mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-26 01:58:51 -05:00
Add cheats menu.
This commit is contained in:
parent
dae8035314
commit
25468cf722
@ -27,6 +27,7 @@ namespace Game {
|
||||
const std::string AudioSection = AUDIO_SECTION;
|
||||
const std::string ControllerSection = CONTROLLER_SECTION;
|
||||
const std::string EnhancementSection = ENHANCEMENTS_SECTION;
|
||||
const std::string CheatSection = CHEATS_SECTION;
|
||||
|
||||
void UpdateAudio() {
|
||||
Audio_SetGameVolume(SEQ_BGM_MAIN, Settings.audio.music_main);
|
||||
@ -57,9 +58,7 @@ namespace Game {
|
||||
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
|
||||
CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Settings.enhancements.animated_pause_menu);
|
||||
|
||||
Settings.enhancements.debug_mode = stob(Conf[EnhancementSection]["debug_mode"]);
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Settings.enhancements.debug_mode);
|
||||
|
||||
// Audio
|
||||
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
|
||||
CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), Settings.audio.master);
|
||||
|
||||
@ -75,6 +74,7 @@ namespace Game {
|
||||
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
|
||||
CVar_SetFloat(const_cast<char*>("gFanfareVolume"), Settings.audio.fanfare);
|
||||
|
||||
// Controllers
|
||||
Settings.controller.gyro_sensitivity = Ship::stof(Conf[ControllerSection]["gyro_sensitivity"]);
|
||||
CVar_SetFloat(const_cast<char*>("gGyroSensitivity"), Settings.controller.gyro_sensitivity);
|
||||
|
||||
@ -87,6 +87,34 @@ namespace Game {
|
||||
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
|
||||
CVar_SetS32(const_cast<char*>("gInputEnabled"), Settings.controller.input_enabled);
|
||||
|
||||
// Cheats
|
||||
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Settings.cheats.debug_mode);
|
||||
|
||||
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Settings.cheats.infinite_money);
|
||||
|
||||
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Settings.cheats.infinite_health);
|
||||
|
||||
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Settings.cheats.infinite_ammo);
|
||||
|
||||
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Settings.cheats.infinite_magic);
|
||||
|
||||
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
|
||||
CVar_SetS32(const_cast<char*>("gNoClip"), Settings.cheats.no_clip);
|
||||
|
||||
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
|
||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Settings.cheats.climb_everything);
|
||||
|
||||
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
|
||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Settings.cheats.moon_jump_on_l);
|
||||
|
||||
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
|
||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Settings.cheats.super_tunic);
|
||||
|
||||
UpdateAudio();
|
||||
}
|
||||
|
||||
@ -111,13 +139,25 @@ namespace Game {
|
||||
Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text);
|
||||
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
|
||||
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
|
||||
Conf[EnhancementSection]["debug_mode"] = std::to_string(Settings.enhancements.debug_mode);
|
||||
|
||||
|
||||
// Controllers
|
||||
Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);
|
||||
Conf[ControllerSection]["rumble_strength"] = std::to_string(Settings.controller.rumble_strength);
|
||||
Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale);
|
||||
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
|
||||
|
||||
// Cheats
|
||||
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
|
||||
Conf[CheatSection]["infinite_money"] = std::to_string(Settings.cheats.infinite_money);
|
||||
Conf[CheatSection]["infinite_health"] = std::to_string(Settings.cheats.infinite_health);
|
||||
Conf[CheatSection]["infinite_ammo"] = std::to_string(Settings.cheats.infinite_ammo);
|
||||
Conf[CheatSection]["infinite_magic"] = std::to_string(Settings.cheats.infinite_magic);
|
||||
Conf[CheatSection]["no_clip"] = std::to_string(Settings.cheats.no_clip);
|
||||
Conf[CheatSection]["climb_everything"] = std::to_string(Settings.cheats.climb_everything);
|
||||
Conf[CheatSection]["moon_jump_on_l"] = std::to_string(Settings.cheats.moon_jump_on_l);
|
||||
Conf[CheatSection]["super_tunic"] = std::to_string(Settings.cheats.super_tunic);
|
||||
|
||||
Conf.Save();
|
||||
}
|
||||
|
||||
|
@ -23,15 +23,28 @@ struct SoHConfigType {
|
||||
bool fast_text = false;
|
||||
bool disable_lod = false;
|
||||
bool animated_pause_menu = false;
|
||||
bool debug_mode = false;
|
||||
} enhancements;
|
||||
|
||||
// Controller
|
||||
struct {
|
||||
float gyro_sensitivity = 1.0f;
|
||||
float rumble_strength = 1.0f;
|
||||
float input_scale = 1.0f;
|
||||
bool input_enabled = false;
|
||||
} controller;
|
||||
|
||||
// Cheats
|
||||
struct {
|
||||
bool debug_mode = false;
|
||||
bool infinite_money = false;
|
||||
bool infinite_health = false;
|
||||
bool infinite_ammo = false;
|
||||
bool infinite_magic = false;
|
||||
bool no_clip = false;
|
||||
bool climb_everything = false;
|
||||
bool moon_jump_on_l = false;
|
||||
bool super_tunic = false;
|
||||
} cheats;
|
||||
};
|
||||
|
||||
enum SeqPlayers {
|
||||
@ -46,6 +59,7 @@ enum SeqPlayers {
|
||||
#define AUDIO_SECTION "AUDIO SETTINGS"
|
||||
#define CONTROLLER_SECTION "CONTROLLER SECTION"
|
||||
#define ENHANCEMENTS_SECTION "ENHANCEMENT SETTINGS"
|
||||
#define CHEATS_SECTION "CHEATS SETTINGS"
|
||||
|
||||
namespace Game {
|
||||
extern SoHConfigType Settings;
|
||||
|
@ -350,20 +350,65 @@ namespace SohImGui {
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::Text("Debugging");
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Checkbox("Debug Mode", &Game::Settings.enhancements.debug_mode)) {
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Game::Settings.enhancements.debug_mode);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Developer Tools")) {
|
||||
HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh));
|
||||
HOOK(ImGui::MenuItem("Console", nullptr, &console->opened));
|
||||
|
||||
ImGui::Text("Debug");
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) {
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Game::Settings.cheats.debug_mode);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Cheats")) {
|
||||
if (ImGui::Checkbox("Infinite Money", &Game::Settings.cheats.infinite_money)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Game::Settings.cheats.infinite_money);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Health", &Game::Settings.cheats.infinite_health)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Game::Settings.cheats.infinite_health);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Ammo", &Game::Settings.cheats.infinite_ammo)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Game::Settings.cheats.infinite_ammo);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Magic", &Game::Settings.cheats.infinite_magic)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Game::Settings.cheats.infinite_magic);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
|
||||
CVar_SetS32(const_cast<char*>("gNoClip"), Game::Settings.cheats.no_clip);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) {
|
||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Game::Settings.cheats.climb_everything);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) {
|
||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Game::Settings.cheats.moon_jump_on_l);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) {
|
||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Game::Settings.cheats.super_tunic);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
@ -324,6 +324,75 @@ void GameState_Update(GameState* gameState) {
|
||||
func_800C49F4(gfxCtx);
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// Cheats hooks
|
||||
// -----------------------
|
||||
|
||||
// Inf Money
|
||||
if (CVar_GetS32("gInfiniteMoney", 0) != 0) {
|
||||
if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) {
|
||||
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
|
||||
}
|
||||
}
|
||||
|
||||
// Inf Health
|
||||
if (CVar_GetS32("gInfiniteHealth", 0) != 0) {
|
||||
if (gSaveContext.health < gSaveContext.healthCapacity) {
|
||||
gSaveContext.health = gSaveContext.healthCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
// Inf Ammo
|
||||
if (CVar_GetS32("gInfiniteAmmo", 0) != 0) {
|
||||
// Deku Sticks
|
||||
if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) {
|
||||
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
|
||||
}
|
||||
|
||||
// Deku Nuts
|
||||
if (AMMO(ITEM_NUT) < CUR_CAPACITY(UPG_NUTS)) {
|
||||
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
|
||||
}
|
||||
|
||||
// Bombs
|
||||
if (AMMO(ITEM_BOMB) < CUR_CAPACITY(UPG_BOMB_BAG)) {
|
||||
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
|
||||
}
|
||||
|
||||
// Fairy Bow (Ammo)
|
||||
if (AMMO(ITEM_BOW) < CUR_CAPACITY(UPG_QUIVER)) {
|
||||
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
|
||||
}
|
||||
|
||||
// Fairy Slingshot (Ammo)
|
||||
if (AMMO(ITEM_SLINGSHOT) < CUR_CAPACITY(UPG_BULLET_BAG)) {
|
||||
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
|
||||
}
|
||||
|
||||
// Bombchus (max: 50, no upgrades)
|
||||
if (AMMO(ITEM_BOMBCHU) < 50) {
|
||||
AMMO(ITEM_BOMBCHU) = 50;
|
||||
}
|
||||
}
|
||||
|
||||
// Inf Magic
|
||||
if (CVar_GetS32("gInfiniteMagic", 0) != 0) {
|
||||
if (gSaveContext.magicAcquired && gSaveContext.magic != (gSaveContext.doubleMagic + 1) * 0x30) {
|
||||
gSaveContext.magic = (gSaveContext.doubleMagic + 1) * 0x30;
|
||||
}
|
||||
}
|
||||
|
||||
// Moon Jump On L
|
||||
if (CVar_GetS32("gMoonJumpOnL", 0) != 0) {
|
||||
if (gGlobalCtx) {
|
||||
Player* player = GET_PLAYER(gGlobalCtx);
|
||||
|
||||
if (CHECK_BTN_ANY(gGlobalCtx->state.input[0].cur.button, BTN_L)) {
|
||||
player->actor.velocity.y = 6.34375f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gameState->frames++;
|
||||
}
|
||||
|
||||
|
@ -1874,6 +1874,10 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
|
||||
s32 bgId2;
|
||||
f32 nx, ny, nz; // unit normal of polygon
|
||||
|
||||
if (CVar_GetS32("gNoClip", 0) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result = false;
|
||||
*outBgId = BGCHECK_SCENE;
|
||||
*outPoly = NULL;
|
||||
@ -3996,7 +4000,11 @@ u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
* SurfaceType Get Wall Flags
|
||||
*/
|
||||
s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
if (CVar_GetS32("gClimbEverything", 0) != 0) {
|
||||
return (1 << 3) | D_80119D90[func_80041D94(colCtx, poly, bgId)];
|
||||
} else {
|
||||
return D_80119D90[func_80041D94(colCtx, poly, bgId)];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4078,11 +4078,11 @@ void Interface_Update(GlobalContext* globalCtx) {
|
||||
D_80125A58 = func_8008F2F8(globalCtx);
|
||||
|
||||
if (D_80125A58 == 1) {
|
||||
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2) {
|
||||
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2 || CVar_GetS32("gSuperTunic", 0) != 0) {
|
||||
D_80125A58 = 0;
|
||||
}
|
||||
} else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) {
|
||||
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3) {
|
||||
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3 || CVar_GetS32("gSuperTunic", 0) != 0) {
|
||||
D_80125A58 = 0;
|
||||
}
|
||||
}
|
||||
|
@ -631,9 +631,9 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
|
||||
if (0) {}
|
||||
|
||||
if ((triggerEntry->flag != 0) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
|
||||
(((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON)) ||
|
||||
(((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0)) ||
|
||||
(((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) &&
|
||||
(this->currentTunic != PLAYER_TUNIC_ZORA)))) {
|
||||
(this->currentTunic != PLAYER_TUNIC_ZORA && CVar_GetS32("gSuperTunic", 0) == 0)))) {
|
||||
Message_StartTextbox(globalCtx, triggerEntry->textId, NULL);
|
||||
gSaveContext.textTriggerFlags |= triggerEntry->flag;
|
||||
}
|
||||
|
@ -3847,7 +3847,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) {
|
||||
SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) &&
|
||||
(this->unk_A79 >= D_808544F4[sp48])) ||
|
||||
((sp48 >= 0) &&
|
||||
((this->currentTunic != PLAYER_TUNIC_GORON) || (this->unk_A79 >= D_808544F4[sp48])))) {
|
||||
((this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0) || (this->unk_A79 >= D_808544F4[sp48])))) {
|
||||
this->unk_A79 = 0;
|
||||
this->actor.colChkInfo.damage = 4;
|
||||
func_80837C0C(globalCtx, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20);
|
||||
@ -4632,7 +4632,7 @@ s32 func_8083A6AC(Player* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false,
|
||||
true, &sp80) &&
|
||||
(ABS(sp84->normal.y) < 600)) {
|
||||
((ABS(sp84->normal.y) < 600) || (CVar_GetS32("gClimbEverything", 0) != 0))) {
|
||||
f32 nx = COLPOLY_GET_NORMAL(sp84->normal.x);
|
||||
f32 ny = COLPOLY_GET_NORMAL(sp84->normal.y);
|
||||
f32 nz = COLPOLY_GET_NORMAL(sp84->normal.z);
|
||||
@ -8152,7 +8152,7 @@ static struct_80832924 D_808545F0[] = {
|
||||
};
|
||||
|
||||
void func_80843CEC(Player* this, GlobalContext* globalCtx) {
|
||||
if (this->currentTunic != PLAYER_TUNIC_GORON) {
|
||||
if (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0) {
|
||||
if ((globalCtx->roomCtx.curRoom.unk_02 == 3) || (D_808535E4 == 9) ||
|
||||
((func_80838144(D_808535E4) >= 0) &&
|
||||
!SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) {
|
||||
@ -9888,7 +9888,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) {
|
||||
if ((this->actor.bgCheckFlags & 0x200) && (D_80853608 < 0x3000)) {
|
||||
CollisionPoly* wallPoly = this->actor.wallPoly;
|
||||
|
||||
if (ABS(wallPoly->normal.y) < 600) {
|
||||
if ((ABS(wallPoly->normal.y) < 600) || (CVar_GetS32("gClimbEverything", 0) != 0)) {
|
||||
f32 sp8C = COLPOLY_GET_NORMAL(wallPoly->normal.x);
|
||||
f32 sp88 = COLPOLY_GET_NORMAL(wallPoly->normal.y);
|
||||
f32 sp84 = COLPOLY_GET_NORMAL(wallPoly->normal.z);
|
||||
@ -10188,7 +10188,7 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) {
|
||||
s32 sp58;
|
||||
s32 sp54;
|
||||
|
||||
if (this->currentTunic == PLAYER_TUNIC_GORON) {
|
||||
if (this->currentTunic == PLAYER_TUNIC_GORON || CVar_GetS32("gSuperTunic", 0) != 0) {
|
||||
sp54 = 20;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user