Add new actor flag and predefined CON label SFLAG_NODAMAGEPUSH.

This flag is set from C for some enemies that should not be pushed back when
damaged, such as TANK. Both the tile flag and the per-sprite flag are used
(i.e. the ultimate flag value is the XOR of the two).
Add currently non-functional example to test.lua that attempts to set this bit
for NEWBEAST.

git-svn-id: https://svn.eduke32.com/eduke32@4371 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-03-15 14:10:47 +00:00
parent 55d6b9c5c7
commit 5cb6e20c63
8 changed files with 21 additions and 2 deletions

View file

@ -263,6 +263,7 @@ enum sflags_t {
SFLAG_ROTFIXED = 0x00020000,
SFLAG_HARDCODED_BADGUY = 0x00040000,
SFLAG_DIDNOSE7WATER = 0x00080000, // used temporarily
SFLAG_NODAMAGEPUSH = 0x00100000,
};
// Custom projectiles "workslike" flags.

View file

@ -10691,6 +10691,7 @@ static void G_LoadExtraPalettes(void)
}
#define SETBGFLAG(Tilenum) g_tile[Tilenum].flags |= SFLAG_HARDCODED_BADGUY
#define SETNDPFLAG(Tilenum) g_tile[Tilenum].flags |= SFLAG_NODAMAGEPUSH
// Has to be after setting the dynamic names (e.g. SHARK).
static void A_InitEnemyFlags(void)
@ -10729,8 +10730,17 @@ static void A_InitEnemyFlags(void)
SETBGFLAG(BOSS4);
SETBGFLAG(RAT);
SETBGFLAG(ROTATEGUN);
SETNDPFLAG(TANK);
SETNDPFLAG(BOSS1);
SETNDPFLAG(BOSS4);
SETNDPFLAG(BOSS2);
SETNDPFLAG(BOSS3);
SETNDPFLAG(RECON);
SETNDPFLAG(ROTATEGUN);
}
#undef SETBGFLAG
#undef SETNDPFLAG
extern int32_t startwin_run(void);
static void G_SetupGameButtons(void);

View file

@ -4570,6 +4570,7 @@ static int32_t C_ParseCommand(int32_t loop)
continue;
}
// XXX: may remove bits set in A_InitEnemyFlags!
g_tile[j].flags = *g_scriptPtr;
continue;
@ -6170,6 +6171,7 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("SFLAG_NOCLIP", SFLAG_NOCLIP, LABEL_DEFINE);
C_AddDefinition("SFLAG_SMOOTHMOVE", SFLAG_SMOOTHMOVE, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOTELEPORT", SFLAG_NOTELEPORT, LABEL_DEFINE);
C_AddDefinition("SFLAG_NODAMAGEPUSH", SFLAG_NODAMAGEPUSH, LABEL_DEFINE);
C_AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE);
C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE);

View file

@ -196,6 +196,7 @@ SFLAG = {
SFLAG_ROTFIXED = -0x00020000,
SFLAG_HARDCODED_BADGUY = -0x00040000,
SFLAG_DIDNOSE7WATER = -0x00080000,
SFLAG_NODAMAGEPUSH = 0x00100000,
-- RESERVED for actor.FLAGS.chain_*/replace_*:
-- 0x08000000, 0x10000000, 0x20000000, 0x40000000
}

View file

@ -2110,6 +2110,7 @@ local function our_gameactor(args)
-- All good, set the tile bits in initial run and register the actor!
-- XXX: Need to see if some other state living on the C side is clobbered
-- by Lua state recreation.
-- TILE_FLAGS_SET_ONLY_ON_FIRST_RUN
if (g_firstRun) then
-- NOTE: when chaining, this allows passing different flags which are
-- silently ORed. This may or may not be what the user intends, but it

View file

@ -1115,7 +1115,7 @@ Provides a mapping of symbolic names to values applicable as sprite
Contains symbolic names of values applicable to <<gameactor,`gameactor`>>'s
`flags` input argument, most of which are described there. +
`SHADOW`, `NVG`, `NOSHADE`, `NOPAL`, `NOEVENTS`, `NOLIGHT`,
`USEACTIVATOR`, `NOCLIP`, `SMOOTHMOVE`, `NOTELEPORT`.
`USEACTIVATOR`, `NOCLIP`, `SMOOTHMOVE`, `NOTELEPORT`, `NODAMAGEPUSH`.
//`BADGUY`,

View file

@ -525,6 +525,10 @@ gameactor{ D.APLAYER, AF.chain_end,
end
}
-- Add NODAMAGEPUSH flag to NEWBEAST.
-- XXX: Doesn't work because of defs.lua: TILE_FLAGS_SET_ONLY_ON_FIRST_RUN
gameactor { D.NEWBEAST, AF.chain_end + AF.NODAMAGEPUSH, function() end }
-- Also test actor code chaining: strength is doubled.
gameactor
{

View file

@ -2265,7 +2265,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_Shoot(i,BLOODSPLAT4);
}
if (PN != TANK && PN != BOSS1 && PN != BOSS4 && PN != BOSS2 && PN != BOSS3 && PN != RECON && PN != ROTATEGUN)
if (!A_CheckSpriteFlags(i, SFLAG_NODAMAGEPUSH))
{
if (sprite[i].extra > 0)
{