// project spec game exit void ExitGame(void) { if(player_rif != INVALID_RIFFHANDLE) { avp_undo_rif_load(player_rif); player_rif=INVALID_RIFFHANDLE; } if(alien_weapon_rif != INVALID_RIFFHANDLE) { avp_undo_rif_load(alien_weapon_rif); alien_weapon_rif=INVALID_RIFFHANDLE; } if(marine_weapon_rif != INVALID_RIFFHANDLE) { avp_undo_rif_load(marine_weapon_rif); marine_weapon_rif=INVALID_RIFFHANDLE; } if(predator_weapon_rif != INVALID_RIFFHANDLE) { avp_undo_rif_load(predator_weapon_rif); predator_weapon_rif=INVALID_RIFFHANDLE; } #if MaxImageGroups>1 SetCurrentImageGroup(0); DeallocateCurrentImages(); #endif }
void LoadedNPC::Unload() { if (INVALID_RIFFHANDLE != npc_rif) { #if MaxImageGroups>1 image_groups.delete_entry(img_group); SetCurrentImageGroup(img_group); DeallocateCurrentImages(); #endif avp_undo_rif_load(npc_rif); // destroys copied shapes } npc_rif = INVALID_RIFFHANDLE; }
int Destroy_CurrentEnvironment(void) { // RWH destroys all en specific data // function to change environment when we // are playing a game - environmnet reset // this stores all info we need TimeStampedMessage("Beginning Destroy_CurrentEnvironment"); //CreateLevelMetablocks(AvP.CurrentEnv); TimeStampedMessage("After CreateLevelMetablocks"); /*----------------------Patrick 14/3/97----------------------- Clean up AI systems at end of level --------------------------------------------------------------*/ { int i ; i = maxstblocks; DestroyAllStrategyBlocks(); while(i--) ActiveStBlockList[i] = NULL; i = maxobjects; InitialiseObjectBlocks(); while(i --) ActiveBlockList[i] = NULL; } TimeStampedMessage("After object blocks"); //Get rid of all sounds //Deallocate memory for all shapes and hierarchy animations DeallocateSoundsAndPoolAllocatedMemory(); KillFarModuleLocs(); TimeStampedMessage("After KillFarModuleLocs"); CleanUpPheromoneSystem(); TimeStampedMessage("After CleanUpPheromoneSystem"); #if MaxImageGroups>1 SetCurrentImageGroup(2); // FOR ENV TimeStampedMessage("After SetCurrentImageGroup"); DeallocateCurrentImages(); TimeStampedMessage("After DeallocateCurrentImages"); #endif // now deasllocate the module vis array DeallocateModuleVisArrays(); TimeStampedMessage("After DeallocateModuleVisArrays"); /* destroy the VDB list */ InitialiseVDBs(); TimeStampedMessage("After InitialiseVDBs"); InitialiseTxAnimBlocks(); // RUN THE npcS ON OUR OWN TimeStampedMessage("After InitialiseTxAnimBlocks"); /* frees the memory from the env load*/ DeallocateModules(); TimeStampedMessage("After DeallocateModules"); avp_undo_rif_load(env_rif); TimeStampedMessage("After avp_undo_rif_load"); // set the Onscreenbloock lsit to zero NumOnScreenBlocks = 0; return(0); }
void InitCharacter() { /*** RWH cleans up the character initialisation it would be nice if this can be called when we load up a game of a different character ***/ // load charcater specific rif and sounds if(player_rif != INVALID_RIFFHANDLE) { // we already have a player loaded - delete the bastard avp_undo_rif_load(player_rif); } if(alien_weapon_rif != INVALID_RIFFHANDLE) { // we already have a player loaded - delete the bastard avp_undo_rif_load(alien_weapon_rif); } if(marine_weapon_rif != INVALID_RIFFHANDLE) { // we already have a player loaded - delete the bastard avp_undo_rif_load(marine_weapon_rif); } if(predator_weapon_rif != INVALID_RIFFHANDLE) { // we already have a player loaded - delete the bastard avp_undo_rif_load(predator_weapon_rif); } #if MaxImageGroups==1 InitialiseTextures(); #else SetCurrentImageGroup(0); DeallocateCurrentImages(); #endif //Start_Progress_Bar(); //Set_Progress_Bar_Position(PBAR_HUD_START); switch(AvP.Network) { case I_No_Network: { // set up the standard single player game switch(AvP.PlayerType) { case I_Marine: { marine_weapon_rif = avp_load_rif("avp_huds/marwep.rif"); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25); player_rif = avp_load_rif("avp_huds/marine.rif"); break; } case I_Predator: { predator_weapon_rif = avp_load_rif("avp_huds/pred_hud.rif"); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25); player_rif = avp_load_rif("avp_huds/predator.rif"); break; } case I_Alien: { #if ALIEN_DEMO alien_weapon_rif = avp_load_rif("alienavp_huds/alien_hud.rif"); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25); player_rif = avp_load_rif("alienavp_huds/alien.rif"); #else alien_weapon_rif = avp_load_rif("avp_huds/alien_hud.rif"); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25); player_rif = avp_load_rif("avp_huds/alien.rif"); #endif break; } default: { GLOBALASSERT(2<1); } } break; } default: { // set up a multiplayer game - here becuse we might end // up with a cooperative game //load all weapon rifs marine_weapon_rif = avp_load_rif("avp_huds/marwep.rif"); predator_weapon_rif = avp_load_rif("avp_huds/pred_hud.rif"); alien_weapon_rif = avp_load_rif("avp_huds/alien_hud.rif"); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25); player_rif = avp_load_rif("avp_huds/multip.rif"); } } //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.5); #if MaxImageGroups>1 SetCurrentImageGroup(0); #endif copy_rif_data(player_rif,CCF_IMAGEGROUPSET,PBAR_HUD_START+PBAR_HUD_INTERVAL*.5,PBAR_HUD_INTERVAL*.25); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.75); if(alien_weapon_rif!=INVALID_RIFFHANDLE) copy_rif_data(alien_weapon_rif,CCF_LOAD_AS_HIERARCHY_IF_EXISTS|CCF_IMAGEGROUPSET|CCF_DONT_INITIALISE_TEXTURES,PBAR_HUD_START+PBAR_HUD_INTERVAL*.5,PBAR_HUD_INTERVAL*.25); if(marine_weapon_rif!=INVALID_RIFFHANDLE) copy_rif_data(marine_weapon_rif,CCF_LOAD_AS_HIERARCHY_IF_EXISTS|CCF_IMAGEGROUPSET|CCF_DONT_INITIALISE_TEXTURES,PBAR_HUD_START+PBAR_HUD_INTERVAL*.5,PBAR_HUD_INTERVAL*.25); if(predator_weapon_rif!=INVALID_RIFFHANDLE) copy_rif_data(predator_weapon_rif,CCF_LOAD_AS_HIERARCHY_IF_EXISTS|CCF_IMAGEGROUPSET|CCF_DONT_INITIALISE_TEXTURES,PBAR_HUD_START+PBAR_HUD_INTERVAL*.5,PBAR_HUD_INTERVAL*.25); //Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL); copy_chunks_from_environment(0); /*KJL************************************* * Setup generic data for weapons etc * *************************************KJL*/ InitialiseEquipment(); InitHUD(); }