I failed to have the inside rock bug after these changes but it might be luck
float pitch = 0;
SkyBox *skybox = NULL;
bool cameramode = 0;
-bool firstload = 0;
+bool firstLoadDone = false;
Texture hawktexture;
float hawkyaw = 0;
extern float yaw, pitch;
extern SkyBox *skybox;
extern bool cameramode;
-extern bool firstload;
+extern bool firstLoadDone;
extern float leveltime;
extern float wonleveltime;
mainmenu = 1;
stillloading = 0;
- firstload = 0;
+ firstLoadDone = false;
newdetail = detail;
newscreenwidth = screenwidth;
}
//TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.hpp
+/* Loads models and textures which only needs to be loaded once */
void Game::LoadStuff()
{
- static float temptexdetail;
- static float viewdistdetail;
+ float temptexdetail;
+ float viewdistdetail;
float megascale = 1;
LOGFUNC;
gameon = 1;
mainmenu = 0;
- firstload = 0;
-
//Fix knife stab, too lazy to do it manually
XYZ moveamount;
moveamount = 0;
changedelay = 1;
visibleloading = false;
+ firstLoadDone = true;
}
char buf[32];
snprintf(buf, 32, "map%d", which + 1); // challenges
Loadlevel(buf);
- } else
+ } else {
Loadlevel("mapsave");
+ }
}
void Game::Loadlevel(const std::string& name, bool tutorial)
oldmusicvolume[2] = 0;
oldmusicvolume[3] = 0;
- if (!firstload)
- firstload = 1;
-
leveltime = 0;
wonleveltime = 0;
visibleloading = false;
loading = 2;
loadtime = 0;
targetlevel = 7;
- if (!firstload)
+ if (!firstLoadDone) {
LoadStuff();
+ }
whichchoice = 0;
actuallevel = campaignlevels[actuallevel].nextlevel.front();
visibleloading = true;
loading = 2;
loadtime = 0;
targetlevel = 7;
- if (firstload)
+ if (firstLoadDone) {
TickOnceAfter();
- else
+ } else {
LoadStuff();
+ }
whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - Account::active().getCampaignChoicesMade();
actuallevel = (Account::active().getCampaignChoicesMade() > 0 ? campaignlevels[Account::active().getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0);
visibleloading = true;
loading = 2;
loadtime = 0;
targetlevel = -1;
- if (firstload) {
+ if (firstLoadDone) {
TickOnceAfter();
- } else
+ } else {
LoadStuff();
+ }
Loadlevel(-1);
mainmenu = 0;
loading = 2;
loadtime = 0;
targetlevel = selected;
- if (firstload)
+ if (firstLoadDone) {
TickOnceAfter();
- else
+ } else {
LoadStuff();
+ }
Loadlevel(selected);
campaign = 0;