From 057c5c9356df17d6698fc28b244a83f5b84f0828 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 22 Mar 2014 09:23:55 +0000 Subject: [PATCH] Clean up A_InitEnemyFlags() a bit. git-svn-id: https://svn.eduke32.com/eduke32@4384 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 53 ++++++++--------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7735c050a..ecb495bfd 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10690,57 +10690,26 @@ static void G_LoadExtraPalettes(void) Bmemset(&slime_pal[255*3], 0, 3); } -#define SETBGFLAG(Tilenum) g_tile[Tilenum].flags |= SFLAG_HARDCODED_BADGUY -#define SETNDPFLAG(Tilenum) g_tile[Tilenum].flags |= SFLAG_NODAMAGEPUSH +#define SETFLAG(Tilenum, Flag) g_tile[Tilenum].flags |= Flag // Has to be after setting the dynamic names (e.g. SHARK). static void A_InitEnemyFlags(void) { - int32_t i; + int32_t DukeEnemies[] = { SHARK, RECON, DRONE, LIZTROOPONTOILET, LIZTROOPJUSTSIT, LIZTROOPSTAYPUT, LIZTROOPSHOOT, LIZTROOPJETPACK, LIZTROOPSHOOT, LIZTROOPDUCKING, + LIZTROOPRUNNING, LIZTROOP, OCTABRAIN, COMMANDER, COMMANDERSTAYPUT, PIGCOP, PIGCOPSTAYPUT, PIGCOPDIVE, EGG, LIZMAN, LIZMANSPITTING, LIZMANJUMP, ORGANTIC, + BOSS1, BOSS2, BOSS3, BOSS4, RAT, ROTATEGUN }; + int32_t i, SolidEnemies[] = { TANK, BOSS1, BOSS2, BOSS3, BOSS4, RECON, ROTATEGUN }; for (i=GREENSLIME; i<=GREENSLIME+7; i++) - SETBGFLAG(i); + SETFLAG(i, SFLAG_HARDCODED_BADGUY); - 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); + for (i=ARRAY_SIZE(DukeEnemies)-1; i>=0; i--) + SETFLAG(DukeEnemies[i], SFLAG_HARDCODED_BADGUY); - SETNDPFLAG(TANK); - SETNDPFLAG(BOSS1); - SETNDPFLAG(BOSS4); - SETNDPFLAG(BOSS2); - SETNDPFLAG(BOSS3); - SETNDPFLAG(RECON); - SETNDPFLAG(ROTATEGUN); + for (i=ARRAY_SIZE(SolidEnemies)-1; i>=0; i--) + SETFLAG(SolidEnemies[i], SFLAG_NODAMAGEPUSH); } -#undef SETBGFLAG -#undef SETNDPFLAG +#undef SETFLAG extern int32_t startwin_run(void); static void G_SetupGameButtons(void);