// 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; }
void InitEnvironmentFromLoad(void) { // in DB menus - we only destroy the current environment // after we have selected a leve, to load - WE could // be going TO ANY ENV or CHARACTER here (ughh) // this is an entire game destroy (with no save) killing // both the env and the character followed by a complete // game restart // environment clean up - sets up the load info Destroy_CurrentEnvironment(); // then the REST DestroyAllStrategyBlocks(); #if MaxImageGroups>1 SetCurrentImageGroup(0); // FOR ENV DeallocateCurrentImages(); #endif /* Patrick: 26/6/97 Stop and remove all sounds here */ SoundSys_StopAll(); SoundSys_RemoveAll(); CDDA_Stop(); // start the loading - we load the player InitCharacter(); // intis the char LoadRifFile(); // env // do all the ness processing // start games calles FormatSaveBuffer and // Process System Objects AssignAllSBNames(); // Set the timer, or we have just taken // 10 secs for the frame /***** No need to do frame counter stuff in a computer! *****/ /* Patrick: 26/6/97 Load our sounds for the new env */ LoadSounds("PLAYER"); }
void LoadedNPC::Load(int progress_start,int progress_interval) { Set_Progress_Bar_Position(progress_start); if (filename) { npc_rif = avp_load_rif_non_env(filename); if (INVALID_RIFFHANDLE != npc_rif) { #if MaxImageGroups>1 for (img_group=FIRST_FREE_IMAGE_GROUP; image_groups.contains(img_group); ++img_group) ; GLOBALASSERT(img_group<MaxImageGroups); image_groups.add_entry(img_group); SetCurrentImageGroup(img_group); // PROBLEM AT PRESENT, copy_rif_data changes this #endif Set_Progress_Bar_Position(progress_start+progress_interval/2); copy_rif_data(npc_rif,CCF_IMAGEGROUPSET + CCF_LOAD_AS_HIERARCHY_IF_EXISTS,progress_start+progress_interval/2,progress_interval/2); unload_rif(npc_rif); // doesnt destroy copied data } } }
void LoadRifFile() { char file_and_path[100]; int i = 0; Set_Progress_Bar_Position(PBAR_LEVEL_START); // clear the dir names for(i = 0; i < 100; i++) { file_and_path[i] = (char)0; EnvFileName[i] = (char)0; LevelDir[i] = (char)0; } // Set up the dirname for the Rif load catpathandextension(&file_and_path[0], (char *)&GameDataDirName[0]); catpathandextension(&file_and_path[0], Env_List[AvP.CurrentEnv]->main); /* root of the file name,smae as dir*/ catpathandextension(&file_and_path[0], (char *)&FileNameExtension[0]); /* extension*/ env_rif = avp_load_rif((const char*)&file_and_path[0]); Set_Progress_Bar_Position(PBAR_LEVEL_START+PBAR_LEVEL_INTERVAL*.4); if(INVALID_RIFFHANDLE == env_rif) { finiObjects(); exit(0x3421); }; #if MaxImageGroups>1 SetCurrentImageGroup(2); // FOR ENV #endif copy_rif_data(env_rif,CCF_ENVIRONMENT,PBAR_LEVEL_START+PBAR_LEVEL_INTERVAL*.4,PBAR_LEVEL_INTERVAL*.6); //setup_shading_tables(); }
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(); }