mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- renamed DDukeActor::GetIndex to GetSpriteIndex to bring it in line with the other games.
This commit is contained in:
parent
7ebe492e94
commit
821f3d356b
7 changed files with 18 additions and 18 deletions
|
@ -78,7 +78,7 @@ void deletesprite(DDukeActor *const actor)
|
|||
S_StopSound(actor->s->lotag, actor);
|
||||
else
|
||||
S_RelinkActorSound(actor, nullptr);
|
||||
::deletesprite(actor->GetIndex());
|
||||
::deletesprite(actor->GetSpriteIndex());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -1561,7 +1561,7 @@ static bool movefireball(DDukeActor* actor)
|
|||
int trail = actor->temp_data[1];
|
||||
auto ball = spawn(actor, FIREBALL);
|
||||
auto spr = ball->s;
|
||||
actor->temp_data[1] = ball->GetIndex();
|
||||
actor->temp_data[1] = ball->GetSpriteIndex();
|
||||
|
||||
spr->xvel = s->xvel;
|
||||
spr->yvel = s->yvel;
|
||||
|
@ -1585,7 +1585,7 @@ static bool movefireball(DDukeActor* actor)
|
|||
|
||||
FireProj proj = { spr->x, spr->y, spr->z, spr->xvel, spr->yvel, spr->zvel };
|
||||
|
||||
fire.Insert(ball->GetIndex(), proj);
|
||||
fire.Insert(ball->GetSpriteIndex(), proj);
|
||||
changeactorstat(ball, STAT_PROJECTILE);
|
||||
}
|
||||
actor->temp_data[0]++;
|
||||
|
|
|
@ -97,22 +97,22 @@ inline int player_struct::GetPlayerNum()
|
|||
// Refactoring helpers/intermediates
|
||||
inline void changeactorstat(DDukeActor* a, int newstat)
|
||||
{
|
||||
::changespritestat(a->GetIndex(), newstat);
|
||||
::changespritestat(a->GetSpriteIndex(), newstat);
|
||||
}
|
||||
|
||||
inline void changeactorsect(DDukeActor* a, int newsect)
|
||||
{
|
||||
::changespritesect(a->GetIndex(), newsect);
|
||||
::changespritesect(a->GetSpriteIndex(), newsect);
|
||||
}
|
||||
|
||||
inline int setsprite(DDukeActor* a, int x, int y, int z)
|
||||
{
|
||||
return ::setsprite(a->GetIndex(), x, y, z);
|
||||
return ::setsprite(a->GetSpriteIndex(), x, y, z);
|
||||
}
|
||||
|
||||
inline int setsprite(DDukeActor* a, const vec3_t& pos)
|
||||
{
|
||||
return ::setsprite(a->GetIndex(), pos.x, pos.y, pos.z);
|
||||
return ::setsprite(a->GetSpriteIndex(), pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
// see comment for changespritestat.
|
||||
|
@ -124,7 +124,7 @@ inline int setsprite(int i, int x, int y, int z)
|
|||
inline int ActorToScriptIndex(DDukeActor* a)
|
||||
{
|
||||
if (!a) return -1;
|
||||
return a->GetIndex();
|
||||
return a->GetSpriteIndex();
|
||||
}
|
||||
|
||||
inline DDukeActor* ScriptIndexToActor(int index)
|
||||
|
@ -139,7 +139,7 @@ int spawn_r(int j, int pn);
|
|||
|
||||
inline DDukeActor* spawn(DDukeActor* spawner, int type)
|
||||
{
|
||||
int i = (isRR()? spawn_r : spawn_d)(spawner ? spawner->GetIndex() : -1, type);
|
||||
int i = (isRR()? spawn_r : spawn_d)(spawner ? spawner->GetSpriteIndex() : -1, type);
|
||||
return i == -1 ? nullptr : &hittype[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ int GetGameVarID(int id, DDukeActor* sActor, int sPlayer)
|
|||
}
|
||||
if (id == g_iThisActorID)
|
||||
{
|
||||
return sActor->GetIndex();
|
||||
return sActor->GetSpriteIndex();
|
||||
}
|
||||
if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER )
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ int GetGameVarID(int id, DDukeActor* sActor, int sPlayer)
|
|||
// for the current actor
|
||||
if(sActor != nullptr)
|
||||
{
|
||||
return aGameVars[id].plArray[sActor->GetIndex()];
|
||||
return aGameVars[id].plArray[sActor->GetSpriteIndex()];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -359,7 +359,7 @@ void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer)
|
|||
else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR )
|
||||
{
|
||||
// for the current actor
|
||||
if (sActor != nullptr) aGameVars[id].plArray[sActor->GetIndex()]=lValue;
|
||||
if (sActor != nullptr) aGameVars[id].plArray[sActor->GetSpriteIndex()]=lValue;
|
||||
else for (auto& i : aGameVars[id].plArray) i = lValue; // -1 sets all actors - was undefined OOB access in WW2GI.
|
||||
}
|
||||
else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG )
|
||||
|
|
|
@ -623,7 +623,7 @@ void resetpspritevars(int g)
|
|||
else
|
||||
s->pal = ps[j].palookup = ud.user_pals[j];
|
||||
|
||||
ps[j].i = act->GetIndex();
|
||||
ps[j].i = act->GetSpriteIndex();
|
||||
ps[j].frag_ps = j;
|
||||
act->SetOwner(act);
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
|
|||
spawned->picnum = actj->s->picnum;
|
||||
sp = spawned->s;
|
||||
t = spawned->temp_data;
|
||||
i = spawned->GetIndex();
|
||||
i = spawned->GetSpriteIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ struct DDukeActor
|
|||
|
||||
static DDukeActor* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself.
|
||||
|
||||
DDukeActor() : s(&sprite[this - array()]) {} // little trick to initialize the reference automatically. ;)
|
||||
DDukeActor() : s(&sprite[this - array()]) {}
|
||||
DDukeActor(const DDukeActor& other) = delete; // we also do not want to allow copies.
|
||||
DDukeActor& operator=(const DDukeActor& other) = delete;
|
||||
void clear()
|
||||
|
@ -49,7 +49,7 @@ struct DDukeActor
|
|||
floorz = ceilingz = lastvx = lastvy = aflags = saved_ammo = 0;
|
||||
memset(temp_data, 0, sizeof(temp_data));
|
||||
}
|
||||
int GetIndex() const { return int(this - array()); }
|
||||
int GetSpriteIndex() const { return int(this - array()); }
|
||||
|
||||
// Wrapper around some ugliness. The 'owner' field gets abused by some actors, so better wrap its real use in access functions to keep things in order.
|
||||
inline DDukeActor* GetOwner()
|
||||
|
@ -59,7 +59,7 @@ struct DDukeActor
|
|||
|
||||
inline void SetOwner(DDukeActor* a)
|
||||
{
|
||||
s->owner = a? a->GetIndex() : -1;
|
||||
s->owner = a? a->GetSpriteIndex() : -1;
|
||||
}
|
||||
|
||||
// same for the 'hittype' owner - which is normally the shooter in an attack.
|
||||
|
@ -70,7 +70,7 @@ struct DDukeActor
|
|||
|
||||
inline void SetHitOwner(DDukeActor* a)
|
||||
{
|
||||
owner = a ? a->GetIndex() : -1;
|
||||
owner = a ? a->GetSpriteIndex() : -1;
|
||||
}
|
||||
|
||||
// This used the Owner field - better move this to something more safe.
|
||||
|
|
Loading…
Reference in a new issue