MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / VersionSwitch

Method VersionSwitch

Source/Fodder.cpp:3464–3533  ·  view source on GitHub ↗

* This function loads a new version of the game, and is generally called on startup, * or AFTER a button on the campaign select screen is pushed * */

Source from the content-addressed store, hash-verified

3462 *
3463 */
3464void cFodder::VersionSwitch(const sGameVersion* pVersion) {
3465 const sGameVersion* VersionPrevious = mVersionCurrent;
3466
3467 if (!pVersion)
3468 return;
3469
3470 if (mVersionCurrent == pVersion)
3471 return;
3472
3473 Image_FadeOut();
3474
3475 mVersionCurrent = pVersion;
3476
3477 WindowTitleBaseSetup();
3478
3479 // Sound must be released first, to unlock the audio device
3480 // But only if we actually have to change the sound object
3481 if (mVersionCurrent && VersionPrevious && !(mVersionCurrent->CanUseAmigaSound() && VersionPrevious->CanUseAmigaSound()))
3482 mSound = 0;
3483
3484 mResources = g_Resource = mVersionCurrent->GetResources();
3485 mGraphics = mVersionCurrent->GetGraphics();
3486
3487 if(!mSound)
3488 mSound = mVersionCurrent->GetSound();
3489
3490 if(!mResources) {
3491 std::cout << "Unknown Platform";
3492 exit(1);
3493 }
3494
3495 mGUI_Select_File_ShownItems = PLATFORM_BASED(4, 5);
3496
3497 Window_UpdateScreenSize();
3498
3499 mGraphics->Load_Sprite_Font();
3500 mGraphics->Load_Hill_Data();
3501 mGraphics->Load_pStuff();
3502
3503 if (mPhase_In_Progress) {
3504 mGraphics->SetActiveSpriteSheet(eGFX_IN_GAME);
3505
3506 // Reload Map Data
3507 Map_Load_Resources();
3508 Map_Overview_Prepare();
3509 mGraphics->MapTiles_Draw();
3510
3511 // Redraw sidebar
3512 mGUI_Sidebar_Setup = 0;
3513 while(mGUI_Sidebar_Setup>=0)
3514 GUI_Sidebar_Setup();
3515
3516 mSurface->palette_FadeTowardNew();
3517 mMusicTrack_unk = mMusic_CurrentTrack;
3518 mMusic_CurrentTrack = 0;
3519 }
3520
3521 if(mRecruit_Screen_Active && mVersionCurrent->hasGfx(eGFX_HILL)) {

Callers 2

menu_loopFunction · 0.80
quickServiceScreenFunction · 0.80

Calls 12

CanUseAmigaSoundMethod · 0.80
GetResourcesMethod · 0.80
palette_FadeTowardNewMethod · 0.80
hasGfxMethod · 0.80
GetGraphicsMethod · 0.45
GetSoundMethod · 0.45
Load_Sprite_FontMethod · 0.45
Load_Hill_DataMethod · 0.45
Load_pStuffMethod · 0.45
SetActiveSpriteSheetMethod · 0.45
MapTiles_DrawMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected