// include ENHANCE.con

define SECTOREFFECTOR 1
define ACTIVATOR 2
define RAKETTIALAS 3575

define PISTE 1669
define SKULL 3714
define ME262 465
define TIGERTANK 4180
define COLAX 51
define LADDER 1038
define WSPLASH 2380
define NUKE 1263
define PAPER 4460
define FLATHOLE 67
define FLOOR_BURNT 76
define INFRARED 50
define SDFK21 4216
define AMMUS2 4805
define GLOW 3285
define PURPLELAVA 4280
define RANDOMEXPLOSION 316 
define ROCKET 266
define FLARESMOKE 3284
define JUNKERS 1391
define ATLAUNCHER 4292 
define PKSPAWNER 2334
define DOG 4240
define DEADTANK 4196
define SNAKEYE 251
define TOUCHPLATE 3
define ACTIVATORLOCKED 4
define MUSICANDSFX 5
define FREEZEAMMO 37
define LOCATORS 6
define CYCLER 7
define MASTERSWITCH 8
define RESPAWN 9
define GPSPEED 10
define ARROW 20
define FIRSTGUNSPRITE 21
define CHAINGUNSPRITE 22
define RPGSPRITE 23
define WACOWINDER       3500
define FREEZESPRITE 24
define SHRINKERSPRITE 25
define HEAVYHBOMB 26
define TRIPBOMBSPRITE 27
define SHOTGUNSPRITE 28
                     // 29
define DEVISTATORSPRITE 35

define HEALTHBOX 30
define AMMOBOX 31
define GROWSPRITEICON 32
define INVENTORYBOX 33
define MINE 38
define AMMO 40
define BATTERYAMMO 41
                  //  42
define DEVISTATORAMMO 43

define TRIPFLARE 44
define CRYSTALAMMO 46
define HBOMBAMMO 47
define AMMOLOTS 48
define SHOTGUNAMMO 49
define COLA 4287
define SIXPAK 52
define FIRSTAID 53
define SHIELD 54
define STEROIDS 55
define AIRTANK 56
define JETPACK 57
define HEATSENSOR 59
define ACCESSCARD 60
define RKONE1 263
define BOOTS 61
define MIRRORBROKE 70
define MOONSKY1 80
define MOONSKY2 81
define MOONSKY3 82
define MOONSKY4 83
define BIGORBIT1 84
define BIGORBIT2 85
define BIGORBIT3 86
define BIGORBIT4 87
define BIGORBIT5 88
define LA 89
define ATOMICHEALTH 4286
define TECHLIGHT2 120
define TECHLIGHTBUST2 121
define TECHLIGHT4 122
define TECHLIGHTBUST4 123
define WALLLIGHT4 124
define WALLLIGHTBUST4 125
define ACCESSSWITCH 130
define SLOTDOOR 132
define LIGHTSWITCH 134
define SPACEDOORSWITCH 136
define SPACELIGHTSWITCH 138
define FRANKENSTINESWITCH 140
define NUKEBUTTON 142
define MULTISWITCH 146
define DOORTILE5 150
define DOORTILE6 151
define DOORTILE1 152
define DOORTILE2 153
define DOORTILE3 154
define DOORTILE4 155
define DOORTILE7 156
define DOORTILE8 157
define DOORTILE9 158
define DOORTILE10 159
define DOORSHOCK 160
define DIPSWITCH 162
define DIPSWITCH2 164
define TECHSWITCH 166
define DIPSWITCH3 168
define ACCESSSWITCH2 170
define REFLECTWATERTILE 180
define FLOORSLIME 200
define BIGFORCE 230
define EPISODE 247
define MASKWALL9 255
define W_LIGHT 260
define SCREENBREAK1 264

define SCREENBREAK2 1
define SCREENBREAK3 2
define SCREENBREAK4 3
define SCREENBREAK5 4
define SCREENBREAK6 5
define SCREENBREAK7 6
define SCREENBREAK8 7
define SCREENBREAK9 8
define SCREENBREAK10 9
define SCREENBREAK11 10
define SCREENBREAK12 1
define SCREENBREAK13 12


define MASKWALL1 285
define W_TECHWALL1 293
define W_TECHWALL2 297
define W_TECHWALL3 301
define W_TECHWALL4 305
define WATERTILE2 336
define BPANNEL1 341
define PANNEL1 342
define PANNEL2 343
define WATERTILE 344
define STATIC 351
define W_SCREENBREAK 357
define W_HITTECHWALL3 360
define W_HITTECHWALL4 361
define W_HITTECHWALL2 362
define W_HITTECHWALL1 363
define MASKWALL10 387
define MASKWALL11 391
define DOORTILE22 395
define FANSPRITE 407
define FANSPRITEBROKE 411
define FANSHADOW 412
define FANSHADOWBROKE 416
define DOORTILE18 447
define DOORTILE19 448
define DOORTILE20 449
define SPACESHUTTLE 487
define SATELLITE 489
define VIEWSCREEN2 499
define VIEWSCREENBROKE 501
define VIEWSCREEN 502
define GLASS 503
define GLASS2 504
define STAINGLASS1 510
define MASKWALL5 514
define SATELITE 516
define FUELPOD 517
define SLIMEPIPE 538
define CRACK1 546
define CRACK2 547
define CRACK3 548
define CRACK4 549
define FOOTPRINTS 550
define DOMELITE 551
define CAMERAPOLE 554
define CHAIR1 556
define CHAIR2 557
define BROKENCHAIR 559
define MIRROR 560
define WATERFOUNTAIN 563
define WATERFOUNTAINBROKE 567
define FEMMAG1 568
define TOILET 569
define STALL 571
define STALLBROKE 573
define FEMMAG2 577
define REACTOR2 578
define REACTOR2BURNT 579
define REACTOR2SPARK 580
define GRATE1 595
define BGRATE1 596
define SOLARPANNEL 602
define NAKED1 604
define ANTENNA 607
define MASKWALL12 609
define TOILETBROKE 615
define PIPE2 616
define PIPE1B 617
define PIPE3 618
define PIPE1 619
define CAMERA1 621
define BRICK 626
define SPLINTERWOOD 630
define PIPE2B 633
define BOLT1 634
define W_NUMBERS 640
define WATERDRIP 316
define WATERBUBBLE 661
define WATERBUBBLEMAKER 662
define W_FORCEFIELD 663
define VACUUM 669
define FOOTPRINTS2 672
define FOOTPRINTS3 673
define FOOTPRINTS4 674
define EGG 675
define SCALE 678
define CHAIR3 680
define CAMERALIGHT 685
define MOVIECAMERA 686
define IVUNIT 689
define POT1 694
define POT2 695
define POT3 697
define PIPE3B 700
define WALLLIGHT3 701
define WALLLIGHTBUST3 702
define WALLLIGHT1 703
define WALLLIGHTBUST1 704
define WALLLIGHT2 705
define WALLLIGHTBUST2 706
define LIGHTSWITCH2 712
define WAITTOBESEATED 716
define DOORTILE14 717
define STATUE 753
define MIKE 762
define VASE 765
define SUSHIPLATE1 768
define SUSHIPLATE2 769
define SUSHIPLATE3 774
define SUSHIPLATE4 779
define DOORTILE16 781
define SUSHIPLATE5 792
define OJ 806
define MASKWALL13 830
define HURTRAIL 859
define POWERSWITCH1 860
define LOCKSWITCH1 862
define POWERSWITCH2 864
define ATM 867
define STATUEFLASH 869
define ATMBROKE 888
define BIGHOLE2 893
define STRIPEBALL 901
define QUEBALL 902
define POCKET 903
define WOODENHORSE 904
define TREE1 908
define TREE2 910
define CACTUS 911
define MASKWALL2 913
define MASKWALL3 914
define MASKWALL4 915
define FIREEXT 916
define TOILETWATER 921
define NEON1 925
define NEON2 926
define CACTUSBROKE 939
define BOUNCEMINE 940
define BROKEFIREHYDRENT 950
define BOX 951
define BULLETHOLE 952
define BOTTLE1 954
define BOTTLE2 955
// define BOTTLE3 956
define BOTTLE4 957
define FEMPIC5 963
define FEMPIC6 964
define FEMPIC7 965
define HYDROPLANT 969
define OCEANSPRITE1 971
define OCEANSPRITE2 972
define OCEANSPRITE3 973
define OCEANSPRITE4 974
define OCEANSPRITE5 975
define GENERICPOLE 977
define CONE 978
define HANGLIGHT 979
define HYDRENT 981
define MASKWALL14 988
define TIRE 990
define PIPE5 994
define PIPE6 995
define PIPE4 996
define PIPE4B 997
define BROKEHYDROPLANT 1003
define PIPE5B 1005
define NEON3 1007
define NEON4 1008
define NEON5 1009
define BOTTLE5 1012
define BOTTLE6 1013
define BOTTLE8 1014
define SPOTLITE 1020
define HANGOOZ 1022
define MASKWALL15 1024
define BOTTLE7 1025
define HORSEONSIDE 1026
define GLASSPIECES 1031
define HORSELITE 1034
define NEON6 1046
define MASKWALL6 1059
define CLOCK 1060
define RUBBERCAN 1062
define BROKENCLOCK 1067
define PLUG 1069
define OOZFILTER 1079
define FLOORPLASMA 1082
define REACTOR 1088
define REACTORSPARK 1092
define REACTORBURNT 1096
define DOORTILE15 1102
define HANDSWITCH 1111
define CIRCLEPANNEL 1113
define CIRCLEPANNELBROKE 1114
define PULLSWITCH 1122
define MASKWALL8 1124
define BIGHOLE 1141
define ALIENSWITCH 1142
define DOORTILE21 1144
define HANDPRINTSWITCH 1155
define BOTTLE10 1157
define BOTTLE11 1158
define BOTTLE12 1159
define BOTTLE13 1160
define BOTTLE14 1161
define BOTTLE15 1162
define BOTTLE16 1163
define BOTTLE17 1164
define BOTTLE18 1165
define BOTTLE19 1166
define DOORTILE17 1169
define MASKWALL7 1174
define JAILBARBREAK 1175
define DOORTILE11 1178
define DOORTILE12 1179
define VENDMACHINE 1212
define VENDMACHINEBROKE 1214
define COLAMACHINE 1215
define COLAMACHINEBROKE 1217
define CRANEPOLE 1221
define CRANE 1222
define BARBROKE 1225
define BLOODPOOL2 1226
define NUKEBARREL 1227
define NUKEBARRELDENTED 1228
define NUKEBARRELLEAKED 1229
define CANWITHSOMETHING 1232
define MONEY2 1233
define BANNER 1236
define EXPLODINGBARREL 1238
define EXPLODINGBARREL2 1239
define FIREBARREL 1240
define SEENINE 1247
define SEENINEDEAD 1248
define STEAM 1250
define CEILINGSTEAM 1255
define PIPE6B 1260
define TRANSPORTERBEAM 1261
define RAT 1267
define TRASH 1272
define FEMPIC1 1280
define FEMPIC2 1289
define BLANKSCREEN 1293
define PODFEM1 1295
define FEMPIC3 1298
define FEMPIC4 1306
define FEM1 1313
define PIIKKI 1316
define FEM3 1322
define FEM5 1323
define MAIL2 4410
define BLOODYPOLE 1324
define FEM4 1326
define FEM6 1333
define FEM6PAD 1335
define FEM8 1338
define HELECOPT 1346
define FETUSJIB 1347
define HOLODUKE 1348
define SPACEMARINE 1353
define FETUS 1358
define FETUSBROKE 1359
define MONK 1352
define LUKE 1354
define COOLEXPLOSION1 1360
define WATERSPLASH2 1380
define SCRATCH 1393
define 5INCH 250
define FEM7 1397
define APLAYERTOP 1400
define APLAYER 1405
define PLAYERONWATER 1420
define DUKELYINGDEAD 1518
define DUKETORSO 1520
define DUKEGUN 1528
define DUKELEG 1536
define BLOOD 1620
define FIRELASER 1625
define TRANSPORTERSTAR 1630
define SPIT 1636
define LOOGIE 1637
define FIST 1640
define FREEZEBLAST 1641
define DEVISTATORBLAST 1642
define SHRINKSPARK 1646
define TONGUE 1647
define MORTER 1740
define SHRINKEREXPLOSION 1656
define RADIUSEXPLOSION 1670
define FORCERIPPLE 1671
define LIZTROOP 1680
// define LIZTROOPSTAYPUT 1682
// define LIZTOP 1705
define GERMANSNIPER 1715 
// define LIZTROOPDSPRITE 1734
define LIZTROOPDUCKING 1744 
define HEADJIB1 1768
define ARMJIB1 1772
define LEGJIB1 1776
define OCTATOP 1845
define OCTADEADSPRITE 1855
define INNERJAW 1860
define EXPLOSION2 1890
define RECON 1960
define PIGCOP 2000 
define PIGCOPSTAYPUT 2001 
define PIGCOPDEADSPRITE 2060
define PIGTOP 2061
define LIZMAN 2120  
define LIZMANSTAYPUT 2121
define LIZMANFEEDING 2160
define LIZMANJUMP 2166
define LIZMANDEADSPRITE 2185
define NAPALM 2200
define KARVENNIN 2200
define LIZMANHEAD1 2201
define LIZMANARM1 2205
define LIZMANLEG1 2209
define EXPLOSION2BOT 2219
define USERWEAPON 2235
define HEADERBAR 2242
define JIBS1 2245
define GROWSPARK 2448
define JIBS2 2250
define JIBS3 2255
define JIBS4 2260
define JIBS5 2265
define BURNING 2270
define FIRE 2271
define JIBS6 2286
define BLOODSPLAT1 2296
define BLOODSPLAT3 2297
define BLOODSPLAT2 2298
define BLOODSPLAT4 2299
define OOZ 2300
define WALLBLOOD1 2301
define WALLBLOOD2 2302
define WALLBLOOD3 2303
define WALLBLOOD4 2304
define WALLBLOOD5 2305
define WALLBLOOD6 2306
define WALLBLOOD7 2307
define WALLBLOOD8 2308
define BURNING2 2310
define FIRE2 2311
define CRACKKNUCKLES 2324
define SMALLSMOKE 2329
define SMALLSMOKEMAKER 2330
define FLOORFLAME 2333
define ROTATEGUN 4240
define GREENSLIME 2370
define WATERDRIPSPLASH 2380
define SCRAP6 2390
define SCRAP1 2400
define SCRAP2 2404
define SCRAP3 2408
define SCRAP4 2412
define SCRAP5 2416
define BETAVERSION 2440
define PLAYERISHERE 2442
define PLAYERWASHERE 2443
define SELECTDIR 2444
define F1HELP 2445
define NOTCHON 2446
define NOTCHOFF 2447
define BACKGROUNDSCREEN 2448
define DUKEICON 2452
define BADGUYICON 2453
define FOODICON 2454
define GETICON 2455
define MENUSCREEN 2456
define MENUBAR 2457
define KILLSICON 2458
define FIRSTAID_ICON 2460
define HEAT_ICON 2461
define BOTTOMSTATUSBAR 2462
define BOOT_ICON 72
define FRAGBAR 2465
define JETPACK_ICON 2467
define AIRTANK_ICON 2468
define STEROIDS_ICON 2469
define HOLODUKE_ICON 2470
define ACCESS_ICON 2471
define DIGITALNUM 2472
define DUKECAR 2491
define CAMCORNER 2482
define CAMLIGHT 2484
define LOGO 2485
define TITLE 2486
define NUKEWARNINGICON 2487
define MOUSECURSOR 2488
define SLIDEBAR 2489
define DREALMS 2492
define BETASCREEN 2493
define WINDOWBORDER1 2494
define TEXTBOX 2495
define WINDOWBORDER2 2496
define DUKENUKEM 2497
define THREEDEE 2498
define INGAMEDUKETHREEDEE 2499
define DEVISTATOR 2510
define KNEE 2521
define CROSSHAIR 2523
define FIRSTGUN 2524
define FIRSTGUNRELOAD 2528
define FALLINGCLIP 2530
define CLIPINHAND 2531
define HAND 2532
define SHELL 2533
define SHOTGUNSHELL 2535
define CHAINGUN 2536
define RPGGUN 2544
define RPGMUZZLEFLASH 2545
define FREEZE 2548
define CATLITE 2552
define SHRINKER 2556
define HANDHOLDINGLASER 2563
define TRIPBOMB 2566
define LASERLINE 2567
define HANDHOLDINGACCESS 2568
define HANDREMOTE 2570
define HANDTHROW 2573
define TIP 2576
define GLAIR 2578
define SCUBAMASK 2581
define SPACEMASK 2584
define FORCESPHERE 2590
define SHOTSPARK1 2595
define RPG 2605
define LASERSITE 2612
define SHOTGUN 2613
define SPINNINGNUKEICON 2813
define BIGFNTCURSOR 2820
define SMALLFNTCURSOR 2821
define STARTALPHANUM 2822
define ENDALPHANUM 2915
define BIGALPHANUM 2940
define BIGPERIOD 3002
define BIGCOMMA 3003
define BIGX 3004
define BIGQ 3005
define BIGSEMI 3006
define BIGCOLIN 3007
define THREEBYFIVE 3010
define BIGAPPOS 3022
define BLANK 3026
define MINIFONT 3072
define BUTTON1 3164
define GLASS3 3187
define RESPAWNMARKERRED 3190
define RESPAWNMARKERYELLOW 3200
define RESPAWNMARKERGREEN 3210
define BONUSSCREEN 3240
define VIEWBORDER 3250
define VICTORY1 3260
define ORDERING 3270
define TEXTSTORY 3280
define BORNTOBEWILDSCREEN 3370
define FEM9 3449
define FOOTPRINT 3701
define POOP 3998
define FRAMEEFFECT1 3999


define KNEE_WEAPON         0
define PISTOL_WEAPON       1
define SHOTGUN_WEAPON      2
define CHAINGUN_WEAPON     3
define RPG_WEAPON          4
define HANDBOMB_WEAPON     5
define SHRINKER_WEAPON     6
define DEVISTATOR_WEAPON   7
define TRIPBOMB_WEAPON     8
define FREEZE_WEAPON       9
define GROW_WEAPON         11
define MP40_BURST          12

define faceplayer 1
define geth 2
define getv 4
define randomangle 8
define faceplayerslow 16
define spin 32
define faceplayersmart 64
define fleeenemy 128
define jumptoplayer 257
define seekplayer 512
define furthestdir 1024
define dodgebullet 4096


define NO       0
define YES      1

// Defines for 'useractor' keyword
define notenemy       0
define enemy          1
define enemystayput   2

define pstanding 1
define pwalking 2
define prunning 4
define pducking 8
define pfalling 16
define pjumping 32
define phigher 64
define pwalkingback 128
define prunningback 256
define pkicking 512
define pshrunk 1024
define pjetpack 2048
define ponsteroids 4096
define ponground 8192
define palive 16384
define pdead 32768
define pfacing 65536


define GET_STEROIDS     0
define GET_SHIELD       1
define GET_SCUBA        2
define GET_HOLODUKE     3
define GET_JETPACK      4
define GET_ACCESS       6
define GET_HEATS        7
define GET_FIRSTAID     9
define GET_BOOTS       10


define KICK_HIT                         0
define PISTOL_RICOCHET                  1
define PISTOL_BODYHIT                   2
define PISTOL_FIRE                      3
define EJECT_CLIP                       4
define INSERT_CLIP                      5
define CHAINGUN_FIRE                    6
define RPG_SHOOT                        7
define POOLBALLHIT                      8
define RPG_EXPLODE                      9
define CAT_FIRE                        10
define SHRINKER_FIRE                   11
define ACTOR_SHRINKING                 12
define PIPEBOMB_BOUNCE                 13
define PIPEBOMB_EXPLODE                14
define LASERTRIP_ONWALL                15
define LASERTRIP_ARMING                16
define LASERTRIP_EXPLODE               17
define VENT_BUST                       18
define GLASS_BREAKING                  19
define GLASS_HEAVYBREAK                20
define SHORT_CIRCUIT                   21
define ITEM_SPLASH                     22
define DUKE_BREATHING                  23
define DUKE_EXHALING                   24
define DUKE_GASP                       25
define SLIM_RECOG                      26
define ENDSEQVOL3SND1                  27
define DUKE_URINATE                    28
define ENDSEQVOL3SND2                  29
define ENDSEQVOL3SND3                  30
define OCTA_ROAM                       31
define DUKE_PASSWIND                   32
define DUKE_CRACK                      33
define SLIM_ATTACK                     34
define SOMETHINGHITFORCE               35
define DUKE_DRINKING                   36
define DUKE_KILLED1                    37
define DUKE_GRUNT                      38
define DUKE_HARTBEAT                   39
define DUKE_ONWATER                    40
define DUKE_DEAD                       41
define DUKE_LAND                       42
define DUKE_WALKINDUCTS                43
define DUKE_GLAD                       44
define DUKE_YES                        45
define DUKE_HEHE                       46
define DUKE_SHUCKS                     47
define DUKE_UNDERWATER                 48
define DUKE_JETPACK_ON                 49
define DUKE_JETPACK_IDLE               50
define DUKE_JETPACK_OFF                51
define LIZTROOP_GROWL                  52
define LIZTROOP_TALK1                  53
define LIZTROOP_TALK2                  54
define LIZTROOP_TALK3                  55
define DUKETALKTOBOSS                  56
define LIZCAPT_GROWL                   57
define LIZCAPT_TALK1                   58
define LIZCAPT_TALK2                   59
define LIZCAPT_TALK3                   60
define LIZARD_BEG                      61
define LIZARD_PAIN                     62
define LIZARD_DEATH                    63
define M27                             64
define DRONE1_HISSRATTLE               65
define DRONE1_HISSSCREECH              66
define DUKE_TIP2                       67
define FLESH_BURNING                   68
define SQUISHED                        69
define TELEPORTER                      70
define ELEVATOR_ON                     71
define DUKE_KILLED3                    72
define ELEVATOR_OFF                    73
define DOOR_OPERATE1                   74
define SUBWAY                          75
define SWITCH_ON                       76
define FAN                             77
define DUKE_GETWEAPON3                 78
define FLUSH_TOILET                    79
define HOVER_CRAFT                     80
define EARTHQUAKE                      81
define INTRUDER_ALERT                  82
define END_OF_LEVEL_WARN               83
define ENGINE_OPERATING                84
define REACTOR_ON                      85
define COMPUTER_AMBIENCE               86
define GEARS_GRINDING                  87
define BUBBLE_AMBIENCE                 88
define MACHINE_AMBIENCE                89
define SEWER_AMBIENCE                  90
define WIND_AMBIENCE                   91
define SOMETHING_DRIPPING              92
define STEAM_HISSING                   93
define THEATER_BREATH                  94
define BAR_MUSIC                       95
define BOS1_ROAM                       96
define BOS1_RECOG                      97
define BOS1_ATTACK1                    98
define BOS1_PAIN                       99
define BOS1_DYING                     100
define BOS2_ROAM                      101
define BOS2_RECOG                     102
define BOS2_ATTACK                    103
define BOS2_PAIN                      104
define BOS2_DYING                     105
define GETATOMICHEALTH                106
define DUKE_GETWEAPON2                107
define PREDSFX2                       108
define SHOTGUN_FIRE                   109
define PRED_ROAM                      110
define PRED_RECOG                     111
define PRED_ATTACK                    112
define PRED_PAIN                      113
define PRED_DYING                     114
define CAPT_ROAM                      115
define CAPT_ATTACK                    116
define CAPT_RECOG                     117
define CAPT_PAIN                      118
define CAPT_DYING                     119
define PIG_ROAM                       120
define PIG_RECOG                      121
define AK47                           122
define PIG_PAIN                       123
define PIG_DYING                      124
define M21                            125
define M22                            126
define M23                            127
define M24                            128
define M25                            129
define M1                             130
define M2                             131
define M3                             132
define M5                             133
define M6                             134
define MEDIC11                        135
define MEDIC22                        136
define MEDIC33                        137
define SOLIC11                        138
define M22CAP                         139
define SOLIC33                        140
define M28                            141
define OCTA_ATTACK1                   142
define LASER1                         143
define LASER2                         144
define TURR_ROAM                      145
define TURR_RECOG                     146
define TURR_ATTACK                    147
define DUMPSTER_MOVE                  148
define SLIM_DYING                     149
define PREDALOAD                      150
define PREDAPAIN1                     151
define PREDAPAIN2                     152
define PREDSFX1                       153
define BOS1_ATTACK2                   154
define COMM_SPIN                      155
define BOS1_WALK                      156
define M4                             157
define THUD                           158
define OCTA_ATTACK2                   159
define WIERDSHOT_FLY                  160
define TURR_PAIN                      161
define TURR_DYING                     162
define SLIM_ROAM                      163
define LADY_SCREAM                    164
define DOOR_OPERATE2                  165
define DOOR_OPERATE3                  166
define DOOR_OPERATE4                  167
define BORNTOBEWILDSND                168
define SHOTGUN_COCK                   169
define GENERIC_AMBIENCE1              170
define GENERIC_AMBIENCE2              171
define GENERIC_AMBIENCE3              172
define GENERIC_AMBIENCE4              173
define GENERIC_AMBIENCE5              174
define GENAMB6                        175
define PREDEYES                       176
define GENERIC_AMBIENCE17             177
define GENERIC_AMBIENCE18             178
define GENERIC_AMBIENCE19             179
define GENERIC_AMBIENCE20             180
define GENERIC_AMBIENCE21             181
define GENERIC_AMBIENCE22             182
define SECRETLEVELSND                 183
define GENERIC_AMBIENCE8              184
define GENERIC_AMBIENCE9              185
define GENERIC_AMBIENCE10             186
define GENERIC_AMBIENCE11             187
define GENERIC_AMBIENCE12             188
define GENERIC_AMBIENCE13             189
define GENERIC_AMBIENCE14             190
define GENERIC_AMBIENCE15             192
define GENERIC_AMBIENCE16             193
define FIRE_CRACKLE                   194
define BONUS_SPEECH1                  195
define BONUS_SPEECH2                  196
define BONUS_SPEECH3                  197
define M26                            198
define BONUS_SPEECH4                  199
define DUKE_LAND_HURT                 200
define DUKE_HIT_STRIPPER1             201
define DUKE_TIP1                      202
define DUKE_KILLED2                   203
define PRED_ROAM2                     204
define PIG_ROAM2                      205
define DUKE_GETWEAPON1                206
define DUKE_SEARCH2                   207
define DUKE_CRACK2                    208
define DUKE_SEARCH                    209
define DUKE_GET                       210
define DUKE_LONGTERM_PAIN             211
define MONITOR_ACTIVE                 212
define NITEVISION_ONOFF               213
define DUKE_HIT_STRIPPER2             214
define DUKE_CRACK_FIRST               215
define DUKE_USEMEDKIT                 216
define DUKE_TAKEPILLS                 217
define DUKE_PISSRELIEF                218
define SELECT_WEAPON                  219
define WATER_GURGLE                   220
define DUKE_GETWEAPON4                221
define JIBBED_ACTOR1                  222
define JIBBED_ACTOR2                  223
define JIBBED_ACTOR3                  224
define JIBBED_ACTOR4                  225
define JIBBED_ACTOR5                  226
define JIBBED_ACTOR6                  227
define JIBBED_ACTOR7                  228
define DUKE_GOTHEALTHATLOW            229
define BOSSTALKTODUKE                 230
define WAR_AMBIENCE1                  231
define WAR_AMBIENCE2                  232
define WAR_AMBIENCE3                  233
define WAR_AMBIENCE4                  234
define WAR_AMBIENCE5                  235
define WAR_AMBIENCE6                  236
define WAR_AMBIENCE7                  237
define WAR_AMBIENCE8                  238
define WAR_AMBIENCE9                  239
define WAR_AMBIENCE10                 240
define A_TALK                         241
define ALIEN_TALK2                    242
define EXITMENUSOUND                  243
define STARTSND                       244
define DUKE_SCREAM                    245
define SHRINKER_HIT                   246
define RATTY                          247
define INTO_MENU                      248
define BONUSMUSIC                     249
define DUKE_BOOBY                     250
define DUKE_TALKTOBOSSFALL            251
define DUKE_LOOKINTOMIRROR            252
define PIG_ROAM3                      253
define KILLME                         254
define M7                             255
define SPACE_DOOR1                    256
define SPACE_DOOR2                    257
define SPACE_DOOR3                    258
define SPACE_DOOR4                    259
define SPACE_DOOR5                    260
define ALIEN_ELEVATOR1                261
define VAULT_DOOR                     262
define JIBBED_ACTOR13                 263
define DUKE_GETWEAPON6                264
define JIBBED_ACTOR8                  265
define JIBBED_ACTOR9                  266
define JIBBED_ACTOR10                 267
define JIBBED_ACTOR11                 268
define JIBBED_ACTOR12                 269
define DUKE_KILLED4                   270
define DUKE_KILLED5                   271
define ALIEN_SWITCH1                  272
define DUKE_STEPONFECES               273
define DUKE_LONGTERM_PAIN2            274
define DUKE_LONGTERM_PAIN3            275
define DUKE_LONGTERM_PAIN4            276
define COMPANB2                       277
define KTIT                           278
define HELICOP_IDLE                   279
define STEPNIT                        280
define SEA                            281
define SPACE_AMBIENCE2                282
define SLIM_HATCH                     283
define RIPHEADNECK                    284
define FOUNDJONES                     285
define ALIEN_DOOR1                    286
define ALIEN_DOOR2                    287
define ENDSEQVOL3SND4                 288
define ENDSEQVOL3SND5                 289
define ENDSEQVOL3SND6                 290
define ENDSEQVOL3SND7                 291
define ENDSEQVOL3SND8                 292
define ENDSEQVOL3SND9                 293
define WHIPYOURASS                    294
define ENDSEQVOL2SND1                 295
define ENDSEQVOL2SND2                 296
define ENDSEQVOL2SND3                 297
define ENDSEQVOL2SND4                 298
define ENDSEQVOL2SND5                 299
define ENDSEQVOL2SND6                 300
define ENDSEQVOL2SND7                 301
define GENERIC_AMBIENCE23             302
define SOMETHINGFROZE                 303
define DUKE_LONGTERM_PAIN5            304
define DUKE_LONGTERM_PAIN6            305
define DUKE_LONGTERM_PAIN7            306
define DUKE_LONGTERM_PAIN8            307
define WIND_REPEAT                    308
define BURN1                          309
define BOMB1                          310
define FIREMISSION                    311
define RECOILLESS                     312
define AIRSTRIKE                      313
define VIHELLYS                       314
define INVADER                        315
define BOMB2                          316
define EXP10                          317
define EXP11                          318
define INC10                          319
define INC11                          320
define AMBUSH2                        321
define RECOG33                        322
define INC12                          323
define INC13                          324
define SNIPER                         325
define VCAMB1                         326
define VCAMB2                         327
define AMBUSH3                        328
define METALLI                        329
define OHJUSLENTO                     330
define BUSH1                          331
define BUSH3                          332
define RUN2                           333  
define MORTAR1                        334  
define JAMB1                          335    
define WARAMB1                        336  
define WARAMB2                        337
define WARAMB3                        338
define HMG                            339  
define INCOMING                       340  
define HK1                            341  
define HK2                            342  
define BUNKERS                        343  
define AAVE                           344
define AIRSTRIKE2                     345
define WARAMB30                       346
define WARAMB31                       347

// new sounds
define CRANK                          348
define RAIN                           349
define WADE                           350
define GDETH1                         351
define GDETH2                         352
define GDETH3                         353
define GDETH4                         354
define GDETH5                         355
define GDETH6                         366
define BCHBOMB                        367
define RMBLOOP                        368
define GRMSEMI                        369
define HVYMG1                         370
define HVYMG2                         371
define HVYMG3                         372
define HVYMG4                         373
define GER_MG                         374
define SALVO1                         375
define TANKSHLZ                       376
define TOMGUN1                        377
define TOMGUN2                        378
define BOATCOM                        379
define LNDING1                        380
define LNDING2                        381
define LNDING3                        382
define HVYVHC1                        383
define TRUCK1                         384
define M6_2                           385
define RADIO1                         386
define BOLTCOCK                       387
define JHIT                           388
define MELEG                          389
define MYLEG                          390
define MYLEG2                         391
define OAAA2                          392
define OAAAA                          393
define OOOO                           394
define OOOO2                          395
define OW1                            396
define OW2                            397
define LUGER                          398
define ELECTR                         399
define ELECTR2                        400

// ******************
// MISC GAME SETTINGS
// ******************

define SWEARFREQUENCY          0      // The lower, the less.

define CAMERASDESTRUCTABLE      NO               // YES
define FREEZERHURTOWNER         YES

define MAXPLAYERHEALTH          100
define MAXWATERFOUNTAINHEALTH    50

define YELLHURTSOUNDSTRENGTH     40
define YELLHURTSOUNDSTRENGTHMP   50

define MAXXSTRETCH 70
define MAXYSTRETCH 70

define MINXSTRETCH 9
define MINYSTRETCH 8

define MAXPLAYERATOMICHEALTH    100     // doubles as maxarmor.
define DOUBLEMAXPLAYERHEALTH    MAXPLAYERATOMICHEALTH
define STARTARMORHEALTH           0
define RETRIEVEDISTANCE         844
define SQUISHABLEDISTANCE      1024 // For actors only!
define DEFAULTVISIBILITY        512
define FROZENQUICKKICKDIST      980

define GENERICIMPACTDAMAGE      10

define MAXPISTOLAMMO           168
define MAXSHOTGUNAMMO          180
define MAXCHAINGUNAMMO         200
define MAXRPGAMMO              180  
define MAXHANDBOMBAMMO           6
define MAXSHRINKERAMMO           1 
define MAXGROWAMMO             50
define MAXDEVISTATORAMMO       110  
define MAXFREEZEAMMO           5
define MAXTRIPBOMBAMMO           4
define TRIPBOMBLASERMODE        3     // 0 = always visable
                                      // 1 = transluscense
                                      // 2 = invisible w/o IR goggles
                                      // 3 = totally invisable



define RESPAWNACTORTIME         768
define RESPAWNITEMTIME          768

define QSIZE                   1024     // total number of active
                                        // bullet holes, blood,
                                        // footprints, money, ect...
                                        // (max 1024)


define BLIMPRESPAWNTIME 2048

define NUMFREEZEBOUNCES          0    // 0 - 255

                 // 48150
define RUNNINGSPEED 44000
                         
define GRAVITATIONALCONSTANT 176

define PLAYDEADTIME 120

define SHRUNKCOUNT 270
define SHRUNKDONECOUNT 304

define FROZENDRIPTIME 0
define THAWTIME 138


// Various blast radius distances

define RPGBLASTRADIUS           3500 
define PIPEBOMBRADIUS           3200
define SHRINKERBLASTRADIUS      3500
define TRIPBOMBBLASTRADIUS      5000
define MORTERBLASTRADIUS        2500
define BOUNCEMINEBLASTRADIUS    2500
define SEENINEBLASTRADIUS       2500

gamestartup     DEFAULTVISIBILITY GENERICIMPACTDAMAGE MAXPLAYERHEALTH
                STARTARMORHEALTH RESPAWNACTORTIME RESPAWNITEMTIME
                RUNNINGSPEED GRAVITATIONALCONSTANT RPGBLASTRADIUS
                PIPEBOMBRADIUS SHRINKERBLASTRADIUS TRIPBOMBBLASTRADIUS
                MORTERBLASTRADIUS BOUNCEMINEBLASTRADIUS SEENINEBLASTRADIUS
                MAXPISTOLAMMO MAXSHOTGUNAMMO MAXCHAINGUNAMMO
                MAXRPGAMMO MAXHANDBOMBAMMO MAXSHRINKERAMMO
                MAXDEVISTATORAMMO MAXTRIPBOMBAMMO MAXFREEZEAMMO
                MAXGROWAMMO CAMERASDESTRUCTABLE NUMFREEZEBOUNCES
                FREEZERHURTOWNER QSIZE TRIPBOMBLASERMODE


// Weapon Strengths
define KNEE_WEAPON_STRENGTH             47
define PISTOL_WEAPON_STRENGTH          68 // mp40
define HANDBOMB_WEAPON_STRENGTH        120



// For direct hits with the rocket launcher,
// this amount is actually doubled.  Otherwise,
// damage values depend on distance. The
// further, the weaker.

define RPG_WEAPON_STRENGTH              110    


define SHRINKER_WEAPON_STRENGTH         150
define GROWSPARK_WEAPON_STRENGTH        70
define SHOTGUN_WEAPON_STRENGTH          68 // Thompson 
define CHAINGUN_WEAPON_STRENGTH         70 // BAR
define FREEZETHROWER_WEAPON_STRENGTH    150
define COOL_EXPLOSION_STRENGTH          38
define TRIPBOMB_STRENGTH               500
define FIRELASER_WEAPON_STRENGTH        70
define MORTER_WEAPON_STRENGTH           50
define BOUNCEMINE_WEAPON_STRENGTH      150
define SPIT_WEAPON_STRENGTH              0
define BULLET_WEAPON_STRENGTH           70

// Enemy strengths (hit points).

define TROOPSTRENGTH            55
define PIGCOPSTRENGTH           55
define PIG_SHIELD_AMOUNT1        0
define PIG_SHIELD_AMOUNT2        0
define LIZSTRENGTH              55
define LIZGETTINGDAZEDAT         0
define LIZEATINGPLAYER           0
define OCTASTRENGTH            175
define OCTASCRATCHINGPLAYER    -11
define RECONSTRENGTH           100
define TURRETSTRENGTH           30
define ROTTURRETSTRENGTH        80
define DRONESTRENGTH           150
define CAPTAINSTRENGTH          50
define CAPTSPINNINGPLAYER      -11
define COMMANDERSTRENGTH        350
define SHARKSTRENGTH            35
define SHARKBITESTRENGTH        -9
define NEWBEASTSTRENGTH         300
define NEWBEASTSCRATCHAMOUNT   -22
define DOLPHINSTRENGTH          50

define PISTOLAMMOAMOUNT         8
define SHOTGUNAMMOAMOUNT        30
define CHAINGUNAMMOAMOUNT       75
define RPGAMMOBOX               32 
define CRYSTALAMMOAMOUNT        1 
define GROWCRYSTALAMMOAMOUNT    5
define DEVISTATORAMMOAMOUNT     16
define FREEZEAMMOAMOUNT         1
define HANDBOMBBOX              3


define TIGERTANKSTRENGTH        6000
define BOSS1PALSTRENGTH         1000
define BOSS2STRENGTH            4500
define BOSS3STRENGTH            4500
define BOSS4STRENGTH            6000

// Miscellaneous strengths.

define WEAKEST           1
define WEAK              5
define MEDIUMSTRENGTH    10
define TOUGH             20
define REALLYTOUGH       30
define ROBOTMOUSESTRENGTH 45
define GOTTASMART        90
define PIRATEGALSTRENGTH 200

define MANWOMANSTRENGTH  100


// Players' inventory amounts.

define STEROID_AMOUNT             0 
define SHIELD_AMOUNT              0
define SCUBA_AMOUNT               0
define HOLODUKE_AMOUNT            0
define JETPACK_AMOUNT          1600 
define HEAT_AMOUNT             1600
define FIRSTAID_AMOUNT          MAXPLAYERHEALTH
define BOOT_AMOUNT              500

define SPAWNAMMOODDS             96


// Maximum quote size is 64 characters.
// Maximum quotes is 255 slots.

definequote  0        AUTO AIMING
definequote  1        SHOW MAP: OFF
definequote  2        ACTIVATED
definequote  3        MEDIKIT
// locked 
definequote  4        
definequote  5        GIVING EVERYTHING!
definequote  6        EXPLOSIVES
definequote  7        WASTED!
// when ceiling comes down or door unlocked
definequote  8
definequote  9        A SECRET PLACE!
definequote 10        SQUISH!
definequote 11        ALL DOORS UNLOCKED
definequote 12        LOCKED
definequote 13        KILLED IN ACTION...PRESS OPEN TO RESTART LEVEL
definequote 14        YOU NEED 60mm SHELLS TO USE MORTAR
definequote 15        DEACTIVATED
definequote 16        SWITCH OPERATED ONLY!
definequote 17        GOD MODE: ON
definequote 18        GOD MODE: OFF
definequote 19        
definequote 20        CROSSHAIR: ON
definequote 21        CROSSHAIR: OFF
definequote 22        YOU'RE TOO GOOD TO BE CHEATING!
definequote 23        MESSAGES: ON
definequote 24        MESSAGES: OFF
definequote 25        ME 262 DIVING TO ATTACK
definequote 26        DETAIL: BAD AND UGLY
definequote 27        DETAIL: GOOD
definequote 28        WALTHER P38! 
definequote 29        BRIGHTNESS LEVEL: ONE
definequote 30        BRIGHTNESS LEVEL: TWO
definequote 31        BRIGHTNESS LEVEL: THREE
definequote 32        BRIGHTNESS LEVEL: FOUR
definequote 33        BRIGHTNESS LEVEL: FIVE
definequote 34        SOUND: ON
definequote 35        SOUND: OFF
definequote 36        SCREEN CAPTURED
definequote 37        SMALL MEDIKIT
definequote 38        you need key!
definequote 39        CHEMICAL MINE! 
definequote 40        Press F1 for Help
definequote 41        you need key!
definequote 42        MINE PLACED
definequote 43        DISARMING...
definequote 44        MOUSE AIMING OFF
definequote 45        MOUSE AIMING ON
definequote 46        ME 262 CLIMBING AWAY 
definequote 47        ME 262 BOMBING AREA (1000LB BOMBS)
definequote 48        FIRE MISSION CANCELLED
definequote 49        you need key!
definequote 50        you need key!
definequote 51        you need key!
definequote 52        you need key!
definequote 53        ME 262 DIVING TO ATTACK
definequote 54        Mg42!
definequote 55        GRENADE!
definequote 56        mp40!
definequote 57        mp44!
definequote 58        TIME DETONATED DYNAMITE!
definequote 59        panzershreck!
definequote 60        panzerfaust 100mm!
definequote 61        RELOADING ROCKET LAUNCHER
definequote 62        SMALL MEDIKIT
definequote 63        AMMO FOR mg42!
definequote 64        RADIOMAN - CALLING IN FIRE MISSION (HIGH EXPLOSIVE)
definequote 65        AMMO FOR LUGER P08!
definequote 66        you need key!
definequote 67        AMMO FOR akimbo LUGER P08!
definequote 68        AMMO FOR MAUSER KARABINER 98!
definequote 69        AMMO FOR mp44!
definequote 70        YOU NEED KEY!
definequote 71        YOU NEED KEY!      
definequote 72        you need key!
definequote 73        WEAPON LOWERED
definequote 74        WEAPON RAISED
definequote 75        you need key!
definequote 76        DEFENSE SYSTEM MALFUNCTION
definequote 77        you need key!
definequote 78        AMMO FOR mp40!
definequote 79        OUT OF MORTAR SHELLS
definequote 80        KNIFE
definequote 81        WEAPON MODE ON
definequote 82        WEAPON MODE OFF
definequote 83        FOLLOW MODE OFF
definequote 84        FOLLOW MODE ON
definequote 85        RUN MODE OFF
definequote 86        RUN MODE ON
definequote 87        you need key!
definequote 88        60MM SHELLS FOR MORTAR
definequote 89        MINES
definequote 90        SMOKES!
definequote 91        MINE DETECTOR
definequote 92        MUSIC: ON
definequote 93        MUSIC: OFF
definequote 94        SCROLL MODE: ON
definequote 95        SCROLL MODE: OFF
definequote 96        BRIGHTNESS LEVEL: SIX
definequote 97        BRIGHTNESS LEVEL: SEVEN
definequote 98        BRIGHTNESS LEVEL: EIGHT
definequote 99        MAD COW MODE ACTIVATED
definequote 100       ALL LOCKS TOGGLED
definequote 101       INFRARED GOGLESS
definequote 102       MINE DISARMED
definequote 103       SCREEN SAVED
definequote 104       ACTIVATE 60mm SHELLS TO USE MORTAR
definequote 105       MINE READY
definequote 106       INFRARED ON
definequote 107       INFRARED OFF
definequote 108       YOUR GIRLFREND - FOLLOWING  
definequote 109       VIEW MODE OFF
definequote 110       VIEW MODE ON
definequote 111       SHOW MAP: ON
definequote 112       CLIPPING: ON
definequote 113       CLIPPING: OFF
definequote 114       !!! INCORRECT VERSION !!!
definequote 115       <Please Leave Blank>
definequote 116       <Please Leave Blank>
definequote 117       <Please Leave Blank>
definequote 118       YOU CAN NOT "QUICK SAVE" WHEN DEAD
definequote 119       GOT ALL WEAPONS/AMMO
definequote 120       GOT ALL INVENTORY
definequote 121       ba 349 natter diving to attack 
definequote 122       ba 349 natter bombing area (rockets)
definequote 123       ba 349 natter climbing away  
definequote 124       akimbo LUGER P08!
definequote 125       JUNKERS JU 208 DIVING TO ATTACK
definequote 126       JUNKERS JU 208 BOMBING AREA (500LB BOMBS)
definequote 127       JUNKERS JU 208 CLIMBING AWAY
definequote 128       B17 DIVING TO ATTACK
definequote 129       B17 BOMBING AREA (800LB BOMS)  
definequote 130       B17 CLIMBING AWAY  
definequote 131       A26 INVADER DIVING TO ATTACK
definequote 132       ROCKETS!  
definequote 133       A26 INVADER BOMBING AREA (1000LB BOMBS)  
definequote 134       A26 CLIMBING AWAY  
definequote 135       P38 J LIGHTNING DIVING TO ATTACK 
definequote 136       P38 J LIGHTNING bombing area (5INCH rockets) 
definequote 137       BOOZE!   
definequote 138       P38 J LIGHTNING CLIMBING AWAY
definequote 139       B17 BOMBING AREA (FIRE BOMS)
definequote 140       YOU ARE ON THE BLUE TEAM
definequote 141       YOU ARE ON THE RED TEAM
definequote 142       YOU GOT THE ENEMY FLAG...TAKE IT BACK TO YOUR BANNER
definequote 143       YOU GOT THE BEAST FLAG  
definequote 144       YOU HAVE BECOME A BEAST
definequote 145       BLUE TEAM WINS
definequote 146       RED TEAM WINS
definequote 147       MINES ( 5)  
definequote 148       MEDIKIT USED
definequote 149       EXPLOSIVES
definequote 150       EXPLOSIVES PLACED
definequote 151       PRESS SPACE TO VIEW MAP  
definequote 152       CAN'T PICK UP ARTILLERY AMMO  
definequote 153       BOOZE!
definequote 154       BOOBY TRAP !!!  
definequote 155       MINE DETECTOR
definequote 156       INFRARED GOGLESS!
definequote 157       AMMO FOR M2MACHINE GUN!
definequote 158       M2MACHINE GUN [PRESS SPACE TO FIRE]
definequote 159       YOU'RE BLEEDING
definequote 160       A-GUNNER
definequote 161       MACHINE GUNNER
definequote 162       SNIPER
definequote 163       GRENADIER
definequote 164       POINT MAN
definequote 165       MEDIC
definequote 166       SQUAD LEADER
definequote 167       KILLED IN ACTION
definequote 168       BOOBY TRAP DISARMED
definequote 169       M-60 MACHINE GUN [PRESS SPACE TO FIRE]  
definequote 170       [DROP AMMO]
definequote 171       [C-4]
definequote 172       [FLARE]
definequote 173       [HEAL]
definequote 174       [FIRE MISSION]
definequote 175       [MORE AMMO]
definequote 176       MEDICAL SUPPLIES
definequote 177       VIET CONG AMMUNITION
definequote 178       ROTTEN FOOD  
definequote 179       MAUSER KARABINER 98!
definequote 180       60MM MORTAR
definequote 181       DEFEND THIS POSITION UNTIL FURTHER ORDERS
definequote 182       SHORTEST }{{{{{{ LONGEST
definequote 183       SHORTEST }}{{{{{ LONGEST
definequote 184       SHORTEST }}}{{{{ LONGEST
definequote 185       SHORTEST }}}}{{{ LONGEST
definequote 186       SHORTEST }}}}}{{ LONGEST
definequote 187       SHORTEST }}}}}}{ LONGEST
definequote 188       SHORTEST }}}}}}} LONGEST
definequote 189       ENGINEER
definequote 190       JU 89 STUKA DIVING TO ATTACK
definequote 191       USING A SPECIAL SKILL...
definequote 192       JU 89 STUKA BOMBING AREA (7.92MM MG)
definequote 193       JU 89 STUKA CLIMBING AWAY
definequote 194       key
definequote 195       F6F HELLCAT DIVING TO ATTACK 
definequote 196       F6F HELLCAT BOMBING AREA (50CAL MG)
definequote 197       F6F HELLCAT CLIMBING AWAY 
definequote 198       GIVING FIRSTAID...
definequote 199       MINE DETECTOR ON
definequote 200       GIVING FIRSTAID FAST...
definequote 201       MINE DETECTOR OFF
definequote 202       YOU ARE IN RED TEAM
definequote 203       YOU ARE IN BLUE TEAM
definequote 204       CHOOSE TEAM


// Volume titles cannot excede 32 characters.

definevolumename 0 ESCAPE FROM WOLFENSTEIN
definevolumename 1 GERMAN HIDEOUT
definevolumename 2 
definevolumename 3 


// Skill titles cannot excede 32 characters.

defineskillname 0 Can i play daddy ?
defineskillname 1 Hey not too rough
defineskillname 2 Hurt me plenty
defineskillname 3 I am death incarnate


// Level file names cannot excede 128 characters.
// Level par cannot excede 5 characters (min:sec)
// Level titles cannot excede 32 characters.

definelevelname 0 0 e1l1.map  02:20 00:45 ESCAPE
definelevelname 0 1 e1l2.map  04:00 03:02 MUNCHEN
definelevelname 0 2 e1l3.map  06:20 04:11 PRISON
definelevelname 0 3 e1l4.map  07:30 03:41 CASTLE
definelevelname 0 4 e1l5.map  08:15 04:34 TANK FACTORY
definelevelname 0 5 e1l6.map  07:15 04:12 HIGH CASTLE
definelevelname 0 6 NONE.map  08:00 05:22 EMPTY
definelevelname 0 7 e1l1.map  00:00 00:00 USER MAP 
definelevelname 0 8 e1l1.map  00:00 00:00 < EMPTY >
definelevelname 0 9 e1l1.map  00:00 00:00 < EMPTY >
definelevelname 0 10 e1l1.map 00:00 00:00 < EMPTY >


definelevelname 1 0 e2l1.map   07:20 05:21 BERLIN GAS FACTORY
definelevelname 1 1 e2l2.map   05:10 03:11 ROAD TO FRANKFURT
definelevelname 1 2 e2l3.map   06:40 03:25 TRAIN STATION
definelevelname 1 3 e2l4.map   10:00 05:41 CONCENTRAMENT CAMP
definelevelname 1 4 e2l5.map   07:30 04:56 BERLIN UNDER BOMBING
definelevelname 1 5 e2l6.map   05:20 03:18 CASTLE NEUWANSTEIN
definelevelname 1 6 e2l7.map   10:20 05:23 V2 SITE
definelevelname 1 7 e2l8.map   00:00 00:00 HITLER JUGEND CAMP
definelevelname 1 8 e2l9.map   00:00 00:00 AUSWITZ
definelevelname 1 9 e2l10.map  00:00 00:00 CENTRAMENT CAMP 
definelevelname 1 10 e2l1.map 00:00 00:00 V2 FACTORY 

definelevelname 2 0 none.map  00:00 00:00 TARGET RANGE    
definelevelname 2 1 none.map  00:00 00:00 MONASTERY [GIMATCH] 
definelevelname 2 2 e3l3.map  00:00 00:00 CAVEFEAR2 [GIMATCH] 
definelevelname 2 3 e3l4.map  00:00 00:00 BASTOGNE BOYZ [GIMATCH]
definelevelname 2 4 e3l5.map  00:00 00:00 SMALL TOWN [GIMATCH]  
definelevelname 2 5 e3l6.map  00:00 00:00 TOWN RUINS [GIMATCH] 
definelevelname 2 6 e3l7.map  00:00 00:00 FUHRER'S BUNKER [GIMATCH]     
definelevelname 2 7 e3l8.map  00:00 00:00 GOOD NIGHT [GIMATCH]
definelevelname 2 8 e3l1.map  00:00 00:00 < EMPTY >
definelevelname 2 9 e3l1.map  00:00 00:00 < EMPTY >
definelevelname 2 10 e3l1.map 00:00 00:00 < EMPTY >

definelevelname 3 0 none.map   00:00 00:00 D DAY [FIRETEAM]
definelevelname 3 1 e4l2.map   00:00 00:00 SEASIDE SWEEP [FIRETEAM] 
definelevelname 3 2 e4l3.map   00:00 00:00 PAPERWORK [FIRETEAM]
definelevelname 3 3 e4l4.map   00:00 00:00 HUNT FOR THE 88'S [FIRETEAM]
definelevelname 3 4 e4l5.map   00:00 00:00 D DAY [CTF]
definelevelname 3 5 e4l6.map   00:00 00:00 CITY IN RUINS [CTF]
definelevelname 3 6 e4l7.map   00:00 00:00 HEDGEROW HELL [CTF] 
definelevelname 3 7 e4l8.map   00:00 00:00 CASINO DE OUISTREHAM [CTF]
definelevelname 3 8 e4l1.map   00:00 00:00 < EMPTY >
definelevelname 3 9 e4l1.map  00:00 00:00 < EMPTY >
definelevelname 3 10 e4l1.map 00:00 00:00 < EMPTY >

// Music will not play if the .MID file excedes 72000 bytes.

music 0 PLT106.mid AINWAINS.mid

// Music for the individual levels
music 1 AUSWITZ.mid boss.mid cblood7.mid d_e3m7.mid
        d_victor.mid cblood8.mid AINWAINS.mid
        AINWAINS.mid AINWAINS.mid AINWAINS.mid 

music 2 WCORNER.mid WPOW.mid LOWAMMO.mid AWLDR.mid
        HITLER.mid BOSS.mid TOWER.mid
        AINWAINS.mid AINWAINS.mid AINWAINS.mid

music 3 lilimarl.mid battle2.mid slowdark.mid quiet.mid
        frenchy.mid battle2.mid slowdark.mid ww2.mid
        ww2.mid ww2.mid ww2.mid 

music 4 battle1.mid battle2.mid quiet.mid slowdark.mid
        battle1.mid battle2.mid frenchy.mid ww2.mid
        ww2.mid ww2.mid ww2.mid


// *****************************************
//      ACTOR SOUNDS
// *****************************************


// Enemy sounds
definesound PRED_ROAM     grmvox1.voc  -64  64  3  0   0 // hui        #110
definesound PRED_ROAM2    grmvox3.voc  -64  64  3  0   0 // schwein    #204
definesound PIG_ROAM3     grmvox4.voc  -64  64  3  0   0 // jawohl...  #253
definesound RECOG33       grmvox5.voc  -64  64  0  0   0 // schnell... #322
definesound VCAMB1        grmvox5.voc  -64  64  3  0   0 //            #326
definesound VCAMB2        grmvox6.voc  -64  64  3  0   0 // heutlich...#327
definesound PRED_PAIN     grmdeth2.voc -64  64  3  0   0 // ah,pundershcwein #113
definesound PRED_DYING    grmdeth1.voc -64  64  3  0   0 // yuh  #114
definesound ALIEN_TALK2   nazi01.voc     0   0  3  0   0 // #242
definesound VAULT_DOOR    nazi02.voc     0   0    0    0   0 // #262
definesound END_OF_LEVEL_WARN nazi03.voc 0   0    0    0   0 // #83
definesound DUKE_UNDERWATER   nazi04.voc 0   0    2    0   0 // #48
definesound DUKE_JETPACK_ON   nazi05.voc 0   0    4    0   0 // #49
definesound DUKE_JETPACK_OFF  nazi06.voc 0   0    2    0   0 // #51
definesound GETATOMICHEALTH   nazi07.voc 0   0    0    0   0 // #106
definesound GENERIC_AMBIENCE10 nazi08.voc 0  0    0    0   0 // #186
definesound BOMB1              nazi09.voc 0  0    0    0   0 // #310
definesound DUKE_JETPACK_IDLE  nazi10.voc 0  0    0    0   0 // #50
definesound KTIT               nazi11.voc 0  0    0    0   0 // #278
definesound SHORT_CIRCUIT      nazi12.voc 0  0    0    0   0 // #21
definesound A_TALK             nazi13.voc 0  0    0    0   0 // #241
definesound DUKE_URINATE       nazi14.voc 0  0    0    0   0 // #28
definesound DUKE_DRINKING      nazi15.voc 0  0    0    0   0 // #36
definesound DUKE_LOOKINTOMIRROR nazi16.voc 0 0    0    0   0 // #252
definesound GDETH1              deth01.voc  0 0    0    0   0 // #351
definesound GDETH2              deth02.voc  0 0    0    0   0 // #352
definesound GDETH3              deth03.voc  0 0    0    0   0 // #353
definesound GDETH4              deth04.voc  0 0    0    0   0 // #354
definesound GDETH5              deth05.voc  0 0    0    0   0 // #355
definesound GDETH6              deth06.voc  0 0    0    0   0 // #356

// MUST BE LEAVED BLANK
definesound PRED_RECOG    blank.voc    0   0   3   0   0
definesound PIG_RECOG     blank.voc    0   0   3   0   0
definesound CAPT_RECOG    blank.voc    0   0   3   0   0




// Episode 1 descriptions
definesound STARTSND      FLYBY.WAV    0 0  254  0  512 // in strt of gme#244
definesound M1            e1l1cap.voc  0 0  254  0   0 // #130
definesound WAR_AMBIENCE7 e1l1cap2.voc 0 0  254  0  0 // #237
definesound SPACE_DOOR4   e1l1cap3.voc 0 0  254  0   0 // #259
definesound SPACE_DOOR2   e1l1cap4.voc 0 0  254  0   0 // #257
definesound SPACE_DOOR1   e1l1cap5.voc 0 0  254  0   0 // #256
definesound M3            e1l3cap.voc  0 0  254  0   0 // #132
definesound M4            e1l4cap.voc  0 0  254  0   0 // #157
definesound PIG_ROAM      e1l4mumb.voc 0 0  254  0   0 // #120 
definesound M5            e1l5cap2.voc 0 0  254  0   0 // #133
definesound M6            gerard2.voc  0 0  254  0   0 // #134
definesound M6_2          mckurk04.voc 0 0  254  0   0 // #385
definesound M7            e1l7cap.voc  0 0  254  0   0 // #255


// Episode 2 descriptions
definesound M21     e2l1cap.voc        0 0   254 0   0 // #125
definesound M22CAP  e2l2cap.voc        0 0   254 0   0 // #139
definesound M23     e2l3cap.voc        0 0   254 16  0 // #127
definesound M22     e2l3die.voc        0 0   254 0   0 // #126
definesound M24     e2l4cap.voc        0 0   254 0   0 // #128
definesound M25     e2l5cap.voc        0 0   254 0   0 // #129
definesound M28     e2l5pow.voc        0 0   254 0   0 // #141
definesound M26     e2l6cap.voc        0 0   254 0   0 // #198
definesound M27     e2l7cap.voc        0 0   254 0   0 // #64
definesound DUKE_HIT_STRIPPER1 gerard3.voc 0 0 254 0 0 // #201


                               
// AI soldier sounds
// medic
definesound SOLIC33       blank.voc    0   0   0   0   0 // #140
definesound MEDIC11       blank.voc   0   0   0   0   0 // #135
definesound MEDIC22       blank.voc   0   0   0   0   0 // #136
definesound MEDIC33       blank.voc   0   0   0   0   0 // #137
definesound SOLIC11       blank.voc   0   0   0   0   0 // #138
definesound SLIM_HATCH         blank.voc 0   0   0   0   0 // #283
definesound DUKE_STEPONFECES   blank.voc 0   0   0   0   0 // #273
definesound DUKE_HIT_STRIPPER2 blank.voc 0   0   0   0   0 // #214
definesound SOMETHINGFROZE     blank.voc 0   0   0   0   0 // #303
definesound M2                 blank.voc 0   0   0   0   0 // #131


// demoman
definesound BOS2_ATTACK   demo01.voc    0   0   0   0   0 // #103okmac
definesound BOS2_RECOG    demo02.voc    0   0   0   0   0 // #102whatever u
definesound BOS2_ROAM     demo03.voc    0   0   0   0   0 // #101mine
definesound DUKE_TIP1     demo04.voc    0   0   0   0   0 // #202expl armd 
definesound DUKE_BOOBY    demo05.voc    0   0   0   0   0 // #250comng
definesound BOS1_ROAM     demo06.voc    0   0   0   0   0 // #96 alright, wa
definesound BOS2_PAIN     demo07.voc    0   0   0   0   0 // #104arrgh
definesound DUKE_TIP2     demo08.voc    0   0   0   0   0 // #67 tnt rdy
definesound BOS2_DYING    demo11.voc    0   0   0   0   0 // #105aaaarrgh

// McCurkee
definesound BOS1_RECOG    mcdeth.voc    0   0   0   0   0 // #97im hit
definesound BOS1_ATTACK1  mcdeth2.voc   0   0   0   0   0 // #98triedfailed
definesound BOS1_ATTACK2  mcdeth3.voc   0   0   0   0   0 // #154dammit im hit
definesound BOS1_PAIN     mckurk01.voc  0   0   0   0   0 // #99yessarge
definesound BOS1_DYING    mckurk02.voc  0   0   0   0   0 // #100withyasarge
definesound COMPANB2      mckurk03.voc  0   0   0   0   0 // #277
definesound SECRETLEVELSND mckurk05.voc 0   0   0   0   0 // #183
definesound DUMPSTER_MOVE mckurk06.voc  0   0   0   0   0 // #148
definesound LASER1        mckurk07.voc  0   0   0   0   0 // #143leadtheway
definesound OCTA_ATTACK2  mckurk10.voc  0   0   0   0   0 // #159ill wait here
definesound OCTA_ATTACK1  mckurk11.voc  0   0   0   0   0 // #142heythanks



// allied soldier
definesound SLIM_ROAM     blank.voc  0   0   0   0   0 // #163
definesound SLIM_RECOG    blank.voc  0   0   0   0   0 // #26
definesound SLIM_ATTACK   blank.voc  0   0   0   0   0 // #34
definesound SLIM_DYING    blank.voc  0   0   0   0   0 // #149
definesound DUKE_PISSRELIEF blank.voc 0  0   0   0   0 // #218
definesound JHIT          boltcock.voc      0   0   0   0   0 // #388
definesound MELEG         meleg.voc     0   0   0   0   0 // #389
definesound MYLEG         myleg.voc     0   0   0   0   0 // #390
definesound MYLEG2        myleg2.voc    0   0   0   0   0 // #391
definesound OAAA2         oaaa2.voc     0   0   0   0   0 // #392
definesound OAAAA         oaaaa.voc     0   0   0   0   0 // #393
definesound OOOO          oooo.voc      0   0   0   0   0 // #394
definesound OOOO2         oooo2.voc     0   0   0   0   0 // #395
definesound OW1           ow1.voc       0   0   0   0   0 // #396
definesound OW2           ow2.voc       0   0   0   0   0 // #397

// level finished sounds
definesound BONUS_SPEECH2       diff1.voc  0   0   255  4   0 // #196
definesound BONUS_SPEECH3       diff3.voc  0   0   255  4   0 // #197
definesound BONUS_SPEECH4       diff4.voc  0   0   255  4   0 // #199

// Diffuculty sounds
definesound JIBBED_ACTOR6       diff1.voc  0   0   255 0  0 // #227
definesound BONUS_SPEECH1       diff2.voc  0   0   255 0  0 // #195
definesound DUKE_GETWEAPON2     diff3.voc  0   0   255 0  0  
definesound JIBBED_ACTOR5       diff4.voc  0   0   255 0  0 // #226


// Beast sounds
definesound LASER2        plt084.voc     0   0   0   0   0 // #144
definesound PREDALOAD     pred2.voc      0   0   0   0   0 // #150
definesound PREDAPAIN1    plt073.voc     0   0   0   0   0 // #151
definesound PREDAPAIN2    plt074.voc     0   0   0   0   0 // #152
definesound PREDEYES      pred3.voc      0   0   0   0   0 // #176
definesound PREDSFX1      pred1.voc      0   0   0   0   0 // #153
definesound PREDSFX2      pred4.voc      0   0   0   0   0 // #108

// CTF sounds
definesound WIERDSHOT_FLY bluewet.voc  0  0  0  16  0 // blueteam win #160
definesound TURR_ROAM     redwet.voc   0  0  0  16  0 // redteam win  #145

// Nature sounds
definesound SEA               wavz1.voc     0 0  255 3  0 // sea #281
definesound WAR_AMBIENCE6     birds1.WAV    0 0  254 3  0 // birds #236
definesound JAMB1             birds2.WAV    0 0  255 3  0 // birds1 #335
definesound TURR_PAIN         birds3.WAV    0 0  254 0  0 // birs1 #161
definesound CAPT_PAIN         frogloop.voc  0 0  254 3  0 // frogs #118
definesound GENERIC_AMBIENCE1 BIRDS2.WAV  0 0  254 3  0 // farm soundz #170
definesound KILLME            BIRDS1.voc  0 0  254 0  0 // chickens #254
definesound TURR_DYING        rooster.voc   0 0  254 0  0 // rooster #162
definesound BOS1_WALK         dogs.voc      0 0  254 0  0 // dogs #156
definesound GENERIC_AMBIENCE2 brook1.voc    0 0  255 3  0 // stream1 #171
definesound GENERIC_AMBIENCE8 brook2.voc    0 0  255 3  0 // stream2 #184
definesound GENERIC_AMBIENCE5 falls.voc     0 0  255 3  0 // waterfall #174
definesound BUSH1             plt041.voc    0 0   0  0  0 // bush1 #331
definesound BUSH3             plt042.voc    0 0   0  0  0 // bush2 #332   
definesound DUKE_WALKINDUCTS  BIRDS2.WAV      0 0  255 0  0 // #43
definesound PIG_ROAM2         wavz2.voc     0 0   0  3  0 // #205
definesound RAIN              rain.voc      0 0   0  3  0 // #349
definesound WADE              wade.voc      0 0   0  3  0 // #350
definesound BUNKERS           dogz1.voc     0 0   0  0  0 // #343 dogz 2
definesound RATTY             rats1.voc     0 0   0  0  0 // #247
definesound ACTOR_SHRINKING   rats2.voc     0 0   0  0  0 // #12



// VEHICLE SOUNDS
definesound FOUNDJONES boatloop.voc   0  0  255  0  0 // #285
definesound INVADER    b17loop.voc    0  0  255  16 0 // #315
definesound AAVE       SALVDIS3.VOC   -256 256 254 16 512 // #344
definesound WAR_AMBIENCE4 plane2.voc  0  0  254  16 0 // #234
definesound GENERIC_AMBIENCE23 b17_1.voc 0   0   255 0   0 // #302
definesound GENERIC_AMBIENCE20 b17_2.voc 0   0   255 0   0 // #180
definesound GENERIC_AMBIENCE18 b17_3.voc 0   0    0  0   0 // #178
definesound GENERIC_AMBIENCE11 plane1.voc 0  0   254 0   0 // #187
definesound HELICOP_IDLE    b17xplos.voc  0   0  255 0   0 // #279
definesound SUBWAY          train.voc     0   0   0  0   0 // #75
definesound ELEVATOR_ON     tank2.voc     0   0   0  0   0 // #71
definesound ELEVATOR_OFF    tank2.voc     0   0   0  3   0 // #73
definesound DUKE_HARTBEAT   tank3.voc     0   0   0  3   0 // #39
definesound HVYVHC1         hvyvhc1.voc   0   0   0  3   0 // #383
definesound TRUCK1          truck1.voc    0   0   0  0   0 // #384
definesound BAR_MUSIC       train1.voc    0   0  254 3   0 // #95
definesound ALIEN_SWITCH1   train2.voc    0   0   0  0   0 // #272


definesound STEPNIT            plt147.voc  0   0  255  0  0 // tank2 #280
definesound GENAMB6            plt110.voc  0   0  255  3  0 // hvy mchne#175
definesound METALLI            plt040.voc  0   0    0  0 4096 // vhl hit#329


// *************
// WEAPON SOUNDS                                                                        
// *************

// GERMAN WEAPONS
definesound HMG           M60B.wav    0   0  3  0   0 // #339 
definesound CAPT_ATTACK   mp40b.wav    0   0  3  0   0 // mp40 #116
definesound GRMSEMI       grmsemi.voc   0   0  3  0   0 // #369
definesound LUGER         lugerx.voc    0   0  3  0   0 // #398
definesound SHRINKER_FIRE mini.wav   0   0 254 0   0 // #11
definesound SPACE_DOOR5   hmg.wav    0   0  4    0   0 // mg fr airplane #260
definesound PRED_ATTACK   rocket.voc    0   0  4    0   0 // ak47   #112
definesound LIZARD_BEG    plt129.voc    0   0  4    0   0 // ak47_2 #61
definesound RECOILLESS    plt025.voc    0   0  254  16  0 // B10    #312

                                
// PLAYER WEAPONS                                    
definesound KICK_HIT           plt115.voc    0     0     4   0   0 // gn1 #0
definesound PISTOL_RICOCHET    ricochet.voc  0     0     0   0 4096 //    #1
definesound PISTOL_BODYHIT     sniperx.voc  -128  128    0   0   0 //     #2
definesound PISTOL_FIRE        lugerx.voc   0     0     3   0   0 // gn2 #3
definesound EJECT_CLIP         RLOAD.WAV   0     0     3   0   0 //     #4
definesound INSERT_CLIP        RLOAD.WAV     512   512   3   0   0 //     #5
definesound CHAINGUN_FIRE      m60fire.wav  0     0     3  0 512 // gn4 #6
definesound SHOTGUN_FIRE       SAWS.WAV    0     0     3  0   0 // gn3 #109
definesound SHOTGUN_COCK       clipin.voc    512   512   3   0   0 //     #169
definesound RPG_SHOOT          atrock.WAV   0     0     4   0   0 // gn5 #7
definesound RPG_EXPLODE        plt011.voc   -256  256   254  0   0 //     #9
definesound CAT_FIRE           atrock.WAV     0     0     4   0   0 //     #10
definesound CAPT_ROAM          plt012.voc    0     0     4   0   0 // flmthrwr #115
definesound PIPEBOMB_BOUNCE    plt043.voc   128   128    2   0   0 //      #13
definesound PIPEBOMB_EXPLODE   xplos4.voc   -128   128   254  0    0 // grnd exp #14
definesound LASERTRIP_ONWALL   lsrbmbpt.voc  0     0     3   0   0 //     #15
definesound LASERTRIP_ARMING   blank.voc     0     0     0   0   0 //     #16
definesound LASERTRIP_EXPLODE  plt014.voc    0     0     4   0   0 //     #17
definesound SNIPER             k43.wav  0     0    254  16  0 // snpr #325
definesound FIREMISSION        3_coltcr.voc  0     0    254  0   0 // gn 8 #311
definesound BOLTCOCK           radio.wav  0     0     0   0   0 // 387
definesound AK47               lugerx.voc   0     0    254  0   0 // 1911 #122
definesound SPACE_DOOR3        plt153.voc   -128 128    254  0  0   // mortar #258
definesound OCTA_ROAM          plt071.voc     0   0     3    0  0   // mg     #31
definesound POOLBALLHIT        plt133.voc     0   0     254  0  512 // mg2    #8


// OTHER WEAPON & EXPLOSION SOUNDS
definesound OHJUSLENTO   incomin1.voc -128 128  254 16 512 // nvl bmb dwn #330
definesound TURR_ATTACK  incomin2.voc -128 128  254 16 512 // nvl bmb dwn2 #147
definesound FAN          canblow1.voc    0   0   0   0   0 // #77
definesound FLUSH_TOILET canblow2.voc    0   0   0   0   0 // #79
definesound HOVER_CRAFT  canblow3.voc    0   0   0   0   0 // #80
definesound EARTHQUAKE   cannon1.voc     0   0   0   0   0 // #81
definesound CAPT_DYING   xplos1.voc      0   0   0   0   0 // #119
definesound PIG_PAIN     xplos2.voc      0   0   0   0   0 // #123
definesound PIG_DYING    xplos3.voc      0   0   0   0   0 // #124
definesound SHRINKER_HIT xplos4.voc    -128 128  254 16  0 // expl #245 
definesound BORNTOBEWILDSND xplos4.voc   0   0   0   0   0 // #168
definesound CRANK           crank.voc    0   0   0   0   0 // #348
definesound BCHBOMB         bchbomz1.voc 0   0   0   0   0 // #367                                                              
definesound RMBLOOP         rmblloop.voc 0   0   0   3   0 // #368
definesound HVYMG1          hvymg1.voc   0   0   0   0   0 // #370
definesound HVYMG2          hvymg2.voc   0   0   0   0   0 // #371
definesound HVYMG3          hvymg3.voc   0   0   0   0   0 // #372
definesound HVYMG4          hvymg4.voc   0   0   0   0   0 // #373
definesound GER_MG          mg1.voc      0   0   0   0   0 // #374
definesound SALVO1          salvo1.voc   0   0   0   0   0 // #375
definesound TANKSHLZ        tnkshelz.voc 0   0   0   0   0 // #376
definesound TOMGUN1         tomgun1.voc  0   0   0   0   0 // #377
definesound TOMGUN2         tomgun2.voc  0   0   0   0   0 // #378
definesound ELECTR          GEN1.WAV     0   0   0   0   0 // #399
definesound ELECTR2         ELE1.WAV     0   0   0   0   0 // #400

definesound INTRUDER_ALERT  plt134.voc  -128 128   254 0  0 // mne xplde  #81
definesound LADY_SCREAM     plt135.voc     0  0    4   0  0 // smoke hits #164
definesound VIHELLYS        plt031.voc     0  0    254  0 0 // airbomb    #314
definesound BOMB2           plt030.voc   -256 256  254 16 0 // expl       #316
definesound EXP10           plt053.voc   -256 256  254 16 0 // expl       #317
definesound EXP11           plt054.voc   -256 256  254 16 0 // expl       #318
definesound INC10           plt055.voc   -128 128  254 16 0 // arty       #319
definesound INC11           plt056.voc   -128 128  254 16 0 // arty       #320
definesound INC12           plt057.voc   -128 128  254 16 0 // mortar     #323
definesound INC13           plt058.voc   -128 128  254 16 0 // mortar     #324
definesound MORTAR1         plt044.voc   -128 128  254 16 512 // mortar   #334

definesound NITEVISION_ONOFF time.wav   0    0    0   0  0 //         #213
definesound SELECT_WEAPON    WPNSEL21.VOC   128  128  3   0  0 //         #219
definesound TURR_RECOG       plt118.voc     0    0    0   0  0 // mne bep #146


// Player's Body Sounds
definesound DUKE_BREATHING      hlminhal.voc      0   0   255 4   0 
definesound DUKE_EXHALING       hlmexhal.voc      0   0   255 4   0          
definesound DUKE_GASP           gasp.voc          0   0   255 4   0          
definesound DUKE_CRACK2         blank.voc         0   0   255 4   0          
definesound DUKE_CRACK          blank.voc         0   0   255 4   0  
definesound DUKE_TALKTOBOSSFALL blank.voc         0   0   255 12  0         
definesound DUKE_CRACK_FIRST    blank.voc        512   512   3   0   0          
definesound DUKE_GET            plt152.voc        -64 64  255 0   0          
definesound DUKE_GETWEAPON1     blank.voc         0   0   255 4   0          
        
definesound DUKE_GETWEAPON3     blank.voc         0   0   255 4   0
definesound DUKE_GETWEAPON4     blank.voc         0   0   255 4   0
definesound JIBBED_ACTOR13      blank.voc         0   0   255 4   0
definesound DUKE_GETWEAPON6     blank.voc         0   0   255 4   0
definesound DUKE_GOTHEALTHATLOW blank.voc         0   0   255 4   0
definesound DUKE_SEARCH         blank.voc         0   0   2   4   0
definesound DUKE_SEARCH2        blank.voc         0   0   255 4   0
definesound DUKE_LONGTERM_PAIN  gdideth1.voc     -192 0   255 4   0
definesound DUKE_LONGTERM_PAIN2 gdideth2.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN3 gdideth1.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN4 gdideth2.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN5 gdideth3.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN6 gdideth2.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN7 gdideth3.voc      0   0   255 4   0
definesound DUKE_LONGTERM_PAIN8 gdideth3.voc      0   0   255 4   0


// Player Health Sounds
definesound SOMETHINGHITFORCE   teleport.voc       0   0   2  0 8192 // #35
definesound DUKE_KILLED1        blank.voc          0   0   255 12  0 // #37
definesound DUKE_KILLED2        blank.voc          0   0   255 12  0 // #203
definesound DUKE_KILLED3        blank.voc          0   0   255 12  0 // #72
definesound DUKE_KILLED4        gdideth2.voc       0   0   255 4   0 // #270
definesound DUKE_KILLED5        blank.voc          0   0   255 12  0 // #271
definesound DUKE_GRUNT          gdideth3.voc       0   0   2   4   0 // #38
definesound DUKE_DEAD           gdideth3.voc      -64  64   255 4  0  // #41
definesound DUKE_SCREAM         gdideth2.voc       0   0 255   0   0 // #245
definesound AMBUSH2             gulp01.voc         0   0   0   0   0 // #321


// Player Movement Sounds                                                                 
definesound RUN2                plt043.voc       -256 0    0   0   0 // #333
definesound DUKE_ONWATER        wetfeet.voc       0   0    4   0   0 // #40
definesound DUKE_LAND           plt032.voc        0   0    2   0   0 // #42
definesound DUKE_LAND_HURT      gdideth3.voc      0   0    255 4   0 // #200
definesound DUKE_YES            blank.voc         0   0   255  4   0 // #45
definesound DUKE_USEMEDKIT      blank.voc         0   0   255  4   0 // #216
definesound DUKE_TAKEPILLS      blank.voc         0   0   255  4   0 // #217
definesound DUKETALKTOBOSS      blank.voc         0   0   255  0   0 // #56
definesound BOSSTALKTODUKE      blank.voc         0   0   255  0   0 // #230


// Common Death Sounds
definesound FLESH_BURNING       fire09.voc      -256   0   0   0   6100 // #68
definesound THUD                thud.voc           0   0   0   0   0    // #158
definesound SQUISHED            squish.voc         0   0   3   0   0    // #69


// Equipment Sounds
definesound TELEPORTER          blank.voc          0   0   0   0   0 // #70
definesound ALIEN_ELEVATOR1     hydro43.voc        0   0   0   0   0 // #261
definesound SWITCH_ON           switch.voc         0   0   0   8   0 // #76
definesound ALIEN_DOOR1         radio.wav         0   0   0  0   0   // #286
definesound ALIEN_DOOR2         adoor2.voc        0   0   0  0   0   // #287
definesound DOOR_OPERATE1       hydro.wav     -256   0   0   0   0 // #74
definesound DOOR_OPERATE2       opendoor.voc    -256   0   0   0   0 // #165
definesound DOOR_OPERATE3       edoor10.voc     -256   0   0   0   0 // #166
definesound DOOR_OPERATE4       edoor11.voc     -256   0   0   0   0 // #167


// Affect Environment Sounds
definesound VENT_BUST           ventbust.voc      -32   32 2  0  0    // #18
definesound GLASS_BREAKING      glass.voc         -412  0  3  0  8192 // #19
definesound GLASS_HEAVYBREAK    glashevy.voc      -412  0  3  0  8192 // #20
definesound ITEM_SPLASH         splash.voc        0     0  2  0  0    // #22
definesound BONUSMUSIC          plt046.voc        0     0 255 1  0    // #249
definesound BURN1               plt016.voc       -128 128  0  0  0    // #309

// Ambience Sounds
definesound ENGINE_OPERATING    onboard.voc        0   0   0   2   0 // #84
definesound REACTOR_ON          MP40S.WAV        0   0   0   2   0 // #85
definesound COMPUTER_AMBIENCE   ele1.WAV        0   0   0   2   0 // #86
definesound GEARS_GRINDING      geargrnd.voc       0   0   0   2   0 // #87
definesound BUBBLE_AMBIENCE     manifold.wav    -256   0   0   2   0 // #88
definesound MACHINE_AMBIENCE    machamb.voc        0   0   0   2   0 // #89
definesound SEWER_AMBIENCE      drip3.voc          0   0   0   0   0 // #90
definesound WIND_AMBIENCE       wind54.voc         0   0   0   2   0 // #91
definesound WIND_REPEAT         flyby.wav         0   0   0   3   0 // #308
definesound SOMETHING_DRIPPING  drip3.voc          0   0   0   0   9000 // #92
definesound STEAM_HISSING       steamhis.voc       0   0   0   1   8192 // #93
definesound GENERIC_AMBIENCE3   plt107.voc         0   0  255  3   0   // #172
definesound FIRE_CRACKLE        plt109.voc         0   0   254 2   0   // #194

// CRACKS
// leave blank
definesound JIBBED_ACTOR1       radio.wav      0   0   0 0  0 // #222
definesound JIBBED_ACTOR2       letgod.wav      0   0   0 0  0 // #223
definesound JIBBED_ACTOR3       inhell.wav      0   0   0 0  0 // #224
definesound JIBBED_ACTOR4       warishel.wav      0   0   0 0  0 // #225
definesound JIBBED_ACTOR7       getsom.wav      0   0   0 0  0 // #228
definesound JIBBED_ACTOR8       groovy.wav      0   0   0 0  0 // #265
definesound JIBBED_ACTOR9       warishel.wav      0   0   0 0  0 // #266
definesound JIBBED_ACTOR10      letgod.wav      0   0   0 0  0 // #267
definesound JIBBED_ACTOR11      groovy.wav      0   0   0 0  0 // #268
definesound WHIPYOURASS         step1.wav      -256 0    0   0   0 // #294
definesound JIBBED_ACTOR12      warishel.wav      0   0   0 0  0 // #269



// War ambience sounds
definesound WAR_AMBIENCE1      TOMGUN1.VOC   0 0 254 16 0 // #231
definesound WAR_AMBIENCE2      GUNS2.WAV   0 0 254 16 0 // #232
definesound WAR_AMBIENCE3      clscom3.voc   0 0 254 16 0 // #233
definesound GENERIC_AMBIENCE17 RIFLE3.WAV   0 0 254 16 0 // #177
definesound WAR_AMBIENCE10     GUNS3.WAV   0 0 254 16 0 // #240
definesound WARAMB1            MACHGUN3.WAV   0 0 254 16 0 // #336
definesound WARAMB2            clscom1.voc  0 0 254 16 0 // #337
definesound WARAMB3            GUNS1.WAV  0 0 254 16 0 // #338
definesound GENERIC_AMBIENCE13 salvdis3.voc  0 0 254 16 0 // #189
definesound GENERIC_AMBIENCE16 distguns.voc  0 0 254 16 0 // #193
definesound GENERIC_AMBIENCE12 TOMGUN2.voc    0 0 254 16 0 // #188
definesound BOATCOM            TOMGUN1.voc   0 0 254 16 0 // #379
definesound LNDING1            HMG.WAV   0 0 254 16 0 // #380
definesound LNDING2            RIFLE1.WAV   0 0 254 16 0 // #381
definesound LNDING3            GUNS4.WAV   0 0 254 16 0 // #382
definesound RAIN               rain.WAV   0    0    1   2   9000 // #401            


// chat
definesound RADIO1           radio1.voc  0   0   254 16 0 // #386
definesound WAR_AMBIENCE5    plt020.voc  0   0   254 16 0 // #235
definesound WAR_AMBIENCE8    plt069.voc  0   0   254 16 0 // #238
definesound WAR_AMBIENCE9    radio07.voc 0   0   254 0  0 // fire mission#239
definesound GENERIC_AMBIENCE14 dropz.voc 0   0  255 16 0 // #190
definesound GENERIC_AMBIENCE15 getin.voc 0   0  255 16 0 // #192
definesound AMBUSH3            hold1.voc 0   0  0 0 0 // #328
definesound AIRSTRIKE2         hold2.voc 0   0  0 0 0 // #345
definesound WARAMB30           job.voc   0   0  254 16 0 // #346
definesound WARAMB31           blank.voc 0   0  254 16 0 // #347
definesound AIRSTRIKE          radio6.voc 0  0  254 16 0 // #313
definesound GENERIC_AMBIENCE19 plt119.voc 0   0  255 16 0 // radiocheck#179
definesound GENERIC_AMBIENCE21 plt065.voc 0   0  255 16 0 // eagl,eagl #181
definesound INCOMING        plt060.voc    0   0  254 16 0 // #340
definesound HK1             radio01.voc    0   0  254 16 0 // rdo chat #341
definesound HK2             radio04.voc    0   0  254 16 0 // rdo chat #342
definesound GENERIC_AMBIENCE22 radio05.voc 0   0  254 16 0 // rdo cht #182
definesound RIPHEADNECK        radio06.voc 0   0  254 16  0 // #284


// ORIGINAL SOUNDS
definesound GENERIC_AMBIENCE4  buzz2.wav   -256  0    0   2   0 // #173
definesound MONITOR_ACTIVE     blank.voc       0    0    0   0   0 // #212
definesound WATER_GURGLE       h2ogrgl2.voc    0    0    1   2   9000 // #220
definesound EXITMENUSOUND      salvo1.voc      0    0    0   0   0 // #243
definesound INTO_MENU          grmvox4.voc    1024 1024 0   0   0 // #248


definesound SPACE_AMBIENCE2    RKONE.WAV     0    0    0   16  0 // #282
definesound ALIEN_ELEVATOR1    hydro43.voc     0    0    0   0   0 // #261
definesound GENERIC_AMBIENCE9  plt112.voc      0    0   254  0   0 // fstfght#185


// END EPISODE SOUNDS
definesound ENDSEQVOL2SND1    plt046.voc     0   0   254 0   0
definesound ENDSEQVOL2SND2    plt046.VOC      0   0   254 0   0
definesound ENDSEQVOL2SND3    blank.VOC      0   0   254 0   0
definesound ENDSEQVOL2SND4    blank.VOC      0   0   254 0   0
definesound ENDSEQVOL2SND5    blank.voc      0   0   254 0   0
definesound ENDSEQVOL2SND6    blank.voc      0   0   254 0   0
definesound ENDSEQVOL2SND7    blank.voc      0   0   255 0   0

definesound ENDSEQVOL3SND1    blank.VOC    0   0   254 0   0
definesound ENDSEQVOL3SND2    blank.VOC    0   0   254 0    0
definesound ENDSEQVOL3SND3    blank.VOC    0   0   254 0   0
definesound ENDSEQVOL3SND4    blank.VOC    0   0   254 1   0
definesound ENDSEQVOL3SND5    blank.voc    0   0   250 0   0
definesound ENDSEQVOL3SND6    blank.voc    0   0   251 0   0
definesound ENDSEQVOL3SND7    blank.voc    0   0   252 0   0
definesound ENDSEQVOL3SND8    blank.voc    0   0   253 0   0
definesound ENDSEQVOL3SND9    blank.voc    0   0   254 0   0



// WEAPON CHANGES
// **************

gamevar TRIPBOMB_CONTROL 2 0
gamevar STICKYBOMB_LIFETIME 100 0 
gamevar STICKYBOMB_LIFETIME_VAR 30 0  

// for weapon #1 puukko
gamevar WEAPON0_FLAGS 292 0


// for weapon #2 ritsa
gamevar WEAPON1_TOTALTIME 15 0 // increased rate of fire
gamevar WEAPON1_CLIP 8 0
gamevar WEAPON1_RELOAD 52 0 // 52
gamevar WEAPON1_SHOOTS SHOTGUN 0 

// for weapon #3 ärkoo
gamevar WEAPON2_FIREDELAY 2 0
gamevar WEAPON2_TOTALTIME 4 0 // increased rate of fire
gamevar WEAPON2_RELOAD 52 0 // 52
gamevar WEAPON2_CLIP 30 0
gamevar WEAPON2_SPAWNTIME 2 0
gamevar WEAPON2_SHOTSPERBURST 0 0
gamevar WEAPON2_FIRESOUND SHOTGUN_FIRE 0
gamevar WEAPON2_FLAGS 64 4
gamevar WEAPON2_SOUND2SOUND 0 0
gamevar WEAPON2_SHOOTS SHOTGUN 0

// for weapon #4 kooveekookoo
gamevar WEAPON3_RELOAD 100 0
gamevar WEAPON3_CLIP 75 0
gamevar WEAPON3_SPAWNTIME 2 0 
gamevar WEAPON3_SPAWN SHOTGUNSHELL 0
gamevar WEAPON3_FLAGS 85 0 

// for weapon #5 ämppäri
gamevar WEAPON4_FIREDELAY 2 0
gamevar WEAPON4_TOTALTIME 3 0 // increased rate of fire
gamevar WEAPON4_RELOAD 52 0 // 52
gamevar WEAPON4_CLIP 30 0
gamevar WEAPON4_SPAWNTIME 2 0 
gamevar WEAPON4_SPAWN SHELL 0
gamevar WEAPON4_FLAGS 64 4
gamevar WEAPON4_SHOOTS SHOTSPARK1 0
gamevar WEAPON4_FIRESOUND REACTOR_ON 0

// for weapon #7a panssarinyrkki
gamevar WEAPON6_SHOOTS RPG 0 
gamevar WEAPON6_FIRESOUND RPG_SHOOT 0
gamevar WEAPON6_FIREDELAY 11 0   
gamevar WEAPON6_TOTALTIME 12 0   
gamevar WEAPON6_FLAGS 0 0

// for weapon #7b kihvääri
gamevar WEAPON11_RELOAD 52 0
gamevar WEAPON11_CLIP 5 0
gamevar WEAPON11_SHOOTS SHOTGUN 0 
gamevar WEAPON11_FIREDELAY 2 0
gamevar WEAPON11_FLAGS 64 0
gamevar WEAPON11_TOTALTIME 23 0
gamevar WEAPON11_FIRESOUND SNIPER 0

// for weapon #8  coltin veljekset
gamevar WEAPON7_FLAGS 1 0
gamevar WEAPON7_SHOOTS SHOTGUN 0
gamevar WEAPON7_FIRESOUND AK47 0
gamevar WEAPON7_CLIP 12 0
gamevar WEAPON7_INITIALSOUND 0 0 
gamevar WEAPON7_RELOAD 40 0 // 32 0
gamevar WEAPON7_FIREDELAY 3 0
gamevar WEAPON7_SOUND2SOUND 0 0
gamevar WEAPON7_TOTALTIME 7 0

// BFG - Big Fragging Gun
gamevar WEAPON9_SHOOTS RPG 0 
gamevar WEAPON9_FIRESOUND RPG_SHOOT 0
gamevar WEAPON9_FIREDELAY 2 0   
gamevar WEAPON9_TOTALTIME 3 0 
gamevar WEAPON9_CLIP 1 0
gamevar WEAPON9_RELOAD 80 0 // 32 0  
gamevar WEAPON9_FLAGS 0 0

// ***********
// definitions
// ***********
// new
define RADIST 3547
define POW1   3428
define POW2   3430 // end guy

// define SIGNALER 2100
define GER_CAP 2762
define DEADGERMAN 2061
define RAISE_MORALE 3297
define LOWER_MORALE 3298
define INSTA_EXPO 1063
define ATTACKING_WERTROOP 2116
define BELT_FEEDER 2117
define DUCKING_WERTROOP 2118
define RUNNING_WERTROOP 2119
define CTF_BLOCK 492
define COLT_1911 36
define MORTAR_DOWN 1230
define FIREMIS_SPAWN 3600
define RADIO_SW 3598
define SKELETON 3704
define SS_TROOP 1950
define WINEBOTTLE 976
define WINEBOTTLE2 983
define WINDOW1 3339
define WINDOW2 3347
define WINDOW3 3391
define WINDOW4 3408
define CANNON 2754
define SMALL_BOMBER 34
define BLOCK_PLAYER 3633
define SPLASH 1381
define MOTHER_SHELL 1230
define PARAPLANE 69

// old
define FENCE1 3831
define ILMAMIINA 58
define PIINA 172
define BLUEMAINFLAG 1800
define REDMAINFLAG 1812
define DEADALLY 2046
define BEASTFLAG 1879
define FIREVASE 1390
define PIKKUSAVU 2328
define SHARK 1549
define ENSPA 1921
define DEMOMAN 1739
define RADIOMAN 1679
define MEDIC 1726
define ALLY_SOLDIER 2149
define SIRPALE 1553
define LIEKITYS 1889
define MORTAR10 2700
define MORTAR11 2701
define MORTAR12 2702
define MORTAR13 2703
define MORTAR14 2704
define MORTAR15 2705
define MORTAR16 2706
define NUOLI 1919
define F105 2675
define AMMUS 3796
define WORDZ 606
define OHJUS3 2680
define CO1 3690
define CO2 3692
define SMOKE 1551
define FLASH 3268
define EXPLOSIONSMOKE 1670
define XPLOSION 3279
define SIRPALE2 1552

define RAKETTIYLOS 3574
define SMOKESPAWNER 307
define ROCKETSPAWNER 308
define ROCKETSPAWNER2 306
define ROCKETSPAWNER3 416

// PER PLAYER VARIABLES
gamevar PLR_STATUS      1 1 // per player var, value 1
gamevar PLR_FTSPECITEM  1 1 
gamevar PLR_MORALE      1 1
gamevar PLR_MODE        1 1     
gamevar PLR_ITEM        1 1
gamevar PLR_DETECTMINES 1 1
gamevar PLR_HEALCOUNT   1 1
gamevar PLR_SMOKECOUNT  1 1
gamevar PLR_SHELLCOUNT  1 1
gamevar PLR_PANIC       1 1
gamevar MCURKEE         1 1 

// GLOBALLY USED VARIABLES
gamevar CTF_STATUS      0 0 // global var, value 0
gamevar RESTART         0 0
gamevar MIS_OBJECTIVE   0 0
gamevar ATTACK_MODE     0 0 


// *******************************************
// some general states that all actors can use
// *******************************************

state nuke
 ifrnd 128
  spawn GLOW
   else
    ifrnd 128
     spawn GLOW
      else
       ifrnd 128
	spawn GLOW
	 else
	  spawn GLOW

 ifrnd 128
  spawn GLOW
   else
    ifrnd 128
     spawn GLOW
      else
       ifrnd 128
	spawn GLOW
	 else
	  spawn GLOW


 ifrnd 128
  sound FLUSH_TOILET
   else
    ifrnd 128
     sound BURN1
      else
       sound BOMB2
killit
ends

state rkone_state
{
soundonce SPACE_AMBIENCE2 
ifcount 6
    {
      resetcount
      ifrnd 35 {
                ifactor RKONE1 spawn RAKETTIALAS quote 123
                else ifactor JUNKERS spawn COLA quote 127
                ifactor ME262 spawn COLA quote 46 
               }
    }
else ifnotmoving { stopsound SPACE_AMBIENCE2 killit } 
}
ends

state pkone_state2
{
soundonce INVADER
ifcount 6
    {
      resetcount
      ifrnd 35 {               
                ifactor SMALL_BOMBER spawn F105 quote 197
                ifactor DEVISTATORSPRITE sound VIHELLYS spawn COLAX quote 139
               }
    }
else ifnotmoving { stopsound INVADER killit } 
}
ends

state xplosnd
{
ifrnd 34 sound FLUSH_TOILET
else ifrnd 34 sound HOVER_CRAFT
else ifrnd 34 sound FAN  
else ifrnd 34 sound PIPEBOMB_EXPLODE
else sound RPG_EXPLODE
}
ends

state ally_hitsfx
ifrnd 17 sound JHIT
else ifrnd 17 sound MELEG
else ifrnd 17 sound MYLEG
else ifrnd 17 sound MYLEG2
else ifrnd 17 sound OAAA2
else ifrnd 17 sound OAAAA
else ifrnd 17 sound OOOO
else ifrnd 17 sound OOOO2
else ifrnd 17 sound OW1
else ifrnd 17 sound SLIM_ROAM
else ifrnd 17 sound SLIM_RECOG
else ifrnd 17 sound SLIM_ATTACK
else ifrnd 17 sound SLIM_DYING
else ifrnd 17 sound DUKE_PISSRELIEF
else sound OW2
ends

state xplosp
       spawn EXPLOSION2 spawn BURNING spawn SHARK spawn SIRPALE 
       spawn EXPLOSION2 spawn FLARESMOKE spawn FLARESMOKE spawn EXPLOSION2 
       spawn EXPLOSION2 spawn EXPLOSION2 spawn FLARESMOKE spawn EXPLOSION2
       ifrnd 128 { spawn EXPLOSION2 spawn EXPLOSION2 spawn EXPLOSION2 }
       ifrnd 64 { spawn EXPLOSION2 spawn EXPLOSION2 spawn EXPLOSION2 }
ends

// fire mission spawners for radioman
state sharkspawner
       spawn SHARK spawn SHARK spawn SHARK spawn SHARK 
       spawn SHARK spawn SHARK spawn SHARK spawn SHARK 
       spawn SHARK spawn SHARK spawn SHARK spawn SHARK
       ifrnd 128 { spawn SHARK spawn SHARK spawn SHARK }
       ifrnd 64 { spawn SHARK spawn SHARK spawn SHARK }
ends

state standard_pjibs
    guts JIBS1 1
    guts JIBS3 2
    guts JIBS4 1
    guts JIBS5 1
    guts JIBS6 2
    guts DUKETORSO 1
    guts DUKELEG 2
    guts DUKEGUN 1
    ifrnd 16 money 1
ends


// for enemies that cause fear
state fear_state
{
ifvarg PLR_MORALE 8
        {
        ifrnd 78 addvar PLR_MORALE -8
        ifrnd 78 addvar PLR_MORALE -4
        else addvar PLR_MORALE -3
        }
}
ends

// morale reduced when shot at
state plrshot_state
{
ifvarg PLR_MORALE 2
        {
        ifrnd 64 addvar PLR_MORALE -3
        else ifrnd 64 addvar PLR_MORALE -2
        else addvar PLR_MORALE -1
        }
}
ends

// morale raised when ss killed
state ssdead_state
{
ifvarl PLR_MORALE 96 addvar PLR_MORALE 5
}
ends

state morale_boost
{
ifvarl PLR_MORALE 25 { ifrnd 64 addvar PLR_MORALE 40
                       else ifrnd 64 addvar PLR_MORALE 30
                       else addvar PLR_MORALE 20
                     }

}
ends


state raisemorale_state
{
ifvarl PLR_MORALE 96 { ifrnd 64 addvar PLR_MORALE 5
                       else ifrnd 128 addvar PLR_MORALE 3
                       else addvar PLR_MORALE 1
                      }
}
ends

state raisemoralehigh_state
{
ifvarl PLR_MORALE 81 { ifrnd 64 addvar PLR_MORALE 20
                       else ifrnd 90 addvar PLR_MORALE 15
                       else addvar PLR_MORALE 10
                      }
}
ends


state gerdethsound
{
ifrnd 34 sound PRED_DYING
else ifrnd 34 sound VAULT_DOOR
else ifrnd 34 sound GDETH1
else ifrnd 34 sound GDETH2
else ifrnd 34 sound GDETH3
else ifrnd 34 sound GDETH4
else ifrnd 34 sound GDETH5
else sound GDETH6
}
ends

state ger_sfx
{
ifrnd 32 soundonce DUKE_JETPACK_OFF
else ifrnd 32 soundonce VCAMB1
else ifrnd 32 soundonce VCAMB2
else ifrnd 32 soundonce PRED_ROAM2
else ifrnd 32 soundonce END_OF_LEVEL_WARN
else ifrnd 32 soundonce SHORT_CIRCUIT
else ifrnd 32 soundonce KTIT
else soundonce PIG_ROAM3

}
ends






// used when a sprite vehicle or ammo box is destroyed
state tdead
{
hitradius 4500 25 50 100 200
spawn SIRPALE spawn SIRPALE ifrnd 128 { spawn SIRPALE spawn SIRPALE }

spawn EXPLOSION2 sound BOMB2
ifrnd 128 debris SCRAP1 30 else debris SCRAP1 10

ifactor LIZMANJUMP { stopsound DUKE_HARTBEAT }

ifactor FEM4 break
ifactor SHRINKEREXPLOSION break 
else killit

}
ends

// used in sprite vehicle hits
state vehiclehit

        ifwasweapon SHRINKSPARK { sound METALLI debris SCRAP1 20 }
        
        ifwasweapon RADIUSEXPLOSION
        { sound METALLI }
        
        ifwasweapon FIRELASER 
        { sound METALLI debris SCRAP1 10 }

        ifwasweapon SHOTSPARK1 { sound PISTOL_RICOCHET addstrength 20 }

        ifwasweapon RPG { sound PISTOL_RICOCHET addstrength 20  }

        ifwasweapon GROWSPARK { sound PISTOL_RICOCHET addstrength 80 }

        ifwasweapon KNEE { addstrength 50 }
ends

// just in case the game needs it
state genericshrunkcode
ends


// **************
//     actors
// **************


// #3297
useractor notenemy RAISE_MORALE 0 0
{
cstat 32768
ifaction 0 { ifpdistl 2048 { ifspritepal 10 state raisemorale_state
                             else ifspritepal 11 state raisemoralehigh_state
                             else ifspritepal 12 { state raisemoralehigh_state
                                                   state raisemorale_state
                                                   state raisemorale_state
                                                 }

                              ifspritepal 13 { ifrnd 10 state raisemorale_state }
                              else killit
                              

                           }
           }
}
enda

// #3298
useractor notenemy LOWER_MORALE 0 0
{
cstat 32768
ifaction 0 { ifpdistl 2048 { ifspritepal 10 state plrshot_state
                             else ifspritepal 11 state fear_state
                             else ifspritepal 12 { state fear_state
                                                   state plrshot_state
                                                   state plrshot_state
                                                  }
                              ifspritepal 13 { ifrnd 10 state plrshot_state }
                              else killit
                             }
           }
}
enda

action ZEROSMOKE
useractor notenemy SMOKESPAWNER 0 0
ifaction 0
        {
        cstat 32768
        ifspritepal 10 { ifrnd 64 spawn SMALLSMOKE }
        else { spawn SMALLSMOKE
               ifcount 50 { action ZEROSMOKE resetcount }
             }
        }

ifaction ZEROSMOKE
        {
        ifrnd 64 spawn SMALLSMOKE
        ifcount 50 killit
        }
enda

action RS2
action RS3
action RS4

useractor notenemy ROCKETSPAWNER 100 0 0
ifaction 0 { ifcount 100 { spawn SMOKESPAWNER spawn RAKETTIYLOS resetcount action RS2 } }
ifaction RS2 { ifcount 100 { spawn RAKETTIYLOS resetcount action RS3 } }
ifaction RS3 { ifcount 100 { spawn SMOKESPAWNER spawn RAKETTIYLOS resetcount action RS4 } }
ifaction RS4 { ifcount 100 { spawn RAKETTIYLOS killit } }
enda

action RS6
action RS7
action RS8

useractor notenemy ROCKETSPAWNER2 100 0 0
ifaction 0 { ifcount 130 { spawn SMOKESPAWNER spawn RAKETTIYLOS resetcount action RS6 } }
ifaction RS6 { ifcount 100 { spawn RAKETTIYLOS resetcount action RS7 } }
ifaction RS7 { ifcount 100 { spawn SMOKESPAWNER spawn RAKETTIYLOS resetcount action RS8 } }
ifaction RS8 { ifcount 100 { spawn RAKETTIYLOS killit } }
enda

useractor notenemy ROCKETSPAWNER3 100 0 0
ifcount 200 { ifrnd 2 { ifrnd 24 { spawn RAKETTIALAS killit } } }
enda



action RAKETTI 0 1 5 1

move UPFAST 300 -300
useractor notenemy RAKETTIYLOS 100 0 UPFAST geth getv
{
ifaction 0
        { sound PRED_ATTACK action RAKETTI }

ifaction RAKETTI
        {
        sizeat 40 40
        ifcount 1 { spawn EXPLOSION2 resetcount }
        spawn SMALLSMOKE
        ifceilingdistl 10 killit
        ifnotmoving killit
        }
}
enda

action RAKETTI2 -1 1 5 1

move DOWNFAST 250 250
useractor notenemy RAKETTIALAS 100 0 DOWNFAST geth getv
{
ifaction 0 { cstat 8 sound PRED_ATTACK action RAKETTI2 }

ifaction RAKETTI2
        { 
        sizeat 40 40
        ifcount 1 { spawn EXPLOSION2 resetcount }
        spawn SMALLSMOKE
        iffloordistl 10 { sound SHRINKER_HIT debris SCRAP6 8 debris SCRAP2 8 state sharkspawner killit }
        }
}
enda

action CTF_IDLE
useractor notenemy CTF_BLOCK 0 0
{
 ifaction 0
 {
      ifpdistl 1024
      {
           ifvare PLR_STATUS 1 { quote 204 killit }
           else ifcount 50 killit           
      }
 }


}
enda

// Radio switch for ordering fire missions
gamevar FIRE_MISSION 0 0
action RADIO_DEFEND 0 1 1 1
action RADIO_DEFEND2 0 1 1 1
action RADIO_DEFEND3 0 1 1 1
action INCOM1 0 1 1 1
action INCOM_ACTIVATE 1 1 1 1
action INCOM2 1 1 1 1
useractor notenemy RADIO_SW 0 INCOM1
{
ifaction INCOM1
{
ifspritepal 10 action RADIO_DEFEND
else 
ifpdistl 800 {
           ifhitspace {
                    ifvarl FIRE_MISSION 1 { quote 47
                                            setvar FIRE_MISSION 1
                                            sound WAR_AMBIENCE9
                                            resetcount
                                            action INCOM_ACTIVATE
                                          }
                  }
              }
}

ifaction INCOM_ACTIVATE
{
ifpdistg 1024 { quote 48 setvar FIRE_MISSION 0
                stopsound WAR_AMBIENCE9 action INCOM1
              }
ifcount 230 { resetcount 
              setvar FIRE_MISSION 2
              action INCOM2
            }
}

ifaction INCOM2
{
ifcount 499 setvar FIRE_MISSION 3
ifcount 500 { setvar FIRE_MISSION 0
              action INCOM1
            }
}

ifaction RADIO_DEFEND
{
ifvare MIS_OBJECTIVE 1
{
ifrnd 1 { ifrnd 80 soundonce AMBUSH3
          else ifrnd 80 soundonce HK1
          else ifrnd 80 soundonce AIRSTRIKE2
        } 
}
else ifvare MIS_OBJECTIVE 2 { soundonce HK2 resetcount action RADIO_DEFEND2 }
}

ifaction RADIO_DEFEND2
{
ifcount 400 { soundonce GENERIC_AMBIENCE22 action RADIO_DEFEND3 }
}

ifaction RADIO_DEFEND3
{
ifcount 400 { soundonce RIPHEADNECK resetcount }
}




}
enda

// to be used with fire mission caller
// spritepal 1 = sfx for mortar
action FIRE_MIS
action FIRE_MIS_IDLE 
action MORT_SOUND
useractor notenemy FIREMIS_SPAWN 0 0
{
ifaction 0 { cstat 32768 ifspritepal 1 action MORT_SOUND
                         else action FIRE_MIS
           }

ifaction FIRE_MIS {  ifvarg FIRE_MISSION 2 { spawn MOTHER_SHELL
                                             action FIRE_MIS_IDLE
                                             resetcount
                                           }
                  }

ifaction FIRE_MIS_IDLE { ifcount 550 action FIRE_MIS }

ifaction MORT_SOUND { ifvarg FIRE_MISSION 1 { ifrnd 7 sound SPACE_DOOR3 } }
}
enda


state bottle
{
ifpdistl RETRIEVEDISTANCE
              {
                  
                  ifphealthl MAXPLAYERHEALTH
                  { quote 153
                    state raisemoralehigh_state                    
                    state raisemorale_state
                    sound AMBUSH2  // gulp
                    addphealth 3 killit
                  }

                  ifvarl PLR_MORALE 100
                  {
                    sound AMBUSH2  // gulp
                    state raisemoralehigh_state
                    state raisemorale_state
                    quote 137 killit
                  }
               }
ifhitweapon { lotsofglass 5 sound GLASS_BREAKING killit }
}
ends


// wine bottle that gives health
useractor notenemy WINEBOTTLE 1 0
cstat 256
ifaction 0 state bottle
enda

useractor notenemy WINEBOTTLE2 1 0
cstat 256
ifaction 0 state bottle
enda


// windows
action NORM 0 0 0 0 10
action BROKEN -9 0 0 0 
useractor notenemy WINDOW1 1 NORM
cstat 272
ifaction NORM
{ 
ifhitweapon { lotsofglass 15 sound GLASS_BREAKING action BROKEN break }
}
enda

action NORM2 0 0 0 0 10
action BROKEN2 1 0 0 0 
useractor notenemy WINDOW2 1 NORM2
cstat 272
ifaction NORM2
{ 
ifhitweapon { lotsofglass 15 sound GLASS_BREAKING action BROKEN2 break }
}
enda


action NORM3 0 0 0 0 10
action BROKEN3 33 0 0 0 
useractor notenemy WINDOW3 1 NORM3
cstat 272
ifaction NORM3
{ 
ifhitweapon { lotsofglass 15 sound GLASS_BREAKING action BROKEN3 break }
}
enda

action NORM4 0 0 0 0 10
action BROKEN4 1 0 0 0 
useractor notenemy WINDOW4 1 NORM4
cstat 272
ifaction NORM4
{ 
ifhitweapon { lotsofglass 15 sound GLASS_BREAKING action BROKEN4 break }
}
enda






// cannon
action CANNO 0 1 7 0 10
action CANWAIT 0 1 7 0 10
useractor notenemy CANNON 10000 CANNO
ifaction CANNO
{
  sizeat 43 43 cstat 257
  ifspritepal 10 {
        ifhitweapon { ifwasweapon RADIUSEXPLOSION { addvar MIS_OBJECTIVE 1 state tdead }
                      else ifwasweapon RPG { addvar MIS_OBJECTIVE 1 state tdead }
                    }
                 }
}
enda



// block_player
action BLOCK 431 0 0 0 1
action BLOCK2 431 0 0 0 1
action LET_GO

state init_block
{
cstat 273 sizeat 320 320
ifspritepal 11 action BLOCK
ifspritepal 10 { ifpdistl 24000 { quote 192 setvar MIS_OBJECTIVE 1
                                  resetcount action BLOCK
                        } } // e1l3

ifspritepal 15 { quote 181 action BLOCK }

ifspritepal 12 action BLOCK2
}
ends


useractor notenemy BLOCK_PLAYER 0 0
{                  
ifaction 0 { ifspritepal 10 state init_block
             else ifspritepal 11 state init_block
             else ifspritepal 12 state init_block
             else ifspritepal 15 state init_block
             else { cstat 17 break }
           }


else {
        ifaction BLOCK
        {
        
        ifspritepal 11 { ifpdistl 2048 { 
                          ifvare MCURKEE 1 quote 190 else ifvare MCURKEE 2 { sound OCTA_ATTACK1 cstat 32768 action LET_GO }
                                       }
                       }
        else ifspritepal 15 { ifcount 5400 { quote 107 sound M23 cstat 32768 action LET_GO } }

        // about 5 minutes
        else { 
               ifcount 5000 { ifrnd 30 ifvare MIS_OBJECTIVE 1 { setvar MIS_OBJECTIVE 2 } }
               ifcount 5400 { quote 193 setvar MIS_OBJECTIVE 3 cstat 32768 action LET_GO }
             }
        }
 
        ifaction BLOCK2 // e1l4
        {
         ifpdistl 3000 {
                         ifvare MIS_OBJECTIVE 3 { cstat 32768 action LET_GO }
                         else quote 202 
                       }
        }
     }
}
enda


// splash
action SPLASH1 -1 5 1 1 10
useractor notenemy SPLASH 0 SPLASH1
{
cstat 128
sizeat 70 70
ifaction SPLASH1
        {
        sizeat 190 190 
        ifactioncount 5 killit
        }
}
enda


// fence
action AITA1 0 1 1 1 1
useractor notenemy FENCE1 TOUGH AITA1
cstat 17
enda


// bounding apers going up and exploding
move apers9 0 -400
action BOUNDAPERS 0 1 1 1 1
useractor notenemy ILMAMIINA 0 BOUNDAPERS apers9 faceplayer  
sizeat 40 40 
ifaction BOUNDAPERS
        {
        ifcount 8 
                { 
                sound INTRUDER_ALERT 
                spawn EXPLOSION2
                debris SCRAP6 9
                debris SCRAP2 9
                hitradius 4500 20 30 50 90
                killit
                } 
        }
enda



action CO1DIE -182 5 5 1 19
action CO2DIE -180 5 5 1 19
action RADISTDIE -39 5 5 1 19
action POW1DIE 80 5 5 1 19  
action POW2DIE 78 5 5 1 19

state co_pain
{
        ifdead {
                 stopsound M1 stopsound WAR_AMBIENCE7
                 stopsound SPACE_DOOR4 stopsound SPACE_DOOR2
                 stopsound SPACE_DOOR1 stopsound M4
                 stopsound M5 stopsound M23
                 stopsound M21 stopsound M22CAP
                 stopsound M3 stopsound M7
                 stopsound M24 stopsound M25
                 stopsound M26 stopsound M27

                state ally_hitsfx

                ifvarg PLR_MORALE 15 addvar PLR_MORALE -15
                state fear_state state plrshot_state
                ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_pjibs killit break }
                else ifwasweapon RPG { sound SQUISHED state standard_pjibs killit break }
                else { ifactor CO1 action CO1DIE
                       else ifactor CO2 action CO2DIE
                       else ifactor RADIST action RADISTDIE
                       else ifactor POW1 action POW1DIE
                       else ifactor POW2 action POW2DIE
                     }

                }
         else { ifrnd 10 state ally_hitsfx }
}
ends


// Commanding officer
action COLI1 
action CO11 -10 1 1 1 1
action CO12 -10 2 1 1 15
action CO13 -10 1 1 1 1
action CO14 -10 2 1 1 15
action CO15 -10 2 1 1 15
action CO16 -10 2 1 1 15
action CO18 -10 2 1 1 15
action CO19 -10 2 1 1 15
action CO211 -10 2 1 1 15

useractor notenemy CO1 80 COLI1

ifaction COLI1 { cstat 257 sizeat 18 18 action CO11 }
ifhitweapon state co_pain
ifpdistl 2048 { ifrnd 2 state raisemorale_state }
ifaction CO1DIE { ifactioncount 5 { spawn DEADALLY killit } }

ifaction CO11
{
ifspritepal 15 { ifcount 100 { sound M1 spritepal 10 action CO15 break } }

ifspritepal 10 {   // e1l1
              ifrnd 1
                { ifrnd 64
                   {
                 state raisemorale_state
                 state raisemorale_state
                 ifrnd 51 { sound M1 action CO15 break }
                 else ifrnd 51 sound WAR_AMBIENCE7
                 else ifrnd 51 sound SPACE_DOOR4
                 else ifrnd 51 sound SPACE_DOOR2
                 else sound SPACE_DOOR1
                 action CO12
                    }
                }
              }

else ifpdistl 2048
                {
                ifspritepal 11 { sound M4 action CO14 } // e1l4
                ifspritepal 12 { sound M5 action CO16 } // e1l5
                ifspritepal 16 { sound M23 action CO18 } // e2l3
                ifspritepal 18 { sound M21 action CO19 } // e2l1
                ifspritepal 21 { sound M22CAP action CO211 } // e2l2cap
                }

}
ifaction CO16 { ifactioncount 115 action CO13 }
ifaction CO19 { ifactioncount 81 action CO13 }
ifaction CO15 { ifactioncount 47 action CO11 } // e1l1beach
ifaction CO18 { ifactioncount 74 action CO13 }
ifaction CO12 { ifactioncount 25 action CO11 } // e1l1beach
ifaction CO211 { ifactioncount 66 action CO13 } // e2l1cap
ifaction CO14 { ifactioncount 70 { spawn ALLY_SOLDIER killit } }

ifaction CO13
{
ifpdistl 1024
        { ifhitspace
                { 
                   ifspritepal 11 { sound M4 action CO14 }
                   ifspritepal 12 { sound M5 action CO16 }
                   ifspritepal 16 { sound M23 action CO18 }
                   ifspritepal 18 { sound M21 action CO19 } // e2l1
                   ifspritepal 21 { sound M22CAP action CO211 } // e2l2cap
                }
        }
}
enda

action CO2LI 
action CO21 -12 1 1 1 1
action CO22 -12 2 1 1 15
action CO23 -12 1 1 1 1
action CO24 -12 2 1 1 15
action CO244 -12 2 1 1 15
action CO25 -12 2 1 1 15
action CO26 -12 2 1 1 15

useractor notenemy CO2 80 CO2LI

ifaction CO2LI { cstat 257 sizeat 17 17 action CO21 }
ifpdistl 2048 { ifrnd 2 state raisemorale_state }
ifhitweapon state co_pain
ifaction CO2DIE { ifactioncount 5 { spawn DEADALLY killit } }

ifaction CO21
{
ifpdistl 2048
                {
                ifspritepal 10 { sound M3 action CO22 } // e1l3
                ifspritepal 11 { sound M7 action CO26 } // e1l7
                ifspritepal 12 { sound M24 action CO244 } // e2l4
                ifspritepal 15 { sound M25 action CO24 } // e2l5
                ifspritepal 16 { sound M26 action CO24 } // e2l6
                ifspritepal 18 { sound M27 action CO25 } // e2l7
                }

}

ifaction CO244 { ifactioncount 81 action CO23 }
ifaction CO22 { ifactioncount 62 action CO23 }
ifaction CO24 { ifactioncount 101 action CO23 }
ifaction CO25 { ifactioncount 123 action CO23 }
ifaction CO26 { ifactioncount 70 action CO23 }

ifaction CO23
{
ifpdistl 1024
        { ifhitspace
                { 
                   ifspritepal 10 { sound M3 action CO22 }
                   ifspritepal 11 { sound M7 action CO26 }
                   ifspritepal 12 { sound M24 action CO244 }
                   ifspritepal 15 { sound M25 action CO24 }
                   ifspritepal 16 { sound M26 action CO24 }
                   ifspritepal 18 { sound M27 action CO25 }
                }
        }
}
enda





action MINIRADIST
action RADIST1 4 1 1 1 1
useractor notenemy RADIST 80 MINIRADIST
{
ifaction MINIRADIST { cstat 257 sizeat 18 18 action RADIST1 }
ifhitweapon state co_pain
ifaction RADISTDIE { ifactioncount 5 { spawn DEADALLY killit } }
}
enda

action MINIPOW
action POW11 20 1 1 1 1
useractor notenemy POW1 80 MINIPOW
{
ifaction MINIPOW { cstat 257 sizeat 18 18 action POW11 }
ifhitweapon state co_pain
ifaction POW1DIE { ifactioncount 5 { spawn DEADALLY killit } }
}
enda

action MINIPOW2
action POW22 17 1 1 1 1
action POW23 17 1 1 1 1
useractor notenemy POW2 80 MINIPOW2
{
ifaction MINIPOW2 { cstat 257 sizeat 18 18 action POW22 }
ifaction POW22
{
 ifspritepal 12 { ifcansee { spritepal 16 resetcount sound DUKE_HIT_STRIPPER1 action POW23 } }
}
ifhitweapon state co_pain
ifaction POW2DIE { ifactioncount 5 { spawn DEADALLY killit } }
ifaction POW23 { ifcount 300 { endofgame 52 action POW22 } }
}
enda

define PATCH_TIME               6000

useractor notenemy FLOOR_BURNT 
fall
cstator 34
sizeat 15 15
ifcount PATCH_TIME 
  {
    killit
  }
enda

// says locked when player near
action SANA
action SANA2
useractor notenemy WORDZ 0 SANA
ifaction SANA
{
cstat 32768

ifp palive {
            ifpdistl 800
                {
                ifspritepal 10 { quote 151 action SANA2 }
                ifspritepal 11 { ifhitspace { quote 12 action SANA2 } }
                ifspritepal 12 { quote 136 action SANA2 }
                }
           }

}

ifaction SANA2
{ ifpdistg 800 action SANA }
enda



// use in barb wires and propellos
action PII 0 1 1 1 1
useractor notenemy PIINA 0 PII
{
ifaction PII
              {
               cstat 32768
               
               ifspritepal 10 {
                               ifpdistl 500 { ifp palive { addphealth -200 } }
                              }

               ifspritepal 11
                        { ifpdistl 700 { ifcount 20 { addphealth -1 palfrom 16 16 ifrnd 50 sound DUKE_LONGTERM_PAIN2 resetcount } } }  

              }
}
enda

useractor notenemy FLATHOLE
fall cstat 32
sizeto 2 2
enda

// arrow for CTF and Fireteam play
action COMM1 0 1 1 1 1
action COMM2 3 1 1 1 1 
action COMM3 4 1 1 1 1 // win

action AG 6 1 1 1 1
action MG 7 1 1 1 1
action SN 8 1 1 1 1
action GR 9 1 1 1 1
action PM 10 1 1 1 1
action ME 11 1 1 1 1
action SQL 12 1 1 1 1
action RM 13 1 1 1 1

state init_nuoli
{
// plr wa flag
spritepal 9 // to avoid loop
ifvare PLR_STATUS 11 { action COMM2 spritepal 1 }
else ifvare PLR_STATUS 12 action COMM2 

// plr wa beats flag
else ifvare PLR_STATUS 21 spritepal 8 
         
// fireteam
else ifvarg PLR_STATUS 12 { ifvarl PLR_STATUS 21 {
         ifvare PLR_STATUS 13 action AG
         else ifvare PLR_STATUS 14 action MG
         else ifvare PLR_STATUS 15 action SN
         else ifvare PLR_STATUS 16 action GR
         else ifvare PLR_STATUS 17 action PM
         else ifvare PLR_STATUS 18 action ME
         else ifvare PLR_STATUS 19 action SQL
         else ifvare PLR_STATUS 20 action RM
                          }                     }
}
ends

useractor notenemy NUOLI 
{
ifspritepal 0 { sizeat 39 39 cstat 0 state init_nuoli }
ifcount 1 killit
}
enda



// flamethrower shoots these
move liekkinop 700 20
action LIEKITYS1 2 10 1 1 5
useractor notenemy LIEKITYS 0 LIEKITYS1 liekkinop geth getv
ifaction LIEKITYS1
{ 
cstat 2
sizeat 10 10
ifactioncount 1 sizeat 55 50
ifactioncount 2 sizeat 20 20
ifactioncount 3 sizeat 10 10
ifactioncount 4 sizeat 30 30
ifactioncount 5 sizeat 40 40
ifactioncount 6 sizeat 20 20
ifactioncount 7 sizeat 50 50
ifactioncount 8 sizeat 20 20
ifactioncount 9 sizeat 100 100
ifactioncount 10 killit
else ifinwater killit
ifnotmoving { ifrnd 128 { spawn BURNING }
              spawn SHRINKEREXPLOSION hitradius 1024 10 20 40 60 killit
            }
}
enda

// shrapnel for explosions
action FB 0 4 1 1 1
action FB2 4 4 1 1 1

move LEN0 1 -42
move LEN1 300 -320
move LEN2 300 -240
move LEN3 300 -160
move LEN4 300 -80
move LEN5 300 0
move LEN6 300 80
move LEN7 300 160
move LEN8 300 240
move LEN9 300 320
move LEN10 20
move LEN11

ai AICRANU0 FB2 LEN0 randomangle
ai AICRANU1 FB2 LEN1 randomangle
ai AICRANU2 FB2 LEN2 randomangle
ai AICRANU3 FB2 LEN3 randomangle
ai AICRANU4 FB2 LEN4 randomangle
ai AICRANU5 FB2 LEN5 randomangle
ai AICRANU6 FB LEN6 randomangle
ai AICRANU7 FB LEN7 randomangle
ai AICRANU8 FB LEN8 randomangle
ai AICRANU9 FB LEN9 randomangle
ai AICRANU10 FB LEN10 randomangle
ai AICRANU11 FB LEN11 randomangle

state cranu0
{ ifcansee ai AICRANU1 else killit }
ends

state cranu1
{
        move LEN1 geth getv
        ifactioncount 4 ai AICRANU2
}
ends

state cranu2
{
        move LEN2 geth getv
        iffloordistl 8 ai AICRANU11
        else ifactioncount 4 ai AICRANU3
}
ends

state cranu3
{
   move LEN3 geth getv
   iffloordistl 8 {  ifonwater ai AICRANU10
                     else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU4
}
ends

state cranu4
{
        move LEN4 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU5
}
ends

state cranu5
{
        move LEN5 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU6
}
ends

state cranu6
{
        move LEN6 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU7
}
ends

state cranu7
{
        move LEN7 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU8
}
ends

state cranu8
{
        move LEN8 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11 }
        else ifactioncount 4 ai AICRANU9
}
ends

state cranu9
{
        move LEN9 geth getv
        iffloordistl 8 {  ifonwater ai AICRANU10
                          else ai AICRANU11
                       }
        else ai AICRANU9
}
ends

state cranu10
{ spawn WATERSPLASH2 killit } 
ends

state cranu11
{
      ifrnd 64 spawn BURNING
      killit
}
ends

state cranu12
{
      spawn EXPLOSION2
      hitradius 1500 25 50 90 170      
      spawn BURNING
      killit
}
ends

useractor notenemy SIRPALE 0 0
{
ifaction 0 { sizeat 48 48 ai AICRANU0 }
else { 
          ifspawnedby RUBBERCAN spawn SMALLSMOKE
          ifai AICRANU0 state cranu0
          else ifai AICRANU1 state cranu1
          else ifai AICRANU2 state cranu2
          else ifai AICRANU3 state cranu3
          else ifai AICRANU4 state cranu4
          else ifai AICRANU5 state cranu5
          else ifai AICRANU6 state cranu6
          else ifai AICRANU7 state cranu7
          else ifai AICRANU8 state cranu8
          else ifai AICRANU9 state cranu9
          else ifai AICRANU10 state cranu10
          else ifai AICRANU11 state cranu11
     }
}
enda
// end of shrapnel for explosions




state smokespawner
       spawn SMOKE spawn SMOKE spawn SMOKE spawn SMOKE
       spawn SMOKE spawn SMOKE spawn SMOKE spawn SMOKE
       spawn SMOKE spawn SMOKE spawn SMOKE spawn SMOKE
ends


// actor for tracers and artillery rounds
action VALO0 0 1 1 1 1
action VALOJUOVA 2247 1 7 1 1
move VALO1 2 -42
move VALO3 2 -70
move VALO2 511

ai AIVALO VALO0 VALO1 faceplayer
ai AIVALO3 VALO0 VALO3 faceplayer
ai AIVALO2 VALOJUOVA VALO2 faceplayer

state valostate3
iffloordistl 35 { } else { ifcansee ai AIVALO2 else killit }
ends

state valostate
     iffloordistl 22 { } else { ifcansee ai AIVALO2 else killit }
ends

state valostate2
    cstat 0
    move VALO2 geth getv
    ifnotmoving { killit } 
    else ifpdistl 1500 { killit }
    else ifcount 100 { killit }
ends

action ASHARK0 0 1 1 1 1
action ASHARK1 0 1 1 1 1
action ASHARK2 0 1 1 1 1
action ACD 0 1 1 1 1
action ACD2 2 1 1 1 1

move YLESPAIN  20 0  
move POISPAIN  150 -50
move SHARKVEL1 0  -27
move SHARKVEL2 240  0
move SHARKVEL3 200  0
move SHARKVEL4 0  100
move SHARKVEL5 650  0
move SHARKVEL6 0  -200
move SHARKVEL7 0  1350
move SHARKVEL8 400  0

ai AIRAJ1 ASHARK2 SHARKVEL3 randomangle
ai AISUUNTAUS ASHARK2 YLESPAIN geth getv
ai AISUUNTAUS2 ASHARK2 POISPAIN geth getv
ai AISHARK1 ASHARK1 SHARKVEL1 faceplayer
ai AISHARK2 ASHARK2 SHARKVEL2 randomangle
ai AISHARK3 ASHARK2 SHARKVEL2 randomangle
ai AICD ACD SHARKVEL2 randomangle

state suuntaustate
{
  ifcount 3 { ai AISUUNTAUS2 resetcount }
  else ifnotmoving killit         
}
ends


state suuntaustate2
{
ifceilingdistl 120 { 

                    // the minimum distance of fire mission
                    ifcount 150 {
                                   ifoutside { spawn TRANSPORTERBEAM killit }
                                   else killit
                                 }
                   }
else { ifnotmoving { ifoutside { spawn TRANSPORTERBEAM killit } 
                      else killit
                   }
     }
}
ends

state sharkstate1
{ ifceilingdistl 50 { ai AISHARK2 resetcount } }
ends

state sharkstate2
{ ifrnd 3 
        { spawn CEILINGSTEAM killit } 
  else 
        { ifcount 220 { spawn CEILINGSTEAM killit } }
}
ends

state sharkstate3
{ ifrnd 1 { ifrnd 32 { spawn CEILINGSTEAM killit } } }
ends




state rajstate1
ifcount 10 { ifrnd 128 { spawn EXPLOSION2 hitradius 1024 8 16 32 64 killit } }
else ifcount 20 { spawn EXPLOSION2 hitradius 1024 8 16 32 64 killit }
ends

state cdstate
ifcount 5 { ifrnd 51 { spawn EXPLOSION2 hitradius 3500 20 40 70 100 killit } }
else ifcount 15 { ifrnd 51 { spawn EXPLOSION2 hitradius 3500 20 40 70 100 killit } }
else ifcount 25 { ifrnd 51 { spawn EXPLOSION2 hitradius 3500 20 40 70 100 killit } }
else ifcount 35 { spawn EXPLOSION2 hitradius 3500 20 40 70 100 killit } 
ends

useractor notenemy SHARK 0 ASHARK0
ifaction ASHARK0 
{    
ifspawnedby RUBBERCAN { cstat 32768 ai AICD }
else ifspawnedby RAKETTIALAS { cstat 32768 ai AICD }
else ifspawnedby TRANSPORTERBEAM { ai AISHARK1 }
else ifspawnedby SPACESHUTTLE { cstat 32768 ai AISHARK3 }
else ifspawnedby LIZTROOPDUCKING { sizeat 43 43 cstat 0 ai AIVALO }
else ifspawnedby LIZMAN { sizeat 43 43 cstat 2 ai AIVALO3 }
else ifspawnedby EXPLOSION2 { cstat 32768 ai AIRAJ1 }
else ifspawnedby RADIOMAN { cstat 2 ai AISUUNTAUS }
else ifspawnedby NUKEBARRELDENTED { cstat 32768 ai AISHARK2 }
else killit
}
else 
        {
          ifai AISHARK1 state sharkstate1
          else ifai AIRAJ1 state rajstate1
          else ifai AISUUNTAUS state suuntaustate
          else ifai AISUUNTAUS2 state suuntaustate2
          else ifai AIVALO state valostate
          else ifai AIVALO2 state valostate2
          else ifai AIVALO3 state valostate3
          else ifai AISHARK2 state sharkstate2
          else ifai AISHARK3 state sharkstate3
          else ifai AICD state cdstate
        }
enda

// for smoke fire missions
action ASMOKE0
move smokeylos 0 -25

ai AISMOKEYLOS ASMOKE0 smokeylos faceplayer
ai AISMOKEHAJO ASMOKE0 SHARKVEL2 randomangle
ai AISMOKEALAS ASMOKE0 SHARKVEL7 faceplayer

useractor notenemy SMOKE 0 0 
ifaction 0 { ifspawnedby SMOKE ai AISMOKEALAS
             else ifspawnedby RESPAWN ai AISMOKEALAS
             else ai AISMOKEYLOS }

ifai AISMOKEYLOS
{
ifspawnedby EXPLOSION2 { ifcount 50 { hitradius 4096 1000 1000 1000 1000 killit } }
else ifspawnedby RUBBERCAN { ifcount 50 { hitradius 4096 1000 1000 1000 1000 killit } }
else ifceilingdistl 100 { ai AISMOKEHAJO resetcount }
}

ifai AISMOKEHAJO
{
  ifrnd 4 { spawn SMOKE killit } 
  else { ifcount 220 { spawn SMOKE killit } }
}

ifai AISMOKEALAS
{ iffloordistl 10 { ifonwater killit else { sound LADY_SCREAM spawn SHRINKEREXPLOSION killit } } }
enda




move RESPAWN_ACTOR_FLAG

state headhitstate
// wackplayer spawn BLOODPOOL2 state blood sound JHIT

ends

// exploding barrel
action EXPBARRELFRAME         0   2   1   1   15
actor EXPLODINGBARREL 26
    fall
    ifaction EXPBARRELFRAME
    {
        ifactioncount 2
        {
            hitradius 1024 WEAKEST WEAK MEDIUMSTRENGTH TOUGH
            spawn EXPLOSION2
            debris SCRAP2 2
            sound SHRINKER_HIT
            killit
        }
        break
    }
    ifsquished
    {
        debris SCRAP1 5
        killit
        break
    }
    ifhitweapon
        action EXPBARRELFRAME
enda



// burning and smoke
action BURNING_FLAME    0   12   1   1   2
action BURNING_FLAME5   0   13   1   1   13

move BURNING_VELS

state burningstate

    ifspawnedby FEM3
            {
                spritepal 8
                ifactioncount 2 { ifpdistl 3500 { addphealth -1 palfrom 32 32 ifrnd 32 sound DUKE_LONGTERM_PAIN2 resetactioncount } }
                else ifcount 412 killit 
            }

    ifrnd 60 spawn SMALLSMOKE 
    ifgapzl 16 break
    ifpdistg 10240 break
    ifcount 200
    {
        ifspawnedby TIRE
        {
            ifactioncount 512
            {
                sizeto 16 16
                killit
            }
            ifrnd 16 sizeto 64 48
        }
        else
        {
            sizeto 8 8 sizeto 8 8
            ifactioncount 192 killit
        }
    }
    else
    {
        ifmove 0 move BURNING_VELS

        ifspawnedby BOX
            { sizeto 32 32 ifcount 32 { spawn SMALLSMOKE killit } }
        else ifspawnedby TREE1 sizeto 96 96
        else ifspawnedby TREE2 sizeto 96 96
        else ifspawnedby APLAYER { sizeto 40 40 sizeto 40 40 }
        else sizeto 52 52
        ifactor BURNING { ifp palive ifpdistl 844 ifrnd 32 ifcansee { soundonce DUKE_LONGTERM_PAIN addphealth -1 palfrom 24 16 } }
    }
ends

actor BURNING WEAK BURNING_FLAME
    cstat 130
    state burningstate
enda

actor BURNING2 WEAK BURNING_FLAME5
    state burningstate cstat 130 
enda





// EXPLOSIVES inventory item
// sprite #1062
// *****************

state get_c4
{
ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
       { 
     ifpinventory GET_BOOTS 6 { } else break
     ifpinventory GET_BOOTS 4 { } else { sound DUKE_GET setvar PLR_DETECTMINES 1 quote 149 setvar PLR_ITEM 3 addinventory GET_BOOTS 6 killit }
     ifpinventory GET_BOOTS 2 { } else { sound DUKE_GET setvar PLR_DETECTMINES 1 quote 149 setvar PLR_ITEM 3 addinventory GET_BOOTS 4 killit }
     sound DUKE_GET setvar PLR_DETECTMINES 1 setvar PLR_ITEM 3 addinventory GET_BOOTS 2 quote 149 killit 
            }
}
ends



state c4_explo
{
ifspawnedby DEMOMAN { ifcount 20 ifp palive ifpdistl RETRIEVEDISTANCE state get_c4 }
ifcount 100 {
        state sharkspawner
        spawn SIRPALE spawn SIRPALE ifrnd 128 { spawn SIRPALE spawn SIRPALE }
        spawn SMOKE
        sound SHRINKER_HIT debris SCRAP6 8 debris SCRAP2 8
        spawn EXPLOSION2
        killit 
            }
}
ends


useractor notenemy INSTA_EXPO 1
fall sizeat 48 48 
cactor RUBBERCAN
enda



actor RUBBERCAN
fall cstat 0
ifactor INSTA_EXPO state c4_explo
else ifspawnedby APLAYER state c4_explo
else ifspawnedby DEMOMAN state c4_explo
else state get_c4
enda



// sound ambience actor #1250
// **************************
// spritepal 0 = warsfx
// spritepal 9 = warsfx more frequently
// spritepal 10 = nature sfx

state warsound
{
ifrnd 18 sound WAR_AMBIENCE1
else ifrnd 18 sound WAR_AMBIENCE2
else ifrnd 18 sound WAR_AMBIENCE3
else ifrnd 18 sound WAR_AMBIENCE4
else ifrnd 18 sound WAR_AMBIENCE10
else ifrnd 18 sound WARAMB1
else ifrnd 18 sound WARAMB2
else ifrnd 18 sound WARAMB3
else ifrnd 18 sound GENERIC_AMBIENCE13
else ifrnd 18 sound GENERIC_AMBIENCE16
else ifrnd 18 sound GENERIC_AMBIENCE17
else ifrnd 18 sound GENERIC_AMBIENCE23
else ifrnd 18 sound HVYMG4
}
ends


actor STEAM
{
cstat 32768

 ifspritepal 10 {
          ifcount 700 {
                ifrnd 51 sound WAR_AMBIENCE1
                else ifrnd 51 sound GENERIC_AMBIENCE1
                else ifrnd 51 sound KILLME
                else ifrnd 51 sound TURR_PAIN
                else ifrnd 51 sound TURR_DYING
                else ifrnd 51 sound BOS1_WALK
                resetcount
                       }
                  }

 else ifspritepal 9 {
                     ifcount 200
                                {
                                state warsound resetcount
                                } 
                    }
 else ifcount 600 { state warsound resetcount }
}
enda



actor WATERBUBBLEMAKER 0 0 randomangle
    ifpdistl 3084 ifrnd 24 spawn WATERBUBBLE
enda

action BUBBLE
action CRACKEDBUBBLE    1
move BUBMOVE           -10 -36
move BUBMOVEFAST           -10 -52

actor WATERBUBBLE 0 BUBBLE BUBMOVE getv geth randomangle

    ifaction CRACKEDBUBBLE
    {
        ifinwater ifrnd 192 killit
        ifactioncount 7 killit
    }
    else
    {
        ifcount 4
        {
            ifrnd 192 move BUBMOVE getv geth randomangle
            else move BUBMOVEFAST getv geth randomangle
            resetcount
        }

        ifonwater
        {
            iffloordistl 8 action CRACKEDBUBBLE
        }
        else ifactioncount 40 action CRACKEDBUBBLE
    }
enda


move ENGINE_SMOKE 64 -64
move SMOKESHOOTOUT -192
move SMOKEVEL2 10 -18
move SMOKEVEL3 10 9

action SMOKEFRAMES 1315 10 1 1 18
action DSMOKEFRAMES 1326 8 1 1 18

actor SMALLSMOKE 0 DSMOKEFRAMES
   
    ifmove 0
    {    
        ifspawnedby SECTOREFFECTOR move ENGINE_SMOKE geth getv
        else ifspawnedby BURNING2 move SMOKEVEL2 geth getv randomangle
        else ifspawnedby SHOTSPARK1 { spawn PIKKUSAVU killit }
        else ifspawnedby RPG { spawn PIKKUSAVU killit }
        else ifspawnedby KNEE { spawn PIKKUSAVU killit }
        else ifspawnedby BURNING move SMOKEVEL2 geth getv randomangle
        else ifspawnedby TRANSPORTERSTAR move SMOKEVEL2 geth getv randomangle
        else ifspawnedby OHJUS3 move SMOKEVEL3 geth getv randomangle
        else ifspawnedby CRYSTALAMMO move SMOKEVEL3 geth getv randomangle
        else move SMOKEVEL2 geth getv randomangle
    }

    // ifpdistl 500 ifspawnedby RPG killit
    cstat 2
    ifpdistl 1024 palfrom 32 256
    ifactioncount 16 killit
enda

action SMOKEFRAMES2 1 4 1 1 6
useractor notenemy PIKKUSAVU 0 SMOKEFRAMES2
sizeat 20 20 cstat 130
ifactioncount 2 killit
enda

action BARREL_DENTING  2 2 1 1 6
action BARREL_DENTED   1
action BARREL_DENTED2  2

move SPAWNED_BLOOD



// EXPLOSIVES
// *******************
 
// general states 

// shell hits the ground
state shell_down
{

ifpdistl 6400 { palfrom 64 512 ifpdistl 4096 state fear_state }
ifonwater spawn SPLASH
else {
       spawn EXPLOSION2 spawn SIRPALE spawn SIRPALE state sharkspawner
       ifrnd 128 spawn BURNING2 

       ifactor CEILINGSTEAM // arty 
          {
          debris SCRAP4 25 debris SCRAP3 20
          ifrnd 128 sound EXP10 else sound EXP11
          hitradius 4500 25 50 100 200         
          ifspawnedby SHARK { } else spawn NUKEBARREL // crater
          }

        else ifactor MORTAR_DOWN // mortar shell without a crater
         {
          sound BOMB2 state sharkspawner debris SCRAP4 20 debris SCRAP3 15
          hitradius 3200 25 50 100 200 
         }

        else ifactor NUKEBARRELDENTED // mortar
         {
          sound BOMB2 state sharkspawner debris SCRAP4 20 debris SCRAP3 15
          hitradius 3200 25 50 100 200 
          ifspawnedby MOTHER_SHELL { } else spawn NUKEBARREL 
         }



      }
killit        
}
ends




// artillery round
// ***************
action PUTOA3 0 1 1 1 1
action PUTOA4 0 1 1 1 1

actor CEILINGSTEAM 
ifaction 0
{ cstat 32768 action PUTOA3 }

ifaction PUTOA3
{
ifrnd 2
        { 
        ifrnd 70 
                { 
                ifrnd 128 sound INC10 else sound INC11
                action PUTOA4   
                }
        }
else action PUTOA3
}


ifaction PUTOA4
{
fall
iffloordistl 4 state shell_down
else action PUTOA4
}
enda



// Mortar code
// ******************
// Every mortar shell spawns these, used for scattering and
// terrain detection

move mor_sp 200 0
action SHEL 0 0 0 0  0

ai AI_MORT SHEL mor_sp randomangle

useractor notenemy MOTHER_SHELL 0 0  
ifaction 0 ai AI_MORT 

ifai AI_MORT
{
ifcount 10 { spawn MORTAR_DOWN killit }
}
enda



// mortar shells shot by the player
move m1 150 -700
move m2 150 0

action KH1 0 1 1 1 2

ai AIKRH1 KH1 m1 geth getv
ai AIKRH2 KH1 m2 geth getv

// sound when falling
state krhsound
    ifrnd 85 sound VIHELLYS 
    else ifrnd 85 sound VIHELLYS   
    else sound VIHELLYS
ends

// when going up, hits something solid and explodes
state krhx2
    spawn EXPLOSION2 spawn SIRPALE spawn SIRPALE state sharkspawner 
    sound BOMB2
    debris SCRAP4 20 debris SCRAP3 15
    hitradius 4500 25 50 100 200
    killit
ends


// shells for 7 different ranges
useractor notenemy MORTAR10 0 0 geth getv
ifaction 0 { sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { cstat 264 ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 70 { spawn MOTHER_SHELL killit } }
enda

useractor notenemy MORTAR11 0 0 geth getv
ifaction 0 { sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { cstat 264 ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 115 { spawn MOTHER_SHELL killit } }
enda

useractor notenemy MORTAR12 0 0 geth getv
ifaction 0 { cstat 264 sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 160 { spawn MOTHER_SHELL killit } }
enda

useractor notenemy MORTAR13 0 0 geth getv
ifaction 0 { cstat 264 sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 205 { spawn MOTHER_SHELL killit } }
enda

useractor notenemy MORTAR14 0 0 geth getv
ifaction 0 { cstat 264 sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 250 { spawn MOTHER_SHELL killit } }
enda

useractor notenemy MORTAR15 0 0 geth getv
ifaction 0 { cstat 264 sizeat 48 48 ai AIKRH1 }
ifai AIKRH1 { ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 295 { spawn MOTHER_SHELL killit } }
enda

// mortar shell for longest distance
useractor notenemy MORTAR16 0 0 geth getv
{
ifaction 0 { sizeat 48 48 cstat 264 ai AIKRH1 }
ifai AIKRH1 { ifceilingdistl 20 { ifoutside { cstat 32768 ai AIKRH2 } else state krhx2 } }
ifai AIKRH2 { ifnotmoving killit else ifactioncount 340 { spawn MOTHER_SHELL killit } } 
}
enda

// end of mortar code



// mortar shell
// ************
// NOTE: Code is activated when player sees this actor
// spritepal 0 = normal
// spritepal 9 = spawns arty rounds randomly

action PUTOA 0 1 1 1 2
action PUTOA2 109 1 1 1 2
action RANDOM_FIRE 0 1 1 1 2

actor NUKEBARRELDENTED 0 0
{
ifaction 0
{
     cstat 32768
     // ifspawnedby MOTHER_SHELL { state krhsound action PUTOA2 }
     ifspritepal 9 action RANDOM_FIRE
     else action PUTOA 
}           


ifaction RANDOM_FIRE
{
ifrnd 1 { ifrnd 70 spawn KARVENNIN else ifrnd 120 spawn SHARK spawn SHARK action 0 }
else action RANDOM_FIRE
}

ifaction PUTOA
{
ifrnd 2
     { 
     ifrnd 70 { state krhsound action PUTOA2 }
     }
}

ifaction PUTOA2
{
cstat 0 fall
iffloordistl 4 state shell_down
}

}
enda

// MORTAR SHELL
// Comes down immediately
action SHELL_DOWN2 107 1 1 1 2
useractor notenemy MORTAR_DOWN 0 0
ifaction 0 {
          ifrnd 10 { state krhsound action SHELL_DOWN2 }
           }

ifaction SHELL_DOWN2
{
fall
iffloordistl 4 state shell_down
}
enda


// crater
action CR 2361 1 1 1 1
useractor notenemy NUKEBARREL 
    fall
    ifaction 0 { sizeat 48 48 cstat 162 action CR }
enda



// for exploding missiles
state ohjus2
spawn EXPLOSION2 spawn NAPALM spawn SIRPALE spawn SIRPALE
sound BOMB2
ifspawnedby FUELPOD { } else { debris SCRAP4 40 debris SCRAP3 10 }
debris SCRAP4 30 debris SCRAP3 20 
hitradius 4096 25 50 100 200
ends


// arty round for naval bombardment
action OHJUS 0 1 1 1 1
action OHJWAIT 0 1 1 1 1
actor FIREVASE 100 0 0
        ifaction 0
        {
        ifrnd 10 { cstat 32768
                   ifrnd 128 sound OHJUSLENTO
                   else sound TURR_ATTACK
                   action OHJWAIT resetcount
                 }

        }

        ifaction OHJWAIT
        ifcount 30 action OHJUS

        ifaction OHJUS
        {
        fall
        ifcount 1 { spawn SMALLSMOKE resetcount }

        iffloordistl 7
               {
                 ifonwater { spawn WATERSPLASH2 killit }
                 else { state ohjus2 ifrnd 128 spawn BURNING2 spawn NUKEBARREL killit } 
                    
                }  
        else action OHJUS
        }

       
enda


// missile going up
// remove me
/*
action OHJUSX 1 1 1 1 1
move OHJUSNOP3 0 -250
useractor notenemy OHJUS3 100 0 OHJUSNOP3 faceplayer
        ifaction 0
        { sizeat 48 48 sound AAVE action OHJUSX }

        ifaction OHJUSX
        {
        ifcount 1 { spawn SMALLSMOKE resetcount }
        ifnotmoving killit
        ifceilingdistl 50 killit
        }
enda
*/

state burningbarrelcode
    fall
    ifcount 32
    {
        resetcount
        ifp palive ifpdistl 1480 ifp phigher
        {
            addphealth -1
            palfrom 16 16
            ifrnd 96 sound DUKE_LONGTERM_PAIN
        }
    }
    ifhitweapon
    {
        sound VENT_BUST
        debris SCRAP1 10
        spawn BURNING
        killit
    }
ends

actor FIREBARREL state burningbarrelcode enda


                     // 235 19 1 1 4
action SHRINKERFRAMES_S 235 2 1 1 4
action SHRINKERFRAMES_E 237 17 1 1 4

action FLAMER2 235 19 1 1 3
action SMOKE1 2134 6 1 1 85
action ILMO15 2133 10 1 -1 50

action SMOKEHAIHTUU 2124 10 1 1 50

actor SHRINKEREXPLOSION 1
    ifaction 0
    {
      ifspawnedby LIEKITYS action FLAMER2
      else ifspawnedby SMOKE
                {
                 sizeto 4096 4096
                 ifrnd 64 { cstat 14 } else ifrnd 64 { cstat 10 }
                 else ifrnd 64 { cstat 6 } else { cstat 2 }
                 action ILMO15
                }  
      else action SHRINKERFRAMES_S
    }

    ifaction SHRINKERFRAMES_S 
    { ifactioncount 2 { hitradius 4500 25 50 100 200
                         spawn SIRPALE ifrnd 128 spawn SIRPALE 
                         action SHRINKERFRAMES_E  }
    }

    ifaction SHRINKERFRAMES_E 
    { ifactioncount 17 killit }
    




    ifaction FLAMER2
    { ifactioncount 19 killit }

    ifaction SMOKE1
    {    
    ifpdistl 2200 palfrom 32 256 
    ifactioncount 54 action SMOKEHAIHTUU
    }
                
    ifaction ILMO15
    { ifactioncount 10 action SMOKE1 }
           
    ifaction SMOKEHAIHTUU
    { ifactioncount 10 killit }

enda

// explosion
action EXPLOSION 0 20 1 1 4
action NALLI 1725 6 1 1 3 
action EXPLOD1 742 16 1 1 4
action EXPLOD2 760 22 1 1 4
action RSTAR 1689 1 1 1 1

state exploeffects
state xplosnd spawn SIRPALE spawn FLOOR_BURNT debris SCRAP2 2 debris SCRAP3 2 state sharkspawner spawn PISTE cstat 2 action EXPLOSION
ends

state exploeffects3
sound FLUSH_TOILET spawn SIRPALE state sharkspawner cstat 2 action EXPLOSION
ends

state exploeffects4
sound BURN1 spawn SIRPALE spawn SHARK cstat 2 action EXPLOSION
ends

state exploeffects2
sound FLUSH_TOILET spawn SIRPALE spawn XPLOSION action EXPLOSION
ends

actor EXPLOSION2 1

ifaction 0
{
 
ifspawnedby APLAYER action NALLI
else ifspawnedby COLA state exploeffects3 
else ifspawnedby MORTAR_DOWN state exploeffects3 
else ifspawnedby KARVENNIN state exploeffects4
else ifspawnedby TRIPBOMB state exploeffects2
else ifspawnedby ROTATEGUN state exploeffects3 
else ifspawnedby MINE state exploeffects3
else ifspawnedby FEM7 state exploeffects3 
else ifspawnedby RANDOMEXPLOSION state exploeffects3 
else ifspawnedby FIREEXT state exploeffects3  
else ifspawnedby RPG state exploeffects3
else ifspawnedby HEAVYHBOMB state exploeffects
else ifspawnedby LIZMANJUMP state exploeffects2 
else ifspawnedby NAPALM state exploeffects4

// hexa
else ifspawnedby RESPAWN state tdead
else ifspawnedby RAKETTIYLOS { sizeat 30 30 action RSTAR resetcount }
else ifspawnedby RAKETTIALAS { cstat 8 sizeat 30 30 action RSTAR resetcount }


// effect for weapon 9
else ifspawnedby TRIPBOMB { state sharkspawner sound FLUSH_TOILET spawn SMOKE action EXPLOSION }

else ifspawnedby HEAVYHBOMB { spawn SIRPALE hitradius 3800 20 30 60 100 action EXPLOSION }


else ifspawnedby SHARK
        {
          cstat 0
          ifrnd 85 action EXPLOD1
          else ifrnd 85 action EXPLOD2
          else action EXPLOSION  
        }

else ifspawnedby CEILINGSTEAM
{ spawn SIRPALE spawn SIRPALE spawn SHARK spawn SHARK action EXPLOSION }
else action EXPLOSION
}


ifaction EXPLOSION
    {
    ifspawnedby COLA sizeto 4096 4096
    ifspawnedby NAPALM sizeto 8000 8000
    ifspawnedby SHARK sizeto 4096 4096
    ifspawnedby AMMUS2 sizeto 200 200
    ifspawnedby KARVENNIN sizeto 6000 6000
    ifspawnedby FIREVASE sizeto 4096 4096
    ifspawnedby GLOW sizeto 9999 9999
    ifspawnedby CRYSTALAMMO cstat 32768
    ifspawnedby SHRINKEREXPLOSION cstat 32768
    ifspawnedby TRANSPORTERSTAR cstat 32768 
    ifactioncount 20 killit
    }
ifaction NALLI
    { cstat 2 spritepal 2 ifactioncount 6 killit }

ifaction RSTAR { ifcount 1 killit }


ifaction EXPLOD1 { ifactioncount 16 killit }

ifaction EXPLOD2 { ifactioncount 22 killit }

enda

actor EXPLOSION2BOT 1 EXPLOSION
    ifspawnedby FIREVASE sizeto 4096 4096
    ifspawnedby CRYSTALAMMO cstat 32768
    ifspawnedby SHRINKEREXPLOSION cstat 32768
    ifspawnedby TRANSPORTERSTAR cstat 32768 
    ifactioncount 20 killit
enda

move flaredown 0 5
action TRAN 1985 6 1 1 300
action TRANS1 0 1 1 1 1
actor TRANSPORTERSTAR 0 0 flaredown randomangle

ifaction 0 action TRANS1

ifaction TRANS1
{
  ifspawnedby FREEZEBLAST { sound CAPT_ROAM spawn LIEKITYS killit } // flame
  else ifspawnedby CRYSTALAMMO action TRAN
  else ifspawnedby APLAYER action TRAN
  else { killit break }
}

ifaction EXPLOD1
{ ifactioncount 16 killit }

ifaction EXPLOD2
{ ifactioncount 22 killit }

ifaction TRAN
{
ifrnd 83 spawn EXPLOSION2
ifcount 1 { spawn SMALLSMOKE resetcount }
iffloordistl 50 killit
ifactioncount 6 killit
}         
enda



actor TRANSPORTERBEAM
ifspawnedby SHARK { spawn SHARK killit }
else ifcount 1 killit
enda


// PLAYER INVENTORY ITEMS
// ***************

state getcode
    sound DUKE_GET
    palfrom 16 0 32
    ifrespawn
    {
        move RESPAWN_ACTOR_FLAG
        spawn RESPAWNMARKERRED
        cstat 32768
    }
    else killit
ends


state getweaponcode
    palfrom 32 0 32
    ifgotweaponce 1 break
    ifrespawn
    {
        move RESPAWN_ACTOR_FLAG
        spawn RESPAWNMARKERRED
        cstat 32768
    }
    else killit
ends


state respawnit
    ifcount RESPAWNITEMTIME { spawn TRANSPORTERSTAR move 0 cstat 0 sound TELEPORTER }
ends

state quikget
    sound DUKE_GET
    palfrom 16 0 32
    killit
ends

state quikweaponget
    palfrom 32 0 32
    ifgotweaponce 1 break
    killit
ends


// removed inventory items
// ***********************

// actor HOLODUKE enda



// cigarettes
action SMALL_CIG
action CIG 1 1 1 1

actor TRIPFLARE 0 SMALL_CIG
    ifaction SMALL_CIG { sizeat 5 5 action CIG }

   ifaction CIG
   {
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6
    ifvarl PLR_MORALE 100 ifcanseetarget 
    {
     setvar PLR_SMOKECOUNT 0 setvar PLR_MODE 14
     quote 90 addphealth -3    
     ifspawnedby TRIPFLARE state getcode
     else state quikget

    }
   }
enda

// MINE box #48
actor AMMOLOTS
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE
    ifpinventory GET_SCUBA 300 ifcanseetarget
    {
        ifrnd 30 state morale_boost
        setvar PLR_DETECTMINES 1 setvar PLR_ITEM 4
        addinventory GET_SCUBA 300 quote 147
        ifspawnedby AMMOLOTS state getcode
        else state quikget
    }
enda

// small medikit #52
actor SIXPAK
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6
    ifcanseetarget
    {
    ifpinventory GET_FIRSTAID 2 { } else break
    ifpinventory GET_FIRSTAID 1 { } else { quote 37 setvar PLR_DETECTMINES 1 setvar PLR_ITEM 2 addinventory GET_FIRSTAID 2 }
    ifpinventory GET_FIRSTAID 0 { } else { ifrnd 40 state morale_boost quote 37 setvar PLR_DETECTMINES 1 setvar PLR_ITEM 2 addinventory GET_FIRSTAID 1 }

    ifspawnedby SIXPAK state getcode
    else state quikget
    }
enda

// Firstaid #53
actor FIRSTAID
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6
    ifpinventory GET_FIRSTAID 2 ifcanseetarget
    { 
        ifrnd 30 state morale_boost
        setvar PLR_DETECTMINES 1 setvar PLR_ITEM 2
        addinventory GET_FIRSTAID 2 quote 3
        ifspawnedby FIRSTAID state getcode
        else state quikget
    }
enda


actor STEROIDS // mortar ammo #55
{
fall
ifmove RESPAWN_ACTOR_FLAG state respawnit
else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE
ifpinventory GET_JETPACK 4 ifcanseetarget
  {
        ifrnd 30 state morale_boost
        setvar PLR_DETECTMINES 1
        setvar PLR_ITEM 6
        quote 88 addinventory GET_JETPACK 4
        ifspawnedby STEROIDS state getcode
        else state quikget
    }
}
enda


// mine detector #921
actor TOILETWATER 
{
fall
ifmove RESPAWN_ACTOR_FLAG state respawnit
else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE
ifpinventory GET_HOLODUKE 10 ifcanseetarget
  {
        ifrnd 30 state morale_boost
        setvar PLR_DETECTMINES 1
        quote 155 setvar PLR_ITEM 5 addinventory GET_HOLODUKE 10
        ifspawnedby TOILETWATER state getcode
        else state quikget
    }
}
enda



// ammo box
action AMM0 0 1 1 1 1
action GERMAN_AMMO 1996 1 1 1 1
action AMMO_EXPLODE 4 1 1 1 1


useractor notenemy FEM4 10 0
    fall
    ifspritepal 12 sizeat 7 7 else sizeat 45 45 
    ifaction 0
    { 
      ifspritepal 12 { cstat 256 action GERMAN_AMMO }
      else action AMM0
    }
    
    ifaction AMM0
    {
     ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
     {      
     ifrnd 96 { sound DUKE_GET addweapon PISTOL_WEAPON 56 quote 65 killit }
     else ifrnd 96 { sound DUKE_GET addammo PISTOL_WEAPON 112 quote 65 killit } 
     else ifrnd 96 { sound DUKE_GET addweapon HANDBOMB_WEAPON 1 quote 55 killit }
     else { sound DUKE_GET addammo CHAINGUN_WEAPON 60 quote 63 killit }
     
     }
    }

    ifaction GERMAN_AMMO
    {
    ifp palive ifpdistl RETRIEVEDISTANCE quote 152
    ifhitweapon { ifwasweapon RADIUSEXPLOSION { resetcount state tdead spawn BURNING action AMMO_EXPLODE }
                  else ifwasweapon RPG { resetcount state tdead spawn BURNING action AMMO_EXPLODE }
                }

    }

    ifaction AMMO_EXPLODE
    {
    ifcount 20 { cstat 32768 ifrnd 4 state tdead }
    ifcount 150 { state tdead killit }
    }

enda
// P08
actor AMMO 
    cstat 32 fall 
    ifspawnedby APLAYER { ifp palive ifcount 72 ifpdistl RETRIEVEDISTANCE ifcanseetarget { addammo PISTOL_WEAPON 180 quote 65 sound DUKE_GET killit } }
    else ifmove RESPAWN_ACTOR_FLAG state respawnit    
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo PISTOL_WEAPON PISTOLAMMOAMOUNT quote 65
        ifspawnedby AMMO state getcode
        else state quikget
    }
    
enda

// mp44
actor SHOTGUNAMMO
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo SHOTGUN_WEAPON SHOTGUNAMMOAMOUNT quote 69
        ifspawnedby SHOTGUNAMMO state getcode
        else state quikget
    }
enda

// MG42
actor BATTERYAMMO 
{
 fall 
 
    ifspawnedby APLAYER { ifp palive { ifcanseetarget { ifpdistl RETRIEVEDISTANCE
                          ifcount 120 { addammo CHAINGUN_WEAPON CHAINGUNAMMOAMOUNT
                                        quote 63 sound DUKE_GET killit
                                      }
                         } } }

    else {
           ifmove RESPAWN_ACTOR_FLAG state respawnit
           else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
           {
             addammo CHAINGUN_WEAPON CHAINGUNAMMOAMOUNT quote 63
             ifspawnedby BATTERYAMMO state getcode
             else state quikget
           }
         }
}
enda


// Mauser ammo
action SMA_MAUSER
action MAUS_AMMO 11 1 1 1
actor SHIELD 0 SMA_MAUSER

 ifaction SMA_MAUSER { sizeat 20 20 action MAUS_AMMO }
 ifaction MAUS_AMMO
 {

    fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo GROW_WEAPON 5 quote 68
        ifspawnedby SHIELD state getcode
        else state quikget
    }
 }
enda


// P08 ammo
actor BOOTS
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo DEVISTATOR_WEAPON 12 quote 67
        ifspawnedby BOOTS state getcode
        else state quikget
    }
enda

// MP40
actor HEATSENSOR
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo RPG_WEAPON 32 quote 78
        ifspawnedby HEATSENSOR state getcode
        else state quikget
    }
enda





// WEAPON PICKUPS
// walther p08

actor FIRSTGUNSPRITE
 cstat 32 fall 
 ifmove RESPAWN_ACTOR_FLAG state respawnit
 else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
     {
       {
        ifgotweaponce 0 break // multiplayer only
        addweapon PISTOL_WEAPON 28 quote 28
        sound SELECT_WEAPON
       }
        ifspawnedby FIRSTGUNSPRITE state getweaponcode
        else state quikweaponget
     }    
 
enda

// mp44
actor SHOTGUNSPRITE
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        {
          ifgotweaponce 0 break // Multiplayer only
          addweapon SHOTGUN_WEAPON SHOTGUNAMMOAMOUNT quote 57
        }
        ifspawnedby SHOTGUNSPRITE state getweaponcode
        else state quikweaponget
    }
enda

// MG42
actor CHAINGUNSPRITE
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break

        ifrnd 30 state morale_boost
        addweapon CHAINGUN_WEAPON 60 quote 54
        ifspawnedby CHAINGUNSPRITE state getweaponcode
        else state quikweaponget
    }
enda


// mp40
actor RPGSPRITE
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break // ( Multiplayer (mode 3) only )
        ifrnd 30 state morale_boost
        addweapon RPG_WEAPON 30 quote 56
        ifspawnedby RPGSPRITE state getweaponcode
        else state quikweaponget
    }
enda

// grenades
actor HBOMBAMMO
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break // ( Multiplayer (mode 3) only )
        
        addweapon HANDBOMB_WEAPON 3 quote 55
        sound DUKE_GET

        ifspawnedby HBOMBAMMO state getweaponcode
        else state quikweaponget
    }
enda

// panzerfaust
actor SHRINKERSPRITE
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break
        ifrnd 30 state morale_boost
        addweapon SHRINKER_WEAPON CRYSTALAMMOAMOUNT quote 60
        ifspawnedby SHRINKERSPRITE state getweaponcode
        else state quikweaponget
    }
enda


// mauser kar 98 
actor GROWSPRITEICON
cstat 32 fall 
ifmove RESPAWN_ACTOR_FLAG state respawnit
else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
{
 
 ifgotweaponce 0 break
 ifrnd 30 state morale_boost
 sound SELECT_WEAPON
 addweapon GROW_WEAPON GROWCRYSTALAMMOAMOUNT quote 179
 ifspawnedby GROWSPRITEICON state getweaponcode
 else state quikweaponget
}
enda

// twin p08
useractor notenemy COLT_1911
    cstat 32 fall 
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break

        addweapon DEVISTATOR_WEAPON 12 quote 124
        ifspawnedby COLT_1911 state getweaponcode
        else state quikweaponget
    }
enda




// tnt
actor TRIPBOMBSPRITE
    cstat 32 fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break

        addweapon TRIPBOMB_WEAPON 1
        sound SELECT_WEAPON
        quote 58
        ifspawnedby TRIPBOMBSPRITE state getweaponcode
        else state quikweaponget
    }
enda



// panzershrechk
actor FREEZESPRITE
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifgotweaponce 0 break
        ifrnd 128 state morale_boost
        addweapon FREEZE_WEAPON FREEZEAMMOAMOUNT quote 59
        ifspawnedby FREEZESPRITE state getweaponcode
        else state quikweaponget
    }
enda

// END OF INVENTORY ITEMS
// **********************

// MINES
// **************

// states for mines
state init_mine
{
sizeat 48 48 cstat 256 fall
}
ends

state minexplo
{
ifactor FEM7 { sound SWITCH_ON ifcount 1 spawn EXPLOSION2 debris SCRAP2 2 debris SCRAP6 6 hitradius 3800 20 30 60 100 addphealth -100 killit } 
else { sound INTRUDER_ALERT debris SCRAP6 12 debris SCRAP2 12 spawn EXPLOSION2 hitradius 2048 30 50 80 120 addphealth -100 killit }
killit
}
ends

state minedead
sound LASERTRIP_ONWALL quote 102 killit break
ends

state disarming
{
  ifvarg PLR_STATUS 12
  {
  ifvare PLR_STATUS 13 { ifrnd 102 state minedead else state minexplo }
  else ifvare PLR_STATUS 14 { ifrnd 102 state minedead else state minexplo }
  else ifvare PLR_STATUS 15 { ifrnd 200 state minedead else state minexplo }
  else ifvare PLR_STATUS 16 { ifrnd 102 state minedead else state minexplo }
  else ifvare PLR_STATUS 17 { ifrnd 230 state minedead else state minexplo }
  else ifvare PLR_STATUS 18 { ifrnd 102 state minedead else state minexplo }
  else ifvare PLR_STATUS 19 { ifrnd 102 state minedead else state minexplo }
  else ifvare PLR_STATUS 20 { ifrnd 200 state minedead else state minexplo }
  }
  else ifrnd 200 state minedead
  else state minexplo 
}
ends


state try_to_disarm
{
ifcount 10
 {

  ifhitspace
   {
   ifcount 20 quote 43 
   ifcount 100 { ifrnd 3 state disarming }
   }

  else
   {
   ifvarg PLR_STATUS 12
    {
     ifvare PLR_STATUS 13 { ifrnd 51 state minedead else state minexplo }
     else ifvare PLR_STATUS 14 { ifrnd 51 state minedead else state minexplo }
     else ifvare PLR_STATUS 15 { ifrnd 154 state minedead else state minexplo }
     else ifvare PLR_STATUS 16 { ifrnd 51 state minedead else state minexplo }
     else ifvare PLR_STATUS 17 { ifrnd 230 state minedead else state minexplo }
     else ifvare PLR_STATUS 18 { ifrnd 51 state minedead else state minexplo }
     else ifvare PLR_STATUS 19 { ifrnd 51 state minedead else state minexplo }
     else ifvare PLR_STATUS 20 { ifrnd 154 state minedead else state minexplo }
    }
   else ifrnd 128 state minedead
   else state minexplo 
   }
 }
}
ends

state mine_hit
{
ifspritepal 7 { ifrnd 12 state minexplo }
else { ifrnd 64 state minexplo }
}
ends
// *****




// chemical mine
action MINE2_FRAME 0 1 1 1 1
action MINE2_TRIG 0 1 1 1 1

useractor notenemy FEM3 WEAK MINE2_FRAME
{
    state init_mine 

    ifaction MINE2_FRAME
    { 
    ifpdistl 800 { ifrnd 60 { quote 39 sound SWITCH_ON spawn BURNING2 } } 

    ifvarg PLR_DETECTMINES 1 { ifpdistl 2800 { soundonce TURR_RECOG } }    

    ifhitweapon { ifwasweapon RADIUSEXPLOSION { ifrnd 128 { spawn BURNING2 } } }
    }
}
enda



// bounding apers
action APERS1  0 1 1 1 1
action APERS2  1 1 1 1 1
action BDISARM 1 1 1 1 1
action APERZ   1 1 1 1 1

useractor notenemy FEM7 10000 APERS1
{
    state init_mine 
    
    ifaction APERS1 
    { 
    ifhitweapon { ifwasweapon RADIUSEXPLOSION state mine_hit }

    ifpdistl 800 { sound SWITCH_ON action APERS2 }
    else ifpdistl 2800
        {
         ifvarg PLR_DETECTMINES 1 { ifpdistl 2800 { soundonce TURR_RECOG } } 
        }
        
    }

    ifaction APERS2 
    { 
            
      ifpdistg 800 state minexplo 
      else
      {
      ifvarg PLR_DETECTMINES 1 { soundonce TURR_RECOG } 
      }
      
      ifhitspace { resetcount action BDISARM }
    }

    ifaction BDISARM state try_to_disarm

}
enda


// flat apers
action FLAT_MINE 0 1 1 
action FLAT_ARMED 0 1 1
action FLAT_DISARM 0 1 1
actor ROTATEGUN 10000 0
{
ifaction 0 { cstat 34 action FLAT_MINE }

ifaction FLAT_MINE
{
    ifhitweapon { ifwasweapon RADIUSEXPLOSION state mine_hit }

    ifpdistl 800 { sound SWITCH_ON action FLAT_ARMED spawn EXPLOSION2 addphealth -100 debris SCRAP2 2 debris SCRAP6 6 killit }
    else ifpdistl 2800
        {
         ifvarg PLR_DETECTMINES 1 soundonce TURR_RECOG 
        }
}

 ifaction FLAT_ARMED 
  {
    ifvarg PLR_DETECTMINES 1 soundonce TURR_RECOG 
    ifpdistg 800 state minexplo
    
    ifhitspace { resetcount action FLAT_DISARM }
  }

ifaction FLAT_DISARM state try_to_disarm


}
enda


// apers mine
action MINE_TRIGGERED 1 1 1 1 1
action MINE_FRAME     0 1 1 1 1
action ADISARM        1 1 1 1 1

useractor notenemy MINE 10000 0
{
    

 ifaction 0 { state init_mine ifspawnedby APLAYER { ifcount 100 action MINE_FRAME } else action MINE_FRAME }
    
 ifaction MINE_FRAME 
    {

    ifhitweapon { ifwasweapon RADIUSEXPLOSION state mine_hit }

    ifpdistl 800 { sound SWITCH_ON action MINE_TRIGGERED ifcount 70 spawn EXPLOSION2 debris SCRAP2 2 debris SCRAP6 6 addphealth -100 killit }
    else ifpdistl 2800
        {
         ifvarg PLR_DETECTMINES 1 soundonce TURR_RECOG 
        }
    }

 ifaction MINE_TRIGGERED 
  {
    ifvarg PLR_DETECTMINES 1 soundonce TURR_RECOG 
    ifpdistg 800 state minexplo
    
    ifhitspace { resetcount action ADISARM }
  }

  ifaction ADISARM state try_to_disarm


}
enda

action POMMINPUDOTUS 0 1 1 1 1
// bomb 
actor COLA 100 0 POMMINPUDOTUS randomangle
        fall
        iffloordistl 2 
        {
        ifonwater { spawn WATERSPLASH2 killit break }
        else
                {
                spawn EXPLOSION2 sound BOMB2 spawn SIRPALE spawn SIRPALE spawn FLARESMOKE 
                debris SCRAP6 15 debris SCRAP2 15
                sound BOMB2
                hitradius 3750 25 50 90 170
                ifrnd 32 spawn BURNING spawn BURNING2 
                killit break
                else ifspawnedby PARAPLANE spawn EXPLOSION2 spawn SIRPALE spawn NAPALM spawn BURNING2
                else ifspawnedby ME262 spawn EXPLOSION2 spawn SIRPALE spawn NAPALM spawn BURNING2
                }
        }
enda

state btdead
quote 168 killit break
ends
    

action NOLLA
action ARTY 0 1 1 1 1
action KRH 2228 1 5 1 
action KRHTESTAUS 0 1 1 1 1

// stationary weapon 
useractor notenemy SPACESHUTTLE
    fall
    cstat 32768
    ifaction 0
    { ifspritepal 7 action ARTY
      else ifspritepal 6 { cstat 0 spritepal 0 sizeat 37 37 action KRH }
    }

                                     
    ifaction KRH
    {
      cstat 0
      ifp palive {
             ifpdistl 380
             {
                 ifpinventory GET_JETPACK 4 { quote 14 } else
                 { setvar PLR_SHELLCOUNT 10 quote 104 }

                 ifvare PLR_MODE 6 { quote 180 cstat 32768 action KRHTESTAUS }

             }
             else ifvare PLR_SHELLCOUNT 10 setvar PLR_SHELLCOUNT 1
                                                       
                  }
    }

    ifaction KRHTESTAUS
    {
    ifp palive { ifpdistg 380 { setvar PLR_MODE 13 action KRH } }
    else action KRH
    }

    ifaction ARTY
    {
    ifcount 100
        { resetcount ifrnd 128 spawn SHARK }
    }
    
enda



// Airplanes
// ***********

// state for bombers
state bomber_state
{
soundonce INVADER
ifcount 6
    {
      resetcount
      ifrnd 35 {
                ifactor DEVISTATORSPRITE { sound VIHELLYS spawn COLA quote 130 }
                else ifactor RKONE1 spawn RAKETTIALAS
                ifactor PARAPLANE { sound VIHELLYS spawn COLA quote 134 }
                else ifactor HORSEONSIDE spawn F105 spawn COLA quote 138 
               }
    }
else ifnotmoving { stopsound INVADER killit }
}
ends

// *****

//    
action SMA_BOMBER 1217 2 1 1 3
move BOMB_SLOW 285
useractor notenemy SMALL_BOMBER 100 SMA_BOMBER BOMB_SLOW geth getv quote 195
{
ifaction SMA_BOMBER { cstat 32 sizeat 30 30 state pkone_state2 quote 196 }
}
enda


// PE3    
action BOMBER 1216 2 1 1 3
action BOMBER2 1216 2 1 1 3
move PK 285    
useractor notenemy DEVISTATORSPRITE 100 BOMBER PK geth getv quote 128    
{
ifaction BOMBER { cstat 32 sizeat 40 40 ifspritepal 21 state pkone_state2 else quote 129 state bomber_state }
}
enda

action BOMBER3 1182 2 1 1 3
useractor notenemy PARAPLANE 100 BOMBER3 PK geth getv quote 131
ifaction BOMBER3 { cstat 32 sizeat 40 40 quote 133 state bomber_state }
enda

// 75MM CANNON bullets for airplanes
action AMMUS21 0 1 7 1 1
action AMMUS20 0 1 7 1 1
move AMMUS1 1700 2000
useractor notenemy AMMUS2 100 0 AMMUS1 randomangle
        
        ifaction AMMUS20 { cstat 32768 action AMMUS21 }

        ifaction AMMUS21
        {
        iffloordistl 20 sound RPG_EXPLODE spawn SHARK
        ifnotmoving sound RPG_EXPLODE spawn SHARK
        }
enda
            
// 7.92 MG AND 7.62 MG bullets for airplanes
state kilammo
hitradius 600 20 20 20 20 spawn SHOTSPARK1 killit
ends

action AMMUS0 0 1 7 1 1
move LENTO3 1700 2000
useractor notenemy AMMUS 100 0 LENTO3 randomangle
        
        ifaction 0 { cstat 32768 action AMMUS0 }

        ifaction AMMUS0
        {
        iffloordistl 20 state kilammo
        ifnotmoving state kilammo
        }
enda
             

// 7.92 MG AND 7.62 MG for airplane
action THUD1 1 2 1 1 30
action THUD2 3 2 1 1 3
move LENTO 325
useractor notenemy F105 100 0 LENTO geth getv

  ifaction 0 { cstat 32768 action THUD1 }

  ifaction THUD1
  {
    ifcount 3 { sound HMG spawn AMMUS resetcount }
    ifactioncount 7 killit
    ifnotmoving killit
  }


enda

// JU-89 STUKA (to be used with machineguns )
action RUBCAN 210 2 1 1 3
useractor notenemy DEVISTATORAMMO 100 0 LENTO geth getv

        ifaction 0 { sizeat 30 30 cstat 32 sound WAR_AMBIENCE4 quote 190 action RUBCAN }

        ifaction RUBCAN spawn F105 spawn COLAX quote 192 else ifnotmoving quote 193 killit

enda



// plane spawner
actor FLOORFLAME
        cstat 32768
        
        
        ifcount 600
        { 
          resetcount
          ifrnd 50 { ifrnd 128 spawn DEVISTATORAMMO }
          else ifrnd 50 { ifrnd 128 spawn DEVISTATORSPRITE }
          else ifrnd 60 { ifrnd 128 spawn RKONE1 }
          else ifrnd 20 { ifrnd 128 spawn HORSEONSIDE }
          else ifrnd 50 { ifrnd 128 spawn JUNKERS }
          else ifrnd 50 { ifrnd 128 spawn PARAPLANE }
          else ifrnd 50 { ifrnd 128 spawn SMALL_BOMBER }
       }
enda

// END OF AIRPLANES


state firestate

    ifgapzl 16 break
    ifinwater killit

    ifactor FIRE { ifp palive ifpdistl 844 ifrnd 32 ifcansee { soundonce DUKE_LONGTERM_PAIN addphealth -1 palfrom 32 32 } }

    ifactor FIRE ifspawnedby FIRE break
    else ifactor FIRE2 ifspawnedby FIRE2 break

    iffloordistl 128
    {
        ifcount 32 sizeto 8 8
        ifcount 64 killit
    }
    else killit

ends

action FIRE_FRAMES     -1 14 1 1 1
action FIRE_FRAMES5    -1 14 1 1 13
move FIREVELS
actor FIRE WEAK FIRE_FRAMES FIREVELS
cstat 130
ifspritepal 3 ifrnd 60 spawn SMALLSMOKE
state firestate
enda

actor FIRE2 WEAK FIRE_FRAMES5 FIREVELS
cstat 130 state firestate enda

actor NAPALM
    cstat 256
    fall
    iffloordistl 2
    { 
    ifonwater killit
    else
    {
        sound HOVER_CRAFT
        spawn EXPLOSION2
        hitradius 3000 25 50 100 200
        spawn BURNING
        killit
    }
    }
enda

state drop_ammo ifrnd SPAWNAMMOODDS spawn AMMO ends
state drop_battery ifrnd SPAWNAMMOODDS spawn BATTERYAMMO ends
state drop_sgshells ifrnd SPAWNAMMOODDS spawn SHOTGUNAMMO ends
state drop_shotgun ifrnd SPAWNAMMOODDS spawn SHOTGUNSPRITE ends
state drop_chaingun ifrnd SPAWNAMMOODDS spawn BATTERYAMMO ends

state jib_sounds
    ifrnd SWEARFREQUENCY
    {
        ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
        else ifrnd 16 sound ALIEN_ELEVATOR1
    }
ends

define BLOODPOOL3 4470
define BLOODPOOL4 4472
define BLOODPOOL5 4473
define BLOODPOOLEDGE 4471

useractor notenemy BLOODPOOL3
cstat 34
sizeat 10 10
enda

useractor notenemy BLOODPOOL4
cstat 34
sizeto 24 24
enda

useractor notenemy BLOODPOOL5
cstat 34
sizeto 24 24
enda

useractor notenemy BLOODPOOLEDGE
cstat 34
sizeto 12 12
enda

state blood
spawn BLOODPOOL2
ifrnd 64 spawn BLOODPOOL3
else ifrnd 54 spawn BLOODPOOLEDGE
else ifrnd 96 spawn BLOODPOOL4
else spawn BLOODPOOL5
guts JIBS6 15
paper 10
ends

state standard_jibs
    guts JIBS2 6
    guts JIBS3 7
    guts JIBS3 7
    guts JIBS3 7
    guts JIBS4 5
    guts JIBS5 2
    guts JIBS6 4
    guts JIBS1 1 spawn BLOODPOOL2               // spine
    state jib_sounds
ends

// barbwire
useractor notenemy PIIKKI TOUGH
   fall cstat 17
   ifpdistl 512 
   { ifcount 20 { addphealth -1 palfrom 16 16 ifrnd 50 sound DUKE_LONGTERM_PAIN2 resetcount } }   

   ifhitweapon { ifwasweapon RADIUSEXPLOSION { debris SCRAP1 30 debris SCRAP1 10 killit } }

enda



// bush sound effects
action AANTA 0 1 1 1 1
action HILJAA 0 1 1 1 1
useractor notenemy FEM6 
sizeat 48 48
cstat 32768
ifaction 0 action AANTA

ifaction AANTA
ifpdistl 1000
{ 
ifrnd 80 soundonce BUSH1
else ifrnd 100 soundonce BUSH3
else action HILJAA         
}

ifaction HILJAA
{ 
ifp pjumping soundonce BUSH3
else ifpdistg 1000 action AANTA 
}
enda

// end game
actor STATUE
cstat 32768
ifp palive { ifpdistl 3072 { endofgame 52 } }
enda

// spike #1338
useractor notenemy FEM8
    fall sizeat 48 48 
    ifcount 16
    {
        resetcount
        ifp palive ifpdistl 1024 ifp phigher
        {
            addphealth -5
            palfrom 16 16
            ifrnd 64 sound DUKE_LONGTERM_PAIN2
        }
     } 
enda

state troop_body_jibs
guts JIBS5 2
guts JIBS5 7
guts JIBS3 4
guts JIBS6 8
guts JIBS2 2
guts JIBS1 1
spawn BLOODPOOL2
ends

state liz_body_jibs
guts JIBS5 2
guts JIBS6 4
spawn BLOODPOOL2
ends


state delete_enemy killit ends

action BLOODFRAMES 0 4 1 1 15
actor BLOOD 0 BLOODFRAMES
    cstat 2 sizeto 10 10 cstat 2 sizeto 10 10 sizeto 10 10 cstat 2
    ifpdistg 3144 killit
    ifactioncount 4 killit
enda

actor KNEE KNEE_WEAPON_STRENGTH enda
actor SPIT SPIT_WEAPON_STRENGTH enda
actor CHAINGUN CHAINGUN_WEAPON_STRENGTH enda
actor SHOTGUN SHOTGUN_WEAPON_STRENGTH enda
actor FIRELASER FIRELASER_WEAPON_STRENGTH enda
actor HEAVYHBOMB HANDBOMB_WEAPON_STRENGTH enda
actor BOUNCEMINE BOUNCEMINE_WEAPON_STRENGTH enda
actor MORTER MORTER_WEAPON_STRENGTH enda
actor SHRINKSPARK SHRINKER_WEAPON_STRENGTH enda

action WEAP7FRAMES 147  4  1  1  6
actor GROWSPARK GROWSPARK_WEAPON_STRENGTH WEAP7FRAMES
sizeat 10 10 
ifactioncount 4 killit
                
else
{ ifcount 2 { } else { ifonwater spawn WATERSPLASH2
                       else ifrnd 64 sound PISTOL_RICOCHET
                     }
}
enda


actor RPG RPG_WEAPON_STRENGTH enda
actor FREEZEBLAST FREEZETHROWER_WEAPON_STRENGTH enda
actor DEVISTATORBLAST FREEZETHROWER_WEAPON_STRENGTH enda
actor COOLEXPLOSION1 COOL_EXPLOSION_STRENGTH enda
actor TRIPBOMB TRIPBOMB_STRENGTH enda

action WEAP2FRAMES 0  4  1  1  6
actor SHOTSPARK1 PISTOL_WEAPON_STRENGTH WEAP2FRAMES

    ifspawnedby TIGERTANK { state tdead killit }

    else ifspawnedby LIZMANJUMP {
                                 ifcount 4 { state tdead killit }
                                }

    debris SCRAP6 1 ifdead killit
    ifactioncount 4 killit
    iffloordistl 10 spawn FLATHOLE
    else
    {
        ifactioncount 1 { ifinwater spawn WATERBUBBLE }
        else ifcount 1 { } else { ifonwater spawn WATERSPLASH2
                                  else ifrnd 96 sound PISTOL_RICOCHET
                                }
    }
enda

move DUKENOTMOVING
state handle_dead_dukes
    fall 

    ifmove 0     // 1st time initializiation...
    {
        ifrnd 128 cstat 4
        else cstat 0
        move DUKENOTMOVING
    }

    ifsquished
    {
        sound SQUISHED
        spawn OOZ
        killit
    }

    else
    {
    
    strength 0
    ifhitweapon ifwasweapon RADIUSEXPLOSION
        {
       state standard_jibs
       killit
        }
    }

    else ifactor APLAYER ifcount 1024 ifpdistg 4096 killit
               
ends

// PLAYER 
action PLYINGFRAMES 0 1 0 1 1
actor DUKELYINGDEAD 0 PLYINGFRAMES
    state handle_dead_dukes
enda

action PSTAND       0     1   8   1    1  
action PEXPLODE     106   5   1   1   10
action PEXPLODEAD   113   1   1    
action KRHDUKE      1315  1   5  1   10 
action PJPHOUVER    2270 2   5   1
action PWALK        8    4   8   1   16  
action PRUN         40   4   8   1   10  
action PWALKBACK    39   4   8  -1   16  
action PRUNBACK     71   4   8  -1   10  
action PJUMPING     72   4   8   1   30  
action PFALLING     88   1   8           
action PDUCKING     96   1   8           
action PCRAWLING    419  4   8   1   20  
action PAKICKING    675  2   8   1   14
action PFLINTCHING  106  1   1   1   10
action PTHROWNBACK  106  5   1   1   18
action PLYINGDEAD   113  1   1
action EYES         2035  7  1   1   15
action INVI          -1  1  1   1   1 
action PSWIMMINGGO   375   1   5   1   10
action PSWIMMING     375   4   5   1   13
action PSWIMMINGWAIT 395   1   5   1   13
action PTREDWATER    395   2   5   1   17

// new actions for player
action PHEAL           0     1   5   1    1
action PC4             0     1   5   1    1
action PMINE           0     1   5   1    1


move PSTOPED
move PSHRINKING // used as a var only

state check_dead_thrown_back
    ifdead
    {
        strength 0
        action PTHROWNBACK
    }
ends

state check_pstandard
    ifp pwalking action PWALK
    else ifp pkicking action PAKICKING
    else ifp pwalkingback action PWALKBACK
    else ifp prunning action PRUN
    else ifp prunningback action PRUNBACK
    else ifp pjumping action PJUMPING
    else ifp pducking action PDUCKING
ends

state random_wall_jibs
    ifrnd 96 shoot BLOODSPLAT1
    ifrnd 96 shoot BLOODSPLAT2
    ifrnd 96 shoot BLOODSPLAT3
    ifrnd 96 shoot BLOODSPLAT4
    ifrnd 96 shoot BLOODSPLAT1
ends


state ammostate // 80 rounds for BAR
spawn BATTERYAMMO spawn BATTERYAMMO 
spawn BATTERYAMMO spawn BATTERYAMMO
ends


// PLAYER #1405
actor APLAYER 100 PSTAND 0 0

ifcount 1
{
 // to make mortar work
 ifvarl PLR_MODE 6 resetcount
 else ifvarg PLR_MODE 12 resetcount 

 ifvarg RESTART 0
 {
    quote 121
    ifvare RESTART 1 setvar RESTART 2 
    else ifvare RESTART 2 { ifrnd 1 { strength 0 } }
 }

 // player uses medkit, etc.
 ifvarg PLR_MODE 1
 {
 ifdead setvar PLR_MODE 1
 ifvare PLR_MODE 13 { setvar PLR_MODE 1 action PSTAND break }
 else ifvare PLR_MODE 2 action PHEAL
 else ifvare PLR_MODE 3 action PHEAL
 else ifvare PLR_MODE 4 action PC4
 else ifvare PLR_MODE 5 action PMINE
 else ifvare PLR_MODE 14 { ifvarl PLR_MORALE 100
                                 { ifrnd 10 { addvar PLR_MORALE 1
                                              addvar PLR_SMOKECOUNT 1
                                            }
                                   else ifvarg PLR_SMOKECOUNT 10 setvar PLR_MODE 1
                                  }
                          else setvar PLR_MODE 1
                        }
 else ifvarg PLR_MODE 5 { ifvarl PLR_MODE 13 action KRHDUKE }
 }

 // bleed
 ifdead { }
 else ifphealthl 99 { ifrnd 1 { ifrnd 7 { action PFLINTCHING state blood addphealth -1 quote 159 ifphealthl 1 action PTHROWNBACK } } }


 // spritepals for players
 ifvarg PLR_STATUS 5
 {
 ifvare PLR_STATUS 6 { spritepal 17 setvar PLR_STATUS 3 } // blue
 else ifvare PLR_STATUS 7 { spritepal 2 setvar PLR_STATUS 2 } // red
 }

 // beast mode & fireteam & ctf
 ifvarg PLR_STATUS 10
 {   
     // plr wa flag & fireteam member & plr wa beastflag
     ifvarl PLR_STATUS 22 { ifp palive spawn NUOLI }
 }

 ifvarg CTF_STATUS 0
 { 
 ifvare CTF_STATUS 1 { ifrnd 10 quote 145 }
 else ifvare CTF_STATUS 2 { ifrnd 10 quote 146 }
 }
} // ifcount 1 



ifaction 0 action PSTAND


// LASER
ifp pstanding
    {
     ifdead { }
     else ifonwater { shoot LASERSITE }
     else ifinwater { }
     else shoot LASERSITE
     }


// sound for running
ifp prunning
    {
     ifdead { }
     else ifonwater { spawn WATERSPLASH2 }
     else ifinwater { }
     else soundonce WHIPYOURASS
     }

// sound for walking
ifp pwalking 
    {
     ifdead { }
     else ifonwater { spawn WATERSPLASH2 }
     else ifinwater { }
     else soundonce WHIPYOURASS 
     }

    ifdead    
    {        
        ifvarg PLR_MORALE 0 { tossweapon setvar PLR_MORALE 0 }
        ifsquished palfrom 32 63 63 63
        else fall

        ifactioncount 7 { move 0 } else ifactioncount 6
        {
            ifmultiplayer { }
            else
            {
                ifrnd 32 sound DUKE_KILLED5
                else ifrnd 32 sound DUKE_KILLED3
                else ifrnd 32 sound DUKE_KILLED1
                else ifrnd 32 sound DUKE_KILLED2
            }
        }

        ifaction PLYINGDEAD
        {
            ifactioncount 3 move PSTOPED
            ifvarg PLR_STATUS 12 { ifvarl PLR_STATUS 21 { quote 167 break } }
            quote 13
            ifhitspace
            {
              action PSTAND
              ifvarg PLR_STATUS 20 { ifvarl PLR_STATUS 28 { setvar PLR_STATUS 1
                                                              state blood } }
              ifvare PLR_STATUS 11 { spawn REDMAINFLAG setvar PLR_STATUS 6 }
              ifvare PLR_STATUS 12 { spawn BLUEMAINFLAG setvar PLR_STATUS 7 }
              spawn DUKELYINGDEAD
              resetplayer
              // keep player in his team
              ifvare PLR_STATUS 3 setvar PLR_STATUS 6 
              ifvare PLR_STATUS 2 setvar PLR_STATUS 7 
            }
            break
        }
        else ifaction PTHROWNBACK
        {
            ifactioncount 5
            {
                state blood
                action PLYINGDEAD
            }
            else ifactioncount 1 move 0
            break
        }

        else ifaction PEXPLODEAD
        {
            ifvarg PLR_STATUS 12 { ifvarl PLR_STATUS 21 { quote 167 break } }
            quote 13
            ifhitspace
            {
              action PSTAND
              ifvarg PLR_STATUS 20 { ifvarl PLR_STATUS 28 { setvar PLR_STATUS 0
                                                            state blood } }

              ifvare PLR_STATUS 11 { spawn REDMAINFLAG setvar PLR_STATUS 6 }
              ifvare PLR_STATUS 12 { spawn BLUEMAINFLAG setvar PLR_STATUS 7 }
              resetplayer
              ifvare PLR_STATUS 3 setvar PLR_STATUS 6 
              ifvare PLR_STATUS 2 setvar PLR_STATUS 7 
            }
            break
        }
        else ifaction PEXPLODE
        {
            ifactioncount 5
            {
                action PEXPLODEAD
                state blood
            }
            break
        }

        else ifp pshrunk
        {
            state standard_pjibs
            state blood

            sound SQUISHED
            sound DUKE_DEAD

            cstat 32768                 // Hide the sprite

            action PLYINGDEAD
        }

        else
        {
            ifinwater
            {
                action PLYINGDEAD
                spawn WATERBUBBLE
                spawn WATERBUBBLE
            }
            else
            {
                action PEXPLODE
                state standard_pjibs
                cstat 32768
                sound SQUISHED
                sound DUKE_DEAD
            }
        }
        break
    }

    ifsquished
    {
        strength -1
        sound SQUISHED
        spawn OOZ
        break
    }

    // player can't be on steroids or use a jetpack
    ifp ponsteroids { }
    ifp pjetpack { }
     
    else ifhitweapon
    {
        

        // morale lowered when wounded
           ifvarg PLR_MORALE 9 {  ifrnd 20 addvar PLR_MORALE -10
                                  else ifrnd 50 addvar PLR_MORALE -7
                                  else ifrnd 128 addvar PLR_MORALE -5
                                  else addvar PLR_MORALE -3
                                }
                   

        ifdead { ifmultiplayer sound DUKE_KILLED4 }
        else
        {
            ifmultiplayer
            {
                ifvare PLR_STATUS 27 { ifrnd 128 sound PREDAPAIN1 else sound PREDAPAIN2 }
                ifphealthl YELLHURTSOUNDSTRENGTHMP
                {
                    ifrnd 64 sound DUKE_LONGTERM_PAIN2
                    else ifrnd 64 sound DUKE_LONGTERM_PAIN3
                    else ifrnd 64 sound DUKE_LONGTERM_PAIN4
                    else sound DUKE_DEAD
                }
                else
                { 
                    ifrnd 64 sound DUKE_LONGTERM_PAIN5
                    else ifrnd 64 sound DUKE_LONGTERM_PAIN6
                    else ifrnd 64 sound DUKE_LONGTERM_PAIN7
                    else sound DUKE_LONGTERM_PAIN8
                }
            }
            else
            {
                ifvare PLR_STATUS 27 { ifrnd 128 sound PREDAPAIN1 else sound PREDAPAIN2 }     
                ifphealthl YELLHURTSOUNDSTRENGTH
                {
                   
                    else ifrnd 74 sound DUKE_LONGTERM_PAIN2
                    else ifrnd 8 sound DUKE_LONGTERM_PAIN3
                    else sound DUKE_LONGTERM_PAIN4
                }
                ifrnd 128 sound DUKE_LONGTERM_PAIN
            }
        }
        
        ifstrength TOUGH
        {
            state headhitstate
            sound DUKE_GRUNT
            ifp pstanding action PFLINTCHING
        }

        
        ifwasweapon RPG
        {
            addphealth -30
            ifrnd 32 state blood
            ifdead state standard_pjibs
            palfrom 48 52
            break
        }
        
        ifwasweapon SPIT
        { addphealth 30 break }

        ifwasweapon RADIUSEXPLOSION
        {
            ifrnd 32 state blood
            ifdead state standard_pjibs
            palfrom 48 52
            break
        }
        
        ifwasweapon FIREEXT
        {
            ifrnd 32 state blood
            ifdead state standard_pjibs
            palfrom 48 52
            break
        }
        
        ifwasweapon FIRELASER 
        {
             palfrom 24 16
             sound SQUISHED
             ifrnd 32 state blood
             ifdead state standard_pjibs
             break
        }

        ifwasweapon SHOTSPARK1 palfrom 24 48
        else ifwasweapon RPG
        {
            ifrnd 128 state blood
            palfrom 48 52
            ifp pdead action PTHROWNBACK 
            break
        }
        else ifwasweapon COOLEXPLOSION1 palfrom 48 48 0 48
        else ifwasweapon KNEE palfrom 16 32
        state check_dead_thrown_back
        state random_wall_jibs

        break
    }

    // give firstaid
    ifaction PHEAL 
    { 
      ifp pwalking { quote 148 setvar PLR_MODE 1 action PSTAND break }
      else ifp prunning { quote 148 setvar PLR_MODE 1 action PSTAND break }
      else ifp pjumping { quote 148 setvar PLR_MODE 1 action PSTAND break }
      else ifp pwalkingback { quote 148 setvar PLR_MODE 1 action PSTAND break }
      else ifp prunningback { quote 148 setvar PLR_MODE 1 action PSTAND break }

      else {
             ifphealthl 100 { ifvare PLR_MODE 3 { ifvarg PLR_HEALCOUNT 74
                                                  { quote 148 setvar PLR_MODE 1 action PSTAND break }
                                                  else                                
                                                  { quote 200
                                                    ifrnd 9 state raisemorale_state
                                                    ifvarl PLR_MORALE 50 { ifrnd 30 { addvar PLR_HEALCOUNT 2 
                                                                                      addphealth 1
                                                                         }           }
                                                   else ifrnd 40 { addvar PLR_HEALCOUNT 1 addphealth 1 }
                                                  }
                                                  
                                                }
                              else { ifvarg PLR_HEALCOUNT 34
                                     { quote 148 setvar PLR_MODE 1 action PSTAND break }
                                     else
                                     { quote 198
                                       ifrnd 9 state raisemorale_state
                                       ifvarl PLR_MORALE 50 { ifrnd 10 { addvar PLR_HEALCOUNT 2
                                                                         addphealth 1
                                                            }          }
                                       else ifrnd 20 { addvar PLR_HEALCOUNT 1 addphealth 1 }
                                     }
                                   }

                            }
             else { quote 148 setvar PLR_MODE 1 action PSTAND break }

           }
    }

    // place explosives
    ifaction PC4
    {
    quote 150 spawn INSTA_EXPO setvar PLR_MODE 1 action PSTAND break              
    }

    // place mine
    ifaction PMINE
    {
    quote 42 spawn FEM7 setvar PLR_MODE 1 action PSTAND break              
    }

    // plr on mortar
    ifaction KRHDUKE 
    {      
      ifcount 15 { ifhitspace {
                        ifp pducking {
                                       ifvarl PLR_MODE 12 addvar PLR_MODE 1
                                       else ifvare PLR_MODE 12 setvar PLR_MODE 6

                                       ifvare PLR_MODE 6 quote 182
                                       else ifvare PLR_MODE 7 quote 183
                                       else ifvare PLR_MODE 8 quote 184
                                       else ifvare PLR_MODE 9 quote 185
                                       else ifvare PLR_MODE 10 quote 186
                                       else ifvare PLR_MODE 11 quote 187
                                       else ifvare PLR_MODE 12 quote 188
                                       resetcount
                                     }
                 }            }

     ifcount 100 { ifhitspace {
                         ifvarl PLR_SHELLCOUNT 1 { quote 79 setvar PLR_MODE 1
                                                   action PSTAND break 
                                                 }
                         ifp pducking { } else
                            { ifvare PLR_MODE 6 spawn MORTAR10
                              else ifvare PLR_MODE 7 spawn MORTAR11
                              else ifvare PLR_MODE 8 spawn MORTAR12
                              else ifvare PLR_MODE 9 spawn MORTAR13
                              else ifvare PLR_MODE 10 spawn MORTAR14
                              else ifvare PLR_MODE 11 spawn MORTAR15
                              else ifvare PLR_MODE 12 spawn MORTAR16
                              sound SPACE_DOOR3 addvar PLR_SHELLCOUNT -1
                              resetcount
                            }
             }            }
    } // action KRHDUKE


    ifaction INVI
    {
     cstat 33025
     ifactioncount 40 { quote 138 soundonce PREDALOAD }
     ifactioncount 200 
     {
       stopsound PREDALOAD quote 139
       ifhitweapon { 
                     resetactioncount  
                     ifrnd 128 soundonce PREDAPAIN1 else soundonce PREDAPAIN2
                   }
       ifhitspace 
       {
        palfrom 48 52 spawn EXPLOSION2 sound LASER2
        shoot FIRELASER resetactioncount 
       }
     }

     ifrnd 1 { ifrnd 128 { cstat 259 action EYES } }
     else ifrnd 1 {
                   ifrnd 128 soundonce PREDSFX1      
                   else soundonce PREDSFX2
                  }
    }
    
    
    ifaction EYES
    { 
    cstat 259
    soundonce PREDEYES 
    ifactioncount 7 { cstat 33025 action INVI } 
    }
    
    ifaction PFLINTCHING
    {
        ifactioncount 2 action PSTAND
        break
    }

    ifinwater
    {
       ifaction PTREDWATER
        {
            ifp pwalking prunning action PSWIMMINGGO
        }
        else ifp pstanding pwalkingback prunningback action PTREDWATER
        else
        {
            ifaction PSWIMMING
            {
                ifrnd 4 spawn WATERBUBBLE
                ifactioncount 4
                    action PSWIMMINGWAIT
            }
            else ifaction PSWIMMINGWAIT
            {
                ifactioncount 2
                    action PSWIMMINGGO
            }
            else ifaction PSWIMMINGGO
            {
                ifactioncount 2
                    action PSWIMMING
            }
            else action PTREDWATER
        }
        ifrnd 4 spawn WATERBUBBLE // For effect

        break
    }
    else
    {
        ifaction PTREDWATER action PSTAND
        ifaction PSWIMMING action PSTAND
        ifaction PSWIMMINGWAIT action PSTAND
        ifaction PSWIMMINGGO action PSTAND
        ifaction PJPHOUVER action PFALLING
    }

    ifaction PFALLING
    {
        ifp ponground
            action PSTAND
        else
        {
            ifp pfalling break
            else state check_pstandard
        }
    }

    ifaction PDUCKING
    {
     ifhitspace {
       ifactioncount 121 resetactioncount
       ifactioncount 25 { ifvarg PLR_FTSPECITEM 1 quote 191
                          else ifvare PLR_STATUS 18 quote 191
                        }
       ifactioncount 120
        {
            // Fireteam special
            ifvarg PLR_STATUS 12
            {
                // A-gunner
                ifvare PLR_STATUS 13
                { ifvare PLR_FTSPECITEM 4 { state ammostate state ammostate
                                            spawn BATTERYAMMO quote 170
                                            setvar PLR_FTSPECITEM 1
                                          }
                  else ifvare PLR_FTSPECITEM 5 { state ammostate state ammostate
                                                 spawn BATTERYAMMO quote 170
                                                 setvar PLR_FTSPECITEM 4
                                               }
                }

                // M-gunner
                else ifvare PLR_STATUS 14
                { ifvare PLR_FTSPECITEM 3 { state ammostate
                                            quote 170 spawn BATTERYAMMO
                                            setvar PLR_FTSPECITEM 1
                                            
                 }                         }

                // 
                else ifvare PLR_STATUS 18 { shoot SPIT quote 173 }
                                            
                                           
                 // sqd leader
                 else ifvare PLR_STATUS 19 { ifvare PLR_FTSPECITEM 2 {
                                                 setvar PLR_FTSPECITEM 1
                                                 spawn RADIOMAN quote 174
                                                                     }
                                           }
              }
        resetactioncount
        } } 
           
     
        ifgapzl 48
        {
            ifp pwalking pwalkingback prunning prunningback action PCRAWLING
        }
        else ifp pducking
        {
         ifp pwalking pwalkingback prunning prunningback action PCRAWLING 
        }

        else
        {
            ifp pstanding action PSTAND
            else state check_pstandard
        }
    }

    else ifaction PCRAWLING
    {        

        ifgapzl 48
        {
            ifp pstanding action PCRAWLING
        }
        else ifp pducking
        {
            ifp pstanding action PDUCKING 
        }
        else
        {
            ifp pstanding action PSTAND
            else state check_pstandard
        }
    }
    else ifgapzl 48 action PDUCKING

    else ifaction PJUMPING
    {
        ifp ponground action PSTAND
        else ifactioncount 4 ifp pfalling action PFALLING
    }

    ifp pfalling action PFALLING
    else ifaction PSTAND state check_pstandard
    else ifaction PAKICKING
    {
        ifactioncount 2 action PSTAND
        break
    }
    else ifaction PWALK     
    {
        ifp pfalling action PFALLING
        else ifp pstanding action PSTAND
        else ifp prunning action PRUN
        else ifp pwalkingback action PWALKBACK
        else ifp prunningback action PRUNBACK
        else ifp pjumping action PJUMPING
        else ifp pducking action PDUCKING 
    }
   

    else ifaction PRUN 
    {
        ifp pstanding action PSTAND
        else ifp pwalking action PWALK
        else ifp pwalkingback action PWALKBACK
        else ifp prunningback action PRUNBACK
        else ifp pjumping action PJUMPING
        else ifp pducking action PDUCKING 
    }
   

    else ifaction PWALKBACK  
    {
        ifp pstanding action PSTAND
        else ifp pwalking action PWALK
        else ifp prunning action PRUN
        else ifp prunningback action PRUNBACK
        else ifp pjumping action PJUMPING
        else ifp pducking action PDUCKING 
    }
   
    else ifaction PRUNBACK 
    {
        ifp pstanding action PSTAND
        else ifp pwalking action PWALK
        else ifp prunning action PRUN
        else ifp pwalkingback action PWALKBACK
        else ifp pjumping action PJUMPING
        else ifp pducking action PDUCKING 
    }
  
enda
 
// CTF & BEAST ACTORS
// ******************

// join blue team #904
actor WOODENHORSE
{  cstat 32768
   ifpdistl 1024 { ifp palive
                         {
                           ifvare PLR_STATUS 2 { addphealth -200 } // red
                           else ifvare PLR_STATUS 3 { } // blue
                           else {
                                  quote 140
                                  setvar PLR_STATUS 6
                                }
                     }
               } // blue team
    
}
enda


// fireteam & red team member selector #489
action ODOTUS 
action LUUPPI 

useractor notenemy SATELLITE 0 LUUPPI
cstat 32768
      
ifaction LUUPPI
{

    // remove ammo in the beginning
    ifspritepal 9
    {
    ifp palive ifpdistl 400 ifcanseetarget
    { addammo PISTOL_WEAPON -48 action ODOTUS }
    else ifcount 8 killit 
    }


    else
    {
       ifp palive ifpdistl 1024 ifcanseetarget
       {
               // a-gunner
            ifspritepal 10
            {
             quote 160
             setvar PLR_STATUS 13
             setvar PLR_FTSPECITEM 5
             addweapon PISTOL_WEAPON 112
             addweapon HANDBOMB_WEAPON 2
             action ODOTUS
            } 
               // machine gunner
            else ifspritepal 11
            {
             quote 161
             setvar PLR_STATUS 14
             setvar PLR_FTSPECITEM 3
             addweapon HANDBOMB_WEAPON 1
             addweapon CHAINGUN_WEAPON 180
             action ODOTUS
            }  
                   // sniper
            else ifspritepal 12 
            {
            quote 162
            setvar PLR_STATUS 15            
            addweapon GROW_WEAPON 70  
            addweapon HANDBOMB_WEAPON 1
            action ODOTUS
            } 
            // grenadier
            else ifspritepal 13
            {
            quote 163
            setvar PLR_STATUS 16
            addweapon HANDBOMB_WEAPON 2
            addweapon TRIPBOMB_WEAPON 2
            addweapon RPG_WEAPON 6
            action ODOTUS
            } 
               // point man
            else ifspritepal 14 
            {
            quote 164
            setvar PLR_STATUS 17
            addweapon HANDBOMB_WEAPON 2
            addweapon PISTOL_WEAPON 112
            action ODOTUS
            }
                // medic
            else ifspritepal 15 
            {   
            quote 165
            setvar PLR_STATUS 18
            addinventory GET_FIRSTAID 2
            addweapon DEVISTATOR_WEAPON 36
            action ODOTUS
            }
            // squad leader
            else ifspritepal 16 
            {
             quote 166
             setvar PLR_STATUS 19
             setvar PLR_FTSPECITEM 2 // fire mission
             addweapon HANDBOMB_WEAPON 2
             addweapon PISTOL_WEAPON 180
             action ODOTUS
            } 
              // engineer 
            else ifspritepal 17 
            {
            quote 189
            setvar PLR_STATUS 20
            addweapon FREEZE_WEAPON 50
         // addinventory GET_BOOTS 4
            action ODOTUS
            }           
                 // red team
           else ifspritepal 0
           {            
             ifvare PLR_STATUS 3 { addphealth -200 } // blue
             else ifvare PLR_STATUS 2 { } // red
             else {
                     quote 141
                     setvar PLR_STATUS 7 // red team 
                  }
           }
        }  
       } // else

} // action

ifaction ODOTUS
{ ifpdistg 2048 action LUUPPI }
enda

// blue_standard
action BLUEWINS 0 1 1 1 1
action BLUELOSE 1666 12 1 1 2
action BLUEWAIT 0 1 1 1 1

useractor notenemy NAKED1 0 0
{
ifaction 0 action BLUEWAIT

ifaction BLUEWAIT
{
ifpdistl 2048 { ifp palive { ifvare PLR_STATUS 11 { quote 145 
                                                    action BLUEWINS
                                                    setvar CTF_STATUS 1
                                                   }
               }           }

ifvare CTF_STATUS 2 { cstat 128 action BLUELOSE }
}

ifaction BLUEWINS 
{
// Sound BLUEWINS
ifcount 200 { sound WIERDSHOT_FLY resetcount }
}

}
enda


// red_standard
action REDWINS 0 1 1 1 1
action REDLOSE 975 12 1 1 2
action REDWAIT 0 1 1 1 1 
useractor notenemy PODFEM1 0 0 
{
ifaction 0 action REDWAIT

ifaction REDWAIT 
{
ifpdistl 2048 { ifp palive { ifvare PLR_STATUS 12 { quote 146
                                                    action REDWINS
                                                    setvar CTF_STATUS 2
                                                   }
               }           }
ifvare CTF_STATUS 1 { cstat 128 action REDLOSE } 
}

ifaction REDWINS
{
 // sound RED_WINS
 ifcount 200 { sound TURR_ROAM resetcount }
}

}
enda



// blue_main_flag
action BLUEFLAG 1
useractor notenemy BLUEMAINFLAG 0 0
{
    ifaction 0 { sizeat 20 20 fall cstat 256 action BLUEFLAG }

    ifaction BLUEFLAG
    { 
      ifpdistl 1300 { ifp palive { ifvare PLR_STATUS 2 { quote 142
                                                         setvar PLR_STATUS 12
                                                         killit
                                                       }
                    }            }
    }
}
enda


// red_main_flag
action REDFLAG 1
useractor notenemy REDMAINFLAG 0 0
{
    ifaction 0 { sizeat 20 20 fall cstat 256 action REDFLAG }

    ifaction REDFLAG
    {
      ifpdistl 1300 { ifp palive { ifvare PLR_STATUS 3 { quote 142
                                                         setvar PLR_STATUS 11
                                                         killit
                                                       }
                    }            }
    }
}
enda

// END OF CTF & BEAST ACTORS


state rf
    ifrnd 128 cstat 4
    else cstat 0
ends

// SS OFFICER # 1680
action SSOFFICERSTAND    21   1    5    1    1
action SSOFFICERWALKING  1    4    5    1   12
action SSOFFICERSHOOT    26   1    5    1   30
action SSOFFICERFLINTCH  -7   1    1    1    6
action SSOFFICERDYING    -7   5    1    1   16
action SSOFFICERDEAD     -2   1    1    1   15
action MINISSOFFICER      0   1    1    1    1

move SSWALKVELS 72
move SSRUNVELS 132
move SS_STOPPED
move SHRUNKVELS 32

ai AISSOFFICERSEEK SSOFFICERWALKING SSWALKVELS seekplayer
ai AISSOFFICERSHOOT SSOFFICERSHOOT  SS_STOPPED faceplayer
ai AISSOFFICERHIT SSOFFICERFLINTCH SS_STOPPED  faceplayer
ai AISSOFFICERDYING SSOFFICERDYING SS_STOPPED  faceplayer
ai AISSOFFICERWAIT SSOFFICERSTAND SS_STOPPED faceplayer

// used in somewhere else, too
state checksquished
ifsquished { addkills 1 sound SQUISHED state standard_jibs spawn OOZ state delete_enemy }
ends


state ss_off_seekstate
{
ifcansee { ifp palive { ifcount 60 { state fear_state ai AISSOFFICERSHOOT } } }
}
ends

state ss_off_shootstate
{
resetcount
sound LUGER shoot SHOTGUN spawn SHELL
state plrshot_state
ai AISSOFFICERWAIT
}
ends

state ss_off_waitstate
{
ifcansee { ifp palive { ifpdistl 5000 { ifcount 60 ai AISSOFFICERSHOOT } } }
else ai AISSOFFICERSEEK
}
ends


state ss_off_dyingstate
{
iffloordistl 32 { ifactioncount 5 { ifspritepal 10 endofgame 52
                                    cstat 0 state blood state random_wall_jibs
                                    state rf strength 0 move SS_STOPPED spawn FIRSTGUNSPRITE
                                    action SSOFFICERDEAD } break }
else { state rf move 0 action SSOFFICERDYING }
}
ends


state ss_off_hitstate
{
ifrnd 20 addstrength -46 
ifdead
    { 
     addkills 1 state ssdead_state
     ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
     else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }            
     else { state gerdethsound ai AISSOFFICERDYING }
     else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break } 
    }    
else { ifrnd 64 sound VAULT_DOOR
       else ifrnd 64 sound END_OF_LEVEL_WARN
       else state gerdethsound
       state blood ai AISSOFFICERSEEK
     }


}
ends

actor LIZTROOP TROOPSTRENGTH MINISSOFFICER
{
fall

ifaction MINISSOFFICER { sizeat 18 18 ai AISSOFFICERSEEK }
         // SS officer size_define sprite number #1680


ifaction SSOFFICERDEAD
{
strength 0 ifhitweapon
ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs
                              state delete_enemy break
                            }
}

    
    else ifai AISSOFFICERDYING state ss_off_dyingstate
    else ifai AISSOFFICERHIT { ifactioncount 3 ai AISSOFFICERSEEK }
    else
    {
        ifai AISSOFFICERSEEK state ss_off_seekstate
        else ifai AISSOFFICERSHOOT state ss_off_shootstate
        else ifai AISSOFFICERWAIT state ss_off_waitstate
        ifhitweapon state ss_off_hitstate
    }

    ifrnd 1 { ifrnd 96 state ger_sfx }
}
enda


// german cap #2762
action CAPTROOPSTAND    33   1    8    1    1
action CAPTROOPWALKING  1    4    8    1   12
action CAPTROOPSHOOT    33   2    8    1   7
action CAPTROOPFLINTCH  -79   1    1    1    6
action CAPTROOPDYING    -79   6    1    1   16
action CAPTROOPDEAD     -73   1    1    1   15
action MINICAPTROOP      0   1    1    1    1
action CAPTROOPDUCK    -661  1    8    1    1
action CAPTROOPDUCKSH  -661  2    8    1    7


ai AICAPTROOPSEEK CAPTROOPWALKING SSWALKVELS seekplayer
ai AICAPTROOPSHOOT CAPTROOPSHOOT  SS_STOPPED faceplayer
ai AICAPTROOPHIT CAPTROOPFLINTCH SS_STOPPED  faceplayer
ai AICAPTROOPDYING CAPTROOPDYING SS_STOPPED  faceplayer
ai AICAPTROOPWAIT CAPTROOPDUCK SS_STOPPED faceplayer
ai AICAPTROOPDUCKSH CAPTROOPDUCKSH SS_STOPPED faceplayer

state cap_tro_seekstate
{
ifcansee { ifp palive ifpdistl 5000
                 { ifcount 60 { ifrnd 128 ai AICAPTROOPDUCKSH
                                     else ai AICAPTROOPSHOOT
                               } } }
ifrnd 2 ai AICAPTROOPWAIT
}
ends

state cap_tro_shootstate
{
ifactioncount 2 { ifrnd 64 state plrshot_state
                  sound REACTOR_ON shoot SHOTGUN spawn SHELL
                  resetactioncount
                  ifcansee { ifrnd 200 { ai AICAPTROOPSHOOT break } 
                             else { resetcount ai AICAPTROOPWAIT }
                           }
                }
}
ends

state cap_tro_waitstate
{
ifcansee { ifp palive ifpdistl 5000
                       { ifcount 20 { ifrnd 20 ai AICAPTROOPDUCKSH }
                        else ifcount 40 { ifrnd 30 ai AICAPTROOPSHOOT }
                       }
         }
ifcount 300 ai AICAPTROOPSEEK
}
ends

state cap_duckshstate
{
ifactioncount 2 { ifrnd 64 state plrshot_state
                  sound REACTOR_ON shoot SHOTGUN spawn SHELL
                  resetactioncount
                  ifcansee { ifrnd 200 { ai AICAPTROOPDUCKSH break } 
                             else { resetcount ai AICAPTROOPWAIT }
                           }
                }

}
ends

state cap_tro_dyingstate
{
ifactioncount 5 { state blood state random_wall_jibs spawn RPGSPRITE spawn DEADGERMAN killit }
}
ends


state cap_tro_hitstate
{
ifrnd 50 addstrength -56 
ifdead
    { 
     addkills 1 cstat 256
     ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
     else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
     else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }            
     else { state gerdethsound ai AICAPTROOPDYING }
    }    
else { ifrnd 128 state gerdethsound state blood ai AICAPTROOPSEEK }
}
ends

useractor enemy GER_CAP TROOPSTRENGTH MINICAPTROOP
{
fall cstat 257
ifaction MINICAPTROOP { sizeat 18 18 ai AICAPTROOPSEEK }
         // cap troop size_define sprite number #2762

ifaction CAPTROOPDEAD
{
strength 0 ifhitweapon
ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs
                              state delete_enemy break
                            }
}

    else ifai AICAPTROOPDYING state cap_tro_dyingstate
    else ifai AICAPTROOPHIT { ifactioncount 3 ai AICAPTROOPSEEK }
    else
    {
        ifai AICAPTROOPSEEK state cap_tro_seekstate
        else ifai AICAPTROOPSHOOT state cap_tro_shootstate
        else ifai AICAPTROOPWAIT state cap_tro_waitstate       
        else ifai AICAPTROOPDUCKSH state cap_duckshstate
        ifhitweapon state cap_tro_hitstate
    }
}
enda



// SS TROOP #1950
action SSTROOPSTAND    21   1    5    1    1
action SSTROOPWALKING  1    4    5    1   12
action SSTROOPSHOOT    26   1    5    1   14
action SSTROOPFLINTCH  31   1    1    1    6
action SSTROOPDYING    31   5    1    1   16
action SSTROOPDEAD     36   1    1    1   15
action MINISSTROOP      0   1    1    1    1

ai AISSTROOPSEEK SSTROOPWALKING SSWALKVELS seekplayer
ai AISSTROOPSHOOT SSTROOPSHOOT  SS_STOPPED faceplayer
ai AISSTROOPHIT SSTROOPFLINTCH SS_STOPPED  faceplayer
ai AISSTROOPDYING SSTROOPDYING SS_STOPPED  faceplayer
ai AISSTROOPWAIT SSTROOPSTAND SS_STOPPED faceplayer

state ss_tro_seekstate
{
ifcansee { ifp palive { ifcount 60 { state fear_state ai AISSTROOPSHOOT } } }
}
ends

state ss_tro_shootstate
{
ifactioncount 1 { ifrnd 128 state plrshot_state
                  sound SHOTGUN_FIRE shoot SHOTGUN spawn SHOTGUNSHELL
                  resetcount ai AISSTROOPWAIT 
                }
}
ends

state ss_tro_waitstate
{
ifcansee { ifp palive { ifpdistl 5000 { ifcount 2 ai AISSTROOPSHOOT } } }
else ai AISSTROOPSEEK
}
ends


state ss_tro_dyingstate
{
iffloordistl 32 { ifactioncount 5 { cstat 0 state blood state random_wall_jibs
                                    state rf strength 0 move SS_STOPPED spawn SHOTGUNSPRITE
                                    action SSTROOPDEAD } break }
else { state rf move 0 action SSTROOPDYING }
}
ends


state ss_tro_hitstate
{
ifrnd 40 addstrength -36 
ifdead
    { 
     addkills 1 state ssdead_state
     ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
     else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
     else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }            
     else { state gerdethsound ai AISSTROOPDYING }
    }    
else { sound PRED_PAIN state blood ai AISSTROOPSEEK }
}
ends

useractor enemy SS_TROOP TROOPSTRENGTH MINISSTROOP
{
fall
ifaction MINISSTROOP { sizeat 18 18 ai AISSTROOPSEEK }
         // SS troop size_define sprite number #1950

ifaction SSTROOPDEAD
{
strength 0 ifhitweapon
ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs
                              state delete_enemy break
                            }
}

    else ifai AISSTROOPDYING state ss_tro_dyingstate
    else ifai AISSTROOPHIT { ifactioncount 3 ai AISSTROOPSEEK }
    else
    {
        ifai AISSTROOPSEEK state ss_tro_seekstate
        else ifai AISSTROOPSHOOT state ss_tro_shootstate
        else ifai AISSTROOPWAIT state ss_tro_waitstate
        ifhitweapon state ss_tro_hitstate
    }
}
enda





// demoman 
// spritepal 10 = private McCurkee
// spritepal 11 = stayput

action MINIDEMO 
action SOLIC1 1711   4   5   1   17
action SOLIC2 1711   1   5   1   1
action SOLIC3 1711   1   5   1   1
action SOLDIE 1731   5   1   1   18
action SOLPAIN 1731  1   1   1   10
action SOLDED 1736 1 1 

action SOLCEE 1711 1 5 1 10 // place explosives
action SOLMINE 1711 1 5 1 10  // place mine

move solspeed 93
move soltopspeed 108
move solstop 0 
move soljumpspeed 120 -95

ai AISOLIC SOLIC1 solspeed seekplayer 
ai AISOLICSTOP SOLIC2 solstop geth getv

ai AISOLICHEAL SOLIC2 solstop faceplayer
ai AISOLSNIPE1 SOLIC2 solstop faceplayer
ai AISOLDYING SOLDIE solstop faceplayer
ai AISOLPAIN SOLPAIN solstop faceplayer 
ai AISOLBULLET SOLIC1 soltopspeed dodgebullet
ai AISOLSTAY SOLIC2 solstop faceplayer
ai AISOLJUMP SOLIC1 soljumpspeed faceplayer
ai AISOLPAIN2 SOLPAIN solstop faceplayer
ai AISOLDEMO SOLCEE solstop faceplayer
ai AISOLMINE SOLMINE solstop faceplayer

ai AISOLFOLLOW SOLIC1 solspeed faceplayer
ai AISOLFOLLOWSTOP SOLIC2 solstop faceplayer

state mil
{
 ifcansee { ifpdistl 1700 { ai AISOLICHEAL } } 
}
ends


state milheal
{ 
ifpdistl 1024 {
      ifcount 20 {     
          ifhitspace { ifspritepal 10
                       { quote 108
                         ifrnd 128 sound LASER1 else sound BOS1_DYING
                       }

                       else
                       {
                         quote 128
                         ifrnd 128 sound BOS2_ATTACK else sound BOS2_RECOG
                       }
                       ai AISOLFOLLOW
                     }
                  }
              }

else ifpdistg 1700 ai AISOLIC
}
ends

state mildying  
{ 
ifactioncount 5 action SOLDED
}
ends

state milpain
{
        ifdead {
                ifspritepal 10 { setvar RESTART 1 quote 121 }
                ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_pjibs killit break }
                else ifwasweapon RPG { sound SQUISHED state standard_pjibs killit break }
                else {
                       ifspritepal 10
                       {
                       ifrnd 128 sound BOS1_ATTACK1 else sound BOS1_ATTACK2
                       }
                       else sound BOS2_DYING
                       ai AISOLDYING
                     }
                }  
         
        else { ifspritepal 10 sound BOS1_RECOG
               else sound BOS2_PAIN ai AISOLPAIN2 }
}
ends

state milpain2
        {
        ifactioncount 2 { ifrnd 128 ai AISOLBULLET else ai AISOLIC } 
        }
ends

state milbullet
        {
        ifactioncount 55 ai AISOLIC
        }
ends

state milfollow
        {         
        ifpdistl 1700 { ifcansee { ai AISOLFOLLOWSTOP } }
        else ifcount 40 { ifp phigher { ifpdistl 5000 { ai AISOLJUMP } } }
        else ifcansee { } else { ifcount 325 { ai AISOLIC } }
        else ifpdistg 7192 { ai AISOLIC }
        }
ends

state miljump
        {
        ifactioncount 4 ai AISOLFOLLOW
        }
ends

state milfollowstop
{
ifpdistl 1000 {
       ifcount 32 {
           ifhitspace { ifp pducking { ifspritepal 10 { } 
                                       else { sound BOS2_ROAM quote 130 ai AISOLMINE }
                                     }
                        else { ifspritepal 10
                               {
                                 ifrnd 84 sound OCTA_ATTACK2
                                 else ifrnd 84 sound SECRETLEVELSND
                                 else sound COMPANB2
                                 quote 123

                               }

                               else
                               {
                               quote 129
                               ifrnd 64 sound BOS2_RECOG
                               else ifrnd 64 sound BOS2_ATTACK
                               else sound BOS1_ROAM 
                               }

                               ai AISOLSTAY
                             }

                        }
                   }           
              }
else ifpdistg 1700 ai AISOLFOLLOW 
}
ends

state milstay
{ 
ifpdistl 1000 {
      ifcount 32 {
         ifhitspace { ifp pducking { ifspritepal 10 { }
                                     else { sound DUKE_TIP2 quote 131 ai AISOLDEMO }
                                   }
                      else { ifspritepal 10
                             {
                                quote 108
                                ifrnd 64 sound LASER1
                                else ifrnd 64 sound BOS1_PAIN
                                else ifrnd 64 sound COMPANB2
                                else sound DUMPSTER_MOVE
                             }

                             else
                             {
                                quote 128
                                ifrnd 64 sound BOS2_ATTACK
                                else ifrnd 64 sound BOS2_RECOG
                                else sound DUKE_BOOBY
                             }

                             ai AISOLFOLLOW

                            }

                    }
                 }           
              }
}
ends

state milmine
ifcount 110 { spawn MINE ai AISOLFOLLOW }
ends

state mildemo
ifcount 65 { sound DUKE_TIP1 spawn RUBBERCAN ai AISOLBULLET }
ends

useractor notenemy DEMOMAN 80 MINIDEMO
fall cstat 257
ifaction MINIDEMO { sizeat 18 18 action SOLIC3 }

// for private McCurkee
ifspritepal 10
{
ifpdistl 2048 { ifvare MCURKEE 1 setvar MCURKEE 2 }
else ifpdistg 2048 { ifvare MCURKEE 2 setvar MCURKEE 1 }
}


ifaction SOLIC3 { ifspritepal 11 ai AISOLSTAY
                  else ai AISOLIC
                }

else ifaction SOLDED
       {
        cstat 256 move 0 strength 0 ifhitweapon ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy } break
       }

else
       {
          ifai AISOLIC state mil
          else ifai AISOLICSTOP state mil
          else ifai AISOLICHEAL state milheal
          else ifai AISOLDYING state mildying
          else ifai AISOLBULLET state milbullet
          else ifai AISOLSTAY state milstay
          else ifai AISOLJUMP state miljump
          else ifai AISOLPAIN2 state milpain2
          else ifai AISOLFOLLOW state milfollow
          else ifai AISOLFOLLOWSTOP state milfollowstop
          else ifai AISOLDEMO state mildemo
          else ifai AISOLMINE state milmine
          ifbulletnear state milbullet
          ifinwater { ifrnd 4 { strength 0 state mildying } }
          ifhitweapon state milpain
       }
enda




// German heavy machinegun
// *********************
// spritepal 0 = normal
// spritepal 9 = shoot all the time
// spritepal 10 = small 

action HMG_AIM 1 1 5 1 1
action HMG_WAIT 1 1 5 1 1
action HMG_SHOOT 1 2 5 1 10
action HMG_MOVE 1 1 5 1 1
action HMG_DYING 11 5 1 1 15
action HMG_DEAD 16 1 1 1 1
action TRACERS 1 2 5 1 5
action MINIMAN4 0 1 1 1 1

move snipe2

actor LIZTROOPDUCKING TROOPSTRENGTH MINIMAN4 faceplayersmart
{
ifaction MINIMAN4 {
                   // in E1L3
                   ifspritepal 10 { sizeat 5 5 spritepal 9 }
                   else sizeat 17 17 // HMG, sprite number #1744
                   fall 
                   ifcount 2 action HMG_AIM
                  }

ifhitweapon 
    {
    ifrnd 50 { addstrength -56 }
    ifdead
         { 
            addkills 1
            ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }            
            else { state gerdethsound action HMG_DYING }
         }    
           else { sound PRED_PAIN state blood action HMG_AIM move 0 }
     }

ifaction HMG_MOVE
    {    
      action HMG_SHOOT
      move snipe2 faceplayersmart
    }

ifaction HMG_SHOOT
    {
    ifactioncount 4 { ifrnd 64 state plrshot_state resetcount
                  sound HMG shoot SHOTGUN shoot SHOTGUN spawn SHOTGUNSHELL
                  ifrnd 5 { stopsound HMG action HMG_WAIT }
                  ifspritepal 12 { ifrnd 50 action TRACERS }
                  else ifspritepal 9 {  ifpdistl 3000 { stopsound HMG action HMG_MOVE }
                                        else { ifrnd 150 action HMG_SHOOT else { stopsound HMG action HMG_AIM } }

                                     }
                  else ifcansee { ifp palive { ifrnd 245 action HMG_SHOOT } }
                  else { stopsound HMG action HMG_AIM }
                }
      
    }

ifaction HMG_WAIT
    {
    ifcount 30 { resetcount action HMG_AIM }

    }

ifaction TRACERS
    {
    ifcount 4 { sound HMG spawn SHARK
                shoot SHOTGUN shoot SHOTGUN spawn SHOTGUNSHELL
                ifrnd 30 action HMG_SHOOT
                resetcount
              }

     else ifcansee { } else { action HMG_AIM }
      else action TRACERS
    }

ifaction HMG_AIM
    { 
    ifspritepal 9 { ifrnd 5 action HMG_SHOOT  
                    else ifcount 50 action HMG_SHOOT
                  }
    else {  ifcansee { ifp palive { ifpdistl 5000 action HMG_MOVE
                                    else ifrnd 15 action HMG_MOVE
                                   }
                      } 
         }
    else action HMG_AIM
    }
    
ifaction HMG_DYING
    { ifactioncount 5 { sizeat 20 20 state blood state random_wall_jibs spawn CHAINGUNSPRITE state rf action HMG_DEAD } }

ifaction HMG_DEAD
    { strength 0 
      ifhitweapon { ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break } }
      break 
    }
}
enda





// sniper
action ATROOPAIMING 1 1 8 1 1
action ATROOPLIIKKUU 1 1 8 1 1
action ATROOPSNIPE 12 1 8 1 10
action ASNIPEDYING 465 5 1 1 15
action ASNIPEDEAD 470 1 1 1 1
action MINIMAN3  0 0 0 0 1

move snipe

actor GERMANSNIPER TROOPSTRENGTH MINIMAN3 faceplayersmart
fall  // SNIPER size_define, sprite number #1715
 
    ifaction MINIMAN3 { sizeat 18 18 action ATROOPAIMING move snipe faceplayersmart }
    
    ifaction ATROOPLIIKKUU
    {    
        { action ATROOPSNIPE move snipe faceplayersmart  }
        
    }
    else ifaction ATROOPSNIPE
    {
        ifcount 4 { state plrshot_state sound SHRINKER_FIRE shoot GROWSPARK action ATROOPAIMING }   
        else ifcount 15 { ifpdistg 3000 { ifrnd 128 action ATROOPAIMING } }
        else ifcount 60 resetcount 
        else action ATROOPSNIPE
    }                                                                                                    
    else ifaction ATROOPAIMING
    { 
    ifcount 80 { ifrnd 20 { ifp palive { ifcansee { action ATROOPLIIKKUU } } } }
    else ifcount 20 { ifp palive { ifcansee { ifpdistl 3000 action ATROOPLIIKKUU } } }
    else action ATROOPAIMING
    }
    
    ifhitweapon 
    {
    ifrnd 70 { addstrength -56 }
    ifdead
         { 
            addkills 1
            ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }
            else { state gerdethsound action ASNIPEDYING }
         }    
           else { sound PRED_PAIN state blood action ATROOPAIMING move 0 }
         }

    else ifaction ASNIPEDYING
    { ifactioncount 5 { state blood state random_wall_jibs
                        ifrnd 64 state blood spawn GROWSPRITEICON
                        else ifrnd 20 state blood
                        state rf action ASNIPEDEAD
                      } }

    else ifaction ASNIPEDEAD
    { strength 0 
      ifhitweapon { ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break } }
      break 
    }

enda



// used for FT SQ's firemission
useractor notenemy RADIOMAN 80 0 
cstat 32767
ifaction 0 { ifspawnedby APLAYER { state sharkspawner killit } }
enda


state medic_healsfx
ifrnd 64 soundonce SLIM_HATCH
else ifrnd 64 soundonce DUKE_STEPONFECES
else ifrnd 64 soundonce DUKE_HIT_STRIPPER2
else ifrnd 64 soundonce SOMETHINGFROZE
ends




// medic
action MINIMEDIC  0 1 1 1 1
action MEDIC1 1298   4   8   1   17
action MEDIC2 1330   1   5   1   1
action MEDIC3 1330   1   5   1   1
action MEDDIE 981   5   1   1   18
action MEDPAIN 981   1   1   1   10
action MEDDED 987 1 1 

move medspeed 93
move medtopspeed 108
move medstop 0 
move medjumpspeed 120 -95

ai AIMEDIC MEDIC1 medspeed seekplayer 
ai AIMEDICHEAL MEDIC2 medstop faceplayer
ai AIMEDDYING MEDDIE medstop faceplayer
ai AIMEDPAIN MEDPAIN medstop faceplayer 
ai AIMEDBULLET MEDIC1 medtopspeed dodgebullet
ai AIMEDSTAY MEDIC2 medstop faceplayer
ai AIMEDJUMP MEDIC1 medjumpspeed faceplayer
ai AIMEDPAIN2 MEDPAIN medstop faceplayer

ai AIMEDFOLLOW MEDIC1 medspeed faceplayer
ai AIMEDFOLLOWSTOP MEDIC2 medstop faceplayer

state doc
{
 ifcansee { ifpdistl 1700 { ai AIMEDICHEAL } } 
 else { ai AIMEDIC }
}
ends


state docheal
{                                                 
ifphealthl 100 { ifpdistl 1024 { ifcount 25 { ifrnd 30 state medic_healsfx addphealth 3 resetcount } } }
else ifpdistl 1000 { ifcount 20 { ifhitspace { quote 126
                                               ifrnd 128 sound MEDIC11
                                               else sound SOLIC33
                                               ai AIMEDFOLLOW } } }
else ifpdistg 1700 ai AIMEDIC
}
ends

state docdying  
{ 
ifactioncount 5 {  
                  ifrnd 128 spawn SIXPAK 
                  spawn DEADALLY killit
                }
}
ends

state docpain  
{
        ifdead {
                state ally_hitsfx
                ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_pjibs killit break }
                else ifwasweapon RPG { sound SQUISHED state standard_pjibs killit break }
                else ai AIMEDDYING
                }  
         
        else { ifrnd 128 sound SOLIC11 ai AIMEDPAIN2 }
}
ends

state docpain2
        {
        ifactioncount 2 { ifrnd 128 ai AIMEDBULLET else ai AIMEDIC } 
        }
ends

state docbullet
        {
        ifactioncount 55 ai AIMEDIC
        }
ends

state docfollow
        { 
        ifpdistl 1700 { ifcansee ai AIMEDFOLLOWSTOP }
        else ifcount 40 { ifp phigher { ifpdistl 5000 { ai AIMEDJUMP } } }
        else ifcansee { } else { ifcount 325 { ai AIMEDIC } }
        else ifpdistg 7192 { ai AIMEDIC }
        }
ends

state docjump
        {
        ifactioncount 4 ai AIMEDFOLLOW
        }
ends

state docfollowstop
{
ifphealthl 100 { ifpdistl 1024 { ifcount 25 { ifrnd 30 state medic_healsfx addphealth 0 resetcount } } }
else ifpdistl 1000 { ifcount 32 { ifhitspace { quote 127
                                               ifrnd 84 sound MEDIC22
                                               else ifrnd 84 sound MEDIC33
                                               else sound SOLIC33
                                               ai AIMEDSTAY
                                          } } }
else ifpdistg 1700 ai AIMEDFOLLOW 
}
ends

state docstay
{ 
ifphealthl 100 { ifpdistl 1000 { ifcount 25 { ifrnd 30 state medic_healsfx addphealth 0 resetcount } } }
else ifpdistl 1000 { ifcount 32 { ifhitspace { quote 126
                                               ifrnd 64 sound MEDIC33
                                               else ifrnd 64 sound M2
                                               else ifrnd 64 sound MEDIC11
                                               else sound SOLIC33
                                               ai AIMEDFOLLOW
                                           } } }
}
ends

useractor notenemy MEDIC 80 MINIMEDIC
fall
ifaction MINIMEDIC { sizeat 17 17 cstat 257 action MEDIC3 }
ifaction MEDIC3 ai AIMEDIC

else
        {
          ifai AIMEDIC state doc        
          else ifai AIMEDICHEAL state docheal
          else ifai AIMEDDYING state docdying
          else ifai AIMEDBULLET state docbullet
          else ifai AIMEDSTAY state docstay
          else ifai AIMEDJUMP state docjump
          else ifai AIMEDPAIN2 state docpain2
          else ifai AIMEDFOLLOW state docfollow
          else ifai AIMEDFOLLOWSTOP state docfollowstop
          ifbulletnear state docbullet
          ifinwater { ifrnd 4 { strength 0 state docdying } }
          ifhitweapon state docpain
        }
enda

/*
action ATT
action ATT2
action DEF
gamevar I 0 2
useractor notenemy SIGNALER 0
{
 cstat 32768

 ifaction 0
 {
        ifpdistl 1024
        {
        spawn EXPLOSION2
        resetcount setvar I 0
        ifspritepal 1 { action ATT setvar ATTACK_MODE 1 }  // normal attack
        else ifspritepal 2 { action ATT setvar ATTACK_MODE 2 } // defend
        }
 }

 ifaction ATT
 {
  ifcount 150 { setvar ATTACK_MODE 0 killit }
 }


}
enda
*/




// WEHRMACHT ENEMIES CODE
// **********************


// ducking wermacht infantry armed with Mp40 SUB machinegun
action MINIDUCK             0     0    0    0    1
action DUCKGM_STAND         72    1    5    1    15
action DUCKGM_SHOOTING      72    2    5    1    7
action DUCKGM_DUCK          32    1    8    1    7
action DUCKGM_DUCKSHOOT     32    2    8    1    10
action DUCKGM_DYING         62    6    1    1    15


move GMWALKVEL 36
move GMRUNVEL 110
move GMSTOP

// ducking
ai AIDUCKGM_DUCK DUCKGM_DUCK GMSTOP faceplayer 
ai AIDUCKGM_DUCKSHOOT DUCKGM_DUCKSHOOT GMSTOP faceplayer
ai AIDUCKGM_POP DUCKGM_STAND GMSTOP faceplayer
ai AIDUCKGM_POPSHOOT DUCKGM_SHOOTING GMSTOP faceplayer
ai AIDUCKGM_DYING DUCKGM_DYING GMSTOP faceplayer

// belt feeder
ai AIDUCKGM_BELT DUCKGM_DUCK GMSTOP geth getv

// general states for Wehrmacht troops
// ***********************************
state german_checkhit
{
 ifrnd 70 addstrength -56

 ifdead
 {
      addkills 1
      ifwasweapon RPG { sound SQUISHED state liz_body_jibs
                        state standard_jibs state delete_enemy
                      }
      else ifwasweapon RADIUSEXPLOSION { sound SQUISHED state liz_body_jibs
                                         state standard_jibs state delete_enemy
                                       }
      else {          
               state gerdethsound state rf
               state blood state random_wall_jibs
           }
 }
 else
 {
      ifrnd 128 state blood
      ifrnd 64 state gerdethsound
      ifrnd 128 state random_wall_jibs        
 }
}
ends


state german_dyingstate
{
     ifactioncount 6 { spawn RPGSPRITE
                       else ifrnd 50 spawn HEATSENSOR
                       spawn DEADGERMAN killit
                     }
}
ends

// states for ducking Wehrmacht troop
// **********************************
state duckgm_popstate
{
 ifactioncount 2 { ifcansee { ifpdistl 4096 ai AIDUCKGM_POPSHOOT
                              else ifrnd 20 ai AIDUCKGM_POPSHOOT
                            }
                   else ifactioncount 30 { resetactioncount ai AIDUCKGM_DUCK }
                  }

 ifactioncount 30 { ifrnd 20 { resetactioncount ai AIDUCKGM_DUCK } }
}
ends

state duckgm_popshoot
{
ifactioncount 2 { ifrnd 32 state plrshot_state                  
                  sound CAPT_ATTACK shoot SHOTGUN spawn SHOTGUNSHELL                   
                  resetactioncount
                  ifcanshoottarget { ifrnd 200 {
                                                 ai AIDUCKGM_POPSHOOT break
                                               }
                                     else ai AIDUCKGM_DUCK
                                   }
                  else ai AIDUCKGM_DUCK
                }
}
ends


state duckgm_duckstate
{
ifactioncount 20 { ifrnd 10 { resetactioncount ai AIDUCKGM_POP } }
}
ends

state duckgm_duckshootstate
{
ifactioncount 2 { ifrnd 32 state plrshot_state
                  resetactioncount
                  sound CAPT_ATTACK shoot SHOTGUN spawn SHOTGUNSHELL                  
                  ifcansee { ifrnd 200 ai AIDUCKGM_DUCKSHOOT 
                             else ai AIDUCKGM_DUCK
                           }
                  else ai AIDUCKGM_DUCK
                }
}
ends


useractor enemy BELT_FEEDER LIZSTRENGTH MINIDUCK 0 geth getv
sizeat 18 18 // size_define
ai AIDUCKGM_BELT cactor DUCKING_WERTROOP
enda


useractor enemy DUCKING_WERTROOP LIZSTRENGTH MINIDUCK
{
    // Wermarcht infantry size_define, sprite number #2118
    fall cstat 257
    ifaction MINIDUCK { sizeat 18 18 ai AIDUCKGM_DUCK }   
    else
    {   
        ifai AIDUCKGM_DUCK state duckgm_duckstate
        else ifai AIDUCKGM_DYING state german_dyingstate
        else ifai AIDUCKGM_DUCKSHOOT state duckgm_duckshootstate
        else ifai AIDUCKGM_POP state duckgm_popstate
        else ifai AIDUCKGM_POPSHOOT state duckgm_popshoot
        else ifai AIDUCKGM_BELT { } 
        ifhitweapon { state german_checkhit
                      ifdead ai AIDUCKGM_DYING
                    }

    }
}
enda



// wermacht infantry armed with Mp40 SUB machinegun
action MINIMAN2          0    0    0    0    1
action GM_WALKING       2     4    5    1    15
action GM_RUNNING       2     4    5    1    11
action GM_SHOOTING      70    2    5    1    7
action GM_DYING         60    6    1    1    15
action GM_LYINGDEAD     65    1
action GM_STAND         70    1    5    1    15
action GM_CHANGECLIP    30    1    8    1    15
action GM_DUCK          30    1    8    1    7   
action GM_DUCKSHOOT     38    1    8    1    7   

ai AIGM_SEEKENEMY GM_WALKING GMWALKVEL seekplayer
ai AIGM_SHOOT GM_SHOOTING GMSTOP faceplayer
ai AIGM_PATROL GM_WALKING GMWALKVEL furthestdir
ai AIGM_DYING GM_DYING GMSTOP faceplayer
ai AIGM_TAKECOVER GM_RUNNING GMRUNVEL dodgebullet
ai AIGM_JAMMED GM_DUCK GMSTOP faceplayer
ai AIGM_AIM GM_STAND GMSTOP faceplayer
ai AIGM_CHANGECLIP GM_CHANGECLIP GMSTOP faceplayer
ai AIGM_CHANGEPOS GM_RUNNING GMRUNVEL randomangle
ai AIGM_RUNFORIT GM_RUNNING GMRUNVEL geth getv

ai AIGM_CHARGE GM_RUNNING GMRUNVEL faceplayer
ai AIGM_DUCK GM_DUCK GMSTOP faceplayer
ai AIGM_POP GM_STAND GMSTOP faceplayer
ai AIGM_DUCKSHOOT GM_DUCKSHOOT GMSTOP faceplayer

gamevar GM_CLIP 30 2 // peractor, value 30

state gm_seekstate
{                                       
ifcansee { ifp palive { ifpdistl 12000 ai AIGM_AIM } }
ifbulletnear { ifrnd 40 ai AIGM_TAKECOVER }
}
ends


state gm_aimstate
{
ifactioncount 2 { ifrnd 18
                     {
                     ifcansee {
                         ifvarl GM_CLIP 1 { sound EJECT_CLIP ai AIGM_CHANGECLIP } // out of bullets
                         else ifrnd 20 ai AIGM_CHANGEPOS
                         else ifrnd 7 { sound PRED_ROAM2 ai AIGM_JAMMED } // jammed                         
                         else ai AIGM_SHOOT
                              }
                      
                      else ai AIGM_SEEKENEMY
                      }
                }
}
ends



state gm_shootstate
{
ifactioncount 2 { ifrnd 32 state plrshot_state
                  resetactioncount addvar GM_CLIP -1
                  sound CAPT_ATTACK shoot SHOTGUN spawn SHELL                  
                  ifcansee { ifpdistl 4096 { ifrnd 200 ai AIGM_SHOOT else ai AIGM_AIM }
                             else ifrnd 130 ai AIGM_SHOOT 
                             else ai AIGM_AIM
                           }
                  else ai AIGM_AIM
                }
}
ends


state gm_jamstate
{
ifactioncount 60 ai AIGM_SEEKENEMY
}
ends


state gm_takecoverstate
{
ifactioncount 30 ai AIGM_SEEKENEMY
}
ends

state gm_patrolstate
{
ifcansee { ifp palive { ifpdistl 12000 ai AIGM_AIM } }
}
ends


state gm_clipstate
{         
ifactioncount 39 soundonce INSERT_CLIP
ifactioncount 40 { setvar GM_CLIP 30 ai AIGM_SEEKENEMY }
}
ends

state gm_posstate
{
ifactioncount 8 ai AIGM_SEEKENEMY
}
ends


state gm_chargestate 
{
ifactioncount 30 ai AIGM_DUCK
}
ends



state gm_duckstate
{
ifrnd 10 { resetactioncount ai AIGM_POP } 
}
ends

state gm_popstate
{
 ifactioncount 2 { ifcansee ai AIGM_SHOOT
                   else ifrnd 20 ai AIGM_DUCK
                 }
 ifactioncount 30 { ifrnd 30 { resetactioncount ai AIGM_DUCK } }
}
ends


state gm_duckshootstate
{
ifactioncount 2 { ifrnd 32 state plrshot_state
                  resetactioncount addvar GM_CLIP -1
                  sound CAPT_ATTACK shoot SHOTGUN spawn SHELL                  
                  ifcansee { ifpdistl 4096 { ifrnd 200 ai AIGM_DUCKSHOOT
                                             else ai AIGM_DUCK }
                             else ifrnd 130 ai AIGM_DUCKSHOOT 
                             else ai AIGM_DUCK
                           }
                  else ai AIGM_DUCK
                }
}
ends


state gm_runforitstate
ifspritepal 10 { ifactioncount 60 ai AIGM_SEEKENEMY }
else ifactioncount 30 ai AIGM_SEEKENEMY
ends



useractor enemy RUNNING_WERTROOP LIZSTRENGTH MINIMAN2
sizeat 18 18 cactor LIZMAN ai AIGM_RUNFORIT
enda

actor LIZMANSTAYPUT LIZSTRENGTH MINIMAN2
sizeat 18 18 // size_define
ai AIGM_PATROL cactor LIZMAN
enda

actor LIZMAN LIZSTRENGTH MINIMAN2 
{
    // Wermarcht infantry size_define, sprite number #2120 & 2121
    fall cstat 257
    ifaction MINIMAN2 { sizeat 18 18 ai AIGM_SEEKENEMY }    
    else
    {   
        /*
        ifrnd 2
        {             
                ifvare ATTACK_MODE 1 { ifrnd 82 ai AIGM_DUCKSHOOT
                                       else ai AIGM_CHARGE
                                       
                                     }
                else ifvare ATTACK_MODE 2 ai AIGM_DUCKSHOOT
        }
        */

        ifai AIGM_SEEKENEMY state gm_seekstate
        else ifai AIGM_SHOOT state gm_shootstate        
        else ifai AIGM_PATROL state gm_patrolstate
        else ifai AIGM_DYING state german_dyingstate
        else ifai AIGM_TAKECOVER state gm_takecoverstate
        else ifai AIGM_JAMMED state gm_jamstate
        else ifai AIGM_AIM state gm_aimstate
        else ifai AIGM_CHANGECLIP state gm_clipstate
        else ifai AIGM_CHANGEPOS state gm_posstate
        else ifai AIGM_RUNFORIT state gm_runforitstate
        else ifai AIGM_CHARGE state gm_chargestate 
        else ifai AIGM_DUCK state gm_duckstate
        else ifai AIGM_DUCKSHOOT state gm_duckshootstate
        else ifai AIGM_POP state gm_popstate

        ifhitweapon { state german_checkhit
                      ifdead ai AIGM_DYING
                    }
    }
                                       
}                                      
enda


// ALLIED SOLDIER # 2149
// **********************************
//      spritepal 9  = armed with machinegun 
//      spritepal 10 = stayput
//      spritepal 11 = pinned down, on knee
//      spritepal 12 = move without firing weapon

// actions
action MINI_ALLY     0       1   1   1   1
action ALLY_RUN     -588    4   8   1   17
action ALLY_WALK    -588    4   8   1   27
action ALLY_STAND   -556    1   8   1   2
action ALLY_SHOOT   -556    2   8   1   7  // -548    1   8   1   7 
action ALLY_DIE     1359    5   5   1   19
action ALLY_PAIN    -540    1   1   1   10
action ALLY_DED     -530    1   1   

action ALLY_ONKNEE  -293    1   8   1   1



// movement
move ally_speed 90
move ally_walk 20
move ally_stop 0 
move ally_jumpspeed 120 -95


// ai funtions
ai AI_ALLYWALK ALLY_WALK ally_walk geth getv
ai AI_ALLYRUN ALLY_RUN ally_speed geth getv // run forwards
ai AI_ALLYRUNSHOOT ALLY_RUN ally_speed geth getv // run forwards & shoot
ai AI_ALLYCRAZY ALLY_RUN ally_speed randomangle
ai AI_ALLYONKNEE ALLY_ONKNEE ally_stop geth getv // stay on knee
ai AI_ALLYSHOOTONKNEE ALLY_SHOOT ally_stop geth getv // shoot from knee

ai AI_ALLYDYING ALLY_DIE ally_stop geth getv
ai AI_ALLYPAIN ALLY_PAIN ally_stop faceplayer 

// ai's for stayput version
ai AI_ALLYSTAYONKNEE ALLY_ONKNEE ally_stop geth getv
ai AI_ALLYSTAYONKNEESHOOT ALLY_SHOOT ally_stop geth getv


// states
state ally_firegun 
{
ifcount 17 { shoot SHOTGUN spawn SHOTGUNSHELL sound SNIPER } 
}
ends


state ally_death
{
state ally_hitsfx
strength 0 ai AI_ALLYDYING
}
ends

state ally_walkstate // e1l4
ifcount 600 { spritepal 0 ai AI_ALLYRUN }
ends


state ally_run 
{
ifactioncount 5 { ifrnd 4 ai AI_ALLYONKNEE }

ifcount 17 { ifrnd 160 { resetcount ai AI_ALLYRUNSHOOT } }
ifcount 20 { ifrnd 128 state ally_hitsfx }

ifnotmoving ai AI_ALLYSTAYONKNEE
}
ends

state ally_runshoot
{
ifcount 17 state ally_firegun resetcount
ifactioncount 8 ai AI_ALLYRUN 
else ifnotmoving ai AI_ALLYSTAYONKNEE 
}
ends


state ally_onknee 
{
ifspritepal 11 { }
else
   {
      ifcount 17 ai AI_ALLYRUN 
      else ifcount 17 { resetactioncount ai AI_ALLYSHOOTONKNEE }
   }
}
ends

state ally_shootonknee
{
ifcount 17 { state ally_firegun
                 { ifcount 17 ai AI_ALLYSTAYONKNEESHOOT break } 
                  else ai AI_ALLYRUN 
                }
}
ends

state ally_stayonknee
{
ifcount 17 { ifcount 17 ai AI_ALLYSTAYONKNEESHOOT }  
}
ends

state ally_stayonkneeshoot
{
ifcount 17  { state ally_firegun
                  ifrnd 180 { ifcount 17 ai AI_ALLYSTAYONKNEESHOOT break } 
                  else ai AI_ALLYSTAYONKNEE 
                }

}
ends

state ally_crazy 
{
ifactioncount 50 ai AI_ALLYRUN 
}
ends


state ally_dying 
{ 
ifactioncount 5 {
        ifrnd 64 spawn AMMO // spawn stuff when dies
        else ifrnd 10 spawn SIXPAK 
        spawn DEADALLY killit
                }
}
ends


state ally_pain 
{
        ifdead {
                state plrshot_state
                ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_pjibs killit break }
                else ifwasweapon RPG { sound SQUISHED state standard_pjibs killit break }
                else ai AI_ALLYDYING
                }  
         else { ifrnd 10 state ally_hitsfx
                ifrnd 10 { ai AI_ALLYCRAZY resetactioncount }
                ifspritepal 10 ai AI_ALLYSTAYONKNEE
                else ifspritepal 11 ai AI_ALLYRUN
                else ai AI_ALLYRUN  
              }
}
ends



useractor notenemy ALLY_SOLDIER 85 MINI_ALLY 
{                     // size_define
ifaction MINI_ALLY { sizeat 17 17 cstat 257 action ALLY_STAND }
fall
ifaction ALLY_STAND {  ifspritepal 10 ai AI_ALLYSTAYONKNEE 
                       else ifspritepal 11 ai AI_ALLYONKNEE
                       else ifspritepal 12 { ifcount 300 ai AI_ALLYWALK }
                       else ifspawnedby CO1 { sound PIG_ROAM ai AI_ALLYWALK }
                       else ifspawnedby ENSPA ai AI_ALLYRUNSHOOT
                       else ai AI_ALLYRUN
                     }

else
        {
          ifai AI_ALLYRUN state ally_run
          else ifai AI_ALLYWALK state ally_walkstate
          else ifai AI_ALLYONKNEE state ally_onknee
          else ifai AI_ALLYSHOOTONKNEE state ally_shootonknee
          else ifai AI_ALLYRUNSHOOT state ally_runshoot
          else ifai AI_ALLYDYING state ally_dying
          else ifai AI_ALLYCRAZY state ally_crazy

          // stayput ally's ai functions
          else ifai AI_ALLYSTAYONKNEE state ally_stayonknee
          else ifai AI_ALLYSTAYONKNEESHOOT state ally_stayonkneeshoot
                   
          ifhitweapon state ally_pain
                      
          // in combat situation the chance of ally dying
          ifspritepal 11 { } // don't kill the pinned down allies
          else ifspritepal 10 { } // or the stayput ones
          else ifspritepal 12 { } // or the patrols
          else ifspawnedby CO1 { } // e1l4
          else { ifrnd 1 { ifrnd 64 { ifaction ALLY_DIE { } else state ally_death } } }
                                

        }
}
enda






// TANK TURRET # 2166

action MINITURRET 0 1 1 1 1
action VCTANK 1 1 8 1 1
action VCTANKSHOOT 564 3 8 1 8
action VCODOTUS  1 1 8 1 1

ai AITANKSEEK VCTANK 0 seekplayer
ai AITANKAIM VCTANK 0 faceplayer
ai AITANKSHOOT VCTANKSHOOT 0 faceplayer
ai AITANKHURT VCTANK 0 faceplayer



state taseek
{
 ifp palive {
       ifcansee ai AITANKAIM
       else ifcount 50 ai AITANKAIM
            }
}
ends

state taaim
{    
      ifcansee { 
                   ifactioncount 150 { ifrnd 40 { ai AITANKSHOOT resetactioncount } }
               } 
     else ifcount 200 { ai AITANKSEEK resetcount }
}
ends

state tashoot
ifactioncount 1 { soundonce RECOILLESS }
ifactioncount 3 { shoot SHOTSPARK1 ai AITANKAIM }
ends

state tahurt
{  
  // 100% chance of destroying tank with a bazooka 
  ifwasweapon RPG { addstrength -900 }
  ifdead state tdead
     else {
            ifcansee { ifcount 150 ai AITANKSHOOT else ai AITANKAIM }
            else ai AITANKSEEK
           }
                       
}
ends


useractor notenemy LIZMANJUMP 900 VCODOTUS fall

sizeat 55 45 // Tank size_define, sprite number #2166

ifaction VCODOTUS ai AITANKSEEK
else {    ifai AITANKSEEK state taseek
          else ifai AITANKAIM state taaim
          else ifai AITANKSHOOT state tashoot  
          else ifai AITANKHURT state tahurt     
          ifhitweapon { state vehiclehit state tahurt  }
          ifspritepal 12 { } else soundonce DUKE_HARTBEAT
      }
enda

state check_body
{
 ifhitweapon ifwasweapon RADIUSEXPLOSION
 {
   state standard_jibs
   killit
 }
}
ends



action DEAD_GERCAP 2 1 1 1 10
action DEAD_GERMANS 1 1 1 1 10
useractor notenemy DEADGERMAN 10 0
{             // size_define
ifaction 0 { sizeat 20 20 cstat 256
             ifspawnedby GER_CAP action DEAD_GERCAP
             else action DEAD_GERMANS
           }

ifaction DEAD_GERMANS state check_body
else ifaction DEAD_GERCAP state check_body

}
enda



action DEAD_ALLIED 1487 1 5 1 10
useractor notenemy DEADALLY 10 0
{             // size_define
ifaction 0 { sizeat 20 20 cstat 256 action DEAD_ALLIED }
ifaction DEAD_ALLIED
{
     ifpdistl 1024 { ifrnd 8 state plrshot_state } 
     ifhitweapon ifwasweapon RADIUSEXPLOSION
     {
       state standard_jibs
       killit
     }
}


}
enda



action APIGWALK         2  4 5 1 20
action APIGRUN          2  4 5 1 11
action APIGSHOOT        32 2 5 1 35
action APIGSTAND        32 1 5 1 1
action APIGDYING        55 5 1 1 15
action APIGHIT          55 1 1 1 10
action APIGDEAD         60 1 1 1 1
action MINIMAN1         0 0 0 0 1

move PIGWALKVELS 72
move PIGRUNVELS 108
move PIGSTOPPED


ai AIPIGSEEKENEMY APIGWALK PIGWALKVELS seekplayer
ai AIPIGSHOOTENEMY APIGSHOOT PIGSTOPPED faceplayer
ai AIPIGFLEEENEMY APIGWALK PIGWALKVELS fleeenemy
ai AIPIGDODGE APIGRUN PIGRUNVELS dodgebullet
ai AIPIGDYING APIGDYING PIGSTOPPED faceplayer
ai AIPIGHIT APIGHIT PIGSTOPPED faceplayer
ai AIPIGWAIT APIGSTAND PIGSTOPPED faceplayer

gamevar LUGER_CLIP 7 2

state pigseekenemystate
{
  ifcansee { ifpdistl 5000 ai AIPIGSHOOTENEMY
             else ifrnd 10 { resetactioncount ai AIPIGWAIT }
           }
  else ifnotmoving { resetactioncount ai AIPIGWAIT }
  else ifrnd 10 { resetactioncount ai AIPIGWAIT }
}
ends

state pigshootenemystate
{
ifactioncount 2 { ifrnd 32 state plrshot_state
                  resetactioncount // addvar LUGER_CLIP -1
                  sound LUGER shoot SHOTGUN spawn SHELL                  
                  ifcansee { ifpdistl 4096 { ifrnd 200 ai AIPIGSHOOTENEMY
                                             else ai AIPIGSEEKENEMY }
                             else ifrnd 130 ai AIPIGSHOOTENEMY 
                             else ai AIPIGSEEKENEMY
                           }
                  else ai AIPIGSEEKENEMY
                }
}
ends

state pigwaitstate
{
ifcansee { ifpdistl 5000 ai AIPIGSHOOTENEMY }
else ifactioncount 30 { ifrnd 10 { ai AIPIGSEEKENEMY } }


}
ends


state checkpighitstate    
    ifdead
    {
        state raisemorale_state
        ifspritepal 10 { endofgame 52 state standard_jibs killit break }
        state random_wall_jibs spawn FIRSTGUNSPRITE    
        addkills 1
        ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy }
        else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy }
        state gerdethsound ai AIPIGDYING 
    }
    else
    {
        sound PRED_PAIN
        state random_wall_jibs
    }
ends


state pigdyingstate
    ifactioncount 5 { spawn DEADGERMAN killit }
ends


actor PIGCOPSTAYPUT PIGCOPSTRENGTH MINIMAN1 cactor PIGCOP enda
actor PIGCOP PIGCOPSTRENGTH MINIMAN1 
    fall cstat 257 // Wermacht officer size_define, sprite number #2000 & 2001
    ifaction MINIMAN1 { sizeat 18 18 ai AIPIGSEEKENEMY }
    else
    {
        ifai AIPIGSEEKENEMY state pigseekenemystate
        else ifai AIPIGWAIT state pigwaitstate
        else ifai AIPIGDYING state pigdyingstate
        else ifai AIPIGDODGE state pigseekenemystate
        else ifai AIPIGSHOOTENEMY state pigshootenemystate      
        ifhitweapon { ifrnd 70 addstrength -56
                      state checkpighitstate
                    }       
        ifrnd 1 { ifrnd 150 state ger_sfx }                                               
    }
enda




// enemy spawner
useractor notenemy ENSPA   
{         
        cstat 32768
                                               
        ifspritepal 1 { ifcount 300 { ifrnd 4 { spawn ALLY_SOLDIER resetcount } } }


        else ifspritepal 2
                {
                ifpdistl 5000 { ifrnd 2 spawn LIZMAN }
                else ifrnd 1 { ifrnd 15 spawn LIZMAN
                               else ifrnd 15 spawn GER_CAP }

                // about 5 minutes
                ifcount 9000 killit 

                }


        else ifspritepal 3 { ifrnd 10 { ifvare MIS_OBJECTIVE 3 { spawn ALLY_SOLDIER killit } } }

        else ifcount 650
        { 
          ifrnd 17 { ifrnd 80 spawn PIGCOP }
          else ifrnd 17 { ifrnd 80 spawn LIZMAN }
          else ifrnd 17 { ifrnd 80 spawn LIZTROOP }
          else ifrnd 17 { ifrnd 80 spawn PIGCOP spawn PIGCOP } 
          else ifrnd 17 { ifrnd 80 spawn PIGCOP spawn LIZMAN }
          resetcount        
        }
}
enda



// ai spawner
useractor notenemy FEM9    
        cstat 32768 
        ifcount 750
        { 
          ifrnd 45 { ifrnd 128 spawn ALLY_SOLDIER }
          else ifrnd 45 { ifrnd 128 spawn MEDIC }
          else ifrnd 45 { ifrnd 128 spawn DEMOMAN }
          else ifrnd 45 { ifrnd 128 spawn RADIOMAN }
          ifcount 750 resetcount
          
        }
enda


// key
actor ACCESSCARD
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp pshrunk { } else ifp palive ifpdistl RETRIEVEDISTANCE ifcount 6 ifcanseetarget
    {
        ifpinventory GET_ACCESS 0 break
        addinventory GET_ACCESS 1
        quote 194
        state getcode
    }
enda

// PANZERSHRECK ROCKETS
actor FREEZEAMMO
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp pshrunk { } else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifcanseetarget
    {
        addammo FREEZE_WEAPON FREEZEAMMOAMOUNT quote 132
        ifspawnedby FREEZEAMMO state getcode
        else state quikget
    }
enda

// tiger 1
action ATIGERTANKSPIN   0 1 7 1 4
action ATIGERTANKSHOOTING 7 1 7 1 10
action ATIGERTANKWAIT 0 1 7 1 1
action ATIGERTANKDESTRUCT 0 1 7 1 1
action ATIGERTANKDEAD 0 1 7 1 1
// move TIGERTANKVEL horiz vert
move TIGERTANKFORWARD 80
move TIGERTANKSTOP

useractor enemy TIGERTANK TIGERTANKSTRENGTH fall

  ifaction 0
  {
    // sizeat 120 120
    action ATIGERTANKWAIT
    cstator 257
    clipdist 100
  }
  else
    ifaction ATIGERTANKSPIN
  {
    soundonce ELEVATOR_ON

    ifactioncount 20
    {
      ifrnd 16
        ifcansee
          ifcanshoottarget
      {
        move TIGERTANKSTOP geth
        action ATIGERTANKSHOOTING
        stopsound ELEVATOR_ON
      }
    }

    ifrnd 16
      move TIGERTANKFORWARD seekplayer
  }
  else
    ifaction ATIGERTANKSHOOTING
  {
    ifactioncount 22
    {
      ifpdistg 8192
      {
      shoot SHOTGUN spawn SHOTGUNSHELL 
      sound HMG
      }
      resetcount
      move 0 action ATIGERTANKWAIT
    }
    else
      ifactioncount 2
    {
      ifcansee
      {
        ifpdistl 16384
        {
          ifrnd 128
          {
           shoot SHOTGUN spawn SHOTGUNSHELL 
           sound HMG
          }
        }
        else
          ifrnd 8   // firespeed RPG
        {
        shoot SHOTSPARK1
        sound RECOILLESS
        }
      }
      else
      {
        move TIGERTANKFORWARD seekplayer
        action ATIGERTANKSPIN
      }
    }

    ifrnd 16
    {
      stopsound ELEVATOR_ON
      move TIGERTANKSTOP faceplayerslow
    }
  }
  else
    ifaction ATIGERTANKWAIT
  {
    ifactioncount 32
    {
      move TIGERTANKFORWARD seekplayer
      action ATIGERTANKSPIN
    }
  }
  else
    ifaction ATIGERTANKDESTRUCT
  {
    ifactioncount 64
      action ATIGERTANKDEAD
    else
      ifactioncount 56
       sound LASERTRIP_ARMING
     else
       ifactioncount 48
         sound LASERTRIP_ARMING
     else
       ifactioncount 32
         sound LASERTRIP_ARMING
     else
       ifactioncount 16
         sound LASERTRIP_ARMING
     break
  }
  else
    ifaction ATIGERTANKDEAD
  {
    addkills 1
    hitradius 6144 TOUGH TOUGH TOUGH TOUGH
    sound RPG_EXPLODE
    debris SCRAP1 15
    spawn EXPLOSION2
    ifrnd 128 spawn DEADTANK
    ifrnd 25 spawn DEADTANK 
    killit
  }

  ifhitweapon
  {
    ifdead
      action ATIGERTANKDEAD
    else
    {
      debris SCRAP1 1
      ifaction ATIGERTANKSHOOTING break

      ifrnd 192
      {
        move TIGERTANKSTOP geth
        action ATIGERTANKSHOOTING
        stopsound ELEVATOR_ON
      }
    }
  }

  ifpdistl 1280
    ifhitspace
      ifp pfacing
        ifangdiffl 512
          action ATIGERTANKDESTRUCT
enda

actor FUELPOD 1 0 500 randomangle
        ifaction 0
        { sound OHJUSLENTO action 5INCH }

        ifaction 5INCH
        {
        ifcount 1 { spawn SMALLSMOKE resetcount }
        ifnotmoving { state ohjus2 killit }
        iffloordistl 8 
                {
                    {
                    ifonwater { spawn WATERSPLASH2 killit break }
                    else { state ohjus2 ifrnd 2 spawn BURNING2 spawn EXPLOSION2 killit } 
                    }
                }
        }
enda

// FINNISH STUKA
action RUBCAN5 1 2 1 1 3
move LENTO5 350
actor HORSEONSIDE 100 0 LENTO5 randomangle 
        ifaction 0 { cstat 32 sound INVADER quote 135 action RUBCAN5 }
        ifaction RUBCAN5 quote 136 state bomber_state 
 
enda

// jagtiger

define TANKSTRENGTH       500      // 2 3 4 5 7 8
//           off-set, numofframes, numofrot, skipframes, delay
action ATANKSPIN   0 1 7 1 4
action ATANKSHOOTING 7 2 7 1 10
action ATANKWAIT 0 1 7 1 1
action ATANKDESTRUCT 0 1 7 1 1
action ATANKDEAD 0 1 7 1 1
// move TANKVEL horiz vert
move TANKFORWARD 100
move TANKSTOP

useractor enemy SDFK21 1000 fall

  ifaction 0
  {
    sizeat 60 60
    action ATANKWAIT
    cstat 257
    clipdist 100
  }
  else
    ifaction ATANKSPIN
  {
    soundonce ELEVATOR_ON

    ifactioncount 20
    {
      ifrnd 16
        ifcansee
          ifcanshoottarget
      {
        move TANKSTOP geth
        action ATANKSHOOTING
        stopsound ELEVATOR_ON
      }
    }

    ifrnd 16
      move TANKFORWARD seekplayer
  }
  else
    ifaction ATANKSHOOTING
  {
    ifactioncount 22
    {
      ifpdistg 8192  // firespeed 1
      {
      shoot SHOTSPARK1 
      sound RECOILLESS
      }
      resetcount
      move 0 action ATANKWAIT
    }
    else
      ifactioncount 2
    {
      ifcansee
      {
        ifpdistl 16384
        {
          ifrnd 2  // firespeed 1
          {
          shoot SHOTSPARK1  
          sound RECOILLESS
          }
        }
        else
          ifrnd 2  // firespeed 1
        {
         shoot SHOTSPARK1 
         sound RECOILLESS
        }
      }
      else
      {
        move TANKFORWARD seekplayer
        action ATANKSPIN
      }
    }

    ifrnd 16
    {
      stopsound ELEVATOR_ON
      move TANKSTOP faceplayerslow
    }
  }
  else
    ifaction ATANKWAIT
  {
    ifactioncount 32
    {
      move TANKFORWARD seekplayer
      action ATANKSPIN
    }
  }
  else
    ifaction ATANKDESTRUCT
  {
    ifactioncount 64
      action ATANKDEAD
    else
      ifactioncount 56
       sound LASERTRIP_ARMING
     else
       ifactioncount 48
         sound LASERTRIP_ARMING
     else
       ifactioncount 32
         sound LASERTRIP_ARMING
     else
       ifactioncount 16
         sound LASERTRIP_ARMING
     break
  }
  else
    ifaction ATANKDEAD
  {
    addkills 1
    hitradius 6144 TOUGH TOUGH TOUGH TOUGH
    sound LASERTRIP_EXPLODE
    debris SCRAP1 15
    spawn EXPLOSION2
    ifrnd 128 spawn GER_CAP
    killit
  }

  ifhitweapon
  {
    ifdead
      action ATANKDEAD
    else
    {
      debris SCRAP1 1
      ifaction ATANKSHOOTING break

      ifrnd 192
      {
        move TANKSTOP geth
        action ATANKSHOOTING
        stopsound ELEVATOR_ON
      }
    }
  }

  ifpdistl 1280
    ifhitspace
      ifp pfacing
        ifangdiffl 512
          action ATANKDESTRUCT
enda

// remote mg42 
action  WACOSHOOTER  0 1 1 1 1
action  WACOSHOOTERA 1 1 1 1 15
action  WACOSHOOTERB 2 1 1 1 15
action  WACOSHOOTERC 3 1 1 1 15
action  WACOSHOOTERD 4 1 1 1 15

ai AIWACOSHOOTER  WACOSHOOTER  0
ai AIWACOSHOOTERA WACOSHOOTERA 0
ai AIWACOSHOOTERB WACOSHOOTERB 0
ai AIWACOSHOOTERC WACOSHOOTERC 0
ai AIWACOSHOOTERD WACOSHOOTERD 0

useractor enemy WACOWINDER WEAK

  ifai 0
  {
    ai AIWACOSHOOTER
  }
  
  ifai AIWACOSHOOTER
  {
    ifrnd 8
    {
      ifp palive
        ifcansee
          ifcanshoottarget
          {
            ifpdistl 18000 
            {
              ifrnd 64
                sound HMG
              sound HMG
            }
            shoot SHOTGUN spawn SHOTGUNSHELL
            shoot SHOTGUN spawn SHOTGUNSHELL
            resetcount
            lotsofglass 4
            ifrnd 64
              ai AIWACOSHOOTERA 
            else ifrnd 128
              ai AIWACOSHOOTERB 
            else ifrnd 128
              ai AIWACOSHOOTERC 
            else
              ai AIWACOSHOOTERD 
          }
    }
  }
  else ifai AIWACOSHOOTERA  
  {
    ifactioncount 1
    {
      ai AIWACOSHOOTER
    }
  }
  else ifai AIWACOSHOOTERB  
  {
    ifactioncount 1
    {
      ai AIWACOSHOOTER
    }
  }
  else ifai AIWACOSHOOTERC  
  {
    ifactioncount 1
    {
      ai AIWACOSHOOTER
    }
  }
  else ifai AIWACOSHOOTERD  
  {
    ifactioncount 1
    {
      ai AIWACOSHOOTER
    }
  }
enda

// m34 hmg
action HMG2_AIM 1 1 5 1 1
action HMG2_WAIT 1 1 5 1 1
action HMG2_SHOOT 1 2 5 1 10
action HMG2_MOVE 1 1 5 1 1
action HMG2_DYING 11 5 1 1 15
action HMG2_DEAD 16 1 1 1 1
action TRACERS2 1 2 5 1 5
action MINIMAN11 0 1 1 1 1

move 0

actor ROTATEGUN TROOPSTRENGTH MINIMAN11 faceplayersmart
{
ifaction MINIMAN11 {
                   // in E1L3
                   ifspritepal 10 { sizeat 5 5 spritepal 9 }
                   else sizeat 17 17 // HMG2, sprite number #4240
                   fall 
                   ifcount 2 action HMG2_AIM
                  }

ifhitweapon 
    {
    ifrnd 50 { addstrength -56 }
    ifdead
         { 
            addkills 1
            ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }            
            else { state gerdethsound action HMG2_DYING }
         }    
           else { sound PRED_PAIN state blood action HMG2_AIM move 0 }
     }

ifaction HMG2_MOVE
    {    
      action HMG2_SHOOT
      move 0 faceplayersmart
    }

ifaction HMG2_SHOOT
    {
    ifactioncount 4 { ifrnd 64 state plrshot_state resetcount
                  sound SPACE_DOOR5 shoot SHOTGUN spawn SHOTGUNSHELL shoot SHOTGUN spawn SHOTGUNSHELL
                  ifrnd 5 { stopsound SPACE_DOOR5 action HMG2_WAIT }
                  ifspritepal 12 { ifrnd 50 action TRACERS2 }
                  else ifspritepal 9 {  ifpdistl 3000 { stopsound SPACE_DOOR5 action HMG2_MOVE }
                                        else { ifrnd 150 action HMG2_SHOOT else { stopsound SPACE_DOOR5 action HMG2_AIM } }

                                     }
                  else ifcansee { ifp palive { ifrnd 245 action HMG2_SHOOT } }
                  else { stopsound SPACE_DOOR5 action HMG2_AIM }
                }
      
    }

ifaction HMG2_WAIT
    {
    ifcount 30 { resetcount action HMG2_AIM }

    }

ifaction TRACERS2
    {
    ifcount 4 { sound SPACE_DOOR5 spawn SHARK
                shoot SHOTGUN spawn SHOTGUNSHELL shoot SHOTGUN spawn SHOTGUNSHELL
                ifrnd 30 action HMG2_SHOOT
                resetcount
              }

     else ifcansee { } else { action HMG2_AIM }
      else action TRACERS2
    }

ifaction HMG2_AIM
    { 
    ifspritepal 9 { ifrnd 5 action HMG2_SHOOT  
                    else ifcount 50 action HMG2_SHOOT
                  }
    else {  ifcansee { ifp palive { ifpdistl 5000 action HMG2_MOVE
                                    else ifrnd 15 action HMG2_MOVE
                                   }
                      } 
         }
    else action HMG2_AIM
    }
    
ifaction HMG2_DYING
    { ifactioncount 5 { sizeat 20 20 state blood state random_wall_jibs state rf action HMG2_DEAD } }

ifaction HMG2_DEAD
    { strength 0 
      ifhitweapon { ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break } }
      break 
    }
}
enda

// ba 349 natter interceptor
action RUBCAN6 264
move LENTO6 600
useractor notenemy RKONE1 100 0 LENTO6 randomangle 
        ifaction 0 { cstat 32 sound SPACE_AMBIENCE2 quote 121 action RUBCAN6 }
        ifaction RUBCAN6 quote 122 state rkone_state  
enda


// bomber spawner
useractor notenemy PKSPAWNER
        cstat 32768
        
        
        ifcount 600
        { 
          resetcount
          ifrnd 80 { ifrnd 128 spawn RKONE1 }
          ifrnd 40 { ifrnd 128 spawn HORSEONSIDE }
          ifrnd 50 { ifrnd 128 spawn JUNKERS }
          ifrnd 70 { ifrnd 128 spawn PARAPLANE }
       }
enda

// JUNKERS JU 208
action POMMITUS 1
move SUIHKUM 350
useractor notenemy JUNKERS 100 0 SUIHKUM randomangle 
        ifaction 0 { cstat 32 quote 125 action POMMITUS }
        ifaction POMMITUS state rkone_state quote 126  
 
enda

// SKULL
actor SKULL
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE
enda

// ROCKET
action RPG_A 0 1 5 1 1
move RPGVEL 500
move RPGVELSTOP 0

ai AIBK1 RPG_A RPGVEL geth getv
ai AIBK2 RPG_A RPGVELSTOP geth getv


useractor notenemy ROCKET 0 0 
ifaction 0 { cstat 32768 ifcansee { ifrnd 1 { ai AIBK2 resetcount } } }

ifai AIBK2 { ifcount 710 ai AIBK1 }

ifai AIBK1
{
    sizeat 30 30
    cstat 0
    move RPGVEL geth getv
    spawn SMALLSMOKE
    ifnotmoving { spawn EXPLOSION2 sound RPG_EXPLODE killit }
}
enda

// bombard
action XP2
useractor notenemy RANDOMEXPLOSION 0 0
ifaction 0 { cstat 32768 ifcansee { ifrnd 2 { ifrnd 10 action XP2 } } }
ifaction XP2 { ifrnd 128 sound BOMB2 else sound PIPEBOMB_EXPLODE spawn EXPLOSION2 spawn SIRPALE state sharkspawner hitradius 2500 20 40 80 100 ifrnd 32 spawn BURNING2 killit break }
enda


// PANZERSHRECK
action HMG3_AIM 1 1 5 1 1
action HMG3_WAIT 1 1 5 1 1
action HMG3_SHOOT 1 2 5 1 10
action HMG3_MOVE 1 1 5 1 1
action HMG3_DYING 11 5 1 1 15
action HMG3_DEAD 16 1 1 1 1
action TRACERS3 1 2 5 1 5
action MINIMAN50 0 1 1 1 1

move 1

actor ATLAUNCHER TROOPSTRENGTH MINIMAN50 faceplayersmart
{
ifaction MINIMAN50 {
                   // in E1L3
                   ifspritepal 10 { sizeat 5 5 spritepal 9 }
                   else sizeat 17 17 // HMG3, sprite number #4240
                   fall 
                   ifcount 2 action HMG3_AIM
                  }

ifhitweapon 
    {
    ifrnd 50 { addstrength -56 }
    ifdead
         { 
            addkills 1
            ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon RPG { sound SQUISHED state standard_jibs state delete_enemy break }
            else ifwasweapon SHRINKEREXPLOSION { state gerdethsound spawn KARVENNIN spawn SKELETON state standard_jibs state delete_enemy break }            
            else { state gerdethsound action HMG3_DYING }
         }    
           else { sound PRED_PAIN state blood action HMG3_AIM move 1 }
     }

ifaction HMG3_MOVE
    {    
      action HMG3_SHOOT
      move 1 faceplayersmart
    }

ifaction HMG3_SHOOT
    {
    ifactioncount 4 { ifrnd 64 state plrshot_state resetcount
                  action TRACERS3
                  ifrnd 5 { stopsound RPG_SHOOT action HMG3_WAIT }
                  ifspritepal 12 { ifrnd 50 action TRACERS3 }
                  else ifspritepal 9 {  ifpdistl 3000 { stopsound RPG_SHOOT action HMG3_MOVE }
                                        else { ifrnd 150 action HMG3_SHOOT else { stopsound RPG_SHOOT action HMG3_AIM } }

                                     }
                  else ifcansee { ifp palive { ifrnd 245 action HMG3_SHOOT } }
                  else { stopsound RPG_SHOOT action HMG3_AIM }
                }
      
    }

ifaction HMG3_WAIT
    {
    ifcount 50 { resetcount action HMG3_AIM }

    }

ifaction TRACERS3
    {
    ifcount 50 { sound RPG_SHOOT spawn EXPLOSION2
                shoot RPG action HMG3_WAIT  
                ifrnd 30 action HMG3_SHOOT
                resetcount
              }

     else ifcansee { } else { action HMG3_AIM }
      else action TRACERS3
    }

ifaction HMG3_AIM
    { 
    ifspritepal 9 { ifrnd 5 action HMG3_SHOOT  
                    else ifcount 50 action HMG3_SHOOT
                  }
    else {  ifcansee { ifp palive { ifpdistl 5000 action HMG3_MOVE
                                    else ifrnd 15 action HMG3_MOVE
                                   }
                      } 
         }
    else action HMG3_AIM
    }
    
ifaction HMG3_DYING
    { ifactioncount 5 { sizeat 20 20 state blood state random_wall_jibs spawn FREEZESPRITE state rf action HMG3_DEAD } }

ifaction HMG3_DEAD
    { strength 0 
      ifhitweapon { ifwasweapon RADIUSEXPLOSION { sound SQUISHED state standard_jibs state delete_enemy break } }
      break 
    }
}
enda


// SHAPNEL

action FS0
move FM1 40 -50
move FM2 20 -40
ai AIFS1 FS0 FM1 randomangle
ai AIFS2 FS0 FM2 randomangle


useractor notenemy FLARESMOKE 0 0 
ifaction 0 { ifrnd 128 ai AIFS1 else ai AIFS2 }

ifai AIFS1
{
ifcount 20 killit
}
ifai AIFS2
{
ifcount 20 killit
}
enda

useractor notenemy GLOW 0 0 
spawn EXPLOSION2 palfrom 6 6 killit
enda

action POMMINPUDOTUS2 0 1 1 1 1
// bomb 
actor COLAX 100 0 POMMINPUDOTUS2 randomangle
        fall
        iffloordistl 2 
        {
        ifonwater { spawn WATERSPLASH2 killit break }
        else
                {
                spawn LIEKITYS sound BURN1 spawn SIRPALE spawn SIRPALE spawn KARVENNIN
                debris SCRAP6 15 debris SCRAP2 15
                sound BURN1
                hitradius 3750 25 50 90 170
                ifrnd 32 spawn BURNING spawn BURNING spawn LIEKITYS spawn LIEKITYS 
                killit break
                }
        }
enda

actor KARVENNIN
    cstat 512
    fall
    iffloordistl 2
    { 
    ifonwater killit
    else
    {
        sound JIBBED_ACTOR7
        spawn EXPLOSION2
        hitradius 3000 25 50 100 200
        spawn BURNING
        killit
    }
    }
enda

actor INFRARED
    fall
    ifmove RESPAWN_ACTOR_FLAG state respawnit
    else ifp pshrunk { } else ifp palive ifcount 6 ifpdistl RETRIEVEDISTANCE ifpinventory GET_HEATS HEAT_AMOUNT
        ifcanseetarget
    {
        addinventory GET_HEATS HEAT_AMOUNT quote 156 state getcode
        ifspawnedby INFRARED state getcode
        else state quikget
    }
enda


// ME 262
action POMMITUS2 466
move SUIHKUM2 350
useractor notenemy ME262 100 0 SUIHKUM2 randomangle 
        ifaction 0 { cstat 32 quote 53 action POMMITUS2 }
        ifaction POMMITUS2 state rkone_state quote 47  
 
enda

action FB3

move GEN1 100 -400
move GEN2 200 -300
move GEN3 300 -200
move GEN4 400 -100

ai AIKRANU1 FB3 GEN1 randomangle
ai AIKRANU2 FB3 GEN2 randomangle
ai AIKRANU3 FB3 GEN3 randomangle
ai AIKRANU4 FB3 GEN4 randomangle

state kranu1
{
        move GEN1 geth getv
        ifactioncount 20 killit 
}
ends

state kranu2
{
        move GEN2 geth getv
        ifactioncount 20 killit 
}
ends

state kranu3
{
        move GEN3 geth getv
        ifactioncount 20 killit 
}
ends

state kranu4
{
        move GEN4 geth getv
        ifactioncount 20 killit 
}
ends

state granu1
{
        move GEN1 geth getv
        ifactioncount 15 killit 
}
ends

state granu2
{
        move GEN2 geth getv
        ifactioncount 10 killit 
}
ends

state granu3
{
        move GEN3 geth getv
        ifactioncount 10 killit 
}
ends

state granu4
{
        move GEN4 geth getv
        ifactioncount 10 killit 
}
ends


useractor notenemy FLASH 0 0
{ ifaction 0 { spawn EXPLOSION2 killit } }
enda

useractor notenemy EXPLOSIONSMOKE 0 0
{
ifaction 0
        {
        cstat 1 
        ifrnd 64 ai AIKRANU1
        else ifrnd 64 ai AIKRANU2
        else ifrnd 64 ai AIKRANU3
        else ai AIKRANU4
        }
else { 
          cstat 1
          spawn SMALLSMOKE
          ifai AIKRANU1 state granu1
          else ifai AIKRANU2 state granu2
          else ifai AIKRANU3 state granu3
          else ifai AIKRANU4 state granu4
     }
}
enda



useractor notenemy PISTE 0 0
{
ifaction 0
        {
        ifspawnedby VALOJUOVA sizeat 20 20 else sizeat 48 48 
        ifrnd 64 ai AIKRANU1
        else ifrnd 64 ai AIKRANU2
        else ifrnd 64 ai AIKRANU3
        else ai AIKRANU4
        }
else { 
          spawn EXPLOSIONSMOKE 
          ifai AIKRANU1 state kranu1
          else ifai AIKRANU2 state kranu2
          else ifai AIKRANU3 state kranu3
          else ifai AIKRANU4 state kranu4
     }
}
enda

move XPLO3MOVE 400 0
action XPLO3
ai AIMOVE XPLO3 XPLO3MOVE randomangle
useractor notenemy XPLOSION 0 0
{
 ifaction 0 ai AIMOVE
 else ifai AIMOVE
 { ifcount 1 { spawn EXPLOSION2 killit } }
}
enda


useractor notenemy SIRPALE2 0 0 
{
ifaction 0 { sizeat 48 48 ai AICRANU1 }
else { 
          spawn FLARESMOKE 
          ifrnd 50 spawn FLARESMOKE
          ifai AICRANU1 state cranu1
          else ifai AICRANU2 state cranu2
          else ifai AICRANU3 state cranu3
          else ifai AICRANU4 state cranu4
          else ifai AICRANU5 state cranu5
          else ifai AICRANU6 state cranu6
          else ifai AICRANU7 state cranu7
          else ifai AICRANU8 state cranu8
          else ifai AICRANU9 state cranu9
          else ifai AICRANU10 state cranu10
          else ifai AICRANU11 state cranu12
     }
}

enda

// ================================
// HERE is the Code for the LADDER!

action RUBCANDENT 1 1 1 1 1
action RUBCAN2 -14

useractor notenemy LADDER
ifpdistl 512
{
        ifhitspace ifp pfacing
           cstat 33
}
else cstat 32


enda


// EVENTS
// ******************


onevent EVENT_ENTERLEVEL
{
// set default CTF & Fireteam & global variables
setvar PLR_STATUS 1
setvar PLR_MODE   13 // resets action
setvar CTF_STATUS 0
setvar RESTART    0
setvar MIS_OBJECTIVE 0
setvar ATTACK_MODE 0

ifvare VOLUME 2 setvar COOP 0 // Ep3, Gimatch maps
else ifvare VOLUME 3 {  ifvarg LEVEL 3 setvar COOP 0 // CTF maps
                        else setvar COOP 1 // FTmaps
                     }


}
endevent



// loading screen
onevent EVENT_GETLOADTILE 
{
sound WIND_REPEAT
// default tile 3281
ifvare VOLUME 0 { ifvare LEVEL 0 setvar RETURN 3220
                  else ifvare LEVEL 1 setvar RETURN 3221
                  else ifvare LEVEL 2 setvar RETURN 3222
                  else ifvare LEVEL 3 setvar RETURN 3223
                  else ifvare LEVEL 4 setvar RETURN 3224
                  else ifvare LEVEL 5 setvar RETURN 3225
                  else ifvare LEVEL 6 setvar RETURN 3226                  
                }
else ifvare VOLUME 1
                { ifvare LEVEL 0 setvar RETURN 3227
                  else ifvare LEVEL 1 setvar RETURN 3228
                  else ifvare LEVEL 2 setvar RETURN 3229
                  else ifvare LEVEL 3 setvar RETURN 3230
                  else ifvare LEVEL 4 setvar RETURN 3231
                  else ifvare LEVEL 5 setvar RETURN 3232
                  else ifvare LEVEL 6 setvar RETURN 3233                  
                }
}
endevent
 

// reset variables 
onevent EVENT_RESETINVENTORY
{
setvar PLR_MORALE      100
setvar PLR_FTSPECITEM  1  
setvar PLR_MODE        13 // resets action      
setvar PLR_ITEM        1 
setvar PLR_DETECTMINES 1 
setvar PLR_SHELLCOUNT  1
setvar PLR_PANIC       1 
setvar MCURKEE         1  
}
endevent

// medikit used by 'm' or 'enter'
onevent EVENT_USEMEDKIT
{
ifphealthl 100 {
ifvare PLR_MODE 3 { setvar RETURN 1 break }
ifpinventory GET_FIRSTAID 0 { } else { setvar RETURN 1 break }
ifpinventory GET_FIRSTAID 1 { } else addinventory GET_FIRSTAID 0
ifpinventory GET_FIRSTAID 2 { } else addinventory GET_FIRSTAID 1


ifvare PLR_MODE 3 setvar RETURN 1 
else
  {
    ifvare PLR_MODE 2 setvar PLR_MODE 3  // fast
    else { setvar PLR_HEALCOUNT 0 setvar PLR_MODE 2 }
  }
               }
setvar RETURN 1
}
endevent

// mine detector
onevent EVENT_HOLODUKEON
{
ifpinventory GET_HOLODUKE 0 { } else { setvar RETURN 1 break }
ifpinventory GET_HOLODUKE 10 { } else {
                ifvare PLR_DETECTMINES 2 { quote 201 setvar PLR_DETECTMINES 1 }
                else { quote 199 setvar PLR_DETECTMINES 2 }
                                      }
setvar RETURN 1
}
endevent

// mortar ammo
onevent EVENT_USEJETPACK
{
setvar RETURN 1
}
endevent



// use inv item
onevent EVENT_INVENTORY
{
ifvare PLR_ITEM 3 { 
     ifpinventory GET_BOOTS 0 { } else { setvar RETURN 1 break }
     ifpinventory GET_BOOTS 2 { } else addinventory GET_BOOTS 0
     ifpinventory GET_BOOTS 4 { } else addinventory GET_BOOTS 2
     ifpinventory GET_BOOTS 6 { } else addinventory GET_BOOTS 4
     setvar PLR_MODE 4 setvar RETURN 1
                  }

else ifvare PLR_ITEM 4
                  {
     ifpinventory GET_SCUBA 0 { } else { setvar RETURN 1 break }
     ifpinventory GET_SCUBA 60 { } else addinventory GET_SCUBA 0
     ifpinventory GET_SCUBA 120 { } else addinventory GET_SCUBA 60
     ifpinventory GET_SCUBA 180 { } else addinventory GET_SCUBA 120
     ifpinventory GET_SCUBA 240 { } else addinventory GET_SCUBA 180
     ifpinventory GET_SCUBA 300 { } else addinventory GET_SCUBA 240
     setvar PLR_MODE 5 setvar RETURN 1
                  }

else ifvare PLR_ITEM 6
                  {
     ifvare PLR_SHELLCOUNT 10 { addinventory GET_JETPACK 0
                                setvar PLR_MODE 6
                              }
     setvar RETURN 1
                  }

}
endevent



// update the selected inv item
onevent EVENT_INVENTORYLEFT

ifvare RETURN 3 { } else { setvar PLR_DETECTMINES 1 } // mine det off

ifvare RETURN 1 setvar PLR_ITEM 2  // med
else ifvare RETURN 3 setvar PLR_ITEM 5 // minedetector
else ifvare RETURN 4 setvar PLR_ITEM 6 // 60mm ammo
else ifvare RETURN 5 setvar PLR_ITEM 7 // cigarettes
else ifvare RETURN 6 setvar PLR_ITEM 4 // mine
else ifvare RETURN 7 setvar PLR_ITEM 3 // explos
endevent

onevent EVENT_INVENTORYRIGHT
ifvare RETURN 3 { } else { setvar PLR_DETECTMINES 1 }

ifvare RETURN 1 setvar PLR_ITEM 2
else ifvare RETURN 3 setvar PLR_ITEM 5
else ifvare RETURN 4 setvar PLR_ITEM 6
else ifvare RETURN 5 setvar PLR_ITEM 7
else ifvare RETURN 6 setvar PLR_ITEM 4
else ifvare RETURN 7 setvar PLR_ITEM 3
endevent


// shot distribution for different weapons
onevent EVENT_GETSHOTRANGE
{
ifvarl PLR_MORALE 25
{ setvar ANGRANGE 64 setvar ZRANGE 256 }

else ifvarg PLR_MORALE 70
{  ifvare WORKSLIKE PISTOL_WEAPON { setvar ANGRANGE 32 setvar ZRANGE 256 }
   else ifvare WORKSLIKE CHAINGUN_WEAPON { setvar ANGRANGE 16 setvar ZRANGE 128 }
   else { setvar ANGRANGE 16 setvar ZRANGE 256 }
}

}
endevent



onevent EVENT_GETAUTOAIMANGLE
{
ifvarl PLR_MORALE 40 setvar AUTOAIMANGLE 45
}
endevent

// RIGHT AMOUNTS
onevent EVENT_CHEATGETJETPACK
{
setvar RETURN 4
}
endevent

onevent EVENT_CHEATGETSTEROIDS
{
setvar RETURN 0 
}
endevent

onevent EVENT_CHEATGETHOLODUKE
{
setvar RETURN 10 
}
endevent

onevent EVENT_CHEATGETBOOT
{
setvar RETURN 6 
}
endevent

onevent EVENT_CHEATGETSCUBA
{
setvar RETURN 300
}
endevent

onevent EVENT_CHEATGETHEAT
{
setvar RETURN -1 
}
endevent

onevent EVENT_CHEATGETFIRSTAID
{
setvar RETURN 2 
}
endevent
/*

onevent EVENT_QUICKKICK
{
ifvare WORKSLIKE DEVISTATOR_WEAPON setvar RETURN -1
else ifvare WORKSLIKE HANDBOMB_WEAPON setvar RETURN -1 
else ifvare WORKSLIKE TRIPBOMB_WEAPON setvar RETURN -1
else setvar RETURN 0
}
endevent
*/

action SPLASHACT 0 4 1 1 7
action SPLASHACT2 -5 5 1 1 5
useractor notenemy WSPLASH 1
ifaction 0 { cstat 32 sizeat 64 64 ifonwater { sizeat 64 64 cstat 32 action SPLASHACT2 } else action SPLASHACT }
ifaction SPLASHACT { ifactioncount 4 killit }
ifaction SPLASHACT2 { ifactioncount 4 killit }
enda

// skeleton actions
action ASKELETON1 0 1 1 1 10

// skeleton actorcode
useractor notenemy SKELETON WEAK
  cstat 257
  fall
  sizeat 64 64
  action ASKELETON1
enda








