mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-14 16:40:52 +00:00
- route checkhitsprite fully through the virtual interface so that the player class can finally be exported.
This commit is contained in:
parent
60af1b4c62
commit
0a91a9a199
17 changed files with 37 additions and 76 deletions
|
@ -220,7 +220,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
{
|
||||
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q), act2->sector(), actor->spr.pos.plusZ(q), actor->sector()))
|
||||
continue;
|
||||
fi.checkhitsprite(act2, actor);
|
||||
checkhitsprite(act2, actor);
|
||||
}
|
||||
}
|
||||
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
|
||||
|
@ -267,7 +267,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
}
|
||||
|
||||
if ((act2->flags1 & SFLAG_HITRADIUSCHECK))
|
||||
fi.checkhitsprite(act2, actor);
|
||||
checkhitsprite(act2, actor);
|
||||
}
|
||||
else if (actor->spr.extra == 0) act2->hitextra = 0;
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q), act2->sector(), actor->spr.pos.plusZ(q), actor->sector()))
|
||||
continue;
|
||||
|
||||
fi.checkhitsprite(act2, actor);
|
||||
checkhitsprite(act2, actor);
|
||||
}
|
||||
}
|
||||
else if (act2->spr.extra >= 0 && act2 != actor && ((act2->flags1 & SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
|
||||
|
@ -256,7 +256,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
}
|
||||
|
||||
if ((act2->flags1 & SFLAG_HITRADIUSCHECK))
|
||||
fi.checkhitsprite(act2, actor);
|
||||
checkhitsprite(act2, actor);
|
||||
|
||||
if (act2->spr.picnum != RTILE_RADIUSEXPLOSION &&
|
||||
Owner && Owner->spr.statnum < MAXSTATUS)
|
||||
|
|
|
@ -39,8 +39,6 @@ bool checkaccessswitch_d(int snum, int pal, DDukeActor *act, walltype* w);
|
|||
bool checkaccessswitch_r(int snum, int pal, DDukeActor* act, walltype* w);
|
||||
void activatebysector_d(sectortype* sect, DDukeActor* j);
|
||||
void activatebysector_r(sectortype* sect, DDukeActor* j);
|
||||
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);
|
||||
void checkhitsprite_r(DDukeActor* i, DDukeActor* sn);
|
||||
void checkhitdefault_d(DDukeActor* i, DDukeActor* sn);
|
||||
void checkhitdefault_r(DDukeActor* i, DDukeActor* sn);
|
||||
void checksectors_d(int snum);
|
||||
|
@ -97,7 +95,6 @@ void SetDispatcher()
|
|||
initactorflags_d,
|
||||
checkaccessswitch_d,
|
||||
activatebysector_d,
|
||||
checkhitsprite_d,
|
||||
checkhitdefault_d,
|
||||
checksectors_d,
|
||||
|
||||
|
@ -130,7 +127,6 @@ void SetDispatcher()
|
|||
initactorflags_r,
|
||||
checkaccessswitch_r,
|
||||
activatebysector_r,
|
||||
checkhitsprite_r,
|
||||
checkhitdefault_r,
|
||||
checksectors_r,
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ struct Dispatcher
|
|||
void (*initactorflags)();
|
||||
bool (*checkaccessswitch)(int snum, int switchpal, DDukeActor* act, walltype* w);
|
||||
void (*activatebysector)(sectortype* sect, DDukeActor* j);
|
||||
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
|
||||
void (*checkhitdefault)(DDukeActor* i, DDukeActor* sn);
|
||||
void (*checksectors)(int low);
|
||||
|
||||
|
@ -112,7 +111,7 @@ void CallInitialize(DDukeActor* actor);
|
|||
void CallTick(DDukeActor* actor);
|
||||
bool CallOperate(DDukeActor* actor, int plnum);
|
||||
void CallAction(DDukeActor* actor);
|
||||
void CallOnHit(DDukeActor* actor, DDukeActor* hitter);
|
||||
void checkhitsprite(DDukeActor* actor, DDukeActor* hitter);
|
||||
void CallOnHurt(DDukeActor* actor, player_struct* hitter);
|
||||
void CallOnTouch(DDukeActor* actor, player_struct* hitter);
|
||||
bool CallOnUse(DDukeActor* actor, player_struct* user);
|
||||
|
|
|
@ -510,7 +510,7 @@ void CallAction(DDukeActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
void CallOnHit(DDukeActor* actor, DDukeActor* hitter)
|
||||
void checkhitsprite(DDukeActor* actor, DDukeActor* hitter)
|
||||
{
|
||||
IFVIRTUALPTR(actor, DDukeActor, onHit)
|
||||
{
|
||||
|
|
|
@ -185,7 +185,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
}
|
||||
if (hit.actor() && ! isaccessswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), knee);
|
||||
checkhitsprite(hit.actor(), knee);
|
||||
if (p >= 0) checkhitswitch(p, nullptr, hit.actor());
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
|
||||
if (hit.actor())
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), spark);
|
||||
checkhitsprite(hit.actor(), spark);
|
||||
if (hit.actor()->isPlayer() && (ud.coop != 1 || ud.ffire == 1))
|
||||
{
|
||||
spark->spr.scale = DVector2(0, 0);
|
||||
|
@ -431,7 +431,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
|
||||
if (hit.actor())
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), spark);
|
||||
checkhitsprite(hit.actor(), spark);
|
||||
if (!hit.actor()->isPlayer())
|
||||
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
|
||||
else spark->spr.scale = DVector2(0, 0);
|
||||
|
@ -853,7 +853,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
if (zvel < 0 && (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY) == 0)
|
||||
checkhitceiling(hit.hitSector);
|
||||
}
|
||||
else if (hit.actor() != nullptr) fi.checkhitsprite(hit.actor(), spark);
|
||||
else if (hit.actor() != nullptr) checkhitsprite(hit.actor(), spark);
|
||||
else if (hit.hitWall != nullptr)
|
||||
{
|
||||
if (!isaccessswitch(hit.hitWall->walltexture))
|
||||
|
|
|
@ -162,7 +162,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
|
|||
|
||||
if (hit.actor() && !isaccessswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), wpn);
|
||||
checkhitsprite(hit.actor(), wpn);
|
||||
if (p >= 0) checkhitswitch(p, nullptr, hit.actor());
|
||||
}
|
||||
else if (hit.hitWall)
|
||||
|
@ -319,7 +319,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
{
|
||||
if (hit.actor()->spr.picnum == RTILE_TORNADO)
|
||||
return;
|
||||
fi.checkhitsprite(hit.actor(), spark);
|
||||
checkhitsprite(hit.actor(), spark);
|
||||
if (hit.actor()->isPlayer() && (ud.coop != 1 || ud.ffire == 1))
|
||||
{
|
||||
auto jib = spawn(spark, RTILE_JIBS6);
|
||||
|
@ -408,7 +408,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
|
||||
if (hit.actor())
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), spark);
|
||||
checkhitsprite(hit.actor(), spark);
|
||||
if (!hit.actor()->isPlayer())
|
||||
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
|
||||
else spark->spr.scale = DVector2(0, 0);
|
||||
|
|
|
@ -272,23 +272,6 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
|
|||
}
|
||||
}
|
||||
|
||||
void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
|
||||
{
|
||||
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
|
||||
{
|
||||
CallOnHit(targ, proj);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (targ->IsKindOf(NAME_DukePlayerOnWater))
|
||||
{
|
||||
targ = targ->GetOwner();
|
||||
if (!targ) return;
|
||||
}
|
||||
checkhitdefault_d(targ, proj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// taken out of checksectors to eliminate some gotos.
|
||||
|
|
|
@ -242,28 +242,6 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
|
|||
}
|
||||
}
|
||||
|
||||
void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
||||
{
|
||||
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
|
||||
{
|
||||
CallOnHit(targ, proj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRRRA()) switch (targ->spr.picnum)
|
||||
{
|
||||
case RTILE_IRONWHEELSWITCH:
|
||||
break;
|
||||
}
|
||||
|
||||
if (targ->IsKindOf(NAME_DukePlayerOnWater))
|
||||
{
|
||||
targ = targ->GetOwner();
|
||||
if (!targ) return;
|
||||
}
|
||||
checkhitdefault_r(targ, proj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -137,7 +137,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, GetSoundFlags, duke_GetSoundFlags)
|
|||
static int Duke_badguypic(int spawnno)
|
||||
{
|
||||
auto clstype = GetSpawnType(spawnno);
|
||||
if (clstype->IsDescendantOf(RUNTIME_CLASS(DDukeActor)))
|
||||
if (clstype && clstype->IsDescendantOf(RUNTIME_CLASS(DDukeActor)))
|
||||
return badguy(static_cast<DDukeActor*>(GetDefaultByType(clstype)));
|
||||
return false;
|
||||
}
|
||||
|
@ -596,19 +596,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, isplayer, duke_isplayer)
|
|||
ACTION_RETURN_INT(duke_isplayer(self));
|
||||
}
|
||||
|
||||
void DukeActor_checkhitsprite(DDukeActor* act, DDukeActor* hitter)
|
||||
{
|
||||
fi.checkhitsprite(act, hitter);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, checkhitsprite, DukeActor_checkhitsprite)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||
PARAM_POINTER(h, DDukeActor);
|
||||
DukeActor_checkhitsprite(self, h);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int duke_spw(DDukeActor* act)
|
||||
{
|
||||
auto tex = TexMan.GetGameTexture(act->spr.spritetexture());
|
||||
|
|
|
@ -456,5 +456,7 @@ spawnclasses
|
|||
4427 = DukeHotMeat
|
||||
4340 = DukeLavaBubble
|
||||
|
||||
1405 = DukePlayerPawn, noskill
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -370,4 +370,6 @@ spawnclasses
|
|||
2097 = RedneckTesla
|
||||
1990 = RedneckTikilamp
|
||||
|
||||
3845 = DukePlayerPawn, noskill
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class DukeFlamethrowerFlame : DukeActor
|
|||
if (coll.type == kHitSprite)
|
||||
{
|
||||
let hitact = DukeActor(coll.hitActor());
|
||||
hitact.checkhitsprite(self);
|
||||
hitact.OnHit(self);
|
||||
if (hitact.isPlayer())
|
||||
hitact.PlayActorSound("PISTOL_BODYHIT");
|
||||
}
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
class DukePlayerPawn : DukeActor
|
||||
{
|
||||
default
|
||||
{
|
||||
pic "APLAYER";
|
||||
}
|
||||
}
|
||||
|
||||
class DukePlayerOnWater : DukeActor
|
||||
{
|
||||
default
|
||||
|
@ -17,6 +25,14 @@ class DukePlayerOnWater : DukeActor
|
|||
}
|
||||
self.ChangeStat(STAT_DUMMYPLAYER);
|
||||
}
|
||||
|
||||
override void OnHit(DukeActor proj)
|
||||
{
|
||||
// propagate the hit to its owner.
|
||||
let owner = self.ownerActor;
|
||||
if (owner && self != owner) owner.OnHit(proj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DukePlayerLyingDead : DukeActor
|
||||
|
|
|
@ -72,7 +72,7 @@ class DukeProjectile : DukeActor
|
|||
|
||||
virtual bool weaponhitsprite_pre(DukeActor targ)
|
||||
{
|
||||
targ.checkhitsprite(self);
|
||||
targ.OnHit(self);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class DukeQueball : DukeActor
|
|||
// the logic here was inverted, so to set things right the type check had to be added.
|
||||
let targ = DukeActor(colli.hitactor());
|
||||
if (targ is 'DukeQueball')
|
||||
targ.checkhitsprite(self);
|
||||
targ.OnHit(self);
|
||||
}
|
||||
|
||||
self.vel.X -= 1/16.;
|
||||
|
|
|
@ -199,8 +199,6 @@ class DukeActor : CoreActor native
|
|||
native void operatesectors(sectortype sec);
|
||||
native int SpriteWidth();
|
||||
|
||||
native void checkhitsprite(DukeActor hitter);
|
||||
|
||||
virtual native void Tick();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue