From e6f8b3a65f8762c68947e7a9e1ccaf63df09a4ed Mon Sep 17 00:00:00 2001 From: onpon4 Date: Fri, 27 Feb 2015 13:35:47 -0500 Subject: [PATCH] Removed support for the old cheats. It was broken, and I don't think it's worth fixing. --- src/Starfighter.cpp | 5 +++-- src/events.cpp | 40 ---------------------------------------- src/events.h | 1 - src/player.cpp | 4 ---- 4 files changed, 3 insertions(+), 47 deletions(-) diff --git a/src/Starfighter.cpp b/src/Starfighter.cpp index f948c2b..e6a90d9 100644 --- a/src/Starfighter.cpp +++ b/src/Starfighter.cpp @@ -62,7 +62,8 @@ int main(int argc, char *argv[]) cheatCount = 2; if ((strcmp(argv[i], "it") == 0) && (cheatCount == 2)) cheatCount = 3; - if ((strcmp(argv[i], "better") == 0) && (cheatCount == 3)) + if (((strcmp(argv[i], "better") == 0) && (cheatCount == 3)) || + (strcmp(argv[i], "humansdoitbetter") == 0)) {printf("Humans do it better! Cheats enabled.\n"); engine.cheat = true;} } @@ -72,7 +73,7 @@ int main(int argc, char *argv[]) initSystem(); // Opens video mode and sound loadFont(); - if (cheatAttempt) + if (cheatAttempt && !engine.cheat) { clearScreen(black); drawString("That doesn't work anymore", -1, 285, FONT_WHITE); diff --git a/src/events.cpp b/src/events.cpp index 40c78fa..773efa5 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -44,43 +44,3 @@ bool checkPauseRequest() return false; } - -static void compareLastKeyInputs() -{ - if (strstr(lastKeyEvents, "humansdoitbetter") != NULL) - {engine.cheat = true; memset(lastKeyEvents, ' ', 25);} - - if (strstr(lastKeyEvents, "credits") != NULL) - {engine.cheatCredits = true; memset(lastKeyEvents, ' ', 25);} -} - -void addKeyEvent(const char *keyName) -{ - if (strlen(keyName) > 1) - return; - - int index = -1; - - for (int i = 0 ; i < 25 ; i++) - { - if (lastKeyEvents[i] == ' ') - { - index = i; - break; - } - } - - if (index == -1) - { - for (int i = 0 ; i < 25 ; i++) - { - lastKeyEvents[i] = lastKeyEvents[i + 1]; - } - - index = 24; - } - - lastKeyEvents[index] = keyName[0]; - - compareLastKeyInputs(); -} diff --git a/src/events.h b/src/events.h index 70b68f1..12673db 100644 --- a/src/events.h +++ b/src/events.h @@ -16,4 +16,3 @@ along with this program. If not, see . */ extern bool checkPauseRequest(); -extern void addKeyEvent(const char *keyName); diff --git a/src/player.cpp b/src/player.cpp index f43d039..ed2ae54 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -387,10 +387,6 @@ void getPlayerInput() break; case SDL_KEYDOWN: - //TODO: reenable somehow? - //if (engine.gameSection == SECTION_TITLE) - // addKeyEvent(SDL_GetKeyName(engine.event.key.keysym.sym)); - engine.keyState[mapkey(engine.event.key.keysym.sym)] = 1; if (engine.gameSection != SECTION_GAME)