mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- added CallOnHit and named spawn.
This commit is contained in:
parent
bab750c156
commit
ba016c7c3a
7 changed files with 45 additions and 0 deletions
|
@ -116,6 +116,7 @@ extern Dispatcher fi;
|
|||
void CallInitialize(DDukeActor* actor);
|
||||
void CallTick(DDukeActor* actor);
|
||||
void CallAction(DDukeActor* actor);
|
||||
void CallOnHit(DDukeActor* actor, DDukeActor* hitter);
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -20,6 +20,8 @@ inline int player_struct::GetPlayerNum()
|
|||
}
|
||||
|
||||
DDukeActor* spawn(DDukeActor* spawner, int type);
|
||||
DDukeActor* spawn(DDukeActor* actj, PClassActor* pname);
|
||||
|
||||
|
||||
inline int badguy(DDukeActor* pSprite)
|
||||
{
|
||||
|
|
|
@ -427,4 +427,14 @@ void CallAction(DDukeActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
void CallOnHit(DDukeActor* actor, DDukeActor* hitter)
|
||||
{
|
||||
IFVIRTUALPTR(actor, DDukeActor, onHit)
|
||||
{
|
||||
VMValue val[2] = { actor, hitter };
|
||||
VMCall(func, val, 2, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -1014,6 +1014,13 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
|
|||
{
|
||||
int j, k, p;
|
||||
|
||||
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
|
||||
{
|
||||
CallOnHit(targ, proj);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (targ->spr.picnum)
|
||||
{
|
||||
case WTGLASS1:
|
||||
|
|
|
@ -1522,6 +1522,12 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
|||
{
|
||||
int j, k, p;
|
||||
|
||||
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
|
||||
{
|
||||
CallOnHit(targ, proj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRRRA()) switch (targ->spr.picnum)
|
||||
{
|
||||
case RRTILE8464:
|
||||
|
|
|
@ -221,6 +221,24 @@ DDukeActor* spawn(DDukeActor* actj, int pn)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
DDukeActor* spawn(DDukeActor* actj, PClassActor * cls)
|
||||
{
|
||||
// still needs work to do.
|
||||
#if 0
|
||||
if (actj)
|
||||
{
|
||||
if (pn < 0) return nullptr;
|
||||
auto spawned = CreateActor(actj->sector(), actj->spr.pos, pn, 0, DVector2(0, 0), nullAngle, 0., 0., actj, 0);
|
||||
if (spawned)
|
||||
{
|
||||
spawned->attackertype = actj->spr.picnum;
|
||||
return fi.spawninit(actj, spawned, nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -74,6 +74,7 @@ class DukeActor : CoreActor native
|
|||
virtual void BeginPlay() {}
|
||||
virtual void Initialize() {}
|
||||
virtual void Tick() {}
|
||||
virtual void onHit(DukeActor hitter) {}
|
||||
virtual void RunState() {} // this is the CON function.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue