mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 10:40:47 +00:00
Actor ST1 handling: cleanup part 2. DONT_BUILD.
Factor out condition for whether a z offset is added or not ("fix for flying/jumping monsters getting stuck in water", etc.) into a function A_GetWaterZOffset() (and a helper A_GetVerticalVel()). git-svn-id: https://svn.eduke32.com/eduke32@4954 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
36c3fd9216
commit
c0d45ef1ec
1 changed files with 41 additions and 32 deletions
|
@ -920,6 +920,46 @@ static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int32_t A_GetVerticalVel(const actor_t *ac)
|
||||
{
|
||||
#ifdef LUNATIC
|
||||
return ac->mv.vvel;
|
||||
#else
|
||||
int32_t moveScriptOfs = AC_MOVE_ID(ac->t_data);
|
||||
|
||||
if ((unsigned)moveScriptOfs < (unsigned)g_scriptSize-1)
|
||||
return script[moveScriptOfs + 1];
|
||||
else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int32_t A_GetWaterZOffset(int spritenum)
|
||||
{
|
||||
const spritetype *const sp = &sprite[spritenum];
|
||||
const actor_t *const ac = &actor[spritenum];
|
||||
|
||||
if (sector[sp->sectnum].lotag == ST_1_ABOVE_WATER)
|
||||
{
|
||||
switch (DYNAMICTILEMAP(sp->picnum))
|
||||
{
|
||||
case OCTABRAIN__STATIC:
|
||||
case COMMANDER__STATIC:
|
||||
case DRONE__STATIC:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fix for flying/jumping monsters getting stuck in water
|
||||
if ((AC_MOVFLAGS(sp, ac) & jumptoplayer_only) ||
|
||||
(G_HaveActor(sp->picnum) && A_GetVerticalVel(ac) != 0))
|
||||
return 0;
|
||||
|
||||
return ACTOR_ONWATER_ADDZ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void VM_Fall(int32_t g_i, spritetype *g_sp)
|
||||
{
|
||||
int32_t grav = g_spriteGravity;
|
||||
|
@ -990,38 +1030,7 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
|
|||
|
||||
if (sector[g_sp->sectnum].lotag == ST_1_ABOVE_WATER)
|
||||
{
|
||||
switch (DYNAMICTILEMAP(g_sp->picnum))
|
||||
{
|
||||
case OCTABRAIN__STATIC:
|
||||
case COMMANDER__STATIC:
|
||||
case DRONE__STATIC:
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
int32_t moveScriptOfs = AC_MOVE_ID(vm.g_t);
|
||||
#endif
|
||||
// fix for flying/jumping monsters getting stuck in water
|
||||
if ((AC_MOVFLAGS(g_sp, &actor[vm.g_i]) & jumptoplayer_only) ||
|
||||
(G_HaveActor(g_sp->picnum) &&
|
||||
#if !defined LUNATIC
|
||||
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1] != 0
|
||||
#else
|
||||
actor[g_i].mv.vvel != 0
|
||||
#endif
|
||||
))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
z += ACTOR_ONWATER_ADDZ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_sp->z = z;
|
||||
g_sp->z = z + A_GetWaterZOffset(g_i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue