diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index d7c4c31f..34f39e31 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -39,77 +39,77 @@ const char* BoolToString(bool _b) bool GetButtonFromString(const char *pText, SDL_GameControllerButton *button) { - if ( *pText == '0' || - *pText == 'a' || - *pText == 'A' ) - { - *button = SDL_CONTROLLER_BUTTON_A; - return true; - } - if ( strcmp(pText, "1") == 0 || - *pText == 'b' || - *pText == 'B' ) - { - *button = SDL_CONTROLLER_BUTTON_B; - return true; - } - if ( *pText == '2' || - *pText == 'x' || - *pText == 'X' ) - { - *button = SDL_CONTROLLER_BUTTON_X; - return true; - } - if ( *pText == '3' || - *pText == 'y' || - *pText == 'Y' ) - { - *button = SDL_CONTROLLER_BUTTON_Y; - return true; - } - if ( *pText == '4' || - strcasecmp(pText, "BACK") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_BACK; - return true; - } - if ( *pText == '5' || - strcasecmp(pText, "GUIDE") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_GUIDE; - return true; - } - if ( *pText == '6' || - strcasecmp(pText, "START") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_START; - return true; - } - if ( *pText == '7' || - strcasecmp(pText, "LS") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_LEFTSTICK; - return true; - } - if ( *pText == '8' || - strcasecmp(pText, "RS") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_RIGHTSTICK; - return true; - } - if ( *pText == '9' || - strcasecmp(pText, "LB") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER; - return true; - } - if ( strcmp(pText, "10") == 0 || - strcasecmp(pText, "RB") == 0 ) - { - *button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; - return true; - } - return false; + if (*pText == '0' || + *pText == 'a' || + *pText == 'A') + { + *button = SDL_CONTROLLER_BUTTON_A; + return true; + } + if (strcmp(pText, "1") == 0 || + *pText == 'b' || + *pText == 'B') + { + *button = SDL_CONTROLLER_BUTTON_B; + return true; + } + if (*pText == '2' || + *pText == 'x' || + *pText == 'X') + { + *button = SDL_CONTROLLER_BUTTON_X; + return true; + } + if (*pText == '3' || + *pText == 'y' || + *pText == 'Y') + { + *button = SDL_CONTROLLER_BUTTON_Y; + return true; + } + if (*pText == '4' || + strcasecmp(pText, "BACK") == 0) + { + *button = SDL_CONTROLLER_BUTTON_BACK; + return true; + } + if (*pText == '5' || + strcasecmp(pText, "GUIDE") == 0) + { + *button = SDL_CONTROLLER_BUTTON_GUIDE; + return true; + } + if (*pText == '6' || + strcasecmp(pText, "START") == 0) + { + *button = SDL_CONTROLLER_BUTTON_START; + return true; + } + if (*pText == '7' || + strcasecmp(pText, "LS") == 0) + { + *button = SDL_CONTROLLER_BUTTON_LEFTSTICK; + return true; + } + if (*pText == '8' || + strcasecmp(pText, "RS") == 0) + { + *button = SDL_CONTROLLER_BUTTON_RIGHTSTICK; + return true; + } + if (*pText == '9' || + strcasecmp(pText, "LB") == 0) + { + *button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER; + return true; + } + if (strcmp(pText, "10") == 0 || + strcasecmp(pText, "RB") == 0) + { + *button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; + return true; + } + return false; } @@ -124,7 +124,7 @@ void Game::init(void) timerStartTime= SDL_GetTicks(); - glitchrunkludge = false; + glitchrunkludge = false; hascontrol = true; jumpheld = false; advancetext = false; @@ -195,8 +195,8 @@ void Game::init(void) useLinearFilter = false; advanced_mode = false; fullScreenEffect_badSignal = false; - // 0..5 - controllerSensitivity = 2; + // 0..5 + controllerSensitivity = 2; nodeathmode = false; nocutscenes = false; @@ -696,9 +696,9 @@ void Game::updatestate() int i; statedelay--; if(statedelay<=0){ - statedelay=0; - glitchrunkludge=false; - } + statedelay=0; + glitchrunkludge=false; + } if (statedelay <= 0) { switch(state) @@ -1387,14 +1387,14 @@ void Game::updatestate() if (timetrialrank > bestrank[timetriallevel] || bestrank[timetriallevel]==-1) { bestrank[timetriallevel] = timetrialrank; - if(timetrialrank>=3){ - if(timetriallevel==0) NETWORK_unlockAchievement("vvvvvvtimetrial_station1_fixed"); - if(timetriallevel==1) NETWORK_unlockAchievement("vvvvvvtimetrial_lab_fixed"); - if(timetriallevel==2) NETWORK_unlockAchievement("vvvvvvtimetrial_tower_fixed"); - if(timetriallevel==3) NETWORK_unlockAchievement("vvvvvvtimetrial_station2_fixed"); - if(timetriallevel==4) NETWORK_unlockAchievement("vvvvvvtimetrial_warp_fixed"); - if(timetriallevel==5) NETWORK_unlockAchievement("vvvvvvtimetrial_final_fixed"); - } + if(timetrialrank>=3){ + if(timetriallevel==0) NETWORK_unlockAchievement("vvvvvvtimetrial_station1_fixed"); + if(timetriallevel==1) NETWORK_unlockAchievement("vvvvvvtimetrial_lab_fixed"); + if(timetriallevel==2) NETWORK_unlockAchievement("vvvvvvtimetrial_tower_fixed"); + if(timetriallevel==3) NETWORK_unlockAchievement("vvvvvvtimetrial_station2_fixed"); + if(timetriallevel==4) NETWORK_unlockAchievement("vvvvvvtimetrial_warp_fixed"); + if(timetriallevel==5) NETWORK_unlockAchievement("vvvvvvtimetrial_final_fixed"); + } } savestats(); @@ -3094,7 +3094,7 @@ void Game::updatestate() break; case 3501: //Game complete! - NETWORK_unlockAchievement("vvvvvvgamecomplete"); + NETWORK_unlockAchievement("vvvvvvgamecomplete"); unlocknum(5); crewstats[0] = true; state++; @@ -3234,7 +3234,7 @@ void Game::updatestate() if (obj.flags[73] == 0) { //flip mode complete - NETWORK_unlockAchievement("vvvvvvgamecompleteflip"); + NETWORK_unlockAchievement("vvvvvvgamecompleteflip"); unlock[19] = true; } @@ -3250,26 +3250,26 @@ void Game::updatestate() } } - if (bestgamedeaths > -1) { - if (bestgamedeaths <= 500) { - NETWORK_unlockAchievement("vvvvvvcomplete500"); - } - if (bestgamedeaths <= 250) { - NETWORK_unlockAchievement("vvvvvvcomplete250"); - } - if (bestgamedeaths <= 100) { - NETWORK_unlockAchievement("vvvvvvcomplete100"); - } - if (bestgamedeaths <= 50) { - NETWORK_unlockAchievement("vvvvvvcomplete50"); - } - } + if (bestgamedeaths > -1) { + if (bestgamedeaths <= 500) { + NETWORK_unlockAchievement("vvvvvvcomplete500"); + } + if (bestgamedeaths <= 250) { + NETWORK_unlockAchievement("vvvvvvcomplete250"); + } + if (bestgamedeaths <= 100) { + NETWORK_unlockAchievement("vvvvvvcomplete100"); + } + if (bestgamedeaths <= 50) { + NETWORK_unlockAchievement("vvvvvvcomplete50"); + } + } savestats(); if (nodeathmode) { - NETWORK_unlockAchievement("vvvvvvmaster"); //bloody hell + NETWORK_unlockAchievement("vvvvvvmaster"); //bloody hell unlock[20] = true; state = 3520; statedelay = 0; @@ -4353,24 +4353,24 @@ void Game::loadstats() fullscreen = atoi(pText); } - if (pKey == "stretch") - { - stretchMode = atoi(pText); - } + if (pKey == "stretch") + { + stretchMode = atoi(pText); + } - if (pKey == "useLinearFilter") - { - useLinearFilter = atoi(pText); - } + if (pKey == "useLinearFilter") + { + useLinearFilter = atoi(pText); + } - if (pKey == "window_width") - { - width = atoi(pText); - } - if (pKey == "window_height") - { - height = atoi(pText); - } + if (pKey == "window_width") + { + width = atoi(pText); + } + if (pKey == "window_height") + { + height = atoi(pText); + } if (pKey == "noflashingmode") @@ -4438,13 +4438,13 @@ void Game::loadstats() graphics.screenbuffer->badSignalEffect = fullScreenEffect_badSignal; } - if (pKey == "usingmmmmmm") + if (pKey == "usingmmmmmm") { - if(atoi(pText)>0){ - usingmmmmmm = 1; - }else{ - usingmmmmmm = 0; - } + if(atoi(pText)>0){ + usingmmmmmm = 1; + }else{ + usingmmmmmm = 0; + } } if (pKey == "skipfakeload") @@ -4467,37 +4467,37 @@ void Game::loadstats() graphics.showmousecursor = atoi(pText); } - if (pKey == "flipButton") - { - SDL_GameControllerButton newButton; - if (GetButtonFromString(pText, &newButton)) - { - controllerButton_flip.push_back(newButton); - } - } + if (pKey == "flipButton") + { + SDL_GameControllerButton newButton; + if (GetButtonFromString(pText, &newButton)) + { + controllerButton_flip.push_back(newButton); + } + } - if (pKey == "enterButton") - { - SDL_GameControllerButton newButton; - if (GetButtonFromString(pText, &newButton)) - { - controllerButton_map.push_back(newButton); - } - } + if (pKey == "enterButton") + { + SDL_GameControllerButton newButton; + if (GetButtonFromString(pText, &newButton)) + { + controllerButton_map.push_back(newButton); + } + } - if (pKey == "escButton") - { - SDL_GameControllerButton newButton; - if (GetButtonFromString(pText, &newButton)) - { - controllerButton_esc.push_back(newButton); - } - } + if (pKey == "escButton") + { + SDL_GameControllerButton newButton; + if (GetButtonFromString(pText, &newButton)) + { + controllerButton_esc.push_back(newButton); + } + } - if (pKey == "controllerSensitivity") - { - controllerSensitivity = atoi(pText); - } + if (pKey == "controllerSensitivity") + { + controllerSensitivity = atoi(pText); + } } @@ -4715,9 +4715,9 @@ void Game::savestats() dataNode->LinkEndChild(msg); } - msg = new TiXmlElement( "controllerSensitivity" ); - msg->LinkEndChild( new TiXmlText( tu.String(controllerSensitivity).c_str())); - dataNode->LinkEndChild( msg ); + msg = new TiXmlElement( "controllerSensitivity" ); + msg->LinkEndChild( new TiXmlText( tu.String(controllerSensitivity).c_str())); + dataNode->LinkEndChild( msg ); FILESYSTEM_saveTiXmlDocument("saves/unlock.vvv", &doc); } @@ -5108,7 +5108,7 @@ void Game::loadquick() else if (pKey == "frames") { frames = atoi(pText); - frames = 0; + frames = 0; } else if (pKey == "seconds") { @@ -5376,7 +5376,7 @@ void Game::customloadquick(std::string savfile) else if (pKey == "frames") { frames = atoi(pText); - frames = 0; + frames = 0; } else if (pKey == "seconds") { @@ -6585,7 +6585,7 @@ void Game::loadtele() else if (pKey == "frames") { frames = atoi(pText); - frames = 0; + frames = 0; } else if (pKey == "seconds") { @@ -6662,25 +6662,25 @@ void Game::gameclock() /* test = true; std::ostringstream os; - os << hours << ":" << minutes << ":" << seconds << ", " << frames; + os << hours << ":" << minutes << ":" << seconds << ", " << frames; teststring = os.str(); */ - frames++; - if (frames >= 30) - { - frames -= 30; - seconds++; - if (seconds >= 60) - { - seconds -= 60; - minutes++; - if (minutes >= 60) - { - minutes -= 60; - hours++; - } - } - } + frames++; + if (frames >= 30) + { + frames -= 30; + seconds++; + if (seconds >= 60) + { + seconds -= 60; + minutes++; + if (minutes >= 60) + { + minutes -= 60; + hours++; + } + } + } } std::string Game::giventimestring( int hrs, int min, int sec ) @@ -6763,56 +6763,56 @@ void Game::createmenu( std::string t ) if (t == "mainmenu") { - #if defined(MAKEANDPLAY) - menuoptions[0] = "player levels"; - menuoptionsactive[0] = true; - menuoptions[1] = "graphic options"; - menuoptionsactive[1] = true; - menuoptions[2] = "game options"; - menuoptionsactive[2] = true; - menuoptions[3] = "quit game"; - menuoptionsactive[3] = true; - nummenuoptions = 4; - menuxoff = -16; - menuyoff = -10; - #elif !defined(MAKEANDPLAY) - #if defined(NO_CUSTOM_LEVELS) - menuoptions[0] = "start game"; - menuoptionsactive[0] = true; - menuoptions[1] = "graphic options"; - menuoptionsactive[1] = true; - menuoptions[2] = "game options"; - menuoptionsactive[2] = true; - menuoptions[3] = "view credits"; - menuoptionsactive[3] = true; - menuoptions[4] = "quit game"; - menuoptionsactive[4] = true; - nummenuoptions = 5; - menuxoff = -16; - menuyoff = -10; - #else - menuoptions[0] = "start game"; - menuoptionsactive[0] = true; - menuoptions[1] = "player levels"; - menuoptionsactive[1] = true; - menuoptions[2] = "graphic options"; - menuoptionsactive[2] = true; - menuoptions[3] = "game options"; - menuoptionsactive[3] = true; - menuoptions[4] = "view credits"; - menuoptionsactive[4] = true; - menuoptions[5] = "quit game"; - menuoptionsactive[5] = true; - nummenuoptions = 6; - menuxoff = -16; - menuyoff = -10; - #endif - #endif +#if defined(MAKEANDPLAY) + menuoptions[0] = "player levels"; + menuoptionsactive[0] = true; + menuoptions[1] = "graphic options"; + menuoptionsactive[1] = true; + menuoptions[2] = "game options"; + menuoptionsactive[2] = true; + menuoptions[3] = "quit game"; + menuoptionsactive[3] = true; + nummenuoptions = 4; + menuxoff = -16; + menuyoff = -10; +#elif !defined(MAKEANDPLAY) + #if defined(NO_CUSTOM_LEVELS) + menuoptions[0] = "start game"; + menuoptionsactive[0] = true; + menuoptions[1] = "graphic options"; + menuoptionsactive[1] = true; + menuoptions[2] = "game options"; + menuoptionsactive[2] = true; + menuoptions[3] = "view credits"; + menuoptionsactive[3] = true; + menuoptions[4] = "quit game"; + menuoptionsactive[4] = true; + nummenuoptions = 5; + menuxoff = -16; + menuyoff = -10; + #else + menuoptions[0] = "start game"; + menuoptionsactive[0] = true; + menuoptions[1] = "player levels"; + menuoptionsactive[1] = true; + menuoptions[2] = "graphic options"; + menuoptionsactive[2] = true; + menuoptions[3] = "game options"; + menuoptionsactive[3] = true; + menuoptions[4] = "view credits"; + menuoptionsactive[4] = true; + menuoptions[5] = "quit game"; + menuoptionsactive[5] = true; + nummenuoptions = 6; + menuxoff = -16; + menuyoff = -10; + #endif +#endif } #if !defined(NO_CUSTOM_LEVELS) else if (t == "playerworlds") { - #if !defined(NO_EDITOR) + #if !defined(NO_EDITOR) menuoptions[0] = "play a level"; menuoptionsactive[0] = true; menuoptions[1] = "level editor"; @@ -6824,7 +6824,7 @@ void Game::createmenu( std::string t ) nummenuoptions = 3; menuxoff = -30; menuyoff = -40; - #else + #else menuoptions[0] = "play a level"; menuoptionsactive[0] = true; menuoptions[1] = "back to menu"; @@ -6832,7 +6832,7 @@ void Game::createmenu( std::string t ) nummenuoptions = 2; menuxoff = -30; menuyoff = -40; - #endif + #endif } else if (t == "levellist") { @@ -7069,34 +7069,34 @@ void Game::createmenu( std::string t ) } else if (t == "options") { - #if defined(MAKEANDPLAY) - menuoptions[0] = "accessibility options"; - menuoptionsactive[0] = true; - menuoptions[1] = "game pad options"; - menuoptionsactive[1] = true; - menuoptions[2] = "clear data"; - menuoptionsactive[2] = true; - menuoptions[3] = "return"; - menuoptionsactive[3] = true; - nummenuoptions = 4; - menuxoff = -40; - menuyoff = 0; - #elif !defined(MAKEANDPLAY) - menuoptions[0] = "accessibility options"; - menuoptionsactive[0] = true; - menuoptions[1] = "unlock play modes"; - menuoptionsactive[1] = true; - menuoptions[2] = "game pad options"; - menuoptionsactive[2] = true; - menuoptions[3] = "clear data"; - menuoptionsactive[3] = true; +#if defined(MAKEANDPLAY) + menuoptions[0] = "accessibility options"; + menuoptionsactive[0] = true; + menuoptions[1] = "game pad options"; + menuoptionsactive[1] = true; + menuoptions[2] = "clear data"; + menuoptionsactive[2] = true; + menuoptions[3] = "return"; + menuoptionsactive[3] = true; + nummenuoptions = 4; + menuxoff = -40; + menuyoff = 0; +#elif !defined(MAKEANDPLAY) + menuoptions[0] = "accessibility options"; + menuoptionsactive[0] = true; + menuoptions[1] = "unlock play modes"; + menuoptionsactive[1] = true; + menuoptions[2] = "game pad options"; + menuoptionsactive[2] = true; + menuoptions[3] = "clear data"; + menuoptionsactive[3] = true; - menuoptions[4] = "return"; - menuoptionsactive[4] = true; - nummenuoptions = 5; - menuxoff = -40; - menuyoff = 0; - #endif + menuoptions[4] = "return"; + menuoptionsactive[4] = true; + nummenuoptions = 5; + menuxoff = -40; + menuyoff = 0; +#endif } else if (t == "accessibility") { @@ -7120,22 +7120,22 @@ void Game::createmenu( std::string t ) menuxoff = -85; menuyoff = -10; } - else if(t == "controller") - { - menuoptions[0] = "analog stick sensitivity"; - menuoptionsactive[0] = true; - menuoptions[1] = "bind flip"; - menuoptionsactive[1] = true; - menuoptions[2] = "bind enter"; - menuoptionsactive[2] = true; - menuoptions[3] = "bind menu"; - menuoptionsactive[3] = true; - menuoptions[4] = "return"; - menuoptionsactive[4] = true; - nummenuoptions = 5; - menuxoff = -40; - menuyoff = 10; - } + else if(t == "controller") + { + menuoptions[0] = "analog stick sensitivity"; + menuoptionsactive[0] = true; + menuoptions[1] = "bind flip"; + menuoptionsactive[1] = true; + menuoptions[2] = "bind enter"; + menuoptionsactive[2] = true; + menuoptions[3] = "bind menu"; + menuoptionsactive[3] = true; + menuoptions[4] = "return"; + menuoptionsactive[4] = true; + nummenuoptions = 5; + menuxoff = -40; + menuyoff = 10; + } else if (t == "cleardatamenu") { menuoptions[0] = "no! don't delete"; diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 3d1ac4a4..36555eaf 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -90,7 +90,7 @@ public: void initteleportermode(); - std::string saveFilePath; + std::string saveFilePath; int door_left; @@ -111,9 +111,9 @@ public: //State logic stuff int state, statedelay; - bool glitchrunkludge; + bool glitchrunkludge; - int usingmmmmmm; + int usingmmmmmm; int gamestate; bool hascontrol, jumpheld; @@ -123,10 +123,10 @@ public: bool infocus; bool muted; int mutebutton; - private: +private: float m_globalVol; - public: +public: int tapleft, tapright; @@ -136,7 +136,7 @@ public: //public var crewstats:Array = new Array(); int lastsaved; int deathcounts; - int timerStartTime; + int timerStartTime; int frames, seconds, minutes, hours; bool gamesaved; @@ -282,9 +282,9 @@ public: bool advanced_mode; bool fullScreenEffect_badSignal; - bool useLinearFilter; - int stretchMode; - int controllerSensitivity; + bool useLinearFilter; + int stretchMode; + int controllerSensitivity; //Screenrecording stuff, for beta/trailer int recording; @@ -327,9 +327,9 @@ public: bool customlevelstatsloaded; - std::vector controllerButton_map; - std::vector controllerButton_flip; - std::vector controllerButton_esc; + std::vector controllerButton_map; + std::vector controllerButton_flip; + std::vector controllerButton_esc; bool skipfakeload; };