From 0e761a4aa64a693a74bf99943dcccd35f1a3e3a7 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 6 Jul 2020 13:03:24 +0200 Subject: [PATCH 1/8] organize all available statetype variables in a states[] array This replaces the current relying on a specific order in which global variables are stored in the executable for e.g. saving and restoring of savegames and thus does not require the -fno-toplevel-reorder compiler flag anymore. Fixes #15. --- Makefile | 14 +- wl_act2.cpp | 1417 +++----------------------------------------------- wl_agent.cpp | 9 +- wl_def.h | 66 +-- wl_draw.cpp | 2 +- wl_main.cpp | 11 +- wl_play.cpp | 2 +- wl_state.cpp | 94 ++-- 8 files changed, 142 insertions(+), 1473 deletions(-) diff --git a/Makefile b/Makefile index a13a806..c249ba9 100644 --- a/Makefile +++ b/Makefile @@ -26,19 +26,6 @@ CFLAGS += -Wreturn-type CFLAGS += -Wwrite-strings CFLAGS += -Wcast-align -# In contrast to Doom, which has all its possible game states -# enumerated and stored in a single huge info.c:states[] array, the -# Wolf3d engine has them as global variables in wl_act2.cpp. The -# savegame code relies on the order of these variables remaining -# constant in the executable and the difference of these variables' -# addresses relative to a certain reference as well. This should be a -# valid assumption for a given executable, but might change when the -# code is compiled again - turning the savegames saved wit the prior -# compilate useless. This compiler flag prevents the reordering of the -# global variables and thus keeps savegames functional across engine -# rebuilds. -CFLAGS += -fno-toplevel-reorder - CCFLAGS += $(CFLAGS) CCFLAGS += -std=gnu99 @@ -79,6 +66,7 @@ SRCS += wl_parallax.cpp SRCS += wl_play.cpp SRCS += wl_state.cpp SRCS += wl_text.cpp +SRCS += states.cpp DEPS = $(filter %.d, $(SRCS:.c=.d) $(SRCS:.cpp=.d)) OBJS = $(filter %.o, $(SRCS:.c=.o) $(SRCS:.cpp=.o)) diff --git a/wl_act2.cpp b/wl_act2.cpp index 31db642..46d226f 100644 --- a/wl_act2.cpp +++ b/wl_act2.cpp @@ -161,72 +161,6 @@ short starthitpoints[4][NUMENEMIES] = } }; -void A_StartDeathCam (objtype *ob); - - -void T_Path (objtype *ob); -void T_Shoot (objtype *ob); -void T_Bite (objtype *ob); -void T_DogChase (objtype *ob); -void T_Chase (objtype *ob); -void T_Projectile (objtype *ob); -void T_Stand (objtype *ob); - -void A_DeathScream (objtype *ob); - -extern statetype s_rocket; -extern statetype s_smoke1; -extern statetype s_smoke2; -extern statetype s_smoke3; -extern statetype s_smoke4; -extern statetype s_boom2; -extern statetype s_boom3; - -void A_Smoke (objtype *ob); - -statetype s_rocket = {true,SPR_ROCKET_1,3,(statefunc)T_Projectile,(statefunc)A_Smoke,&s_rocket}; -statetype s_smoke1 = {false,SPR_SMOKE_1,3,NULL,NULL,&s_smoke2}; -statetype s_smoke2 = {false,SPR_SMOKE_2,3,NULL,NULL,&s_smoke3}; -statetype s_smoke3 = {false,SPR_SMOKE_3,3,NULL,NULL,&s_smoke4}; -statetype s_smoke4 = {false,SPR_SMOKE_4,3,NULL,NULL,NULL}; - -statetype s_boom1 = {false,SPR_BOOM_1,6,NULL,NULL,&s_boom2}; -statetype s_boom2 = {false,SPR_BOOM_2,6,NULL,NULL,&s_boom3}; -statetype s_boom3 = {false,SPR_BOOM_3,6,NULL,NULL,NULL}; - -#ifdef SPEAR - -extern statetype s_hrocket; -extern statetype s_hsmoke1; -extern statetype s_hsmoke2; -extern statetype s_hsmoke3; -extern statetype s_hsmoke4; -extern statetype s_hboom2; -extern statetype s_hboom3; - -void A_Smoke (objtype *ob); - -statetype s_hrocket = {true,SPR_HROCKET_1,3,(statefunc)T_Projectile,(statefunc)A_Smoke,&s_hrocket}; -statetype s_hsmoke1 = {false,SPR_HSMOKE_1,3,NULL,NULL,&s_hsmoke2}; -statetype s_hsmoke2 = {false,SPR_HSMOKE_2,3,NULL,NULL,&s_hsmoke3}; -statetype s_hsmoke3 = {false,SPR_HSMOKE_3,3,NULL,NULL,&s_hsmoke4}; -statetype s_hsmoke4 = {false,SPR_HSMOKE_4,3,NULL,NULL,NULL}; - -statetype s_hboom1 = {false,SPR_HBOOM_1,6,NULL,NULL,&s_hboom2}; -statetype s_hboom2 = {false,SPR_HBOOM_2,6,NULL,NULL,&s_hboom3}; -statetype s_hboom3 = {false,SPR_HBOOM_3,6,NULL,NULL,NULL}; - -#endif - -void T_Schabb (objtype *ob); -void T_SchabbThrow (objtype *ob); -void T_Fake (objtype *ob); -void T_FakeFire (objtype *ob); -void T_Ghosts (objtype *ob); - -void A_Slurpie (objtype *ob); -void A_HitlerMorph (objtype *ob); -void A_MechaSound (objtype *ob); /* ================= @@ -241,10 +175,10 @@ void A_Smoke (objtype *ob) GetNewActor (); #ifdef SPEAR if (ob->obclass == hrocketobj) - newobj->state = &s_hsmoke1; + newobj->state = &states[s_hsmoke1]; else #endif - newobj->state = &s_smoke1; + newobj->state = &states[s_smoke1]; newobj->ticcount = 6; newobj->tilex = ob->tilex; @@ -332,13 +266,13 @@ void T_Projectile (objtype *ob) if (ob->obclass == rocketobj) { PlaySoundLocActor(MISSILEHITSND,ob); - ob->state = &s_boom1; + ob->state = &states[s_boom1]; } #ifdef SPEAR else if (ob->obclass == hrocketobj) { PlaySoundLocActor(MISSILEHITSND,ob); - ob->state = &s_hboom1; + ob->state = &states[s_hboom1]; } #endif else @@ -375,471 +309,6 @@ void T_Projectile (objtype *ob) } -/* -============================================================================= - -GUARD - -============================================================================= -*/ - -// -// guards -// - -extern statetype s_grdstand; - -extern statetype s_grdpath1; -extern statetype s_grdpath1s; -extern statetype s_grdpath2; -extern statetype s_grdpath3; -extern statetype s_grdpath3s; -extern statetype s_grdpath4; - -extern statetype s_grdpain; -extern statetype s_grdpain1; - -extern statetype s_grdgiveup; - -extern statetype s_grdshoot1; -extern statetype s_grdshoot2; -extern statetype s_grdshoot3; -extern statetype s_grdshoot4; - -extern statetype s_grdchase1; -extern statetype s_grdchase1s; -extern statetype s_grdchase2; -extern statetype s_grdchase3; -extern statetype s_grdchase3s; -extern statetype s_grdchase4; - -extern statetype s_grddie1; -extern statetype s_grddie1d; -extern statetype s_grddie2; -extern statetype s_grddie3; -extern statetype s_grddie4; - -statetype s_grdstand = {true,SPR_GRD_S_1,0,(statefunc)T_Stand,NULL,&s_grdstand}; - -statetype s_grdpath1 = {true,SPR_GRD_W1_1,20,(statefunc)T_Path,NULL,&s_grdpath1s}; -statetype s_grdpath1s = {true,SPR_GRD_W1_1,5,NULL,NULL,&s_grdpath2}; -statetype s_grdpath2 = {true,SPR_GRD_W2_1,15,(statefunc)T_Path,NULL,&s_grdpath3}; -statetype s_grdpath3 = {true,SPR_GRD_W3_1,20,(statefunc)T_Path,NULL,&s_grdpath3s}; -statetype s_grdpath3s = {true,SPR_GRD_W3_1,5,NULL,NULL,&s_grdpath4}; -statetype s_grdpath4 = {true,SPR_GRD_W4_1,15,(statefunc)T_Path,NULL,&s_grdpath1}; - -statetype s_grdpain = {2,SPR_GRD_PAIN_1,10,NULL,NULL,&s_grdchase1}; -statetype s_grdpain1 = {2,SPR_GRD_PAIN_2,10,NULL,NULL,&s_grdchase1}; - -statetype s_grdshoot1 = {false,SPR_GRD_SHOOT1,20,NULL,NULL,&s_grdshoot2}; -statetype s_grdshoot2 = {false,SPR_GRD_SHOOT2,20,NULL,(statefunc)T_Shoot,&s_grdshoot3}; -statetype s_grdshoot3 = {false,SPR_GRD_SHOOT3,20,NULL,NULL,&s_grdchase1}; - -statetype s_grdchase1 = {true,SPR_GRD_W1_1,10,(statefunc)T_Chase,NULL,&s_grdchase1s}; -statetype s_grdchase1s = {true,SPR_GRD_W1_1,3,NULL,NULL,&s_grdchase2}; -statetype s_grdchase2 = {true,SPR_GRD_W2_1,8,(statefunc)T_Chase,NULL,&s_grdchase3}; -statetype s_grdchase3 = {true,SPR_GRD_W3_1,10,(statefunc)T_Chase,NULL,&s_grdchase3s}; -statetype s_grdchase3s = {true,SPR_GRD_W3_1,3,NULL,NULL,&s_grdchase4}; -statetype s_grdchase4 = {true,SPR_GRD_W4_1,8,(statefunc)T_Chase,NULL,&s_grdchase1}; - -statetype s_grddie1 = {false,SPR_GRD_DIE_1,15,NULL,(statefunc)A_DeathScream,&s_grddie2}; -statetype s_grddie2 = {false,SPR_GRD_DIE_2,15,NULL,NULL,&s_grddie3}; -statetype s_grddie3 = {false,SPR_GRD_DIE_3,15,NULL,NULL,&s_grddie4}; -statetype s_grddie4 = {false,SPR_GRD_DEAD,0,NULL,NULL,&s_grddie4}; - - -#ifndef SPEAR -// -// ghosts -// -extern statetype s_blinkychase1; -extern statetype s_blinkychase2; -extern statetype s_inkychase1; -extern statetype s_inkychase2; -extern statetype s_pinkychase1; -extern statetype s_pinkychase2; -extern statetype s_clydechase1; -extern statetype s_clydechase2; - -statetype s_blinkychase1 = {false,SPR_BLINKY_W1,10,(statefunc)T_Ghosts,NULL,&s_blinkychase2}; -statetype s_blinkychase2 = {false,SPR_BLINKY_W2,10,(statefunc)T_Ghosts,NULL,&s_blinkychase1}; - -statetype s_inkychase1 = {false,SPR_INKY_W1,10,(statefunc)T_Ghosts,NULL,&s_inkychase2}; -statetype s_inkychase2 = {false,SPR_INKY_W2,10,(statefunc)T_Ghosts,NULL,&s_inkychase1}; - -statetype s_pinkychase1 = {false,SPR_PINKY_W1,10,(statefunc)T_Ghosts,NULL,&s_pinkychase2}; -statetype s_pinkychase2 = {false,SPR_PINKY_W2,10,(statefunc)T_Ghosts,NULL,&s_pinkychase1}; - -statetype s_clydechase1 = {false,SPR_CLYDE_W1,10,(statefunc)T_Ghosts,NULL,&s_clydechase2}; -statetype s_clydechase2 = {false,SPR_CLYDE_W2,10,(statefunc)T_Ghosts,NULL,&s_clydechase1}; -#endif - -// -// dogs -// - -extern statetype s_dogpath1; -extern statetype s_dogpath1s; -extern statetype s_dogpath2; -extern statetype s_dogpath3; -extern statetype s_dogpath3s; -extern statetype s_dogpath4; - -extern statetype s_dogjump1; -extern statetype s_dogjump2; -extern statetype s_dogjump3; -extern statetype s_dogjump4; -extern statetype s_dogjump5; - -extern statetype s_dogchase1; -extern statetype s_dogchase1s; -extern statetype s_dogchase2; -extern statetype s_dogchase3; -extern statetype s_dogchase3s; -extern statetype s_dogchase4; - -extern statetype s_dogdie1; -extern statetype s_dogdie1d; -extern statetype s_dogdie2; -extern statetype s_dogdie3; -extern statetype s_dogdead; - -statetype s_dogpath1 = {true,SPR_DOG_W1_1,20,(statefunc)T_Path,NULL,&s_dogpath1s}; -statetype s_dogpath1s = {true,SPR_DOG_W1_1,5,NULL,NULL,&s_dogpath2}; -statetype s_dogpath2 = {true,SPR_DOG_W2_1,15,(statefunc)T_Path,NULL,&s_dogpath3}; -statetype s_dogpath3 = {true,SPR_DOG_W3_1,20,(statefunc)T_Path,NULL,&s_dogpath3s}; -statetype s_dogpath3s = {true,SPR_DOG_W3_1,5,NULL,NULL,&s_dogpath4}; -statetype s_dogpath4 = {true,SPR_DOG_W4_1,15,(statefunc)T_Path,NULL,&s_dogpath1}; - -statetype s_dogjump1 = {false,SPR_DOG_JUMP1,10,NULL,NULL,&s_dogjump2}; -statetype s_dogjump2 = {false,SPR_DOG_JUMP2,10,NULL,(statefunc)T_Bite,&s_dogjump3}; -statetype s_dogjump3 = {false,SPR_DOG_JUMP3,10,NULL,NULL,&s_dogjump4}; -statetype s_dogjump4 = {false,SPR_DOG_JUMP1,10,NULL,NULL,&s_dogjump5}; -statetype s_dogjump5 = {false,SPR_DOG_W1_1,10,NULL,NULL,&s_dogchase1}; - -statetype s_dogchase1 = {true,SPR_DOG_W1_1,10,(statefunc)T_DogChase,NULL,&s_dogchase1s}; -statetype s_dogchase1s = {true,SPR_DOG_W1_1,3,NULL,NULL,&s_dogchase2}; -statetype s_dogchase2 = {true,SPR_DOG_W2_1,8,(statefunc)T_DogChase,NULL,&s_dogchase3}; -statetype s_dogchase3 = {true,SPR_DOG_W3_1,10,(statefunc)T_DogChase,NULL,&s_dogchase3s}; -statetype s_dogchase3s = {true,SPR_DOG_W3_1,3,NULL,NULL,&s_dogchase4}; -statetype s_dogchase4 = {true,SPR_DOG_W4_1,8,(statefunc)T_DogChase,NULL,&s_dogchase1}; - -statetype s_dogdie1 = {false,SPR_DOG_DIE_1,15,NULL,(statefunc)A_DeathScream,&s_dogdie2}; -statetype s_dogdie2 = {false,SPR_DOG_DIE_2,15,NULL,NULL,&s_dogdie3}; -statetype s_dogdie3 = {false,SPR_DOG_DIE_3,15,NULL,NULL,&s_dogdead}; -statetype s_dogdead = {false,SPR_DOG_DEAD,15,NULL,NULL,&s_dogdead}; - - -// -// officers -// - -extern statetype s_ofcstand; - -extern statetype s_ofcpath1; -extern statetype s_ofcpath1s; -extern statetype s_ofcpath2; -extern statetype s_ofcpath3; -extern statetype s_ofcpath3s; -extern statetype s_ofcpath4; - -extern statetype s_ofcpain; -extern statetype s_ofcpain1; - -extern statetype s_ofcgiveup; - -extern statetype s_ofcshoot1; -extern statetype s_ofcshoot2; -extern statetype s_ofcshoot3; -extern statetype s_ofcshoot4; - -extern statetype s_ofcchase1; -extern statetype s_ofcchase1s; -extern statetype s_ofcchase2; -extern statetype s_ofcchase3; -extern statetype s_ofcchase3s; -extern statetype s_ofcchase4; - -extern statetype s_ofcdie1; -extern statetype s_ofcdie2; -extern statetype s_ofcdie3; -extern statetype s_ofcdie4; -extern statetype s_ofcdie5; - -statetype s_ofcstand = {true,SPR_OFC_S_1,0,(statefunc)T_Stand,NULL,&s_ofcstand}; - -statetype s_ofcpath1 = {true,SPR_OFC_W1_1,20,(statefunc)T_Path,NULL,&s_ofcpath1s}; -statetype s_ofcpath1s = {true,SPR_OFC_W1_1,5,NULL,NULL,&s_ofcpath2}; -statetype s_ofcpath2 = {true,SPR_OFC_W2_1,15,(statefunc)T_Path,NULL,&s_ofcpath3}; -statetype s_ofcpath3 = {true,SPR_OFC_W3_1,20,(statefunc)T_Path,NULL,&s_ofcpath3s}; -statetype s_ofcpath3s = {true,SPR_OFC_W3_1,5,NULL,NULL,&s_ofcpath4}; -statetype s_ofcpath4 = {true,SPR_OFC_W4_1,15,(statefunc)T_Path,NULL,&s_ofcpath1}; - -statetype s_ofcpain = {2,SPR_OFC_PAIN_1,10,NULL,NULL,&s_ofcchase1}; -statetype s_ofcpain1 = {2,SPR_OFC_PAIN_2,10,NULL,NULL,&s_ofcchase1}; - -statetype s_ofcshoot1 = {false,SPR_OFC_SHOOT1,6,NULL,NULL,&s_ofcshoot2}; -statetype s_ofcshoot2 = {false,SPR_OFC_SHOOT2,20,NULL,(statefunc)T_Shoot,&s_ofcshoot3}; -statetype s_ofcshoot3 = {false,SPR_OFC_SHOOT3,10,NULL,NULL,&s_ofcchase1}; - -statetype s_ofcchase1 = {true,SPR_OFC_W1_1,10,(statefunc)T_Chase,NULL,&s_ofcchase1s}; -statetype s_ofcchase1s = {true,SPR_OFC_W1_1,3,NULL,NULL,&s_ofcchase2}; -statetype s_ofcchase2 = {true,SPR_OFC_W2_1,8,(statefunc)T_Chase,NULL,&s_ofcchase3}; -statetype s_ofcchase3 = {true,SPR_OFC_W3_1,10,(statefunc)T_Chase,NULL,&s_ofcchase3s}; -statetype s_ofcchase3s = {true,SPR_OFC_W3_1,3,NULL,NULL,&s_ofcchase4}; -statetype s_ofcchase4 = {true,SPR_OFC_W4_1,8,(statefunc)T_Chase,NULL,&s_ofcchase1}; - -statetype s_ofcdie1 = {false,SPR_OFC_DIE_1,11,NULL,(statefunc)A_DeathScream,&s_ofcdie2}; -statetype s_ofcdie2 = {false,SPR_OFC_DIE_2,11,NULL,NULL,&s_ofcdie3}; -statetype s_ofcdie3 = {false,SPR_OFC_DIE_3,11,NULL,NULL,&s_ofcdie4}; -statetype s_ofcdie4 = {false,SPR_OFC_DIE_4,11,NULL,NULL,&s_ofcdie5}; -statetype s_ofcdie5 = {false,SPR_OFC_DEAD,0,NULL,NULL,&s_ofcdie5}; - - -// -// mutant -// - -extern statetype s_mutstand; - -extern statetype s_mutpath1; -extern statetype s_mutpath1s; -extern statetype s_mutpath2; -extern statetype s_mutpath3; -extern statetype s_mutpath3s; -extern statetype s_mutpath4; - -extern statetype s_mutpain; -extern statetype s_mutpain1; - -extern statetype s_mutgiveup; - -extern statetype s_mutshoot1; -extern statetype s_mutshoot2; -extern statetype s_mutshoot3; -extern statetype s_mutshoot4; - -extern statetype s_mutchase1; -extern statetype s_mutchase1s; -extern statetype s_mutchase2; -extern statetype s_mutchase3; -extern statetype s_mutchase3s; -extern statetype s_mutchase4; - -extern statetype s_mutdie1; -extern statetype s_mutdie2; -extern statetype s_mutdie3; -extern statetype s_mutdie4; -extern statetype s_mutdie5; - -statetype s_mutstand = {true,SPR_MUT_S_1,0,(statefunc)T_Stand,NULL,&s_mutstand}; - -statetype s_mutpath1 = {true,SPR_MUT_W1_1,20,(statefunc)T_Path,NULL,&s_mutpath1s}; -statetype s_mutpath1s = {true,SPR_MUT_W1_1,5,NULL,NULL,&s_mutpath2}; -statetype s_mutpath2 = {true,SPR_MUT_W2_1,15,(statefunc)T_Path,NULL,&s_mutpath3}; -statetype s_mutpath3 = {true,SPR_MUT_W3_1,20,(statefunc)T_Path,NULL,&s_mutpath3s}; -statetype s_mutpath3s = {true,SPR_MUT_W3_1,5,NULL,NULL,&s_mutpath4}; -statetype s_mutpath4 = {true,SPR_MUT_W4_1,15,(statefunc)T_Path,NULL,&s_mutpath1}; - -statetype s_mutpain = {2,SPR_MUT_PAIN_1,10,NULL,NULL,&s_mutchase1}; -statetype s_mutpain1 = {2,SPR_MUT_PAIN_2,10,NULL,NULL,&s_mutchase1}; - -statetype s_mutshoot1 = {false,SPR_MUT_SHOOT1,6,NULL,(statefunc)T_Shoot,&s_mutshoot2}; -statetype s_mutshoot2 = {false,SPR_MUT_SHOOT2,20,NULL,NULL,&s_mutshoot3}; -statetype s_mutshoot3 = {false,SPR_MUT_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_mutshoot4}; -statetype s_mutshoot4 = {false,SPR_MUT_SHOOT4,20,NULL,NULL,&s_mutchase1}; - -statetype s_mutchase1 = {true,SPR_MUT_W1_1,10,(statefunc)T_Chase,NULL,&s_mutchase1s}; -statetype s_mutchase1s = {true,SPR_MUT_W1_1,3,NULL,NULL,&s_mutchase2}; -statetype s_mutchase2 = {true,SPR_MUT_W2_1,8,(statefunc)T_Chase,NULL,&s_mutchase3}; -statetype s_mutchase3 = {true,SPR_MUT_W3_1,10,(statefunc)T_Chase,NULL,&s_mutchase3s}; -statetype s_mutchase3s = {true,SPR_MUT_W3_1,3,NULL,NULL,&s_mutchase4}; -statetype s_mutchase4 = {true,SPR_MUT_W4_1,8,(statefunc)T_Chase,NULL,&s_mutchase1}; - -statetype s_mutdie1 = {false,SPR_MUT_DIE_1,7,NULL,(statefunc)A_DeathScream,&s_mutdie2}; -statetype s_mutdie2 = {false,SPR_MUT_DIE_2,7,NULL,NULL,&s_mutdie3}; -statetype s_mutdie3 = {false,SPR_MUT_DIE_3,7,NULL,NULL,&s_mutdie4}; -statetype s_mutdie4 = {false,SPR_MUT_DIE_4,7,NULL,NULL,&s_mutdie5}; -statetype s_mutdie5 = {false,SPR_MUT_DEAD,0,NULL,NULL,&s_mutdie5}; - - -// -// SS -// - -extern statetype s_ssstand; - -extern statetype s_sspath1; -extern statetype s_sspath1s; -extern statetype s_sspath2; -extern statetype s_sspath3; -extern statetype s_sspath3s; -extern statetype s_sspath4; - -extern statetype s_sspain; -extern statetype s_sspain1; - -extern statetype s_ssshoot1; -extern statetype s_ssshoot2; -extern statetype s_ssshoot3; -extern statetype s_ssshoot4; -extern statetype s_ssshoot5; -extern statetype s_ssshoot6; -extern statetype s_ssshoot7; -extern statetype s_ssshoot8; -extern statetype s_ssshoot9; - -extern statetype s_sschase1; -extern statetype s_sschase1s; -extern statetype s_sschase2; -extern statetype s_sschase3; -extern statetype s_sschase3s; -extern statetype s_sschase4; - -extern statetype s_ssdie1; -extern statetype s_ssdie2; -extern statetype s_ssdie3; -extern statetype s_ssdie4; - -statetype s_ssstand = {true,SPR_SS_S_1,0,(statefunc)T_Stand,NULL,&s_ssstand}; - -statetype s_sspath1 = {true,SPR_SS_W1_1,20,(statefunc)T_Path,NULL,&s_sspath1s}; -statetype s_sspath1s = {true,SPR_SS_W1_1,5,NULL,NULL,&s_sspath2}; -statetype s_sspath2 = {true,SPR_SS_W2_1,15,(statefunc)T_Path,NULL,&s_sspath3}; -statetype s_sspath3 = {true,SPR_SS_W3_1,20,(statefunc)T_Path,NULL,&s_sspath3s}; -statetype s_sspath3s = {true,SPR_SS_W3_1,5,NULL,NULL,&s_sspath4}; -statetype s_sspath4 = {true,SPR_SS_W4_1,15,(statefunc)T_Path,NULL,&s_sspath1}; - -statetype s_sspain = {2,SPR_SS_PAIN_1,10,NULL,NULL,&s_sschase1}; -statetype s_sspain1 = {2,SPR_SS_PAIN_2,10,NULL,NULL,&s_sschase1}; - -statetype s_ssshoot1 = {false,SPR_SS_SHOOT1,20,NULL,NULL,&s_ssshoot2}; -statetype s_ssshoot2 = {false,SPR_SS_SHOOT2,20,NULL,(statefunc)T_Shoot,&s_ssshoot3}; -statetype s_ssshoot3 = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot4}; -statetype s_ssshoot4 = {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_ssshoot5}; -statetype s_ssshoot5 = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot6}; -statetype s_ssshoot6 = {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_ssshoot7}; -statetype s_ssshoot7 = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_ssshoot8}; -statetype s_ssshoot8 = {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_ssshoot9}; -statetype s_ssshoot9 = {false,SPR_SS_SHOOT3,10,NULL,NULL,&s_sschase1}; - -statetype s_sschase1 = {true,SPR_SS_W1_1,10,(statefunc)T_Chase,NULL,&s_sschase1s}; -statetype s_sschase1s = {true,SPR_SS_W1_1,3,NULL,NULL,&s_sschase2}; -statetype s_sschase2 = {true,SPR_SS_W2_1,8,(statefunc)T_Chase,NULL,&s_sschase3}; -statetype s_sschase3 = {true,SPR_SS_W3_1,10,(statefunc)T_Chase,NULL,&s_sschase3s}; -statetype s_sschase3s = {true,SPR_SS_W3_1,3,NULL,NULL,&s_sschase4}; -statetype s_sschase4 = {true,SPR_SS_W4_1,8,(statefunc)T_Chase,NULL,&s_sschase1}; - -statetype s_ssdie1 = {false,SPR_SS_DIE_1,15,NULL,(statefunc)A_DeathScream,&s_ssdie2}; -statetype s_ssdie2 = {false,SPR_SS_DIE_2,15,NULL,NULL,&s_ssdie3}; -statetype s_ssdie3 = {false,SPR_SS_DIE_3,15,NULL,NULL,&s_ssdie4}; -statetype s_ssdie4 = {false,SPR_SS_DEAD,0,NULL,NULL,&s_ssdie4}; - - -#ifndef SPEAR -// -// hans -// -extern statetype s_bossstand; - -extern statetype s_bosschase1; -extern statetype s_bosschase1s; -extern statetype s_bosschase2; -extern statetype s_bosschase3; -extern statetype s_bosschase3s; -extern statetype s_bosschase4; - -extern statetype s_bossdie1; -extern statetype s_bossdie2; -extern statetype s_bossdie3; -extern statetype s_bossdie4; - -extern statetype s_bossshoot1; -extern statetype s_bossshoot2; -extern statetype s_bossshoot3; -extern statetype s_bossshoot4; -extern statetype s_bossshoot5; -extern statetype s_bossshoot6; -extern statetype s_bossshoot7; -extern statetype s_bossshoot8; - - -statetype s_bossstand = {false,SPR_BOSS_W1,0,(statefunc)T_Stand,NULL,&s_bossstand}; - -statetype s_bosschase1 = {false,SPR_BOSS_W1,10,(statefunc)T_Chase,NULL,&s_bosschase1s}; -statetype s_bosschase1s = {false,SPR_BOSS_W1,3,NULL,NULL,&s_bosschase2}; -statetype s_bosschase2 = {false,SPR_BOSS_W2,8,(statefunc)T_Chase,NULL,&s_bosschase3}; -statetype s_bosschase3 = {false,SPR_BOSS_W3,10,(statefunc)T_Chase,NULL,&s_bosschase3s}; -statetype s_bosschase3s = {false,SPR_BOSS_W3,3,NULL,NULL,&s_bosschase4}; -statetype s_bosschase4 = {false,SPR_BOSS_W4,8,(statefunc)T_Chase,NULL,&s_bosschase1}; - -statetype s_bossdie1 = {false,SPR_BOSS_DIE1,15,NULL,(statefunc)A_DeathScream,&s_bossdie2}; -statetype s_bossdie2 = {false,SPR_BOSS_DIE2,15,NULL,NULL,&s_bossdie3}; -statetype s_bossdie3 = {false,SPR_BOSS_DIE3,15,NULL,NULL,&s_bossdie4}; -statetype s_bossdie4 = {false,SPR_BOSS_DEAD,0,NULL,NULL,&s_bossdie4}; - -statetype s_bossshoot1 = {false,SPR_BOSS_SHOOT1,30,NULL,NULL,&s_bossshoot2}; -statetype s_bossshoot2 = {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_bossshoot3}; -statetype s_bossshoot3 = {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_bossshoot4}; -statetype s_bossshoot4 = {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_bossshoot5}; -statetype s_bossshoot5 = {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_bossshoot6}; -statetype s_bossshoot6 = {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_bossshoot7}; -statetype s_bossshoot7 = {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_bossshoot8}; -statetype s_bossshoot8 = {false,SPR_BOSS_SHOOT1,10,NULL,NULL,&s_bosschase1}; - - -// -// gretel -// -extern statetype s_gretelstand; - -extern statetype s_gretelchase1; -extern statetype s_gretelchase1s; -extern statetype s_gretelchase2; -extern statetype s_gretelchase3; -extern statetype s_gretelchase3s; -extern statetype s_gretelchase4; - -extern statetype s_greteldie1; -extern statetype s_greteldie2; -extern statetype s_greteldie3; -extern statetype s_greteldie4; - -extern statetype s_gretelshoot1; -extern statetype s_gretelshoot2; -extern statetype s_gretelshoot3; -extern statetype s_gretelshoot4; -extern statetype s_gretelshoot5; -extern statetype s_gretelshoot6; -extern statetype s_gretelshoot7; -extern statetype s_gretelshoot8; - - -statetype s_gretelstand = {false,SPR_GRETEL_W1,0,(statefunc)T_Stand,NULL,&s_gretelstand}; - -statetype s_gretelchase1 = {false,SPR_GRETEL_W1,10,(statefunc)T_Chase,NULL,&s_gretelchase1s}; -statetype s_gretelchase1s = {false,SPR_GRETEL_W1,3,NULL,NULL,&s_gretelchase2}; -statetype s_gretelchase2 = {false,SPR_GRETEL_W2,8,(statefunc)T_Chase,NULL,&s_gretelchase3}; -statetype s_gretelchase3 = {false,SPR_GRETEL_W3,10,(statefunc)T_Chase,NULL,&s_gretelchase3s}; -statetype s_gretelchase3s = {false,SPR_GRETEL_W3,3,NULL,NULL,&s_gretelchase4}; -statetype s_gretelchase4 = {false,SPR_GRETEL_W4,8,(statefunc)T_Chase,NULL,&s_gretelchase1}; - -statetype s_greteldie1 = {false,SPR_GRETEL_DIE1,15,NULL,(statefunc)A_DeathScream,&s_greteldie2}; -statetype s_greteldie2 = {false,SPR_GRETEL_DIE2,15,NULL,NULL,&s_greteldie3}; -statetype s_greteldie3 = {false,SPR_GRETEL_DIE3,15,NULL,NULL,&s_greteldie4}; -statetype s_greteldie4 = {false,SPR_GRETEL_DEAD,0,NULL,NULL,&s_greteldie4}; - -statetype s_gretelshoot1 = {false,SPR_GRETEL_SHOOT1,30,NULL,NULL,&s_gretelshoot2}; -statetype s_gretelshoot2 = {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_gretelshoot3}; -statetype s_gretelshoot3 = {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_gretelshoot4}; -statetype s_gretelshoot4 = {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_gretelshoot5}; -statetype s_gretelshoot5 = {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_gretelshoot6}; -statetype s_gretelshoot6 = {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_gretelshoot7}; -statetype s_gretelshoot7 = {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_gretelshoot8}; -statetype s_gretelshoot8 = {false,SPR_GRETEL_SHOOT1,10,NULL,NULL,&s_gretelchase1}; -#endif - - /* =============== = @@ -856,28 +325,28 @@ void SpawnStand (enemy_t which, int tilex, int tiley, int dir) switch (which) { case en_guard: - SpawnNewObj (tilex,tiley,&s_grdstand); + SpawnNewObj (tilex,tiley,&states[s_grdstand]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_officer: - SpawnNewObj (tilex,tiley,&s_ofcstand); + SpawnNewObj (tilex,tiley,&states[s_ofcstand]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_mutant: - SpawnNewObj (tilex,tiley,&s_mutstand); + SpawnNewObj (tilex,tiley,&states[s_mutstand]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_ss: - SpawnNewObj (tilex,tiley,&s_ssstand); + SpawnNewObj (tilex,tiley,&states[s_ssstand]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; @@ -924,7 +393,7 @@ void SpawnStand (enemy_t which, int tilex, int tiley, int dir) void SpawnDeadGuard (int tilex, int tiley) { - SpawnNewObj (tilex,tiley,&s_grddie4); + SpawnNewObj (tilex,tiley,&states[s_grddie4]); DEMOIF_SDL { newobj->flags |= FL_NONMARK; // walk through moving enemy fix @@ -945,7 +414,7 @@ void SpawnDeadGuard (int tilex, int tiley) void SpawnBoss (int tilex, int tiley) { - SpawnNewObj (tilex,tiley,&s_bossstand); + SpawnNewObj (tilex,tiley,&states[s_bossstand]); newobj->speed = SPDPATROL; newobj->obclass = bossobj; @@ -966,7 +435,7 @@ void SpawnBoss (int tilex, int tiley) void SpawnGretel (int tilex, int tiley) { - SpawnNewObj (tilex,tiley,&s_gretelstand); + SpawnNewObj (tilex,tiley,&states[s_gretelstand]); newobj->speed = SPDPATROL; newobj->obclass = gretelobj; @@ -991,35 +460,35 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir) switch (which) { case en_guard: - SpawnNewObj (tilex,tiley,&s_grdpath1); + SpawnNewObj (tilex,tiley,&states[s_grdpath1]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_officer: - SpawnNewObj (tilex,tiley,&s_ofcpath1); + SpawnNewObj (tilex,tiley,&states[s_ofcpath1]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_ss: - SpawnNewObj (tilex,tiley,&s_sspath1); + SpawnNewObj (tilex,tiley,&states[s_sspath1]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_mutant: - SpawnNewObj (tilex,tiley,&s_mutpath1); + SpawnNewObj (tilex,tiley,&states[s_mutpath1]); newobj->speed = SPDPATROL; if (!loadedgame) gamestate.killtotal++; break; case en_dog: - SpawnNewObj (tilex,tiley,&s_dogpath1); + SpawnNewObj (tilex,tiley,&states[s_dogpath1]); newobj->speed = SPDDOG; if (!loadedgame) gamestate.killtotal++; @@ -1183,67 +652,6 @@ void A_DeathScream (objtype *ob) #ifdef SPEAR -void T_Launch (objtype *ob); -void T_Will (objtype *ob); - -extern statetype s_angelshoot1; -extern statetype s_deathshoot1; -extern statetype s_spark1; - -// -// trans -// -extern statetype s_transstand; - -extern statetype s_transchase1; -extern statetype s_transchase1s; -extern statetype s_transchase2; -extern statetype s_transchase3; -extern statetype s_transchase3s; -extern statetype s_transchase4; - -extern statetype s_transdie0; -extern statetype s_transdie01; -extern statetype s_transdie1; -extern statetype s_transdie2; -extern statetype s_transdie3; -extern statetype s_transdie4; - -extern statetype s_transshoot1; -extern statetype s_transshoot2; -extern statetype s_transshoot3; -extern statetype s_transshoot4; -extern statetype s_transshoot5; -extern statetype s_transshoot6; -extern statetype s_transshoot7; -extern statetype s_transshoot8; - - -statetype s_transstand = {false,SPR_TRANS_W1,0,(statefunc)T_Stand,NULL,&s_transstand}; - -statetype s_transchase1 = {false,SPR_TRANS_W1,10,(statefunc)T_Chase,NULL,&s_transchase1s}; -statetype s_transchase1s = {false,SPR_TRANS_W1,3,NULL,NULL,&s_transchase2}; -statetype s_transchase2 = {false,SPR_TRANS_W2,8,(statefunc)T_Chase,NULL,&s_transchase3}; -statetype s_transchase3 = {false,SPR_TRANS_W3,10,(statefunc)T_Chase,NULL,&s_transchase3s}; -statetype s_transchase3s = {false,SPR_TRANS_W3,3,NULL,NULL,&s_transchase4}; -statetype s_transchase4 = {false,SPR_TRANS_W4,8,(statefunc)T_Chase,NULL,&s_transchase1}; - -statetype s_transdie0 = {false,SPR_TRANS_W1,1,NULL,(statefunc)A_DeathScream,&s_transdie01}; -statetype s_transdie01 = {false,SPR_TRANS_W1,1,NULL,NULL,&s_transdie1}; -statetype s_transdie1 = {false,SPR_TRANS_DIE1,15,NULL,NULL,&s_transdie2}; -statetype s_transdie2 = {false,SPR_TRANS_DIE2,15,NULL,NULL,&s_transdie3}; -statetype s_transdie3 = {false,SPR_TRANS_DIE3,15,NULL,NULL,&s_transdie4}; -statetype s_transdie4 = {false,SPR_TRANS_DEAD,0,NULL,NULL,&s_transdie4}; - -statetype s_transshoot1 = {false,SPR_TRANS_SHOOT1,30,NULL,NULL,&s_transshoot2}; -statetype s_transshoot2 = {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_transshoot3}; -statetype s_transshoot3 = {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_transshoot4}; -statetype s_transshoot4 = {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_transshoot5}; -statetype s_transshoot5 = {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_transshoot6}; -statetype s_transshoot6 = {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_transshoot7}; -statetype s_transshoot7 = {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_transshoot8}; -statetype s_transshoot8 = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transchase1}; - /* =============== @@ -1261,7 +669,7 @@ void SpawnTrans (int tilex, int tiley) if (SoundBlasterPresent && DigiMode != sds_Off) s_transdie01.tictime = 105; - SpawnNewObj (tilex,tiley,&s_transstand); + SpawnNewObj (tilex,tiley,&states[s_transstand]); newobj->obclass = transobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_trans]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH; @@ -1270,63 +678,6 @@ void SpawnTrans (int tilex, int tiley) } -// -// uber -// -void T_UShoot (objtype *ob); - -extern statetype s_uberstand; - -extern statetype s_uberchase1; -extern statetype s_uberchase1s; -extern statetype s_uberchase2; -extern statetype s_uberchase3; -extern statetype s_uberchase3s; -extern statetype s_uberchase4; - -extern statetype s_uberdie0; -extern statetype s_uberdie01; -extern statetype s_uberdie1; -extern statetype s_uberdie2; -extern statetype s_uberdie3; -extern statetype s_uberdie4; -extern statetype s_uberdie5; - -extern statetype s_ubershoot1; -extern statetype s_ubershoot2; -extern statetype s_ubershoot3; -extern statetype s_ubershoot4; -extern statetype s_ubershoot5; -extern statetype s_ubershoot6; -extern statetype s_ubershoot7; - - -statetype s_uberstand = {false,SPR_UBER_W1,0,(statefunc)T_Stand,NULL,&s_uberstand}; - -statetype s_uberchase1 = {false,SPR_UBER_W1,10,(statefunc)T_Chase,NULL,&s_uberchase1s}; -statetype s_uberchase1s = {false,SPR_UBER_W1,3,NULL,NULL,&s_uberchase2}; -statetype s_uberchase2 = {false,SPR_UBER_W2,8,(statefunc)T_Chase,NULL,&s_uberchase3}; -statetype s_uberchase3 = {false,SPR_UBER_W3,10,(statefunc)T_Chase,NULL,&s_uberchase3s}; -statetype s_uberchase3s = {false,SPR_UBER_W3,3,NULL,NULL,&s_uberchase4}; -statetype s_uberchase4 = {false,SPR_UBER_W4,8,(statefunc)T_Chase,NULL,&s_uberchase1}; - -statetype s_uberdie0 = {false,SPR_UBER_W1,1,NULL,(statefunc)A_DeathScream,&s_uberdie01}; -statetype s_uberdie01 = {false,SPR_UBER_W1,1,NULL,NULL,&s_uberdie1}; -statetype s_uberdie1 = {false,SPR_UBER_DIE1,15,NULL,NULL,&s_uberdie2}; -statetype s_uberdie2 = {false,SPR_UBER_DIE2,15,NULL,NULL,&s_uberdie3}; -statetype s_uberdie3 = {false,SPR_UBER_DIE3,15,NULL,NULL,&s_uberdie4}; -statetype s_uberdie4 = {false,SPR_UBER_DIE4,15,NULL,NULL,&s_uberdie5}; -statetype s_uberdie5 = {false,SPR_UBER_DEAD,0,NULL,NULL,&s_uberdie5}; - -statetype s_ubershoot1 = {false,SPR_UBER_SHOOT1,30,NULL,NULL,&s_ubershoot2}; -statetype s_ubershoot2 = {false,SPR_UBER_SHOOT2,12,NULL,(statefunc)T_UShoot,&s_ubershoot3}; -statetype s_ubershoot3 = {false,SPR_UBER_SHOOT3,12,NULL,(statefunc)T_UShoot,&s_ubershoot4}; -statetype s_ubershoot4 = {false,SPR_UBER_SHOOT4,12,NULL,(statefunc)T_UShoot,&s_ubershoot5}; -statetype s_ubershoot5 = {false,SPR_UBER_SHOOT3,12,NULL,(statefunc)T_UShoot,&s_ubershoot6}; -statetype s_ubershoot6 = {false,SPR_UBER_SHOOT2,12,NULL,(statefunc)T_UShoot,&s_ubershoot7}; -statetype s_ubershoot7 = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_uberchase1}; - - /* =============== = @@ -1340,7 +691,7 @@ void SpawnUber (int tilex, int tiley) if (SoundBlasterPresent && DigiMode != sds_Off) s_uberdie01.tictime = 70; - SpawnNewObj (tilex,tiley,&s_uberstand); + SpawnNewObj (tilex,tiley,&states[s_uberstand]); newobj->obclass = uberobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_uber]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH; @@ -1371,59 +722,6 @@ void T_UShoot (objtype *ob) } -// -// will -// -extern statetype s_willstand; - -extern statetype s_willchase1; -extern statetype s_willchase1s; -extern statetype s_willchase2; -extern statetype s_willchase3; -extern statetype s_willchase3s; -extern statetype s_willchase4; - -extern statetype s_willdie1; -extern statetype s_willdie2; -extern statetype s_willdie3; -extern statetype s_willdie4; -extern statetype s_willdie5; -extern statetype s_willdie6; - -extern statetype s_willshoot1; -extern statetype s_willshoot2; -extern statetype s_willshoot3; -extern statetype s_willshoot4; -extern statetype s_willshoot5; -extern statetype s_willshoot6; - - -statetype s_willstand = {false,SPR_WILL_W1,0,(statefunc)T_Stand,NULL,&s_willstand}; - -statetype s_willchase1 = {false,SPR_WILL_W1,10,(statefunc)T_Will,NULL,&s_willchase1s}; -statetype s_willchase1s = {false,SPR_WILL_W1,3,NULL,NULL,&s_willchase2}; -statetype s_willchase2 = {false,SPR_WILL_W2,8,(statefunc)T_Will,NULL,&s_willchase3}; -statetype s_willchase3 = {false,SPR_WILL_W3,10,(statefunc)T_Will,NULL,&s_willchase3s}; -statetype s_willchase3s = {false,SPR_WILL_W3,3,NULL,NULL,&s_willchase4}; -statetype s_willchase4 = {false,SPR_WILL_W4,8,(statefunc)T_Will,NULL,&s_willchase1}; - -statetype s_willdeathcam = {false,SPR_WILL_W1,1,NULL,NULL,&s_willdie1}; - -statetype s_willdie1 = {false,SPR_WILL_W1,1,NULL,(statefunc)A_DeathScream,&s_willdie2}; -statetype s_willdie2 = {false,SPR_WILL_W1,10,NULL,NULL,&s_willdie3}; -statetype s_willdie3 = {false,SPR_WILL_DIE1,10,NULL,NULL,&s_willdie4}; -statetype s_willdie4 = {false,SPR_WILL_DIE2,10,NULL,NULL,&s_willdie5}; -statetype s_willdie5 = {false,SPR_WILL_DIE3,10,NULL,NULL,&s_willdie6}; -statetype s_willdie6 = {false,SPR_WILL_DEAD,20,NULL,NULL,&s_willdie6}; - -statetype s_willshoot1 = {false,SPR_WILL_SHOOT1,30,NULL,NULL,&s_willshoot2}; -statetype s_willshoot2 = {false,SPR_WILL_SHOOT2,10,NULL,(statefunc)T_Launch,&s_willshoot3}; -statetype s_willshoot3 = {false,SPR_WILL_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_willshoot4}; -statetype s_willshoot4 = {false,SPR_WILL_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_willshoot5}; -statetype s_willshoot5 = {false,SPR_WILL_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_willshoot6}; -statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_willchase1}; - - /* =============== = @@ -1437,7 +735,7 @@ void SpawnWill (int tilex, int tiley) if (SoundBlasterPresent && DigiMode != sds_Off) s_willdie2.tictime = 70; - SpawnNewObj (tilex,tiley,&s_willstand); + SpawnNewObj (tilex,tiley,&states[s_willstand]); newobj->obclass = willobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_will]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH; @@ -1474,11 +772,11 @@ void T_Will (objtype *ob) // go into attack frame // if (ob->obclass == willobj) - NewState (ob,&s_willshoot1); + NewState (ob,&states[s_willshoot1]); else if (ob->obclass == angelobj) - NewState (ob,&s_angelshoot1); + NewState (ob,&states[s_angelshoot1]); else - NewState (ob,&s_deathshoot1); + NewState (ob,&states[s_deathshoot1]); return; } dodge = true; @@ -1544,63 +842,6 @@ void T_Will (objtype *ob) } -// -// death -// -extern statetype s_deathstand; - -extern statetype s_deathchase1; -extern statetype s_deathchase1s; -extern statetype s_deathchase2; -extern statetype s_deathchase3; -extern statetype s_deathchase3s; -extern statetype s_deathchase4; - -extern statetype s_deathdie1; -extern statetype s_deathdie2; -extern statetype s_deathdie3; -extern statetype s_deathdie4; -extern statetype s_deathdie5; -extern statetype s_deathdie6; -extern statetype s_deathdie7; -extern statetype s_deathdie8; -extern statetype s_deathdie9; - -extern statetype s_deathshoot1; -extern statetype s_deathshoot2; -extern statetype s_deathshoot3; -extern statetype s_deathshoot4; -extern statetype s_deathshoot5; - - -statetype s_deathstand = {false,SPR_DEATH_W1,0,(statefunc)T_Stand,NULL,&s_deathstand}; - -statetype s_deathchase1 = {false,SPR_DEATH_W1,10,(statefunc)T_Will,NULL,&s_deathchase1s}; -statetype s_deathchase1s = {false,SPR_DEATH_W1,3,NULL,NULL,&s_deathchase2}; -statetype s_deathchase2 = {false,SPR_DEATH_W2,8,(statefunc)T_Will,NULL,&s_deathchase3}; -statetype s_deathchase3 = {false,SPR_DEATH_W3,10,(statefunc)T_Will,NULL,&s_deathchase3s}; -statetype s_deathchase3s = {false,SPR_DEATH_W3,3,NULL,NULL,&s_deathchase4}; -statetype s_deathchase4 = {false,SPR_DEATH_W4,8,(statefunc)T_Will,NULL,&s_deathchase1}; - -statetype s_deathdeathcam = {false,SPR_DEATH_W1,1,NULL,NULL,&s_deathdie1}; - -statetype s_deathdie1 = {false,SPR_DEATH_W1,1,NULL,(statefunc)A_DeathScream,&s_deathdie2}; -statetype s_deathdie2 = {false,SPR_DEATH_W1,10,NULL,NULL,&s_deathdie3}; -statetype s_deathdie3 = {false,SPR_DEATH_DIE1,10,NULL,NULL,&s_deathdie4}; -statetype s_deathdie4 = {false,SPR_DEATH_DIE2,10,NULL,NULL,&s_deathdie5}; -statetype s_deathdie5 = {false,SPR_DEATH_DIE3,10,NULL,NULL,&s_deathdie6}; -statetype s_deathdie6 = {false,SPR_DEATH_DIE4,10,NULL,NULL,&s_deathdie7}; -statetype s_deathdie7 = {false,SPR_DEATH_DIE5,10,NULL,NULL,&s_deathdie8}; -statetype s_deathdie8 = {false,SPR_DEATH_DIE6,10,NULL,NULL,&s_deathdie9}; -statetype s_deathdie9 = {false,SPR_DEATH_DEAD,0,NULL,NULL,&s_deathdie9}; - -statetype s_deathshoot1 = {false,SPR_DEATH_SHOOT1,30,NULL,NULL,&s_deathshoot2}; -statetype s_deathshoot2 = {false,SPR_DEATH_SHOOT2,10,NULL,(statefunc)T_Launch,&s_deathshoot3}; -statetype s_deathshoot3 = {false,SPR_DEATH_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_deathshoot4}; -statetype s_deathshoot4 = {false,SPR_DEATH_SHOOT3,10,NULL,(statefunc)T_Launch,&s_deathshoot5}; -statetype s_deathshoot5 = {false,SPR_DEATH_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_deathchase1}; - - /* =============== = @@ -1614,7 +855,7 @@ void SpawnDeath (int tilex, int tiley) if (SoundBlasterPresent && DigiMode != sds_Off) s_deathdie2.tictime = 105; - SpawnNewObj (tilex,tiley,&s_deathstand); + SpawnNewObj (tilex,tiley,&states[s_deathstand]); newobj->obclass = deathobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_death]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH; @@ -1645,7 +886,7 @@ void T_Launch (objtype *ob) if (ob->obclass == deathobj) { T_Shoot (ob); - if (ob->state == &s_deathshoot2) + if (ob->state == &states[s_deathshoot2]) { iangle-=4; if (iangle<0) @@ -1660,7 +901,7 @@ void T_Launch (objtype *ob) } GetNewActor (); - newobj->state = &s_rocket; + newobj->state = &states[s_rocket]; newobj->ticcount = 1; newobj->tilex = ob->tilex; @@ -1671,12 +912,12 @@ void T_Launch (objtype *ob) switch(ob->obclass) { case deathobj: - newobj->state = &s_hrocket; + newobj->state = &states[s_hrocket]; newobj->obclass = hrocketobj; PlaySoundLocActor (KNIGHTMISSILESND,newobj); break; case angelobj: - newobj->state = &s_spark1; + newobj->state = &states[s_spark1]; newobj->obclass = sparkobj; PlaySoundLocActor (ANGELFIRESND,newobj); break; @@ -1696,89 +937,6 @@ void T_Launch (objtype *ob) // // angel // -void A_Relaunch (objtype *ob); -void A_Victory (objtype *ob); -void A_StartAttack (objtype *ob); -void A_Breathing (objtype *ob); - -extern statetype s_angelstand; - -extern statetype s_angelchase1; -extern statetype s_angelchase1s; -extern statetype s_angelchase2; -extern statetype s_angelchase3; -extern statetype s_angelchase3s; -extern statetype s_angelchase4; - -extern statetype s_angeldie1; -extern statetype s_angeldie11; -extern statetype s_angeldie2; -extern statetype s_angeldie3; -extern statetype s_angeldie4; -extern statetype s_angeldie5; -extern statetype s_angeldie6; -extern statetype s_angeldie7; -extern statetype s_angeldie8; -extern statetype s_angeldie9; - -extern statetype s_angelshoot1; -extern statetype s_angelshoot2; -extern statetype s_angelshoot3; -extern statetype s_angelshoot4; -extern statetype s_angelshoot5; -extern statetype s_angelshoot6; - -extern statetype s_angeltired; -extern statetype s_angeltired2; -extern statetype s_angeltired3; -extern statetype s_angeltired4; -extern statetype s_angeltired5; -extern statetype s_angeltired6; -extern statetype s_angeltired7; - -extern statetype s_spark1; -extern statetype s_spark2; -extern statetype s_spark3; -extern statetype s_spark4; - - -statetype s_angelstand = {false,SPR_ANGEL_W1,0,(statefunc)T_Stand,NULL,&s_angelstand}; - -statetype s_angelchase1 = {false,SPR_ANGEL_W1,10,(statefunc)T_Will,NULL,&s_angelchase1s}; -statetype s_angelchase1s = {false,SPR_ANGEL_W1,3,NULL,NULL,&s_angelchase2}; -statetype s_angelchase2 = {false,SPR_ANGEL_W2,8,(statefunc)T_Will,NULL,&s_angelchase3}; -statetype s_angelchase3 = {false,SPR_ANGEL_W3,10,(statefunc)T_Will,NULL,&s_angelchase3s}; -statetype s_angelchase3s = {false,SPR_ANGEL_W3,3,NULL,NULL,&s_angelchase4}; -statetype s_angelchase4 = {false,SPR_ANGEL_W4,8,(statefunc)T_Will,NULL,&s_angelchase1}; - -statetype s_angeldie1 = {false,SPR_ANGEL_W1,1,NULL,(statefunc)A_DeathScream,&s_angeldie11}; -statetype s_angeldie11 = {false,SPR_ANGEL_W1,1,NULL,NULL,&s_angeldie2}; -statetype s_angeldie2 = {false,SPR_ANGEL_DIE1,10,NULL,(statefunc)A_Slurpie,&s_angeldie3}; -statetype s_angeldie3 = {false,SPR_ANGEL_DIE2,10,NULL,NULL,&s_angeldie4}; -statetype s_angeldie4 = {false,SPR_ANGEL_DIE3,10,NULL,NULL,&s_angeldie5}; -statetype s_angeldie5 = {false,SPR_ANGEL_DIE4,10,NULL,NULL,&s_angeldie6}; -statetype s_angeldie6 = {false,SPR_ANGEL_DIE5,10,NULL,NULL,&s_angeldie7}; -statetype s_angeldie7 = {false,SPR_ANGEL_DIE6,10,NULL,NULL,&s_angeldie8}; -statetype s_angeldie8 = {false,SPR_ANGEL_DIE7,10,NULL,NULL,&s_angeldie9}; -statetype s_angeldie9 = {false,SPR_ANGEL_DEAD,130,NULL,(statefunc)A_Victory,&s_angeldie9}; - -statetype s_angelshoot1 = {false,SPR_ANGEL_SHOOT1,10,NULL,(statefunc)A_StartAttack,&s_angelshoot2}; -statetype s_angelshoot2 = {false,SPR_ANGEL_SHOOT2,20,NULL,(statefunc)T_Launch,&s_angelshoot3}; -statetype s_angelshoot3 = {false,SPR_ANGEL_SHOOT1,10,NULL,(statefunc)A_Relaunch,&s_angelshoot2}; - -statetype s_angeltired = {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,&s_angeltired2}; -statetype s_angeltired2 = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired3}; -statetype s_angeltired3 = {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,&s_angeltired4}; -statetype s_angeltired4 = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired5}; -statetype s_angeltired5 = {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,&s_angeltired6}; -statetype s_angeltired6 = {false,SPR_ANGEL_TIRED2,40,NULL,NULL,&s_angeltired7}; -statetype s_angeltired7 = {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,&s_angelchase1}; - -statetype s_spark1 = {false,SPR_SPARK1,6,(statefunc)T_Projectile,NULL,&s_spark2}; -statetype s_spark2 = {false,SPR_SPARK2,6,(statefunc)T_Projectile,NULL,&s_spark3}; -statetype s_spark3 = {false,SPR_SPARK3,6,(statefunc)T_Projectile,NULL,&s_spark4}; -statetype s_spark4 = {false,SPR_SPARK4,6,(statefunc)T_Projectile,NULL,&s_spark1}; - void A_Slurpie (objtype *) { @@ -1803,7 +961,7 @@ void SpawnAngel (int tilex, int tiley) if (SoundBlasterPresent && DigiMode != sds_Off) s_angeldie11.tictime = 105; - SpawnNewObj (tilex,tiley,&s_angelstand); + SpawnNewObj (tilex,tiley,&[s_angelstand]); newobj->obclass = angelobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_angel]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH; @@ -1852,13 +1010,13 @@ void A_Relaunch (objtype *ob) { if (++ob->temp1 == 3) { - NewState (ob,&s_angeltired); + NewState (ob,&states[s_angeltired]); return; } if (US_RndT()&1) { - NewState (ob,&s_angelchase1); + NewState (ob,&states[s_angelchase1]); return; } } @@ -1869,41 +1027,6 @@ void A_Relaunch (objtype *ob) // // spectre // -void T_SpectreWait (objtype *ob); -void A_Dormant (objtype *ob); - -extern statetype s_spectrewait1; -extern statetype s_spectrewait2; -extern statetype s_spectrewait3; -extern statetype s_spectrewait4; - -extern statetype s_spectrechase1; -extern statetype s_spectrechase2; -extern statetype s_spectrechase3; -extern statetype s_spectrechase4; - -extern statetype s_spectredie1; -extern statetype s_spectredie2; -extern statetype s_spectredie3; -extern statetype s_spectredie4; - -extern statetype s_spectrewake; - -statetype s_spectrewait1 = {false,SPR_SPECTRE_W1,10,(statefunc)T_Stand,NULL,&s_spectrewait2}; -statetype s_spectrewait2 = {false,SPR_SPECTRE_W2,10,(statefunc)T_Stand,NULL,&s_spectrewait3}; -statetype s_spectrewait3 = {false,SPR_SPECTRE_W3,10,(statefunc)T_Stand,NULL,&s_spectrewait4}; -statetype s_spectrewait4 = {false,SPR_SPECTRE_W4,10,(statefunc)T_Stand,NULL,&s_spectrewait1}; - -statetype s_spectrechase1 = {false,SPR_SPECTRE_W1,10,(statefunc)T_Ghosts,NULL,&s_spectrechase2}; -statetype s_spectrechase2 = {false,SPR_SPECTRE_W2,10,(statefunc)T_Ghosts,NULL,&s_spectrechase3}; -statetype s_spectrechase3 = {false,SPR_SPECTRE_W3,10,(statefunc)T_Ghosts,NULL,&s_spectrechase4}; -statetype s_spectrechase4 = {false,SPR_SPECTRE_W4,10,(statefunc)T_Ghosts,NULL,&s_spectrechase1}; - -statetype s_spectredie1 = {false,SPR_SPECTRE_F1,10,NULL,NULL,&s_spectredie2}; -statetype s_spectredie2 = {false,SPR_SPECTRE_F2,10,NULL,NULL,&s_spectredie3}; -statetype s_spectredie3 = {false,SPR_SPECTRE_F3,10,NULL,NULL,&s_spectredie4}; -statetype s_spectredie4 = {false,SPR_SPECTRE_F4,300,NULL,NULL,&s_spectrewake}; -statetype s_spectrewake = {false,SPR_SPECTRE_F4,10,NULL,(statefunc)A_Dormant,&s_spectrewake}; /* =============== @@ -1915,7 +1038,7 @@ statetype s_spectrewake = {false,SPR_SPECTRE_F4,10,NULL,(statefunc)A_Dor void SpawnSpectre (int tilex, int tiley) { - SpawnNewObj (tilex,tiley,&s_spectrewait1); + SpawnNewObj (tilex,tiley,&states[s_spectrewait1]); newobj->obclass = spectreobj; newobj->hitpoints = starthitpoints[gamestate.difficulty][en_spectre]; newobj->flags |= FL_SHOOTABLE|FL_AMBUSH|FL_BONUS; // |FL_NEVERMARK|FL_NONMARK; @@ -1970,7 +1093,7 @@ void A_Dormant (objtype *ob) ob->flags &= ~FL_ATTACKMODE; ob->flags &= ~FL_NONMARK; // stuck bugfix 1 ob->dir = nodir; - NewState (ob,&s_spectrewait1); + NewState (ob,&states[s_spectrewait1]); } @@ -1998,16 +1121,16 @@ void SpawnGhosts (int which, int tilex, int tiley) switch(which) { case en_blinky: - SpawnNewObj (tilex,tiley,&s_blinkychase1); + SpawnNewObj (tilex,tiley,&states[s_blinkychase1]); break; case en_clyde: - SpawnNewObj (tilex,tiley,&s_clydechase1); + SpawnNewObj (tilex,tiley,&states[s_clydechase1]); break; case en_pinky: - SpawnNewObj (tilex,tiley,&s_pinkychase1); + SpawnNewObj (tilex,tiley,&states[s_pinkychase1]); break; case en_inky: - SpawnNewObj (tilex,tiley,&s_inkychase1); + SpawnNewObj (tilex,tiley,&states[s_inkychase1]); break; } @@ -2024,186 +1147,6 @@ void SpawnGhosts (int which, int tilex, int tiley) } - -void T_Gift (objtype *ob); -void T_GiftThrow (objtype *ob); - -void T_Fat (objtype *ob); -void T_FatThrow (objtype *ob); - -// -// schabb -// -extern statetype s_schabbstand; - -extern statetype s_schabbchase1; -extern statetype s_schabbchase1s; -extern statetype s_schabbchase2; -extern statetype s_schabbchase3; -extern statetype s_schabbchase3s; -extern statetype s_schabbchase4; - -extern statetype s_schabbdie1; -extern statetype s_schabbdie2; -extern statetype s_schabbdie3; -extern statetype s_schabbdie4; -extern statetype s_schabbdie5; -extern statetype s_schabbdie6; - -extern statetype s_schabbshoot1; -extern statetype s_schabbshoot2; - -extern statetype s_needle1; -extern statetype s_needle2; -extern statetype s_needle3; -extern statetype s_needle4; - -extern statetype s_schabbdeathcam; - - -statetype s_schabbstand = {false,SPR_SCHABB_W1,0,(statefunc)T_Stand,NULL,&s_schabbstand}; - -statetype s_schabbchase1 = {false,SPR_SCHABB_W1,10,(statefunc)T_Schabb,NULL,&s_schabbchase1s}; -statetype s_schabbchase1s = {false,SPR_SCHABB_W1,3,NULL,NULL,&s_schabbchase2}; -statetype s_schabbchase2 = {false,SPR_SCHABB_W2,8,(statefunc)T_Schabb,NULL,&s_schabbchase3}; -statetype s_schabbchase3 = {false,SPR_SCHABB_W3,10,(statefunc)T_Schabb,NULL,&s_schabbchase3s}; -statetype s_schabbchase3s = {false,SPR_SCHABB_W3,3,NULL,NULL,&s_schabbchase4}; -statetype s_schabbchase4 = {false,SPR_SCHABB_W4,8,(statefunc)T_Schabb,NULL,&s_schabbchase1}; - -statetype s_schabbdeathcam = {false,SPR_SCHABB_W1,1,NULL,NULL,&s_schabbdie1}; - -statetype s_schabbdie1 = {false,SPR_SCHABB_W1,10,NULL,(statefunc)A_DeathScream,&s_schabbdie2}; -statetype s_schabbdie2 = {false,SPR_SCHABB_W1,10,NULL,NULL,&s_schabbdie3}; -statetype s_schabbdie3 = {false,SPR_SCHABB_DIE1,10,NULL,NULL,&s_schabbdie4}; -statetype s_schabbdie4 = {false,SPR_SCHABB_DIE2,10,NULL,NULL,&s_schabbdie5}; -statetype s_schabbdie5 = {false,SPR_SCHABB_DIE3,10,NULL,NULL,&s_schabbdie6}; -statetype s_schabbdie6 = {false,SPR_SCHABB_DEAD,20,NULL,(statefunc)A_StartDeathCam,&s_schabbdie6}; - -statetype s_schabbshoot1 = {false,SPR_SCHABB_SHOOT1,30,NULL,NULL,&s_schabbshoot2}; -statetype s_schabbshoot2 = {false,SPR_SCHABB_SHOOT2,10,NULL,(statefunc)T_SchabbThrow,&s_schabbchase1}; - -statetype s_needle1 = {false,SPR_HYPO1,6,(statefunc)T_Projectile,NULL,&s_needle2}; -statetype s_needle2 = {false,SPR_HYPO2,6,(statefunc)T_Projectile,NULL,&s_needle3}; -statetype s_needle3 = {false,SPR_HYPO3,6,(statefunc)T_Projectile,NULL,&s_needle4}; -statetype s_needle4 = {false,SPR_HYPO4,6,(statefunc)T_Projectile,NULL,&s_needle1}; - - -// -// gift -// -extern statetype s_giftstand; - -extern statetype s_giftchase1; -extern statetype s_giftchase1s; -extern statetype s_giftchase2; -extern statetype s_giftchase3; -extern statetype s_giftchase3s; -extern statetype s_giftchase4; - -extern statetype s_giftdie1; -extern statetype s_giftdie2; -extern statetype s_giftdie3; -extern statetype s_giftdie4; -extern statetype s_giftdie5; -extern statetype s_giftdie6; - -extern statetype s_giftshoot1; -extern statetype s_giftshoot2; - -extern statetype s_needle1; -extern statetype s_needle2; -extern statetype s_needle3; -extern statetype s_needle4; - -extern statetype s_giftdeathcam; - -extern statetype s_boom1; -extern statetype s_boom2; -extern statetype s_boom3; - - -statetype s_giftstand = {false,SPR_GIFT_W1,0,(statefunc)T_Stand,NULL,&s_giftstand}; - -statetype s_giftchase1 = {false,SPR_GIFT_W1,10,(statefunc)T_Gift,NULL,&s_giftchase1s}; -statetype s_giftchase1s = {false,SPR_GIFT_W1,3,NULL,NULL,&s_giftchase2}; -statetype s_giftchase2 = {false,SPR_GIFT_W2,8,(statefunc)T_Gift,NULL,&s_giftchase3}; -statetype s_giftchase3 = {false,SPR_GIFT_W3,10,(statefunc)T_Gift,NULL,&s_giftchase3s}; -statetype s_giftchase3s = {false,SPR_GIFT_W3,3,NULL,NULL,&s_giftchase4}; -statetype s_giftchase4 = {false,SPR_GIFT_W4,8,(statefunc)T_Gift,NULL,&s_giftchase1}; - -statetype s_giftdeathcam = {false,SPR_GIFT_W1,1,NULL,NULL,&s_giftdie1}; - -statetype s_giftdie1 = {false,SPR_GIFT_W1,1,NULL,(statefunc)A_DeathScream,&s_giftdie2}; -statetype s_giftdie2 = {false,SPR_GIFT_W1,10,NULL,NULL,&s_giftdie3}; -statetype s_giftdie3 = {false,SPR_GIFT_DIE1,10,NULL,NULL,&s_giftdie4}; -statetype s_giftdie4 = {false,SPR_GIFT_DIE2,10,NULL,NULL,&s_giftdie5}; -statetype s_giftdie5 = {false,SPR_GIFT_DIE3,10,NULL,NULL,&s_giftdie6}; -statetype s_giftdie6 = {false,SPR_GIFT_DEAD,20,NULL,(statefunc)A_StartDeathCam,&s_giftdie6}; - -statetype s_giftshoot1 = {false,SPR_GIFT_SHOOT1,30,NULL,NULL,&s_giftshoot2}; -statetype s_giftshoot2 = {false,SPR_GIFT_SHOOT2,10,NULL,(statefunc)T_GiftThrow,&s_giftchase1}; - - -// -// fat -// -extern statetype s_fatstand; - -extern statetype s_fatchase1; -extern statetype s_fatchase1s; -extern statetype s_fatchase2; -extern statetype s_fatchase3; -extern statetype s_fatchase3s; -extern statetype s_fatchase4; - -extern statetype s_fatdie1; -extern statetype s_fatdie2; -extern statetype s_fatdie3; -extern statetype s_fatdie4; -extern statetype s_fatdie5; -extern statetype s_fatdie6; - -extern statetype s_fatshoot1; -extern statetype s_fatshoot2; -extern statetype s_fatshoot3; -extern statetype s_fatshoot4; -extern statetype s_fatshoot5; -extern statetype s_fatshoot6; - -extern statetype s_needle1; -extern statetype s_needle2; -extern statetype s_needle3; -extern statetype s_needle4; - -extern statetype s_fatdeathcam; - - -statetype s_fatstand = {false,SPR_FAT_W1,0,(statefunc)T_Stand,NULL,&s_fatstand}; - -statetype s_fatchase1 = {false,SPR_FAT_W1,10,(statefunc)T_Fat,NULL,&s_fatchase1s}; -statetype s_fatchase1s = {false,SPR_FAT_W1,3,NULL,NULL,&s_fatchase2}; -statetype s_fatchase2 = {false,SPR_FAT_W2,8,(statefunc)T_Fat,NULL,&s_fatchase3}; -statetype s_fatchase3 = {false,SPR_FAT_W3,10,(statefunc)T_Fat,NULL,&s_fatchase3s}; -statetype s_fatchase3s = {false,SPR_FAT_W3,3,NULL,NULL,&s_fatchase4}; -statetype s_fatchase4 = {false,SPR_FAT_W4,8,(statefunc)T_Fat,NULL,&s_fatchase1}; - -statetype s_fatdeathcam = {false,SPR_FAT_W1,1,NULL,NULL,&s_fatdie1}; - -statetype s_fatdie1 = {false,SPR_FAT_W1,1,NULL,(statefunc)A_DeathScream,&s_fatdie2}; -statetype s_fatdie2 = {false,SPR_FAT_W1,10,NULL,NULL,&s_fatdie3}; -statetype s_fatdie3 = {false,SPR_FAT_DIE1,10,NULL,NULL,&s_fatdie4}; -statetype s_fatdie4 = {false,SPR_FAT_DIE2,10,NULL,NULL,&s_fatdie5}; -statetype s_fatdie5 = {false,SPR_FAT_DIE3,10,NULL,NULL,&s_fatdie6}; -statetype s_fatdie6 = {false,SPR_FAT_DEAD,20,NULL,(statefunc)A_StartDeathCam,&s_fatdie6}; - -statetype s_fatshoot1 = {false,SPR_FAT_SHOOT1,30,NULL,NULL,&s_fatshoot2}; -statetype s_fatshoot2 = {false,SPR_FAT_SHOOT2,10,NULL,(statefunc)T_GiftThrow,&s_fatshoot3}; -statetype s_fatshoot3 = {false,SPR_FAT_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_fatshoot4}; -statetype s_fatshoot4 = {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_fatshoot5}; -statetype s_fatshoot5 = {false,SPR_FAT_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_fatshoot6}; -statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Shoot,&s_fatchase1}; - - /* =============== = @@ -2215,11 +1158,11 @@ statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Sho void SpawnSchabbs (int tilex, int tiley) { if (DigiMode != sds_Off) - s_schabbdie2.tictime = 140; + states[s_schabbdie2].tictime = 140; else - s_schabbdie2.tictime = 5; + states[s_schabbdie2].tictime = 5; - SpawnNewObj (tilex,tiley,&s_schabbstand); + SpawnNewObj (tilex,tiley,&states[s_schabbstand]); newobj->speed = SPDPATROL; newobj->obclass = schabbobj; @@ -2242,11 +1185,11 @@ void SpawnSchabbs (int tilex, int tiley) void SpawnGift (int tilex, int tiley) { if (DigiMode != sds_Off) - s_giftdie2.tictime = 140; + states[s_giftdie2].tictime = 140; else - s_giftdie2.tictime = 5; + states[s_giftdie2].tictime = 5; - SpawnNewObj (tilex,tiley,&s_giftstand); + SpawnNewObj (tilex,tiley,&states[s_giftstand]); newobj->speed = SPDPATROL; newobj->obclass = giftobj; @@ -2269,11 +1212,11 @@ void SpawnGift (int tilex, int tiley) void SpawnFat (int tilex, int tiley) { if (DigiMode != sds_Off) - s_fatdie2.tictime = 140; + states[s_fatdie2].tictime = 140; else - s_fatdie2.tictime = 5; + states[s_fatdie2].tictime = 5; - SpawnNewObj (tilex,tiley,&s_fatstand); + SpawnNewObj (tilex,tiley,&states[s_fatstand]); newobj->speed = SPDPATROL; newobj->obclass = fatobj; @@ -2307,7 +1250,7 @@ void T_SchabbThrow (objtype *ob) iangle = (int) (angle/(M_PI*2)*ANGLES); GetNewActor (); - newobj->state = &s_needle1; + newobj->state = &states[s_needle1]; newobj->ticcount = 1; newobj->tilex = ob->tilex; @@ -2347,7 +1290,7 @@ void T_GiftThrow (objtype *ob) iangle = (int) (angle/(M_PI*2)*ANGLES); GetNewActor (); - newobj->state = &s_rocket; + newobj->state = &states[s_rocket]; newobj->ticcount = 1; newobj->tilex = ob->tilex; @@ -2394,7 +1337,7 @@ void T_Schabb (objtype *ob) // // go into attack frame // - NewState (ob,&s_schabbshoot1); + NewState (ob,&states[s_schabbshoot1]); return; } dodge = true; @@ -2486,7 +1429,7 @@ void T_Gift (objtype *ob) // // go into attack frame // - NewState (ob,&s_giftshoot1); + NewState (ob,&states[s_giftshoot1]); return; } dodge = true; @@ -2578,7 +1521,7 @@ void T_Fat (objtype *ob) // // go into attack frame // - NewState (ob,&s_fatshoot1); + NewState (ob,&states[s_fatshoot1]); return; } dodge = true; @@ -2652,168 +1595,6 @@ void T_Fat (objtype *ob) */ -// -// fake -// -extern statetype s_fakestand; - -extern statetype s_fakechase1; -extern statetype s_fakechase1s; -extern statetype s_fakechase2; -extern statetype s_fakechase3; -extern statetype s_fakechase3s; -extern statetype s_fakechase4; - -extern statetype s_fakedie1; -extern statetype s_fakedie2; -extern statetype s_fakedie3; -extern statetype s_fakedie4; -extern statetype s_fakedie5; -extern statetype s_fakedie6; - -extern statetype s_fakeshoot1; -extern statetype s_fakeshoot2; -extern statetype s_fakeshoot3; -extern statetype s_fakeshoot4; -extern statetype s_fakeshoot5; -extern statetype s_fakeshoot6; -extern statetype s_fakeshoot7; -extern statetype s_fakeshoot8; -extern statetype s_fakeshoot9; - -extern statetype s_fire1; -extern statetype s_fire2; - -statetype s_fakestand = {false,SPR_FAKE_W1,0,(statefunc)T_Stand,NULL,&s_fakestand}; - -statetype s_fakechase1 = {false,SPR_FAKE_W1,10,(statefunc)T_Fake,NULL,&s_fakechase1s}; -statetype s_fakechase1s = {false,SPR_FAKE_W1,3,NULL,NULL,&s_fakechase2}; -statetype s_fakechase2 = {false,SPR_FAKE_W2,8,(statefunc)T_Fake,NULL,&s_fakechase3}; -statetype s_fakechase3 = {false,SPR_FAKE_W3,10,(statefunc)T_Fake,NULL,&s_fakechase3s}; -statetype s_fakechase3s = {false,SPR_FAKE_W3,3,NULL,NULL,&s_fakechase4}; -statetype s_fakechase4 = {false,SPR_FAKE_W4,8,(statefunc)T_Fake,NULL,&s_fakechase1}; - -statetype s_fakedie1 = {false,SPR_FAKE_DIE1,10,NULL,(statefunc)A_DeathScream,&s_fakedie2}; -statetype s_fakedie2 = {false,SPR_FAKE_DIE2,10,NULL,NULL,&s_fakedie3}; -statetype s_fakedie3 = {false,SPR_FAKE_DIE3,10,NULL,NULL,&s_fakedie4}; -statetype s_fakedie4 = {false,SPR_FAKE_DIE4,10,NULL,NULL,&s_fakedie5}; -statetype s_fakedie5 = {false,SPR_FAKE_DIE5,10,NULL,NULL,&s_fakedie6}; -statetype s_fakedie6 = {false,SPR_FAKE_DEAD,0,NULL,NULL,&s_fakedie6}; - -statetype s_fakeshoot1 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot2}; -statetype s_fakeshoot2 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot3}; -statetype s_fakeshoot3 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot4}; -statetype s_fakeshoot4 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot5}; -statetype s_fakeshoot5 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot6}; -statetype s_fakeshoot6 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot7}; -statetype s_fakeshoot7 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot8}; -statetype s_fakeshoot8 = {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,&s_fakeshoot9}; -statetype s_fakeshoot9 = {false,SPR_FAKE_SHOOT,8,NULL,NULL,&s_fakechase1}; - -statetype s_fire1 = {false,SPR_FIRE1,6,NULL,(statefunc)T_Projectile,&s_fire2}; -statetype s_fire2 = {false,SPR_FIRE2,6,NULL,(statefunc)T_Projectile,&s_fire1}; - -// -// hitler -// -extern statetype s_mechachase1; -extern statetype s_mechachase1s; -extern statetype s_mechachase2; -extern statetype s_mechachase3; -extern statetype s_mechachase3s; -extern statetype s_mechachase4; - -extern statetype s_mechadie1; -extern statetype s_mechadie2; -extern statetype s_mechadie3; -extern statetype s_mechadie4; - -extern statetype s_mechashoot1; -extern statetype s_mechashoot2; -extern statetype s_mechashoot3; -extern statetype s_mechashoot4; -extern statetype s_mechashoot5; -extern statetype s_mechashoot6; - - -extern statetype s_hitlerchase1; -extern statetype s_hitlerchase1s; -extern statetype s_hitlerchase2; -extern statetype s_hitlerchase3; -extern statetype s_hitlerchase3s; -extern statetype s_hitlerchase4; - -extern statetype s_hitlerdie1; -extern statetype s_hitlerdie2; -extern statetype s_hitlerdie3; -extern statetype s_hitlerdie4; -extern statetype s_hitlerdie5; -extern statetype s_hitlerdie6; -extern statetype s_hitlerdie7; -extern statetype s_hitlerdie8; -extern statetype s_hitlerdie9; -extern statetype s_hitlerdie10; - -extern statetype s_hitlershoot1; -extern statetype s_hitlershoot2; -extern statetype s_hitlershoot3; -extern statetype s_hitlershoot4; -extern statetype s_hitlershoot5; -extern statetype s_hitlershoot6; - -extern statetype s_hitlerdeathcam; - -statetype s_mechastand = {false,SPR_MECHA_W1,0,(statefunc)T_Stand,NULL,&s_mechastand}; - -statetype s_mechachase1 = {false,SPR_MECHA_W1,10,(statefunc)T_Chase,(statefunc)A_MechaSound,&s_mechachase1s}; -statetype s_mechachase1s = {false,SPR_MECHA_W1,6,NULL,NULL,&s_mechachase2}; -statetype s_mechachase2 = {false,SPR_MECHA_W2,8,(statefunc)T_Chase,NULL,&s_mechachase3}; -statetype s_mechachase3 = {false,SPR_MECHA_W3,10,(statefunc)T_Chase,(statefunc)A_MechaSound,&s_mechachase3s}; -statetype s_mechachase3s = {false,SPR_MECHA_W3,6,NULL,NULL,&s_mechachase4}; -statetype s_mechachase4 = {false,SPR_MECHA_W4,8,(statefunc)T_Chase,NULL,&s_mechachase1}; - -statetype s_mechadie1 = {false,SPR_MECHA_DIE1,10,NULL,(statefunc)A_DeathScream,&s_mechadie2}; -statetype s_mechadie2 = {false,SPR_MECHA_DIE2,10,NULL,NULL,&s_mechadie3}; -statetype s_mechadie3 = {false,SPR_MECHA_DIE3,10,NULL,(statefunc)A_HitlerMorph,&s_mechadie4}; -statetype s_mechadie4 = {false,SPR_MECHA_DEAD,0,NULL,NULL,&s_mechadie4}; - -statetype s_mechashoot1 = {false,SPR_MECHA_SHOOT1,30,NULL,NULL,&s_mechashoot2}; -statetype s_mechashoot2 = {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_mechashoot3}; -statetype s_mechashoot3 = {false,SPR_MECHA_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_mechashoot4}; -statetype s_mechashoot4 = {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_mechashoot5}; -statetype s_mechashoot5 = {false,SPR_MECHA_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_mechashoot6}; -statetype s_mechashoot6 = {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_mechachase1}; - - -statetype s_hitlerchase1 = {false,SPR_HITLER_W1,6,(statefunc)T_Chase,NULL,&s_hitlerchase1s}; -statetype s_hitlerchase1s = {false,SPR_HITLER_W1,4,NULL,NULL,&s_hitlerchase2}; -statetype s_hitlerchase2 = {false,SPR_HITLER_W2,2,(statefunc)T_Chase,NULL,&s_hitlerchase3}; -statetype s_hitlerchase3 = {false,SPR_HITLER_W3,6,(statefunc)T_Chase,NULL,&s_hitlerchase3s}; -statetype s_hitlerchase3s = {false,SPR_HITLER_W3,4,NULL,NULL,&s_hitlerchase4}; -statetype s_hitlerchase4 = {false,SPR_HITLER_W4,2,(statefunc)T_Chase,NULL,&s_hitlerchase1}; - -statetype s_hitlerdeathcam = {false,SPR_HITLER_W1,10,NULL,NULL,&s_hitlerdie1}; - -statetype s_hitlerdie1 = {false,SPR_HITLER_W1,1,NULL,(statefunc)A_DeathScream,&s_hitlerdie2}; -statetype s_hitlerdie2 = {false,SPR_HITLER_W1,10,NULL,NULL,&s_hitlerdie3}; -statetype s_hitlerdie3 = {false,SPR_HITLER_DIE1,10,NULL,(statefunc)A_Slurpie,&s_hitlerdie4}; -statetype s_hitlerdie4 = {false,SPR_HITLER_DIE2,10,NULL,NULL,&s_hitlerdie5}; -statetype s_hitlerdie5 = {false,SPR_HITLER_DIE3,10,NULL,NULL,&s_hitlerdie6}; -statetype s_hitlerdie6 = {false,SPR_HITLER_DIE4,10,NULL,NULL,&s_hitlerdie7}; -statetype s_hitlerdie7 = {false,SPR_HITLER_DIE5,10,NULL,NULL,&s_hitlerdie8}; -statetype s_hitlerdie8 = {false,SPR_HITLER_DIE6,10,NULL,NULL,&s_hitlerdie9}; -statetype s_hitlerdie9 = {false,SPR_HITLER_DIE7,10,NULL,NULL,&s_hitlerdie10}; -statetype s_hitlerdie10 = {false,SPR_HITLER_DEAD,20,NULL,(statefunc)A_StartDeathCam,&s_hitlerdie10}; - -statetype s_hitlershoot1 = {false,SPR_HITLER_SHOOT1,30,NULL,NULL,&s_hitlershoot2}; -statetype s_hitlershoot2 = {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_hitlershoot3}; -statetype s_hitlershoot3 = {false,SPR_HITLER_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_hitlershoot4}; -statetype s_hitlershoot4 = {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_hitlershoot5}; -statetype s_hitlershoot5 = {false,SPR_HITLER_SHOOT3,10,NULL,(statefunc)T_Shoot,&s_hitlershoot6}; -statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,&s_hitlerchase1}; - - - /* =============== = @@ -2825,11 +1606,11 @@ statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_ void SpawnFakeHitler (int tilex, int tiley) { if (DigiMode != sds_Off) - s_hitlerdie2.tictime = 140; + states[s_hitlerdie2].tictime = 140; else - s_hitlerdie2.tictime = 5; + states[s_hitlerdie2].tictime = 5; - SpawnNewObj (tilex,tiley,&s_fakestand); + SpawnNewObj (tilex,tiley,&states[s_fakestand]); newobj->speed = SPDPATROL; newobj->obclass = fakeobj; @@ -2852,12 +1633,12 @@ void SpawnFakeHitler (int tilex, int tiley) void SpawnHitler (int tilex, int tiley) { if (DigiMode != sds_Off) - s_hitlerdie2.tictime = 140; + states[s_hitlerdie2].tictime = 140; else - s_hitlerdie2.tictime = 5; + states[s_hitlerdie2].tictime = 5; - SpawnNewObj (tilex,tiley,&s_mechastand); + SpawnNewObj (tilex,tiley,&states[s_mechastand]); newobj->speed = SPDPATROL; newobj->obclass = mechahitlerobj; @@ -2881,7 +1662,7 @@ void A_HitlerMorph (objtype *ob) { short hitpoints[4]={500,700,800,900}; - SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1); + SpawnNewObj (ob->tilex,ob->tiley,&states[s_hitlerchase1]); newobj->speed = SPDPATROL*5; newobj->x = ob->x; @@ -2930,7 +1711,7 @@ void T_FakeFire (objtype *ob) if (!objfreelist) // stop shooting if over MAXACTORS { - NewState (ob,&s_fakechase1); + NewState (ob,&states[s_fakechase1]); return; } @@ -2942,7 +1723,7 @@ void T_FakeFire (objtype *ob) iangle = (int) (angle/(M_PI*2)*ANGLES); GetNewActor (); - newobj->state = &s_fire1; + newobj->state = &states[s_fire1]; newobj->ticcount = 1; newobj->tilex = ob->tilex; @@ -2981,7 +1762,7 @@ void T_Fake (objtype *ob) // // go into attack frame // - NewState (ob,&s_fakeshoot1); + NewState (ob,&states[s_fakeshoot1]); return; } } @@ -3117,45 +1898,45 @@ void T_Chase (objtype *ob) switch (ob->obclass) { case guardobj: - NewState (ob,&s_grdshoot1); + NewState (ob,&states[s_grdshoot1]); break; case officerobj: - NewState (ob,&s_ofcshoot1); + NewState (ob,&states[s_ofcshoot1]); break; case mutantobj: - NewState (ob,&s_mutshoot1); + NewState (ob,&states[s_mutshoot1]); break; case ssobj: - NewState (ob,&s_ssshoot1); + NewState (ob,&states[s_ssshoot1]); break; #ifndef SPEAR case bossobj: - NewState (ob,&s_bossshoot1); + NewState (ob,&states[s_bossshoot1]); break; case gretelobj: - NewState (ob,&s_gretelshoot1); + NewState (ob,&states[s_gretelshoot1]); break; case mechahitlerobj: - NewState (ob,&s_mechashoot1); + NewState (ob,&states[s_mechashoot1]); break; case realhitlerobj: - NewState (ob,&s_hitlershoot1); + NewState (ob,&states[s_hitlershoot1]); break; #else case angelobj: - NewState (ob,&s_angelshoot1); + NewState (ob,&states[s_angelshoot1]); break; case transobj: - NewState (ob,&s_transshoot1); + NewState (ob,&states[s_transshoot1]); break; case uberobj: - NewState (ob,&s_ubershoot1); + NewState (ob,&states[s_ubershoot1]); break; case willobj: - NewState (ob,&s_willshoot1); + NewState (ob,&states[s_willshoot1]); break; case deathobj: - NewState (ob,&s_deathshoot1); + NewState (ob,&states[s_deathshoot1]); break; #endif } @@ -3312,7 +2093,7 @@ void T_DogChase (objtype *ob) dy -= move; if (dy <= MINACTORDIST) { - NewState (ob,&s_dogjump1); + NewState (ob,&states[s_dogjump1]); return; } } @@ -3595,42 +2376,6 @@ void T_Bite (objtype *ob) // BJ victory // -void T_BJRun (objtype *ob); -void T_BJJump (objtype *ob); -void T_BJDone (objtype *ob); -void T_BJYell (objtype *ob); - -void T_DeathCam (objtype *ob); - -extern statetype s_bjrun1; -extern statetype s_bjrun1s; -extern statetype s_bjrun2; -extern statetype s_bjrun3; -extern statetype s_bjrun3s; -extern statetype s_bjrun4; - -extern statetype s_bjjump1; -extern statetype s_bjjump2; -extern statetype s_bjjump3; -extern statetype s_bjjump4; - - -statetype s_bjrun1 = {false,SPR_BJ_W1,12,(statefunc)T_BJRun,NULL,&s_bjrun1s}; -statetype s_bjrun1s = {false,SPR_BJ_W1,3, NULL,NULL,&s_bjrun2}; -statetype s_bjrun2 = {false,SPR_BJ_W2,8,(statefunc)T_BJRun,NULL,&s_bjrun3}; -statetype s_bjrun3 = {false,SPR_BJ_W3,12,(statefunc)T_BJRun,NULL,&s_bjrun3s}; -statetype s_bjrun3s = {false,SPR_BJ_W3,3, NULL,NULL,&s_bjrun4}; -statetype s_bjrun4 = {false,SPR_BJ_W4,8,(statefunc)T_BJRun,NULL,&s_bjrun1}; - - -statetype s_bjjump1 = {false,SPR_BJ_JUMP1,14,(statefunc)T_BJJump,NULL,&s_bjjump2}; -statetype s_bjjump2 = {false,SPR_BJ_JUMP2,14,(statefunc)T_BJJump,(statefunc)T_BJYell,&s_bjjump3}; -statetype s_bjjump3 = {false,SPR_BJ_JUMP3,14,(statefunc)T_BJJump,NULL,&s_bjjump4}; -statetype s_bjjump4 = {false,SPR_BJ_JUMP4,300,NULL,(statefunc)T_BJDone,&s_bjjump4}; - - -statetype s_deathcam = {false,0,0,NULL,NULL,NULL}; - /* =============== @@ -3642,7 +2387,7 @@ statetype s_deathcam = {false,0,0,NULL,NULL,NULL}; void SpawnBJVictory (void) { - SpawnNewObj (player->tilex,player->tiley+1,&s_bjrun1); + SpawnNewObj (player->tilex,player->tiley+1,&states[s_bjrun1]); newobj->x = player->x; newobj->y = player->y; newobj->obclass = bjobj; @@ -3683,7 +2428,7 @@ void T_BJRun (objtype *ob) if ( !(--ob->temp1) ) { - NewState (ob,&s_bjjump1); + NewState (ob,&states[s_bjjump1]); return; } } @@ -3836,7 +2581,7 @@ void A_StartDeathCam (objtype *ob) // // line angle up exactly // - NewState (player,&s_deathcam); + NewState (player,&states[s_deathcam]); player->x = gamestate.killx; player->y = gamestate.killy; @@ -3881,16 +2626,16 @@ void A_StartDeathCam (objtype *ob) { #ifndef SPEAR case schabbobj: - NewState (ob,&s_schabbdeathcam); + NewState (ob,&states[s_schabbdeathcam]); break; case realhitlerobj: - NewState (ob,&s_hitlerdeathcam); + NewState (ob,&states[s_hitlerdeathcam]); break; case giftobj: - NewState (ob,&s_giftdeathcam); + NewState (ob,&states[s_giftdeathcam]); break; case fatobj: - NewState (ob,&s_fatdeathcam); + NewState (ob,&states[s_fatdeathcam]); break; #endif } diff --git a/wl_agent.cpp b/wl_agent.cpp index 8ffedf6..fdc876e 100644 --- a/wl_agent.cpp +++ b/wl_agent.cpp @@ -51,9 +51,6 @@ objtype *LastAttacker; void T_Player (objtype *ob); void T_Attack (objtype *ob); -statetype s_player = {false,0,0,(statefunc) T_Player,NULL,NULL}; -statetype s_attack = {false,0,0,(statefunc) T_Attack,NULL,NULL}; - struct atkinf { int8_t tics,attack,frame; // attack is 1 for gun, 2 for knife @@ -1076,7 +1073,7 @@ void Cmd_Fire (void) gamestate.weaponframe = 0; - player->state = &s_attack; + player->state = &states[s_attack]; gamestate.attackframe = 0; gamestate.attackcount = @@ -1193,7 +1190,7 @@ void SpawnPlayer (int tilex, int tiley, int dir) player->areanumber = (byte) *(mapsegs[0]+(player->tiley<tilex); player->x = ((int32_t)tilex<y = ((int32_t)tiley<state = &s_player; + player->state = &states[s_player]; player->angle = (1-dir)*90; if (player->angle<0) player->angle += ANGLES; @@ -1409,7 +1406,7 @@ void T_Attack (objtype *ob) switch (cur->attack) { case -1: - ob->state = &s_player; + ob->state = &states[s_player]; if (!gamestate.ammo) { gamestate.weapon = wp_knife; diff --git a/wl_def.h b/wl_def.h index db0308f..8ada0e3 100644 --- a/wl_def.h +++ b/wl_def.h @@ -722,15 +722,18 @@ typedef enum { typedef void (* statefunc) (void *); +#include "states.h" + typedef struct statestruct { boolean rotate; short shapenum; // a shapenum of -1 means get from ob->temp1 short tictime; void (*think) (void *),(*action) (void *); - struct statestruct *next; + statenum_t next; } statetype; +extern statetype states[numstates]; //--------------------- // @@ -1250,67 +1253,6 @@ void InitAreas (void); #define s_nakedbody s_static10 -extern statetype s_grddie1; -extern statetype s_dogdie1; -extern statetype s_ofcdie1; -extern statetype s_mutdie1; -extern statetype s_ssdie1; -extern statetype s_bossdie1; -extern statetype s_schabbdie1; -extern statetype s_fakedie1; -extern statetype s_mechadie1; -extern statetype s_hitlerdie1; -extern statetype s_greteldie1; -extern statetype s_giftdie1; -extern statetype s_fatdie1; - -extern statetype s_spectredie1; -extern statetype s_angeldie1; -extern statetype s_transdie0; -extern statetype s_uberdie0; -extern statetype s_willdie1; -extern statetype s_deathdie1; - - -extern statetype s_grdchase1; -extern statetype s_dogchase1; -extern statetype s_ofcchase1; -extern statetype s_sschase1; -extern statetype s_mutchase1; -extern statetype s_bosschase1; -extern statetype s_schabbchase1; -extern statetype s_fakechase1; -extern statetype s_mechachase1; -extern statetype s_gretelchase1; -extern statetype s_giftchase1; -extern statetype s_fatchase1; - -extern statetype s_spectrechase1; -extern statetype s_angelchase1; -extern statetype s_transchase1; -extern statetype s_uberchase1; -extern statetype s_willchase1; -extern statetype s_deathchase1; - -extern statetype s_blinkychase1; -extern statetype s_hitlerchase1; - -extern statetype s_grdpain; -extern statetype s_grdpain1; -extern statetype s_ofcpain; -extern statetype s_ofcpain1; -extern statetype s_sspain; -extern statetype s_sspain1; -extern statetype s_mutpain; -extern statetype s_mutpain1; - -extern statetype s_deathcam; - -extern statetype s_schabbdeathcam2; -extern statetype s_hitlerdeathcam2; -extern statetype s_giftdeathcam2; -extern statetype s_fatdeathcam2; - void SpawnStand (enemy_t which, int tilex, int tiley, int dir); void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir); void KillActor (objtype *ob); diff --git a/wl_draw.cpp b/wl_draw.cpp index 79160a0..5559010 100644 --- a/wl_draw.cpp +++ b/wl_draw.cpp @@ -1036,7 +1036,7 @@ void DrawPlayerWeapon (void) if (gamestate.victoryflag) { #ifndef APOGEE_1_0 - if (player->state == &s_deathcam && (GetTimeCount()&32) ) + if (player->state == &states[s_deathcam] && (GetTimeCount()&32) ) SimpleScaleShape(viewwidth/2,SPR_DEATHCAM,viewheight+1); #endif return; diff --git a/wl_main.cpp b/wl_main.cpp index e34121e..2c6e653 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -357,9 +357,6 @@ int32_t DoChecksum(byte *source,unsigned size,int32_t checksum) ================== */ -extern statetype s_grdstand; -extern statetype s_player; - boolean SaveTheGame(FILE *file,int x,int y) { // struct diskfree_t dfree; @@ -441,7 +438,7 @@ boolean SaveTheGame(FILE *file,int x,int y) ob = player; DiskFlopAnim(x,y); memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)&s_player); + nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)states); fwrite(&nullobj,sizeof(nullobj),1,file); ob = ob->next; @@ -449,7 +446,7 @@ boolean SaveTheGame(FILE *file,int x,int y) for (; ob ; ob=ob->next) { memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)&s_grdstand); + nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)states); fwrite(&nullobj,sizeof(nullobj),1,file); } nullobj.active = ac_badobject; // end of file marker @@ -556,7 +553,7 @@ boolean LoadTheGame(FILE *file,int x,int y) InitActorList (); DiskFlopAnim(x,y); fread (player,sizeof(*player),1,file); - player->state=(statetype *) ((uintptr_t)player->state+(uintptr_t)&s_player); + player->state=(statetype *) ((uintptr_t)player->state+(uintptr_t)states); while (1) { @@ -565,7 +562,7 @@ boolean LoadTheGame(FILE *file,int x,int y) if (nullobj.active == ac_badobject) break; GetNewActor (); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state+(uintptr_t)&s_grdstand); + nullobj.state=(statetype *) ((uintptr_t)nullobj.state+(uintptr_t)states); // don't copy over the links memcpy (newobj,&nullobj,sizeof(nullobj)-8); } diff --git a/wl_play.cpp b/wl_play.cpp index 8cddd9c..a76505c 100644 --- a/wl_play.cpp +++ b/wl_play.cpp @@ -1205,7 +1205,7 @@ void DoActor (objtype * ob) } } - ob->state = ob->state->next; + ob->state = &states[ob->state->next]; if (!ob->state) { diff --git a/wl_state.cpp b/wl_state.cpp index 92b8ca1..0bfc08c 100644 --- a/wl_state.cpp +++ b/wl_state.cpp @@ -857,25 +857,25 @@ void KillActor (objtype *ob) { case guardobj: GivePoints (100); - NewState (ob,&s_grddie1); + NewState (ob,&states[s_grddie1]); PlaceItemType (bo_clip2,tilex,tiley); break; case officerobj: GivePoints (400); - NewState (ob,&s_ofcdie1); + NewState (ob,&states[s_ofcdie1]); PlaceItemType (bo_clip2,tilex,tiley); break; case mutantobj: GivePoints (700); - NewState (ob,&s_mutdie1); + NewState (ob,&states[s_mutdie1]); PlaceItemType (bo_clip2,tilex,tiley); break; case ssobj: GivePoints (500); - NewState (ob,&s_ssdie1); + NewState (ob,&states[s_ssdie1]); if (gamestate.bestweapon < wp_machinegun) PlaceItemType (bo_machinegun,tilex,tiley); else @@ -884,19 +884,19 @@ void KillActor (objtype *ob) case dogobj: GivePoints (200); - NewState (ob,&s_dogdie1); + NewState (ob,&states[s_dogdie1]); break; #ifndef SPEAR case bossobj: GivePoints (5000); - NewState (ob,&s_bossdie1); + NewState (ob,&states[s_bossdie1]); PlaceItemType (bo_key1,tilex,tiley); break; case gretelobj: GivePoints (5000); - NewState (ob,&s_greteldie1); + NewState (ob,&states[s_greteldie1]); PlaceItemType (bo_key1,tilex,tiley); break; @@ -904,36 +904,36 @@ void KillActor (objtype *ob) GivePoints (5000); gamestate.killx = player->x; gamestate.killy = player->y; - NewState (ob,&s_giftdie1); + NewState (ob,&states[s_giftdie1]); break; case fatobj: GivePoints (5000); gamestate.killx = player->x; gamestate.killy = player->y; - NewState (ob,&s_fatdie1); + NewState (ob,&states[s_fatdie1]); break; case schabbobj: GivePoints (5000); gamestate.killx = player->x; gamestate.killy = player->y; - NewState (ob,&s_schabbdie1); + NewState (ob,&states[s_schabbdie1]); break; case fakeobj: GivePoints (2000); - NewState (ob,&s_fakedie1); + NewState (ob,&states[s_fakedie1]); break; case mechahitlerobj: GivePoints (5000); - NewState (ob,&s_mechadie1); + NewState (ob,&states[s_mechadie1]); break; case realhitlerobj: GivePoints (5000); gamestate.killx = player->x; gamestate.killy = player->y; - NewState (ob,&s_hitlerdie1); + NewState (ob,&states[s_hitlerdie1]); break; #else case spectreobj: @@ -942,35 +942,35 @@ void KillActor (objtype *ob) GivePoints (200); // Get points once for each ob->flags &= ~FL_BONUS; } - NewState (ob,&s_spectredie1); + NewState (ob,&states[s_spectredie1]); break; case angelobj: GivePoints (5000); - NewState (ob,&s_angeldie1); + NewState (ob,&states[s_angeldie1]); break; case transobj: GivePoints (5000); - NewState (ob,&s_transdie0); + NewState (ob,&states[s_transdie0]); PlaceItemType (bo_key1,tilex,tiley); break; case uberobj: GivePoints (5000); - NewState (ob,&s_uberdie0); + NewState (ob,&states[s_uberdie0]); PlaceItemType (bo_key1,tilex,tiley); break; case willobj: GivePoints (5000); - NewState (ob,&s_willdie1); + NewState (ob,&states[s_willdie1]); PlaceItemType (bo_key1,tilex,tiley); break; case deathobj: GivePoints (5000); - NewState (ob,&s_deathdie1); + NewState (ob,&states[s_deathdie1]); PlaceItemType (bo_key1,tilex,tiley); break; #endif @@ -1020,30 +1020,30 @@ void DamageActor (objtype *ob, unsigned damage) { case guardobj: if (ob->hitpoints&1) - NewState (ob,&s_grdpain); + NewState (ob,&states[s_grdpain]); else - NewState (ob,&s_grdpain1); + NewState (ob,&states[s_grdpain1]); break; case officerobj: if (ob->hitpoints&1) - NewState (ob,&s_ofcpain); + NewState (ob,&states[s_ofcpain]); else - NewState (ob,&s_ofcpain1); + NewState (ob,&states[s_ofcpain1]); break; case mutantobj: if (ob->hitpoints&1) - NewState (ob,&s_mutpain); + NewState (ob,&states[s_mutpain]); else - NewState (ob,&s_mutpain1); + NewState (ob,&states[s_mutpain1]); break; case ssobj: if (ob->hitpoints&1) - NewState (ob,&s_sspain); + NewState (ob,&states[s_sspain]); else - NewState (ob,&s_sspain1); + NewState (ob,&states[s_sspain1]); break; } @@ -1311,121 +1311,121 @@ void FirstSighting (objtype *ob) { case guardobj: PlaySoundLocActor(HALTSND,ob); - NewState (ob,&s_grdchase1); + NewState (ob,&states[s_grdchase1]); ob->speed *= 3; // go faster when chasing player break; case officerobj: PlaySoundLocActor(SPIONSND,ob); - NewState (ob,&s_ofcchase1); + NewState (ob,&states[s_ofcchase1]); ob->speed *= 5; // go faster when chasing player break; case mutantobj: - NewState (ob,&s_mutchase1); + NewState (ob,&states[s_mutchase1]); ob->speed *= 3; // go faster when chasing player break; case ssobj: PlaySoundLocActor(SCHUTZADSND,ob); - NewState (ob,&s_sschase1); + NewState (ob,&states[s_sschase1]); ob->speed *= 4; // go faster when chasing player break; case dogobj: PlaySoundLocActor(DOGBARKSND,ob); - NewState (ob,&s_dogchase1); + NewState (ob,&states[s_dogchase1]); ob->speed *= 2; // go faster when chasing player break; #ifndef SPEAR case bossobj: SD_PlaySound(GUTENTAGSND); - NewState (ob,&s_bosschase1); + NewState (ob,&states[s_bosschase1]); ob->speed = SPDPATROL*3; // go faster when chasing player break; #ifndef APOGEE_1_0 case gretelobj: SD_PlaySound(KEINSND); - NewState (ob,&s_gretelchase1); + NewState (ob,&states[s_gretelchase1]); ob->speed *= 3; // go faster when chasing player break; case giftobj: SD_PlaySound(EINESND); - NewState (ob,&s_giftchase1); + NewState (ob,&states[s_giftchase1]); ob->speed *= 3; // go faster when chasing player break; case fatobj: SD_PlaySound(ERLAUBENSND); - NewState (ob,&s_fatchase1); + NewState (ob,&states[s_fatchase1]); ob->speed *= 3; // go faster when chasing player break; #endif case schabbobj: SD_PlaySound(SCHABBSHASND); - NewState (ob,&s_schabbchase1); + NewState (ob,&states[s_schabbchase1]); ob->speed *= 3; // go faster when chasing player break; case fakeobj: SD_PlaySound(TOT_HUNDSND); - NewState (ob,&s_fakechase1); + NewState (ob,&states[s_fakechase1]); ob->speed *= 3; // go faster when chasing player break; case mechahitlerobj: SD_PlaySound(DIESND); - NewState (ob,&s_mechachase1); + NewState (ob,&states[s_mechachase1]); ob->speed *= 3; // go faster when chasing player break; case realhitlerobj: SD_PlaySound(DIESND); - NewState (ob,&s_hitlerchase1); + NewState (ob,&states[s_hitlerchase1]); ob->speed *= 5; // go faster when chasing player break; case ghostobj: - NewState (ob,&s_blinkychase1); + NewState (ob,&states[s_blinkychase1]); ob->speed *= 2; // go faster when chasing player break; #else case spectreobj: SD_PlaySound(GHOSTSIGHTSND); - NewState (ob,&s_spectrechase1); + NewState (ob,&states[s_spectrechase1]); ob->speed = 800; // go faster when chasing player break; case angelobj: SD_PlaySound(ANGELSIGHTSND); - NewState (ob,&s_angelchase1); + NewState (ob,&states[s_angelchase1]); ob->speed = 1536; // go faster when chasing player break; case transobj: SD_PlaySound(TRANSSIGHTSND); - NewState (ob,&s_transchase1); + NewState (ob,&states[s_transchase1]); ob->speed = 1536; // go faster when chasing player break; case uberobj: - NewState (ob,&s_uberchase1); + NewState (ob,&states[s_uberchase1]); ob->speed = 3000; // go faster when chasing player break; case willobj: SD_PlaySound(WILHELMSIGHTSND); - NewState (ob,&s_willchase1); + NewState (ob,&states[s_willchase1]); ob->speed = 2048; // go faster when chasing player break; case deathobj: SD_PlaySound(KNIGHTSIGHTSND); - NewState (ob,&s_deathchase1); + NewState (ob,&states[s_deathchase1]); ob->speed = 2048; // go faster when chasing player break; #endif From 549274965a2387cf46b55f61b4c47f59de723703 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 6 Jul 2020 15:02:49 +0200 Subject: [PATCH 2/8] add the files containing the states[] array --- states.cpp | 492 +++++++++++++++++++++++++++++++++++++++++++++++++++++ states.h | 461 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 953 insertions(+) create mode 100644 states.cpp create mode 100644 states.h diff --git a/states.cpp b/states.cpp new file mode 100644 index 0000000..0b33853 --- /dev/null +++ b/states.cpp @@ -0,0 +1,492 @@ +#include "wl_def.h" +#include "wl_def.h" + +extern void A_Breathing (objtype *); +extern void A_Dormant (objtype *); +extern void A_HitlerMorph (objtype *); +extern void A_MechaSound (objtype *); +extern void A_Relaunch (objtype *); +extern void A_Slurpie (objtype *); +extern void A_Smoke (objtype *); +extern void A_StartAttack (objtype *); +extern void A_StartDeathCam (objtype *); +extern void A_Victory (objtype *); +extern void T_Attack (objtype *); +extern void T_BJDone (objtype *); +extern void T_BJJump (objtype *); +extern void T_BJRun (objtype *); +extern void T_BJYell (objtype *); +extern void T_Bite (objtype *); +extern void T_Chase (objtype *); +extern void T_DogChase (objtype *); +extern void T_Fake (objtype *); +extern void T_FakeFire (objtype *); +extern void T_Fat (objtype *); +extern void T_Ghosts (objtype *); +extern void T_Gift (objtype *); +extern void T_GiftThrow (objtype *); +extern void T_Launch (objtype *); +extern void T_Path (objtype *); +extern void T_Player (objtype *); +extern void T_Projectile (objtype *); +extern void T_Schabb (objtype *); +extern void T_SchabbThrow (objtype *); +extern void T_Shoot (objtype *); +extern void T_Stand (objtype *); +extern void T_UShoot (objtype *); +extern void T_Will (objtype *); + +statetype states[numstates] = { + {false,0,0,NULL,NULL,s_null}, // s_null + {false,0,0,(statefunc)T_Player,NULL,s_null}, // s_player + {false,0,0,(statefunc)T_Attack,NULL,s_null}, // s_attack + {true,SPR_ROCKET_1,3,(statefunc)T_Projectile,(statefunc)A_Smoke,s_rocket}, // s_rocket + {false,SPR_SMOKE_1,3,NULL,NULL,s_smoke2}, // s_smoke1 + {false,SPR_SMOKE_2,3,NULL,NULL,s_smoke3}, // s_smoke2 + {false,SPR_SMOKE_3,3,NULL,NULL,s_smoke4}, // s_smoke3 + {false,SPR_SMOKE_4,3,NULL,NULL,s_null}, // s_smoke4 + {false,SPR_BOOM_1,6,NULL,NULL,s_boom2}, // s_boom1 + {false,SPR_BOOM_2,6,NULL,NULL,s_boom3}, // s_boom2 + {false,SPR_BOOM_3,6,NULL,NULL,s_null}, // s_boom3 +#ifdef SPEAR + {true,SPR_HROCKET_1,3,(statefunc)T_Projectile,(statefunc)A_Smoke,s_hrocket}, // s_hrocket + {false,SPR_HSMOKE_1,3,NULL,NULL,s_hsmoke2}, // s_hsmoke1 + {false,SPR_HSMOKE_2,3,NULL,NULL,s_hsmoke3}, // s_hsmoke2 + {false,SPR_HSMOKE_3,3,NULL,NULL,s_hsmoke4}, // s_hsmoke3 + {false,SPR_HSMOKE_4,3,NULL,NULL,s_null}, // s_hsmoke4 + {false,SPR_HBOOM_1,6,NULL,NULL,s_hboom2}, // s_hboom1 + {false,SPR_HBOOM_2,6,NULL,NULL,s_hboom3}, // s_hboom2 + {false,SPR_HBOOM_3,6,NULL,NULL,s_null}, // s_hboom3 +#endif + {true,SPR_GRD_S_1,0,(statefunc)T_Stand,NULL,s_grdstand}, // s_grdstand + {true,SPR_GRD_W1_1,20,(statefunc)T_Path,NULL,s_grdpath1s}, // s_grdpath1 + {true,SPR_GRD_W1_1,5,NULL,NULL,s_grdpath2}, // s_grdpath1s + {true,SPR_GRD_W2_1,15,(statefunc)T_Path,NULL,s_grdpath3}, // s_grdpath2 + {true,SPR_GRD_W3_1,20,(statefunc)T_Path,NULL,s_grdpath3s}, // s_grdpath3 + {true,SPR_GRD_W3_1,5,NULL,NULL,s_grdpath4}, // s_grdpath3s + {true,SPR_GRD_W4_1,15,(statefunc)T_Path,NULL,s_grdpath1}, // s_grdpath4 + {2,SPR_GRD_PAIN_1,10,NULL,NULL,s_grdchase1}, // s_grdpain + {2,SPR_GRD_PAIN_2,10,NULL,NULL,s_grdchase1}, // s_grdpain1 + {false,SPR_GRD_SHOOT1,20,NULL,NULL,s_grdshoot2}, // s_grdshoot1 + {false,SPR_GRD_SHOOT2,20,NULL,(statefunc)T_Shoot,s_grdshoot3}, // s_grdshoot2 + {false,SPR_GRD_SHOOT3,20,NULL,NULL,s_grdchase1}, // s_grdshoot3 + {true,SPR_GRD_W1_1,10,(statefunc)T_Chase,NULL,s_grdchase1s}, // s_grdchase1 + {true,SPR_GRD_W1_1,3,NULL,NULL,s_grdchase2}, // s_grdchase1s + {true,SPR_GRD_W2_1,8,(statefunc)T_Chase,NULL,s_grdchase3}, // s_grdchase2 + {true,SPR_GRD_W3_1,10,(statefunc)T_Chase,NULL,s_grdchase3s}, // s_grdchase3 + {true,SPR_GRD_W3_1,3,NULL,NULL,s_grdchase4}, // s_grdchase3s + {true,SPR_GRD_W4_1,8,(statefunc)T_Chase,NULL,s_grdchase1}, // s_grdchase4 + {false,SPR_GRD_DIE_1,15,NULL,(statefunc)A_DeathScream,s_grddie2}, // s_grddie1 + {false,SPR_GRD_DIE_2,15,NULL,NULL,s_grddie3}, // s_grddie2 + {false,SPR_GRD_DIE_3,15,NULL,NULL,s_grddie4}, // s_grddie3 + {false,SPR_GRD_DEAD,0,NULL,NULL,s_grddie4}, // s_grddie4 +#ifndef SPEAR + {false,SPR_BLINKY_W1,10,(statefunc)T_Ghosts,NULL,s_blinkychase2}, // s_blinkychase1 + {false,SPR_BLINKY_W2,10,(statefunc)T_Ghosts,NULL,s_blinkychase1}, // s_blinkychase2 + {false,SPR_INKY_W1,10,(statefunc)T_Ghosts,NULL,s_inkychase2}, // s_inkychase1 + {false,SPR_INKY_W2,10,(statefunc)T_Ghosts,NULL,s_inkychase1}, // s_inkychase2 + {false,SPR_PINKY_W1,10,(statefunc)T_Ghosts,NULL,s_pinkychase2}, // s_pinkychase1 + {false,SPR_PINKY_W2,10,(statefunc)T_Ghosts,NULL,s_pinkychase1}, // s_pinkychase2 + {false,SPR_CLYDE_W1,10,(statefunc)T_Ghosts,NULL,s_clydechase2}, // s_clydechase1 + {false,SPR_CLYDE_W2,10,(statefunc)T_Ghosts,NULL,s_clydechase1}, // s_clydechase2 +#endif + {true,SPR_DOG_W1_1,20,(statefunc)T_Path,NULL,s_dogpath1s}, // s_dogpath1 + {true,SPR_DOG_W1_1,5,NULL,NULL,s_dogpath2}, // s_dogpath1s + {true,SPR_DOG_W2_1,15,(statefunc)T_Path,NULL,s_dogpath3}, // s_dogpath2 + {true,SPR_DOG_W3_1,20,(statefunc)T_Path,NULL,s_dogpath3s}, // s_dogpath3 + {true,SPR_DOG_W3_1,5,NULL,NULL,s_dogpath4}, // s_dogpath3s + {true,SPR_DOG_W4_1,15,(statefunc)T_Path,NULL,s_dogpath1}, // s_dogpath4 + {false,SPR_DOG_JUMP1,10,NULL,NULL,s_dogjump2}, // s_dogjump1 + {false,SPR_DOG_JUMP2,10,NULL,(statefunc)T_Bite,s_dogjump3}, // s_dogjump2 + {false,SPR_DOG_JUMP3,10,NULL,NULL,s_dogjump4}, // s_dogjump3 + {false,SPR_DOG_JUMP1,10,NULL,NULL,s_dogjump5}, // s_dogjump4 + {false,SPR_DOG_W1_1,10,NULL,NULL,s_dogchase1}, // s_dogjump5 + {true,SPR_DOG_W1_1,10,(statefunc)T_DogChase,NULL,s_dogchase1s}, // s_dogchase1 + {true,SPR_DOG_W1_1,3,NULL,NULL,s_dogchase2}, // s_dogchase1s + {true,SPR_DOG_W2_1,8,(statefunc)T_DogChase,NULL,s_dogchase3}, // s_dogchase2 + {true,SPR_DOG_W3_1,10,(statefunc)T_DogChase,NULL,s_dogchase3s}, // s_dogchase3 + {true,SPR_DOG_W3_1,3,NULL,NULL,s_dogchase4}, // s_dogchase3s + {true,SPR_DOG_W4_1,8,(statefunc)T_DogChase,NULL,s_dogchase1}, // s_dogchase4 + {false,SPR_DOG_DIE_1,15,NULL,(statefunc)A_DeathScream,s_dogdie2}, // s_dogdie1 + {false,SPR_DOG_DIE_2,15,NULL,NULL,s_dogdie3}, // s_dogdie2 + {false,SPR_DOG_DIE_3,15,NULL,NULL,s_dogdead}, // s_dogdie3 + {false,SPR_DOG_DEAD,15,NULL,NULL,s_dogdead}, // s_dogdead + {true,SPR_OFC_S_1,0,(statefunc)T_Stand,NULL,s_ofcstand}, // s_ofcstand + {true,SPR_OFC_W1_1,20,(statefunc)T_Path,NULL,s_ofcpath1s}, // s_ofcpath1 + {true,SPR_OFC_W1_1,5,NULL,NULL,s_ofcpath2}, // s_ofcpath1s + {true,SPR_OFC_W2_1,15,(statefunc)T_Path,NULL,s_ofcpath3}, // s_ofcpath2 + {true,SPR_OFC_W3_1,20,(statefunc)T_Path,NULL,s_ofcpath3s}, // s_ofcpath3 + {true,SPR_OFC_W3_1,5,NULL,NULL,s_ofcpath4}, // s_ofcpath3s + {true,SPR_OFC_W4_1,15,(statefunc)T_Path,NULL,s_ofcpath1}, // s_ofcpath4 + {2,SPR_OFC_PAIN_1,10,NULL,NULL,s_ofcchase1}, // s_ofcpain + {2,SPR_OFC_PAIN_2,10,NULL,NULL,s_ofcchase1}, // s_ofcpain1 + {false,SPR_OFC_SHOOT1,6,NULL,NULL,s_ofcshoot2}, // s_ofcshoot1 + {false,SPR_OFC_SHOOT2,20,NULL,(statefunc)T_Shoot,s_ofcshoot3}, // s_ofcshoot2 + {false,SPR_OFC_SHOOT3,10,NULL,NULL,s_ofcchase1}, // s_ofcshoot3 + {true,SPR_OFC_W1_1,10,(statefunc)T_Chase,NULL,s_ofcchase1s}, // s_ofcchase1 + {true,SPR_OFC_W1_1,3,NULL,NULL,s_ofcchase2}, // s_ofcchase1s + {true,SPR_OFC_W2_1,8,(statefunc)T_Chase,NULL,s_ofcchase3}, // s_ofcchase2 + {true,SPR_OFC_W3_1,10,(statefunc)T_Chase,NULL,s_ofcchase3s}, // s_ofcchase3 + {true,SPR_OFC_W3_1,3,NULL,NULL,s_ofcchase4}, // s_ofcchase3s + {true,SPR_OFC_W4_1,8,(statefunc)T_Chase,NULL,s_ofcchase1}, // s_ofcchase4 + {false,SPR_OFC_DIE_1,11,NULL,(statefunc)A_DeathScream,s_ofcdie2}, // s_ofcdie1 + {false,SPR_OFC_DIE_2,11,NULL,NULL,s_ofcdie3}, // s_ofcdie2 + {false,SPR_OFC_DIE_3,11,NULL,NULL,s_ofcdie4}, // s_ofcdie3 + {false,SPR_OFC_DIE_4,11,NULL,NULL,s_ofcdie5}, // s_ofcdie4 + {false,SPR_OFC_DEAD,0,NULL,NULL,s_ofcdie5}, // s_ofcdie5 + {true,SPR_MUT_S_1,0,(statefunc)T_Stand,NULL,s_mutstand}, // s_mutstand + {true,SPR_MUT_W1_1,20,(statefunc)T_Path,NULL,s_mutpath1s}, // s_mutpath1 + {true,SPR_MUT_W1_1,5,NULL,NULL,s_mutpath2}, // s_mutpath1s + {true,SPR_MUT_W2_1,15,(statefunc)T_Path,NULL,s_mutpath3}, // s_mutpath2 + {true,SPR_MUT_W3_1,20,(statefunc)T_Path,NULL,s_mutpath3s}, // s_mutpath3 + {true,SPR_MUT_W3_1,5,NULL,NULL,s_mutpath4}, // s_mutpath3s + {true,SPR_MUT_W4_1,15,(statefunc)T_Path,NULL,s_mutpath1}, // s_mutpath4 + {2,SPR_MUT_PAIN_1,10,NULL,NULL,s_mutchase1}, // s_mutpain + {2,SPR_MUT_PAIN_2,10,NULL,NULL,s_mutchase1}, // s_mutpain1 + {false,SPR_MUT_SHOOT1,6,NULL,(statefunc)T_Shoot,s_mutshoot2}, // s_mutshoot1 + {false,SPR_MUT_SHOOT2,20,NULL,NULL,s_mutshoot3}, // s_mutshoot2 + {false,SPR_MUT_SHOOT3,10,NULL,(statefunc)T_Shoot,s_mutshoot4}, // s_mutshoot3 + {false,SPR_MUT_SHOOT4,20,NULL,NULL,s_mutchase1}, // s_mutshoot4 + {true,SPR_MUT_W1_1,10,(statefunc)T_Chase,NULL,s_mutchase1s}, // s_mutchase1 + {true,SPR_MUT_W1_1,3,NULL,NULL,s_mutchase2}, // s_mutchase1s + {true,SPR_MUT_W2_1,8,(statefunc)T_Chase,NULL,s_mutchase3}, // s_mutchase2 + {true,SPR_MUT_W3_1,10,(statefunc)T_Chase,NULL,s_mutchase3s}, // s_mutchase3 + {true,SPR_MUT_W3_1,3,NULL,NULL,s_mutchase4}, // s_mutchase3s + {true,SPR_MUT_W4_1,8,(statefunc)T_Chase,NULL,s_mutchase1}, // s_mutchase4 + {false,SPR_MUT_DIE_1,7,NULL,(statefunc)A_DeathScream,s_mutdie2}, // s_mutdie1 + {false,SPR_MUT_DIE_2,7,NULL,NULL,s_mutdie3}, // s_mutdie2 + {false,SPR_MUT_DIE_3,7,NULL,NULL,s_mutdie4}, // s_mutdie3 + {false,SPR_MUT_DIE_4,7,NULL,NULL,s_mutdie5}, // s_mutdie4 + {false,SPR_MUT_DEAD,0,NULL,NULL,s_mutdie5}, // s_mutdie5 + {true,SPR_SS_S_1,0,(statefunc)T_Stand,NULL,s_ssstand}, // s_ssstand + {true,SPR_SS_W1_1,20,(statefunc)T_Path,NULL,s_sspath1s}, // s_sspath1 + {true,SPR_SS_W1_1,5,NULL,NULL,s_sspath2}, // s_sspath1s + {true,SPR_SS_W2_1,15,(statefunc)T_Path,NULL,s_sspath3}, // s_sspath2 + {true,SPR_SS_W3_1,20,(statefunc)T_Path,NULL,s_sspath3s}, // s_sspath3 + {true,SPR_SS_W3_1,5,NULL,NULL,s_sspath4}, // s_sspath3s + {true,SPR_SS_W4_1,15,(statefunc)T_Path,NULL,s_sspath1}, // s_sspath4 + {2,SPR_SS_PAIN_1,10,NULL,NULL,s_sschase1}, // s_sspain + {2,SPR_SS_PAIN_2,10,NULL,NULL,s_sschase1}, // s_sspain1 + {false,SPR_SS_SHOOT1,20,NULL,NULL,s_ssshoot2}, // s_ssshoot1 + {false,SPR_SS_SHOOT2,20,NULL,(statefunc)T_Shoot,s_ssshoot3}, // s_ssshoot2 + {false,SPR_SS_SHOOT3,10,NULL,NULL,s_ssshoot4}, // s_ssshoot3 + {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_ssshoot5}, // s_ssshoot4 + {false,SPR_SS_SHOOT3,10,NULL,NULL,s_ssshoot6}, // s_ssshoot5 + {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_ssshoot7}, // s_ssshoot6 + {false,SPR_SS_SHOOT3,10,NULL,NULL,s_ssshoot8}, // s_ssshoot7 + {false,SPR_SS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_ssshoot9}, // s_ssshoot8 + {false,SPR_SS_SHOOT3,10,NULL,NULL,s_sschase1}, // s_ssshoot9 + {true,SPR_SS_W1_1,10,(statefunc)T_Chase,NULL,s_sschase1s}, // s_sschase1 + {true,SPR_SS_W1_1,3,NULL,NULL,s_sschase2}, // s_sschase1s + {true,SPR_SS_W2_1,8,(statefunc)T_Chase,NULL,s_sschase3}, // s_sschase2 + {true,SPR_SS_W3_1,10,(statefunc)T_Chase,NULL,s_sschase3s}, // s_sschase3 + {true,SPR_SS_W3_1,3,NULL,NULL,s_sschase4}, // s_sschase3s + {true,SPR_SS_W4_1,8,(statefunc)T_Chase,NULL,s_sschase1}, // s_sschase4 + {false,SPR_SS_DIE_1,15,NULL,(statefunc)A_DeathScream,s_ssdie2}, // s_ssdie1 + {false,SPR_SS_DIE_2,15,NULL,NULL,s_ssdie3}, // s_ssdie2 + {false,SPR_SS_DIE_3,15,NULL,NULL,s_ssdie4}, // s_ssdie3 + {false,SPR_SS_DEAD,0,NULL,NULL,s_ssdie4}, // s_ssdie4 +#ifndef SPEAR + {false,SPR_BOSS_W1,0,(statefunc)T_Stand,NULL,s_bossstand}, // s_bossstand + {false,SPR_BOSS_W1,10,(statefunc)T_Chase,NULL,s_bosschase1s}, // s_bosschase1 + {false,SPR_BOSS_W1,3,NULL,NULL,s_bosschase2}, // s_bosschase1s + {false,SPR_BOSS_W2,8,(statefunc)T_Chase,NULL,s_bosschase3}, // s_bosschase2 + {false,SPR_BOSS_W3,10,(statefunc)T_Chase,NULL,s_bosschase3s}, // s_bosschase3 + {false,SPR_BOSS_W3,3,NULL,NULL,s_bosschase4}, // s_bosschase3s + {false,SPR_BOSS_W4,8,(statefunc)T_Chase,NULL,s_bosschase1}, // s_bosschase4 + {false,SPR_BOSS_DIE1,15,NULL,(statefunc)A_DeathScream,s_bossdie2}, // s_bossdie1 + {false,SPR_BOSS_DIE2,15,NULL,NULL,s_bossdie3}, // s_bossdie2 + {false,SPR_BOSS_DIE3,15,NULL,NULL,s_bossdie4}, // s_bossdie3 + {false,SPR_BOSS_DEAD,0,NULL,NULL,s_bossdie4}, // s_bossdie4 + {false,SPR_BOSS_SHOOT1,30,NULL,NULL,s_bossshoot2}, // s_bossshoot1 + {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_bossshoot3}, // s_bossshoot2 + {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_bossshoot4}, // s_bossshoot3 + {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_bossshoot5}, // s_bossshoot4 + {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_bossshoot6}, // s_bossshoot5 + {false,SPR_BOSS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_bossshoot7}, // s_bossshoot6 + {false,SPR_BOSS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_bossshoot8}, // s_bossshoot7 + {false,SPR_BOSS_SHOOT1,10,NULL,NULL,s_bosschase1}, // s_bossshoot8 + {false,SPR_GRETEL_W1,0,(statefunc)T_Stand,NULL,s_gretelstand}, // s_gretelstand + {false,SPR_GRETEL_W1,10,(statefunc)T_Chase,NULL,s_gretelchase1s}, // s_gretelchase1 + {false,SPR_GRETEL_W1,3,NULL,NULL,s_gretelchase2}, // s_gretelchase1s + {false,SPR_GRETEL_W2,8,(statefunc)T_Chase,NULL,s_gretelchase3}, // s_gretelchase2 + {false,SPR_GRETEL_W3,10,(statefunc)T_Chase,NULL,s_gretelchase3s}, // s_gretelchase3 + {false,SPR_GRETEL_W3,3,NULL,NULL,s_gretelchase4}, // s_gretelchase3s + {false,SPR_GRETEL_W4,8,(statefunc)T_Chase,NULL,s_gretelchase1}, // s_gretelchase4 + {false,SPR_GRETEL_DIE1,15,NULL,(statefunc)A_DeathScream,s_greteldie2}, // s_greteldie1 + {false,SPR_GRETEL_DIE2,15,NULL,NULL,s_greteldie3}, // s_greteldie2 + {false,SPR_GRETEL_DIE3,15,NULL,NULL,s_greteldie4}, // s_greteldie3 + {false,SPR_GRETEL_DEAD,0,NULL,NULL,s_greteldie4}, // s_greteldie4 + {false,SPR_GRETEL_SHOOT1,30,NULL,NULL,s_gretelshoot2}, // s_gretelshoot1 + {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,s_gretelshoot3}, // s_gretelshoot2 + {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,s_gretelshoot4}, // s_gretelshoot3 + {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,s_gretelshoot5}, // s_gretelshoot4 + {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,s_gretelshoot6}, // s_gretelshoot5 + {false,SPR_GRETEL_SHOOT2,10,NULL,(statefunc)T_Shoot,s_gretelshoot7}, // s_gretelshoot6 + {false,SPR_GRETEL_SHOOT3,10,NULL,(statefunc)T_Shoot,s_gretelshoot8}, // s_gretelshoot7 + {false,SPR_GRETEL_SHOOT1,10,NULL,NULL,s_gretelchase1}, // s_gretelshoot8 +#endif +#ifdef SPEAR + {false,SPR_TRANS_W1,0,(statefunc)T_Stand,NULL,s_transstand}, // s_transstand + {false,SPR_TRANS_W1,10,(statefunc)T_Chase,NULL,s_transchase1s}, // s_transchase1 + {false,SPR_TRANS_W1,3,NULL,NULL,s_transchase2}, // s_transchase1s + {false,SPR_TRANS_W2,8,(statefunc)T_Chase,NULL,s_transchase3}, // s_transchase2 + {false,SPR_TRANS_W3,10,(statefunc)T_Chase,NULL,s_transchase3s}, // s_transchase3 + {false,SPR_TRANS_W3,3,NULL,NULL,s_transchase4}, // s_transchase3s + {false,SPR_TRANS_W4,8,(statefunc)T_Chase,NULL,s_transchase1}, // s_transchase4 + {false,SPR_TRANS_W1,1,NULL,(statefunc)A_DeathScream,s_transdie01}, // s_transdie0 + {false,SPR_TRANS_W1,1,NULL,NULL,s_transdie1}, // s_transdie01 + {false,SPR_TRANS_DIE1,15,NULL,NULL,s_transdie2}, // s_transdie1 + {false,SPR_TRANS_DIE2,15,NULL,NULL,s_transdie3}, // s_transdie2 + {false,SPR_TRANS_DIE3,15,NULL,NULL,s_transdie4}, // s_transdie3 + {false,SPR_TRANS_DEAD,0,NULL,NULL,s_transdie4}, // s_transdie4 + {false,SPR_TRANS_SHOOT1,30,NULL,NULL,s_transshoot2}, // s_transshoot1 + {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_transshoot3}, // s_transshoot2 + {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_transshoot4}, // s_transshoot3 + {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_transshoot5}, // s_transshoot4 + {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_transshoot6}, // s_transshoot5 + {false,SPR_TRANS_SHOOT2,10,NULL,(statefunc)T_Shoot,s_transshoot7}, // s_transshoot6 + {false,SPR_TRANS_SHOOT3,10,NULL,(statefunc)T_Shoot,s_transshoot8}, // s_transshoot7 + {false,SPR_TRANS_SHOOT1,10,NULL,NULL,s_transchase1}, // s_transshoot8 + {false,SPR_UBER_W1,0,(statefunc)T_Stand,NULL,s_uberstand}, // s_uberstand + {false,SPR_UBER_W1,10,(statefunc)T_Chase,NULL,s_uberchase1s}, // s_uberchase1 + {false,SPR_UBER_W1,3,NULL,NULL,s_uberchase2}, // s_uberchase1s + {false,SPR_UBER_W2,8,(statefunc)T_Chase,NULL,s_uberchase3}, // s_uberchase2 + {false,SPR_UBER_W3,10,(statefunc)T_Chase,NULL,s_uberchase3s}, // s_uberchase3 + {false,SPR_UBER_W3,3,NULL,NULL,s_uberchase4}, // s_uberchase3s + {false,SPR_UBER_W4,8,(statefunc)T_Chase,NULL,s_uberchase1}, // s_uberchase4 + {false,SPR_UBER_W1,1,NULL,(statefunc)A_DeathScream,s_uberdie01}, // s_uberdie0 + {false,SPR_UBER_W1,1,NULL,NULL,s_uberdie1}, // s_uberdie01 + {false,SPR_UBER_DIE1,15,NULL,NULL,s_uberdie2}, // s_uberdie1 + {false,SPR_UBER_DIE2,15,NULL,NULL,s_uberdie3}, // s_uberdie2 + {false,SPR_UBER_DIE3,15,NULL,NULL,s_uberdie4}, // s_uberdie3 + {false,SPR_UBER_DIE4,15,NULL,NULL,s_uberdie5}, // s_uberdie4 + {false,SPR_UBER_DEAD,0,NULL,NULL,s_uberdie5}, // s_uberdie5 + {false,SPR_UBER_SHOOT1,30,NULL,NULL,s_ubershoot2}, // s_ubershoot1 + {false,SPR_UBER_SHOOT2,12,NULL,(statefunc)T_UShoot,s_ubershoot3}, // s_ubershoot2 + {false,SPR_UBER_SHOOT3,12,NULL,(statefunc)T_UShoot,s_ubershoot4}, // s_ubershoot3 + {false,SPR_UBER_SHOOT4,12,NULL,(statefunc)T_UShoot,s_ubershoot5}, // s_ubershoot4 + {false,SPR_UBER_SHOOT3,12,NULL,(statefunc)T_UShoot,s_ubershoot6}, // s_ubershoot5 + {false,SPR_UBER_SHOOT2,12,NULL,(statefunc)T_UShoot,s_ubershoot7}, // s_ubershoot6 + {false,SPR_UBER_SHOOT1,12,NULL,NULL,s_uberchase1}, // s_ubershoot7 + {false,SPR_WILL_W1,0,(statefunc)T_Stand,NULL,s_willstand}, // s_willstand + {false,SPR_WILL_W1,10,(statefunc)T_Will,NULL,s_willchase1s}, // s_willchase1 + {false,SPR_WILL_W1,3,NULL,NULL,s_willchase2}, // s_willchase1s + {false,SPR_WILL_W2,8,(statefunc)T_Will,NULL,s_willchase3}, // s_willchase2 + {false,SPR_WILL_W3,10,(statefunc)T_Will,NULL,s_willchase3s}, // s_willchase3 + {false,SPR_WILL_W3,3,NULL,NULL,s_willchase4}, // s_willchase3s + {false,SPR_WILL_W4,8,(statefunc)T_Will,NULL,s_willchase1}, // s_willchase4 + {false,SPR_WILL_W1,1,NULL,NULL,s_willdie1}, // s_willdeathcam + {false,SPR_WILL_W1,1,NULL,(statefunc)A_DeathScream,s_willdie2}, // s_willdie1 + {false,SPR_WILL_W1,10,NULL,NULL,s_willdie3}, // s_willdie2 + {false,SPR_WILL_DIE1,10,NULL,NULL,s_willdie4}, // s_willdie3 + {false,SPR_WILL_DIE2,10,NULL,NULL,s_willdie5}, // s_willdie4 + {false,SPR_WILL_DIE3,10,NULL,NULL,s_willdie6}, // s_willdie5 + {false,SPR_WILL_DEAD,20,NULL,NULL,s_willdie6}, // s_willdie6 + {false,SPR_WILL_SHOOT1,30,NULL,NULL,s_willshoot2}, // s_willshoot1 + {false,SPR_WILL_SHOOT2,10,NULL,(statefunc)T_Launch,s_willshoot3}, // s_willshoot2 + {false,SPR_WILL_SHOOT3,10,NULL,(statefunc)T_Shoot,s_willshoot4}, // s_willshoot3 + {false,SPR_WILL_SHOOT4,10,NULL,(statefunc)T_Shoot,s_willshoot5}, // s_willshoot4 + {false,SPR_WILL_SHOOT3,10,NULL,(statefunc)T_Shoot,s_willshoot6}, // s_willshoot5 + {false,SPR_WILL_SHOOT4,10,NULL,(statefunc)T_Shoot,s_willchase1}, // s_willshoot6 + {false,SPR_DEATH_W1,0,(statefunc)T_Stand,NULL,s_deathstand}, // s_deathstand + {false,SPR_DEATH_W1,10,(statefunc)T_Will,NULL,s_deathchase1s}, // s_deathchase1 + {false,SPR_DEATH_W1,3,NULL,NULL,s_deathchase2}, // s_deathchase1s + {false,SPR_DEATH_W2,8,(statefunc)T_Will,NULL,s_deathchase3}, // s_deathchase2 + {false,SPR_DEATH_W3,10,(statefunc)T_Will,NULL,s_deathchase3s}, // s_deathchase3 + {false,SPR_DEATH_W3,3,NULL,NULL,s_deathchase4}, // s_deathchase3s + {false,SPR_DEATH_W4,8,(statefunc)T_Will,NULL,s_deathchase1}, // s_deathchase4 + {false,SPR_DEATH_W1,1,NULL,NULL,s_deathdie1}, // s_deathdeathcam + {false,SPR_DEATH_W1,1,NULL,(statefunc)A_DeathScream,s_deathdie2}, // s_deathdie1 + {false,SPR_DEATH_W1,10,NULL,NULL,s_deathdie3}, // s_deathdie2 + {false,SPR_DEATH_DIE1,10,NULL,NULL,s_deathdie4}, // s_deathdie3 + {false,SPR_DEATH_DIE2,10,NULL,NULL,s_deathdie5}, // s_deathdie4 + {false,SPR_DEATH_DIE3,10,NULL,NULL,s_deathdie6}, // s_deathdie5 + {false,SPR_DEATH_DIE4,10,NULL,NULL,s_deathdie7}, // s_deathdie6 + {false,SPR_DEATH_DIE5,10,NULL,NULL,s_deathdie8}, // s_deathdie7 + {false,SPR_DEATH_DIE6,10,NULL,NULL,s_deathdie9}, // s_deathdie8 + {false,SPR_DEATH_DEAD,0,NULL,NULL,s_deathdie9}, // s_deathdie9 + {false,SPR_DEATH_SHOOT1,30,NULL,NULL,s_deathshoot2}, // s_deathshoot1 + {false,SPR_DEATH_SHOOT2,10,NULL,(statefunc)T_Launch,s_deathshoot3}, // s_deathshoot2 + {false,SPR_DEATH_SHOOT4,10,NULL,(statefunc)T_Shoot,s_deathshoot4}, // s_deathshoot3 + {false,SPR_DEATH_SHOOT3,10,NULL,(statefunc)T_Launch,s_deathshoot5}, // s_deathshoot4 + {false,SPR_DEATH_SHOOT4,10,NULL,(statefunc)T_Shoot,s_deathchase1}, // s_deathshoot5 + {false,SPR_ANGEL_W1,0,(statefunc)T_Stand,NULL,s_angelstand}, // s_angelstand + {false,SPR_ANGEL_W1,10,(statefunc)T_Will,NULL,s_angelchase1s}, // s_angelchase1 + {false,SPR_ANGEL_W1,3,NULL,NULL,s_angelchase2}, // s_angelchase1s + {false,SPR_ANGEL_W2,8,(statefunc)T_Will,NULL,s_angelchase3}, // s_angelchase2 + {false,SPR_ANGEL_W3,10,(statefunc)T_Will,NULL,s_angelchase3s}, // s_angelchase3 + {false,SPR_ANGEL_W3,3,NULL,NULL,s_angelchase4}, // s_angelchase3s + {false,SPR_ANGEL_W4,8,(statefunc)T_Will,NULL,s_angelchase1}, // s_angelchase4 + {false,SPR_ANGEL_W1,1,NULL,(statefunc)A_DeathScream,s_angeldie11}, // s_angeldie1 + {false,SPR_ANGEL_W1,1,NULL,NULL,s_angeldie2}, // s_angeldie11 + {false,SPR_ANGEL_DIE1,10,NULL,(statefunc)A_Slurpie,s_angeldie3}, // s_angeldie2 + {false,SPR_ANGEL_DIE2,10,NULL,NULL,s_angeldie4}, // s_angeldie3 + {false,SPR_ANGEL_DIE3,10,NULL,NULL,s_angeldie5}, // s_angeldie4 + {false,SPR_ANGEL_DIE4,10,NULL,NULL,s_angeldie6}, // s_angeldie5 + {false,SPR_ANGEL_DIE5,10,NULL,NULL,s_angeldie7}, // s_angeldie6 + {false,SPR_ANGEL_DIE6,10,NULL,NULL,s_angeldie8}, // s_angeldie7 + {false,SPR_ANGEL_DIE7,10,NULL,NULL,s_angeldie9}, // s_angeldie8 + {false,SPR_ANGEL_DEAD,130,NULL,(statefunc)A_Victory,s_angeldie9}, // s_angeldie9 + {false,SPR_ANGEL_SHOOT1,10,NULL,(statefunc)A_StartAttack,s_angelshoot2}, // s_angelshoot1 + {false,SPR_ANGEL_SHOOT2,20,NULL,(statefunc)T_Launch,s_angelshoot3}, // s_angelshoot2 + {false,SPR_ANGEL_SHOOT1,10,NULL,(statefunc)A_Relaunch,s_angelshoot2}, // s_angelshoot3 + {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,s_angeltired2}, // s_angeltired + {false,SPR_ANGEL_TIRED2,40,NULL,NULL,s_angeltired3}, // s_angeltired2 + {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,s_angeltired4}, // s_angeltired3 + {false,SPR_ANGEL_TIRED2,40,NULL,NULL,s_angeltired5}, // s_angeltired4 + {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,s_angeltired6}, // s_angeltired5 + {false,SPR_ANGEL_TIRED2,40,NULL,NULL,s_angeltired7}, // s_angeltired6 + {false,SPR_ANGEL_TIRED1,40,NULL,(statefunc)A_Breathing,s_angelchase1}, // s_angeltired7 + {false,SPR_SPARK1,6,(statefunc)T_Projectile,NULL,s_spark2}, // s_spark1 + {false,SPR_SPARK2,6,(statefunc)T_Projectile,NULL,s_spark3}, // s_spark2 + {false,SPR_SPARK3,6,(statefunc)T_Projectile,NULL,s_spark4}, // s_spark3 + {false,SPR_SPARK4,6,(statefunc)T_Projectile,NULL,s_spark1}, // s_spark4 + {false,SPR_SPECTRE_W1,10,(statefunc)T_Stand,NULL,s_spectrewait2}, // s_spectrewait1 + {false,SPR_SPECTRE_W2,10,(statefunc)T_Stand,NULL,s_spectrewait3}, // s_spectrewait2 + {false,SPR_SPECTRE_W3,10,(statefunc)T_Stand,NULL,s_spectrewait4}, // s_spectrewait3 + {false,SPR_SPECTRE_W4,10,(statefunc)T_Stand,NULL,s_spectrewait1}, // s_spectrewait4 + {false,SPR_SPECTRE_W1,10,(statefunc)T_Ghosts,NULL,s_spectrechase2}, // s_spectrechase1 + {false,SPR_SPECTRE_W2,10,(statefunc)T_Ghosts,NULL,s_spectrechase3}, // s_spectrechase2 + {false,SPR_SPECTRE_W3,10,(statefunc)T_Ghosts,NULL,s_spectrechase4}, // s_spectrechase3 + {false,SPR_SPECTRE_W4,10,(statefunc)T_Ghosts,NULL,s_spectrechase1}, // s_spectrechase4 + {false,SPR_SPECTRE_F1,10,NULL,NULL,s_spectredie2}, // s_spectredie1 + {false,SPR_SPECTRE_F2,10,NULL,NULL,s_spectredie3}, // s_spectredie2 + {false,SPR_SPECTRE_F3,10,NULL,NULL,s_spectredie4}, // s_spectredie3 + {false,SPR_SPECTRE_F4,300,NULL,NULL,s_spectrewake}, // s_spectredie4 + {false,SPR_SPECTRE_F4,10,NULL,(statefunc)A_Dormant,s_spectrewake}, // s_spectrewake +#endif +#ifndef SPEAR + {false,SPR_SCHABB_W1,0,(statefunc)T_Stand,NULL,s_schabbstand}, // s_schabbstand + {false,SPR_SCHABB_W1,10,(statefunc)T_Schabb,NULL,s_schabbchase1s}, // s_schabbchase1 + {false,SPR_SCHABB_W1,3,NULL,NULL,s_schabbchase2}, // s_schabbchase1s + {false,SPR_SCHABB_W2,8,(statefunc)T_Schabb,NULL,s_schabbchase3}, // s_schabbchase2 + {false,SPR_SCHABB_W3,10,(statefunc)T_Schabb,NULL,s_schabbchase3s}, // s_schabbchase3 + {false,SPR_SCHABB_W3,3,NULL,NULL,s_schabbchase4}, // s_schabbchase3s + {false,SPR_SCHABB_W4,8,(statefunc)T_Schabb,NULL,s_schabbchase1}, // s_schabbchase4 + {false,SPR_SCHABB_W1,1,NULL,NULL,s_schabbdie1}, // s_schabbdeathcam + {false,SPR_SCHABB_W1,10,NULL,(statefunc)A_DeathScream,s_schabbdie2}, // s_schabbdie1 + {false,SPR_SCHABB_W1,10,NULL,NULL,s_schabbdie3}, // s_schabbdie2 + {false,SPR_SCHABB_DIE1,10,NULL,NULL,s_schabbdie4}, // s_schabbdie3 + {false,SPR_SCHABB_DIE2,10,NULL,NULL,s_schabbdie5}, // s_schabbdie4 + {false,SPR_SCHABB_DIE3,10,NULL,NULL,s_schabbdie6}, // s_schabbdie5 + {false,SPR_SCHABB_DEAD,20,NULL,(statefunc)A_StartDeathCam,s_schabbdie6}, // s_schabbdie6 + {false,SPR_SCHABB_SHOOT1,30,NULL,NULL,s_schabbshoot2}, // s_schabbshoot1 + {false,SPR_SCHABB_SHOOT2,10,NULL,(statefunc)T_SchabbThrow,s_schabbchase1}, // s_schabbshoot2 + {false,SPR_HYPO1,6,(statefunc)T_Projectile,NULL,s_needle2}, // s_needle1 + {false,SPR_HYPO2,6,(statefunc)T_Projectile,NULL,s_needle3}, // s_needle2 + {false,SPR_HYPO3,6,(statefunc)T_Projectile,NULL,s_needle4}, // s_needle3 + {false,SPR_HYPO4,6,(statefunc)T_Projectile,NULL,s_needle1}, // s_needle4 + {false,SPR_GIFT_W1,0,(statefunc)T_Stand,NULL,s_giftstand}, // s_giftstand + {false,SPR_GIFT_W1,10,(statefunc)T_Gift,NULL,s_giftchase1s}, // s_giftchase1 + {false,SPR_GIFT_W1,3,NULL,NULL,s_giftchase2}, // s_giftchase1s + {false,SPR_GIFT_W2,8,(statefunc)T_Gift,NULL,s_giftchase3}, // s_giftchase2 + {false,SPR_GIFT_W3,10,(statefunc)T_Gift,NULL,s_giftchase3s}, // s_giftchase3 + {false,SPR_GIFT_W3,3,NULL,NULL,s_giftchase4}, // s_giftchase3s + {false,SPR_GIFT_W4,8,(statefunc)T_Gift,NULL,s_giftchase1}, // s_giftchase4 + {false,SPR_GIFT_W1,1,NULL,NULL,s_giftdie1}, // s_giftdeathcam + {false,SPR_GIFT_W1,1,NULL,(statefunc)A_DeathScream,s_giftdie2}, // s_giftdie1 + {false,SPR_GIFT_W1,10,NULL,NULL,s_giftdie3}, // s_giftdie2 + {false,SPR_GIFT_DIE1,10,NULL,NULL,s_giftdie4}, // s_giftdie3 + {false,SPR_GIFT_DIE2,10,NULL,NULL,s_giftdie5}, // s_giftdie4 + {false,SPR_GIFT_DIE3,10,NULL,NULL,s_giftdie6}, // s_giftdie5 + {false,SPR_GIFT_DEAD,20,NULL,(statefunc)A_StartDeathCam,s_giftdie6}, // s_giftdie6 + {false,SPR_GIFT_SHOOT1,30,NULL,NULL,s_giftshoot2}, // s_giftshoot1 + {false,SPR_GIFT_SHOOT2,10,NULL,(statefunc)T_GiftThrow,s_giftchase1}, // s_giftshoot2 + {false,SPR_FAT_W1,0,(statefunc)T_Stand,NULL,s_fatstand}, // s_fatstand + {false,SPR_FAT_W1,10,(statefunc)T_Fat,NULL,s_fatchase1s}, // s_fatchase1 + {false,SPR_FAT_W1,3,NULL,NULL,s_fatchase2}, // s_fatchase1s + {false,SPR_FAT_W2,8,(statefunc)T_Fat,NULL,s_fatchase3}, // s_fatchase2 + {false,SPR_FAT_W3,10,(statefunc)T_Fat,NULL,s_fatchase3s}, // s_fatchase3 + {false,SPR_FAT_W3,3,NULL,NULL,s_fatchase4}, // s_fatchase3s + {false,SPR_FAT_W4,8,(statefunc)T_Fat,NULL,s_fatchase1}, // s_fatchase4 + {false,SPR_FAT_W1,1,NULL,NULL,s_fatdie1}, // s_fatdeathcam + {false,SPR_FAT_W1,1,NULL,(statefunc)A_DeathScream,s_fatdie2}, // s_fatdie1 + {false,SPR_FAT_W1,10,NULL,NULL,s_fatdie3}, // s_fatdie2 + {false,SPR_FAT_DIE1,10,NULL,NULL,s_fatdie4}, // s_fatdie3 + {false,SPR_FAT_DIE2,10,NULL,NULL,s_fatdie5}, // s_fatdie4 + {false,SPR_FAT_DIE3,10,NULL,NULL,s_fatdie6}, // s_fatdie5 + {false,SPR_FAT_DEAD,20,NULL,(statefunc)A_StartDeathCam,s_fatdie6}, // s_fatdie6 + {false,SPR_FAT_SHOOT1,30,NULL,NULL,s_fatshoot2}, // s_fatshoot1 + {false,SPR_FAT_SHOOT2,10,NULL,(statefunc)T_GiftThrow,s_fatshoot3}, // s_fatshoot2 + {false,SPR_FAT_SHOOT3,10,NULL,(statefunc)T_Shoot,s_fatshoot4}, // s_fatshoot3 + {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Shoot,s_fatshoot5}, // s_fatshoot4 + {false,SPR_FAT_SHOOT3,10,NULL,(statefunc)T_Shoot,s_fatshoot6}, // s_fatshoot5 + {false,SPR_FAT_SHOOT4,10,NULL,(statefunc)T_Shoot,s_fatchase1}, // s_fatshoot6 + {false,SPR_FAKE_W1,0,(statefunc)T_Stand,NULL,s_fakestand}, // s_fakestand + {false,SPR_FAKE_W1,10,(statefunc)T_Fake,NULL,s_fakechase1s}, // s_fakechase1 + {false,SPR_FAKE_W1,3,NULL,NULL,s_fakechase2}, // s_fakechase1s + {false,SPR_FAKE_W2,8,(statefunc)T_Fake,NULL,s_fakechase3}, // s_fakechase2 + {false,SPR_FAKE_W3,10,(statefunc)T_Fake,NULL,s_fakechase3s}, // s_fakechase3 + {false,SPR_FAKE_W3,3,NULL,NULL,s_fakechase4}, // s_fakechase3s + {false,SPR_FAKE_W4,8,(statefunc)T_Fake,NULL,s_fakechase1}, // s_fakechase4 + {false,SPR_FAKE_DIE1,10,NULL,(statefunc)A_DeathScream,s_fakedie2}, // s_fakedie1 + {false,SPR_FAKE_DIE2,10,NULL,NULL,s_fakedie3}, // s_fakedie2 + {false,SPR_FAKE_DIE3,10,NULL,NULL,s_fakedie4}, // s_fakedie3 + {false,SPR_FAKE_DIE4,10,NULL,NULL,s_fakedie5}, // s_fakedie4 + {false,SPR_FAKE_DIE5,10,NULL,NULL,s_fakedie6}, // s_fakedie5 + {false,SPR_FAKE_DEAD,0,NULL,NULL,s_fakedie6}, // s_fakedie6 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot2}, // s_fakeshoot1 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot3}, // s_fakeshoot2 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot4}, // s_fakeshoot3 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot5}, // s_fakeshoot4 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot6}, // s_fakeshoot5 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot7}, // s_fakeshoot6 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot8}, // s_fakeshoot7 + {false,SPR_FAKE_SHOOT,8,NULL,(statefunc)T_FakeFire,s_fakeshoot9}, // s_fakeshoot8 + {false,SPR_FAKE_SHOOT,8,NULL,NULL,s_fakechase1}, // s_fakeshoot9 + {false,SPR_FIRE1,6,NULL,(statefunc)T_Projectile,s_fire2}, // s_fire1 + {false,SPR_FIRE2,6,NULL,(statefunc)T_Projectile,s_fire1}, // s_fire2 + {false,SPR_MECHA_W1,0,(statefunc)T_Stand,NULL,s_mechastand}, // s_mechastand + {false,SPR_MECHA_W1,10,(statefunc)T_Chase,(statefunc)A_MechaSound,s_mechachase1s}, // s_mechachase1 + {false,SPR_MECHA_W1,6,NULL,NULL,s_mechachase2}, // s_mechachase1s + {false,SPR_MECHA_W2,8,(statefunc)T_Chase,NULL,s_mechachase3}, // s_mechachase2 + {false,SPR_MECHA_W3,10,(statefunc)T_Chase,(statefunc)A_MechaSound,s_mechachase3s}, // s_mechachase3 + {false,SPR_MECHA_W3,6,NULL,NULL,s_mechachase4}, // s_mechachase3s + {false,SPR_MECHA_W4,8,(statefunc)T_Chase,NULL,s_mechachase1}, // s_mechachase4 + {false,SPR_MECHA_DIE1,10,NULL,(statefunc)A_DeathScream,s_mechadie2}, // s_mechadie1 + {false,SPR_MECHA_DIE2,10,NULL,NULL,s_mechadie3}, // s_mechadie2 + {false,SPR_MECHA_DIE3,10,NULL,(statefunc)A_HitlerMorph,s_mechadie4}, // s_mechadie3 + {false,SPR_MECHA_DEAD,0,NULL,NULL,s_mechadie4}, // s_mechadie4 + {false,SPR_MECHA_SHOOT1,30,NULL,NULL,s_mechashoot2}, // s_mechashoot1 + {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,s_mechashoot3}, // s_mechashoot2 + {false,SPR_MECHA_SHOOT3,10,NULL,(statefunc)T_Shoot,s_mechashoot4}, // s_mechashoot3 + {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,s_mechashoot5}, // s_mechashoot4 + {false,SPR_MECHA_SHOOT3,10,NULL,(statefunc)T_Shoot,s_mechashoot6}, // s_mechashoot5 + {false,SPR_MECHA_SHOOT2,10,NULL,(statefunc)T_Shoot,s_mechachase1}, // s_mechashoot6 + {false,SPR_HITLER_W1,6,(statefunc)T_Chase,NULL,s_hitlerchase1s}, // s_hitlerchase1 + {false,SPR_HITLER_W1,4,NULL,NULL,s_hitlerchase2}, // s_hitlerchase1s + {false,SPR_HITLER_W2,2,(statefunc)T_Chase,NULL,s_hitlerchase3}, // s_hitlerchase2 + {false,SPR_HITLER_W3,6,(statefunc)T_Chase,NULL,s_hitlerchase3s}, // s_hitlerchase3 + {false,SPR_HITLER_W3,4,NULL,NULL,s_hitlerchase4}, // s_hitlerchase3s + {false,SPR_HITLER_W4,2,(statefunc)T_Chase,NULL,s_hitlerchase1}, // s_hitlerchase4 + {false,SPR_HITLER_W1,10,NULL,NULL,s_hitlerdie1}, // s_hitlerdeathcam + {false,SPR_HITLER_W1,1,NULL,(statefunc)A_DeathScream,s_hitlerdie2}, // s_hitlerdie1 + {false,SPR_HITLER_W1,10,NULL,NULL,s_hitlerdie3}, // s_hitlerdie2 + {false,SPR_HITLER_DIE1,10,NULL,(statefunc)A_Slurpie,s_hitlerdie4}, // s_hitlerdie3 + {false,SPR_HITLER_DIE2,10,NULL,NULL,s_hitlerdie5}, // s_hitlerdie4 + {false,SPR_HITLER_DIE3,10,NULL,NULL,s_hitlerdie6}, // s_hitlerdie5 + {false,SPR_HITLER_DIE4,10,NULL,NULL,s_hitlerdie7}, // s_hitlerdie6 + {false,SPR_HITLER_DIE5,10,NULL,NULL,s_hitlerdie8}, // s_hitlerdie7 + {false,SPR_HITLER_DIE6,10,NULL,NULL,s_hitlerdie9}, // s_hitlerdie8 + {false,SPR_HITLER_DIE7,10,NULL,NULL,s_hitlerdie10}, // s_hitlerdie9 + {false,SPR_HITLER_DEAD,20,NULL,(statefunc)A_StartDeathCam,s_hitlerdie10}, // s_hitlerdie10 + {false,SPR_HITLER_SHOOT1,30,NULL,NULL,s_hitlershoot2}, // s_hitlershoot1 + {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,s_hitlershoot3}, // s_hitlershoot2 + {false,SPR_HITLER_SHOOT3,10,NULL,(statefunc)T_Shoot,s_hitlershoot4}, // s_hitlershoot3 + {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,s_hitlershoot5}, // s_hitlershoot4 + {false,SPR_HITLER_SHOOT3,10,NULL,(statefunc)T_Shoot,s_hitlershoot6}, // s_hitlershoot5 + {false,SPR_HITLER_SHOOT2,10,NULL,(statefunc)T_Shoot,s_hitlerchase1}, // s_hitlershoot6 +#endif + {false,SPR_BJ_W1,12,(statefunc)T_BJRun,NULL,s_bjrun1s}, // s_bjrun1 + {false,SPR_BJ_W1,3,NULL,NULL,s_bjrun2}, // s_bjrun1s + {false,SPR_BJ_W2,8,(statefunc)T_BJRun,NULL,s_bjrun3}, // s_bjrun2 + {false,SPR_BJ_W3,12,(statefunc)T_BJRun,NULL,s_bjrun3s}, // s_bjrun3 + {false,SPR_BJ_W3,3,NULL,NULL,s_bjrun4}, // s_bjrun3s + {false,SPR_BJ_W4,8,(statefunc)T_BJRun,NULL,s_bjrun1}, // s_bjrun4 + {false,SPR_BJ_JUMP1,14,(statefunc)T_BJJump,NULL,s_bjjump2}, // s_bjjump1 + {false,SPR_BJ_JUMP2,14,(statefunc)T_BJJump,(statefunc)T_BJYell,s_bjjump3}, // s_bjjump2 + {false,SPR_BJ_JUMP3,14,(statefunc)T_BJJump,NULL,s_bjjump4}, // s_bjjump3 + {false,SPR_BJ_JUMP4,300,NULL,(statefunc)T_BJDone,s_bjjump4}, // s_bjjump4 + {false,0,0,NULL,NULL,s_null}, // s_deathcam +}; diff --git a/states.h b/states.h new file mode 100644 index 0000000..03a0cff --- /dev/null +++ b/states.h @@ -0,0 +1,461 @@ +#ifndef __STATES_H__ +#define __STATES_H__ + +typedef enum +{ + s_null, + s_player, + s_attack, + s_rocket, + s_smoke1, + s_smoke2, + s_smoke3, + s_smoke4, + s_boom1, + s_boom2, + s_boom3, +#ifdef SPEAR + s_hrocket, + s_hsmoke1, + s_hsmoke2, + s_hsmoke3, + s_hsmoke4, + s_hboom1, + s_hboom2, + s_hboom3, +#endif + s_grdstand, + s_grdpath1, + s_grdpath1s, + s_grdpath2, + s_grdpath3, + s_grdpath3s, + s_grdpath4, + s_grdpain, + s_grdpain1, + s_grdshoot1, + s_grdshoot2, + s_grdshoot3, + s_grdchase1, + s_grdchase1s, + s_grdchase2, + s_grdchase3, + s_grdchase3s, + s_grdchase4, + s_grddie1, + s_grddie2, + s_grddie3, + s_grddie4, +#ifndef SPEAR + s_blinkychase1, + s_blinkychase2, + s_inkychase1, + s_inkychase2, + s_pinkychase1, + s_pinkychase2, + s_clydechase1, + s_clydechase2, +#endif + s_dogpath1, + s_dogpath1s, + s_dogpath2, + s_dogpath3, + s_dogpath3s, + s_dogpath4, + s_dogjump1, + s_dogjump2, + s_dogjump3, + s_dogjump4, + s_dogjump5, + s_dogchase1, + s_dogchase1s, + s_dogchase2, + s_dogchase3, + s_dogchase3s, + s_dogchase4, + s_dogdie1, + s_dogdie2, + s_dogdie3, + s_dogdead, + s_ofcstand, + s_ofcpath1, + s_ofcpath1s, + s_ofcpath2, + s_ofcpath3, + s_ofcpath3s, + s_ofcpath4, + s_ofcpain, + s_ofcpain1, + s_ofcshoot1, + s_ofcshoot2, + s_ofcshoot3, + s_ofcchase1, + s_ofcchase1s, + s_ofcchase2, + s_ofcchase3, + s_ofcchase3s, + s_ofcchase4, + s_ofcdie1, + s_ofcdie2, + s_ofcdie3, + s_ofcdie4, + s_ofcdie5, + s_mutstand, + s_mutpath1, + s_mutpath1s, + s_mutpath2, + s_mutpath3, + s_mutpath3s, + s_mutpath4, + s_mutpain, + s_mutpain1, + s_mutshoot1, + s_mutshoot2, + s_mutshoot3, + s_mutshoot4, + s_mutchase1, + s_mutchase1s, + s_mutchase2, + s_mutchase3, + s_mutchase3s, + s_mutchase4, + s_mutdie1, + s_mutdie2, + s_mutdie3, + s_mutdie4, + s_mutdie5, + s_ssstand, + s_sspath1, + s_sspath1s, + s_sspath2, + s_sspath3, + s_sspath3s, + s_sspath4, + s_sspain, + s_sspain1, + s_ssshoot1, + s_ssshoot2, + s_ssshoot3, + s_ssshoot4, + s_ssshoot5, + s_ssshoot6, + s_ssshoot7, + s_ssshoot8, + s_ssshoot9, + s_sschase1, + s_sschase1s, + s_sschase2, + s_sschase3, + s_sschase3s, + s_sschase4, + s_ssdie1, + s_ssdie2, + s_ssdie3, + s_ssdie4, +#ifndef SPEAR + s_bossstand, + s_bosschase1, + s_bosschase1s, + s_bosschase2, + s_bosschase3, + s_bosschase3s, + s_bosschase4, + s_bossdie1, + s_bossdie2, + s_bossdie3, + s_bossdie4, + s_bossshoot1, + s_bossshoot2, + s_bossshoot3, + s_bossshoot4, + s_bossshoot5, + s_bossshoot6, + s_bossshoot7, + s_bossshoot8, + s_gretelstand, + s_gretelchase1, + s_gretelchase1s, + s_gretelchase2, + s_gretelchase3, + s_gretelchase3s, + s_gretelchase4, + s_greteldie1, + s_greteldie2, + s_greteldie3, + s_greteldie4, + s_gretelshoot1, + s_gretelshoot2, + s_gretelshoot3, + s_gretelshoot4, + s_gretelshoot5, + s_gretelshoot6, + s_gretelshoot7, + s_gretelshoot8, +#endif +#ifdef SPEAR + s_transstand, + s_transchase1, + s_transchase1s, + s_transchase2, + s_transchase3, + s_transchase3s, + s_transchase4, + s_transdie0, + s_transdie01, + s_transdie1, + s_transdie2, + s_transdie3, + s_transdie4, + s_transshoot1, + s_transshoot2, + s_transshoot3, + s_transshoot4, + s_transshoot5, + s_transshoot6, + s_transshoot7, + s_transshoot8, + s_uberstand, + s_uberchase1, + s_uberchase1s, + s_uberchase2, + s_uberchase3, + s_uberchase3s, + s_uberchase4, + s_uberdie0, + s_uberdie01, + s_uberdie1, + s_uberdie2, + s_uberdie3, + s_uberdie4, + s_uberdie5, + s_ubershoot1, + s_ubershoot2, + s_ubershoot3, + s_ubershoot4, + s_ubershoot5, + s_ubershoot6, + s_ubershoot7, + s_willstand, + s_willchase1, + s_willchase1s, + s_willchase2, + s_willchase3, + s_willchase3s, + s_willchase4, + s_willdeathcam, + s_willdie1, + s_willdie2, + s_willdie3, + s_willdie4, + s_willdie5, + s_willdie6, + s_willshoot1, + s_willshoot2, + s_willshoot3, + s_willshoot4, + s_willshoot5, + s_willshoot6, + s_deathstand, + s_deathchase1, + s_deathchase1s, + s_deathchase2, + s_deathchase3, + s_deathchase3s, + s_deathchase4, + s_deathdeathcam, + s_deathdie1, + s_deathdie2, + s_deathdie3, + s_deathdie4, + s_deathdie5, + s_deathdie6, + s_deathdie7, + s_deathdie8, + s_deathdie9, + s_deathshoot1, + s_deathshoot2, + s_deathshoot3, + s_deathshoot4, + s_deathshoot5, + s_angelstand, + s_angelchase1, + s_angelchase1s, + s_angelchase2, + s_angelchase3, + s_angelchase3s, + s_angelchase4, + s_angeldie1, + s_angeldie11, + s_angeldie2, + s_angeldie3, + s_angeldie4, + s_angeldie5, + s_angeldie6, + s_angeldie7, + s_angeldie8, + s_angeldie9, + s_angelshoot1, + s_angelshoot2, + s_angelshoot3, + s_angeltired, + s_angeltired2, + s_angeltired3, + s_angeltired4, + s_angeltired5, + s_angeltired6, + s_angeltired7, + s_spark1, + s_spark2, + s_spark3, + s_spark4, + s_spectrewait1, + s_spectrewait2, + s_spectrewait3, + s_spectrewait4, + s_spectrechase1, + s_spectrechase2, + s_spectrechase3, + s_spectrechase4, + s_spectredie1, + s_spectredie2, + s_spectredie3, + s_spectredie4, + s_spectrewake, +#endif +#ifndef SPEAR + s_schabbstand, + s_schabbchase1, + s_schabbchase1s, + s_schabbchase2, + s_schabbchase3, + s_schabbchase3s, + s_schabbchase4, + s_schabbdeathcam, + s_schabbdie1, + s_schabbdie2, + s_schabbdie3, + s_schabbdie4, + s_schabbdie5, + s_schabbdie6, + s_schabbshoot1, + s_schabbshoot2, + s_needle1, + s_needle2, + s_needle3, + s_needle4, + s_giftstand, + s_giftchase1, + s_giftchase1s, + s_giftchase2, + s_giftchase3, + s_giftchase3s, + s_giftchase4, + s_giftdeathcam, + s_giftdie1, + s_giftdie2, + s_giftdie3, + s_giftdie4, + s_giftdie5, + s_giftdie6, + s_giftshoot1, + s_giftshoot2, + s_fatstand, + s_fatchase1, + s_fatchase1s, + s_fatchase2, + s_fatchase3, + s_fatchase3s, + s_fatchase4, + s_fatdeathcam, + s_fatdie1, + s_fatdie2, + s_fatdie3, + s_fatdie4, + s_fatdie5, + s_fatdie6, + s_fatshoot1, + s_fatshoot2, + s_fatshoot3, + s_fatshoot4, + s_fatshoot5, + s_fatshoot6, + s_fakestand, + s_fakechase1, + s_fakechase1s, + s_fakechase2, + s_fakechase3, + s_fakechase3s, + s_fakechase4, + s_fakedie1, + s_fakedie2, + s_fakedie3, + s_fakedie4, + s_fakedie5, + s_fakedie6, + s_fakeshoot1, + s_fakeshoot2, + s_fakeshoot3, + s_fakeshoot4, + s_fakeshoot5, + s_fakeshoot6, + s_fakeshoot7, + s_fakeshoot8, + s_fakeshoot9, + s_fire1, + s_fire2, + s_mechastand, + s_mechachase1, + s_mechachase1s, + s_mechachase2, + s_mechachase3, + s_mechachase3s, + s_mechachase4, + s_mechadie1, + s_mechadie2, + s_mechadie3, + s_mechadie4, + s_mechashoot1, + s_mechashoot2, + s_mechashoot3, + s_mechashoot4, + s_mechashoot5, + s_mechashoot6, + s_hitlerchase1, + s_hitlerchase1s, + s_hitlerchase2, + s_hitlerchase3, + s_hitlerchase3s, + s_hitlerchase4, + s_hitlerdeathcam, + s_hitlerdie1, + s_hitlerdie2, + s_hitlerdie3, + s_hitlerdie4, + s_hitlerdie5, + s_hitlerdie6, + s_hitlerdie7, + s_hitlerdie8, + s_hitlerdie9, + s_hitlerdie10, + s_hitlershoot1, + s_hitlershoot2, + s_hitlershoot3, + s_hitlershoot4, + s_hitlershoot5, + s_hitlershoot6, +#endif + s_bjrun1, + s_bjrun1s, + s_bjrun2, + s_bjrun3, + s_bjrun3s, + s_bjrun4, + s_bjjump1, + s_bjjump2, + s_bjjump3, + s_bjjump4, + s_deathcam, + numstates +} statenum_t; + +#endif From e4a1610e22fd4324a23393a25fd283304f264eb7 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 7 Jul 2020 11:17:25 +0200 Subject: [PATCH 3/8] simplify pointer arithmetics in SaveTheGame()/LoadTheGame() --- wl_main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wl_main.cpp b/wl_main.cpp index 2c6e653..6e7e39e 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -438,7 +438,7 @@ boolean SaveTheGame(FILE *file,int x,int y) ob = player; DiskFlopAnim(x,y); memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)states); + nullobj.state=(statetype *) (nullobj.state-states); fwrite(&nullobj,sizeof(nullobj),1,file); ob = ob->next; @@ -446,7 +446,7 @@ boolean SaveTheGame(FILE *file,int x,int y) for (; ob ; ob=ob->next) { memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state-(uintptr_t)states); + nullobj.state=(statetype *) (nullobj.state-states); fwrite(&nullobj,sizeof(nullobj),1,file); } nullobj.active = ac_badobject; // end of file marker @@ -553,7 +553,7 @@ boolean LoadTheGame(FILE *file,int x,int y) InitActorList (); DiskFlopAnim(x,y); fread (player,sizeof(*player),1,file); - player->state=(statetype *) ((uintptr_t)player->state+(uintptr_t)states); + player->state=&states[(size_t)player->state]; while (1) { @@ -562,7 +562,7 @@ boolean LoadTheGame(FILE *file,int x,int y) if (nullobj.active == ac_badobject) break; GetNewActor (); - nullobj.state=(statetype *) ((uintptr_t)nullobj.state+(uintptr_t)states); + nullobj.state=&states[(size_t)nullobj.state]; // don't copy over the links memcpy (newobj,&nullobj,sizeof(nullobj)-8); } From 335569bfa9884e54e912ecaedc3b4ab20611d49b Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Wed, 8 Jul 2020 15:42:36 +0200 Subject: [PATCH 4/8] display a message and quit the game when an invalid savegame is loaded There is currently no other way to "unload" the savegame. --- wl_main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wl_main.cpp b/wl_main.cpp index 6e7e39e..3dddfb6 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -553,6 +553,7 @@ boolean LoadTheGame(FILE *file,int x,int y) InitActorList (); DiskFlopAnim(x,y); fread (player,sizeof(*player),1,file); + if ((size_t)player->state > numstates) goto fail; player->state=&states[(size_t)player->state]; while (1) @@ -562,6 +563,7 @@ boolean LoadTheGame(FILE *file,int x,int y) if (nullobj.active == ac_badobject) break; GetNewActor (); + if ((size_t)nullobj.state > numstates) goto fail; nullobj.state=&states[(size_t)nullobj.state]; // don't copy over the links memcpy (newobj,&nullobj,sizeof(nullobj)-8); @@ -655,6 +657,16 @@ boolean LoadTheGame(FILE *file,int x,int y) } return true; + +fail: + Message("Unsupported savegame format!"); + + IN_ClearKeysDown(); + IN_Ack(); + + Quit(0); + + return false; } //=========================================================================== From af8d05b3d3c3d380f836407c4efc8653fbf2f58c Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 10 Jul 2020 13:06:13 +0200 Subject: [PATCH 5/8] back to main menu on failure instead of quitting --- wl_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wl_main.cpp b/wl_main.cpp index 3dddfb6..dff5606 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -659,12 +659,12 @@ boolean LoadTheGame(FILE *file,int x,int y) return true; fail: - Message("Unsupported savegame format!"); + Message("Unsupported savegame\nformat detected!"); IN_ClearKeysDown(); IN_Ack(); - Quit(0); + loadedgame = false; return false; } From 4d836b0bf1f3487849a00acd7fca118d84593793 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 10 Jul 2020 13:25:30 +0200 Subject: [PATCH 6/8] add copyright headers to newly added files --- states.cpp | 25 ++++++++++++++++++++++++- states.h | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/states.cpp b/states.cpp index 0b33853..beb0fa9 100644 --- a/states.cpp +++ b/states.cpp @@ -1,4 +1,27 @@ -#include "wl_def.h" +// +// Copyright(C) 1992 Id Software, Inc. +// Copyright(C) 2007-2011 Moritz "Ripper" Kroll +// Copyright(C) 2020 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// DESCRIPTION: +// Organize all available statetype variables in a states[] array. +// +// This replaces the current relying on a specific order in which +// global variables are stored in the executable for e.g. saving +// and restoring of savegames and thus does not require the +// -fno-toplevel-reorder compiler flag anymore. +// + #include "wl_def.h" extern void A_Breathing (objtype *); diff --git a/states.h b/states.h index 03a0cff..884b0a8 100644 --- a/states.h +++ b/states.h @@ -1,3 +1,27 @@ +// +// Copyright(C) 1992 Id Software, Inc. +// Copyright(C) 2007-2011 Moritz "Ripper" Kroll +// Copyright(C) 2020 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// DESCRIPTION: +// Organize all available statetype variables in a states[] array. +// +// This replaces the current relying on a specific order in which +// global variables are stored in the executable for e.g. saving +// and restoring of savegames and thus does not require the +// -fno-toplevel-reorder compiler flag anymore. +// + #ifndef __STATES_H__ #define __STATES_H__ From 56f634a171370e3a5e74ff003fe9205c7d9ca7b2 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 13 Jul 2020 13:57:35 +0200 Subject: [PATCH 7/8] prevent crashes for subsequent games when loading invalid savegame --- wl_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wl_main.cpp b/wl_main.cpp index dff5606..eaa08e2 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -664,6 +664,7 @@ boolean LoadTheGame(FILE *file,int x,int y) IN_ClearKeysDown(); IN_Ack(); + memset(objlist, 0, sizeof(objlist)); loadedgame = false; return false; From 39d4fdeec38ebc32d34a09418017afdf3e7b00d9 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 13 Jul 2020 14:09:48 +0200 Subject: [PATCH 8/8] add some minimalistic comments --- wl_def.h | 6 +++--- wl_main.cpp | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/wl_def.h b/wl_def.h index 8ada0e3..e7c13f6 100644 --- a/wl_def.h +++ b/wl_def.h @@ -722,7 +722,7 @@ typedef enum { typedef void (* statefunc) (void *); -#include "states.h" +#include "states.h" // [FG] statetype states[] array typedef struct statestruct { @@ -730,10 +730,10 @@ typedef struct statestruct short shapenum; // a shapenum of -1 means get from ob->temp1 short tictime; void (*think) (void *),(*action) (void *); - statenum_t next; + statenum_t next; // [FG] statetype states[] array } statetype; -extern statetype states[numstates]; +extern statetype states[numstates]; // [FG] statetype states[] array //--------------------- // diff --git a/wl_main.cpp b/wl_main.cpp index eaa08e2..06b0537 100644 --- a/wl_main.cpp +++ b/wl_main.cpp @@ -438,7 +438,7 @@ boolean SaveTheGame(FILE *file,int x,int y) ob = player; DiskFlopAnim(x,y); memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) (nullobj.state-states); + nullobj.state=(statetype *) (nullobj.state-states); // [FG] statetype states[] array fwrite(&nullobj,sizeof(nullobj),1,file); ob = ob->next; @@ -446,7 +446,7 @@ boolean SaveTheGame(FILE *file,int x,int y) for (; ob ; ob=ob->next) { memcpy(&nullobj,ob,sizeof(nullobj)); - nullobj.state=(statetype *) (nullobj.state-states); + nullobj.state=(statetype *) (nullobj.state-states); // [FG] statetype states[] array fwrite(&nullobj,sizeof(nullobj),1,file); } nullobj.active = ac_badobject; // end of file marker @@ -553,8 +553,8 @@ boolean LoadTheGame(FILE *file,int x,int y) InitActorList (); DiskFlopAnim(x,y); fread (player,sizeof(*player),1,file); - if ((size_t)player->state > numstates) goto fail; - player->state=&states[(size_t)player->state]; + if ((size_t)player->state > numstates) goto fail; // [FG] detect unsupported savegame format + player->state=&states[(size_t)player->state]; // [FG] statetype states[] array while (1) { @@ -563,8 +563,8 @@ boolean LoadTheGame(FILE *file,int x,int y) if (nullobj.active == ac_badobject) break; GetNewActor (); - if ((size_t)nullobj.state > numstates) goto fail; - nullobj.state=&states[(size_t)nullobj.state]; + if ((size_t)nullobj.state > numstates) goto fail; // [FG] detect unsupported savegame format + nullobj.state=&states[(size_t)nullobj.state]; // [FG] statetype states[] array // don't copy over the links memcpy (newobj,&nullobj,sizeof(nullobj)-8); } @@ -658,6 +658,7 @@ boolean LoadTheGame(FILE *file,int x,int y) return true; +// [FG] detect unsupported savegame format fail: Message("Unsupported savegame\nformat detected!");