Catacomb Armageddon open source release. master
authorRichard Mandel <richard@tech-transfer.com>
Mon, 9 Jun 2014 08:09:32 +0000 (04:09 -0400)
committerRichard Mandel <richard@tech-transfer.com>
Mon, 9 Jun 2014 08:17:22 +0000 (04:17 -0400)
65 files changed:
ARMADICT.OBJ
ARMAHEAD.OBJ
ARMEDICT.OBJ
ARMEHEAD.OBJ
ARMGAME.PRJ
ARMMHEAD.OBJ
AUDIOARM.H
C5_ACT1.C
C5_ACT2.C [new file with mode: 0644]
C5_ACT3.C [new file with mode: 0644]
C5_ACT4.C [new file with mode: 0644]
C5_ASM.ASM
C5_DEBUG.C
C5_DRAW.C
C5_GAME.C
C5_MAIN.C
C5_PLAY.C
C5_SCALE.C
C5_SCA_A.ASM
C5_STATE.C
C5_TRACE.C
C5_WIZ.C
DEF.H
GELIB.C
GELIB.H
GFXE_ARM.EQU
GFXE_ARM.H
ID_ASM.EQU
ID_CA.C
ID_CA.H
ID_HEADS.H
ID_IN.C
ID_IN.H
ID_MM.C
ID_MM.H
ID_RF.C
ID_RF.H
ID_RF_A.ASM
ID_SD.C
ID_SD.H
ID_STRS.H
ID_US.C
ID_US.H
ID_US_1.C
ID_US_2.C
ID_US_A.ASM
ID_VW.C
ID_VW.H
ID_VW_A.ASM
ID_VW_AC.ASM
ID_VW_AE.ASM
JABHACK.ASM
JAMPAK.C [new file with mode: 0644]
JAMPAK.H [new file with mode: 0644]
JAM_IO.C [new file with mode: 0644]
JAM_IO.H [new file with mode: 0644]
LZHUF.C [new file with mode: 0644]
LZHUFF.H [new file with mode: 0644]
LZW.C [new file with mode: 0644]
LZW.H [new file with mode: 0644]
MAPSARM.H
README.md
SL_FILE.H [new file with mode: 0644]
SOFT.C [new file with mode: 0644]
SOFT.H [new file with mode: 0644]

index b0e8792347769d2702986979e80716691b9a9867..3dff98842bbf2e0ba015f946d79b064318e1b419 100644 (file)
Binary files a/ARMADICT.OBJ and b/ARMADICT.OBJ differ
index 9feed1a25dc7f5933965819e8a2bbf18b22fa24f..2fcd49d7f68308c85f4fb40d700c8773a907992c 100644 (file)
Binary files a/ARMAHEAD.OBJ and b/ARMAHEAD.OBJ differ
index 2b16875ac24a6074a8f121758ef5ea03c4a7e389..33ee37863dd97036eb04abc5f22e4c54e440bc12 100644 (file)
Binary files a/ARMEDICT.OBJ and b/ARMEDICT.OBJ differ
index be2b224398df6b4d36a9504c83e14369d150dbb2..b818f4bdfd67123f4e846062616294933aff300c 100644 (file)
Binary files a/ARMEHEAD.OBJ and b/ARMEHEAD.OBJ differ
index d5e9a9546569cc56ceabcb69e06935c249fa7348..bea242cfed9409f3a8ea8a05991ca1d35ca6fe16 100644 (file)
Binary files a/ARMGAME.PRJ and b/ARMGAME.PRJ differ
index e227b29ee1c6c03bdd842d623438024cbbb62dfa..e8dbe9f36206ab4494795bd1e44ad85cf77801f9 100644 (file)
Binary files a/ARMMHEAD.OBJ and b/ARMMHEAD.OBJ differ
index 2187679cec30ebca691cde4afd745b43fb02cd90..46b813ca4a9da2eb7e13b603f96718b5c7752c24 100644 (file)
@@ -1,4 +1,4 @@
-/* Catacomb Abyss Source Code\r
+/* Catacomb Armageddon Source Code\r
  * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
 \r
 /////////////////////////////////////////////////\r
 //\r
-// MUSE Header for .ABS\r
-// Created Thu Apr 16 14:56:19 1992\r
+// MUSE Header for .ARM\r
+// Created Mon Jun 08 16:14:17 1992\r
 //\r
 /////////////////////////////////////////////////\r
 \r
-#define NUMSOUNDS              34\r
-#define NUMSNDCHUNKS           103\r
+#define NUMSOUNDS              35\r
+#define NUMSNDCHUNKS           106\r
 \r
 //\r
 // Sound names & indexes\r
@@ -64,6 +64,7 @@ typedef enum {
                FREEZETIMESND,           // 31\r
                TIMERETURNSND,           // 32\r
                TICKSND,                 // 33\r
+               BODY_EXPLODESND,         // 34\r
                LASTSOUND\r
             } soundnames;\r
 \r
@@ -71,9 +72,9 @@ typedef enum {
 // Base offsets\r
 //\r
 #define STARTPCSOUNDS          0\r
-#define STARTADLIBSOUNDS       34\r
-#define STARTDIGISOUNDS                68\r
-#define STARTMUSIC             102\r
+#define STARTADLIBSOUNDS       35\r
+#define STARTDIGISOUNDS                70\r
+#define STARTMUSIC             105\r
 \r
 //\r
 // Music names & indexes\r
index 4749b1ba15fe5e9675496b1cb040ec2cb48aef70..dcd65e3503f1dd9ac3236248156a4d7e47a4f6cc 100644 (file)
--- a/C5_ACT1.C
+++ b/C5_ACT1.C
@@ -1,4 +1,4 @@
-/* Catacomb Abyss Source Code\r
+/* Catacomb Armageddon Source Code\r
  * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
 \r
 =============================================================================\r
 */\r
-void SpawnSkeleton(int tilex, int tiley);\r
-\r
 \r
+#if 0\r
 #define MSHOTDAMAGE    2\r
 #define MSHOTSPEED     10000\r
 \r
 #define ESHOTDAMAGE    1\r
 #define ESHOTSPEED     5000\r
 \r
+#define SSHOTDAMAGE    3\r
+#define SSHOTSPEED     6500\r
+\r
 #define RANDOM_ATTACK 20\r
+#endif\r
 \r
 /*\r
 =============================================================================\r
@@ -55,7 +58,6 @@ short zombie_base_delay;
 short other_x[] = {0,39,39,0},\r
                other_y[] = {0,0,27,27};\r
 \r
-\r
 /*\r
 =============================================================================\r
 \r
@@ -69,7 +71,6 @@ dirtype dirtable[9] = {northwest,north,northeast,west,nodir,east,
        southwest,south,southeast};\r
 \r
 \r
-\r
 /*\r
 =============================================================================\r
 \r
@@ -92,12 +93,12 @@ statetype s_nukebonus2 = {NUKE2OBJPIC,8,NULL,&s_nukebonus3};
 statetype s_nukebonus3 = {NUKE3OBJPIC,8,NULL,&s_nukebonus};\r
 \r
 statetype s_potionbonus = {POTIONOBJPIC,0,NULL,&s_potionbonus};\r
-statetype s_rkey2bonus = {RKEY2PIC,0,NULL,&s_rkey2bonus};\r
+//statetype s_rkey2bonus = {RKEY2PIC,0,NULL,&s_rkey2bonus};\r
 statetype s_rkeybonus = {RKEYOBJPIC,0,NULL,&s_rkeybonus};\r
 statetype s_ykeybonus = {YKEYOBJPIC,0,NULL,&s_ykeybonus};\r
 statetype s_gkeybonus = {GKEYOBJPIC,0,NULL,&s_gkeybonus};\r
 statetype s_bkeybonus = {BKEYOBJPIC,0,NULL,&s_bkeybonus};\r
-statetype s_scrollbonus = {SCROLLOBJPIC,0,NULL,&s_scrollbonus};\r
+//////////////////////////statetype s_scrollbonus = {SCROLLOBJPIC,0,NULL,&s_scrollbonus};\r
 statetype s_chestbonus = {CHESTOBJPIC,0,NULL,&s_chestbonus};\r
 //statetype s_goalbonus = {NEMESISPIC,0,NULL,&s_goalbonus};\r
 \r
@@ -135,7 +136,7 @@ statetype s_bonus_die = {0,8,NULL,NULL};
 \r
 void SpawnBonus (int tilex, int tiley, int number)\r
 {\r
-       extern unsigned gnd_colors[];\r
+       extern unsigned gcolor;\r
 \r
        statetype *state;\r
 \r
@@ -157,12 +158,13 @@ void SpawnBonus (int tilex, int tiley, int number)
                case B_PGEM:                    state = &s_pgem1bonus;          break;\r
 \r
                case B_CHEST:\r
-                       if (gnd_colors[gamestate.mapon] == 0x0101)\r
+                       if (gcolor == 0x0101)\r
                                state = &s_waterchestbonus1;\r
                        else\r
                                state = &s_chestbonus;\r
                break;\r
 \r
+#if 0\r
                case B_SCROLL1:\r
                case B_SCROLL2:\r
                case B_SCROLL3:\r
@@ -171,8 +173,9 @@ void SpawnBonus (int tilex, int tiley, int number)
                case B_SCROLL6:\r
                case B_SCROLL7:\r
                case B_SCROLL8:                 state = &s_scrollbonus;         break;\r
+#endif\r
 \r
-               case B_RKEY2:                   state = &s_rkey2bonus;          break;\r
+//             case B_RKEY2:                   state = &s_rkey2bonus;          break;\r
 \r
                default:\r
                        Quit("SpawnBonus(): INVALID BONUS");\r
@@ -218,7 +221,7 @@ void SpawnTombstone (int tilex, int tiley, int shape)
 \r
        SpawnNewObj (tilex,tiley,state,TILEGLOBAL/2);\r
 //     new->tileobject = true;\r
-       new->obclass = solidobj;\r
+       new->obclass = realsolidobj;\r
        new->flags |= of_shootable;\r
 }\r
 \r
@@ -277,6 +280,7 @@ statetype s_walldie4 = {0,-1,T_WallDie,&s_walldie5};
 statetype s_walldie5 = {0,20,NULL,&s_walldie6};\r
 statetype s_walldie6 = {0,-1,T_WallDie,NULL};\r
 \r
+\r
 /*\r
 ================\r
 =\r
@@ -285,10 +289,9 @@ statetype s_walldie6 = {0,-1,T_WallDie,NULL};
 ================\r
 */\r
 \r
-       extern unsigned gnd_colors[];\r
-\r
 void ExplodeWall (int tilex, int tiley)\r
 {\r
+       extern unsigned gcolor;\r
        unsigned tilenum;\r
 \r
        DSpawnNewObj (tilex,tiley,&s_walldie1,0);\r
@@ -296,7 +299,7 @@ void ExplodeWall (int tilex, int tiley)
                return;\r
        new->obclass = inertobj;\r
        new->active = always;\r
-       if (gnd_colors[gamestate.mapon] == 0x0101)\r
+       if (gcolor == 0x0101)\r
                tilenum = WATEREXP;\r
        else\r
                tilenum = WALLEXP;\r
@@ -316,12 +319,13 @@ void ExplodeWall (int tilex, int tiley)
 \r
 void T_WallDie (objtype *ob)\r
 {\r
+       extern unsigned gcolor;\r
        unsigned tile,other,spot,x,y;\r
 \r
        if (++ob->temp1 == 3)\r
                tile = 0;\r
        else\r
-               if (gnd_colors[gamestate.mapon] == 0x0101)\r
+               if (gcolor == 0x0101)\r
                        tile = WATEREXP-1 + ob->temp1;\r
                else\r
                        tile = WALLEXP-1 + ob->temp1;\r
@@ -369,8 +373,8 @@ statetype s_obj_gate2 = {OBJ_WARP2PIC,10,T_Gate,&s_obj_gate3};
 statetype s_obj_gate3 = {OBJ_WARP3PIC,10,T_Gate,&s_obj_gate4};\r
 statetype s_obj_gate4 = {OBJ_WARP4PIC,10,T_Gate,&s_obj_gate1};\r
 \r
-statetype s_pit = {PITOBJPIC,6,T_Gate,&s_pit};\r
-\r
+extern statetype s_anthill;\r
+statetype s_anthill = {ANT_HILLPIC, 20, T_Gate, &s_anthill};\r
 \r
 //---------------------------------------------------------------------------\r
 //     SpawnWarp()\r
@@ -384,7 +388,7 @@ void SpawnWarp (int tilex, int tiley, int type)
        if (type)\r
                SpawnNewObj (tilex,tiley,&s_obj_gate1,TILEGLOBAL/3);\r
        else\r
-               SpawnNewObj (tilex,tiley,&s_pit,TILEGLOBAL/3);\r
+               SpawnNewObj (tilex,tiley,&s_anthill,TILEGLOBAL/3);\r
        new->obclass = gateobj;\r
        new->temp1 = type;\r
 }\r
@@ -465,167 +469,227 @@ void T_Gate (objtype *ob)
 /*\r
 =============================================================================\r
 \r
-                                                       TROLLS\r
+                                       FAT DEMON\r
 \r
 =============================================================================\r
 */\r
 \r
-void T_Troll (objtype *ob);\r
-\r
-extern statetype s_trollpause;\r
+#define FATCLOUDDAMAGE 2\r
 \r
-extern statetype s_troll1;\r
-extern statetype s_troll2;\r
-extern statetype s_troll3;\r
-extern statetype s_troll4;\r
+void T_FatDemon (objtype *ob);\r
+void T_CheckCnt(objtype *ob);\r
+void ExplodeSound(objtype *ob);\r
 \r
-extern statetype s_trollattack1;\r
-extern statetype s_trollattack2;\r
-extern statetype s_trollattack3;\r
+extern statetype s_fatdemon_pause;\r
+extern statetype s_fatdemon_walk1;\r
+extern statetype s_fatdemon_walk2;\r
+extern statetype s_fatdemon_walk3;\r
+extern statetype s_fatdemon_walk4;\r
+extern statetype s_fatdemon_attack1;\r
+extern statetype s_fatdemon_attack2;\r
+extern statetype s_fatdemon_blowup2;\r
+extern statetype s_fatdemon_blowup3;\r
+extern statetype s_fatdemon_blowup4;\r
+extern statetype s_fatdemon_blowup5;\r
+extern statetype s_fatdemon_blowup6;\r
+extern statetype s_fatdemon_blowup7;\r
+extern statetype s_fatdemon_explode;\r
+extern statetype s_fatdemon_feet;\r
 \r
-extern statetype s_trollouch;\r
+statetype s_fatdemon_pause = {FATDEMON_WALK1PIC,40,NULL,&s_fatdemon_walk2};\r
 \r
-extern statetype s_trolldie1;\r
-extern statetype s_trolldie2;\r
-extern statetype s_trolldie3;\r
+statetype s_fatdemon_walk1 = {FATDEMON_WALK1PIC,13,T_FatDemon,&s_fatdemon_walk2};\r
+statetype s_fatdemon_walk2 = {FATDEMON_WALK2PIC,13,T_FatDemon,&s_fatdemon_walk3};\r
+statetype s_fatdemon_walk3 = {FATDEMON_WALK3PIC,13,T_FatDemon,&s_fatdemon_walk4};\r
+statetype s_fatdemon_walk4 = {FATDEMON_WALK4PIC,13,T_FatDemon,&s_fatdemon_walk1};\r
 \r
+statetype s_fatdemon_attack1 = {FATDEMON_ATTACK1PIC,20,NULL,&s_fatdemon_attack2};\r
+statetype s_fatdemon_attack2 = {FATDEMON_ATTACK2PIC,20,T_DoDamage,&s_fatdemon_pause};\r
 \r
-statetype s_trollpause = {TROLL1PIC,40,NULL,&s_troll2};\r
+statetype s_fatdemon_ouch = {FATDEMON_OUCHPIC,14,NULL,&s_fatdemon_walk1};\r
 \r
-statetype s_troll1 = {TROLL1PIC,13,T_Troll,&s_troll2};\r
-statetype s_troll2 = {TROLL2PIC,13,T_Troll,&s_troll3};\r
-statetype s_troll3 = {TROLL3PIC,13,T_Troll,&s_troll4};\r
-statetype s_troll4 = {TROLL4PIC,13,T_Troll,&s_troll1};\r
+statetype s_fatdemon_blowup1 = {FATDEMON_BLOWUP1PIC,25,NULL,&s_fatdemon_blowup2};\r
+statetype s_fatdemon_blowup2 = {FATDEMON_BLOWUP2PIC,25,NULL,&s_fatdemon_blowup3};\r
+statetype s_fatdemon_blowup3 = {FATDEMON_BLOWUP1PIC,15,NULL,&s_fatdemon_blowup4};\r
+statetype s_fatdemon_blowup4 = {FATDEMON_BLOWUP2PIC,15,NULL,&s_fatdemon_blowup5};\r
+statetype s_fatdemon_blowup5 = {FATDEMON_BLOWUP1PIC,6,NULL,&s_fatdemon_blowup6};\r
+statetype s_fatdemon_blowup6 = {FATDEMON_BLOWUP2PIC,6,T_CheckCnt,&s_fatdemon_blowup5};\r
+statetype s_fatdemon_blowup7 = {FATDEMON_BLOWUP3PIC,30,NULL,&s_fatdemon_explode};\r
 \r
-statetype s_trollattack1 = {TROLLATTACK1PIC,15,NULL,&s_trollattack2};\r
-statetype s_trollattack2 = {TROLLATTACK2PIC,15,NULL,&s_trollattack3};\r
-statetype s_trollattack3 = {TROLLATTACK3PIC,30,T_DoDamage,&s_trollpause};\r
 \r
-statetype s_trollouch = {TROLLOUCHPIC,14,T_Troll,&s_troll1};\r
-\r
-statetype s_trolldie1 = {TROLLDIE1PIC,18,NULL,&s_trolldie2};\r
-statetype s_trolldie2 = {TROLLDIE2PIC,18,NULL,&s_trolldie3};\r
-statetype s_trolldie3 = {TROLLDIE3PIC,0,NULL,&s_trolldie3};\r
+statetype s_fatdemon_explode = {FATDEMON_EXPLODEPIC,40,ExplodeSound,&s_fatdemon_feet};\r
+statetype s_fatdemon_feet = {FATDEMON_FEETPIC,30,NULL,&s_fatdemon_feet};\r
 \r
+#define cnt            ob->temp1\r
+#define cloud_delay    ob->temp2\r
 \r
 /*\r
 ===============\r
 =\r
-= SpawnTroll\r
+= SpawnFatDemon\r
 =\r
 ===============\r
 */\r
 \r
-void SpawnTroll (int tilex, int tiley)\r
+void SpawnFatDemon (int tilex, int tiley)\r
 {\r
-       SpawnNewObj(tilex,tiley,&s_troll1,35*PIXRADIUS);\r
+       SpawnNewObj(tilex,tiley,&s_fatdemon_walk1,35*PIXRADIUS);\r
        new->speed = 2500;\r
-       new->obclass = trollobj;\r
+       new->obclass = fatdemonobj;\r
        new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(14);\r
+       new->hitpoints = EasyHitPoints(10);\r
+       new->temp1 = 25;        //used to "shake" the fat dude??????\r
 }\r
 \r
 \r
 /*\r
 ===============\r
 =\r
-= T_Troll\r
+= T_FatDemon\r
 =\r
 ===============\r
 */\r
 \r
-void T_Troll (objtype *ob)\r
+void T_FatDemon (objtype *ob)\r
 {\r
        if (Chase(ob,true) || (random(1000)<RANDOM_ATTACK))\r
        {\r
-               ob->state = &s_trollattack1;\r
+               ob->state = &s_fatdemon_attack1;\r
                ob->ticcount = ob->state->tictime;\r
                return;\r
        }\r
 }\r
 \r
 \r
-void T_WetMan(objtype *ob);\r
+/*\r
+===============\r
+=\r
+= T_DecCnt\r
+=\r
+===============\r
+*/\r
+\r
+void T_CheckCnt (objtype *ob)\r
+{\r
+       ob->temp1--;\r
+       if (!ob->temp1)\r
+       {\r
+               ob->state = &s_fatdemon_blowup7;\r
+               ob->ticcount = ob->state->tictime;\r
+       }\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= ExplodeSound\r
+=\r
+===============\r
+*/\r
+void ExplodeSound(objtype *ob)\r
+{\r
+       if (ob->temp1 != 666)                                           // Has this think been called already?\r
+       {\r
+               SD_PlaySound(BODY_EXPLODESND);\r
+               ob->temp1 = 666;                        // Has now!\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                               WATER DRAGON\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern statetype s_dragon_shot1;\r
+extern statetype s_dragon_shot2;\r
+\r
 \r
+void T_Dragon(objtype *ob);\r
+void T_DragonShoot(objtype *ob);\r
 \r
-//statetype s_wet_pause = {WET_WALK1PIC,25,NULL,&s_wet_walk1};\r
 \r
-statetype s_wet_bubbles1 = {WET_BUBBLE1PIC,13,T_WetMan,&s_wet_bubbles2};\r
-statetype s_wet_bubbles2 = {WET_BUBBLE2PIC,15,T_WetMan,&s_wet_bubbles1};\r
-statetype s_wet_bubbles3 = {0,18,T_WetMan,&s_wet_bubbles1};\r
+statetype s_wet_bubbles1 = {DRAGON_BUBBLES1PIC,13,T_Dragon,&s_wet_bubbles2};\r
+statetype s_wet_bubbles2 = {DRAGON_BUBBLES2PIC,15,T_Dragon,&s_wet_bubbles1};\r
+statetype s_wet_bubbles3 = {0,35,T_Dragon,&s_wet_bubbles1};\r
 \r
-statetype s_wet_peek = {WET_EYESPIC,45,NULL,&s_wet_bubbles1};\r
+statetype s_wet_peek = {DRAGON_EYESPIC,45,NULL,&s_wet_bubbles1};\r
 \r
-//statetype s_wet_rise1 = {WET_BUBBLE1PIC,14,NULL,&s_wet_rise2};\r
-statetype s_wet_rise1 = {WET_BUBBLE2PIC,15,NULL,&s_wet_rise3};\r
-statetype s_wet_rise3 = {WET_EYESPIC,20,NULL,&s_wet_rise4};\r
-statetype s_wet_rise4 = {WET_RISE1PIC,20,NULL,&s_wet_rise5};\r
-statetype s_wet_rise5 = {WET_RISE2PIC,20,NULL,&s_wet_walk1};\r
+statetype s_wet_rise1 = {DRAGON_BUBBLES2PIC,15,NULL,&s_wet_rise3};\r
+statetype s_wet_rise3 = {DRAGON_EYESPIC,20,NULL,&s_wet_rise4};\r
+statetype s_wet_rise4 = {DRAGON_RISE1PIC,20,NULL,&s_wet_rise5};\r
+statetype s_wet_rise5 = {DRAGON_RISE2PIC,20,NULL,&s_wet_walk1};\r
 \r
-statetype s_wet_sink1 = {WET_RISE2PIC,20,NULL,&s_wet_sink2};\r
-statetype s_wet_sink2 = {WET_RISE1PIC,20,NULL,&s_wet_sink3};\r
-statetype s_wet_sink3 = {WET_EYESPIC,20,NULL,&s_wet_bubbles1};\r
+statetype s_wet_sink1 = {DRAGON_RISE2PIC,20,NULL,&s_wet_sink2};\r
+statetype s_wet_sink2 = {DRAGON_RISE1PIC,20,NULL,&s_wet_sink3};\r
+statetype s_wet_sink3 = {DRAGON_EYESPIC,20,NULL,&s_wet_bubbles1};\r
 \r
-statetype s_wet_walk1 = {WET_WALK1PIC,12,T_WetMan,&s_wet_walk2};\r
-statetype s_wet_walk2 = {WET_WALK2PIC,12,T_WetMan,&s_wet_walk3};\r
-statetype s_wet_walk3 = {WET_WALK3PIC,12,T_WetMan,&s_wet_walk4};\r
-statetype s_wet_walk4 = {WET_WALK4PIC,12,T_WetMan,&s_wet_walk1};\r
+statetype s_wet_walk1 = {DRAGON_WALK1PIC,12,T_Dragon,&s_wet_walk2};\r
+statetype s_wet_walk2 = {DRAGON_WALK2PIC,12,T_Dragon,&s_wet_walk3};\r
+statetype s_wet_walk3 = {DRAGON_WALK3PIC,12,T_Dragon,&s_wet_walk4};\r
+statetype s_wet_walk4 = {DRAGON_WALK4PIC,12,T_Dragon,&s_wet_walk1};\r
 \r
+statetype s_wet_attack1 = {DRAGON_ATTACK1PIC,10,NULL,&s_wet_attack2};\r
+statetype s_wet_attack2 = {DRAGON_ATTACK2PIC,10,NULL,&s_wet_attack3};\r
+statetype s_wet_attack3 = {DRAGON_ATTACK2PIC,10,NULL,&s_wet_attack4};\r
+statetype s_wet_attack4 = {DRAGON_ATTACK3PIC,10,T_DragonShoot,&s_wet_walk1};\r
 \r
-statetype s_wet_attack1 = {WET_ATTACK1PIC,10,NULL,&s_wet_attack2};\r
-statetype s_wet_attack2 = {WET_ATTACK2PIC,10,NULL,&s_wet_attack3};\r
-statetype s_wet_attack3 = {WET_ATTACK2PIC,10,NULL,&s_wet_attack4};\r
-statetype s_wet_attack4 = {WET_ATTACK3PIC,10,T_DoDamage,&s_wet_walk1};\r
+statetype s_wet_ouch = {DRAGON_OUCHPIC,10,T_Dragon,&s_wet_walk1};\r
 \r
-statetype s_wet_ouch = {WET_OUCHPIC,10,NULL,&s_wet_walk1};\r
+statetype s_wet_die1 = {DRAGON_DEATH1PIC,27,NULL,&s_wet_die2};\r
+statetype s_wet_die2 = {DRAGON_DEATH2PIC,29,NULL,&s_wet_die3};\r
+statetype s_wet_die3 = {DRAGON_DEATH3PIC,44,NULL,&s_wet_die4};\r
+statetype s_wet_die4 = {DRAGON_BUBBLES2PIC,26,NULL,&s_wet_die5};\r
+statetype s_wet_die5 = {DRAGON_BUBBLES1PIC,23,NULL,NULL};\r
 \r
-statetype s_wet_die1 = {WET_DIE1PIC,27,NULL,&s_wet_die2};\r
-statetype s_wet_die2 = {WET_DIE2PIC,29,NULL,&s_wet_die3};\r
-statetype s_wet_die3 = {WET_DIE3PIC,44,NULL,&s_wet_die4};\r
-statetype s_wet_die4 = {WET_BUBBLE2PIC,26,NULL,&s_wet_die5};\r
-statetype s_wet_die5 = {WET_BUBBLE1PIC,23,NULL,NULL};\r
+statetype s_dragon_shot1 = {PSHOT1PIC,8,&T_ShootPlayer,&s_dragon_shot2};\r
+statetype s_dragon_shot2 = {PSHOT2PIC,8,&T_ShootPlayer,&s_dragon_shot1};\r
 \r
 \r
-typedef enum {wt_BUBBLES,wt_WALK} WetManTypes;\r
+typedef enum {wt_BUBBLES,wt_WALK,wt_CORNER1,wt_CORNER2,wt_CORNER3,wt_CORNER4} DragonTypes;\r
 \r
-#define WT_TIMEREMAIN  (ob->temp1)\r
-#define WT_STAGE                       (ob->temp2)\r
 \r
+#define WD_TIMEREMAIN  (ob->temp1)\r
+#define WD_STAGE       (ob->temp2)\r
+#define WATER_DRAGON_LEAVE     0x04\r
 \r
 /*\r
 ===============\r
 =\r
-= SpawnWetMan\r
+= SpawnDragon\r
 =\r
 ===============\r
 */\r
-void SpawnWetMan(int tilex, int tiley)\r
+void SpawnDragon(int tilex, int tiley)\r
 {\r
        objtype *ob;\r
        SpawnNewObj(tilex,tiley,&s_wet_bubbles1,PIXRADIUS*35);\r
        ob=new;\r
 \r
-       WT_STAGE = wt_BUBBLES;\r
-       WT_TIMEREMAIN = 60*4+random(60*3);\r
+       WD_STAGE = wt_BUBBLES;\r
+       WD_TIMEREMAIN = 80;\r
 \r
        new->obclass = wetobj;\r
        new->speed = 1000;\r
        new->flags &= ~of_shootable;\r
-       new->hitpoints = EasyHitPoints(18);\r
+       new->hitpoints = EasyHitPoints(20);\r
 }\r
 \r
 \r
 /*\r
 ===============\r
 =\r
-= T_WetMan\r
+= T_Dragon\r
 =\r
 ===============\r
 */\r
 \r
-void T_WetMan(objtype *ob)\r
+void T_Dragon(objtype *ob)\r
 {\r
-       switch (WT_STAGE)\r
+       switch (WD_STAGE)\r
        {\r
                case wt_BUBBLES:\r
                        ob->flags &= ~of_shootable;\r
@@ -634,8 +698,8 @@ void T_WetMan(objtype *ob)
                                // RISE & GOTO WALK STAGE\r
                                //\r
 \r
-                               WT_STAGE = wt_WALK;\r
-                               WT_TIMEREMAIN = 60*5+random(60*5);\r
+                               WD_STAGE = wt_WALK;\r
+                               WD_TIMEREMAIN = 60*8+random(60*5);\r
                                ob->state = &s_wet_rise1;\r
                                ob->speed = 2200;\r
                                ob->ticcount = ob->state->tictime;\r
@@ -644,13 +708,13 @@ void T_WetMan(objtype *ob)
                        {\r
                                // DEC COUNTER - And check for WALK\r
                                //\r
-                               if ((WT_TIMEREMAIN-=realtics) < 0)\r
+                               if ((WD_TIMEREMAIN-=realtics) < 0)\r
                                {\r
                                        // RISE & GOTO WALK STAGE\r
                                        //\r
 \r
-                                       WT_STAGE = wt_WALK;\r
-                                       WT_TIMEREMAIN = 60+random(60*2);\r
+                                       WD_STAGE = wt_WALK;\r
+                                       WD_TIMEREMAIN = 60*8+random(60*5);\r
                                        ob->state = &s_wet_rise1;\r
                                        ob->speed = 2200;\r
                                        ob->ticcount = ob->state->tictime;\r
@@ -670,22 +734,34 @@ void T_WetMan(objtype *ob)
 \r
                case wt_WALK:\r
                        ob->flags |= of_shootable;\r
-                       if (Chase(ob,true) || (random(1000)<RANDOM_ATTACK))\r
+\r
+                       if (Chase(ob,true) || (CheckHandAttack(ob)))\r
+\r
                        {\r
-                               ob->state = &s_wet_attack1;\r
-                               ob->ticcount = ob->state->tictime;\r
+                                       ob->flags |= WATER_DRAGON_LEAVE;\r
+                                       WD_STAGE = random(wt_CORNER3) + 2;\r
+                                       WD_TIMEREMAIN = 60*2+(random(6)*60);\r
+                                       ob->state = &s_wet_bubbles1;\r
+                                       ob->ticcount = ob->state->tictime;\r
                        }\r
+                       else\r
+                               if (AngleNearPlayer(ob) != -1)\r
+                               {\r
+                                       ob->state = &s_wet_attack1;\r
+                                       ob->ticcount = ob->state->tictime;\r
+                               }\r
+\r
                        else\r
                        {\r
                                // DEC COUNTER - And check for SINK\r
                                //\r
-                               if ((WT_TIMEREMAIN-=realtics) < 0)\r
+                               if ((WD_TIMEREMAIN-=realtics) < 0)\r
                                {\r
                                        // SINK & GOTO BUBBLE STAGE\r
                                        //\r
 \r
-                                       WT_STAGE = wt_BUBBLES;\r
-                                       WT_TIMEREMAIN = 60*4+random(60*3);\r
+                                       WD_STAGE = wt_BUBBLES;\r
+                                       WD_TIMEREMAIN = 60*2+random(60*2);\r
                                        ob->state = &s_wet_sink1;\r
                                        ob->speed = 1200;\r
                                        ob->ticcount = ob->state->tictime;\r
@@ -694,1504 +770,51 @@ void T_WetMan(objtype *ob)
 \r
                        }\r
                        break;\r
-       }\r
-}\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       ZOMBIE\r
-\r
-=============================================================================\r
-*/\r
-\r
-extern statetype s_zombie_rise1;\r
-extern statetype s_zombie_rise2;\r
-extern statetype s_zombie_rise3;\r
-extern statetype s_zombie_rise4;\r
-\r
-extern statetype s_zombie_alive1;\r
-extern statetype s_zombie_alive2;\r
-extern statetype s_zombie_alive3;\r
-\r
-//extern statetype s_zombie_attack1;\r
-\r
-extern statetype s_zombie_death1;\r
-extern statetype s_zombie_death2;\r
-extern statetype s_zombie_death3;\r
-\r
-void T_Zombie (objtype *ob);\r
-void T_ZombieRisen(objtype *obj);\r
-\r
-statetype s_zombie_risen = {ZOMB_WALK3PIC,1,T_ZombieRisen,&s_zombie_alive1};\r
-\r
-statetype s_zombie_pause = {ZOMB_WALK1PIC,20,NULL,&s_zombie_alive1};\r
-\r
-statetype s_zombie_inground = {0,13,T_Zombie,&s_zombie_inground};\r
-\r
-statetype s_zombie_rise1 = {ZOMB_APPEAR1PIC,24,NULL,&s_zombie_rise2};\r
-statetype s_zombie_rise2 = {ZOMB_APPEAR2PIC,24,NULL,&s_zombie_rise3};\r
-statetype s_zombie_rise3 = {ZOMB_APPEAR3PIC,24,NULL,&s_zombie_rise4};\r
-statetype s_zombie_rise4 = {ZOMB_APPEAR4PIC,24,NULL,&s_zombie_risen};\r
-\r
-statetype s_zombie_alive1 = {ZOMB_WALK1PIC,13,T_Zombie,&s_zombie_alive2};\r
-statetype s_zombie_alive2 = {ZOMB_WALK2PIC,13,T_Zombie,&s_zombie_alive3};\r
-statetype s_zombie_alive3 = {ZOMB_WALK3PIC,13,T_Zombie,&s_zombie_alive1};\r
-\r
-statetype s_zombie_death1 = {ZOMB_DIE1PIC,16,NULL,&s_zombie_death2};\r
-statetype s_zombie_death2 = {ZOMB_DIE2PIC,16,NULL,&s_zombie_death3};\r
-statetype s_zombie_death3 = {ZOMB_DIE3PIC,16,NULL,&s_zombie_death3};\r
-\r
-statetype s_zombie_attack  = {ZOMB_ATTACKPIC,15,T_DoDamage,&s_zombie_pause};\r
-//statetype s_zombie_attack1 = {ZOMB_ATTACKPIC,15,NULL,&s_zombie_pause};\r
-\r
-statetype s_zombie_ouch = {ZOMB_OUCHPIC,15,NULL,&s_zombie_alive1};\r
-\r
-\r
-\r
-\r
-enum zombie_modes {zm_wait_for_dark,zm_wait_to_rise,zm_active};\r
-\r
-#define zombie_mode    ob->temp1\r
-#define zombie_delay   ob->temp2\r
-\r
-\r
-//--------------------------------------------------------------------------\r
-// SpawnZombie()\r
-//--------------------------------------------------------------------------\r
-void SpawnZombie (int tilex, int tiley)\r
-{\r
-       objtype *ob;\r
-       short current_zombie_delay;\r
-       unsigned tile;\r
-\r
-       SpawnNewObj(tilex,tiley,&s_zombie_inground,35*PIXRADIUS);\r
-       ob = new;\r
-       zombie_mode = zm_wait_for_dark;\r
-\r
-       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
-       if (tile)\r
-               zombie_delay = (tile>>8)*30;\r
-       else\r
-       {\r
-               current_zombie_delay = (2*60)+random(4*60);\r
-               zombie_delay = zombie_base_delay+current_zombie_delay;\r
-               zombie_base_delay += current_zombie_delay;\r
-               if (zombie_base_delay > 8*60)\r
-                       zombie_base_delay = 0;\r
-       }\r
-\r
-       new->speed = 2500;\r
-       new->obclass = zombieobj;\r
-       new->hitpoints = EasyHitPoints(5);\r
-       new->active = yes;\r
-       new->flags &= ~of_shootable;\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-// T_Zombie()\r
-//--------------------------------------------------------------------------\r
-void T_Zombie (objtype *ob)\r
-{\r
-       switch (zombie_mode)\r
-       {\r
-               case zm_wait_for_dark:\r
-                       if (gamestate.mapon == 0)\r
-                       {\r
-                               if (BGFLAGS & BGF_NIGHT)\r
-                                       zombie_mode = zm_wait_to_rise;\r
-                       }\r
-                       else\r
-                               zombie_mode = zm_wait_to_rise;\r
-               break;\r
-\r
-               case zm_wait_to_rise:\r
-                       if (zombie_delay < 0)\r
+               case wt_CORNER1:\r
+               case wt_CORNER2:\r
+               case wt_CORNER3:\r
+               case wt_CORNER4:\r
+                       ob->flags &= ~of_shootable;\r
+                       if ((WD_TIMEREMAIN -= realtics) < 0)\r
                        {\r
-                               if ((ob->tilex == player->tilex) && (ob->tiley == player->tiley))\r
-                                       break;\r
-\r
-                               ob->active = always;\r
-                               ob->state = &s_zombie_rise1;\r
-                               ob->ticcount = ob->state->tictime;              // JIM Added\r
-                               zombie_mode = zm_active;\r
+                               WD_STAGE = wt_BUBBLES;\r
+                               ob->flags &= ~WATER_DRAGON_LEAVE;\r
                        }\r
                        else\r
-                               zombie_delay -= tics;\r
-\r
-               break;\r
-\r
-               case zm_active:\r
-                       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
                        {\r
-                               ob->state = &s_zombie_attack;\r
-                               ob->ticcount = ob->state->tictime;\r
-                               return;\r
-                       }\r
-               break;\r
-       }\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-// T_ZombieRisen()\r
-//--------------------------------------------------------------------------\r
-void T_ZombieRisen(objtype *obj)\r
-{\r
-       obj->flags |= of_shootable;\r
-}\r
-\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                                                       SPOOKS\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Spook(objtype *ob);\r
-\r
-statetype s_spook_wait = {0,10,T_Spook,&s_spook_wait};\r
-\r
-statetype s_spook0 = {SPOOK_INOUTPIC,7,NULL,&s_spook0_1};\r
-statetype s_spook0_1 = {0,7,NULL,&s_spook0_2};\r
-statetype s_spook0_2 = {SPOOK_INOUTPIC,7,NULL,&s_spook1};\r
-\r
-statetype s_spook1 = {SPOOK1PIC,10,NULL,&s_spook2};\r
-statetype s_spook2 = {SPOOK2PIC,10,T_Spook,&s_spook3};\r
-statetype s_spook3 = {SPOOK3PIC,10,T_Spook,&s_spook4};\r
-statetype s_spook4 = {SPOOK4PIC,10,T_Spook,&s_spook5};\r
-statetype s_spook5 = {SPOOK3PIC,10,T_Spook,&s_spook6};\r
-statetype s_spook6 = {SPOOK2PIC,10,T_Spook,&s_spook1};\r
-\r
-statetype s_spook_attack1 = {SPOOK_ATTACKPIC,35,NULL,&s_spook_attack3};\r
-statetype s_spook_attack3 = {SPOOK3PIC,20,T_DoDamage,&s_spook1};\r
-\r
-statetype s_spook_pause  = {SPOOK1PIC,20,NULL,&s_spook1};\r
-\r
-statetype s_spookouch = {SPOOKHITPIC,5,NULL,&s_spook1};\r
+                               fixed tempx,tempy;\r
+                               unsigned temp_tilex,temp_tiley;\r
 \r
-statetype s_spookdie = {SPOOK_INOUTPIC,9,NULL,&s_spookdie1};\r
-statetype s_spookdie1 = {SPOOK4PIC,9,NULL,&s_spookdie2};\r
-statetype s_spookdie2 = {SPOOK_INOUTPIC,9,NULL,&s_spookdie3};\r
-statetype s_spookdie3 = {SPOOK4PIC,9,NULL,&s_spookdie4};\r
-statetype s_spookdie4 = {SPOOK_INOUTPIC,9,NULL,&s_spookdie5};\r
-statetype s_spookdie5 = {0,11,NULL,NULL};\r
+                               tempx = player->x;\r
+                               tempy = player->y;\r
+                               temp_tilex = player->tilex;\r
+                               temp_tiley = player->tiley;\r
 \r
-#define spook_mode     ob->temp1\r
-#define spook_delay    ob->temp2\r
+                               player->x = ((long)other_x[WD_STAGE-2]<<TILESHIFT)+TILEGLOBAL/2;\r
+                               player->y = ((long)other_y[WD_STAGE-2]<<TILESHIFT)+TILEGLOBAL/2;\r
+                               player->tilex = other_x[WD_STAGE-2];\r
+                               player->tiley = other_y[WD_STAGE-2];\r
 \r
-/*\r
-===============\r
-=\r
-= SpawnSpook\r
-=\r
-===============\r
-*/\r
-void SpawnSpook(int tilex, int tiley)\r
-{\r
-       objtype *ob;\r
-       unsigned tile;\r
-       SpawnNewObj(tilex,tiley,&s_spook_wait,PIXRADIUS*35);\r
-       ob = new;\r
-\r
-       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
-       if (tile)\r
-               spook_delay = (tile>>8)*30;\r
-       else\r
-               spook_delay = 2*60+random(5*60);\r
-\r
-       spook_mode = zm_wait_for_dark;\r
-\r
-       new->active = yes;\r
-       new->obclass = spookobj;\r
-       new->speed = 1900;\r
-       new->flags &= ~of_shootable;\r
-       new->hitpoints = EasyHitPoints(5);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Spook\r
-=\r
-===============\r
-*/\r
-void T_Spook(objtype *ob)\r
-{\r
-       switch (zombie_mode)\r
-       {\r
-               case zm_wait_for_dark:\r
-                       if (!gamestate.mapon)\r
-                       {\r
-                               if (BGFLAGS & BGF_NIGHT)\r
-                                       spook_mode = zm_wait_to_rise;\r
-                       }\r
-                       else\r
-                               spook_mode = zm_wait_to_rise;\r
-               break;\r
 \r
-               case zm_wait_to_rise:\r
-                       spook_delay -= tics;\r
-                       if (spook_delay < 0)\r
-                       {\r
-                               if ((ob->tilex == player->tilex) && (ob->tiley == player->tiley))\r
-                                       break;\r
-\r
-                               ob->active = always;\r
-                               ob->flags |= of_shootable;\r
-                               ob->state = &s_spook0;\r
-                               ob->ticcount = ob->state->tictime;\r
-                               spook_mode = zm_active;\r
-                       }\r
-                       else\r
-                               spook_delay -= tics;\r
-               break;\r
+                               Chase(ob,true);\r
 \r
-               case zm_active:\r
-                       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
-                       {\r
-                               ob->state = &s_spook_attack1;\r
-                               ob->ticcount = ob->state->tictime;\r
-                               return;\r
+                               player->x = tempx;\r
+                               player->y = tempy;\r
+                               player->tilex = temp_tilex;\r
+                               player->tiley = temp_tiley;\r
                        }\r
-               break;\r
-       }\r
-}\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                               SKELETON IN WALL\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_WallSkeleton(objtype *ob);\r
-\r
-extern statetype s_skel_1;\r
-\r
-statetype s_wallskel = {0,40,T_WallSkeleton,&s_wallskel};\r
-statetype s_wallskel2 = {0,1,NULL,NULL};\r
-\r
-\r
-enum wskel_modes {ws_wall1,ws_wall2,ws_wall3,ws_exit};\r
-\r
-#define wskel_mode     ob->temp1\r
-#define wskel_delay    ob->temp2\r
-#define wskel_base     ob->angle\r
-#define wskel_wallx    ob->hitpoints\r
-#define wskel_wally    ob->speed\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnWallSkeleton\r
-=\r
-===============\r
-*/\r
-void SpawnWallSkeleton(int tilex, int tiley)\r
-{\r
-       char xofs[] = {0,0,-1,+1};\r
-       char yofs[] = {-1,+1,0,0};\r
-\r
-       objtype *ob;\r
-       int wallx=tilex,wally=tiley,wallbase,wallmode,loop;\r
-       unsigned tile,current_delay;\r
-\r
-       for (loop=0; loop<4; loop++)\r
-       {\r
-               tile = *(mapsegs[0]+farmapylookup[tiley+yofs[loop]]+tilex+xofs[loop]);\r
-               switch (tile)\r
-               {\r
-                       case WALL_SKELETON_CODE:\r
-                       case WALL_SKELETON_CODE+1:\r
-                       case WALL_SKELETON_CODE+2:\r
-                               wallmode = ws_wall1+(tile-WALL_SKELETON_CODE);\r
-                               wallbase = WALL_SKELETON_CODE;\r
-                               goto foundtile;\r
-                       break;\r
-\r
-                       case 41:\r
-                       case 43:\r
-                               wallmode = ws_wall1+(tile-41);\r
-                               wallbase = 41;\r
-                               goto foundtile;\r
                        break;\r
-\r
-                       case 42:\r
-                       case 44:\r
-                               wallmode = ws_wall1+(tile-42);\r
-                               wallbase = 42;\r
-                               goto foundtile;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return;\r
-foundtile:;\r
-\r
-       wallx += xofs[loop];\r
-       wally += yofs[loop];\r
-\r
-       SpawnNewObj(tilex,tiley,&s_wallskel,PIXRADIUS*35);\r
-       ob = new;\r
-       new->obclass = wallskelobj;\r
-       new->speed = 1900;\r
-       new->flags &= ~of_shootable;\r
-       new->hitpoints = EasyHitPoints(5);\r
-\r
-//     new->tilex = wallx;\r
-//     new->tiley = wally;\r
-       wskel_wallx = wallx;\r
-       wskel_wally = wally;\r
-       wskel_base = wallbase;\r
-       new->active = no;\r
-\r
-       wskel_mode = wallmode;\r
-\r
-       tile = *(mapsegs[2]+farmapylookup[wally]+wallx);\r
-       if (tile)\r
-               wskel_delay = (tile>>8)*30;\r
-       else\r
-       {\r
-               current_delay = (2*60)+random(4*60);\r
-               wskel_delay = zombie_base_delay+current_delay;\r
-               zombie_base_delay += current_delay;\r
-               if (zombie_base_delay > 8*60)\r
-                       zombie_base_delay = 0;\r
-       }\r
-}\r
-\r
-/*\r
-===============\r
-=\r
-= T_WallSkeleton\r
-=\r
-===============\r
-*/\r
-void T_WallSkeleton(objtype *ob)\r
-{\r
-       int x=wskel_wallx,y=wskel_wally;\r
-\r
-       wskel_delay -= realtics;\r
-       if (wskel_delay > 0)\r
-               return;\r
-\r
-       switch (wskel_mode)\r
-       {\r
-               case ws_wall2:\r
-                       if ((wskel_base == 41) || (wskel_base == 42))\r
-                               wskel_mode++;\r
-               case ws_wall1:\r
-               case ws_wall3:\r
-                       (unsigned)actorat[x][y]\r
-                               = tilemap[x][y]\r
-                               = *(mapsegs[0]+farmapylookup[y]+x)\r
-                               = wskel_base+(wskel_mode-ws_wall1);\r
-\r
-                       wskel_mode++;\r
-                       wskel_delay = (120);\r
-                       ob->active = always;\r
-               break;\r
-\r
-               case ws_exit:\r
-//                     wskel_delay = 0;\r
-//                     if (objectcount >= MAXACTORS-3)\r
-//                             break;\r
-\r
-                       (unsigned)actorat[x][y]\r
-                               = tilemap[x][y]\r
-                               = *(mapsegs[0]+farmapylookup[y]+x)\r
-                               = wskel_base;\r
-                       ob->tilex = ob->x >> TILESHIFT;\r
-                       ob->tiley = ob->y >> TILESHIFT;\r
-\r
-                       ob->obclass = skeletonobj;\r
-                       ob->speed = 2036;\r
-                       ob->flags |= of_shootable;\r
-                       ob->hitpoints = EasyHitPoints(12);\r
-                       ob->state = &s_skel_1;\r
-                       ob->ticcount = ob->state->tictime;\r
-\r
-//                     SpawnSkeleton(ob->tilex,ob->tiley);\r
-//                     ob->state = NULL;\r
-               break;\r
        }\r
 }\r
 \r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                               SKELETONS\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Skeleton(objtype *ob);\r
-\r
-\r
-\r
-\r
-statetype s_skel_pause = {SKELETON_1PIC,40,NULL,&s_skel_2};\r
-\r
-statetype s_skel_1 = {SKELETON_1PIC,10,T_Skeleton,&s_skel_2};\r
-statetype s_skel_2 = {SKELETON_2PIC,10,T_Skeleton,&s_skel_3};\r
-statetype s_skel_3 = {SKELETON_3PIC,10,T_Skeleton,&s_skel_4};\r
-statetype s_skel_4 = {SKELETON_4PIC,10,T_Skeleton,&s_skel_1};\r
-\r
-statetype s_skel_attack1 = {SKELETON_ATTACK_1PIC,12,NULL,&s_skel_attack2};\r
-statetype s_skel_attack2 = {SKELETON_ATTACK_2PIC,12,NULL,&s_skel_attack3};\r
-statetype s_skel_attack3 = {SKELETON_ATTACK_3PIC,12,T_DoDamage,&s_skel_pause};\r
-\r
-statetype s_skel_ouch = {SKELETON_OUCHPIC,8,NULL,&s_skel_1};\r
-\r
-statetype s_skel_die1 = {SKELETON_OUCHPIC,18,NULL,&s_skel_die2};\r
-statetype s_skel_die2 = {SKELETON_DEATH_1PIC,18,NULL,&s_skel_die3};\r
-statetype s_skel_die3 = {SKELETON_DEATH_2PIC,18,NULL,&s_skel_die3};\r
-\r
 /*\r
 ===============\r
 =\r
-= SpawnSkeleton\r
+= T_DragonShoot\r
 =\r
 ===============\r
 */\r
-void SpawnSkeleton(int tilex, int tiley)\r
+void T_DragonShoot (objtype *ob)\r
 {\r
-       SpawnNewObj(tilex,tiley,&s_skel_1,PIXRADIUS*35);\r
-       new->obclass = skeletonobj;\r
-       new->speed = 2036;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(12);\r
+       ShootPlayer(ob,dshotobj,10000,&s_dragon_shot1);\r
 }\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Skeleton\r
-=\r
-===============\r
-*/\r
-\r
-void T_Skeleton(objtype *ob)\r
-{\r
-       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
-       {\r
-               ob->state = &s_skel_attack1;\r
-               ob->ticcount = ob->state->tictime;\r
-               return;\r
-       }\r
-}\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                               EYE\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Eye(objtype *ob);\r
-boolean T_EyeShoot (objtype *ob, boolean eyeshot);\r
-\r
-\r
-\r
-\r
-statetype s_eye_pause = {EYE_WALK1PIC,40,NULL,&s_eye_2};\r
-\r
-statetype s_eye_1 = {EYE_WALK1PIC,20,T_Eye,&s_eye_2};\r
-statetype s_eye_2 = {EYE_WALK2PIC,20,T_Eye,&s_eye_3};\r
-statetype s_eye_3 = {EYE_WALK3PIC,20,T_Eye,&s_eye_4};\r
-statetype s_eye_4 = {EYE_WALK2PIC,20,T_Eye,&s_eye_1};\r
-\r
-statetype s_eye_ouch = {EYE_OUCH1PIC,8,NULL,&s_eye_ouch2};\r
-statetype s_eye_ouch2 = {EYE_OUCH2PIC,8,NULL,&s_eye_1};\r
-\r
-statetype s_eye_die1 = {EYE_DEATH1PIC,22,NULL,&s_eye_die2};\r
-statetype s_eye_die2 = {EYE_DEATH2PIC,22,NULL,&s_eye_die3};\r
-statetype s_eye_die3 = {EYE_DEATH2PIC,22,NULL,NULL};\r
-\r
-extern statetype s_eshot2;\r
-\r
-statetype s_eshot1 = {EYE_SHOT1PIC,8,&T_ShootPlayer,&s_eshot2};\r
-statetype s_eshot2 = {EYE_SHOT2PIC,8,&T_ShootPlayer,&s_eshot1};\r
-\r
-enum eye_modes {em_other1,em_player1,em_other2,em_player2,em_other3,em_player3,em_other4,em_player4};\r
-\r
-#define eye_mode       ob->temp1\r
-#define eye_delay      ob->temp2\r
-\r
-//-------------------------------------------------------------------------\r
-// SpawnEye()\r
-//-------------------------------------------------------------------------\r
-void SpawnEye(int tilex, int tiley)\r
-{\r
-       objtype *ob;\r
-\r
-       SpawnNewObj(tilex,tiley,&s_eye_1,PIXRADIUS*35);\r
-       ob = new;\r
-       new->obclass = eyeobj;\r
-       new->speed = 1200;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(14);\r
-       eye_mode = em_other1;\r
-}\r
-\r
-\r
-//-------------------------------------------------------------------------\r
-// T_Eye()\r
-//-------------------------------------------------------------------------\r
-void T_Eye(objtype *ob)\r
-{\r
-       fixed tempx,tempy;\r
-       unsigned temp_tilex,temp_tiley;\r
-\r
-       eye_delay -= realtics;\r
-       if (eye_delay < 0)\r
-       {\r
-               eye_mode = random(em_player4);\r
-               eye_delay = (10*60);\r
-       }\r
-\r
-       tempx = player->x;\r
-       tempy = player->y;\r
-       temp_tilex = player->tilex;\r
-       temp_tiley = player->tiley;\r
-\r
-\r
-       switch (eye_mode)\r
-       {\r
-               case em_other1:\r
-               case em_other2:\r
-               case em_other3:\r
-               case em_other4:\r
-                       player->x = ((long)other_x[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
-                       player->y = ((long)other_y[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
-                       player->tilex = other_x[eye_mode];\r
-                       player->tiley = other_y[eye_mode];\r
-               break;\r
-       }\r
-\r
-       if (Chase(ob,true))\r
-               eye_delay = 0;\r
-\r
-       player->x = tempx;\r
-       player->y = tempy;\r
-       player->tilex = temp_tilex;\r
-       player->tiley = temp_tiley;\r
-\r
-       if (!random(2))\r
-               ShootPlayer(ob,eshotobj,ESHOTSPEED,&s_eshot1);\r
-}\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       ORCS\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Orc (objtype *ob);\r
-\r
-extern statetype s_orcpause;\r
-\r
-extern statetype s_orc1;\r
-extern statetype s_orc2;\r
-extern statetype s_orc3;\r
-extern statetype s_orc4;\r
-\r
-extern statetype s_orcattack1;\r
-extern statetype s_orcattack2;\r
-extern statetype s_orcattack3;\r
-\r
-extern statetype s_orcouch;\r
-\r
-extern statetype s_orcdie1;\r
-extern statetype s_orcdie2;\r
-extern statetype s_orcdie3;\r
-\r
-\r
-\r
-statetype s_orcpause = {ORC1PIC,40,NULL,&s_orc2};\r
-\r
-statetype s_orc1 = {ORC1PIC,20,T_Orc,&s_orc2};\r
-statetype s_orc2 = {ORC2PIC,20,T_Orc,&s_orc3};\r
-statetype s_orc3 = {ORC3PIC,20,T_Orc,&s_orc4};\r
-statetype s_orc4 = {ORC4PIC,20,T_Orc,&s_orc1};\r
-\r
-statetype s_orcattack1 = {ORCATTACK1PIC,20,NULL,&s_orcattack2};\r
-statetype s_orcattack2 = {ORCATTACK2PIC,20,NULL,&s_orcattack3};\r
-statetype s_orcattack3 = {ORCATTACK2PIC,30,T_DoDamage,&s_orcpause};\r
-\r
-statetype s_orcouch = {ORCOUCHPIC,15,NULL,&s_orc1};\r
-\r
-statetype s_orcdie1 = {ORCDIE1PIC,18,NULL,&s_orcdie2};\r
-statetype s_orcdie2 = {ORCDIE2PIC,18,NULL,&s_orcdie3};\r
-statetype s_orcdie3 = {ORCDIE3PIC,0,NULL,&s_orcdie3};\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnOrc\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnOrc (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_orc1,PIXRADIUS*35);\r
-       new->obclass = orcobj;\r
-       new->speed = 1536;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(6);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Orc\r
-=\r
-===============\r
-*/\r
-\r
-void T_Orc (objtype *ob)\r
-{\r
-       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
-       {\r
-               ob->state = &s_orcattack1;\r
-               ob->ticcount = ob->state->tictime;\r
-               return;\r
-       }\r
-}\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       DEMON\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Demon (objtype *ob);\r
-\r
-\r
-extern statetype s_demonpause;\r
-\r
-extern statetype s_demon1;\r
-extern statetype s_demon2;\r
-extern statetype s_demon3;\r
-extern statetype s_demon4;\r
-\r
-extern statetype s_demonattack1;\r
-extern statetype s_demonattack2;\r
-extern statetype s_demonattack3;\r
-\r
-extern statetype s_demonouch;\r
-\r
-extern statetype s_demondie1;\r
-extern statetype s_demondie2;\r
-extern statetype s_demondie3;\r
-\r
-\r
-statetype s_demonpause = {DEMON1PIC,40,NULL,&s_demon2};\r
-\r
-statetype s_demon1 = {DEMON1PIC,20,T_Demon,&s_demon2};\r
-statetype s_demon2 = {DEMON2PIC,20,T_Demon,&s_demon3};\r
-statetype s_demon3 = {DEMON3PIC,20,T_Demon,&s_demon4};\r
-statetype s_demon4 = {DEMON4PIC,20,T_Demon,&s_demon1};\r
-\r
-statetype s_demonattack1 = {DEMONATTACK1PIC,20,NULL,&s_demonattack2};\r
-statetype s_demonattack2 = {DEMONATTACK2PIC,20,NULL,&s_demonattack3};\r
-statetype s_demonattack3 = {DEMONATTACK3PIC,30,T_DoDamage,&s_demonpause};\r
-\r
-statetype s_demonouch = {DEMONOUCHPIC,15,T_Demon,&s_demon1};\r
-\r
-statetype s_demondie1 = {DEMONDIE1PIC,40,NULL,&s_demondie2};\r
-statetype s_demondie2 = {DEMONDIE2PIC,30,NULL,&s_demondie3};\r
-statetype s_demondie3 = {DEMONDIE3PIC,0,NULL,&s_demondie3};\r
-\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnDemon\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnDemon (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_demon1,PIXRADIUS*35);\r
-       new->obclass = demonobj;\r
-       new->speed = 2048;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(50);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Demon\r
-=\r
-===============\r
-*/\r
-\r
-void T_Demon (objtype *ob)\r
-{\r
-       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
-       {\r
-               ob->state = &s_demonattack1;\r
-               ob->ticcount = ob->state->tictime;\r
-               return;\r
-       }\r
-}\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       MAGE\r
-\r
-=============================================================================\r
-*/\r
-\r
-\r
-void T_Mage (objtype *ob);\r
-void T_MageShoot (objtype *ob);\r
-\r
-extern statetype s_magepause;\r
-\r
-extern statetype s_mage1;\r
-extern statetype s_mage2;\r
-\r
-extern statetype s_mageattack1;\r
-extern statetype s_mageattack2;\r
-extern statetype s_mageattack3;\r
-\r
-extern statetype s_mageouch;\r
-\r
-extern statetype s_magedie1;\r
-extern statetype s_magedie2;\r
-\r
-\r
-statetype s_magepause = {MAGE1PIC,10,NULL,&s_mage2};\r
-\r
-statetype s_mage1 = {MAGE1PIC,20,T_Mage,&s_mage2};\r
-statetype s_mage2 = {MAGE2PIC,20,T_Mage,&s_mage1};\r
-\r
-//statetype s_mageattack1 = {MAGEATTACKPIC,20,NULL,&s_mageattack2};\r
-//statetype s_mageattack2 = {MAGEATTACKPIC,-1,T_MageShoot,&s_mageattack3};\r
-statetype s_mageattack3 = {MAGEATTACKPIC,30,NULL,&s_magepause};\r
-\r
-statetype s_mageouch = {MAGEOUCHPIC,10,NULL,&s_mage1};\r
-\r
-statetype s_magedie1 = {MAGEDIE1PIC,20,NULL,&s_magedie2};\r
-statetype s_magedie2 = {MAGEDIE2PIC,0,NULL,&s_magedie2};\r
-\r
-\r
-statetype s_mshot1 = {PSHOT1PIC,8,&T_ShootPlayer,&s_mshot2};\r
-statetype s_mshot2 = {PSHOT2PIC,8,&T_ShootPlayer,&s_mshot1};\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnMage\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnMage (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_mage1,PIXRADIUS*35);\r
-       new->obclass = mageobj;\r
-       new->speed = 3072;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(5);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Mage\r
-=\r
-===============\r
-*/\r
-\r
-void T_Mage (objtype *ob)\r
-{\r
-       fixed tempx,tempy;\r
-       unsigned temp_tilex,temp_tiley;\r
-\r
-       eye_delay -= realtics;\r
-       if (eye_delay < 0)\r
-       {\r
-               eye_mode = random(em_player4);\r
-               eye_delay = (10*60);\r
-       }\r
-\r
-       tempx = player->x;\r
-       tempy = player->y;\r
-       temp_tilex = player->tilex;\r
-       temp_tiley = player->tiley;\r
-\r
-\r
-       switch (eye_mode)\r
-       {\r
-               case em_other1:\r
-               case em_other2:\r
-               case em_other3:\r
-               case em_other4:\r
-                       player->x = ((long)other_x[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
-                       player->y = ((long)other_y[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
-                       player->tilex = other_x[eye_mode];\r
-                       player->tiley = other_y[eye_mode];\r
-               break;\r
-       }\r
-\r
-       if (Chase(ob,true))\r
-               eye_delay = 0;\r
-\r
-       player->x = tempx;\r
-       player->y = tempy;\r
-       player->tilex = temp_tilex;\r
-       player->tiley = temp_tiley;\r
-\r
-       if (!random(10))\r
-               if (ShootPlayer(ob,mshotobj,MSHOTSPEED,&s_mshot1))\r
-               {\r
-                       ob->state = &s_mageattack3;\r
-                       ob->ticcount = ob->state->tictime;\r
-               }\r
-}\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                               RED DEMON\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_RedDemon (objtype *ob);\r
-\r
-extern statetype s_red_demonpause;\r
-\r
-extern statetype s_red_demon1;\r
-extern statetype s_red_demon2;\r
-extern statetype s_red_demon3;\r
-extern statetype s_red_demon4;\r
-\r
-extern statetype s_red_demonattack1;\r
-extern statetype s_red_demonattack2;\r
-extern statetype s_red_demonattack3;\r
-\r
-extern statetype s_red_demonouch;\r
-\r
-extern statetype s_red_demondie1;\r
-extern statetype s_red_demondie2;\r
-extern statetype s_red_demondie3;\r
-\r
-statetype s_red_demonpause = {RED_DEMON1PIC,40,NULL,&s_red_demon2};\r
-\r
-statetype s_red_demon1 = {RED_DEMON1PIC,20,T_RedDemon,&s_red_demon2};\r
-statetype s_red_demon2 = {RED_DEMON2PIC,20,T_RedDemon,&s_red_demon3};\r
-statetype s_red_demon3 = {RED_DEMON3PIC,20,T_RedDemon,&s_red_demon4};\r
-statetype s_red_demon4 = {RED_DEMON4PIC,20,T_RedDemon,&s_red_demon1};\r
-\r
-statetype s_red_demonattack1 = {RED_DEMONATTACK1PIC,20,NULL,&s_red_demonattack2};\r
-statetype s_red_demonattack2 = {RED_DEMONATTACK2PIC,20,NULL,&s_red_demonattack3};\r
-statetype s_red_demonattack3 = {RED_DEMONATTACK3PIC,30,T_DoDamage,&s_red_demon2};\r
-\r
-statetype s_red_demonouch = {RED_DEMONOUCHPIC,15,T_RedDemon,&s_red_demon1};\r
-\r
-statetype s_red_demondie1 = {RED_DEMONDIE1PIC,40,NULL,&s_red_demondie2};\r
-statetype s_red_demondie2 = {RED_DEMONDIE2PIC,30,NULL,&s_red_demondie3};\r
-statetype s_red_demondie3 = {RED_DEMONDIE3PIC,0,NULL,&s_red_demondie3};\r
-\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnRedDemon\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnRedDemon (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_red_demon1,PIXRADIUS*35);\r
-       new->obclass = reddemonobj;\r
-       new->speed = 2048;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(50);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_RedDemon\r
-=\r
-===============\r
-*/\r
-\r
-void T_RedDemon (objtype *ob)\r
-{\r
-       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
-       {\r
-               ob->state = &s_red_demonattack1;\r
-               ob->ticcount = ob->state->tictime;\r
-               return;\r
-       }\r
-}\r
-\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       GRELMINAR\r
-\r
-=============================================================================\r
-*/\r
-\r
-\r
-void T_Grelminar (objtype *ob);\r
-void T_GrelminarShoot (objtype *ob);\r
-void T_Grelm_DropKey(objtype *ob);\r
-\r
-extern statetype s_grelpause;\r
-\r
-extern statetype s_grel1;\r
-extern statetype s_grel2;\r
-\r
-extern statetype s_grelattack1;\r
-extern statetype s_grelattack2;\r
-extern statetype s_grelattack3;\r
-\r
-extern statetype s_grelouch;\r
-\r
-extern statetype s_greldie1;\r
-extern statetype s_greldie2;\r
-extern statetype s_greldie3;\r
-extern statetype s_greldie4;\r
-extern statetype s_greldie5;\r
-extern         statetype s_greldie5a;\r
-extern statetype s_greldie6;\r
-\r
-\r
-statetype s_grelpause = {GREL1PIC,50,NULL,&s_grel2};\r
-\r
-statetype s_grel1 = {GREL1PIC,20,T_Grelminar,&s_grel2};\r
-statetype s_grel2 = {GREL2PIC,20,T_Grelminar,&s_grel1};\r
-\r
-//statetype s_grelattack1 = {GRELATTACKPIC,20,NULL,&s_grelattack2};\r
-//statetype s_grelattack2 = {GRELATTACKPIC,-1,T_GrelminarShoot,&s_grelattack3};\r
-statetype s_grelattack3 = {GRELATTACKPIC,30,NULL,&s_grelpause};\r
-\r
-statetype s_grelouch = {GRELHITPIC,6,NULL,&s_grel1};\r
-\r
-statetype s_greldie1 = {GRELDIE1PIC,22,NULL,&s_greldie2};\r
-statetype s_greldie2 = {GRELDIE2PIC,22,NULL,&s_greldie3};\r
-statetype s_greldie3 = {GRELDIE3PIC,22,NULL,&s_greldie4};\r
-statetype s_greldie4 = {GRELDIE4PIC,22,NULL,&s_greldie5};\r
-statetype s_greldie5 = {GRELDIE5PIC,22,NULL,&s_greldie5a};\r
-statetype s_greldie5a = {GRELDIE5PIC,1,T_Grelm_DropKey,&s_greldie6};\r
-statetype s_greldie6 = {GRELDIE6PIC,0,NULL,&s_greldie6};\r
-\r
-\r
-extern statetype s_gshot1;\r
-\r
-statetype s_gshot1 = {SKULL_SHOTPIC,8,T_ShootPlayer,&s_gshot1};\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnGrelminar\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnGrelminar (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_grel1,PIXRADIUS*35);\r
-       new->obclass = grelmobj;\r
-       new->speed = 2048;\r
-       new->flags |= of_shootable;\r
-       new->hitpoints = EasyHitPoints(100);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Grelminar\r
-=\r
-===============\r
-*/\r
-\r
-void T_Grelminar (objtype *ob)\r
-{\r
-       Chase (ob,false);\r
-\r
-       if (!random(10))\r
-               if (ShootPlayer(ob,gshotobj,10000,&s_gshot1))\r
-               {\r
-                       ob->state = &s_grelattack3;\r
-               }\r
-}\r
-\r
-\r
-//=================================\r
-//\r
-// T_Grelm_DropKey\r
-//\r
-//=================================\r
-void T_Grelm_DropKey(objtype *ob)\r
-{\r
-       if (ob->temp1)\r
-               return;\r
-\r
-       SpawnBonus(ob->tilex,ob->tiley,B_RKEY);\r
-       SD_PlaySound(GRELM_DEADSND);\r
-       ob->temp1 = true;\r
-}\r
-\r
-/*\r
-=============================================================================\r
-\r
-                                                       BAT\r
-\r
-=============================================================================\r
-*/\r
-\r
-void T_Bat (objtype *ob);\r
-void T_BatPast (objtype *ob);\r
-\r
-extern statetype s_bat1;\r
-extern statetype s_bat2;\r
-extern statetype s_bat3;\r
-extern statetype s_bat4;\r
-\r
-extern statetype s_batdie1;\r
-extern statetype s_batdie2;\r
-\r
-\r
-statetype s_bat1 = {BAT1PIC,6,T_Bat,&s_bat2};\r
-statetype s_bat2 = {BAT2PIC,6,T_Bat,&s_bat3};\r
-statetype s_bat3 = {BAT3PIC,6,T_Bat,&s_bat4};\r
-statetype s_bat4 = {BAT4PIC,6,T_Bat,&s_bat1};\r
-\r
-statetype s_batpast = {BAT4PIC,80,T_BatPast,&s_bat1};\r
-\r
-statetype s_batdie1 = {BATDIE1PIC,18,NULL,&s_batdie2};\r
-statetype s_batdie2 = {BATDIE2PIC,18,NULL,NULL};\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= SpawnBat\r
-=\r
-===============\r
-*/\r
-\r
-void SpawnBat (int tilex, int tiley)\r
-{\r
-       SpawnNewObj(tilex,tiley,&s_bat1,PIXRADIUS*35);\r
-       new->obclass =batobj;\r
-       new->flags |= of_shootable;\r
-\r
-       new->hitpoints = 1;\r
-       new->speed = 2000;\r
-}\r
-\r
-\r
-/*\r
-==================================\r
-=\r
-= BatChaseThink\r
-=\r
-==================================\r
-*/\r
-\r
-void BatChaseThink (objtype *obj)\r
-{\r
-       int deltax,deltay;\r
-\r
-       deltax=player->tilex - obj->tilex;\r
-       deltay=player->tiley - obj->tiley;\r
-\r
-       if (deltax>0)\r
-               deltax = 2;\r
-       else if (deltax<0)\r
-               deltax = 0;\r
-       else deltax = 1;\r
-\r
-       if (deltay>0)\r
-               deltay = 2;\r
-       else if (deltay<0)\r
-               deltay = 0;\r
-       else deltay = 1;\r
-\r
-       obj->dir = dirtable[deltay*3+deltax];\r
-       if (Walk(obj))\r
-               return;\r
-\r
-       obj->dir = dirtable[3+deltax];\r
-       if (Walk(obj))\r
-               return;\r
-\r
-       obj->dir = dirtable[deltay*3+1];\r
-       if (Walk(obj))\r
-               return;\r
-\r
-       obj->dir = nodir;\r
-}\r
-\r
-\r
-void BatRunThink (objtype *obj)\r
-{\r
-       int deltax,deltay;\r
-\r
-       deltax=player->tilex - obj->tilex;\r
-       deltay=player->tiley - obj->tiley;\r
-\r
-       if (deltax>=0)\r
-               deltax = 0;\r
-       else\r
-               deltax = 2;\r
-\r
-       if (deltay>=0)\r
-               deltay = 0;\r
-       else\r
-               deltay = 2;\r
-\r
-       obj->dir = dirtable[deltay*3+deltax];\r
-       if (Walk(obj))\r
-               return;\r
-\r
-       obj->dir = dirtable[3+deltax];\r
-       if (Walk(obj))\r
-               return;\r
-\r
-       obj->dir = dirtable[deltay*3+1];\r
-       Walk(obj);\r
-}\r
-\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_Bat\r
-=\r
-===============\r
-*/\r
-\r
-void T_Bat (objtype *ob)\r
-{\r
-       long move;\r
-       long deltax,deltay,size;\r
-\r
-       move = ob->speed*tics;\r
-       size = (long)ob->size + player->size + move;\r
-\r
-\r
-       do\r
-       {\r
-               deltax = ob->x - player->x;\r
-               deltay = ob->y - player->y;\r
-\r
-               if (deltax <= size && deltax >= -size\r
-               && deltay <= size && deltay >= -size && !ob->temp1)\r
-               {\r
-                       TakeDamage (4);\r
-                       ob->temp1 = 2;\r
-               }\r
-\r
-               if (move < ob->distance)\r
-               {\r
-                       MoveObj (ob,move);\r
-                       break;\r
-               }\r
-\r
-               actorat[ob->tilex][ob->tiley] = 0;      // pick up marker from goal\r
-               if (ob->dir == nodir)\r
-                       ob->dir = north;\r
-\r
-               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
-               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
-               move -= ob->distance;\r
-\r
-               if (ob->temp1)\r
-               {\r
-                       Walk (ob);                              // go straight\r
-                       if (!--ob->temp1)\r
-                       {\r
-                               ob->state = &s_batpast;\r
-                               ob->ticcount = ob->state->tictime;\r
-                       }\r
-               }\r
-               else\r
-                       BatChaseThink (ob);             // head towards player\r
-\r
-               actorat[ob->tilex][ob->tiley] = ob;     // set down a new goal marker\r
-       } while (0);    // just once\r
-       CalcBounds (ob);\r
-}\r
-\r
-\r
-/*\r
-===============\r
-=\r
-= T_BatPast\r
-=\r
-===============\r
-*/\r
-\r
-void T_BatPast (objtype *ob)\r
-{\r
-       long move;\r
-       long deltax,deltay,size;\r
-\r
-       move = ob->speed*tics;\r
-\r
-       do\r
-       {\r
-               if (move < ob->distance)\r
-               {\r
-                       MoveObj (ob,move);\r
-                       break;\r
-               }\r
-               actorat[ob->tilex][ob->tiley] = 0;      // pick up marker from goal\r
-\r
-               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
-               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
-               move -= ob->distance;\r
-\r
-               BatRunThink (ob);\r
-\r
-               actorat[ob->tilex][ob->tiley] = ob;     // set down a new goal marker\r
-       } while (0);    //(move)\r
-       CalcBounds (ob);\r
-}\r
-\r
-\r
-//--------------------------------------------------------------------------\r
-// ShootPlayer()\r
-//--------------------------------------------------------------------------\r
-boolean ShootPlayer(objtype *ob, short obclass, short speed, statetype *state)\r
-{\r
-       int angle = AngleNearPlayer(ob);\r
-\r
-       if (angle == -1)\r
-               return(false);\r
-\r
-       DSpawnNewObjFrac (ob->x,ob->y,state,PIXRADIUS*35);\r
-       new->speed = speed;\r
-       new->obclass = obclass;\r
-       new->active = always;\r
-       new->angle = angle;\r
-\r
-       return(true);\r
-}\r
-\r
-//--------------------------------------------------------------------------\r
-// T_ShootPlayer()\r
-//--------------------------------------------------------------------------\r
-void T_ShootPlayer(objtype *ob)\r
-{\r
-       objtype *check;\r
-       long xmove,ymove,speed;\r
-\r
-       speed = ob->speed*tics;\r
-\r
-       xmove = FixedByFrac(speed,costable[ob->angle]);\r
-       ymove = -FixedByFrac(speed,sintable[ob->angle]);\r
-\r
-       if (ShotClipMove(ob,xmove,ymove))\r
-       {\r
-               ob->state = &s_pshot_exp1;\r
-               ob->ticcount = ob->state->tictime;\r
-               return;\r
-       }\r
-\r
-       ob->tilex = ob->x >> TILESHIFT;\r
-       ob->tiley = ob->y >> TILESHIFT;\r
-\r
-// check for collision with wall\r
-//\r
-       if (tilemap[ob->tilex][ob->tiley])\r
-       {\r
-               SD_PlaySound (SHOOTWALLSND);\r
-               ob->state = &s_pshot_exp1;\r
-               ob->ticcount = s_pshot_exp1.tictime;\r
-               return;\r
-       }\r
-\r
-//\r
-//\r
-       if ( ob->xl <= player->xh\r
-       && ob->xh >= player->xl\r
-       && ob->yl <= player->yh\r
-       && ob->yh >= player->yl)\r
-       {\r
-               switch (ob->obclass)\r
-               {\r
-                       case eshotobj:\r
-                               TakeDamage (ESHOTDAMAGE);\r
-                       break;\r
-\r
-                       case mshotobj:\r
-                               TakeDamage (MSHOTDAMAGE);\r
-                       break;\r
-\r
-                       case gshotobj:\r
-                               TakeDamage (25);\r
-                       break;\r
-               }\r
-               ob->state = NULL;\r
-               return;\r
-       }\r
-\r
-// check for collision\r
-//\r
-       for (check = player->next; check; check=check->next)\r
-               if ((ob->flags & of_shootable) && ob->obclass != mageobj\r
-               && ob->xl <= check->xh\r
-               && ob->xh >= check->xl\r
-               && ob->yl <= check->yh\r
-               && ob->yh >= check->yl)\r
-               {\r
-                       switch (ob->obclass)\r
-                       {\r
-                               case eshotobj:\r
-                                       ShootActor (check,ESHOTDAMAGE);\r
-                               break;\r
-\r
-                               case mshotobj:\r
-                                       ShootActor (check,MSHOTDAMAGE);\r
-                               break;\r
-\r
-                               case gshotobj:\r
-                                       ShootActor (check,25);\r
-                               break;\r
-\r
-                               case pshotobj:\r
-                                       ShootActor (check,25);\r
-                               break;\r
-                       }\r
-                       ob->state = &s_pshot_exp1;\r
-                       ob->ticcount = s_pshot_exp1.tictime;\r
-                       return;\r
-               }\r
-}\r
-\r
-//-------------------------------------------------------------------------\r
-// AngleNearPlayer()\r
-//-------------------------------------------------------------------------\r
-int AngleNearPlayer(objtype *ob)\r
-{\r
-       int angle=-1;\r
-       int xdiff = ob->tilex-player->tilex;\r
-       int ydiff = ob->tiley-player->tiley;\r
-\r
-       if (ob->tiley == player->tiley)\r
-       {\r
-               if (ob->tilex < player->tilex)\r
-                       angle = 0;\r
-               else\r
-                       angle = 180;\r
-       }\r
-       else\r
-       if (ob->tilex == player->tilex)\r
-       {\r
-               if (ob->tiley < player->tiley)\r
-                       angle = 270;\r
-               else\r
-                       angle = 90;\r
-       }\r
-       else\r
-       if (xdiff == ydiff)\r
-               if (ob->tilex < player->tilex)\r
-               {\r
-                       if (ob->tiley < player->tiley)\r
-                               angle = 315;\r
-                       else\r
-                               angle = 45;\r
-               }\r
-               else\r
-               {\r
-                       if (ob->tiley < player->tiley)\r
-                               angle = 225;\r
-                       else\r
-                               angle = 135;\r
-               }\r
-\r
-       return(angle);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     EasyHitPoints\r
-//\r
-//     Checks to see if the player has selected the easy mode for playing.\r
-//     If so then the normal hit points are cut in half.\r
-//     This is when the object is spawned.\r
-//\r
-//     Parms\r
-//             NrmHitPts - the normal hit points\r
-//\r
-//     Returns\r
-//             Half of NrmHitPts\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-int EasyHitPoints(int NrmHitPts)\r
-{\r
-       if (EASYMODEON)                         // Wimpy, Wimpy, Wimpy!!!!!\r
-       {\r
-               return(NrmHitPts/4);\r
-       }\r
-       else\r
-               return(NrmHitPts);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//     EasyDoDamage\r
-//\r
-//     Checks to see if the player has selected the easy mode for playing.\r
-//     If so then the normal amount of damage is cut in half.\r
-//     This is called each time a monster does damage.\r
-//\r
-//     Parms\r
-//             Damage - the normal damage taken\r
-//\r
-//     Returns\r
-//             Half of Damage\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-int EasyDoDamage(int Damage)\r
-{\r
-       if (EASYMODEON)                         // Wimpy, Wimpy, Wimpy!!!!!\r
-               return(Damage/2);\r
-       else\r
-               return(Damage);\r
-}\r
-\r
diff --git a/C5_ACT2.C b/C5_ACT2.C
new file mode 100644 (file)
index 0000000..fd8633a
--- /dev/null
+++ b/C5_ACT2.C
@@ -0,0 +1,827 @@
+/* Catacomb Armageddon Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ */\r
+\r
+// C3_PLAY.C\r
+\r
+#include "DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+void SpawnSkeleton(int tilex, int tiley);\r
+\r
+#if 0\r
+#define MSHOTDAMAGE    2\r
+#define MSHOTSPEED     10000\r
+\r
+#define ESHOTDAMAGE    1\r
+#define ESHOTSPEED     5000\r
+\r
+#define SSHOTDAMAGE    3\r
+#define SSHOTSPEED     6500\r
+\r
+#define RANDOM_ATTACK 20\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+boolean ShootPlayer (objtype *ob, short obclass, short speed, statetype *state);\r
+void T_ShootPlayer(objtype *ob);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                               SKELETON IN WALL\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_WallSkeleton(objtype *ob);\r
+\r
+statetype s_wallskel = {0,40,T_WallSkeleton,&s_wallskel};\r
+statetype s_wallskel2 = {0,1,NULL,NULL};\r
+\r
+\r
+enum wskel_modes {ws_wall1,ws_wall2,ws_wall3,ws_exit};\r
+//enum wskel_modes {ws_wall1,ws_exit};\r
+\r
+#define wskel_mode     ob->temp1\r
+#define wskel_delay    ob->temp2\r
+#define wskel_base     ob->angle\r
+#define wskel_wallx    ob->hitpoints\r
+#define wskel_wally    ob->speed\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnWallSkeleton\r
+=\r
+===============\r
+*/\r
+void SpawnWallSkeleton(int tilex, int tiley)\r
+{\r
+       char xofs[] = {0,0,-1,+1};\r
+       char yofs[] = {-1,+1,0,0};\r
+\r
+       objtype *ob;\r
+       int wallx=tilex,wally=tiley,wallbase,wallmode,loop;\r
+       unsigned tile,current_delay;\r
+\r
+       for (loop=0; loop<4; loop++)\r
+       {\r
+               tile = *(mapsegs[0]+farmapylookup[tiley+yofs[loop]]+tilex+xofs[loop]);\r
+               switch (tile)\r
+               {\r
+//                     case WALL_SKELETON_CODE:\r
+//                     case WALL_SKELETON_CODE+1:\r
+//                     case WALL_SKELETON_CODE+2:\r
+//                             wallmode = ws_wall1+(tile-WALL_SKELETON_CODE);\r
+//                             wallbase = WALL_SKELETON_CODE;\r
+//                             goto foundtile;\r
+//                     break;\r
+\r
+                       case 66:\r
+                       case 68:\r
+//                     case 21:\r
+                               wallmode = ws_wall1+(tile-66);\r
+                               wallbase = 66;\r
+                               goto foundtile;\r
+//                     break;\r
+\r
+                       case 67:\r
+                       case 69:\r
+                               wallmode = ws_wall1+(tile-67);\r
+                               wallbase = 67;\r
+                               goto foundtile;\r
+//                     break;\r
+               }\r
+       }\r
+\r
+       return;\r
+foundtile:;\r
+\r
+       wallx += xofs[loop];\r
+       wally += yofs[loop];\r
+\r
+       SpawnNewObj(tilex,tiley,&s_wallskel,PIXRADIUS*35);\r
+       ob = new;\r
+       new->obclass = wallskelobj;\r
+       new->speed = 1900;\r
+       new->flags &= ~of_shootable;\r
+       new->hitpoints = 12;\r
+\r
+//     new->tilex = wallx;\r
+//     new->tiley = wally;\r
+       wskel_wallx = wallx;\r
+       wskel_wally = wally;\r
+       wskel_base = wallbase;\r
+       new->active = no;\r
+\r
+       wskel_mode = wallmode;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[wally]+wallx);\r
+       if (tile)\r
+               wskel_delay = (tile>>8)*30;\r
+       else\r
+       {\r
+               current_delay = (2*60)+random(4*60);\r
+               wskel_delay = zombie_base_delay+current_delay;\r
+               zombie_base_delay += current_delay;\r
+               if (zombie_base_delay > 8*60)\r
+                       zombie_base_delay = 0;\r
+       }\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_WallSkeleton\r
+=\r
+===============\r
+*/\r
+void T_WallSkeleton(objtype *ob)\r
+{\r
+       int x=wskel_wallx,y=wskel_wally;\r
+\r
+       wskel_delay -= realtics;\r
+       if (wskel_delay > 0)\r
+               return;\r
+\r
+       switch (wskel_mode)\r
+       {\r
+               case ws_wall2:\r
+                       if ((wskel_base == 66) || (wskel_base == 67))\r
+                               wskel_mode++;\r
+               case ws_wall1:\r
+               case ws_wall3:\r
+                       (unsigned)actorat[x][y]\r
+                               = tilemap[x][y]\r
+                               = *(mapsegs[0]+farmapylookup[y]+x)\r
+                               = wskel_base+(wskel_mode-ws_wall1);\r
+\r
+                       wskel_mode++;\r
+                       wskel_delay = (120);\r
+                       ob->active = always;\r
+               break;\r
+\r
+               case ws_exit:\r
+                       (unsigned)actorat[x][y]\r
+                               = tilemap[x][y]\r
+                               = *(mapsegs[0]+farmapylookup[y]+x)\r
+                               = 21;\r
+//                             = wskel_base;\r
+                       ob->tilex = ob->x >> TILESHIFT;\r
+                       ob->tiley = ob->y >> TILESHIFT;\r
+\r
+                       ob->obclass = skeletonobj;\r
+                       ob->speed = 2036;\r
+                       ob->flags |= of_shootable;\r
+                       ob->hitpoints = 12;\r
+                       ob->state = &s_skel_1;\r
+                       ob->ticcount = ob->state->tictime;\r
+               break;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                               SKELETONS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_Skeleton(objtype *ob);\r
+\r
+\r
+\r
+\r
+statetype s_skel_pause = {SKELETON_1PIC,40,NULL,&s_skel_2};\r
+\r
+statetype s_skel_1 = {SKELETON_1PIC,10,T_Skeleton,&s_skel_2};\r
+statetype s_skel_2 = {SKELETON_2PIC,10,T_Skeleton,&s_skel_3};\r
+statetype s_skel_3 = {SKELETON_3PIC,10,T_Skeleton,&s_skel_4};\r
+statetype s_skel_4 = {SKELETON_4PIC,10,T_Skeleton,&s_skel_1};\r
+\r
+statetype s_skel_attack1 = {SKELETON_ATTACK_1PIC,12,NULL,&s_skel_attack2};\r
+statetype s_skel_attack2 = {SKELETON_ATTACK_2PIC,12,NULL,&s_skel_attack3};\r
+statetype s_skel_attack3 = {SKELETON_ATTACK_3PIC,12,T_DoDamage,&s_skel_pause};\r
+\r
+statetype s_skel_ouch = {SKELETON_OUCHPIC,8,NULL,&s_skel_1};\r
+\r
+statetype s_skel_die1 = {SKELETON_OUCHPIC,18,NULL,&s_skel_die2};\r
+statetype s_skel_die2 = {SKELETON_DEATH_1PIC,18,NULL,&s_skel_die3};\r
+statetype s_skel_die3 = {SKELETON_DEATH_2PIC,18,NULL,&s_skel_die3};\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnSkeleton\r
+=\r
+===============\r
+*/\r
+void SpawnSkeleton(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_skel_1,PIXRADIUS*35);\r
+       new->obclass = skeletonobj;\r
+       new->speed = 2036;\r
+       new->flags |= of_shootable;\r
+       new->hitpoints = EasyHitPoints(12);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Skeleton\r
+=\r
+===============\r
+*/\r
+\r
+void T_Skeleton(objtype *ob)\r
+{\r
+       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
+       {\r
+               ob->state = &s_skel_attack1;\r
+               ob->ticcount = ob->state->tictime;\r
+               return;\r
+       }\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                               EYE\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_EyeMage (objtype *ob);\r
+boolean T_EyeShoot (objtype *ob, boolean eyeshot);\r
+void T_EyeShootPlayer (objtype *ob);\r
+\r
+extern statetype s_eye_shootplayer_1;\r
+extern statetype s_eye_shootplayer_2;\r
+\r
+statetype s_eye_pause = {EYE_WALK1PIC,40,NULL,&s_eye_2};\r
+\r
+statetype s_eye_1 = {EYE_WALK1PIC,20,T_EyeMage,&s_eye_2};\r
+statetype s_eye_2 = {EYE_WALK2PIC,20,T_EyeMage,&s_eye_3};\r
+statetype s_eye_3 = {EYE_WALK3PIC,20,T_EyeMage,&s_eye_4};\r
+statetype s_eye_4 = {EYE_WALK2PIC,20,T_EyeMage,&s_eye_1};\r
+statetype s_eye_shootplayer_1 = {EYE_SCOWLPIC,1,T_EyeShootPlayer,&s_eye_shootplayer_2};\r
+statetype s_eye_shootplayer_2 = {EYE_SCOWLPIC,20,NULL,&s_eye_1};\r
+\r
+statetype s_eye_ouch = {EYE_OUCH1PIC,8,NULL,&s_eye_ouch2};\r
+statetype s_eye_ouch2 = {EYE_OUCH2PIC,8,NULL,&s_eye_1};\r
+\r
+statetype s_eye_die1 = {EYE_DEATH1PIC,22,NULL,&s_eye_die2};\r
+statetype s_eye_die2 = {EYE_DEATH2PIC,22,NULL,&s_eye_die3};\r
+statetype s_eye_die3 = {EYE_DEATH2PIC,22,NULL,NULL};\r
+\r
+extern statetype s_eshot2;\r
+\r
+statetype s_eshot1 = {EYE_SHOT1PIC,8,&T_ShootPlayer,&s_eshot2};\r
+statetype s_eshot2 = {EYE_SHOT2PIC,8,&T_ShootPlayer,&s_eshot1};\r
+\r
+#define eye_mode       ob->temp1\r
+#define eye_delay      ob->temp2\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+// SpawnEye()\r
+//-------------------------------------------------------------------------\r
+void SpawnEye(int tilex, int tiley)\r
+{\r
+       objtype *ob;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_eye_1,PIXRADIUS*35);\r
+       ob = new;\r
+       new->obclass = eyeobj;\r
+       new->speed = 1200;\r
+       new->flags |= of_shootable;\r
+       new->hitpoints = EasyHitPoints(15);\r
+       eye_mode = em_other1;\r
+}\r
+\r
+\r
+//---------------------------------------------------------------------------\r
+// T_EyeShootPlayer\r
+//---------------------------------------------------------------------------\r
+void T_EyeShootPlayer (objtype *ob)\r
+{\r
+       ShootPlayer(ob,eshotobj,ESHOTSPEED,&s_eshot1);\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       SUCCUBUS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_Succubus (objtype *ob);\r
+void T_SuccubusShot (objtype *ob);\r
+\r
+extern statetype s_succubus_pause;\r
+extern statetype s_succubus_walk1;\r
+extern statetype s_succubus_walk2;\r
+extern statetype s_succubus_walk3;\r
+extern statetype s_succubus_walk4;\r
+extern statetype s_succubus_shot1;\r
+extern statetype s_succubus_attack1;\r
+extern statetype s_succubus_attack2;\r
+extern statetype s_succubus_attack3;\r
+extern statetype s_succubus_death1;\r
+extern statetype s_succubus_death2;\r
+\r
+statetype s_succubus_pause = {SUCCUBUS_WALK2PIC,10,NULL,&s_succubus_walk3};\r
+\r
+statetype s_succubus_walk1 = {SUCCUBUS_WALK1PIC,10,T_EyeMage,&s_succubus_walk2};\r
+statetype s_succubus_walk2 = {SUCCUBUS_WALK2PIC,10,T_EyeMage,&s_succubus_walk3};\r
+statetype s_succubus_walk3 = {SUCCUBUS_WALK3PIC,10,T_EyeMage,&s_succubus_walk4};\r
+statetype s_succubus_walk4 = {SUCCUBUS_WALK4PIC,10,T_EyeMage,&s_succubus_walk1};\r
+\r
+statetype s_succubus_attack1 = {SUCCUBUS_ATTACK1PIC,15,NULL,&s_succubus_attack2};\r
+statetype s_succubus_attack2 = {SUCCUBUS_ATTACK1PIC,-1,T_SuccubusShot,&s_succubus_attack3};\r
+statetype s_succubus_attack3 = {SUCCUBUS_ATTACK2PIC,15,NULL,&s_succubus_pause};\r
+\r
+statetype s_succubus_ouch = {SUCCUBUS_OUCHPIC,15,NULL,&s_succubus_walk1};\r
+\r
+statetype s_succubus_death1 = {SUCCUBUS_DEATH1PIC,55,NULL,&s_succubus_death2};\r
+statetype s_succubus_death2 = {SUCCUBUS_DEATH2PIC,20,NULL,&s_succubus_death2};\r
+\r
+statetype s_succubus_shot1 = {SUCCUBUS_SHOT1PIC,12,&T_ShootPlayer,&s_succubus_shot1};\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnSuccubus\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnSuccubus (int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_succubus_walk1,PIXRADIUS*30);\r
+       new->obclass = succubusobj;\r
+       new->speed = 2500;\r
+       new->flags |= of_shootable;\r
+       new->hitpoints = EasyHitPoints(12);\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_SuccubusShot\r
+=\r
+===============\r
+*/\r
+\r
+void T_SuccubusShot (objtype *ob)\r
+{\r
+       ShootPlayer(ob,sshotobj,ob->temp1 ? MSHOTSPEED : SSHOTSPEED,&s_succubus_shot1);\r
+//     ob->state = &s_succubus_attack3;\r
+//     ob->ticcount = ob->temp1 ? 7 : ob->state->tictime;\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       MAGE\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+void T_MageShoot (objtype *ob);\r
+\r
+extern statetype s_magepause;\r
+\r
+extern statetype s_mage1;\r
+extern statetype s_mage2;\r
+\r
+extern statetype s_mageattack1;\r
+extern statetype s_mageattack2;\r
+extern statetype s_mageattack3;\r
+\r
+extern statetype s_mageouch;\r
+\r
+extern statetype s_magedie1;\r
+extern statetype s_magedie2;\r
+\r
+\r
+statetype s_magepause = {MAGE1PIC,10,NULL,&s_mage2};\r
+\r
+statetype s_mage1 = {MAGE1PIC,20,T_EyeMage,&s_mage2};\r
+statetype s_mage2 = {MAGE2PIC,20,T_EyeMage,&s_mage1};\r
+\r
+//statetype s_mageattack1 = {MAGEATTACKPIC,20,NULL,&s_mageattack2};\r
+//statetype s_mageattack2 = {MAGEATTACKPIC,-1,T_MageShoot,&s_mageattack3};\r
+statetype s_mageattack3 = {MAGEATTACKPIC,30,NULL,&s_magepause};\r
+\r
+statetype s_mageouch = {MAGEOUCHPIC,10,NULL,&s_mage1};\r
+\r
+statetype s_magedie1 = {MAGEDIE1PIC,20,NULL,&s_magedie2};\r
+statetype s_magedie2 = {MAGEDIE2PIC,0,NULL,&s_magedie2};\r
+\r
+\r
+statetype s_mshot1 = {PSHOT1PIC,8,&T_ShootPlayer,&s_mshot2};\r
+statetype s_mshot2 = {PSHOT2PIC,8,&T_ShootPlayer,&s_mshot1};\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnMage\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnMage (int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_mage1,PIXRADIUS*35);\r
+       new->obclass = mageobj;\r
+       new->speed = 3072;\r
+       new->flags |= of_shootable;\r
+       new->hitpoints = EasyHitPoints(12);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_EyeMage\r
+=\r
+= **********\r
+= ***NOTE*** This routine controls the thinks for the Eye, Mage, and Succubus.\r
+= **********\r
+=\r
+===============\r
+*/\r
+\r
+void T_EyeMage (objtype *ob)\r
+{\r
+       fixed tempx,tempy;\r
+       unsigned temp_tilex,temp_tiley;\r
+       int angle;\r
+\r
+       eye_delay -= realtics;\r
+       if (eye_delay < 0)\r
+       {\r
+               eye_mode = random(em_dummy);\r
+               eye_delay = (10*60);\r
+       }\r
+\r
+       tempx = player->x;\r
+       tempy = player->y;\r
+       temp_tilex = player->tilex;\r
+       temp_tiley = player->tiley;\r
+\r
+\r
+       switch (eye_mode)\r
+       {\r
+               case em_other1:\r
+               case em_other2:\r
+               case em_other3:\r
+               case em_other4:\r
+                       player->x = ((long)other_x[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
+                       player->y = ((long)other_y[eye_mode]<<TILESHIFT)+TILEGLOBAL/2;\r
+                       player->tilex = other_x[eye_mode];\r
+                       player->tiley = other_y[eye_mode];\r
+               break;\r
+       }\r
+\r
+       if (Chase(ob,true))\r
+               eye_delay = 0;\r
+\r
+       player->x = tempx;\r
+       player->y = tempy;\r
+       player->tilex = temp_tilex;\r
+       player->tiley = temp_tiley;\r
+\r
+\r
+       if (ob->obclass == mageobj)                                     // do the mage shot\r
+       {\r
+               if (!random(10))\r
+                       if (ShootPlayer(ob,mshotobj,MSHOTSPEED,&s_mshot1))\r
+                       {\r
+                               ob->state = &s_mageattack3;\r
+                               ob->ticcount = ob->state->tictime;\r
+                       }\r
+       }\r
+       else\r
+               if (ob->obclass == succubusobj)                         // do the succubus shot\r
+               {\r
+                       angle = AngleNearPlayer(ob);        // make sure angle is correct\r
+                                                                                                                       //          - see AngleNearPlayer\r
+                       if (!random(5) && (angle != -1))   // if correct angle and random # attack\r
+                       {\r
+                               ob->state = &s_succubus_attack1;    // change state to attack\r
+                               ob->ticcount = ob->state->tictime;      // init ticcount - otherwise\r
+                       }                                                                                                       //  object may get hung in a\r
+               }                                                                                                               //  endless state\r
+\r
+               else\r
+               {\r
+                       angle = AngleNearPlayer(ob);                    // do the eye shot\r
+\r
+                       if (!random(2) && (angle != -1))\r
+                       {\r
+                               ob->state = &s_eye_shootplayer_1;\r
+                               ob->ticcount = ob->state->tictime;\r
+                       }\r
+               }\r
+\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       BUNNY\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_HarmlessBunnyWalk(objtype *ob);\r
+void T_Bunny(objtype *ob);\r
+\r
+extern statetype s_bunny_left1;\r
+extern statetype s_bunny_left2;\r
+extern statetype s_bunny_left3;\r
+extern statetype s_bunny_right1;\r
+extern statetype s_bunny_right2;\r
+extern statetype s_bunny_right3;\r
+extern statetype s_bunny_meta1;\r
+extern statetype s_bunny_meta2;\r
+extern statetype s_bunny_walk1;\r
+extern statetype s_bunny_walk2;\r
+extern statetype s_bunny_attack1;\r
+extern statetype s_bunny_attack2;\r
+extern statetype s_bunny_pause;\r
+extern statetype s_bunny_death1;\r
+extern statetype s_bunny_death2;\r
+extern statetype s_bunny_death3;\r
+\r
+statetype s_bunny_left1 = {BUNNY_LEFT1PIC, 55, NULL, &s_bunny_left2};\r
+statetype s_bunny_left2 = {BUNNY_LEFT1PIC, 10, T_HarmlessBunnyWalk, &s_bunny_left1};\r
+statetype s_bunny_left3 = {BUNNY_LEFT2PIC, 30, NULL, &s_bunny_left1};\r
+\r
+statetype s_bunny_right1 = {BUNNY_RIGHT1PIC, 55, NULL, &s_bunny_right2};\r
+statetype s_bunny_right2 = {BUNNY_RIGHT1PIC, 10, T_HarmlessBunnyWalk, &s_bunny_right1};\r
+statetype s_bunny_right3 = {BUNNY_RIGHT2PIC, 30, NULL, &s_bunny_right1};\r
+\r
+statetype s_bunny_meta1 = {BUNNY_META1PIC, 30, NULL, &s_bunny_meta2};\r
+statetype s_bunny_meta2 = {BUNNY_META2PIC, 30, NULL, &s_bunny_walk1};\r
+\r
+statetype s_bunny_walk1 = {BUNNY_WALK1PIC, 25, T_Bunny, &s_bunny_walk2};\r
+statetype s_bunny_walk2 = {BUNNY_WALK2PIC, 25, T_Bunny, &s_bunny_walk1};\r
+\r
+statetype s_bunny_attack1 = {BUNNY_WALK1PIC, 25, NULL, &s_bunny_attack2};\r
+statetype s_bunny_attack2 = {BUNNY_WALK2PIC, 25, T_DoDamage, &s_bunny_walk1};\r
+\r
+statetype s_bunny_ouch = {BUNNY_OUCHPIC, 30, NULL, &s_bunny_pause};\r
+statetype s_bunny_pause = {BUNNY_WALK1PIC, 50, T_Bunny, &s_bunny_walk2};\r
+\r
+statetype s_bunny_death1 = {BUNNY_OUCHPIC, 40, NULL, &s_bunny_death2};\r
+statetype s_bunny_death2 = {BUNNY_DEATH1PIC, 50, NULL, &s_bunny_death3};\r
+statetype s_bunny_death3 = {BUNNY_DEATH2PIC, 20, NULL, &s_bunny_death3};\r
+\r
+\r
+#define bunny_dir_hop  ob->temp1\r
+#define bunny_delay    ob->temp2\r
+#define LEFTSIDE       0x8             // 1=left 0=right --side showing\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnBunny\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnBunny (int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_bunny_left1,PIXRADIUS*35);\r
+       new->obclass =  hbunnyobj;\r
+       new->speed = 1947;\r
+       new->temp1 = (random(3))+2;\r
+       new->temp2 = random(30);\r
+       new->flags &= ~of_shootable;\r
+       new->flags |= LEFTSIDE;                         //left side showing}\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_HarmlessBunnyWalk\r
+=\r
+===============\r
+*/\r
+\r
+\r
+void T_HarmlessBunnyWalk(objtype *ob)\r
+{\r
+       int valid_dir[8][2] = {{6,5}, {7,6}, {4,7}, {5,4}, {3,2}, {0,3}, {1,0}, {2,1}};\r
+       long move;\r
+       dirtype player_dir;\r
+       fixed old_x, old_y;\r
+       unsigned old_tilex, old_tiley;\r
+       long old_distance;\r
+\r
+\r
+       ob->temp2 -= realtics;\r
+       if (ob->temp2 <= 0)\r
+       {\r
+               if (CheckHandAttack(ob))\r
+               {\r
+                       ob->temp2 = -1;\r
+                       return;\r
+               }\r
+\r
+               actorat[ob->tilex][ob->tiley] = 0;\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->distance = TILEGLOBAL;\r
+               ob->state = &s_bunny_meta1;\r
+               ob->ticcount = ob->state->tictime;\r
+               ob->obclass = bunnyobj;\r
+               ob->flags |= of_shootable;\r
+               ob->hitpoints = EasyHitPoints(10);\r
+               ob->dir = nodir;\r
+               ChaseThink(ob,true);                                    // JTR - testing..\r
+               return;\r
+       }\r
+\r
+       // The direction of the player isn't updated so it must be\r
+       // calculated.  This is done so the correct side (left/right)\r
+       // of the bunny will be showed.\r
+\r
+       if ((player->angle > 337) || (player->angle <= 22))\r
+               player_dir = east;\r
+       else\r
+               if (player->angle <= 67)\r
+                       player_dir = northeast;\r
+               else\r
+                       if (player->angle <= 112)\r
+                player_dir = north;\r
+                       else\r
+                if (player->angle <= 157)\r
+                        player_dir = northwest;\r
+                else\r
+                        if (player->angle <= 202)\r
+                                player_dir = west;\r
+                        else\r
+                                if (player->angle <= 247)\r
+                         player_dir = southwest;\r
+                                else\r
+                        if (player->angle <= 292)\r
+                                player_dir = south;\r
+                        else\r
+                                if (player->angle <= 337)\r
+                                        player_dir = southeast;\r
+       if (ob->temp1)\r
+               ob->temp1--;\r
+       else\r
+               ob->temp1 = (random(3))+2;\r
+       if (ob->flags & LEFTSIDE)\r
+       {\r
+               if (ob->temp1)\r
+               {\r
+                       if (valid_dir[player_dir][0] != ob->dir)\r
+                       {\r
+                               ob->dir = valid_dir[player_dir][0];\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       ob->state = &s_bunny_right1;\r
+                       ob->ticcount = ob->state->tictime;\r
+                       ob->flags &= ~LEFTSIDE;\r
+                       ob->dir = valid_dir[player_dir][1];\r
+                       return;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               if (ob->temp1)\r
+               {\r
+                       if (valid_dir[player_dir][1] != ob->dir)\r
+                       {\r
+                               ob->dir = valid_dir[player_dir][1];\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       ob->state = &s_bunny_left1;\r
+                       ob->ticcount = ob->state->tictime;\r
+                       ob->flags |= LEFTSIDE;\r
+                       ob->dir = valid_dir[player_dir][2];\r
+                       return;\r
+               }\r
+       }\r
+\r
+       move = ob->speed*tics;\r
+\r
+       do\r
+       {\r
+               old_distance    = ob->distance;\r
+               old_x           = ob->x;\r
+               old_y           = ob->y;\r
+               old_tilex       = ob->tilex;\r
+               old_tiley       = ob->tiley;\r
+\r
+               MoveObj (ob, move);\r
+\r
+               ob->tilex = ob->x >> TILESHIFT;\r
+               ob->tiley = ob->y >> TILESHIFT;\r
+\r
+               if (ob->tilex == old_tilex && ob->tiley == old_tiley)\r
+               {\r
+                       break;\r
+               }\r
+               else\r
+                       if (actorat[ob->tilex][ob->tiley] == 0)\r
+                       {\r
+                               actorat[old_tilex][old_tiley] = 0;\r
+                               actorat[ob->tilex][ob->tiley] = ob;\r
+                               ob->distance = TILEGLOBAL;\r
+                       }\r
+                       else\r
+                       {\r
+                               ob->distance    = old_distance;\r
+                               ob->x           = old_x;\r
+                               ob->y           = old_y;\r
+                               ob->tilex       = old_tilex;\r
+                               ob->tiley       = old_tiley;\r
+                               return;\r
+                       }\r
+\r
+        } while (0);\r
+\r
+       CalcBounds (ob);\r
+\r
+       if (ob->flags & LEFTSIDE)\r
+               ob->state = &s_bunny_left3;\r
+       else\r
+               ob->state = &s_bunny_right3;\r
+       ob->ticcount = ob->state->tictime;\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_Bunny\r
+=\r
+===============\r
+*/\r
+\r
+void T_Bunny(objtype *ob)\r
+{\r
+       if (Chase (ob, true) || (random(1000)<RANDOM_ATTACK))\r
+       {\r
+               ob->state = &s_bunny_attack1;\r
+               ob->ticcount = ob->state->tictime;\r
+               return;\r
+       }\r
+}\r
diff --git a/C5_ACT3.C b/C5_ACT3.C
new file mode 100644 (file)
index 0000000..79378d4
--- /dev/null
+++ b/C5_ACT3.C
@@ -0,0 +1,1218 @@
+/* Catacomb Armageddon Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ */\r
+\r
+// C3_PLAY.C\r
+\r
+#include "DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+#if 0\r
+#define MSHOTDAMAGE    2\r
+#define MSHOTSPEED     10000\r
+\r
+#define ESHOTDAMAGE    1\r
+#define ESHOTSPEED     5000\r
+\r
+#define SSHOTDAMAGE    3\r
+#define SSHOTSPEED     6500\r
+\r
+#define RANDOM_ATTACK 20\r
+#endif\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                GLOBAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+boolean ShootPlayer (objtype *ob, short obclass, short speed, statetype *state);\r
+void T_ShootPlayer(objtype *ob);\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL VARIABLES\r
+\r
+=============================================================================\r
+*/\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                               RED DEMON\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_RedDemon (objtype *ob);\r
+void T_RedDemonCheckCnt (objtype *ob);\r
+\r
+extern statetype s_red_demonpause;\r
+\r
+extern statetype s_red_demon1;\r
+extern statetype s_red_demon2;\r
+extern statetype s_red_demon3;\r
+extern statetype s_red_demon4;\r
+\r
+extern statetype s_red_demonattack1;\r
+extern statetype s_red_demonattack2;\r
+extern statetype s_red_demonattack3;\r
+\r
+extern statetype s_red_demonouch;\r
+\r
+extern statetype s_red_demondie1;\r
+extern statetype s_red_demondie2;\r
+extern statetype s_red_demondie3;\r
+extern statetype s_red_demondie4;\r
+\r
+statetype s_red_demonpause = {RED_DEMON1PIC,30,NULL,&s_red_demon2};\r
+\r
+statetype s_red_demon1 = {RED_DEMON1PIC,20,T_RedDemon,&s_red_demon2};\r
+statetype s_red_demon2 = {RED_DEMON2PIC,20,T_RedDemon,&s_red_demon3};\r
+statetype s_red_demon3 = {RED_DEMON3PIC,20,T_RedDemon,&s_red_demon4};\r
+statetype s_red_demon4 = {RED_DEMON4PIC,20,T_RedDemon,&s_red_demon1};\r
+\r
+statetype s_red_demonattack1 = {RED_DEMONATTACK1PIC,20,NULL,&s_red_demonattack2};\r
+statetype s_red_demonattack2 = {RED_DEMONATTACK2PIC,20,NULL,&s_red_demonattack3};\r
+statetype s_red_demonattack3 = {RED_DEMONATTACK3PIC,30,T_DoDamage,&s_red_demon2};\r
+\r
+statetype s_red_demonouch = {RED_DEMONOUCHPIC,30,NULL,&s_red_demon1};\r
+\r
+statetype s_red_demondie1 = {RED_DEMONOUCHPIC,9,NULL,&s_red_demondie2};\r
+statetype s_red_demondie2 = {RED_DEMONDIE1PIC,9,T_RedDemonCheckCnt,&s_red_demondie1};\r
+statetype s_red_demondie3 = {RED_DEMONDIE2PIC,20,NULL,&s_red_demondie4};\r
+statetype s_red_demondie4 = {RED_DEMONDIE3PIC,10,NULL,&s_red_demondie4};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnRedDemon\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnRedDemon (int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_red_demon1,PIXRADIUS*35);\r
+       new->obclass = reddemonobj;\r
+       new->speed = 2048;\r
+       new->flags |= of_shootable;\r
+       new->hitpoints = EasyHitPoints(50);\r
+       new->temp1 = 25;\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_RedDemon\r
+=\r
+===============\r
+*/\r
+\r
+void T_RedDemon (objtype *ob)\r
+{\r
+       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
+       {\r
+               ob->state = &s_red_demonattack1;\r
+               ob->ticcount = ob->state->tictime;\r
+               return;\r
+       }\r
+}\r
+\r
+/*\r
+===============\r
+=\r
+= T_RedDemonCheckCnt\r
+=\r
+===============\r
+*/\r
+\r
+void T_RedDemonCheckCnt (objtype *ob)\r
+{\r
+       ob->temp1--;\r
+       if (!ob->temp1)\r
+       {\r
+               ob->state = &s_red_demondie3;\r
+               ob->ticcount = ob->state->tictime;\r
+       }\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       GRELMINAR\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+void T_Grelminar (objtype *ob);\r
+void T_GrelminarShoot (objtype *ob);\r
+void T_Grelm_DropKey(objtype *ob);\r
+\r
+extern statetype s_grelpause;\r
+\r
+extern statetype s_grel1;\r
+extern statetype s_grel2;\r
+\r
+extern statetype s_grelattack1;\r
+extern statetype s_grelattack2;\r
+extern statetype s_grelattack3;\r
+\r
+extern statetype s_grelouch;\r
+\r
+extern statetype s_greldie1;\r
+extern statetype s_greldie2;\r
+extern statetype s_greldie3;\r
+extern statetype s_greldie4;\r
+extern statetype s_greldie5;\r
+extern         statetype s_greldie5a;\r
+extern statetype s_greldie6;\r
+\r
+\r
+statetype s_grelpause = {GREL1PIC,50,NULL,&s_grel2};\r
+\r
+statetype s_grel1 = {GREL1PIC,20,T_Grelminar,&s_grel2};\r
+statetype s_grel2 = {GREL2PIC,20,T_Grelminar,&s_grel1};\r
+\r
+//statetype s_grelattack1 = {GRELATTACKPIC,20,NULL,&s_grelattack2};\r
+//statetype s_grelattack2 = {GRELATTACKPIC,-1,T_GrelminarShoot,&s_grelattack3};\r
+statetype s_grelattack3 = {GRELATTACKPIC,30,NULL,&s_grelpause};\r
+\r
+statetype s_grelouch = {GRELHITPIC,6,NULL,&s_grel1};\r
+\r
+statetype s_greldie1 = {GRELDIE1PIC,22,NULL,&s_greldie2};\r
+statetype s_greldie2 = {GRELDIE2PIC,22,NULL,&s_greldie3};\r
+statetype s_greldie3 = {GRELDIE3PIC,22,NULL,&s_greldie4};\r
+statetype s_greldie4 = {GRELDIE4PIC,22,NULL,&s_greldie5};\r
+statetype s_greldie5 = {GRELDIE5PIC,22,NULL,&s_greldie5a};\r
+statetype s_greldie5a = {GRELDIE5PIC,1,T_Grelm_DropKey,&s_greldie6};\r
+statetype s_greldie6 = {GRELDIE6PIC,0,NULL,&s_greldie6};\r
+\r
+\r
+extern statetype s_gshot1;\r
+\r
+statetype s_gshot1 = {SKULL_SHOTPIC,8,T_ShootPlayer,&s_gshot1};\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnGrelminar\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnGrelminar (int tilex, int tiley)\r
+{\r
+       unsigned Grel_Hard;\r
+       unsigned DropKey;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_grel1,PIXRADIUS*35);\r
+       new->obclass = grelmobj;\r
+       new->speed = 2048;\r
+       new->flags |= of_shootable;\r
+\r
+       //\r
+       // if Grelminar is to drop a key the info-plane byte to the right\r
+       //              should have a 1 in the highbyte, else he will not drop the key.\r
+       //\r
+       DropKey = *(mapsegs[2]+farmapylookup[tiley]+tilex+1);\r
+       if (DropKey)\r
+               new->temp1 = DropKey>>8;\r
+       else\r
+               new->temp1 = 0;\r
+\r
+       //\r
+       // The info-plane byte below Grelminar will determine how powerful\r
+       //              Grelminar is.  If nothing is there, he is the most powerful.\r
+       //                      -- affected are the hit points and the shot damage.\r
+       //      The hit points are controlled here, the shot damage is controlled\r
+       //      within the spawning of the shot.  See ShootPlayer for more info.\r
+       //\r
+       Grel_Hard = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (Grel_Hard)\r
+       {\r
+               new->temp2 = Grel_Hard>>8;\r
+               new->hitpoints = EasyHitPoints((new->temp2 * 10));\r
+       }\r
+       else\r
+               new->hitpoints = EasyHitPoints(100);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Grelminar\r
+=\r
+===============\r
+*/\r
+\r
+void T_Grelminar (objtype *ob)\r
+{\r
+       Chase (ob,false);\r
+\r
+       if (!random(10))\r
+               if (ShootPlayer(ob,gshotobj,ob->temp2,&s_gshot1))\r
+               {\r
+                       ob->state = &s_grelattack3;\r
+                       ob->ticcount = ob->state->tictime;\r
+               }\r
+       if (CheckHandAttack(ob))\r
+               TakeDamage (ob->temp2*3);\r
+\r
+}\r
+\r
+\r
+//=================================\r
+//\r
+// T_Grelm_DropKey\r
+//\r
+//=================================\r
+void T_Grelm_DropKey(objtype *ob)\r
+{\r
+       if (!(ob->temp1))\r
+       {\r
+               ob->state = NULL;\r
+               return;\r
+       }\r
+\r
+       SpawnBonus(ob->tilex,ob->tiley,B_RKEY);\r
+       SD_PlaySound(GRELM_DEADSND);\r
+       ob->temp1 = false;\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       BAT\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_Bat (objtype *ob);\r
+void T_BatPast (objtype *ob);\r
+\r
+extern statetype s_bat1;\r
+extern statetype s_bat2;\r
+extern statetype s_bat3;\r
+extern statetype s_bat4;\r
+\r
+extern statetype s_batdie1;\r
+extern statetype s_batdie2;\r
+\r
+\r
+statetype s_bat1 = {BAT1PIC,6,T_Bat,&s_bat2};\r
+statetype s_bat2 = {BAT2PIC,6,T_Bat,&s_bat3};\r
+statetype s_bat3 = {BAT3PIC,6,T_Bat,&s_bat4};\r
+statetype s_bat4 = {BAT4PIC,6,T_Bat,&s_bat1};\r
+\r
+statetype s_batpast = {BAT4PIC,80,T_BatPast,&s_bat1};\r
+\r
+statetype s_batdie1 = {BATDIE1PIC,18,NULL,&s_batdie2};\r
+statetype s_batdie2 = {BATDIE2PIC,18,NULL,NULL};\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnBat\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnBat (int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_bat1,PIXRADIUS*35);\r
+       new->obclass = batobj;\r
+       new->flags |= of_shootable;\r
+\r
+       new->hitpoints = 1;\r
+       new->speed = 2000;\r
+}\r
+\r
+\r
+/*\r
+==================================\r
+=\r
+= BatChaseThink\r
+=\r
+==================================\r
+*/\r
+\r
+void BatChaseThink (objtype *obj)\r
+{\r
+       int deltax,deltay;\r
+\r
+       deltax=player->tilex - obj->tilex;\r
+       deltay=player->tiley - obj->tiley;\r
+\r
+       if (deltax>0)\r
+               deltax = 2;\r
+       else if (deltax<0)\r
+               deltax = 0;\r
+       else deltax = 1;\r
+\r
+       if (deltay>0)\r
+               deltay = 2;\r
+       else if (deltay<0)\r
+               deltay = 0;\r
+       else deltay = 1;\r
+\r
+       obj->dir = dirtable[deltay*3+deltax];\r
+       if (Walk(obj))\r
+               return;\r
+\r
+       obj->dir = dirtable[3+deltax];\r
+       if (Walk(obj))\r
+               return;\r
+\r
+       obj->dir = dirtable[deltay*3+1];\r
+       if (Walk(obj))\r
+               return;\r
+\r
+       obj->dir = nodir;\r
+}\r
+\r
+\r
+void BatRunThink (objtype *obj)\r
+{\r
+       int deltax,deltay;\r
+\r
+       deltax=player->tilex - obj->tilex;\r
+       deltay=player->tiley - obj->tiley;\r
+\r
+       if (deltax>=0)\r
+               deltax = 0;\r
+       else\r
+               deltax = 2;\r
+\r
+       if (deltay>=0)\r
+               deltay = 0;\r
+       else\r
+               deltay = 2;\r
+\r
+       obj->dir = dirtable[deltay*3+deltax];\r
+       if (Walk(obj))\r
+               return;\r
+\r
+       obj->dir = dirtable[3+deltax];\r
+       if (Walk(obj))\r
+               return;\r
+\r
+       obj->dir = dirtable[deltay*3+1];\r
+       Walk(obj);\r
+}\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_Bat\r
+=\r
+===============\r
+*/\r
+\r
+void T_Bat (objtype *ob)\r
+{\r
+       long move;\r
+       long deltax,deltay,size;\r
+\r
+       move = ob->speed*tics;\r
+       size = (long)ob->size + player->size + move;\r
+\r
+\r
+       do\r
+       {\r
+               deltax = ob->x - player->x;\r
+               deltay = ob->y - player->y;\r
+\r
+               if (deltax <= size && deltax >= -size\r
+               && deltay <= size && deltay >= -size && !ob->temp1)\r
+               {\r
+                       TakeDamage (4);\r
+                       ob->temp1 = 2;\r
+               }\r
+\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+\r
+               actorat[ob->tilex][ob->tiley] = 0;      // pick up marker from goal\r
+               if (ob->dir == nodir)\r
+                       ob->dir = north;\r
+\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+               move -= ob->distance;\r
+\r
+               if (ob->temp1)\r
+               {\r
+                       Walk (ob);                              // go straight\r
+                       if (!--ob->temp1)\r
+                       {\r
+                               ob->state = &s_batpast;\r
+                               ob->ticcount = ob->state->tictime;\r
+                       }\r
+               }\r
+               else\r
+                       BatChaseThink (ob);             // head towards player\r
+\r
+               actorat[ob->tilex][ob->tiley] = ob;     // set down a new goal marker\r
+       } while (0);    // just once\r
+       CalcBounds (ob);\r
+}\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= T_BatPast\r
+=\r
+===============\r
+*/\r
+\r
+void T_BatPast (objtype *ob)\r
+{\r
+       long move;\r
+       long deltax,deltay,size;\r
+\r
+       move = ob->speed*tics;\r
+\r
+       do\r
+       {\r
+               if (move < ob->distance)\r
+               {\r
+                       MoveObj (ob,move);\r
+                       break;\r
+               }\r
+               actorat[ob->tilex][ob->tiley] = 0;      // pick up marker from goal\r
+\r
+               ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;\r
+               ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;\r
+               move -= ob->distance;\r
+\r
+               BatRunThink (ob);\r
+\r
+               actorat[ob->tilex][ob->tiley] = ob;     // set down a new goal marker\r
+       } while (0);    //(move)\r
+       CalcBounds (ob);\r
+}\r
+\r
+\r
+void T_ChaseThink(objtype *obj);\r
+void T_AwakeThink(objtype *obj);\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       GODESS\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_Godess (objtype *ob);\r
+\r
+\r
+extern statetype s_godesspause;\r
+\r
+extern statetype s_godess_statue1;\r
+extern statetype s_godess_statue2;\r
+\r
+extern statetype s_godess1;\r
+extern statetype s_godess2;\r
+extern statetype s_godess3;\r
+\r
+extern statetype s_godessattack1;\r
+extern statetype s_godessattack2;\r
+extern statetype s_godessattack3;\r
+\r
+extern statetype s_godessouch;\r
+\r
+extern statetype s_godessdie1;\r
+extern statetype s_godessdie2;\r
+extern statetype s_godessdie3;\r
+\r
+\r
+statetype s_godesspause = {GODESS_WALK1PIC,25,NULL,&s_godess2};\r
+\r
+statetype s_godess_statue1 = {GODESS_STATUEPIC,20,T_ChaseThink,&s_godess_statue1};\r
+statetype s_godess_statue2 = {GODESS_STATUEPIC,1,T_AwakeThink,&s_godess1};\r
+\r
+statetype s_godess1 = {GODESS_WALK1PIC,20,T_ChaseThink,&s_godess2};\r
+statetype s_godess2 = {GODESS_WALK2PIC,20,T_ChaseThink,&s_godess3};\r
+statetype s_godess3 = {GODESS_WALK3PIC,20,T_ChaseThink,&s_godess1};\r
+\r
+statetype s_godessattack1 = {GODESS_ATTACK1PIC,10,NULL,&s_godessattack2};//20\r
+statetype s_godessattack2 = {GODESS_ATTACK2PIC,8,NULL,&s_godessattack3};//20\r
+statetype s_godessattack3 = {GODESS_ATTACK3PIC,10,T_DoDamage,&s_godesspause};//30\r
+\r
+statetype s_godessouch = {GODESS_OUCHPIC,10,NULL,&s_godess1};\r
+\r
+statetype s_godessdie1 = {GODESS_DEATH1PIC,65,NULL,&s_godessdie2};\r
+statetype s_godessdie2 = {GODESS_DEATH2PIC,30,NULL,&s_godessdie2};\r
+\r
+\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnGodess\r
+=\r
+===============\r
+*/\r
+\r
+void SpawnGodess (int tilex, int tiley)\r
+{\r
+       objtype *ob;\r
+       short current_zombie_delay;\r
+       unsigned tile;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_godess_statue1,PIXRADIUS*35);\r
+       ob = new;\r
+       zombie_mode = zm_wait_for_dark;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (tile)\r
+               zombie_delay = (tile>>8)*30;\r
+       else\r
+       {\r
+               current_zombie_delay = (2*60)+random(4*60);\r
+               zombie_delay = zombie_base_delay+current_zombie_delay;\r
+               zombie_base_delay += current_zombie_delay;\r
+               if (zombie_base_delay > 8*60)\r
+                       zombie_base_delay = 0;\r
+       }\r
+\r
+       new->obclass = realsolidobj;//godessobj;\r
+       new->speed = 3000;\r
+       new->flags |= of_shootable;\r
+       new->flags &= ~of_tree;\r
+//     new->hitpoints = EasyHitPoints(10);\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       ANT\r
+\r
+=============================================================================\r
+*/\r
+\r
+void T_Ant(objtype *ob);\r
+\r
+statetype s_ant_wait = {ANT_EGG1PIC,10,T_ChaseThink,&s_ant_wait};\r
+\r
+statetype s_ant_egg = {ANT_EGG2PIC,45,T_AwakeThink,&s_ant_walk1};\r
+\r
+statetype s_ant_walk1 = {ANT_WALK1PIC,20,T_ChaseThink,&s_ant_walk2};\r
+statetype s_ant_walk2 = {ANT_WALK2PIC,20,T_ChaseThink,&s_ant_walk3};\r
+statetype s_ant_walk3 = {ANT_WALK3PIC,20,T_ChaseThink,&s_ant_walk1};\r
+\r
+statetype s_ant_attack1 = {ANT_ATTACKPIC,20,NULL,&s_ant_pause};\r
+\r
+statetype s_ant_pause  = {ANT_WALK2PIC,15,T_DoDamage,&s_ant_walk1};\r
+\r
+statetype s_ant_ouch = {ANT_WALK1PIC,15,NULL,&s_ant_walk1};\r
+\r
+statetype s_ant_die1 = {ANT_DEATH1PIC,40,NULL,&s_ant_die2};\r
+statetype s_ant_die2 = {ANT_DEATH2PIC,10,NULL,&s_ant_die3};\r
+statetype s_ant_die3 = {ANT_DEATH3PIC,10,NULL,&s_ant_die2};\r
+\r
+#define ant_mode       ob->temp1\r
+#define ant_delay      ob->temp2\r
+\r
+/*\r
+===============\r
+=\r
+= SpawnAnt\r
+=\r
+===============\r
+*/\r
+void SpawnAnt(int tilex, int tiley)\r
+{\r
+       objtype *ob;\r
+       unsigned tile;\r
+       SpawnNewObj(tilex,tiley,&s_ant_wait,PIXRADIUS*35);\r
+       ob = new;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (tile)\r
+               ant_delay = (tile>>8)*30;\r
+       else\r
+               ant_delay = 2*60+random(5*60);\r
+\r
+       ant_mode = zm_wait_for_dark;\r
+\r
+       new->obclass = antobj;\r
+       new->speed = 1900;\r
+       new->flags &= ~of_shootable;\r
+       new->hitpoints = EasyHitPoints(15);\r
+}\r
+\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                       ZOMBIE\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern statetype s_zombie_rise1;\r
+extern statetype s_zombie_rise2;\r
+extern statetype s_zombie_rise3;\r
+extern statetype s_zombie_rise4;\r
+\r
+extern statetype s_zombie_alive1;\r
+extern statetype s_zombie_alive2;\r
+extern statetype s_zombie_alive3;\r
+\r
+//extern statetype s_zombie_attack1;\r
+\r
+extern statetype s_zombie_death1;\r
+extern statetype s_zombie_death2;\r
+extern statetype s_zombie_death3;\r
+\r
+void T_Zombie (objtype *ob);\r
+void T_ZombieRisen(objtype *obj);\r
+\r
+statetype s_zombie_risen = {ZOMB_WALK3PIC,1,T_AwakeThink,&s_zombie_alive1};\r
+\r
+statetype s_zombie_pause = {ZOMB_WALK1PIC,20,NULL,&s_zombie_alive1};\r
+\r
+statetype s_zombie_inground = {0,13,T_ChaseThink,&s_zombie_inground};\r
+\r
+statetype s_zombie_rise1 = {ZOMB_APPEAR1PIC,24,NULL,&s_zombie_rise2};\r
+statetype s_zombie_rise2 = {ZOMB_APPEAR2PIC,24,NULL,&s_zombie_rise3};\r
+statetype s_zombie_rise3 = {ZOMB_APPEAR3PIC,24,NULL,&s_zombie_rise4};\r
+statetype s_zombie_rise4 = {ZOMB_APPEAR4PIC,24,NULL,&s_zombie_risen};\r
+\r
+statetype s_zombie_alive1 = {ZOMB_WALK1PIC,13,T_ChaseThink,&s_zombie_alive2};\r
+statetype s_zombie_alive2 = {ZOMB_WALK2PIC,13,T_ChaseThink,&s_zombie_alive3};\r
+statetype s_zombie_alive3 = {ZOMB_WALK3PIC,13,T_ChaseThink,&s_zombie_alive1};\r
+\r
+statetype s_zombie_death1 = {ZOMB_DIE1PIC,16,NULL,&s_zombie_death2};\r
+statetype s_zombie_death2 = {ZOMB_DIE2PIC,16,NULL,&s_zombie_death3};\r
+statetype s_zombie_death3 = {ZOMB_DIE3PIC,16,NULL,&s_zombie_death3};\r
+\r
+statetype s_zombie_attack  = {ZOMB_ATTACKPIC,15,T_DoDamage,&s_zombie_pause};\r
+//statetype s_zombie_attack1 = {ZOMB_ATTACKPIC,15,NULL,&s_zombie_pause};\r
+\r
+statetype s_zombie_ouch = {ZOMB_OUCHPIC,15,NULL,&s_zombie_alive1};\r
+\r
+\r
+//--------------------------------------------------------------------------\r
+// SpawnZombie()\r
+//--------------------------------------------------------------------------\r
+void SpawnZombie (int tilex, int tiley)\r
+{\r
+       objtype *ob;\r
+       short current_zombie_delay;\r
+       unsigned tile;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_zombie_inground,35*PIXRADIUS);\r
+       ob = new;\r
+       zombie_mode = zm_wait_for_dark;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (tile)\r
+               zombie_delay = (tile>>8)*30;\r
+       else\r
+       {\r
+               current_zombie_delay = (2*60)+random(4*60);\r
+               zombie_delay = zombie_base_delay+current_zombie_delay;\r
+               zombie_base_delay += current_zombie_delay;\r
+               if (zombie_base_delay > 8*60)\r
+                       zombie_base_delay = 0;\r
+       }\r
+\r
+       new->speed = 2500;\r
+       new->obclass = zombieobj;\r
+       new->hitpoints = EasyHitPoints(8);\r
+       new->active = yes;\r
+       new->flags &= ~of_shootable;\r
+}\r
+\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                       TREE\r
+\r
+=============================================================================\r
+*/\r
+\r
+extern statetype s_tree_pause;\r
+extern statetype s_tree_idle;\r
+extern statetype s_tree_awakening1;\r
+extern statetype s_tree_awakening2;\r
+extern statetype s_tree_walk1;\r
+extern statetype s_tree_walk2;\r
+extern statetype s_tree_walk3;\r
+extern statetype s_tree_death1;\r
+extern statetype s_tree_death2;\r
+extern statetype s_tree_death3;\r
+extern statetype s_tree_death4;\r
+extern statetype s_tree_death5;\r
+extern statetype s_tree_attack1;\r
+extern statetype s_tree_attack2;\r
+extern statetype s_tree_attack3;\r
+extern statetype s_tree_ouch;\r
+\r
+void T_Tree (objtype *ob);\r
+void T_DeathThink(objtype *ob);\r
+\r
+statetype s_tree_pause = {TREE_WALK1PIC,25,NULL,&s_tree_walk2};\r
+\r
+statetype s_tree_idle = {TREE_IDLEPIC,13,T_ChaseThink,&s_tree_idle};\r
+\r
+statetype s_tree_awakening1 = {TREE_AWAKENINGPIC,1,T_AwakeThink,&s_tree_awakening2};\r
+statetype s_tree_awakening2 = {TREE_AWAKENINGPIC,50,NULL,&s_tree_walk1};\r
+\r
+statetype s_tree_walk1 = {TREE_WALK1PIC,13,T_ChaseThink,&s_tree_walk2};\r
+statetype s_tree_walk2 = {TREE_WALK2PIC,13,T_ChaseThink,&s_tree_walk1};\r
+\r
+statetype s_tree_death1 = {TREE_DEATH1PIC,45,NULL,&s_tree_death2};\r
+statetype s_tree_death2 = {TREE_DEATH2PIC,25,NULL,&s_tree_death3};\r
+statetype s_tree_death3 = {TREE_DEATH1PIC,15,T_DeathThink,&s_tree_death4};\r
+statetype s_tree_death4 = {TREE_DEATH2PIC,15,T_DeathThink,&s_tree_death5};\r
+statetype s_tree_death5 = {TREE_DEATH3PIC,15,T_DeathThink,&s_tree_death3};\r
+\r
+statetype s_tree_attack1  = {TREE_ATTACK1PIC,15,T_DoDamage,&s_tree_attack2};\r
+statetype s_tree_attack2  = {TREE_ATTACK2PIC,15,T_DoDamage,&s_tree_attack3};\r
+statetype s_tree_attack3  = {TREE_ATTACK3PIC,15,T_DoDamage,&s_tree_pause};\r
+\r
+statetype s_tree_ouch = {TREE_AWAKENINGPIC,15,NULL,&s_tree_walk1};\r
+\r
+\r
+#define zombie_mode    ob->temp1\r
+#define zombie_delay   ob->temp2\r
+\r
+\r
+//--------------------------------------------------------------------------\r
+// SpawnTree()\r
+//--------------------------------------------------------------------------\r
+void SpawnTree(int tilex, int tiley)\r
+{\r
+       objtype *ob;\r
+       short current_zombie_delay;\r
+       unsigned tile;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_tree_idle,35*PIXRADIUS);\r
+       ob = new;\r
+       zombie_mode = zm_wait_for_dark;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (tile)\r
+               zombie_delay = (tile>>8)*30;\r
+       else\r
+       {\r
+               current_zombie_delay = (2*60)+random(4*60);\r
+               zombie_delay = zombie_base_delay+current_zombie_delay;\r
+               zombie_base_delay += current_zombie_delay;\r
+               if (zombie_base_delay > 8*60)\r
+                       zombie_base_delay = 0;\r
+       }\r
+\r
+       new->speed = 2500;\r
+       new->obclass = realsolidobj;\r
+//     new->hitpoints = EasyHitPoints(12);\r
+       new->active = yes;\r
+       new->flags |= of_shootable;\r
+       new->flags |= of_tree;\r
+}\r
+\r
+//--------------------------------------------------------------------------\r
+// T_DeathThink()\r
+//--------------------------------------------------------------------------\r
+void T_DeathThink(objtype *ob)\r
+{\r
+       char num;\r
+\r
+       if ((ob->ticcount - realtics) <= 0)\r
+       {\r
+               num = random(2);\r
+               switch (ob->temp1)\r
+               {\r
+                       case 3:\r
+                               if (num)\r
+                                       ob->state = &s_tree_death4;\r
+                               else\r
+                                       ob->state = &s_tree_death5;\r
+                               ob->temp1++;\r
+                       break;\r
+\r
+                       case 4:\r
+                               if (num)\r
+                                       ob->state = &s_tree_death3;\r
+                               else\r
+                                       ob->state = &s_tree_death5;\r
+                               ob->temp1++;\r
+                       break;\r
+\r
+                       case 5:\r
+                               if (num)\r
+                                       ob->state = &s_tree_death3;\r
+                               else\r
+                                       ob->state = &s_tree_death4;\r
+                               ob->temp1 = 3;\r
+                       break;\r
+               }\r
+               ob->ticcount = ob->state->tictime;\r
+       }\r
+\r
+\r
+\r
+       if (CheckHandAttack(ob))\r
+               TakeDamage (1);\r
+}\r
+\r
+\r
+//////////////////////////////////////////////////////////////////////////\r
+//\r
+//     GENERAL THINK ROUTINES USED BY THE ZOMBIE, TREE, ANT, AND GODESS\r
+//             ----trying to cut down on the code size----\r
+//\r
+//////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+//--------------------------------------------------------------------------\r
+// T_ChaseThink()\r
+//--------------------------------------------------------------------------\r
+void T_ChaseThink(objtype *ob)\r
+{\r
+       switch (zombie_mode)\r
+       {\r
+               case zm_wait_for_dark:\r
+#if 0\r
+                       if (gamestate.mapon == 0)\r
+                       {\r
+                               if (BGFLAGS & BGF_NIGHT)\r
+                                       zombie_mode = zm_wait_to_rise;\r
+                       }\r
+                       else\r
+#endif\r
+                               zombie_mode = zm_wait_to_rise;\r
+               break;\r
+\r
+               case zm_wait_to_rise:\r
+                       if (zombie_delay < 0)\r
+                       {\r
+                               if ((ob->tilex == player->tilex) && (ob->tiley == player->tiley))\r
+                                       break;\r
+                               if (CheckHandAttack(ob))\r
+                                       break;\r
+\r
+                               ob->active = always;\r
+                               switch (ob->obclass)\r
+                               {\r
+                                       case zombieobj:\r
+                                               ob->state = &s_zombie_rise1;\r
+                                       break;\r
+\r
+                                       case antobj:\r
+                                               ob->state = &s_ant_egg;\r
+                                       break;\r
+\r
+                                       case realsolidobj:      //tree and godess\r
+                                               if (ob->flags & of_tree)\r
+                                                       ob->state = &s_tree_awakening1;\r
+                                               else\r
+                                                       ob->state = &s_godess_statue2;\r
+                                       break;\r
+                               }\r
+                               ob->ticcount = ob->state->tictime;\r
+                               zombie_mode = zm_active;\r
+                       }\r
+                       else\r
+                               zombie_delay -= tics;\r
+\r
+               break;\r
+\r
+               case zm_active:\r
+                       if (Chase (ob,true) || (random(1000)<RANDOM_ATTACK))\r
+                       {\r
+                               switch (ob->obclass)\r
+                               {\r
+                                       case zombieobj:\r
+                                               ob->state = &s_zombie_attack;\r
+                                       break;\r
+\r
+                                       case antobj:\r
+                                               ob->state = &s_ant_attack1;\r
+                                       break;\r
+\r
+                                       case treeobj:\r
+                                               ob->state = &s_tree_attack1;\r
+                                       break;\r
+\r
+                                       case godessobj:\r
+                                               ob->state = &s_godessattack1;\r
+                                       break;\r
+                               }\r
+                               ob->ticcount = ob->state->tictime;\r
+                               return;\r
+                       }\r
+               break;\r
+       }\r
+}\r
+\r
+//--------------------------------------------------------------------------\r
+// T_AwakeThink()\r
+//--------------------------------------------------------------------------\r
+void T_AwakeThink(objtype *obj)\r
+{\r
+       if (obj->obclass == realsolidobj)\r
+       {\r
+               if (obj->flags & of_tree)\r
+                       obj->obclass = treeobj;\r
+               else\r
+                       obj->obclass = godessobj;\r
+               obj->hitpoints = EasyHitPoints(12);\r
+       }\r
+       else\r
+               obj->flags |= of_shootable;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+//--------------------------------------------------------------------------\r
+// ShootPlayer()\r
+//--------------------------------------------------------------------------\r
+boolean ShootPlayer(objtype *ob, short obclass, short speed, statetype *state)\r
+{\r
+       int angle = AngleNearPlayer(ob);\r
+\r
+       if (angle == -1)\r
+               return(false);\r
+\r
+       DSpawnNewObjFrac (ob->x,ob->y,state,PIXRADIUS*35);\r
+       new->obclass = obclass;\r
+       new->active = always;\r
+       new->angle = angle;\r
+\r
+       //\r
+       //      If the shot is Grelminar's, then determine the power of the shot.\r
+       //      The shot speed is hard-wired as 10000.  But the shot power is\r
+       //              determined by speed.  Speed now contains "Grelminar's level of\r
+       //              hardness" and this is multiplied by 3 to get the shot power.\r
+       //\r
+       if (obclass == gshotobj)\r
+       {\r
+               new->speed = 10000;\r
+               new->temp1 = speed*3;\r
+       }\r
+       else\r
+               new->speed = speed;\r
+\r
+\r
+       return(true);\r
+}\r
+\r
+//--------------------------------------------------------------------------\r
+// T_ShootPlayer()\r
+//--------------------------------------------------------------------------\r
+void T_ShootPlayer(objtype *ob)\r
+{\r
+       objtype *check;\r
+       long xmove,ymove,speed;\r
+\r
+       speed = ob->speed*tics;\r
+\r
+       xmove = FixedByFrac(speed,costable[ob->angle]);\r
+       ymove = -FixedByFrac(speed,sintable[ob->angle]);\r
+\r
+       if (ShotClipMove(ob,xmove,ymove))\r
+       {\r
+               ob->state = &s_pshot_exp1;\r
+               ob->ticcount = ob->state->tictime;\r
+               return;\r
+       }\r
+\r
+       ob->tilex = ob->x >> TILESHIFT;\r
+       ob->tiley = ob->y >> TILESHIFT;\r
+\r
+\r
+// check for collision with wall\r
+//\r
+       if (tilemap[ob->tilex][ob->tiley])\r
+       {\r
+               SD_PlaySound (SHOOTWALLSND);\r
+               ob->state = &s_pshot_exp1;\r
+               ob->ticcount = s_pshot_exp1.tictime;\r
+               return;\r
+       }\r
+\r
+\r
+\r
+// check for collision with player\r
+//\r
+       if ( ob->xl <= player->xh\r
+       && ob->xh >= player->xl\r
+       && ob->yl <= player->yh\r
+       && ob->yh >= player->yl)\r
+       {\r
+               switch (ob->obclass)\r
+               {\r
+                       case eshotobj:\r
+                               TakeDamage (ESHOTDAMAGE);\r
+                       break;\r
+\r
+                       case mshotobj:\r
+                               TakeDamage (MSHOTDAMAGE);\r
+                       break;\r
+\r
+                       case gshotobj:\r
+                               TakeDamage (ob->temp1);         // the damage of Grelminar's shot -\r
+                       break;                                                          //   see Grelminar's spawning\r
+\r
+                       case sshotobj:\r
+                               TakeDamage(SSHOTDAMAGE);\r
+                       break;\r
+\r
+                       case dshotobj:\r
+                               TakeDamage(7);\r
+                       break;\r
+               }\r
+               ob->state = NULL;\r
+               return;\r
+       }\r
+\r
+// check for collision with other solid and realsolid objects.\r
+//  Great terminology!! -- solid objects really aren't solid\r
+//                      -- realsolid objects ARE solid\r
+//     if ((actorat[ob->tilex][ob->tiley]) && (actorat[ob->tilex][ob->tiley]->obclass != ob->obclass))\r
+       if (((actorat[ob->tilex][ob->tiley]->obclass == realsolidobj) ||\r
+                (actorat[ob->tilex][ob->tiley]->obclass == solidobj)) &&\r
+                (actorat[ob->tilex][ob->tiley]->flags & of_shootable))\r
+       {\r
+                       ob->state = &s_pshot_exp1;\r
+                       ob->ticcount = s_pshot_exp1.tictime;\r
+                       return;\r
+       }\r
+\r
+\r
+// check for collision with player\r
+//\r
+       for (check = player->next; check; check=check->next)\r
+               if ((ob->flags & of_shootable) && ob->obclass != mageobj\r
+               && ob->xl <= check->xh\r
+               && ob->xh >= check->xl\r
+               && ob->yl <= check->yh\r
+               && ob->yh >= check->yl)\r
+               {\r
+                       switch (ob->obclass)\r
+                       {\r
+                               case eshotobj:\r
+                                       ShootActor (check,ESHOTDAMAGE);\r
+                               break;\r
+\r
+                               case mshotobj:\r
+                                       ShootActor (check,MSHOTDAMAGE);\r
+                               break;\r
+\r
+                               case gshotobj:\r
+                                       ShootActor (check,25);          //NOLAN--check on me!!!!!!!\r
+                               break;\r
+\r
+                               case pshotobj:\r
+                                       ShootActor (check,25);\r
+                               break;\r
+\r
+                               case sshotobj:\r
+                                       ShootActor(check, SSHOTDAMAGE);\r
+                               break;\r
+\r
+                               case dshotobj:\r
+                                       ShootActor(check, 7);\r
+                               break;\r
+                       }\r
+                       ob->state = &s_pshot_exp1;\r
+                       ob->ticcount = s_pshot_exp1.tictime;\r
+                       return;\r
+               }\r
+}\r
+\r
+//-------------------------------------------------------------------------\r
+// AngleNearPlayer()\r
+//-------------------------------------------------------------------------\r
+int AngleNearPlayer(objtype *ob)\r
+{\r
+       int angle=-1;\r
+       int xdiff = ob->tilex-player->tilex;\r
+       int ydiff = ob->tiley-player->tiley;\r
+\r
+       if (ob->tiley == player->tiley)\r
+       {\r
+               if (ob->tilex < player->tilex)\r
+                       angle = 0;\r
+               else\r
+                       angle = 180;\r
+       }\r
+       else\r
+       if (ob->tilex == player->tilex)\r
+       {\r
+               if (ob->tiley < player->tiley)\r
+                       angle = 270;\r
+               else\r
+                       angle = 90;\r
+       }\r
+       else\r
+       if (xdiff == ydiff)\r
+               if (ob->tilex < player->tilex)\r
+               {\r
+                       if (ob->tiley < player->tiley)\r
+                               angle = 315;\r
+                       else\r
+                               angle = 45;\r
+               }\r
+               else\r
+               {\r
+                       if (ob->tiley < player->tiley)\r
+                               angle = 225;\r
+                       else\r
+                               angle = 135;\r
+               }\r
+\r
+       return(angle);\r
+}\r
diff --git a/C5_ACT4.C b/C5_ACT4.C
new file mode 100644 (file)
index 0000000..676e0b7
--- /dev/null
+++ b/C5_ACT4.C
@@ -0,0 +1,414 @@
+/* Catacomb Armageddon Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ */\r
+\r
+// C4_PLAY.C\r
+\r
+#include "DEF.H"\r
+#pragma hdrstop\r
+\r
+/*\r
+=============================================================================\r
+\r
+                                                LOCAL CONSTANTS\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//\r
+//                             ARCH OBJECTS\r
+//\r
+//-------------------------------------------------------------------------\r
+\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//                             ARCH\r
+//-------------------------------------------------------------------------\r
+\r
+void SpawnArch(int tilex, int tiley, int num);\r
+\r
+extern statetype s_arch_1;\r
+extern statetype s_arch_2;\r
+extern statetype s_arch_3;\r
+extern statetype s_arch_4;\r
+extern statetype s_arch_5;\r
+extern statetype s_arch_6;\r
+extern statetype s_arch_7;\r
+extern statetype s_arch_8;\r
+extern statetype s_arch_9;\r
+extern statetype s_arch_10;\r
+extern statetype s_arch_11;\r
+extern statetype s_arch_12;\r
+extern statetype s_arch_13;\r
+\r
+statetype s_arch_1 = {ARCH1PIC, 20, NULL, &s_arch_1};\r
+statetype s_arch_2 = {ARCH2PIC, 20, NULL, &s_arch_2};\r
+statetype s_arch_3 = {ARCH3PIC, 20, NULL, &s_arch_3};\r
+statetype s_arch_4 = {ARCH4PIC, 20, NULL, &s_arch_4};\r
+statetype s_arch_5 = {ARCH5PIC, 20, NULL, &s_arch_5};\r
+statetype s_arch_6 = {ARCH6PIC, 20, NULL, &s_arch_6};\r
+statetype s_arch_7 = {ARCH7PIC, 20, NULL, &s_arch_7};\r
+statetype s_arch_8 = {ARCH8PIC, 20, NULL, &s_arch_8};\r
+statetype s_arch_9 = {ARCH9PIC, 20, NULL, &s_arch_9};\r
+statetype s_arch_10 = {ARCH10PIC, 20, NULL, &s_arch_10};\r
+statetype s_arch_11 = {ARCH11PIC, 20, NULL, &s_arch_11};\r
+statetype s_arch_12 = {ARCH12PIC, 20, NULL, &s_arch_12};\r
+statetype s_arch_13 = {ARCH13PIC, 20, NULL, &s_arch_13};\r
+\r
+void SpawnArch (int tilex, int tiley, int num)\r
+{\r
+       statetype       *objstate;\r
+\r
+\r
+       switch (num)\r
+       {\r
+               case 1:\r
+                       objstate = &s_arch_1;\r
+               break;\r
+               case 2:\r
+                       objstate = &s_arch_2;\r
+               break;\r
+               case 3:\r
+                       objstate = &s_arch_3;\r
+               break;\r
+               case 4:\r
+                       objstate = &s_arch_4;\r
+               break;\r
+               case 5:\r
+                       objstate = &s_arch_5;\r
+               break;\r
+               case 6:\r
+                       objstate = &s_arch_6;\r
+               break;\r
+               case 7:\r
+                       objstate = &s_arch_7;\r
+               break;\r
+               case 8:\r
+                       objstate = &s_arch_8;\r
+               break;\r
+               case 9:\r
+                       objstate = &s_arch_9;\r
+               break;\r
+               case 10:\r
+                       objstate = &s_arch_10;\r
+               break;\r
+               case 11:\r
+                       objstate = &s_arch_11;\r
+               break;\r
+               case 12:\r
+                       objstate = &s_arch_12;\r
+               break;\r
+               case 13:\r
+                       objstate = &s_arch_13;\r
+               break;\r
+       }\r
+       ASpawnNewObj(tilex,tiley,objstate,PIXRADIUS*35);\r
+       new->obclass = solidobj;\r
+       new->flags &= ~of_shootable;\r
+}\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//\r
+//                             MISC OBJECTS\r
+//\r
+//-------------------------------------------------------------------------\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//             COLUMN, SULPHUR GAS HOLE, FIRE POT, FOUNTAIN\r
+//-------------------------------------------------------------------------\r
+\r
+\r
+void SpawnMiscObjects(int tilex, int tiley, int num);\r
+\r
+extern statetype s_column;\r
+extern statetype s_sulphur_gas_1;\r
+extern statetype s_sulphur_gas_2;\r
+extern statetype s_sulphur_gas_3;\r
+extern statetype s_fire_pot_1;\r
+extern statetype s_fire_pot_2;\r
+extern statetype s_fountain;\r
+\r
+statetype s_column = {COLUMNPIC, 20, NULL, &s_column};\r
+statetype s_sulphur_gas_1 = {SULPHUR_GAS_1PIC, 20, NULL, &s_sulphur_gas_2};\r
+statetype s_sulphur_gas_2 = {SULPHUR_GAS_2PIC, 20, NULL, &s_sulphur_gas_3};\r
+statetype s_sulphur_gas_3 = {SULPHUR_GAS_3PIC, 20, NULL, &s_sulphur_gas_1};\r
+statetype s_fire_pot_1 = {FIRE_POT_1PIC, 20, NULL, &s_fire_pot_2};\r
+statetype s_fire_pot_2 = {FIRE_POT_2PIC, 20, NULL, &s_fire_pot_1};\r
+statetype s_fountain = {WFOUNTAINPIC, 20, NULL, &s_fountain};\r
+\r
+\r
+void SpawnMiscObjects(int tilex, int tiley, int num)\r
+{\r
+       statetype       *objstate;\r
+\r
+       switch (num)\r
+       {\r
+               case 1:\r
+                       objstate = &s_column;\r
+               break;\r
+\r
+               case 2:\r
+                       objstate = &s_sulphur_gas_1;\r
+               break;\r
+\r
+               case 3:\r
+                       objstate = &s_fire_pot_1;\r
+               break;\r
+\r
+               case 4:\r
+                       objstate = &s_fountain;\r
+               break;\r
+       }\r
+\r
+       SpawnNewObj(tilex,tiley,objstate,PIXRADIUS*35);\r
+       new->obclass = realsolidobj;\r
+       if (num == 2)\r
+               new->flags &= ~of_shootable;\r
+       else\r
+               new->flags |= of_shootable;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+#if 0\r
+void SpawnColumn(int tilex, int tiley);\r
+\r
+extern statetype s_column;\r
+statetype s_column = {COLUMNPIC, 20, NULL, &s_column};\r
+\r
+void SpawnColumn(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_column,PIXRADIUS*35);\r
+       new->obclass = realsolidobj;\r
+       new->flags |= of_shootable;\r
+}\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//                             SULPHUR GAS\r
+//-------------------------------------------------------------------------\r
+\r
+void SpawnSulphurGas(int tilex, int tiley);\r
+\r
+extern statetype s_sulphur_gas_1;\r
+extern statetype s_sulphur_gas_2;\r
+extern statetype s_sulphur_gas_3;\r
+\r
+statetype s_sulphur_gas_1 = {SULPHUR_GAS_1PIC, 20, NULL, &s_sulphur_gas_2};\r
+statetype s_sulphur_gas_2 = {SULPHUR_GAS_2PIC, 20, NULL, &s_sulphur_gas_3};\r
+statetype s_sulphur_gas_3 = {SULPHUR_GAS_3PIC, 20, NULL, &s_sulphur_gas_1};\r
+\r
+void SpawnSulphurGas(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_sulphur_gas_1,PIXRADIUS*35);\r
+       new->obclass = realsolidobj;\r
+       new->flags &= ~of_shootable;\r
+}\r
+\r
+\r
+//-------------------------------------------------------------------------\r
+//                             FIRE POT\r
+//-------------------------------------------------------------------------\r
+\r
+void SpawnFirePot(int tilex, int tiley);\r
+\r
+extern statetype s_fire_pot_1;\r
+extern statetype s_fire_pot_2;\r
+\r
+statetype s_fire_pot_1 = {FIRE_POT_1PIC, 20, NULL, &s_fire_pot_2};\r
+statetype s_fire_pot_2 = {FIRE_POT_2PIC, 20, NULL, &s_fire_pot_1};\r
+\r
+void SpawnFirePot(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_fire_pot_1,PIXRADIUS*35);\r
+       new->obclass = realsolidobj;\r
+       new->flags |= of_shootable;\r
+\r
+}\r
+\r
+//------------------------------------------------------------------------\r
+//                             FOUNTAIN\r
+//------------------------------------------------------------------------\r
+\r
+void SpawnFountain(int tilex, int tiley);\r
+\r
+extern statetype s_fountain;\r
+statetype s_fountain = {WFOUNTAINPIC, 20, NULL, &s_fountain};\r
+\r
+void SpawnFountain(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_fountain,PIXRADIUS*35);\r
+       new->obclass = realsolidobj;\r
+       new->flags |= of_shootable;\r
+}\r
+\r
+#endif\r
+\r
+\r
+//------------------------------------------------------------------------\r
+//                             FORCE FIELD\r
+//------------------------------------------------------------------------\r
+\r
+void SpawnForceField(int tilex, int tiley);\r
+void T_ForceField(objtype *ob);\r
+void T_ForceFieldRemove(objtype *ob);\r
+\r
+extern statetype s_force_field_1;\r
+extern statetype s_force_field_2;\r
+extern statetype s_force_field_3;\r
+extern statetype s_force_field_4;\r
+extern statetype s_force_field_die1;\r
+\r
+statetype s_force_field_1 = {FORCE_FIELD_1PIC, 10, T_ForceField, &s_force_field_2};\r
+statetype s_force_field_2 = {FORCE_FIELD_2PIC, 10, T_ForceField, &s_force_field_3};\r
+statetype s_force_field_3 = {FORCE_FIELD_3PIC, 10, T_ForceField, &s_force_field_4};\r
+statetype s_force_field_4 = {FORCE_FIELD_4PIC, 10, T_ForceField, &s_force_field_1};\r
+\r
+statetype s_force_field_die = {0,0,T_ForceFieldRemove,&s_force_field_die1};\r
+statetype s_force_field_die1 = {0,0,NULL,NULL};\r
+\r
+void SpawnForceField(int tilex, int tiley)\r
+{\r
+       SpawnNewObj(tilex,tiley,&s_force_field_1,PIXRADIUS*35);\r
+       new->obclass = solidobj;\r
+       new->hitpoints = EasyHitPoints(20);\r
+       new->flags |= of_forcefield;            //sets bit 7 :: makes it nonsolid, but also detectable\r
+                                                                                               //              without adding another object type!\r
+       new->flags |= of_shootable;\r
+}\r
+\r
+void T_ForceField(objtype *ob)\r
+{\r
+       long move,deltax,deltay,size;\r
+\r
+       size = (long)ob->size + player->size;\r
+\r
+       deltax = ob->x - player->x;\r
+       deltay = ob->y - player->y;\r
+\r
+       if (deltax <= size && deltax >= -size\r
+       && deltay <= size && deltay >= -size)\r
+               TakeDamage (20);\r
+\r
+}\r
+\r
+void T_ForceFieldRemove(objtype *ob)\r
+{\r
+       actorat[ob->tilex][ob->tiley] = 0;\r
+}\r
+\r
+\r
+//------------------------------------------------------------------------\r
+//                     SKELETON HANGING FROM CEILING\r
+//------------------------------------------------------------------------\r
+\r
+void SpawnSkeletonHanging(int tilex, int tiley);\r
+void T_SkelHangThink(objtype *ob);\r
+\r
+extern statetype s_skeleton_hanging;\r
+statetype s_skeleton_hanging = {SKEL_HANGPIC, 20, T_SkelHangThink, &s_skeleton_hanging};\r
+\r
+void SpawnSkeletonHanging(int tilex, int tiley)\r
+{\r
+       unsigned tile;\r
+\r
+       SpawnNewObj(tilex,tiley,&s_skeleton_hanging,PIXRADIUS*35);\r
+       new->obclass = solidobj;\r
+\r
+       tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);\r
+       if (tile)\r
+               new->temp1 = (tile>>8)*30;\r
+       else\r
+               new->temp1 = (3*60)+random(4*60);\r
+\r
+       new->flags |= of_shootable;\r
+}\r
+\r
+void T_SkelHangThink(objtype *ob)\r
+{\r
+       ob->temp1 -= realtics;\r
+       if (ob->temp1 <= 0)\r
+       {\r
+               ob->state = &s_skel_1;\r
+               ob->ticcount = ob->state->tictime;\r
+               ob->obclass = skeletonobj;\r
+               ob->speed = 2036;\r
+               ob->flags |= of_shootable;\r
+               ob->hitpoints = EasyHitPoints(12);\r
+       }\r
+}\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     EasyHitPoints\r
+//\r
+//     Checks to see if the player has selected the easy mode for playing.\r
+//     If so then the normal hit points are cut in half.\r
+//     This is when the object is spawned.\r
+//\r
+//     Parms\r
+//             NrmHitPts - the normal hit points\r
+//\r
+//     Returns\r
+//             Half of NrmHitPts\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+int EasyHitPoints(int NrmHitPts)\r
+{\r
+       if (EASYMODEON)                         // Wimpy, Wimpy, Wimpy!!!!!\r
+       {\r
+               return(NrmHitPts/4);\r
+       }\r
+       else\r
+               return(NrmHitPts);\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+//     EasyDoDamage\r
+//\r
+//     Checks to see if the player has selected the easy mode for playing.\r
+//     If so then the normal amount of damage is cut in half.\r
+//     This is called each time a monster does damage.\r
+//\r
+//     Parms\r
+//             Damage - the normal damage taken\r
+//\r
+//     Returns\r
+//             Half of Damage\r
+//\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+int EasyDoDamage(int Damage)\r
+{\r
+       if (EASYMODEON)                         // Wimpy, Wimpy, Wimpy!!!!!\r
+               return(Damage/2);\r
+       else\r
+               return(Damage);\r
+}\r
+\r
index 05eb2f080816ba03752d97e95c6c36de750ddb5b..a4390b2df5ac331d65291617a7cfc48c0f40e4d5 100644 (file)
@@ -1,4 +1,4 @@
-; Catacomb Abyss Source Code\r
+; Catacomb Armageddon Source Code\r
 ; Copyright (C) 1993-2014 Flat Rock Software\r
 ;\r
 ; This program is free software; you can redistribute it and/or modify\r
index c631b43eb514339bb0b53f6e4ccf68f3400e4592..d8e2b1aa426a98d7c63b5f8b060bd562a2eb209a 100644 (file)
@@ -1,4 +1,4 @@
-/* Catacomb Abyss Source Code\r
+/* Catacomb Armageddon Source Code\r
  * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
@@ -53,6 +53,7 @@
 =============================================================================\r
 */\r
 \r
+short colordelay=0;\r
 boolean autofire=false;\r
 int    maporgx;\r
 int    maporgy;\r
@@ -62,56 +63,6 @@ void ViewMap (void);
 \r
 //===========================================================================\r
 \r
-\r
-/*\r
-==================\r
-=\r
-= DebugMemory\r
-=\r
-==================\r
-*/\r
-\r
-void DebugMemory (void)\r
-{\r
-       int     i;\r
-       char    scratch[80],str[10];\r
-       long    mem;\r
-       spritetype _seg *block;\r
-\r
-       VW_FixRefreshBuffer ();\r
-       CenterWindow (16,7);\r
-\r
-#if 0\r
-       CA_OpenDebug ();\r
-       for (i=0;i<NUMCHUNKS;i++)\r
-       {\r
-               if (grsegs[i])\r
-               {\r
-                       strcpy (scratch,"Chunk:");\r
-                       itoa (i,str,10);\r
-                       strcat (scratch,str);\r
-                       strcat (scratch,"\n");\r
-                       write (debughandle,scratch,strlen(scratch));\r
-               }\r
-       }\r
-       CA_CloseDebug ();\r
-#endif\r
-\r
-       US_CPrint ("Memory Usage");\r
-       US_CPrint ("------------");\r
-       US_Print ("Total     :");\r
-       US_PrintUnsigned (mminfo.mainmem/1024);\r
-       US_Print ("k\nFree      :");\r
-       US_PrintUnsigned (MM_UnusedMemory()/1024);\r
-       US_Print ("k\nWith purge:");\r
-       US_PrintUnsigned (MM_TotalFree()/1024);\r
-       US_Print ("k\n");\r
-       VW_UpdateScreen();\r
-       IN_Ack ();\r
-}\r
-\r
-//===========================================================================\r
-\r
 #if 0\r
 /*\r
 ================\r
@@ -189,7 +140,22 @@ int DebugKeys (void)
        boolean esc;\r
        int level,i;\r
 \r
-#if 0\r
+#if DEBUG_KEYS_AVAILABLE\r
+       if (Keyboard[sc_R])\r
+       {\r
+               CenterWindow (12,2);\r
+               if (autofire)\r
+                 US_PrintCentered ("Rapid-Fire OFF");\r
+               else\r
+                 US_PrintCentered ("Rapid-Fire ON");\r
+               VW_UpdateScreen();\r
+               IN_Ack();\r
+               autofire ^= 1;\r
+               return 1;\r
+       }\r
+#endif\r
+\r
+#if DEBUG_KEYS_AVAILABLE\r
        if (Keyboard[sc_A])\r
        {\r
                char levelstr[50];\r
@@ -252,7 +218,7 @@ int DebugKeys (void)
        //\r
                        if (Keyboard[sc_RightArrow])\r
                        {\r
-                               if (mapon < LASTMAP-2)\r
+                               if (mapon < LASTMAP-1)\r
                                {\r
                                        MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3);\r
                                        mapon++;\r
@@ -298,25 +264,12 @@ int DebugKeys (void)
                DrawText(true);\r
                status_flag = 0;\r
        }\r
-#endif\r
 \r
-       if (Keyboard[sc_T])\r
-       {\r
-               VW_FixRefreshBuffer ();\r
-               CenterWindow (16,4);\r
-\r
-               US_Print("Tics      :");\r
-               US_PrintUnsigned (tics);\r
-               US_Print("\nReal Tics :");\r
-               US_PrintUnsigned(realtics);\r
-               VW_UpdateScreen();\r
-               IN_Ack ();\r
-       }\r
 \r
        if (Keyboard[sc_V])\r
        {\r
                displayofs = bufferofs = screenloc[screenpage];\r
-               CenterWindow (20,5);\r
+               CenterWindow (16,4);\r
                US_CPrint("\n"GAMENAME);\r
                US_CPrint(VERSION);\r
                US_CPrint(REVISION);\r
@@ -324,6 +277,7 @@ int DebugKeys (void)
                IN_Ack ();\r
        }\r
 \r
+\r
        if (Keyboard[sc_Q])                     // Q = Insta-Quit!\r
                Quit("Insta-Quit!");\r
 \r
@@ -337,6 +291,8 @@ int DebugKeys (void)
                IN_Ack();\r
                return 1;\r
        }\r
+#endif\r
+\r
 \r
 //     if (Keyboard[sc_E])\r
 //             FaceDoor((player->x>>16l)+1,(player->y>>16l));\r
@@ -360,6 +316,69 @@ int DebugKeys (void)
        }\r
 #endif\r
 \r
+\r
+#if 1//DEBUG_KEYS_AVAILABLE\r
+       if (Keyboard[sc_O])\r
+       {\r
+               extern unsigned objectcount,latchmemavail;\r
+               unsigned unused,total;\r
+\r
+               CenterWindow (30,13);\r
+               US_Print ("Objects: ");\r
+               US_PrintUnsigned (objectcount);\r
+\r
+               US_Print("\n\nTics: ");\r
+               US_PrintUnsigned (tics);\r
+               US_Print("      Real Tics: ");\r
+               US_PrintUnsigned(realtics);\r
+\r
+               US_Print ("\n\n    Total Available: ");\r
+               US_PrintUnsigned (mminfo.mainmem/1024);\r
+               US_Print ("k\n        Mem In Use: ");\r
+               unused=MM_UnusedMemory()/1024;\r
+               US_PrintUnsigned (unused);\r
+               US_Print ("k\n Mem After Purge: ");\r
+               total=MM_TotalFree()/1024;\r
+               US_PrintUnsigned (total);\r
+               US_Print ("k (");\r
+               US_PrintUnsigned (total-unused);\r
+\r
+               US_Print (")\n\nLatch Mem Free: ");\r
+               US_PrintUnsigned (latchmemavail);\r
+               US_Print ("\n");\r
+               VW_UpdateScreen();\r
+               IN_Ack();\r
+       }\r
+\r
+       if (colordelay<1)\r
+       {\r
+               if (Keyboard[26])\r
+               {\r
+                       extern unsigned *groundcolor,debug_gnd;\r
+\r
+                       groundcolor = &debug_gnd;\r
+                       debug_gnd += 0x0101;\r
+                       if (debug_gnd == 0x1010)\r
+                               debug_gnd = 0;\r
+                       colordelay = 10;\r
+               }\r
+\r
+               if (Keyboard[27])\r
+               {\r
+                       extern unsigned *skycolor,debug_sky;\r
+\r
+                       skycolor = &debug_sky;\r
+                       debug_sky += 0x0101;\r
+                       if (debug_sky == 0x1010)\r
+                               debug_sky = 0;\r
+                       colordelay = 10;\r
+               }\r
+       }\r
+       else\r
+               colordelay -= realtics;\r
+#endif\r
+\r
+\r
 #if 0\r
        if (Keyboard[sc_C])             // C = count objects\r
        {\r
@@ -445,21 +464,15 @@ int DebugKeys (void)
                }\r
                gamestate.gems[4] = GEM_DELAY_TIME;\r
                redraw_gems = true;\r
-               for (i=0;i<8;i++)\r
-                       GiveScroll (i,false);\r
+/////////              for (i=0;i<8;i++)\r
+/////////                      GiveScroll (i,false);\r
 \r
                IN_Ack ();\r
                return 1;\r
        }\r
 \r
-       if (Keyboard[sc_M])                     // M = memory info\r
-       {\r
-               DebugMemory();\r
-               return 1;\r
-       }\r
-\r
 #if DEBUG_OVERHEAD\r
-       if (Keyboard[sc_O])                     // O = overhead\r
+       if (Keyboard[sc_Z])                     // O is used elsewhere...\r
        {\r
                ViewMap();\r
                return 1;\r
@@ -511,7 +524,7 @@ int DebugKeys (void)
        {\r
                CenterWindow(26,3);\r
                PrintY+=6;\r
-               US_Print("  Warp to which level(0-18):");\r
+               US_Print("  Warp to which level(0-16):");\r
                VW_UpdateScreen();\r
                esc = !US_LineInput (px,py,str,NULL,true,2,0);\r
                if (!esc)\r
@@ -544,11 +557,11 @@ int DebugKeys (void)
        }\r
 #endif\r
 \r
-       if (LastScan >= sc_1 && LastScan <= sc_8)       // free scrolls\r
-       {\r
-               GiveScroll (LastScan-sc_1,false);\r
-               IN_ClearKeysDown ();\r
-       }\r
+////////       if (LastScan >= sc_1 && LastScan <= sc_8)       // free scrolls\r
+////////       {\r
+////////               GiveScroll (LastScan-sc_1,false);\r
+////////               IN_ClearKeysDown ();\r
+////////       }\r
 \r
        return 0;\r
 }\r
index e4c59f3c08f1c22728415cc6c97f5f29ae8f2e34..bab5ea3d0fef880e7b90a540e0c0aeaa5801e9e9 100644 (file)
--- a/C5_DRAW.C
+++ b/C5_DRAW.C
@@ -1,4 +1,4 @@
-/* Catacomb Abyss Source Code\r
+/* Catacomb Armageddon Source Code\r
  * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
 #include "DEF.H"\r
 #pragma hdrstop\r
 \r
-//#define DRAWEACH                             // draw walls one at a time for debugging\r
+//#define DRAWEACH                              // draw walls one at a time for debugging\r
 \r
-unsigned       highest;\r
-unsigned       mostwalls,numwalls;\r
+unsigned        highest;\r
+unsigned        mostwalls,numwalls;\r
 \r
 /*\r
 =============================================================================\r
@@ -34,19 +34,19 @@ unsigned    mostwalls,numwalls;
 =============================================================================\r
 */\r
 \r
-#define PI     3.141592657\r
-#define ANGLEQUAD      (ANGLES/4)\r
+#define PI      3.141592657\r
+#define ANGLEQUAD       (ANGLES/4)\r
 \r
-unsigned       oldend;\r
+unsigned        oldend;\r
 \r
-#define FINEANGLES     3600\r
+#define FINEANGLES      3600\r
 \r
-#define MINRATIO       16\r
+#define MINRATIO        16\r
 \r
 \r
-const  unsigned        MAXSCALEHEIGHT  = (VIEWWIDTH/2);\r
-const  unsigned        MAXVISHEIGHT    = (VIEWHEIGHT/2);\r
-const  unsigned        BASESCALE               = 32;\r
+const   unsigned        MAXSCALEHEIGHT  = (VIEWWIDTH/2);\r
+const   unsigned        MAXVISHEIGHT    = (VIEWHEIGHT/2);\r
+const   unsigned        BASESCALE               = 32;\r
 \r
 /*\r
 =============================================================================\r
@@ -64,10 +64,10 @@ const       unsigned        BASESCALE               = 32;
 unsigned screenloc[3]= {PAGE1START,PAGE2START,PAGE3START};\r
 unsigned freelatch = FREESTART;\r
 \r
-boolean                fizzlein;\r
+boolean         fizzlein;\r
 \r
-long   scaleshapecalll;\r
-long   scaletablecall;\r
+long    scaleshapecalll;\r
+long    scaletablecall;\r
 \r
 /*\r
 =============================================================================\r
@@ -77,12 +77,12 @@ long        scaletablecall;
 =============================================================================\r
 */\r
 \r
-long   bytecount,endcount;             // for profiling\r
-int            animframe;\r
-int            pixelangle[VIEWWIDTH];\r
-int            far finetangent[FINEANGLES+1];\r
-int            fineviewangle;\r
-unsigned       viewxpix,viewypix;\r
+long    bytecount,endcount;             // for profiling\r
+int             animframe;\r
+int             pixelangle[VIEWWIDTH];\r
+int             far finetangent[FINEANGLES+1];\r
+int             fineviewangle;\r
+unsigned        viewxpix,viewypix;\r
 \r
 /*\r
 ============================================================================\r
@@ -92,25 +92,25 @@ unsigned    viewxpix,viewypix;
 ============================================================================\r
 */\r
 \r
-fixed  tileglobal      = TILEGLOBAL;\r
-fixed  focallength     = FOCALLENGTH;\r
-fixed  mindist         = MINDIST;\r
-int            viewheight      = VIEWHEIGHT;\r
+fixed   tileglobal      = TILEGLOBAL;\r
+fixed   focallength     = FOCALLENGTH;\r
+fixed   mindist         = MINDIST;\r
+int             viewheight      = VIEWHEIGHT;\r
 fixed scale;\r
 \r
 \r
-tilept tile,lasttile,          // tile of wall being followed\r
-       focal,                  // focal point in tiles\r
-       left,mid,right;         // rightmost tile in view\r
+tilept  tile,lasttile,          // tile of wall being followed\r
+       focal,                  // focal point in tiles\r
+       left,mid,right;         // rightmost tile in view\r
 \r
 globpt edge,view;\r
 \r
-int    segstart[VIEWHEIGHT],   // addline tracks line segment and draws\r
+int     segstart[VIEWHEIGHT],   // addline tracks line segment and draws\r
        segend[VIEWHEIGHT],\r
-       segcolor[VIEWHEIGHT];   // only when the color changes\r
+       segcolor[VIEWHEIGHT];   // only when the color changes\r
 \r
 \r
-walltype       walls[MAXWALLS],*leftwall,*rightwall;\r
+walltype        walls[MAXWALLS],*leftwall,*rightwall;\r
 \r
 \r
 //==========================================================================\r
@@ -133,29 +133,29 @@ fixed prestep;
 \r
 fixed sintable[ANGLES+ANGLES/4],*costable = sintable+(ANGLES/4);\r
 \r
-fixed  viewx,viewy;                    // the focal point\r
-int    viewangle;\r
-fixed  viewsin,viewcos;\r
+fixed   viewx,viewy;                    // the focal point\r
+int     viewangle;\r
+fixed   viewsin,viewcos;\r
 \r
-int    zbuffer[VIEWXH+1];      // holds the height of the wall at that point\r
+int     zbuffer[VIEWXH+1];      // holds the height of the wall at that point\r
 \r
 //==========================================================================\r
 \r
-void   DrawLine (int xl, int xh, int y,int color);\r
-void   DrawWall (walltype *wallptr);\r
-void   TraceRay (unsigned angle);\r
-fixed  FixedByFrac (fixed a, fixed b);\r
-fixed  FixedAdd (void);\r
-fixed  TransformX (fixed gx, fixed gy);\r
-int            FollowTrace (fixed tracex, fixed tracey, long deltax, long deltay, int max);\r
-int            BackTrace (int finish);\r
-void   ForwardTrace (void);\r
-int            TurnClockwise (void);\r
-int            TurnCounterClockwise (void);\r
-void   FollowWall (void);\r
-\r
-void   NewScene (void);\r
-void   BuildTables (void);\r
+void    DrawLine (int xl, int xh, int y,int color);\r
+void    DrawWall (walltype *wallptr);\r
+void    TraceRay (unsigned angle);\r
+fixed   FixedByFrac (fixed a, fixed b);\r
+fixed   FixedAdd (void);\r
+fixed   TransformX (fixed gx, fixed gy);\r
+int             FollowTrace (fixed tracex, fixed tracey, long deltax, long deltay, int max);\r
+int             BackTrace (int finish);\r
+void    ForwardTrace (void);\r
+int             TurnClockwise (void);\r
+int             TurnCounterClockwise (void);\r
+void    FollowWall (void);\r
+\r
+void    NewScene (void);\r
+void    BuildTables (void);\r
 \r
 //==========================================================================\r
 \r
@@ -175,9 +175,9 @@ void        BuildTables (void);
 ==================\r
 */\r
 \r
-unsigned static        char dotmask[8] = {0x80,0x40,0x20,0x10,8,4,2,1};\r
-unsigned static        char leftmask[8] = {0xff,0x7f,0x3f,0x1f,0xf,7,3,1};\r
-unsigned static        char rightmask[8] = {0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};\r
+unsigned static char dotmask[8] = {0x80,0x40,0x20,0x10,8,4,2,1};\r
+unsigned static char leftmask[8] = {0xff,0x7f,0x3f,0x1f,0xf,7,3,1};\r
+unsigned static char rightmask[8] = {0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};\r
 \r
 void DrawLine (int xl, int xh, int y,int color)\r
 {\r
@@ -203,9 +203,9 @@ void DrawLine (int xl, int xh, int y,int color)
        //\r
        // set the GC index register to point to the bit mask register\r
        //\r
-       asm     mov     al,GC_BITMASK\r
-       asm     mov     dx,GC_INDEX\r
-       asm     out     dx,al\r
+       asm     mov     al,GC_BITMASK\r
+       asm     mov     dx,GC_INDEX\r
+       asm     out     dx,al\r
 \r
   if (xlb==xhb)\r
   {\r
@@ -215,50 +215,50 @@ void DrawLine (int xl, int xh, int y,int color)
 \r
        maskleft&=maskright;\r
 \r
-       asm     mov     es,[screenseg]\r
-       asm     mov     di,[dest]\r
-       asm     mov     dx,GC_INDEX+1\r
+       asm     mov     es,[screenseg]\r
+       asm     mov     di,[dest]\r
+       asm     mov     dx,GC_INDEX+1\r
 \r
-       asm     mov     al,[BYTE PTR maskleft]\r
-       asm     out     dx,al           // mask off pixels\r
+       asm     mov     al,[BYTE PTR maskleft]\r
+       asm     out     dx,al           // mask off pixels\r
 \r
-       asm     mov     al,[BYTE PTR color]\r
-       asm     xchg    al,[es:di]      // load latches and write pixels\r
+       asm     mov     al,[BYTE PTR color]\r
+       asm     xchg    al,[es:di]      // load latches and write pixels\r
 \r
        return;\r
   }\r
 \r
-asm    mov     es,[screenseg]\r
-asm    mov     di,[dest]\r
-asm    mov     dx,GC_INDEX+1\r
-asm    mov     bh,[BYTE PTR color]\r
+asm     mov     es,[screenseg]\r
+asm     mov     di,[dest]\r
+asm     mov     dx,GC_INDEX+1\r
+asm     mov     bh,[BYTE PTR color]\r
 \r
 //\r
 // draw left side\r
 //\r
-asm    mov     al,[BYTE PTR maskleft]\r
-asm    out     dx,al           // mask off pixels\r
+asm     mov     al,[BYTE PTR maskleft]\r
+asm     out     dx,al           // mask off pixels\r
 \r
-asm    mov     al,bh\r
-asm    xchg    al,[es:di]      // load latches and write pixels\r
-asm    inc     di\r
+asm     mov     al,bh\r
+asm     xchg    al,[es:di]      // load latches and write pixels\r
+asm     inc     di\r
 \r
 //\r
 // draw middle\r
 //\r
-asm    mov     al,255\r
-asm    out     dx,al           // no masking\r
+asm     mov     al,255\r
+asm     out     dx,al           // no masking\r
 \r
-asm    mov     al,bh\r
-asm    mov     cx,[mid]\r
-asm    rep     stosb\r
+asm     mov     al,bh\r
+asm     mov     cx,[mid]\r
+asm     rep     stosb\r
 \r
 //\r
 // draw right side\r
 //\r
-asm    mov     al,[BYTE PTR maskright]\r
-asm    out     dx,al           // mask off pixels\r
-asm    xchg    bh,[es:di]      // load latches and write pixels\r
+asm     mov     al,[BYTE PTR maskright]\r
+asm     out     dx,al           // mask off pixels\r
+asm     xchg    bh,[es:di]      // load latches and write pixels\r
 \r
 }\r
 \r
@@ -289,9 +289,9 @@ void DrawLineDot (int xl, int xh, int y,int color)
        //\r
        // set the GC index register to point to the bit mask register\r
        //\r
-       asm     mov     al,GC_BITMASK\r
-       asm     mov     dx,GC_INDEX\r
-       asm     out     dx,al\r
+       asm     mov     al,GC_BITMASK\r
+       asm     mov     dx,GC_INDEX\r
+       asm     out     dx,al\r
 \r
   if (xlb==xhb)\r
   {\r
@@ -301,69 +301,69 @@ void DrawLineDot (int xl, int xh, int y,int color)
 \r
        maskleft&=maskright;\r
 \r
-       asm     mov     es,[screenseg]\r
-       asm     mov     di,[dest]\r
-       asm     mov     dx,GC_INDEX+1\r
+       asm     mov     es,[screenseg]\r
+       asm     mov     di,[dest]\r
+       asm     mov     dx,GC_INDEX+1\r
 \r
-       asm     mov     al,[BYTE PTR maskleft]\r
-       asm     out     dx,al           // mask off pixels\r
+       asm     mov     al,[BYTE PTR maskleft]\r
+       asm     out     dx,al           // mask off pixels\r
 \r
-       asm     mov     al,[BYTE PTR color]\r
-       asm     xchg    al,[es:di]      // load latches and write pixels\r
+       asm     mov     al,[BYTE PTR color]\r
+       asm     xchg    al,[es:di]      // load latches and write pixels\r
 \r
 \r
        //\r
        // write the black dot at the start\r
        //\r
-       asm     mov     al,[BYTE PTR maskdot]\r
-       asm     out     dx,al           // mask off pixels\r
+       asm     mov     al,[BYTE PTR maskdot]\r
+       asm     out     dx,al           // mask off pixels\r
 \r
-       asm     xor     al,al\r
-       asm     xchg    al,[es:di]      // load latches and write pixels\r
+       asm     xor     al,al\r
+       asm     xchg    al,[es:di]      // load latches and write pixels\r
 \r
 \r
        return;\r
   }\r
 \r
-asm    mov     es,[screenseg]\r
-asm    mov     di,[dest]\r
-asm    mov     dx,GC_INDEX+1\r
-asm    mov     bh,[BYTE PTR color]\r
+asm     mov     es,[screenseg]\r
+asm     mov     di,[dest]\r
+asm     mov     dx,GC_INDEX+1\r
+asm     mov     bh,[BYTE PTR color]\r
 \r
 //\r
 // draw left side\r
 //\r
-asm    mov     al,[BYTE PTR maskleft]\r
-asm    out     dx,al           // mask off pixels\r
+asm     mov     al,[BYTE PTR maskleft]\r
+asm     out     dx,al           // mask off pixels\r
 \r
-asm    mov     al,bh\r
-asm    xchg    al,[es:di]      // load latches and write pixels\r
+asm     mov     al,bh\r
+asm     xchg    al,[es:di]      // load latches and write pixels\r
 \r
 //\r
 // write the black dot at the start\r
 //\r
-asm    mov     al,[BYTE PTR maskdot]\r
-asm    out     dx,al           // mask off pixels\r
-asm    xor     al,al\r
-asm    xchg    al,[es:di]      // load latches and write pixels\r
-asm    inc     di\r
+asm     mov     al,[BYTE PTR maskdot]\r
+asm     out     dx,al           // mask off pixels\r
+asm     xor     al,al\r
+asm     xchg    al,[es:di]      // load latches and write pixels\r
+asm     inc     di\r
 \r
 //\r
 // draw middle\r
 //\r
-asm    mov     al,255\r
-asm    out     dx,al           // no masking\r
+asm     mov     al,255\r
+asm     out     dx,al           // no masking\r
 \r
-asm    mov     al,bh\r
-asm    mov     cx,[mid]\r
-asm    rep     stosb\r
+asm     mov     al,bh\r
+asm     mov     cx,[mid]\r
+asm     rep     stosb\r
 \r
 //\r
 // draw right side\r
 //\r
-asm    mov     al,[BYTE PTR maskright]\r
-asm    out     dx,al           // mask off pixels\r
-asm    xchg    bh,[es:di]      // load latches and write pixels\r
+asm     mov     al,[BYTE PTR maskright]\r
+asm     out     dx,al           // mask off pixels\r
+asm     xchg    bh,[es:di]      // load latches and write pixels\r
 \r
 }\r
 \r
@@ -372,7 +372,7 @@ asm xchg    bh,[es:di]      // load latches and write pixels
 //==========================================================================\r
 \r
 \r
-long           wallscalesource;\r
+long            wallscalesource;\r
 \r
 #ifdef DRAWEACH\r
 /*\r
@@ -385,7 +385,7 @@ long                wallscalesource;
 \r
 void near ScaleOneWall (int xl, int xh)\r
 {\r
-       int     x,pixwidth,height;\r
+       int     x,pixwidth,height;\r
 \r
        *(((unsigned *)&wallscalesource)+1) = wallseg[xl];\r
 \r
@@ -401,190 +401,281 @@ void near ScaleOneWall (int xl, int xh)
                //\r
                // scale a byte wide strip of wall\r
                //\r
-               asm     mov     bx,[x]\r
-               asm     mov     di,bx\r
-               asm     shr     di,1\r
-               asm     shr     di,1\r
-               asm     shr     di,1                                            // X in bytes\r
-               asm     add     di,[bufferofs]\r
-               asm     and     bx,7\r
-               asm     shl     bx,1\r
-               asm     shl     bx,1\r
-               asm     shl     bx,1\r
-               asm     add     bx,[pixwidth]                           // bx = pixel*8+pixwidth-1\r
-               asm     dec     bx\r
-               asm     mov     al,BYTE PTR [bitmasks1+bx]\r
-               asm     mov     dx,GC_INDEX+1\r
-               asm     out     dx,al                                           // set bit mask register\r
-               asm     mov     es,[screenseg]\r
-               asm     lds     si,[wallscalesource]\r
-               asm     call [DWORD PTR ss:scaletablecall]              // scale the line of pixels\r
-\r
-               asm     mov     al,BYTE PTR [ss:bitmasks2+bx]\r
-               asm     or      al,al\r
-               asm     jz      nosecond\r
+               asm     mov     bx,[x]\r
+               asm     mov     di,bx\r
+               asm     shr     di,1\r
+               asm     shr     di,1\r
+               asm     shr     di,1                                            // X in bytes\r
+               asm     add     di,[bufferofs]\r
+               asm     and     bx,7\r
+               asm     shl     bx,1\r
+               asm     shl     bx,1\r
+               asm     shl     bx,1\r
+               asm     add     bx,[pixwidth]                           // bx = pixel*8+pixwidth-1\r
+               asm     dec     bx\r
+               asm     mov     al,BYTE PTR [bitmasks1+bx]\r
+               asm     mov     dx,GC_INDEX+1\r
+               asm     out     dx,al                                           // set bit mask register\r
+               asm     mov     es,[screenseg]\r
+               asm     lds     si,[wallscalesource]\r
+               asm     call [DWORD PTR ss:scaletablecall]              // scale the line of pixels\r
+\r
+               asm     mov     al,BYTE PTR [ss:bitmasks2+bx]\r
+               asm     or      al,al\r
+               asm     jz      nosecond\r
 \r
                //\r
                // draw a second byte for vertical strips that cross two bytes\r
                //\r
-               asm     inc     di\r
-               asm     out     dx,al                                           // set bit mask register\r
-               asm     call [DWORD PTR ss:scaletablecall]      // scale the line of pixels\r
+               asm     inc     di\r
+               asm     out     dx,al                                           // set bit mask register\r
+               asm     call [DWORD PTR ss:scaletablecall]      // scale the line of pixels\r
        nosecond:\r
-               asm     mov     ax,ss\r
-               asm     mov     ds,ax\r
+               asm     mov     ax,ss\r
+               asm     mov     ds,ax\r
        }\r
 }\r
 \r
 #endif\r
 \r
+char wall_anim_pos[NUMFLOORS];\r
+\r
 // EAST / WEST WALLS\r
 //\r
-int    walllight1[NUMFLOORS] = {0,\r
-       W_WARP1EWPIC,\r
-       W_NEMPICEWPIC,W_PENTAEWPIC,W_ALTER_LFPIC,W_ALTER_RTPIC,\r
-       W_SUB1EWPIC,W_SUB2EWPIC,W_SUB3EWPIC,\r
+int     far walllight1[NUMFLOORS] = {0,\r
 \r
-       W_TORCH1PIC,W_TORCH2PIC,\r
-       W_LSUB_STONEPIC,\r
-       W_BLOODY_LSUB_STONEPIC,\r
-       W_BREATH_LWALL1PIC,W_BREATH_LWALL2PIC,\r
+       CRYSTAL_LIGHT_1PIC,\r
+       CRYSTAL_LIGHT_2PIC,\r
+       CRYSTAL_LIGHT_3PIC,\r
+       CRYSTAL_LIGHT_4PIC,                     //4\r
 \r
-       EXPWALL1PIC,EXPWALL2PIC,EXPWALL3PIC,\r
+       FIRE_WALL_1PIC,\r
+       FIRE_WALL_2PIC,\r
+       FIRE_WALL_3PIC,\r
+       FIRE_WALL_4PIC,                         //8\r
 \r
-       W_WOOD_DOORWAYPIC,W_WOOD_DOORWAY_GLOWPIC,\r
+       BRN_STONE_GATEPIC,\r
+       BRN_STONE_WALL_1PIC,\r
+       KUDZU_WEAK_LIGHTPIC,\r
+       KUDZU_LIGHT_WALLPIC,\r
+       HEDGE_WALLPIC,\r
+       HEDGE_EYESPIC,                          //14\r
 \r
-       W_WATER1EWPIC,W_DRAIN1EWPIC,\r
-       W_WATER2EWPIC,W_DRAIN2EWPIC,\r
+       W_GEN_DOOR1PIC,                                 //15\r
+       BRN_WINDOW_LIGHTPIC,\r
 \r
-       W_WOODEN_DOORPIC,W_WOOD_DOOREWPIC,W_METAL_DOORPIC,W_GLOW_DOORPIC,\r
+       ALTAR_LEFTPIC,\r
+       ALTAR_RIGHTPIC,\r
+       GRAY_LIGHT_WALLPIC,\r
+       GRAY_LIGHT_SIGNPIC,                     //20\r
 \r
-       W_FINALEXITPIC,\r
+       MANICLE_LIGHT_WALLPIC,\r
+       MANICLE_LIGHT_BLOODYPIC,\r
 \r
-       W_WATER_EXP1PIC,W_WATER_EXP2PIC,W_WATER_EXP3PIC,\r
+       LIGHT_CURTAIN_WINDOWPIC,\r
+       LIGHT_CURTAIN_WALLPIC,\r
+       BRN_LIGHT_SIGNPIC,                      //25\r
 \r
-       W_PRE_CHEATSPIC,W_CHEAT_WARPPIC,W_CHEAT_FREEZEPIC,W_SURFACE_PLAQPIC,\r
+       LIGHT_STONE_WALLPIC,\r
 \r
-       W_WATER_GATEEW1PIC,\r
-       WALL8LPIC,WALL9LPIC,WALL10DPIC,WALL11LPIC,WALL12LPIC,WALL13LPIC,WALL14LPIC,WALL15LPIC,\r
-       WALL16LPIC,WALL17LPIC,W_WINDOWEWPIC,WALL19LPIC,WALL20LPIC,WALL21LPIC,\r
-       WALL22LPIC,WALL23LPIC,WALL24LPIC,WALL25LPIC,WALL26LPIC,WALL27LPIC,\r
-       WALL28LPIC,WALL29LPIC,WALL30LPIC,WALL31LPIC,\r
-       W_BREATH_LWALL4PIC,W_BREATH_LWALL3PIC,\r
-       MAGE_STATUEPIC,ZOMBIE_STATUEPIC,EYE_STATUEPIC,NEM_STATUEPIC,\r
-       SKELETON_STATUEPIC,SPOOK_STATUEPIC,ORCH_STATUEPIC,\r
-       };\r
+       W_GEN_DOOR2PIC,                                 //27\r
 \r
-// NORTH / SOUTH WALLS\r
-//\r
-int    walldark1[NUMFLOORS] = {0,\r
-       W_WARP1NSPIC,\r
-       W_NEMPICEWPIC,W_PENTANSPIC,1,1,\r
-       W_SUB1NSPIC,W_SUB2NSPIC,W_SUB3NSPIC,\r
+       TROLL_LIGHT_STONEPIC,\r
 \r
-       W_TORCH1PIC,W_TORCH2PIC,\r
-       W_DSUB_STONEPIC,\r
-       W_BLOODY_DSUB_STONEPIC,\r
-       W_BREATH_DWALL1PIC,W_BREATH_DWALL2PIC,\r
+       BRN_FLAGSTONE_LIGHT_2PIC,\r
 \r
-       EXPWALL1PIC,EXPWALL2PIC,EXPWALL3PIC,\r
+       W_CRYSTAL_DOORPIC,\r
 \r
-       W_WOOD_DOORWAYPIC,W_WOOD_DOORWAY_GLOWPIC,\r
+       DMG_BRN_FSTN_LTPIC,\r
 \r
-       W_WATER1NSPIC,W_DRAIN1NSPIC,\r
-       W_WATER2NSPIC,W_DRAIN2NSPIC,\r
-       W_WOODEN_DOORPIC,W_WOOD_DOORNSPIC,W_METAL_DOORPIC,W_GLOW_DOORPIC,\r
+       RUST_METAL_LIGHTPIC,\r
+       GRAY_METAL_LIGHTPIC,                    //33\r
 \r
-       W_FINALEXITPIC,\r
+       WEAK_STONE_LIGHTPIC,\r
 \r
-       W_WATER_EXP1PIC,W_WATER_EXP2PIC,W_WATER_EXP3PIC,\r
+       DMG_FIN_FSTN_LTPIC,\r
 \r
-       W_CHEAT_GODPIC,W_CHEAT_ITEMSPIC,W_POST_CHEATPIC,W_SURFACE_PLAQPIC,\r
+       WEAK_GRAY_RFGSTN_LIGHTPIC,\r
+       0,\r
 \r
-       W_WATER_GATENS1PIC,\r
-       WALL8DPIC,WALL9DPIC,WALL10LPIC,WALL11DPIC,WALL12DPIC,WALL13DPIC,WALL14DPIC,WALL15DPIC,\r
-       WALL16DPIC,WALL17DPIC,W_WINDOWNSPIC,WALL19DPIC,WALL20DPIC,WALL21DPIC,\r
-       WALL22DPIC,WALL23DPIC,WALL24DPIC,WALL25DPIC,WALL26DPIC,WALL27DPIC,\r
-       WALL28DPIC,WALL29DPIC,WALL30DPIC,WALL31DPIC,\r
-       W_BREATH_DWALL4PIC,W_BREATH_DWALL3PIC,\r
-       MAGE_STATUEPIC,ZOMBIE_STATUEPIC,EYE_STATUEPIC,NEM_STATUEPIC,\r
-       SKELETON_STATUEPIC,SPOOK_STATUEPIC,ORCH_STATUEPIC,\r
-       };\r
+       WEAK_CRYSTAL_LIGHTPIC,\r
 \r
-// EAST / WEST WALLS\r
-//\r
-int    walllight2[NUMFLOORS] = {0,\r
-       W_WARP2EWPIC,\r
-       W_NEMPICEWPIC,W_PENTAEWPIC,W_ALTER_LFPIC,W_ALTER_RTPIC,\r
-       W_SUB1EWPIC,W_SUB2EWPIC,W_SUB3EWPIC,\r
+       RED_MUD_LIGHTPIC,\r
+\r
+       STEEL_DOOR1PIC,                         //40\r
+\r
+       RED_MUD_WEAK_LIGHTPIC,\r
+\r
+       STEEL_DOOR2PIC,                         //42\r
 \r
-       W_TORCH2PIC,W_TORCH1PIC,\r
-       W_LSUB_STONEPIC,\r
-       W_BLOODY_LSUB_STONEPIC,\r
-       W_BREATH_LWALL2PIC,W_BREATH_LWALL1PIC,\r
+       HORN_DOORPIC,\r
+       TROLL_BLOODY_LT_STONEPIC,\r
+       CLOSED_DOOR_1PIC,\r
 \r
-       EXPWALL2PIC,EXPWALL1PIC,EXPWALL3PIC,\r
+       GRY_DOOR_LTPIC,                         //46\r
 \r
-       W_WOOD_DOORWAYPIC,W_WOOD_DOORWAY_GLOWPIC,\r
+       BRN_DOOR_LTPIC,                         //47\r
 \r
-       W_WATER2EWPIC,W_DRAIN2EWPIC,\r
-       W_WATER1EWPIC,W_DRAIN1EWPIC,\r
+       GRY_FGSTN_LTPIC,                           //48\r
+       DOOR_2PIC,\r
 \r
-       W_WOODEN_DOORPIC,W_WOOD_DOOREWPIC,W_METAL_DOORPIC,W_GLOW_DOORPIC,\r
+       WATER_LIGHT_WEAK_1PIC,\r
+       WATER_LIGHT_WEAK_2PIC,\r
+       WATER_LIGHT_WEAK_3PIC,                  //52\r
 \r
-       W_FINALEXITPIC,\r
+       WATER_LIGHT_1PIC,\r
+       WATER_LIGHT_2PIC,\r
+       WATER_LIGHT_3PIC,\r
 \r
-       W_WATER_EXP2PIC,W_WATER_EXP1PIC,W_WATER_EXP1PIC,\r
+       LIGHT_BREATH_1PIC,\r
+       LIGHT_BREATH_2PIC,\r
+       LIGHT_BREATH_3PIC,                      //58\r
 \r
-       W_PRE_CHEATSPIC,W_CHEAT_WARPPIC,W_CHEAT_FREEZEPIC,W_SURFACE_PLAQPIC,\r
+       EXP_WALL_1PIC,\r
+       EXP_WALL_2PIC,\r
+       EXP_WALL_3PIC,\r
 \r
-       W_WATER_GATEEW2PIC,\r
-       WALL8LPIC,WALL9LPIC,WALL10DPIC,WALL11LPIC,WALL12LPIC,WALL13LPIC,WALL14LPIC,WALL15LPIC,\r
-       WALL16LPIC,WALL17LPIC,W_WINDOWEWPIC,WALL19LPIC,WALL20LPIC,WALL21LPIC,\r
-       WALL22LPIC,WALL23LPIC,WALL24LPIC,WALL25LPIC,WALL26LPIC,WALL27LPIC,\r
-       WALL28LPIC,WALL29LPIC,WALL30LPIC,WALL31LPIC,\r
-       W_BREATH_LWALL3PIC,W_BREATH_LWALL4PIC,\r
-       MAGE_STATUEPIC,ZOMBIE_STATUEPIC,EYE_STATUEPIC,NEM_STATUEPIC,\r
-       SKELETON_STATUEPIC,SPOOK_STATUEPIC,ORCH_STATUEPIC,\r
+       WATER_EXP_WALL_1PIC,\r
+       WATER_EXP_WALL_2PIC,\r
+       WATER_EXP_WALL_3PIC,                    //64\r
+\r
+       FINALWALLPIC,\r
+\r
+       LT_SKEL1PIC,\r
+       DK_SKEL1PIC,\r
+       LT_SKEL2PIC,\r
+       DK_SKEL2PIC,\r
+\r
+       0,\r
+\r
+       TAP_1PIC,\r
+       TAP_2PIC,\r
+       TAP_3PIC,\r
+       TAP_4PIC,\r
+       TAP_5PIC,\r
+\r
+       WATER_DOOR1_PIC,\r
+       WATER_DOOR2_PIC,\r
        };\r
 \r
 // NORTH / SOUTH WALLS\r
 //\r
-int    walldark2[NUMFLOORS] = {0,\r
-       W_WARP2NSPIC,\r
-       W_NEMPICEWPIC,W_PENTANSPIC,1,1,\r
-       W_SUB1NSPIC,W_SUB2NSPIC,W_SUB3NSPIC,\r
+int     far walldark1[NUMFLOORS] = {0,\r
+\r
+       CRYSTAL_DARK_1PIC,\r
+       CRYSTAL_DARK_2PIC,\r
+       CRYSTAL_DARK_3PIC,\r
+       CRYSTAL_DARK_4PIC,                      //4\r
+\r
+       FIRE_WALL_1PIC,\r
+       FIRE_WALL_2PIC,\r
+       FIRE_WALL_3PIC,\r
+       FIRE_WALL_4PIC,                         //8\r
+\r
+       BRN_STONE_GATEPIC,\r
+       BRN_STONE_WALL_2PIC,\r
+       KUDZU_WEAK_DARKPIC,\r
+       KUDZU_DARK_WALLPIC,\r
+       HEDGE_WALLPIC,\r
+       HEDGE_EYESPIC,                          //14\r
+\r
+       W_GEN_DOOR1PIC,                         //15\r
+       BRN_WINDOW_DARKPIC,\r
+\r
+       ALTAR_LEFTPIC,\r
+       ALTAR_RIGHTPIC,\r
+       GRAY_DARK_WALLPIC,\r
+       GRAY_DARK_SIGNPIC,                      //20\r
+\r
+       MANICLE_DARK_WALLPIC,\r
+       MANICLE_DARK_BLOODYPIC,\r
+\r
+       DARK_CURTAIN_WINDOWPIC,\r
+       DARK_CURTAIN_WALLPIC,\r
+       BRN_DARK_SIGNPIC,\r
+\r
+       DARK_STONE_WALLPIC,\r
+\r
+       W_GEN_DOOR2PIC,                         //27\r
+\r
+       TROLL_DARK_STONEPIC,\r
+\r
+       BRN_FLAGSTONE_DARK_2PIC,\r
+\r
+       W_CRYSTAL_DOORPIC,                              //30\r
+\r
+       DMG_BRN_FSTN_DKPIC,\r
+\r
+       RUST_METAL_DARKPIC,\r
+       GRAY_METAL_DARKPIC,\r
+\r
+       WEAK_STONE_DARKPIC,\r
+\r
+       DMG_FIN_FSTN_DKPIC,                     //35\r
+\r
+       WEAK_GRAY_RFGSTN_DARKPIC,\r
+       0,\r
+\r
+       WEAK_CRYSTAL_DARKPIC,\r
+\r
+       BRN_MUD_DARKPIC,\r
+\r
+       STEEL_DOOR1PIC,                         //40\r
+\r
+       BRN_MUD_WEAK_DARKPIC,\r
+\r
+       STEEL_DOOR2PIC,\r
+\r
+       HORN_DOORPIC,\r
+       TROLL_BLOODY_DK_STONEPIC,\r
 \r
-       W_TORCH2PIC,W_TORCH1PIC,\r
-       W_DSUB_STONEPIC,\r
-       W_BLOODY_DSUB_STONEPIC,\r
-       W_BREATH_DWALL2PIC,W_BREATH_DWALL1PIC,\r
+       CLOSED_DOOR_1PIC,\r
 \r
-       EXPWALL2PIC,EXPWALL1PIC,EXPWALL3PIC,\r
+       GRY_DOOR_DKPIC,                         //46\r
+       BRN_DOOR_DKPIC,                         //47\r
+       GRY_FGSTN_DKPIC,                                //48\r
+       DOOR_2PIC,\r
 \r
-       W_WOOD_DOORWAYPIC,W_WOOD_DOORWAY_GLOWPIC,\r
+       WATER_DARK_WEAK_1PIC,\r
+       WATER_DARK_WEAK_2PIC,\r
+       WATER_DARK_WEAK_3PIC,\r
 \r
-       W_WATER2NSPIC,W_DRAIN2NSPIC,\r
-       W_WATER1NSPIC,W_DRAIN1NSPIC,\r
+       WATER_DARK_1PIC,\r
+       WATER_DARK_2PIC,\r
+       WATER_DARK_3PIC,\r
 \r
-       W_WOODEN_DOORPIC,W_WOOD_DOORNSPIC,W_METAL_DOORPIC,W_GLOW_DOORPIC,\r
+       DARK_BREATH_1PIC,\r
+       DARK_BREATH_2PIC,\r
+       DARK_BREATH_3PIC,\r
 \r
-       W_FINALEXITPIC,\r
+       EXP_WALL_1PIC,\r
+       EXP_WALL_2PIC,\r
+       EXP_WALL_3PIC,\r
 \r
-       W_WATER_EXP2PIC,W_WATER_EXP1PIC,W_WATER_EXP1PIC,\r
+       WATER_EXP_WALL_1PIC,\r
+       WATER_EXP_WALL_2PIC,\r
+       WATER_EXP_WALL_3PIC,\r
 \r
-       W_CHEAT_GODPIC,W_CHEAT_ITEMSPIC,W_POST_CHEATPIC,W_SURFACE_PLAQPIC,\r
+       FINALWALLPIC,\r
 \r
-       W_WATER_GATENS2PIC,\r
-       WALL8DPIC,WALL9DPIC,WALL10LPIC,WALL11DPIC,WALL12DPIC,WALL13DPIC,WALL14DPIC,WALL15DPIC,\r
-       WALL16DPIC,WALL17DPIC,W_WINDOWNSPIC,WALL19DPIC,WALL20DPIC,WALL21DPIC,\r
-       WALL22DPIC,WALL23DPIC,WALL24DPIC,WALL25DPIC,WALL26DPIC,WALL27DPIC,\r
-       WALL28DPIC,WALL29DPIC,WALL30DPIC,WALL31DPIC,\r
-       W_BREATH_DWALL3PIC,W_BREATH_DWALL4PIC,\r
-       MAGE_STATUEPIC,ZOMBIE_STATUEPIC,EYE_STATUEPIC,NEM_STATUEPIC,\r
-       SKELETON_STATUEPIC,SPOOK_STATUEPIC,ORCH_STATUEPIC,\r
+       LT_SKEL1PIC,\r
+       DK_SKEL1PIC,\r
+       LT_SKEL2PIC,\r
+       DK_SKEL2PIC,\r
+\r
+       0,\r
+\r
+       TAP_1PIC,\r
+       TAP_2PIC,\r
+       TAP_3PIC,\r
+       TAP_4PIC,\r
+       TAP_5PIC,\r
+\r
+       WATER_DOOR1_PIC,\r
+       WATER_DOOR2_PIC,\r
        };\r
 \r
+\r
 /*\r
 =====================\r
 =\r
@@ -601,21 +692,18 @@ int       walldark2[NUMFLOORS] = {0,
 \r
 void DrawVWall (walltype *wallptr)\r
 {\r
-       int                     x,i;\r
-       unsigned        source;\r
-       unsigned        width,sourceint;\r
-       unsigned        wallpic,wallpicseg;\r
-       unsigned        skip;\r
-       long            fracheight,fracstep,longheightchange;\r
-       unsigned        height;\r
-       int                     heightchange;\r
-       unsigned        slope,distance;\r
-       int                     traceangle,angle;\r
-       int                     mapadd;\r
-       unsigned        lastpix,lastsource,lastwidth;\r
-\r
-       short mike;\r
-\r
+       int                     x,i;\r
+       unsigned        source;\r
+       unsigned        width,sourceint;\r
+       unsigned        wallpic,wallpicseg;\r
+       unsigned        skip;\r
+       long            fracheight,fracstep,longheightchange;\r
+       unsigned        height;\r
+       int                     heightchange;\r
+       unsigned        slope,distance;\r
+       int                     traceangle,angle;\r
+       int                     mapadd;\r
+       unsigned        lastpix,lastsource,lastwidth;\r
 \r
        if (wallptr->rightclip < wallptr->leftclip)\r
                Quit ("DrawVWall: Right < Left");\r
@@ -625,15 +713,15 @@ void DrawVWall (walltype *wallptr)
 //\r
        wallptr->height1 >>= 1;\r
        wallptr->height2 >>= 1;\r
-       wallptr->planecoord>>=10;                       // remove non significant bits\r
+       wallptr->planecoord>>=10;                       // remove non significant bits\r
 \r
        width = wallptr->x2 - wallptr->x1;\r
        if (width)\r
        {\r
                heightchange = wallptr->height2 - wallptr->height1;\r
-               asm     mov     ax,[heightchange]\r
-               asm     mov     WORD PTR [longheightchange+2],ax\r
-               asm     mov     WORD PTR [longheightchange],0   // avoid long shift by 16\r
+               asm     mov     ax,[heightchange]\r
+               asm     mov     WORD PTR [longheightchange+2],ax\r
+               asm     mov     WORD PTR [longheightchange],0   // avoid long shift by 16\r
                fracstep = longheightchange/width;\r
        }\r
 \r
@@ -655,55 +743,41 @@ void DrawVWall (walltype *wallptr)
        // find wall picture to map from\r
        //\r
        if (wallptr->side)\r
-       {       // east or west wall\r
-\r
-               if (wallptr->color == 1)\r
-                       mike = 1;\r
-\r
-               if (animframe)\r
-                       wallpic = walllight2[wallptr->color];\r
-               else\r
-                       wallpic = walllight1[wallptr->color];\r
+       {       // east or west wall\r
 \r
+               wallpic = walllight1[wallptr->color+wall_anim_pos[wallptr->color]];\r
                if (wallptr->planecoord < viewxpix)\r
                {\r
                        distance = viewxpix-wallptr->planecoord;\r
                        traceangle -= FINEANGLES/2;\r
-                       mapadd = (64-viewypix&63);              // the pixel spot of the origin\r
+                       mapadd = (64-viewypix&63);              // the pixel spot of the origin\r
                }\r
                else\r
                {\r
                        distance = wallptr->planecoord-viewxpix;\r
                        // traceangle is correct\r
-                       mapadd = viewypix&63;           // the pixel spot of the origin\r
+                       mapadd = viewypix&63;           // the pixel spot of the origin\r
                }\r
        }\r
        else\r
-       {       // north or south wall\r
-\r
-               if (wallptr->color == 1)\r
-                       mike = 1;\r
-\r
-               if (animframe)\r
-                       wallpic = walldark2[wallptr->color];\r
-               else\r
-                       wallpic = walldark1[wallptr->color];\r
+       {       // north or south wall\r
 \r
+               wallpic = walldark1[wallptr->color+wall_anim_pos[wallptr->color]];\r
                if (wallptr->planecoord < viewypix)\r
                {\r
                        distance = viewypix-wallptr->planecoord;\r
                        traceangle -= FINEANGLES/4;\r
-                       mapadd = viewxpix&63;           // the pixel spot of the origin\r
+                       mapadd = viewxpix&63;           // the pixel spot of the origin\r
                }\r
                else\r
                {\r
                        distance = wallptr->planecoord-viewypix;\r
                        traceangle -= FINEANGLES*3/4;\r
-                       mapadd = (64-viewxpix&63);              // the pixel spot of the origin\r
+                       mapadd = (64-viewxpix&63);              // the pixel spot of the origin\r
                }\r
        }\r
 \r
-       mapadd = 64*64-mapadd;                          // make sure it stays positive\r
+       mapadd = 64*64-mapadd;                          // make sure it stays positive\r
 \r
        wallpicseg = (unsigned)walldirectory[wallpic-FIRSTWALLPIC];\r
        if (traceangle > FINEANGLES/2)\r
@@ -721,27 +795,27 @@ void DrawVWall (walltype *wallptr)
                //\r
                // height\r
                //\r
-               asm     mov     ax,WORD PTR [fracheight]\r
-               asm     mov     dx,WORD PTR [fracheight+2]\r
-               asm     mov     cx,dx\r
-               asm     add     ax,WORD PTR [fracstep]\r
-               asm     adc     dx,WORD PTR [fracstep+2]\r
-               asm     mov     WORD PTR [fracheight],ax\r
-               asm     mov     WORD PTR [fracheight+2],dx\r
-               asm     mov     bx,[x]\r
-               asm     shl     bx,1\r
-               asm     cmp     cx,MAXSCALEHEIGHT\r
-               asm     jbe     storeheight\r
-               asm     mov     cx,MAXSCALEHEIGHT\r
+               asm     mov     ax,WORD PTR [fracheight]\r
+               asm     mov     dx,WORD PTR [fracheight+2]\r
+               asm     mov     cx,dx\r
+               asm     add     ax,WORD PTR [fracstep]\r
+               asm     adc     dx,WORD PTR [fracstep+2]\r
+               asm     mov     WORD PTR [fracheight],ax\r
+               asm     mov     WORD PTR [fracheight+2],dx\r
+               asm     mov     bx,[x]\r
+               asm     shl     bx,1\r
+               asm     cmp     cx,MAXSCALEHEIGHT\r
+               asm     jbe     storeheight\r
+               asm     mov     cx,MAXSCALEHEIGHT\r
 storeheight:\r
-               asm     mov WORD PTR [wallheight+bx],cx\r
-               asm     mov WORD PTR [zbuffer+bx],cx\r
+               asm     mov WORD PTR [wallheight+bx],cx\r
+               asm     mov WORD PTR [zbuffer+bx],cx\r
 \r
-//             height = fracheight>>16;\r
-//             fracheight += fracstep;\r
-//             if (height > MAXSCALEHEIGHT)\r
-//                     height = MAXSCALEHEIGHT;\r
-//             wallheight[x] = zbuffer[x] = height;\r
+//              height = fracheight>>16;\r
+//              fracheight += fracstep;\r
+//              if (height > MAXSCALEHEIGHT)\r
+//                      height = MAXSCALEHEIGHT;\r
+//              wallheight[x] = zbuffer[x] = height;\r
 \r
                //\r
                // texture map\r
@@ -763,26 +837,26 @@ storeheight:
                source >>=20;\r
 \r
                source += mapadd;\r
-               source &= 63;                           // mask off the unused units\r
+               source &= 63;                           // mask off the unused units\r
                source = 63-source;\r
-               source <<= 6;                           // multiply by 64 for offset into pic\r
+               source <<= 6;                           // multiply by 64 for offset into pic\r
 #endif\r
-               asm     mov     ax,[distance]\r
-               asm     imul    [slope]                 // ax is the source pixel\r
-               asm     mov     al,ah\r
-               asm     shr     al,1\r
-               asm     shr     al,1                            // low 6 bits is now pixel number\r
-               asm     add     ax,[mapadd]\r
-               asm     and ax,63\r
-               asm     mov     dx,63\r
-               asm     sub     dx,ax                           // otherwise it is backwards\r
-               asm     shl     dx,1\r
-               asm     shl     dx,1\r
-               asm     shl     dx,1\r
-               asm     shl     dx,1\r
-               asm     shl     dx,1\r
-               asm     shl     dx,1                            // *64 to index into shape\r
-               asm     mov     [source],dx\r
+               asm     mov     ax,[distance]\r
+               asm     imul    [slope]                 // ax is the source pixel\r
+               asm     mov     al,ah\r
+               asm     shr     al,1\r
+               asm     shr     al,1                            // low 6 bits is now pixel number\r
+               asm     add     ax,[mapadd]\r
+               asm     and ax,63\r
+               asm     mov     dx,63\r
+               asm     sub     dx,ax                           // otherwise it is backwards\r
+               asm     shl     dx,1\r
+               asm     shl     dx,1\r
+               asm     shl     dx,1\r
+               asm     shl     dx,1\r
+               asm     shl     dx,1\r
+               asm     shl     dx,1                            // *64 to index into shape\r
+               asm     mov     [source],dx\r
 \r
                if (source != lastsource)\r
                {\r
@@ -797,7 +871,7 @@ storeheight:
                        lastwidth = 1;\r
                }\r
                else\r
-                       lastwidth++;                    // optimized draw, same map as last one\r
+                       lastwidth++;                    // optimized draw, same map as last one\r
        }\r
        wallofs[lastpix] = lastsource;\r
        wallseg[lastpix] = wallpicseg;\r
@@ -817,8 +891,8 @@ storeheight:
 = Follows a ray of the given angle from viewx,viewy in the global map until\r
 = it hits a solid tile\r
 = sets:\r
-=   tile.x,tile.y      : tile coordinates of contacted tile\r
-=   tilecolor  : solid tile's color\r
+=   tile.x,tile.y       : tile coordinates of contacted tile\r
+=   tilecolor   : solid tile's color\r
 =\r
 ==================\r
 */\r
@@ -842,21 +916,21 @@ void TraceRay (unsigned angle)
   fixtemp = FixedByFrac(prestep,traceystep);\r
   tracey = viewy-fixtemp;\r
 \r
-  tile.x = tracex>>TILESHIFT;  // starting point in tiles\r
+  tile.x = tracex>>TILESHIFT;   // starting point in tiles\r
   tile.y = tracey>>TILESHIFT;\r
 \r
 \r
-  if (tracexstep<0)                    // use 2's complement, not signed magnitude\r
+  if (tracexstep<0)                     // use 2's complement, not signed magnitude\r
        tracexstep = -(tracexstep&0x7fffffff);\r
 \r
-  if (traceystep<0)                    // use 2's complement, not signed magnitude\r
+  if (traceystep<0)                     // use 2's complement, not signed magnitude\r
        traceystep = -(traceystep&0x7fffffff);\r
 \r
 //\r
 // we assume viewx,viewy is not inside a solid tile, so go ahead one step\r
 //\r
 \r
-  do   // until a solid tile is hit\r
+  do    // until a solid tile is hit\r
   {\r
     otx = tile.x;\r
        oty = tile.y;\r
@@ -948,7 +1022,7 @@ void TraceRay (unsigned angle)
 ========================\r
 */\r
 \r
-#pragma warn -rvl                      // I stick the return value in with ASMs\r
+#pragma warn -rvl                       // I stick the return value in with ASMs\r
 \r
 fixed FixedByFrac (fixed a, fixed b)\r
 {\r
@@ -957,40 +1031,40 @@ fixed FixedByFrac (fixed a, fixed b)
 //\r
 // setup\r
 //\r
-asm    mov     si,[WORD PTR b+2]       // sign of result = sign of fraction\r
+asm     mov     si,[WORD PTR b+2]       // sign of result = sign of fraction\r
 \r
-asm    mov     ax,[WORD PTR a]\r
-asm    mov     cx,[WORD PTR a+2]\r
+asm     mov     ax,[WORD PTR a]\r
+asm     mov     cx,[WORD PTR a+2]\r
 \r
-asm    or      cx,cx\r
-asm    jns     aok:                            // negative?\r
-asm    not     ax\r
-asm    not     cx\r
-asm    add     ax,1\r
-asm    adc     cx,0\r
-asm    xor     si,0x8000                       // toggle sign of result\r
+asm     or      cx,cx\r
+asm     jns     aok:                            // negative?\r
+asm     not     ax\r
+asm     not     cx\r
+asm     add     ax,1\r
+asm     adc     cx,0\r
+asm     xor     si,0x8000                       // toggle sign of result\r
 aok:\r
 \r
 //\r
 // multiply  cx:ax by bx\r
 //\r
-asm    mov     bx,[WORD PTR b]\r
-asm    mul     bx                                      // fraction*fraction\r
-asm    mov     di,dx                           // di is low word of result\r
-asm    mov     ax,cx                           //\r
-asm    mul     bx                                      // units*fraction\r
-asm add        ax,di\r
-asm    adc     dx,0\r
+asm     mov     bx,[WORD PTR b]\r
+asm     mul     bx                                      // fraction*fraction\r
+asm     mov     di,dx                           // di is low word of result\r
+asm     mov     ax,cx                           //\r
+asm     mul     bx                                      // units*fraction\r
+asm add ax,di\r
+asm     adc     dx,0\r
 \r
 //\r
 // put result dx:ax in 2's complement\r
 //\r
-asm    test    si,0x8000               // is the result negative?\r
-asm    jz      ansok:\r
-asm    not     ax\r
-asm    not     dx\r
-asm    add     ax,1\r
-asm    adc     dx,0\r
+asm     test    si,0x8000               // is the result negative?\r
+asm     jz      ansok:\r
+asm     not     ax\r
+asm     not     dx\r
+asm     add     ax,1\r
+asm     adc     dx,0\r
 \r
 ansok:;\r
 \r
@@ -1014,44 +1088,44 @@ fixed FixedAdd (fixed a, fixed b)
 {\r
   fixed value;\r
 \r
-asm    mov     ax,[WORD PTR a]\r
-asm    mov     dx,[WORD PTR a+2]\r
+asm     mov     ax,[WORD PTR a]\r
+asm     mov     dx,[WORD PTR a+2]\r
 \r
-asm    mov     bx,[WORD PTR b]\r
-asm    mov     cx,[WORD PTR b+2]\r
+asm     mov     bx,[WORD PTR b]\r
+asm     mov     cx,[WORD PTR b+2]\r
 \r
-asm    or      dx,dx\r
-asm    jns     aok:            // negative?\r
-asm    and     dx,0x7fff\r
-asm    not     ax              // convert a from signed magnitude to 2's compl\r
-asm    not     dx\r
-asm    add     ax,1\r
-asm    adc     dx,0\r
+asm     or      dx,dx\r
+asm     jns     aok:            // negative?\r
+asm     and     dx,0x7fff\r
+asm     not     ax              // convert a from signed magnitude to 2's compl\r
+asm     not     dx\r
+asm     add     ax,1\r
+asm     adc     dx,0\r
 aok:\r
 \r
-asm    or      cx,cx\r
-asm    jns     bok:            // negative?\r
-asm    and     cx,0x7fff\r
-asm    not     bx              // convert b from signed magnitude to 2's compl\r
-asm    not     cx\r
-asm    add     bx,1\r
-asm    adc     cx,0\r
+asm     or      cx,cx\r
+asm     jns     bok:            // negative?\r
+asm     and     cx,0x7fff\r
+asm     not     bx              // convert b from signed magnitude to 2's compl\r
+asm     not     cx\r
+asm     add     bx,1\r
+asm     adc     cx,0\r
 bok:\r
 \r
-asm    add     ax,bx           // perform the addition\r
-asm    adc     dx,cx\r
-asm    jns     done\r
+asm     add     ax,bx           // perform the addition\r
+asm     adc     dx,cx\r
+asm     jns     done\r
 \r
-asm    and     dx,0x7fff       // value was negative\r
-asm    not     ax              // back to signed magnitude\r
-asm    not     dx\r
-asm    add     ax,1\r
-asm    adc     dx,0\r
+asm     and     dx,0x7fff       // value was negative\r
+asm     not     ax              // back to signed magnitude\r
+asm     not     dx\r
+asm     add     ax,1\r
+asm     adc     dx,0\r
 \r
 done:\r
 \r
-asm    mov     [WORD PTR value],ax\r
-asm    mov     [WORD PTR value+2],dx\r
+asm     mov     [WORD PTR value],ax\r
+asm     mov     [WORD PTR value+2],dx\r
 \r
   return value;\r
 }\r
@@ -1066,18 +1140,18 @@ asm     mov     [WORD PTR value+2],dx
 = TransformPoint\r
 =\r
 = Takes paramaters:\r
-=   gx,gy              : globalx/globaly of point\r
+=   gx,gy               : globalx/globaly of point\r
 =\r
 = globals:\r
-=   viewx,viewy                : point of view\r
-=   viewcos,viewsin    : sin/cos of viewangle\r
+=   viewx,viewy         : point of view\r
+=   viewcos,viewsin     : sin/cos of viewangle\r
 =\r
 =\r
 = defines:\r
-=   CENTERX            : pixel location of center of view window\r
-=   TILEGLOBAL         : size of one\r
-=   FOCALLENGTH                : distance behind viewx/y for center of projection\r
-=   scale              : conversion from global value to screen value\r
+=   CENTERX             : pixel location of center of view window\r
+=   TILEGLOBAL          : size of one\r
+=   FOCALLENGTH         : distance behind viewx/y for center of projection\r
+=   scale               : conversion from global value to screen value\r
 =\r
 = returns:\r
 =   screenx,screenheight: projected edge location and size\r
@@ -1203,22 +1277,22 @@ fixed TransformX (fixed gx, fixed gy)
 =\r
 = Calculates:\r
 =\r
-= scale                        projection constant\r
-= sintable/costable    overlapping fractional tables\r
-= firstangle/lastangle angles from focalpoint to left/right view edges\r
-= prestep              distance from focal point before checking for tiles\r
+= scale                 projection constant\r
+= sintable/costable     overlapping fractional tables\r
+= firstangle/lastangle  angles from focalpoint to left/right view edges\r
+= prestep               distance from focal point before checking for tiles\r
 =\r
 ==================\r
 */\r
 \r
 void BuildTables (void)\r
 {\r
-  int          i;\r
-  long         intang;\r
-  long         x;\r
-  float        angle,anglestep,radtoint;\r
-  double       tang;\r
-  fixed        value;\r
+  int           i;\r
+  long          intang;\r
+  long          x;\r
+  float         angle,anglestep,radtoint;\r
+  double        tang;\r
+  fixed         value;\r
 \r
 //\r
 // calculate the angle offset from view angle of each pixel's ray\r
@@ -1239,7 +1313,7 @@ void BuildTables (void)
 // calculate fine tangents\r
 // 1 sign bit, 5 units (clipped to), 10 fracs\r
 //\r
-#define MININT (-MAXINT)\r
+#define MININT  (-MAXINT)\r
 \r
        for (i=0;i<FINEANGLES/4;i++)\r
        {\r
@@ -1255,8 +1329,8 @@ void BuildTables (void)
                        intang = 0xff00 | (intang & 0xff);\r
 \r
                finetangent[i] = intang;\r
-//             finetangent[FINEANGLES/2+i] = intang;\r
-//             finetangent[FINEANGLES/2-i-1] = -intang;\r
+//              finetangent[FINEANGLES/2+i] = intang;\r
+//              finetangent[FINEANGLES/2-i-1] = -intang;\r
                finetangent[FINEANGLES-i-1] = -intang;\r
        }\r
 \r
@@ -1321,50 +1395,93 @@ void BuildTables (void)
 void ClearScreen (void)\r
 {\r
        unsigned topcolor=*skycolor, bottomcolor=*groundcolor;\r
+       unsigned topimage=topcolor&0xf0,bottomimage=bottomcolor&0xf0;\r
+       unsigned pfoffset=0;\r
+\r
+\r
+#if USE_STRIPS\r
+       if (topimage == 0x20)           // special code for lightning\r
+               topimage = topcolor = 0;\r
+\r
+// Manually wipe screen with solid color.\r
+// If BOTH sky and ground are 'images' don't manually clear it!\r
+//\r
+       if ((!topimage) || (!bottomimage))\r
+       {\r
+#endif\r
 \r
   //\r
   // clear the screen\r
   //\r
-asm    mov     dx,GC_INDEX\r
-asm    mov     ax,GC_MODE + 256*2              // read mode 0, write mode 2\r
-asm    out     dx,ax\r
-asm    mov     ax,GC_BITMASK + 255*256\r
-asm    out     dx,ax\r
+asm     mov     dx,GC_INDEX\r
+asm     mov     ax,GC_MODE + 256*2              // read mode 0, write mode 2\r
+asm     out     dx,ax\r
+asm     mov     ax,GC_BITMASK + 255*256\r
+asm     out     dx,ax\r
 \r
-asm    mov     dx,40-VIEWWIDTH/8\r
-asm    mov     bl,VIEWWIDTH/16\r
-asm    mov     bh,CENTERY+1\r
+//asm     mov     dx,40-VIEWWIDTH/8                                    // dx = modulo\r
+asm     mov     bl,VIEWWIDTH/16\r
+asm     mov     bh,CENTERY+1\r
 \r
-asm    mov     ax,topcolor\r
-asm    mov     es,[screenseg]\r
-asm    mov     di,[bufferofs]\r
-asm    add     di,((SCREENWIDTH*VIEWY)+(VIEWX/8))\r
+asm     mov     ax,topcolor\r
+asm     mov     es,[screenseg]\r
+asm     mov     di,[bufferofs]\r
+asm     add     di,((SCREENWIDTH*VIEWY)+(VIEWX/8))\r
 \r
 toploop:\r
-asm    mov     cl,bl\r
-asm    rep     stosw\r
-asm    stosb\r
-asm    add     di,dx\r
-asm    dec     bh\r
-asm    jnz     toploop\r
+asm     mov     cl,bl\r
+asm     rep     stosw\r
+asm     stosb\r
+//asm     add     di,dx                                        // no need to add "0" modulo\r
+asm     dec     bh\r
+asm     jnz     toploop\r
 \r
-asm    mov     bh,CENTERY+1\r
-asm    mov     ax,bottomcolor\r
+asm     mov     bh,CENTERY+1\r
+asm     mov     ax,bottomcolor\r
 \r
 bottomloop:\r
-asm    mov     cl,bl\r
-asm    rep     stosw\r
-asm    stosb\r
-asm    add     di,dx\r
-asm    dec     bh\r
-asm    jnz     bottomloop\r
+asm     mov     cl,bl\r
+asm     rep     stosw\r
+asm     stosb\r
+//asm     add     di,dx                                        // no need to add "0" modulo\r
+asm     dec     bh\r
+asm     jnz     bottomloop\r
+\r
+#if USE_STRIPS\r
+       }\r
 \r
 \r
-asm    mov     dx,GC_INDEX\r
-asm    mov     ax,GC_MODE + 256*10             // read mode 1, write mode 2\r
-asm    out     dx,ax\r
-asm    mov     al,GC_BITMASK\r
-asm    out     dx,al\r
+//\r
+// code to test parallax turning\r
+//\r
+\r
+       if (topimage)\r
+       {\r
+               topimage -= 16;\r
+               pfoffset = LONG_PERCENTAGE(3200,359,(359-player->angle),12);\r
+               while (pfoffset >= 640)\r
+                       pfoffset -= 640;\r
+               LatchDrawPicStrip(0,0,SKY1PIC+topimage,pfoffset+8);\r
+       }\r
+\r
+       if (bottomimage)\r
+       {\r
+////           pfoffset = LONG_PERCENTAGE(3200,359,(359-player->angle),12)+320;\r
+//             pfoffset += 320;\r
+//             while (pfoffset >= 640)\r
+//                     pfoffset -= 640;\r
+//             LatchDrawPicStrip(0,64,SKY1PIC+topimage,pfoffset+8);\r
+               bottomimage -= 16;\r
+               LatchDrawPic(0,64,GND1PIC+bottomimage);\r
+       }\r
+#endif\r
+\r
+\r
+asm     mov     dx,GC_INDEX\r
+asm     mov     ax,GC_MODE + 256*10             // read mode 1, write mode 2\r
+asm     out     dx,ax\r
+asm     mov     al,GC_BITMASK\r
+asm     out     dx,al\r
 \r
 }\r
 \r
@@ -1385,12 +1502,12 @@ void DrawWallList (void)
        int i,leftx,newleft,rightclip;\r
        walltype *wall, *check;\r
 \r
-asm    mov     ax,ds\r
-asm    mov     es,ax\r
-asm    mov     di,OFFSET wallwidth\r
-asm    xor     ax,ax\r
-asm    mov     cx,VIEWWIDTH/2\r
-asm    rep     stosw\r
+asm     mov     ax,ds\r
+asm     mov     es,ax\r
+asm     mov     di,OFFSET wallwidth\r
+asm     xor     ax,ax\r
+asm     mov     cx,VIEWWIDTH/2\r
+asm     rep     stosw\r
 \r
        ClearScreen ();\r
 \r
@@ -1418,7 +1535,7 @@ asm       rep     stosw
                rightclip=VIEWXH;\r
 \r
          if (leftx < wall->x1 - 1)\r
-               newleft = wall->x1-1;           // there was black space between walls\r
+               newleft = wall->x1-1;           // there was black space between walls\r
          else\r
                newleft = leftx;\r
 \r
@@ -1432,7 +1549,7 @@ asm       rep     stosw
        }\r
 \r
 #ifndef DRAWEACH\r
-       ScaleWalls ();                                  // draw all the walls\r
+       ScaleWalls ();                                  // draw all the walls\r
 #endif\r
 }\r
 \r
@@ -1452,10 +1569,15 @@ objtype *depthsort[MAXACTORS];
 \r
 void DrawScaleds (void)\r
 {\r
-       int             i,j,least,numvisable,height;\r
-       objtype         *obj,**vislist,*farthest;\r
-       memptr          shape;\r
-       byte            *tilespot,*visspot;\r
+#if USE_INERT_LIST\r
+               extern inertobjtype inertobjlist[], *inert;\r
+\r
+               boolean inertlist=false;\r
+#endif\r
+       int             i,j,least,numvisable,height;\r
+       objtype         *obj,**vislist,*farthest;\r
+       memptr          shape;\r
+       byte            *tilespot,*visspot;\r
 \r
        numvisable = 0;\r
 \r
@@ -1464,7 +1586,8 @@ void DrawScaleds (void)
 //\r
        vislist = &depthsort[0];\r
 \r
-       for (obj = player->next;obj;obj=obj->next)\r
+       obj = player->next;\r
+       while (obj)\r
        {\r
                tilespot = &tilemap[0][0]+(obj->tilex<<6)+obj->tiley;\r
                visspot = &spotvis[0][0]+(obj->tilex<<6)+obj->tiley;\r
@@ -1481,27 +1604,44 @@ void DrawScaleds (void)
                || ( *(visspot+64) && !*(tilespot+64) )\r
                || ( *(visspot+63) && !*(tilespot+63) ) )\r
                {\r
-                       if ((obj->active == noalways) || (obj->active == always))\r
-                               obj->active = always;\r
-                       else\r
-                               obj->active = yes;\r
+#if USE_INERT_LIST\r
+                       if (!inertlist)\r
+#endif\r
+                               if ((obj->active == noalways) || (obj->active == always))\r
+                                       obj->active = always;\r
+                               else\r
+                                       obj->active = yes;\r
                        TransformActor (obj);\r
                        if (!obj->viewheight || obj->viewheight > VIEWWIDTH)\r
-                               continue;                       // too close or far away\r
+                               goto cont;                       // too close or far away\r
 \r
                        if (!obj->state->shapenum)\r
-                               continue;\r
+                               goto cont;\r
 \r
                        *vislist++ = obj;\r
                        numvisable++;\r
                }\r
                else\r
-                       if ((obj->active != always) && (obj->active != noalways))\r
-                               obj->active = no;\r
+#if USE_INERT_LIST\r
+                       if (!inertlist)\r
+#endif\r
+                               if ((obj->active != always) && (obj->active != noalways))\r
+                                       obj->active = no;\r
+\r
+cont:;\r
+               obj = obj->next;\r
+#if USE_INERT_LIST\r
+               if ((!obj) && (!inertlist))\r
+               {\r
+                       if (inert != inertobjlist)\r
+                               obj = (objtype *)inertobjlist;\r
+                       inertlist = true;\r
+               }\r
+#endif\r
        }\r
 \r
        if (vislist == &depthsort[0])\r
-               return;                                         // no visable objects\r
+               return;                                         // no visable objects\r
 \r
 //\r
 // draw from back to front\r
@@ -1540,7 +1680,7 @@ void DrawScaleds (void)
 \r
 void CalcTics (void)\r
 {\r
-       long    newtime,oldtimecount;\r
+       long    newtime,oldtimecount;\r
 \r
 \r
 #ifdef PROFILE\r
@@ -1552,11 +1692,11 @@ void CalcTics (void)
 // calculate tics since last refresh for adaptive timing\r
 //\r
        if (lasttimecount > TimeCount)\r
-               TimeCount = lasttimecount;              // if the game was paused a LONG time\r
+               TimeCount = lasttimecount;              // if the game was paused a LONG time\r
 \r
 #if 0\r
-       if (DemoMode)                                   // demo recording and playback needs\r
-       {                                                               // to be constant\r
+       if (DemoMode)                                   // demo recording and playback needs\r
+       {                                                               // to be constant\r
 //\r
 // take DEMOTICS or more tics, and modify Timecount to reflect time taken\r
 //\r
@@ -1608,20 +1748,20 @@ void CalcTics (void)
 ========================\r
 */\r
 \r
-void   DrawHand (void)\r
+void    DrawHand (void)\r
 {\r
-       #define HAND_X_POS      ((VIEWWIDTH/16)-(10/2))         // "10" = hand width in bytes\r
+       #define HAND_X_POS      ((VIEWWIDTH/16)-(10/2))         // "10" = hand width in bytes\r
 \r
        #define picnum HAND1PICM\r
 \r
        memptr source;\r
        unsigned dest,width,height;\r
 \r
-//     if (gamestate.shotpower || boltsleft)\r
-//             picnum += (((unsigned)TimeCount>>3)&1);\r
+//      if (gamestate.shotpower || boltsleft)\r
+//              picnum += (((unsigned)TimeCount>>3)&1);\r
 \r
        source = grsegs[picnum];\r
-       dest = ylookup[VIEWHEIGHT-handheight]+HAND_X_POS+bufferofs;                     // 12\r
+       dest = ylookup[VIEWHEIGHT-handheight]+HAND_X_POS+bufferofs;                     // 12\r
        width = picmtable[picnum-STARTPICM].width;\r
        height = picmtable[picnum-STARTPICM].height;\r
 \r
@@ -1640,7 +1780,7 @@ void      DrawHand (void)
 ========================\r
 */\r
 \r
-void   ThreeDRefresh (void)\r
+void    ThreeDRefresh (void)\r
 {\r
        int tracedir;\r
 \r
@@ -1650,17 +1790,17 @@ restart:
 //\r
 // clear out the traced array\r
 //\r
-asm    mov     ax,ds\r
-asm    mov     es,ax\r
-asm    mov     di,OFFSET spotvis\r
-asm    xor     ax,ax\r
-asm    mov     cx,[mapwidth]           // mapheight*32 words\r
-asm    shl     cx,1\r
-asm    shl     cx,1\r
-asm    shl     cx,1\r
-asm    shl     cx,1\r
-asm    shl     cx,1\r
-asm    rep stosw\r
+asm     mov     ax,ds\r
+asm     mov     es,ax\r
+asm     mov     di,OFFSET spotvis\r
+asm     xor     ax,ax\r
+asm     mov     cx,[mapwidth]           // mapheight*32 words\r
+asm     shl     cx,1\r
+asm     shl     cx,1\r
+asm     shl     cx,1\r
+asm     shl     cx,1\r
+asm     shl     cx,1\r
+asm     rep stosw\r
 \r
 \r
 //\r
@@ -1673,7 +1813,7 @@ asm       rep stosw
        viewcos = costable[viewangle];\r
        viewx = player->x - FixedByFrac(FOCALLENGTH,viewcos);\r
        viewy = player->y + FixedByFrac(FOCALLENGTH,viewsin);\r
-       viewx &= 0xfffffc00;            // stop on a pixel boundary\r
+       viewx &= 0xfffffc00;            // stop on a pixel boundary\r
        viewy &= 0xfffffc00;\r
        viewx += 0x180;\r
        viewy += 0x180;\r
@@ -1728,22 +1868,23 @@ asm     rep stosw
 //\r
 // draw the wall list saved be FollowWalls ()\r
 //\r
-       animframe = (TimeCount&8)>>3;\r
+//      animframe = (TimeCount&8)>>3;\r
 \r
 //\r
 // draw all the scaled images\r
 //\r
-       asm     mov     dx,GC_INDEX\r
+       asm     mov     dx,GC_INDEX\r
 \r
-       asm     mov     ax,GC_COLORDONTCARE\r
-       asm     out     dx,ax                                           // don't look at any of the planes\r
+       asm     mov     ax,GC_COLORDONTCARE\r
+       asm     out     dx,ax                                           // don't look at any of the planes\r
 \r
-       asm     mov     ax,GC_MODE + 256*(10)           // read mode 1, write mode 2\r
-       asm     out     dx,ax\r
+       asm     mov     ax,GC_MODE + 256*(10)           // read mode 1, write mode 2\r
+       asm     out     dx,ax\r
 \r
-       asm     mov     al,GC_BITMASK\r
-       asm     out     dx,al\r
+       asm     mov     al,GC_BITMASK\r
+       asm     out     dx,al\r
 \r
+       AnimateWallList();\r
        DrawWallList();\r
        DrawScaleds();\r
 \r
@@ -1764,24 +1905,24 @@ asm     rep stosw
                fizzlein = false;\r
                FizzleFade(bufferofs,displayofs,VIEWWIDTH,VIEWHEIGHT,true);\r
                lasttimecount = TimeCount;\r
-               if (MousePresent) Mouse(MDelta);        // Clear accumulated mouse movement\r
+               if (MousePresent) Mouse(MDelta);        // Clear accumulated mouse movement\r
        }\r
 \r
-asm    cli\r
-asm    mov     cx,[bufferofs]\r
-asm    mov     dx,3d4h         // CRTC address register\r
-asm    mov     al,0ch          // start address high register\r
-asm    out     dx,al\r
-asm    inc     dx\r
-asm    mov     al,ch\r
-asm    out     dx,al           // set the high byte\r
-asm    dec     dx\r
-asm    mov     al,0dh          // start address low register\r
-asm    out     dx,al\r
-asm    inc     dx\r
-asm    mov     al,cl\r
-asm    out     dx,al           // set the low byte\r
-asm    sti\r
+asm     cli\r
+asm     mov     cx,[bufferofs]\r
+asm     mov     dx,3d4h         // CRTC address register\r
+asm     mov     al,0ch          // start address high register\r
+asm     out     dx,al\r
+asm     inc     dx\r
+asm     mov     al,ch\r
+asm     out     dx,al           // set the high byte\r
+asm     dec     dx\r
+asm     mov     al,0dh          // start address low register\r
+asm     out     dx,al\r
+asm     inc     dx\r
+asm     mov     al,cl\r
+asm     out     dx,al           // set the low byte\r
+asm     sti\r
 \r
        displayofs = bufferofs;\r
 \r
index edb7612e49b4fe4edfcd57f56680d84a93ed1f8b..14693a7230a5538f7cd5669bf8db11d34626d5a0 100644 (file)
--- a/C5_GAME.C
+++ b/C5_GAME.C
@@ -1,4 +1,4 @@
-/* Catacomb Abyss Source Code\r
+/* Catacomb Armageddon Source Code\r
  * Copyright (C) 1993-2014 Flat Rock Software\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
 =============================================================================\r
 */\r
 \r
-#define NUMLUMPS        36\r
+#define NUMLUMPS        61\r
 \r
-#define ORCLUMP                        0\r
-#define TROLLLUMP                      1\r
-#define BOLTLUMP                       2\r
-#define NUKELUMP                       3\r
-#define POTIONLUMP                     4\r
+#define SUCCUBUSLUMP   0\r
+#define FATDEMONLUMP   1\r
+#define BOLTLUMP       2\r
+#define NUKELUMP       3\r
+#define POTIONLUMP     4\r
 #define RKEYLUMP        5\r
 #define YKEYLUMP        6\r
 #define GKEYLUMP        7\r
 #define BKEYLUMP        8\r
-#define SCROLLLUMP      9\r
+//#define SCROLLLUMP   9\r
 #define CHESTLUMP       10\r
 #define PLAYERLUMP      11\r
 #define WALL1LUMP       12\r
 #define WALL2LUMP       13\r
 #define BDOORLUMP       14\r
-#define DEMONLUMP               15\r
-#define MAGELUMP                16\r
-#define BATLUMP                 17\r
-#define GRELLUMP                18\r
-#define TOMBSTONESLUMP                   19\r
-#define ZOMBIELUMP                               20\r
-#define SPOOKLUMP                                        21\r
-#define SKELETONLUMP                             22\r
-#define RGEMLUMP                                         23\r
-#define GGEMLUMP                                         24\r
-#define BGEMLUMP                                         25\r
-#define YGEMLUMP                                         26\r
-#define PGEMLUMP                                         27\r
-#define RKEY2LUMP                                        28\r
-#define WETMANLUMP                               29\r
-#define OBJ_WARPLUMP                             30\r
-#define EYELUMP                                          31\r
-#define REDDEMONLUMP            32\r
-#define PITLUMP                                          33\r
-#define FTIMELUMP                                        34\r
-#define WATERCHESTLUMP                   35\r
-\r
-\r
+#define GODESSLUMP     15\r
+#define MAGELUMP       16\r
+#define BATLUMP                17\r
+#define GRELLUMP       18\r
+#define TOMBSTONESLUMP 19\r
+#define ZOMBIELUMP     20\r
+#define ANTLUMP                21\r
+#define SKELETONLUMP   22\r
+#define RGEMLUMP       23\r
+#define GGEMLUMP       24\r
+#define BGEMLUMP       25\r
+#define YGEMLUMP       26\r
+#define PGEMLUMP       27\r
+//#define RKEY2LUMP    28\r
+#define DRAGONLUMP     29\r
+#define OBJ_WARPLUMP   30\r
+#define EYELUMP                31\r
+#define REDDEMONLUMP   32\r
+//#define PITLUMP      33\r
+#define FTIMELUMP      34\r
+#define WATERCHESTLUMP 35\r
+#define TREELUMP        36\r
+#define ARCH1LUMP       37\r
+#define BUNNYLUMP       38\r
+#define ANTHILLLUMP     39\r
+#define COLUMNLUMP      40\r
+#define SULPHURGASLUMP  41\r
+#define FIREPOTLUMP     42\r
+//#define WHIRLPOOLLUMP        43\r
+#define FOUNTAINLUMP    44\r
+#define FORCEFIELDLUMP  45\r
+#define ARCH2LUMP       46\r
+#define ARCH3LUMP       47\r
+#define ARCH4LUMP       48\r
+#define ARCH5LUMP       49\r
+#define ARCH6LUMP       50\r
+#define SKELHANGLUMP    51\r
+//#define SKELPILELUMP 52\r
+#define ARCH7LUMP       53\r
+#define ARCH8LUMP       54\r
+#define ARCH9LUMP       55\r
+#define ARCH10LUMP      56\r
+#define ARCH11LUMP      57\r
+#define ARCH12LUMP     58\r
+#define ARCH13LUMP     59\r
 \r
 int     lumpstart[NUMLUMPS] = {\r
-ORC_LUMP_START,\r
-TROLL_LUMP_START,\r
+SUCCUBUS_LUMP_START,\r
+FATDEMON_LUMP_START,\r
 BOLT_LUMP_START,\r
 NUKE_LUMP_START,\r
 POTION_LUMP_START,\r
@@ -88,40 +110,65 @@ RKEY_LUMP_START,
 YKEY_LUMP_START,\r
 GKEY_LUMP_START,\r
 BKEY_LUMP_START,\r
-SCROLL_LUMP_START,\r
+0,\r
+//SCROLL_LUMP_START,\r
 CHEST_LUMP_START,\r
 PLAYER_LUMP_START,\r
 //WALL1_LUMP_START,\r
 //WALL2_LUMP_START,\r
 //BDOOR_LUMP_START,\r
 0,0,0,\r
-DEMON_LUMP_START,\r
+GODESS_LUMP_START,\r
 MAGE_LUMP_START,\r
 BAT_LUMP_START,\r
 GREL_LUMP_START,\r
 TOMBSTONES_LUMP_START,\r
 ZOMBIE_LUMP_START,\r
-SPOOK_LUMP_START,\r
+ANT_LUMP_START,\r
 SKELDUDE_LUMP_START,\r
 RGEM_LUMP_START,\r
 GGEM_LUMP_START,\r
 BGEM_LUMP_START,\r
 YGEM_LUMP_START,\r
 PGEM_LUMP_START,\r
-RKEY2_LUMP_START,\r
-WETMAN_LUMP_START,\r
+0,                                     //RKEY2_LUMP_START,\r
+DRAGON_LUMP_START,\r
 OBJ_WARP_LUMP_START,\r
 EYE_LUMP_START,\r
 REDDEMON_LUMP_START,\r
-PIT_LUMP_START,\r
+0,                                     //PIT_LUMP_START,\r
 TIME_LUMP_START,\r
 O_WATER_CHEST_LUMP_START,\r
+TREE_LUMP_START,\r
+ARCH1_LUMP_START,\r
+BUNNY_LUMP_START,\r
+ANTHILL_LUMP_START,\r
+COLUMN_LUMP_START,\r
+SULPHURGAS_LUMP_START,\r
+FIREPOT_LUMP_START,\r
+0,                                     //WHIRLPOOL_LUMP_START,\r
+FOUNTAIN_LUMP_START,\r
+FORCEFIELD_LUMP_START,\r
+ARCH2_LUMP_START,\r
+ARCH3_LUMP_START,\r
+ARCH4_LUMP_START,\r
+ARCH5_LUMP_START,\r
+ARCH6_LUMP_START,\r
+SKELHANG_LUMP_START,\r
+0,                                     //SKELPILE_LUMP_START,\r
+ARCH7_LUMP_START,\r
+ARCH8_LUMP_START,\r
+ARCH9_LUMP_START,\r
+ARCH10_LUMP_START,\r
+ARCH11_LUMP_START,\r
+ARCH12_LUMP_START,\r
+ARCH13_LUMP_START,\r
 };\r
 \r
 \r
 int     lumpend[NUMLUMPS] = {\r
-ORC_LUMP_END,\r
-TROLL_LUMP_END,\r
+SUCCUBUS_LUMP_END,\r
+FATDEMON_LUMP_END,\r
 BOLT_LUMP_END,\r
 NUKE_LUMP_END,\r
 POTION_LUMP_END,\r
@@ -129,37 +176,60 @@ RKEY_LUMP_END,
 YKEY_LUMP_END,\r
 GKEY_LUMP_END,\r
 BKEY_LUMP_END,\r
-SCROLL_LUMP_END,\r
+0,\r
+//SCROLL_LUMP_END,\r
 CHEST_LUMP_END,\r
 PLAYER_LUMP_END,\r
-//WALL1_LUMP_END,\r
-//WALL2_LUMP_END,\r
-//BDOOR_LUMP_END,\r
 0,0,0,\r
-DEMON_LUMP_END,\r
+GODESS_LUMP_END,\r
 MAGE_LUMP_END,\r
 BAT_LUMP_END,\r
 GREL_LUMP_END,\r
 TOMBSTONES_LUMP_END,\r
 ZOMBIE_LUMP_END,\r
-SPOOK_LUMP_END,\r
+ANT_LUMP_END,\r
 SKELDUDE_LUMP_END,\r
 RGEM_LUMP_END,\r
 GGEM_LUMP_END,\r
 BGEM_LUMP_END,\r
 YGEM_LUMP_END,\r
 PGEM_LUMP_END,\r
-RKEY2_LUMP_END,\r
-WETMAN_LUMP_END,\r
+0,                                     //RKEY2_LUMP_END,\r
+DRAGON_LUMP_END,\r
 OBJ_WARP_LUMP_END,\r
 EYE_LUMP_END,\r
 REDDEMON_LUMP_END,\r
-PIT_LUMP_END,\r
+0,                                     //PIT_LUMP_END,\r
 TIME_LUMP_END,\r
 O_WATER_CHEST_LUMP_END,\r
+TREE_LUMP_END,\r
+ARCH1_LUMP_END,\r
+BUNNY_LUMP_END,\r
+ANTHILL_LUMP_END,\r
+COLUMN_LUMP_END,\r
+SULPHURGAS_LUMP_END,\r
+FIREPOT_LUMP_END,\r
+0,                                     //WHIRLPOOL_LUMP_END,\r
+FOUNTAIN_LUMP_END,\r
+FORCEFIELD_LUMP_END,\r
+ARCH2_LUMP_END,\r
+ARCH3_LUMP_END,\r
+ARCH4_LUMP_END,\r
+ARCH5_LUMP_END,\r
+ARCH6_LUMP_END,\r
+SKELHANG_LUMP_END,\r
+0,                                     //SKELPILE_LUMP_END,\r
+ARCH7_LUMP_END,\r
+ARCH8_LUMP_END,\r
+ARCH9_LUMP_END,\r
+ARCH10_LUMP_END,\r
+ARCH11_LUMP_END,\r
+ARCH12_LUMP_END,\r
+ARCH13_LUMP_END,\r
 };\r
 \r
 \r
+//extern unsigned scolor,gcolor;\r
 \r
 \r
 /*\r
@@ -192,7 +262,7 @@ boolean lumpneeded[NUMLUMPS];
 //==========================================================================\r
 //\r
 //\r
-//                                                     LOCAL PROTOTYPES\r
+//                                                      LOCAL PROTOTYPES\r
 //\r
 //\r
 //==========================================================================\r
@@ -213,15 +283,18 @@ void CashPoints(void);
 \r
 void ScanInfoPlane (void)\r
 {\r
-       extern unsigned gnd_colors[];\r
-\r
-       char hibyte;\r
+       unsigned char hibyte;\r
        unsigned        x,y,i,j;\r
-       int                     tile;\r
+       unsigned int tile;\r
        unsigned        far     *start;\r
 \r
        InitObjList();                  // start spawning things with a clean slate\r
 \r
+       scolor = gcolor = 0;\r
+       skycolor = &scolor;\r
+       groundcolor = &gcolor;\r
+\r
+\r
        memset (lumpneeded,0,sizeof(lumpneeded));\r
 \r
        start = mapsegs[2];\r
@@ -231,7 +304,38 @@ void ScanInfoPlane (void)
                        tile = *start++;\r
                        hibyte = tile >> 8;\r
                        tile &= 0xff;\r
-                       if (!tile)\r
+\r
+                       switch (hibyte)\r
+                       {\r
+                               char hi;\r
+\r
+                               case 0xFB:\r
+                                       wall_anim_time = tile;\r
+                                       tile = 0;\r
+                                       break;\r
+\r
+                               case 0xfa:                                                              // sky/ground color\r
+                               case 0xf9:                                                              // sky/ground 'strip'\r
+                                       x++;\r
+                                       tile = *start++;\r
+                                       hi = tile >> 8;\r
+                                       tile &= 0xff;\r
+                                       switch (hibyte)\r
+                                       {\r
+                                               case 0xfa:                      // sky / ground color\r
+                                                       scolor = ((hi)|(hi<<8));\r
+                                                       gcolor = ((tile)|(tile<<8));\r
+                                                       skycolor = &scolor;\r
+                                                       groundcolor = &gcolor;\r
+                                               break;\r
+\r
+                                               case 0xf9:                      // sky / ground 'strip'\r
+                                               break;\r
+                                       }\r
+                               break;\r
+                       }\r
+\r
+                       if ((!tile) || (hibyte))\r
                                continue;\r
 \r
                        switch (tile)\r
@@ -255,20 +359,7 @@ void ScanInfoPlane (void)
                                SpawnBonus(x,y,tile-5);\r
                                break;\r
 \r
-                       case 29:\r
-                               lumpneeded[RKEY2LUMP] = true;\r
-                               SpawnBonus(x,y,B_RKEY2);\r
-                       break;\r
-\r
-                       case 58:\r
-                       case 59:\r
-                       case 60:\r
-                       case 61:\r
-                       case 62:\r
-                               lumpneeded[tile-58+RGEMLUMP] = true;\r
-                               SpawnBonus(x,y,tile-58+B_RGEM);\r
-                       break;\r
-\r
+#if 0\r
                        case 12:\r
                        case 13:\r
                        case 14:\r
@@ -280,6 +371,12 @@ void ScanInfoPlane (void)
                                lumpneeded[SCROLLLUMP] = true;\r
                                SpawnBonus(x,y,B_SCROLL1+tile-12);\r
                                break;\r
+#endif\r
+\r
+                       case 20:\r
+                               lumpneeded[REDDEMONLUMP] = true;\r
+                               SpawnRedDemon (x,y);\r
+                               break;\r
 \r
 #if 0\r
                        case 20:        // goal\r
@@ -288,73 +385,36 @@ void ScanInfoPlane (void)
                                break;\r
 #endif\r
 \r
-                       case 21:        // chest\r
-                               if (gnd_colors[gamestate.mapon] == 0x0101)\r
-                                       lumpneeded[WATERCHESTLUMP] = true;\r
-                               else\r
-                                       lumpneeded[CHESTLUMP] = true;\r
-                               SpawnBonus(x,y,B_CHEST);\r
-                       break;\r
-\r
-                       case 31:\r
-                       case 32:\r
-                       case 33:\r
-                       case 34:\r
-                       case 35:\r
-                               lumpneeded[OBJ_WARPLUMP] = true;\r
-                               SpawnWarp (x,y,tile-30);\r
+                       case 21:\r
+                               lumpneeded[GODESSLUMP] = true;\r
+                               SpawnGodess (x,y);\r
                                break;\r
 \r
-                       case 41:\r
-                               if (gamestate.difficulty <gd_Hard)\r
-                                       break;\r
-                       case 36:\r
-                               if (gamestate.difficulty <gd_Normal)\r
-                                       break;\r
                        case 22:\r
-                               lumpneeded[TROLLLUMP] = true;\r
-                               SpawnTroll (x,y);\r
+                               lumpneeded[FATDEMONLUMP] = true;\r
+                               SpawnFatDemon (x,y);\r
                                break;\r
 \r
-                       case 42:\r
-                               if (gamestate.difficulty <gd_Hard)\r
-                                       break;\r
-                       case 37:\r
-                               if (gamestate.difficulty <gd_Normal)\r
-                                       break;\r
              &n