Remove built-in cheats

This commit is contained in:
David Joslin 2023-11-06 23:25:34 -08:00 committed by Agent X
parent a33f8592f8
commit 8ab0e17876
26 changed files with 22 additions and 162 deletions

View file

@ -84,6 +84,10 @@ override_field_invisible = {
"GraphNode": [ "_guard1", "_guard2" ],
}
override_field_deprecated = {
"ServerSettings": [ "enableCheats" ],
}
override_field_immutable = {
"MarioState": [ "playerIndex", "controller", "marioObj", "marioBodyState", "statusForCamera", "area" ],
"MarioAnimation": [ "animDmaTable" ],
@ -521,6 +525,10 @@ def doc_struct_field(struct, field):
if fid in override_field_invisible[sid]:
return ''
if sid in override_field_deprecated:
if fid in override_field_deprecated[sid]:
return ''
if '???' in lvt or '???' in lot:
return ''

View file

@ -2494,7 +2494,6 @@
| Field | Type | Access |
| ----- | ---- | ------ |
| bubbleDeath | `integer` | |
| enableCheats | `integer` | |
| enablePlayerList | `integer` | |
| enablePlayersInLevelDisplay | `integer` | |
| headlessServer | `integer` | |

View file

@ -27,7 +27,6 @@
#include "types.h"
#include "macros.h"
#include "hardcoded.h"
#include "pc/cheats.h"
#include "pc/network/network.h"
#include "pc/djui/djui.h"
#include "src/pc/djui/djui_panel_pause.h"

View file

@ -31,7 +31,6 @@
#include "pc/network/network.h"
#include "pc/network/lag_compensation.h"
#include "pc/lua/smlua_hooks.h"
#include "pc/cheats.h"
u8 sDelayInvincTimer;
s16 gInteractionInvulnerable;
@ -2398,7 +2397,7 @@ void check_lava_boost(struct MarioState *m) {
if (!m) { return; }
bool allow = true;
smlua_call_event_hooks_mario_param_and_int_ret_bool(HOOK_ALLOW_HAZARD_SURFACE, m, HAZARD_TYPE_LAVA_FLOOR, &allow);
if (m->action == ACT_BUBBLED || (gServerSettings.enableCheats && gCheats.godMode) || (!allow)) { return; }
if (m->action == ACT_BUBBLED || (!allow)) { return; }
if (!(m->action & ACT_FLAG_RIDING_SHELL) && m->pos[1] < m->floorHeight + 10.0f) {
if (!(m->flags & MARIO_METAL_CAP)) {
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 12 : 18;

View file

@ -39,7 +39,6 @@
#include "obj_behaviors.h"
#include "hardcoded.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/network/socket/socket.h"
@ -1685,23 +1684,6 @@ void update_mario_inputs(struct MarioState *m) {
debug_print_speed_action_normal(m);
if (gServerSettings.enableCheats && gCheats.moonJump && m->playerIndex == 0 && m->controller->buttonDown & L_TRIG) {
if (m->action == ACT_FORWARD_GROUND_KB ||
m->action == ACT_BACKWARD_GROUND_KB ||
m->action == ACT_SOFT_FORWARD_GROUND_KB ||
m->action == ACT_HARD_BACKWARD_GROUND_KB ||
m->action == ACT_FORWARD_AIR_KB ||
m->action == ACT_BACKWARD_AIR_KB ||
m->action == ACT_HARD_FORWARD_AIR_KB ||
m->action == ACT_HARD_BACKWARD_AIR_KB ||
m->action == ACT_AIR_HIT_WALL) {
set_mario_action(m, ACT_FREEFALL, 0);
}
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
m->vel[1] = 40;
}
/* Developer stuff */
#ifdef DEVELOPMENT
if (gNetworkSystem == &gNetworkSystemSocket) {
@ -2130,18 +2112,6 @@ s32 execute_mario_action(UNUSED struct Object *o) {
}
}
if (gServerSettings.enableCheats) {
if (gCheats.godMode) {
gMarioState->health = 0x880;
gMarioState->healCounter = 0;
gMarioState->hurtCounter = 0;
}
if (gCheats.infiniteLives && gMarioState->numLives < 100) {
gMarioState->numLives = 100;
}
}
if (gMarioState->action) {
if (gMarioState->action != ACT_BUBBLED) {
gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
@ -2254,10 +2224,6 @@ s32 execute_mario_action(UNUSED struct Object *o) {
#endif
}
if (gServerSettings.enableCheats && gCheats.bljAnywhere && gMarioState->playerIndex == 0 && gMarioState->action == ACT_LONG_JUMP && gMarioState->forwardVel < -15 && gMarioState->input & INPUT_Z_DOWN && gMarioState->pos[1] - gMarioState->floorHeight < 90) {
gMarioState->vel[1] = -30;
}
play_infinite_stairs_music();
gMarioState->marioObj->oInteractStatus = 0;
queue_particle_rumble();

View file

@ -20,7 +20,6 @@
#include "pc/configfile.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/cheats.h"
#include "hardcoded.h"
void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3) {
@ -58,7 +57,7 @@ s32 lava_boost_on_wall(struct MarioState *m) {
if (!m) { return 0; }
bool allow = true;
smlua_call_event_hooks_mario_param_and_int_ret_bool(HOOK_ALLOW_HAZARD_SURFACE, m, HAZARD_TYPE_LAVA_WALL, &allow);
if ((gServerSettings.enableCheats && gCheats.godMode) || (!allow) || gDjuiInMainMenu) { return FALSE; }
if ((!allow) || gDjuiInMainMenu) { return FALSE; }
m->faceAngle[1] = atan2s(m->wallNormal[2], m->wallNormal[0]);
if (m->forwardVel < 24.0f) {
@ -76,7 +75,6 @@ s32 lava_boost_on_wall(struct MarioState *m) {
s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
if (!m) { return 0; }
if (gServerSettings.enableCheats && gCheats.godMode && m->playerIndex == 0) { return FALSE; }
f32 fallHeight;
f32 damageHeight;

View file

@ -24,7 +24,6 @@
#include "pc/configfile.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/cheats.h"
#define POLE_NONE 0
#define POLE_TOUCHED_FLOOR 1
@ -343,11 +342,6 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
s32 returnValue = 0;
if (smlua_call_event_hooks_mario_param_and_int_ret_int(HOOK_BEFORE_PHYS_STEP, m, STEP_TYPE_HANG, &returnValue)) return returnValue;
if (gServerSettings.enableCheats && gCheats.superSpeed && m->playerIndex == 0) {
m->vel[0] *= SUPER_SPEED_MULTIPLIER;
m->vel[2] *= SUPER_SPEED_MULTIPLIER;
}
struct WallCollisionData wcd = { 0 };
resolve_and_return_wall_collisions_data(nextPos, 50.0f, 50.0f, &wcd);
m->wall = (wcd.numWalls > 0)

View file

@ -633,15 +633,13 @@ s32 act_debug_free_move(struct MarioState *m) {
u32 action = ACT_IDLE;
#ifndef DEVELOPMENT
if (gServerSettings.enableCheats == 0) {
if (m->pos[1] <= m->waterLevel - 100) {
action = ACT_WATER_IDLE;
} else {
action = ACT_FREEFALL;
}
set_mario_action(m, action, 0);
return FALSE;
if (m->pos[1] <= m->waterLevel - 100) {
action = ACT_WATER_IDLE;
} else {
action = ACT_FREEFALL;
}
set_mario_action(m, action, 0);
return FALSE;
#endif
// integer immediates, generates convert instructions for some reason

View file

@ -14,7 +14,6 @@
#include "rumble_init.h"
#include "pc/debuglog.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
@ -160,7 +159,7 @@ s32 set_triple_jump_action(struct MarioState *m, UNUSED u32 action, UNUSED u32 a
if (m->flags & MARIO_WING_CAP) {
return set_mario_action(m, ACT_FLYING_TRIPLE_JUMP, 0);
} else if (m->forwardVel > 20.0f || (gServerSettings.enableCheats && gCheats.alwaysTripleJump && m->playerIndex == 0)) {
} else if (m->forwardVel > 20.0f) {
return set_mario_action(m, ACT_TRIPLE_JUMP, 0);
} else {
return set_mario_action(m, ACT_JUMP, 0);
@ -483,12 +482,7 @@ void update_walking_speed(struct MarioState *m) {
m->forwardVel = 48.0f;
}
// handles the "Super responsive controls" cheat. The content of the "else" is Mario's original code for turning around.
if (gServerSettings.enableCheats && gCheats.responsiveControls && m->playerIndex == 0) {
m->faceAngle[1] = m->intendedYaw;
} else {
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
}
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
apply_slope_accel(m);
}

View file

@ -21,7 +21,6 @@
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/lua/smlua_hooks.h"
#include "pc/cheats.h"
#define MIN_SWIM_STRENGTH 160
#define MIN_SWIM_SPEED 16.0f
@ -195,11 +194,6 @@ u32 perform_water_step(struct MarioState *m) {
s32 returnValue = 0;
if (smlua_call_event_hooks_mario_param_and_int_ret_int(HOOK_BEFORE_PHYS_STEP, m, STEP_TYPE_WATER, &returnValue)) return (u32) returnValue;
if (gServerSettings.enableCheats && gCheats.superSpeed && m->playerIndex == 0) {
m->vel[0] *= SUPER_SPEED_MULTIPLIER;
m->vel[2] *= SUPER_SPEED_MULTIPLIER;
}
vec3f_copy(step, m->vel);
if (m->action & ACT_FLAG_SWIMMING) {

View file

@ -10,7 +10,6 @@
#include "mario_step.h"
#include "pc/lua/smlua.h"
#include "game/hardcoded.h"
#include "pc/cheats.h"
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
@ -114,7 +113,7 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
bool allow = true;
smlua_call_event_hooks_mario_param_and_int_ret_bool(HOOK_ALLOW_HAZARD_SURFACE, m, HAZARD_TYPE_QUICKSAND, &allow);
extern bool gDjuiInMainMenu;
if (m->action & ACT_FLAG_RIDING_SHELL || (gServerSettings.enableCheats && gCheats.godMode && m->playerIndex == 0) || (!allow) || gDjuiInMainMenu) {
if (m->action & ACT_FLAG_RIDING_SHELL || (!allow) || gDjuiInMainMenu) {
m->quicksandDepth = 0.0f;
} else {
if (m->quicksandDepth < 1.1f) {
@ -353,11 +352,6 @@ s32 perform_ground_step(struct MarioState *m) {
s32 returnValue = 0;
if (smlua_call_event_hooks_mario_param_and_int_ret_int(HOOK_BEFORE_PHYS_STEP, m, STEP_TYPE_GROUND, &returnValue)) return returnValue;
if (gServerSettings.enableCheats && gCheats.superSpeed && m->playerIndex == 0 && m->action != ACT_BUBBLED) {
m->vel[0] *= SUPER_SPEED_MULTIPLIER;
m->vel[2] *= SUPER_SPEED_MULTIPLIER;
}
for (i = 0; i < 4; i++) {
Vec3f step = { 0 };
if (m->floor) {
@ -719,11 +713,6 @@ s32 perform_air_step(struct MarioState *m, u32 stepArg) {
s32 returnValue = 0;
if (smlua_call_event_hooks_mario_param_and_int_and_int_ret_int(HOOK_BEFORE_PHYS_STEP, m, STEP_TYPE_AIR, stepArg, &returnValue)) return returnValue;
if (gServerSettings.enableCheats && gCheats.superSpeed && m->playerIndex == 0 && m->action != ACT_BUBBLED) {
m->vel[0] *= SUPER_SPEED_MULTIPLIER;
m->vel[2] *= SUPER_SPEED_MULTIPLIER;
}
m->wall = NULL;
for (i = 0; i < 4; i++) {

View file

@ -23,7 +23,6 @@
#include "engine/math_util.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
#include "pc/cheats.h"
/**
* Flags controlling what debug info is displayed.
@ -294,10 +293,6 @@ void bhv_mario_update(void) {
particleFlags |= gMarioState->particleFlags;
gCurrentObject->oMarioParticleFlags = particleFlags;
if (gServerSettings.enableCheats && gCheats.rapidFireA && gMarioState->playerIndex == 0) {
gMarioState->controller->buttonDown &= ~A_BUTTON;
}
// This code is meant to preserve old Lua mods' ability to set overridePaletteIndex and paletteIndex and still work
// as they expected. USE_REAL_PALETTE_VAR is meant to help support cases where mods will do:
// np.overridePaletteIndex = np.paletteIndex

View file

@ -1,3 +0,0 @@
#include "cheats.h"
struct Cheats gCheats;

View file

@ -1,22 +0,0 @@
#ifndef _CHEATS_H
#define _CHEATS_H
#include <stdbool.h>
#include "network/network.h"
#define SUPER_SPEED_MULTIPLIER 4
struct Cheats {
bool moonJump;
bool godMode;
bool infiniteLives;
bool superSpeed;
bool responsiveControls;
bool rapidFireA;
bool alwaysTripleJump;
bool bljAnywhere;
};
extern struct Cheats gCheats;
#endif // _CHEATS_H

View file

@ -1,6 +1,5 @@
#include "cliopts.h"
#include "configfile.h"
#include "cheats.h"
#include "pc_main.h"
#include "platform.h"
#include "macros.h"
@ -15,7 +14,6 @@ struct PCCLIOptions gCLIOpts;
static void print_help(void) {
printf("\nsm64ex-coop\n");
printf("%-20s\tEnables the cheat menu.\n", "--cheats");
printf("%-20s\tSaves the configuration file as CONFIGNAME.\n", "--configfile CONFIGNAME");
printf("%-20s\tSets additional data directory name (only 'res' is used by default).\n", "--gamedir DIRNAME");
printf("%-20s\tOverrides the default save/config path ('!' expands to executable path).\n", "--savepath SAVEPATH");
@ -72,10 +70,7 @@ bool parse_cli_opts(int argc, char* argv[]) {
gCLIOpts.NetworkPort = 7777;
}
} else if (strcmp(argv[i], "--cheats") == 0) // Enable cheats menu
gServerSettings.enableCheats = true;
else if (strcmp(argv[i], "--poolsize") == 0) // Main pool size
} else if (strcmp(argv[i], "--poolsize") == 0) // Main pool size
arg_uint("--poolsize", argv[++i], &gCLIOpts.PoolSize);
else if (strcmp(argv[i], "--configfile") == 0 && (i + 1) < argc)

View file

@ -115,7 +115,6 @@ bool configEnableCamera = false;
bool configCameraAnalog = false;
bool configCameraMouse = false;
bool configSkipIntro = 0;
bool configEnableCheats = 0;
bool configBubbleDeath = true;
unsigned int configAmountofPlayers = 16;
bool configHUD = true;
@ -214,7 +213,6 @@ static const struct ConfigOption options[] = {
{.name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan},
{.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade},
{.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro},
{.name = "enable_cheats", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCheats},
// debug
{.name = "debug_offset", .type = CONFIG_TYPE_U64 , .u64Value = &gPcDebug.bhvOffset},
{.name = "debug_tags", .type = CONFIG_TYPE_U64 , .u64Value = gPcDebug.tags},

View file

@ -76,7 +76,6 @@ extern bool configCameraMouse;
extern bool configCameraAnalog;
extern bool configHUD;
extern bool configSkipIntro;
extern bool configEnableCheats;
extern bool configBubbleDeath;
extern unsigned int configAmountofPlayers;
extern char configJoinIp[];

View file

@ -1,23 +0,0 @@
#include "djui.h"
#include "djui_panel.h"
#include "djui_panel_menu.h"
#include "pc/cheats.h"
void djui_panel_cheats_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(CHEATS, CHEATS));
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
djui_checkbox_create(body, DLANG(CHEATS, MOON_JUMP), &gCheats.moonJump, NULL);
djui_checkbox_create(body, DLANG(CHEATS, GOD_MODE), &gCheats.godMode, NULL);
djui_checkbox_create(body, DLANG(CHEATS, INFINITE_LIVES), &gCheats.infiniteLives, NULL);
djui_checkbox_create(body, DLANG(CHEATS, SUPER_SPEED), &gCheats.superSpeed, NULL);
djui_checkbox_create(body, DLANG(CHEATS, RESPONSIVE_CONTROLS), &gCheats.responsiveControls, NULL);
djui_checkbox_create(body, DLANG(CHEATS, RAPID_FIRE), &gCheats.rapidFireA, NULL);
djui_checkbox_create(body, DLANG(CHEATS, BLJ_ANYWHERE), &gCheats.bljAnywhere, NULL);
djui_checkbox_create(body, DLANG(CHEATS, ALWAYS_TRIPLE_JUMP), &gCheats.alwaysTripleJump, NULL);
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}
djui_panel_add(caller, panel, NULL);
}

View file

@ -1,4 +0,0 @@
#pragma once
#include "djui.h"
void djui_panel_cheats_create(struct DjuiBase* caller);

View file

@ -10,7 +10,6 @@
#include "pc/network/network.h"
#include "pc/utils/misc.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
static struct DjuiRect* sRectPort = NULL;
static struct DjuiRect* sRectPassword = NULL;

View file

@ -6,7 +6,6 @@
#include "pc/network/network.h"
#include "pc/utils/misc.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
#include "pc/mods/mods.h"
#include "pc/mods/mods_utils.h"
#include "djui_panel_main.h"

View file

@ -6,8 +6,6 @@
#include "pc/network/network.h"
#include "pc/utils/misc.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
#include "pc/pc_main.h"
#include "djui_inputbox.h"
static unsigned int sKnockbackIndex = 0;
@ -61,7 +59,6 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), &configSkipIntro, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, ENABLE_CHEATS), &configEnableCheats, NULL);
djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), &configBubbleDeath, NULL);
if (!gCoopCompatibility) djui_checkbox_create(body, DLANG(HOST_SETTINGS, NAMETAGS), &configNametags, NULL);

View file

@ -3,11 +3,9 @@
#include "djui_panel_player.h"
#include "djui_panel_dynos.h"
#include "djui_panel_options.h"
#include "djui_panel_cheats.h"
#include "djui_panel_host.h"
#include "djui_panel_menu.h"
#include "djui_panel_confirm.h"
#include "pc/cheats.h"
#include "pc/pc_main.h"
#include "pc/network/network.h"
#include "game/object_helpers.h"
@ -68,10 +66,6 @@ void djui_panel_pause_create(struct DjuiBase* caller) {
struct DjuiButton* button3 = djui_button_create(body, DLANG(PAUSE, OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_create);
defaultBase = &button3->base;
if (gServerSettings.enableCheats) {
djui_button_create(body, DLANG(PAUSE, CHEATS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_cheats_create);
}
if (gNetworkType == NT_SERVER) {
djui_button_create(body, DLANG(PAUSE, SERVER_SETTINGS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create);
}

View file

@ -9,7 +9,6 @@
#include "src/game/hardcoded.h"
#include "src/game/scroll_targets.h"
#include "pc/configfile.h"
#include "pc/cheats.h"
#include "pc/djui/djui.h"
#include "pc/djui/djui_panel.h"
#include "pc/djui/djui_hud_utils.h"
@ -117,7 +116,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
gServerSettings.playerKnockbackStrength = configPlayerKnockbackStrength;
gServerSettings.stayInLevelAfterStar = configStayInLevelAfterStar;
gServerSettings.skipIntro = configSkipIntro;
gServerSettings.enableCheats = configEnableCheats;
gServerSettings.enableCheats = 0;
gServerSettings.bubbleDeath = configBubbleDeath;
gServerSettings.enablePlayersInLevelDisplay = TRUE;
gServerSettings.enablePlayerList = TRUE;

View file

@ -18,7 +18,6 @@
#include "pc/djui/djui_panel_playerlist.h"
#include "pc/djui/djui_panel_menu.h"
#include "pc/djui/djui_panel_join_message.h"
#include "pc/cheats.h"
#include "pc/utils/string_builder.h"
//#define DISABLE_MODULE_LOG 1
#include "pc/debuglog.h"

View file

@ -387,7 +387,7 @@ void network_receive_player(struct Packet* p) {
np->currPositionValid = true;
#ifndef DEVELOPMENT
if (gNetworkType == NT_SERVER && gServerSettings.enableCheats == 0) {
if (gNetworkType == NT_SERVER) {
if (m->action == ACT_DEBUG_FREE_MOVE) {
network_send_kick(np->localIndex, EKT_CLOSE_CONNECTION);
network_player_disconnected(np->localIndex);