MCPcopy Create free account
hub / github.com/NBlood/NBlood / LoadGame

Function LoadGame

source/sw/src/save.cpp:745–1301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743
744
745int LoadGame(short save_num)
746{
747 MFILE_READ fil;
748 int i,j,saveisshot=0;
749 short ndx,SpriteNum,sectnum;
750 PLAYERp pp = NULL;
751 SPRITEp sp;
752 USERp u;
753 SECTOR_OBJECTp sop;
754 SECT_USERp sectu;
755 int8_t code;
756 ANIMp a;
757 uint8_t data_code;
758 int16_t data_ndx;
759 PANEL_SPRITEp psp,next,cur;
760 PANEL_SPRITE tpanel_sprite;
761 char game_name[80];
762 OrgTileP otp, next_otp;
763
764 int RotNdx;
765 int StateStartNdx;
766 int StateNdx;
767 int StateEndNdx;
768 extern SWBOOL InMenuLevel;
769
770 Saveable_Init();
771
772 sprintf(game_name,"game%d.sav",save_num);
773 if ((fil = MOPEN_READ(game_name)) == MOPEN_READ_ERR)
774 return -1;
775
776 MREAD(&i,sizeof(i),1,fil);
777 if (i != GameVersion)
778 {
779 MCLOSE_READ(fil);
780 return -1;
781 }
782
783 // Don't terminate until you've made sure conditions are valid for loading.
784 if (InMenuLevel)
785 StopSong();
786 else
787 TerminateLevel();
788 Terminate3DSounds();
789
790 Terminate3DSounds();
791
792 MREAD(SaveGameDescr[save_num], sizeof(SaveGameDescr[save_num]),1,fil);
793
794 MREAD(&Level,sizeof(Level),1,fil);
795 MREAD(&Skill,sizeof(Skill),1,fil);
796
797 ScreenLoadSaveSetup(Player + myconnectindex);
798 ScreenLoad(fil);
799 ScreenTileUnLock();
800
801 MREAD(&numplayers, sizeof(numplayers),1,fil);
802 MREAD(&myconnectindex,sizeof(myconnectindex),1,fil);

Callers 2

MNU_QuickLoadCustomFunction · 0.70
MNU_GetLoadCustomFunction · 0.70

Calls 15

Saveable_InitFunction · 0.85
StopSongFunction · 0.85
TerminateLevelFunction · 0.85
Terminate3DSoundsFunction · 0.85
ScreenLoadSaveSetupFunction · 0.85
ScreenLoadFunction · 0.85
ScreenTileUnLockFunction · 0.85
LoadSymDataInfoFunction · 0.85
LoadSymCodeInfoFunction · 0.85
CallocMemFunction · 0.85
PanelNdxToSpriteFunction · 0.85
SetupPreCacheFunction · 0.85

Tested by

no test coverage detected