int CBaseEntity::Restore( CRestore &restore ) { int status; status = restore.ReadEntVars( "ENTVARS", pev ); if ( status ) status = restore.ReadFields( "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) ); //LLAPb begin //Precache script //if ( status ) //status = restore.ReadScriptVars( "SAMOGON" ... ); //Find function "LOAD", pass args to it, but don't call it!!! //LLAPb end if ( pev->modelindex != 0 && !FStringNull(pev->model) ) { Vector mins, maxs; mins = pev->mins; // Set model is about to destroy these maxs = pev->maxs; PRECACHE_MODEL( (char *)STRING(pev->model) ); SET_MODEL(ENT(pev), STRING(pev->model)); UTIL_SetSize(pev, mins, maxs); // Reset them } return status; }
int CGlobalState::Restore( CRestore &restore ) { int i, listCount; globalentity_t tmpEntity; ClearStates(); if ( !restore.ReadFields( "GLOBAL", this, m_SaveData, ARRAYSIZE(m_SaveData) ) ) return 0; listCount = m_listCount; // Get new list count m_listCount = 0; // Clear loaded data for ( i = 0; i < listCount; i++ ) { if ( !restore.ReadFields( "GENT", &tmpEntity, gGlobalEntitySaveData, ARRAYSIZE(gGlobalEntitySaveData) ) ) return 0; EntityAdd( MAKE_STRING(tmpEntity.name), MAKE_STRING(tmpEntity.levelName), tmpEntity.state ); } return 1; }
int CBaseEntity::Restore(CRestore &restore) { int status; status = restore.ReadEntVars("ENTVARS", pev); if(status) status = restore.ReadFields("BASE", this, m_SaveData, ARRAYSIZE(m_SaveData)); if(pev->modelindex != 0 && !FStringNull(pev->model)) { Vector mins, maxs; mins = pev->mins; // Set model is about to destroy these maxs = pev->maxs; PRECACHE_MODEL((char *)STRING(pev->model)); SET_MODEL(ENT(pev), STRING(pev->model)); UTIL_SetSize(pev, mins, maxs); // Reset them } return status; }
int CApache::Restore( CRestore &restore ) { if ( !CBaseMonster::Restore(restore) ) return 0; int status = restore.ReadFields( "CApache", this, m_SaveData, ARRAYSIZE(m_SaveData) ); // lampe if ( pev->spawnflags & SF_APACHE_LENSFLARE ) m_bFlashLightOn = FALSE; return status; }
int CTank::Restore( CRestore &restore ) // s execute lors du chargement rapide { if ( !CBaseMonster::Restore(restore) ) return 0; int status = restore.ReadFields( "CTank", this, m_SaveData, ARRAYSIZE(m_SaveData) ); //----------------------- ALERT ( at_console,"TANK RESTORE -----------------\n" ); // restoration de la camera bSetView = 1; // restoration du tank CBaseEntity *pFind = UTIL_FindEntityByClassname( NULL, "info_tank_model" ); while ( pFind != NULL && pFind == this ) pFind = UTIL_FindEntityByClassname( pFind, "info_tank_model" ); // chargement if ( pFind == NULL ) { ALERT ( at_console, "TANK RESTORE : il n'y a qu'un tankmodel : simple chargement\n" ); return status; } // changement de niveau ALERT ( at_console, "TANK RESTORE : autre tankmodel : changement de niveau\n" ); CTank *pModelFound = (CTank*)pFind; m_pTankBSP = pModelFound->m_pTankBSP; // changement de tankbsp m_pTankBSP->m_pTankModel = this; pModelFound->SetThink ( SUB_Remove ); // destruction du tankmodel inutile pModelFound->pev->nextthink = gpGlobals->time + 0.1; pModelFound->pev->rendermode = kRenderTransTexture; pModelFound->pev->renderamt = 0; m_pTankBSP->pev->angles = pev->angles; m_pTankBSP->pev->origin = pev->origin; // tite boite edict_t *pentTrouve; CBaseEntity *pTrouve; CBasePlayer *pPlayer = (CBasePlayer*) UTIL_FindEntityByClassname ( NULL, "player" ); pentTrouve = FIND_ENTITY_BY_CLASSNAME( NULL, "info_teleport_destination" ); if ( pentTrouve == NULL ) { ALERT ( at_console , "info_tank_model : pas de teleport destination !!!\n" ); return status; } else { pTrouve = CBaseEntity :: Instance ( pentTrouve ); Vector vecTeleport = pTrouve->pev->origin; UTIL_SetOrigin( pPlayer->pev, vecTeleport ); } return status; }