From 599d9232f165f555c6d420a023aa501a0020bb34 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 9 Dec 2012 13:24:32 +0000 Subject: [PATCH] Initialize BADGUY sprite flags for hardcoded enemies. ... instead of switch/case-ing them in A_CheckEnemyTile(). Because this requires bumping BYTEVERSION, we also get rid of the excess trailing bytes in the save game's "rest" data. (See r3052.) git-svn-id: https://svn.eduke32.com/eduke32@3257 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 42 +----------------------------- polymer/eduke32/source/duke3d.h | 2 +- polymer/eduke32/source/game.c | 43 +++++++++++++++++++++++++++++++ polymer/eduke32/source/savegame.c | 13 ++-------- 4 files changed, 47 insertions(+), 53 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index c929799a2..ab71aaca7 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -8144,47 +8144,7 @@ void A_PlayAlertSound(int32_t i) int32_t A_CheckEnemyTile(int32_t pn) { - //this case can't be handled by the dynamictostatic system because it adds - //stuff to the value from names.h so handling separately - if (A_CheckSpriteTileFlags(pn, SPRITE_BADGUY) || - (pn >= GREENSLIME && pn <= GREENSLIME+7)) - return 1; - - switch (DYNAMICTILEMAP(pn)) - { - case SHARK__STATIC: - case RECON__STATIC: - case DRONE__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: - case PIGCOP__STATIC: - case EGG__STATIC: - case PIGCOPSTAYPUT__STATIC: - case PIGCOPDIVE__STATIC: - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - case ORGANTIC__STATIC: - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - case RAT__STATIC: - case ROTATEGUN__STATIC: - return 1; - } - - return 0; + return A_CheckSpriteTileFlags(pn, SPRITE_BADGUY); } int32_t A_CheckSwitchTile(int32_t i) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index d017f4a82..a241d037c 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VOLUMEONE (g_Shareware == 1) // increase by 3, because atomic GRP adds 1, and Shareware adds 2 -#define BYTEVERSION_JF 258 +#define BYTEVERSION_JF 261 #define BYTEVERSION_13 27 #define BYTEVERSION_14 116 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 19f25316d..81a60c612 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9589,6 +9589,48 @@ static void G_LoadExtraPalettes(void) kclose(fp); } +#define SETBGFLAG(Tilenum) g_tile[Tilenum].flags |= SPRITE_BADGUY + +// Has to be after setting the dynamic names (e.g. SHARK). +static void A_InitEnemyFlags(void) +{ + int32_t i; + + for (i=GREENSLIME; i<=GREENSLIME+7; i++) + SETBGFLAG(i); + + SETBGFLAG(SHARK); + SETBGFLAG(RECON); + SETBGFLAG(DRONE); + SETBGFLAG(LIZTROOPONTOILET); + SETBGFLAG(LIZTROOPJUSTSIT); + SETBGFLAG(LIZTROOPSTAYPUT); + SETBGFLAG(LIZTROOPSHOOT); + SETBGFLAG(LIZTROOPJETPACK); + SETBGFLAG(LIZTROOPDUCKING); + SETBGFLAG(LIZTROOPRUNNING); + SETBGFLAG(LIZTROOP); + SETBGFLAG(OCTABRAIN); + SETBGFLAG(COMMANDER); + SETBGFLAG(COMMANDERSTAYPUT); + SETBGFLAG(PIGCOP); + SETBGFLAG(EGG); + SETBGFLAG(PIGCOPSTAYPUT); + SETBGFLAG(PIGCOPDIVE); + SETBGFLAG(LIZMAN); + SETBGFLAG(LIZMANSPITTING); + SETBGFLAG(LIZMANFEEDING); + SETBGFLAG(LIZMANJUMP); + SETBGFLAG(ORGANTIC); + SETBGFLAG(BOSS1); + SETBGFLAG(BOSS2); + SETBGFLAG(BOSS3); + SETBGFLAG(BOSS4); + SETBGFLAG(RAT); + SETBGFLAG(ROTATEGUN); +} +#undef SETBGFLAG + extern int32_t startwin_run(void); static void G_SetupGameButtons(void); @@ -9614,6 +9656,7 @@ static void G_Startup(void) setbasepaltable(basepaltable, BASEPALCOUNT); G_InitDynamicTiles(); + A_InitEnemyFlags(); if (g_netServer || ud.multimode > 1) G_CheckGametype(); diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 33dae8d34..248ff9f2b 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -862,17 +862,9 @@ static void sv_postquoteredef(); static void sv_restsave(); static void sv_restload(); -// This used to be sizeof(_prlight)*PR_MAXLIGHTS + sizeof(lightcount), but -// 1) we haven't been loading Polymer lights since a while now since they're -// restored by polymer_loadboard() and -// 2) sizeof(_prlight) differs across compilers, see -// http://forums.duke4.net/topic/5686-synchronize-game-save-data-across-multiple-eduke32-installations -// Can be removed with the next savegame version bump. -#define TRAILINGBYTES (261*1024 + 4) - #define SVARDATALEN \ ((sizeof(g_player[0].user_name)+sizeof(g_player[0].pcolor)+sizeof(g_player[0].pteam) \ - +sizeof(g_player[0].frags)+sizeof(DukePlayer_t))*MAXPLAYERS + TRAILINGBYTES) + +sizeof(g_player[0].frags)+sizeof(DukePlayer_t))*MAXPLAYERS) static uint32_t savegame_bitptrsize; static uint8_t savegame_quotedef[MAXQUOTES>>3]; @@ -1624,8 +1616,7 @@ static void sv_restsave() CPDAT(&dummy_ps, sizeof(DukePlayer_t)); } - Bassert((savegame_restdata+SVARDATALEN)-mem == TRAILINGBYTES); - Bmemset(mem, 0, TRAILINGBYTES); + Bassert((savegame_restdata+SVARDATALEN)-mem == 0); #undef CPDAT } static void sv_restload()