Clean up #include files in the code and disable some annoying assertions using #ifdef _DEBUG && 0

This commit is contained in:
LegendaryGuard 2023-07-30 23:51:14 +02:00
parent 02eddc5b00
commit e1f6760620
21 changed files with 117 additions and 97 deletions

View file

@ -1665,7 +1665,9 @@ bool idEntity::StartSound( const char *soundName, const s_channelType channel, i
// we should ALWAYS be playing sounds from the def.
// hardcoded sounds MUST be avoided at all times because they won't get precached.
#ifdef _DEBUG && 0
assert( idStr::Icmpn( soundName, "snd_", 4 ) == 0 );
#endif
if ( !spawnArgs.GetString( soundName, "", &sound ) ) {
return false;
@ -5676,7 +5678,7 @@ idEntity::Event_SetGravity
=====================
*/
void idEntity::Event_SetGravity( const idVec3 &grav ) {
GetPhysics()->SetGravity(grav);
GetPhysics()->SetGravity( grav );
}
/*
@ -5686,9 +5688,9 @@ idEntity::Event_GetGravity
=====================
*/
void idEntity::Event_GetGravity( void ) {
idVec3 cur=GetPhysics()->GetGravity();
idVec3 cur = GetPhysics()->GetGravity();
idThread::ReturnVector(cur);
idThread::ReturnVector( cur );
}
/*
@ -5698,9 +5700,9 @@ idEntity::Event_GetGravityNormal
=====================
*/
void idEntity::Event_GetGravityNormal( void ) {
idVec3 cur=GetPhysics()->GetGravityNormal();
idVec3 cur = GetPhysics()->GetGravityNormal();
idThread::ReturnVector(cur);
idThread::ReturnVector( cur );
}
/*
@ -5710,7 +5712,7 @@ idEntity::Event_GetSelfEntity
=====================
*/
void idEntity::Event_GetSelfEntity( void ) {
idThread::ReturnEntity(this);
idThread::ReturnEntity( this );
}
/*
@ -5720,7 +5722,7 @@ idEntity::Event_GetHealth
=====================
*/
void idEntity::Event_GetHealth( void ) {
idThread::ReturnInt(health);
idThread::ReturnInt( health );
}
/*
@ -5768,7 +5770,7 @@ idEntity::SetState
*/
void idEntity::SetState( const function_t *newState ) {
if ( !newState ) {
gameLocal.Printf("idEntity::SetState(): %s: Null State.\n", name.c_str());
gameLocal.Printf( "idEntity::SetState(): %s: Null State.\n", name.c_str() );
}
state = newState;
@ -5795,7 +5797,7 @@ idEntity::UpdateScript
=====================
*/
void idEntity::UpdateScript( void ) {
int i;
int i;
// a series of state changes can happen in a single frame.
// this loop limits them in case we've entered an infinite loop.
@ -5928,8 +5930,8 @@ idEntity::IsInUse
================
*/
bool IsInUse( void ) {
if (scriptThread != NULL) {
return (scriptThread->IsBusy());
if ( scriptThread != NULL ) {
return ( scriptThread->IsBusy() );
}
return false;
@ -5953,9 +5955,9 @@ idEntity::Event_SpawnProjectiles
================
*/
void idEntity::Event_SpawnProjectiles( int num_projectiles, float spread, float fuseOffset, float launchPower, float dmgPower ) {
idProjectile *proj;
idProjectile *proj;
idEntity *ent;
int i;
int i;
idVec3 dir;
float ang;
float spin;
@ -5979,7 +5981,7 @@ void idEntity::Event_SpawnProjectiles( int num_projectiles, float spread, float
playerViewAxis = physics->GetAxis();
if ( !projectileDict.GetNumKeyVals() ) {
const char *classname = this->spawnArgs.GetString("inv_name");
const char *classname = this->spawnArgs.GetString( "inv_name" );
gameLocal.Warning( "No projectile defined on '%s'", classname );
return;
}
@ -6033,7 +6035,7 @@ void idEntity::Event_SpawnProjectiles( int num_projectiles, float spread, float
ent->fl.networkSync = false;
}
proj = static_cast<idProjectile *>(ent);
proj = static_cast<idProjectile *>( ent );
proj->Create( owner, playerViewOrigin, dir );
projBounds = proj->GetPhysics()->GetBounds().Rotate( proj->GetPhysics()->GetAxis() );
@ -6086,7 +6088,7 @@ idEntity::Event_GetMaster
================
*/
void idEntity::Event_GetMaster( void ) {
idThread::ReturnEntity(bindMaster);
idThread::ReturnEntity( bindMaster );
}
/*
@ -6096,7 +6098,7 @@ idEntity::Event_GetModelDims
================
*/
void idEntity::Event_GetModelDims( void ) {
idThread::ReturnVector(GetModelDims());
idThread::ReturnVector( GetModelDims() );
}
/*
@ -6108,9 +6110,9 @@ idEntity::GetModelDims
idVec3 idEntity::GetModelDims( void ) {
idVec3 a;
if ( renderEntity.hModel ) {
a.x = abs(renderEntity.bounds.GetMaxs().x) + abs(renderEntity.bounds.GetMins().x);
a.y = abs(renderEntity.bounds.GetMaxs().y) + abs(renderEntity.bounds.GetMins().y);
a.z = abs(renderEntity.bounds.GetMaxs().z) + abs(renderEntity.bounds.GetMins().z);
a.x = abs( renderEntity.bounds.GetMaxs().x ) + abs( renderEntity.bounds.GetMins().x );
a.y = abs( renderEntity.bounds.GetMaxs().y ) + abs( renderEntity.bounds.GetMins().y );
a.z = abs( renderEntity.bounds.GetMaxs().z ) + abs( renderEntity.bounds.GetMins().z );
} else {
a.Zero();
}
@ -6124,7 +6126,7 @@ idEntity::Event_ResetGravity
================
*/
void idEntity::Event_ResetGravity( void ) {
physics->SetGravity(gameLocal.GetGravity());
physics->SetGravity( gameLocal.GetGravity() );
}
// HEXEN : Zeroth - broken
@ -6196,4 +6198,4 @@ idEntity::curGrav
*/
idVec3 idEntity::curGrav() {
return physics->GetGravity();
}
}

View file

@ -4775,7 +4775,7 @@ idGameLocal::InitHub
*/
void idGameLocal::InitHub( void ) {
idEntity* ent;
idStr name,tmp,name_str,st;
idStr name, tmp, name_str, st;
int nt = 0;
idVec3 vc;
idAngles ag;
@ -4809,7 +4809,7 @@ void idGameLocal::InitHub( void ) {
if ( persistentLevelInfo.GetInt( name_str ) ) {
delete ent;
gameLocal.entities[i]=NULL;
gameLocal.entities[i] = NULL;
continue;
}
@ -4819,10 +4819,10 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st == "on" ) {
static_cast<idTrigger *>(gameLocal.entities[i])->Enable();
static_cast<idTrigger *>( gameLocal.entities[i] )->Enable();
continue;
} else if ( st == "off" ) {
static_cast<idTrigger *>(gameLocal.entities[i])->Disable();
static_cast<idTrigger *>( gameLocal.entities[i] )->Disable();
continue;
}
@ -4832,10 +4832,10 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st == "on" ) {
static_cast<idTrigger_Timer *>(gameLocal.entities[i])->Enable();
static_cast<idTrigger_Timer *>( gameLocal.entities[i] )->Enable();
continue;
} else if ( st == "off" ) {
static_cast<idTrigger_Timer *>(gameLocal.entities[i])->Disable();
static_cast<idTrigger_Timer *>( gameLocal.entities[i] )->Disable();
continue;
}
@ -4845,10 +4845,10 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st == "on" ) {
static_cast<idTrigger_Touch *>(gameLocal.entities[i])->Enable();
static_cast<idTrigger_Touch *>( gameLocal.entities[i] )->Enable();
continue;
} else if ( st == "off" ) {
static_cast<idTrigger_Touch *>(gameLocal.entities[i])->Disable();
static_cast<idTrigger_Touch *>( gameLocal.entities[i] )->Disable();
continue;
}
@ -4859,7 +4859,7 @@ void idGameLocal::InitHub( void ) {
if ( st != "" ) {
nt = persistentLevelInfo.GetInt( name_str );
static_cast<idTrigger_Count *>(gameLocal.entities[i])->SetCount( nt );
static_cast<idTrigger_Count *>( gameLocal.entities[i] )->SetCount( nt );
continue;
}
@ -4870,7 +4870,7 @@ void idGameLocal::InitHub( void ) {
if ( st != "" ) {
nt = persistentLevelInfo.GetInt( name_str );
static_cast<idTrigger_Count *>(gameLocal.entities[i])->SetGoal( nt );
static_cast<idTrigger_Count *>( gameLocal.entities[i] )->SetGoal( nt );
continue;
}
@ -4880,7 +4880,7 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st == "1" ) {
static_cast<idLight *>(gameLocal.entities[i])->BecomeBroken( NULL );
static_cast<idLight *>( gameLocal.entities[i] )->BecomeBroken( NULL );
continue;
}
@ -4890,10 +4890,10 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st == "on" ) {
static_cast<idLight *>(gameLocal.entities[i])->On();
static_cast<idLight *>( gameLocal.entities[i] )->On();
continue;
} else if ( st == "off" ) {
static_cast<idLight *>(gameLocal.entities[i])->Off();
static_cast<idLight *>( gameLocal.entities[i] )->Off();
continue;
}
@ -4904,8 +4904,8 @@ void idGameLocal::InitHub( void ) {
if ( st != "" ) {
vc = persistentLevelInfo.GetVector( name_str );
static_cast<idMover *>(gameLocal.entities[i])->GetPhysics()->SetOrigin( vc );
static_cast<idMover *>(gameLocal.entities[i])->SetDestPos( vc );
static_cast<idMover *>( gameLocal.entities[i] )->GetPhysics()->SetOrigin( vc );
static_cast<idMover *>( gameLocal.entities[i] )->SetDestPos( vc );
continue;
}
@ -4917,7 +4917,7 @@ void idGameLocal::InitHub( void ) {
if ( st != "" ) {
ag = persistentLevelInfo.GetAngles( name_str );
ag.Normalize360();
static_cast<idPhysics_Parametric *>(static_cast<idMover *>(gameLocal.entities[i])->GetPhysics())->SetAngularExtrapolation( EXTRAPOLATION_NONE, 0, 0, ag, ang_zero, ang_zero );
static_cast<idPhysics_Parametric *>( static_cast<idMover *>( gameLocal.entities[i] )->GetPhysics() )->SetAngularExtrapolation( EXTRAPOLATION_NONE, 0, 0, ag, ang_zero, ang_zero );
continue;
}
@ -4927,13 +4927,13 @@ void idGameLocal::InitHub( void ) {
st = persistentLevelInfo.GetString( name_str );
if ( st != "" ) {
static_cast<idPhysics_Parametric *>(static_cast<idMoveable *>(gameLocal.entities[i])->GetPhysics())->SetOrigin( persistentLevelInfo.GetVector( name_str ) );
static_cast<idPhysics_Parametric *>( static_cast<idMoveable *>(gameLocal .entities[i] )->GetPhysics() )->SetOrigin( persistentLevelInfo.GetVector( name_str ) );
name_str = tmp;
name_str += "_moveable_ang";
static_cast<idMoveable *>(gameLocal.entities[i])->SetAngles( persistentLevelInfo.GetAngles( name_str ) );
static_cast<idMoveable *>( gameLocal.entities[i] )->SetAngles( persistentLevelInfo.GetAngles( name_str ) );
name_str = tmp;
name_str += "_moveable_vel";
static_cast<idPhysics_Parametric *>(static_cast<idMoveable *>(gameLocal.entities[i])->GetPhysics())->SetLinearVelocity( persistentLevelInfo.GetVector( name_str ) );
static_cast<idPhysics_Parametric *>( static_cast<idMoveable *>( gameLocal.entities[i] )->GetPhysics() )->SetLinearVelocity( persistentLevelInfo.GetVector( name_str ) );
continue;
}
}
@ -5111,27 +5111,27 @@ Zeroth
idGameLocal::SavePersistentMoveables
===============
*/
void idGameLocal::SavePersistentMoveables(void) {
void idGameLocal::SavePersistentMoveables( void ) {
idEntity* ent;
idStr tmp, name_str, st, name;
int nt = 0;
// idVec3 vc;
idAngles ag;
for (int i = 0; i < MAX_GENTITIES; i++ ) {
for ( int i = 0; i < MAX_GENTITIES; i++ ) {
ent = gameLocal.entities[i];
if (ent) {
if ( ent ) {
name = ent->GetEntityDefName();
// find moveables locations
if ( name.Left(9) == "moveable_" ) {
/*
if ( name.Left( 9 ) == "moveable_" ) {
#if 0
vc = ent->GetPhysics()->GetOrigin();
if ( vc == ent->spawnArgs.GetVector("origin") ) {
if ( vc == ent->spawnArgs.GetVector( "origin" ) ) {
continue;
}
*/
#endif
if ( static_cast<idMoveable *>( ent )->savePersistentInfo == false ) {
continue;
@ -5157,4 +5157,4 @@ void idGameLocal::SavePersistentMoveables(void) {
}
}
}
}
}

View file

@ -71,17 +71,17 @@ CLASS_DECLARATION( idEntity, idItem )
EVENT( EV_RespawnItem, idItem::Event_Respawn )
EVENT( EV_RespawnFx, idItem::Event_RespawnFx )
// EVENT( EV_SetNextState, idItem::Event_SetNextState )
// EVENT( EV_SetState, idItem::Event_SetState )
// EVENT( EV_GetState, idItem::Event_GetState )
// EVENT( EV_SetState, idItem::Event_SetState )
// EVENT( EV_GetState, idItem::Event_GetState )
// HEXEN : Zeroth
EVENT( EV_ArtifactStart, idItem::Event_ArtifactStart )
EVENT( EV_ArtifactDone, idItem::Event_ArtifactDone )
EVENT( EV_ArtifactDone, idItem::Event_ArtifactDone )
EVENT( EV_ArtifactCoolDown, idItem::Event_ArtifactCoolDown )
EVENT( EV_SetArtifactActive, idItem::Event_SetArtifactActive )
EVENT( EV_OwnerLaunchProjectiles, idItem::Event_OwnerLaunchProjectiles )
EVENT( EV_OwnerCreateProjectile, idItem::Event_OwnerCreateProjectile )
EVENT( EV_GetOwner, idItem::Event_GetOwner )
EVENT( EV_HideMultiModel, idItem::Event_HideMultiModel )
EVENT( EV_OwnerLaunchProjectiles, idItem::Event_OwnerLaunchProjectiles )
EVENT( EV_OwnerCreateProjectile, idItem::Event_OwnerCreateProjectile )
EVENT( EV_GetOwner, idItem::Event_GetOwner )
EVENT( EV_HideMultiModel, idItem::Event_HideMultiModel )
END_CLASS
@ -585,8 +585,8 @@ bool idItem::GiveToPlayer( idPlayer *player ) {
}
if ( val ) {
if ( spawnArgs.GetString("scriptobject") != "" ) {
if ( !g_noPickupNotification.GetBool() && !spawnArgs.GetBool("dontNotifyOnPickup") ) {
if ( spawnArgs.GetString( "scriptobject" ) != "" ) {
if ( !g_noPickupNotification.GetBool() && !spawnArgs.GetBool( "dontNotifyOnPickup" ) ) {
CallFunc( "pickup_message" );
}
CallFunc( "pickup_effect" );
@ -1814,7 +1814,9 @@ idItem::SetOwner
================
*/
void idItem::SetOwner( idPlayer *_owner ) {
#ifdef _DEBUG && 0
assert( !owner );
#endif
owner = _owner;
lastOwner = _owner;
// SetName( va( "%s_weapon", owner->name.c_str() ) );
@ -1833,7 +1835,9 @@ idItem::CallFunc
bool idItem::CallFunc( char *funcName ) {
const function_t *func = GetScriptFunction( (const char*) funcName );
if ( !func ) {
#ifdef _DEBUG && 0
assert( 0 );
#endif
gameLocal.Error( "Can't find function use' in object '%s'", scriptObject.GetTypeName() );
return false;
}

View file

@ -1,9 +1,9 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Game_local.h"
#include "../Moveable.h"
#include "Entity.h"
#include "Game_local.h"
#include "Moveable.h"
#include "AI.h"
#include "AI_Golem.h"

View file

@ -3,7 +3,7 @@
#pragma hdrstop
#include "../Game_local.h"
#include "Game_local.h"
const idVec3 GOLEM_TRACE_MINS = idVec3(-1,-1,-1);
const idVec3 GOLEM_TRACE_MAXS = idVec3(-1,-1,-1);

View file

@ -1,7 +1,7 @@
#pragma hdrstop
#include "../Game_local.h"
#include "Game_local.h"
const int SHADOWSPAWN_RANGE_ATTACK_RATE = 3;
const int SHADOWSPAWN_DRAIN_RATE = 10;

View file

@ -1,7 +1,7 @@
#pragma hdrstop
#include "../Entity.h"
#include "Entity.h"
#include "AI.h"
#include "AI_Veloxite.h"

View file

@ -1,7 +1,7 @@
#pragma hdrstop
#include "../Game_local.h"
#include "Game_local.h"
CLASS_DECLARATION( idEntity, idEntity_MultiModel )

View file

@ -1,8 +1,8 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Moveable.h"
#include "Entity.h"
#include "Moveable.h"
#include "Leaf.h"
CLASS_DECLARATION( idMoveable, idEntity_Leaf )

View file

@ -1,8 +1,8 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Game_local.h"
#include "Entity.h"
#include "Game_local.h"
#include "LeafEmitter.h"
CLASS_DECLARATION( idEntity, idEntity_LeafEmitter )

View file

@ -1,8 +1,8 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Misc.h"
#include "Entity.h"
#include "Misc.h"
#include "Tree.h"
CLASS_DECLARATION( idAnimated, idAnimated_Tree )

View file

@ -981,8 +981,9 @@ ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, co
}
gameLocal.Printf( " from (%.2f %.2f %.2f) to (%.2f %.2f %.2f)\n", start.x, start.y, start.z, end.x, end.y, end.z);
#ifdef _DEBUG && 0
assert( 0 );
#endif
return true;
}
return false;

View file

@ -1,10 +1,10 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Player.h"
#include "../Projectile.h"
#include "../ai/AI.h"
#include "Game_local.h"
#include "Player.h"
#include "Projectile.h"
#include "ai/AI.h"
#include "FireStorm.h"

View file

@ -1,8 +1,8 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Projectile.h"
#include "Game_local.h"
#include "Projectile.h"
#include "Soul.h"

View file

@ -1,12 +1,12 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Player.h"
#include "../Projectile.h"
#include "../ai/AI.h"
#include "../ai/AI_Golem.h"
#include "../ai/AI_Veloxite.h"
#include "Game_local.h"
#include "Player.h"
#include "Projectile.h"
#include "ai/AI.h"
#include "ai/AI_Golem.h"
#include "ai/AI_Veloxite.h"
#include "Wraithverge.h"

View file

@ -230,8 +230,10 @@ ID_INLINE void idScriptVariable<type, etype, returnType>::LinkTo( idScriptObject
template<class type, etype_t etype, class returnType>
ID_INLINE idScriptVariable<type, etype, returnType> &idScriptVariable<type, etype, returnType>::operator=( const returnType &value ) {
#ifdef _DEBUG && 0
// check if we attempt to access the object before it's been linked
assert( data );
#endif
// make sure we don't crash if we don't have a pointer
if ( data ) {

View file

@ -26,15 +26,15 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "../../sys/platform.h"
#include "sys/platform.h"
#include "../Game_local.h"
#include "../gamesys/SysCvar.h"
#include "../Player.h"
#include "../Camera.h"
#include "../SmokeParticles.h"
#include "Game_local.h"
#include "gamesys/SysCvar.h"
#include "Player.h"
#include "Camera.h"
#include "SmokeParticles.h"
#include "Script_Thread.h"
#include "script/Script_Thread.h"
const idEventDef EV_Thread_Execute( "<execute>", NULL );
const idEventDef EV_Thread_SetCallback( "<script_setcallback>", NULL );

View file

@ -817,9 +817,9 @@ idDynamicBlock<type> *idDynamicBlockAlloc<type, baseBlockSize, minBlockSize>::Re
template<class type, int baseBlockSize, int minBlockSize>
void idDynamicBlockAlloc<type, baseBlockSize, minBlockSize>::FreeInternal( idDynamicBlock<type> *block ) {
#ifdef _DEBUG && 0
assert( block->node == NULL );
#endif
#ifdef DYNAMIC_BLOCK_ALLOC_CHECK
assert( block->id[0] == 0x11111111 && block->id[1] == 0x22222222 && block->id[2] == 0x33333333 && block->allocator == (void*)this );
#endif

View file

@ -370,7 +370,9 @@ idHashIndex::SetGranularity
================
*/
ID_INLINE void idHashIndex::SetGranularity( const int newGranularity ) {
#ifdef _DEBUG && 0
assert( newGranularity > 0 );
#endif
granularity = newGranularity;
}

View file

@ -151,8 +151,9 @@ idList<type>::idList( int )
*/
template< class type >
ID_INLINE idList<type>::idList( int newgranularity ) {
assert( newgranularity > 0 );
#ifdef _DEBUG && 0
assert( newGranularity > 0 );
#endif
list = NULL;
granularity = newgranularity;
Clear();
@ -311,7 +312,9 @@ template< class type >
ID_INLINE void idList<type>::SetGranularity( int newgranularity ) {
int newsize;
assert( newgranularity > 0 );
#ifdef _DEBUG && 0
assert( newGranularity > 0 );
#endif
granularity = newgranularity;
if ( list ) {
@ -417,9 +420,11 @@ ID_INLINE void idList<type>::Resize( int newsize, int newgranularity ) {
type *temp;
int i;
#ifdef _DEBUG && 0
assert( newsize >= 0 );
assert( newgranularity > 0 );
assert( newGranularity > 0 );
#endif
granularity = newgranularity;
// free up the list if no data is being reserved
@ -591,8 +596,10 @@ Release builds do no range checking.
*/
template< class type >
ID_INLINE type &idList<type>::operator[]( int index ) {
#ifdef _DEBUG && 0
assert( index >= 0 );
assert( index < num );
#endif
return list[ index ];
}

View file

@ -154,8 +154,10 @@ ID_INLINE void idStrPool::FreeString( const idPoolStr *poolStr ) {
}
}
}
#ifdef _DEBUG && 0
assert( i != -1 );
assert( pool[i] == poolStr );
#endif
delete pool[i];
pool.RemoveIndex( i );
poolHash.RemoveIndex( hash, i );