Add Mario scale modifier, other cheats to UI

This commit is contained in:
Llennpie 2021-12-24 20:50:18 -05:00
parent 61410071d2
commit 3be1aa71ee
6 changed files with 32 additions and 16 deletions

View File

@ -1210,6 +1210,8 @@ s32 set_water_plunge_action(struct MarioState *m) {
u8 sSquishScaleOverTime[16] = { 0x46, 0x32, 0x32, 0x3C, 0x46, 0x50, 0x50, 0x3C,
0x28, 0x14, 0x14, 0x1E, 0x32, 0x3C, 0x3C, 0x28 };
float mario_scale_size = 2.5f;
/**
* Applies the squish to Mario's model via scaling.
*/
@ -1219,11 +1221,8 @@ void squish_mario_model(struct MarioState *m) {
// Also handles the Tiny Mario and Huge Mario cheats.
if (m->squishTimer == 0) {
if (Cheats.EnableCheats) {
if (Cheats.HugeMario) {
vec3f_set(m->marioObj->header.gfx.scale, 2.5f, 2.5f, 2.5f);
}
else if (Cheats.TinyMario) {
vec3f_set(m->marioObj->header.gfx.scale, 0.2f, 0.2f, 0.2f);
if (Cheats.ScaleMario) {
vec3f_set(m->marioObj->header.gfx.scale, mario_scale_size, mario_scale_size, mario_scale_size);
}
else {
vec3f_set(m->marioObj->header.gfx.scale, 1.0f, 1.0f, 1.0f);
@ -1757,7 +1756,7 @@ s32 execute_mario_action(UNUSED struct Object *o) {
if (Cheats.GodMode)
gMarioState->health = 0x880;
if (Cheats.InfiniteLives && gMarioState->numLives < 99)
if (Cheats.InfiniteLives && gMarioState->numLives < 4)
gMarioState->numLives += 1;
if (Cheats.SuperSpeed && gMarioState->forwardVel > 0)

View File

@ -55,4 +55,6 @@ extern int current_cap_state;
extern int current_eye_state;
extern int current_hand_state;
extern float mario_scale_size;
#endif // MARIO_H

View File

@ -22,6 +22,7 @@
#include "moon/utils/moon-env.h"
#include "pc/controller/controller_keyboard.h"
#include "moon/ui/screens/addons/addons-view.h"
#include "pc/cheats.h"
#include <SDL2/SDL.h>
@ -494,10 +495,6 @@ namespace MoonInternal {
ImGui::Dummy(ImVec2(0, 5));
ImGui::Checkbox("God Mode", &enable_god);
ImGui::Dummy(ImVec2(0, 5));
const char* levelList[] = {
"Castle Grounds", "Castle Inside", "Bob-omb Battlefield",
"Whomp's Fortress", "Princess's Secret Slide", "Tower of the Wing Cap",
@ -508,7 +505,8 @@ namespace MoonInternal {
"Snowman's Land", "Wet-Dry World", "Tall, Tall Mountain", "Tiny, Huge Island",
"Tick Tock Clock", "Wing Mario Over the Rainbow", "Rainbow Ride", "Bowser in the Sky"
};
ImGui::Combo("Level", &current_level_sel, levelList, IM_ARRAYSIZE(levelList));
ImGui::Text("Warp to Level");
ImGui::Combo("###warp_to_level", &current_level_sel, levelList, IM_ARRAYSIZE(levelList));
if (ImGui::Button("Warp")) {
switch (current_level_sel) {
@ -598,6 +596,19 @@ namespace MoonInternal {
ImGui::Dummy(ImVec2(0, 5));
if (ImGui::CollapsingHeader("Cheats")) {
ImGui::Checkbox("God Mode", &enable_god); // agent x version better!!!
ImGui::Checkbox("Infinite Lives", &Cheats.InfiniteLives);
ImGui::Checkbox("Moon Jump", &Cheats.MoonJump); ImGui::SameLine(); HelpMarker(
"Hold L in mid-air to Moon Jump!");
ImGui::Checkbox("Responsive Controls", &Cheats.Responsive);
ImGui::Checkbox("Super Speed", &Cheats.SuperSpeed);
ImGui::Checkbox("Custom Mario Scale", &Cheats.ScaleMario);
if (Cheats.ScaleMario) {
ImGui::SliderFloat("Scale ###mario_scale", &mario_scale_size, 0.2f, 5.0f);
}
}
/*
const char* skyStates[] = { "Default", "Night", "Green", "Blue", "Pink"};
ImGui::Combo("Skybox", &selected_sky_item, skyStates, IM_ARRAYSIZE(skyStates));

View File

@ -30,6 +30,7 @@ extern "C" {
#include "sm64.h"
#include "game/behavior_actions.h"
#include "game/behaviors/yoshi.inc.h"
#include "pc/cheats.h"
}
bool camera_frozen;
@ -71,9 +72,13 @@ namespace MoonInternal {
camera_frozen = false;
enable_shadows = true;
enable_god = false;
enable_god = true;
enable_yoshi = false;
Cheats.EnableCheats = true;
Cheats.InfiniteLives = true;
Cheats.ExitAnywhere = true;
MoonInternal::load_cc_directory();
MoonInternal::load_cc_file(cc_array[configColorCode]);
apply_editor_from_cc();

View File

@ -17,6 +17,6 @@ MCheatsCategory::MCheatsCategory() : MoonCategory("TEXT_OPT_CHEATS"){
this->catOptions.push_back(new MWValue(22, 125, "TEXT_OPT_CHEAT5", {.bvar = &Cheats.SuperSpeed }, true));
this->catOptions.push_back(new MWValue(22, 142, "TEXT_OPT_CHEAT6", {.bvar = &Cheats.Responsive }, true));
this->catOptions.push_back(new MWValue(22, 159, "TEXT_OPT_CHEAT7", {.bvar = &Cheats.ExitAnywhere }, true));
this->catOptions.push_back(new MWValue(22, 176, "TEXT_OPT_CHEAT8", {.bvar = &Cheats.HugeMario }, true));
this->catOptions.push_back(new MWValue(22, 193, "TEXT_OPT_CHEAT9", {.bvar = &Cheats.TinyMario }, true));
//this->catOptions.push_back(new MWValue(22, 176, "TEXT_OPT_CHEAT8", {.bvar = &Cheats.HugeMario }, true));
//this->catOptions.push_back(new MWValue(22, 193, "TEXT_OPT_CHEAT9", {.bvar = &Cheats.TinyMario }, true));
}

View File

@ -11,8 +11,7 @@ struct CheatList {
bool SuperSpeed;
bool Responsive;
bool ExitAnywhere;
bool HugeMario;
bool TinyMario;
bool ScaleMario;
};
extern struct CheatList Cheats;