From 80dc5295f09f2d9c0bf1a1226930d7fdb452c014 Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 31 Oct 2018 14:42:33 +0700 Subject: [PATCH] Rename (player, ggm) --- dlls/client.cpp | 16 ++-- dlls/coop.cpp | 44 +++++------ dlls/enttools.cpp | 14 ++-- dlls/gravgunmod.cpp | 142 +++++++++++++++++----------------- dlls/gravgunmod.h | 2 +- dlls/multiplay_gamerules.cpp | 10 +-- dlls/player.cpp | 4 +- dlls/player.h | 2 +- dlls/singleplay_gamerules.cpp | 2 +- dlls/triggers.cpp | 10 +-- 10 files changed, 123 insertions(+), 123 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 1654ff0a..431ef0f3 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -90,7 +90,7 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( pEntity ) ; if( pl ) { - pl->gravgunmod_data.iState = STATE_UNINITIALIZED; + pl->m_ggm.iState = STATE_UNINITIALIZED; pl->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( pl ); } @@ -122,7 +122,7 @@ void ClientDisconnect( edict_t *pEntity ) if( pPlayer && pPlayer->IsPlayer() ) { GGM_SaveState( pPlayer ); - pPlayer->gravgunmod_data.iState = STATE_UNINITIALIZED; + pPlayer->m_ggm.iState = STATE_UNINITIALIZED; } if (g_fGameOver) @@ -629,7 +629,7 @@ void ClientCommand( edict_t *pEntity ) }*/ pPlayer->RemoveAllItems(TRUE); UTIL_BecomeSpectator(pPlayer); - pPlayer->gravgunmod_data.iState = STATE_SPECTATOR; + pPlayer->m_ggm.iState = STATE_SPECTATOR; } else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode { @@ -695,16 +695,16 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) // prevent keeping other's uid on saverestore CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)&pEntity->v); const char *uid = GGM_GetAuthID( pPlayer ); - if( !pPlayer->gravgunmod_data.pState || !pPlayer->gravgunmod_data.pState->fRegistered || pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( !pPlayer->m_ggm.pState || !pPlayer->m_ggm.pState->fRegistered || pPlayer->m_ggm.iState != STATE_SPAWNED ) { GGMPlayerState *pState = GGM_GetState(uid, name); - if( pState != pPlayer->gravgunmod_data.pState ) + if( pState != pPlayer->m_ggm.pState ) { GGM_SaveState( pPlayer ); pEntity->v.netname = pEntity->v.frags = 0; - pPlayer->gravgunmod_data.pState = pState; - pPlayer->gravgunmod_data.iState = STATE_UNINITIALIZED; + pPlayer->m_ggm.pState = pState; + pPlayer->m_ggm.iState = STATE_UNINITIALIZED; } } @@ -728,7 +728,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName ); // prevent phantom nickname changed messages - if( mp_coop.value && ((CBasePlayer *)pEntity->pvPrivateData)->gravgunmod_data.iState == STATE_UNINITIALIZED ) + if( mp_coop.value && ((CBasePlayer *)pEntity->pvPrivateData)->m_ggm.iState == STATE_UNINITIALIZED ) return; if( gpGlobals->maxClients > 1 ) diff --git a/dlls/coop.cpp b/dlls/coop.cpp index 9c8ff408..4c03d1e0 100644 --- a/dlls/coop.cpp +++ b/dlls/coop.cpp @@ -179,8 +179,8 @@ void UTIL_BecomeSpectator( CBasePlayer *pPlayer ) void UTIL_SpawnPlayer( CBasePlayer *pPlayer ) { //pPlayer->StopObserver(); - if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR ) - pPlayer->gravgunmod_data.iState = STATE_SPAWNED; + if( pPlayer->m_ggm.iState == STATE_SPECTATOR ) + pPlayer->m_ggm.iState = STATE_SPAWNED; pPlayer->m_iRespawnFrames = 0; pPlayer->pev->effects &= ~EF_NODRAW; @@ -435,7 +435,7 @@ void COOP_ServerActivate( void ) // reset all players state if( plr ) { - plr->gravgunmod_data.iState = STATE_UNINITIALIZED; + plr->m_ggm.iState = STATE_UNINITIALIZED; plr->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( plr ); //plr->Spawn(); @@ -550,7 +550,7 @@ void GlobalVote::ShowGlobalMenu( const char *title, int count, const char **menu { count2++; CBasePlayer *player = (CBasePlayer *) plr; - GGM_PlayerMenu &m = player->gravgunmod_data.menu.New( title ); + GGM_PlayerMenu &m = player->m_ggm.menu.New( title ); for( int j = 0; j < count; j++ ) { char cmd[32]; @@ -603,7 +603,7 @@ bool COOP_PlayerDeath( CBasePlayer *pPlayer ) st_fSkipNext = false; return false; } - if( pPlayer->pev->health > 0 || pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->pev->health > 0 || pPlayer->m_ggm.iState != STATE_SPAWNED ) return true; // if( pPlayer->gravgunmod_data.m_iMenuState == MENUSTATE_CHECKPOINT ) // return true; @@ -729,11 +729,11 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 { CBasePlayer *pPlayer = (CBasePlayer*)pActivator; - if( pPlayer->gravgunmod_data.iLocalConfirm <= 0 ) - pPlayer->gravgunmod_data.iLocalConfirm = 1; - if( pPlayer->gravgunmod_data.iLocalConfirm < 3 ) + if( pPlayer->m_ggm.iLocalConfirm <= 0 ) + pPlayer->m_ggm.iLocalConfirm = 1; + if( pPlayer->m_ggm.iLocalConfirm < 3 ) { - pPlayer->gravgunmod_data.menu.New("This will change map back", false) + pPlayer->m_ggm.menu.New("This will change map back", false) .Add("Confirm", "confirmchangelevel") .Add("Cancel", "") .Show(); @@ -741,7 +741,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 else { g_GlobalVote.ConfirmMenu(pPlayer, pTrigger, mapname ); - pPlayer->gravgunmod_data.iLocalConfirm = 0; + pPlayer->m_ggm.iLocalConfirm = 0; } } return false; @@ -761,9 +761,9 @@ void COOP_CheckpointMenu( CBasePlayer *pPlayer ) if( !g_pCurrentMap ) return; - GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint", false); + GGM_PlayerMenu &m = pPlayer->m_ggm.menu.New("Select checkpoint", false); - if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR || pPlayer->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN || pPlayer->pev->health <= 0 ) + if( pPlayer->m_ggm.iState == STATE_SPECTATOR || pPlayer->m_ggm.iState == STATE_SPECTATOR_BEGIN || pPlayer->pev->health <= 0 ) m.Add("Default", "respawn"); else m.Add("New checkpoint", "newcheckpoint"); @@ -788,14 +788,14 @@ bool COOP_ClientCommand( edict_t *pEntity ) else if( FStrEq(pcmd, "unblock") ) { - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED ) return false; UTIL_CleanSpawnPoint( pev->origin, 150 ); return true; } else if( FStrEq( pcmd, "joincoop" ) ) { - if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED ) + if( pPlayer->m_ggm.iState == STATE_SPAWNED ) return false; if( mp_coop_checkpoints.value && g_pCurrentMap && g_pCurrentMap->checkpoints[0].szDisplayName[0] ) COOP_CheckpointMenu( pPlayer ); @@ -809,9 +809,9 @@ bool COOP_ClientCommand( edict_t *pEntity ) else if( FStrEq( pcmd, "coopmenu" ) ) { //UTIL_CoopMenu( pPlayer ); - if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED ) + if( pPlayer->m_ggm.iState == STATE_SPAWNED ) { - GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New( "COOP MENU" ) + GGM_PlayerMenu &m = pPlayer->m_ggm.menu.New( "COOP MENU" ) .Add( "Force respawn", "respawn" ) .Add( "Unblock", "unblock" ) .Add( "Become spectator", "spectate" ); @@ -821,9 +821,9 @@ bool COOP_ClientCommand( edict_t *pEntity ) m.Show(); return true; } - else if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR ) + else if( pPlayer->m_ggm.iState == STATE_SPECTATOR ) { - pPlayer->gravgunmod_data.menu.New( "COOP MENU" ) + pPlayer->m_ggm.menu.New( "COOP MENU" ) .Add( "Join game", "joincoop" ) .Add( "Cancel", "" ) .Show(); @@ -850,7 +850,7 @@ bool COOP_ClientCommand( edict_t *pEntity ) int i = atoi(CMD_ARGV(1)); if( i > 4 || i < 0 ) return false; - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED || pPlayer->pev->health < 1 ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED || pPlayer->pev->health < 1 ) UTIL_SpawnPlayer( pPlayer ); GGM_RestorePosition( pPlayer, &g_pCurrentMap->checkpoints[i].pos ); return true; @@ -859,7 +859,7 @@ bool COOP_ClientCommand( edict_t *pEntity ) { if( !mp_coop_checkpoints.value ) return false; - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED ) return false; if( !UTIL_CoopIsBadPlayer( pPlayer ) ) COOP_NewCheckpoint( pPlayer->pev ); @@ -869,8 +869,8 @@ bool COOP_ClientCommand( edict_t *pEntity ) } else if( FStrEq( pcmd, "confirmchangelevel" ) ) { - if( pPlayer->gravgunmod_data.iLocalConfirm ) - pPlayer->gravgunmod_data.iLocalConfirm++; + if( pPlayer->m_ggm.iLocalConfirm ) + pPlayer->m_ggm.iLocalConfirm++; else return false; } diff --git a/dlls/enttools.cpp b/dlls/enttools.cpp index f97385dd..c3e4d6ad 100644 --- a/dlls/enttools.cpp +++ b/dlls/enttools.cpp @@ -100,20 +100,20 @@ bool Ent_CheckCreate( edict_t *player, const char *classname ) if( !p ) return false; - if( p->gravgunmod_data.flEntScore > 1 ) + if( p->m_ggm.flEntScore > 1 ) return false; - if( gpGlobals->time - p->gravgunmod_data.flEntTime > 60 ) + if( gpGlobals->time - p->m_ggm.flEntTime > 60 ) { - p->gravgunmod_data.flEntTime = gpGlobals->time; - p->gravgunmod_data.flEntScore = 0; + p->m_ggm.flEntTime = gpGlobals->time; + p->m_ggm.flEntScore = 0; } for( node = entblacklist; node; node = node->next ) { if( Q_stricmpext(node->pattern, classname ) ) { - if( !node->limit || ( p->gravgunmod_data.flEntScore + 1.0f / (float)node->limit > 1 ) ) + if( !node->limit || ( p->m_ggm.flEntScore + 1.0f / (float)node->limit > 1 ) ) { // remove all created entities if( node->clear ) @@ -129,7 +129,7 @@ bool Ent_CheckCreate( edict_t *player, const char *classname ) } return false; } - p->gravgunmod_data.flEntScore += 1.0f / (float)node->limit; + p->m_ggm.flEntScore += 1.0f / (float)node->limit; } } @@ -1090,7 +1090,7 @@ void Ent_Create_f( edict_t *player ) const char *plid = GGM_GetPlayerID( player ); CBasePlayer *pPlayer = (CBasePlayer*)CBaseEntity::Instance( player ); entity->enttools_data.enttools = 1; - if( pPlayer && pPlayer->IsPlayer() && pPlayer->gravgunmod_data.pState && pPlayer->gravgunmod_data.pState->fRegistered ) + if( pPlayer && pPlayer->IsPlayer() && pPlayer->m_ggm.pState && pPlayer->m_ggm.pState->fRegistered ) entity->enttools_data.enttools = 2; if( plid ); diff --git a/dlls/gravgunmod.cpp b/dlls/gravgunmod.cpp index 25d68dc7..d649b16b 100644 --- a/dlls/gravgunmod.cpp +++ b/dlls/gravgunmod.cpp @@ -398,16 +398,16 @@ const char *GGM_GetAuthID( CBasePlayer *pPlayer ) void GGM_ClientPutinServer( edict_t *pEntity, CBasePlayer *pPlayer ) { - if( mp_touchmenu.value && pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED ) + if( mp_touchmenu.value && pPlayer->m_ggm.iState == STATE_UNINITIALIZED ) g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 ); - pPlayer->gravgunmod_data.iState = STATE_CONNECTED; + pPlayer->m_ggm.iState = STATE_CONNECTED; - pPlayer->gravgunmod_data.flEntTime = 0; - pPlayer->gravgunmod_data.flEntScore = 0; - pPlayer->gravgunmod_data.menu.pPlayer = pPlayer; - pPlayer->gravgunmod_data.menu.Clear(); - pPlayer->gravgunmod_data.pState = GGM_GetState( GGM_GetAuthID(pPlayer), STRING(pEntity->v.netname) ); + pPlayer->m_ggm.flEntTime = 0; + pPlayer->m_ggm.flEntScore = 0; + pPlayer->m_ggm.menu.m_pPlayer = pPlayer; + pPlayer->m_ggm.menu.Clear(); + pPlayer->m_ggm.pState = GGM_GetState( GGM_GetAuthID(pPlayer), STRING(pEntity->v.netname) ); } void GGM_ClientFirstSpawn(CBasePlayer *pPlayer) @@ -431,10 +431,10 @@ edict_t *GGM_PlayerByID( const char *id ) { CBasePlayer *player = (CBasePlayer *) plr; - if( !player->gravgunmod_data.pState ) + if( !player->m_ggm.pState ) continue; - if( !strcmp( player->gravgunmod_data.pState->szUID, id ) ) + if( !strcmp( player->m_ggm.pState->szUID, id ) ) return player->edict(); } } @@ -449,10 +449,10 @@ const char *GGM_GetPlayerID( edict_t *player ) if( !plr->IsPlayer() ) return NULL; - if( !plr->gravgunmod_data.pState ) + if( !plr->m_ggm.pState ) return NULL; - return plr->gravgunmod_data.pState->szUID; + return plr->m_ggm.pState->szUID; } struct GGMPlayerState *registered_list; @@ -519,7 +519,7 @@ void GGM_ClearLists( void ) CBasePlayer *pPlayer = (CBasePlayer*)UTIL_PlayerByIndex( i ); if( pPlayer && pPlayer->IsPlayer() ) - pPlayer->gravgunmod_data.pState = NULL; + pPlayer->m_ggm.pState = NULL; } while( login_list ) @@ -885,7 +885,7 @@ void GGM_SaveState( CBasePlayer *pPlayer ) { if( !pPlayer ) return; - GGMPlayerState *pState = pPlayer->gravgunmod_data.pState; + GGMPlayerState *pState = pPlayer->m_ggm.pState; int i, j = 0; if( !pState ) @@ -894,7 +894,7 @@ void GGM_SaveState( CBasePlayer *pPlayer ) pState->t.iFrags = pPlayer->pev->frags; pState->t.iDeaths = pPlayer->m_iDeaths; - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED ) return; if( pPlayer->pev->health <= 0 ) @@ -963,7 +963,7 @@ bool GGM_RestorePosition( CBasePlayer *pPlayer, struct GGMPosition *pos ) { if( !COOP_SetDefaultSpawnPosition( pPlayer ) ) g_pGameRules->GetPlayerSpawnSpot( pPlayer ); - if( pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT ) + if( pPlayer->m_ggm.iState == STATE_POINT_SELECT ) return false; } @@ -982,7 +982,7 @@ extern int gmsgScoreInfo; bool GGM_RestoreState( CBasePlayer *pPlayer ) { - GGMPlayerState *pState = pPlayer->gravgunmod_data.pState; + GGMPlayerState *pState = pPlayer->m_ggm.pState; int i; if( !pState ) @@ -1041,18 +1041,18 @@ void ClientPutInServer( edict_t *client ); bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) { - if( pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED ) + if( pPlayer->m_ggm.iState == STATE_UNINITIALIZED ) { ClientPutInServer( pPlayer->edict() ); return true; } - if( ( mp_coop.value || mp_spectator.value ) && pPlayer->gravgunmod_data.iState == STATE_CONNECTED || !pPlayer->gravgunmod_data.pState ) + if( ( mp_coop.value || mp_spectator.value ) && pPlayer->m_ggm.iState == STATE_CONNECTED || !pPlayer->m_ggm.pState ) { - if( !pPlayer->gravgunmod_data.pState ) + if( !pPlayer->m_ggm.pState ) GGM_ChatPrintf( pPlayer, "This nickname busy! Please login or change nickname\n" ); - pPlayer->gravgunmod_data.iState = STATE_SPECTATOR_BEGIN; + pPlayer->m_ggm.iState = STATE_SPECTATOR_BEGIN; pPlayer->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( pPlayer ); if( !COOP_SetDefaultSpawnPosition( pPlayer ) ) @@ -1060,7 +1060,7 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) return true; } - if( mp_coop.value && pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT && !(pPlayer->pev->flags & FL_SPECTATOR) ) + if( mp_coop.value && pPlayer->m_ggm.iState == STATE_POINT_SELECT && !(pPlayer->pev->flags & FL_SPECTATOR) ) { pPlayer->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( pPlayer ); @@ -1072,9 +1072,9 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) if( mp_coop.value ) { - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED ) { - pPlayer->gravgunmod_data.iState = STATE_SPAWNED; + pPlayer->m_ggm.iState = STATE_SPAWNED; g_fPause = false; if( GGM_RestoreState( pPlayer ) ) { @@ -1111,9 +1111,9 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) } else { - if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED ) + if( pPlayer->m_ggm.iState != STATE_SPAWNED ) { - pPlayer->gravgunmod_data.iState = STATE_SPAWNED; + pPlayer->m_ggm.iState = STATE_SPAWNED; g_fPause = false; if( GGM_RestoreState( pPlayer ) ) { @@ -1126,7 +1126,7 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) g_fPause = false; - return pPlayer->gravgunmod_data.iState != STATE_SPAWNED; + return pPlayer->m_ggm.iState != STATE_SPAWNED; } void GGM_Logout( CBasePlayer *pPlayer ) @@ -1159,11 +1159,11 @@ void GGM_Logout( CBasePlayer *pPlayer ) break; } - if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED ) + if( pPlayer->m_ggm.iState == STATE_SPAWNED ) GGM_SaveState( pPlayer ); - pPlayer->gravgunmod_data.pState = GGM_GetState(uid, name); - if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED ) + pPlayer->m_ggm.pState = GGM_GetState(uid, name); + if( pPlayer->m_ggm.iState == STATE_SPAWNED ) GGM_RestoreState( pPlayer ); // remove login record @@ -1184,10 +1184,10 @@ void GGM_FreeState( const char *uid ) { CBasePlayer *pPlayer = (CBasePlayer*)UTIL_PlayerByIndex( i ); - if( pPlayer && pPlayer->IsPlayer() && pPlayer->gravgunmod_data.pState ) + if( pPlayer && pPlayer->IsPlayer() && pPlayer->m_ggm.pState ) { - if( !pPlayer->gravgunmod_data.pState->fRegistered && !strcmp( uid, pPlayer->gravgunmod_data.pState->szUID ) ) - pPlayer->gravgunmod_data.pState = NULL; + if( !pPlayer->m_ggm.pState->fRegistered && !strcmp( uid, pPlayer->m_ggm.pState->szUID ) ) + pPlayer->m_ggm.pState = NULL; } } @@ -1262,10 +1262,10 @@ void GGM_Register( CBasePlayer *pPlayer, const char *name, const char *password struct GGMPlayerState *pState; struct GGMLogin *pLogin; - if( !pPlayer || !pPlayer->gravgunmod_data.pState ) + if( !pPlayer || !pPlayer->m_ggm.pState ) return; - if( pPlayer->gravgunmod_data.pState->fRegistered ) + if( pPlayer->m_ggm.pState->fRegistered ) { GGM_ChatPrintf( pPlayer, "Cannot register, when logged in\n" ); return; @@ -1283,19 +1283,19 @@ void GGM_Register( CBasePlayer *pPlayer, const char *name, const char *password strncpy( pState->p.szPassword, password, 32 ); GGM_Munge( pState->p.szPassword ); pState->p.szPassword[32] = 0; - pState->t = pPlayer->gravgunmod_data.pState->t; + pState->t = pPlayer->m_ggm.pState->t; pState->pNext = registered_list; registered_list = pState; GGM_WritePersist( pState ); pLogin = (struct GGMLogin*)calloc(1, sizeof( struct GGMLogin ) ); pLogin->pState = pState; strncpy( pLogin->f.szName, STRING(pPlayer->pev->netname ), 32 ); - strncpy( pLogin->f.szUID, pPlayer->gravgunmod_data.pState->szUID, 32 ); + strncpy( pLogin->f.szUID, pPlayer->m_ggm.pState->szUID, 32 ); pLogin->pNext = login_list; login_list = pLogin; GGM_WriteLogin( pLogin ); - GGM_FreeState( pPlayer->gravgunmod_data.pState->szUID ); - pPlayer->gravgunmod_data.pState = pState; + GGM_FreeState( pPlayer->m_ggm.pState->szUID ); + pPlayer->m_ggm.pState = pState; GGM_ChatPrintf( pPlayer, "Successfully registered as %s!\n", name ); } @@ -1311,7 +1311,7 @@ void GGM_RegName_f( CBasePlayer *pPlayer ) if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), true ) ) return; - strncpy( pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1), 31 ); + strncpy( pPlayer->m_ggm.fRegisterInput, CMD_ARGV(1), 31 ); CLIENT_COMMAND( pPlayer->edict(), "messagemode reg_Password\n"); } @@ -1340,7 +1340,7 @@ void GGM_RegPassword_f( CBasePlayer *pPlayer ) if( CMD_ARGC() != 2 ) return; - GGM_Register( pPlayer, pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1) ); + GGM_Register( pPlayer, pPlayer->m_ggm.fRegisterInput, CMD_ARGV(1) ); } void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password ) @@ -1352,7 +1352,7 @@ void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password ) if( !pPlayer ) return; - if( pPlayer->gravgunmod_data.pState && pPlayer->gravgunmod_data.pState->fRegistered ) + if( pPlayer->m_ggm.pState && pPlayer->m_ggm.pState->fRegistered ) { GGM_ChatPrintf( pPlayer, "Cannot login, already logged in\n" ); return; @@ -1363,7 +1363,7 @@ void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password ) pState = GGM_GetRegistration( name ); - if( !pPlayer->gravgunmod_data.pState ) + if( !pPlayer->m_ggm.pState ) { for( pLogin = login_list; pLogin; pLogin = pLogin->pNext ) { @@ -1396,12 +1396,12 @@ void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password ) pLogin->pNext = login_list; login_list = pLogin; GGM_WriteLogin( pLogin ); - if( pPlayer->gravgunmod_data.pState ) - GGM_FreeState( pPlayer->gravgunmod_data.pState->szUID ); - pPlayer->gravgunmod_data.pState = pState; + if( pPlayer->m_ggm.pState ) + GGM_FreeState( pPlayer->m_ggm.pState->szUID ); + pPlayer->m_ggm.pState = pState; GGM_ChatPrintf( pPlayer, "Successfully logged in as %s\n", name ); - if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED ) + if( pPlayer->m_ggm.iState == STATE_SPAWNED ) GGM_RestoreState( pPlayer ); } @@ -1414,7 +1414,7 @@ void GGM_LoginPassword_f( CBasePlayer *pPlayer ) if( CMD_ARGC() != 2 ) return; - GGM_Login( pPlayer, pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1) ); + GGM_Login( pPlayer, pPlayer->m_ggm.fRegisterInput, CMD_ARGV(1) ); } void GGM_LoginName_f( CBasePlayer *pPlayer ) @@ -1428,7 +1428,7 @@ void GGM_LoginName_f( CBasePlayer *pPlayer ) if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), false ) ) return; - strncpy( pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1), 31 ); + strncpy( pPlayer->m_ggm.fRegisterInput, CMD_ARGV(1), 31 ); CLIENT_COMMAND( pPlayer->edict(), "messagemode login_Password\n"); } @@ -1449,19 +1449,19 @@ void GGM_Login_f( CBasePlayer *pPlayer ) void GGM_ChangePassword_f( CBasePlayer *pPlayer ) { - if( !pPlayer || !pPlayer->gravgunmod_data.pState || !pPlayer->gravgunmod_data.pState->fRegistered ) + if( !pPlayer || !pPlayer->m_ggm.pState || !pPlayer->m_ggm.pState->fRegistered ) return; - if( !pPlayer->gravgunmod_data.pState->fRegistered ) + if( !pPlayer->m_ggm.pState->fRegistered ) { GGM_ChatPrintf( pPlayer, "Cannot register, when logged in\n" ); return; } else if( CMD_ARGC() == 2 ) { - strncpy( pPlayer->gravgunmod_data.pState->p.szPassword, CMD_ARGV(1), 32 ); - GGM_Munge( pPlayer->gravgunmod_data.pState->p.szPassword ); - GGM_WritePersist( pPlayer->gravgunmod_data.pState ); + strncpy( pPlayer->m_ggm.pState->p.szPassword, CMD_ARGV(1), 32 ); + GGM_Munge( pPlayer->m_ggm.pState->p.szPassword ); + GGM_WritePersist( pPlayer->m_ggm.pState ); } else CLIENT_COMMAND( pPlayer->edict(), "messagemode New_Password\n"); @@ -1747,24 +1747,24 @@ GGM_PlayerMenu &GGM_PlayerMenu::New( const char *title, bool force ) extern int gmsgShowMenu; void GGM_PlayerMenu::Show() { - if( !pPlayer ) + if( !m_pPlayer ) return; - if( pPlayer->gravgunmod_data.fTouchMenu) + if( m_pPlayer->m_ggm.fTouchMenu) { char buf[256]; #define MENU_STR(VAR) (#VAR) sprintf( buf, MENU_STR(slot10\ntouch_hide _sm*\ntouch_show _sm\ntouch_addbutton "_smt" "#%s" "" 0.16 0.11 0.41 0.3 0 255 0 255 78 1.5\n), m_sTitle); - if( pPlayer ) - CLIENT_COMMAND( pPlayer->edict(), buf); + if( m_pPlayer ) + CLIENT_COMMAND( m_pPlayer->edict(), buf); for( int i = 0; i < m_iCount; i++ ) { sprintf( buf, MENU_STR(touch_settexture _sm%d "#%d. %s"\ntouch_show _sm%d\n), i+1, i+1, m_rgItems[i].szName, i + 1 ); - if( pPlayer ) - CLIENT_COMMAND( pPlayer->edict(), buf); + if( m_pPlayer ) + CLIENT_COMMAND( m_pPlayer->edict(), buf); } } else @@ -1780,7 +1780,7 @@ void GGM_PlayerMenu::Show() flags |= 1<pev ); + MESSAGE_BEGIN( MSG_ONE, gmsgShowMenu, NULL, m_pPlayer->pev ); WRITE_SHORT( flags ); // slots WRITE_CHAR( 255 ); // show time WRITE_BYTE( 0 ); // need more @@ -1802,12 +1802,12 @@ bool GGM_PlayerMenu::MenuSelect( int select ) if( !m_rgItems[select-1].szCommand[0] ) { // cancel menu item - GGM_ClearHelpMessage( pPlayer ); + GGM_ClearHelpMessage( m_pPlayer ); return true; } GGM::Cmd_TokenizeString( m_rgItems[select-1].szCommand ); - ClientCommand( pPlayer->edict() ); + ClientCommand( m_pPlayer->edict() ); GGM::Cmd_Reset(); return true; @@ -1837,7 +1837,7 @@ bool GGM_MenuCommand( CBasePlayer *player, const char *name ) return false; } - GGM_PlayerMenu &m = player->gravgunmod_data.menu.New( buf ); + GGM_PlayerMenu &m = player->m_ggm.menu.New( buf ); while( pFile = GGM::COM_ParseFile( pFile, buf ) ) { @@ -1954,10 +1954,10 @@ bool GGM_HelpCommand( CBasePlayer *pPlayer, const char *name ) void GGM_InitialMenus( CBasePlayer *pPlayer ) { - pPlayer->gravgunmod_data.fTouchLoading = false; + pPlayer->m_ggm.fTouchLoading = false; if( !GGM_MenuCommand( pPlayer, "init" ) && mp_coop.value ) - pPlayer->gravgunmod_data.menu.New( "COOP SERVER" ) + pPlayer->m_ggm.menu.New( "COOP SERVER" ) .Add("Join coop", "joincoop") .Add("Spectate", "spectate") .Show(); @@ -1978,7 +1978,7 @@ bool GGM_TouchCommand( CBasePlayer *pPlayer, const char *pcmd ) return true; } - if( !pPlayer->gravgunmod_data.fTouchLoading ) + if( !pPlayer->m_ggm.fTouchLoading ) return false; if( FStrEq(pcmd, "m1")) @@ -2026,7 +2026,7 @@ bool GGM_ClientCommand( CBasePlayer *pPlayer, const char *pCmd ) { int imenu = atoi( CMD_ARGV( 1 ) ); - return pPlayer->gravgunmod_data.menu.MenuSelect(imenu); + return pPlayer->m_ggm.menu.MenuSelect(imenu); } else if( GGM_MOTDCommand( pPlayer, pCmd ) ) return true; @@ -2087,10 +2087,10 @@ bool GGM_ClientCommand( CBasePlayer *pPlayer, const char *pCmd ) } else if( FStrEq(pCmd, "ent_import" ) ) { - if( !pPlayer->gravgunmod_data.pState || !pPlayer->gravgunmod_data.pState->fRegistered ) + if( !pPlayer->m_ggm.pState || !pPlayer->m_ggm.pState->fRegistered ) return false; - Ent_ChangeOwner( GGM_GetAuthID(pPlayer), NULL, pPlayer->gravgunmod_data.pState->szUID, 1, 2 ); + Ent_ChangeOwner( GGM_GetAuthID(pPlayer), NULL, pPlayer->m_ggm.pState->szUID, 1, 2 ); return true; } else if( FStrEq(pCmd, "logout") ) @@ -2120,10 +2120,10 @@ void GGM_CvarValue2( const edict_t *pEnt, int requestID, const char *cvarName, c if( pEnt && requestID == 111 && FStrEq( cvarName , "touch_enable" ) && atoi( value) ) { CBasePlayer *player = (CBasePlayer * ) CBaseEntity::Instance( (edict_t*)pEnt ); - player->gravgunmod_data.fTouchMenu = !!atof( value ); + player->m_ggm.fTouchMenu = !!atof( value ); CLIENT_COMMAND((edict_t*)pEnt, "m1\n"); - player->gravgunmod_data.fTouchLoading = true; + player->m_ggm.fTouchLoading = true; const char *name = NULL, *command = NULL; if( mp_coop.value ) diff --git a/dlls/gravgunmod.h b/dlls/gravgunmod.h index a6613b6a..44ca35e6 100644 --- a/dlls/gravgunmod.h +++ b/dlls/gravgunmod.h @@ -94,7 +94,7 @@ class GGM_PlayerMenu bool m_fShow; public: - CBasePlayer *pPlayer; + CBasePlayer *m_pPlayer; bool MenuSelect( int select ); GGM_PlayerMenu &SetTitle( const char *title ); GGM_PlayerMenu &New( const char *title, bool force = true ); diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 2461f4ba..60d34753 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -486,10 +486,10 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl ) MESSAGE_END(); } - if( pl->gravgunmod_data.iState <= STATE_CONNECTED ) + if( pl->m_ggm.iState <= STATE_CONNECTED ) ClientPutInServer( pl->edict() ); - if( pl->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN && !pl->gravgunmod_data.fTouchMenu ) + if( pl->m_ggm.iState == STATE_SPECTATOR_BEGIN && !pl->m_ggm.fTouchMenu ) GGM_InitialMenus( pl ); } @@ -563,10 +563,10 @@ BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity //========================================================= void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer ) { - if( !mp_coop.value && pPlayer->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN ) + if( !mp_coop.value && pPlayer->m_ggm.iState == STATE_SPECTATOR_BEGIN ) if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) UTIL_SpawnPlayer( pPlayer ); - if( pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED ) + if( pPlayer->m_ggm.iState == STATE_UNINITIALIZED ) if( pPlayer->m_afButtonPressed || pPlayer->pev->button ) { ClientPutInServer( pPlayer->edict() ); @@ -576,7 +576,7 @@ void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer ) return; } - if( pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT ) + if( pPlayer->m_ggm.iState == STATE_POINT_SELECT ) { if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) pPlayer->Spawn(); diff --git a/dlls/player.cpp b/dlls/player.cpp index 9ca370ff..1946a7ef 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2584,7 +2584,7 @@ void CBasePlayer::PostThink() } // Handle Tank controlling - if( m_pTank && gravgunmod_data.iState == STATE_SPAWNED ) + if( m_pTank && m_ggm.iState == STATE_SPAWNED ) { // if they've moved too far from the gun, or selected a weapon, unuse the gun if( m_pTank->OnControls( pev ) && !pev->weaponmodel ) @@ -3002,7 +3002,7 @@ void CBasePlayer::Spawn( void ) m_lastx = m_lasty = 0; m_flNextChatTime = gpGlobals->time; - gravgunmod_data.flSpawnTime = gpGlobals->time; + m_ggm.flSpawnTime = gpGlobals->time; g_pGameRules->PlayerSpawn( this ); g_flSemclipTime = 0; diff --git a/dlls/player.h b/dlls/player.h index 5627ec6a..3ecf4d4b 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -332,7 +332,7 @@ public: virtual float TouchGravGun( CBaseEntity *attacker, int stage ); - struct GGMData gravgunmod_data; + struct GGMData m_ggm; virtual void Touch( CBaseEntity *pOther ); }; diff --git a/dlls/singleplay_gamerules.cpp b/dlls/singleplay_gamerules.cpp index 495bba4d..80953095 100644 --- a/dlls/singleplay_gamerules.cpp +++ b/dlls/singleplay_gamerules.cpp @@ -121,7 +121,7 @@ float CHalfLifeRules::FlPlayerFallDamage( CBasePlayer *pPlayer ) //========================================================= void CHalfLifeRules::PlayerSpawn( CBasePlayer *pPlayer ) { - pPlayer->gravgunmod_data.iState = STATE_SPAWNED; + pPlayer->m_ggm.iState = STATE_SPAWNED; } //========================================================= diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index e448947c..5994318a 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1604,7 +1604,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) continue; // count only players spawned more 30 seconds ago - if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.flSpawnTime ) > 30 ) && plr->pev->modelindex ) + if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->m_ggm.flSpawnTime ) > 30 ) && plr->pev->modelindex ) { @@ -1639,7 +1639,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) //UTIL_CoopPrintMessage("%s^7 trying activate changelevel too early\n", UTIL_CoopPlayerName( pPlayer )); UTIL_CleanSpawnPoint( pPlayer->pev->origin, 50 ); m_coopData.flRepeatTimer = gpGlobals->time; - pPlayer->gravgunmod_data.iLocalConfirm = -2; + pPlayer->m_ggm.iLocalConfirm = -2; } ClientPrint( pActivator->pev, HUD_PRINTCENTER, "Too early! You or other players near you\nplaying less than 30 seconds!" ); @@ -1708,7 +1708,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) { CBaseEntity *plr = UTIL_PlayerByIndex( i ); - if( plr && plr->IsPlayer() && ( !FindTriggerTransition( m_szLandmarkName ) || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.flSpawnTime ) > 30 || m_coopData.fSkipSpawnCheck ) ) + if( plr && plr->IsPlayer() && ( !FindTriggerTransition( m_szLandmarkName ) || (gpGlobals->time -((CBasePlayer*)plr)->m_ggm.flSpawnTime ) > 30 || m_coopData.fSkipSpawnCheck ) ) { if( InTransitionVolume( plr, m_szLandmarkName )) { @@ -1726,7 +1726,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) ALERT( at_console, "There are %d players in transition volume %s\n", count, m_szLandmarkName ); } - else if( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->gravgunmod_data.flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) ) + else if( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->m_ggm.flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) ) { if( !m_coopData.fSkipSpawnCheck ) { @@ -1799,7 +1799,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) if( plr ) { GGM_SaveState( plr ); - plr->gravgunmod_data.iState = STATE_UNINITIALIZED; + plr->m_ggm.iState = STATE_UNINITIALIZED; plr->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( plr ); // HACK: force perform reconnection