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
This commit is contained in:
helixhorned 2012-12-09 13:24:32 +00:00
parent 541fca6dac
commit 599d9232f1
4 changed files with 47 additions and 53 deletions

View file

@ -8144,47 +8144,7 @@ void A_PlayAlertSound(int32_t i)
int32_t A_CheckEnemyTile(int32_t pn) int32_t A_CheckEnemyTile(int32_t pn)
{ {
//this case can't be handled by the dynamictostatic system because it adds return A_CheckSpriteTileFlags(pn, SPRITE_BADGUY);
//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;
} }
int32_t A_CheckSwitchTile(int32_t i) int32_t A_CheckSwitchTile(int32_t i)

View file

@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VOLUMEONE (g_Shareware == 1) #define VOLUMEONE (g_Shareware == 1)
// increase by 3, because atomic GRP adds 1, and Shareware adds 2 // 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_13 27
#define BYTEVERSION_14 116 #define BYTEVERSION_14 116

View file

@ -9589,6 +9589,48 @@ static void G_LoadExtraPalettes(void)
kclose(fp); 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); extern int32_t startwin_run(void);
static void G_SetupGameButtons(void); static void G_SetupGameButtons(void);
@ -9614,6 +9656,7 @@ static void G_Startup(void)
setbasepaltable(basepaltable, BASEPALCOUNT); setbasepaltable(basepaltable, BASEPALCOUNT);
G_InitDynamicTiles(); G_InitDynamicTiles();
A_InitEnemyFlags();
if (g_netServer || ud.multimode > 1) G_CheckGametype(); if (g_netServer || ud.multimode > 1) G_CheckGametype();

View file

@ -862,17 +862,9 @@ static void sv_postquoteredef();
static void sv_restsave(); static void sv_restsave();
static void sv_restload(); 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 \ #define SVARDATALEN \
((sizeof(g_player[0].user_name)+sizeof(g_player[0].pcolor)+sizeof(g_player[0].pteam) \ ((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 uint32_t savegame_bitptrsize;
static uint8_t savegame_quotedef[MAXQUOTES>>3]; static uint8_t savegame_quotedef[MAXQUOTES>>3];
@ -1624,8 +1616,7 @@ static void sv_restsave()
CPDAT(&dummy_ps, sizeof(DukePlayer_t)); CPDAT(&dummy_ps, sizeof(DukePlayer_t));
} }
Bassert((savegame_restdata+SVARDATALEN)-mem == TRAILINGBYTES); Bassert((savegame_restdata+SVARDATALEN)-mem == 0);
Bmemset(mem, 0, TRAILINGBYTES);
#undef CPDAT #undef CPDAT
} }
static void sv_restload() static void sv_restload()