Rename CWorld::Instance to CWorld::World to avoid conflicting with CBaseEntity::Instance function name
This commit is contained in:
parent
a370af08e6
commit
9c4af83c7d
7 changed files with 23 additions and 22 deletions
|
@ -14,6 +14,7 @@
|
||||||
* Fixed NPCs not being able to speak scripted sentences while in scripted death [#180](https://github.com/SamVanheer/halflife-updated/issues/180) (Thanks λλλλλλ)
|
* Fixed NPCs not being able to speak scripted sentences while in scripted death [#180](https://github.com/SamVanheer/halflife-updated/issues/180) (Thanks λλλλλλ)
|
||||||
* Removed unnecessary semicolons (Thanks Shepard)
|
* Removed unnecessary semicolons (Thanks Shepard)
|
||||||
* Updated source file encoding to UTF-8 [#183](https://github.com/SamVanheer/halflife-updated/issues/183) (Thanks anchurcn)
|
* Updated source file encoding to UTF-8 [#183](https://github.com/SamVanheer/halflife-updated/issues/183) (Thanks anchurcn)
|
||||||
|
* Renamed `CWorld::Instance` to `CWorld::World` to avoid conflicting with `CBaseEntity::Instance` function name
|
||||||
|
|
||||||
## Changes in V1.0.0 Beta 013
|
## Changes in V1.0.0 Beta 013
|
||||||
|
|
||||||
|
|
|
@ -748,7 +748,7 @@ public:
|
||||||
void Precache() override;
|
void Precache() override;
|
||||||
bool KeyValue(KeyValueData* pkvd) override;
|
bool KeyValue(KeyValueData* pkvd) override;
|
||||||
|
|
||||||
static inline CWorld* Instance = nullptr;
|
static inline CWorld* World = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline DLL_GLOBAL edict_t* g_pBodyQueueHead = nullptr;
|
inline DLL_GLOBAL edict_t* g_pBodyQueueHead = nullptr;
|
||||||
|
@ -756,14 +756,14 @@ inline DLL_GLOBAL edict_t* g_pBodyQueueHead = nullptr;
|
||||||
inline CBaseEntity* CBaseEntity::Instance(edict_t* pent)
|
inline CBaseEntity* CBaseEntity::Instance(edict_t* pent)
|
||||||
{
|
{
|
||||||
if (!pent)
|
if (!pent)
|
||||||
return CWorld::Instance;
|
return CWorld::World;
|
||||||
return (CBaseEntity*)GET_PRIVATE(pent);
|
return (CBaseEntity*)GET_PRIVATE(pent);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CBaseEntity* CBaseEntity::Instance(entvars_t* pev)
|
inline CBaseEntity* CBaseEntity::Instance(entvars_t* pev)
|
||||||
{
|
{
|
||||||
if (!pev)
|
if (!pev)
|
||||||
return CWorld::Instance;
|
return CWorld::World;
|
||||||
|
|
||||||
return Instance(ENT(pev));
|
return Instance(ENT(pev));
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ void CGauss::SecondaryAttack()
|
||||||
SendStopEvent(false);
|
SendStopEvent(false);
|
||||||
|
|
||||||
#ifndef CLIENT_DLL
|
#ifndef CLIENT_DLL
|
||||||
m_pPlayer->TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, 50, DMG_SHOCK);
|
m_pPlayer->TakeDamage(CWorld::World->pev, CWorld::World->pev, 50, DMG_SHOCK);
|
||||||
UTIL_ScreenFade(m_pPlayer, Vector(255, 128, 0), 2, 0.5, 128, FFADE_IN);
|
UTIL_ScreenFade(m_pPlayer, Vector(255, 128, 0), 2, 0.5, 128, FFADE_IN);
|
||||||
#endif
|
#endif
|
||||||
SendWeaponAnim(GAUSS_IDLE);
|
SendWeaponAnim(GAUSS_IDLE);
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ void CBasePlayer::WaterMove()
|
||||||
pev->dmg += 1;
|
pev->dmg += 1;
|
||||||
if (pev->dmg > 5)
|
if (pev->dmg > 5)
|
||||||
pev->dmg = 5;
|
pev->dmg = 5;
|
||||||
TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, pev->dmg, DMG_DROWN);
|
TakeDamage(CWorld::World->pev, CWorld::World->pev, pev->dmg, DMG_DROWN);
|
||||||
pev->pain_finished = gpGlobals->time + 1;
|
pev->pain_finished = gpGlobals->time + 1;
|
||||||
|
|
||||||
// track drowning damage, give it back when
|
// track drowning damage, give it back when
|
||||||
|
@ -1148,12 +1148,12 @@ void CBasePlayer::WaterMove()
|
||||||
if (pev->watertype == CONTENT_LAVA) // do damage
|
if (pev->watertype == CONTENT_LAVA) // do damage
|
||||||
{
|
{
|
||||||
if (pev->dmgtime < gpGlobals->time)
|
if (pev->dmgtime < gpGlobals->time)
|
||||||
TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, 10 * pev->waterlevel, DMG_BURN);
|
TakeDamage(CWorld::World->pev, CWorld::World->pev, 10 * pev->waterlevel, DMG_BURN);
|
||||||
}
|
}
|
||||||
else if (pev->watertype == CONTENT_SLIME) // do damage
|
else if (pev->watertype == CONTENT_SLIME) // do damage
|
||||||
{
|
{
|
||||||
pev->dmgtime = gpGlobals->time + 1;
|
pev->dmgtime = gpGlobals->time + 1;
|
||||||
TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, 4 * pev->waterlevel, DMG_ACID);
|
TakeDamage(CWorld::World->pev, CWorld::World->pev, 4 * pev->waterlevel, DMG_ACID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FBitSet(pev->flags, FL_INWATER))
|
if (!FBitSet(pev->flags, FL_INWATER))
|
||||||
|
@ -2548,7 +2548,7 @@ void CBasePlayer::PostThink()
|
||||||
|
|
||||||
if (flFallDamage > 0)
|
if (flFallDamage > 0)
|
||||||
{
|
{
|
||||||
TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, flFallDamage, DMG_FALL);
|
TakeDamage(CWorld::World->pev, CWorld::World->pev, flFallDamage, DMG_FALL);
|
||||||
pev->punchangle.x = 0;
|
pev->punchangle.x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2740,7 +2740,7 @@ edict_t* EntSelectSpawnPoint(CBaseEntity* pPlayer)
|
||||||
{
|
{
|
||||||
// if ent is a client, kill em (unless they are ourselves)
|
// if ent is a client, kill em (unless they are ourselves)
|
||||||
if (ent->IsPlayer() && !(ent->edict() == player))
|
if (ent->IsPlayer() && !(ent->edict() == player))
|
||||||
ent->TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, 300, DMG_GENERIC);
|
ent->TakeDamage(CWorld::World->pev, CWorld::World->pev, 300, DMG_GENERIC);
|
||||||
}
|
}
|
||||||
goto ReturnSpot;
|
goto ReturnSpot;
|
||||||
}
|
}
|
||||||
|
@ -2764,7 +2764,7 @@ ReturnSpot:
|
||||||
if (FNullEnt(pSpot))
|
if (FNullEnt(pSpot))
|
||||||
{
|
{
|
||||||
ALERT(at_error, "PutClientInServer: no info_player_start on level");
|
ALERT(at_error, "PutClientInServer: no info_player_start on level");
|
||||||
return CWorld::Instance->edict();
|
return CWorld::World->edict();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLastSpawn = pSpot;
|
g_pLastSpawn = pSpot;
|
||||||
|
@ -3554,7 +3554,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
|
||||||
{
|
{
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
|
|
||||||
edict_t* pWorld = CWorld::Instance->edict();
|
edict_t* pWorld = CWorld::World->edict();
|
||||||
|
|
||||||
Vector start = pev->origin + pev->view_ofs;
|
Vector start = pev->origin + pev->view_ofs;
|
||||||
Vector end = start + gpGlobals->v_forward * 1024;
|
Vector end = start + gpGlobals->v_forward * 1024;
|
||||||
|
|
|
@ -1677,7 +1677,7 @@ float TEXTURETYPE_PlaySound(TraceResult* ptr, Vector vecSrc, Vector vecEnd, int
|
||||||
if (pEntity)
|
if (pEntity)
|
||||||
pTextureName = TRACE_TEXTURE(ENT(pEntity->pev), rgfl1, rgfl2);
|
pTextureName = TRACE_TEXTURE(ENT(pEntity->pev), rgfl1, rgfl2);
|
||||||
else
|
else
|
||||||
pTextureName = TRACE_TEXTURE(CWorld::Instance->edict(), rgfl1, rgfl2);
|
pTextureName = TRACE_TEXTURE(CWorld::World->edict(), rgfl1, rgfl2);
|
||||||
|
|
||||||
if (pTextureName)
|
if (pTextureName)
|
||||||
{
|
{
|
||||||
|
@ -1804,10 +1804,10 @@ float TEXTURETYPE_PlaySound(TraceResult* ptr, Vector vecSrc, Vector vecEnd, int
|
||||||
switch (RANDOM_LONG(0, 1))
|
switch (RANDOM_LONG(0, 1))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
UTIL_EmitAmbientSound(CWorld::Instance->edict(), ptr->vecEndPos, "buttons/spark5.wav", flVolume, ATTN_NORM, 0, 100);
|
UTIL_EmitAmbientSound(CWorld::World->edict(), ptr->vecEndPos, "buttons/spark5.wav", flVolume, ATTN_NORM, 0, 100);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
UTIL_EmitAmbientSound(CWorld::Instance->edict(), ptr->vecEndPos, "buttons/spark6.wav", flVolume, ATTN_NORM, 0, 100);
|
UTIL_EmitAmbientSound(CWorld::World->edict(), ptr->vecEndPos, "buttons/spark6.wav", flVolume, ATTN_NORM, 0, 100);
|
||||||
break;
|
break;
|
||||||
// case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break;
|
// case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break;
|
||||||
// case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break;
|
// case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break;
|
||||||
|
@ -1816,7 +1816,7 @@ float TEXTURETYPE_PlaySound(TraceResult* ptr, Vector vecSrc, Vector vecEnd, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// play material hit sound
|
// play material hit sound
|
||||||
UTIL_EmitAmbientSound(CWorld::Instance->edict(), ptr->vecEndPos, rgsz[RANDOM_LONG(0, cnt - 1)], fvol, fattn, 0, 96 + RANDOM_LONG(0, 0xf));
|
UTIL_EmitAmbientSound(CWorld::World->edict(), ptr->vecEndPos, rgsz[RANDOM_LONG(0, cnt - 1)], fvol, fattn, 0, 96 + RANDOM_LONG(0, 0xf));
|
||||||
//EMIT_SOUND_DYN( ENT(m_pPlayer->pev), CHAN_WEAPON, rgsz[RANDOM_LONG(0,cnt-1)], fvol, ATTN_NORM, 0, 96 + RANDOM_LONG(0,0xf));
|
//EMIT_SOUND_DYN( ENT(m_pPlayer->pev), CHAN_WEAPON, rgsz[RANDOM_LONG(0,cnt-1)], fvol, ATTN_NORM, 0, 96 + RANDOM_LONG(0,0xf));
|
||||||
|
|
||||||
return fvolbar;
|
return fvolbar;
|
||||||
|
|
|
@ -45,7 +45,7 @@ CHalfLifeTeamplay::CHalfLifeTeamplay()
|
||||||
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
|
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
|
||||||
strncpy(m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH);
|
strncpy(m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH);
|
||||||
|
|
||||||
edict_t* pWorld = CWorld::Instance->edict();
|
edict_t* pWorld = CWorld::World->edict();
|
||||||
if (pWorld && !FStringNull(pWorld->v.team))
|
if (pWorld && !FStringNull(pWorld->v.team))
|
||||||
{
|
{
|
||||||
if (0 != teamoverride.value)
|
if (0 != teamoverride.value)
|
||||||
|
@ -270,7 +270,7 @@ void CHalfLifeTeamplay::ChangePlayerTeam(CBasePlayer* pPlayer, const char* pTeam
|
||||||
m_DisableDeathMessages = true;
|
m_DisableDeathMessages = true;
|
||||||
m_DisableDeathPenalty = true;
|
m_DisableDeathPenalty = true;
|
||||||
|
|
||||||
pPlayer->TakeDamage(CWorld::Instance->pev, CWorld::Instance->pev, 900, damageFlags);
|
pPlayer->TakeDamage(CWorld::World->pev, CWorld::World->pev, 900, damageFlags);
|
||||||
|
|
||||||
m_DisableDeathMessages = false;
|
m_DisableDeathMessages = false;
|
||||||
m_DisableDeathPenalty = false;
|
m_DisableDeathPenalty = false;
|
||||||
|
|
|
@ -474,23 +474,23 @@ LINK_ENTITY_TO_CLASS(worldspawn, CWorld);
|
||||||
|
|
||||||
CWorld::CWorld()
|
CWorld::CWorld()
|
||||||
{
|
{
|
||||||
if (Instance)
|
if (World)
|
||||||
{
|
{
|
||||||
ALERT(at_error, "Do not create multiple instances of worldspawn\n");
|
ALERT(at_error, "Do not create multiple instances of worldspawn\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance = this;
|
World = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorld::~CWorld()
|
CWorld::~CWorld()
|
||||||
{
|
{
|
||||||
if (Instance != this)
|
if (World != this)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance = nullptr;
|
World = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::Spawn()
|
void CWorld::Spawn()
|
||||||
|
@ -502,7 +502,7 @@ void CWorld::Spawn()
|
||||||
void CWorld::Precache()
|
void CWorld::Precache()
|
||||||
{
|
{
|
||||||
// Flag this entity for removal if it's not the actual world entity.
|
// Flag this entity for removal if it's not the actual world entity.
|
||||||
if (Instance != this)
|
if (World != this)
|
||||||
{
|
{
|
||||||
UTIL_Remove(this);
|
UTIL_Remove(this);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue