Browse Source

Renaming (ggmdata)

gravgun
mittorn 6 years ago
parent
commit
f8098cfad2
  1. 12
      dlls/client.cpp
  2. 34
      dlls/coop.cpp
  3. 12
      dlls/enttools.cpp
  4. 54
      dlls/gravgunmod.cpp
  5. 16
      dlls/gravgunmod.h
  6. 10
      dlls/multiplay_gamerules.cpp
  7. 4
      dlls/player.cpp
  8. 2
      dlls/singleplay_gamerules.cpp
  9. 10
      dlls/triggers.cpp

12
dlls/client.cpp

@ -90,7 +90,7 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres
CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( pEntity ) ; CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( pEntity ) ;
if( pl ) if( pl )
{ {
pl->gravgunmod_data.m_state = STATE_UNINITIALIZED; pl->gravgunmod_data.iState = STATE_UNINITIALIZED;
pl->RemoveAllItems( TRUE ); pl->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( pl ); UTIL_BecomeSpectator( pl );
} }
@ -122,7 +122,7 @@ void ClientDisconnect( edict_t *pEntity )
if( pPlayer && pPlayer->IsPlayer() ) if( pPlayer && pPlayer->IsPlayer() )
{ {
GGM_SaveState( pPlayer ); GGM_SaveState( pPlayer );
pPlayer->gravgunmod_data.m_state = STATE_UNINITIALIZED; pPlayer->gravgunmod_data.iState = STATE_UNINITIALIZED;
} }
if (g_fGameOver) if (g_fGameOver)
@ -629,7 +629,7 @@ void ClientCommand( edict_t *pEntity )
}*/ }*/
pPlayer->RemoveAllItems(TRUE); pPlayer->RemoveAllItems(TRUE);
UTIL_BecomeSpectator(pPlayer); UTIL_BecomeSpectator(pPlayer);
pPlayer->gravgunmod_data.m_state = STATE_SPECTATOR; pPlayer->gravgunmod_data.iState = STATE_SPECTATOR;
} }
else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode
{ {
@ -695,7 +695,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
// prevent keeping other's uid on saverestore // prevent keeping other's uid on saverestore
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)&pEntity->v); CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)&pEntity->v);
const char *uid = GGM_GetAuthID( pPlayer ); const char *uid = GGM_GetAuthID( pPlayer );
if( !pPlayer->gravgunmod_data.pState || !pPlayer->gravgunmod_data.pState->fRegistered || pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( !pPlayer->gravgunmod_data.pState || !pPlayer->gravgunmod_data.pState->fRegistered || pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
{ {
GGMPlayerState *pState = GGM_GetState(uid, name); GGMPlayerState *pState = GGM_GetState(uid, name);
@ -704,7 +704,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
GGM_SaveState( pPlayer ); GGM_SaveState( pPlayer );
pEntity->v.netname = pEntity->v.frags = 0; pEntity->v.netname = pEntity->v.frags = 0;
pPlayer->gravgunmod_data.pState = pState; pPlayer->gravgunmod_data.pState = pState;
pPlayer->gravgunmod_data.m_state = STATE_UNINITIALIZED; pPlayer->gravgunmod_data.iState = STATE_UNINITIALIZED;
} }
} }
@ -728,7 +728,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName ); g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName );
// prevent phantom nickname changed messages // prevent phantom nickname changed messages
if( mp_coop.value && ((CBasePlayer *)pEntity->pvPrivateData)->gravgunmod_data.m_state == STATE_UNINITIALIZED ) if( mp_coop.value && ((CBasePlayer *)pEntity->pvPrivateData)->gravgunmod_data.iState == STATE_UNINITIALIZED )
return; return;
if( gpGlobals->maxClients > 1 ) if( gpGlobals->maxClients > 1 )

34
dlls/coop.cpp

@ -179,8 +179,8 @@ void UTIL_BecomeSpectator( CBasePlayer *pPlayer )
void UTIL_SpawnPlayer( CBasePlayer *pPlayer ) void UTIL_SpawnPlayer( CBasePlayer *pPlayer )
{ {
//pPlayer->StopObserver(); //pPlayer->StopObserver();
if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR ) if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR )
pPlayer->gravgunmod_data.m_state = STATE_SPAWNED; pPlayer->gravgunmod_data.iState = STATE_SPAWNED;
pPlayer->m_iRespawnFrames = 0; pPlayer->m_iRespawnFrames = 0;
pPlayer->pev->effects &= ~EF_NODRAW; pPlayer->pev->effects &= ~EF_NODRAW;
@ -435,7 +435,7 @@ void COOP_ServerActivate( void )
// reset all players state // reset all players state
if( plr ) if( plr )
{ {
plr->gravgunmod_data.m_state = STATE_UNINITIALIZED; plr->gravgunmod_data.iState = STATE_UNINITIALIZED;
plr->RemoveAllItems( TRUE ); plr->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( plr ); UTIL_BecomeSpectator( plr );
//plr->Spawn(); //plr->Spawn();
@ -603,7 +603,7 @@ bool COOP_PlayerDeath( CBasePlayer *pPlayer )
st_fSkipNext = false; st_fSkipNext = false;
return false; return false;
} }
if( pPlayer->pev->health > 0 || pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->pev->health > 0 || pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
return true; return true;
// if( pPlayer->gravgunmod_data.m_iMenuState == MENUSTATE_CHECKPOINT ) // if( pPlayer->gravgunmod_data.m_iMenuState == MENUSTATE_CHECKPOINT )
// return true; // return true;
@ -729,9 +729,9 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
{ {
CBasePlayer *pPlayer = (CBasePlayer*)pActivator; CBasePlayer *pPlayer = (CBasePlayer*)pActivator;
if( pPlayer->gravgunmod_data.m_iLocalConfirm <= 0 ) if( pPlayer->gravgunmod_data.iLocalConfirm <= 0 )
pPlayer->gravgunmod_data.m_iLocalConfirm = 1; pPlayer->gravgunmod_data.iLocalConfirm = 1;
if( pPlayer->gravgunmod_data.m_iLocalConfirm < 3 ) if( pPlayer->gravgunmod_data.iLocalConfirm < 3 )
{ {
pPlayer->gravgunmod_data.menu.New("This will change map back", false) pPlayer->gravgunmod_data.menu.New("This will change map back", false)
.Add("Confirm", "confirmchangelevel") .Add("Confirm", "confirmchangelevel")
@ -741,7 +741,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
else else
{ {
g_GlobalVote.ConfirmMenu(pPlayer, pTrigger, mapname ); g_GlobalVote.ConfirmMenu(pPlayer, pTrigger, mapname );
pPlayer->gravgunmod_data.m_iLocalConfirm = 0; pPlayer->gravgunmod_data.iLocalConfirm = 0;
} }
} }
return false; return false;
@ -763,7 +763,7 @@ void COOP_CheckpointMenu( CBasePlayer *pPlayer )
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint", false); GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint", false);
if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR || pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN || pPlayer->pev->health <= 0 ) if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR || pPlayer->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN || pPlayer->pev->health <= 0 )
m.Add("Default", "respawn"); m.Add("Default", "respawn");
else else
m.Add("New checkpoint", "newcheckpoint"); m.Add("New checkpoint", "newcheckpoint");
@ -788,14 +788,14 @@ bool COOP_ClientCommand( edict_t *pEntity )
else if( FStrEq(pcmd, "unblock") ) else if( FStrEq(pcmd, "unblock") )
{ {
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
return false; return false;
UTIL_CleanSpawnPoint( pev->origin, 150 ); UTIL_CleanSpawnPoint( pev->origin, 150 );
return true; return true;
} }
else if( FStrEq( pcmd, "joincoop" ) ) else if( FStrEq( pcmd, "joincoop" ) )
{ {
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED )
return false; return false;
if( mp_coop_checkpoints.value && g_pCurrentMap && g_pCurrentMap->checkpoints[0].szDisplayName[0] ) if( mp_coop_checkpoints.value && g_pCurrentMap && g_pCurrentMap->checkpoints[0].szDisplayName[0] )
COOP_CheckpointMenu( pPlayer ); COOP_CheckpointMenu( pPlayer );
@ -809,7 +809,7 @@ bool COOP_ClientCommand( edict_t *pEntity )
else if( FStrEq( pcmd, "coopmenu" ) ) else if( FStrEq( pcmd, "coopmenu" ) )
{ {
//UTIL_CoopMenu( pPlayer ); //UTIL_CoopMenu( pPlayer );
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED )
{ {
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New( "COOP MENU" ) GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New( "COOP MENU" )
.Add( "Force respawn", "respawn" ) .Add( "Force respawn", "respawn" )
@ -821,7 +821,7 @@ bool COOP_ClientCommand( edict_t *pEntity )
m.Show(); m.Show();
return true; return true;
} }
else if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR ) else if( pPlayer->gravgunmod_data.iState == STATE_SPECTATOR )
{ {
pPlayer->gravgunmod_data.menu.New( "COOP MENU" ) pPlayer->gravgunmod_data.menu.New( "COOP MENU" )
.Add( "Join game", "joincoop" ) .Add( "Join game", "joincoop" )
@ -850,7 +850,7 @@ bool COOP_ClientCommand( edict_t *pEntity )
int i = atoi(CMD_ARGV(1)); int i = atoi(CMD_ARGV(1));
if( i > 4 || i < 0 ) if( i > 4 || i < 0 )
return false; return false;
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED || pPlayer->pev->health < 1 ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED || pPlayer->pev->health < 1 )
UTIL_SpawnPlayer( pPlayer ); UTIL_SpawnPlayer( pPlayer );
GGM_RestorePosition( pPlayer, &g_pCurrentMap->checkpoints[i].pos ); GGM_RestorePosition( pPlayer, &g_pCurrentMap->checkpoints[i].pos );
return true; return true;
@ -859,7 +859,7 @@ bool COOP_ClientCommand( edict_t *pEntity )
{ {
if( !mp_coop_checkpoints.value ) if( !mp_coop_checkpoints.value )
return false; return false;
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
return false; return false;
if( !UTIL_CoopIsBadPlayer( pPlayer ) ) if( !UTIL_CoopIsBadPlayer( pPlayer ) )
COOP_NewCheckpoint( pPlayer->pev ); COOP_NewCheckpoint( pPlayer->pev );
@ -869,8 +869,8 @@ bool COOP_ClientCommand( edict_t *pEntity )
} }
else if( FStrEq( pcmd, "confirmchangelevel" ) ) else if( FStrEq( pcmd, "confirmchangelevel" ) )
{ {
if( pPlayer->gravgunmod_data.m_iLocalConfirm ) if( pPlayer->gravgunmod_data.iLocalConfirm )
pPlayer->gravgunmod_data.m_iLocalConfirm++; pPlayer->gravgunmod_data.iLocalConfirm++;
else else
return false; return false;
} }

12
dlls/enttools.cpp

@ -100,20 +100,20 @@ bool Ent_CheckCreate( edict_t *player, const char *classname )
if( !p ) if( !p )
return false; return false;
if( p->gravgunmod_data.m_flEntScope > 1 ) if( p->gravgunmod_data.flEntScore > 1 )
return false; return false;
if( gpGlobals->time - p->gravgunmod_data.m_flEntTime > 60 ) if( gpGlobals->time - p->gravgunmod_data.flEntTime > 60 )
{ {
p->gravgunmod_data.m_flEntTime = gpGlobals->time; p->gravgunmod_data.flEntTime = gpGlobals->time;
p->gravgunmod_data.m_flEntScope = 0; p->gravgunmod_data.flEntScore = 0;
} }
for( node = entblacklist; node; node = node->next ) for( node = entblacklist; node; node = node->next )
{ {
if( Q_stricmpext(node->pattern, classname ) ) if( Q_stricmpext(node->pattern, classname ) )
{ {
if( !node->limit || ( p->gravgunmod_data.m_flEntScope + 1.0f / (float)node->limit > 1 ) ) if( !node->limit || ( p->gravgunmod_data.flEntScore + 1.0f / (float)node->limit > 1 ) )
{ {
// remove all created entities // remove all created entities
if( node->clear ) if( node->clear )
@ -129,7 +129,7 @@ bool Ent_CheckCreate( edict_t *player, const char *classname )
} }
return false; return false;
} }
p->gravgunmod_data.m_flEntScope += 1.0f / (float)node->limit; p->gravgunmod_data.flEntScore += 1.0f / (float)node->limit;
} }
} }

54
dlls/gravgunmod.cpp

@ -398,13 +398,13 @@ const char *GGM_GetAuthID( CBasePlayer *pPlayer )
void GGM_ClientPutinServer( edict_t *pEntity, CBasePlayer *pPlayer ) void GGM_ClientPutinServer( edict_t *pEntity, CBasePlayer *pPlayer )
{ {
if( mp_touchmenu.value && pPlayer->gravgunmod_data.m_state == STATE_UNINITIALIZED ) if( mp_touchmenu.value && pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED )
g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 ); g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 );
pPlayer->gravgunmod_data.m_state = STATE_CONNECTED; pPlayer->gravgunmod_data.iState = STATE_CONNECTED;
pPlayer->gravgunmod_data.m_flEntTime = 0; pPlayer->gravgunmod_data.flEntTime = 0;
pPlayer->gravgunmod_data.m_flEntScope = 0; pPlayer->gravgunmod_data.flEntScore = 0;
pPlayer->gravgunmod_data.menu.pPlayer = pPlayer; pPlayer->gravgunmod_data.menu.pPlayer = pPlayer;
pPlayer->gravgunmod_data.menu.Clear(); pPlayer->gravgunmod_data.menu.Clear();
pPlayer->gravgunmod_data.pState = GGM_GetState( GGM_GetAuthID(pPlayer), STRING(pEntity->v.netname) ); pPlayer->gravgunmod_data.pState = GGM_GetState( GGM_GetAuthID(pPlayer), STRING(pEntity->v.netname) );
@ -894,7 +894,7 @@ void GGM_SaveState( CBasePlayer *pPlayer )
pState->t.iFrags = pPlayer->pev->frags; pState->t.iFrags = pPlayer->pev->frags;
pState->t.iDeaths = pPlayer->m_iDeaths; pState->t.iDeaths = pPlayer->m_iDeaths;
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
return; return;
if( pPlayer->pev->health <= 0 ) if( pPlayer->pev->health <= 0 )
@ -963,7 +963,7 @@ bool GGM_RestorePosition( CBasePlayer *pPlayer, struct GGMPosition *pos )
{ {
if( !COOP_SetDefaultSpawnPosition( pPlayer ) ) if( !COOP_SetDefaultSpawnPosition( pPlayer ) )
g_pGameRules->GetPlayerSpawnSpot( pPlayer ); g_pGameRules->GetPlayerSpawnSpot( pPlayer );
if( pPlayer->gravgunmod_data.m_state == STATE_POINT_SELECT ) if( pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT )
return false; return false;
} }
@ -1041,18 +1041,18 @@ void ClientPutInServer( edict_t *client );
bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
{ {
if( pPlayer->gravgunmod_data.m_state == STATE_UNINITIALIZED ) if( pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED )
{ {
ClientPutInServer( pPlayer->edict() ); ClientPutInServer( pPlayer->edict() );
return true; return true;
} }
if( ( mp_coop.value || mp_spectator.value ) && pPlayer->gravgunmod_data.m_state == STATE_CONNECTED || !pPlayer->gravgunmod_data.pState ) if( ( mp_coop.value || mp_spectator.value ) && pPlayer->gravgunmod_data.iState == STATE_CONNECTED || !pPlayer->gravgunmod_data.pState )
{ {
if( !pPlayer->gravgunmod_data.pState ) if( !pPlayer->gravgunmod_data.pState )
GGM_ChatPrintf( pPlayer, "This nickname busy! Please login or change nickname\n" ); GGM_ChatPrintf( pPlayer, "This nickname busy! Please login or change nickname\n" );
pPlayer->gravgunmod_data.m_state = STATE_SPECTATOR_BEGIN; pPlayer->gravgunmod_data.iState = STATE_SPECTATOR_BEGIN;
pPlayer->RemoveAllItems( TRUE ); pPlayer->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( pPlayer ); UTIL_BecomeSpectator( pPlayer );
if( !COOP_SetDefaultSpawnPosition( pPlayer ) ) if( !COOP_SetDefaultSpawnPosition( pPlayer ) )
@ -1060,7 +1060,7 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
return true; return true;
} }
if( mp_coop.value && pPlayer->gravgunmod_data.m_state == STATE_POINT_SELECT && !(pPlayer->pev->flags & FL_SPECTATOR) ) if( mp_coop.value && pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT && !(pPlayer->pev->flags & FL_SPECTATOR) )
{ {
pPlayer->RemoveAllItems( TRUE ); pPlayer->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( pPlayer ); UTIL_BecomeSpectator( pPlayer );
@ -1072,9 +1072,9 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
if( mp_coop.value ) if( mp_coop.value )
{ {
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
{ {
pPlayer->gravgunmod_data.m_state = STATE_SPAWNED; pPlayer->gravgunmod_data.iState = STATE_SPAWNED;
g_fPause = false; g_fPause = false;
if( GGM_RestoreState( pPlayer ) ) if( GGM_RestoreState( pPlayer ) )
{ {
@ -1111,9 +1111,9 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
} }
else else
{ {
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState != STATE_SPAWNED )
{ {
pPlayer->gravgunmod_data.m_state = STATE_SPAWNED; pPlayer->gravgunmod_data.iState = STATE_SPAWNED;
g_fPause = false; g_fPause = false;
if( GGM_RestoreState( pPlayer ) ) if( GGM_RestoreState( pPlayer ) )
{ {
@ -1126,7 +1126,7 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
g_fPause = false; g_fPause = false;
return pPlayer->gravgunmod_data.m_state != STATE_SPAWNED; return pPlayer->gravgunmod_data.iState != STATE_SPAWNED;
} }
void GGM_Logout( CBasePlayer *pPlayer ) void GGM_Logout( CBasePlayer *pPlayer )
@ -1159,11 +1159,11 @@ void GGM_Logout( CBasePlayer *pPlayer )
break; break;
} }
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED )
GGM_SaveState( pPlayer ); GGM_SaveState( pPlayer );
pPlayer->gravgunmod_data.pState = GGM_GetState(uid, name); pPlayer->gravgunmod_data.pState = GGM_GetState(uid, name);
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED )
GGM_RestoreState( pPlayer ); GGM_RestoreState( pPlayer );
// remove login record // remove login record
@ -1311,7 +1311,7 @@ void GGM_RegName_f( CBasePlayer *pPlayer )
if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), true ) ) if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), true ) )
return; return;
strncpy( pPlayer->gravgunmod_data.registering_name, CMD_ARGV(1), 31 ); strncpy( pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1), 31 );
CLIENT_COMMAND( pPlayer->edict(), "messagemode reg_Password\n"); CLIENT_COMMAND( pPlayer->edict(), "messagemode reg_Password\n");
} }
@ -1340,7 +1340,7 @@ void GGM_RegPassword_f( CBasePlayer *pPlayer )
if( CMD_ARGC() != 2 ) if( CMD_ARGC() != 2 )
return; return;
GGM_Register( pPlayer, pPlayer->gravgunmod_data.registering_name, CMD_ARGV(1) ); GGM_Register( pPlayer, pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1) );
} }
void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password ) void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password )
@ -1401,7 +1401,7 @@ void GGM_Login( CBasePlayer *pPlayer, const char *name, const char *password )
pPlayer->gravgunmod_data.pState = pState; pPlayer->gravgunmod_data.pState = pState;
GGM_ChatPrintf( pPlayer, "Successfully logged in as %s\n", name ); GGM_ChatPrintf( pPlayer, "Successfully logged in as %s\n", name );
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED ) if( pPlayer->gravgunmod_data.iState == STATE_SPAWNED )
GGM_RestoreState( pPlayer ); GGM_RestoreState( pPlayer );
} }
@ -1414,7 +1414,7 @@ void GGM_LoginPassword_f( CBasePlayer *pPlayer )
if( CMD_ARGC() != 2 ) if( CMD_ARGC() != 2 )
return; return;
GGM_Login( pPlayer, pPlayer->gravgunmod_data.registering_name, CMD_ARGV(1) ); GGM_Login( pPlayer, pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1) );
} }
void GGM_LoginName_f( CBasePlayer *pPlayer ) void GGM_LoginName_f( CBasePlayer *pPlayer )
@ -1428,7 +1428,7 @@ void GGM_LoginName_f( CBasePlayer *pPlayer )
if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), false ) ) if( !GGM_CheckUserName( pPlayer, CMD_ARGV(1), false ) )
return; return;
strncpy( pPlayer->gravgunmod_data.registering_name, CMD_ARGV(1), 31 ); strncpy( pPlayer->gravgunmod_data.fRegisterInput, CMD_ARGV(1), 31 );
CLIENT_COMMAND( pPlayer->edict(), "messagemode login_Password\n"); CLIENT_COMMAND( pPlayer->edict(), "messagemode login_Password\n");
} }
@ -1749,7 +1749,7 @@ void GGM_PlayerMenu::Show()
{ {
if( !pPlayer ) if( !pPlayer )
return; return;
if( pPlayer->gravgunmod_data.m_fTouchMenu) if( pPlayer->gravgunmod_data.fTouchMenu)
{ {
char buf[256]; char buf[256];
@ -1954,7 +1954,7 @@ bool GGM_HelpCommand( CBasePlayer *pPlayer, const char *name )
void GGM_InitialMenus( CBasePlayer *pPlayer ) void GGM_InitialMenus( CBasePlayer *pPlayer )
{ {
pPlayer->gravgunmod_data.touch_loading = false; pPlayer->gravgunmod_data.fTouchLoading = false;
if( !GGM_MenuCommand( pPlayer, "init" ) && mp_coop.value ) if( !GGM_MenuCommand( pPlayer, "init" ) && mp_coop.value )
pPlayer->gravgunmod_data.menu.New( "COOP SERVER" ) pPlayer->gravgunmod_data.menu.New( "COOP SERVER" )
@ -1978,7 +1978,7 @@ bool GGM_TouchCommand( CBasePlayer *pPlayer, const char *pcmd )
return true; return true;
} }
if( !pPlayer->gravgunmod_data.touch_loading ) if( !pPlayer->gravgunmod_data.fTouchLoading )
return false; return false;
if( FStrEq(pcmd, "m1")) if( FStrEq(pcmd, "m1"))
@ -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) ) if( pEnt && requestID == 111 && FStrEq( cvarName , "touch_enable" ) && atoi( value) )
{ {
CBasePlayer *player = (CBasePlayer * ) CBaseEntity::Instance( (edict_t*)pEnt ); CBasePlayer *player = (CBasePlayer * ) CBaseEntity::Instance( (edict_t*)pEnt );
player->gravgunmod_data.m_fTouchMenu = !!atof( value ); player->gravgunmod_data.fTouchMenu = !!atof( value );
CLIENT_COMMAND((edict_t*)pEnt, "m1\n"); CLIENT_COMMAND((edict_t*)pEnt, "m1\n");
player->gravgunmod_data.touch_loading = true; player->gravgunmod_data.fTouchLoading = true;
const char *name = NULL, *command = NULL; const char *name = NULL, *command = NULL;
if( mp_coop.value ) if( mp_coop.value )

16
dlls/gravgunmod.h

@ -165,16 +165,16 @@ struct GGMPlayerState
struct GGMData struct GGMData
{ {
float m_flSpawnTime; float flSpawnTime;
PlayerState m_state; PlayerState iState;
bool m_fTouchMenu; bool fTouchMenu;
int m_iLocalConfirm; int iLocalConfirm;
float m_flEntScope; float flEntScore;
float m_flEntTime; float flEntTime;
GGM_PlayerMenu menu; GGM_PlayerMenu menu;
bool touch_loading; bool fTouchLoading;
struct GGMPlayerState *pState; struct GGMPlayerState *pState;
char registering_name[32]; char fRegisterInput[32];
}; };
struct GGMPlayerState *GGM_GetState(const char *uid, const char *name); struct GGMPlayerState *GGM_GetState(const char *uid, const char *name);

10
dlls/multiplay_gamerules.cpp

@ -486,10 +486,10 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
MESSAGE_END(); MESSAGE_END();
} }
if( pl->gravgunmod_data.m_state <= STATE_CONNECTED ) if( pl->gravgunmod_data.iState <= STATE_CONNECTED )
ClientPutInServer( pl->edict() ); ClientPutInServer( pl->edict() );
if( pl->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN && !pl->gravgunmod_data.m_fTouchMenu ) if( pl->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN && !pl->gravgunmod_data.fTouchMenu )
GGM_InitialMenus( pl ); GGM_InitialMenus( pl );
} }
@ -563,10 +563,10 @@ BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity
//========================================================= //=========================================================
void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer ) void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer )
{ {
if( !mp_coop.value && pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN ) if( !mp_coop.value && pPlayer->gravgunmod_data.iState == STATE_SPECTATOR_BEGIN )
if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) )
UTIL_SpawnPlayer( pPlayer ); UTIL_SpawnPlayer( pPlayer );
if( pPlayer->gravgunmod_data.m_state == STATE_UNINITIALIZED ) if( pPlayer->gravgunmod_data.iState == STATE_UNINITIALIZED )
if( pPlayer->m_afButtonPressed || pPlayer->pev->button ) if( pPlayer->m_afButtonPressed || pPlayer->pev->button )
{ {
ClientPutInServer( pPlayer->edict() ); ClientPutInServer( pPlayer->edict() );
@ -576,7 +576,7 @@ void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer )
return; return;
} }
if( pPlayer->gravgunmod_data.m_state == STATE_POINT_SELECT ) if( pPlayer->gravgunmod_data.iState == STATE_POINT_SELECT )
{ {
if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) )
pPlayer->Spawn(); pPlayer->Spawn();

4
dlls/player.cpp

@ -2584,7 +2584,7 @@ void CBasePlayer::PostThink()
} }
// Handle Tank controlling // Handle Tank controlling
if( m_pTank && gravgunmod_data.m_state == STATE_SPAWNED ) if( m_pTank && gravgunmod_data.iState == STATE_SPAWNED )
{ {
// if they've moved too far from the gun, or selected a weapon, unuse the gun // if they've moved too far from the gun, or selected a weapon, unuse the gun
if( m_pTank->OnControls( pev ) && !pev->weaponmodel ) if( m_pTank->OnControls( pev ) && !pev->weaponmodel )
@ -3002,7 +3002,7 @@ void CBasePlayer::Spawn( void )
m_lastx = m_lasty = 0; m_lastx = m_lasty = 0;
m_flNextChatTime = gpGlobals->time; m_flNextChatTime = gpGlobals->time;
gravgunmod_data.m_flSpawnTime = gpGlobals->time; gravgunmod_data.flSpawnTime = gpGlobals->time;
g_pGameRules->PlayerSpawn( this ); g_pGameRules->PlayerSpawn( this );
g_flSemclipTime = 0; g_flSemclipTime = 0;

2
dlls/singleplay_gamerules.cpp

@ -121,7 +121,7 @@ float CHalfLifeRules::FlPlayerFallDamage( CBasePlayer *pPlayer )
//========================================================= //=========================================================
void CHalfLifeRules::PlayerSpawn( CBasePlayer *pPlayer ) void CHalfLifeRules::PlayerSpawn( CBasePlayer *pPlayer )
{ {
pPlayer->gravgunmod_data.m_state = STATE_SPAWNED; pPlayer->gravgunmod_data.iState = STATE_SPAWNED;
} }
//========================================================= //=========================================================

10
dlls/triggers.cpp

@ -1604,7 +1604,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
continue; continue;
// count only players spawned more 30 seconds ago // count only players spawned more 30 seconds ago
if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.m_flSpawnTime ) > 30 ) && plr->pev->modelindex ) if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.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_CoopPrintMessage("%s^7 trying activate changelevel too early\n", UTIL_CoopPlayerName( pPlayer ));
UTIL_CleanSpawnPoint( pPlayer->pev->origin, 50 ); UTIL_CleanSpawnPoint( pPlayer->pev->origin, 50 );
m_coopData.flRepeatTimer = gpGlobals->time; m_coopData.flRepeatTimer = gpGlobals->time;
pPlayer->gravgunmod_data.m_iLocalConfirm = -2; pPlayer->gravgunmod_data.iLocalConfirm = -2;
} }
ClientPrint( pActivator->pev, HUD_PRINTCENTER, "Too early! You or other players near you\nplaying less than 30 seconds!" ); 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 ); CBaseEntity *plr = UTIL_PlayerByIndex( i );
if( plr && plr->IsPlayer() && ( !FindTriggerTransition( m_szLandmarkName ) || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.m_flSpawnTime ) > 30 || m_coopData.fSkipSpawnCheck ) ) if( plr && plr->IsPlayer() && ( !FindTriggerTransition( m_szLandmarkName ) || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.flSpawnTime ) > 30 || m_coopData.fSkipSpawnCheck ) )
{ {
if( InTransitionVolume( plr, m_szLandmarkName )) 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 ); ALERT( at_console, "There are %d players in transition volume %s\n", count, m_szLandmarkName );
} }
else if( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->gravgunmod_data.m_flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) ) else if( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->gravgunmod_data.flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) )
{ {
if( !m_coopData.fSkipSpawnCheck ) if( !m_coopData.fSkipSpawnCheck )
{ {
@ -1799,7 +1799,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
if( plr ) if( plr )
{ {
GGM_SaveState( plr ); GGM_SaveState( plr );
plr->gravgunmod_data.m_state = STATE_UNINITIALIZED; plr->gravgunmod_data.iState = STATE_UNINITIALIZED;
plr->RemoveAllItems( TRUE ); plr->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( plr ); UTIL_BecomeSpectator( plr );
// HACK: force perform reconnection // HACK: force perform reconnection

Loading…
Cancel
Save