defineprojectile FORKSTAB PROJ_WORKSLIKE 4097
defineprojectile FORKSTAB PROJ_SPAWNS -1
defineprojectile FORKSTAB PROJ_EXTRA 10
defineprojectile FORKSTAB PROJ_EXTRA_RAND 2
defineprojectile FORKSTAB PROJ_XREPEAT 3
defineprojectile FORKSTAB PROJ_YREPEAT 3
defineprojectile FORKSTAB PROJ_DECAL -1
defineprojectile FORKSTAB PROJ_RANGE 1152

gamevar WEAPON0_FLAGS 288 1
gamevar WEAPON0_SHOOTS FORKSTAB 1
gamevar WEAPON0_FIREDELAY 2 1
gamevar WEAPON0_SHOTSPERBURST 4 1

state qav_initframes0
setvarvar WEAPON0_TOTALTIME qav_maxframes
mulvarvar WEAPON0_TOTALTIME qav_tpf
divvarvar WEAPON0_TOTALTIME 4
setvarvar qav_frame player[THISACTOR].kickback_pic
mulvarvar qav_frame 4
divvarvar qav_frame qav_tpf
ends

state woodsound_cases
switch picnum
case 5391
	setactorvar[THISACTOR].sparkanim 1
break
default 
	setactorvar[THISACTOR].sparkanim 1 
break
endswitch
ends

//METAL
state metalsound_cases
switch picnum
					case 5127
					case 5129
					case 5130
					case 5131
					case 5132
					case 5133
					case 5158
					case 5168
					case 5176
					case 5177
					case 5178
					case 5179
					case 5217
					case 5218
					case 5219
					case 5221
					case 5222
					case 5223
					case 5224
					case 5235
					case 5275
					case 5276
					case 5281
					case 5282
					case 5310
					case 5311
					case 5312
					case 5313
					case 5314
					case 5315
					case 5316
					case 5317
					case 5318
					case 5319
					case 5320
					case 5322
					case 5323
					case 5324
					case 5325
					case 5326
					case 5327
					case 5328
					case 5329
					case 5330
					case 5331
					case 5332
					case 5333
					case 5334
					case 5335
					case 5336
					case 5337
					case 5340
					case 5341
					case 5342
					case 5343
					case 5344
					case 5367
					case 5368
					case 5375
					case 5382
					case 5383
					case 5384
					case 5385
					case 5386
					case 5416
					case 5418
					case 5430
					case 5431
					case 5432
					case 5435
					case 5436
					case 5437
					case 5440
					case 5441
					case 5442
					case 5443
					case 5444
					case 5445
					case 5446
					case 5450
					case 5451
					case 5452
					case 5456
					case 5465
					case 5486
					case 5495
					case 5496
					case 5506
					case 5507
					case 5508
					case 5523
					case 5532
					case 5555
					case 5556
					case 5557
					case 5558
					case 5559
					case 5583
					case 5584
					case 5585
					case 5586
					case 5590
					case 5591
					case 5603
					case 5604
					case 5606
					case 5607
					case 5608
					case 5609
					case 5610
					case 5611
					case 5612
					case 5613
					case 5614
					case 5615
					case 5616
					case 5617
					case 5618
					case 5619
					case 5620
					case 5621
					case 5622
					case 5623
					case 5625
					case 5630
					case 5631
					case 5689
					case 5735
					case 5763
					case 5914
					case 5916
					case 5974
					case 5978
					case 6175
					case 6176
					case 6180
					case 6184
					case 6185
					case 6217
					case 6220
					case 6275
					case 6472
					case 6473
					case 6474
					case 6785
					case 6786
					case 7159
					case 7409
					case 7411
					case 7573
					case 7577
					case 7580
					case 7582
					case 7583
					case 7596
					case 7597
					case 7666
	setactorvar[THISACTOR].sparkanim 2
break
endswitch
ends

//STONE
state stonesound_cases
switch picnum
					case 5120
					case 5121
					case 5122
					case 5123
					case 5124
					case 5125
					case 5126
					case 5128
					case 5157
					case 5160
					case 5162
					case 5163
					case 5164
					case 5165
					case 5167
					case 5170
					case 5175
					case 5180
					case 5181
					case 5182
					case 5185
					case 5190
					case 5191
					case 5192
					case 5200
					case 5201
					case 5202
					case 5203
					case 5209
					case 5210
					case 5211
					case 5212
					case 5213
					case 5214
					case 5220
					case 5230
					case 5231
					case 5233
					case 5234
					case 5248
					case 5253
					case 5280
					case 5300
					case 5301
					case 5302
					case 5304
					case 5305
					case 5306
					case 5357
					case 5358
					case 5364
					case 5365
					case 5366
					case 5372
					case 5373
					case 5392
					case 5393
					case 5394
					case 5395
					case 5396
					case 5397
					case 5399
					case 5400
					case 5401
					case 5402
					case 5403
					case 5405
					case 5406
					case 5407
					case 5408
					case 5409
					case 5410
					case 5411
					case 5412
					case 5413
					case 5414
					case 5415
					case 5417
					case 5419
					case 5429
					case 5447
					case 5457
					case 5460
					case 5461
					case 5462
					case 5463
					case 5464
					case 5466
					case 5467
					case 5472
					case 5474
					case 5475
					case 5477
					case 5478
					case 5480
					case 5483
					case 5484
					case 5485
					case 5488
					case 5489
					case 5491
					case 5492
					case 5494
					case 5499
					case 5500
					case 5501
					case 5503
					case 5504
					case 5505
					case 5520
					case 5521
					case 5531
					case 5533
					case 5534
					case 5535
					case 5536
					case 5537
					case 5538
					case 5539
					case 5541
					case 5542
					case 5544
					case 5547
					case 5548
					case 5549
					case 5550
					case 5552
					case 5553
					case 5554
					case 5561
					case 5562
					case 5563
					case 5565
					case 5568
					case 5569
					case 5578
					case 5579
					case 5599
					case 5600
					case 5601
					case 5632
					case 5649
					case 5658
					case 5676
					case 5687
					case 5688
					case 5758
					case 5822
					case 6084
					case 6131
					case 6249
					case 6837
					case 6838
					case 7570
					case 7575
					case 7593
					case 7612
					case 7616
					case 9728
	setactorvar[THISACTOR].sparkanim 4
break
endswitch
ends

state meatsound_cases
switch picnum
					case 5350
					case 5351
					case 5352
					case 5353
					case 5354
					case 5355
					case 5356
					case 5359
					case 5360
					case 5361
					case 5362
					case 5363
					case 5422
					case 5423
					case 6215
					case 6216
					case 6236
					case 6237
					case 6238
					case 6239
					case 7581
					case 7586
					case 7587
					case 7588
					case 7589
					case 7590
					case 7591
setvar sparkanim 8
setvar kill_bull 1
break
endswitch
ends

state watersound_cases
switch picnum
	case 5650 //lava
	case 6117 //graz,
	case 6236 //zmei
	case 6250 //blood
	case 8035 //water2
	case 6125
	case 6126
	case 6149
	case 6240
	
setactorvar[THISACTOR].sparkanim 32
setactor[THISACTOR].pal 10
setvar kill_bull 1
break
endswitch
ends

//Удалить
state dirtsound_cases
switch picnum
case 6052
setactorvar[THISACTOR].sparkanim 16
break
endswitch
ends

state weaponpitchforkgame

ifactor SHOTSPARK1
{	
	ifspawnedby APLAYER
	{  
		getactor[THISACTOR].htg_t 6 wallid //wall hit
		ifvarn wallid -1
		ifvare wall[wallid].lotag 0
		{
			getwall[wallid].picnum picnum
			
			state woodsound_cases
			state metalsound_cases
			state stonesound_cases
			state dirtsound_cases
			state meatsound_cases
			state watersound_cases
			
			getwall[wallid].cstat acstat
			ifvarand acstat 16 setvar kill_bull 1 else
			ifvare acstat -32768 setvar kill_bull 1
			ifvarg ROT_PNDIST[wallid] 0 setvar kill_bull 1
			
			ifvare peractor 0
			{
				getwall[wallid].nextsector sectorid
				ifvarn sectorid -1
				{
					getsector[sectorid].lotag lotag
					ifvarn lotag 0 setvar kill_bull 1
					headspritesect spriteid sectorid
					whilevarn spriteid -1 
					{
						getactor[spriteid].picnum picnum
						switch picnum
						case ACTIVATOR
						case TC_LOCKER
						case SECTOREFFECTOR
							setvar kill_bull 1
						break
						endswitch
						nextspritesect spriteid spriteid
					}
				}

				ifvare kill_bull 0
				{
					getwall[wallid].x wallx
					getwall[wallid].y wally
					getwall[wallid].point2 wallid
					getwall[wallid].x wallx2
					getwall[wallid].y wally2
					subvarvar wallx2 wallx
					subvarvar wally2 wally
					getangle wallang wallx2 wally2
					addvar wallang 512
					eqspawn BULLETHOLE
					ifvare sparkanim 1 { setactor[RETURN].cstat 18 setactor[RETURN].pal 9 } else setactor[RETURN].cstat 16
					setactor[RETURN].ang wallang
				}
				setvar peractor 1
			}
		} 
		else
		{
			ifvarn wallid -1 ifvare wall[wallid].lotag 511 killit
			getactor[THISACTOR].htg_t 7 tmp
			ifvarn tmp -1
			{
				getactor[THISACTOR].htg_t 8 tmp //sprite hit
				ifvarn tmp -1
				{
					getactor[tmp].picnum picnum
					switch picnum
					
					//BLOOD
					case ZOMBIE
					case EZOMBIEFALL
					case HERETIC
					case EVILHAND
					case FATRAT
					case GARGOYLE
					case BUTCHER
					case FISH
					case SPIDER
					case HELLDOG
					case PHANTASM
					case BATSLEEP
					case BOSSSPIDER
					case BAT
					case TCHERNOBOG
					case BEAST
					case GILLBEAST
					case APLAYER
					case CIVILIAN
					case DEADMAN1
					case DEADMAN2
					case DEADMAN3
					case DEADMAN4
					case DEADMAN5
					case DEADMAN6
					case DEADMAN7
					case DEADMAN8
					case DEADMAN9
					case DEADMAN10
					case DEADMAN11
					case DEADMAN12
					case 5490 //DEADLADY
					case DEADWOMAN
					case DEADWOMAN2
					case DEADDUKE
					case DEADZOMB
					case DEADLEG
					case DEADDOG
					case MEAT1
					case MEAT2
					case JIBS7
					case JIBS7FLOOR
					case JIBS8
					case JIBS8FLOOR
					case JIBS9
					case JIBS9FLOOR
					case JIBS10
					case JIBS11
					case JIBS12
					case MIM
					case 5854
					case 5807
					case 6095
					case 6096
					case JECK
					case CERBERUS
					setactorvar[THISACTOR].sparkanim 8
					break
					
					//METAL
					case 5178
					case 5179
					case 5224
					case 5275
					case 5281
					case 5282
					case 5284
					case 5285
					case 5286
					case 5287
					case 5311
					case 5321
					case 5338
					case 5339
					case 5348
					case 5349
					case 5383
					case 5384
					case 5385
					case 5386
					case 5404
					case 5436
					case 5437
					case 5438
					case 5439
					case 5450
					case 5451
					case 5452
					case 5502
					case 5583
					case 5584
					case 5585
					case 5586
					case 5588
					case 5589
					case 5603
					case 5604
					case 5605
					case 5622
					case 5669
					case 5680
					case 5681
					case 5683
					case 5684
					case 5685
					case 5695
					case 5699
					case 5700
					case 5704
					case 5710
					case 5716
					case 5748
					case 5760
					case 5761
					case 5769
					case 5775
					case 5796
					case 5797
					case 5798
					case 5812
					case 5813
					case 5814
					case 5828
					case 5830
					case 5831
					case 5834
					case 5835
					case 5865
					case 5866
					case 5868
					case 5873
					case 5892
					case 5914
					case 5916
					case 5919
					case 5955
					case 5974
					case 5978
					case 6068
					case 6074
					case 6081
					case 6082
					case 6083
					case 6088
					case 6093
					case 6097
					case 6102
					case 6103
					case 6164
					case 6166
					case 6167
					case 6175
					case 6176
					case 6180
					case 6184
					case 6185
					case 6190
					case 6191
					case 6192
					case 6193
					case 6194
					case 6195
					case 6196
					case 6197
					case 6200
					case 6210
					case 6211
					case 6218
					case 6219
					case 6275
					case 6281
					case 6282
					case 6283
					case 6284
					case 6468
					case 7298
					case 7393
					case 7409
					case 7411
					case 7415
					case 7424
					case 7425
					case 7427
					case 7440
					case 7582
					case 7583
					case 7592
					case 7596
					case 7597
					case 7599
					case 7602
					case 7613
					case 7652
					case 7653
					case 7654
					case 7655
					case 7656
					case 7657
					case 7658
					case 7660
					case 7661
					case 7662
					case 7663
					case 7664
					case 7665
					case 7666
					case 7668
					case 7671
					case 7699
					case 8660

					setactorvar[THISACTOR].sparkanim 2
					break
					case AIRBALL
					//case GLASS4
					case SPIDERNET
					//nullop
					break
					
					//STONE
					case 5171
					case 5172
					case 5307
					case 5308
					case 5309
					case 5346
					case 5347
					case 5358
					case 5369
					case 5372
					case 5448
					case 5459
					case 5543
					case 5545
					case 5546
					case 5654
					case 5655
					case 5656
					case 5657
					case 5670
					case 5671
					case 5672
					case 5673
					case 5692
					case 5693
					case 5696
					case 5697
					case 5698
					case 5720
					case 5721
					case 5742
					case 5752
					case 5754
					case 5757
					case 5762
					case 5774
					case 5799
					case 5815
					case 5819
					case 5821
					case 5824
					case 5825
					case 5826
					case 5827
					case 5860
					case 5924
					case 5925
					case 5926
					case 5928
					case 5943
					case 6053
					case 6062
					case 6078
					case 6084
					case 6279
					case 6289
					case 6650
					case 6846
					case 7437
					case 7614
					setactorvar[THISACTOR].sparkanim 4
					break
					
					default //WOOD
					ifvarn actorvar[tmp].obj_statnum 15 setactorvar[THISACTOR].sparkanim 1 else
					{
						getactorvar[tmp].obj_extra obj_extra
						ifvarg obj_extra 0 
						{ 
							getactorvar[tmp].obj_lotag obj_lotag
							ifvare obj_lotag 3 setactorvar[THISACTOR].sparkanim 1 else 
							ifvare obj_lotag 4 setactorvar[THISACTOR].sparkanim 4 else
							ifvare obj_lotag 5 setactorvar[THISACTOR].sparkanim 1 else
							ifvare obj_lotag 6 setactorvar[THISACTOR].sparkanim 1 else
							ifvare obj_lotag 8 setactorvar[THISACTOR].sparkanim 4 else
							ifvare obj_lotag 15 setactorvar[THISACTOR].sparkanim 8 else
							ifvare obj_lotag 16 setactorvar[THISACTOR].sparkanim 8 else
							setactorvar[THISACTOR].sparkanim 2 
						} else setactorvar[THISACTOR].sparkanim 1
					}
					break
					endswitch
				} 
				else
				{
					getactor[THISACTOR].htg_t 7 tmp //sector hit
					ifvarn tmp -1
					{
						getplayer[THISACTOR].horiz phoriz
						subvar phoriz 100
						ifvarl phoriz 0
						{
							
							ifvarand sector[tmp].floorstat 1 killit
							getsector[tmp].floorpicnum picnum
							state woodsound_cases
							state metalsound_cases
							state stonesound_cases
							state dirtsound_cases
							state meatsound_cases
							state watersound_cases
						} else ifvarg phoriz 0
						{
							ifvarand sector[tmp].ceilingstat 1 killit
							getsector[tmp].ceilingpicnum picnum
							state woodsound_cases
							state metalsound_cases
							state stonesound_cases
							state dirtsound_cases
							state meatsound_cases
							state watersound_cases
						}
					}
				}
			}
		}
	}
	
	getactor[THISACTOR].htg_t 7 tmp
	ifvarn tmp -1
	{
		getactor[THISACTOR].htg_t 8 tmp //sprite hit
		ifvarn tmp -1
		{
			getactor[tmp].picnum picnum
			switch picnum
			case APLAYER
			case ZOMBIE
			case EZOMBIEFALL
			case HERETIC
			case EVILHAND
			case FATRAT
			case GARGOYLE
			case BUTCHER
			case FISH
			case SPIDER
			case HELLDOG
			case PHANTASM
			case BATSLEEP
			case BOSSSPIDER
			case BAT
			case GILLBEAST
			case CIVILIAN
			case DEADMAN1
			case DEADMAN2
			case DEADMAN3
			case DEADMAN4
			case DEADMAN5
			case DEADMAN6
			case DEADMAN7
			case DEADMAN8
			case DEADMAN9
			case DEADMAN10
			case DEADMAN11
			case DEADMAN12
			case 5490 //DEADLADY
			case DEADWOMAN
			case DEADWOMAN2
			case DEADDUKE
			case DEADZOMB
			case DEADLEG
			case DEADDOG
			case MEAT1
			case MEAT2
			case JIBS7
			case JIBS7FLOOR
			case JIBS8
			case JIBS8FLOOR
			case JIBS9
			case JIBS9FLOOR
			case JIBS10
			case JIBS11
			case JIBS12
			case MIM
			case 5854
			case 5807
			case 6095
			case 6096
			case JECK
			case CERBERUS
			case TCHERNOBOG
			case BEAST
			setactorvar[THISACTOR].sparkanim 8
			break
			endswitch
		}
	} 
	
}
ends


state pitchforkdisplay

setvarvar qav_maxframes 10
setvar qav_tpf 5
state qav_initframes0

switch qav_frame
case 0
setvar tilenumweapon 3222
setvar orientationweapon 0
setvar xweapon -1
setvar yweapon -20
setvar qav_sh 0
setvarvar qav_pal 0
setvar weapon_zoom 10000
setvar qav_ang 0
state qav2tc_state
break
case 1
setvar tilenumweapon 3223
setvar xweapon -3
setvar yweapon -28
setvar weapon_zoom 10000
state qav2tc_state
break
case 2
setvar tilenumweapon 3224
setvar xweapon -3
setvar yweapon -38
setvar weapon_zoom 10000
state qav2tc_state
break
case 3
setvar tilenumweapon 3224
setvar xweapon -4
setvar yweapon -39
setvar weapon_zoom 10000
state qav2tc_state
break
case 4
setvar tilenumweapon 3224
setvar xweapon -4
setvar yweapon -39
setvar weapon_zoom 10000
state qav2tc_state
break
case 5
setvar tilenumweapon 3224
setvar xweapon -2
setvar yweapon -32
setvar weapon_zoom 10000
state qav2tc_state
break
case 6
setvar tilenumweapon 3223
setvar xweapon -2
setvar yweapon -28
setvar weapon_zoom 10000
state qav2tc_state
break
case 7
setvar tilenumweapon 3223
setvar xweapon -1
setvar yweapon -21
setvar weapon_zoom 10000
state qav2tc_state
break
case 8
setvar tilenumweapon 3222
setvar xweapon -1
setvar yweapon -20
setvar weapon_zoom 10000
state qav2tc_state
break
case 9
setvar tilenumweapon 3222
setvar xweapon -1
setvar yweapon -20
setvar weapon_zoom 10000
state qav2tc_state
break
endswitch

ends

state pitchforkshotrange
ifvare CURRWEAP 0
{
	setvar ANGRANGE 1
	setvar ZRANGE 1

	getplayer[THISACTOR].posx x
	getplayer[THISACTOR].posy y
	getplayer[THISACTOR].ang ang

	switch prongcount
	case 0
		getplayer[THISACTOR].posx savex
		getplayer[THISACTOR].posy savey
	case 1
		subvar ang 512
		setvarvar mx x
		addvar mx 50
		rotatepoint x y mx y ang temp my
		setplayer[THISACTOR].posx temp
		setplayer[THISACTOR].posy my
	break
	case 2
		addvar ang 512
		setvarvar mx x
		addvar mx 150
		rotatepoint x y mx y ang temp my
		setplayer[THISACTOR].posx temp
		setplayer[THISACTOR].posy my
	break
	case 3
		subvar ang 512
		setvarvar mx x
		addvar mx 50
		rotatepoint x y mx y ang temp my
		setplayer[THISACTOR].posx temp
		setplayer[THISACTOR].posy my
		
		setplayer[THISACTOR].posx savex
		setplayer[THISACTOR].posy savey
	break
	endswitch
	
	addvar prongcount 1
	ifvarg prongcount 3 setvar prongcount 0
}
ends