diff --git a/neo/d3xp/Achievements.cpp b/neo/d3xp/Achievements.cpp index cf6e8e01..1034dd97 100644 --- a/neo/d3xp/Achievements.cpp +++ b/neo/d3xp/Achievements.cpp @@ -109,8 +109,8 @@ idAchievementManager::idAchievementManager ======================== */ idAchievementManager::idAchievementManager() : - lastImpKilledTime( 0 ), lastPlayerKilledTime( 0 ), + lastImpKilledTime( 0 ), playerTookDamage( false ) { counts.Zero(); diff --git a/neo/d3xp/Actor.cpp b/neo/d3xp/Actor.cpp index f4a79829..bd8e594e 100644 --- a/neo/d3xp/Actor.cpp +++ b/neo/d3xp/Actor.cpp @@ -491,7 +491,7 @@ idActor::idActor() waitState = ""; - blink_anim = NULL; + blink_anim = 0; blink_time = 0; blink_min = 0; blink_max = 0; @@ -3679,7 +3679,7 @@ idActor::Event_HasAnim */ void idActor::Event_HasAnim( int channel, const char* animname ) { - if( GetAnim( channel, animname ) != NULL ) + if( GetAnim( channel, animname ) != 0 ) { idThread::ReturnFloat( 1.0f ); } diff --git a/neo/d3xp/Entity.cpp b/neo/d3xp/Entity.cpp index 98620dda..e2a2d3e9 100644 --- a/neo/d3xp/Entity.cpp +++ b/neo/d3xp/Entity.cpp @@ -412,7 +412,7 @@ void idEntity::UpdateChangeableSpawnArgs( const idDict* source ) } cameraTarget = NULL; target = source->GetString( "cameraTarget" ); - if( target != NULL && target[0] != NULL ) + if( target != NULL && target[0] != '\0' ) { // update the camera taget PostEventMS( &EV_UpdateCameraTarget, 0 ); @@ -560,7 +560,7 @@ void idEntity::Spawn() cameraTarget = NULL; temp = spawnArgs.GetString( "cameraTarget" ); - if( temp != NULL && temp[0] != NULL ) + if( temp != NULL && temp[0] != '\0' ) { // update the camera taget PostEventMS( &EV_UpdateCameraTarget, 0 ); @@ -624,7 +624,7 @@ void idEntity::Spawn() SetAxis( axis ); temp = spawnArgs.GetString( "model" ); - if( temp != NULL && *temp != NULL ) + if( temp != NULL && *temp != '\0' ) { SetModel( temp ); } diff --git a/neo/d3xp/GameEdit.cpp b/neo/d3xp/GameEdit.cpp index b27fc2df..9a3167fc 100644 --- a/neo/d3xp/GameEdit.cpp +++ b/neo/d3xp/GameEdit.cpp @@ -1210,7 +1210,7 @@ int idGameEdit::MapGetUniqueMatchingKeyVals( const char* key, const char* list[] if( ent ) { const char* k = ent->epairs.GetString( key ); - if( k != NULL && *k != NULL && count < max ) + if( k != NULL && *k != '\0' && count < max ) { list[count++] = k; } diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index c13d0c4f..1e89d212 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/d3xp/Game_local.cpp @@ -73,7 +73,7 @@ idCVar net_usercmd_timing_debug( "net_usercmd_timing_debug", "0", CVAR_BOOL, "Pr // List of all defs used by the player that will stay on the fast timeline -static char* fastEntityList[] = +static const char* fastEntityList[] = { "player_doommarine", "weapon_chainsaw", @@ -744,7 +744,7 @@ void idGameLocal::SetPersistentPlayerInfo( int clientNum, const idDict& playerIn idGameLocal::Printf ============ */ -void idGameLocal::Printf( const char* fmt, ... ) const +void idGameLocal::Printf( const char* fmt, ... ) const // DG: FIXME: printf-annotation { va_list argptr; char text[MAX_STRING_CHARS]; diff --git a/neo/d3xp/Item.cpp b/neo/d3xp/Item.cpp index dcb5c69b..90477c60 100644 --- a/neo/d3xp/Item.cpp +++ b/neo/d3xp/Item.cpp @@ -471,7 +471,7 @@ bool idItem::Pickup( idPlayer* player ) if( respawn && !dropped && !no_respawn ) { const char* sfx = spawnArgs.GetString( "fxRespawn" ); - if( sfx != NULL && *sfx != NULL ) + if( sfx != NULL && *sfx != '\0' ) { PostEventSec( &EV_RespawnFx, respawn - 0.5f ); } @@ -677,7 +677,7 @@ void idItem::Event_RespawnFx() ServerSendEvent( EVENT_RESPAWNFX, NULL, false ); } const char* sfx = spawnArgs.GetString( "fxRespawn" ); - if( sfx != NULL && *sfx != NULL ) + if( sfx != NULL && *sfx != '\0' ) { idEntityFx::StartFx( sfx, NULL, NULL, this, true ); } @@ -888,7 +888,7 @@ void idItemTeam::Spawn() idItemTeam::LoadScript =============== */ -function_t* idItemTeam::LoadScript( char* script ) +function_t* idItemTeam::LoadScript( const char* script ) { function_t* function = NULL; idStr funcname = spawnArgs.GetString( script, "" ); diff --git a/neo/d3xp/Item.h b/neo/d3xp/Item.h index 4d363336..e2fdddd3 100644 --- a/neo/d3xp/Item.h +++ b/neo/d3xp/Item.h @@ -282,7 +282,7 @@ private: void Event_FlagCapture(); void PrivateReturn(); - function_t* LoadScript( char* script ); + function_t* LoadScript( const char* script ); void SpawnNugget( idVec3 pos ); void UpdateGuis(); diff --git a/neo/d3xp/Light.cpp b/neo/d3xp/Light.cpp index 87e4b0ec..0c7c6ef8 100644 --- a/neo/d3xp/Light.cpp +++ b/neo/d3xp/Light.cpp @@ -756,7 +756,7 @@ void idLight::BecomeBroken( idEntity* activator ) // if the light has a sound, either start the alternate (broken) sound, or stop the sound const char* parm = spawnArgs.GetString( "snd_broken" ); - if( refSound.shader || ( parm != NULL && *parm != NULL ) ) + if( refSound.shader || ( parm != NULL && *parm != '\0' ) ) { StopSound( SND_CHANNEL_ANY, false ); const idSoundShader* alternate = refSound.shader ? refSound.shader->GetAltSound() : declManager->FindSound( parm ); @@ -768,7 +768,7 @@ void idLight::BecomeBroken( idEntity* activator ) } parm = spawnArgs.GetString( "mtr_broken" ); - if( parm != NULL && *parm != NULL ) + if( parm != NULL && *parm != '\0' ) { SetShader( parm ); } diff --git a/neo/d3xp/Misc.cpp b/neo/d3xp/Misc.cpp index 7e271da6..ae3d48e6 100644 --- a/neo/d3xp/Misc.cpp +++ b/neo/d3xp/Misc.cpp @@ -2226,7 +2226,7 @@ void idFuncSplat::Event_Splat() for( int i = 0; i < count; i++ ) { splat = spawnArgs.RandomPrefix( "mtr_splat", gameLocal.random ); - if( splat != NULL && *splat != NULL ) + if( splat != NULL && *splat != '\0' ) { float size = spawnArgs.GetFloat( "splatSize", "128" ); float dist = spawnArgs.GetFloat( "splatDistance", "128" ); @@ -3512,7 +3512,7 @@ void idFuncRadioChatter::Event_Activate( idEntity* activator ) } const char* sound = spawnArgs.GetString( "snd_radiochatter", "" ); - if( sound != NULL && *sound != NULL ) + if( sound != NULL && *sound != '\0' ) { const idSoundShader* shader = declManager->FindSound( sound ); int length = 0; diff --git a/neo/d3xp/Moveable.cpp b/neo/d3xp/Moveable.cpp index 65de9054..9c4484ec 100644 --- a/neo/d3xp/Moveable.cpp +++ b/neo/d3xp/Moveable.cpp @@ -1298,7 +1298,7 @@ void idExplodingBarrel::Killed( idEntity* inflictor, idEntity* attacker, int dam physicsObj.SetContents( 0 ); const char* splash = spawnArgs.GetString( "def_splash_damage", "damage_explosion" ); - if( splash != NULL && *splash != NULL ) + if( splash != NULL && *splash != '\0' ) { gameLocal.RadiusDamage( GetPhysics()->GetOrigin(), this, attacker, this, this, splash ); } @@ -1451,7 +1451,7 @@ void idExplodingBarrel::Event_Respawn() } } const char* temp = spawnArgs.GetString( "model" ); - if( temp != NULL && *temp != NULL ) + if( temp != NULL && *temp != '\0' ) { SetModel( temp ); } diff --git a/neo/d3xp/Mover.cpp b/neo/d3xp/Mover.cpp index 33d7151a..eaf10371 100644 --- a/neo/d3xp/Mover.cpp +++ b/neo/d3xp/Mover.cpp @@ -4110,7 +4110,7 @@ void idDoor::Lock( int f ) { // in this case the sound trigger never got spawned const char* sndtemp = door->spawnArgs.GetString( "snd_locked" ); - if( sndtemp != NULL && *sndtemp != NULL ) + if( sndtemp != NULL && *sndtemp != '\0' ) { door->PostEventMS( &EV_Door_SpawnSoundTrigger, 0 ); } @@ -4298,7 +4298,7 @@ void idDoor::Event_SpawnDoorTrigger() } const char* sndtemp = spawnArgs.GetString( "snd_locked" ); - if( spawnArgs.GetInt( "locked" ) && sndtemp != NULL && *sndtemp != NULL ) + if( spawnArgs.GetInt( "locked" ) && sndtemp != NULL && *sndtemp != '\0' ) { PostEventMS( &EV_Door_SpawnSoundTrigger, 0 ); } diff --git a/neo/d3xp/MultiplayerGame.cpp b/neo/d3xp/MultiplayerGame.cpp index 4090f5ab..d4df8fcd 100644 --- a/neo/d3xp/MultiplayerGame.cpp +++ b/neo/d3xp/MultiplayerGame.cpp @@ -3736,7 +3736,7 @@ idMultiplayerGame::GetTeamFlag */ void idMultiplayerGame::FindTeamFlags() { - char* flagDefs[2] = + const char* flagDefs[2] = { "team_CTF_redflag", "team_CTF_blueflag" diff --git a/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index 2c664190..9a55fd34 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/d3xp/Player.cpp @@ -1729,7 +1729,7 @@ void idPlayer::SetupWeaponEntity() for( w = 0; w < MAX_WEAPONS; w++ ) { weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); - if( weap != NULL && *weap != NULL ) + if( weap != NULL && *weap != '\0' ) { idWeapon::CacheWeapon( weap ); } @@ -4936,7 +4936,7 @@ idDict* idPlayer::FindInventoryItem( const char* name ) for( int i = 0; i < inventory.items.Num(); i++ ) { const char* iname = inventory.items[i]->GetString( "inv_name" ); - if( iname != NULL && *iname != NULL ) + if( iname != NULL && *iname != '\0' ) { if( idStr::Icmp( name, iname ) == 0 ) { diff --git a/neo/d3xp/Projectile.cpp b/neo/d3xp/Projectile.cpp index 9c65cca9..9758b0d2 100644 --- a/neo/d3xp/Projectile.cpp +++ b/neo/d3xp/Projectile.cpp @@ -942,7 +942,7 @@ void idProjectile::Fizzle() // fizzle FX const char* psystem = spawnArgs.GetString( "smoke_fuse" ); - if( psystem != NULL && *psystem != NULL ) + if( psystem != NULL && *psystem != '\0' ) { //FIXME:SMOKE gameLocal.particles->SpawnParticles( GetPhysics()->GetOrigin(), vec3_origin, psystem ); } @@ -1114,7 +1114,7 @@ void idProjectile::Explode( const trace_t& collision, idEntity* ignore ) } int surfaceType = collision.c.material != NULL ? collision.c.material->GetSurfaceType() : SURFTYPE_METAL; - if( !( fxname != NULL && *fxname != NULL ) ) + if( !( fxname != NULL && *fxname != '\0' ) ) { if( ( surfaceType == SURFTYPE_NONE ) || ( surfaceType == SURFTYPE_METAL ) || ( surfaceType == SURFTYPE_STONE ) ) { @@ -2328,7 +2328,7 @@ void idBFGProjectile::Spawn() memset( &secondModel, 0, sizeof( secondModel ) ); secondModelDefHandle = -1; const char* temp = spawnArgs.GetString( "model_two" ); - if( temp != NULL && *temp != NULL ) + if( temp != NULL && *temp != '\0' ) { secondModel.hModel = renderModelManager->FindModel( temp ); secondModel.bounds = secondModel.hModel->Bounds( &secondModel ); @@ -2551,7 +2551,7 @@ void idBFGProjectile::Launch( const idVec3& start, const idVec3& dir, const idVe memset( &secondModel, 0, sizeof( secondModel ) ); secondModelDefHandle = -1; const char* temp = spawnArgs.GetString( "model_two" ); - if( temp != NULL && *temp != NULL ) + if( temp != NULL && *temp != '\0' ) { secondModel.hModel = renderModelManager->FindModel( temp ); secondModel.bounds = secondModel.hModel->Bounds( &secondModel ); diff --git a/neo/d3xp/Target.cpp b/neo/d3xp/Target.cpp index 6f3ea69a..491fa924 100644 --- a/neo/d3xp/Target.cpp +++ b/neo/d3xp/Target.cpp @@ -1238,7 +1238,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity* activator ) } parm = spawnArgs.GetString( "snd_influence" ); - if( parm != NULL && *parm != NULL ) + if( parm != NULL && *parm != '\0' ) { PostEventSec( &EV_StartSoundShader, flashIn, parm, SND_CHANNEL_ANY ); } @@ -1356,7 +1356,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity* activator ) } parm = spawnArgs.GetString( "mtrWorld" ); - if( parm != NULL && *parm != NULL ) + if( parm != NULL && *parm != '\0' ) { gameLocal.SetGlobalMaterial( declManager->FindMaterial( parm ) ); } @@ -1809,7 +1809,7 @@ void idTarget_EnableLevelWeapons::Event_Activate( idEntity* activator ) if( gameLocal.entities[ i ] ) { gameLocal.entities[ i ]->ProcessEvent( &EV_Player_EnableWeapon ); - if( weap != NULL && weap[ 0 ] != NULL ) + if( weap != NULL && weap[ 0 ] != '\0' ) { gameLocal.entities[ i ]->PostEventSec( &EV_Player_SelectWeapon, 0.5f, weap ); } diff --git a/neo/d3xp/Weapon.cpp b/neo/d3xp/Weapon.cpp index 0b8d3264..01d25f83 100644 --- a/neo/d3xp/Weapon.cpp +++ b/neo/d3xp/Weapon.cpp @@ -4630,7 +4630,7 @@ void idWeapon::Event_Melee() const char* decal; // project decal decal = weaponDef->dict.GetString( "mtr_strike" ); - if( decal != NULL && *decal != NULL ) + if( decal != NULL && *decal != '\0' ) { gameLocal.ProjectDecal( tr.c.point, -tr.c.normal, 8.0f, true, 6.0, decal ); } diff --git a/neo/d3xp/ai/AI.cpp b/neo/d3xp/ai/AI.cpp index 219aef91..e40353ec 100644 --- a/neo/d3xp/ai/AI.cpp +++ b/neo/d3xp/ai/AI.cpp @@ -5033,7 +5033,7 @@ void idAI::DirectDamage( const char* meleeDefName, idEntity* ent ) // do the damage // p = meleeDef->GetString( "snd_hit" ); - if( p != NULL && *p != NULL ) + if( p != NULL && *p != '\0' ) { shader = declManager->FindSound( p ); StartSoundShader( shader, SND_CHANNEL_DAMAGE, 0, false, NULL ); @@ -5135,7 +5135,7 @@ bool idAI::AttackMelee( const char* meleeDefName ) if( enemyEnt == NULL ) { p = meleeDef->GetString( "snd_miss" ); - if( p != NULL && *p != NULL ) + if( p != NULL && *p != '\0' ) { shader = declManager->FindSound( p ); StartSoundShader( shader, SND_CHANNEL_DAMAGE, 0, false, NULL ); @@ -5173,7 +5173,7 @@ bool idAI::AttackMelee( const char* meleeDefName ) { // missed p = meleeDef->GetString( "snd_miss" ); - if( p != NULL && *p != NULL ) + if( p != NULL && *p != '\0' ) { shader = declManager->FindSound( p ); StartSoundShader( shader, SND_CHANNEL_DAMAGE, 0, false, NULL ); @@ -5185,7 +5185,7 @@ bool idAI::AttackMelee( const char* meleeDefName ) // do the damage // p = meleeDef->GetString( "snd_hit" ); - if( p != NULL && *p != NULL ) + if( p != NULL && *p != '\0' ) { shader = declManager->FindSound( p ); StartSoundShader( shader, SND_CHANNEL_DAMAGE, 0, false, NULL ); @@ -5429,7 +5429,7 @@ void idAI::SetChatSound() snd = NULL; } - if( snd != NULL && *snd != NULL ) + if( snd != NULL && *snd != '\0' ) { chat_snd = declManager->FindSound( snd ); diff --git a/neo/d3xp/gamesys/SysCmds.cpp b/neo/d3xp/gamesys/SysCmds.cpp index 2fbc5e27..e48e5d94 100644 --- a/neo/d3xp/gamesys/SysCmds.cpp +++ b/neo/d3xp/gamesys/SysCmds.cpp @@ -544,7 +544,7 @@ argv(0) god */ void Cmd_God_f( const idCmdArgs& args ) { - char* msg; + const char* msg; idPlayer* player; player = gameLocal.GetLocalPlayer(); @@ -578,7 +578,7 @@ argv(0) notarget */ void Cmd_Notarget_f( const idCmdArgs& args ) { - char* msg; + const char* msg; idPlayer* player; player = gameLocal.GetLocalPlayer(); @@ -610,7 +610,7 @@ argv(0) noclip */ void Cmd_Noclip_f( const idCmdArgs& args ) { - char* msg; + const char* msg; idPlayer* player; player = gameLocal.GetLocalPlayer(); diff --git a/neo/d3xp/menus/MenuHandler_PDA.cpp b/neo/d3xp/menus/MenuHandler_PDA.cpp index deb7370b..875295a5 100644 --- a/neo/d3xp/menus/MenuHandler_PDA.cpp +++ b/neo/d3xp/menus/MenuHandler_PDA.cpp @@ -317,7 +317,7 @@ void idMenuHandler_PDA::Initialize( const char* swfFile, idSoundWorld* sw ) { const char* weaponDefName = va( "def_weapon%d", j ); const char* weap = player->spawnArgs.GetString( weaponDefName ); - if( weap != NULL && *weap != NULL ) + if( weap != NULL && *weap != '\0' ) { const idDeclEntityDef* weaponDef = gameLocal.FindEntityDef( weap, false ); if( weaponDef != NULL ) @@ -711,4 +711,4 @@ idMenuHandler_PDA::~idMenuHandler_PDA() navBar.Cleanup(); commandBarWidget.Cleanup(); Cleanup(); -} \ No newline at end of file +} diff --git a/neo/d3xp/menus/MenuScreen_HUD.cpp b/neo/d3xp/menus/MenuScreen_HUD.cpp index b6828442..c85db895 100644 --- a/neo/d3xp/menus/MenuScreen_HUD.cpp +++ b/neo/d3xp/menus/MenuScreen_HUD.cpp @@ -545,7 +545,7 @@ void idMenuScreen_HUD::GiveWeapon( idPlayer* player, int weaponIndex ) const char* weapnum = va( "def_weapon%d", weaponIndex ); const char* weap = player->spawnArgs.GetString( weapnum ); - if( weap != NULL && *weap != NULL ) + if( weap != NULL && *weap != '\0' ) { const idDeclEntityDef* weaponDef = gameLocal.FindEntityDef( weap, false ); if( weaponDef != NULL ) @@ -1141,7 +1141,7 @@ void idMenuScreen_HUD::UpdateWeaponStates( idPlayer* player, bool weaponChanged const idMaterial* hudIcon = NULL; const char* weapNum = weaponDefNames[ weaponIndex ]; const char* weap = player->spawnArgs.GetString( weapNum ); - if( weap != NULL && *weap != NULL ) + if( weap != NULL && *weap != '\0' ) { const idDeclEntityDef* weaponDef = gameLocal.FindEntityDef( weap, false ); if( weaponDef != NULL ) @@ -1205,7 +1205,7 @@ void idMenuScreen_HUD::UpdateWeaponStates( idPlayer* player, bool weaponChanged { hasWeapons = true; const char* weap = player->spawnArgs.GetString( weapnum ); - if( weap != NULL && *weap != NULL ) + if( weap != NULL && *weap != '\0' ) { weapstate++; } diff --git a/neo/d3xp/menus/MenuScreen_PDA_Inventory.cpp b/neo/d3xp/menus/MenuScreen_PDA_Inventory.cpp index 25e8ee99..8cebe634 100644 --- a/neo/d3xp/menus/MenuScreen_PDA_Inventory.cpp +++ b/neo/d3xp/menus/MenuScreen_PDA_Inventory.cpp @@ -123,7 +123,7 @@ void idMenuScreen_PDA_Inventory::ShowScreen( const mainMenuTransition_t transiti { const char* weap = GetWeaponName( j ); - if( weap == NULL || *weap == NULL ) + if( weap == NULL || *weap == '\0' ) { continue; } @@ -226,7 +226,7 @@ void idMenuScreen_PDA_Inventory::Update() { const char* weap = GetWeaponName( j ); - if( weap == NULL || *weap == NULL ) + if( weap == NULL || *weap == '\0' ) { continue; } @@ -313,7 +313,7 @@ void idMenuScreen_PDA_Inventory::EquipWeapon() { const char* weap = GetWeaponName( j ); - if( weap == NULL || *weap == NULL ) + if( weap == NULL || *weap == '\0' ) { continue; } @@ -443,4 +443,4 @@ bool idMenuScreen_PDA_Inventory::HandleAction( idWidgetAction& action, const idW } return idMenuWidget::HandleAction( action, event, widget, forceHandled ); -} \ No newline at end of file +} diff --git a/neo/d3xp/menus/MenuWidget.cpp b/neo/d3xp/menus/MenuWidget.cpp index 89d20a79..14352e11 100644 --- a/neo/d3xp/menus/MenuWidget.cpp +++ b/neo/d3xp/menus/MenuWidget.cpp @@ -36,15 +36,15 @@ idMenuWidget::idMenuWidget ======================== */ idMenuWidget::idMenuWidget() : + handlerIsParent( false ), + menuData( NULL ), + swfObj( NULL ), boundSprite( NULL ), parent( NULL ), dataSource( NULL ), dataSourceFieldIndex( 0 ), focusIndex( 0 ), widgetState( WIDGET_STATE_NORMAL ), - menuData( NULL ), - swfObj( NULL ), - handlerIsParent( false ), refCount( 0 ), noAutoFree( false ) { diff --git a/neo/d3xp/menus/MenuWidget_PDA_UserData.cpp b/neo/d3xp/menus/MenuWidget_PDA_UserData.cpp index 013ba2d6..8e646bb7 100644 --- a/neo/d3xp/menus/MenuWidget_PDA_UserData.cpp +++ b/neo/d3xp/menus/MenuWidget_PDA_UserData.cpp @@ -133,7 +133,7 @@ void idMenuWidget_PDA_UserData::Update() if( txtClearance != NULL ) { const char* security = pda->GetSecurity(); - if( *security == NULL ) + if( *security == '\0' ) { txtClearance->SetText( idLocalization::GetString( "#str_00066" ) ); } @@ -203,4 +203,4 @@ void idMenuWidget_PDA_UserData::ObserveEvent( const idMenuWidget& widget, const break; } } -} \ No newline at end of file +} diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index 9361bb7b..e426b70b 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -121,9 +121,9 @@ idCommonLocal::idCommonLocal idCommonLocal::idCommonLocal() : readSnapshotIndex( 0 ), writeSnapshotIndex( 0 ), + optimalPCTBuffer( 0.5f ), optimalTimeBuffered( 0.0f ), optimalTimeBufferedWindow( 0.0f ), - optimalPCTBuffer( 0.5f ), lastPacifierSessionTime( 0 ), lastPacifierGuiTime( 0 ), lastPacifierDialogState( false ), diff --git a/neo/framework/Common.h b/neo/framework/Common.h index a40eddc6..1f75164e 100644 --- a/neo/framework/Common.h +++ b/neo/framework/Common.h @@ -102,7 +102,7 @@ public: #define SCOPED_PROFILE_EVENT( x ) idScopedProfileEvent scopedProfileEvent_##__LINE__( x ) -ID_INLINE bool BeginTraceRecording( char* szName ) +ID_INLINE bool BeginTraceRecording( const char* szName ) { return false; } diff --git a/neo/framework/DebugGraph.cpp b/neo/framework/DebugGraph.cpp index da63cf43..44ccd5aa 100644 --- a/neo/framework/DebugGraph.cpp +++ b/neo/framework/DebugGraph.cpp @@ -42,11 +42,11 @@ idDebugGraph::idDebugGraph idDebugGraph::idDebugGraph( int numItems ) : bgColor( 0.0f, 0.0f, 0.0f, 0.5f ), fontColor( 1.0f, 1.0f, 1.0f, 1.0f ), - enable( true ), mode( GRAPH_FILL ), sideways( false ), border( 0.0f ), - position( 100.0f, 100.0f, 100.0f, 100.0f ) + position( 100.0f, 100.0f, 100.0f, 100.0f ), + enable( true ) { Init( numItems ); diff --git a/neo/framework/Unzip.cpp b/neo/framework/Unzip.cpp index 77a74d73..aacc8e17 100644 --- a/neo/framework/Unzip.cpp +++ b/neo/framework/Unzip.cpp @@ -475,11 +475,13 @@ static int unzlocal_GetCurrentFileInfoInternal( unzFile file, /* we check the magic */ if( err == UNZ_OK ) + { if( unzlocal_getLong( s->file, &uMagic ) != UNZ_OK ) err = UNZ_ERRNO; else if( uMagic != 0x02014b50 ) err = UNZ_BADZIPFILE; - + } + if( unzlocal_getShort( s->file, &file_info.version ) != UNZ_OK ) err = UNZ_ERRNO; @@ -555,10 +557,12 @@ static int unzlocal_GetCurrentFileInfoInternal( unzFile file, uSizeRead = extraFieldBufferSize; if( lSeek != 0 ) + { if( s->file->Seek( lSeek, FS_SEEK_CUR ) == 0 ) lSeek = 0; else err = UNZ_ERRNO; + } if( ( file_info.size_file_extra > 0 ) && ( extraFieldBufferSize > 0 ) ) if( s->file->Read( extraField, uSizeRead ) != ( int )uSizeRead ) err = UNZ_ERRNO; @@ -580,10 +584,12 @@ static int unzlocal_GetCurrentFileInfoInternal( unzFile file, uSizeRead = commentBufferSize; if( lSeek != 0 ) + { if( s->file->Seek( lSeek, FS_SEEK_CUR ) == 0 ) lSeek = 0; else err = UNZ_ERRNO; + } if( ( file_info.size_file_comment > 0 ) && ( commentBufferSize > 0 ) ) if( s->file->Read( szComment, uSizeRead ) != ( int )uSizeRead ) err = UNZ_ERRNO; @@ -778,11 +784,13 @@ static int unzlocal_CheckCurrentFileCoherencyHeader( unz_s* s, uInt* piSizeVar, if( err == UNZ_OK ) + { if( unzlocal_getLong( s->file, &uMagic ) != UNZ_OK ) err = UNZ_ERRNO; else if( uMagic != 0x04034b50 ) err = UNZ_BADZIPFILE; - + } + if( unzlocal_getShort( s->file, &uData ) != UNZ_OK ) err = UNZ_ERRNO; /* diff --git a/neo/idlib/Dict.cpp b/neo/idlib/Dict.cpp index 1338b003..c4b6ba6f 100644 --- a/neo/idlib/Dict.cpp +++ b/neo/idlib/Dict.cpp @@ -881,7 +881,7 @@ bool idDict::ReadFromIniFile( idFile* f ) { return false; } - buffer[length - 1] = NULL; // Since the .ini files are not null terminated, make sure we mark where the end of the .ini file is in our read buffer + buffer[length - 1] = '\0'; // Since the .ini files are not null terminated, make sure we mark where the end of the .ini file is in our read buffer idLexer parser( LEXFL_NOFATALERRORS | LEXFL_ALLOWPATHNAMES /*| LEXFL_ONLYSTRINGS */ ); idStr name = f->GetName(); diff --git a/neo/idlib/Lexer.cpp b/neo/idlib/Lexer.cpp index 4aa4d259..c7c6a95b 100644 --- a/neo/idlib/Lexer.cpp +++ b/neo/idlib/Lexer.cpp @@ -1038,7 +1038,7 @@ idLexer::ReadPunctuation int idLexer::ReadPunctuation( idToken* token ) { int l, n, i; - char* p; + const char* p; const punctuation_t* punc; #ifdef PUNCTABLE diff --git a/neo/idlib/Lexer.h b/neo/idlib/Lexer.h index 97c1eef1..86dcfe42 100644 --- a/neo/idlib/Lexer.h +++ b/neo/idlib/Lexer.h @@ -130,7 +130,7 @@ typedef enum // punctuation typedef struct punctuation_s { - char* p; // punctuation character(s) + const char* p; // punctuation character(s) int n; // punctuation id } punctuation_t; diff --git a/neo/idlib/Parser.cpp b/neo/idlib/Parser.cpp index 601d94d4..d3b8c54f 100644 --- a/neo/idlib/Parser.cpp +++ b/neo/idlib/Parser.cpp @@ -706,7 +706,7 @@ void idParser::AddBuiltinDefines() define_t* define; struct builtin { - char* string; + const char* string; int id; } builtin[] = { diff --git a/neo/idlib/geometry/Surface_SweptSpline.cpp b/neo/idlib/geometry/Surface_SweptSpline.cpp index f20ff325..087b9683 100644 --- a/neo/idlib/geometry/Surface_SweptSpline.cpp +++ b/neo/idlib/geometry/Surface_SweptSpline.cpp @@ -167,7 +167,7 @@ void idSurface_SweptSpline::Tessellate( const int splineSubdivisions, const int // calculate the points and first derivatives for the swept spline totalTime = sweptSpline->GetTime( sweptSpline->GetNumValues() - 1 ) - sweptSpline->GetTime( 0 ) + sweptSpline->GetCloseTime(); - sweptSplineDiv = sweptSpline->GetBoundaryType() == idCurve_Spline::BT_CLOSED ? sweptSplineSubdivisions : sweptSplineSubdivisions - 1; + sweptSplineDiv = sweptSpline->GetBoundaryType() == idCurve_Spline::BT_CLOSED ? sweptSplineSubdivisions : sweptSplineSubdivisions - 1; baseOffset = ( splineSubdivisions - 1 ) * sweptSplineSubdivisions; for( i = 0; i < sweptSplineSubdivisions; i++ ) { @@ -181,7 +181,7 @@ void idSurface_SweptSpline::Tessellate( const int splineSubdivisions, const int // sweep the spline totalTime = spline->GetTime( spline->GetNumValues() - 1 ) - spline->GetTime( 0 ) + spline->GetCloseTime(); - splineDiv = spline->GetBoundaryType() == idCurve_Spline::BT_CLOSED ? splineSubdivisions : splineSubdivisions - 1; + splineDiv = spline->GetBoundaryType() == idCurve_Spline::BT_CLOSED ? splineSubdivisions : splineSubdivisions - 1; splineMat.Identity(); idVec3 tempNormal; for( i = 0; i < splineSubdivisions; i++ ) diff --git a/neo/idlib/math/Simd.cpp b/neo/idlib/math/Simd.cpp index 83910651..a88215cf 100644 --- a/neo/idlib/math/Simd.cpp +++ b/neo/idlib/math/Simd.cpp @@ -186,7 +186,7 @@ double ticksPerNanosecond; PrintClocks ============ */ -void PrintClocks( char *string, int dataCount, int clocks, int otherClocks = 0 ) { +void PrintClocks( const char *string, int dataCount, int clocks, int otherClocks = 0 ) { int i; idLib::common->Printf( string ); diff --git a/neo/idlib/math/Simd_SSE.cpp b/neo/idlib/math/Simd_SSE.cpp index 3d4d578f..8970c4fa 100644 --- a/neo/idlib/math/Simd_SSE.cpp +++ b/neo/idlib/math/Simd_SSE.cpp @@ -41,7 +41,9 @@ If you have questions concerning this license or the applicable additional terms #include +#ifndef M_PI // DG: this is already defined in math.h #define M_PI 3.14159265358979323846f +#endif /* ============ diff --git a/neo/renderer/Image_files.cpp b/neo/renderer/Image_files.cpp index ae8b12ff..7ec1baaa 100644 --- a/neo/renderer/Image_files.cpp +++ b/neo/renderer/Image_files.cpp @@ -726,13 +726,13 @@ Loads six files with proper extensions bool R_LoadCubeImages( const char* imgName, cubeFiles_t extensions, byte* pics[6], int* outSize, ID_TIME_T* timestamp ) { int i, j; - char* cameraSides[6] = { "_forward.tga", "_back.tga", "_left.tga", "_right.tga", + const char* cameraSides[6] = { "_forward.tga", "_back.tga", "_left.tga", "_right.tga", "_up.tga", "_down.tga" }; - char* axisSides[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", + const char* axisSides[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" }; - char** sides; + const char** sides; char fullName[MAX_IMAGE_NAME]; int width, height, size = 0; diff --git a/neo/renderer/Material.cpp b/neo/renderer/Material.cpp index 849f54dc..bce1bbe9 100644 --- a/neo/renderer/Material.cpp +++ b/neo/renderer/Material.cpp @@ -257,7 +257,7 @@ idImage* idMaterial::GetEditorImage() const // info parms typedef struct { - char* name; + const char* name; int clearSolid, surfaceFlags, contents; } infoParm_t; @@ -2847,7 +2847,7 @@ bool idMaterial::Parse( const char* text, const int textLength, bool allowBinary idMaterial::Print =================== */ -char* opNames[] = +const char* opNames[] = { "OP_TYPE_ADD", "OP_TYPE_SUBTRACT", diff --git a/neo/renderer/Model.cpp b/neo/renderer/Model.cpp index a9222ab6..173cffa3 100644 --- a/neo/renderer/Model.cpp +++ b/neo/renderer/Model.cpp @@ -1299,7 +1299,7 @@ bool idRenderModelStatic::ConvertASEToModelSurfaces( const struct aseModel_s* as // completely ignore any explict normals on surfaces with a renderbump command // which will guarantee the best contours and least vertexes. const char* rb = im1->GetRenderBump(); - if( rb != NULL && rb[0] != NULL ) + if( rb != NULL && rb[0] != '\0' ) { normalsParsed = false; } @@ -2303,7 +2303,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces( const struct maModel_s* ma ) // completely ignore any explict normals on surfaces with a renderbump command // which will guarantee the best contours and least vertexes. const char* rb = im1->GetRenderBump(); - if( rb != NULL && rb[0] != NULL ) + if( rb != NULL && rb[0] != '\0' ) { normalsParsed = false; } diff --git a/neo/renderer/Model_lwo.cpp b/neo/renderer/Model_lwo.cpp index 179de78c..402bbb1c 100644 --- a/neo/renderer/Model_lwo.cpp +++ b/neo/renderer/Model_lwo.cpp @@ -2311,7 +2311,7 @@ int lwGetPolygons5( idFile* fp, int cksize, lwPolygonList* plist, int ptoffset ) bp += 2; } j -= 1; - pp->surf = ( lwSurface* ) j; + pp->surf = ( lwSurface* ) j; // DG: FIXME: cast int to pointer?! pp++; pv += nv; @@ -3054,7 +3054,7 @@ int lwGetPolygonTags( idFile* fp, int cksize, lwTagList* tlist, lwPolygonList* p switch( type ) { case ID_SURF: - plist->pol[ i ].surf = ( lwSurface* ) j; + plist->pol[ i ].surf = ( lwSurface* ) j; // DG: FIXME: cast int to pointer?! break; case ID_PART: plist->pol[ i ].part = j; diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 2747b3fe..8b5efda7 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -1658,7 +1658,7 @@ void R_MakeAmbientMap_f( const idCmdArgs& args ) renderView_t ref; viewDef_t primary; int downSample; - char* extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", + const char* extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" }; int outSize; diff --git a/neo/renderer/tr_frontend_addmodels.cpp b/neo/renderer/tr_frontend_addmodels.cpp index 40898cc6..9cbebe9c 100644 --- a/neo/renderer/tr_frontend_addmodels.cpp +++ b/neo/renderer/tr_frontend_addmodels.cpp @@ -587,7 +587,7 @@ void R_AddSingleModel( viewEntity_t* vEntity ) { continue; } - if( tri->numIndexes == NULL ) + if( tri->numIndexes == 0 ) { continue; // happens for particles } diff --git a/neo/swf/SWF_ScriptObject.cpp b/neo/swf/SWF_ScriptObject.cpp index 3fa21f0c..84451c46 100644 --- a/neo/swf/SWF_ScriptObject.cpp +++ b/neo/swf/SWF_ScriptObject.cpp @@ -64,7 +64,7 @@ idSWFScriptObject::swfNamedVar_t& idSWFScriptObject::swfNamedVar_t::operator=( c idSWFScriptObject::idSWFScriptObject ======================== */ -idSWFScriptObject::idSWFScriptObject() : prototype( NULL ), refCount( 1 ), noAutoDelete( false ), objectType( SWF_OBJECT_OBJECT ) +idSWFScriptObject::idSWFScriptObject() : refCount( 1 ), noAutoDelete( false ), prototype( NULL ), objectType( SWF_OBJECT_OBJECT ) { data.sprite = NULL; data.text = NULL; @@ -694,4 +694,4 @@ void idSWFScriptObject::PrintToConsole() const { idLib::Printf( "No subelements\n" ); } -} \ No newline at end of file +} diff --git a/neo/swf/SWF_SpriteInstance.cpp b/neo/swf/SWF_SpriteInstance.cpp index 51357d97..6149c00f 100644 --- a/neo/swf/SWF_SpriteInstance.cpp +++ b/neo/swf/SWF_SpriteInstance.cpp @@ -36,13 +36,15 @@ idSWFSpriteInstance::idSWFSpriteInstance ======================== */ idSWFSpriteInstance::idSWFSpriteInstance() : - sprite( NULL ), - parent( NULL ), - depth( 0 ), isPlaying( true ), isVisible( true ), childrenRunning( true ), + firstRun( false ), currentFrame( 0 ), + frameCount( 0 ), + sprite( NULL ), + parent( NULL ), + depth( 0 ), itemIndex( 0 ), materialOverride( NULL ), materialWidth( 0 ), @@ -52,7 +54,6 @@ idSWFSpriteInstance::idSWFSpriteInstance() : moveToXScale( 1.0f ), moveToYScale( 1.0f ), moveToSpeed( 1.0f ), - firstRun( false ), stereoDepth( 0 ) { } @@ -1646,4 +1647,4 @@ SWF_SPRITE_NATIVE_VAR_DEFINE_SET( onEnterFrame ) { SWF_SPRITE_PTHIS_SET( "onEnterFrame" ); pThis->onEnterFrame = value; -} \ No newline at end of file +} diff --git a/neo/sys/sdl/sdl_cpu.cpp b/neo/sys/sdl/sdl_cpu.cpp index d7dcc7dd..0c893bd3 100644 --- a/neo/sys/sdl/sdl_cpu.cpp +++ b/neo/sys/sdl/sdl_cpu.cpp @@ -248,7 +248,7 @@ cpuid_t Sys_GetCPUId() typedef struct bitFlag_s { - char* name; + const char* name; int bit; } bitFlag_t; @@ -265,14 +265,14 @@ static bitFlag_t controlWordFlags[] = { "Infinity control", 12 }, { "", 0 } }; -static char* precisionControlField[] = +static const char* precisionControlField[] = { "Single Precision (24-bits)", "Reserved", "Double Precision (53-bits)", "Double Extended Precision (64-bits)" }; -static char* roundingControlField[] = +static const char* roundingControlField[] = { "Round to nearest", "Round down", diff --git a/neo/sys/sys_savegame.cpp b/neo/sys/sys_savegame.cpp index 59bbfab9..ff700232 100644 --- a/neo/sys/sys_savegame.cpp +++ b/neo/sys/sys_savegame.cpp @@ -248,7 +248,7 @@ void idSaveGameDetails::Clear() descriptors.Clear(); damaged = false; date = 0; - slotName[0] = NULL; + slotName[0] = '\0'; } /* @@ -409,7 +409,7 @@ idSaveGameProcessor idSaveGameProcessor::idSaveGameProcessor ======================== */ -idSaveGameProcessor::idSaveGameProcessor() : working( false ), init( false ) +idSaveGameProcessor::idSaveGameProcessor() : init( false ), working( false ) { } @@ -685,7 +685,7 @@ idSaveGameManager::RetrySave */ void idSaveGameManager::RetrySave() { - if( DeviceSelectorWaitingOnSaveRetry() && !common->Dialog().HasDialogMsg( GDM_WARNING_FOR_NEW_DEVICE_ABOUT_TO_LOSE_PROGRESS, false ) ) + if( DeviceSelectorWaitingOnSaveRetry() && !common->Dialog().HasDialogMsg( GDM_WARNING_FOR_NEW_DEVICE_ABOUT_TO_LOSE_PROGRESS, NULL ) ) { cmdSystem->AppendCommandText( "savegame autosave\n" ); } diff --git a/neo/sys/sys_session_local.cpp b/neo/sys/sys_session_local.cpp index 7528dfcd..308f9736 100644 --- a/neo/sys/sys_session_local.cpp +++ b/neo/sys/sys_session_local.cpp @@ -4392,8 +4392,8 @@ idNetSessionPort::idNetSessionPort ======================== */ idNetSessionPort::idNetSessionPort() : - forcePacketDropPrev( 0.0f ), - forcePacketDropCurr( 0.0f ) + forcePacketDropCurr( 0.0f ), + forcePacketDropPrev( 0.0f ) { } diff --git a/neo/sys/win32/win_glimp.cpp b/neo/sys/win32/win_glimp.cpp index cf755dd4..00dd4bbe 100644 --- a/neo/sys/win32/win_glimp.cpp +++ b/neo/sys/win32/win_glimp.cpp @@ -669,13 +669,13 @@ static idStr GetDeviceName( const int deviceNum ) &device, 0 /* dwFlags */ ) ) { - return false; + return idStr(); } // get the monitor for this display if( !( device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) ) { - return false; + return idStr(); } return idStr( device.DeviceName ); diff --git a/neo/sys/win32/win_main.cpp b/neo/sys/win32/win_main.cpp index aae7ec17..67817b65 100644 --- a/neo/sys/win32/win_main.cpp +++ b/neo/sys/win32/win_main.cpp @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms #include #include #include -#include +#include #include #ifndef __MRC__ diff --git a/neo/sys/win32/win_net.cpp b/neo/sys/win32/win_net.cpp index 941a5501..b5813f35 100644 --- a/neo/sys/win32/win_net.cpp +++ b/neo/sys/win32/win_net.cpp @@ -93,7 +93,7 @@ net_interface netint[MAX_INTERFACES]; NET_ErrorString ======================== */ -char* NET_ErrorString() +const char* NET_ErrorString() { int code; @@ -1176,4 +1176,4 @@ void idUDP::SendPacket( const netadr_t to, const void* data, int size ) } Net_SendUDPPacket( netSocket, size, data, to ); -} \ No newline at end of file +} diff --git a/neo/ui/EditWindow.cpp b/neo/ui/EditWindow.cpp index 1756cd04..e13a4f6c 100644 --- a/neo/ui/EditWindow.cpp +++ b/neo/ui/EditWindow.cpp @@ -221,7 +221,7 @@ const char* idEditWindow::HandleEvent( const sysEvent_t* event, bool* updateVisu { // need to call this to allow proper focus and capturing on embedded children const char* ret = idWindow::HandleEvent( event, updateVisuals ); - if( ret != NULL && *ret != NULL ) + if( ret != NULL && *ret != '\0' ) { return ret; } diff --git a/neo/ui/Window.cpp b/neo/ui/Window.cpp index 95a1ece1..2d14e003 100644 --- a/neo/ui/Window.cpp +++ b/neo/ui/Window.cpp @@ -844,7 +844,7 @@ const char* idWindow::HandleEvent( const sysEvent_t* event, bool* updateVisuals //} SetFocus( child ); const char* childRet = child->HandleEvent( event, updateVisuals ); - if( childRet != NULL && *childRet != NULL ) + if( childRet != NULL && *childRet != '\0' ) { return childRet; } @@ -1083,7 +1083,7 @@ const char* idWindow::HandleEvent( const sysEvent_t* event, bool* updateVisuals *updateVisuals = true; } const char* mouseRet = RouteMouseCoords( event->evValue, event->evValue2 ); - if( mouseRet != NULL && *mouseRet != NULL ) + if( mouseRet != NULL && *mouseRet != '\0' ) { return mouseRet; }