Skip to content

Commit

Permalink
Clean up cheat mode activation. To enter cheat mode, start the game w…
Browse files Browse the repository at this point in the history
…ith the

"-cheat" commmand line option, and then, in the game, press left shift and backspace 
simultaneously. This does not work in multiplayer games unless you have compiled 
the game with debug enabled. You must delete your keymap file for this to work as
described.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@548 4a71c877-e1ca-e34f-864e-861f7616d084
  • Loading branch information
perim committed Aug 7, 2006
1 parent 47af9cd commit 518478f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/clparse.c
Expand Up @@ -74,6 +74,7 @@ BOOL ParseCommandLineEarly(int argc, char** argv)
" -<WIDTH>x<HEIGHT> : Set the dimensions of the viewport (screen or window)\n"
" -savegame <NAME> : Load a saved game\n"
" -help : Show this help\n"
" -cheat : Allow cheat mode\n"
" -debug FLAGS : Show debug for FLAGS\n"
" -debugfile FILE : Log debug output in FILE\n"
" -datadir DIR : Set default datadir to DIR\n"
Expand Down Expand Up @@ -124,7 +125,6 @@ BOOL ParseCommandLine(int argc, char** argv)
{
char *tokenType;
char *token;
char *cl2 = "-secret";
unsigned int w, h;
int i = 0, j = 0;

Expand Down Expand Up @@ -219,10 +219,10 @@ BOOL ParseCommandLine(int argc, char** argv)
strncat(saveGameName, token, 240);
SetGameMode(GS_SAVEGAMELOAD);
}
else if( stricmp( tokenType,cl2) == 0)
else if (stricmp(tokenType, "-cheat") == 0)
{
fprintf(stdout, "CHEAT MODE ACTIVATED!!\n");
bAllowDebugMode =TRUE;
fprintf(stdout, " ** CHEAT MODE PERMITTED! **\n");
bAllowDebugMode = TRUE;
}
else if( sscanf(tokenType,"-%ix%i", &w, &h) == 2)
{
Expand Down
17 changes: 6 additions & 11 deletions src/keybind.c
Expand Up @@ -1198,18 +1198,15 @@ void kf_TogglePowerBar( void )
/* Toggles whether we process debug key mappings */
void kf_ToggleDebugMappings( void )
{

#ifndef DEBUG
if(bMultiPlayer && (NetPlay.bComms != 0) )
{
return;
}
// Prevent cheating in multiplayer when not compiled in debug mode
if (bMultiPlayer && (NetPlay.bComms != 0))
{
return;
}
#endif


#ifndef DEBUG
if(bAllowDebugMode)
#endif
if (bAllowDebugMode)
{
if(getDebugMappingStatus())
{
Expand All @@ -1228,8 +1225,6 @@ if(bMultiPlayer && (NetPlay.bComms != 0) )
{
sendTextMessage("Presses Debug. CHEAT",TRUE);
}


}
}
// --------------------------------------------------------------------------
Expand Down
14 changes: 4 additions & 10 deletions src/keymap.c
Expand Up @@ -282,7 +282,6 @@ void keyInitMappings( BOOL bForceDefaults )

// ********************************* ALL THE MAPPINGS ARE NOW IN ORDER, PLEASE ****
// ********************************* DO NOT REORDER THEM!!!!!! ********************
// PLEASE DON'T TOUCH THIS WITHOUT ASKING ALEX M FIRST...:-)
/* ALL OF THIS NEEDS TO COME IN OFF A USER CUSTOMISABLE TEXT FILE */
// **********************************
// **********************************
Expand All @@ -297,7 +296,6 @@ void keyInitMappings( BOOL bForceDefaults )
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_F8,KEYMAP_PRESSED,kf_ToggleConsole, strresGetString(psStringRes,STR_BIND_TOGCON));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_F9,KEYMAP_PRESSED,kf_ToggleEnergyBars, strresGetString(psStringRes,STR_BIND_BARS));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_F10,KEYMAP_PRESSED,kf_ScreenDump, strresGetString(psStringRes,STR_BIND_SHOT));
// keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_F10,KEYMAP_PRESSED,kf_ScreenDump, strresGetString(psStringRes,STR_BIND_SHOT));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_F11,KEYMAP_PRESSED,kf_ToggleFormationSpeedLimiting, strresGetString(psStringRes,STR_BIND_SPLIM));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,KEY_F12,KEYMAP_PRESSED,kf_MoveToLastMessagePos, strresGetString(psStringRes,STR_BIND_PREV));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_LSHIFT,KEY_F12,KEYMAP_PRESSED,kf_ToggleSensorDisplay,"Toggle Sensor display"); //Which key should we use? --Re enabled see below! -Q 5-10-05
Expand Down Expand Up @@ -424,13 +422,11 @@ void keyInitMappings( BOOL bForceDefaults )
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,(KEY_CODE)KEY_MAXSCAN,KEYMAP_PRESSED,kf_SelectNextCyborgFactory,strresGetString(psStringRes,STR_BIND_SELCYBORG));
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,(KEY_CODE)KEY_MAXSCAN,KEYMAP_PRESSED,kf_ToggleReopenBuildMenu,strresGetString(psStringRes,STR_BIND_REOPEN_BUILD));

#ifndef DEBUG
if(bAllowDebugMode)
{
#endif
if (bAllowDebugMode)
{
// NOTE THIS!!!!!!!
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_A,KEYMAP_PRESSED,kf_AllAvailable, "Make all items available");
keyAddMapping(KEYMAP___HIDE,KEY_LSHIFT,KEY_FORWARDSLASH,KEYMAP_PRESSED,kf_ToggleDebugMappings,"TOGGLE Debug Mappings");
keyAddMapping(KEYMAP___HIDE,KEY_LSHIFT,KEY_BACKSPACE,KEYMAP_PRESSED,kf_ToggleDebugMappings, "TOGGLE Debug Mappings");
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_X,KEYMAP_PRESSED,kf_FinishResearch, "Complete current research");
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_SCROLLLOCK,KEYMAP_PRESSED,kf_TogglePauseMode, strresGetString(psStringRes,STR_BIND_PAUSE));
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_J,KEYMAP_PRESSED,kf_MaxScrollLimits, "Maximum scroll limits");
Expand Down Expand Up @@ -462,9 +458,7 @@ if(bAllowDebugMode)
keyAddMapping(KEYMAP__DEBUG,KEY_LALT,KEY_F6,KEYMAP_PRESSED,kf_SelectPlayer, "Select player 5");
keyAddMapping(KEYMAP__DEBUG,KEY_LALT,KEY_F7,KEYMAP_PRESSED,kf_SelectPlayer, "Select player 6");
keyAddMapping(KEYMAP__DEBUG,KEY_LALT,KEY_F8,KEYMAP_PRESSED,kf_SelectPlayer, "Select player 7");
#ifndef DEBUG
}
#endif
}

saveKeyMap(); // save out the default key mappings.

Expand Down
4 changes: 2 additions & 2 deletions src/scriptvals_lexer.l
Expand Up @@ -137,7 +137,7 @@ void scrvSetInputBuffer(UBYTE *pBuffer, UDWORD size)
pInputBuffer = pBuffer;
pEndBuffer = pBuffer + size;

/* Reset the lexer incase it's been used before */
/* Reset the lexer in case it's been used before */
scrv__flush_buffer(YY_CURRENT_BUFFER);
inComment = FALSE;
}
Expand All @@ -152,7 +152,7 @@ int scrv_wrap(void)
{
if (inComment)
{
DBERROR(("Warning: reched end of file in a comment"));
DBERROR(("Warning: reached end of file in a comment"));
}
return 1;
}
Expand Down

0 comments on commit 518478f

Please sign in to comment.