mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-23 20:42:45 +00:00
- move the remaining parts of spawninitdefault to DukeActor::Initialize.
This ensures proper execution of all code - spawninitdefault was designed to be the fallback for actors without a special case in spawninit.
This commit is contained in:
parent
38b278b12d
commit
4328016963
6 changed files with 34 additions and 45 deletions
|
@ -176,7 +176,6 @@ void addspritetodelete(int spnum=0);
|
||||||
void checkavailinven(player_struct* p);
|
void checkavailinven(player_struct* p);
|
||||||
bool initspriteforspawn(DDukeActor* spn);
|
bool initspriteforspawn(DDukeActor* spn);
|
||||||
bool commonEnemySetup(DDukeActor* self, DDukeActor* owner);
|
bool commonEnemySetup(DDukeActor* self, DDukeActor* owner);
|
||||||
bool spawninitdefault(DDukeActor* actj, DDukeActor* act);
|
|
||||||
void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
|
void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
|
||||||
int spawnbloodpoolpart1(DDukeActor* acti);
|
int spawnbloodpoolpart1(DDukeActor* acti);
|
||||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell);
|
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell);
|
||||||
|
|
|
@ -340,47 +340,6 @@ bool commonEnemySetup(DDukeActor* self, DDukeActor* owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool spawninitdefault(DDukeActor* actj, DDukeActor *act)
|
|
||||||
{
|
|
||||||
if (gs.actorinfo[act->spr.picnum].scriptaddress)
|
|
||||||
{
|
|
||||||
if (actj == nullptr && act->spr.lotag > ud.player_skill)
|
|
||||||
{
|
|
||||||
// make it go away...
|
|
||||||
act->spr.scale = DVector2(0, 0);
|
|
||||||
ChangeActorStat(act, STAT_MISC);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init the size
|
|
||||||
if (act->spr.scale.X == 0 || act->spr.scale.Y == 0)
|
|
||||||
act->spr.scale = DVector2(REPEAT_SCALE, REPEAT_SCALE);
|
|
||||||
|
|
||||||
if (actorflag(act, SFLAG_BADGUY))
|
|
||||||
{
|
|
||||||
commonEnemySetup(act, actj);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
act->clipdist = 10;
|
|
||||||
act->SetOwner(act);
|
|
||||||
ChangeActorStat(act, STAT_ACTOR);
|
|
||||||
if (actj)
|
|
||||||
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
act->timetosleep = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -149,7 +149,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
switch (act->spr.picnum)
|
switch (act->spr.picnum)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
spawninitdefault(actj, act);
|
CallInitialize(act);
|
||||||
break;
|
break;
|
||||||
case FOF:
|
case FOF:
|
||||||
act->spr.scale = DVector2(0, 0);
|
act->spr.scale = DVector2(0, 0);
|
||||||
|
|
|
@ -61,7 +61,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
default_case:
|
default_case:
|
||||||
spawninitdefault(actj, act);
|
CallInitialize(act);
|
||||||
break;
|
break;
|
||||||
case RTILE_RRTILE7936:
|
case RTILE_RRTILE7936:
|
||||||
if (!isRRRA()) goto default_case;
|
if (!isRRRA()) goto default_case;
|
||||||
|
|
|
@ -623,6 +623,17 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, badguy, badguy)
|
||||||
ACTION_RETURN_INT(badguy(self));
|
ACTION_RETURN_INT(badguy(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int duke_scripted(DDukeActor* act)
|
||||||
|
{
|
||||||
|
return gs.actorinfo[act->spr.picnum].scriptaddress > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, scripted, duke_scripted)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
ACTION_RETURN_INT(duke_scripted(self));
|
||||||
|
}
|
||||||
|
|
||||||
int duke_isplayer(DDukeActor* act)
|
int duke_isplayer(DDukeActor* act)
|
||||||
{
|
{
|
||||||
return act->isPlayer();
|
return act->isPlayer();
|
||||||
|
|
|
@ -209,7 +209,6 @@ class DukeActor : CoreActor native
|
||||||
|
|
||||||
virtual void BeginPlay() {}
|
virtual void BeginPlay() {}
|
||||||
virtual void StaticSetup() {}
|
virtual void StaticSetup() {}
|
||||||
virtual void Initialize() {}
|
|
||||||
virtual void onHit(DukeActor hitter) { checkhitdefault(hitter); }
|
virtual void onHit(DukeActor hitter) { checkhitdefault(hitter); }
|
||||||
virtual void onHurt(DukePlayer p) {}
|
virtual void onHurt(DukePlayer p) {}
|
||||||
virtual bool onUse(DukePlayer user) { return false; }
|
virtual bool onUse(DukePlayer user) { return false; }
|
||||||
|
@ -230,6 +229,7 @@ class DukeActor : CoreActor native
|
||||||
native void hitradius(int r, int hp1, int hp2, int hp3, int hp4);
|
native void hitradius(int r, int hp1, int hp2, int hp3, int hp4);
|
||||||
native double, DukeActor hitasprite();
|
native double, DukeActor hitasprite();
|
||||||
native int badguy();
|
native int badguy();
|
||||||
|
native int scripted();
|
||||||
native int isplayer();
|
native int isplayer();
|
||||||
native void lotsofstuff(Name type, int count);
|
native void lotsofstuff(Name type, int count);
|
||||||
native double gutsoffset();
|
native double gutsoffset();
|
||||||
|
@ -251,6 +251,26 @@ class DukeActor : CoreActor native
|
||||||
deprecated("4.9") native bool checktype(String name); // this must not stay in the code, so mark it deprecated to keep the annoying warning at startup.
|
deprecated("4.9") native bool checktype(String name); // this must not stay in the code, so mark it deprecated to keep the annoying warning at startup.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual void Initialize()
|
||||||
|
{
|
||||||
|
if (!self.badguy() && self.scripted())
|
||||||
|
{
|
||||||
|
if (!self.mapSpawned) self.lotag = 0;
|
||||||
|
|
||||||
|
if (self.lotag > ud.player_skill)
|
||||||
|
{
|
||||||
|
self.scale = (0, 0);
|
||||||
|
self.ChangeStat(STAT_MISC);
|
||||||
|
}
|
||||||
|
self.clipdist = 10;
|
||||||
|
self.ownerActor = self;
|
||||||
|
self.ChangeStat(STAT_ACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int checkLocationForFloorSprite(double radius)
|
int checkLocationForFloorSprite(double radius)
|
||||||
{
|
{
|
||||||
bool away = self.isAwayFromWall(radius);
|
bool away = self.isAwayFromWall(radius);
|
||||||
|
|
Loading…
Reference in a new issue