Restructuring some of the cheat code
This commit is contained in:
parent
c04b6da5ff
commit
a8161a60ec
|
@ -32,6 +32,7 @@
|
||||||
#include "level_table.h"
|
#include "level_table.h"
|
||||||
#include "thread6.h"
|
#include "thread6.h"
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
|
#include "pc/cheats.h"
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
#include "bettercamera.h"
|
#include "bettercamera.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1397,12 +1398,14 @@ void update_mario_inputs(struct MarioState *m) {
|
||||||
update_mario_geometry_inputs(m);
|
update_mario_geometry_inputs(m);
|
||||||
|
|
||||||
debug_print_speed_action_normal(m);
|
debug_print_speed_action_normal(m);
|
||||||
|
|
||||||
/* Moonjump cheat */
|
/* Moonjump cheat */
|
||||||
while (cheatMoonjump == true && cheatEnablecheats == true && m->controller->buttonDown & L_TRIG ){
|
while (Cheats.MoonJump == true && Cheats.EnableCheats == true && m->controller->buttonDown & L_TRIG ){
|
||||||
m->vel[1] = 25;
|
m->vel[1] = 25;
|
||||||
break;
|
break; // TODO: Unneeded break?
|
||||||
}
|
}
|
||||||
/*End of moonjump cheat */
|
/*End of moonjump cheat */
|
||||||
|
|
||||||
if (gCameraMovementFlags & CAM_MOVE_C_UP_MODE) {
|
if (gCameraMovementFlags & CAM_MOVE_C_UP_MODE) {
|
||||||
if (m->action & ACT_FLAG_ALLOW_FIRST_PERSON) {
|
if (m->action & ACT_FLAG_ALLOW_FIRST_PERSON) {
|
||||||
m->input |= INPUT_FIRST_PERSON;
|
m->input |= INPUT_FIRST_PERSON;
|
||||||
|
@ -1726,17 +1729,17 @@ s32 execute_mario_action(UNUSED struct Object *o) {
|
||||||
/**
|
/**
|
||||||
* Cheat stuff
|
* Cheat stuff
|
||||||
*/
|
*/
|
||||||
while (cheatGodmode == true && cheatEnablecheats == true){
|
|
||||||
|
if (Cheats.EnableCheats)
|
||||||
|
{
|
||||||
|
if (Cheats.GodMode)
|
||||||
gMarioState->health = 0x880;
|
gMarioState->health = 0x880;
|
||||||
break;
|
|
||||||
}
|
if (Cheats.InfiniteLives && gMarioState->numLives < 99)
|
||||||
while (cheatInfinitelives == true && cheatEnablecheats == true && gMarioState->numLives < 99){
|
|
||||||
gMarioState->numLives += 1;
|
gMarioState->numLives += 1;
|
||||||
break;
|
|
||||||
}
|
if (Cheats.SuperSpeed && gMarioState->forwardVel > 0)
|
||||||
while (cheatSuperspeed == true && cheatEnablecheats == true && gMarioState->forwardVel > 0 ){
|
|
||||||
gMarioState->forwardVel += 100;
|
gMarioState->forwardVel += 100;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* End of cheat stuff
|
* End of cheat stuff
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "behavior_data.h"
|
#include "behavior_data.h"
|
||||||
#include "thread6.h"
|
#include "thread6.h"
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
|
#include "pc/cheats.h"
|
||||||
|
|
||||||
struct LandingAction {
|
struct LandingAction {
|
||||||
s16 numFrames;
|
s16 numFrames;
|
||||||
|
@ -464,12 +465,11 @@ void update_walking_speed(struct MarioState *m) {
|
||||||
|
|
||||||
/* Handles the "Super responsive controls" cheat. The content of the "else" is Mario's original code for turning around.*/
|
/* Handles the "Super responsive controls" cheat. The content of the "else" is Mario's original code for turning around.*/
|
||||||
|
|
||||||
if (cheatResponsive == true && cheatEnablecheats == true ) {
|
if (Cheats.Responsive == true && Cheats.EnableCheats == true ) {
|
||||||
m->faceAngle[1] = m->intendedYaw;
|
m->faceAngle[1] = m->intendedYaw;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m->faceAngle[1] =
|
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
|
||||||
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
|
|
||||||
}
|
}
|
||||||
apply_slope_accel(m);
|
apply_slope_accel(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "game/options_menu.h"
|
#include "game/options_menu.h"
|
||||||
#include "pc/pc_main.h"
|
#include "pc/pc_main.h"
|
||||||
#include "pc/cliopts.h"
|
#include "pc/cliopts.h"
|
||||||
|
#include "pc/cheats.h"
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
#include "pc/controller/controller_api.h"
|
#include "pc/controller/controller_api.h"
|
||||||
|
|
||||||
|
@ -219,12 +220,12 @@ static struct Option optsAudio[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Option optsCheats[] = {
|
static struct Option optsCheats[] = {
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[0], &cheatEnablecheats ),
|
DEF_OPT_TOGGLE( optsCheatsStr[0], &Cheats.EnableCheats ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[1], &cheatMoonjump ),
|
DEF_OPT_TOGGLE( optsCheatsStr[1], &Cheats.MoonJump ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[2], &cheatGodmode ),
|
DEF_OPT_TOGGLE( optsCheatsStr[2], &Cheats.GodMode ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[3], &cheatInfinitelives ),
|
DEF_OPT_TOGGLE( optsCheatsStr[3], &Cheats.InfiniteLives ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[4], &cheatSuperspeed),
|
DEF_OPT_TOGGLE( optsCheatsStr[4], &Cheats.SuperSpeed),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[5], &cheatResponsive),
|
DEF_OPT_TOGGLE( optsCheatsStr[5], &Cheats.Responsive),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
struct CheatList Cheats;
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct CheatList
|
||||||
|
{
|
||||||
|
bool EnableCheats;
|
||||||
|
bool MoonJump;
|
||||||
|
bool GodMode;
|
||||||
|
bool InfiniteLives;
|
||||||
|
bool SuperSpeed;
|
||||||
|
bool Responsive;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct CheatList Cheats;
|
|
@ -37,15 +37,6 @@ bool configFullscreen = false;
|
||||||
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
|
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
|
||||||
unsigned int configMasterVolume = MAX_VOLUME; // 0 - MAX_VOLUME
|
unsigned int configMasterVolume = MAX_VOLUME; // 0 - MAX_VOLUME
|
||||||
|
|
||||||
// Cheat stuff
|
|
||||||
bool cheatEnablecheats = false;
|
|
||||||
bool cheatMoonjump = false;
|
|
||||||
bool cheatGodmode = false;
|
|
||||||
bool cheatInfinitelives = false;
|
|
||||||
bool cheatSuperspeed = false;
|
|
||||||
bool cheatResponsive = false;
|
|
||||||
|
|
||||||
|
|
||||||
// Keyboard mappings (VK_ values, by default keyboard/gamepad/mouse)
|
// Keyboard mappings (VK_ values, by default keyboard/gamepad/mouse)
|
||||||
unsigned int configKeyA[MAX_BINDS] = { 0x0026, 0x1000, 0x1103 };
|
unsigned int configKeyA[MAX_BINDS] = { 0x0026, 0x1000, 0x1103 };
|
||||||
unsigned int configKeyB[MAX_BINDS] = { 0x0033, 0x1002, 0x1101 };
|
unsigned int configKeyB[MAX_BINDS] = { 0x0033, 0x1002, 0x1101 };
|
||||||
|
|
|
@ -24,12 +24,6 @@ extern unsigned int configKeyStickUp[];
|
||||||
extern unsigned int configKeyStickDown[];
|
extern unsigned int configKeyStickDown[];
|
||||||
extern unsigned int configKeyStickLeft[];
|
extern unsigned int configKeyStickLeft[];
|
||||||
extern unsigned int configKeyStickRight[];
|
extern unsigned int configKeyStickRight[];
|
||||||
extern bool cheatMoonjump;
|
|
||||||
extern bool cheatGodmode;
|
|
||||||
extern bool cheatEnablecheats;
|
|
||||||
extern bool cheatInfinitelives;
|
|
||||||
extern bool cheatSuperspeed;
|
|
||||||
extern bool cheatResponsive;
|
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
extern unsigned int configCameraXSens;
|
extern unsigned int configCameraXSens;
|
||||||
extern unsigned int configCameraYSens;
|
extern unsigned int configCameraYSens;
|
||||||
|
|
Loading…
Reference in New Issue