mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-14 16:40:52 +00:00
- made fallspecial game independent and eliminated all the wrapping and callback weirdness with fall.
This commit is contained in:
parent
7f19a120a0
commit
4812e1431e
10 changed files with 89 additions and 114 deletions
|
@ -193,6 +193,7 @@ static FFlagDef DukeActorFlagDefs[] =
|
|||
DEFINE_FLAG(SFLAG3, NOJIBS, DDukeActor, flags3),
|
||||
DEFINE_FLAG(SFLAG3, NOVERTICALMOVE, DDukeActor, flags3),
|
||||
DEFINE_FLAG(SFLAG3, MOVE_NOPLAYERINTERACT, DDukeActor, flags3),
|
||||
DEFINE_FLAG(SFLAG3, MAGMAIMMUNE, DDukeActor, flags3),
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -3826,13 +3826,87 @@ void alterang(int ang, DDukeActor* actor, int playernum)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// special checks for RR's extended sector types, now available everywhere
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static int fallspecial(DDukeActor* actor, int playernum)
|
||||
{
|
||||
int sphit = 0;
|
||||
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
|
||||
{
|
||||
if (actor->sector()->lotag == ST_801_ROCKY)
|
||||
{
|
||||
if (actor->GetClass() == RedneckRockClass)
|
||||
{
|
||||
spawn(actor, RedneckRock2Class);
|
||||
spawn(actor, RedneckRock2Class);
|
||||
addspritetodelete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (actor->sector()->lotag == ST_802_KILLBADGUYS)
|
||||
{
|
||||
if (!actor->isPlayer() && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F)
|
||||
{
|
||||
spawnguts(actor, DukeJibs6Class, 5);
|
||||
S_PlayActorSound(SQUISHED, actor);
|
||||
addspritetodelete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (actor->sector()->lotag == ST_803_KILLROCKS)
|
||||
{
|
||||
if (actor->GetClass() == RedneckRock2Class)
|
||||
addspritetodelete();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (ud.mapflags & (MFLAG_ALLSECTORTYPES | MFLAG_SECTORTYPE800))
|
||||
{
|
||||
if (actor->sector()->lotag == ST_800_KILLSTUFF)
|
||||
{
|
||||
if (!actor->isPlayer() && badguy(actor) && actor->spriteextra < 128)
|
||||
{
|
||||
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
|
||||
actor->vel.Z = 8000 / 256.;
|
||||
actor->spr.extra = 0;
|
||||
actor->spriteextra++;
|
||||
sphit = 1;
|
||||
}
|
||||
else if (!actor->isPlayer())
|
||||
{
|
||||
if (!actor->spriteextra)
|
||||
addspritetodelete();
|
||||
return 0;
|
||||
}
|
||||
actor->attackertype = DukeShotSparkClass;
|
||||
actor->hitextra = 1;
|
||||
}
|
||||
}
|
||||
if (tilesurface(actor->sector()->floortexture) == TSURF_MAGMA)
|
||||
{
|
||||
if (!(actor->flags3 & SFLAG3_MAGMAIMMUNE) && actor->spr.pal != 19)
|
||||
{
|
||||
if ((krand() & 3) == 1)
|
||||
{
|
||||
actor->attackertype = DukeShotSparkClass;
|
||||
actor->hitextra = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sphit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// the indirections here are to keep this core function free of game references
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void fall_common(DDukeActor *actor, int playernum, int(*fallspecial)(DDukeActor*, int))
|
||||
void fall(DDukeActor *actor, int playernum)
|
||||
{
|
||||
actor->spr.xoffset = 0;
|
||||
actor->spr.yoffset = 0;
|
||||
|
@ -3840,7 +3914,7 @@ void fall_common(DDukeActor *actor, int playernum, int(*fallspecial)(DDukeActor*
|
|||
{
|
||||
double grav;
|
||||
|
||||
int sphit = fallspecial? fallspecial(actor, playernum) : 0;
|
||||
int sphit = fallspecial(actor, playernum);
|
||||
if (floorspace(actor->sector()))
|
||||
grav = 0;
|
||||
else
|
||||
|
|
|
@ -864,17 +864,6 @@ void moveeffectors_d(void) //STATNUM 3
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void fall_d(DDukeActor *actor, int g_p)
|
||||
{
|
||||
fall_common(actor, g_p, nullptr);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void think_d(void)
|
||||
{
|
||||
thinktime.Reset();
|
||||
|
|
|
@ -1025,96 +1025,6 @@ void fakebubbaspawn(DDukeActor *actor, player_struct* p)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// special checks in fall that only apply to RR.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static int fallspecial(DDukeActor *actor, int playernum)
|
||||
{
|
||||
int sphit = 0;
|
||||
if (ud.mapflags & MFLAG_ALLSECTORTYPES)
|
||||
{
|
||||
if (actor->sector()->lotag == ST_801_ROCKY)
|
||||
{
|
||||
if (actor->GetClass() == RedneckRockClass)
|
||||
{
|
||||
spawn(actor, RedneckRock2Class);
|
||||
spawn(actor, RedneckRock2Class);
|
||||
addspritetodelete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (actor->sector()->lotag == ST_802_KILLBADGUYS)
|
||||
{
|
||||
if (!actor->isPlayer() && badguy(actor) && actor->spr.pos.Z == actor->floorz - FOURSLEIGHT_F)
|
||||
{
|
||||
spawnguts(actor, DukeJibs6Class, 5);
|
||||
S_PlayActorSound(SQUISHED, actor);
|
||||
addspritetodelete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (actor->sector()->lotag == ST_803_KILLROCKS)
|
||||
{
|
||||
if (actor->GetClass() == RedneckRock2Class)
|
||||
addspritetodelete();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (ud.mapflags & (MFLAG_ALLSECTORTYPES | MFLAG_SECTORTYPE800))
|
||||
{
|
||||
if (actor->sector()->lotag == ST_800_KILLSTUFF)
|
||||
{
|
||||
if (actor->spr.picnum == RTILE_AMMO)
|
||||
{
|
||||
addspritetodelete();
|
||||
return 0;
|
||||
}
|
||||
if (!actor->isPlayer() && (badguy(actor)) && (!isRRRA() || actor->spriteextra < 128))
|
||||
{
|
||||
actor->spr.pos.Z = actor->floorz - FOURSLEIGHT_F;
|
||||
actor->vel.Z = 8000 / 256.;
|
||||
actor->spr.extra = 0;
|
||||
actor->spriteextra++;
|
||||
sphit = 1;
|
||||
}
|
||||
else if (!actor->isPlayer())
|
||||
{
|
||||
if (!actor->spriteextra)
|
||||
addspritetodelete();
|
||||
return 0;
|
||||
}
|
||||
actor->attackertype = DukeShotSparkClass;
|
||||
actor->hitextra = 1;
|
||||
}
|
||||
}
|
||||
if (tilesurface(actor->sector()->floortexture) == TSURF_MAGMA)
|
||||
{
|
||||
if (actor->spr.picnum != RTILE_MINION && actor->spr.pal != 19)
|
||||
{
|
||||
if ((krand() & 3) == 1)
|
||||
{
|
||||
actor->attackertype = DukeShotSparkClass;
|
||||
actor->hitextra = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sphit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void fall_r(DDukeActor* ac, int g_p)
|
||||
{
|
||||
fall_common(ac, g_p, fallspecial);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -438,6 +438,7 @@ enum sflags3_t
|
|||
SFLAG3_NOJIBS = 0x01000000,
|
||||
SFLAG3_NOVERTICALMOVE = 0x02000000,
|
||||
SFLAG3_MOVE_NOPLAYERINTERACT = 0x04000000,
|
||||
SFLAG3_MAGMAIMMUNE = 0x08000000,
|
||||
};
|
||||
|
||||
using EDukeFlags3 = TFlags<sflags3_t, uint32_t>;
|
||||
|
|
|
@ -48,8 +48,6 @@ void addweapon_d(player_struct* p, int weapon, bool wswitch);
|
|||
void addweapon_r(player_struct* p, int weapon, bool wswitch);
|
||||
int ifhitbyweapon_r(DDukeActor* sn);
|
||||
int ifhitbyweapon_d(DDukeActor* sn);
|
||||
void fall_d(DDukeActor* i, int g_p);
|
||||
void fall_r(DDukeActor* i, int g_p);
|
||||
void incur_damage_d(player_struct* p);
|
||||
void incur_damage_r(player_struct* p);
|
||||
void selectweapon_d(int snum, int j);
|
||||
|
@ -88,7 +86,6 @@ void SetDispatcher()
|
|||
|
||||
addweapon_d,
|
||||
ifhitbyweapon_d,
|
||||
fall_d,
|
||||
|
||||
incur_damage_d,
|
||||
selectweapon_d,
|
||||
|
@ -113,7 +110,6 @@ void SetDispatcher()
|
|||
|
||||
addweapon_r,
|
||||
ifhitbyweapon_r,
|
||||
fall_r,
|
||||
|
||||
incur_damage_r,
|
||||
selectweapon_r,
|
||||
|
|
|
@ -82,7 +82,6 @@ struct Dispatcher
|
|||
|
||||
void (*addweapon)(player_struct *p, int weapon, bool wswitch);
|
||||
int (*ifhitbyweapon)(DDukeActor* sectnum);
|
||||
void (*fall)(DDukeActor* actor, int g_p);
|
||||
|
||||
// player
|
||||
void (*incur_damage)(player_struct* p);
|
||||
|
|
|
@ -1792,7 +1792,7 @@ int ParseState::parse(void)
|
|||
insptr++;
|
||||
g_ac->spr.xoffset = 0;
|
||||
g_ac->spr.yoffset = 0;
|
||||
fi.fall(g_ac, g_p);
|
||||
fall(g_ac, g_p);
|
||||
break;
|
||||
case concmd_enda:
|
||||
case concmd_break:
|
||||
|
|
|
@ -818,7 +818,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeType, Duke_ChangeType)
|
|||
|
||||
void Duke_fall(DDukeActor* self, player_struct* p)
|
||||
{
|
||||
fi.fall(self, p->GetPlayerNum());
|
||||
fall(self, p->GetPlayerNum());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, fall, Duke_fall)
|
||||
|
|
|
@ -13,11 +13,16 @@ class RedneckMinion : DukeActor
|
|||
{
|
||||
self.scale = (0.25, 0.25);
|
||||
self.setClipDistFromTile();
|
||||
if (Raze.isRRRA() && ud.ufospawnsminion)
|
||||
self.pal = 8;
|
||||
if (self.pal == 19)
|
||||
if (Raze.isRRRA())
|
||||
{
|
||||
self.bHitradius_NoEffect = true;
|
||||
if (ud.ufospawnsminion)
|
||||
self.pal = 8;
|
||||
|
||||
if (self.pal == 19)
|
||||
{
|
||||
self.bHitradius_NoEffect = true;
|
||||
self.bMagmaImmune = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue