Fixes #258
Updates cheat routines to cover all possible cheat functions, so they are all now reported. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6643 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
e2cfc4cc32
commit
1b5f3fafca
|
@ -35,6 +35,7 @@ typedef struct _cheat_entry
|
||||||
void (*function)(void); // pointer to void* function
|
void (*function)(void); // pointer to void* function
|
||||||
} CHEAT_ENTRY;
|
} CHEAT_ENTRY;
|
||||||
|
|
||||||
|
bool Cheated = false;
|
||||||
static CHEAT_ENTRY cheatCodes[] =
|
static CHEAT_ENTRY cheatCodes[] =
|
||||||
{
|
{
|
||||||
// {"VQKZMY^\\Z",kf_ToggleOverlays},//interface
|
// {"VQKZMY^\\Z",kf_ToggleOverlays},//interface
|
||||||
|
@ -88,6 +89,7 @@ BOOL attemptCheatCode(const char* cheat_name)
|
||||||
/* We've got our man... */
|
/* We've got our man... */
|
||||||
curCheat->function(); // run it
|
curCheat->function(); // run it
|
||||||
/* And get out of here */
|
/* And get out of here */
|
||||||
|
Cheated = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2127,6 +2127,7 @@ INT_RETVAL intRunWidgets(void)
|
||||||
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new structure: %s."),
|
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new structure: %s."),
|
||||||
selectedPlayer, psStructure->pStructureType->pName);
|
selectedPlayer, psStructure->pStructureType->pName);
|
||||||
sendTextMessage(msg, true);
|
sendTextMessage(msg, true);
|
||||||
|
Cheated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (psPositionStats->ref >= REF_FEATURE_START &&
|
else if (psPositionStats->ref >= REF_FEATURE_START &&
|
||||||
|
@ -2140,7 +2141,7 @@ INT_RETVAL intRunWidgets(void)
|
||||||
// the fact that we're cheating ourselves a new feature.
|
// the fact that we're cheating ourselves a new feature.
|
||||||
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new feature: %s."), selectedPlayer, psPositionStats->pName);
|
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new feature: %s."), selectedPlayer, psPositionStats->pName);
|
||||||
sendTextMessage(msg, true);
|
sendTextMessage(msg, true);
|
||||||
|
Cheated = true;
|
||||||
// Notify the other hosts that we've just built ourselves a feature
|
// Notify the other hosts that we've just built ourselves a feature
|
||||||
sendMultiPlayerFeature(((FEATURE_STATS *)psPositionStats)->subType, world_coord(structX), world_coord(structY));
|
sendMultiPlayerFeature(((FEATURE_STATS *)psPositionStats)->subType, world_coord(structX), world_coord(structY));
|
||||||
}
|
}
|
||||||
|
@ -2159,6 +2160,7 @@ INT_RETVAL intRunWidgets(void)
|
||||||
// the fact that we're cheating ourselves a new droid.
|
// the fact that we're cheating ourselves a new droid.
|
||||||
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new droid: %s."), selectedPlayer, psDroid->aName);
|
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new droid: %s."), selectedPlayer, psDroid->aName);
|
||||||
sendTextMessage(msg, true);
|
sendTextMessage(msg, true);
|
||||||
|
Cheated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editPosMode = IED_NOPOS;
|
editPosMode = IED_NOPOS;
|
||||||
|
|
202
src/keybind.c
202
src/keybind.c
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "lib/framework/frame.h"
|
#include "lib/framework/frame.h"
|
||||||
#include "lib/framework/strres.h"
|
#include "lib/framework/strres.h"
|
||||||
|
#include "lib/framework/stdio_ext.h"
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
#include "basedef.h"
|
#include "basedef.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
@ -101,6 +102,7 @@
|
||||||
|
|
||||||
extern char ScreenDumpPath[];
|
extern char ScreenDumpPath[];
|
||||||
|
|
||||||
|
BOOL bMovePause = false;
|
||||||
BOOL bAllowOtherKeyPresses = true;
|
BOOL bAllowOtherKeyPresses = true;
|
||||||
char sTextToSend[MAX_CONSOLE_STRING_LENGTH];
|
char sTextToSend[MAX_CONSOLE_STRING_LENGTH];
|
||||||
char beaconMsg[MAX_PLAYERS][MAX_CONSOLE_STRING_LENGTH]; //beacon msg for each player
|
char beaconMsg[MAX_PLAYERS][MAX_CONSOLE_STRING_LENGTH]; //beacon msg for each player
|
||||||
|
@ -134,6 +136,7 @@ static void noMPCheatMsg(void)
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_ToggleMissionTimer( void )
|
void kf_ToggleMissionTimer( void )
|
||||||
{
|
{
|
||||||
|
addConsoleMessage(_("Warning! This cheat is buggy. We recommend to NOT use it."), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
||||||
setMissionCheatTime(!mission.cheatTime);
|
setMissionCheatTime(!mission.cheatTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,6 +287,8 @@ void kf_ToggleConsoleDrop( void )
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_SetKillerLevel( void )
|
void kf_SetKillerLevel( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
{
|
{
|
||||||
|
@ -292,7 +297,9 @@ void kf_SetKillerLevel( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
setDifficultyLevel(DL_KILLER);
|
setDifficultyLevel(DL_KILLER);
|
||||||
addConsoleMessage(_("Hard as nails!!!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("Hard as nails!!!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_SetEasyLevel( void )
|
void kf_SetEasyLevel( void )
|
||||||
|
@ -311,29 +318,35 @@ void kf_SetEasyLevel( void )
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_UpThePower( void )
|
void kf_UpThePower( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
{
|
{
|
||||||
noMPCheatMsg();
|
noMPCheatMsg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
asPower[selectedPlayer].currentPower+=1000;
|
asPower[selectedPlayer].currentPower+=1000;
|
||||||
addConsoleMessage(_("1000 big ones!!!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("1000 big ones!!!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_MaxPower( void )
|
void kf_MaxPower( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
{
|
{
|
||||||
noMPCheatMsg();
|
noMPCheatMsg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
asPower[selectedPlayer].currentPower = SDWORD_MAX / 2;
|
asPower[selectedPlayer].currentPower = SDWORD_MAX / 2;
|
||||||
addConsoleMessage(_("Power overwhelming"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("Power overwhelming"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -365,6 +378,8 @@ void kf_SetHardLevel( void )
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_SetToughUnitsLevel( void )
|
void kf_SetToughUnitsLevel( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
{
|
{
|
||||||
|
@ -373,7 +388,9 @@ void kf_SetToughUnitsLevel( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
setDifficultyLevel(DL_TOUGH);
|
setDifficultyLevel(DL_TOUGH);
|
||||||
addConsoleMessage(_("Twice as nice!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("Twice as nice!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_ToggleFPS(void) //This shows *just FPS* and is always visable (when active) -Q.
|
void kf_ToggleFPS(void) //This shows *just FPS* and is always visable (when active) -Q.
|
||||||
|
@ -422,11 +439,19 @@ void kf_FrameRate( void )
|
||||||
void kf_ShowNumObjects( void )
|
void kf_ShowNumObjects( void )
|
||||||
{
|
{
|
||||||
int droids, structures, features;
|
int droids, structures, features;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
objCount(&droids, &structures, &features);
|
objCount(&droids, &structures, &features);
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using a cheat :Num Droids: %d Num Structures: %d Num Features: %d"),
|
||||||
CONPRINTF(ConsoleString,(ConsoleString, "Num Droids: %d Num Structures: %d Num Features: %d",
|
selectedPlayer, droids, structures, features);
|
||||||
droids, structures, features));
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -443,6 +468,8 @@ void kf_ToggleRadar( void )
|
||||||
/* Toggles infinite power on/off */
|
/* Toggles infinite power on/off */
|
||||||
void kf_TogglePower( void )
|
void kf_TogglePower( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
|
@ -455,13 +482,12 @@ void kf_TogglePower( void )
|
||||||
powerCalculated = !powerCalculated;
|
powerCalculated = !powerCalculated;
|
||||||
if (powerCalculated)
|
if (powerCalculated)
|
||||||
{
|
{
|
||||||
addConsoleMessage(_("Infinite power disabled"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
|
||||||
powerCalc(true);
|
powerCalc(true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
addConsoleMessage(_("Infinite power enabled"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
selectedPlayer, powerCalculated ? _("Infinite power disabled"): _("Infinite power enabled") );
|
||||||
}
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -475,7 +501,7 @@ void kf_RecalcLighting( void )
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/* Sends the 3dfx screen buffer to disk */
|
/* Sends the screen buffer to disk */
|
||||||
void kf_ScreenDump( void )
|
void kf_ScreenDump( void )
|
||||||
{
|
{
|
||||||
//CONPRINTF(ConsoleString,(ConsoleString,"Screen dump written to working directory : %s", screenDumpToDisk()));
|
//CONPRINTF(ConsoleString,(ConsoleString,"Screen dump written to working directory : %s", screenDumpToDisk()));
|
||||||
|
@ -487,6 +513,8 @@ void kf_ScreenDump( void )
|
||||||
/* Make all functions available */
|
/* Make all functions available */
|
||||||
void kf_AllAvailable( void )
|
void kf_AllAvailable( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
|
@ -495,8 +523,11 @@ void kf_AllAvailable( void )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
addConsoleMessage(_("All items made available"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
|
||||||
makeAllAvailable();
|
makeAllAvailable();
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("All items made available"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -526,7 +557,6 @@ void kf_TileInfo(void)
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_ToggleBackgroundFog( void )
|
void kf_ToggleBackgroundFog( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
static BOOL bEnabled = true;//start in nicks mode
|
static BOOL bEnabled = true;//start in nicks mode
|
||||||
|
|
||||||
if (bEnabled)//true, so go to false
|
if (bEnabled)//true, so go to false
|
||||||
|
@ -548,12 +578,10 @@ void kf_ToggleBackgroundFog( void )
|
||||||
}
|
}
|
||||||
fogStatus |= FOG_BACKGROUND;//set lowest bit of 3
|
fogStatus |= FOG_BACKGROUND;//set lowest bit of 3
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void kf_ToggleDistanceFog( void )
|
extern void kf_ToggleDistanceFog( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
static BOOL bEnabled = true;//start in nicks mode
|
static BOOL bEnabled = true;//start in nicks mode
|
||||||
|
|
||||||
if (bEnabled)//true, so go to false
|
if (bEnabled)//true, so go to false
|
||||||
|
@ -575,31 +603,41 @@ extern void kf_ToggleDistanceFog( void )
|
||||||
}
|
}
|
||||||
fogStatus |= FOG_DISTANCE;//set lowest bit of 3
|
fogStatus |= FOG_DISTANCE;//set lowest bit of 3
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* Toggles fog on/off */
|
||||||
void kf_ToggleFog( void )
|
void kf_ToggleFog( void )
|
||||||
{
|
{
|
||||||
static BOOL fogEnabled = false;
|
static BOOL fogEnabled = false;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fogEnabled)
|
if (fogEnabled)
|
||||||
{
|
{
|
||||||
fogEnabled = false;
|
fogEnabled = false;
|
||||||
pie_SetFogStatus(false);
|
pie_SetFogStatus(false);
|
||||||
pie_EnableFog(fogEnabled);
|
pie_EnableFog(fogEnabled);
|
||||||
addConsoleMessage(_("Fog off"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fogEnabled = true;
|
fogEnabled = true;
|
||||||
pie_EnableFog(fogEnabled);
|
pie_EnableFog(fogEnabled);
|
||||||
addConsoleMessage(_("Fog on"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, fogEnabled ? _("Fog on") : _("Fog off") );
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/* Toggles fog on/off */
|
|
||||||
void kf_ToggleWidgets( void )
|
void kf_ToggleWidgets( void )
|
||||||
{
|
{
|
||||||
if(getWidgetsStatus())
|
if(getWidgetsStatus())
|
||||||
|
@ -618,7 +656,8 @@ void kf_ToggleWidgets( void )
|
||||||
/* Toggle camera on/off */
|
/* Toggle camera on/off */
|
||||||
void kf_ToggleCamera( void )
|
void kf_ToggleCamera( void )
|
||||||
{
|
{
|
||||||
if(getWarCamStatus() == false) {
|
if(getWarCamStatus() == false)
|
||||||
|
{
|
||||||
shakeStop(); // Ensure screen shake stopped before starting camera mode.
|
shakeStop(); // Ensure screen shake stopped before starting camera mode.
|
||||||
setDrivingStatus(false);
|
setDrivingStatus(false);
|
||||||
}
|
}
|
||||||
|
@ -707,7 +746,6 @@ void kf_RadarZoomIn( void )
|
||||||
{
|
{
|
||||||
audio_PlayTrack( ID_SOUND_BUILD_FAIL );
|
audio_PlayTrack( ID_SOUND_BUILD_FAIL );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_RadarZoomOut( void )
|
void kf_RadarZoomOut( void )
|
||||||
|
@ -1019,6 +1057,8 @@ void kf_AddMissionOffWorld( void )
|
||||||
/* Tell the scripts to end a mission*/
|
/* Tell the scripts to end a mission*/
|
||||||
void kf_EndMissionOffWorld( void )
|
void kf_EndMissionOffWorld( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Bail out if we're running a _true_ multiplayer game
|
// Bail out if we're running a _true_ multiplayer game
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
|
@ -1028,6 +1068,9 @@ void kf_EndMissionOffWorld( void )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
sasprintf((char**)&cmsg, _("Warning! This cheat can cause dire problems later on! [%s]"), _("Ending Mission."));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
|
|
||||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_MISSION_END);
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_MISSION_END);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -1086,10 +1129,8 @@ KEY_CODE entry;
|
||||||
camToggleStatus();
|
camToggleStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
/* Raises the G Offset */
|
/* Raises the G Offset */
|
||||||
void kf_UpGeoOffset( void )
|
void kf_UpGeoOffset( void )
|
||||||
|
@ -1117,6 +1158,8 @@ void kf_TogglePowerBar( void )
|
||||||
/* Toggles whether we process debug key mappings */
|
/* Toggles whether we process debug key mappings */
|
||||||
void kf_ToggleDebugMappings( void )
|
void kf_ToggleDebugMappings( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Prevent cheating in multiplayer when not compiled in debug mode by
|
// Prevent cheating in multiplayer when not compiled in debug mode by
|
||||||
// bailing out if we're running a _true_ multiplayer game
|
// bailing out if we're running a _true_ multiplayer game
|
||||||
|
@ -1132,19 +1175,15 @@ void kf_ToggleDebugMappings( void )
|
||||||
if(getDebugMappingStatus())
|
if(getDebugMappingStatus())
|
||||||
{
|
{
|
||||||
processDebugMappings(false);
|
processDebugMappings(false);
|
||||||
CONPRINTF(ConsoleString, (ConsoleString, "CHEATS DISABLED!"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
game_SetValidityKey(VALIDITYKEY_CHEAT_MODE);
|
game_SetValidityKey(VALIDITYKEY_CHEAT_MODE);
|
||||||
processDebugMappings(true);
|
processDebugMappings(true);
|
||||||
CONPRINTF(ConsoleString, (ConsoleString, "CHEATS ENABLED!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bMultiPlayer)
|
|
||||||
{
|
|
||||||
sendTextMessage("Presses Debug. CHEAT",true);
|
|
||||||
}
|
}
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"), selectedPlayer,
|
||||||
|
getDebugMappingStatus() ? _("CHEATS ARE NOW ENABLED!") : _("CHEATS ARE NOW DISABLED!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -1152,6 +1191,8 @@ void kf_ToggleDebugMappings( void )
|
||||||
|
|
||||||
void kf_ToggleGodMode( void )
|
void kf_ToggleGodMode( void )
|
||||||
{
|
{
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
|
@ -1191,14 +1232,16 @@ void kf_ToggleGodMode( void )
|
||||||
}
|
}
|
||||||
// remove all proximity messages
|
// remove all proximity messages
|
||||||
releaseAllProxDisp();
|
releaseAllProxDisp();
|
||||||
CONPRINTF(ConsoleString,(ConsoleString,"God Mode OFF"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
godMode = true; // view all structures and droids
|
godMode = true; // view all structures and droids
|
||||||
setRevealStatus(false); // view the entire map
|
setRevealStatus(false); // view the entire map
|
||||||
CONPRINTF(ConsoleString,(ConsoleString,"God Mode ON"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, godMode ? _("God Mode ON") : _("God Mode OFF"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
/* Aligns the view to north - some people can't handle the world spinning */
|
/* Aligns the view to north - some people can't handle the world spinning */
|
||||||
|
@ -1265,6 +1308,16 @@ void kf_TogglePauseMode( void )
|
||||||
void kf_FinishAllResearch(void)
|
void kf_FinishAllResearch(void)
|
||||||
{
|
{
|
||||||
UDWORD j;
|
UDWORD j;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (j = 0; j < numResearch; j++)
|
for (j = 0; j < numResearch; j++)
|
||||||
{
|
{
|
||||||
|
@ -1277,7 +1330,9 @@ void kf_FinishAllResearch(void)
|
||||||
researchResult(j, selectedPlayer, false, NULL);
|
researchResult(j, selectedPlayer, false, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONPRINTF(ConsoleString, (ConsoleString, _("Researched EVERYTHING for you!")));
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("Researched EVERYTHING for you!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -1285,14 +1340,34 @@ void kf_FinishAllResearch(void)
|
||||||
void kf_FinishResearch( void )
|
void kf_FinishResearch( void )
|
||||||
{
|
{
|
||||||
STRUCTURE *psCurr;
|
STRUCTURE *psCurr;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (psCurr=interfaceStructList(); psCurr; psCurr = psCurr->psNext)
|
for (psCurr=interfaceStructList(); psCurr; psCurr = psCurr->psNext)
|
||||||
{
|
{
|
||||||
if (psCurr->pStructureType->type == REF_RESEARCH)
|
if (psCurr->pStructureType->type == REF_RESEARCH)
|
||||||
{
|
{
|
||||||
|
BASE_STATS *pSubject = NULL;
|
||||||
|
|
||||||
((RESEARCH_FACILITY *)psCurr->pFunctionality)->timeStarted = gameTime + 100000;
|
((RESEARCH_FACILITY *)psCurr->pFunctionality)->timeStarted = gameTime + 100000;
|
||||||
//set power accrued to high value so that will trigger straight away
|
//set power accrued to high value so that will trigger straight away
|
||||||
((RESEARCH_FACILITY *)psCurr->pFunctionality)->powerAccrued = 10000;
|
((RESEARCH_FACILITY *)psCurr->pFunctionality)->powerAccrued = 10000;
|
||||||
|
// find out what the heck we are researching
|
||||||
|
pSubject = ((RESEARCH_FACILITY *)psCurr->pFunctionality)->psSubject;
|
||||||
|
if (pSubject)
|
||||||
|
{
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s %s"),
|
||||||
|
selectedPlayer, _("Researched"), getName(pSubject->pName) );
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1532,8 +1607,6 @@ void kf_ToggleDrivingMode( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL bMovePause = false;
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_MovePause( void )
|
void kf_MovePause( void )
|
||||||
{
|
{
|
||||||
|
@ -1634,9 +1707,23 @@ void kf_KillEnemy( void )
|
||||||
UDWORD player;
|
UDWORD player;
|
||||||
DROID *psCDroid,*psNDroid;
|
DROID *psCDroid,*psNDroid;
|
||||||
STRUCTURE *psCStruct, *psNStruct;
|
STRUCTURE *psCStruct, *psNStruct;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
CONPRINTF(ConsoleString, (ConsoleString, _("Enemy destroyed by cheating!")));
|
#ifndef DEBUG
|
||||||
debug(LOG_DEATH, "kf_KillEnemy: Destroying enemy droids and structures");
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
debug(LOG_DEATH, "Destroying enemy droids and structures");
|
||||||
|
CONPRINTF(ConsoleString, (ConsoleString,
|
||||||
|
_("Warning! This can have drastic consequences if used incorrectly in missions.")));
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("All enemies destroyed by cheating!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
|
|
||||||
for (player = 0; player < MAX_PLAYERS; player++)
|
for (player = 0; player < MAX_PLAYERS; player++)
|
||||||
{
|
{
|
||||||
|
@ -1663,8 +1750,22 @@ void kf_KillSelected(void)
|
||||||
{
|
{
|
||||||
DROID *psCDroid, *psNDroid;
|
DROID *psCDroid, *psNDroid;
|
||||||
STRUCTURE *psCStruct, *psNStruct;
|
STRUCTURE *psCStruct, *psNStruct;
|
||||||
|
const char* cmsg;
|
||||||
|
|
||||||
debug(LOG_DEATH, "kf_KillSelected: Destroying selected droids and structures");
|
#ifndef DEBUG
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
|
||||||
|
selectedPlayer, _("Destroying selected droids and structures!"));
|
||||||
|
sendTextMessage(cmsg, true);
|
||||||
|
|
||||||
|
debug(LOG_DEATH, "Destroying selected droids and structures");
|
||||||
for(psCDroid=apsDroidLists[selectedPlayer]; psCDroid; psCDroid=psNDroid)
|
for(psCDroid=apsDroidLists[selectedPlayer]; psCDroid; psCDroid=psNDroid)
|
||||||
{
|
{
|
||||||
psNDroid = psCDroid->psNext;
|
psNDroid = psCDroid->psNext;
|
||||||
|
@ -1766,7 +1867,6 @@ void kf_SendTextMessage(void)
|
||||||
sstrcpy(ConsoleMsg, sTextToSend);
|
sstrcpy(ConsoleMsg, sTextToSend);
|
||||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_CONSOLE);
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_CONSOLE);
|
||||||
|
|
||||||
|
|
||||||
if (runningMultiplayer())
|
if (runningMultiplayer())
|
||||||
{
|
{
|
||||||
sendTextMessage(sTextToSend,false);
|
sendTextMessage(sTextToSend,false);
|
||||||
|
@ -1822,7 +1922,6 @@ void kf_SendTextMessage(void)
|
||||||
const char input_char[2] = { inputGetCharKey(), '\0' };
|
const char input_char[2] = { inputGetCharKey(), '\0' };
|
||||||
|
|
||||||
sstrcat(sTextToSend, input_char);
|
sstrcat(sTextToSend, input_char);
|
||||||
|
|
||||||
sstrcpy(sCurrentConsoleText, sTextToSend);
|
sstrcpy(sCurrentConsoleText, sTextToSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2088,7 +2187,6 @@ void kf_ToggleVisibility( void )
|
||||||
{
|
{
|
||||||
setRevealStatus(true);
|
setRevealStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
@ -2096,6 +2194,15 @@ static void kfsf_SetSelectedDroidsState( SECONDARY_ORDER sec, SECONDARY_STATE st
|
||||||
{
|
{
|
||||||
DROID *psDroid;
|
DROID *psDroid;
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
|
||||||
|
if (runningMultiplayer())
|
||||||
|
{
|
||||||
|
noMPCheatMsg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
||||||
{
|
{
|
||||||
if(psDroid->selected)
|
if(psDroid->selected)
|
||||||
|
@ -2213,7 +2320,6 @@ BOOL bFound;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(psDroid = apsDroidLists[selectedPlayer],bFound = false;
|
for(psDroid = apsDroidLists[selectedPlayer],bFound = false;
|
||||||
psDroid && !bFound; psDroid = psDroid->psNext)
|
psDroid && !bFound; psDroid = psDroid->psNext)
|
||||||
{
|
{
|
||||||
|
@ -2264,7 +2370,6 @@ void kf_ToggleShakeStatus( void )
|
||||||
{
|
{
|
||||||
setShakeStatus(true);
|
setShakeStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
void kf_ToggleShadows( void )
|
void kf_ToggleShadows( void )
|
||||||
|
@ -2277,7 +2382,6 @@ void kf_ToggleShadows( void )
|
||||||
{
|
{
|
||||||
setDrawShadows(true);
|
setDrawShadows(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -2767,13 +2767,13 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
||||||
//don't bother adding the text if haven't played the audio
|
//don't bother adding the text if haven't played the audio
|
||||||
if (bPlaySuccess)
|
if (bPlaySuccess)
|
||||||
{
|
{
|
||||||
sLabInit.pText = _("OBJECTIVE ACHIEVED");//"Objective Achieved";
|
sLabInit.pText = Cheated ? _("OBJECTIVE ACHIEVED by cheating!") : _("OBJECTIVE ACHIEVED");//"Objective Achieved";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLabInit.pText = _("OBJECTIVE FAILED");//"Objective Failed;
|
sLabInit.pText = Cheated ? _("OBJECTIVE FAILED--and you cheated!"): _("OBJECTIVE FAILED");//"Objective Failed;
|
||||||
}
|
}
|
||||||
sLabInit.FontID = font_regular;
|
sLabInit.FontID = font_regular;
|
||||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern BOOL offWorldKeepLists;
|
||||||
extern DROID *apsLimboDroids[MAX_PLAYERS];
|
extern DROID *apsLimboDroids[MAX_PLAYERS];
|
||||||
// return positions for vtols
|
// return positions for vtols
|
||||||
extern Vector2i asVTOLReturnPos[MAX_PLAYERS];
|
extern Vector2i asVTOLReturnPos[MAX_PLAYERS];
|
||||||
|
extern bool Cheated;
|
||||||
extern void initMission(void);
|
extern void initMission(void);
|
||||||
extern BOOL missionShutDown(void);
|
extern BOOL missionShutDown(void);
|
||||||
extern void missionDestroyObjects(void);
|
extern void missionDestroyObjects(void);
|
||||||
|
|
|
@ -1055,6 +1055,11 @@ BOOL sendTextMessage(const char *pStr, BOOL all)
|
||||||
|
|
||||||
if (!ingame.localOptionsReceived)
|
if (!ingame.localOptionsReceived)
|
||||||
{
|
{
|
||||||
|
if(!bMultiPlayer)
|
||||||
|
{
|
||||||
|
// apparently we are not in a mp game, so dump the message to the console.
|
||||||
|
addConsoleMessage(pStr,LEFT_JUSTIFY, SYSTEM_MESSAGE);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/scores.c
16
src/scores.c
|
@ -189,8 +189,7 @@ static UDWORD dispST;
|
||||||
static BOOL bDispStarted = false;
|
static BOOL bDispStarted = false;
|
||||||
static char text[255];
|
static char text[255];
|
||||||
static char text2[255];
|
static char text2[255];
|
||||||
|
extern bool Cheated;
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/* Initialise the mission data info - done before each mission */
|
/* Initialise the mission data info - done before each mission */
|
||||||
BOOL scoreInitSystem( void )
|
BOOL scoreInitSystem( void )
|
||||||
|
@ -208,6 +207,7 @@ BOOL scoreInitSystem( void )
|
||||||
missionData.shotsOnTarget = 0;
|
missionData.shotsOnTarget = 0;
|
||||||
missionData.shotsOffTarget = 0;
|
missionData.shotsOffTarget = 0;
|
||||||
missionData.babasMowedDown = 0;
|
missionData.babasMowedDown = 0;
|
||||||
|
Cheated = false;
|
||||||
bDispStarted = false;
|
bDispStarted = false;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
@ -345,8 +345,8 @@ UDWORD width,height;
|
||||||
|
|
||||||
fillUpStats();
|
fillUpStats();
|
||||||
|
|
||||||
pie_UniTransBoxFill(16 + D_W, MT_Y_POS - 16, pie_GetVideoBufferWidth() - D_W - 16, MT_Y_POS + 256, WZCOL_SCORE_BOX);
|
pie_UniTransBoxFill(16 + D_W, MT_Y_POS - 16, pie_GetVideoBufferWidth() - D_W - 16, MT_Y_POS + 256+16, WZCOL_SCORE_BOX);
|
||||||
iV_Box(16 + D_W, MT_Y_POS - 16, pie_GetVideoBufferWidth() - D_W - 16, MT_Y_POS + 256, WZCOL_SCORE_BOX_BORDER);
|
iV_Box(16 + D_W, MT_Y_POS - 16, pie_GetVideoBufferWidth() - D_W - 16, MT_Y_POS + 256+16, WZCOL_SCORE_BOX_BORDER);
|
||||||
|
|
||||||
iV_DrawText( _("Unit Losses"), LC_X + D_W, 80 + 16 + D_H );
|
iV_DrawText( _("Unit Losses"), LC_X + D_W, 80 + 16 + D_H );
|
||||||
iV_DrawText( _("Structure Losses"), LC_X + D_W, 140 + 16 + D_H );
|
iV_DrawText( _("Structure Losses"), LC_X + D_W, 140 + 16 + D_H );
|
||||||
|
@ -442,6 +442,14 @@ void dispAdditionalInfo( void )
|
||||||
getAsciiTime( (char*)&text2, gameTime );
|
getAsciiTime( (char*)&text2, gameTime );
|
||||||
sprintf( text, _("Total Game Time - %s"), text2 );
|
sprintf( text, _("Total Game Time - %s"), text2 );
|
||||||
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 340 + D_H );
|
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 340 + D_H );
|
||||||
|
if (Cheated)
|
||||||
|
{
|
||||||
|
// A quick way to flash the text
|
||||||
|
((gameTime2 / 250) % 2) ? iV_SetTextColour(WZCOL_RED) : iV_SetTextColour(WZCOL_YELLOW);
|
||||||
|
sprintf( text, _("You cheated!"));
|
||||||
|
iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 360 + D_H );
|
||||||
|
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue