mirror of
https://github.com/AloUltraExt/sm64ex-alo.git
synced 2025-01-24 00:24:33 -05:00
make cheats flag and more walk on cheats
This commit is contained in:
parent
a49f459165
commit
3016c41e37
8 changed files with 94 additions and 14 deletions
36
Makefile
36
Makefile
|
@ -45,12 +45,14 @@ OSX_BUILD ?= 0
|
|||
TARGET_ARCH ?= native
|
||||
TARGET_BITS ?= 0
|
||||
|
||||
# Enable better camera (Puppycam)
|
||||
BETTERCAMERA ?= 1
|
||||
# Disable no drawing distance by default
|
||||
NODRAWINGDISTANCE ?= 0
|
||||
# Enable extended options menu by default
|
||||
EXT_OPTIONS_MENU ?= 1
|
||||
# Enable better camera (Puppycam)
|
||||
BETTERCAMERA ?= 1
|
||||
# Enable cheats
|
||||
CHEATS_ACTIONS ?= 1
|
||||
# Disable no drawing distance by default
|
||||
NODRAWINGDISTANCE ?= 0
|
||||
# Disable text-based save-files by default
|
||||
TEXTSAVES ?= 0
|
||||
# Load resources from external files
|
||||
|
@ -638,9 +640,15 @@ ifeq ($(BETTERCAMERA),1)
|
|||
EXT_OPTIONS_MENU := 1
|
||||
endif
|
||||
|
||||
# Check for Cheats option
|
||||
ifeq ($(CHEATS_ACTIONS),1)
|
||||
CUSTOM_C_DEFINES += -DCHEATS_ACTIONS
|
||||
EXT_OPTIONS_MENU := 1
|
||||
endif
|
||||
|
||||
# Check for extended options menu option
|
||||
ifeq ($(EXT_OPTIONS_MENU),1)
|
||||
CUSTOM_C_DEFINES += -DEXT_OPTIONS_MENU -DCHEATS_ACTIONS
|
||||
CUSTOM_C_DEFINES += -DEXT_OPTIONS_MENU
|
||||
endif
|
||||
|
||||
# Check for Rumble option
|
||||
|
@ -1157,11 +1165,14 @@ $(BUILD_DIR)/include/text_options_strings.h: include/text_options_strings.h.in
|
|||
$(call print,Encoding:,$<,$@)
|
||||
$(V)$(TEXTCONV) charmap.txt $< $@
|
||||
|
||||
ifeq ($(CHEATS_ACTIONS),1)
|
||||
$(BUILD_DIR)/include/text_cheats_strings.h: include/text_cheats_strings.h.in
|
||||
$(call print,Encoding:,$<,$@)
|
||||
$(V)$(TEXTCONV) charmap.txt $< $@
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(VERSION),eu)
|
||||
TEXT_DIRS := text/de text/us text/fr
|
||||
|
||||
|
@ -1231,13 +1242,18 @@ $(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(LA
|
|||
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
|
||||
ifeq ($(BETTERCAMERA),1)
|
||||
$(BUILD_DIR)/src/extras/bettercamera.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
endif
|
||||
|
||||
ifeq ($(EXT_OPTIONS_MENU),1)
|
||||
$(BUILD_DIR)/src/extras/cheats.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
$(BUILD_DIR)/src/extras/options_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
|
||||
ifeq ($(BETTERCAMERA),1)
|
||||
$(BUILD_DIR)/src/extras/bettercamera.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
endif
|
||||
|
||||
ifeq ($(CHEATS_ACTIONS),1)
|
||||
$(BUILD_DIR)/src/extras/cheats.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
endif
|
||||
|
||||
$(BUILD_DIR)/src/extras/options_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_PORT_CONSOLE),0)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// TODO: Actually translate this to JP
|
||||
|
||||
#define TEXT_OPT_CHEAT0 _("ENABLE CHEATS")
|
||||
#define TEXT_OPT_CHEAT1 _("MOONJUMP (PRESS L)")
|
||||
#define TEXT_OPT_CHEAT1 _("MOON-JUMP (PRESS L)")
|
||||
#define TEXT_OPT_CHEAT2 _("INVINCIBLE PLAYER")
|
||||
#define TEXT_OPT_CHEAT3 _("INFINITE LIVES")
|
||||
#define TEXT_OPT_CHEAT4 _("SUPER SPEED")
|
||||
|
@ -24,17 +24,21 @@
|
|||
|
||||
#define TEXT_CHEAT_WALKON0 _("WALK ON LAVA")
|
||||
#define TEXT_CHEAT_WALKON1 _("WALK ON QUICKSAND")
|
||||
#define TEXT_CHEAT_WALKON2 _("WALK ON WATER")
|
||||
#define TEXT_CHEAT_WALKON3 _("WALK ON GAS")
|
||||
#define TEXT_CHEAT_WALKON4 _("WALK ON SLOPE")
|
||||
#define TEXT_CHEAT_WALKON5 _("WALK ON DEATH BARRIER")
|
||||
|
||||
#else // VERSION
|
||||
|
||||
#define TEXT_OPT_CHEAT0 _("Enable cheats")
|
||||
#define TEXT_OPT_CHEAT1 _("Moonjump (Press L)")
|
||||
#define TEXT_OPT_CHEAT2 _("Invincible Player")
|
||||
#define TEXT_OPT_CHEAT1 _("Moon-jump (Press L)")
|
||||
#define TEXT_OPT_CHEAT2 _("Invincible player")
|
||||
#define TEXT_OPT_CHEAT3 _("Infinite lives")
|
||||
#define TEXT_OPT_CHEAT4 _("Super speed")
|
||||
#define TEXT_OPT_CHEAT5 _("Super responsive controls")
|
||||
#define TEXT_OPT_CHEAT6 _("Exit course at any time")
|
||||
#define TEXT_OPT_CHEAT7 _("Player Size")
|
||||
#define TEXT_OPT_CHEAT7 _("Player size")
|
||||
#define TEXT_OPT_CHEAT8 _("Walk on cheats")
|
||||
|
||||
#define TEXT_CHEAT_MSIZE0 _("Normal")
|
||||
|
@ -43,6 +47,10 @@
|
|||
|
||||
#define TEXT_CHEAT_WALKON0 _("Walk on lava")
|
||||
#define TEXT_CHEAT_WALKON1 _("Walk on quicksand")
|
||||
#define TEXT_CHEAT_WALKON2 _("Walk on water")
|
||||
#define TEXT_CHEAT_WALKON3 _("Walk on gas")
|
||||
#define TEXT_CHEAT_WALKON4 _("Walk on slope")
|
||||
#define TEXT_CHEAT_WALKON5 _("Walk on death barrier")
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#include "surface_collision.h"
|
||||
#include "surface_load.h"
|
||||
#include "math_util.h"
|
||||
#ifdef CHEATS_ACTIONS
|
||||
#include "extras/cheats.h"
|
||||
#endif
|
||||
|
||||
/**************************************************
|
||||
* WALLS *
|
||||
|
@ -456,6 +459,10 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef CHEATS_ACTIONS
|
||||
height = cheats_walk_on_environment(height, x, z);
|
||||
#endif
|
||||
|
||||
*pheight = height;
|
||||
floor = surf;
|
||||
break;
|
||||
|
|
|
@ -87,11 +87,19 @@ static const u8 *cheatChoicesMarioSize[] = {
|
|||
static const u8 optsWalkOnCheatStr[][64] = {
|
||||
{ TEXT_CHEAT_WALKON0 },
|
||||
{ TEXT_CHEAT_WALKON1 },
|
||||
{ TEXT_CHEAT_WALKON2 },
|
||||
{ TEXT_CHEAT_WALKON3 },
|
||||
{ TEXT_CHEAT_WALKON4 },
|
||||
{ TEXT_CHEAT_WALKON5 },
|
||||
};
|
||||
|
||||
static struct Option optWalkOnCheats[] = {
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[0], &Cheats.WalkOn.Lava ),
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[1], &Cheats.WalkOn.Quicksand ),
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[2], &Cheats.WalkOn.Water ),
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[3], &Cheats.WalkOn.Gas ),
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[4], &Cheats.WalkOn.Slope ),
|
||||
DEF_OPT_TOGGLE( optsWalkOnCheatStr[5], &Cheats.WalkOn.DeathBarrier ),
|
||||
};
|
||||
|
||||
static struct SubMenu menuCheatWalkOn = DEF_SUBMENU( optCheatMenuStr[1], optWalkOnCheats );
|
||||
|
@ -184,4 +192,24 @@ void cheats_mario_size(struct MarioState *m) {
|
|||
}
|
||||
}
|
||||
|
||||
f32 cheats_walk_on_environment(f32 height, f32 x, f32 z) {
|
||||
f32 newHeight;
|
||||
f32 waterLevel = find_water_level(x, z);
|
||||
f32 gasLevel = find_poison_gas_level(x, z);
|
||||
|
||||
if (Cheats.EnableCheats) {
|
||||
if (Cheats.WalkOn.Water && height < waterLevel && gCurrentObject == gMarioObject) {
|
||||
newHeight = waterLevel;
|
||||
} else if (Cheats.WalkOn.Gas && height < gasLevel && gCurrentObject == gMarioObject) {
|
||||
newHeight = gasLevel;
|
||||
} else {
|
||||
newHeight = height;
|
||||
}
|
||||
} else {
|
||||
newHeight = height;
|
||||
}
|
||||
|
||||
return newHeight;
|
||||
}
|
||||
|
||||
#endif // CHEATS_ACTIONS
|
||||
|
|
|
@ -54,6 +54,10 @@ extern const u8 optCheatMenuStr[][32];
|
|||
struct CheatListWalkOn {
|
||||
bool Lava;
|
||||
bool Quicksand;
|
||||
bool Water;
|
||||
bool Gas;
|
||||
bool Slope;
|
||||
bool DeathBarrier;
|
||||
};
|
||||
|
||||
struct CheatList {
|
||||
|
@ -76,5 +80,6 @@ extern void cheats_mario_inputs(struct MarioState *m);
|
|||
extern void cheats_mario_action(struct MarioState *m);
|
||||
extern void cheats_responsive_controls(struct MarioState *m);
|
||||
extern void cheats_mario_size(struct MarioState *m);
|
||||
extern f32 cheats_walk_on_environment(f32 height, f32 x, f32 z);
|
||||
|
||||
#endif // CHEATS_H
|
||||
|
|
|
@ -1817,6 +1817,10 @@ void mario_process_interactions(struct MarioState *m) {
|
|||
}
|
||||
|
||||
void check_death_barrier(struct MarioState *m) {
|
||||
#ifdef CHEATS_ACTIONS
|
||||
if (Cheats.EnableCheats && Cheats.WalkOn.DeathBarrier) return;
|
||||
#endif
|
||||
|
||||
if (m->pos[1] < m->floorHeight + 2048.0f) {
|
||||
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) {
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
|
|
|
@ -393,6 +393,12 @@ void mario_set_forward_vel(struct MarioState *m, f32 forwardVel) {
|
|||
*/
|
||||
s32 mario_get_floor_class(struct MarioState *m) {
|
||||
s32 floorClass;
|
||||
#ifdef CHEATS_ACTIONS
|
||||
if (Cheats.EnableCheats && Cheats.WalkOn.Slope) {
|
||||
floorClass = SURFACE_CLASS_NOT_SLIPPERY;
|
||||
return floorClass;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The slide terrain type defaults to slide slipperiness.
|
||||
// This doesn't matter too much since normally the slide terrain
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
#include "platform.h"
|
||||
#include "macros.h"
|
||||
|
||||
#ifdef CHEATS_ACTIONS
|
||||
#include "extras/cheats.h"
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -16,7 +18,9 @@ struct PCCLIOptions gCLIOpts = { 0 };
|
|||
|
||||
static void print_help(void) {
|
||||
printf("Super Mario 64 PC Port\n");
|
||||
#ifdef CHEATS_ACTIONS
|
||||
printf("%-20s\tEnables the cheat menu.\n", "--cheats");
|
||||
#endif
|
||||
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");
|
||||
|
@ -56,8 +60,10 @@ void parse_cli_opts(int argc, char* argv[]) {
|
|||
else if (strcmp(argv[i], "--windowed") == 0) // Open game in windowed mode
|
||||
gCLIOpts.FullScreen = 2;
|
||||
|
||||
#ifdef CHEATS_ACTIONS
|
||||
else if (strcmp(argv[i], "--cheats") == 0) // Enable cheats menu
|
||||
Cheats.EnableCheats = true;
|
||||
#endif
|
||||
|
||||
else if (strcmp(argv[i], "--poolsize") == 0) // Main pool size
|
||||
arg_uint("--poolsize", argv[++i], &gCLIOpts.PoolSize);
|
||||
|
|
Loading…
Add table
Reference in a new issue