summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2022-07-10 23:47:14 -0700
committerGitHub <noreply@github.com>2022-07-10 23:47:14 -0700
commit510894d1959cf168ae1d19a5c7cf0ec5294edbbb (patch)
treef400797179332278d65065b29e21ec9aeb40fbd6
parent5a0c39cb9586343be2509bf5c75d69898c248355 (diff)
parent1709d6c0b759bc1ec217fdf9b63615c50ba4c3e7 (diff)
Merge pull request #66 from zsrtp/refactor
refactor + fixes / feature additions
-rw-r--r--Makefile2
-rw-r--r--RomHack-template.toml51
-rw-r--r--any.binbin0 -> 3920 bytes
m---------external/libtp_c0
-rw-r--r--external/misc/ad.py147
-rw-r--r--external/misc/any.py127
-rw-r--r--include/actor.h8
-rw-r--r--include/bit.h8
-rw-r--r--include/cheats.h8
-rw-r--r--include/commands.h72
-rw-r--r--include/controller.h28
-rw-r--r--include/corotdcheck.h2
-rw-r--r--include/fifo_queue.h2
-rw-r--r--include/flaglog.h2
-rw-r--r--include/font.h29
-rw-r--r--include/free_cam.h4
-rw-r--r--include/gorge.h10
-rw-r--r--include/gz_flags.h81
-rw-r--r--include/input_viewer.h8
-rw-r--r--include/lib.h1
-rw-r--r--include/menu.h43
-rw-r--r--include/menus/actor_spawn_menu.h12
-rw-r--r--include/menus/ad_saves_menu.h40
-rw-r--r--include/menus/amounts_menu.h4
-rw-r--r--include/menus/any_saves_menu.h7
-rw-r--r--include/menus/cheats_menu.h5
-rw-r--r--include/menus/flag_records_menu.h5
-rw-r--r--include/menus/flags_menu.h22
-rw-r--r--include/menus/hundo_saves_menu.h4
-rw-r--r--include/menus/inventory_menu.h4
-rw-r--r--include/menus/item_wheel_menu.h8
-rw-r--r--include/menus/main_menu.h4
-rw-r--r--include/menus/memfiles_menu.h7
-rw-r--r--include/menus/memory_editor_menu.h8
-rw-r--r--include/menus/memory_menu.h11
-rw-r--r--include/menus/pause_menu.h4
-rw-r--r--include/menus/position_settings_menu.h6
-rw-r--r--include/menus/practice_menu.h6
-rw-r--r--include/menus/scene_menu.h23
-rw-r--r--include/menus/settings_menu.h16
-rw-r--r--include/menus/tools_menu.h18
-rw-r--r--include/menus/warping_menu.h4
-rw-r--r--include/movelink.h6
-rw-r--r--include/rollcheck.h5
-rw-r--r--include/save_manager.h42
-rw-r--r--include/save_specials.h46
-rw-r--r--include/system.h8
-rw-r--r--include/time.h5
-rw-r--r--include/timer.h11
-rw-r--r--include/umd.h5
-rw-r--r--include/utils/audio.h13
-rw-r--r--include/utils/card.h24
-rw-r--r--include/utils/cursor.h65
-rw-r--r--include/utils/draw.h24
-rw-r--r--include/utils/hook.h2
-rw-r--r--include/utils/lines.h27
-rw-r--r--include/utils/link.h10
-rw-r--r--include/utils/loading.h8
-rw-r--r--include/utils/memory.h5
-rw-r--r--res/save_files/ad.binbin4080 -> 3360 bytes
-rw-r--r--res/save_files/ad/aeralfos.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/ag.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/argorok.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/beast_ganon.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/bk_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/blizzeta.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/camp.binbin0 -> 2700 bytes
-rw-r--r--res/save_files/ad/city1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/city2.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/dangoro.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/darkhammer.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/darknut.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/deathsword.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/deku_toad.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/diababa.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/dot_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/early_ele.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/early_platform.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/eldin_twilight.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/faron_boost.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/forest.binbin0 -> 2700 bytes
-rw-r--r--res/save_files/ad/forest2.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/forest_escape.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/gm.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/grove2.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/hc.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/horseback.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/ice_boost.bin (renamed from res/save_files/ad/post_lanayru.bin)bin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/kb1.bin (renamed from res/save_files/ad/forest_bit.bin)bin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/lakebed1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/lanayru_twilight.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/mdh.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/morpheel.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/mountain.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/mountain_umd.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/palace1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/palace2.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/pillar_clip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/poe_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/silver_rupee.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/spr.binbin0 -> 2700 bytes
-rw-r--r--res/save_files/ad/spr1.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/spr_boost.binbin2700 -> 0 bytes
-rw-r--r--res/save_files/ad/stallord.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/tot.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/ad/zant.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any.binbin4000 -> 3920 bytes
-rw-r--r--res/save_files/any/aeralfos_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/ag.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/argorok.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/beast_ganon.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/boss_bug.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/camp.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/cits_1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/cits_2.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/cits_early.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/darkhammer.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/darknut.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/death_sword_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/deku_toad.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/early_platform.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/eldin_twilight.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/ems.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/fan_tower.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/forest_bit.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/forest_escape.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/goats.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/gorge_void.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/hc.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/hc_tower.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/horseback_ganon.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/hugo.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/iza.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/karg.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/lakebed_1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/lakebed_bk_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/lanayru_gate_clip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/lanayru_twilight.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/mdh.bin (renamed from res/save_files/any/lakebed_2.bin)bin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/mdh_bridge.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/mdh_tower.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/norgor.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/onebomb.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/ordon_gate_clip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/palace_1.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/palace_2.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/pillar_clip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/poe_1_skip.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/purple_mist.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/rupee_roll.bin (renamed from res/save_files/ad/karg_flight.bin)bin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/spr.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/spr_warp.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/stallord.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/waterfall_sidehop.binbin2700 -> 2700 bytes
-rw-r--r--res/save_files/any/zant.binbin2700 -> 2700 bytes
-rw-r--r--res/tex/framePause.texbin0 -> 1040 bytes
-rw-r--r--res/tex/framePause_16.pngbin0 -> 196 bytes
-rw-r--r--res/tex/framePlay.texbin0 -> 1040 bytes
-rw-r--r--res/tex/playFrame_16.pngbin0 -> 239 bytes
-rw-r--r--src/actor.cpp33
-rw-r--r--src/bit.cpp18
-rw-r--r--src/commands.cpp199
-rw-r--r--src/controller.cpp162
-rw-r--r--src/corotdcheck.cpp89
-rw-r--r--src/fifo_queue.cpp8
-rw-r--r--src/font.cpp29
-rw-r--r--src/free_cam.cpp37
-rw-r--r--src/gorge.cpp29
-rw-r--r--src/gz_flags.cpp91
-rw-r--r--src/input_viewer.cpp284
-rw-r--r--src/lib.cpp151
-rw-r--r--src/menu.cpp50
-rw-r--r--src/menus/actor_list_menu.cpp102
-rw-r--r--src/menus/actor_spawner_menu.cpp274
-rw-r--r--src/menus/ad_saves_menu.cpp192
-rw-r--r--src/menus/amounts_menu.cpp185
-rw-r--r--src/menus/any_saves_menu.cpp263
-rw-r--r--src/menus/cheat_menu.cpp288
-rw-r--r--src/menus/dungeon_flags_menu.cpp186
-rw-r--r--src/menus/flag_log_menu.cpp39
-rw-r--r--src/menus/flag_records_menu.cpp200
-rw-r--r--src/menus/flags_menu.cpp67
-rw-r--r--src/menus/general_flags_menu.cpp141
-rw-r--r--src/menus/hundo_saves_menu.cpp405
-rw-r--r--src/menus/inventory_menu.cpp54
-rw-r--r--src/menus/item_wheel_menu.cpp255
-rw-r--r--src/menus/main_menu.cpp94
-rw-r--r--src/menus/memfiles_menu.cpp144
-rw-r--r--src/menus/memory_editor_menu.cpp368
-rw-r--r--src/menus/memory_menu.cpp53
-rw-r--r--src/menus/pause_menu.cpp510
-rw-r--r--src/menus/portal_flags_menu.cpp214
-rw-r--r--src/menus/position_settings_menu.cpp112
-rw-r--r--src/menus/practice_menu.cpp54
-rw-r--r--src/menus/scene_menu.cpp151
-rw-r--r--src/menus/settings_menu.cpp157
-rw-r--r--src/menus/tools_menu.cpp377
-rw-r--r--src/menus/warping_menu.cpp329
-rw-r--r--src/menus/watches_menu.cpp684
-rw-r--r--src/movelink.cpp303
-rw-r--r--src/rollcheck.cpp23
-rw-r--r--src/save_manager.cpp65
-rw-r--r--src/save_specials.cpp213
-rw-r--r--src/system.cpp32
-rw-r--r--src/time.cpp14
-rw-r--r--src/timer.cpp164
-rw-r--r--src/umd.cpp36
-rw-r--r--src/utils/audio.cpp57
-rw-r--r--src/utils/card.cpp200
-rw-r--r--src/utils/cursor.cpp81
-rw-r--r--src/utils/draw.cpp44
-rw-r--r--src/utils/hook.cpp30
-rw-r--r--src/utils/lines.cpp68
-rw-r--r--src/utils/link.cpp171
-rw-r--r--src/utils/loading.cpp34
-rw-r--r--src/utils/memory.cpp164
216 files changed, 4812 insertions, 5122 deletions
diff --git a/Makefile b/Makefile
index 17c152c..e164f82 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ EXTERNAL := external
DATA := data
INCLUDES := include external
MAKEFILES := $(shell find . -mindepth 2 -name Makefile)
-GZ_VERSION ?= 0.4
+GZ_VERSION ?= 0.5.0
ifdef PR_TEST
RUN_PR_TEST := -D PR_TEST=1
diff --git a/RomHack-template.toml b/RomHack-template.toml
index fbb4b02..9e45450 100644
--- a/RomHack-template.toml
+++ b/RomHack-template.toml
@@ -19,6 +19,7 @@ base = "@linkBase"
libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
[files]
+# textures
"tpgz/tex/file.tex" = "res/tex/file.tex"
"tpgz/tex/folder_empty.tex" = "res/tex/folder_empty.tex"
"tpgz/tex/folder_full.tex" = "res/tex/folder_full.tex"
@@ -26,6 +27,10 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/tex/tpgz.tex" = "res/tex/tpgz.tex"
"tpgz/tex/flagOn.tex" = "res/tex/flagOn.tex"
"tpgz/tex/flagOff.tex" = "res/tex/flagOff.tex"
+"tpgz/tex/framePlay.tex" = "res/tex/framePlay.tex"
+"tpgz/tex/framePause.tex" = "res/tex/framePause.tex"
+
+# fonts
"tpgz/fonts/consola.fnt" = "res/fonts/consola.fnt"
"tpgz/fonts/calamity-bold.fnt" = "res/fonts/calamity-bold.fnt"
"tpgz/fonts/lib-serif.fnt" = "res/fonts/lib-serif.fnt"
@@ -33,6 +38,8 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/fonts/lib-sans.fnt" = "res/fonts/lib-sans.fnt"
"tpgz/fonts/lib-sans-bold.fnt" = "res/fonts/lib-sans-bold.fnt"
"tpgz/fonts/press-start-2p.fnt" = "res/fonts/press-start-2p.fnt"
+
+# any% saves
"tpgz/save_files/any.bin" = "res/save_files/any.bin"
"tpgz/save_files/any/aeralfos_skip.bin" = "res/save_files/any/aeralfos_skip.bin"
"tpgz/save_files/any/boss_bug.bin" = "res/save_files/any/boss_bug.bin"
@@ -65,7 +72,6 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/save_files/any/spr.bin" = "res/save_files/any/spr.bin"
"tpgz/save_files/any/lakebed_1.bin" = "res/save_files/any/lakebed_1.bin"
"tpgz/save_files/any/waterfall_sidehop.bin" = "res/save_files/any/waterfall_sidehop.bin"
-"tpgz/save_files/any/lakebed_2.bin" = "res/save_files/any/lakebed_2.bin"
"tpgz/save_files/any/ag.bin" = "res/save_files/any/ag.bin"
"tpgz/save_files/any/cits_early.bin" = "res/save_files/any/cits_early.bin"
"tpgz/save_files/any/cits_1.bin" = "res/save_files/any/cits_1.bin"
@@ -81,6 +87,9 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/save_files/any/beast_ganon.bin" = "res/save_files/any/beast_ganon.bin"
"tpgz/save_files/any/horseback_ganon.bin" = "res/save_files/any/horseback_ganon.bin"
"tpgz/save_files/any/lanayru_twilight.bin" = "res/save_files/any/lanayru_twilight.bin"
+"tpgz/save_files/any/rupee_roll.bin" = "res/save_files/any/rupee_roll.bin"
+
+# 100% saves
"tpgz/save_files/hundo.bin" = "res/save_files/hundo.bin"
"tpgz/save_files/hundo/aeralfos_skip.bin" = "res/save_files/hundo/aeralfos_skip.bin"
"tpgz/save_files/hundo/boss_bug.bin" = "res/save_files/hundo/boss_bug.bin"
@@ -158,6 +167,8 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/save_files/hundo/coo_30.bin" = "res/save_files/hundo/coo_30.bin"
"tpgz/save_files/hundo/cats.bin" = "res/save_files/hundo/cats.bin"
"tpgz/save_files/hundo/hc_darknut.bin" = "res/save_files/hundo/hc_darknut.bin"
+
+# All Dungeons saves
"tpgz/save_files/ad.bin" = "res/save_files/ad.bin"
"tpgz/save_files/ad/ordon_gate_clip.bin" = "res/save_files/ad/ordon_gate_clip.bin"
"tpgz/save_files/ad/goats.bin" = "res/save_files/ad/goats.bin"
@@ -165,50 +176,44 @@ libs = ["tpgz.a", "external/libtp_c/libtp_c.a", "external/gcn_c/gcn_c.a"]
"tpgz/save_files/ad/faron_twilight.bin" = "res/save_files/ad/faron_twilight.bin"
"tpgz/save_files/ad/ems.bin" = "res/save_files/ad/ems.bin"
"tpgz/save_files/ad/purple_mist.bin" = "res/save_files/ad/purple_mist.bin"
-"tpgz/save_files/ad/forest_bit.bin" = "res/save_files/ad/forest_bit.bin"
-"tpgz/save_files/ad/forest_escape.bin" = "res/save_files/ad/forest_escape.bin"
+"tpgz/save_files/ad/kb1.bin" = "res/save_files/ad/kb1.bin"
+"tpgz/save_files/ad/eldin_twilight.bin" = "res/save_files/ad/eldin_twilight.bin"
+"tpgz/save_files/ad/forest.bin" = "res/save_files/ad/forest.bin"
+"tpgz/save_files/ad/diababa.bin" = "res/save_files/ad/diababa.bin"
"tpgz/save_files/ad/pillar_clip.bin" = "res/save_files/ad/pillar_clip.bin"
"tpgz/save_files/ad/lakebed1.bin" = "res/save_files/ad/lakebed1.bin"
"tpgz/save_files/ad/deku_toad.bin" = "res/save_files/ad/deku_toad.bin"
-"tpgz/save_files/ad/karg_flight.bin" = "res/save_files/ad/karg_flight.bin"
-"tpgz/save_files/ad/forest2.bin" = "res/save_files/ad/forest2.bin"
-"tpgz/save_files/ad/diababa.bin" = "res/save_files/ad/diababa.bin"
-"tpgz/save_files/ad/eldin_twilight.bin" = "res/save_files/ad/eldin_twilight.bin"
"tpgz/save_files/ad/lanayru_twilight.bin" = "res/save_files/ad/lanayru_twilight.bin"
-"tpgz/save_files/ad/post_lanayru.bin" = "res/save_files/ad/post_lanayru.bin"
+"tpgz/save_files/ad/mountain_umd.bin" = "res/save_files/ad/mountain_umd.bin"
+"tpgz/save_files/ad/spr.bin" = "res/save_files/ad/spr.bin"
+"tpgz/save_files/ad/ice_boost.bin" = "res/save_files/ad/ice_boost.bin"
+"tpgz/save_files/ad/blizzeta.bin" = "res/save_files/ad/blizzeta.bin"
+"tpgz/save_files/ad/gm.bin" = "res/save_files/ad/gm.bin"
+"tpgz/save_files/ad/dangoro.bin" = "res/save_files/ad/dangoro.bin"
"tpgz/save_files/ad/bk_skip.bin" = "res/save_files/ad/bk_skip.bin"
"tpgz/save_files/ad/morpheel.bin" = "res/save_files/ad/morpheel.bin"
"tpgz/save_files/ad/mdh.bin" = "res/save_files/ad/mdh.bin"
-"tpgz/save_files/ad/mountain.bin" = "res/save_files/ad/mountain.bin"
-"tpgz/save_files/ad/mountain_umd.bin" = "res/save_files/ad/mountain_umd.bin"
-"tpgz/save_files/ad/spr1.bin" = "res/save_files/ad/spr1.bin"
-"tpgz/save_files/ad/darkhammer.bin" = "res/save_files/ad/darkhammer.bin"
-"tpgz/save_files/ad/spr_boost.bin" = "res/save_files/ad/spr_boost.bin"
-"tpgz/save_files/ad/blizzeta.bin" = "res/save_files/ad/blizzeta.bin"
+"tpgz/save_files/ad/camp.bin" = "res/save_files/ad/camp.bin"
"tpgz/save_files/ad/ag.bin" = "res/save_files/ad/ag.bin"
"tpgz/save_files/ad/poe_skip.bin" = "res/save_files/ad/poe_skip.bin"
"tpgz/save_files/ad/deathsword.bin" = "res/save_files/ad/deathsword.bin"
"tpgz/save_files/ad/stallord.bin" = "res/save_files/ad/stallord.bin"
-"tpgz/save_files/ad/early_ele.bin" = "res/save_files/ad/early_ele.bin"
-"tpgz/save_files/ad/gm.bin" = "res/save_files/ad/gm.bin"
-"tpgz/save_files/ad/dangoro.bin" = "res/save_files/ad/dangoro.bin"
+"tpgz/save_files/ad/faron_boost.bin" = "res/save_files/ad/faron_boost.bin"
+"tpgz/save_files/ad/tot.bin" = "res/save_files/ad/tot.bin"
+"tpgz/save_files/ad/dot_skip.bin" = "res/save_files/ad/dot_skip.bin"
"tpgz/save_files/ad/silver_rupee.bin" = "res/save_files/ad/silver_rupee.bin"
"tpgz/save_files/ad/city1.bin" = "res/save_files/ad/city1.bin"
"tpgz/save_files/ad/aeralfos.bin" = "res/save_files/ad/aeralfos.bin"
"tpgz/save_files/ad/city2.bin" = "res/save_files/ad/city2.bin"
"tpgz/save_files/ad/argorok.bin" = "res/save_files/ad/argorok.bin"
-"tpgz/save_files/ad/faron_boost.bin" = "res/save_files/ad/faron_boost.bin"
-"tpgz/save_files/ad/grove2.bin" = "res/save_files/ad/grove2.bin"
-"tpgz/save_files/ad/tot.bin" = "res/save_files/ad/tot.bin"
-"tpgz/save_files/ad/darknut.bin" = "res/save_files/ad/darknut.bin"
-"tpgz/save_files/ad/dot_skip.bin" = "res/save_files/ad/dot_skip.bin"
"tpgz/save_files/ad/palace1.bin" = "res/save_files/ad/palace1.bin"
"tpgz/save_files/ad/palace2.bin" = "res/save_files/ad/palace2.bin"
-"tpgz/save_files/ad/early_platform.bin" = "res/save_files/ad/early_platform.bin"
"tpgz/save_files/ad/zant.bin" = "res/save_files/ad/zant.bin"
"tpgz/save_files/ad/hc.bin" = "res/save_files/ad/hc.bin"
"tpgz/save_files/ad/beast_ganon.bin" = "res/save_files/ad/beast_ganon.bin"
"tpgz/save_files/ad/horseback.bin" = "res/save_files/ad/horseback.bin"
+
+# warp info
"tpgz/stage_info/cave.bin" = "res/stage_info/cave.bin"
"tpgz/stage_info/dungeon.bin" = "res/stage_info/dungeon.bin"
"tpgz/stage_info/interior.bin" = "res/stage_info/interior.bin"
diff --git a/any.bin b/any.bin
new file mode 100644
index 0000000..4b28412
--- /dev/null
+++ b/any.bin
Binary files differ
diff --git a/external/libtp_c b/external/libtp_c
-Subproject c917558581939a7e6d150eaa22ffb712dc21d4f
+Subproject 43aa2555100a19ad8c8b3bd3bbef7c72e70d2d4
diff --git a/external/misc/ad.py b/external/misc/ad.py
index 8dfb36e..294fcb6 100644
--- a/external/misc/ad.py
+++ b/external/misc/ad.py
@@ -12,9 +12,53 @@ default_entry = {
}
# order matters
-file_names = ["ordon_gate_clip", "ordon_gate_clip", "goats", "hugo", "faron_twilight", "ems", "purple_mist", "forest_bit", "forest_escape", "pillar_clip", "lakebed1", "deku_toad", "karg_flight", "forest2", "diababa", "eldin_twilight", "lanayru_twilight", "post_lanayru", "bk_skip", "morpheel", "mdh", "mountain", "mountain_umd", "spr1", "darkhammer", "spr_boost", "blizzeta", "ag", "poe_skip", "deathsword", "stallord", "early_ele", "gm", "dangoro", "silver_rupee", "city1", "aeralfos", "city2", "argorok", "faron_boost", "grove2", "tot", "darknut", "dot_skip", "palace1", "palace2", "early_platform", "zant", "hc", "beast_ganon", "horseback_ganon", ]
-
-ad_p = [{**default_entry, "id": i, "filename": file_names[i]} for i in range(51)]
+file_names = [
+ "ordon_gate_clip",
+ "ordon_gate_clip",
+ "goats",
+ "hugo",
+ "faron_twilight",
+ "ems",
+ "purple_mist",
+ "kb1",
+ "eldin_twilight",
+ "forest",
+ "diababa",
+ "pillar_clip",
+ "lakebed1",
+ "deku_toad",
+ "lanayru_twilight",
+ "mountain_umd",
+ "spr",
+ "ice_boost",
+ "blizzeta",
+ "gm",
+ "dangoro",
+ "bk_skip",
+ "morpheel",
+ "mdh",
+ "camp",
+ "ag",
+ "poe_skip",
+ "deathsword",
+ "stallord",
+ "faron_boost",
+ "tot",
+ "dot_skip",
+ "silver_rupee",
+ "city1",
+ "aeralfos",
+ "city2",
+ "argorok",
+ "palace1",
+ "palace2",
+ "zant",
+ "hc",
+ "beast_ganon",
+ "horseback_ganon",
+]
+
+ad_p = [{**default_entry, "id": i, "filename": file_names[i]} for i in range(42)]
ad_p[0]["requirements"] = REQ_POS | REQ_CAM
ad_p[0]["pos"] = (827.450012, 216.490097, -4533.90625)
@@ -42,73 +86,66 @@ ad_p[6]["pos"] = (-23524.6152, 250.0, -16220.166)
ad_p[6]["angle"] = 40758
ad_p[6]["counter"] = 30
-# forest escape
-ad_p[8]["requirements"] = REQ_POS | REQ_CAM
-ad_p[8]["pos"] = (-12433.6016, -235.969193, -17103.998)
-ad_p[8]["angle"] = 29553
-ad_p[8]["cam"]["pos"] = (-12552.8252, -53.5801048, -16729.5313)
-ad_p[8]["cam"]["target"] = (-12433.2979, -106.667023, -17104.9512)
-ad_p[8]["counter"] = 30
-
# eldin twilight
-ad_p[15]["requirements"] = REQ_POS | REQ_CAM
-ad_p[15]["pos"] = (455.088379, -150.0, 11516.7227)
-ad_p[15]["angle"] = 6058
-ad_p[15]["cam"]["pos"] = (219.367218, -20.1253014, 11157.582)
-ad_p[15]["cam"]["target"] = (482.515137, -39.9999771, 11558.5283)
-ad_p[15]["counter"] = 10
+ad_p[8]["requirements"] = REQ_POS | REQ_CAM
+ad_p[8]["pos"] = (455.088379, -150.0, 11516.7227)
+ad_p[8]["angle"] = 6058
+ad_p[8]["cam"]["pos"] = (219.367218, -20.1253014, 11157.582)
+ad_p[8]["cam"]["target"] = (482.515137, -39.9999771, 11558.5283)
+ad_p[8]["counter"] = 10
# bk skip
-ad_p[18]["requirements"] = REQ_POS | REQ_CAM
-ad_p[18]["pos"] = (71.9835968, 1500.00, 2839.01587)
-ad_p[18]["angle"] = 32767
-ad_p[18]["cam"]["pos"] = (71.9835968, 1719.93542, 2969.04565)
-ad_p[18]["cam"]["target"] = (71.9835968, 1660.0, 2839.01587)
-ad_p[18]["counter"] = 30
+ad_p[21]["requirements"] = REQ_POS | REQ_CAM
+ad_p[21]["pos"] = (71.9835968, 1500.00, 2839.01587)
+ad_p[21]["angle"] = 32767
+ad_p[21]["cam"]["pos"] = (71.9835968, 1719.93542, 2969.04565)
+ad_p[21]["cam"]["target"] = (71.9835968, 1660.0, 2839.01587)
+ad_p[21]["counter"] = 30
# morpheel
-ad_p[19]["requirements"] = REQ_POS | REQ_CAM
-ad_p[19]["pos"] = (-1193.0, -23999.00, -770.0)
-ad_p[19]["angle"] = 10754
-ad_p[19]["counter"] = 20
+ad_p[22]["requirements"] = REQ_POS | REQ_CAM
+ad_p[22]["pos"] = (-1193.0, -23999.00, -770.0)
+ad_p[22]["angle"] = 10754
+ad_p[22]["counter"] = 20
# spr boost
-ad_p[25]["requirements"] = REQ_POS | REQ_CAM
-ad_p[25]["pos"] = (2019.5192, 200.00, -2865.9890)
-ad_p[25]["angle"] = 16384
-ad_p[25]["counter"] = 30
+ad_p[17]["requirements"] = REQ_POS | REQ_CAM
+ad_p[17]["pos"] = (2019.5192, 200.00, -2865.9890)
+ad_p[17]["angle"] = 16384
+ad_p[17]["counter"] = 30
# poe 1 skip
-ad_p[28]["requirements"] = REQ_POS | REQ_CAM
-ad_p[28]["pos"] = (-2046.97168, 0.0, -587.304871)
-ad_p[28]["angle"] = 49030
-ad_p[28]["cam"]["pos"] = (-1779.00293, 213.707397, -584.686768)
-ad_p[28]["cam"]["target"] = (-2047.97168, 130.16568, -587.317139)
-ad_p[28]["counter"] = 10
-
-# early ele
-ad_p[31]["requirements"] = REQ_POS | REQ_CAM
-ad_p[31]["pos"] = (1304.8733, -355.5959, -5385.2314)
-ad_p[31]["angle"] = 45225
-ad_p[31]["counter"] = 30
+ad_p[26]["requirements"] = REQ_POS | REQ_CAM
+ad_p[26]["pos"] = (-2046.97168, 0.0, -587.304871)
+ad_p[26]["angle"] = 49030
+ad_p[26]["cam"]["pos"] = (-1779.00293, 213.707397, -584.686768)
+ad_p[26]["cam"]["target"] = (-2047.97168, 130.16568, -587.317139)
+ad_p[26]["counter"] = 10
# dot skip
-ad_p[43]["requirements"] = REQ_POS | REQ_CAM
-ad_p[43]["cam"]["target"] = 1361.59766, -33.1954155, -1090.47632
-ad_p[43]["cam"]["pos"] = 1396.36316, 9.51973343, -719.644531
-ad_p[43]["angle"] = 33673
-ad_p[43]["pos"] = 1361.68408, -143.56076, -1089.4801
+ad_p[31]["requirements"] = REQ_POS | REQ_CAM
+ad_p[31]["cam"]["target"] = 1361.59766, -33.1954155, -1090.47632
+ad_p[31]["cam"]["pos"] = 1396.36316, 9.51973343, -719.644531
+ad_p[31]["angle"] = 33673
+ad_p[31]["pos"] = 1361.68408, -143.56076, -1089.4801
-file = open("ad.bin", "wb")
+file = open("ad.bin",
+"wb")
for entry in ad_p:
print(entry)
- file.write(entry["requirements"].to_bytes(1, "big", signed=False))
- file.write(int(0).to_bytes(1, "big", signed=False)) # padding
- file.write(entry["angle"].to_bytes(2, "big", signed=False))
+ file.write(entry["requirements"].to_bytes(1, "big",
+signed=False))
+ file.write(int(0).to_bytes(1, "big",
+signed=False)) # padding
+ file.write(entry["angle"].to_bytes(2, "big",
+signed=False))
file.write(struct.pack('>fff', *entry["pos"]))
file.write(struct.pack('>fff', *entry["cam"]["pos"]))
file.write(struct.pack('>fff', *entry["cam"]["target"]))
- file.write(entry["counter"].to_bytes(4, "big", signed=False))
- file.write(struct.pack(">32s", entry["filename"].encode("ascii")))
- file.write(int(0).to_bytes(4, "big", signed=False)) # padding
+ file.write(entry["counter"].to_bytes(4, "big",
+signed=False))
+ file.write(struct.pack(">32s",
+entry["filename"].encode("ascii")))
+ file.write(int(0).to_bytes(4, "big",
+signed=False)) # padding
diff --git a/external/misc/any.py b/external/misc/any.py
index 0320cd1..19bc24b 100644
--- a/external/misc/any.py
+++ b/external/misc/any.py
@@ -12,10 +12,61 @@ default_entry = {
}
# order matters
-file_names = ["ordon_gate_clip", "ordon_gate_clip", "goats", "hugo", "ems", "purple_mist", "forest_bit", "forest_escape", "gorge_void", "gorge_void", "lanayru_gate_clip", "pillar_clip", "lakebed_1", "deku_toad", "karg", "eldin_twilight", "lanayru_twilight", "waterfall_sidehop", "boss_bug", "iza", "norgor", "spr_warp", "spr", "darkhammer", "lakebed_2", "lakebed_bk_skip", "onebomb", "mdh_tower", "mdh_bridge", "camp", "ag", "poe_1_skip", "death_sword_skip", "stallord", "stallord", "cits_early", "cits_1", "aeralfos_skip", "cits_2", "fan_tower", "argorok", "palace_1", "palace_2", "early_platform", "zant", "hc", "darknut", "hc_tower", "beast_ganon", "horseback_ganon", ]
-
-any_p = [{**default_entry, "id": i, "filename": file_names[i]} for i in range(50)]
-
+file_names = [
+ "ordon_gate_clip",
+ "ordon_gate_clip",
+ "goats",
+ "hugo",
+ "ems",
+ "purple_mist",
+ "forest_bit",
+ "forest_escape",
+ "gorge_void",
+ "rupee_roll",
+ "lanayru_gate_clip",
+ "pillar_clip",
+ "lakebed_1",
+ "deku_toad",
+ "karg",
+ "eldin_twilight",
+ "lanayru_twilight",
+ "waterfall_sidehop",
+ "boss_bug",
+ "iza",
+ "norgor",
+ "spr_warp",
+ "spr",
+ "darkhammer",
+ "lakebed_bk_skip",
+ "onebomb",
+ "mdh_tower",
+ "mdh_bridge",
+ "camp",
+ "ag",
+ "poe_1_skip",
+ "death_sword_skip",
+ "stallord",
+ "stallord",
+ "cits_early",
+ "cits_1",
+ "aeralfos_skip",
+ "cits_2",
+ "fan_tower",
+ "argorok",
+ "palace_1",
+ "palace_2",
+ "early_platform",
+ "zant",
+ "hc",
+ "darknut",
+ "hc_tower",
+ "beast_ganon",
+ "horseback_ganon",
+]
+
+any_p = [{**default_entry, "id": i, "filename": file_names[i]} for i in range(49)]
+
+# ordon gate clip
any_p[0]["requirements"] = REQ_POS | REQ_CAM
any_p[0]["pos"] = (827.450012, 216.490097, -4533.90625)
any_p[0]["angle"] = 498
@@ -23,6 +74,7 @@ any_p[0]["cam"]["pos"] = (833.467468, 477.604675, -4241.97266)
any_p[0]["cam"]["target"] = (827.497559, 329.622986, -4532.90723)
any_p[0]["counter"] = 10
+# back in time
any_p[1]["requirements"] = REQ_POS | REQ_CAM
any_p[1]["pos"] = (466.622467, 319.770752, -11651.3867)
any_p[1]["angle"] = 52540
@@ -30,17 +82,20 @@ any_p[1]["cam"]["pos"] = (735.525391, 524.418701, -11576.4746)
any_p[1]["cam"]["target"] = (465.674622, 421.052704, -11651.0684)
any_p[1]["counter"] = 10
+# hugo
any_p[3]["requirements"] = REQ_POS | REQ_CAM
any_p[3]["pos"] = (701.797302, 85.5212784, -5299.6123)
any_p[3]["angle"] = 63622
any_p[3]["cam"]["pos"] = (735.525391, 524.418701, -11576.4746)
any_p[3]["cam"]["target"] = (465.674622, 421.052704, -11651.0684)
+# purple mist
any_p[5]["requirements"] = REQ_POS
any_p[5]["pos"] = (-23524.6152, 250.0, -16220.166)
any_p[5]["angle"] = 40758
any_p[5]["counter"] = 30
+# forest escape
any_p[7]["requirements"] = REQ_POS | REQ_CAM
any_p[7]["pos"] = (-12433.6016, -235.969193, -17103.998)
any_p[7]["angle"] = 29553
@@ -48,10 +103,12 @@ any_p[7]["cam"]["pos"] = (-12552.8252, -53.5801048, -16729.5313)
any_p[7]["cam"]["target"] = (-12433.2979, -106.667023, -17104.9512)
any_p[7]["counter"] = 30
+# gorge void
any_p[8]["requirements"] = REQ_POS
any_p[8]["pos"] = (-9704.47266, -7200.0, 58475.5195)
any_p[8]["angle"] = 54288
+# rupee roll
any_p[9]["requirements"] = REQ_POS | REQ_CAM
any_p[9]["pos"] = (-11130.208, -5700.0, 56423.1953)
any_p[9]["angle"] = 31571
@@ -59,6 +116,7 @@ any_p[9]["cam"]["pos"] = (-11178.1504, -5506.71338, 56843.1797)
any_p[9]["cam"]["target"] = (-11124.4697, -5589.99902, 56373.5195)
any_p[9]["counter"] = 15
+# lanayru gate clip
any_p[10]["requirements"] = REQ_POS | REQ_CAM
any_p[10]["pos"] = (-63026.2852, -9065.92578, 71680.3438)
any_p[10]["angle"] = 44248
@@ -66,6 +124,7 @@ any_p[10]["cam"]["pos"] = (-62655.8125, -8900.91309, 71903.6328)
any_p[10]["cam"]["target"] = (-63064.2148, -8969.97656, 71661.0781)
any_p[10]["counter"] = 15
+# eldin twilight
any_p[15]["requirements"] = REQ_POS | REQ_CAM
any_p[15]["pos"] = (455.088379, -150.0, 11516.7227)
any_p[15]["angle"] = 6058
@@ -73,14 +132,17 @@ any_p[15]["cam"]["pos"] = (219.367218, -20.1253014, 11157.582)
any_p[15]["cam"]["target"] = (482.515137, -39.9999771, 11558.5283)
any_p[15]["counter"] = 10
+# boss bug
any_p[18]["requirements"] = REQ_POS
any_p[18]["pos"] = (-89100.00, -18811.2363, 39410.00)
any_p[18]["angle"] = 21504
+# iza
any_p[19]["requirements"] = REQ_POS
any_p[19]["pos"] = (5979.97217, 150.0, -2748.34155)
any_p[19]["angle"] = 10114
+# norgor
any_p[20]["requirements"] = REQ_POS | REQ_CAM
any_p[20]["pos"] = (173.71, -186.52, -3633.71)
any_p[20]["angle"] = 46568
@@ -88,6 +150,7 @@ any_p[20]["cam"]["pos"] = (501.768982, -5.045784, -3586.1145)
any_p[20]["cam"]["target"] = (174.411758, -70.5306549, -3668.91406)
any_p[20]["counter"] = 15
+# snowpeak messenger skip
any_p[21]["requirements"] = REQ_POS | REQ_CAM
any_p[21]["pos"] = (-9294.87988, 980.0, -11712.3838)
any_p[21]["angle"] = 346
@@ -95,42 +158,40 @@ any_p[21]["cam"]["pos"] = (-9309.65137, 1280.4469, -12130.7695)
any_p[21]["cam"]["target"] = (-9294.2207, 1180.0, -11692.3945)
any_p[21]["counter"] = 10
+# spr
any_p[22]["requirements"] = REQ_POS
any_p[22]["pos"] = (0.0, -150.0, 6000.0)
any_p[22]["angle"] = 33768
+# bk skip
any_p[24]["requirements"] = REQ_POS | REQ_CAM
-any_p[24]["pos"] = (0.0, 1240.29333, 14500.0)
-any_p[24]["angle"] = 32768
-any_p[24]["cam"]["pos"] = (-87.9447556, 1414.24292, 14741.0518)
-any_p[24]["cam"]["target"] = (-8.74227766, 1337.22534, 14499.0)
-any_p[24]["counter"] = 15
+any_p[24]["pos"] = (71.9835968, 1500.00, 2839.01587)
+any_p[24]["angle"] = 32767
+any_p[24]["cam"]["pos"] = (71.9835968, 1719.93542, 2969.04565)
+any_p[24]["cam"]["target"] = (71.9835968, 1660.0, 2839.01587)
+any_p[24]["counter"] = 30
+# morpheel
any_p[25]["requirements"] = REQ_POS | REQ_CAM
-any_p[25]["pos"] = (71.9835968, 1500.00, 2839.01587)
-any_p[25]["angle"] = 32767
-any_p[25]["cam"]["pos"] = (71.9835968, 1719.93542, 2969.04565)
-any_p[25]["cam"]["target"] = (71.9835968, 1660.0, 2839.01587)
-any_p[25]["counter"] = 30
-
-any_p[26]["requirements"] = REQ_POS | REQ_CAM
-any_p[26]["pos"] = (-1193.0, -23999.00, -770.0)
-any_p[26]["angle"] = 10754
-any_p[26]["counter"] = 20
-
-any_p[31]["requirements"] = REQ_POS | REQ_CAM
-any_p[31]["pos"] = (-2046.97168, 0.0, -587.304871)
-any_p[31]["angle"] = 49030
-any_p[31]["cam"]["pos"] = (-1779.00293, 213.707397, -584.686768)
-any_p[31]["cam"]["target"] = (-2047.97168, 130.16568, -587.317139)
-any_p[31]["counter"] = 10
-
-any_p[36]["requirements"] = REQ_POS | REQ_CAM
-any_p[36]["pos"] = (1309.60645, -240.0, 5533.43848)
-any_p[36]["angle"] = 16384
-any_p[36]["cam"]["pos"] = (1027.53259, -108.096123, 5605.23047)
-any_p[36]["cam"]["target"] = (1313.54285, -234.203003, 5545.16846)
-any_p[36]["counter"] = 10
+any_p[25]["pos"] = (-1193.0, -23999.00, -770.0)
+any_p[25]["angle"] = 10754
+any_p[25]["counter"] = 20
+
+# poe 1 skip
+any_p[30]["requirements"] = REQ_POS | REQ_CAM
+any_p[30]["pos"] = (-2046.97168, 0.0, -587.304871)
+any_p[30]["angle"] = 49030
+any_p[30]["cam"]["pos"] = (-1779.00293, 213.707397, -584.686768)
+any_p[30]["cam"]["target"] = (-2047.97168, 130.16568, -587.317139)
+any_p[30]["counter"] = 10
+
+# city 1
+any_p[35]["requirements"] = REQ_POS | REQ_CAM
+any_p[35]["pos"] = (1309.60645, -240.0, 5533.43848)
+any_p[35]["angle"] = 16384
+any_p[35]["cam"]["pos"] = (1027.53259, -108.096123, 5605.23047)
+any_p[35]["cam"]["target"] = (1313.54285, -234.203003, 5545.16846)
+any_p[35]["counter"] = 10
file = open("any.bin", "wb")
diff --git a/include/actor.h b/include/actor.h
deleted file mode 100644
index 99772bd..0000000
--- a/include/actor.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-namespace Actor {
-void freeze_actors();
-void unfreeze_actors();
-void hide_actors();
-void show_actors();
-} // namespace Actor \ No newline at end of file
diff --git a/include/bit.h b/include/bit.h
index 5af9978..9c161c5 100644
--- a/include/bit.h
+++ b/include/bit.h
@@ -1,12 +1,8 @@
#pragma once
#ifdef WII_PLATFORM
-extern bool g_bit_active;
-extern bool inject_bit_flag;
-
namespace BiTIndicator {
-void render();
-void run();
-void set_camera_angle_position();
+void execute();
+void setPosition();
} // namespace BiTIndicator
#endif \ No newline at end of file
diff --git a/include/cheats.h b/include/cheats.h
index 3553c0b..bd1a5a0 100644
--- a/include/cheats.h
+++ b/include/cheats.h
@@ -7,7 +7,6 @@
#define CHEAT_AMNT 14
#endif
-namespace Cheats {
enum CheatId {
InfiniteAir,
InfiniteArrows,
@@ -34,11 +33,8 @@ struct Cheat {
bool active;
};
-void apply_cheats();
-}; // namespace Cheats
+void GZ_applyCheats();
-extern Cheats::Cheat CheatItems[CHEAT_AMNT];
-
-// static Cheats::Cheat CheatItems[CHEAT_AMNT];
+extern Cheat g_cheats[CHEAT_AMNT];
#endif \ No newline at end of file
diff --git a/include/commands.h b/include/commands.h
index 0cf65fb..a3ec866 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -2,17 +2,19 @@
#include <stdint.h>
#ifdef GCN_PLATFORM
-#define COMMANDS_AMNT 9
-#define GORGE_VOID_BUTTONS (Pad::L | Pad::Z)
-#define STORE_POSITION_BUTTONS (Pad::DPAD_UP | Pad::R)
-#define LOAD_POSITION_BUTTONS (Pad::DPAD_DOWN | Pad::R)
-#define MOON_JUMP_BUTTONS (Pad::R | Pad::A)
-#define RELOAD_AREA_BUTTONS (Pad::L | Pad::R | Pad::A | Pad::START)
-#define TIMER_TOGGLE_BUTTONS (Pad::Z | Pad::A)
-#define TIMER_RESET_BUTTONS (Pad::Z | Pad::B)
-#define FREE_CAM_BUTTONS (Pad::Z | Pad::B | Pad::A)
-#define MOVE_LINK_BUTTONS (Pad::L | Pad::R | Pad::Y)
-#define FRAME_ADVANCE_BUTTONS (Pad::L | Pad::R | Pad::X)
+#define COMMANDS_AMNT 10
+#define GORGE_VOID_BUTTONS (CButton::L | CButton::Z)
+#define STORE_POSITION_BUTTONS (CButton::DPAD_UP | CButton::R)
+#define LOAD_POSITION_BUTTONS (CButton::DPAD_DOWN | CButton::R)
+#define MOON_JUMP_BUTTONS (CButton::R | CButton::A)
+#define RELOAD_AREA_BUTTONS (CButton::L | CButton::R | CButton::A | CButton::START)
+#define TIMER_TOGGLE_BUTTONS (CButton::Z | CButton::A)
+#define TIMER_RESET_BUTTONS (CButton::Z | CButton::B)
+#define FREE_CAM_BUTTONS (CButton::Z | CButton::B | CButton::A)
+#define MOVE_LINK_BUTTONS (CButton::L | CButton::R | CButton::Y)
+#define FRAME_PAUSE_BUTTONS (CButton::R | CButton::DPAD_UP)
+#define FRAME_ADVANCE_BUTTONS (CButton::R | CButton::DPAD_RIGHT)
+#define FRAME_ADVANCE_TEXT "R + D-Pad Up"
#define GORGE_VOID_TEXT "L+Z"
#define STORE_POSITION_TEXT "D-PAD up + R"
#define LOAD_POSITION_TEXT "D-PAD down + R"
@@ -22,21 +24,22 @@
#define TIMER_RESET_TEXT "Z+B"
#define FREE_CAM_TEXT "Z+B+A"
#define MOVE_LINK_TEXT "L+R+Y"
-#define FRAME_ADVANCE_TEXT "L+R+X"
#endif
+
#ifdef WII_PLATFORM
-#define COMMANDS_AMNT 10
-#define GORGE_VOID_BUTTONS (Mote::Z | Mote::C | Mote::A | Mote::ONE)
-#define BACK_IN_TIME_BUTTONS (Mote::Z | Mote::C | Mote::A | Mote::TWO)
-#define STORE_POSITION_BUTTONS (Mote::Z | Mote::C | Mote::ONE)
-#define LOAD_POSITION_BUTTONS (Mote::Z | Mote::C | Mote::TWO)
-#define MOON_JUMP_BUTTONS (Mote::Z | Mote::C | Mote::A)
-#define RELOAD_AREA_BUTTONS (Mote::Z | Mote::C | Mote::B | Mote::TWO)
-#define TIMER_TOGGLE_BUTTONS (Mote::Z | Mote::C | Mote::A | Mote::B)
-#define TIMER_RESET_BUTTONS (Mote::Z | Mote::C | Mote::B | Mote::ONE)
-#define FREE_CAM_BUTTONS (Mote::Z | Mote::C | Mote::B | Mote::MINUS)
-#define MOVE_LINK_BUTTONS (Mote::Z | Mote::C | Mote::B | Mote::PLUS)
-#define FRAME_ADVANCE_BUTTONS (Mote::Z | Mote::C | Mote::B | Mote::DPAD_RIGHT)
+#define COMMANDS_AMNT 11
+#define GORGE_VOID_BUTTONS (GZPad::Z | GZPad::C | GZPad::A | GZPad::ONE)
+#define BACK_IN_TIME_BUTTONS (GZPad::Z | GZPad::C | GZPad::A | GZPad::TWO)
+#define STORE_POSITION_BUTTONS (GZPad::Z | GZPad::C | GZPad::ONE)
+#define LOAD_POSITION_BUTTONS (GZPad::Z | GZPad::C | GZPad::TWO)
+#define MOON_JUMP_BUTTONS (GZPad::Z | GZPad::C | GZPad::A)
+#define RELOAD_AREA_BUTTONS (GZPad::Z | GZPad::C | GZPad::B | GZPad::TWO)
+#define TIMER_TOGGLE_BUTTONS (GZPad::Z | GZPad::C | GZPad::A | GZPad::B)
+#define TIMER_RESET_BUTTONS (GZPad::Z | GZPad::C | GZPad::B | GZPad::ONE)
+#define FREE_CAM_BUTTONS (GZPad::Z | GZPad::C | GZPad::B | GZPad::MINUS)
+#define MOVE_LINK_BUTTONS (GZPad::Z | GZPad::C | GZPad::B | GZPad::PLUS)
+#define FRAME_PAUSE_BUTTONS (GZPad::Z | GZPad::DPAD_UP)
+#define FRAME_ADVANCE_BUTTONS (GZPad::Z | GZPad::C | GZPad::B | GZPad::DPAD_RIGHT)
#define GORGE_VOID_TEXT "Z+C+A+1"
#define BACK_IN_TIME_TEXT "Z+C+A+2"
#define STORE_POSITION_TEXT "Z+C+1"
@@ -52,9 +55,8 @@
extern bool reload_area_flag;
-extern bool commands_states[COMMANDS_AMNT];
+extern bool g_commandStates[COMMANDS_AMNT];
-namespace Commands {
enum Commands {
CMD_STORE_POSITION,
CMD_LOAD_POSITION,
@@ -68,11 +70,17 @@ enum Commands {
#endif
CMD_FREE_CAM,
CMD_MOVE_LINK,
- CMD_FRAME_ADVANCE
+ CMD_FRAME_PAUSE,
+};
+
+struct Command {
+ bool& active;
+ uint16_t buttons;
+ void (*command)();
};
-void process_inputs();
-void enable_command(int idx);
-void disable_command(int idx);
-void reload_area();
-} // namespace Commands \ No newline at end of file
+void GZCmd_processInputs();
+void GZCmd_enable(int idx);
+void GZCmd_disable(int idx);
+void GZCmd_reloadArea();
+void GZCmd_advanceFrame(); \ No newline at end of file
diff --git a/include/controller.h b/include/controller.h
index fdc5314..0f2a68f 100644
--- a/include/controller.h
+++ b/include/controller.h
@@ -1,13 +1,11 @@
#pragma once
#include <stdint.h>
+#include "libtp_c/include/controller.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-extern bool a_held;
-extern uint16_t current_input;
-
-namespace Controller {
-enum Button {
#ifdef GCN_PLATFORM
+enum GZPad {
DPAD_LEFT = 0,
DPAD_RIGHT = 1,
DPAD_DOWN = 2,
@@ -20,8 +18,11 @@ enum Button {
X = 9,
Y = 10,
START = 11,
+};
#endif
+
#ifdef WII_PLATFORM
+enum GZPad {
DPAD_LEFT = 0,
DPAD_RIGHT = 1,
DPAD_DOWN = 2,
@@ -35,12 +36,13 @@ enum Button {
Z = 10,
C = 11,
HOME = 12,
-#endif
};
-bool button_is_pressed(int idx);
-bool button_is_pressed(int idx, uint16_t repeat_time);
-bool button_is_down(int idx);
-bool button_is_held(int idx, int phase = 0);
-uint16_t get_current_inputs();
-void read_controller();
-} // namespace Controller \ No newline at end of file
+#endif
+
+bool GZ_getButtonRepeat(int idx);
+bool GZ_getButtonRepeat(int idx, uint16_t repeat_time);
+bool GZ_getButtonPressed(int idx);
+bool GZ_getButtonHold(int idx, int phase = 0);
+uint16_t GZ_getButtonStatus();
+void GZ_readController();
+bool GZ_getButtonTrig(int idx);
diff --git a/include/corotdcheck.h b/include/corotdcheck.h
index a57124f..b60049d 100644
--- a/include/corotdcheck.h
+++ b/include/corotdcheck.h
@@ -1,5 +1,5 @@
#pragma once
namespace CoroTDChecker {
-void run();
+void execute();
} // namespace CoroTDChecker \ No newline at end of file
diff --git a/include/fifo_queue.h b/include/fifo_queue.h
index 3f06ccd..1892142 100644
--- a/include/fifo_queue.h
+++ b/include/fifo_queue.h
@@ -15,7 +15,7 @@ public:
};
extern _FIFOQueue Queue;
-extern bool fifo_visible;
+extern bool g_fifoVisible;
class FIFOQueue {
private:
diff --git a/include/flaglog.h b/include/flaglog.h
index dd25f53..01ff57a 100644
--- a/include/flaglog.h
+++ b/include/flaglog.h
@@ -1,3 +1,3 @@
#pragma once
-extern bool g_flag_log_active;
+extern bool g_flagLogEnabled;
diff --git a/include/font.h b/include/font.h
index 14c3b52..8771528 100644
--- a/include/font.h
+++ b/include/font.h
@@ -2,8 +2,10 @@
#include "libtp_c/include/dolphin/mtx/vec.h"
#include "libtp_c/include/addrs.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/texture.h"
#include "gcn_c/include/gfx.h"
+#include <cstdarg>
#define MAX_GLYPHS 94
#define DROP_SHADOWS_RGBA 0x000000FF
@@ -63,17 +65,28 @@ private:
static _Font font;
public:
- static FontCode load_font(const char* path);
+ static FontCode loadFont(const char* path);
static void free_font();
static bool lookupGlyph(char c, DecodedGlyph& glyph);
static float renderChar(char c, float x, float y, uint32_t color,
float size = FONT_DEFAULT_SIZE);
static void renderChars(const char* str, float x, float y, uint32_t color,
float size = FONT_DEFAULT_SIZE);
- static void gz_renderChar(char c, float x, float y, uint32_t color, bool drop_shawdows,
- float size = FONT_DEFAULT_SIZE);
- static void gz_renderChars(const char* str, float x, float y, uint32_t color, bool drop_shadows,
- float size = FONT_DEFAULT_SIZE);
- static float get_char_width(char c, float size = FONT_DEFAULT_SIZE);
- static float get_chars_width(const char* str, float size = FONT_DEFAULT_SIZE);
-}; \ No newline at end of file
+ static void GZ_drawChar(char c, float x, float y, uint32_t color, bool drop_shawdows,
+ float size = FONT_DEFAULT_SIZE);
+ static void GZ_drawStr(const char* str, float x, float y, uint32_t color, bool drop_shadows,
+ float size = FONT_DEFAULT_SIZE);
+ static float getCharWidth(char c, float size = FONT_DEFAULT_SIZE);
+ static float getStrWidth(const char* str, float size = FONT_DEFAULT_SIZE);
+};
+
+float GZ_drawSelectChar(const char* str, float x, float y, size_t char_idx, size_t max_char,
+ uint32_t color);
+
+inline void GZ_drawText(const char* str, float x, float y, uint32_t color, bool shadows) {
+ Font::GZ_drawStr(str, x, y, color, shadows);
+}
+
+inline float GZ_getTextWidth(const char* str, float size = FONT_DEFAULT_SIZE) {
+ return Font::getStrWidth(str, size);
+} \ No newline at end of file
diff --git a/include/free_cam.h b/include/free_cam.h
index 6ca68b1..8262dc1 100644
--- a/include/free_cam.h
+++ b/include/free_cam.h
@@ -1,6 +1,6 @@
#pragma once
-extern bool free_cam_active;
+extern bool g_freeCamEnabled;
#ifdef GCN_PLATFORM
#define FREE_CAM_MOVEMENT_TEXT "Stick/L/R"
@@ -12,5 +12,5 @@ extern bool free_cam_active;
#endif
namespace FreeCam {
-void handle_free_cam();
+void execute();
} // namespace FreeCam
diff --git a/include/gorge.h b/include/gorge.h
index dc26737..57558c8 100644
--- a/include/gorge.h
+++ b/include/gorge.h
@@ -1,11 +1,7 @@
#pragma once
-extern bool g_gorge_active;
-extern bool inject_gorge_flag;
-
namespace GorgeVoidIndicator {
-void render();
-void run();
-void prep_rupee_roll();
-void warp_to_gorge();
+void execute();
+void initState();
+void warpToPosition();
} // namespace GorgeVoidIndicator \ No newline at end of file
diff --git a/include/gz_flags.h b/include/gz_flags.h
index 7e6755c..8559962 100644
--- a/include/gz_flags.h
+++ b/include/gz_flags.h
@@ -1,21 +1,88 @@
#pragma once
+
#include "font.h"
+#include "cheats.h"
+#include "save_manager.h"
+#include "menus/settings_menu.h"
+#include "fifo_queue.h"
+
#ifdef WII_PLATFORM
#define MAX_GZ_FLAGS 16
+#define FRAME_ADVANCE_BTN GZPad::Z
#endif
#ifdef GCN_PLATFORM
#define MAX_GZ_FLAGS 15
+#define FRAME_ADVANCE_BTN GZPad::R
#endif
struct GZFlag {
- bool* activation_flag;
- int required_phase;
- void (*flag_active_function)();
- void (*flag_deactive_function)();
+ bool* mpFlag;
+ int mPhase;
+ void (*mpActiveFunc)();
+ void (*mpDeactiveFunc)();
};
+enum {
+ /* Main Menus */
+ GZ_NO_MENU = -1,
+ GZ_MAIN_MENU,
+ GZ_CHEAT_MENU,
+ GZ_FLAGS_MENU,
+ GZ_INVENTORY_MENU,
+ GZ_MEMORY_MENU,
+ GZ_PRACTICE_MENU,
+ GZ_SCENE_MENU,
+ GZ_SETTINGS_MENU,
+ GZ_TOOLS_MENU,
+ GZ_WARP_MENU,
+
+ /* Flags Sub-Menus */
+ GZ_GEN_FLAGS_MENU,
+ GZ_DUN_FLAGS_MENU,
+ GZ_PORTAL_FLAGS_MENU,
+ GZ_FLAG_RECORD_MENU,
+ GZ_FLAG_LOG_MENU,
+
+ /* Inventory Sub-Menus */
+ GZ_WHEEL_MENU,
+ GZ_PAUSE_MENU,
+ GZ_AMOUNTS_MENU,
+
+ /* Memory Sub-Menus */
+ GZ_WATCHES_MENU,
+ GZ_MEM_EDITOR_MENU,
+ GZ_MEMFILES_MENU,
+
+ /* Practice Sub-Menus */
+ GZ_ANY_SAVES_MENU,
+ GZ_HUNDO_SAVES_MENU,
+ GZ_AD_SAVES_MENU,
+
+ /* Scene Sub-Menus */
+ GZ_SPAWN_MENU,
+ GZ_ACLIST_MENU,
+
+ /* Settings Sub-Menus */
+ GZ_POS_SETTINGS_MENU,
+};
+
+extern bool g_framePaused;
+
enum LoopPhase { GAME_LOOP, POST_GAME_LOOP };
-namespace GZFlags {
-void apply_active_flags(int loop_phase);
-} \ No newline at end of file
+inline bool GZ_checkCheat(int cheatIdx) {
+ return g_cheats[cheatIdx].active;
+}
+
+inline bool GZ_checkDropShadows() {
+ return g_dropShadows;
+}
+
+inline void GZ_setFifoVisible(bool visible) {
+ g_fifoVisible = visible;
+}
+
+void GZ_execute(int phase);
+void GZ_drawFrameTex(Texture* pauseTex, Texture* playTex);
+
+#define sPauseTimer (*(uint8_t*)(sPauseTimer_addr)) \ No newline at end of file
diff --git a/include/input_viewer.h b/include/input_viewer.h
index c9f50f6..43e794e 100644
--- a/include/input_viewer.h
+++ b/include/input_viewer.h
@@ -1,9 +1,7 @@
#pragma once
#include "font.h"
-extern bool iv_visible;
-
namespace InputViewer {
-
-void render();
-} \ No newline at end of file
+void draw();
+void drawViewer(Vec2 pos, float scale, bool is_shadow);
+} // namespace InputViewer \ No newline at end of file
diff --git a/include/lib.h b/include/lib.h
index f6816aa..4383bd1 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -1,7 +1,6 @@
#pragma once
extern "C" {
-
void init();
void game_loop();
void post_game_loop();
diff --git a/include/menu.h b/include/menu.h
index c80a907..224234f 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -6,21 +6,18 @@
#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/dolphin/mtx/vec.h"
#include "timer.h"
+#include "utils/cursor.h"
+#include "utils/lines.h"
-#define MAX_LIST_MEMBER_LENGTH 40
-#define MAX_LIST_ITEMS 20
-#define MAX_LINE_LENGTH 50
-#define MAX_DESCRIPTION_LENGTH 100
-
-#define MAX_MENU_RENDER_FLAGS 26
+#define MAX_MENU_RENDER_FLAGS 27
#ifdef GCN_PLATFORM
-#define SELECTION_BUTTON (Controller::Pad::A)
-#define BACK_BUTTON (Controller::B)
+#define SELECTION_BUTTON (GZPad::A)
+#define BACK_BUTTON (GZPad::B)
#endif
#ifdef WII_PLATFORM
-#define SELECTION_BUTTON (Controller::Mote::A)
-#define BACK_BUTTON (Controller::B)
+#define SELECTION_BUTTON (GZPad::A)
+#define BACK_BUTTON (GZPad::B)
#endif
enum MenuIndex {
@@ -53,28 +50,10 @@ enum MenuIndex {
MN_ACTOR_SPAWNER_INDEX
};
-struct ListMember {
- char member[MAX_LIST_MEMBER_LENGTH];
-};
-
-struct Line {
- char line[MAX_LINE_LENGTH];
- const int idx;
- char description[MAX_DESCRIPTION_LENGTH];
- bool toggleable = false;
- bool* activation_flag;
- uint8_t max_y_cursor_options;
- char value[MAX_LINE_LENGTH] = {0};
-};
-
-class Menu;
-
-namespace MenuRendering {
-void render_active_menus();
-void set_menu(MenuIndex idx);
-void close_active_menus();
-bool is_menu_open();
-} // namespace MenuRendering
+void GZ_drawMenu();
+void GZ_setMenu(int idx);
+void GZ_clearMenu();
+bool GZ_checkMenuOpen();
class Menu {
public:
diff --git a/include/menus/actor_spawn_menu.h b/include/menus/actor_spawn_menu.h
index 0a3c615..53dcb52 100644
--- a/include/menus/actor_spawn_menu.h
+++ b/include/menus/actor_spawn_menu.h
@@ -10,5 +10,15 @@ enum {
class ActorSpawnMenu : public Menu {
public:
ActorSpawnMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
+};
+
+class ActorListMenu : public Menu {
+public:
+ ActorListMenu() : Menu() {}
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/ad_saves_menu.h b/include/menus/ad_saves_menu.h
index e592272..1f16338 100644
--- a/include/menus/ad_saves_menu.h
+++ b/include/menus/ad_saves_menu.h
@@ -1,6 +1,6 @@
#include "menu.h"
-#define AD_SPECIALS_AMNT 12
+#define AD_SPECIALS_AMNT 9
enum ADPracticeIndex {
AD_ORDON_GATE_CLIP_INDEX,
@@ -10,46 +10,38 @@ enum ADPracticeIndex {
AD_FARON_TWILGHT_INDEX,
AD_EMS_INDEX,
AD_MIST_INDEX,
- AD_FRST_BIT_INDEX,
- AD_FRST_ESCAPE_INDEX,
+ AD_KB1_INDEX,
+ AD_ELDIN_TWILIGHT_INDEX,
+ AD_FOREST_INDEX,
+ AD_DIABABA_INDEX,
AD_PILLAR_CLIP_INDEX,
AD_LAKEBED_1_INDEX,
AD_TOAD_INDEX,
- AD_KARG_INDEX,
- AD_FT2_INDEX,
- AD_DIABABA_INDEX,
- AD_ELDIN_TWILIGHT_INDEX,
AD_LANAYRU_TWILIGHT_INDEX,
- AD_POST_LANAYRU_INDEX,
- AD_BK_SKIP_INDEX,
- AD_MORPHEEL_INDEX,
- AD_MDH_INDEX,
- AD_MOUNTAIN_INDEX,
AD_MOUNTAIN_UMD_INDEX,
AD_SPR_INDEX,
- AD_DARK_HAMMER_INDEX,
AD_SPR_BOOST_INDEX,
AD_BLIZZETA_INDEX,
+ AD_GM_INDEX,
+ AD_DANGORO_INDEX,
+ AD_BK_SKIP_INDEX,
+ AD_MORPHEEL_INDEX,
+ AD_MDH_INDEX,
+ AD_CAMP_INDEX,
AD_AG_INDEX,
AD_POE_SKIP_INDEX,
AD_DSS_INDEX,
AD_STALLORD_INDEX,
- AD_EARLY_ELE_INDEX,
- AD_GM_INDEX,
- AD_DANGORO_INDEX,
+ AD_FARON_BOOST_INDEX,
+ AD_TOT_INDEX,
+ AD_DOT_SKIP_INDEX,
AD_RUPEE_INDEX,
AD_CITS_1_INDEX,
AD_AERALFOS_INDEX,
AD_CITS_2_INDEX,
AD_ARGOROK_INDEX,
- AD_FARON_BOOST_INDEX,
- AD_GROVE_2_INDEX,
- AD_TOT_INDEX,
- AD_DARKNUT_INDEX,
- AD_DOT_SKIP_INDEX,
AD_PALACE_1_INDEX,
AD_PALACE_2_INDEX,
- AD_EARLY_PLATFORM_INDEX,
AD_ZANT_INDEX,
AD_HC_INDEX,
AD_BEAST_GANON_INDEX,
@@ -59,5 +51,7 @@ enum ADPracticeIndex {
class ADSavesMenu : public Menu {
public:
ADSavesMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/amounts_menu.h b/include/menus/amounts_menu.h
index 2f15d9d..53aa9ea 100644
--- a/include/menus/amounts_menu.h
+++ b/include/menus/amounts_menu.h
@@ -14,5 +14,7 @@ enum AmountsIndex {
class AmountsMenu : public Menu {
public:
AmountsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/any_saves_menu.h b/include/menus/any_saves_menu.h
index a8085cd..a197a61 100644
--- a/include/menus/any_saves_menu.h
+++ b/include/menus/any_saves_menu.h
@@ -1,6 +1,6 @@
#include "menu.h"
-#define ANY_SPECIALS_AMNT 18
+#define ANY_SPECIALS_AMNT 19
enum AnyPracticeIndex {
ORDON_GATE_CLIP_INDEX,
@@ -27,7 +27,6 @@ enum AnyPracticeIndex {
SPR_WARP_SKIP_INDEX,
SPR_INDEX,
DARK_HAMMER_INDEX,
- LAKEBED_2_INDEX,
LAKEBED_BK_SKIP_INDEX,
ONEBOMB_INDEX,
MDH_TOWER_INDEX,
@@ -58,5 +57,7 @@ enum AnyPracticeIndex {
class AnySavesMenu : public Menu {
public:
AnySavesMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/cheats_menu.h b/include/menus/cheats_menu.h
index 6cafffc..4726785 100644
--- a/include/menus/cheats_menu.h
+++ b/include/menus/cheats_menu.h
@@ -1,8 +1,11 @@
#pragma once
+
#include "menu.h"
class CheatsMenu : public Menu {
public:
CheatsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/flag_records_menu.h b/include/menus/flag_records_menu.h
index 4a39f7f..1f22a15 100644
--- a/include/menus/flag_records_menu.h
+++ b/include/menus/flag_records_menu.h
@@ -3,5 +3,8 @@
class FlagRecordsMenu : public Menu {
public:
FlagRecordsMenu() : Menu() {}
- static void render();
+ static void draw();
+ static void drawFlagRecord(uint8_t* record);
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/flags_menu.h b/include/menus/flags_menu.h
index 2072717..3940032 100644
--- a/include/menus/flags_menu.h
+++ b/include/menus/flags_menu.h
@@ -32,6 +32,8 @@ enum DungeonFlagsIndex {
};
enum PortalFlagsIndex {
+ SELECT_REGION_INDEX,
+ REGION_FLAG_INDEX,
SPRING_WARP_INDEX,
S_FARON_WARP_INDEX,
N_FARON_WARP_INDEX,
@@ -52,29 +54,39 @@ enum PortalFlagsIndex {
class FlagsMenu : public Menu {
public:
FlagsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
};
class GeneralFlagsMenu : public Menu {
public:
GeneralFlagsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
};
class DungeonFlagsMenu : public Menu {
public:
DungeonFlagsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
};
class PortalFlagsMenu : public Menu {
public:
PortalFlagsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
};
class FlagLogMenu : public Menu {
public:
FlagLogMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/hundo_saves_menu.h b/include/menus/hundo_saves_menu.h
index f53e7a5..ae138b7 100644
--- a/include/menus/hundo_saves_menu.h
+++ b/include/menus/hundo_saves_menu.h
@@ -88,5 +88,7 @@ enum HundoPracticeIndex {
class HundoSavesMenu : public Menu {
public:
HundoSavesMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/inventory_menu.h b/include/menus/inventory_menu.h
index 949943c..6ef2efc 100644
--- a/include/menus/inventory_menu.h
+++ b/include/menus/inventory_menu.h
@@ -7,5 +7,7 @@
class InventoryMenu : public Menu {
public:
InventoryMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/item_wheel_menu.h b/include/menus/item_wheel_menu.h
index ccab098..3e1e061 100644
--- a/include/menus/item_wheel_menu.h
+++ b/include/menus/item_wheel_menu.h
@@ -3,11 +3,15 @@
struct ItemLookup {
enum ItemTable item_id;
- char item_description[40];
+ char name[40];
};
class ItemWheelMenu : public Menu {
public:
ItemWheelMenu() : Menu() {}
- static void render();
+ static void draw();
+ static void updateListIdx();
+ static void fixSpecialItems(int i);
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/main_menu.h b/include/menus/main_menu.h
index 2c9c1f4..9786a61 100644
--- a/include/menus/main_menu.h
+++ b/include/menus/main_menu.h
@@ -15,5 +15,7 @@ enum MainMenuIndex {
class MainMenu : public Menu {
public:
MainMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/memfiles_menu.h b/include/menus/memfiles_menu.h
index a2c08e5..865a491 100644
--- a/include/menus/memfiles_menu.h
+++ b/include/menus/memfiles_menu.h
@@ -14,13 +14,16 @@ struct PositionData {
};
extern bool set_position_data;
+extern bool g_injectMemfile;
extern int8_t memfile_load_delay;
extern PositionData memfile_posdata;
-void set_memfile_position();
+void GZMemfile_setLinkPosition();
class MemfilesMenu : public Menu {
public:
MemfilesMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/memory_editor_menu.h b/include/menus/memory_editor_menu.h
index 3fbe619..3103a2d 100644
--- a/include/menus/memory_editor_menu.h
+++ b/include/menus/memory_editor_menu.h
@@ -3,7 +3,9 @@
class MemoryEditorMenu : public Menu {
public:
MemoryEditorMenu() : Menu() {}
- static void render();
-};
+ static void draw();
+ static void drawMemEditor();
-extern uint32_t address_index;
+ static Cursor cursor;
+ static uint32_t mAddressIndex;
+};
diff --git a/include/menus/memory_menu.h b/include/menus/memory_menu.h
index 4682551..0b8bb80 100644
--- a/include/menus/memory_menu.h
+++ b/include/menus/memory_menu.h
@@ -20,16 +20,21 @@ struct MemoryWatch {
bool value_selected = false;
};
-extern MemoryWatch Watches[MAX_WATCHES];
+extern MemoryWatch g_watches[MAX_WATCHES];
class MemoryMenu : public Menu {
public:
MemoryMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
};
class WatchesMenu : public Menu {
public:
WatchesMenu() : Menu() {}
- static void render();
+ static void draw();
+ static void drawMemoryLines();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/pause_menu.h b/include/menus/pause_menu.h
index 896a26f..b19d735 100644
--- a/include/menus/pause_menu.h
+++ b/include/menus/pause_menu.h
@@ -23,5 +23,7 @@ enum PauseIndex {
class PauseMenu : public Menu {
public:
PauseMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/position_settings_menu.h b/include/menus/position_settings_menu.h
index 243080e..09a794e 100644
--- a/include/menus/position_settings_menu.h
+++ b/include/menus/position_settings_menu.h
@@ -13,11 +13,13 @@ enum SpritesIndex {
FIFO_SPR_INDEX
};
-extern Vec2 sprite_offsets[SPRITES_AMNT];
+extern Vec2 g_spriteOffsets[SPRITES_AMNT];
class PosSettingsMenu : public Menu {
public:
static void initDefaults();
PosSettingsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/practice_menu.h b/include/menus/practice_menu.h
index 7a0b327..8cf01f4 100644
--- a/include/menus/practice_menu.h
+++ b/include/menus/practice_menu.h
@@ -7,7 +7,7 @@
#define AD_INDEX 2
#define REQ_POS 1
#define REQ_CAM 2
-extern bool inject_save_flag;
+extern bool g_injectSave;
extern int last_save_index;
extern char last_category[5];
extern special* last_special_ptr;
@@ -16,5 +16,7 @@ extern int last_special_size;
class PracticeMenu : public Menu {
public:
PracticeMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/scene_menu.h b/include/menus/scene_menu.h
index 807b1c2..d9f9a14 100644
--- a/include/menus/scene_menu.h
+++ b/include/menus/scene_menu.h
@@ -2,8 +2,8 @@
#include "menu.h"
-#define SCENE_AMNT 10
-namespace Scene {
+#define SCENE_AMNT 7
+
enum SceneIndex {
DISABLE_BG_INDEX,
DISABLE_SFX_INDEX,
@@ -15,17 +15,30 @@ enum SceneIndex {
TIME_HOURS_INDEX,
TIME_MINUTES_INDEX,
ACTOR_MENU_INDEX,
+ ACTOR_LIST_INDEX,
};
struct SceneItem {
enum SceneIndex id;
bool active;
};
-} // namespace Scene
-extern Scene::SceneItem SceneItems[SCENE_AMNT];
+
+extern SceneItem g_sceneFlags[SCENE_AMNT];
+
+void GZ_freezeTime();
+void GZ_freezeCamera();
+void GZ_unfreezeCamera();
+void GZ_hideHUD();
+void GZ_showHUD();
+void GZ_freezeActors();
+void GZ_unfreezeActors();
+void GZ_hideActors();
+void GZ_showActors();
class SceneMenu : public Menu {
public:
SceneMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/settings_menu.h b/include/menus/settings_menu.h
index b33b49d..1fbb32d 100644
--- a/include/menus/settings_menu.h
+++ b/include/menus/settings_menu.h
@@ -2,7 +2,7 @@
#include "menu.h"
-#define CURSOR_RGBA cursor_rgba
+#define CURSOR_RGBA g_cursorColor
enum SettingsIndex {
AREA_RELOAD_BEHAVIOR_INDEX,
@@ -15,13 +15,13 @@ enum SettingsIndex {
DELETE_CARD_INDEX,
POS_SETTINGS_MENU_INDEX
};
-extern bool g_drop_shadows;
-extern int g_area_reload_behavior;
-extern int g_cursor_color;
+extern bool g_dropShadows;
+extern int g_reloadType;
+extern int g_cursorColorType;
extern bool g_cursor_color_flag;
extern bool g_swap_equips_flag;
-extern int cursor_rgba;
-extern int g_font;
+extern int g_cursorColor;
+extern int g_fontType;
#define LOAD_AREA 0
#define LOAD_FILE 1
@@ -38,5 +38,7 @@ class SettingsMenu : public Menu {
public:
static void initFont();
SettingsMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/tools_menu.h b/include/menus/tools_menu.h
index 3970ee1..2bd7ba5 100644
--- a/include/menus/tools_menu.h
+++ b/include/menus/tools_menu.h
@@ -3,14 +3,15 @@
#include "menu.h"
#ifdef WII_PLATFORM
-#define TOOL_AMNT 19
+#define TOOL_AMNT 21
#endif
#ifdef GCN_PLATFORM
-#define TOOL_AMNT 18
+#define TOOL_AMNT 20
#endif
-namespace Tools {
+
enum ToolsIndex {
RELOAD_AREA_INDEX,
+ FRAME_ADVANCE_INDEX,
FAST_BONK_INDEX,
FAST_MOVEMENT_INDEX,
GORGE_INDEX,
@@ -21,6 +22,7 @@ enum ToolsIndex {
UMD_INDEX,
INPUT_VIEWER_INDEX,
LINK_DEBUG_INDEX,
+ HEAP_DEBUG_INDEX,
SAND_INDEX,
ROLL_INDEX,
TELEPORT_INDEX,
@@ -38,10 +40,9 @@ struct Tool {
bool active;
};
-void apply_cheats();
-}; // namespace Tools
+void GZ_applyCheats();
-extern Tools::Tool ToolItems[TOOL_AMNT];
+extern Tool g_tools[TOOL_AMNT];
extern int g_tunic_color;
extern bool g_tunic_color_flag;
@@ -59,5 +60,8 @@ extern TunicColor TunicColors[TUNIC_COLOR_AMNT];
class ToolsMenu : public Menu {
public:
ToolsMenu() : Menu() {}
- static void render();
+ static void draw();
+ static void setTunicColor();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/menus/warping_menu.h b/include/menus/warping_menu.h
index c7cab83..3fc6f27 100644
--- a/include/menus/warping_menu.h
+++ b/include/menus/warping_menu.h
@@ -36,5 +36,7 @@ struct WarpInfo {
class WarpingMenu : public Menu {
public:
WarpingMenu() : Menu() {}
- static void render();
+ static void draw();
+
+ static Cursor cursor;
}; \ No newline at end of file
diff --git a/include/movelink.h b/include/movelink.h
index 9af20ee..b74b97a 100644
--- a/include/movelink.h
+++ b/include/movelink.h
@@ -1,7 +1,7 @@
#pragma once
#include "font.h"
-extern bool move_link_active;
+extern bool g_moveLinkEnabled;
#ifdef GCN_PLATFORM
#define MOVE_LINK_MOVEMENT_TEXT "Stick/C"
@@ -13,6 +13,6 @@ extern bool move_link_active;
#endif
namespace MoveLink {
-void move_link();
-void render_info_input();
+void execute();
+// void render_info_input();
} // namespace MoveLink
diff --git a/include/rollcheck.h b/include/rollcheck.h
index 0373fc1..95050c7 100644
--- a/include/rollcheck.h
+++ b/include/rollcheck.h
@@ -1,8 +1,5 @@
#pragma once
-extern bool g_roll_check_active;
-
namespace RollIndicator {
-void render();
-void run();
+void execute();
} // namespace RollIndicator \ No newline at end of file
diff --git a/include/save_manager.h b/include/save_manager.h
index 7158124..1c5cd6b 100644
--- a/include/save_manager.h
+++ b/include/save_manager.h
@@ -87,17 +87,19 @@ public:
bool repeat_during = false;
public:
- static void inject_save(void* buffer);
- static void inject_memfile(void* buffer);
- static void inject_default_before();
- static void inject_default_during();
- static void inject_memfile_during();
- static void inject_default_after();
- static void load_save(uint32_t id, char* category, special* i_specials = nullptr, int size = 0);
- static void load_save_file(const char* fileName);
- static void trigger_load();
- static void default_load();
+ static void injectSave(void* buffer);
+ static void injectMemfile(void* buffer);
+ static void injectDefault_before();
+ static void injectDefault_during();
+ static void injectMemfile_during();
+ static void injectDefault_after();
+ static void loadSave(uint32_t id, const char* category, special* i_specials = nullptr,
+ int size = 0);
+ static void loadSavefile(const char* fileName);
+ static void triggerLoad();
+ static void defaultLoad();
static void setLinkInfo();
+ static void setPositionCamera();
void setSavePosition(float x, float y, float z) {
mPracticeSaveInfo.position.x = x;
@@ -133,16 +135,16 @@ struct GZSaveHeader {
};
struct GZSaveLayout {
- Cheats::Cheat CheatItems[CHEAT_AMNT];
- Tools::Tool ToolItems[TOOL_AMNT];
- Scene::SceneItem SceneItems[SCENE_AMNT];
- MemoryWatch Watches[MAX_WATCHES];
- Vec2 sprite_offsets[SPRITES_AMNT];
- bool commands_states[COMMANDS_AMNT];
- bool g_drop_shadows;
- int g_area_reload_behavior;
- int g_cursor_color;
- int g_font;
+ Cheat mCheats[CHEAT_AMNT];
+ Tool mTools[TOOL_AMNT];
+ SceneItem mSceneFlags[SCENE_AMNT];
+ MemoryWatch mWatches[MAX_WATCHES];
+ Vec2 mSpriteOffsets[SPRITES_AMNT];
+ bool mCommandStates[COMMANDS_AMNT];
+ bool mDropShadows;
+ int mReloadType;
+ int mCursorColType;
+ int mFontType;
};
struct GZSaveFile {
diff --git a/include/save_specials.h b/include/save_specials.h
new file mode 100644
index 0000000..c85ea32
--- /dev/null
+++ b/include/save_specials.h
@@ -0,0 +1,46 @@
+#pragma once
+
+void SaveMngSpecial_BossFlags();
+
+void SaveMngSpecial_Goats1();
+void SaveMngSpecial_Goats2();
+
+void SaveMngSpecial_Hugo();
+void SaveMngSpecial_SpawnHugo();
+
+void SaveMngSpecial_PurpleMist();
+
+void SaveMngSpecial_KargOoB();
+void SaveMngSpecial_WaterfallSidehop();
+
+void SaveMngSpecial_KB2Skip();
+void SaveMngSpecial_Escort();
+
+void SaveMngSpecial_Dangoro();
+
+void SaveMngSpecial_Darkhammer();
+void SaveMngSpecial_SPRBossKey();
+
+void SaveMngSpecial_Norgor();
+void SaveMngSpecial_LakebedBKSkip();
+void SaveMngSpecial_Morpheel();
+
+void SaveMngSpecial_Iza1Skip();
+
+void SaveMngSpecial_Stallord();
+void SaveMngSpecial_Stallord2();
+void SaveMngSpecial_Stallord2_init();
+
+void SaveMngSpecial_ToTEarlyPoe();
+void SaveMngSpecial_ToTEarlyHP();
+
+void SaveMngSpecial_HugoArchery();
+
+void SaveMngSpecial_CityPoeCycle();
+void SaveMngSpecial_FanTower();
+void SaveMngSpecial_Argorok();
+
+void SaveMngSpecial_Palace1();
+void SaveMngSpecial_Palace2();
+
+void SaveMngSpecial_CaveOfOrdeals(); \ No newline at end of file
diff --git a/include/system.h b/include/system.h
deleted file mode 100644
index ce6b0b8..0000000
--- a/include/system.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-namespace System {
-void lock_camera();
-void unlock_camera();
-void hide_hud();
-void show_hud();
-} // namespace System \ No newline at end of file
diff --git a/include/time.h b/include/time.h
deleted file mode 100644
index 2d2b5f0..0000000
--- a/include/time.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-namespace Utilities {
-void freeze_time();
-}
diff --git a/include/timer.h b/include/timer.h
index f63d6df..b6cbe59 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -1,10 +1,11 @@
#pragma once
#include "font.h"
-extern bool timer_visible;
-extern bool timer_started;
-extern bool reset_timer;
+extern bool g_timerEnabled;
+extern bool g_resetTimer;
namespace Timer {
-void render();
-} \ No newline at end of file
+void drawTimer();
+void drawIGT();
+void drawLoadTimer();
+} // namespace Timer \ No newline at end of file
diff --git a/include/umd.h b/include/umd.h
index 5a5303a..ebb29c0 100644
--- a/include/umd.h
+++ b/include/umd.h
@@ -1,8 +1,5 @@
#pragma once
-extern bool g_umd_active;
-
namespace UMDIndicator {
-void render();
-void run();
+void execute();
} // namespace UMDIndicator \ No newline at end of file
diff --git a/include/utils/audio.h b/include/utils/audio.h
index fa8297d..ee06125 100644
--- a/include/utils/audio.h
+++ b/include/utils/audio.h
@@ -1,7 +1,8 @@
#pragma once
-namespace Utilities {
-void disable_bg_music();
-void enable_bg_music();
-void disable_sfx();
-void enable_sfx();
-} // namespace Utilities \ No newline at end of file
+
+#include "libtp_c/include/m_Do/m_Do_audio.h"
+
+void GZ_disableBGM();
+void GZ_enableBGM();
+void GZ_disableSFX();
+void GZ_enableSFX();
diff --git a/include/utils/card.h b/include/utils/card.h
index 4e74bda..6ca7c2b 100644
--- a/include/utils/card.h
+++ b/include/utils/card.h
@@ -2,16 +2,14 @@
#include "gcn_c/include/storage.h"
#include "menu.h"
-extern bool inject_memfile_flag;
-
-namespace Utilities {
-int32_t storage_write(Storage* info, void* data, int32_t size, int32_t offset, int32_t sector_size);
-int32_t storage_read(Storage* info, void* data, int32_t size, int32_t offset, int32_t sector_size);
-void store_mem_card(Storage& card);
-void store_memfile(Storage& card);
-void delete_mem_card(Storage& card);
-void delete_memfile(Storage& card);
-void load_mem_card(Storage& card);
-void load_memfile(Storage& card);
-void load_gz_card(bool& card_load);
-} // namespace Utilities \ No newline at end of file
+int32_t GZ_storageWrite(Storage* info, void* data, int32_t size, int32_t offset,
+ int32_t sector_size);
+int32_t GZ_storageRead(Storage* info, void* data, int32_t size, int32_t offset,
+ int32_t sector_size);
+void GZ_storeMemCard(Storage& card);
+void GZ_storeMemfile(Storage& card);
+void GZ_deleteMemCard(Storage& card);
+void GZ_deleteMemfile(Storage& card);
+void GZ_loadMemCard(Storage& card);
+void GZ_loadMemfile(Storage& card);
+void GZ_loadGZSave(bool& card_load); \ No newline at end of file
diff --git a/include/utils/cursor.h b/include/utils/cursor.h
index 5d587ff..2ee6add 100644
--- a/include/utils/cursor.h
+++ b/include/utils/cursor.h
@@ -1,13 +1,64 @@
#pragma once
+#include <stdint.h>
+#include "controller.h"
+
+#ifdef GCN_PLATFORM
+#define SCROLL_P10_BTN GZPad::Y
+#define SCROLL_M10_BTN GZPad::X
+#endif
+
+#ifdef WII_PLATFORM
+#define SCROLL_P10_BTN GZPad::TWO
+#define SCROLL_M10_BTN GZPad::ONE
+#endif
+
struct Cursor {
- int y = 0;
+ enum Mode {
+ MODE_SINGLE_COLUMN,
+ MODE_LIST,
+ MODE_UNRESTRICTED,
+ };
+
+ Cursor() { reset(); }
+
+ void move(int max_x, int max_y);
+
+ template <typename T>
+ static void moveList(T& index) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ index--;
+ } else if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ index++;
+ } else if (GZ_getButtonRepeat(SCROLL_M10_BTN)) {
+ index -= 10;
+ } else if (GZ_getButtonRepeat(SCROLL_P10_BTN)) {
+ index += 10;
+ }
+ }
+
+ void reset() {
+ mode = MODE_SINGLE_COLUMN;
+ x = 0;
+ y = 0;
+ lock_x = false;
+ lock_y = false;
+ }
+
+ void lock(bool x, bool y) {
+ lock_x = x;
+ lock_y = y;
+ }
+
+ void setMode(uint8_t m) { mode = m; }
+
int x = 0;
+ int y = 0;
+ uint8_t mode = 0;
+ bool lock_x = false;
+ bool lock_y = false;
};
-extern bool can_move_cursor;
-namespace Utilities {
-void move_cursor(Cursor& cursor, int max_cursor_x_value, int max_cursor_y_value = 0,
- bool lock_x = false, bool lock_y = false, bool unrestricted = false,
- bool menu_with_list_lines = false);
-} \ No newline at end of file
+extern bool g_cursorEnabled;
+
+void GZ_setCursorColor(); \ No newline at end of file
diff --git a/include/utils/draw.h b/include/utils/draw.h
index 6bbdf53..e08b652 100644
--- a/include/utils/draw.h
+++ b/include/utils/draw.h
@@ -21,16 +21,16 @@ void add_vertex(uint32_t color, Vec2 point);
void add_vertex(uint32_t color, Vec2 point, Vec2 tex);
void end();
-void draw_quad(uint32_t color, Vec2 p[4]);
-void draw_quad(uint32_t color, Vec2 p[4], GXTexObj* texture);
-void draw_quad(uint32_t color, Vec2 p[4], Vec2 tex[4]);
-void draw_quad(uint32_t color, Vec2 p[4], Vec2 tex[4], GXTexObj* texture);
-void draw_quad_outline(uint32_t color, Vec2 p[4]);
-void draw_quad_outline(uint32_t color, Vec2 p[4], uint8_t width);
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim);
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, GXTexObj* texture);
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4]);
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4], GXTexObj* texture);
-void draw_rect_outline(uint32_t color, Vec2 pos, Vec2 dim);
-void draw_rect_outline(uint32_t color, Vec2 pos, Vec2 dim, uint8_t width);
+void drawQuad(uint32_t color, Vec2 p[4]);
+void drawQuad(uint32_t color, Vec2 p[4], GXTexObj* texture);
+void drawQuad(uint32_t color, Vec2 p[4], Vec2 tex[4]);
+void drawQuad(uint32_t color, Vec2 p[4], Vec2 tex[4], GXTexObj* texture);
+void drawQuadOutline(uint32_t color, Vec2 p[4]);
+void drawQuadOutline(uint32_t color, Vec2 p[4], uint8_t width);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, GXTexObj* texture);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4]);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4], GXTexObj* texture);
+void drawRectOutline(uint32_t color, Vec2 pos, Vec2 dim);
+void drawRectOutline(uint32_t color, Vec2 pos, Vec2 dim, uint8_t width);
}; // namespace Draw
diff --git a/include/utils/hook.h b/include/utils/hook.h
index 9670e0c..3032770 100644
--- a/include/utils/hook.h
+++ b/include/utils/hook.h
@@ -18,5 +18,5 @@ enum HookIndex {
};
namespace Hook {
-void apply_hooks();
+void applyHooks();
} // namespace Hook \ No newline at end of file
diff --git a/include/utils/lines.h b/include/utils/lines.h
index 867ed27..e915617 100644
--- a/include/utils/lines.h
+++ b/include/utils/lines.h
@@ -1,10 +1,27 @@
#pragma once
#include "font.h"
-#include "menu.h"
+
#define MAX_RENDER_LINES 15
-namespace Utilities {
+#define MAX_LIST_MEMBER_LENGTH 40
+#define MAX_LIST_ITEMS 20
+#define MAX_LINE_LENGTH 50
+#define MAX_DESCRIPTION_LENGTH 100
+
+struct ListMember {
+ char member[MAX_LIST_MEMBER_LENGTH];
+};
+
+struct Line {
+ char line[MAX_LINE_LENGTH];
+ const int idx;
+ char description[MAX_DESCRIPTION_LENGTH];
+ bool toggleable = false;
+ bool* activation_flag;
+ uint8_t max_y_cursor_options;
+ char value[MAX_LINE_LENGTH] = {0};
+};
+
+float maxF(float a, float b);
void menu_anim(int idx);
-void render_lines(Line lines[], int cursor, int LINES);
-void change_cursor_color();
-} // namespace Utilities \ No newline at end of file
+void GZ_drawMenuLines(Line lines[], int cursor, int LINES); \ No newline at end of file
diff --git a/include/utils/link.h b/include/utils/link.h
index b165de4..7789ff5 100644
--- a/include/utils/link.h
+++ b/include/utils/link.h
@@ -2,10 +2,9 @@
#include "font.h"
#include "libtp_c/include/dolphin/os/OSCache.h"
-namespace Utilities {
-void show_link_debug_info();
-void change_tunic_color();
-inline void setup_link_color() {
+void GZ_displayLinkInfo();
+
+inline void GZ_patchLinkColor() {
#ifdef WII_PLATFORM
#ifdef WII_NTSCU_10
#define SWORD_UP_RED_ADDR 0x801176B0
@@ -27,5 +26,4 @@ inline void setup_link_color() {
DCFlushRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
ICInvalidateRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
#endif // WII_PLATFORM
-}
-} // namespace Utilities \ No newline at end of file
+} \ No newline at end of file
diff --git a/include/utils/loading.h b/include/utils/loading.h
index 07a880a..e69de29 100644
--- a/include/utils/loading.h
+++ b/include/utils/loading.h
@@ -1,8 +0,0 @@
-#pragma once
-#include "save_manager.h"
-
-namespace Utilities {
-void set_camera_angle_position();
-void set_angle_position();
-
-} // namespace Utilities \ No newline at end of file
diff --git a/include/utils/memory.h b/include/utils/memory.h
index 87af82a..614401d 100644
--- a/include/utils/memory.h
+++ b/include/utils/memory.h
@@ -1,5 +1,4 @@
#include "font.h"
-namespace Utilities {
-void render_active_watches();
-} \ No newline at end of file
+void GZ_drawWatches();
+void GZ_drawHeapInfo(); \ No newline at end of file
diff --git a/res/save_files/ad.bin b/res/save_files/ad.bin
index 6af49aa..e0fa02f 100644
--- a/res/save_files/ad.bin
+++ b/res/save_files/ad.bin
Binary files differ
diff --git a/res/save_files/ad/aeralfos.bin b/res/save_files/ad/aeralfos.bin
index 5317008..ba247e8 100644
--- a/res/save_files/ad/aeralfos.bin
+++ b/res/save_files/ad/aeralfos.bin
Binary files differ
diff --git a/res/save_files/ad/ag.bin b/res/save_files/ad/ag.bin
index 31cfa1b..52221f3 100644
--- a/res/save_files/ad/ag.bin
+++ b/res/save_files/ad/ag.bin
Binary files differ
diff --git a/res/save_files/ad/argorok.bin b/res/save_files/ad/argorok.bin
index c23a36e..0aba741 100644
--- a/res/save_files/ad/argorok.bin
+++ b/res/save_files/ad/argorok.bin
Binary files differ
diff --git a/res/save_files/ad/beast_ganon.bin b/res/save_files/ad/beast_ganon.bin
index d3fb8ab..447f538 100644
--- a/res/save_files/ad/beast_ganon.bin
+++ b/res/save_files/ad/beast_ganon.bin
Binary files differ
diff --git a/res/save_files/ad/bk_skip.bin b/res/save_files/ad/bk_skip.bin
index 3b666eb..f2376dd 100644
--- a/res/save_files/ad/bk_skip.bin
+++ b/res/save_files/ad/bk_skip.bin
Binary files differ
diff --git a/res/save_files/ad/blizzeta.bin b/res/save_files/ad/blizzeta.bin
index 5c35564..2bfc831 100644
--- a/res/save_files/ad/blizzeta.bin
+++ b/res/save_files/ad/blizzeta.bin
Binary files differ
diff --git a/res/save_files/ad/camp.bin b/res/save_files/ad/camp.bin
new file mode 100644
index 0000000..633e3ee
--- /dev/null
+++ b/res/save_files/ad/camp.bin
Binary files differ
diff --git a/res/save_files/ad/city1.bin b/res/save_files/ad/city1.bin
index b4a3994..7f7e6c5 100644
--- a/res/save_files/ad/city1.bin
+++ b/res/save_files/ad/city1.bin
Binary files differ
diff --git a/res/save_files/ad/city2.bin b/res/save_files/ad/city2.bin
index b9d1ee2..0c0e43b 100644
--- a/res/save_files/ad/city2.bin
+++ b/res/save_files/ad/city2.bin
Binary files differ
diff --git a/res/save_files/ad/dangoro.bin b/res/save_files/ad/dangoro.bin
index d9dd3d6..3ea9519 100644
--- a/res/save_files/ad/dangoro.bin
+++ b/res/save_files/ad/dangoro.bin
Binary files differ
diff --git a/res/save_files/ad/darkhammer.bin b/res/save_files/ad/darkhammer.bin
deleted file mode 100644
index 861f71e..0000000
--- a/res/save_files/ad/darkhammer.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/darknut.bin b/res/save_files/ad/darknut.bin
deleted file mode 100644
index 6c0ba58..0000000
--- a/res/save_files/ad/darknut.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/deathsword.bin b/res/save_files/ad/deathsword.bin
index 8ea1ed5..44a9ee7 100644
--- a/res/save_files/ad/deathsword.bin
+++ b/res/save_files/ad/deathsword.bin
Binary files differ
diff --git a/res/save_files/ad/deku_toad.bin b/res/save_files/ad/deku_toad.bin
index 40df407..1bccb8b 100644
--- a/res/save_files/ad/deku_toad.bin
+++ b/res/save_files/ad/deku_toad.bin
Binary files differ
diff --git a/res/save_files/ad/diababa.bin b/res/save_files/ad/diababa.bin
index 1188abf..0e89820 100644
--- a/res/save_files/ad/diababa.bin
+++ b/res/save_files/ad/diababa.bin
Binary files differ
diff --git a/res/save_files/ad/dot_skip.bin b/res/save_files/ad/dot_skip.bin
index 465d9cd..31e90ea 100644
--- a/res/save_files/ad/dot_skip.bin
+++ b/res/save_files/ad/dot_skip.bin
Binary files differ
diff --git a/res/save_files/ad/early_ele.bin b/res/save_files/ad/early_ele.bin
deleted file mode 100644
index f7f2107..0000000
--- a/res/save_files/ad/early_ele.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/early_platform.bin b/res/save_files/ad/early_platform.bin
deleted file mode 100644
index ba00b8d..0000000
--- a/res/save_files/ad/early_platform.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/eldin_twilight.bin b/res/save_files/ad/eldin_twilight.bin
index a6db635..f6c516f 100644
--- a/res/save_files/ad/eldin_twilight.bin
+++ b/res/save_files/ad/eldin_twilight.bin
Binary files differ
diff --git a/res/save_files/ad/faron_boost.bin b/res/save_files/ad/faron_boost.bin
index 52f8c01..07ea301 100644
--- a/res/save_files/ad/faron_boost.bin
+++ b/res/save_files/ad/faron_boost.bin
Binary files differ
diff --git a/res/save_files/ad/forest.bin b/res/save_files/ad/forest.bin
new file mode 100644
index 0000000..d2619b5
--- /dev/null
+++ b/res/save_files/ad/forest.bin
Binary files differ
diff --git a/res/save_files/ad/forest2.bin b/res/save_files/ad/forest2.bin
deleted file mode 100644
index 0969518..0000000
--- a/res/save_files/ad/forest2.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/forest_escape.bin b/res/save_files/ad/forest_escape.bin
deleted file mode 100644
index 95e3020..0000000
--- a/res/save_files/ad/forest_escape.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/gm.bin b/res/save_files/ad/gm.bin
index d67caa5..8f6b4c7 100644
--- a/res/save_files/ad/gm.bin
+++ b/res/save_files/ad/gm.bin
Binary files differ
diff --git a/res/save_files/ad/grove2.bin b/res/save_files/ad/grove2.bin
deleted file mode 100644
index b7f8510..0000000
--- a/res/save_files/ad/grove2.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/hc.bin b/res/save_files/ad/hc.bin
index d3d54e6..b618e2b 100644
--- a/res/save_files/ad/hc.bin
+++ b/res/save_files/ad/hc.bin
Binary files differ
diff --git a/res/save_files/ad/horseback.bin b/res/save_files/ad/horseback.bin
index c210334..760d026 100644
--- a/res/save_files/ad/horseback.bin
+++ b/res/save_files/ad/horseback.bin
Binary files differ
diff --git a/res/save_files/ad/post_lanayru.bin b/res/save_files/ad/ice_boost.bin
index 2c72d28..ade2d2c 100644
--- a/res/save_files/ad/post_lanayru.bin
+++ b/res/save_files/ad/ice_boost.bin
Binary files differ
diff --git a/res/save_files/ad/forest_bit.bin b/res/save_files/ad/kb1.bin
index cd993f9..6cdb853 100644
--- a/res/save_files/ad/forest_bit.bin
+++ b/res/save_files/ad/kb1.bin
Binary files differ
diff --git a/res/save_files/ad/lakebed1.bin b/res/save_files/ad/lakebed1.bin
index c3f098b..b2ae8f8 100644
--- a/res/save_files/ad/lakebed1.bin
+++ b/res/save_files/ad/lakebed1.bin
Binary files differ
diff --git a/res/save_files/ad/lanayru_twilight.bin b/res/save_files/ad/lanayru_twilight.bin
index de99f28..c0f3a72 100644
--- a/res/save_files/ad/lanayru_twilight.bin
+++ b/res/save_files/ad/lanayru_twilight.bin
Binary files differ
diff --git a/res/save_files/ad/mdh.bin b/res/save_files/ad/mdh.bin
index 35b72c0..f20a3b0 100644
--- a/res/save_files/ad/mdh.bin
+++ b/res/save_files/ad/mdh.bin
Binary files differ
diff --git a/res/save_files/ad/morpheel.bin b/res/save_files/ad/morpheel.bin
index 55ee2d9..e512df3 100644
--- a/res/save_files/ad/morpheel.bin
+++ b/res/save_files/ad/morpheel.bin
Binary files differ
diff --git a/res/save_files/ad/mountain.bin b/res/save_files/ad/mountain.bin
deleted file mode 100644
index b6db949..0000000
--- a/res/save_files/ad/mountain.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/mountain_umd.bin b/res/save_files/ad/mountain_umd.bin
index 9e4669b..f1427aa 100644
--- a/res/save_files/ad/mountain_umd.bin
+++ b/res/save_files/ad/mountain_umd.bin
Binary files differ
diff --git a/res/save_files/ad/palace1.bin b/res/save_files/ad/palace1.bin
index b918785..a080995 100644
--- a/res/save_files/ad/palace1.bin
+++ b/res/save_files/ad/palace1.bin
Binary files differ
diff --git a/res/save_files/ad/palace2.bin b/res/save_files/ad/palace2.bin
index e3833c5..b48fdb6 100644
--- a/res/save_files/ad/palace2.bin
+++ b/res/save_files/ad/palace2.bin
Binary files differ
diff --git a/res/save_files/ad/pillar_clip.bin b/res/save_files/ad/pillar_clip.bin
index 1bd6cc0..a1193e6 100644
--- a/res/save_files/ad/pillar_clip.bin
+++ b/res/save_files/ad/pillar_clip.bin
Binary files differ
diff --git a/res/save_files/ad/poe_skip.bin b/res/save_files/ad/poe_skip.bin
index 5851904..78af756 100644
--- a/res/save_files/ad/poe_skip.bin
+++ b/res/save_files/ad/poe_skip.bin
Binary files differ
diff --git a/res/save_files/ad/silver_rupee.bin b/res/save_files/ad/silver_rupee.bin
index ee433c6..477b4f1 100644
--- a/res/save_files/ad/silver_rupee.bin
+++ b/res/save_files/ad/silver_rupee.bin
Binary files differ
diff --git a/res/save_files/ad/spr.bin b/res/save_files/ad/spr.bin
new file mode 100644
index 0000000..ce478c0
--- /dev/null
+++ b/res/save_files/ad/spr.bin
Binary files differ
diff --git a/res/save_files/ad/spr1.bin b/res/save_files/ad/spr1.bin
deleted file mode 100644
index 651c043..0000000
--- a/res/save_files/ad/spr1.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/spr_boost.bin b/res/save_files/ad/spr_boost.bin
deleted file mode 100644
index a764543..0000000
--- a/res/save_files/ad/spr_boost.bin
+++ /dev/null
Binary files differ
diff --git a/res/save_files/ad/stallord.bin b/res/save_files/ad/stallord.bin
index 3b2ea45..7c0ea2b 100644
--- a/res/save_files/ad/stallord.bin
+++ b/res/save_files/ad/stallord.bin
Binary files differ
diff --git a/res/save_files/ad/tot.bin b/res/save_files/ad/tot.bin
index 45c9154..a079799 100644
--- a/res/save_files/ad/tot.bin
+++ b/res/save_files/ad/tot.bin
Binary files differ
diff --git a/res/save_files/ad/zant.bin b/res/save_files/ad/zant.bin
index db834de..ac921cf 100644
--- a/res/save_files/ad/zant.bin
+++ b/res/save_files/ad/zant.bin
Binary files differ
diff --git a/res/save_files/any.bin b/res/save_files/any.bin
index 7b188be..4b28412 100644
--- a/res/save_files/any.bin
+++ b/res/save_files/any.bin
Binary files differ
diff --git a/res/save_files/any/aeralfos_skip.bin b/res/save_files/any/aeralfos_skip.bin
index c6a498f..ac8fa0c 100644
--- a/res/save_files/any/aeralfos_skip.bin
+++ b/res/save_files/any/aeralfos_skip.bin
Binary files differ
diff --git a/res/save_files/any/ag.bin b/res/save_files/any/ag.bin
index a42bfd6..614d80c 100644
--- a/res/save_files/any/ag.bin
+++ b/res/save_files/any/ag.bin
Binary files differ
diff --git a/res/save_files/any/argorok.bin b/res/save_files/any/argorok.bin
index f4f619a..4d3c569 100644
--- a/res/save_files/any/argorok.bin
+++ b/res/save_files/any/argorok.bin
Binary files differ
diff --git a/res/save_files/any/beast_ganon.bin b/res/save_files/any/beast_ganon.bin
index e35d326..536315f 100644
--- a/res/save_files/any/beast_ganon.bin
+++ b/res/save_files/any/beast_ganon.bin
Binary files differ
diff --git a/res/save_files/any/boss_bug.bin b/res/save_files/any/boss_bug.bin
index 0e52d78..458f4eb 100644
--- a/res/save_files/any/boss_bug.bin
+++ b/res/save_files/any/boss_bug.bin
Binary files differ
diff --git a/res/save_files/any/camp.bin b/res/save_files/any/camp.bin
index 2310d64..8891b1c 100644
--- a/res/save_files/any/camp.bin
+++ b/res/save_files/any/camp.bin
Binary files differ
diff --git a/res/save_files/any/cits_1.bin b/res/save_files/any/cits_1.bin
index 84226ae..7e71d17 100644
--- a/res/save_files/any/cits_1.bin
+++ b/res/save_files/any/cits_1.bin
Binary files differ
diff --git a/res/save_files/any/cits_2.bin b/res/save_files/any/cits_2.bin
index 555cdce..b59a173 100644
--- a/res/save_files/any/cits_2.bin
+++ b/res/save_files/any/cits_2.bin
Binary files differ
diff --git a/res/save_files/any/cits_early.bin b/res/save_files/any/cits_early.bin
index 277f5f7..b2da219 100644
--- a/res/save_files/any/cits_early.bin
+++ b/res/save_files/any/cits_early.bin
Binary files differ
diff --git a/res/save_files/any/darkhammer.bin b/res/save_files/any/darkhammer.bin
index 5ea1ef8..5164f33 100644
--- a/res/save_files/any/darkhammer.bin
+++ b/res/save_files/any/darkhammer.bin
Binary files differ
diff --git a/res/save_files/any/darknut.bin b/res/save_files/any/darknut.bin
index 3edea4c..038b18e 100644
--- a/res/save_files/any/darknut.bin
+++ b/res/save_files/any/darknut.bin
Binary files differ
diff --git a/res/save_files/any/death_sword_skip.bin b/res/save_files/any/death_sword_skip.bin
index d749282..76f4ce9 100644
--- a/res/save_files/any/death_sword_skip.bin
+++ b/res/save_files/any/death_sword_skip.bin
Binary files differ
diff --git a/res/save_files/any/deku_toad.bin b/res/save_files/any/deku_toad.bin
index 0fb99d9..1df72ba 100644
--- a/res/save_files/any/deku_toad.bin
+++ b/res/save_files/any/deku_toad.bin
Binary files differ
diff --git a/res/save_files/any/early_platform.bin b/res/save_files/any/early_platform.bin
index c42c2b5..073c7e5 100644
--- a/res/save_files/any/early_platform.bin
+++ b/res/save_files/any/early_platform.bin
Binary files differ
diff --git a/res/save_files/any/eldin_twilight.bin b/res/save_files/any/eldin_twilight.bin
index 766be47..3cbc8c0 100644
--- a/res/save_files/any/eldin_twilight.bin
+++ b/res/save_files/any/eldin_twilight.bin
Binary files differ
diff --git a/res/save_files/any/ems.bin b/res/save_files/any/ems.bin
index 44e1be0..26a4f46 100644
--- a/res/save_files/any/ems.bin
+++ b/res/save_files/any/ems.bin
Binary files differ
diff --git a/res/save_files/any/fan_tower.bin b/res/save_files/any/fan_tower.bin
index 41b2bbc..3388173 100644
--- a/res/save_files/any/fan_tower.bin
+++ b/res/save_files/any/fan_tower.bin
Binary files differ
diff --git a/res/save_files/any/forest_bit.bin b/res/save_files/any/forest_bit.bin
index 50822c6..6d54d45 100644
--- a/res/save_files/any/forest_bit.bin
+++ b/res/save_files/any/forest_bit.bin
Binary files differ
diff --git a/res/save_files/any/forest_escape.bin b/res/save_files/any/forest_escape.bin
index dfa763c..967d960 100644
--- a/res/save_files/any/forest_escape.bin
+++ b/res/save_files/any/forest_escape.bin
Binary files differ
diff --git a/res/save_files/any/goats.bin b/res/save_files/any/goats.bin
index 6aeabc9..fe1edc5 100644
--- a/res/save_files/any/goats.bin
+++ b/res/save_files/any/goats.bin
Binary files differ
diff --git a/res/save_files/any/gorge_void.bin b/res/save_files/any/gorge_void.bin
index 3da3043..167a4ad 100644
--- a/res/save_files/any/gorge_void.bin
+++ b/res/save_files/any/gorge_void.bin
Binary files differ
diff --git a/res/save_files/any/hc.bin b/res/save_files/any/hc.bin
index 60b11ed..624c209 100644
--- a/res/save_files/any/hc.bin
+++ b/res/save_files/any/hc.bin
Binary files differ
diff --git a/res/save_files/any/hc_tower.bin b/res/save_files/any/hc_tower.bin
index 0d12a07..d27bcb6 100644
--- a/res/save_files/any/hc_tower.bin
+++ b/res/save_files/any/hc_tower.bin
Binary files differ
diff --git a/res/save_files/any/horseback_ganon.bin b/res/save_files/any/horseback_ganon.bin
index 39075db..dfca8dd 100644
--- a/res/save_files/any/horseback_ganon.bin
+++ b/res/save_files/any/horseback_ganon.bin
Binary files differ
diff --git a/res/save_files/any/hugo.bin b/res/save_files/any/hugo.bin
index e45be2b..fa74ba6 100644
--- a/res/save_files/any/hugo.bin
+++ b/res/save_files/any/hugo.bin
Binary files differ
diff --git a/res/save_files/any/iza.bin b/res/save_files/any/iza.bin
index 5b41764..13a30ab 100644
--- a/res/save_files/any/iza.bin
+++ b/res/save_files/any/iza.bin
Binary files differ
diff --git a/res/save_files/any/karg.bin b/res/save_files/any/karg.bin
index be4ef4f..a598cec 100644
--- a/res/save_files/any/karg.bin
+++ b/res/save_files/any/karg.bin
Binary files differ
diff --git a/res/save_files/any/lakebed_1.bin b/res/save_files/any/lakebed_1.bin
index c280322..619f34c 100644
--- a/res/save_files/any/lakebed_1.bin
+++ b/res/save_files/any/lakebed_1.bin
Binary files differ
diff --git a/res/save_files/any/lakebed_bk_skip.bin b/res/save_files/any/lakebed_bk_skip.bin
index ddd46a2..1f12414 100644
--- a/res/save_files/any/lakebed_bk_skip.bin
+++ b/res/save_files/any/lakebed_bk_skip.bin
Binary files differ
diff --git a/res/save_files/any/lanayru_gate_clip.bin b/res/save_files/any/lanayru_gate_clip.bin
index b6bec9c..cd9c0df 100644
--- a/res/save_files/any/lanayru_gate_clip.bin
+++ b/res/save_files/any/lanayru_gate_clip.bin
Binary files differ
diff --git a/res/save_files/any/lanayru_twilight.bin b/res/save_files/any/lanayru_twilight.bin
index bea87ce..44e6880 100644
--- a/res/save_files/any/lanayru_twilight.bin
+++ b/res/save_files/any/lanayru_twilight.bin
Binary files differ
diff --git a/res/save_files/any/lakebed_2.bin b/res/save_files/any/mdh.bin
index b1bb2c0..c45a960 100644
--- a/res/save_files/any/lakebed_2.bin
+++ b/res/save_files/any/mdh.bin
Binary files differ
diff --git a/res/save_files/any/mdh_bridge.bin b/res/save_files/any/mdh_bridge.bin
index 4f1725f..7ae7076 100644
--- a/res/save_files/any/mdh_bridge.bin
+++ b/res/save_files/any/mdh_bridge.bin
Binary files differ
diff --git a/res/save_files/any/mdh_tower.bin b/res/save_files/any/mdh_tower.bin
index 110e8f7..f12babd 100644
--- a/res/save_files/any/mdh_tower.bin
+++ b/res/save_files/any/mdh_tower.bin
Binary files differ
diff --git a/res/save_files/any/norgor.bin b/res/save_files/any/norgor.bin
index 3ff6aa8..d1b1bf7 100644
--- a/res/save_files/any/norgor.bin
+++ b/res/save_files/any/norgor.bin
Binary files differ
diff --git a/res/save_files/any/onebomb.bin b/res/save_files/any/onebomb.bin
index e0e8a9d..fb0c464 100644
--- a/res/save_files/any/onebomb.bin
+++ b/res/save_files/any/onebomb.bin
Binary files differ
diff --git a/res/save_files/any/ordon_gate_clip.bin b/res/save_files/any/ordon_gate_clip.bin
index ad0c2d8..811f51b 100644
--- a/res/save_files/any/ordon_gate_clip.bin
+++ b/res/save_files/any/ordon_gate_clip.bin
Binary files differ
diff --git a/res/save_files/any/palace_1.bin b/res/save_files/any/palace_1.bin
index 1859843..09d08dc 100644
--- a/res/save_files/any/palace_1.bin
+++ b/res/save_files/any/palace_1.bin
Binary files differ
diff --git a/res/save_files/any/palace_2.bin b/res/save_files/any/palace_2.bin
index fff2c50..1ae9439 100644
--- a/res/save_files/any/palace_2.bin
+++ b/res/save_files/any/palace_2.bin
Binary files differ
diff --git a/res/save_files/any/pillar_clip.bin b/res/save_files/any/pillar_clip.bin
index e8e579c..10901d1 100644
--- a/res/save_files/any/pillar_clip.bin
+++ b/res/save_files/any/pillar_clip.bin
Binary files differ
diff --git a/res/save_files/any/poe_1_skip.bin b/res/save_files/any/poe_1_skip.bin
index a6fd6c8..7986738 100644
--- a/res/save_files/any/poe_1_skip.bin
+++ b/res/save_files/any/poe_1_skip.bin
Binary files differ
diff --git a/res/save_files/any/purple_mist.bin b/res/save_files/any/purple_mist.bin
index ff36aaa..0c50742 100644
--- a/res/save_files/any/purple_mist.bin
+++ b/res/save_files/any/purple_mist.bin
Binary files differ
diff --git a/res/save_files/ad/karg_flight.bin b/res/save_files/any/rupee_roll.bin
index 0b49fad..5330a81 100644
--- a/res/save_files/ad/karg_flight.bin
+++ b/res/save_files/any/rupee_roll.bin
Binary files differ
diff --git a/res/save_files/any/spr.bin b/res/save_files/any/spr.bin
index db4b5d6..edd6038 100644
--- a/res/save_files/any/spr.bin
+++ b/res/save_files/any/spr.bin
Binary files differ
diff --git a/res/save_files/any/spr_warp.bin b/res/save_files/any/spr_warp.bin
index 1741db8..0b09594 100644
--- a/res/save_files/any/spr_warp.bin
+++ b/res/save_files/any/spr_warp.bin
Binary files differ
diff --git a/res/save_files/any/stallord.bin b/res/save_files/any/stallord.bin
index 2e4c423..24d3b80 100644
--- a/res/save_files/any/stallord.bin
+++ b/res/save_files/any/stallord.bin
Binary files differ
diff --git a/res/save_files/any/waterfall_sidehop.bin b/res/save_files/any/waterfall_sidehop.bin
index a9a4a18..09624f6 100644
--- a/res/save_files/any/waterfall_sidehop.bin
+++ b/res/save_files/any/waterfall_sidehop.bin
Binary files differ
diff --git a/res/save_files/any/zant.bin b/res/save_files/any/zant.bin
index a7f5687..a3580e8 100644
--- a/res/save_files/any/zant.bin
+++ b/res/save_files/any/zant.bin
Binary files differ
diff --git a/res/tex/framePause.tex b/res/tex/framePause.tex
new file mode 100644
index 0000000..12c8c13
--- /dev/null
+++ b/res/tex/framePause.tex
Binary files differ
diff --git a/res/tex/framePause_16.png b/res/tex/framePause_16.png
new file mode 100644
index 0000000..2615e52
--- /dev/null
+++ b/res/tex/framePause_16.png
Binary files differ
diff --git a/res/tex/framePlay.tex b/res/tex/framePlay.tex
new file mode 100644
index 0000000..172cac0
--- /dev/null
+++ b/res/tex/framePlay.tex
Binary files differ
diff --git a/res/tex/playFrame_16.png b/res/tex/playFrame_16.png
new file mode 100644
index 0000000..28cb21b
--- /dev/null
+++ b/res/tex/playFrame_16.png
Binary files differ
diff --git a/src/actor.cpp b/src/actor.cpp
deleted file mode 100644
index 5bc61d2..0000000
--- a/src/actor.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "actor.h"
-#include "libtp_c/include/msl_c/string.h"
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-
-namespace Actor {
-bool freeze_run_once;
-bool hide_run_once;
-
-void freeze_actors() {
- freeze_run_once = true;
- g_dComIfAc_gameInfo.freeze = true;
-}
-
-void unfreeze_actors() {
- if (freeze_run_once) {
- g_dComIfAc_gameInfo.freeze = false;
- freeze_run_once = false;
- }
-}
-
-void hide_actors() {
- hide_run_once = true;
- fopAc_ac_c__stopStatus |= 0x100;
-}
-
-void show_actors() {
- if (hide_run_once) {
- fopAc_ac_c__stopStatus &= ~0x100;
- hide_run_once = false;
- }
-}
-
-} // namespace Actor
diff --git a/src/bit.cpp b/src/bit.cpp
index 1b63ab9..4e10de0 100644
--- a/src/bit.cpp
+++ b/src/bit.cpp
@@ -19,27 +19,21 @@
#define BOOTS_TERM_VEL -300.0
#define TARGET_FRAME 28
-#define LAST_Y_GROUND_POS (*(float*)(tp_zelAudio.link_debug_ptr + 0x2f3c))
-
-bool inject_bit_flag = false;
-extern Font font;
-
-namespace BiTIndicator {
-using namespace Controller;
+#define LAST_Y_GROUND_POS (*(float*)(dComIfGp_getPlayer() + 0x2f3c))
static char buf[30];
-void set_camera_angle_position() {
+void BiTIndicator::setPosition() {
dComIfGp_getPlayer()->mCurrent.mPosition = (cXyz){466.622467f, 319.770752f, -11651.3867f};
dComIfGp_getPlayer()->mCollisionRot.mY = 32000;
tp_matrixInfo.matrix_info->target = {465.674622f, 421.052704f, -11651.0684f};
tp_matrixInfo.matrix_info->pos = {735.525391f, 524.418701f, -11576.4746f};
}
-void run() {
+void BiTIndicator::execute() {
double dt = 0;
- if (dComIfGp_getPlayer() && tp_zelAudio.link_debug_ptr) {
+ if (dComIfGp_getPlayer()) {
const bool has_boots = (dComIfGp_getPlayer()->mNoResetFlg0 & 0x02) != 0;
const double term_vel = has_boots ? BOOTS_TERM_VEL : NORMAL_TERM_VEL;
const double acc = has_boots ? BOOTS_ACC : NORMAL_ACC;
@@ -74,7 +68,8 @@ void run() {
if (tp_strcmp((const char*)g_dComIfG_gameInfo.info.getPlayer().mPlayerReturnPlace.mName,
"F_SP104") == 0 &&
- button_is_down(HOME) && tp_homeMenuSts.is_visible == 0 && !tp_fopScnRq.isLoading) {
+ GZ_getButtonPressed(GZPad::HOME) && tp_homeMenuSts.is_visible == 0 &&
+ !tp_fopScnRq.isLoading) {
if ((int)dt == TARGET_FRAME) {
tp_sprintf(buf, "Got it");
}
@@ -88,5 +83,4 @@ void run() {
}
}
}
-} // namespace BiTIndicator
#endif \ No newline at end of file
diff --git a/src/commands.cpp b/src/commands.cpp
index 6ff71d8..98fac9a 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -17,71 +17,82 @@
#include "libtp_c/include/f_op/f_op_draw_tag.h"
#include "timer.h"
#include "utils/loading.h"
-
-using namespace Controller;
+#include "gz_flags.h"
bool reload_area_flag = false;
-bool timer_started = false;
-bool reset_timer = false;
+bool g_timerEnabled = false;
+bool g_resetTimer = false;
+
+bool g_commandStates[COMMANDS_AMNT];
+
+static Vec sSavePlayerPos = {0.0f, 0.0f, 0.0f};
+static int16_t sSavePlayerAngle = 0;
+static Vec sSaveCamPos = {0.0f, 0.0f, 0.0f};
+static Vec sSaveCamTarget = {0.0f, 0.0f, 0.0f};
-bool commands_states[COMMANDS_AMNT];
+static int sLastInputs;
+static int sCurInputs;
-namespace Commands {
-static cXyz saved_player_pos(0.0f, 0.0f, 0.0f);
-static uint16_t saved_angle = 0;
+bool GZCmd_checkTrig(int combo) {
+ if (sCurInputs == combo && sLastInputs != combo) {
+ return true;
+ }
+ return false;
+}
-static Vec saved_pos = {0.0f, 0.0f, 0.0f};
-static Vec saved_target = {0.0f, 0.0f, 0.0f};
-static int button_last_frame;
-static int button_this_frame;
+void GZCmd_pauseFrame() {
+ if (GZCmd_checkTrig(FRAME_PAUSE_BUTTONS)) {
+ g_framePaused = !g_framePaused;
+ }
+}
-void store_position() {
+void GZCmd_storePosition() {
if (dComIfGp_getPlayer()) {
- saved_player_pos = dComIfGp_getPlayer()->mCurrent.mPosition;
- saved_angle = dComIfGp_getPlayer()->mCollisionRot.mY;
+ sSavePlayerPos = dComIfGp_getPlayer()->mCurrent.mPosition;
+ sSavePlayerAngle = dComIfGp_getPlayer()->mCollisionRot.mY;
}
if (tp_matrixInfo.matrix_info) {
- saved_pos = tp_matrixInfo.matrix_info->pos;
- saved_target = tp_matrixInfo.matrix_info->target;
+ sSaveCamPos = tp_matrixInfo.matrix_info->pos;
+ sSaveCamTarget = tp_matrixInfo.matrix_info->target;
}
}
-void load_position() {
+void GZCmd_loadPosition() {
if (dComIfGp_getPlayer()) {
- dComIfGp_getPlayer()->mCurrent.mPosition = saved_player_pos;
- dComIfGp_getPlayer()->mCollisionRot.mY = saved_angle;
+ dComIfGp_getPlayer()->mCurrent.mPosition = sSavePlayerPos;
+ dComIfGp_getPlayer()->mCollisionRot.mY = sSavePlayerAngle;
}
if (tp_matrixInfo.matrix_info) {
- tp_matrixInfo.matrix_info->pos = saved_pos;
- tp_matrixInfo.matrix_info->target = saved_target;
+ tp_matrixInfo.matrix_info->pos = sSaveCamPos;
+ tp_matrixInfo.matrix_info->target = sSaveCamTarget;
}
}
-void moon_jump() {
+void GZCmd_moonJump() {
if (dComIfGp_getPlayer()) {
dComIfGp_getPlayer()->mSpeed.y = 56.0f;
- };
-};
+ }
+}
-void toggle_timer() {
- if (button_this_frame == TIMER_TOGGLE_BUTTONS && button_last_frame != TIMER_TOGGLE_BUTTONS) {
- timer_started = !timer_started;
- };
+void GZCmd_toggleTimer() {
+ if (GZCmd_checkTrig(TIMER_TOGGLE_BUTTONS)) {
+ g_timerEnabled = !g_timerEnabled;
+ }
}
-void hit_reset() {
- reset_timer = true;
+void GZCmd_resetTimer() {
+ g_resetTimer = true;
}
-void reload_area() {
- inject_save_flag = true;
- if (g_area_reload_behavior == LOAD_AREA) {
- tp_memcpy(
- &g_dComIfG_gameInfo.info.mMemory, gSaveManager.mAreaReloadOpts.temp_flags,
- sizeof(
- gSaveManager.mAreaReloadOpts.temp_flags)); // restore last set of saved temp flags
+void GZCmd_reloadArea() {
+ g_injectSave = true;
+
+ if (g_reloadType == LOAD_AREA) {
+ // restore last set of saved temp flags
+ tp_memcpy(&g_dComIfG_gameInfo.info.mMemory, gSaveManager.mAreaReloadOpts.temp_flags,
+ sizeof(gSaveManager.mAreaReloadOpts.temp_flags));
// restore last tear count
for (int i = 0; i < 4; i++) {
@@ -89,95 +100,87 @@ void reload_area() {
}
gSaveManager.mPracticeFileOpts.inject_options_before_load =
- SaveManager::inject_default_before;
+ SaveManager::injectDefault_before;
gSaveManager.mPracticeFileOpts.inject_options_during_load = nullptr;
gSaveManager.mPracticeFileOpts.inject_options_after_load = nullptr;
} else {
- SaveManager::load_save(last_save_index, last_category, last_special_ptr, 0xFF);
+ SaveManager::loadSave(last_save_index, last_category, last_special_ptr, 0xFF);
}
-} // namespace Commands
+}
-void gorge_void() {
- if (button_this_frame == GORGE_VOID_BUTTONS && button_last_frame != GORGE_VOID_BUTTONS) {
- SaveManager::load_save_file("tpgz/save_files/any/gorge_void.bin");
+void GZCmd_loadGorgeVoid() {
+ if (GZCmd_checkTrig(GORGE_VOID_BUTTONS)) {
+ SaveManager::loadSavefile("tpgz/save_files/any/gorge_void.bin");
gSaveManager.mPracticeFileOpts.inject_options_before_load =
- SaveManager::inject_default_before;
+ SaveManager::injectDefault_before;
gSaveManager.mPracticeFileOpts.inject_options_during_load =
- GorgeVoidIndicator::warp_to_gorge;
- gSaveManager.mPracticeFileOpts.inject_options_after_load =
- GorgeVoidIndicator::prep_rupee_roll;
- inject_save_flag = true;
+ GorgeVoidIndicator::warpToPosition;
+ gSaveManager.mPracticeFileOpts.inject_options_after_load = GorgeVoidIndicator::initState;
+ g_injectSave = true;
}
}
#ifdef WII_PLATFORM
-void back_in_time() {
- if (button_this_frame == BACK_IN_TIME_BUTTONS && button_last_frame != BACK_IN_TIME_BUTTONS) {
- SaveManager::load_save_file("tpgz/save_files/any/ordon_gate_clip.bin");
+void GZCmd_bitPractice() {
+ if (GZCmd_checkTrig(BACK_IN_TIME_BUTTONS)) {
+ SaveManager::loadSavefile("tpgz/save_files/any/ordon_gate_clip.bin");
gSaveManager.mPracticeFileOpts.inject_options_before_load =
- gSaveManager.inject_default_before;
+ SaveManager::injectDefault_before;
gSaveManager.mPracticeFileOpts.inject_options_during_load =
- gSaveManager.inject_default_during;
- gSaveManager.mPracticeFileOpts.inject_options_after_load =
- BiTIndicator::set_camera_angle_position;
+ SaveManager::injectDefault_during;
+ gSaveManager.mPracticeFileOpts.inject_options_after_load = BiTIndicator::setPosition;
gSaveManager.mPracticeFileOpts.inject_options_after_counter = 10;
- inject_save_flag = true;
+ g_injectSave = true;
}
}
#endif
-void toggle_free_cam() {
- if (button_this_frame == FREE_CAM_BUTTONS && button_last_frame != FREE_CAM_BUTTONS) {
- free_cam_active = !free_cam_active;
+void GZCmd_toggleFreeCam() {
+ if (GZCmd_checkTrig(FREE_CAM_BUTTONS)) {
+ g_freeCamEnabled = !g_freeCamEnabled;
}
}
-void toggle_move_link() {
- if (button_this_frame == MOVE_LINK_BUTTONS && button_last_frame != MOVE_LINK_BUTTONS) {
- move_link_active = !move_link_active;
+void GZCmd_toggleMoveLink() {
+ if (GZCmd_checkTrig(MOVE_LINK_BUTTONS)) {
+ g_moveLinkEnabled = !g_moveLinkEnabled;
}
}
-struct Command {
- bool& active;
- uint16_t buttons;
- void (*command)();
-};
-
-static Command Commands[COMMANDS_AMNT] = {
- {commands_states[CMD_STORE_POSITION], STORE_POSITION_BUTTONS, store_position},
- {commands_states[CMD_LOAD_POSITION], LOAD_POSITION_BUTTONS, load_position},
- {commands_states[CMD_MOON_JUMP], MOON_JUMP_BUTTONS, moon_jump},
- {commands_states[CMD_RELOAD_AREA], RELOAD_AREA_BUTTONS, reload_area},
- {commands_states[CMD_TIMER_TOGGLE], TIMER_TOGGLE_BUTTONS, toggle_timer},
- {commands_states[CMD_TIMER_RESET], TIMER_RESET_BUTTONS, hit_reset},
- {commands_states[CMD_GORGE_VOID], GORGE_VOID_BUTTONS, gorge_void},
+static Command sCommands[COMMANDS_AMNT] = {
+ {g_commandStates[CMD_STORE_POSITION], STORE_POSITION_BUTTONS, GZCmd_storePosition},
+ {g_commandStates[CMD_LOAD_POSITION], LOAD_POSITION_BUTTONS, GZCmd_loadPosition},
+ {g_commandStates[CMD_MOON_JUMP], MOON_JUMP_BUTTONS, GZCmd_moonJump},
+ {g_commandStates[CMD_RELOAD_AREA], RELOAD_AREA_BUTTONS, GZCmd_reloadArea},
+ {g_commandStates[CMD_TIMER_TOGGLE], TIMER_TOGGLE_BUTTONS, GZCmd_toggleTimer},
+ {g_commandStates[CMD_TIMER_RESET], TIMER_RESET_BUTTONS, GZCmd_resetTimer},
+ {g_commandStates[CMD_GORGE_VOID], GORGE_VOID_BUTTONS, GZCmd_loadGorgeVoid},
#ifdef WII_PLATFORM
- {commands_states[CMD_BIT], BACK_IN_TIME_BUTTONS, back_in_time},
+ {g_commandStates[CMD_BIT], BACK_IN_TIME_BUTTONS, GZCmd_bitPractice},
#endif
- {commands_states[CMD_FREE_CAM], FREE_CAM_BUTTONS, toggle_free_cam},
- {commands_states[CMD_MOVE_LINK], MOVE_LINK_BUTTONS, toggle_move_link}};
-
-void process_inputs() {
- button_this_frame = Controller::get_current_inputs();
- for (auto c : Commands) {
- if (c.active == true && Controller::get_current_inputs() == c.buttons) {
- c.command();
- set_buttons_down(0x0);
- set_buttons_pressed(0x0);
- tp_mPadButton.sval = 0x0;
- tp_mPadStatus.sval = 0x0;
- };
- };
- button_last_frame = button_this_frame;
+ {g_commandStates[CMD_FREE_CAM], FREE_CAM_BUTTONS, GZCmd_toggleFreeCam},
+ {g_commandStates[CMD_MOVE_LINK], MOVE_LINK_BUTTONS, GZCmd_toggleMoveLink},
+ {g_commandStates[CMD_FRAME_PAUSE], FRAME_PAUSE_BUTTONS, GZCmd_pauseFrame},
};
-void enable_command(int idx) {
- Commands[idx].active = true;
+void GZCmd_processInputs() {
+ sCurInputs = GZ_getButtonStatus();
+ for (auto c : sCommands) {
+ if (c.active && GZ_getButtonStatus() == c.buttons) {
+ c.command();
+ setGamepadButtons(0x0);
+ setGamepadTrig(0x0);
+ tp_mPadButton.mRepeat = 0x0;
+ tp_mPadStatus.button = 0x0;
+ }
+ }
+ sLastInputs = sCurInputs;
}
-void disable_command(int idx) {
- Commands[idx].active = false;
+void GZCmd_enable(int idx) {
+ sCommands[idx].active = true;
}
-} // namespace Commands \ No newline at end of file
+void GZCmd_disable(int idx) {
+ sCommands[idx].active = false;
+} \ No newline at end of file
diff --git a/src/controller.cpp b/src/controller.cpp
index f7bcb5a..679cb2a 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -6,6 +6,7 @@
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#include "menu.h"
+#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
#ifdef GCN_PLATFORM
#define BUTTON_STATES 12
@@ -17,27 +18,22 @@
#define REPEAT_DELAY 5
#ifdef GCN_PLATFORM
-#define buttons_down (tp_mPadStatus.sval)
-#define A_BUTTON (Controller::Pad::A)
-#define ITEM_WHEEL_BUTTON (Controller::Pad::DPAD_DOWN)
-#define TRIGGER_BUTTONS (Controller::Pad::L | Controller::Pad::R)
+#define buttonStatus (tp_mPadStatus.button)
+#define A_BUTTON (CButton::A)
+#define ITEM_WHEEL_BUTTON (CButton::DPAD_DOWN)
+#define TRIGGER_BUTTONS (CButton::L | CButton::R)
#endif
#ifdef WII_PLATFORM
-#define buttons_down (tp_mPad.buttons)
-#define A_BUTTON (Controller::Mote::A)
-#define ITEM_WHEEL_BUTTON (Controller::Mote::MINUS)
-#define TRIGGER_BUTTONS (Controller::Mote::Z | Controller::Mote::C)
+#define buttonStatus (tp_mPad.mHoldButton)
+#define A_BUTTON (GZPad::A)
+#define ITEM_WHEEL_BUTTON (GZPad::MINUS)
+#define TRIGGER_BUTTONS (GZPad::Z | GZPad::C)
#endif
-static uint16_t sButtons_down_last_frame = 0;
-static uint16_t sButtons_down = 0;
-static uint16_t sButtons_pressed = 0;
-bool a_held = true;
-bool a_held_last_frame = true;
-uint16_t current_input = 0x0000;
-
-bool can_move_cursor = false;
-static uint16_t sNum_frames_cursor_buffer = 0;
+static uint16_t sButtonsLastFrame = 0;
+static uint16_t sButtons = 0;
+static uint16_t sButtonsPressed = 0;
+static uint16_t sCursorEnableDelay = 0;
struct ButtonState {
uint16_t button;
@@ -46,112 +42,107 @@ struct ButtonState {
};
#ifdef GCN_PLATFORM
-static ButtonState buttonStates[BUTTON_STATES] = {{Controller::Pad::DPAD_LEFT, 0xFFFFFFFF, false},
- {Controller::Pad::DPAD_RIGHT, 0xFFFFFFFF, false},
- {Controller::Pad::DPAD_DOWN, 0xFFFFFFFF, false},
- {Controller::Pad::DPAD_UP, 0xFFFFFFFF, false},
- {Controller::Pad::Z, 0xFFFFFFFF, false},
- {Controller::Pad::R, 0xFFFFFFFF, false},
- {Controller::Pad::L, 0xFFFFFFFF, false},
- {Controller::Pad::A, 0xFFFFFFFF, false},
- {Controller::Pad::B, 0xFFFFFFFF, false},
- {Controller::Pad::X, 0xFFFFFFFF, false},
- {Controller::Pad::Y, 0xFFFFFFFF, false},
- {Controller::Pad::START, 0xFFFFFFFF, false}};
+static ButtonState buttonStates[BUTTON_STATES] = {
+ {CButton::DPAD_LEFT, 0xFFFFFFFF, false}, {CButton::DPAD_RIGHT, 0xFFFFFFFF, false},
+ {CButton::DPAD_DOWN, 0xFFFFFFFF, false}, {CButton::DPAD_UP, 0xFFFFFFFF, false},
+ {CButton::Z, 0xFFFFFFFF, false}, {CButton::R, 0xFFFFFFFF, false},
+ {CButton::L, 0xFFFFFFFF, false}, {CButton::A, 0xFFFFFFFF, false},
+ {CButton::B, 0xFFFFFFFF, false}, {CButton::X, 0xFFFFFFFF, false},
+ {CButton::Y, 0xFFFFFFFF, false}, {CButton::START, 0xFFFFFFFF, false},
+};
#endif
#ifdef WII_PLATFORM
-static ButtonState buttonStates[BUTTON_STATES] = {{Controller::Mote::DPAD_LEFT, 0xFFFFFFFF, false},
- {Controller::Mote::DPAD_RIGHT, 0xFFFFFFFF, false},
- {Controller::Mote::DPAD_DOWN, 0xFFFFFFFF, false},
- {Controller::Mote::DPAD_UP, 0xFFFFFFFF, false},
- {Controller::Mote::PLUS, 0xFFFFFFFF, false},
- {Controller::Mote::TWO, 0xFFFFFFFF, false},
- {Controller::Mote::ONE, 0xFFFFFFFF, false},
- {Controller::Mote::B, 0xFFFFFFFF, false},
- {Controller::Mote::A, 0xFFFFFFFF, false},
- {Controller::Mote::MINUS, 0xFFFFFFFF, false},
- {Controller::Mote::Z, 0xFFFFFFFF, false},
- {Controller::Mote::C, 0xFFFFFFFF, false},
- {Controller::Mote::HOME, 0xFFFFFFFF, false}};
+static ButtonState buttonStates[BUTTON_STATES] = {
+ {GZPad::DPAD_LEFT, 0xFFFFFFFF, false}, {GZPad::DPAD_RIGHT, 0xFFFFFFFF, false},
+ {GZPad::DPAD_DOWN, 0xFFFFFFFF, false}, {GZPad::DPAD_UP, 0xFFFFFFFF, false},
+ {GZPad::PLUS, 0xFFFFFFFF, false}, {GZPad::TWO, 0xFFFFFFFF, false},
+ {GZPad::ONE, 0xFFFFFFFF, false}, {GZPad::B, 0xFFFFFFFF, false},
+ {GZPad::A, 0xFFFFFFFF, false}, {GZPad::MINUS, 0xFFFFFFFF, false},
+ {GZPad::Z, 0xFFFFFFFF, false}, {GZPad::C, 0xFFFFFFFF, false},
+ {GZPad::HOME, 0xFFFFFFFF, false},
+};
#endif
-namespace Controller {
+void GZ_readController() {
+ sButtonsLastFrame = sButtons;
+ sButtons = buttonStatus;
+ sButtonsPressed = sButtons & (0xFFFF ^ sButtonsLastFrame);
-void read_controller() {
- sButtons_down_last_frame = sButtons_down;
- sButtons_down = buttons_down;
- sButtons_pressed = sButtons_down & (0xFFFF ^ sButtons_down_last_frame);
-
- uint8_t idx = 0;
- for (; idx < BUTTON_STATES; idx++) {
- buttonStates[idx].is_down = (buttonStates[idx].button & sButtons_down) != 0;
- if ((buttonStates[idx].button & sButtons_pressed) != 0) {
+ for (uint8_t idx = 0; idx < BUTTON_STATES; idx++) {
+ buttonStates[idx].is_down = (buttonStates[idx].button & sButtons) != 0;
+ if ((buttonStates[idx].button & sButtonsPressed) != 0) {
buttonStates[idx].pressed_frame = cCt_getFrameCount() + 1;
}
}
- Cheats::apply_cheats();
- if (MenuRendering::is_menu_open() == true) {
- current_input = Controller::get_current_inputs();
- a_held = a_held_last_frame && current_input == A_BUTTON;
- a_held_last_frame = current_input == A_BUTTON;
+ GZ_applyCheats();
+ if (GZ_checkMenuOpen() == true) {
+ uint16_t current_input = GZ_getButtonStatus();
#ifdef GCN_PLATFORM
// prevent accidentally moving cursor down when opening menu
- if (!can_move_cursor) {
- if (current_input & Controller::Pad::DPAD_UP) {
- can_move_cursor = true;
- } else if (current_input & (Controller::Pad::L | Controller::Pad::R)) {
- sNum_frames_cursor_buffer = 0;
- } else if (sNum_frames_cursor_buffer < 1) {
- sNum_frames_cursor_buffer = 1;
+ if (!g_cursorEnabled) {
+ if (current_input & CButton::DPAD_UP) {
+ g_cursorEnabled = true;
+ } else if (current_input & (CButton::L | CButton::R)) {
+ sCursorEnableDelay = 0;
+ } else if (sCursorEnableDelay < 1) {
+ sCursorEnableDelay = 1;
}
- if (sNum_frames_cursor_buffer >= 4) {
- can_move_cursor = true;
- } else if (sNum_frames_cursor_buffer > 0) {
- sNum_frames_cursor_buffer++;
+ if (sCursorEnableDelay >= 4) {
+ g_cursorEnabled = true;
+ } else if (sCursorEnableDelay > 0) {
+ sCursorEnableDelay++;
}
}
#else
- can_move_cursor = true;
+ g_cursorEnabled = true;
#endif
- Controller::set_buttons_down(0x0);
- Controller::set_buttons_pressed(0x0);
+ setGamepadButtons(0);
+ setGamepadTrig(0);
#ifdef GCN_PLATFORM
- buttons_down = 0x0;
- tp_mPadButton.sval = 0x0;
+ buttonStatus = 0x0;
+ tp_mPadButton.mRepeat = 0x0;
#endif
} else {
- can_move_cursor = false;
- sNum_frames_cursor_buffer = 0;
- Commands::process_inputs();
+ g_cursorEnabled = false;
+ sCursorEnableDelay = 0;
+ GZCmd_processInputs();
}
}
-bool button_is_down(int idx) {
+bool GZ_getButtonPressed(int idx) {
return buttonStates[idx].is_down;
}
-bool button_is_pressed(int idx, uint16_t repeat_time) {
+bool GZ_getButtonRepeat(int idx, uint16_t repeat_time) {
auto delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame;
auto just_clicked = delta == 0;
auto held_down_long_enough = delta > REPEAT_DELAY;
auto is_repeat_frame = held_down_long_enough && delta % repeat_time == 0;
- auto down = button_is_down(idx);
+ auto down = GZ_getButtonPressed(idx);
return down && (just_clicked || is_repeat_frame);
}
-bool button_is_pressed(int idx) {
- return button_is_pressed(idx, REPEAT_TIME);
+bool GZ_getButtonRepeat(int idx) {
+ return GZ_getButtonRepeat(idx, REPEAT_TIME);
+}
+
+uint16_t GZ_getButtonStatus() {
+ return buttonStatus;
}
-uint16_t get_current_inputs() {
- return buttons_down;
+bool GZ_getButtonTrig(int idx) {
+ auto delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame;
+ auto just_clicked = delta == 0;
+
+ auto down = GZ_getButtonPressed(idx);
+ return down && just_clicked;
}
-bool button_is_held(int idx, int phase) {
+bool GZ_getButtonHold(int idx, int phase) {
uint32_t delta;
if (phase == POST_GAME_LOOP) {
delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame;
@@ -164,5 +155,4 @@ bool button_is_held(int idx, int phase) {
} else {
return false;
}
-}
-} // namespace Controller \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/corotdcheck.cpp b/src/corotdcheck.cpp
index 32847cf..b7a9130 100644
--- a/src/corotdcheck.cpp
+++ b/src/corotdcheck.cpp
@@ -1,80 +1,63 @@
#include "corotdcheck.h"
#include "controller.h"
#include "fifo_queue.h"
-#include "fs.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
#ifdef GCN_PLATFORM
-#define ITEM_BUTTON_HELD_CHECK (!button_is_held(Pad::Y) || !button_is_held(Pad::X))
-#define ITEM_BUTTON_DOWN_CHECK (button_is_down(Pad::Y) || button_is_down(Pad::X))
+#define ITEM_BUTTON_HELD_CHECK (!GZ_getButtonHold(GZPad::Y) || !GZ_getButtonHold(GZPad::X))
+#define ITEM_BUTTON_DOWN_CHECK (GZ_getButtonPressed(GZPad::Y) || GZ_getButtonPressed(GZPad::X))
#define PAD Pad
#endif // GCN_PLATFORM
#ifdef WII_PLATFORM
#define ITEM_BUTTON_HELD_CHECK \
- (!button_is_held(Mote::B) || !button_is_held(Mote::DPAD_LEFT) || \
- !button_is_held(Mote::DPAD_RIGHT) || !button_is_held(Mote::DPAD_DOWN))
+ (!GZ_getButtonHold(GZPad::B) || !GZ_getButtonHold(GZPad::DPAD_LEFT) || \
+ !GZ_getButtonHold(GZPad::DPAD_RIGHT) || !GZ_getButtonHold(GZPad::DPAD_DOWN))
#define ITEM_BUTTON_DOWN_CHECK \
- (button_is_down(Mote::B) || button_is_down(Mote::DPAD_LEFT) || \
- button_is_down(Mote::DPAD_RIGHT) || button_is_down(Mote::DPAD_DOWN))
+ (GZ_getButtonPressed(GZPad::B) || GZ_getButtonPressed(GZPad::DPAD_LEFT) || \
+ GZ_getButtonPressed(GZPad::DPAD_RIGHT) || GZ_getButtonPressed(GZPad::DPAD_DOWN))
#define PAD Mote
#endif // WII_PLATFORM
-namespace CoroTDChecker {
-using namespace Controller;
+void CoroTDChecker::execute() {
+ static bool sTimerStarted = false;
+ static bool sGoalHit = false;
+ static uint32_t sFrameCount = 0;
-static bool start_timer = false;
-uint32_t current_counter = 0;
-static bool got_it = false;
-static char buf[20];
-
-void run() {
// reset counters on load
- if (tp_fopScnRq.isLoading == 1) {
- current_counter = 0;
- got_it = false;
- start_timer = false;
+ if (tp_fopScnRq.isLoading) {
+ sFrameCount = 0;
+ sGoalHit = false;
+ sTimerStarted = false;
}
- if (start_timer == false && button_is_down(PAD::A) &&
- tp_strcmp((const char*)g_dComIfG_gameInfo.play.mStartStage.mStage, "F_SP108") == 0) {
- start_timer = true;
+ if (!sTimerStarted && GZ_getButtonPressed(GZPad::A) && daAlink_c__checkStageName("F_SP108")) {
+ sTimerStarted = true;
}
- if (start_timer == true) {
- current_counter++;
-
- if (current_counter < 20) {
- // went early
- if (!got_it && ITEM_BUTTON_HELD_CHECK && (current_counter < 10) &&
- ITEM_BUTTON_DOWN_CHECK) {
- int final_val = 10 - current_counter;
- tp_sprintf(buf, "%df early", final_val);
- FIFOQueue::push(buf, Queue, 0x0000FF00);
- }
-
- // got it
- else if (!got_it && ITEM_BUTTON_HELD_CHECK && (current_counter == 10) &&
- ITEM_BUTTON_DOWN_CHECK) {
- FIFOQueue::push("got it", Queue, 0x00CC0000);
- got_it = true;
- }
-
- // went late
- else if (!got_it && ITEM_BUTTON_HELD_CHECK && current_counter > 10 &&
- ITEM_BUTTON_DOWN_CHECK) {
- int final_val = current_counter - 10;
- tp_sprintf(buf, "%df late", final_val);
- FIFOQueue::push(buf, Queue, 0x99000000);
+ if (sTimerStarted) {
+ sFrameCount++;
+
+ if (sFrameCount < 20) {
+ if (!sGoalHit && ITEM_BUTTON_HELD_CHECK && ITEM_BUTTON_DOWN_CHECK) {
+ char buf[20];
+ if (sFrameCount < 10) {
+ tp_sprintf(buf, "%df early", 10 - sFrameCount);
+ FIFOQueue::push(buf, Queue, 0x0000FF00);
+ } else if (sFrameCount == 10) {
+ FIFOQueue::push("got it", Queue, 0x00CC0000);
+ sGoalHit = true;
+ } else if (sFrameCount > 10) {
+ tp_sprintf(buf, "%df late", sFrameCount - 10);
+ FIFOQueue::push(buf, Queue, 0x99000000);
+ }
}
} else {
- current_counter = 0;
- got_it = false;
- start_timer = false;
+ sFrameCount = 0;
+ sGoalHit = false;
+ sTimerStarted = false;
}
}
-}
-} // namespace CoroTDChecker \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/fifo_queue.cpp b/src/fifo_queue.cpp
index c447465..9a54c68 100644
--- a/src/fifo_queue.cpp
+++ b/src/fifo_queue.cpp
@@ -3,7 +3,7 @@
#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
-bool fifo_visible;
+bool g_fifoVisible;
void FIFOQueue::renderItems(_FIFOQueue& Queue) {
for (int i = 0; i < MAX_MESSAGES; i++) {
@@ -18,9 +18,9 @@ void FIFOQueue::renderItems(_FIFOQueue& Queue) {
alpha = Queue.messages[i].ttl * 8.5;
}
color |= alpha;
- if (fifo_visible) {
- Font::renderChars(Queue.messages[i].msg, (sprite_offsets[FIFO_SPR_INDEX].x),
- offset + (sprite_offsets[FIFO_SPR_INDEX].y), color);
+ if (g_fifoVisible) {
+ Font::renderChars(Queue.messages[i].msg, (g_spriteOffsets[FIFO_SPR_INDEX].x),
+ offset + (g_spriteOffsets[FIFO_SPR_INDEX].y), color);
}
}
};
diff --git a/src/font.cpp b/src/font.cpp
index a1d46e1..79c6e28 100644
--- a/src/font.cpp
+++ b/src/font.cpp
@@ -2,10 +2,11 @@
#include "libtp_c/include/msl_c/string.h"
#include "utils/disc.h"
#include "utils/draw.h"
+#include "gz_flags.h"
_Font Font::font;
-FontCode Font::load_font(const char* path) {
+FontCode Font::loadFont(const char* path) {
DVDFileInfo fileInfo;
int32_t readsize;
if (font.loadCode == FontCode::FNT_OK) {
@@ -62,7 +63,7 @@ void Font::free_font() {
}
void PositionedGlyph::render(uint32_t color, Texture* texture) {
- Draw::draw_quad(color, vertices, tex_coords, &texture->_texObj);
+ Draw::drawQuad(color, vertices, tex_coords, &texture->_texObj);
}
PositionedGlyph DecodedGlyph::position(float _x, float _y, float factor) {
@@ -111,22 +112,22 @@ void Font::renderChars(const char* str, float x, float y, uint32_t color, float
}
}
-void Font::gz_renderChar(char c, float x, float y, uint32_t color, bool drop_shadows, float size) {
+void Font::GZ_drawChar(char c, float x, float y, uint32_t color, bool drop_shadows, float size) {
if (drop_shadows) {
renderChar(c, x + 1.0f, y + 1.0f, DROP_SHADOWS_RGBA, size);
}
renderChar(c, x, y, color, size);
}
-void Font::gz_renderChars(const char* str, float x, float y, uint32_t color, bool drop_shadows,
- float size) {
+void Font::GZ_drawStr(const char* str, float x, float y, uint32_t color, bool drop_shadows,
+ float size) {
if (drop_shadows) {
renderChars(str, x + 1.0f, y + 1.0f, DROP_SHADOWS_RGBA, size);
}
renderChars(str, x, y, color, size);
}
-float Font::get_char_width(char c, float size) {
+float Font::getCharWidth(char c, float size) {
DecodedGlyph glyph;
if (lookupGlyph(c, glyph)) {
return glyph.width * size / font.header.base_size;
@@ -135,11 +136,23 @@ float Font::get_char_width(char c, float size) {
}
}
-float Font::get_chars_width(const char* str, float size) {
+float Font::getStrWidth(const char* str, float size) {
int len = tp_strlen(str);
float str_size = 0.f;
for (int i = 0; i < len; i++) {
- str_size += get_char_width(str[i], size);
+ str_size += getCharWidth(str[i], size);
}
return str_size;
+}
+
+// returns the width of the rendered string
+float GZ_drawSelectChar(const char* str, float x, float y, size_t char_idx, size_t max_char,
+ uint32_t color) {
+ float pos = 0.0f;
+ for (size_t i = 0; i <= max_char; ++i) {
+ Font::GZ_drawChar(str[i], x + pos, y, char_idx == i ? CURSOR_RGBA : color,
+ GZ_checkDropShadows());
+ pos += Font::getCharWidth(str[i]);
+ }
+ return pos;
} \ No newline at end of file
diff --git a/src/free_cam.cpp b/src/free_cam.cpp
index ed846ba..5c6c71a 100644
--- a/src/free_cam.cpp
+++ b/src/free_cam.cpp
@@ -4,39 +4,39 @@
#include "menu.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_draw_tag.h"
+#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
#define ROTATION_SPEED (0.002)
#define FREECAM_FAST_SPEED (2.0)
#define FREECAM_SPEED (0.2)
-bool free_cam_active;
+bool g_freeCamEnabled;
bool init_once = false;
double pitch = 0.0;
double yaw = 0.0;
#ifdef GCN_PLATFORM
-#define CONTROL_Y (tp_mPadStatus.control_y)
-#define CONTROL_X (tp_mPadStatus.control_x)
-#define VERTICAL_DISPLACEMENT (tp_mPadStatus.trig_L - tp_mPadStatus.trig_R)
-#define SPEED_PREDICATE (tp_mPadButton.buttons & Controller::Pad::Z)
-#define PITCH_CONTROL (tp_mPadStatus.c_y)
-#define YAW_CONTROL (tp_mPadStatus.c_x)
+#define CONTROL_Y (tp_mPadStatus.stick_y)
+#define CONTROL_X (tp_mPadStatus.stick_x)
+#define VERTICAL_DISPLACEMENT (tp_mPadStatus.trigger_left - tp_mPadStatus.trigger_right)
+#define SPEED_PREDICATE (tp_mPadButton.mButton & CButton::Z)
+#define PITCH_CONTROL (tp_mPadStatus.substick_y)
+#define YAW_CONTROL (tp_mPadStatus.substick_x)
#endif
#ifdef WII_PLATFORM
-#define CONTROL_Y ((tp_mPad.buttons & Controller::Mote::C) == 0 ? tp_mPad.stick.y * 0x48 : 0)
-#define CONTROL_X ((tp_mPad.buttons & Controller::Mote::C) == 0 ? -tp_mPad.stick.x * 0x48 : 0)
+#define CONTROL_Y ((tp_mPad.mHoldButton & GZPad::C) == 0 ? tp_mPad.stick.y * 0x48 : 0)
+#define CONTROL_X ((tp_mPad.mHoldButton & GZPad::C) == 0 ? -tp_mPad.stick.x * 0x48 : 0)
#define VERTICAL_DISPLACEMENT \
- ((tp_mPad.buttons & Controller::Mote::DPAD_UP ? 75 : 0) - \
- (tp_mPad.buttons & Controller::Mote::DPAD_DOWN ? 75 : 0))
-#define SPEED_PREDICATE (tp_mPad.buttons & Controller::Mote::Z)
-#define PITCH_CONTROL ((tp_mPad.buttons & Controller::Mote::C) != 0 ? tp_mPad.stick.y * 0x3B : 0)
-#define YAW_CONTROL ((tp_mPad.buttons & Controller::Mote::C) != 0 ? -tp_mPad.stick.x * 0x3B : 0)
+ ((tp_mPad.mHoldButton & GZPad::DPAD_UP ? 75 : 0) - \
+ (tp_mPad.mHoldButton & GZPad::DPAD_DOWN ? 75 : 0))
+#define SPEED_PREDICATE (tp_mPad.mHoldButton & GZPad::Z)
+#define PITCH_CONTROL ((tp_mPad.mHoldButton & GZPad::C) != 0 ? tp_mPad.stick.y * 0x3B : 0)
+#define YAW_CONTROL ((tp_mPad.mHoldButton & GZPad::C) != 0 ? -tp_mPad.stick.x * 0x3B : 0)
#endif
-namespace FreeCam {
-void handle_free_cam() {
- if (free_cam_active) {
+void FreeCam::execute() {
+ if (g_freeCamEnabled) {
auto& cam_target = tp_matrixInfo.matrix_info->target;
auto& cam_pos = tp_matrixInfo.matrix_info->pos;
// Freeze the game to prevent control stick inputs to move link
@@ -80,5 +80,4 @@ void handle_free_cam() {
init_once = false;
}
}
-}
-} // namespace FreeCam \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/gorge.cpp b/src/gorge.cpp
index 168fd8f..681cad4 100644
--- a/src/gorge.cpp
+++ b/src/gorge.cpp
@@ -17,11 +17,6 @@
#define TARGET_BUTTON L
#endif
-bool inject_gorge_flag = false;
-
-namespace GorgeVoidIndicator {
-using namespace Controller;
-
static bool start_timer = false;
uint32_t previous_counter = 0;
uint32_t current_counter = 0;
@@ -30,13 +25,12 @@ static int after_cs_val = 0;
static bool got_it = false;
static char buf[20];
-void prep_rupee_roll() {
+void GorgeVoidIndicator::initState() {
dComIfGs_onSwitch(21, dComIfGp_getPlayer()->mOrig.mRoomNo);
dComIfGp_getEvent().mOrder[0].mEventId = 9;
- inject_gorge_flag = false;
}
-void warp_to_gorge() {
+void GorgeVoidIndicator::warpToPosition() {
// set gorge map info
g_dComIfG_gameInfo.info.mMemory.mBit.mSwitch[0] = 0; // optimize later
dComIfGs_putSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
@@ -63,7 +57,8 @@ void warp_to_gorge() {
g_dComIfG_gameInfo.info.mRestart.mRoomPos = pos;
g_dComIfG_gameInfo.info.mRestart.mRoomAngleY = 24169;
}
-void run() {
+
+void GorgeVoidIndicator::execute() {
// reset counters on load
if (tp_fopScnRq.isLoading == 1) {
counter_difference = 0;
@@ -93,29 +88,29 @@ void run() {
// only care about 10f before and after
if (counter_difference > 123 && after_cs_val < 10) {
// went early
- if (!got_it && !(button_is_held(TARGET_BUTTON) && button_is_held(A)) &&
+ if (!got_it && !(GZ_getButtonHold(TARGET_BUTTON) && GZ_getButtonHold(A)) &&
(counter_difference < WARP_CS_FRAMES) &&
- (button_is_down(A) && button_is_down(TARGET_BUTTON))) {
+ (GZ_getButtonPressed(A) && GZ_getButtonPressed(TARGET_BUTTON))) {
int final_val = WARP_CS_FRAMES - counter_difference;
tp_sprintf(buf, "%df early", final_val);
FIFOQueue::push(buf, Queue, 0x0000FF00);
}
// got it
- else if (!got_it && !(button_is_held(TARGET_BUTTON) && button_is_held(A)) &&
+ else if (!got_it && !(GZ_getButtonHold(TARGET_BUTTON) && GZ_getButtonHold(A)) &&
(counter_difference == WARP_CS_FRAMES) &&
- (button_is_down(A) && button_is_down(TARGET_BUTTON))) {
+ (GZ_getButtonPressed(A) && GZ_getButtonPressed(TARGET_BUTTON))) {
FIFOQueue::push("got it", Queue, 0x00CC0000);
got_it = true;
}
// went late
- else if (!got_it && !(button_is_held(TARGET_BUTTON) && button_is_held(A)) &&
- after_cs_val > 0 && (button_is_down(A) && button_is_down(TARGET_BUTTON))) {
+ else if (!got_it && !(GZ_getButtonHold(TARGET_BUTTON) && GZ_getButtonHold(A)) &&
+ after_cs_val > 0 &&
+ (GZ_getButtonPressed(A) && GZ_getButtonPressed(TARGET_BUTTON))) {
tp_sprintf(buf, "%df late", after_cs_val);
FIFOQueue::push(buf, Queue, 0x99000000);
}
}
}
-}
-} // namespace GorgeVoidIndicator \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/gz_flags.cpp b/src/gz_flags.cpp
index 606594f..7c037f7 100644
--- a/src/gz_flags.cpp
+++ b/src/gz_flags.cpp
@@ -1,5 +1,4 @@
#include "gz_flags.h"
-#include "actor.h"
#include "fifo_queue.h"
#include "gorge.h"
#include "bit.h"
@@ -7,8 +6,6 @@
#include "menus/settings_menu.h"
#include "menus/tools_menu.h"
#include "rollcheck.h"
-#include "system.h"
-#include "time.h"
#include "utils/audio.h"
#include "utils/lines.h"
#include "utils/link.h"
@@ -18,45 +15,65 @@
#include "menus/memfiles_menu.h"
#include "corotdcheck.h"
#include "umd.h"
+#include "utils/draw.h"
-bool inject_save_flag = false;
+bool g_injectSave = false;
+bool g_framePaused = false;
-GZFlag GZ_Flags[MAX_GZ_FLAGS] = {
- {&ToolItems[Tools::GORGE_INDEX].active, GAME_LOOP, GorgeVoidIndicator::run},
+GZFlag g_gzFlags[MAX_GZ_FLAGS] = {
+ {&g_tools[GORGE_INDEX].active, GAME_LOOP, GorgeVoidIndicator::execute},
#ifdef WII_PLATFORM
- {&ToolItems[Tools::BIT_INDEX].active, GAME_LOOP, BiTIndicator::run},
+ {&g_tools[BIT_INDEX].active, GAME_LOOP, BiTIndicator::execute},
#endif
- {&ToolItems[Tools::ROLL_INDEX].active, GAME_LOOP, RollIndicator::run},
- {&ToolItems[Tools::COROTD_INDEX].active, GAME_LOOP, CoroTDChecker::run},
- {&ToolItems[Tools::UMD_INDEX].active, POST_GAME_LOOP, UMDIndicator::run},
- {&inject_save_flag, GAME_LOOP, SaveManager::trigger_load},
- {&SceneItems[Scene::FREEZE_ACTOR_INDEX].active, GAME_LOOP, Actor::freeze_actors,
- Actor::unfreeze_actors},
- {&SceneItems[Scene::HIDE_ACTOR_INDEX].active, GAME_LOOP, Actor::hide_actors,
- Actor::show_actors},
- {&SceneItems[Scene::FREEZE_CAMERA_INDEX].active, GAME_LOOP, System::lock_camera,
- System::unlock_camera},
- {&SceneItems[Scene::HIDE_HUD_INDEX].active, GAME_LOOP, System::hide_hud, System::show_hud},
- {&SceneItems[Scene::FREEZE_TIME_INDEX].active, GAME_LOOP, Utilities::freeze_time},
- {&g_tunic_color_flag, GAME_LOOP, Utilities::change_tunic_color, Utilities::change_tunic_color},
- {&g_cursor_color_flag, GAME_LOOP, Utilities::change_cursor_color,
- Utilities::change_cursor_color},
- {&SceneItems[Scene::DISABLE_BG_INDEX].active, GAME_LOOP, Utilities::disable_bg_music,
- Utilities::enable_bg_music},
- {&SceneItems[Scene::DISABLE_SFX_INDEX].active, GAME_LOOP, Utilities::disable_sfx,
- Utilities::enable_sfx},
- {&set_position_data, GAME_LOOP, set_memfile_position}};
-
-namespace GZFlags {
-void apply_active_flags(int loop_phase) {
+ {&g_tools[ROLL_INDEX].active, GAME_LOOP, RollIndicator::execute},
+ {&g_tools[COROTD_INDEX].active, GAME_LOOP, CoroTDChecker::execute},
+ {&g_tools[UMD_INDEX].active, POST_GAME_LOOP, UMDIndicator::execute},
+ {&g_injectSave, GAME_LOOP, SaveManager::triggerLoad},
+ {&g_sceneFlags[FREEZE_ACTOR_INDEX].active, GAME_LOOP, GZ_freezeActors, GZ_unfreezeActors},
+ {&g_sceneFlags[HIDE_ACTOR_INDEX].active, GAME_LOOP, GZ_hideActors, GZ_showActors},
+ {&g_sceneFlags[FREEZE_CAMERA_INDEX].active, GAME_LOOP, GZ_freezeCamera, GZ_unfreezeCamera},
+ {&g_sceneFlags[HIDE_HUD_INDEX].active, GAME_LOOP, GZ_hideHUD, GZ_showHUD},
+ {&g_sceneFlags[FREEZE_TIME_INDEX].active, GAME_LOOP, GZ_freezeTime},
+ {&g_sceneFlags[DISABLE_BG_INDEX].active, GAME_LOOP, GZ_disableBGM, GZ_enableBGM},
+ {&g_sceneFlags[DISABLE_SFX_INDEX].active, GAME_LOOP, GZ_disableSFX, GZ_enableSFX},
+ {&g_injectMemfile, GAME_LOOP, GZMemfile_setLinkPosition}};
+
+void GZ_frameAdvance() {
+ sPauseTimer = 1;
+ tp_cPadInfo[0].mPressedButtonFlags = tp_cPadInfo[0].mButtonFlags;
+
+ if (GZ_getButtonTrig(FRAME_ADVANCE_BTN)) {
+ // this sets pause timer to 0 for 1 frame,
+ // which lets 1 frame pass before pausing again
+ sPauseTimer = 0;
+ }
+}
+
+void GZ_drawFrameTex(Texture* pauseTex, Texture* playTex) {
+ if (g_framePaused) {
+ if (sPauseTimer == 1) {
+ Draw::drawRect(0xFFFFFFFF, {550.0f, 5.0f}, {32, 32}, &pauseTex->_texObj);
+ } else {
+ Draw::drawRect(0xFFFFFFFF, {550.0f, 5.0f}, {32, 32}, &playTex->_texObj);
+ }
+ }
+}
+
+void GZ_execute(int phase) {
for (int i = 0; i < MAX_GZ_FLAGS; i++) {
- if (loop_phase == GZ_Flags[i].required_phase) {
- if (*GZ_Flags[i].activation_flag) {
- GZ_Flags[i].flag_active_function();
- } else if (GZ_Flags[i].flag_deactive_function) {
- GZ_Flags[i].flag_deactive_function();
+ if (g_gzFlags[i].mPhase == phase && g_gzFlags[i].mpFlag != nullptr) {
+ if (*g_gzFlags[i].mpFlag && g_gzFlags[i].mpActiveFunc) {
+ g_gzFlags[i].mpActiveFunc();
+ } else if (g_gzFlags[i].mpDeactiveFunc) {
+ g_gzFlags[i].mpDeactiveFunc();
}
}
}
-}
-} // namespace GZFlags \ No newline at end of file
+
+ GZ_setCursorColor();
+ ToolsMenu::setTunicColor();
+
+ if (g_framePaused) {
+ GZ_frameAdvance();
+ }
+} \ No newline at end of file
diff --git a/src/input_viewer.cpp b/src/input_viewer.cpp
index 2aac3b9..89ec0b9 100644
--- a/src/input_viewer.cpp
+++ b/src/input_viewer.cpp
@@ -8,13 +8,11 @@
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
#include "utils/draw.h"
+#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
#define OUTLINE_WIDTH 0x10
-bool iv_visible;
-
-namespace InputViewer {
-void draw_ellipse(uint32_t color, Vec2 center, Vec2 dim) {
+void drawEllipse(uint32_t color, Vec2 center, Vec2 dim) {
constexpr const size_t n_points = 4;
float dx[n_points] = {0};
float dy[n_points] = {0};
@@ -36,7 +34,7 @@ void draw_ellipse(uint32_t color, Vec2 center, Vec2 dim) {
Draw::end();
}
-void draw_ellipse_outline(uint32_t color, Vec2 center, Vec2 dim, uint8_t line_width) {
+void drawEllipseOutline(uint32_t color, Vec2 center, Vec2 dim, uint8_t line_width) {
constexpr const size_t n_points = 4;
float dx[n_points] = {0};
float dy[n_points] = {0};
@@ -60,7 +58,7 @@ void draw_ellipse_outline(uint32_t color, Vec2 center, Vec2 dim, uint8_t line_wi
Draw::end();
}
-void draw_stick(uint32_t color, Vec2 pos, float size) {
+/* void drawStick(uint32_t color, Vec2 pos, float size) {
float s2 = size / 2;
float dx1 = 0;
float dy1 = -1.0f;
@@ -79,9 +77,9 @@ void draw_stick(uint32_t color, Vec2 pos, float size) {
dy2 = tmp;
}
Draw::end();
-}
+} */
-void draw_stick_outline(uint32_t color, Vec2 pos, float size) {
+void drawStickOutline(uint32_t color, Vec2 pos, float size) {
float s2 = size / 2;
float dx1 = 0;
float dy1 = -1.0f;
@@ -103,94 +101,90 @@ void draw_stick_outline(uint32_t color, Vec2 pos, float size) {
Draw::end();
}
-void draw_button(Controller::Button button, char c, uint32_t color, Vec2 pos, Vec2 dim,
- float char_size) {
- bool is_button_down = Controller::button_is_down(button);
- Draw::draw_rect_outline(color, {pos.x, pos.y}, dim, OUTLINE_WIDTH);
+void drawButton(GZPad button, char c, uint32_t color, Vec2 pos, Vec2 dim, float char_size) {
+ bool is_button_down = GZ_getButtonPressed(button);
+ Draw::drawRectOutline(color, {pos.x, pos.y}, dim, OUTLINE_WIDTH);
if (is_button_down) {
- Draw::draw_rect(color, {pos.x, pos.y}, dim);
+ Draw::drawRect(color, {pos.x, pos.y}, dim);
}
- float width = Font::get_char_width(c, char_size);
- Font::gz_renderChar(c, pos.x + (dim.x - width) / 2, pos.y + (dim.y + char_size / 2) / 2,
- is_button_down ? 0x00000060 : color, false, char_size);
+ float width = Font::getCharWidth(c, char_size);
+ Font::GZ_drawChar(c, pos.x + (dim.x - width) / 2, pos.y + (dim.y + char_size / 2) / 2,
+ is_button_down ? 0x00000060 : color, false, char_size);
}
-void draw_button_ellipse(Controller::Button button, char c, uint32_t color, Vec2 pos, Vec2 dim,
- float char_size) {
- bool is_button_down = Controller::button_is_down(button);
- draw_ellipse_outline(color, {pos.x + dim.x / 2, pos.y + dim.y / 2}, dim, OUTLINE_WIDTH);
+void drawButtonEllipse(GZPad button, char c, uint32_t color, Vec2 pos, Vec2 dim, float char_size) {
+ bool is_button_down = GZ_getButtonPressed(button);
+ drawEllipseOutline(color, {pos.x + dim.x / 2, pos.y + dim.y / 2}, dim, OUTLINE_WIDTH);
if (is_button_down) {
- draw_ellipse(color, {pos.x + dim.x / 2, pos.y + dim.y / 2}, dim);
+ drawEllipse(color, {pos.x + dim.x / 2, pos.y + dim.y / 2}, dim);
}
- float width = Font::get_char_width(c, char_size);
- Font::gz_renderChar(c, pos.x + (dim.x - width) / 2, pos.y + (dim.y + char_size / 2) / 2,
- is_button_down ? 0x00000060 : color, false, char_size);
+ float width = Font::getCharWidth(c, char_size);
+ Font::GZ_drawChar(c, pos.x + (dim.x - width) / 2, pos.y + (dim.y + char_size / 2) / 2,
+ is_button_down ? 0x00000060 : color, false, char_size);
}
-void draw_cross(uint32_t color, Vec2 pos, float size) {
+void drawCross(uint32_t color, Vec2 pos, float size) {
float branch_width = 3.f * size / 11.f;
float branch_length = 4.f * size / 11.f;
- draw_button(Controller::DPAD_LEFT, '-', color, {pos.x, pos.y + branch_length},
- {branch_length, branch_width}, 8 * size / 25);
- draw_button(Controller::DPAD_UP, '|', color, {pos.x + branch_length, pos.y},
- {branch_width, branch_length}, 4 * size / 25);
- draw_button(Controller::DPAD_RIGHT, '-', color,
- {pos.x + branch_length + branch_width, pos.y + branch_length},
- {branch_length, branch_width}, 8 * size / 25);
- draw_button(Controller::DPAD_DOWN, '|', color,
- {pos.x + branch_length, pos.y + branch_length + branch_width},
- {branch_width, branch_length}, 4 * size / 25);
+ drawButton(GZPad::DPAD_LEFT, '-', color, {pos.x, pos.y + branch_length},
+ {branch_length, branch_width}, 8 * size / 25);
+ drawButton(GZPad::DPAD_UP, '|', color, {pos.x + branch_length, pos.y},
+ {branch_width, branch_length}, 4 * size / 25);
+ drawButton(GZPad::DPAD_RIGHT, '-', color,
+ {pos.x + branch_length + branch_width, pos.y + branch_length},
+ {branch_length, branch_width}, 8 * size / 25);
+ drawButton(GZPad::DPAD_DOWN, '|', color,
+ {pos.x + branch_length, pos.y + branch_length + branch_width},
+ {branch_width, branch_length}, 4 * size / 25);
}
-void draw_input_viewer(Vec2 pos, float scale, bool is_shadow) {
+void InputViewer::drawViewer(Vec2 pos, float scale, bool is_shadow) {
#ifdef GCN_PLATFORM
- draw_button(Controller::A, 'A', is_shadow ? 0x00000060 : 0x00FF7fFF,
- {pos.x + 130.f * scale, pos.y + 30.f * scale}, {30.f * scale, 30.f * scale},
- 8 * scale);
- draw_button(Controller::B, 'B', is_shadow ? 0x00000060 : 0xFF0000FF,
- {pos.x + 108.5f * scale, pos.y + 45.f * scale}, {13.f * scale, 13.f * scale},
- 8 * scale);
- draw_button(Controller::X, 'X', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 167.5f * scale, pos.y + 30.f * scale}, {15.f * scale, 30.f * scale},
- 8 * scale);
- draw_button(Controller::Y, 'Y', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 130.f * scale, pos.y + 7.5f * scale}, {30.f * scale, 15.f * scale},
- 8 * scale);
- draw_button(Controller::Z, 'Z', is_shadow ? 0x00000060 : 0x8A2BE2FF,
- {pos.x + 167.5f * scale, pos.y + 7.5f * scale}, {15.f * scale, 15.f * scale},
- 8 * scale);
- draw_button(Controller::START, ' ', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 87.5f * scale, pos.y + 40.f * scale}, {10.f * scale, 10.f * scale},
- 8 * scale);
- draw_cross(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 95.f * scale, pos.y + 10.f * scale},
- 25.f * scale);
+ drawButton(GZPad::A, 'A', is_shadow ? 0x00000060 : 0x00FF7fFF,
+ {pos.x + 130.f * scale, pos.y + 30.f * scale}, {30.f * scale, 30.f * scale},
+ 8 * scale);
+ drawButton(GZPad::B, 'B', is_shadow ? 0x00000060 : 0xFF0000FF,
+ {pos.x + 108.5f * scale, pos.y + 45.f * scale}, {13.f * scale, 13.f * scale},
+ 8 * scale);
+ drawButton(GZPad::X, 'X', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 167.5f * scale, pos.y + 30.f * scale}, {15.f * scale, 30.f * scale},
+ 8 * scale);
+ drawButton(GZPad::Y, 'Y', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 130.f * scale, pos.y + 7.5f * scale}, {30.f * scale, 15.f * scale},
+ 8 * scale);
+ drawButton(GZPad::Z, 'Z', is_shadow ? 0x00000060 : 0x8A2BE2FF,
+ {pos.x + 167.5f * scale, pos.y + 7.5f * scale}, {15.f * scale, 15.f * scale},
+ 8 * scale);
+ drawButton(GZPad::START, ' ', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 87.5f * scale, pos.y + 40.f * scale}, {10.f * scale, 10.f * scale},
+ 8 * scale);
+ drawCross(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 95.f * scale, pos.y + 10.f * scale},
+ 25.f * scale);
// analog sticks
- draw_stick_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 17.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
- draw_stick_outline(is_shadow ? 0x00000060 : 0xFFD138FF,
- {pos.x + 62.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
- draw_ellipse(is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + (17.5f + tp_mPadMStick.control_analog.x * 10) * scale,
- pos.y + (30.f - tp_mPadMStick.control_analog.y * 10) * scale},
- {20.0f * scale, 20.0f * scale});
- draw_ellipse(is_shadow ? 0x00000060 : 0xFFD138FF,
- {pos.x + (62.5f + tp_mPadSStick.c_analog.x * 10) * scale,
- pos.y + (30.f - tp_mPadSStick.c_analog.y * 10) * scale},
- {20.0f * scale, 20.0f * scale});
+ drawStickOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 17.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
+ drawStickOutline(is_shadow ? 0x00000060 : 0xFFD138FF,
+ {pos.x + 62.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
+ drawEllipse(is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + (17.5f + tp_mPadMStick.mPosX * 10) * scale,
+ pos.y + (30.f - tp_mPadMStick.mPosY * 10) * scale},
+ {20.0f * scale, 20.0f * scale});
+ drawEllipse(is_shadow ? 0x00000060 : 0xFFD138FF,
+ {pos.x + (62.5f + tp_mPadSStick.mPosX * 10) * scale,
+ pos.y + (30.f - tp_mPadSStick.mPosY * 10) * scale},
+ {20.0f * scale, 20.0f * scale});
// Analog triggers
- Draw::draw_rect_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x, pos.y},
- {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
- Draw::draw_rect(is_shadow ? 0x00000060 :
- Controller::button_is_down(Controller::L) ? 0x00FF00FF : 0xFFFFFFFF,
- {pos.x, pos.y}, {35.f * tp_mPadButton.l_analog * scale, 7.f * scale});
- Draw::draw_rect_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 45.f * scale, pos.y},
- {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
- Draw::draw_rect(is_shadow ? 0x00000060 :
- Controller::button_is_down(Controller::R) ? 0x00FF00FF : 0xFFFFFFFF,
- {pos.x + (45.f + 35.f * (1 - tp_mPadButton.r_analog)) * scale, pos.y},
- {35.f * tp_mPadButton.r_analog * scale, 7.f * scale});
+ Draw::drawRectOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x, pos.y},
+ {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
+ Draw::drawRect(is_shadow ? 0x00000060 : GZ_getButtonPressed(GZPad::L) ? 0x00FF00FF : 0xFFFFFFFF,
+ {pos.x, pos.y}, {35.f * tp_mPadButton.mAnalogLf * scale, 7.f * scale});
+ Draw::drawRectOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 45.f * scale, pos.y},
+ {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
+ Draw::drawRect(is_shadow ? 0x00000060 : GZ_getButtonPressed(GZPad::R) ? 0x00FF00FF : 0xFFFFFFFF,
+ {pos.x + (45.f + 35.f * (1 - tp_mPadButton.mAnalogRf)) * scale, pos.y},
+ {35.f * tp_mPadButton.mAnalogRf * scale, 7.f * scale});
// stick inputs
char control_x[5]; // control stick x
@@ -198,58 +192,58 @@ void draw_input_viewer(Vec2 pos, float scale, bool is_shadow) {
char c_x[5]; // c stick x
char c_y[5]; // c stick y
- tp_sprintf(control_x, "%d", tp_mPadStatus.control_x);
- tp_sprintf(control_y, "%d", tp_mPadStatus.control_y);
- tp_sprintf(c_x, "%d", tp_mPadStatus.c_x);
- tp_sprintf(c_y, "%d", tp_mPadStatus.c_y);
+ tp_sprintf(control_x, "%d", tp_mPadStatus.stick_x);
+ tp_sprintf(control_y, "%d", tp_mPadStatus.stick_y);
+ tp_sprintf(c_x, "%d", tp_mPadStatus.substick_x);
+ tp_sprintf(c_y, "%d", tp_mPadStatus.substick_y);
- Font::gz_renderChars(control_x, pos.x, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 13 * scale);
- Font::gz_renderChars(control_y, pos.x + 23.f * scale, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 13 * scale);
- Font::gz_renderChars(c_x, pos.x + 45.f * scale, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFD138FF, false, 13 * scale);
- Font::gz_renderChars(c_y, pos.x + 70.f * scale, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFD138FF, false, 13 * scale);
+ Font::GZ_drawStr(control_x, pos.x, pos.y + 65.f * scale, is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ false, 13 * scale);
+ Font::GZ_drawStr(control_y, pos.x + 23.f * scale, pos.y + 65.f * scale,
+ is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 13 * scale);
+ Font::GZ_drawStr(c_x, pos.x + 45.f * scale, pos.y + 65.f * scale,
+ is_shadow ? 0x00000060 : 0xFFD138FF, false, 13 * scale);
+ Font::GZ_drawStr(c_y, pos.x + 70.f * scale, pos.y + 65.f * scale,
+ is_shadow ? 0x00000060 : 0xFFD138FF, false, 13 * scale);
#endif
#ifdef WII_PLATFORM
- draw_button_ellipse(Controller::C, 'c', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 42.5f * scale, pos.y + 15.f * scale}, {15.f * scale, 10.f * scale},
- 8 * scale);
- draw_button(Controller::Z, 'Z', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 40.f * scale, pos.y + 30.f * scale}, {20.f * scale, 15.f * scale},
- 8 * scale);
- draw_button_ellipse(Controller::A, 'A', is_shadow ? 0x00000060 : 0xBFBFBFFF,
- {pos.x + 70.f * scale, pos.y + 42.5f * scale}, {15.f * scale, 15.f * scale},
- 8 * scale);
- draw_button(Controller::B, 'B', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 95.f * scale, pos.y + 40.f * scale}, {10.f * scale, 20.f * scale},
- 8 * scale);
- draw_button_ellipse(Controller::MINUS, '-', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 115.f * scale, pos.y + 12.5f * scale},
- {10.f * scale, 10.f * scale}, 8 * scale);
- draw_button_ellipse(Controller::HOME, ' ', is_shadow ? 0x00000060 : 0x00BFFFFF,
- {pos.x + 130.f * scale, pos.y + 12.5f * scale},
- {10.f * scale, 10.f * scale}, 8 * scale);
- draw_button_ellipse(Controller::PLUS, '+', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 145.f * scale, pos.y + 12.5f * scale},
- {10.f * scale, 10.f * scale}, 8 * scale);
- draw_button_ellipse(Controller::ONE, '1', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 127.5f * scale, pos.y + 30.f * scale},
- {15.f * scale, 15.f * scale}, 8 * scale);
- draw_button_ellipse(Controller::TWO, '2', is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 127.5f * scale, pos.y + 50.f * scale},
- {15.f * scale, 15.f * scale}, 8 * scale);
- draw_cross(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 75.f * scale, pos.y + 10.f * scale},
- 25.f * scale);
+ drawButtonEllipse(GZPad::C, 'c', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 42.5f * scale, pos.y + 15.f * scale}, {15.f * scale, 10.f * scale},
+ 8 * scale);
+ drawButton(GZPad::Z, 'Z', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 40.f * scale, pos.y + 30.f * scale}, {20.f * scale, 15.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::A, 'A', is_shadow ? 0x00000060 : 0xBFBFBFFF,
+ {pos.x + 70.f * scale, pos.y + 42.5f * scale}, {15.f * scale, 15.f * scale},
+ 8 * scale);
+ drawButton(GZPad::B, 'B', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 95.f * scale, pos.y + 40.f * scale}, {10.f * scale, 20.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::MINUS, '-', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 115.f * scale, pos.y + 12.5f * scale}, {10.f * scale, 10.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::HOME, ' ', is_shadow ? 0x00000060 : 0x00BFFFFF,
+ {pos.x + 130.f * scale, pos.y + 12.5f * scale}, {10.f * scale, 10.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::PLUS, '+', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 145.f * scale, pos.y + 12.5f * scale}, {10.f * scale, 10.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::ONE, '1', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 127.5f * scale, pos.y + 30.f * scale}, {15.f * scale, 15.f * scale},
+ 8 * scale);
+ drawButtonEllipse(GZPad::TWO, '2', is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 127.5f * scale, pos.y + 50.f * scale}, {15.f * scale, 15.f * scale},
+ 8 * scale);
+ drawCross(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 75.f * scale, pos.y + 10.f * scale},
+ 25.f * scale);
// analog sticks
- draw_stick_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + 17.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
- draw_ellipse(is_shadow ? 0x00000060 : 0xFFFFFFFF,
- {pos.x + (17.5f + tp_mPad.stick.x * 10) * scale,
- pos.y + (30.f - tp_mPad.stick.y * 10) * scale},
- {20.0f * scale, 20.0f * scale});
+ drawStickOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + 17.5f * scale, pos.y + 30.f * scale}, 35.0f * scale);
+ drawEllipse(is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ {pos.x + (17.5f + tp_mPad.stick.x * 10) * scale,
+ pos.y + (30.f - tp_mPad.stick.y * 10) * scale},
+ {20.0f * scale, 20.0f * scale});
// stick inputs
char control_x[5]; // control stick x
@@ -258,20 +252,19 @@ void draw_input_viewer(Vec2 pos, float scale, bool is_shadow) {
tp_sprintf(control_x, "%.2f", tp_mPad.stick.x);
tp_sprintf(control_y, "%.2f", tp_mPad.stick.y);
- Font::gz_renderChars(control_x, pos.x, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 8 * scale);
- Font::gz_renderChars(control_y, pos.x + 23.f * scale, pos.y + 65.f * scale,
- is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 8 * scale);
+ Font::GZ_drawStr(control_x, pos.x, pos.y + 65.f * scale, is_shadow ? 0x00000060 : 0xFFFFFFFF,
+ false, 8 * scale);
+ Font::GZ_drawStr(control_y, pos.x + 23.f * scale, pos.y + 65.f * scale,
+ is_shadow ? 0x00000060 : 0xFFFFFFFF, false, 8 * scale);
// Analog triggers
- Draw::draw_rect_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x, pos.y},
- {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
- Draw::draw_rect(is_shadow ? 0x00000060 : tp_mPad.nunchuck_shake > 0.2 ? 0x00FF00FF : 0xFFFFFFFF,
- {pos.x, pos.y},
- {35.f * MIN(1.0f, tp_mPad.nunchuck_shake) * scale, 7.f * scale});
- Draw::draw_rect_outline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 117.5f * scale, pos.y},
- {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
- Draw::draw_rect(
+ Draw::drawRectOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x, pos.y},
+ {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
+ Draw::drawRect(is_shadow ? 0x00000060 : tp_mPad.nunchuck_shake > 0.2 ? 0x00FF00FF : 0xFFFFFFFF,
+ {pos.x, pos.y}, {35.f * MIN(1.0f, tp_mPad.nunchuck_shake) * scale, 7.f * scale});
+ Draw::drawRectOutline(is_shadow ? 0x00000060 : 0xFFFFFFFF, {pos.x + 117.5f * scale, pos.y},
+ {35.f * scale, 7.f * scale}, OUTLINE_WIDTH);
+ Draw::drawRect(
is_shadow ? 0x00000060 : tp_mPad.wiimote_shake > 0.2 ? 0x00FF00FF : 0xFFFFFFFF,
{pos.x + (117.5f + 35.f * (1 - MIN(1.0f, tp_mPad.wiimote_shake))) * scale, pos.y},
{35.f * MIN(1.0f, tp_mPad.wiimote_shake) * scale, 7.f * scale});
@@ -279,13 +272,12 @@ void draw_input_viewer(Vec2 pos, float scale, bool is_shadow) {
#endif
}
-void render() {
+void InputViewer::draw() {
Vec2 pos = {0.f, 0.f};
- pos.x += sprite_offsets[VIEWER_INDEX].x;
- pos.y += sprite_offsets[VIEWER_INDEX].y;
+ pos.x += g_spriteOffsets[VIEWER_INDEX].x;
+ pos.y += g_spriteOffsets[VIEWER_INDEX].y;
float scale = 1.0f; // 0.5f * tp_cos(TP::get_frame_count() / 20.f) + 1.0f;
- if (g_drop_shadows)
- draw_input_viewer({pos.x + 1.f, pos.y + 1.f}, scale, true);
- draw_input_viewer(pos, scale, false);
-}
-} // namespace InputViewer \ No newline at end of file
+ if (g_dropShadows)
+ drawViewer({pos.x + 1.f, pos.y + 1.f}, scale, true);
+ drawViewer(pos, scale, false);
+} \ No newline at end of file
diff --git a/src/lib.cpp b/src/lib.cpp
index 6c1ce92..cd23d22 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -4,10 +4,8 @@
#include "free_cam.h"
#include "gz_flags.h"
#include "input_viewer.h"
-// #include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/m_Do/m_Do_printf.h"
-#include "menu.h"
#include "menus/main_menu.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
@@ -23,10 +21,11 @@
#include "utils/texture.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
+#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
_FIFOQueue Queue;
-bool card_load = true;
-Texture gzIconTex;
+bool l_loadCard = true;
+Texture l_gzIconTex;
bool last_frame_was_loading = false;
extern "C" {
@@ -35,128 +34,162 @@ extern "C" {
#define QUOTE(x) Q(x)
#if (GCN_NTSCU)
-#define main_tampoline ((void (*)(void))0x803737b4)
+#define main_trampoline ((void (*)(void))0x803737b4)
#endif
#if (GCN_PAL)
-#define main_tampoline ((void (*)(void))0x803745e4)
+#define main_trampoline ((void (*)(void))0x803745e4)
#endif
#if (GCN_NTSCJ)
-#define main_tampoline ((void (*)(void))0x80375c44)
+#define main_trampoline ((void (*)(void))0x80375c44)
#endif
#if (WII_NTSCU_10)
-#define main_tampoline ((void (*)(void))0x803ce3dc)
+#define main_trampoline ((void (*)(void))0x803ce3dc)
#endif
#if (WII_PAL)
-#define main_tampoline ((void (*)(void))0x803b929c)
+#define main_trampoline ((void (*)(void))0x803b929c)
#endif
#ifdef GZ_VERSION
#define INTERNAL_GZ_VERSION QUOTE(GZ_VERSION)
#endif
void apply_lib_hooks() {
- Hook::apply_hooks();
- main_tampoline();
+ Hook::applyHooks();
+ main_trampoline();
}
void init() {
- Font::load_font("tpgz/fonts/consola.fnt");
+ Font::loadFont("tpgz/fonts/consola.fnt");
Draw::init();
PosSettingsMenu::initDefaults();
- fifo_visible = true;
- if (gzIconTex.loadCode == TexCode::TEX_UNLOADED) {
- load_texture("tpgz/tex/tpgz.tex", &gzIconTex);
- if (gzIconTex.loadCode != TexCode::TEX_OK) {
- tp_osReport("Could not load TPGZ's icon texture (Code: %d)", gzIconTex.loadCode);
- }
+ g_fifoVisible = true;
+ if (l_gzIconTex.loadCode == TexCode::TEX_UNLOADED) {
+ load_texture("tpgz/tex/tpgz.tex", &l_gzIconTex);
}
- Utilities::setup_link_color();
+ GZ_patchLinkColor();
}
void game_loop() {
#ifdef GCN_PLATFORM
- using namespace Controller::Pad;
-#define BUTTONS (tp_mPadStatus.sval)
-#define CANCEL_LOAD_BUTTONS (L | R | B)
-#define SHOW_MENU_BUTTONS (L | R | DPAD_DOWN)
+#define BUTTONS (tp_mPadStatus.button)
+#define CANCEL_LOAD_BUTTONS (CButton::L | CButton::R | CButton::B)
+#define SHOW_MENU_BUTTONS (CButton::L | CButton::R | CButton::DPAD_DOWN)
#endif
#ifdef WII_PLATFORM
- using namespace Controller::Mote;
-#define BUTTONS (tp_mPad.buttons)
+#define BUTTONS (tp_mPad.mHoldButton)
#define CANCEL_LOAD_BUTTONS (Z | C | B)
#define SHOW_MENU_BUTTONS (Z | C | MINUS)
#endif
// Button combo to bypass the automatic loading of the save file
// in case of crash cause by the load.
- if (BUTTONS == CANCEL_LOAD_BUTTONS && card_load) {
- card_load = false;
+ if (BUTTONS == CANCEL_LOAD_BUTTONS && l_loadCard) {
+ l_loadCard = false;
}
// check and load gz settings card if found
- Utilities::load_gz_card(card_load);
+ GZ_loadGZSave(l_loadCard);
- if (BUTTONS == SHOW_MENU_BUTTONS && tp_fopScnRq.isLoading != 1 && !move_link_active) {
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- fifo_visible = false;
+ if (BUTTONS == SHOW_MENU_BUTTONS && tp_fopScnRq.isLoading != 1 && !g_moveLinkEnabled) {
+ GZ_setMenu(MN_MAIN_MENU_INDEX);
+ g_fifoVisible = false;
}
+
if (tp_fopScnRq.isLoading) {
- MenuRendering::close_active_menus();
- move_link_active = false;
+ GZ_clearMenu();
+ g_moveLinkEnabled = false;
last_frame_was_loading = true;
- free_cam_active = false;
+ g_freeCamEnabled = false;
}
// save temp flags and tears after every loading zone
if (last_frame_was_loading && !tp_fopScnRq.isLoading) {
tp_memcpy(gSaveManager.mAreaReloadOpts.temp_flags, &g_dComIfG_gameInfo.info.mMemory,
sizeof(g_dComIfG_gameInfo.info.mMemory));
+
for (int i = 0; i < 4; i++) {
gSaveManager.mAreaReloadOpts.tears[i] = dComIfGs_getLightDropNum(i);
}
+
last_frame_was_loading = false;
}
- GZFlags::apply_active_flags(GAME_LOOP);
- FreeCam::handle_free_cam();
- MoveLink::move_link();
+ GZ_execute(GAME_LOOP);
+ FreeCam::execute();
+ MoveLink::execute();
- if (ToolItems[Tools::TURBO_MODE_INDEX].active) {
- tp_cPadInfo.triggerInput = tp_cPadInfo.input;
+ if (g_tools[TURBO_MODE_INDEX].active) {
+ tp_cPadInfo[0].mPressedButtonFlags = tp_cPadInfo[0].mButtonFlags;
}
}
void post_game_loop() {
- GZFlags::apply_active_flags(POST_GAME_LOOP);
+ GZ_execute(POST_GAME_LOOP);
}
+Texture l_framePauseTex;
+Texture l_framePlayTex;
+
void draw() {
setupRendering();
- // Consolas.setupRendering();
- if (MenuRendering::is_menu_open()) {
- Font::gz_renderChars("tpgz v" INTERNAL_GZ_VERSION, sprite_offsets[MENU_INDEX].x + 35.0f,
- 25.0f, cursor_rgba, g_drop_shadows);
- if (gzIconTex.loadCode == TexCode::TEX_OK) {
- Draw::draw_rect(0xFFFFFFFF, {sprite_offsets[MENU_INDEX].x, 5.0f}, {30, 30},
- &gzIconTex._texObj);
+
+ if (GZ_checkMenuOpen()) {
+ Font::GZ_drawStr("tpgz v" INTERNAL_GZ_VERSION, g_spriteOffsets[MENU_INDEX].x + 35.0f, 25.0f,
+ g_cursorColor, g_dropShadows);
+ if (l_gzIconTex.loadCode == TexCode::TEX_OK) {
+ Draw::drawRect(0xFFFFFFFF, {g_spriteOffsets[MENU_INDEX].x, 5.0f}, {30, 30},
+ &l_gzIconTex._texObj);
}
}
- if (fifo_visible) {
+
+ if (g_fifoVisible) {
FIFOQueue::renderItems(Queue);
}
- if (ToolItems[Tools::LINK_DEBUG_INDEX].active) {
- Utilities::show_link_debug_info();
+
+ if (g_tools[LINK_DEBUG_INDEX].active) {
+ GZ_displayLinkInfo();
+ }
+
+ if (g_tools[HEAP_DEBUG_INDEX].active) {
+ GZ_drawHeapInfo();
}
- if (ToolItems[Tools::INPUT_VIEWER_INDEX].active) {
- InputViewer::render();
+
+ if (g_tools[INPUT_VIEWER_INDEX].active) {
+ InputViewer::draw();
}
- if (ToolItems[Tools::TIMER_INDEX].active || ToolItems[Tools::LOAD_TIMER_INDEX].active ||
- ToolItems[Tools::IGT_TIMER_INDEX].active) {
- Timer::render();
+
+ if (g_tools[TIMER_INDEX].active) {
+ Timer::drawTimer();
}
- if (move_link_active) {
- MoveLink::render_info_input();
+
+ if (g_tools[LOAD_TIMER_INDEX].active) {
+ Timer::drawLoadTimer();
}
- MenuRendering::render_active_menus();
- Utilities::render_active_watches();
+
+ if (g_tools[IGT_TIMER_INDEX].active) {
+ Timer::drawIGT();
+ }
+
+ if (g_tools[FRAME_ADVANCE_INDEX].active) {
+ if (l_framePauseTex.loadCode == TexCode::TEX_UNLOADED) {
+ load_texture("tpgz/tex/framePause.tex", &l_framePauseTex);
+ }
+
+ if (l_framePlayTex.loadCode == TexCode::TEX_UNLOADED) {
+ load_texture("tpgz/tex/framePlay.tex", &l_framePlayTex);
+ }
+
+ GZ_drawFrameTex(&l_framePauseTex, &l_framePlayTex);
+ } else {
+ if (l_framePauseTex.loadCode == TexCode::TEX_OK) {
+ free_texture(&l_framePauseTex);
+ }
+
+ if (l_framePlayTex.loadCode == TexCode::TEX_OK) {
+ free_texture(&l_framePlayTex);
+ }
+ }
+
+ GZ_drawMenu();
+ GZ_drawWatches();
}
} \ No newline at end of file
diff --git a/src/menu.cpp b/src/menu.cpp
index 39736cc..5e0b69e 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -20,44 +20,42 @@
#include "menus/ad_saves_menu.h"
#include "menus/memfiles_menu.h"
#include "menus/actor_spawn_menu.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
typedef void (*menu_render_t)();
-menu_render_t MenuRenderList[MAX_MENU_RENDER_FLAGS] = {
- MainMenu::render, InventoryMenu::render, ItemWheelMenu::render,
- WarpingMenu::render, MemoryMenu::render, WatchesMenu::render,
- MemoryEditorMenu::render, FlagsMenu::render, GeneralFlagsMenu::render,
- DungeonFlagsMenu::render, PortalFlagsMenu::render, FlagRecordsMenu::render,
- PracticeMenu::render, CheatsMenu::render, SceneMenu::render,
- SettingsMenu::render, ToolsMenu::render, PauseMenu::render,
- AmountsMenu::render, AnySavesMenu::render, HundoSavesMenu::render,
- PosSettingsMenu::render, FlagLogMenu::render, ADSavesMenu::render,
- MemfilesMenu::render, ActorSpawnMenu::render};
+menu_render_t l_menuDrawList[MAX_MENU_RENDER_FLAGS] = {
+ MainMenu::draw, CheatsMenu::draw, FlagsMenu::draw, InventoryMenu::draw,
+ MemoryMenu::draw, PracticeMenu::draw, SceneMenu::draw, SettingsMenu::draw,
+ ToolsMenu::draw, WarpingMenu::draw, GeneralFlagsMenu::draw, DungeonFlagsMenu::draw,
+ PortalFlagsMenu::draw, FlagRecordsMenu::draw, FlagLogMenu::draw, ItemWheelMenu::draw,
+ PauseMenu::draw, AmountsMenu::draw, WatchesMenu::draw, MemoryEditorMenu::draw,
+ MemfilesMenu::draw, AnySavesMenu::draw, HundoSavesMenu::draw, ADSavesMenu::draw,
+ ActorSpawnMenu::draw, ActorListMenu::draw, PosSettingsMenu::draw,
+};
-menu_render_t currentMenu = nullptr;
+menu_render_t l_currentMenu = nullptr;
-namespace MenuRendering {
-void render_active_menus() {
- if (currentMenu) {
- currentMenu();
+void GZ_drawMenu() {
+ if (l_currentMenu != nullptr) {
+ l_currentMenu();
}
}
-void set_menu(MenuIndex idx) {
- if (idx > MN_NONE_INDEX) {
- currentMenu = MenuRenderList[idx];
+void GZ_setMenu(int menu_idx) {
+ if (menu_idx > MN_NONE_INDEX) {
+ l_currentMenu = l_menuDrawList[menu_idx];
} else {
- currentMenu = nullptr;
+ l_currentMenu = nullptr;
}
}
-void close_active_menus() {
- if (currentMenu) {
- currentMenu = nullptr;
+void GZ_clearMenu() {
+ if (l_currentMenu) {
+ l_currentMenu = nullptr;
}
}
-bool is_menu_open() {
- return currentMenu != nullptr;
-}
-} // namespace MenuRendering \ No newline at end of file
+bool GZ_checkMenuOpen() {
+ return l_currentMenu != nullptr;
+} \ No newline at end of file
diff --git a/src/menus/actor_list_menu.cpp b/src/menus/actor_list_menu.cpp
new file mode 100644
index 0000000..977784c
--- /dev/null
+++ b/src/menus/actor_list_menu.cpp
@@ -0,0 +1,102 @@
+#include "menus/actor_spawn_menu.h"
+#include "menus/memory_editor_menu.h"
+#include "menus/settings_menu.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_actor_mng.h"
+#include "gz_flags.h"
+
+#define LINE_NUM 1
+
+#ifdef GCN_PLATFORM
+#define CONTROLLER_RIGHT GZPad::DPAD_RIGHT
+#define CONTROLLER_LEFT GZPad::DPAD_LEFT
+#define MEM_SWITCH_BTN GZPad::Y
+#define CONTROL_TEXT "Y"
+#endif
+#ifdef WII_PLATFORM
+#define CONTROLLER_RIGHT GZPad::DPAD_RIGHT
+#define CONTROLLER_LEFT GZPad::DPAD_LEFT
+#define MEM_SWITCH_BTN GZPad::C
+#define CONTROL_TEXT "C"
+#endif
+
+Cursor ActorListMenu::cursor;
+
+uint16_t l_index = 0;
+
+Line lines[LINE_NUM] = {
+ {"index:", ACTOR_ID_INDEX, "List Index (Dpad to scroll / " CONTROL_TEXT " to view memory)",
+ false},
+};
+
+void ActorListMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_SCENE_MENU);
+ return;
+ }
+
+ switch (cursor.y) {
+ case ACTOR_ID_INDEX:
+ if (GZ_getButtonRepeat(CONTROLLER_RIGHT) && l_index < g_fopAcTg_Queue.mSize) {
+ l_index++;
+ } else if (GZ_getButtonRepeat(CONTROLLER_LEFT) && l_index > 0) {
+ l_index--;
+ }
+ break;
+ }
+
+ if (l_index > g_fopAcTg_Queue.mSize - 1) {
+ l_index = g_fopAcTg_Queue.mSize - 1;
+ }
+
+ node_class* node = g_fopAcTg_Queue.mpHead;
+ fopAc_ac_c* actorData = NULL;
+ for (int i = 0; i < g_fopAcTg_Queue.mSize; i++) {
+ if (i == l_index && node != NULL) {
+ create_tag_class* tag = (create_tag_class*)node;
+ actorData = (fopAc_ac_c*)tag->mpTagData;
+ break;
+ }
+ node = node->mpNextNode;
+ }
+
+ if (actorData != NULL) {
+ char addressBuf[18];
+ tp_sprintf(addressBuf, "Address: %08X", (uint32_t)actorData);
+ GZ_drawText(addressBuf, 25.0f, 100.f, 0xFFFFFFFF, GZ_checkDropShadows());
+
+ char nameBuf[13];
+ tp_sprintf(nameBuf, "Proc ID: %d", actorData->mBase.mProcName);
+ GZ_drawText(nameBuf, 25.0f, 120.f, 0xFFFFFFFF, GZ_checkDropShadows());
+
+ char paramBuf[17];
+ tp_sprintf(paramBuf, "Params: %08X", actorData->mBase.mParameters);
+ GZ_drawText(paramBuf, 25.0f, 140.f, 0xFFFFFFFF, GZ_checkDropShadows());
+
+ char angleBuf[14];
+ tp_sprintf(angleBuf, "Angle: %d", actorData->mCollisionRot.mY);
+ GZ_drawText(angleBuf, 25.0f, 160.f, 0xFFFFFFFF, GZ_checkDropShadows());
+
+ char posBuf[50];
+ tp_sprintf(posBuf, "Position: %.1f %.1f %.1f", actorData->mCurrent.mPosition.x,
+ actorData->mCurrent.mPosition.y, actorData->mCurrent.mPosition.z);
+ GZ_drawText(posBuf, 25.0f, 180.f, 0xFFFFFFFF, GZ_checkDropShadows());
+
+ tp_sprintf(lines[ACTOR_ID_INDEX].value, " <%d / %d>", l_index, g_fopAcTg_Queue.mSize - 1);
+
+ if (GZ_getButtonTrig(MEM_SWITCH_BTN)) {
+ switch (cursor.y) {
+ case ACTOR_ID_INDEX:
+ MemoryEditorMenu::mAddressIndex = (uint32_t)actorData;
+ GZ_setMenu(GZ_MEM_EDITOR_MENU);
+ return;
+ }
+ }
+ }
+
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/actor_spawner_menu.cpp b/src/menus/actor_spawner_menu.cpp
index 794a624..269b813 100644
--- a/src/menus/actor_spawner_menu.cpp
+++ b/src/menus/actor_spawner_menu.cpp
@@ -1,47 +1,47 @@
#include "menus/actor_spawn_menu.h"
#include "menus/settings_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_actor_mng.h"
+#include "gz_flags.h"
+
+#define LINE_NUM 4
-#define LINES 4
#ifdef GCN_PLATFORM
-#define CONTROLLER_RIGHT Controller::DPAD_RIGHT
-#define CONTROLLER_LEFT Controller::DPAD_LEFT
-#define CONTROLLER_UP Controller::DPAD_UP
-#define CONTROLLER_DOWN Controller::DPAD_DOWN
-#define CONTROLLER_SKIP_10 Controller::X
-#define CONTROLLER_SKIP_MINUS_10 Controller::Y
+#define CONTROLLER_RIGHT GZPad::DPAD_RIGHT
+#define CONTROLLER_LEFT GZPad::DPAD_LEFT
+#define CONTROLLER_UP GZPad::DPAD_UP
+#define CONTROLLER_DOWN GZPad::DPAD_DOWN
+#define CONTROLLER_SKIP_10 GZPad::X
+#define CONTROLLER_SKIP_MINUS_10 GZPad::Y
+#define CONTROL_TEXT "X/Y"
#endif
+
#ifdef WII_PLATFORM
-#define CONTROLLER_RIGHT Controller::DPAD_RIGHT
-#define CONTROLLER_LEFT Controller::DPAD_LEFT
-#define CONTROLLER_UP Controller::DPAD_UP
-#define CONTROLLER_DOWN Controller::DPAD_DOWN
-#define CONTROLLER_SKIP_10 Controller::ONE
-#define CONTROLLER_SKIP_MINUS_10 Controller::TWO
+#define CONTROLLER_RIGHT GZPad::DPAD_RIGHT
+#define CONTROLLER_LEFT GZPad::DPAD_LEFT
+#define CONTROLLER_UP GZPad::DPAD_UP
+#define CONTROLLER_DOWN GZPad::DPAD_DOWN
+#define CONTROLLER_SKIP_10 GZPad::ONE
+#define CONTROLLER_SKIP_MINUS_10 GZPad::TWO
+#define CONTROL_TEXT "1/2"
#endif
-static Cursor cursor = {0, 0};
-bool lock_cursor_y = false;
-bool lock_cursor_x = false;
-bool init_once = false;
+Cursor ActorSpawnMenu::cursor;
-uint16_t actor_id = 0;
-uint32_t actor_params = 0;
-int8_t actor_type = -1;
-uint8_t param_index = 0;
-bool params_selected = false;
+uint16_t l_actorID = 0;
+uint32_t l_actorParams = 0;
+int8_t l_actorType = -1;
+uint8_t l_paramIdx = 0;
+bool l_paramsSelected = false;
-Line lines[LINES] = {{"actor id:", ACTOR_ID_INDEX, "Actor ID (Dpad / X/Y to scroll)", false},
- {"actor params:", ACTOR_PARAM_INDEX, "Actor Parameters (default: 0)", false},
- {"actor subtype:", ACTOR_SUBTYPE_INDEX,
- "Actor subtype (default: -1) (Dpad / X/Y to scroll)", false},
- {"spawn", ACTOR_SPAWN_INDEX, "Spawn actor at current position", false}};
+Line lines[LINE_NUM] = {
+ {"actor id:", ACTOR_ID_INDEX, "Actor ID (Dpad / " CONTROL_TEXT " to scroll)", false},
+ {"actor params:", ACTOR_PARAM_INDEX, "Actor Parameters (default: 0)", false},
+ {"actor subtype:", ACTOR_SUBTYPE_INDEX,
+ "Actor subtype (default: -1) (Dpad / " CONTROL_TEXT " to scroll)", false},
+ {"spawn", ACTOR_SPAWN_INDEX, "Spawn actor at current position", false},
+};
void actorFastCreateAtLink(short id, uint32_t parameters, int8_t subtype) {
fopAcM_create(id, parameters, &dComIfGp_getPlayer()->mCurrent.mPosition,
@@ -49,175 +49,139 @@ void actorFastCreateAtLink(short id, uint32_t parameters, int8_t subtype) {
nullptr, subtype);
}
-// returns the width of the rendered string
-float render_selected_number_selector(const char* str, float x, float y, size_t selected_char_index,
- size_t max_char, uint32_t color) {
- float pos = 0.0f;
- for (size_t i = 0; i <= max_char; ++i) {
- Font::gz_renderChar(str[i], x + pos, y, selected_char_index == i ? CURSOR_RGBA : color,
- g_drop_shadows);
- pos += Font::get_char_width(str[i]);
- }
- return pos;
-}
+void ActorSpawnMenu::draw() {
+ cursor.setMode(Cursor::MODE_UNRESTRICTED);
-void ActorSpawnMenu::render() {
- if (Controller::button_is_pressed(BACK_BUTTON)) {
- if (params_selected) {
- lock_cursor_y = false;
- params_selected = false;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ if (l_paramsSelected) {
+ cursor.lock_y = false;
+ l_paramsSelected = false;
} else {
- init_once = false;
- MenuRendering::set_menu(MN_SCENE_INDEX);
+ GZ_setMenu(GZ_SCENE_MENU);
return;
}
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case ACTOR_PARAM_INDEX: {
- lock_cursor_y = true;
- params_selected = true;
+ case ACTOR_PARAM_INDEX:
+ cursor.lock_y = true;
+ l_paramsSelected = true;
break;
- }
- case ACTOR_SPAWN_INDEX: {
- actorFastCreateAtLink(actor_id, actor_params, actor_type);
+ case ACTOR_SPAWN_INDEX:
+ actorFastCreateAtLink(l_actorID, l_actorParams, l_actorType);
break;
}
- }
}
switch (cursor.y) {
- case ACTOR_ID_INDEX: {
- if (Controller::button_is_pressed(CONTROLLER_RIGHT)) {
- actor_id++;
- } else if (Controller::button_is_pressed(CONTROLLER_LEFT)) {
- actor_id--;
- } else if (Controller::button_is_pressed(CONTROLLER_SKIP_10)) {
- actor_id += 10;
- } else if (Controller::button_is_pressed(CONTROLLER_SKIP_MINUS_10)) {
- actor_id -= 10;
+ case ACTOR_ID_INDEX:
+ if (GZ_getButtonRepeat(CONTROLLER_RIGHT)) {
+ l_actorID++;
+ } else if (GZ_getButtonRepeat(CONTROLLER_LEFT)) {
+ l_actorID--;
+ } else if (GZ_getButtonRepeat(CONTROLLER_SKIP_10)) {
+ l_actorID += 10;
+ } else if (GZ_getButtonRepeat(CONTROLLER_SKIP_MINUS_10)) {
+ l_actorID -= 10;
}
break;
- }
- case ACTOR_SUBTYPE_INDEX: {
- if (Controller::button_is_pressed(CONTROLLER_RIGHT)) {
- actor_type++;
- } else if (Controller::button_is_pressed(CONTROLLER_LEFT)) {
- actor_type--;
- } else if (Controller::button_is_pressed(CONTROLLER_SKIP_10)) {
- actor_type += 10;
- } else if (Controller::button_is_pressed(CONTROLLER_SKIP_MINUS_10)) {
- actor_type -= 10;
+ case ACTOR_SUBTYPE_INDEX:
+ if (GZ_getButtonRepeat(CONTROLLER_RIGHT)) {
+ l_actorType++;
+ } else if (GZ_getButtonRepeat(CONTROLLER_LEFT)) {
+ l_actorType--;
+ } else if (GZ_getButtonRepeat(CONTROLLER_SKIP_10)) {
+ l_actorType += 10;
+ } else if (GZ_getButtonRepeat(CONTROLLER_SKIP_MINUS_10)) {
+ l_actorType -= 10;
}
break;
}
- }
char buf[9];
- tp_sprintf(buf, "%08X", actor_params);
- if (params_selected) {
- if (Controller::button_is_pressed(CONTROLLER_RIGHT)) {
- if (param_index == 7) {
- param_index = 0;
- } else if (param_index >= 0 && param_index < 8) {
- param_index++;
+ tp_sprintf(buf, "%08X", l_actorParams);
+ if (l_paramsSelected) {
+ if (GZ_getButtonRepeat(CONTROLLER_RIGHT)) {
+ if (l_paramIdx == 7) {
+ l_paramIdx = 0;
+ } else if (l_paramIdx >= 0 && l_paramIdx < 8) {
+ l_paramIdx++;
}
}
- if (Controller::button_is_pressed(CONTROLLER_LEFT)) {
- if (param_index == 0) {
- param_index = 7;
- } else if (param_index >= 0 && param_index < 8) {
- param_index--;
+ if (GZ_getButtonRepeat(CONTROLLER_LEFT)) {
+ if (l_paramIdx == 0) {
+ l_paramIdx = 7;
+ } else if (l_paramIdx >= 0 && l_paramIdx < 8) {
+ l_paramIdx--;
}
}
- if (Controller::button_is_pressed(CONTROLLER_UP)) {
- switch (param_index) {
- case 0: {
- actor_params += 0x10000000;
+ if (GZ_getButtonRepeat(CONTROLLER_UP)) {
+ switch (l_paramIdx) {
+ case 0:
+ l_actorParams += 0x10000000;
break;
- }
- case 1: {
- actor_params += 0x1000000;
+ case 1:
+ l_actorParams += 0x1000000;
break;
- }
- case 2: {
- actor_params += 0x100000;
+ case 2:
+ l_actorParams += 0x100000;
break;
- }
- case 3: {
- actor_params += 0x10000;
+ case 3:
+ l_actorParams += 0x10000;
break;
- }
- case 4: {
- actor_params += 0x1000;
+ case 4:
+ l_actorParams += 0x1000;
break;
- }
- case 5: {
- actor_params += 0x100;
+ case 5:
+ l_actorParams += 0x100;
break;
- }
- case 6: {
- actor_params += 0x10;
+ case 6:
+ l_actorParams += 0x10;
break;
- }
- case 7: {
- actor_params += 0x1;
+ case 7:
+ l_actorParams += 0x1;
break;
}
- }
}
- if (Controller::button_is_pressed(CONTROLLER_DOWN)) {
- switch (param_index) {
- case 0: {
- actor_params -= 0x10000000;
+ if (GZ_getButtonRepeat(CONTROLLER_DOWN)) {
+ switch (l_paramIdx) {
+ case 0:
+ l_actorParams -= 0x10000000;
break;
- }
- case 1: {
- actor_params -= 0x1000000;
+ case 1:
+ l_actorParams -= 0x1000000;
break;
- }
- case 2: {
- actor_params -= 0x100000;
+ case 2:
+ l_actorParams -= 0x100000;
break;
- }
- case 3: {
- actor_params -= 0x10000;
+ case 3:
+ l_actorParams -= 0x10000;
break;
- }
- case 4: {
- actor_params -= 0x1000;
+ case 4:
+ l_actorParams -= 0x1000;
break;
- }
- case 5: {
- actor_params -= 0x100;
+ case 5:
+ l_actorParams -= 0x100;
break;
- }
- case 6: {
- actor_params -= 0x10;
+ case 6:
+ l_actorParams -= 0x10;
break;
- }
- case 7: {
- actor_params -= 0x1;
+ case 7:
+ l_actorParams -= 0x1;
break;
}
- }
}
- render_selected_number_selector(buf, 170.0f, 80.0f, param_index, 7, 0xFFFFFFFF);
+ GZ_drawSelectChar(buf, 170.0f, 80.0f, l_paramIdx, 7, 0xFFFFFFFF);
} else {
- Font::gz_renderChars(buf, 170.0f, 80.0f,
- (cursor.y == ACTOR_PARAM_INDEX ? CURSOR_RGBA : 0xFFFFFFFF),
- g_drop_shadows);
+ Font::GZ_drawStr(buf, 170.0f, 80.0f,
+ (cursor.y == ACTOR_PARAM_INDEX ? CURSOR_RGBA : 0xFFFFFFFF),
+ GZ_checkDropShadows());
}
- tp_sprintf(lines[ACTOR_ID_INDEX].value, " <%d>", actor_id);
- tp_sprintf(lines[ACTOR_SUBTYPE_INDEX].value, " <%d>", actor_type);
+ tp_sprintf(lines[ACTOR_ID_INDEX].value, " <%d>", l_actorID);
+ tp_sprintf(lines[ACTOR_SUBTYPE_INDEX].value, " <%d>", l_actorType);
- Utilities::move_cursor(cursor, LINES, 8, lock_cursor_x, lock_cursor_y, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(8, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/ad_saves_menu.cpp b/src/menus/ad_saves_menu.cpp
index 4a9c1e1..e21e895 100644
--- a/src/menus/ad_saves_menu.cpp
+++ b/src/menus/ad_saves_menu.cpp
@@ -1,167 +1,79 @@
#include "menus/ad_saves_menu.h"
-#include "controller.h"
-#include "fifo_queue.h"
-#include "gorge.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-#include "libtp_c/include/msl_c/string.h"
-#include "menus/practice_menu.h"
-#include "rollcheck.h"
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
-#include "utils/loading.h"
-#include "libtp_c/include/utils.h"
+#include "gz_flags.h"
+#include "save_specials.h"
-#include "fs.h"
-#define LINES 51
+#define LINE_NUM 43
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor ADSavesMenu::cursor;
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"ordon gate clip", AD_ORDON_GATE_CLIP_INDEX, "Gate Clip outside Ordon Spring"},
- {"back in time", AD_BIT_INDEX, "Back In Time off the Ordon Spring bridge"},
+ {"back in time", AD_BIT_INDEX, "Back in Time off the Ordon Spring bridge"},
{"goats", AD_GOATS_INDEX, "Goat herding 2"},
{"sword and shield skip", AD_HUGO_INDEX, "Hangin' with Hugo"},
{"faron twilight", AD_FARON_TWILGHT_INDEX, "Faron Twilight 1st half"},
- {"early master sword", AD_EMS_INDEX, "Super Jump to early Sacred Grove"},
+ {"early master sword", AD_EMS_INDEX, "Super Jump to Sacred Grove"},
{"purple mist", AD_MIST_INDEX, "Purple mist in Faron Woods (post-EMS)"},
- {"forest bit", AD_FRST_BIT_INDEX, "Back In Time in Forest Temple"},
- {"forest escape", AD_FRST_ESCAPE_INDEX, "LJA over S Faron exit trigger"},
- {"pillar clip", AD_PILLAR_CLIP_INDEX, "Pillar Clip in Lake Hylia (low water)"},
- {"lakebed 1", AD_LAKEBED_1_INDEX, "The first Lakebed Temple segment"},
- {"deku toad", AD_TOAD_INDEX, "The miniboss of Lakebed Temple"},
- {"kargorok flight", AD_KARG_INDEX, "Clip OoB with trumpet bird"},
- {"forest temple 2", AD_FT2_INDEX, "Second half of Forest Temple"},
- {"diababa", AD_DIABABA_INDEX, "The Forest Temple boss"},
+ {"king bulblin", AD_KB1_INDEX, "King Bulblin 1 fight"},
{"eldin twilight", AD_ELDIN_TWILIGHT_INDEX, "Eldin Twilight tears"},
+ {"forest temple", AD_FOREST_INDEX, "Forest Temple segment"},
+ {"diababa", AD_DIABABA_INDEX, "Forest Temple boss"},
+ {"pillar clip", AD_PILLAR_CLIP_INDEX, "Pillar Clip in Lake Hylia (low water)"},
+ {"lakebed 1", AD_LAKEBED_1_INDEX, "The 1st Lakebed Temple segment"},
+ {"deku toad", AD_TOAD_INDEX, "Lakebed Temple miniboss"},
{"lanayru twilight", AD_LANAYRU_TWILIGHT_INDEX, "Lanayru Twilight tears"},
- {"post lanayru", AD_POST_LANAYRU_INDEX, "Stealing Iza's bombs"},
- {"lakebed bk skip", AD_BK_SKIP_INDEX, "Boss key skip in Lakebed Temple main room"},
+ {"mountain umd", AD_MOUNTAIN_UMD_INDEX, "Snowpeak Mountain w/ UMD"},
+ {"snowpeak", AD_SPR_INDEX, "The Snowpeak Ruins segment"},
+ {"ice boost", AD_SPR_BOOST_INDEX, "Ice boost to SPR 2nd floor"},
+ {"blizzeta", AD_BLIZZETA_INDEX, "Snowpeak Ruins boss"},
+ {"goron mines", AD_GM_INDEX, "The Goron Mines segment"},
+ {"dangoro", AD_DANGORO_INDEX, "Goron Mines miniboss"},
+ {"lakebed bk skip", AD_BK_SKIP_INDEX, "Boss Key skip in Lakebed Temple"},
{"morpheel", AD_MORPHEEL_INDEX, "Morpheel fight (no Zora Armor)"},
- {"mdh", AD_MDH_INDEX, "MDH segment"},
- {"mountain", AD_MOUNTAIN_INDEX, "Climbing up Snowpeak mountain"},
- {"mountain umd", AD_MOUNTAIN_UMD_INDEX, "Snowpeak Mountain UMD"},
- {"snowpeak", AD_SPR_INDEX, "The Snowpeak Ruins dungeon segment"},
- {"dark hammer", AD_DARK_HAMMER_INDEX, "The Snowpeak Ruins miniboss"},
- {"snowpeak bomb boost", AD_SPR_BOOST_INDEX, "Bomb boost to SPR 2nd floor"},
- {"blizzeta", AD_BLIZZETA_INDEX, "The Snowpeak Ruins boss"},
+ {"mdh", AD_MDH_INDEX, "Midna's Desperate Hour segment"},
+ {"bulblin camp", AD_CAMP_INDEX, "Bulblin camp segment"},
{"arbiter's grounds", AD_AG_INDEX, "The Arbiter's Grounds segment"},
{"poe 1 skip", AD_POE_SKIP_INDEX, "The pillar jump in Arbiter's Grounds"},
- {"death sword", AD_DSS_INDEX, "The Arbiter's Grounds miniboss"},
- {"stallord", AD_STALLORD_INDEX, "The Arbiter's Grounds boss"},
- {"early elevator", AD_EARLY_ELE_INDEX, "OoB clip to DM elevator"},
- {"goron mines", AD_GM_INDEX, "The Goron Mines segment"},
- {"dangoro", AD_DANGORO_INDEX, "The Goron Mines miniboss"},
- {"silver rupee", AD_RUPEE_INDEX, "Silver Rupee collection"},
- {"city in the sky 1", AD_CITS_1_INDEX, "The first City in the Sky segment"},
- {"aeralfos skip", AD_AERALFOS_INDEX, "The City in the Sky miniboss"},
- {"city in the sky 2", AD_CITS_2_INDEX, "The second City in the Sky segment"},
- {"argorok", AD_ARGOROK_INDEX, "The City in the Sky boss"},
+ {"death sword", AD_DSS_INDEX, "Arbiter's Grounds miniboss"},
+ {"stallord", AD_STALLORD_INDEX, "Arbiter's Grounds boss"},
{"faron bomb boost", AD_FARON_BOOST_INDEX, "Bomb boost to Sacred Grove"},
- {"grove 2", AD_GROVE_2_INDEX, "The 2nd Skullkid chase"},
{"temple of time", AD_TOT_INDEX, "The Temple of Time segment"},
- {"darknut", AD_DARKNUT_INDEX, "The Temple of Time miniboss"},
{"dot skip", AD_DOT_SKIP_INDEX, "Door of Time skip"},
- {"palace of twilight 1", AD_PALACE_1_INDEX, "The first Palace of Twilight segment"},
- {"palace of twilight 2", AD_PALACE_2_INDEX,
- "The second Palace of Twilight segment (after both Sols)"},
- {"early platform", AD_EARLY_PLATFORM_INDEX, "Early platform in Palace of Twilight"},
- {"zant", AD_ZANT_INDEX, "The Palace of Twilight boss"},
+ {"silver rupee", AD_RUPEE_INDEX, "Silver Rupee collection"},
+ {"city 1", AD_CITS_1_INDEX, "The 1st City in the Sky segment"},
+ {"aeralfos skip", AD_AERALFOS_INDEX, "City in the Sky miniboss"},
+ {"city 2", AD_CITS_2_INDEX, "The 2nd City in the Sky segment"},
+ {"argorok", AD_ARGOROK_INDEX, "City in the Sky boss"},
+ {"palace 1", AD_PALACE_1_INDEX, "The 1st Palace of Twilight segment"},
+ {"palace 2", AD_PALACE_2_INDEX, "The 2nd Palace of Twilight segment"},
+ {"zant", AD_ZANT_INDEX, "Palace of Twilight boss"},
{"hyrule castle", AD_HC_INDEX, "The Hyrule Castle segment"},
{"beast ganon", AD_BEAST_GANON_INDEX, "The Beast Ganon fight"},
- {"horseback ganon", AD_HORSEBACK_INDEX, "The horseback Ganondorf fight"}};
-
-void default_load() {
- gSaveManager.mPracticeFileOpts.inject_options_before_load = SaveManager::inject_default_before;
- gSaveManager.mPracticeFileOpts.inject_options_during_load = SaveManager::inject_default_during;
- gSaveManager.mPracticeFileOpts.inject_options_after_load = SaveManager::inject_default_after;
- inject_save_flag = true;
- fifo_visible = true;
- MenuRendering::set_menu(MN_NONE_INDEX);
- init_once = false;
-}
-
-void hugo() {
- gSaveManager.inject_default_during();
- dComIfGs_onSwitch(47, 0); // midna trigger off
- dComIfGs_offSwitch(63, 0); // hugo alive
-}
-
-void karg_oob() {
- gSaveManager.mPracticeFileOpts.inject_options_before_load = nullptr;
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
- dComIfGs_setTransformStatus(STATUS_HUMAN);
-}
-
-void morpheel() {
- dComIfGp_getPlayer()->mHeldItem = HOOKSHOT; // clawshot
- dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
-}
+ {"horseback ganon", AD_HORSEBACK_INDEX, "The Horseback Ganondorf fight"},
+};
-void stallord() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
- setNextStagePoint(1); // spawn at in front of stally
-}
-
-void argorok() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x10000;
-}
-
-void palace1() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0; // reset palace switches
-}
-
-void palace2() {
- dComIfGp_getPlayer()->mHeldItem = 3; // master sword
-}
-
-void lakebed_bk_skip_during() {
- gSaveManager.inject_default_during();
- dComIfGs_onSwitch(2, 0); // bridge turned
- dComIfGs_onSwitch(122, 0); // dungeon intro cs off
-}
-
-void bossflags() {
- gSaveManager.inject_default_during();
- tp_bossFlags = 0xFF;
-}
-
-void ADSavesMenu::render() {
+void ADSavesMenu::draw() {
special ADSpecials[AD_SPECIALS_AMNT] = {
- special(AD_HUGO_INDEX, hugo, nullptr),
- special(AD_KARG_INDEX, karg_oob, nullptr),
- special(AD_BK_SKIP_INDEX, lakebed_bk_skip_during, nullptr),
- special(AD_MORPHEEL_INDEX, nullptr, morpheel),
- special(AD_STALLORD_INDEX, stallord, nullptr),
- special(AD_FRST_ESCAPE_INDEX, bossflags, nullptr),
- special(AD_PILLAR_CLIP_INDEX, bossflags, nullptr),
- special(AD_LAKEBED_1_INDEX, bossflags, nullptr),
- special(AD_DARK_HAMMER_INDEX, bossflags, nullptr),
- special(AD_ARGOROK_INDEX, argorok, nullptr),
- special(AD_PALACE_1_INDEX, palace1, nullptr),
- special(AD_PALACE_2_INDEX, nullptr, palace2)};
-
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_PRACTICE_INDEX);
- init_once = false;
- return;
+ special(AD_HUGO_INDEX, SaveMngSpecial_Hugo, SaveMngSpecial_SpawnHugo),
+ special(AD_BK_SKIP_INDEX, SaveMngSpecial_LakebedBKSkip, nullptr),
+ special(AD_MORPHEEL_INDEX, nullptr, SaveMngSpecial_Morpheel),
+ special(AD_STALLORD_INDEX, SaveMngSpecial_Stallord, nullptr),
+ special(AD_PILLAR_CLIP_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(AD_LAKEBED_1_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(AD_ARGOROK_INDEX, SaveMngSpecial_Argorok, nullptr),
+ special(AD_PALACE_1_INDEX, SaveMngSpecial_Palace1, nullptr),
+ special(AD_PALACE_2_INDEX, nullptr, SaveMngSpecial_Palace2),
};
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_PRACTICE_MENU);
+ return;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
- SaveManager::load_save(cursor.y, (char*)"ad", ADSpecials, AD_SPECIALS_AMNT);
- init_once = false;
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ SaveManager::loadSave(cursor.y, "ad", ADSpecials, AD_SPECIALS_AMNT);
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/amounts_menu.cpp b/src/menus/amounts_menu.cpp
index 5b38b57..e416d39 100644
--- a/src/menus/amounts_menu.cpp
+++ b/src/menus/amounts_menu.cpp
@@ -1,141 +1,94 @@
#include "menus/amounts_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "libtp_c/include/msl_c/math.h"
#include "libtp_c/include/msl_c/string.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "gz_flags.h"
-#define LINES 8
+#define LINE_NUM 8
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor AmountsMenu::cursor;
-static uint8_t arrow_ammo;
-static uint8_t bomb_bag_1_ammo = 0;
-static uint8_t bomb_bag_2_ammo = 0;
-static uint8_t bomb_bag_3_ammo = 0;
-static uint8_t slingshot_ammo = 0;
-static uint8_t poe_count = 0;
-static uint16_t hp_count = 0;
-static uint16_t rupee_count = 0;
+uint8_t l_arrowNum;
+uint8_t l_bag1Num = 0;
+uint8_t l_bag2Num = 0;
+uint8_t l_bag3Num = 0;
+uint8_t l_seedNum = 0;
+uint8_t l_poeNum = 0;
+uint16_t l_hpNum = 0;
+uint16_t l_rupeeNum = 0;
-Line lines[LINES] = {{"arrow ammo:", ARROW_AMMO_INDEX, "Amount of arrows held"},
- {"bomb bag 1 ammo:", BOMB_BAG_1_AMMO_INDEX, "Amount of bombs in bag 1"},
- {"bomb bag 2 ammo:", BOMB_BAG_2_AMMO_INDEX, "Amount of bombs in bag 2"},
- {"bomb bag 3 ammo:", BOMB_BAG_3_AMMO_INDEX, "Amount of bombs in bag 3"},
- {"slingshot ammo:", SLINGSHOT_AMMO_INDEX, "Amount of slingshot pellets held"},
- {"heart pieces:", HEART_PIECE_COUNT_INDEX, "Amount of heart pieces collected"},
- {"poes:", POE_COUNT_INDEX, "Amount of poes collected"},
- {"rupees:", RUPEE_COUNT_INDEX, "Current rupee count"}};
+Line lines[LINE_NUM] = {
+ {"arrows:", ARROW_AMMO_INDEX, "Current arrow count"},
+ {"bomb bag 1 num:", BOMB_BAG_1_AMMO_INDEX, "Amount of bombs in bag 1"},
+ {"bomb bag 2 num:", BOMB_BAG_2_AMMO_INDEX, "Amount of bombs in bag 2"},
+ {"bomb bag 3 num:", BOMB_BAG_3_AMMO_INDEX, "Amount of bombs in bag 3"},
+ {"seeds:", SLINGSHOT_AMMO_INDEX, "Current seed count"},
+ {"heart pieces:", HEART_PIECE_COUNT_INDEX, "Amount of heart pieces collected"},
+ {"poes:", POE_COUNT_INDEX, "Amount of poes collected"},
+ {"rupees:", RUPEE_COUNT_INDEX, "Current rupee count"},
+};
+
+void AmountsMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
-void AmountsMenu::render() {
// update amounts
- arrow_ammo = dComIfGs_getArrowNum();
- bomb_bag_1_ammo = dComIfGs_getBombNum(BOMB_BAG_1);
- bomb_bag_2_ammo = dComIfGs_getBombNum(BOMB_BAG_2);
- bomb_bag_3_ammo = dComIfGs_getBombNum(BOMB_BAG_3);
- slingshot_ammo = dComIfGs_getPachinkoNum();
- poe_count = dComIfGs_getPohSpiritNum();
- hp_count = dComIfGs_getMaxLife();
- rupee_count = dComIfGs_getRupee();
+ l_arrowNum = dComIfGs_getArrowNum();
+ l_bag1Num = dComIfGs_getBombNum(BOMB_BAG_1);
+ l_bag2Num = dComIfGs_getBombNum(BOMB_BAG_2);
+ l_bag3Num = dComIfGs_getBombNum(BOMB_BAG_3);
+ l_seedNum = dComIfGs_getPachinkoNum();
+ l_poeNum = dComIfGs_getPohSpiritNum();
+ l_hpNum = dComIfGs_getMaxLife();
+ l_rupeeNum = dComIfGs_getRupee();
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_INVENTORY_INDEX);
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_INVENTORY_MENU);
return;
- };
-
- if (!init_once) {
- current_input = 0;
- init_once = true;
}
switch (cursor.y) {
- case ARROW_AMMO_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- arrow_ammo--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- arrow_ammo++;
- }
- dComIfGs_setArrowNum(arrow_ammo);
+ case ARROW_AMMO_INDEX:
+ Cursor::moveList(l_arrowNum);
+ dComIfGs_setArrowNum(l_arrowNum);
break;
- }
- case BOMB_BAG_1_AMMO_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- bomb_bag_1_ammo--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- bomb_bag_1_ammo++;
- }
- dComIfGs_setBombNum(BOMB_BAG_1, bomb_bag_1_ammo);
+ case BOMB_BAG_1_AMMO_INDEX:
+ Cursor::moveList(l_bag1Num);
+ dComIfGs_setBombNum(BOMB_BAG_1, l_bag1Num);
break;
- }
- case BOMB_BAG_2_AMMO_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- bomb_bag_2_ammo--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- bomb_bag_2_ammo++;
- }
- dComIfGs_setBombNum(BOMB_BAG_2, bomb_bag_2_ammo);
+ case BOMB_BAG_2_AMMO_INDEX:
+ Cursor::moveList(l_bag2Num);
+ dComIfGs_setBombNum(BOMB_BAG_2, l_bag2Num);
break;
- }
- case BOMB_BAG_3_AMMO_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- bomb_bag_3_ammo--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- bomb_bag_3_ammo++;
- }
- dComIfGs_setBombNum(BOMB_BAG_3, bomb_bag_3_ammo);
+ case BOMB_BAG_3_AMMO_INDEX:
+ Cursor::moveList(l_bag3Num);
+ dComIfGs_setBombNum(BOMB_BAG_3, l_bag3Num);
break;
- }
- case SLINGSHOT_AMMO_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- slingshot_ammo--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- slingshot_ammo++;
- }
- dComIfGs_setPachinkoNum(slingshot_ammo);
+ case SLINGSHOT_AMMO_INDEX:
+ Cursor::moveList(l_seedNum);
+ dComIfGs_setPachinkoNum(l_seedNum);
break;
- }
- case HEART_PIECE_COUNT_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- hp_count--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- hp_count++;
- }
- dComIfGs_setMaxLife(hp_count);
+ case HEART_PIECE_COUNT_INDEX:
+ Cursor::moveList(l_hpNum);
+ dComIfGs_setMaxLife(l_hpNum);
break;
- }
- case POE_COUNT_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- poe_count--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- poe_count++;
- }
- dComIfGs_setPohSpiritNum(poe_count);
+ case POE_COUNT_INDEX:
+ Cursor::moveList(l_poeNum);
+ dComIfGs_setPohSpiritNum(l_poeNum);
break;
- }
- case RUPEE_COUNT_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- rupee_count--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT)) {
- rupee_count++;
- }
- dComIfGs_setRupee(rupee_count);
+ case RUPEE_COUNT_INDEX:
+ Cursor::moveList(l_rupeeNum);
+ dComIfGs_setRupee(l_rupeeNum);
break;
}
- }
- tp_sprintf(lines[ARROW_AMMO_INDEX].value, " <%d>", arrow_ammo);
- tp_sprintf(lines[BOMB_BAG_1_AMMO_INDEX].value, " <%d>", bomb_bag_1_ammo);
- tp_sprintf(lines[BOMB_BAG_2_AMMO_INDEX].value, " <%d>", bomb_bag_2_ammo);
- tp_sprintf(lines[BOMB_BAG_3_AMMO_INDEX].value, " <%d>", bomb_bag_3_ammo);
- tp_sprintf(lines[SLINGSHOT_AMMO_INDEX].value, " <%d>", slingshot_ammo);
- tp_sprintf(lines[HEART_PIECE_COUNT_INDEX].value, " <%d>", hp_count);
- tp_sprintf(lines[POE_COUNT_INDEX].value, " <%d>", poe_count);
- tp_sprintf(lines[RUPEE_COUNT_INDEX].value, " <%d>", rupee_count);
+ tp_sprintf(lines[ARROW_AMMO_INDEX].value, " <%d>", l_arrowNum);
+ tp_sprintf(lines[BOMB_BAG_1_AMMO_INDEX].value, " <%d>", l_bag1Num);
+ tp_sprintf(lines[BOMB_BAG_2_AMMO_INDEX].value, " <%d>", l_bag2Num);
+ tp_sprintf(lines[BOMB_BAG_3_AMMO_INDEX].value, " <%d>", l_bag3Num);
+ tp_sprintf(lines[SLINGSHOT_AMMO_INDEX].value, " <%d>", l_seedNum);
+ tp_sprintf(lines[HEART_PIECE_COUNT_INDEX].value, " <%d>", l_hpNum);
+ tp_sprintf(lines[POE_COUNT_INDEX].value, " <%d>", l_poeNum);
+ tp_sprintf(lines[RUPEE_COUNT_INDEX].value, " <%d>", l_rupeeNum);
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/any_saves_menu.cpp b/src/menus/any_saves_menu.cpp
index 47f92f9..9eaa6a4 100644
--- a/src/menus/any_saves_menu.cpp
+++ b/src/menus/any_saves_menu.cpp
@@ -1,42 +1,26 @@
#include "menus/any_saves_menu.h"
-#include "controller.h"
-#include "fifo_queue.h"
-#include "gorge.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-#include "libtp_c/include/msl_c/string.h"
-#include "menus/practice_menu.h"
-#include "rollcheck.h"
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
-#include "utils/loading.h"
-#include "libtp_c/include/utils.h"
-#include "libtp_c/include/f_op/f_op_actor_mng.h"
-#include "libtp_c/include/rel/d/a/b/d_a_b_ds.h"
-#include "libtp_c/include/rel/d/a/obj/d_a_obj_lv4sand.h"
-#include "libtp_c/include/f_op/f_op_actor_iter.h"
+#include "gz_flags.h"
+#include "save_specials.h"
-#include "fs.h"
-#define LINES 50
+#define LINE_NUM 49
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor AnySavesMenu::cursor;
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"ordon gate clip", ORDON_GATE_CLIP_INDEX, "Gate Clip outside Ordon Spring"},
- {"back in time", BACK_IN_TIME_INDEX, "Back In Time off the Ordon Spring bridge"},
+ {"back in time", BACK_IN_TIME_INDEX, "Back in Time off the Ordon Spring bridge"},
{"goats", GOATS_INDEX, "Goat herding 2"},
{"sword and shield skip", HUGO_INDEX, "Hangin' with Hugo"},
- {"early master sword", EMS_INDEX, "Super Jump to early Sacred Grove"},
+ {"early master sword", EMS_INDEX, "Super Jump to Sacred Grove"},
{"purple mist", MIST_INDEX, "Purple mist in Faron Woods (post-EMS)"},
- {"forest bit", FRST_BIT_INDEX, "Back In Time in Forest Temple"},
- {"forest escape", FRST_ESCAPE_INDEX, "LJA over S Faron exit trigger"},
- {"gorge void", GORGE_VOID_INDEX, "1 frame jump attack into faron gorge"},
- {"rupee roll", RUPEE_ROLL_INDEX, "LJA onto fence + pick up rupee"},
- {"lanayru gate clip", LANAYRU_GATE_CLIP_INDEX, "Gate Clip outside Lake Hylia"},
+ {"forest bit", FRST_BIT_INDEX, "Back in Time in Forest Temple"},
+ {"forest escape", FRST_ESCAPE_INDEX, "LJA over S.Faron exit trigger"},
+ {"gorge void", GORGE_VOID_INDEX, "1 frame jump attack into Gorge"},
+ {"rupee roll", RUPEE_ROLL_INDEX, "Rupee Roll / Gorge Skip"},
+ {"lanayru gate clip", LANAYRU_GATE_CLIP_INDEX, "Gate Clip to Lanayru"},
{"pillar clip", PILLAR_CLIP_INDEX, "Pillar Clip in Lake Hylia (low water)"},
- {"lakebed 1", LAKEBED_1_INDEX, "The first Lakebed Temple segment"},
- {"deku toad", TOAD_INDEX, "The miniboss of Lakebed Temple"},
+ {"lakebed 1", LAKEBED_1_INDEX, "The 1st Lakebed Temple segment"},
+ {"deku toad", TOAD_INDEX, "Lakebed Temple miniboss"},
{"kargorok flight", KARG_INDEX, "Clip OoB with trumpet bird"},
{"eldin twilight", ELDIN_TWILIGHT_INDEX, "Eldin Twilight tears"},
{"lanayru twilight", LANAYRU_TWILIGHT_INDEX, "Lanayru Twilight tears"},
@@ -44,187 +28,68 @@ Line lines[LINES] = {
{"boss bug", BOSS_BUG_INDEX, "Lanayru Twilight boss bug"},
{"iza", IZA_INDEX, "Steal Iza's bomb bag"},
{"norgor", NORGOR_INDEX, "Goron bomb bag without water bombs"},
- {"snowpeak messenger skip", SPR_WARP_SKIP_INDEX, "LJA to skip the Snowpeak messenger fight"},
- {"snowpeak", SPR_INDEX, "The Snowpeak Ruins dungeon segment"},
- {"dark hammer", DARK_HAMMER_INDEX, "The Snowpeak Ruins miniboss"},
- {"lakebed 2", LAKEBED_2_INDEX, "The second Lakebed Temple segment"},
- {"lakebed bk skip", LAKEBED_BK_SKIP_INDEX, "Boss key skip in Lakebed Temple main room"},
+ {"messenger skip", SPR_WARP_SKIP_INDEX, "LJA to skip the Snowpeak messengers"},
+ {"snowpeak", SPR_INDEX, "The Snowpeak Ruins segment"},
+ {"dark hammer", DARK_HAMMER_INDEX, "Snowpeak Ruins miniboss"},
+ {"lakebed bk skip", LAKEBED_BK_SKIP_INDEX, "Boss Key skip in Lakebed Temple"},
{"morpheel", ONEBOMB_INDEX, "Morpheel fight (no Zora Armor)"},
- {"mdh tower", MDH_TOWER_INDEX, "MDH tower climb before castle rooftops"},
- {"mdh bridge", MDH_BRIDGE_INDEX, "The falling bridge on castle rooftops"},
- {"bulblin camp", BULBLIN_CAMP_INDEX, "The area before Arbiter's Grounds"},
+ {"mdh tower", MDH_TOWER_INDEX, "MDH tower climb"},
+ {"mdh bridge", MDH_BRIDGE_INDEX, "MDH castle rooftops"},
+ {"bulblin camp", BULBLIN_CAMP_INDEX, "The camp before Arbiter's Grounds"},
{"arbiter's grounds", AG_INDEX, "The Arbiter's Grounds segment"},
{"poe 1 skip", POE_1_SKIP_INDEX, "The pillar jump in Arbiter's Grounds"},
- {"death sword", DSS_INDEX, "The Arbiter's Grounds miniboss"},
- {"stallord", STALLORD_INDEX, "The Arbiter's Grounds boss"},
+ {"death sword", DSS_INDEX, "Arbiter's Grounds miniboss"},
+ {"stallord", STALLORD_INDEX, "Arbiter's Grounds boss"},
{"stallord 2", STALLORD2_INDEX, "Stallord 2nd phase"},
- {"city in the sky early", CITS_EARLY_INDEX, "Clip to the cannon early"},
- {"city in the sky 1", CITS_1_INDEX, "The first City in the Sky segment"},
- {"aeralfos skip", AERALFOS_SKIP_INDEX, "The City in the Sky miniboss"},
- {"city in the sky 2", CITS_2_INDEX, "The second City in the Sky segment"},
- {"fan tower", FAN_TOWER_INDEX, "Final fan room in CitS before the boss"},
- {"argorok", ARGOROK_INDEX, "The City in the Sky boss"},
- {"palace of twilight 1", PALACE_1_INDEX, "The first Palace of Twilight segment"},
- {"palace of twilight 2", PALACE_2_INDEX,
- "The second Palace of Twilight segment (after both Sols)"},
+ {"city early", CITS_EARLY_INDEX, "Clip to the cannon early"},
+ {"city 1", CITS_1_INDEX, "The 1st City in the Sky segment"},
+ {"aeralfos skip", AERALFOS_SKIP_INDEX, "City in the Sky miniboss"},
+ {"city 2", CITS_2_INDEX, "The 2nd City in the Sky segment"},
+ {"fan tower", FAN_TOWER_INDEX, "Final fan room in City"},
+ {"argorok", ARGOROK_INDEX, "City in the Sky boss"},
+ {"palace 1", PALACE_1_INDEX, "The 1st Palace of Twilight segment"},
+ {"palace 2", PALACE_2_INDEX, "The 2nd Palace of Twilight segment"},
{"early platform", EARLY_PLATFORM_INDEX, "Early platform in Palace of Twilight"},
- {"zant", ZANT_INDEX, "The Palace of Twilight boss"},
+ {"zant", ZANT_INDEX, "Palace of Twilight boss"},
{"hyrule castle", HC_INDEX, "The Hyrule Castle segment"},
- {"darknut fight", DARKNUT_INDEX, "The Darknut fight in Hyrule Castle"},
- {"final tower climb", HC_TOWER_INDEX, "The tower climb before the final boss fights"},
+ {"darknut fight", DARKNUT_INDEX, "The 1st Darknut fight in Hyrule Castle"},
+ {"final tower climb", HC_TOWER_INDEX, "The tower climb before Ganondorf"},
{"beast ganon", BEAST_GANON_INDEX, "The Beast Ganon fight"},
- {"horseback ganon", HORSEBACK_GANON_INDEX, "The horseback Ganondorf fight"}};
+ {"horseback ganon", HORSEBACK_GANON_INDEX, "The Horseback Ganondorf fight"},
+};
-void hugo() {
- gSaveManager.inject_default_during();
- dComIfGs_onSwitch(47, 0); // midna trigger off
- dComIfGs_offSwitch(63, 0); // hugo alive
-}
-
-void spawn_hugo() {
- gSaveManager.setSaveAngle(40166);
- gSaveManager.setSavePosition(2.9385, 396.9580, -18150.087);
- gSaveManager.setLinkInfo();
-
- cXyz position(-289.9785, 401.5400, -18533.078);
- fopAcM_create(468, 0x0000F100, &position, dComIfGp_getPlayer()->mCurrent.mRoomNo,
- &dComIfGp_getPlayer()->mCurrent.mAngle, nullptr, 0xFF);
-}
-
-void karg_oob() {
- gSaveManager.mPracticeFileOpts.inject_options_before_load = nullptr;
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
- dComIfGs_setTransformStatus(STATUS_HUMAN);
-}
-
-void morpheel() {
- dComIfGp_getPlayer()->mHeldItem = HOOKSHOT; // clawshot
- dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
-}
-
-void stallord_2() {
- gSaveManager.mPracticeFileOpts.inject_options_after_counter = 20;
-
- daB_DS_c* stallord = (daB_DS_c*)fopAcM_SearchByName(246); // stallord proc name
- daObjLv4Sand_c* sand = (daObjLv4Sand_c*)fopAcM_SearchByName(189); // sand proc name
-
- if (stallord != NULL) {
- stallord->mBase.mParameters |= 0x2; // make actor phase 2 version
- stallord->mAttentionInfo.mFlags = 4; // makes stallord targetable when hit down
- stallord->mActionMode1 = 1; // make stallord head active
- stallord->mGravity = 0.0f; // change gravity to 0
- g_env_light.mWeatherPalette = 2; // set arena light
- sand->mSpeed.y = 1000.0f; // move sand out of the way
-
- dComIfGs_onOneZoneSwitch(6, stallord->mCurrent.mRoomNo);
- dComIfGs_onZoneSwitch(7, stallord->mCurrent.mRoomNo); // sets arena to raised
-
- stallord->mCurrent.mPosition.x = -2097.20f; //-2397.22f;
- stallord->mCurrent.mPosition.y = 1022.21f; // 1697.20f;
- stallord->mCurrent.mPosition.z = -1246.87f; // 1131.33f;
-
- dComIfGp_getPlayer()->mCurrent.mPosition.x = 644.91f;
- dComIfGp_getPlayer()->mCurrent.mPosition.y = 300.3158f;
- dComIfGp_getPlayer()->mCurrent.mPosition.z = 2195.0237f;
- dComIfGp_getPlayer()->mCollisionRot.mY = 39350;
- // tp_matrixInfo.matrix_info->target = {865.203f, -1414.390f, 2496.8774f};
- // tp_matrixInfo.matrix_info->pos = {644.438f, -1480.324f, 2194.693f};
- }
-}
-
-void stallord2_init() {
- gSaveManager.repeat_during = true;
- gSaveManager.repeat_count = 120;
-
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
- setNextStagePoint(1); // spawn at in front of stally
-}
-
-void stallord() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
- setNextStagePoint(1); // spawn at in front of stally
-}
-
-void fan_tower() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0; // reset city switches
-}
-
-void argorok() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x10000;
-}
-
-void palace1() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0; // reset palace switches
-}
-
-void palace2() {
- dComIfGp_getPlayer()->mHeldItem = 3; // master sword
-}
-
-void lakebed_bk_skip_during() {
- gSaveManager.inject_default_during();
- dComIfGs_onSwitch(2, 0); // bridge turned
- dComIfGs_onSwitch(122, 0); // dungeon intro cs off
-}
-
-void bossflags() {
- gSaveManager.inject_default_during();
- tp_bossFlags = 0xFF;
-}
-
-void darkhammer() {
- dComIfGs_onEventBit(0x0B02);
- dComIfGs_onEventBit(0x0B04); // iza bomb bag stolen
-}
-
-void waterfall_sidehop() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mRestart.mLastSpeedF = 10.0f; // link spawns swimming forward
-}
-
-void AnySavesMenu::render() {
+void AnySavesMenu::draw() {
special AnySpecials[ANY_SPECIALS_AMNT] = {
- special(HUGO_INDEX, hugo, spawn_hugo),
- special(KARG_INDEX, karg_oob, nullptr),
- special(LAKEBED_BK_SKIP_INDEX, lakebed_bk_skip_during, nullptr),
- special(ONEBOMB_INDEX, nullptr, morpheel),
- special(STALLORD_INDEX, stallord, nullptr),
- special(STALLORD2_INDEX, stallord2_init, stallord_2),
- special(FRST_ESCAPE_INDEX, bossflags, nullptr),
- special(GORGE_VOID_INDEX, bossflags, nullptr),
- special(RUPEE_ROLL_INDEX, bossflags, nullptr),
- special(LANAYRU_GATE_CLIP_INDEX, bossflags, nullptr),
- special(PILLAR_CLIP_INDEX, bossflags, nullptr),
- special(LAKEBED_1_INDEX, bossflags, nullptr),
- special(WATERFALL_SIDEHOP_INDEX, waterfall_sidehop, nullptr),
- special(DARK_HAMMER_INDEX, bossflags, darkhammer),
- special(FAN_TOWER_INDEX, fan_tower, nullptr),
- special(ARGOROK_INDEX, argorok, nullptr),
- special(PALACE_1_INDEX, palace1, nullptr),
- special(PALACE_2_INDEX, nullptr, palace2)};
-
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_PRACTICE_INDEX);
- init_once = false;
- return;
+ special(HUGO_INDEX, SaveMngSpecial_Hugo, SaveMngSpecial_SpawnHugo),
+ special(KARG_INDEX, SaveMngSpecial_KargOoB, nullptr),
+ special(NORGOR_INDEX, nullptr, SaveMngSpecial_Norgor),
+ special(LAKEBED_BK_SKIP_INDEX, SaveMngSpecial_LakebedBKSkip, nullptr),
+ special(ONEBOMB_INDEX, nullptr, SaveMngSpecial_Morpheel),
+ special(STALLORD_INDEX, SaveMngSpecial_Stallord, nullptr),
+ special(STALLORD2_INDEX, SaveMngSpecial_Stallord2_init, SaveMngSpecial_Stallord2),
+ special(FRST_ESCAPE_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(GORGE_VOID_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(RUPEE_ROLL_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(LANAYRU_GATE_CLIP_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(PILLAR_CLIP_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(LAKEBED_1_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(WATERFALL_SIDEHOP_INDEX, SaveMngSpecial_WaterfallSidehop, nullptr),
+ special(DARK_HAMMER_INDEX, SaveMngSpecial_BossFlags, SaveMngSpecial_Darkhammer),
+ special(FAN_TOWER_INDEX, SaveMngSpecial_FanTower, nullptr),
+ special(ARGOROK_INDEX, SaveMngSpecial_Argorok, nullptr),
+ special(PALACE_1_INDEX, SaveMngSpecial_Palace1, nullptr),
+ special(PALACE_2_INDEX, nullptr, SaveMngSpecial_Palace2),
};
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_PRACTICE_MENU);
+ return;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
- SaveManager::load_save(cursor.y, (char*)"any", AnySpecials, ANY_SPECIALS_AMNT);
- init_once = false;
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ SaveManager::loadSave(cursor.y, "any", AnySpecials, ANY_SPECIALS_AMNT);
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/cheat_menu.cpp b/src/menus/cheat_menu.cpp
index ec3f573..edf6a05 100644
--- a/src/menus/cheat_menu.cpp
+++ b/src/menus/cheat_menu.cpp
@@ -1,16 +1,12 @@
#include "cheats.h"
#include "commands.h"
-#include "controller.h"
-#include "libtp_c/include/addrs.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/patch.h"
#include "libtp_c/include/msl_c/string.h"
#include "menus/cheats_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES CHEAT_AMNT
+#define LINE_NUM CHEAT_AMNT
#ifdef GCN_PLATFORM
#define INVINCIBLE_ENEMIES_OFFSET (0x328)
@@ -19,12 +15,9 @@
#define INVINCIBLE_ENEMIES_OFFSET (0x244)
#endif
-static Cursor cursor = {0, 0};
-bool init_once = false;
-bool door_collision = false;
-using namespace Cheats;
+Cursor CheatsMenu::cursor;
-Cheat CheatItems[CHEAT_AMNT] = {
+Cheat g_cheats[CHEAT_AMNT] = {
{InfiniteAir, false}, {InfiniteArrows, false}, {InfiniteBombs, false},
{InfiniteHearts, false}, {InfiniteOil, false}, {InfiniteRupees, false},
{InfiniteSlingshot, false}, {Invincible, false}, {InvincibleEnemies, false},
@@ -35,176 +28,137 @@ Cheat CheatItems[CHEAT_AMNT] = {
#endif
};
-Line lines[LINES] = {
- {"infinite air", InfiniteAir, "Gives Link infinite air underwater", true,
- &CheatItems[InfiniteAir].active},
- {"infinite arrows", InfiniteArrows, "Gives Link 99 arrows", true,
- &CheatItems[InfiniteArrows].active},
- {"infinite bombs", InfiniteBombs, "Gives Link 99 bombs in all bags", true,
- &CheatItems[InfiniteBombs].active},
- {"infinite hearts", InfiniteHearts, "Link will always have full hearts", true,
- &CheatItems[InfiniteHearts].active},
- {"infinite oil", InfiniteOil, "Gives Link infinite lantern oil", true,
- &CheatItems[InfiniteOil].active},
- {"infinite rupees", InfiniteRupees, "Link will always have 1000 rupees", true,
- &CheatItems[InfiniteRupees].active},
- {"infinite slingshot", InfiniteSlingshot, "Gives Link 99 slingshot pellets", true,
- &CheatItems[InfiniteSlingshot].active},
- {"invincible", Invincible, "Makes Link invincible", true, &CheatItems[Invincible].active},
- {"invincible enemies", InvincibleEnemies, "Makes some enemies invincible", true,
- &CheatItems[InvincibleEnemies].active},
+Line lines[LINE_NUM] = {
+ {"infinite air", InfiniteAir, "Gives infinite air underwater", true,
+ &g_cheats[InfiniteAir].active},
+ {"infinite arrows", InfiniteArrows, "Always have 99 arrows", true,
+ &g_cheats[InfiniteArrows].active},
+ {"infinite bombs", InfiniteBombs, "Always have 99 bombs", true,
+ &g_cheats[InfiniteBombs].active},
+ {"infinite hearts", InfiniteHearts, "Always have full hearts", true,
+ &g_cheats[InfiniteHearts].active},
+ {"infinite oil", InfiniteOil, "Gives infinite lantern oil", true,
+ &g_cheats[InfiniteOil].active},
+ {"infinite rupees", InfiniteRupees, "Always have 1000 rupees", true,
+ &g_cheats[InfiniteRupees].active},
+ {"infinite slingshot", InfiniteSlingshot, "Always have 99 slingshot pellets", true,
+ &g_cheats[InfiniteSlingshot].active},
+ {"invincible", Invincible, "Disables Link's hurtbox", true, &g_cheats[Invincible].active},
+ {"invincible enemies", InvincibleEnemies, "Make some enemies invincible", true,
+ &g_cheats[InvincibleEnemies].active},
{"moon jump", MoonJump, "Hold " MOON_JUMP_TEXT " to moon jump", true,
- &CheatItems[MoonJump].active},
+ &g_cheats[MoonJump].active},
{"disable walls", DoorStorage, "Disables most wall collision", true,
- &CheatItems[DoorStorage].active},
- {"super clawshot", SuperClawshot, "Super Clawshot", true, &CheatItems[SuperClawshot].active},
+ &g_cheats[DoorStorage].active},
+ {"super clawshot", SuperClawshot, "Super fast / long Clawshot", true,
+ &g_cheats[SuperClawshot].active},
{"unrestricted items", UnrestrictedItems, "Disable item restrictions", true,
- &CheatItems[UnrestrictedItems].active},
+ &g_cheats[UnrestrictedItems].active},
{"transform anywhere", TransformAnywhere, "Transform at any location", true,
- &CheatItems[TransformAnywhere].active},
+ &g_cheats[TransformAnywhere].active},
#ifdef WII_PLATFORM
- {"gale LJA", GaleLJA, "Yeet everywhere", true, &CheatItems[GaleLJA].active},
+ {"gale LJA", GaleLJA, "Yeet everywhere", true, &g_cheats[GaleLJA].active},
#endif
};
-namespace Cheats {
-using namespace Controller;
-
-void apply_cheats() {
- for (auto cheat : CheatItems) {
- if (cheat.active) {
- switch (cheat.id) {
- case MoonJump: {
- Commands::enable_command(Commands::CMD_MOON_JUMP);
- break;
- }
- case InvincibleEnemies: {
- *reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
- 0x60000000; // nop
- DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- break;
- }
- case Invincible: {
- if (dComIfGp_getPlayer()) {
- dComIfGp_getPlayer()->field_0x56b[2] = 5;
- }
- break;
- }
- case InfiniteHearts: {
- uint16_t max_life = dComIfGs_getMaxLife();
- dComIfGs_setLife((max_life / 5) * 4);
- break;
- }
- case InfiniteAir: {
- dComIfGs_setOxygen(600);
- break;
- }
- case InfiniteOil: {
- dComIfGs_setOil(21600);
- break;
- }
- case InfiniteBombs: {
- dComIfGs_setBombNum(BOMB_BAG_1, 99);
- dComIfGs_setBombNum(BOMB_BAG_2, 99);
- dComIfGs_setBombNum(BOMB_BAG_3, 99);
- break;
- }
- case InfiniteRupees: {
- dComIfGs_setRupee(1000);
- break;
- }
- case InfiniteArrows: {
- dComIfGs_setArrowNum(99);
- break;
- }
- case InfiniteSlingshot: {
- dComIfGs_setPachinkoNum(99);
- break;
- }
- case SuperClawshot: {
- tp_clawshot.speed = 2870.0f;
- tp_clawshot.extension_rate = 69120.0f;
- tp_clawshot.retraction_rate = 2870.0f;
- tp_clawshot.pull_rate = 500.0f;
- break;
- }
- case DoorStorage: {
- if (dComIfGp_getPlayer()) {
- dComIfGp_getPlayer()->mLinkAcch.SetWallNone();
- dComIfGp_getPlayer()->mLinkAcch.OnLineCheckNone();
- door_collision = true;
- }
- break;
- }
-#ifdef WII_PLATFORM
- case GaleLJA: {
- if (dComIfGp_getPlayer() && dComIfGp_getPlayer()->mActionID == 0x60 &&
- dComIfGp_getPlayer()->mHeldItem == NO_ITEM) {
- dComIfGp_getPlayer()->mHeldItem = 0x0103;
- }
- }
-#endif
- default: {
- }
- }
- } else {
- switch (cheat.id) {
- case MoonJump: {
- Commands::disable_command(Commands::CMD_MOON_JUMP);
- break;
- }
- case InvincibleEnemies: {
- *reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
- 0x7C030050; // sub r0, r0, r3
- DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- break;
- }
- case SuperClawshot: {
- tp_clawshot.speed = 100.0f;
- tp_clawshot.extension_rate = 2000.0f;
- tp_clawshot.retraction_rate = 150.0f;
- tp_clawshot.pull_rate = 60.0f;
- break;
- }
- case DoorStorage: {
- if (dComIfGp_getPlayer() && door_collision == true) {
- dComIfGp_getPlayer()->mLinkAcch.OffWallNone();
- dComIfGp_getPlayer()->mLinkAcch.OffLineCheckNone();
- door_collision = false;
- }
- break;
- }
- default: {
- }
- }
+bool l_doorCollision = false;
+
+void GZ_applyCheats() {
+ if (GZ_checkCheat(MoonJump)) {
+ GZCmd_enable(CMD_MOON_JUMP);
+ } else {
+ GZCmd_disable(CMD_MOON_JUMP);
+ }
+
+ if (GZ_checkCheat(InvincibleEnemies)) {
+ *reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
+ 0x60000000; // nop
+ DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET), sizeof(uint32_t));
+ ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
+ } else {
+ *reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
+ 0x7C030050; // sub r0, r0, r3
+ DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET), sizeof(uint32_t));
+ ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
+ }
+
+ if (GZ_checkCheat(Invincible)) {
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mDamageTimer = 5;
}
}
-};
-} // namespace Cheats
-void CheatsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- return;
- };
+ if (GZ_checkCheat(InfiniteHearts)) {
+ uint16_t max_life = dComIfGs_getMaxLife();
+ dComIfGs_setLife((max_life / 5) * 4);
+ }
+
+ if (GZ_checkCheat(InfiniteAir)) {
+ dComIfGs_setOxygen(600);
+ }
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_checkCheat(InfiniteOil)) {
+ dComIfGs_setOil(21600);
}
- Utilities::move_cursor(cursor, LINES);
+ if (GZ_checkCheat(InfiniteBombs)) {
+ dComIfGs_setBombNum(BOMB_BAG_1, 99);
+ dComIfGs_setBombNum(BOMB_BAG_2, 99);
+ dComIfGs_setBombNum(BOMB_BAG_3, 99);
+ }
+
+ if (GZ_checkCheat(InfiniteRupees)) {
+ dComIfGs_setRupee(1000);
+ }
+
+ if (GZ_checkCheat(InfiniteArrows)) {
+ dComIfGs_setArrowNum(99);
+ }
+
+ if (GZ_checkCheat(InfiniteSlingshot)) {
+ dComIfGs_setPachinkoNum(99);
+ }
+
+ if (GZ_checkCheat(SuperClawshot)) {
+ daAlinkHIO_hookshot.mShootSpeed = 2870.0f;
+ daAlinkHIO_hookshot.mMaxLength = 69120.0f;
+ daAlinkHIO_hookshot.mReturnSpeed = 2870.0f;
+ daAlinkHIO_hookshot.mClawReturnSpeed = 500.0f;
+ } else {
+ daAlinkHIO_hookshot.mShootSpeed = 100.0f;
+ daAlinkHIO_hookshot.mMaxLength = 2000.0f;
+ daAlinkHIO_hookshot.mReturnSpeed = 150.0f;
+ daAlinkHIO_hookshot.mClawReturnSpeed = 60.0f;
+ }
+
+ if (GZ_checkCheat(DoorStorage)) {
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mLinkAcch.SetWallNone();
+ dComIfGp_getPlayer()->mLinkAcch.OnLineCheckNone();
+ l_doorCollision = true;
+ }
+ } else {
+ if (dComIfGp_getPlayer() && l_doorCollision) {
+ dComIfGp_getPlayer()->mLinkAcch.OffWallNone();
+ dComIfGp_getPlayer()->mLinkAcch.OffLineCheckNone();
+ l_doorCollision = false;
+ }
+ }
+}
+
+void CheatsMenu::draw() {
+ cursor.move(0, LINE_NUM);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(MN_MAIN_MENU_INDEX);
+ return;
+ }
- if (current_input == SELECTION_BUTTON && a_held == false) {
- CheatItems[cursor.y].active = !(CheatItems[cursor.y].active);
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ g_cheats[cursor.y].active = !g_cheats[cursor.y].active;
}
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/dungeon_flags_menu.cpp b/src/menus/dungeon_flags_menu.cpp
index c58f145..1f20670 100644
--- a/src/menus/dungeon_flags_menu.cpp
+++ b/src/menus/dungeon_flags_menu.cpp
@@ -1,45 +1,35 @@
-#include "controller.h"
-#include "font.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "menus/flags_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#include <stdint.h>
-
-#define LINES 8
+#define LINE_NUM 8
#define MAX_DUNGEON_OPTIONS 9
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor DungeonFlagsMenu::cursor;
-bool map_flag;
-bool compass_flag;
-bool boss_key_flag;
-bool miniboss_flag;
-bool boss_flag;
+bool init_once = false;
-int select_dungeon_index = 0;
-uint8_t key_num = 0;
-uint8_t area_id;
+bool l_mapFlag;
+bool l_compassFlag;
+bool l_bosskeyFlag;
+bool l_minibossFlag;
+bool l_bossFlag;
+int l_selDun = 0;
+uint8_t l_keyNum = 0;
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"dungeon:", SELECT_DUNGEON_INDEX, "Selected dungeon flags", false, nullptr,
MAX_DUNGEON_OPTIONS},
{"small keys", SMALL_KEY_FLAG_INDEX, "Selected dungeon small keys", false, nullptr, 5},
- {"have map", MAP_FLAG_INDEX, "Give selected dungeon map", true, &map_flag},
- {"have compass", COMPASS_FLAG_INDEX, "Give selected dungeon compass", true, &compass_flag},
- {"have boss key", BOSS_KEY_FLAG_INDEX, "Give selected dungeon boss key", true, &boss_key_flag},
+ {"have map", MAP_FLAG_INDEX, "Give selected dungeon map", true, &l_mapFlag},
+ {"have compass", COMPASS_FLAG_INDEX, "Give selected dungeon compass", true, &l_compassFlag},
+ {"have boss key", BOSS_KEY_FLAG_INDEX, "Give selected dungeon boss key", true, &l_bosskeyFlag},
{"miniboss dead", DEFEAT_MINIBOSS_FLAG_INDEX, "Selected dungeon miniboss is defeated", true,
- &miniboss_flag},
- {"boss dead", DEFEAT_BOSS_FLAG_INDEX, "Selected dungeon boss is defeated", true, &boss_flag},
- {"clear flags", CLEAR_DUNGEON_FLAGS_INDEX, "Clear all selected dungeon flags"}};
-
-ListMember dungeon_options[MAX_DUNGEON_OPTIONS] = {
- "Forest Temple", "Goron Mines", "Lakebed Temple",
- "Arbiter's Grounds", "Snowpeak Ruins", "Temple of Time",
- "City in the Sky", "Palace of Twilight", "Hyrule Castle"};
+ &l_minibossFlag},
+ {"boss dead", DEFEAT_BOSS_FLAG_INDEX, "Selected dungeon boss is defeated", true, &l_bossFlag},
+ {"clear flags", CLEAR_DUNGEON_FLAGS_INDEX, "Clear all selected dungeon flags"},
+};
bool getSaveDungeonItem(int32_t stage, int32_t flag) {
return dSv_memBit_c__isDungeonItem(&dComIfGs_getSavedata().mSave[stage].mBit, flag);
@@ -61,119 +51,117 @@ void setSaveDungeonKeys(int32_t stage, uint8_t num) {
dComIfGs_getSavedata().mSave[stage].mBit.setKeyNum(num);
}
-void DungeonFlagsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
+void DungeonFlagsMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
init_once = false;
- MenuRendering::set_menu(MN_FLAGS_INDEX);
+ GZ_setMenu(GZ_FLAGS_MENU);
return;
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- key_num = getSaveDungeonKeys(area_id);
- }
-
- if (cursor.y == SELECT_DUNGEON_INDEX) {
- cursor.x = select_dungeon_index;
- Utilities::move_cursor(cursor, LINES, MAX_DUNGEON_OPTIONS, false, false, false, true);
- if (cursor.y == SELECT_DUNGEON_INDEX) {
- select_dungeon_index = cursor.x;
- }
- key_num = getSaveDungeonKeys(area_id);
- } else if (cursor.y == SMALL_KEY_FLAG_INDEX) {
- cursor.x = key_num;
- Utilities::move_cursor(cursor, LINES, 6, false, false, false, true);
- if (cursor.y == SMALL_KEY_FLAG_INDEX) {
- key_num = cursor.x;
- setSaveDungeonKeys(area_id, key_num);
- dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
- }
- } else {
- Utilities::move_cursor(cursor, LINES, 2);
- }
-
- switch (select_dungeon_index) {
- case 0: {
+ uint8_t area_id = 0;
+ switch (l_selDun) {
+ case 0:
area_id = dSv_memory_c::FOREST_TEMPLE;
break;
- }
- case 1: {
+ case 1:
area_id = dSv_memory_c::GORON_MINES;
break;
- }
- case 2: {
+ case 2:
area_id = dSv_memory_c::LAKEBED;
break;
- }
- case 3: {
+ case 3:
area_id = dSv_memory_c::ARBITERS;
break;
- }
- case 4: {
+ case 4:
area_id = dSv_memory_c::SNOWPEAK_RUINS;
break;
- }
- case 5: {
+ case 5:
area_id = dSv_memory_c::TEMPLE_OF_TIME;
break;
- }
- case 6: {
+ case 6:
area_id = dSv_memory_c::CITY;
break;
- }
- case 7: {
+ case 7:
area_id = dSv_memory_c::PALACE;
break;
- }
- case 8: {
+ case 8:
area_id = dSv_memory_c::HYRULE_CASTLE;
break;
}
+
+ if (!init_once) {
+ l_keyNum = getSaveDungeonKeys(area_id);
+ init_once = true;
+ }
+
+ switch (cursor.y) {
+ case SELECT_DUNGEON_INDEX:
+ cursor.x = l_selDun;
+ cursor.move(MAX_DUNGEON_OPTIONS, LINE_NUM);
+
+ if (cursor.y == SELECT_DUNGEON_INDEX) {
+ l_selDun = cursor.x;
+ }
+ l_keyNum = getSaveDungeonKeys(area_id);
+ break;
+ case SMALL_KEY_FLAG_INDEX:
+ cursor.x = l_keyNum;
+ cursor.move(6, LINE_NUM);
+
+ if (cursor.y == SMALL_KEY_FLAG_INDEX) {
+ l_keyNum = cursor.x;
+ setSaveDungeonKeys(area_id, l_keyNum);
+ dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
+ }
+ break;
+ default:
+ cursor.move(0, LINE_NUM);
+ break;
}
// update flags
- map_flag = getSaveDungeonItem(area_id, dSv_memBit_c::MAP);
- compass_flag = getSaveDungeonItem(area_id, dSv_memBit_c::COMPASS);
- boss_key_flag = getSaveDungeonItem(area_id, dSv_memBit_c::BOSS_KEY);
- miniboss_flag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY_2);
- boss_flag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY);
+ l_mapFlag = getSaveDungeonItem(area_id, dSv_memBit_c::MAP);
+ l_compassFlag = getSaveDungeonItem(area_id, dSv_memBit_c::COMPASS);
+ l_bosskeyFlag = getSaveDungeonItem(area_id, dSv_memBit_c::BOSS_KEY);
+ l_minibossFlag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY_2);
+ l_bossFlag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY);
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case MAP_FLAG_INDEX: {
+ case MAP_FLAG_INDEX:
setSaveDungeonItem(area_id, dSv_memBit_c::MAP);
break;
- }
- case COMPASS_FLAG_INDEX: {
+ case COMPASS_FLAG_INDEX:
setSaveDungeonItem(area_id, dSv_memBit_c::COMPASS);
break;
- }
- case BOSS_KEY_FLAG_INDEX: {
+ case BOSS_KEY_FLAG_INDEX:
setSaveDungeonItem(area_id, dSv_memBit_c::BOSS_KEY);
break;
- }
- case DEFEAT_MINIBOSS_FLAG_INDEX: {
+ case DEFEAT_MINIBOSS_FLAG_INDEX:
setSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY_2);
break;
- }
- case DEFEAT_BOSS_FLAG_INDEX: {
+ case DEFEAT_BOSS_FLAG_INDEX:
setSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY);
break;
- }
- case CLEAR_DUNGEON_FLAGS_INDEX: {
+ case CLEAR_DUNGEON_FLAGS_INDEX:
tp_memset(&dComIfGs_getSavedata().mSave[area_id].mBit, 0, sizeof(dSv_memBit_c));
- key_num = 0;
+ l_keyNum = 0;
break;
}
- }
// copy current stage save flags over temp flags
dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
}
- tp_sprintf(lines[SMALL_KEY_FLAG_INDEX].value, " <%d>", key_num);
- tp_sprintf(lines[SELECT_DUNGEON_INDEX].value, " <%s>",
- dungeon_options[select_dungeon_index].member);
+ ListMember dun_opt[MAX_DUNGEON_OPTIONS] = {
+ "Forest Temple", "Goron Mines", "Lakebed Temple",
+ "Arbiter's Grounds", "Snowpeak Ruins", "Temple of Time",
+ "City in the Sky", "Palace of Twilight", "Hyrule Castle",
+ };
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ tp_sprintf(lines[SMALL_KEY_FLAG_INDEX].value, " <%d>", l_keyNum);
+ tp_sprintf(lines[SELECT_DUNGEON_INDEX].value, " <%s>", dun_opt[l_selDun].member);
+
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/flag_log_menu.cpp b/src/menus/flag_log_menu.cpp
index aff61a5..7acc505 100644
--- a/src/menus/flag_log_menu.cpp
+++ b/src/menus/flag_log_menu.cpp
@@ -1,39 +1,28 @@
#include "menus/flags_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "flaglog.h"
+#include "gz_flags.h"
-#define LINES 1
+#define LINE_NUM 1
-static Cursor cursor = {0, 0};
-bool init_once = false;
-bool g_flag_log_active = false;
+Cursor FlagLogMenu::cursor;
+bool g_flagLogEnabled = false;
-Line lines[LINES] = {{"log activated", 0, "toggle flag logger on/off", true, &g_flag_log_active}};
+Line lines[LINE_NUM] = {{"log activated", 0, "toggle flag logger on/off", true, &g_flagLogEnabled}};
-void FlagLogMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_FLAGS_INDEX);
+void FlagLogMenu::draw() {
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_FLAGS_MENU);
return;
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case 0: {
- g_flag_log_active = !g_flag_log_active;
+ case 0:
+ g_flagLogEnabled = !g_flagLogEnabled;
return;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/flag_records_menu.cpp b/src/menus/flag_records_menu.cpp
index c7fed7d..e761094 100644
--- a/src/menus/flag_records_menu.cpp
+++ b/src/menus/flag_records_menu.cpp
@@ -1,184 +1,170 @@
#include "menus/flag_records_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-#include "libtp_c/include/msl_c/math.h"
#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "menus/settings_menu.h"
-#include "utils/cursor.h"
#include "utils/draw.h"
-#include "utils/lines.h"
#include "utils/texture.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/msl_c/string.h"
+#include "gz_flags.h"
#define MAX_DISPLAY_LINES 8
#define WHITE_RGBA 0xFFFFFFFF
#define MAX_RECORD_OPTIONS 4
#define FLAG_RECORD_INDEX 0
-static Cursor cursor = {0, 0};
-bool init_once = false;
-int max_flags;
-uint8_t bit_index = 0;
-uint8_t record_index = 0;
+Cursor FlagRecordsMenu::cursor;
-Texture gzFlagOnTex;
-Texture gzFlagOffTex;
+uint8_t l_bitIdx = 0;
+uint8_t l_recIdx = 0;
+Texture l_flagOnTex;
+Texture l_flagOffTex;
#ifdef GCN_PLATFORM
-#define SCRL_FORW_BUTTON (Controller::X)
-#define SCRL_BACK_BUTTON (Controller::Y)
+#define SCRL_FORW_BUTTON (GZPad::X)
+#define SCRL_BACK_BUTTON (GZPad::Y)
#define SCRL_FORW_TEXT "X"
#define SCRL_BACK_TEXT "Y"
#endif
#ifdef WII_PLATFORM
-#define SCRL_FORW_BUTTON (Controller::TWO)
-#define SCRL_BACK_BUTTON (Controller::ONE)
+#define SCRL_FORW_BUTTON (GZPad::TWO)
+#define SCRL_BACK_BUTTON (GZPad::ONE)
#define SCRL_FORW_TEXT "2"
#define SCRL_BACK_TEXT "1"
#endif
-void render_flag_records(uint8_t* record) {
+void FlagRecordsMenu::drawFlagRecord(uint8_t* record) {
if (cursor.y > 0) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (bit_index == 0) {
- bit_index = 7;
- } else if (bit_index >= 0 && bit_index < 8) {
- bit_index--;
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (l_bitIdx == 0) {
+ l_bitIdx = 7;
+ } else if (l_bitIdx >= 0 && l_bitIdx < 8) {
+ l_bitIdx--;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (bit_index == 7) {
- bit_index = 0;
- } else if (bit_index >= 0 && bit_index < 8) {
- bit_index++;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (l_bitIdx == 7) {
+ l_bitIdx = 0;
+ } else if (l_bitIdx >= 0 && l_bitIdx < 8) {
+ l_bitIdx++;
}
}
}
for (uint8_t i = 0; i < MAX_DISPLAY_LINES; i++) {
- float y_offset;
-#define LINE_X_OFFSET 20.0f
+ const float x_offset = 20.0f;
+ float y_offset = (80.0f + i * 20.0f);
- y_offset = (80.0f + i * 20.0f);
-
- char offset[6];
int idx_num;
-
if (cursor.y > MAX_DISPLAY_LINES) {
idx_num = i + (cursor.y - MAX_DISPLAY_LINES);
} else {
idx_num = i;
}
- tp_sprintf(offset, "0x%02X:", idx_num);
- float flag_x_offset = LINE_X_OFFSET + Font::get_chars_width(offset);
+ char offset[6];
+ tp_sprintf(offset, "0x%02X:", idx_num);
- for (uint8_t bit = 0; bit < 8; bit++) {
+ float flag_x_offset = x_offset + Font::getStrWidth(offset);
+ for (int bit = 0; bit < 8; bit++) {
if (*(record + idx_num) & (1 << bit)) {
- Draw::draw_rect(0xFFFFFFFF, {flag_x_offset + ((7 - bit) * 20.0f), y_offset - 13.0f},
- {16, 16}, &gzFlagOnTex._texObj);
+ Draw::drawRect(0xFFFFFFFF, {flag_x_offset + ((7 - bit) * 20.0f), y_offset - 13.0f},
+ {16, 16}, &l_flagOnTex._texObj);
} else {
- Draw::draw_rect(0xFFFFFFFF, {flag_x_offset + ((7 - bit) * 20.0f), y_offset - 13.0f},
- {16, 16}, &gzFlagOffTex._texObj);
+ Draw::drawRect(0xFFFFFFFF, {flag_x_offset + ((7 - bit) * 20.0f), y_offset - 13.0f},
+ {16, 16}, &l_flagOffTex._texObj);
}
}
+ // Draw Flag cursor
if (cursor.y == (idx_num + 1)) {
- Draw::draw_rect(0x0080FF77,
- {(flag_x_offset + ((7 - bit_index) * 20.0f)), y_offset - 13.0f},
- {16, 16}); // Flag cursor
+ Draw::drawRect(0x0080FF77,
+ {(flag_x_offset + ((7 - l_bitIdx) * 20.0f)), y_offset - 13.0f},
+ {16, 16});
}
- if (current_input == Controller::Pad::A && a_held == false) {
+
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
if (cursor.y == (idx_num + 1)) {
- *(record + idx_num) ^= (1 << bit_index);
+ *(record + idx_num) ^= (1 << l_bitIdx);
}
}
- Font::gz_renderChars(offset, LINE_X_OFFSET, y_offset,
- (cursor.y == (idx_num + 1) ? CURSOR_RGBA : WHITE_RGBA),
- g_drop_shadows);
+ uint32_t color = cursor.y == (idx_num + 1) ? CURSOR_RGBA : WHITE_RGBA;
+ GZ_drawText(offset, x_offset, y_offset, color, GZ_checkDropShadows());
}
}
-void FlagRecordsMenu::render() {
- if (button_is_pressed(Controller::B)) {
- init_once = false;
- free_texture(&gzFlagOnTex);
- free_texture(&gzFlagOffTex);
- MenuRendering::set_menu(MN_FLAGS_INDEX);
+void FlagRecordsMenu::draw() {
+ cursor.setMode(Cursor::MODE_UNRESTRICTED);
+
+ if (l_flagOnTex.loadCode == TexCode::TEX_UNLOADED) {
+ load_texture("tpgz/tex/flagOn.tex", &l_flagOnTex);
+ }
+
+ if (l_flagOffTex.loadCode == TexCode::TEX_UNLOADED) {
+ load_texture("tpgz/tex/flagOff.tex", &l_flagOffTex);
+ }
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ free_texture(&l_flagOnTex);
+ free_texture(&l_flagOffTex);
+ GZ_setMenu(GZ_FLAGS_MENU);
return;
}
- if (button_is_pressed(Controller::Z)) {
+ if (GZ_getButtonTrig(GZPad::Z)) {
cursor.y = 0;
}
- if (button_is_pressed(SCRL_BACK_BUTTON)) {
+ int max_flags = 0;
+ switch (l_recIdx) {
+ case 0:
+ max_flags = 0x20;
+ drawFlagRecord((uint8_t*)&g_dComIfG_gameInfo.info.mMemory.mBit.mTbox);
+ break;
+ case 1:
+ max_flags = 0x100;
+ drawFlagRecord((uint8_t*)&g_dComIfG_gameInfo.info.mSavedata.mEvent.mEvent);
+ break;
+ case 2:
+ max_flags = 0x18;
+ drawFlagRecord((uint8_t*)&g_dComIfG_gameInfo.info.mSavedata.mMiniGame);
+ break;
+ case 3:
+ max_flags = 0x18;
+ drawFlagRecord((uint8_t*)&g_dComIfG_gameInfo.info.mDan.mSwitch);
+ break;
+ }
+
+ if (GZ_getButtonTrig(SCRL_BACK_BUTTON)) {
cursor.y -= 0x10;
if (cursor.y < 0) {
cursor.y = 0;
}
- } else if (button_is_pressed(SCRL_FORW_BUTTON)) {
+ } else if (GZ_getButtonTrig(SCRL_FORW_BUTTON)) {
cursor.y += 0x10;
if (cursor.y > max_flags + 1) {
cursor.y = max_flags;
}
}
- if (gzFlagOnTex.loadCode == TexCode::TEX_UNLOADED) {
- load_texture("tpgz/tex/flagOn.tex", &gzFlagOnTex);
- }
- if (gzFlagOffTex.loadCode == TexCode::TEX_UNLOADED) {
- load_texture("tpgz/tex/flagOff.tex", &gzFlagOffTex);
- }
-
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- ListMember flag_record_options[MAX_RECORD_OPTIONS] = {"membit", "event", "minigame", "danbit"};
if (cursor.y == FLAG_RECORD_INDEX) {
- cursor.x = record_index;
- Utilities::move_cursor(cursor, max_flags + 1, MAX_RECORD_OPTIONS, false, false, false,
- true);
+ cursor.x = l_recIdx;
+ cursor.move(MAX_RECORD_OPTIONS, max_flags + 1);
+
if (cursor.y == FLAG_RECORD_INDEX) {
- record_index = cursor.x;
+ l_recIdx = cursor.x;
}
} else {
- Utilities::move_cursor(cursor, max_flags + 1, 0, false, false, false, true);
+ cursor.move(0, max_flags + 1);
}
- char record_type[9];
- tp_sprintf(record_type, " <%s>", flag_record_options[record_index].member);
- Font::gz_renderChars(record_type, 12.0f, 60.0f, (cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA),
- g_drop_shadows);
-
- Font::gz_renderChars("DPad/" SCRL_BACK_TEXT "/" SCRL_FORW_TEXT
- " to move cursor, A to toggle flag, Z to top",
- 25.0f, 440.f, 0xFFFFFFFF, g_drop_shadows);
- switch (record_index) {
- case 0: {
- max_flags = 0x20;
- render_flag_records((uint8_t*)&g_dComIfG_gameInfo.info.mMemory.mBit.mTbox);
- break;
- }
- case 1: {
- max_flags = 0x100;
- render_flag_records((uint8_t*)&g_dComIfG_gameInfo.info.mSavedata.mEvent.mEvent);
- break;
- }
- case 2: {
- max_flags = 0x18;
- render_flag_records((uint8_t*)&g_dComIfG_gameInfo.info.mSavedata.mMiniGame);
- break;
- }
- case 3: {
- max_flags = 0x18;
- render_flag_records((uint8_t*)&g_dComIfG_gameInfo.info.mDan.mSwitch);
- break;
- }
- }
-}; \ No newline at end of file
+ ListMember rec_opt[MAX_RECORD_OPTIONS] = {"stage", "event", "minigame", "danbit"};
+ char record_type[9];
+ tp_sprintf(record_type, " <%s>", rec_opt[l_recIdx].member);
+ uint32_t color = cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA;
+
+ GZ_drawText(record_type, 12.0f, 60.f, color, GZ_checkDropShadows());
+ GZ_drawText("DPad/" SCRL_BACK_TEXT "/" SCRL_FORW_TEXT
+ " to move cursor, A to toggle flag, Z to top",
+ 25.0f, 440.f, WHITE_RGBA, GZ_checkDropShadows());
+} \ No newline at end of file
diff --git a/src/menus/flags_menu.cpp b/src/menus/flags_menu.cpp
index 3c77ca6..1ff5c63 100644
--- a/src/menus/flags_menu.cpp
+++ b/src/menus/flags_menu.cpp
@@ -1,57 +1,44 @@
#include "menus/flags_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES 5
+#define LINE_NUM 5
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor FlagsMenu::cursor;
-Line lines[LINES] = {{"general flags", GENERAL_FLAGS_INDEX, "general flags", false},
- {"dungeon flags", DUNGEON_FLAGS_INDEX, "dungeon related flags", false},
- {"portal flags", PORTAL_FLAGS_INDEX, "warp portal flags", false},
- {"flag records", FLAG_RECORDS_INDEX, "view flag records", false},
- {"flag log", FLAG_LOG_INDEX, "view flag log", false}};
+Line lines[LINE_NUM] = {
+ {"general flags", GENERAL_FLAGS_INDEX, "General flags", false},
+ {"dungeon flags", DUNGEON_FLAGS_INDEX, "Dungeon flags", false},
+ {"portal flags", PORTAL_FLAGS_INDEX, "Warp portal flags", false},
+ {"flag records", FLAG_RECORDS_INDEX, "Edit flag records", false},
+ {"flag log", FLAG_LOG_INDEX, "Toggle the flag log", false},
+};
-void FlagsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
+void FlagsMenu::draw() {
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
return;
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case GENERAL_FLAGS_INDEX: {
- MenuRendering::set_menu(MN_GENERAL_FLAGS_INDEX);
+ case GENERAL_FLAGS_INDEX:
+ GZ_setMenu(GZ_GEN_FLAGS_MENU);
return;
- }
- case DUNGEON_FLAGS_INDEX: {
- MenuRendering::set_menu(MN_DUNGEON_FLAGS_INDEX);
+ case DUNGEON_FLAGS_INDEX:
+ GZ_setMenu(GZ_DUN_FLAGS_MENU);
return;
- }
- case PORTAL_FLAGS_INDEX: {
- MenuRendering::set_menu(MN_PORTAL_FLAGS_INDEX);
+ case PORTAL_FLAGS_INDEX:
+ GZ_setMenu(GZ_PORTAL_FLAGS_MENU);
return;
- }
- case FLAG_RECORDS_INDEX: {
- MenuRendering::set_menu(MN_FLAG_RECORDS_INDEX);
+ case FLAG_RECORDS_INDEX:
+ GZ_setMenu(GZ_FLAG_RECORD_MENU);
return;
- }
- case FLAG_LOG_INDEX: {
- MenuRendering::set_menu(MN_FLAG_LOG_INDEX);
+ case FLAG_LOG_INDEX:
+ GZ_setMenu(GZ_FLAG_LOG_MENU);
return;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/general_flags_menu.cpp b/src/menus/general_flags_menu.cpp
index 6b0e551..c48aa1a 100644
--- a/src/menus/general_flags_menu.cpp
+++ b/src/menus/general_flags_menu.cpp
@@ -1,89 +1,78 @@
-#include "controller.h"
-#include "font.h"
+#include "gz_flags.h"
#include "menus/flags_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/utils.h"
-#define LINES 11
+#define LINE_NUM 11
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor GeneralFlagsMenu::cursor;
-bool boss_flag;
-bool rupee_flag = false;
-bool midna_charge;
-bool transform_warp;
-bool midna_on_z;
-bool epona_stolen;
-bool epona_tamed;
-bool map_warping;
-bool midna_healthy;
-bool midna_on_back;
-bool wolf_sense;
+bool l_bossFlag;
+bool l_rupeeFlag = false;
+bool l_midnaCharge;
+bool l_transformWarp;
+bool l_midnaZ;
+bool l_eponaStolen;
+bool l_eponaTamed;
+bool l_mapWarping;
+bool l_midnaHealed;
+bool l_midnaRide;
+bool l_wolfSense;
-Line lines[LINES] = {
- {"boss flag", BOSS_FLAG_INDEX, "Set the boss flag value. Press A to lock the value", true,
- &boss_flag},
- {"rupee cutscenes", RUPEE_CS_FLAG_INDEX, "Toggle flag for rupee cutscenes being enabled", true,
- &rupee_flag},
- {"epona stolen", EPONA_STOLEN_INDEX, "Toggle flag for Epona being stolen", true, &epona_stolen},
- {"epona tamed", EPONA_TAMED_INDEX, "Toggle flag for Epona being tamed", true, &epona_tamed},
- {"map warping", MAP_WARPING_INDEX, "Toggle flag for having map warping", true, &map_warping},
- {"midna charge", MIDNA_CHARGE_INDEX, "Toggle flag for Midna charge", true, &midna_charge},
- {"midna healthy", MIDNA_HEALTHY, "Toggle flag for Midna being healthy/sick", true,
- &midna_healthy},
+Line lines[LINE_NUM] = {
+ {"boss flag", BOSS_FLAG_INDEX, "Sets the boss flag value", true, &l_bossFlag},
+ {"rupee cutscenes", RUPEE_CS_FLAG_INDEX, "Toggle rupee cutscenes being enabled", true,
+ &l_rupeeFlag},
+ {"epona stolen", EPONA_STOLEN_INDEX, "Toggle flag for Epona being stolen", true,
+ &l_eponaStolen},
+ {"epona tamed", EPONA_TAMED_INDEX, "Toggle flag for Epona being tamed", true, &l_eponaTamed},
+ {"map warping", MAP_WARPING_INDEX, "Toggle flag for map warping", true, &l_mapWarping},
+ {"midna charge", MIDNA_CHARGE_INDEX, "Toggle flag for Midna charge", true, &l_midnaCharge},
+ {"midna healed", MIDNA_HEALTHY, "Toggle flag for Midna being healed", true, &l_midnaHealed},
{"midna on back", MIDNA_ON_BACK, "Toggle flag for Midna appearing on Wolf Link's back", true,
- &midna_on_back},
- {"midna on z", MIDNA_Z_INDEX, "Toggle flag for being able to use Midna", true, &midna_on_z},
+ &l_midnaRide},
+ {"midna on Z", MIDNA_Z_INDEX, "Toggle flag for being able to call Midna", true, &l_midnaZ},
{"transform/warp", TRANSFORM_WARP_INDEX, "Toggle flag for transforming/warping", true,
- &transform_warp},
- {"wolf sense", WOLF_SENSE_INDEX, "Toggle flag for having wolf sense", true, &wolf_sense}};
+ &l_transformWarp},
+ {"wolf sense", WOLF_SENSE_INDEX, "Toggle flag for wolf sense", true, &l_wolfSense},
+};
-void GeneralFlagsMenu::render() {
+void GeneralFlagsMenu::draw() {
// update flags
- boss_flag = tp_bossFlags > 0;
- midna_charge = dComIfGs_isEventBit(0x0501);
- transform_warp = dComIfGs_isEventBit(0x0D04);
- midna_on_z = dComIfGs_isEventBit(0x0C10);
- epona_stolen = dComIfGs_isEventBit(0x0580);
- epona_tamed = dComIfGs_isEventBit(0x0601);
- map_warping = dComIfGs_isEventBit(0x0604);
- midna_healthy = dComIfGs_isEventBit(0x1E08);
- midna_on_back = dComIfGs_isTransformLV(3);
- wolf_sense = dComIfGs_isEventBit(0x4308);
+ l_bossFlag = tp_bossFlags > 0;
+ l_midnaCharge = dComIfGs_isEventBit(0x0501);
+ l_transformWarp = dComIfGs_isEventBit(0x0D04);
+ l_midnaZ = dComIfGs_isEventBit(0x0C10);
+ l_eponaStolen = dComIfGs_isEventBit(0x0580);
+ l_eponaTamed = dComIfGs_isEventBit(0x0601);
+ l_mapWarping = dComIfGs_isEventBit(0x0604);
+ l_midnaHealed = dComIfGs_isEventBit(0x1E08);
+ l_midnaRide = dComIfGs_isTransformLV(3);
+ l_wolfSense = dComIfGs_isEventBit(0x4308);
for (int i = BLUE_RUPEE; i <= SILVER_RUPEE; i++) {
if (dComIfGs_isItemFirstBit(i)) {
- rupee_flag = true;
+ l_rupeeFlag = true;
break;
}
}
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_FLAGS_INDEX);
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_FLAGS_MENU);
return;
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case BOSS_FLAG_INDEX: {
- if (boss_flag) {
+ case BOSS_FLAG_INDEX:
+ if (l_bossFlag) {
tp_bossFlags = 0;
} else {
tp_bossFlags = 255;
}
break;
- }
- case RUPEE_CS_FLAG_INDEX: {
- if (rupee_flag) {
+ case RUPEE_CS_FLAG_INDEX:
+ if (l_rupeeFlag) {
for (int i = BLUE_RUPEE; i <= SILVER_RUPEE; i++) {
dComIfGs_offItemFirstBit(i);
}
@@ -93,50 +82,40 @@ void GeneralFlagsMenu::render() {
}
}
break;
- }
- case EPONA_STOLEN_INDEX: {
+ case EPONA_STOLEN_INDEX:
setEventFlag(0x0580);
break;
- }
- case EPONA_TAMED_INDEX: {
+ case EPONA_TAMED_INDEX:
setEventFlag(0x0601);
break;
- }
- case MAP_WARPING_INDEX: {
+ case MAP_WARPING_INDEX:
setEventFlag(0x0604);
break;
- }
- case MIDNA_HEALTHY: {
+ case MIDNA_HEALTHY:
setEventFlag(0x1E08);
break;
- }
- case MIDNA_ON_BACK: {
+ case MIDNA_ON_BACK:
if (dComIfGs_isTransformLV(3)) {
dComIfGs_offTransformLV(3);
} else {
dComIfGs_onTransformLV(3);
}
break;
- }
- case MIDNA_Z_INDEX: {
+ case MIDNA_Z_INDEX:
setEventFlag(0x0C10);
break;
- }
- case TRANSFORM_WARP_INDEX: {
+ case TRANSFORM_WARP_INDEX:
setEventFlag(0x0D04);
break;
- }
- case WOLF_SENSE_INDEX: {
+ case WOLF_SENSE_INDEX:
setEventFlag(0x4308);
break;
- }
- case MIDNA_CHARGE_INDEX: {
+ case MIDNA_CHARGE_INDEX:
setEventFlag(0x0501);
break;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/hundo_saves_menu.cpp b/src/menus/hundo_saves_menu.cpp
index b6af5d8..9e87b3f 100644
--- a/src/menus/hundo_saves_menu.cpp
+++ b/src/menus/hundo_saves_menu.cpp
@@ -1,290 +1,131 @@
-#include "controller.h"
-#include "fifo_queue.h"
-#include "gorge.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-#include "libtp_c/include/msl_c/string.h"
-#include "menus/practice_menu.h"
-#include "rollcheck.h"
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
-#include "utils/loading.h"
-#include "libtp_c/include/f_op/f_op_draw_tag.h"
-#include "libtp_c/include/utils.h"
-
-#include "fs.h"
-#define LINES 78
-
-#define REQ_POS 1
-#define REQ_CAM 2
-
-static Cursor cursor = {0, 0};
-bool init_once = false;
-
-Line lines[LINES] = {
- {"goats 1", HND_GOATS_1_INDEX, "goat herding 1"},
- {"ordon gate clip", HND_ORDON_GATE_CLIP_INDEX, "gate clip outside ordon spring"},
- {"goats 2", HND_GOATS_2_INDEX, "goat herding 2"},
- {"faron twilight", HND_FARON_TWILIGHT_INDEX, "faron twilight tears"},
- {"early master sword", HND_EMS_INDEX, "super jump to early sacred grove"},
- {"purple mist", HND_MIST_INDEX, "purple mist in faron woods (post EMS)"},
- {"forest bit", HND_FRST_BIT_INDEX, "back in time in forest temple"},
- {"forest temple 2", HND_FRST_2_INDEX, "the forest temple segment after boomerang"},
- {"diababa", HND_OOKLESS_INDEX, "the forest temple boss"},
- {"eldin twilight", HND_ELDIN_TWILIGHT_INDEX, "eldin twilight tears"},
- {"lanayru gate clip", HND_LANAYRU_GATE_CLIP_INDEX, "gate clip outside lake hylia"},
- {"pillar clip", HND_PILLAR_CLIP_INDEX, "pillar clip in lake hylia (low water)"},
- {"lakebed 1", HND_LAKEBED_1_INDEX, "the first lakebed segment"},
- {"deku toad", HND_TOAD_INDEX, "the miniboss of lakebed temple"},
- {"kargorok flight", HND_KARG_INDEX, "clip oob with trumpet bird"},
- {"lanayru twilight", HND_LANAYRU_TWILIGHT_INDEX, "lanayru twilight tears"},
- {"boss bug", HND_BOSS_BUG_INDEX, "lanayru twilight boss bug"},
- {"king bulblin 2 skip", HND_KB_2_INDEX, "clip to skip king bulblin 2"},
- {"wagon escort", HND_ESCORT_INDEX, "telma wagon escort segment"},
- {"coro td", HND_COROTD_INDEX, "text displacement with coro"},
- {"goron mines", HND_GM_INDEX, "the goron mines segment"},
- {"dangoro", HND_DANGORO_INDEX, "the goron mines miniboss"},
- {"king bulblin 1", HND_KB_1_INDEX, "the king bulblin 1 fight"},
- {"lakebed bk skip", HND_LAKEBED_BK_SKIP_INDEX, "boss key skip in lakebed main room"},
- {"morpheel", HND_MORPHEEL_INDEX, "the lakebed temple boss"},
- {"star 1", HND_STAR_1_INDEX, "the first STAR minigame"},
- {"mdh tower", HND_MDH_TOWER_INDEX, "mdh tower climb"},
- {"mdh bridge", HND_MDH_BRIDGE_INDEX, "mdh castle rooftops"},
- {"post mdh", HND_POST_MDH_INDEX, "collection cycle after mdh"},
- {"iza 1 skip", HND_IZA_1_SKIP_INDEX, "plumm oob clip to skip iza boat ride"},
- {"lake hylia cave", HND_LH_CAVE_INDEX, "the lake hylia dark cave"},
- {"bulblin camp", HND_BULBLIN_CAMP_INDEX, "the camp before arbiter's grounds"},
- {"arbiter's grounds", HND_AG_INDEX, "the arbiter's grounds segment"},
- {"poe 1 skip", HND_POE_1_SKIP_INDEX, "the pillar jump in arbiter's grounds"},
- {"death sword", HND_DSS_INDEX, "the arbiter's grounds miniboss"},
- {"stallord", HND_STALLORD_INDEX, "the arbiter's grounds boss"},
- {"post ag", HND_POST_AG_INDEX, "collection cycle after arbiter's"},
- {"snowpeak", HND_SPR_INDEX, "the snowpeak dungeon segment"},
- {"darkhammer", HND_DARK_HAMMER_INDEX, "The snowpeak miniboss"},
- {"spr superjump", HND_SPR_SUPERJUMP_INDEX, "the snowpeak superjump to second floor"},
- {"spr boss key lja", HND_SPR_BK_LJA_INDEX, "the lja to get to snowpeak boss key early"},
- {"spr boss key room", HND_SPR_BK_ROOM_INDEX, "the snowpeak boss key room"},
- {"blizzeta", HND_BLIZZETA_INDEX, "the snowpeak ruins boss"},
- {"faron boost", HND_FARON_BOOST_INDEX, "the boost to sacred grove"},
- {"grove skip", HND_GROVE_SKIP_INDEX, "grove 2 skip w/ moon boots"},
- {"grove boost", HND_GROVE_BOOST_INDEX, "boost to get to top floor of grove"},
- {"temple of time", HND_TOT_INDEX, "the temple of time segment"},
- {"tot early poe", HND_EARLY_POE_INDEX, "early first poe in temple of time"},
- {"tot statue throws", HND_STATUE_THROWS_INDEX, "temple of time statue throws"},
- {"tot early hp", HND_EARLY_HP_INDEX, "temple of time bomb boost to heart piece"},
- {"tot darknut", HND_DARKNUT_INDEX, "the temple of time miniboss"},
- {"dot skip", HND_DOT_SKIP_INDEX, "statue clip through door of time"},
- {"post tot", HND_POST_TOT_INDEX, "the collection cycle after temple of time"},
- {"hotspring minigame", HND_HOTSPRING_INDEX, "the goron hotspring water minigame"},
- {"silver rupee", HND_BELL_INDEX, "kakariko silver rupee collection"},
- {"ice puzzle", HND_PUZZLE_INDEX, "the ice puzzle segment"},
- {"hugo archery", HND_ARCHERY_INDEX, "the first hidden village trip"},
- {"city in the sky 1", HND_CITY_1_INDEX, "the first city in the sky segment"},
+#include "menus/hundo_saves_menu.h"
+#include "gz_flags.h"
+#include "save_specials.h"
+
+#define LINE_NUM 78
+
+Cursor HundoSavesMenu::cursor;
+
+Line lines[LINE_NUM] = {
+ {"goats 1", HND_GOATS_1_INDEX, "Goat herding 1"},
+ {"ordon gate clip", HND_ORDON_GATE_CLIP_INDEX, "Gate clip outside Ordon Spring"},
+ {"goats 2", HND_GOATS_2_INDEX, "Goat herding 2"},
+ {"faron twilight", HND_FARON_TWILIGHT_INDEX, "Faron Twilight tears"},
+ {"early master sword", HND_EMS_INDEX, "Super Jump to Sacred Grove"},
+ {"purple mist", HND_MIST_INDEX, "Purple mist in Faron Woods (post-EMS)"},
+ {"forest bit", HND_FRST_BIT_INDEX, "Back in Time in Forest Temple"},
+ {"forest temple 2", HND_FRST_2_INDEX, "The Forest Temple segment after boomerang"},
+ {"diababa", HND_OOKLESS_INDEX, "Forest Temple boss"},
+ {"eldin twilight", HND_ELDIN_TWILIGHT_INDEX, "Eldin Twilight tears"},
+ {"lanayru gate clip", HND_LANAYRU_GATE_CLIP_INDEX, "Gate Clip to Lanayru"},
+ {"pillar clip", HND_PILLAR_CLIP_INDEX, "Pillar Clip in Lake Hylia (low water)"},
+ {"lakebed 1", HND_LAKEBED_1_INDEX, "The 1st Lakebed Temple segment"},
+ {"deku toad", HND_TOAD_INDEX, "Lakebed Temple miniboss"},
+ {"kargorok flight", HND_KARG_INDEX, "Clip OoB with trumpet bird"},
+ {"lanayru twilight", HND_LANAYRU_TWILIGHT_INDEX, "Lanayru Twilight tears"},
+ {"boss bug", HND_BOSS_BUG_INDEX, "Lanayru Twilight boss bug"},
+ {"kb2 skip", HND_KB_2_INDEX, "Clip to skip King Bulblin 2"},
+ {"wagon escort", HND_ESCORT_INDEX, "Telma wagon escort"},
+ {"coro td", HND_COROTD_INDEX, "Text Displacement with Coro"},
+ {"goron mines", HND_GM_INDEX, "The Goron Mines segment"},
+ {"dangoro", HND_DANGORO_INDEX, "Goron Mines miniboss"},
+ {"king bulblin 1", HND_KB_1_INDEX, "The King Bulblin 1 fight"},
+ {"lakebed bk skip", HND_LAKEBED_BK_SKIP_INDEX, "Boss Key skip in Lakebed Temple"},
+ {"morpheel", HND_MORPHEEL_INDEX, "Lakebed Temple boss"},
+ {"star 1", HND_STAR_1_INDEX, "The 1st STAR minigame"},
+ {"mdh tower", HND_MDH_TOWER_INDEX, "MDH tower climb"},
+ {"mdh bridge", HND_MDH_BRIDGE_INDEX, "MDH castle rooftops"},
+ {"post mdh", HND_POST_MDH_INDEX, "Collection cycle after MDH"},
+ {"iza 1 skip", HND_IZA_1_SKIP_INDEX, "Plumm OoB to skip iza 1"},
+ {"lake hylia cave", HND_LH_CAVE_INDEX, "Lake Hylia dark cave"},
+ {"bulblin camp", HND_BULBLIN_CAMP_INDEX, "The camp before Arbiter's Grounds"},
+ {"arbiter's grounds", HND_AG_INDEX, "The Arbiter's Grounds segment"},
+ {"poe 1 skip", HND_POE_1_SKIP_INDEX, "The pillar jump in Arbiter's Grounds"},
+ {"death sword", HND_DSS_INDEX, "Arbiter's Grounds miniboss"},
+ {"stallord", HND_STALLORD_INDEX, "Arbiter's Grounds boss"},
+ {"post ag", HND_POST_AG_INDEX, "Collection cycle after Arbiter's"},
+ {"snowpeak", HND_SPR_INDEX, "The Snowpeak Ruins segment"},
+ {"darkhammer", HND_DARK_HAMMER_INDEX, "Snowpeak Ruins miniboss"},
+ {"spr superjump", HND_SPR_SUPERJUMP_INDEX, "SPR Super Jump to 2nd floor"},
+ {"spr bk lja", HND_SPR_BK_LJA_INDEX, "LJA to Snowpeak Boss Key room"},
+ {"spr bk room", HND_SPR_BK_ROOM_INDEX, "Snowpeak Boss Key room"},
+ {"blizzeta", HND_BLIZZETA_INDEX, "Snowpeak Ruins boss"},
+ {"faron boost", HND_FARON_BOOST_INDEX, "Bomb boost to Sacred Grove"},
+ {"grove skip", HND_GROVE_SKIP_INDEX, "Grove 2 skip w/ Moon Boots"},
+ {"grove boost", HND_GROVE_BOOST_INDEX, "Boost to upper floor of Grove"},
+ {"temple of time", HND_TOT_INDEX, "The Temple of Time segment"},
+ {"tot early poe", HND_EARLY_POE_INDEX, "Early poe 1 in Temple of Time"},
+ {"tot statue throws", HND_STATUE_THROWS_INDEX, "Temple of Time statue throws"},
+ {"tot early hp", HND_EARLY_HP_INDEX, "Boost to heart piece in Temple of Time"},
+ {"tot darknut", HND_DARKNUT_INDEX, "Temple of Time miniboss"},
+ {"dot skip", HND_DOT_SKIP_INDEX, "Door of Time skip"},
+ {"post tot", HND_POST_TOT_INDEX, "Collection cycle after Temple of Time"},
+ {"hotspring minigame", HND_HOTSPRING_INDEX, "Goron hotspring water minigame"},
+ {"silver rupee", HND_BELL_INDEX, "Kakariko silver rupee collection"},
+ {"ice puzzle", HND_PUZZLE_INDEX, "The Ice Puzzle segment"},
+ {"hugo archery", HND_ARCHERY_INDEX, "Archery in Hidden Village"},
+ {"city 1", HND_CITY_1_INDEX, "The 1st City in the Sky segment"},
{"aeralfos skip", HND_AERALFOS_INDEX, "the city in the sky miniboss"},
- {"city in the sky 2", HND_CITY_2_INDEX, "the second city in the sky segment"},
- {"early poe cycle", HND_POE_CYCLE_INDEX, "early poe cycle segment"},
- {"fan tower", HND_FAN_TOWER_INDEX, "final fan room in city before the boss"},
- {"argorok", HND_ARGOROK_INDEX, "the city in the sky boss"},
- {"star 2", HND_STAR_2_INDEX, "the second STAR minigame"},
- {"palace of twilight 1", HND_PALACE_1_INDEX, "the first palace of twilight segment"},
- {"palace of twilight 2", HND_PALACE_2_INDEX, "the second palace of twilight segment"},
- {"early platform cycle", HND_EARLY_PLATFORM_INDEX, "early platform in palace of twilight"},
- {"zant", HND_ZANT_INDEX, "the palace of twilight boss"},
- {"cave of ordeals", HND_COO_INDEX, "the cave of ordeals segment"},
- {"coo floor 10", HND_COO_10_INDEX, "cave of ordeals floor 10"},
- {"coo floor 20", HND_COO_20_INDEX, "cave of ordeals floor 20"},
- {"coo floor 30", HND_COO_30_INDEX, "cave of ordeals floor 30"},
- {"cats minigame", HND_CATS_INDEX, "hidden village cats minigame"},
- {"hyrule castle", HND_HYRULE_INDEX, "the hyrule castle segment"},
- {"darknut skip", HND_DARKNUT_SKIP_INDEX, "hyrule castle darknut skip"},
- {"final tower", HND_FINAL_TOWER_INDEX, "the tower climb before the final boss"},
- {"beast ganon", HND_BEAST_GANON_INDEX, "the beast ganon fight"},
- {"horseback ganon", HND_HORSEBACK_GANON_INDEX, "the horseback ganon fight"}};
-
-void default_load() {
- gSaveManager.mPracticeFileOpts.inject_options_before_load = SaveManager::inject_default_before;
- gSaveManager.mPracticeFileOpts.inject_options_during_load = SaveManager::inject_default_during;
- gSaveManager.mPracticeFileOpts.inject_options_after_load = SaveManager::inject_default_after;
- inject_save_flag = true;
- fifo_visible = true;
- MenuRendering::set_menu(MN_NONE_INDEX);
- init_once = false;
-}
-
-void goats_1() {
- gSaveManager.inject_default_during();
- setNextStageLayer(5);
-}
-
-void goats_2() {
- gSaveManager.inject_default_during();
- setNextStageLayer(4);
-}
-
-void purple_mist() {
- gSaveManager.inject_default_during();
- dComIfGs_setTransformStatus(STATUS_HUMAN);
-}
-
-void kb2_skip() {
- gSaveManager.inject_default_during();
- setNextStageLayer(3);
-}
-
-void escort() {
- gSaveManager.inject_default_during();
- setNextStageRoom(0xD);
- setNextStagePoint(98);
- setNextStageLayer(2);
- dComIfGs_setKeyNum(2); // give 2 keys for field gates
-}
-
-void dangoro() {
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x200000; // turn off intro cs, start fight
-}
-
-void morpheel() {
- dComIfGp_getPlayer()->mHeldItem = HOOKSHOT; // clawshot
- dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
- gSaveManager.setSaveAngle(10754);
- gSaveManager.setSavePosition(-1193.0f, -23999.0f, -770.0f);
- gSaveManager.setLinkInfo();
-}
-
-void karg_oob() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
- dComIfGs_setTransformStatus(STATUS_HUMAN);
-}
-
-void iza_1_skip() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
- setNextStageName("F_SP112"); // set stage to river
- setNextStageRoom(1);
- setNextStagePoint(0);
- setNextStageLayer(4);
-}
-
-void stallord() {
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
- setNextStagePoint(1); // spawn at in front of stally
-}
-
-void spr_bosskey() {
- gSaveManager.inject_default_during();
- setNextStageRoom(0xB); // boss key room
- setNextStagePoint(0); // default spawn
-}
-
-void tot_early_poe() {
- gSaveManager.inject_default_during();
- gSaveManager.setSaveAngle(49299);
- gSaveManager.setSavePosition(-2462.85f, 2750.0f, -7.10f);
- gSaveManager.setLinkInfo();
-}
-
-void tot_early_hp() {
- gSaveManager.inject_default_during();
- gSaveManager.setSaveAngle(49152);
- gSaveManager.setSavePosition(-8000.50f, 5100.0f, -3226.17f);
- gSaveManager.setLinkInfo();
-}
-
-void hugo_archery() {
- gSaveManager.inject_default_during();
- // g_dComIfG_gameInfo.temp_flags.flags[14] = 0xC0; // start archery minigame
-}
-
-void cits_poe_cycle() {
- gSaveManager.inject_default_during();
- gSaveManager.setSaveAngle(71);
- gSaveManager.setSavePosition(-14005.31f, 3000.0f, -15854.05f);
- gSaveManager.setLinkInfo();
-}
-
-void fan_tower() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0;
-}
-
-void argorok() {
- g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x10000;
-}
-
-void palace1() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0;
-}
-
-void palace2() {
- dComIfGp_getPlayer()->mHeldItem = 3; // master sword
- gSaveManager.inject_default_during();
- gSaveManager.setSaveAngle(32731);
- gSaveManager.setSavePosition(251.83f, -200.0f, 10993.50f);
- gSaveManager.setLinkInfo();
-}
-
-void lakebed_bk_skip_during() {
- gSaveManager.inject_default_during();
- dComIfGs_onSwitch(122, dComIfGp_getPlayer()->mOrig.mRoomNo); // dungeon intro cs off
-}
-
-void bossflags() {
- gSaveManager.inject_default_during();
- tp_bossFlags = 0xFF;
-}
-
-void cave_of_ordeals() {
- gSaveManager.inject_default_during();
- g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0;
-}
-
-void HundoSavesMenu::render() {
+ {"city 2", HND_CITY_2_INDEX, "The 2nd City in the Sky segment"},
+ {"early poe cycle", HND_POE_CYCLE_INDEX, "City early poe cycle segment"},
+ {"fan tower", HND_FAN_TOWER_INDEX, "Final fan room in City"},
+ {"argorok", HND_ARGOROK_INDEX, "City in the Sky boss"},
+ {"star 2", HND_STAR_2_INDEX, "The 2nd STAR minigame"},
+ {"palace 1", HND_PALACE_1_INDEX, "The 1st Palace of Twilight segment"},
+ {"palace 2", HND_PALACE_2_INDEX, "The 2nd Palace of Twilight segment"},
+ {"early platform cycle", HND_EARLY_PLATFORM_INDEX, "Early platform in Palace of Twilight"},
+ {"zant", HND_ZANT_INDEX, "Palace of Twilight boss"},
+ {"cave of ordeals", HND_COO_INDEX, "The Cave of Ordeals segment"},
+ {"coo floor 10", HND_COO_10_INDEX, "Cave of Ordeals floor 10"},
+ {"coo floor 20", HND_COO_20_INDEX, "Cave of Ordeals floor 20"},
+ {"coo floor 30", HND_COO_30_INDEX, "Cave of Ordeals floor 30"},
+ {"cats minigame", HND_CATS_INDEX, "Hidden Village cats minigame"},
+ {"hyrule castle", HND_HYRULE_INDEX, "The Hyrule Castle segment"},
+ {"darknut skip", HND_DARKNUT_SKIP_INDEX, "Hyrule Castle 1st Darknut skip"},
+ {"final tower", HND_FINAL_TOWER_INDEX, "The tower climb before Ganondorf"},
+ {"beast ganon", HND_BEAST_GANON_INDEX, "The Beast Ganon fight"},
+ {"horseback ganon", HND_HORSEBACK_GANON_INDEX, "The Horseback Ganondorf fight"},
+};
+
+void HundoSavesMenu::draw() {
special HundoSpecials[HND_SPECIALS_AMNT] = {
- special(HND_GOATS_1_INDEX, goats_1, nullptr),
- special(HND_GOATS_2_INDEX, goats_2, nullptr),
- special(HND_MIST_INDEX, purple_mist, nullptr),
- special(HND_KARG_INDEX, karg_oob, nullptr),
- special(HND_KB_2_INDEX, kb2_skip, nullptr),
- special(HND_ESCORT_INDEX, escort, nullptr),
- special(HND_DANGORO_INDEX, nullptr, dangoro),
- special(HND_LAKEBED_BK_SKIP_INDEX, lakebed_bk_skip_during, nullptr),
- special(HND_MORPHEEL_INDEX, nullptr, morpheel),
- special(HND_IZA_1_SKIP_INDEX, iza_1_skip, nullptr),
- special(HND_STALLORD_INDEX, nullptr, stallord),
- special(HND_DARK_HAMMER_INDEX, bossflags, nullptr),
- special(HND_DARK_HAMMER_INDEX, bossflags, nullptr),
- special(HND_LAKEBED_1_INDEX, bossflags, nullptr),
- special(HND_SPR_BK_ROOM_INDEX, spr_bosskey, nullptr),
- special(HND_EARLY_POE_INDEX, nullptr, tot_early_poe),
- special(HND_EARLY_HP_INDEX, nullptr, tot_early_hp),
- special(HND_POE_CYCLE_INDEX, nullptr, cits_poe_cycle),
- special(HND_FAN_TOWER_INDEX, fan_tower, nullptr),
- special(HND_ARGOROK_INDEX, nullptr, argorok),
- special(HND_PALACE_1_INDEX, palace1, nullptr),
- special(HND_PALACE_2_INDEX, nullptr, palace2),
- special(HND_COO_INDEX, cave_of_ordeals, nullptr),
- special(HND_COO_10_INDEX, cave_of_ordeals, nullptr),
- special(HND_COO_20_INDEX, cave_of_ordeals, nullptr),
- special(HND_COO_30_INDEX, cave_of_ordeals, nullptr)};
-
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_PRACTICE_INDEX);
- init_once = false;
- return;
+ special(HND_GOATS_1_INDEX, SaveMngSpecial_Goats1, nullptr),
+ special(HND_GOATS_2_INDEX, SaveMngSpecial_Goats2, nullptr),
+ special(HND_MIST_INDEX, SaveMngSpecial_PurpleMist, nullptr),
+ special(HND_KARG_INDEX, SaveMngSpecial_KargOoB, nullptr),
+ special(HND_KB_2_INDEX, SaveMngSpecial_KB2Skip, nullptr),
+ special(HND_ESCORT_INDEX, SaveMngSpecial_Escort, nullptr),
+ special(HND_DANGORO_INDEX, nullptr, SaveMngSpecial_Dangoro),
+ special(HND_LAKEBED_BK_SKIP_INDEX, SaveMngSpecial_LakebedBKSkip, nullptr),
+ special(HND_MORPHEEL_INDEX, nullptr, SaveMngSpecial_Morpheel),
+ special(HND_IZA_1_SKIP_INDEX, SaveMngSpecial_Iza1Skip, nullptr),
+ special(HND_STALLORD_INDEX, nullptr, SaveMngSpecial_Stallord),
+ special(HND_DARK_HAMMER_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(HND_DARK_HAMMER_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(HND_LAKEBED_1_INDEX, SaveMngSpecial_BossFlags, nullptr),
+ special(HND_SPR_BK_ROOM_INDEX, SaveMngSpecial_SPRBossKey, nullptr),
+ special(HND_EARLY_POE_INDEX, nullptr, SaveMngSpecial_ToTEarlyPoe),
+ special(HND_EARLY_HP_INDEX, nullptr, SaveMngSpecial_ToTEarlyHP),
+ special(HND_POE_CYCLE_INDEX, nullptr, SaveMngSpecial_CityPoeCycle),
+ special(HND_FAN_TOWER_INDEX, SaveMngSpecial_FanTower, nullptr),
+ special(HND_ARGOROK_INDEX, nullptr, SaveMngSpecial_Argorok),
+ special(HND_PALACE_1_INDEX, SaveMngSpecial_Palace1, nullptr),
+ special(HND_PALACE_2_INDEX, nullptr, SaveMngSpecial_Palace2),
+ special(HND_COO_INDEX, SaveMngSpecial_CaveOfOrdeals, nullptr),
+ special(HND_COO_10_INDEX, SaveMngSpecial_CaveOfOrdeals, nullptr),
+ special(HND_COO_20_INDEX, SaveMngSpecial_CaveOfOrdeals, nullptr),
+ special(HND_COO_30_INDEX, SaveMngSpecial_CaveOfOrdeals, nullptr),
};
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_PRACTICE_MENU);
+ return;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
- SaveManager::load_save(cursor.y, (char*)"hundo", HundoSpecials, HND_SPECIALS_AMNT);
- init_once = false;
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ SaveManager::loadSave(cursor.y, "hundo", HundoSpecials, HND_SPECIALS_AMNT);
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/inventory_menu.cpp b/src/menus/inventory_menu.cpp
index 65814cb..d0ef314 100644
--- a/src/menus/inventory_menu.cpp
+++ b/src/menus/inventory_menu.cpp
@@ -1,48 +1,38 @@
#include "menus/inventory_menu.h"
-#include "controller.h"
#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES 3
+#define LINE_NUM 3
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor InventoryMenu::cursor;
-Line lines[LINES] = {{"item wheel", ITEM_WHEEL_INDEX, "Modify the item wheel", false},
- {"pause menu", PAUSE_MENU_INDEX, "Modify the pause menu collection", false},
- {"amounts", AMOUNTS_MENU_INDEX, "Modify ammo / collectible amounts", false}};
+Line lines[LINE_NUM] = {
+ {"item wheel", ITEM_WHEEL_INDEX, "Modify the item wheel", false},
+ {"pause menu", PAUSE_MENU_INDEX, "Modify the pause menu collection", false},
+ {"amounts", AMOUNTS_MENU_INDEX, "Modify ammo / collectible amounts", false},
+};
-void InventoryMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- return;
- };
+void InventoryMenu::draw() {
+ cursor.move(0, LINE_NUM);
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
+ return;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case ITEM_WHEEL_INDEX: {
- MenuRendering::set_menu(MN_ITEM_WHELL_INDEX);
+ case ITEM_WHEEL_INDEX:
+ GZ_setMenu(GZ_WHEEL_MENU);
return;
- }
- case PAUSE_MENU_INDEX: {
- MenuRendering::set_menu(MN_PAUSE_INDEX);
+ case PAUSE_MENU_INDEX:
+ GZ_setMenu(GZ_PAUSE_MENU);
return;
- }
- case AMOUNTS_MENU_INDEX: {
- MenuRendering::set_menu(MN_AMOUNTS_INDEX);
+ case AMOUNTS_MENU_INDEX:
+ GZ_setMenu(GZ_AMOUNTS_MENU);
return;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
-
- Utilities::render_lines(lines, cursor.y, LINES);
-}; \ No newline at end of file
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+} \ No newline at end of file
diff --git a/src/menus/item_wheel_menu.cpp b/src/menus/item_wheel_menu.cpp
index d9267af..7148d76 100644
--- a/src/menus/item_wheel_menu.cpp
+++ b/src/menus/item_wheel_menu.cpp
@@ -1,63 +1,61 @@
#include "menus/item_wheel_menu.h"
-#include "controller.h"
#include "font.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/msl_c/string.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
#define ITEM_WHEEL_SLOTS 24
-#define LINES ITEM_WHEEL_SLOTS
-#define TOTAL_ITEMS 58
-
-static Cursor cursor = {0, 0};
-int listIdx = 0;
-int new_int_item_id;
-bool init_once = false;
-
-const uint8_t valid_items[] = {DUNGEON_EXIT, DUNGEON_BACK,
- TKS_LETTER, HAWK_EYE,
- BOOMERANG, SPINNER,
- IRONBALL, BOW,
- HOOKSHOT, HVY_BOOTS,
- COPY_ROD, W_HOOKSHOT,
- KANTERA, MASTER_SWORD,
- FISHING_ROD_1, PACHINKO,
- BOMB_BAG_LV1, BEE_ROD,
- JEWEL_ROD, WORM_ROD,
- JEWEL_BEE_ROD, JEWEL_WORM_ROD,
- EMPTY_BOTTLE, RED_BOTTLE,
- GREEN_BOTTLE, BLUE_BOTTLE,
- MILK_BOTTLE, HALF_MILK_BOTTLE,
- OIL_BOTTLE, WATER_BOTTLE,
- UGLY_SOUP, HOT_SPRING,
- FAIRY, NORMAL_BOMB,
- WATER_BOMB, POKE_BOMB,
- FAIRY_DROP, WORM,
- BEE_CHILD, CHUCHU_RARE,
- CHUCHU_RED, CHUCHU_BLUE,
- CHUCHU_GREEN, CHUCHU_YELLOW,
- CHUCHU_PURPLE, LV1_SOUP,
- LV2_SOUP, LV3_SOUP,
- LETTER, BILL,
- WOOD_STATUE, IRIAS_PENDANT,
- HORSE_FLUTE, RAFRELS_MEMO,
- ASHS_SCRIBBLING, ANCIENT_DOCUMENT,
- AIR_LETTER, ANCIENT_DOCUMENT2,
- NO_ITEM};
-
-const uint8_t default_items[ITEM_WHEEL_SLOTS] = {
+#define LINE_NUM ITEM_WHEEL_SLOTS
+#define MAX_ITEMS 58
+
+Cursor ItemWheelMenu::cursor;
+
+const uint8_t l_validItems[] = {
+ DUNGEON_EXIT, DUNGEON_BACK,
+ TKS_LETTER, HAWK_EYE,
+ BOOMERANG, SPINNER,
+ IRONBALL, BOW,
+ HOOKSHOT, HVY_BOOTS,
+ COPY_ROD, W_HOOKSHOT,
+ KANTERA, MASTER_SWORD,
+ FISHING_ROD_1, PACHINKO,
+ BOMB_BAG_LV1, BEE_ROD,
+ JEWEL_ROD, WORM_ROD,
+ JEWEL_BEE_ROD, JEWEL_WORM_ROD,
+ EMPTY_BOTTLE, RED_BOTTLE,
+ GREEN_BOTTLE, BLUE_BOTTLE,
+ MILK_BOTTLE, HALF_MILK_BOTTLE,
+ OIL_BOTTLE, WATER_BOTTLE,
+ UGLY_SOUP, HOT_SPRING,
+ FAIRY, NORMAL_BOMB,
+ WATER_BOMB, POKE_BOMB,
+ FAIRY_DROP, WORM,
+ BEE_CHILD, CHUCHU_RARE,
+ CHUCHU_RED, CHUCHU_BLUE,
+ CHUCHU_GREEN, CHUCHU_YELLOW,
+ CHUCHU_PURPLE, LV1_SOUP,
+ LV2_SOUP, LV3_SOUP,
+ LETTER, BILL,
+ WOOD_STATUE, IRIAS_PENDANT,
+ HORSE_FLUTE, RAFRELS_MEMO,
+ ASHS_SCRIBBLING, ANCIENT_DOCUMENT,
+ AIR_LETTER, ANCIENT_DOCUMENT2,
+ NO_ITEM,
+};
+
+const uint8_t l_defaultItems[ITEM_WHEEL_SLOTS] = {
BOOMERANG, KANTERA, SPINNER, HVY_BOOTS, BOW,
HAWK_EYE, IRONBALL, NO_ITEM, COPY_ROD, HOOKSHOT,
W_HOOKSHOT, EMPTY_BOTTLE, EMPTY_BOTTLE, EMPTY_BOTTLE, EMPTY_BOTTLE,
BOMB_BAG_LV1, BOMB_BAG_LV1, BOMB_BAG_LV1, DUNGEON_EXIT, RAFRELS_MEMO,
- FISHING_ROD_1, HORSE_FLUTE, ANCIENT_DOCUMENT, PACHINKO};
+ FISHING_ROD_1, HORSE_FLUTE, ANCIENT_DOCUMENT, PACHINKO,
+};
-const ItemLookup lookup_table[TOTAL_ITEMS] = {
- {DUNGEON_EXIT, "ooccoo sr."},
- {DUNGEON_BACK, "ooccoo jr."},
- {TKS_LETTER, "ooccoo's note"},
+const ItemLookup l_lookupTbl[MAX_ITEMS] = {
+ {DUNGEON_EXIT, "Ooccoo Sr."},
+ {DUNGEON_BACK, "Ooccoo Jr."},
+ {TKS_LETTER, "Ooccoo's note"},
{HAWK_EYE, "hawkeye"},
{BOOMERANG, "gale boomerang"},
{SPINNER, "spinner"},
@@ -102,103 +100,128 @@ const ItemLookup lookup_table[TOTAL_ITEMS] = {
{LV1_SOUP, "simple soup"},
{LV2_SOUP, "good soup"},
{LV3_SOUP, "superb soup"},
- {LETTER, "renados letter"},
+ {LETTER, "Renado's letter"},
{BILL, "invoice"},
{WOOD_STATUE, "wooden statue"},
- {IRIAS_PENDANT, "ilia's charm"},
+ {IRIAS_PENDANT, "Ilia's charm"},
{HORSE_FLUTE, "horse call"},
- {RAFRELS_MEMO, "auru's memo"},
- {ASHS_SCRIBBLING, "ashei's sketch"},
+ {RAFRELS_MEMO, "Auru's memo"},
+ {ASHS_SCRIBBLING, "Ashei's sketch"},
{ANCIENT_DOCUMENT, "ancient sky book (empty)"},
{AIR_LETTER, "ancient sky book (partial)"},
{ANCIENT_DOCUMENT2, "ancient sky book (filled)"},
- {NO_ITEM, "no item"}};
-
-Line lines[LINES] = {{"Slot 0:", SLOT_0, "", false, nullptr, false},
- {"Slot 1:", SLOT_1, "", false, nullptr, false},
- {"Slot 2:", SLOT_2, "", false, nullptr, false},
- {"Slot 3:", SLOT_3, "", false, nullptr, false},
- {"Slot 4:", SLOT_4, "", false, nullptr, false},
- {"Slot 5:", SLOT_5, "", false, nullptr, false},
- {"Slot 6:", SLOT_6, "", false, nullptr, false},
- {"Slot 7:", SLOT_7, "", false, nullptr, false},
- {"Slot 8:", SLOT_8, "", false, nullptr, false},
- {"Slot 9:", SLOT_9, "", false, nullptr, false},
- {"Slot 10:", SLOT_10, "", false, nullptr, false},
- {"Slot 11:", SLOT_11, "", false, nullptr, false},
- {"Slot 12:", SLOT_12, "", false, nullptr, false},
- {"Slot 13:", SLOT_13, "", false, nullptr, false},
- {"Slot 14:", SLOT_14, "", false, nullptr, false},
- {"Slot 15:", SLOT_15, "", false, nullptr, false},
- {"Slot 16:", SLOT_16, "", false, nullptr, false},
- {"Slot 17:", SLOT_17, "", false, nullptr, false},
- {"Slot 18:", SLOT_18, "", false, nullptr, false},
- {"Slot 19:", SLOT_19, "", false, nullptr, false},
- {"Slot 20:", SLOT_20, "", false, nullptr, false},
- {"Slot 21:", SLOT_21, "", false, nullptr, false},
- {"Slot 22:", SLOT_22, "", false, nullptr, false},
- {"Slot 23:", SLOT_23, "", false, nullptr, false}};
-
-void updateListIdx() {
+ {NO_ITEM, "no item"},
+};
+
+Line lines[LINE_NUM] = {
+ {"Slot 0:", SLOT_0, "", false, nullptr, false},
+ {"Slot 1:", SLOT_1, "", false, nullptr, false},
+ {"Slot 2:", SLOT_2, "", false, nullptr, false},
+ {"Slot 3:", SLOT_3, "", false, nullptr, false},
+ {"Slot 4:", SLOT_4, "", false, nullptr, false},
+ {"Slot 5:", SLOT_5, "", false, nullptr, false},
+ {"Slot 6:", SLOT_6, "", false, nullptr, false},
+ {"Slot 7:", SLOT_7, "", false, nullptr, false},
+ {"Slot 8:", SLOT_8, "", false, nullptr, false},
+ {"Slot 9:", SLOT_9, "", false, nullptr, false},
+ {"Slot 10:", SLOT_10, "", false, nullptr, false},
+ {"Slot 11:", SLOT_11, "", false, nullptr, false},
+ {"Slot 12:", SLOT_12, "", false, nullptr, false},
+ {"Slot 13:", SLOT_13, "", false, nullptr, false},
+ {"Slot 14:", SLOT_14, "", false, nullptr, false},
+ {"Slot 15:", SLOT_15, "", false, nullptr, false},
+ {"Slot 16:", SLOT_16, "", false, nullptr, false},
+ {"Slot 17:", SLOT_17, "", false, nullptr, false},
+ {"Slot 18:", SLOT_18, "", false, nullptr, false},
+ {"Slot 19:", SLOT_19, "", false, nullptr, false},
+ {"Slot 20:", SLOT_20, "", false, nullptr, false},
+ {"Slot 21:", SLOT_21, "", false, nullptr, false},
+ {"Slot 22:", SLOT_22, "", false, nullptr, false},
+ {"Slot 23:", SLOT_23, "", false, nullptr, false},
+};
+
+int l_listIdx = 0;
+
+void ItemWheelMenu::updateListIdx() {
uint8_t item_id = dComIfGs_getSavedata().getPlayer().getItem().mItems[cursor.y];
- for (int i = 0; i < TOTAL_ITEMS; i++) {
- if (item_id == valid_items[i]) {
- listIdx = i;
+ for (int i = 0; i < MAX_ITEMS; i++) {
+ if (item_id == l_validItems[i]) {
+ l_listIdx = i;
}
}
}
-void ItemWheelMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_INVENTORY_INDEX);
- init_once = false;
- return;
- }
-
- if (!init_once) {
- current_input = 0;
- init_once = true;
+void ItemWheelMenu::fixSpecialItems(int i) {
+ if (l_validItems[i] == NORMAL_BOMB || l_validItems[i] == WATER_BOMB ||
+ l_validItems[i] == POKE_BOMB) {
+ switch (cursor.y) {
+ case SLOT_15:
+ dComIfGs_setBombNum(BOMB_BAG_1, 1);
+ break;
+ case SLOT_16:
+ dComIfGs_setBombNum(BOMB_BAG_2, 1);
+ break;
+ case SLOT_17:
+ dComIfGs_setBombNum(BOMB_BAG_3, 1);
+ break;
+ }
}
+}
+void ItemWheelMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
updateListIdx();
- for (int i = 0; i < LINES; i++) {
- new_int_item_id = dComIfGs_getItem(i, false);
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_INVENTORY_MENU);
+ return;
+ }
- for (int j = 0; j < TOTAL_ITEMS; j++) {
- if (lookup_table[j].item_id == new_int_item_id) {
- tp_sprintf(lines[i].value, " <%s>",
- new_int_item_id != NO_ITEM ? lookup_table[j].item_description : "none");
+ for (int slot_no = 0; slot_no < LINE_NUM; slot_no++) {
+ int item_id = dComIfGs_getItem(slot_no, false);
+
+ for (int j = 0; j < MAX_ITEMS; j++) {
+ if (l_lookupTbl[j].item_id == item_id) {
+ tp_sprintf(lines[slot_no].value, " <%s>",
+ item_id != NO_ITEM ? l_lookupTbl[j].name : "none");
}
- if (lookup_table[j].item_id == default_items[i]) {
- tp_sprintf(lines[i].description, "Slot %d default: %s. Press Z to set to default",
- i, lookup_table[j].item_description);
+
+ if (l_lookupTbl[j].item_id == l_defaultItems[slot_no]) {
+ tp_sprintf(lines[slot_no].description,
+ "Slot %d default: %s. Press Z to set to default", slot_no,
+ l_lookupTbl[j].name);
} else {
continue;
}
}
}
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- listIdx++;
- if (listIdx > TOTAL_ITEMS) {
- listIdx = 0;
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ l_listIdx++;
+
+ if (l_listIdx > MAX_ITEMS) {
+ l_listIdx = 0;
}
- dComIfGs_setItem(cursor.y, valid_items[listIdx]);
+
+ fixSpecialItems(l_listIdx);
+ dComIfGs_setItem(cursor.y, l_validItems[l_listIdx]);
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- listIdx--;
- if (listIdx < 0) {
- listIdx = 58;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ l_listIdx--;
+
+ if (l_listIdx < 0) {
+ l_listIdx = MAX_ITEMS;
}
- dComIfGs_setItem(cursor.y, valid_items[listIdx]);
+
+ fixSpecialItems(l_listIdx);
+ dComIfGs_setItem(cursor.y, l_validItems[l_listIdx]);
}
- if (button_is_pressed(Controller::Z)) {
- dComIfGs_setItem(cursor.y, default_items[cursor.y]);
+ if (GZ_getButtonTrig(GZPad::Z)) {
+ dComIfGs_setItem(cursor.y, l_defaultItems[cursor.y]);
}
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
}
diff --git a/src/menus/main_menu.cpp b/src/menus/main_menu.cpp
index 0092fd1..6746bac 100644
--- a/src/menus/main_menu.cpp
+++ b/src/menus/main_menu.cpp
@@ -1,73 +1,63 @@
#include "menus/main_menu.h"
-#include "controller.h"
#include "fifo_queue.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES 9
+#define LINE_NUM 9
-static Cursor cursor = {0, 0};
+Cursor MainMenu::cursor;
-Line lines[LINES] = {{"cheats", CHEAT_INDEX, "Turn cheats on/off", false},
- {"flags", FLAGS_INDEX, "Turn in-game flags on/off", false},
- {"inventory", INVENTORY_INDEX, "Set Link's items and equipment", false},
- {"memory", MEMORY_INDEX, "View/edit memory and add watches", false},
- {"practice", PRACTICE_INDEX, "Load practice files", false},
- {"scene", SCENE_INDEX, "Adjust the scene's state", false},
- {"settings", SETTINGS_INDEX, "Configure settings", false},
- {"tools", TOOLS_INDEX, "Use various tools for practice and testing", false},
- {"warping", WARPING_INDEX, "Warp to dungeons, towns, grottos, etc.", false}};
+Line lines[LINE_NUM] = {
+ {"cheats", CHEAT_INDEX, "Toggle cheats", false},
+ {"flags", FLAGS_INDEX, "Toggle in-game flags", false},
+ {"inventory", INVENTORY_INDEX, "Set items and equipment", false},
+ {"memory", MEMORY_INDEX, "View/edit memory, add watches, and save/load memfiles", false},
+ {"practice", PRACTICE_INDEX, "Load practice files", false},
+ {"scene", SCENE_INDEX, "Adjust current scene settings", false},
+ {"settings", SETTINGS_INDEX, "Configure settings", false},
+ {"tools", TOOLS_INDEX, "Use various tools for practice and testing", false},
+ {"warping", WARPING_INDEX, "Warp to any area", false},
+};
-void MainMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_NONE_INDEX);
- fifo_visible = true;
- return;
- };
+void MainMenu::draw() {
+ cursor.move(0, LINE_NUM);
- Utilities::move_cursor(cursor, LINES);
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_clearMenu();
+ GZ_setFifoVisible(true);
+ return;
+ }
- if (current_input == SELECTION_BUTTON && !a_held) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case MEMORY_INDEX: {
- MenuRendering::set_menu(MN_MEMORY_INDEX);
+ case CHEAT_INDEX:
+ GZ_setMenu(GZ_CHEAT_MENU);
return;
- }
- case INVENTORY_INDEX: {
- MenuRendering::set_menu(MN_INVENTORY_INDEX);
+ case FLAGS_INDEX:
+ GZ_setMenu(GZ_FLAGS_MENU);
return;
- }
- case CHEAT_INDEX: {
- MenuRendering::set_menu(MN_CHEAT_INDEX);
+ case INVENTORY_INDEX:
+ GZ_setMenu(GZ_INVENTORY_MENU);
return;
- }
- case TOOLS_INDEX: {
- MenuRendering::set_menu(MN_TOOLS_INDEX);
+ case MEMORY_INDEX:
+ GZ_setMenu(GZ_MEMORY_MENU);
return;
- }
- case SETTINGS_INDEX: {
- MenuRendering::set_menu(MN_SETTINGS_INDEX);
+ case PRACTICE_INDEX:
+ GZ_setMenu(GZ_PRACTICE_MENU);
return;
- }
- case WARPING_INDEX: {
- MenuRendering::set_menu(MN_WARPING_INDEX);
+ case SCENE_INDEX:
+ GZ_setMenu(GZ_SCENE_MENU);
return;
- }
- case PRACTICE_INDEX: {
- MenuRendering::set_menu(MN_PRACTICE_INDEX);
+ case SETTINGS_INDEX:
+ GZ_setMenu(GZ_SETTINGS_MENU);
return;
- }
- case SCENE_INDEX: {
- MenuRendering::set_menu(MN_SCENE_INDEX);
+ case TOOLS_INDEX:
+ GZ_setMenu(GZ_TOOLS_MENU);
return;
- }
- case FLAGS_INDEX: {
- MenuRendering::set_menu(MN_FLAGS_INDEX);
+ case WARPING_INDEX:
+ GZ_setMenu(GZ_WARP_MENU);
return;
}
- }
}
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/memfiles_menu.cpp b/src/menus/memfiles_menu.cpp
index 50b73cc..7c8b6a4 100644
--- a/src/menus/memfiles_menu.cpp
+++ b/src/menus/memfiles_menu.cpp
@@ -1,140 +1,124 @@
#include "menus/memfiles_menu.h"
-#include "controller.h"
-#include "font.h"
#include "utils/card.h"
#include "libtp_c/include/msl_c/string.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_draw_tag.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
+#include "gz_flags.h"
-#define LINES 4
+#define LINE_NUM 4
#define MAX_SAVE_SLOTS 20
-static Cursor cursor = {0, 0};
-bool init_once = false;
-static uint8_t file_no = 1;
-uint8_t save_delay = 0;
-int8_t memfile_load_delay = 10;
-bool set_position_data = false;
-bool copy_respawn_data = false;
-char fileBuf[9];
+Cursor MemfilesMenu::cursor;
+bool set_position_data;
+bool g_injectMemfile = false;
+static uint8_t l_fileNo = 1;
+bool l_dataCopied = false;
+cXyz l_tmpPos = g_dComIfG_gameInfo.info.mRestart.mRoomPos;
+uint16_t l_tmpAngle = g_dComIfG_gameInfo.info.mRestart.mRoomAngleY;
PositionData memfile_posdata;
-cXyz tmpPos = g_dComIfG_gameInfo.info.mRestart.mRoomPos;
-uint16_t tmpAngle = g_dComIfG_gameInfo.info.mRestart.mRoomAngleY;
-Line lines[LINES] = {{"file slot:", MEMFILE_SLOT_INDEX, "Select memfile slot"},
- {"save", MEMFILE_SAVE_INDEX, "Save memfile to slot", false},
- {"load", MEMFILE_LOAD_INDEX, "Load memfile from slot", false},
- {"delete", MEMFILE_DELETE_INDEX, "Delete memfile from slot", false}};
+Line lines[LINE_NUM] = {
+ {"file slot:", MEMFILE_SLOT_INDEX, "Select memfile slot"},
+ {"save", MEMFILE_SAVE_INDEX, "Save memfile to slot", false},
+ {"load", MEMFILE_LOAD_INDEX, "Load memfile from slot", false},
+ {"delete", MEMFILE_DELETE_INDEX, "Delete memfile from slot", false},
+};
-void set_memfile_position() {
- // respawn pos gets overwritten by default spawn, so reinject respawn info
- if (!copy_respawn_data) {
- tmpPos = g_dComIfG_gameInfo.info.mRestart.mRoomPos;
- tmpAngle = g_dComIfG_gameInfo.info.mRestart.mRoomAngleY;
- copy_respawn_data = true;
- }
+void GZMemfile_setLinkPosition() {
+ static int8_t sLoadDelay = 10;
- if (tp_fopScnRq.isLoading == 0) {
- memfile_load_delay--;
+ if (tp_fopScnRq.isLoading == 1) {
+ sLoadDelay--;
}
- if (memfile_load_delay == 0) {
- dComIfGp_getPlayer()->mCurrent.mPosition = memfile_posdata.link;
- tp_matrixInfo.matrix_info->target = memfile_posdata.cam.target;
- tp_matrixInfo.matrix_info->pos = memfile_posdata.cam.pos;
- dComIfGp_getPlayer()->mCollisionRot.mY = memfile_posdata.angle;
- g_dComIfG_gameInfo.info.mRestart.mRoomPos = tmpPos;
- g_dComIfG_gameInfo.info.mRestart.mRoomAngleY = tmpAngle;
- set_position_data = false;
- copy_respawn_data = false;
- memfile_load_delay = 10;
+ // respawn pos gets overwritten by default spawn, so reinject respawn info
+ if (!l_dataCopied) {
+ l_tmpPos = g_dComIfG_gameInfo.info.mRestart.mRoomPos;
+ l_tmpAngle = g_dComIfG_gameInfo.info.mRestart.mRoomAngleY;
+ l_dataCopied = true;
}
-}
-void MemfilesMenu::render() {
- if (button_is_pressed(BACK_BUTTON) && save_delay == 0) {
- init_once = false;
- MenuRendering::set_menu(MN_MEMORY_INDEX);
- return;
+ if (sLoadDelay == 0) {
+ if (dComIfGp_getPlayer() != nullptr) {
+ dComIfGp_getPlayer()->mCurrent.mPosition = memfile_posdata.link;
+ tp_matrixInfo.matrix_info->target = memfile_posdata.cam.target;
+ tp_matrixInfo.matrix_info->pos = memfile_posdata.cam.pos;
+ dComIfGp_getPlayer()->mCollisionRot.mY = memfile_posdata.angle;
+ g_dComIfG_gameInfo.info.mRestart.mRoomPos = l_tmpPos;
+ g_dComIfG_gameInfo.info.mRestart.mRoomAngleY = l_tmpAngle;
+ l_dataCopied = false;
+ }
+ sLoadDelay = 10;
}
+}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
+void MemfilesMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
- if (save_delay > 0) {
- save_delay--;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MEMORY_MENU);
+ return;
}
switch (cursor.y) {
- case MEMFILE_SLOT_INDEX: {
- if (button_is_pressed(Controller::DPAD_LEFT) && file_no > 1) {
- file_no--;
- } else if (button_is_pressed(Controller::DPAD_RIGHT) && file_no < MAX_SAVE_SLOTS) {
- file_no++;
+ case MEMFILE_SLOT_INDEX:
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT) && l_fileNo > 1) {
+ l_fileNo--;
+ } else if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT) && l_fileNo < MAX_SAVE_SLOTS) {
+ l_fileNo++;
}
break;
}
- }
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ static Storage card;
+ char fileBuf[9];
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case MEMFILE_SAVE_INDEX: {
- static Storage card;
- tp_sprintf(fileBuf, "tpgz_s%d", file_no);
+ case MEMFILE_SAVE_INDEX:
+ tp_sprintf(fileBuf, "tpgz_s%d", l_fileNo);
card.file_name = fileBuf;
card.sector_size = SECTOR_SIZE;
tp_sprintf(card.file_name_buffer, card.file_name);
#ifndef WII_PLATFORM
card.result = CARDProbeEx(0, nullptr, &card.sector_size);
if (card.result == Ready) {
- Utilities::store_memfile(card);
+ GZ_storeMemfile(card);
}
#endif // WII_PLATFORM
- Utilities::store_memfile(card);
- save_delay = 20;
+ GZ_storeMemfile(card);
break;
- }
- case MEMFILE_LOAD_INDEX: {
- static Storage card;
- tp_sprintf(fileBuf, "tpgz_s%d", file_no);
+ case MEMFILE_LOAD_INDEX:
+ tp_sprintf(fileBuf, "tpgz_s%d", l_fileNo);
card.file_name = fileBuf;
card.sector_size = SECTOR_SIZE;
tp_sprintf(card.file_name_buffer, card.file_name);
#ifndef WII_PLATFORM
card.result = CARDProbeEx(0, NULL, &card.sector_size);
if (card.result == Ready) {
- Utilities::load_memfile(card);
+ GZ_loadMemfile(card);
}
#endif // WII_PLATFORM
break;
- }
- case MEMFILE_DELETE_INDEX: {
- static Storage card;
- tp_sprintf(fileBuf, "tpgz_s%d", file_no);
+ case MEMFILE_DELETE_INDEX:
+ tp_sprintf(fileBuf, "tpgz_s%d", l_fileNo);
card.file_name = fileBuf;
card.sector_size = SECTOR_SIZE;
tp_sprintf(card.file_name_buffer, card.file_name);
#ifndef WII_PLATFORM
card.result = CARDProbeEx(0, nullptr, &card.sector_size);
if (card.result == Ready) {
- Utilities::delete_memfile(card);
+ GZ_deleteMemfile(card);
}
#endif // WII_PLATFORM
- Utilities::delete_memfile(card);
- save_delay = 20;
+ GZ_deleteMemfile(card);
break;
}
- }
}
- tp_sprintf(lines[MEMFILE_SLOT_INDEX].value, " <%d>", file_no);
+ tp_sprintf(lines[MEMFILE_SLOT_INDEX].value, " <%d>", l_fileNo);
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/memory_editor_menu.cpp b/src/menus/memory_editor_menu.cpp
index efb5cfd..a51b9da 100644
--- a/src/menus/memory_editor_menu.cpp
+++ b/src/menus/memory_editor_menu.cpp
@@ -1,11 +1,7 @@
#include "menus/memory_editor_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/msl_c/string.h"
#include "menus/settings_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
#define MAX_DISPLAY_LINES 15
#define WHITE_RGBA 0xFFFFFFFF
@@ -13,148 +9,116 @@
#define LINE_X_OFFSET 20.0f
#define LINE_BYTE_OFFSET 100.0f
-static Cursor cursor = {0, 0};
-bool init_once = false;
-bool lock_cursor_y = false;
-bool lock_cursor_x = false;
-bool index_selected = false;
-uint8_t index_place = 0;
-uint8_t byte_index = 0;
-uint32_t address_index = 0x80000000;
+Cursor MemoryEditorMenu::cursor;
+uint32_t MemoryEditorMenu::mAddressIndex = 0x80000000;
-uint32_t mem_cursor_color;
-uint8_t red = 0;
-uint8_t green = 0;
-uint8_t blue = 0;
+bool l_idxSelected = false;
+uint8_t l_idxPlace = 0;
+uint8_t l_byteIdx = 0;
+uint8_t l_cycleR = 0;
+uint8_t l_cycleG = 0;
+uint8_t l_cycleB = 0;
-// returns the width of the rendered string
-float render_selected_number_selector(const char* str, float x, float y, size_t selected_char_index,
- size_t max_char, uint32_t color) {
- float pos = 0.0f;
- for (size_t i = 0; i <= max_char; ++i) {
- Font::gz_renderChar(str[i], x + pos, y, selected_char_index == i ? CURSOR_RGBA : color,
- g_drop_shadows);
- pos += Font::get_char_width(str[i]);
- }
- return pos;
-}
-
-void render_memory(Cursor cursor) {
+void MemoryEditorMenu::drawMemEditor() {
char index[9];
- tp_sprintf(index, "%08X", address_index);
+ tp_sprintf(index, "%08X", mAddressIndex);
- if (index_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (index_place == 7) {
- index_place = 0;
- } else if (index_place >= 0 && index_place < 8) {
- index_place++;
+ if (l_idxSelected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (l_idxPlace == 7) {
+ l_idxPlace = 0;
+ } else if (l_idxPlace >= 0 && l_idxPlace < 8) {
+ l_idxPlace++;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (index_place == 0) {
- index_place = 7;
- } else if (index_place >= 0 && index_place < 8) {
- index_place--;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (l_idxPlace == 0) {
+ l_idxPlace = 7;
+ } else if (l_idxPlace >= 0 && l_idxPlace < 8) {
+ l_idxPlace--;
}
}
- if (button_is_pressed(Controller::DPAD_UP)) {
- switch (index_place) {
- case 0: {
- address_index = 0x81FFFFFF;
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
+ switch (l_idxPlace) {
+ case 0:
+ mAddressIndex = 0x81FFFFFF;
break;
- }
- case 1: {
- address_index += 0x1000000;
+ case 1:
+ mAddressIndex += 0x1000000;
break;
- }
- case 2: {
- address_index += 0x100000;
+ case 2:
+ mAddressIndex += 0x100000;
break;
- }
- case 3: {
- address_index += 0x10000;
+ case 3:
+ mAddressIndex += 0x10000;
break;
- }
- case 4: {
- address_index += 0x1000;
+ case 4:
+ mAddressIndex += 0x1000;
break;
- }
- case 5: {
- address_index += 0x100;
+ case 5:
+ mAddressIndex += 0x100;
break;
- }
- case 6: {
- address_index += 0x10;
+ case 6:
+ mAddressIndex += 0x10;
break;
- }
- case 7: {
- address_index += 0x1;
+ case 7:
+ mAddressIndex += 0x1;
break;
}
- }
- if (address_index > 0x81FFFFFF) {
- address_index = 0x81FFFFFF;
+ if (mAddressIndex > 0x81FFFFFF) {
+ mAddressIndex = 0x81FFFFFF;
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
- switch (index_place) {
- case 0: {
- address_index -= 0x10000000;
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
+ switch (l_idxPlace) {
+ case 0:
+ mAddressIndex -= 0x10000000;
break;
- }
- case 1: {
- address_index -= 0x1000000;
+ case 1:
+ mAddressIndex -= 0x1000000;
break;
- }
- case 2: {
- address_index -= 0x100000;
+ case 2:
+ mAddressIndex -= 0x100000;
break;
- }
- case 3: {
- address_index -= 0x10000;
+ case 3:
+ mAddressIndex -= 0x10000;
break;
- }
- case 4: {
- address_index -= 0x1000;
+ case 4:
+ mAddressIndex -= 0x1000;
break;
- }
- case 5: {
- address_index -= 0x100;
+ case 5:
+ mAddressIndex -= 0x100;
break;
- }
- case 6: {
- address_index -= 0x10;
+ case 6:
+ mAddressIndex -= 0x10;
break;
- }
- case 7: {
- address_index -= 0x1;
+ case 7:
+ mAddressIndex -= 0x1;
break;
}
- }
- if (address_index < 0x80000000) {
- address_index = 0x80000000;
+ if (mAddressIndex < 0x80000000) {
+ mAddressIndex = 0x80000000;
}
}
- render_selected_number_selector(index, LINE_X_OFFSET, 80.0f, index_place, 7, WHITE_RGBA);
+ GZ_drawSelectChar(index, LINE_X_OFFSET, 80.0f, l_idxPlace, 7, WHITE_RGBA);
} else {
- Font::gz_renderChars(index, LINE_X_OFFSET, 80.0f,
- (cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ GZ_drawText(index, LINE_X_OFFSET, 80.0f, (cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA),
+ GZ_checkDropShadows());
}
- if (cursor.y > 0 && !lock_cursor_x) {
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (byte_index == 0) {
- byte_index = 7;
- } else if (byte_index >= 0 && byte_index < 8) {
- byte_index--;
+ if (cursor.y > 0 && !cursor.lock_x) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (l_byteIdx == 0) {
+ l_byteIdx = 7;
+ } else if (l_byteIdx >= 0 && l_byteIdx < 8) {
+ l_byteIdx--;
}
}
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (byte_index == 7) {
- byte_index = 0;
- } else if (byte_index >= 0 && byte_index < 8) {
- byte_index++;
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (l_byteIdx == 7) {
+ l_byteIdx = 0;
+ } else if (l_byteIdx >= 0 && l_byteIdx < 8) {
+ l_byteIdx++;
}
}
}
@@ -173,127 +137,115 @@ void render_memory(Cursor cursor) {
char b6[3];
char b7[3];
- tp_sprintf(address, "%08X ", address_index + (i * 8));
- tp_sprintf(b0, "%02X", *(uint8_t*)(address_index + (i * 8)));
- tp_sprintf(b1, "%02X", *(uint8_t*)((address_index + (i * 8)) + 1));
- tp_sprintf(b2, "%02X", *(uint8_t*)((address_index + (i * 8)) + 2));
- tp_sprintf(b3, "%02X", *(uint8_t*)((address_index + (i * 8)) + 3));
- tp_sprintf(b4, "%02X", *(uint8_t*)((address_index + (i * 8)) + 4));
- tp_sprintf(b5, "%02X", *(uint8_t*)((address_index + (i * 8)) + 5));
- tp_sprintf(b6, "%02X", *(uint8_t*)((address_index + (i * 8)) + 6));
- tp_sprintf(b7, "%02X", *(uint8_t*)((address_index + (i * 8)) + 7));
+ tp_sprintf(address, "%08X ", mAddressIndex + (i * 8));
+ tp_sprintf(b0, "%02X", *(uint8_t*)(mAddressIndex + (i * 8)));
+ tp_sprintf(b1, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 1));
+ tp_sprintf(b2, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 2));
+ tp_sprintf(b3, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 3));
+ tp_sprintf(b4, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 4));
+ tp_sprintf(b5, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 5));
+ tp_sprintf(b6, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 6));
+ tp_sprintf(b7, "%02X", *(uint8_t*)((mAddressIndex + (i * 8)) + 7));
- float address_offset = Font::get_chars_width(address) + LINE_X_OFFSET;
- float two_numbers_offset = Font::get_chars_width(" 00");
- if (cursor.y == (i + 1) && lock_cursor_x && lock_cursor_y) {
- if (button_is_pressed(Controller::DPAD_UP)) {
- *(uint8_t*)((address_index + (i * 8)) + byte_index) += 0x1;
+ float address_offset = Font::getStrWidth(address) + LINE_X_OFFSET;
+ float b_offset = Font::getStrWidth(" 00");
+ if (cursor.y == (i + 1) && cursor.lock_x && cursor.lock_y) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
+ *(uint8_t*)((mAddressIndex + (i * 8)) + l_byteIdx) += 0x1;
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
- *(uint8_t*)((address_index + (i * 8)) + byte_index) -= 0x1;
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
+ *(uint8_t*)((mAddressIndex + (i * 8)) + l_byteIdx) -= 0x1;
}
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- *(uint8_t*)((address_index + (i * 8)) + byte_index) += 0x10;
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ *(uint8_t*)((mAddressIndex + (i * 8)) + l_byteIdx) += 0x10;
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- *(uint8_t*)((address_index + (i * 8)) + byte_index) -= 0x10;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ *(uint8_t*)((mAddressIndex + (i * 8)) + l_byteIdx) -= 0x10;
}
}
- // cycle cursor color when value selected
- if (lock_cursor_x && lock_cursor_y) {
- if (red < 0x00A0 && (green == 0x0000 && blue == 0x0000)) {
- red += 0x0001;
- } else if (green < 0x00A0 && (blue == 0x0000 && red == 0x00A0)) {
- green += 0x0001;
- } else if (blue < 0x00A0 && (green == 0x00A0 && red == 0x00A0)) {
- blue += 0x0001;
- } else if (red > 0x0000 && (green == 0x00A0 && blue == 0x00A0)) {
- red -= 0x0001;
- } else if (green > 0x0000 && (blue == 0x00A0 && red == 0x0000)) {
- green -= 0x0001;
+ uint32_t mem_cursor_color;
+ // cycle cursor color when value selected
+ if (cursor.lock_x && cursor.lock_y) {
+ if (l_cycleR < 0x00A0 && (l_cycleG == 0x0000 && l_cycleB == 0x0000)) {
+ l_cycleR += 0x0001;
+ } else if (l_cycleG < 0x00A0 && (l_cycleB == 0x0000 && l_cycleR == 0x00A0)) {
+ l_cycleG += 0x0001;
+ } else if (l_cycleB < 0x00A0 && (l_cycleG == 0x00A0 && l_cycleR == 0x00A0)) {
+ l_cycleB += 0x0001;
+ } else if (l_cycleR > 0x0000 && (l_cycleG == 0x00A0 && l_cycleB == 0x00A0)) {
+ l_cycleR -= 0x0001;
+ } else if (l_cycleG > 0x0000 && (l_cycleB == 0x00A0 && l_cycleR == 0x0000)) {
+ l_cycleG -= 0x0001;
} else {
- blue -= 0x0001;
+ l_cycleB -= 0x0001;
}
- mem_cursor_color = (red << 24) | (green << 16) | (blue << 8) | 0xFF;
+ mem_cursor_color = (l_cycleR << 24) | (l_cycleG << 16) | (l_cycleB << 8) | 0xFF;
} else {
mem_cursor_color = CURSOR_RGBA;
}
- Font::gz_renderChars(address, LINE_X_OFFSET, y_offset,
- (cursor.y == (i + 1) ? CURSOR_RGBA : ADDRESS_RGBA), g_drop_shadows);
- Font::gz_renderChars(
- b0, address_offset, y_offset,
- (byte_index == 0 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b1, address_offset + two_numbers_offset * 1, y_offset,
- (byte_index == 1 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b2, address_offset + two_numbers_offset * 2, y_offset,
- (byte_index == 2 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b3, address_offset + two_numbers_offset * 3, y_offset,
- (byte_index == 3 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b4, address_offset + two_numbers_offset * 4, y_offset,
- (byte_index == 4 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b5, address_offset + two_numbers_offset * 5, y_offset,
- (byte_index == 5 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b6, address_offset + two_numbers_offset * 6, y_offset,
- (byte_index == 6 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
- Font::gz_renderChars(
- b7, address_offset + two_numbers_offset * 7, y_offset,
- (byte_index == 7 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
- g_drop_shadows);
+ GZ_drawText(address, LINE_X_OFFSET, y_offset,
+ (cursor.y == (i + 1) ? CURSOR_RGBA : ADDRESS_RGBA), GZ_checkDropShadows());
+ GZ_drawText(b0, address_offset, y_offset,
+ (l_byteIdx == 0 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b1, address_offset + b_offset * 1, y_offset,
+ (l_byteIdx == 1 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b2, address_offset + b_offset * 2, y_offset,
+ (l_byteIdx == 2 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b3, address_offset + b_offset * 3, y_offset,
+ (l_byteIdx == 3 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b4, address_offset + b_offset * 4, y_offset,
+ (l_byteIdx == 4 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b5, address_offset + b_offset * 5, y_offset,
+ (l_byteIdx == 5 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b6, address_offset + b_offset * 6, y_offset,
+ (l_byteIdx == 6 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
+ GZ_drawText(b7, address_offset + b_offset * 7, y_offset,
+ (l_byteIdx == 7 && cursor.y == (i + 1) ? mem_cursor_color : WHITE_RGBA),
+ GZ_checkDropShadows());
}
}
-void MemoryEditorMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- if (index_selected) {
- lock_cursor_y = false;
- index_selected = false;
- } else if (lock_cursor_x || lock_cursor_y) {
- lock_cursor_x = false;
- lock_cursor_y = false;
+void MemoryEditorMenu::draw() {
+ cursor.setMode(Cursor::MODE_UNRESTRICTED);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ if (l_idxSelected) {
+ cursor.lock_y = false;
+ l_idxSelected = false;
+ } else if (cursor.lock_x || cursor.lock_y) {
+ cursor.lock_x = false;
+ cursor.lock_y = false;
} else {
- init_once = false;
- MenuRendering::set_menu(MN_MEMORY_INDEX);
+ GZ_setMenu(GZ_MEMORY_MENU);
return;
}
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case 0: {
- lock_cursor_y = true;
- index_selected = true;
- }
+ case 0:
+ cursor.lock_y = true;
+ l_idxSelected = true;
+ break;
}
if (cursor.y > 0) {
- lock_cursor_x = true;
- lock_cursor_y = true;
+ cursor.lock_x = true;
+ cursor.lock_y = true;
}
}
- Utilities::move_cursor(cursor, 1 + MAX_DISPLAY_LINES, 8, lock_cursor_x, lock_cursor_y, false,
- true);
- Font::gz_renderChars("DPad to move/modify value, A/B to (de)select value", 25.0f, 440.f,
- 0xFFFFFFFF, g_drop_shadows);
- render_memory(cursor);
-}; \ No newline at end of file
+ cursor.move(8, 1 + MAX_DISPLAY_LINES);
+ GZ_drawText("DPad to move/modify value, A/B to (de)select value", 25.0f, 440.f, WHITE_RGBA,
+ GZ_checkDropShadows());
+ drawMemEditor();
+} \ No newline at end of file
diff --git a/src/menus/memory_menu.cpp b/src/menus/memory_menu.cpp
index 18242a3..4f6af81 100644
--- a/src/menus/memory_menu.cpp
+++ b/src/menus/memory_menu.cpp
@@ -1,47 +1,36 @@
#include "menus/memory_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES 3
+#define LINE_NUM 3
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor MemoryMenu::cursor;
-Line lines[LINES] = {{"watches", 0, "Manage memory watches", false},
- {"memory editor", 1, "View/edit memory", false},
- {"mem files", 2, "Save/Load memory files", false}};
+Line lines[LINE_NUM] = {
+ {"watches", 0, "Manage memory watches", false},
+ {"memory editor", 1, "View/edit memory", false},
+ {"mem files", 2, "Save/Load memory files", false},
+};
-void MemoryMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
+void MemoryMenu::draw() {
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
return;
}
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case 0: {
- MenuRendering::set_menu(MN_WATCHES_INDEX);
+ case 0:
+ GZ_setMenu(GZ_WATCHES_MENU);
return;
- }
- case 1: {
- MenuRendering::set_menu(MN_MEMORY_EDITOR_INDEX);
+ case 1:
+ GZ_setMenu(GZ_MEM_EDITOR_MENU);
return;
- }
- case 2: {
- MenuRendering::set_menu(MN_MEM_FILES_INDEX);
+ case 2:
+ GZ_setMenu(GZ_MEMFILES_MENU);
return;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/pause_menu.cpp b/src/menus/pause_menu.cpp
index fb21604..0514db0 100644
--- a/src/menus/pause_menu.cpp
+++ b/src/menus/pause_menu.cpp
@@ -1,479 +1,409 @@
#include "menus/pause_menu.h"
-#include "controller.h"
-#include "font.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/utils.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
-
-#define LINES 17
-
-#define MAX_ORDON_SWORD_OPTIONS 3
-#define MAX_MASTER_SWORD_OPTIONS 3
-#define MAX_WOOD_SHIELD_OPTIONS 3
-#define MAX_HYLIAN_SHIELD_OPTIONS 2
-#define MAX_HERO_TUNIC_OPTIONS 2
-#define MAX_ZORA_ARMOR_OPTIONS 2
-#define MAX_MAGIC_ARMOR_OPTIONS 2
-#define MAX_BOMB_CAPACITY_OPTIONS 2
-#define MAX_WALLET_OPTIONS 3
-#define MAX_ARROW_CAPACITY_OPTIONS 3
-
-#define MAX_HIDDEN_SKILL_OPTIONS 2
-
-static Cursor cursor = {0, 0};
-static uint8_t ordon_sword_index = 0;
-static uint8_t master_sword_index = 0;
-static uint8_t wood_shield_index = 0;
-static uint8_t hylian_shield_index = 0;
-static uint8_t hero_tunic_index = 0;
-static uint8_t zora_armor_index = 0;
-static uint8_t magic_armor_index = 0;
-static uint8_t bomb_capacity_index = 0;
-static uint8_t wallet_index = 0;
-static uint8_t arrow_capacity_index = 0;
-
-bool ending_blow;
-bool shield_bash;
-bool backslice;
-bool helm_splitter;
-bool mortal_draw;
-bool jump_strike;
-bool great_spin;
-
-bool init_once = false;
-
-Line lines[LINES] = {
+#include "gz_flags.h"
+
+#define LINE_NUM 17
+
+#define MAX_ORDON_SWORD_OPT 3
+#define MAX_MASTER_SWORD_OPT 3
+#define MAX_WOOD_SHIELD_OPT 3
+#define MAX_HYLIAN_SHIELD_OPT 2
+#define MAX_HERO_TUNIC_OPT 2
+#define MAX_ZORA_ARMOR_OPT 2
+#define MAX_MAGIC_ARMOR_OPT 2
+#define MAX_BOMB_CAPACITY_OPT 2
+#define MAX_WALLET_OPT 3
+#define MAX_ARROW_CAPACITY_OPT 3
+#define MAX_HIDDEN_SKILL_OPT 2
+
+Cursor PauseMenu::cursor;
+
+uint8_t l_ordonSword_idx = 0;
+uint8_t l_masterSword_idx = 0;
+uint8_t l_woodShield_idx = 0;
+uint8_t l_hyShield_idx = 0;
+uint8_t l_tunic_idx = 0;
+uint8_t l_zoraArmor_idx = 0;
+uint8_t l_magicArmor_idx = 0;
+uint8_t l_bombCap_idx = 0;
+uint8_t l_wallet_idx = 0;
+uint8_t l_arrowCap_idx = 0;
+
+bool l_ebFlag;
+bool l_sbFlag;
+bool l_bsFlag;
+bool l_hsFlag;
+bool l_mdFlag;
+bool l_jsFlag;
+bool l_gsFlag;
+
+Line lines[LINE_NUM] = {
{"ordon sword:", ORDON_SWORD_INDEX, "Wooden Sword / Ordon Sword", false, nullptr,
- MAX_ORDON_SWORD_OPTIONS},
+ MAX_ORDON_SWORD_OPT},
{"master sword:", MASTER_SWORD_INDEX, "Master Sword / Light Sword", false, nullptr,
- MAX_MASTER_SWORD_OPTIONS},
+ MAX_MASTER_SWORD_OPT},
{"wooden shield:", WOOD_SHIELD_INDEX, "Ordon Shield / Wooden Shield", false, nullptr,
- MAX_WOOD_SHIELD_OPTIONS},
- {"hylian shield:", HYLIAN_SHIELD_INDEX, "Hylian Shield", false, nullptr,
- MAX_HYLIAN_SHIELD_OPTIONS},
- {"hero's tunic:", HERO_TUNIC_INDEX, "Hero's Tunic", false, nullptr, MAX_HERO_TUNIC_OPTIONS},
- {"zora armor:", ZORA_ARMOR_INDEX, "Zora Armor", false, nullptr, MAX_ZORA_ARMOR_OPTIONS},
- {"magic armor:", MAGIC_ARMOR_INDEX, "Magic Armor", false, nullptr, MAX_MAGIC_ARMOR_OPTIONS},
+ MAX_WOOD_SHIELD_OPT},
+ {"hylian shield:", HYLIAN_SHIELD_INDEX, "Hylian Shield", false, nullptr, MAX_HYLIAN_SHIELD_OPT},
+ {"hero's tunic:", HERO_TUNIC_INDEX, "Hero's Tunic", false, nullptr, MAX_HERO_TUNIC_OPT},
+ {"zora armor:", ZORA_ARMOR_INDEX, "Zora Armor", false, nullptr, MAX_ZORA_ARMOR_OPT},
+ {"magic armor:", MAGIC_ARMOR_INDEX, "Magic Armor", false, nullptr, MAX_MAGIC_ARMOR_OPT},
{"bomb capacity:", BOMB_CAPACITY_INDEX, "Bomb Bag Capacity", false, nullptr,
- MAX_BOMB_CAPACITY_OPTIONS},
- {"wallet upgrade:", WALLET_INDEX, "Wallet Capacity", false, nullptr, MAX_WALLET_OPTIONS},
+ MAX_BOMB_CAPACITY_OPT},
+ {"wallet upgrade:", WALLET_INDEX, "Wallet Capacity", false, nullptr, MAX_WALLET_OPT},
{"arrow capacity:", ARROW_CAPACITY_INDEX, "Arrow Quiver Capacity", false, nullptr,
- MAX_ARROW_CAPACITY_OPTIONS},
- {"ending blow:", ENDING_BLOW_INDEX, "Ending Blow", true, &ending_blow},
- {"shield bash:", SHIELD_BASH_INDEX, "Shield Bash", true, &shield_bash},
- {"backslice:", BACKSLICE_INDEX, "Backslice", true, &backslice},
- {"helm splitter:", HELM_SPLITTER_INDEX, "Helm Splitter", true, &helm_splitter},
- {"mortal draw:", MORTAL_DRAW_INDEX, "Mortal Draw", true, &mortal_draw},
- {"jump strike:", JUMP_STRIKE_INDEX, "Jump Strike", true, &jump_strike},
- {"greatspin:", GREAT_SPIN_INDEX, "Greatspin", true, &great_spin}};
+ MAX_ARROW_CAPACITY_OPT},
+ {"ending blow:", ENDING_BLOW_INDEX, "Ending Blow", true, &l_ebFlag},
+ {"shield bash:", SHIELD_BASH_INDEX, "Shield Bash", true, &l_sbFlag},
+ {"backslice:", BACKSLICE_INDEX, "Backslice", true, &l_bsFlag},
+ {"helm splitter:", HELM_SPLITTER_INDEX, "Helm Splitter", true, &l_hsFlag},
+ {"mortal draw:", MORTAL_DRAW_INDEX, "Mortal Draw", true, &l_mdFlag},
+ {"jump strike:", JUMP_STRIKE_INDEX, "Jump Strike", true, &l_jsFlag},
+ {"greatspin:", GREAT_SPIN_INDEX, "Greatspin", true, &l_gsFlag}};
void resetIndex() {
- ordon_sword_index = 0;
- master_sword_index = 0;
- wood_shield_index = 0;
- hylian_shield_index = 0;
- hero_tunic_index = 0;
- zora_armor_index = 0;
- magic_armor_index = 0;
- bomb_capacity_index = 0;
- wallet_index = 0;
- arrow_capacity_index = 0;
+ l_ordonSword_idx = 0;
+ l_masterSword_idx = 0;
+ l_woodShield_idx = 0;
+ l_hyShield_idx = 0;
+ l_tunic_idx = 0;
+ l_zoraArmor_idx = 0;
+ l_magicArmor_idx = 0;
+ l_bombCap_idx = 0;
+ l_wallet_idx = 0;
+ l_arrowCap_idx = 0;
}
void getEquipment() {
if (dComIfGs_isItemFirstBit(SWORD)) {
- ordon_sword_index = 2;
+ l_ordonSword_idx = 2;
} else if (dComIfGs_isItemFirstBit(WOOD_STICK)) {
- ordon_sword_index = 1;
+ l_ordonSword_idx = 1;
}
if (dComIfGs_isItemFirstBit(LIGHT_SWORD)) {
- master_sword_index = 2;
+ l_masterSword_idx = 2;
} else if (dComIfGs_isItemFirstBit(MASTER_SWORD)) {
- master_sword_index = 1;
+ l_masterSword_idx = 1;
}
if (dComIfGs_isItemFirstBit(SHIELD)) {
- wood_shield_index = 2;
+ l_woodShield_idx = 2;
} else if (dComIfGs_isItemFirstBit(WOOD_SHIELD)) {
- wood_shield_index = 1;
+ l_woodShield_idx = 1;
}
if (dComIfGs_isItemFirstBit(HYLIA_SHIELD)) {
- hylian_shield_index = 1;
+ l_hyShield_idx = 1;
}
if (dComIfGs_isItemFirstBit(WEAR_KOKIRI)) {
- hero_tunic_index = 1;
+ l_tunic_idx = 1;
}
if (dComIfGs_isItemFirstBit(WEAR_ZORA)) {
- zora_armor_index = 1;
+ l_zoraArmor_idx = 1;
}
if (dComIfGs_isItemFirstBit(ARMOR)) {
- magic_armor_index = 1;
+ l_magicArmor_idx = 1;
}
if (dComIfGs_isItemFirstBit(BOMB_BAG_LV2)) {
- bomb_capacity_index = 1;
+ l_bombCap_idx = 1;
}
switch (dComIfGs_getWalletSize()) {
- case 1: {
- wallet_index = 1;
+ case 1:
+ l_wallet_idx = 1;
break;
- }
- case 2: {
- wallet_index = 2;
+ case 2:
+ l_wallet_idx = 2;
break;
}
- }
if (dComIfGs_getArrowMax() == 100) {
- arrow_capacity_index = 2;
+ l_arrowCap_idx = 2;
} else if (dComIfGs_getArrowMax() == 60) {
- arrow_capacity_index = 1;
+ l_arrowCap_idx = 1;
}
}
void setEquipment() {
- switch (ordon_sword_index) {
- case 0: {
+ switch (l_ordonSword_idx) {
+ case 0:
dComIfGs_offItemFirstBit(WOOD_STICK);
dComIfGs_offItemFirstBit(SWORD);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(WOOD_STICK);
dComIfGs_offItemFirstBit(SWORD);
break;
- }
- case 2: {
+ case 2:
dComIfGs_onItemFirstBit(SWORD);
dComIfGs_offItemFirstBit(WOOD_STICK);
break;
}
- }
- switch (master_sword_index) {
- case 0: {
+ switch (l_masterSword_idx) {
+ case 0:
dComIfGs_offItemFirstBit(MASTER_SWORD);
dComIfGs_offItemFirstBit(LIGHT_SWORD);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(MASTER_SWORD);
dComIfGs_offItemFirstBit(LIGHT_SWORD);
break;
- }
- case 2: {
+ case 2:
dComIfGs_onItemFirstBit(LIGHT_SWORD);
break;
}
- }
- switch (wood_shield_index) {
- case 0: {
+ switch (l_woodShield_idx) {
+ case 0:
dComIfGs_offItemFirstBit(SHIELD);
dComIfGs_offItemFirstBit(WOOD_SHIELD);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(WOOD_SHIELD);
break;
- }
- case 2: {
+ case 2:
dComIfGs_onItemFirstBit(SHIELD);
break;
}
- }
- switch (hylian_shield_index) {
- case 0: {
+ switch (l_hyShield_idx) {
+ case 0:
dComIfGs_offItemFirstBit(HYLIA_SHIELD);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(HYLIA_SHIELD);
break;
}
- }
- switch (hero_tunic_index) {
- case 0: {
+ switch (l_tunic_idx) {
+ case 0:
dComIfGs_offItemFirstBit(WEAR_KOKIRI);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(WEAR_KOKIRI);
break;
}
- }
- switch (zora_armor_index) {
- case 0: {
+ switch (l_zoraArmor_idx) {
+ case 0:
dComIfGs_offItemFirstBit(WEAR_ZORA);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(WEAR_ZORA);
break;
}
- }
- switch (magic_armor_index) {
- case 0: {
+ switch (l_magicArmor_idx) {
+ case 0:
dComIfGs_offItemFirstBit(ARMOR);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(ARMOR);
break;
}
- }
- switch (bomb_capacity_index) {
- case 0: {
+ switch (l_bombCap_idx) {
+ case 0:
dComIfGs_offItemFirstBit(BOMB_BAG_LV2);
break;
- }
- case 1: {
+ case 1:
dComIfGs_onItemFirstBit(BOMB_BAG_LV2);
break;
}
- }
- switch (wallet_index) {
- case 0: {
+ switch (l_wallet_idx) {
+ case 0:
dComIfGs_setWalletSize(WALLET);
break;
- }
- case 1: {
+ case 1:
dComIfGs_setWalletSize(BIG_WALLET);
break;
- }
- case 2: {
+ case 2:
dComIfGs_setWalletSize(GIANT_WALLET);
break;
}
- }
- switch (arrow_capacity_index) {
- case 0: {
+ switch (l_arrowCap_idx) {
+ case 0:
dComIfGs_setArrowMax(30);
break;
- }
- case 1: {
+ case 1:
dComIfGs_setArrowMax(60);
break;
- }
- case 2: {
+ case 2:
dComIfGs_setArrowMax(100);
break;
}
- }
}
-void PauseMenu::render() {
- // update hidden skill flags
- ending_blow = dComIfGs_isEventBit(0x2904);
- shield_bash = dComIfGs_isEventBit(0x2908);
- backslice = dComIfGs_isEventBit(0x2902);
- helm_splitter = dComIfGs_isEventBit(0x2901);
- mortal_draw = dComIfGs_isEventBit(0x2A80);
- jump_strike = dComIfGs_isEventBit(0x2A40);
- great_spin = dComIfGs_isEventBit(0x2A20);
-
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_INVENTORY_INDEX);
- resetIndex();
- return;
- };
+void PauseMenu::draw() {
+ static bool init = false;
+ cursor.setMode(Cursor::MODE_LIST);
- if (!init_once) {
+ if (!init) {
getEquipment();
- current_input = 0;
- init_once = true;
+ init = true;
}
- ListMember ordon_sword_options[MAX_ORDON_SWORD_OPTIONS] = {"none", "wooden sword",
- "ordon sword"};
-
- ListMember master_sword_options[MAX_MASTER_SWORD_OPTIONS] = {"none", "master sword",
- "light sword"};
-
- ListMember wood_shield_options[MAX_WOOD_SHIELD_OPTIONS] = {"none", "ordon shield",
- "wooden shield"};
-
- ListMember hylian_shield_options[MAX_HYLIAN_SHIELD_OPTIONS] = {"none", "hylian shield"};
-
- ListMember hero_tunic_options[MAX_HERO_TUNIC_OPTIONS] = {"none", "hero's tunic"};
-
- ListMember zora_armor_options[MAX_ZORA_ARMOR_OPTIONS] = {"none", "zora armor"};
-
- ListMember magic_armor_options[MAX_MAGIC_ARMOR_OPTIONS] = {"none", "magic armor"};
-
- ListMember bomb_capacity_options[MAX_BOMB_CAPACITY_OPTIONS] = {"30/15/10", "60/30/20"};
-
- ListMember wallet_options[MAX_WALLET_OPTIONS] = {"300 Rupees", "600 Rupees", "1000 Rupees"};
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ init = false;
+ GZ_setMenu(GZ_INVENTORY_MENU);
+ resetIndex();
+ return;
+ }
- ListMember arrow_capacity_options[MAX_ARROW_CAPACITY_OPTIONS] = {"30 Arrows", "60 Arrows",
- "100 Arrows"};
+ // update hidden skill flags
+ l_ebFlag = dComIfGs_isEventBit(0x2904);
+ l_sbFlag = dComIfGs_isEventBit(0x2908);
+ l_bsFlag = dComIfGs_isEventBit(0x2902);
+ l_hsFlag = dComIfGs_isEventBit(0x2901);
+ l_mdFlag = dComIfGs_isEventBit(0x2A80);
+ l_jsFlag = dComIfGs_isEventBit(0x2A40);
+ l_gsFlag = dComIfGs_isEventBit(0x2A20);
+
+ ListMember ordonSword_opt[3] = {"none", "wooden sword", "ordon sword"};
+ ListMember masterSword_opt[3] = {"none", "master sword", "light sword"};
+ ListMember woodShield_opt[3] = {"none", "ordon shield", "wooden shield"};
+ ListMember hyShield_opt[2] = {"none", "hylian shield"};
+ ListMember tunic_opt[2] = {"none", "hero's tunic"};
+ ListMember zoraArmor_opt[2] = {"none", "zora armor"};
+ ListMember magicArmor_opt[2] = {"none", "magic armor"};
+ ListMember bombCap_opt[2] = {"30/15/10", "60/30/20"};
+ ListMember wallet_opt[3] = {"300 Rupees", "600 Rupees", "1000 Rupees"};
+ ListMember arrowCap_opt[3] = {"30 Arrows", "60 Arrows", "100 Arrows"};
switch (cursor.y) {
- case ORDON_SWORD_INDEX: {
- cursor.x = ordon_sword_index;
- Utilities::move_cursor(cursor, LINES, MAX_ORDON_SWORD_OPTIONS, false, false, false, true);
+ case ORDON_SWORD_INDEX:
+ cursor.x = l_ordonSword_idx;
+ cursor.move(MAX_ORDON_SWORD_OPT, LINE_NUM);
+
if (cursor.y == ORDON_SWORD_INDEX) {
- ordon_sword_index = cursor.x;
+ l_ordonSword_idx = cursor.x;
}
-
break;
- }
- case MASTER_SWORD_INDEX: {
- cursor.x = master_sword_index;
- Utilities::move_cursor(cursor, LINES, MAX_MASTER_SWORD_OPTIONS, false, false, false, true);
+ case MASTER_SWORD_INDEX:
+ cursor.x = l_masterSword_idx;
+ cursor.move(MAX_MASTER_SWORD_OPT, LINE_NUM);
+
if (cursor.y == MASTER_SWORD_INDEX) {
- master_sword_index = cursor.x;
+ l_masterSword_idx = cursor.x;
}
-
break;
- }
- case WOOD_SHIELD_INDEX: {
- cursor.x = wood_shield_index;
- Utilities::move_cursor(cursor, LINES, MAX_WOOD_SHIELD_OPTIONS, false, false, false, true);
+ case WOOD_SHIELD_INDEX:
+ cursor.x = l_woodShield_idx;
+ cursor.move(MAX_WOOD_SHIELD_OPT, LINE_NUM);
+
if (cursor.y == WOOD_SHIELD_INDEX) {
- wood_shield_index = cursor.x;
+ l_woodShield_idx = cursor.x;
}
-
break;
- }
- case HYLIAN_SHIELD_INDEX: {
- cursor.x = hylian_shield_index;
- Utilities::move_cursor(cursor, LINES, MAX_HYLIAN_SHIELD_OPTIONS, false, false, false, true);
+ case HYLIAN_SHIELD_INDEX:
+ cursor.x = l_hyShield_idx;
+ cursor.move(MAX_HYLIAN_SHIELD_OPT, LINE_NUM);
+
if (cursor.y == HYLIAN_SHIELD_INDEX) {
- hylian_shield_index = cursor.x;
+ l_hyShield_idx = cursor.x;
}
-
break;
- }
- case HERO_TUNIC_INDEX: {
- cursor.x = hero_tunic_index;
- Utilities::move_cursor(cursor, LINES, MAX_HERO_TUNIC_OPTIONS, false, false, false, true);
+ case HERO_TUNIC_INDEX:
+ cursor.x = l_tunic_idx;
+ cursor.move(MAX_HERO_TUNIC_OPT, LINE_NUM);
+
if (cursor.y == HERO_TUNIC_INDEX) {
- hero_tunic_index = cursor.x;
+ l_tunic_idx = cursor.x;
}
-
break;
- }
- case ZORA_ARMOR_INDEX: {
- cursor.x = zora_armor_index;
- Utilities::move_cursor(cursor, LINES, MAX_ZORA_ARMOR_OPTIONS, false, false, false, true);
+ case ZORA_ARMOR_INDEX:
+ cursor.x = l_zoraArmor_idx;
+ cursor.move(MAX_ZORA_ARMOR_OPT, LINE_NUM);
+
if (cursor.y == ZORA_ARMOR_INDEX) {
- zora_armor_index = cursor.x;
+ l_zoraArmor_idx = cursor.x;
}
-
break;
- }
- case MAGIC_ARMOR_INDEX: {
- cursor.x = magic_armor_index;
- Utilities::move_cursor(cursor, LINES, MAX_MAGIC_ARMOR_OPTIONS, false, false, false, true);
+ case MAGIC_ARMOR_INDEX:
+ cursor.x = l_magicArmor_idx;
+ cursor.move(MAX_MAGIC_ARMOR_OPT, LINE_NUM);
+
if (cursor.y == MAGIC_ARMOR_INDEX) {
- magic_armor_index = cursor.x;
+ l_magicArmor_idx = cursor.x;
}
-
break;
- }
- case BOMB_CAPACITY_INDEX: {
- cursor.x = bomb_capacity_index;
- Utilities::move_cursor(cursor, LINES, MAX_BOMB_CAPACITY_OPTIONS, false, false, false, true);
+ case BOMB_CAPACITY_INDEX:
+ cursor.x = l_bombCap_idx;
+ cursor.move(MAX_BOMB_CAPACITY_OPT, LINE_NUM);
+
if (cursor.y == BOMB_CAPACITY_INDEX) {
- bomb_capacity_index = cursor.x;
+ l_bombCap_idx = cursor.x;
}
-
break;
- }
- case WALLET_INDEX: {
- cursor.x = wallet_index;
- Utilities::move_cursor(cursor, LINES, MAX_WALLET_OPTIONS, false, false, false, true);
+ case WALLET_INDEX:
+ cursor.x = l_wallet_idx;
+ cursor.move(MAX_WALLET_OPT, LINE_NUM);
+
if (cursor.y == WALLET_INDEX) {
- wallet_index = cursor.x;
+ l_wallet_idx = cursor.x;
}
-
break;
- }
- case ARROW_CAPACITY_INDEX: {
- cursor.x = arrow_capacity_index;
- Utilities::move_cursor(cursor, LINES, MAX_ARROW_CAPACITY_OPTIONS, false, false, false,
- true);
+ case ARROW_CAPACITY_INDEX:
+ cursor.x = l_arrowCap_idx;
+ cursor.move(MAX_ARROW_CAPACITY_OPT, LINE_NUM);
+
if (cursor.y == ARROW_CAPACITY_INDEX) {
- arrow_capacity_index = cursor.x;
+ l_arrowCap_idx = cursor.x;
}
-
break;
- }
- default: {
- Utilities::move_cursor(cursor, LINES, 2);
+ default:
+ cursor.move(0, LINE_NUM);
break;
}
- }
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case ENDING_BLOW_INDEX: {
+ case ENDING_BLOW_INDEX:
setEventFlag(0x2904);
break;
- }
- case SHIELD_BASH_INDEX: {
+ case SHIELD_BASH_INDEX:
setEventFlag(0x2908);
break;
- }
- case BACKSLICE_INDEX: {
+ case BACKSLICE_INDEX:
setEventFlag(0x2902);
break;
- }
- case HELM_SPLITTER_INDEX: {
+ case HELM_SPLITTER_INDEX:
setEventFlag(0x2901);
break;
- }
- case MORTAL_DRAW_INDEX: {
+ case MORTAL_DRAW_INDEX:
setEventFlag(0x2A80);
break;
- }
- case JUMP_STRIKE_INDEX: {
+ case JUMP_STRIKE_INDEX:
setEventFlag(0x2A40);
break;
- }
- case GREAT_SPIN_INDEX: {
+ case GREAT_SPIN_INDEX:
setEventFlag(0x2A20);
break;
}
- }
}
setEquipment();
- tp_sprintf(lines[ORDON_SWORD_INDEX].value, " <%s>",
- ordon_sword_options[ordon_sword_index].member);
- tp_sprintf(lines[MASTER_SWORD_INDEX].value, " <%s>",
- master_sword_options[master_sword_index].member);
- tp_sprintf(lines[WOOD_SHIELD_INDEX].value, " <%s>",
- wood_shield_options[wood_shield_index].member);
- tp_sprintf(lines[HYLIAN_SHIELD_INDEX].value, " <%s>",
- hylian_shield_options[hylian_shield_index].member);
- tp_sprintf(lines[HERO_TUNIC_INDEX].value, " <%s>", hero_tunic_options[hero_tunic_index].member);
- tp_sprintf(lines[ZORA_ARMOR_INDEX].value, " <%s>", zora_armor_options[zora_armor_index].member);
- tp_sprintf(lines[MAGIC_ARMOR_INDEX].value, " <%s>",
- magic_armor_options[magic_armor_index].member);
- tp_sprintf(lines[BOMB_CAPACITY_INDEX].value, " <%s>",
- bomb_capacity_options[bomb_capacity_index].member);
- tp_sprintf(lines[WALLET_INDEX].value, " <%s>", wallet_options[wallet_index].member);
- tp_sprintf(lines[ARROW_CAPACITY_INDEX].value, " <%s>",
- arrow_capacity_options[arrow_capacity_index].member);
-
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ tp_sprintf(lines[ORDON_SWORD_INDEX].value, " <%s>", ordonSword_opt[l_ordonSword_idx].member);
+ tp_sprintf(lines[MASTER_SWORD_INDEX].value, " <%s>", masterSword_opt[l_masterSword_idx].member);
+ tp_sprintf(lines[WOOD_SHIELD_INDEX].value, " <%s>", woodShield_opt[l_woodShield_idx].member);
+ tp_sprintf(lines[HYLIAN_SHIELD_INDEX].value, " <%s>", hyShield_opt[l_hyShield_idx].member);
+ tp_sprintf(lines[HERO_TUNIC_INDEX].value, " <%s>", tunic_opt[l_tunic_idx].member);
+ tp_sprintf(lines[ZORA_ARMOR_INDEX].value, " <%s>", zoraArmor_opt[l_zoraArmor_idx].member);
+ tp_sprintf(lines[MAGIC_ARMOR_INDEX].value, " <%s>", magicArmor_opt[l_magicArmor_idx].member);
+ tp_sprintf(lines[BOMB_CAPACITY_INDEX].value, " <%s>", bombCap_opt[l_bombCap_idx].member);
+ tp_sprintf(lines[WALLET_INDEX].value, " <%s>", wallet_opt[l_wallet_idx].member);
+ tp_sprintf(lines[ARROW_CAPACITY_INDEX].value, " <%s>", arrowCap_opt[l_arrowCap_idx].member);
+
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/portal_flags_menu.cpp b/src/menus/portal_flags_menu.cpp
index a86b32c..1491ffc 100644
--- a/src/menus/portal_flags_menu.cpp
+++ b/src/menus/portal_flags_menu.cpp
@@ -1,47 +1,49 @@
-#include "controller.h"
-#include "font.h"
#include "menus/flags_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
-#define LINES 15
-
-static Cursor cursor = {0, 0};
-bool init_once = false;
-
-bool spring_warp;
-bool south_faron_warp;
-bool north_faron_warp;
-bool grove_warp;
-bool gorge_warp;
-bool kakariko_warp;
-bool mountain_warp;
-bool bridge_warp;
-bool castle_town_warp;
-bool lake_hylia_warp;
-bool domain_warp;
-bool uzr_warp;
-bool snowpeak_warp;
-bool mesa_warp;
-bool mirror_warp;
-
-Line lines[LINES] = {
- {"ordon spring", SPRING_WARP_INDEX, "Ordon Spring warp portal", true, &spring_warp},
- {"south faron", S_FARON_WARP_INDEX, "South Faron warp portal", true, &south_faron_warp},
- {"north faron", N_FARON_WARP_INDEX, "North Faron warp portal", true, &north_faron_warp},
- {"sacred grove", GROVE_WARP_INDEX, "Sacred Grove warp portal", true, &grove_warp},
- {"eldin gorge", GORGE_WARP_INDEX, "Eldin Gorge warp portal", true, &gorge_warp},
- {"kak village", KAKARIKO_WARP_INDEX, "Kakariko Village warp portal", true, &kakariko_warp},
- {"death mountain", MOUNTAIN_WARP_INDEX, "Death Mountain warp portal", true, &mountain_warp},
- {"eldin bridge", BRIDGE_WARP_INDEX, "Bridge of Eldin warp portal", true, &bridge_warp},
- {"castle town", TOWN_WARP_INDEX, "Castle Town warp portal", true, &castle_town_warp},
- {"lake hylia", LAKE_WARP_INDEX, "Lake Hylia warp portal", true, &lake_hylia_warp},
- {"zora's domain", DOMAIN_WARP_INDEX, "Zora's Domain warp portal", true, &domain_warp},
- {"upper river", UZR_WARP_INDEX, "Upper Zora's River warp portal", true, &uzr_warp},
- {"snowpeak", SNOWPEAK_WARP_INDEX, "Snowpeak warp portal", true, &snowpeak_warp},
- {"gerudo mesa", MESA_WARP_INDEX, "Gerudo Mesa warp portal", true, &mesa_warp},
- {"mirror chamber", MIRROR_WARP_INDEX, "Mirror Chamber warp portal", true, &mirror_warp},
+#define LINE_NUM 17
+#define MAX_REGION_OPTIONS 6
+
+Cursor PortalFlagsMenu::cursor;
+
+bool l_mapRegion;
+uint8_t l_selRegion = 0;
+
+bool l_springWarp;
+bool l_sfaronWarp;
+bool l_nfaronWarp;
+bool l_groveWarp;
+bool l_gorgeWarp;
+bool l_kakWarp;
+bool l_mountainWarp;
+bool l_bridgeWarp;
+bool l_ctWarp;
+bool l_lakeWarp;
+bool l_domainWarp;
+bool l_uzrWarp;
+bool l_snowpeakWarp;
+bool l_mesaWarp;
+bool l_mirrorWarp;
+
+Line lines[LINE_NUM] = {
+ {"region:", SELECT_REGION_INDEX, "Select region flag", false, nullptr, MAX_REGION_OPTIONS},
+ {"region unlocked", REGION_FLAG_INDEX, "Unlock selected map region", true, &l_mapRegion},
+ {"ordon spring", SPRING_WARP_INDEX, "Ordon Spring warp portal", true, &l_springWarp},
+ {"south faron", S_FARON_WARP_INDEX, "South Faron warp portal", true, &l_sfaronWarp},
+ {"north faron", N_FARON_WARP_INDEX, "North Faron warp portal", true, &l_nfaronWarp},
+ {"sacred grove", GROVE_WARP_INDEX, "Sacred Grove warp portal", true, &l_groveWarp},
+ {"eldin gorge", GORGE_WARP_INDEX, "Eldin Gorge warp portal", true, &l_gorgeWarp},
+ {"kak village", KAKARIKO_WARP_INDEX, "Kakariko Village warp portal", true, &l_kakWarp},
+ {"death mountain", MOUNTAIN_WARP_INDEX, "Death Mountain warp portal", true, &l_mountainWarp},
+ {"eldin bridge", BRIDGE_WARP_INDEX, "Bridge of Eldin warp portal", true, &l_bridgeWarp},
+ {"castle town", TOWN_WARP_INDEX, "Castle Town warp portal", true, &l_ctWarp},
+ {"lake hylia", LAKE_WARP_INDEX, "Lake Hylia warp portal", true, &l_lakeWarp},
+ {"zora's domain", DOMAIN_WARP_INDEX, "Zora's Domain warp portal", true, &l_domainWarp},
+ {"upper river", UZR_WARP_INDEX, "Upper Zora's River warp portal", true, &l_uzrWarp},
+ {"snowpeak", SNOWPEAK_WARP_INDEX, "Snowpeak warp portal", true, &l_snowpeakWarp},
+ {"gerudo mesa", MESA_WARP_INDEX, "Gerudo Mesa warp portal", true, &l_mesaWarp},
+ {"mirror chamber", MIRROR_WARP_INDEX, "Mirror Chamber warp portal", true, &l_mirrorWarp},
};
bool getSaveSwitch(int32_t stage, int32_t flag) {
@@ -56,101 +58,113 @@ void setSaveSwitch(int32_t stage, int32_t flag) {
}
}
-void PortalFlagsMenu::render() {
- spring_warp = getSaveSwitch(dSv_memory_c::ORDON, 52);
- south_faron_warp = getSaveSwitch(dSv_memory_c::FARON, 71);
- north_faron_warp = getSaveSwitch(dSv_memory_c::FARON, 2);
- grove_warp = getSaveSwitch(dSv_memory_c::GROVE, 100);
- gorge_warp = getSaveSwitch(dSv_memory_c::FIELD, 21);
- kakariko_warp = getSaveSwitch(dSv_memory_c::ELDIN, 31);
- mountain_warp = getSaveSwitch(dSv_memory_c::ELDIN, 21);
- bridge_warp = getSaveSwitch(dSv_memory_c::FIELD, 99);
- castle_town_warp = getSaveSwitch(dSv_memory_c::FIELD, 3);
- lake_hylia_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 10);
- domain_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 2);
- uzr_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 21);
- snowpeak_warp = getSaveSwitch(dSv_memory_c::SNOWPEAK, 21);
- mesa_warp = getSaveSwitch(dSv_memory_c::DESERT, 21);
- mirror_warp = getSaveSwitch(dSv_memory_c::DESERT, 40);
-
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_FLAGS_INDEX);
- return;
- }
+inline void setRegionFlag(int regionBit) {
+ g_dComIfG_gameInfo.info.getPlayer().mPlayerFieldLastStayInfo.mRegion ^= (1 << regionBit);
+}
+
+inline bool getRegionFlag(int regionBit) {
+ return g_dComIfG_gameInfo.info.getPlayer().mPlayerFieldLastStayInfo.mRegion & (1 << regionBit);
+}
- if (!init_once) {
- current_input = 0;
- init_once = true;
+void PortalFlagsMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
+
+ l_mapRegion = getRegionFlag(l_selRegion + 1);
+ l_springWarp = getSaveSwitch(dSv_memory_c::ORDON, 52);
+ l_sfaronWarp = getSaveSwitch(dSv_memory_c::FARON, 71);
+ l_nfaronWarp = getSaveSwitch(dSv_memory_c::FARON, 2);
+ l_groveWarp = getSaveSwitch(dSv_memory_c::GROVE, 100);
+ l_gorgeWarp = getSaveSwitch(dSv_memory_c::FIELD, 21);
+ l_kakWarp = getSaveSwitch(dSv_memory_c::ELDIN, 31);
+ l_mountainWarp = getSaveSwitch(dSv_memory_c::ELDIN, 21);
+ l_bridgeWarp = getSaveSwitch(dSv_memory_c::FIELD, 99);
+ l_ctWarp = getSaveSwitch(dSv_memory_c::FIELD, 3);
+ l_lakeWarp = getSaveSwitch(dSv_memory_c::LANAYRU, 10);
+ l_domainWarp = getSaveSwitch(dSv_memory_c::LANAYRU, 2);
+ l_uzrWarp = getSaveSwitch(dSv_memory_c::LANAYRU, 21);
+ l_snowpeakWarp = getSaveSwitch(dSv_memory_c::SNOWPEAK, 21);
+ l_mesaWarp = getSaveSwitch(dSv_memory_c::DESERT, 21);
+ l_mirrorWarp = getSaveSwitch(dSv_memory_c::DESERT, 40);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_FLAGS_MENU);
+ return;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case SPRING_WARP_INDEX: {
+ case REGION_FLAG_INDEX:
+ setRegionFlag(l_selRegion + 1);
+ break;
+ case SPRING_WARP_INDEX:
setSaveSwitch(dSv_memory_c::ORDON, 52);
break;
- }
- case S_FARON_WARP_INDEX: {
+ case S_FARON_WARP_INDEX:
setSaveSwitch(dSv_memory_c::FARON, 71);
break;
- }
- case N_FARON_WARP_INDEX: {
+ case N_FARON_WARP_INDEX:
setSaveSwitch(dSv_memory_c::FARON, 2);
break;
- }
- case GROVE_WARP_INDEX: {
+ case GROVE_WARP_INDEX:
setSaveSwitch(dSv_memory_c::GROVE, 100);
break;
- }
- case GORGE_WARP_INDEX: {
+ case GORGE_WARP_INDEX:
setSaveSwitch(dSv_memory_c::FIELD, 21);
break;
- }
- case KAKARIKO_WARP_INDEX: {
+ case KAKARIKO_WARP_INDEX:
setSaveSwitch(dSv_memory_c::ELDIN, 31);
break;
- }
- case MOUNTAIN_WARP_INDEX: {
+ case MOUNTAIN_WARP_INDEX:
setSaveSwitch(dSv_memory_c::ELDIN, 21);
break;
- }
- case BRIDGE_WARP_INDEX: {
+ case BRIDGE_WARP_INDEX:
setSaveSwitch(dSv_memory_c::FIELD, 99);
break;
- }
- case TOWN_WARP_INDEX: {
+ case TOWN_WARP_INDEX:
setSaveSwitch(dSv_memory_c::FIELD, 3);
break;
- }
- case LAKE_WARP_INDEX: {
+ case LAKE_WARP_INDEX:
setSaveSwitch(dSv_memory_c::LANAYRU, 10);
break;
- }
- case DOMAIN_WARP_INDEX: {
+ case DOMAIN_WARP_INDEX:
setSaveSwitch(dSv_memory_c::LANAYRU, 2);
break;
- }
- case UZR_WARP_INDEX: {
+ case UZR_WARP_INDEX:
setSaveSwitch(dSv_memory_c::LANAYRU, 21);
break;
- }
- case SNOWPEAK_WARP_INDEX: {
+ case SNOWPEAK_WARP_INDEX:
setSaveSwitch(dSv_memory_c::SNOWPEAK, 21);
break;
- }
- case MESA_WARP_INDEX: {
+ case MESA_WARP_INDEX:
setSaveSwitch(dSv_memory_c::DESERT, 21);
break;
- }
- case MIRROR_WARP_INDEX: {
+ case MIRROR_WARP_INDEX:
setSaveSwitch(dSv_memory_c::DESERT, 40);
break;
}
- }
// copy stage save flags to temp flags
dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
}
- Utilities::move_cursor(cursor, LINES);
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ switch (cursor.y) {
+ case SELECT_REGION_INDEX:
+ cursor.x = l_selRegion;
+ cursor.move(MAX_REGION_OPTIONS, LINE_NUM);
+
+ if (cursor.y == SELECT_REGION_INDEX) {
+ l_selRegion = cursor.x;
+ }
+ break;
+ default:
+ cursor.move(0, LINE_NUM);
+ break;
+ }
+
+ ListMember region_opt[MAX_REGION_OPTIONS] = {
+ "ordon", "faron", "eldin", "lanayru", "desert", "snowpeak",
+ };
+
+ tp_sprintf(lines[SELECT_REGION_INDEX].value, " <%s>", region_opt[l_selRegion].member);
+
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/position_settings_menu.cpp b/src/menus/position_settings_menu.cpp
index 05901af..873a435 100644
--- a/src/menus/position_settings_menu.cpp
+++ b/src/menus/position_settings_menu.cpp
@@ -1,32 +1,28 @@
#include "menus/position_settings_menu.h"
#include <cstdio>
-#include "controller.h"
+#include "utils/draw.h"
#include "fifo_queue.h"
-#include "font.h"
#include "menus/settings_menu.h"
-#include "utils/cursor.h"
-#include "utils/draw.h"
-#include "utils/lines.h"
#include "libtp_c/include/SSystem/SComponent/c_counter.h"
+#include "gz_flags.h"
-#define LINES SPRITES_AMNT
+#define LINE_NUM SPRITES_AMNT
#define NO_SELECTION ((uint8_t)-1)
#define INITAL_SPEED 1.0f
#define INCREMENT_FACTOR 1.05f
#define MAX_SPEED 20.f
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor PosSettingsMenu::cursor;
-float speed;
-bool was_pressed;
+bool init_once = false;
-uint8_t selected_item = NO_SELECTION;
+float l_cursorSpeed;
+uint8_t l_selItem = NO_SELECTION;
-Vec2 sprite_offsets[SPRITES_AMNT];
+Vec2 g_spriteOffsets[SPRITES_AMNT];
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"main menu", SpritesIndex::MENU_INDEX, "Change main menu position", false},
{"input viewer", SpritesIndex::VIEWER_INDEX, "Change input viewer position", false},
{"link debug info", SpritesIndex::DEBUG_INFO_INDEX, "Change link debug info position", false},
@@ -35,79 +31,83 @@ Line lines[LINES] = {
{"igt timer", SpritesIndex::IGT_TIMER_SPR_INDEX, "Change IGT timer position", false},
{"fifo queue", SpritesIndex::FIFO_SPR_INDEX, "Change fifo queue position", false}};
-void draw_cursor(Vec2 pos) {
+void drawCursor(Vec2 pos) {
bool cycle = (cCt_getFrameCount() / 8) % 2;
- if (g_drop_shadows) {
- Draw::draw_rect_outline(DROP_SHADOWS_RGBA, {pos.x - 10 + 1, pos.y + 1}, {20, 0}, 0xA);
- Draw::draw_rect_outline(DROP_SHADOWS_RGBA, {pos.x + 1, pos.y - 10 + 1}, {0, 20}, 0xA);
+ if (GZ_checkDropShadows()) {
+ Draw::drawRectOutline(DROP_SHADOWS_RGBA, {pos.x - 10 + 1, pos.y + 1}, {20, 0}, 0xA);
+ Draw::drawRectOutline(DROP_SHADOWS_RGBA, {pos.x + 1, pos.y - 10 + 1}, {0, 20}, 0xA);
}
- Draw::draw_rect_outline(cycle ? cursor_rgba : 0xFFFFFFFF, {pos.x - 10, pos.y}, {20, 0}, 0xA);
- Draw::draw_rect_outline(cycle ? cursor_rgba : 0xFFFFFFFF, {pos.x, pos.y - 10}, {0, 20}, 0xA);
+ Draw::drawRectOutline(cycle ? g_cursorColor : 0xFFFFFFFF, {pos.x - 10, pos.y}, {20, 0}, 0xA);
+ Draw::drawRectOutline(cycle ? g_cursorColor : 0xFFFFFFFF, {pos.x, pos.y - 10}, {0, 20}, 0xA);
}
-void PosSettingsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- if (selected_item != NO_SELECTION) {
- selected_item = NO_SELECTION;
+void PosSettingsMenu::draw() {
+ cursor.setMode(Cursor::MODE_UNRESTRICTED);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ if (l_selItem != NO_SELECTION) {
+ l_selItem = NO_SELECTION;
} else {
init_once = false;
- MenuRendering::set_menu(MN_SETTINGS_INDEX);
+ GZ_setMenu(GZ_SETTINGS_MENU);
return;
}
- };
+ }
if (!init_once) {
- selected_item = NO_SELECTION;
- current_input = 0;
+ l_selItem = NO_SELECTION;
init_once = true;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
if (cursor.y < SPRITES_AMNT) {
- selected_item = selected_item == cursor.y ? NO_SELECTION : cursor.y;
+ l_selItem = l_selItem == cursor.y ? NO_SELECTION : cursor.y;
}
}
- if (selected_item != NO_SELECTION && selected_item < SPRITES_AMNT) {
- if (button_is_pressed(Controller::DPAD_RIGHT, 3)) {
- sprite_offsets[selected_item].x += speed;
+ if (l_selItem != NO_SELECTION && l_selItem < SPRITES_AMNT) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT, 3)) {
+ g_spriteOffsets[l_selItem].x += l_cursorSpeed;
}
- if (button_is_pressed(Controller::DPAD_LEFT, 3)) {
- sprite_offsets[selected_item].x -= speed;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT, 3)) {
+ g_spriteOffsets[l_selItem].x -= l_cursorSpeed;
}
- if (button_is_pressed(Controller::DPAD_UP, 3)) {
- sprite_offsets[selected_item].y -= speed;
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP, 3)) {
+ g_spriteOffsets[l_selItem].y -= l_cursorSpeed;
}
- if (button_is_pressed(Controller::DPAD_DOWN, 3)) {
- sprite_offsets[selected_item].y += speed;
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN, 3)) {
+ g_spriteOffsets[l_selItem].y += l_cursorSpeed;
}
+
// Draw visual cursor
- draw_cursor(sprite_offsets[selected_item]);
+ drawCursor(g_spriteOffsets[l_selItem]);
}
- if (button_is_down(Controller::DPAD_RIGHT) || button_is_down(Controller::DPAD_LEFT) ||
- button_is_down(Controller::DPAD_UP) || button_is_down(Controller::DPAD_DOWN)) {
- if (speed < MAX_SPEED) {
- speed *= INCREMENT_FACTOR;
+ if (GZ_getButtonPressed(GZPad::DPAD_RIGHT) || GZ_getButtonPressed(GZPad::DPAD_LEFT) ||
+ GZ_getButtonPressed(GZPad::DPAD_UP) || GZ_getButtonPressed(GZPad::DPAD_DOWN)) {
+ if (l_cursorSpeed < MAX_SPEED) {
+ l_cursorSpeed *= INCREMENT_FACTOR;
}
- if (speed > MAX_SPEED) {
- speed = MAX_SPEED;
+ if (l_cursorSpeed > MAX_SPEED) {
+ l_cursorSpeed = MAX_SPEED;
}
} else {
- speed = INITAL_SPEED;
+ l_cursorSpeed = INITAL_SPEED;
}
- Utilities::move_cursor(cursor, LINES, 1, selected_item != NO_SELECTION,
- selected_item != NO_SELECTION);
- Utilities::render_lines(lines, cursor.y, LINES);
+ cursor.lock_x = l_selItem != NO_SELECTION;
+ cursor.lock_y = l_selItem != NO_SELECTION;
+
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
}
void PosSettingsMenu::initDefaults() {
- sprite_offsets[VIEWER_INDEX] = {220.f, 380.f};
- sprite_offsets[MENU_INDEX] = {25.f, 60.f};
- sprite_offsets[DEBUG_INFO_INDEX] = {450.0f, 200.f};
- sprite_offsets[TIMER_SPR_INDEX] = {525.0f, 420.f};
- sprite_offsets[LOAD_TIMER_SPR_INDEX] = {525.0f, 30.f};
- sprite_offsets[IGT_TIMER_SPR_INDEX] = {35.0f, 30.f};
- sprite_offsets[FIFO_SPR_INDEX] = {5.0f, 440.f};
+ g_spriteOffsets[VIEWER_INDEX] = {220.f, 380.f};
+ g_spriteOffsets[MENU_INDEX] = {25.f, 60.f};
+ g_spriteOffsets[DEBUG_INFO_INDEX] = {450.0f, 200.f};
+ g_spriteOffsets[TIMER_SPR_INDEX] = {525.0f, 420.f};
+ g_spriteOffsets[LOAD_TIMER_SPR_INDEX] = {525.0f, 30.f};
+ g_spriteOffsets[IGT_TIMER_SPR_INDEX] = {35.0f, 30.f};
+ g_spriteOffsets[FIFO_SPR_INDEX] = {5.0f, 440.f};
} \ No newline at end of file
diff --git a/src/menus/practice_menu.cpp b/src/menus/practice_menu.cpp
index 8aa4478..4a1326b 100644
--- a/src/menus/practice_menu.cpp
+++ b/src/menus/practice_menu.cpp
@@ -1,52 +1,40 @@
#include "menus/practice_menu.h"
-#include "controller.h"
-#include "font.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
-#define LINES 3
+#define LINE_NUM 3
-static Cursor cursor = {0, 0};
-bool init_once = false;
+Cursor PracticeMenu::cursor;
char last_category[5];
int last_save_index;
int last_special_size;
special* last_special_ptr;
-Line lines[LINES] = {{"any%", ANY_INDEX, "Any% practice saves", false},
- {"100%", HUNDO_INDEX, "100% practice saves", false},
- {"all dungeons", AD_INDEX, "All Dungeons practice saves", false}};
+Line lines[LINE_NUM] = {
+ {"any%", ANY_INDEX, "Any% practice saves", false},
+ {"100%", HUNDO_INDEX, "100% practice saves", false},
+ {"all dungeons", AD_INDEX, "All Dungeons practice saves", false},
+};
-void PracticeMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
+void PracticeMenu::draw() {
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
return;
- };
-
- if (!init_once) {
- current_input = 0;
- init_once = true;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case ANY_INDEX: {
- MenuRendering::set_menu(MN_ANY_SAVES_INDEX);
+ case ANY_INDEX:
+ GZ_setMenu(GZ_ANY_SAVES_MENU);
return;
- }
- case HUNDO_INDEX: {
- MenuRendering::set_menu(MN_HUNDO_SAVES_INDEX);
+ case HUNDO_INDEX:
+ GZ_setMenu(GZ_HUNDO_SAVES_MENU);
return;
- }
- case AD_INDEX: {
- MenuRendering::set_menu(MN_AD_SAVES_INDEX);
+ case AD_INDEX:
+ GZ_setMenu(GZ_AD_SAVES_MENU);
return;
}
- }
}
- Utilities::move_cursor(cursor, LINES);
-
- Utilities::render_lines(lines, cursor.y, LINES);
-};
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
diff --git a/src/menus/scene_menu.cpp b/src/menus/scene_menu.cpp
index 3ee8d10..fabc44b 100644
--- a/src/menus/scene_menu.cpp
+++ b/src/menus/scene_menu.cpp
@@ -1,48 +1,103 @@
#include "menus/scene_menu.h"
-#include "controller.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
-#define LINES SCENE_AMNT
+#include "libtp_c/include/d/meter/d_meter_HIO.h"
+#include "gz_flags.h"
-static Cursor cursor = {0, 0};
-bool init_once = false;
-using namespace Scene;
+#define LINE_NUM 11
-SceneItem SceneItems[SCENE_AMNT] = {{FREEZE_ACTOR_INDEX, false}, {HIDE_ACTOR_INDEX, false},
- {DISABLE_BG_INDEX, false}, {DISABLE_SFX_INDEX, false},
- {FREEZE_CAMERA_INDEX, false}, {HIDE_HUD_INDEX, false},
- {FREEZE_TIME_INDEX, false}};
+Cursor SceneMenu::cursor;
-Line lines[LINES] = {
+SceneItem g_sceneFlags[SCENE_AMNT] = {
+ {FREEZE_ACTOR_INDEX, false}, {HIDE_ACTOR_INDEX, false}, {DISABLE_BG_INDEX, false},
+ {DISABLE_SFX_INDEX, false}, {FREEZE_CAMERA_INDEX, false}, {HIDE_HUD_INDEX, false},
+ {FREEZE_TIME_INDEX, false},
+};
+
+Line lines[LINE_NUM] = {
{"disable bg music", DISABLE_BG_INDEX, "Disables background and enemy music", true,
- &SceneItems[DISABLE_BG_INDEX].active},
- {"disable sfx", DISABLE_SFX_INDEX, "Disables sound effects (item, weather, etc.)", true,
- &SceneItems[DISABLE_SFX_INDEX].active},
+ &g_sceneFlags[DISABLE_BG_INDEX].active},
+ {"disable sfx", DISABLE_SFX_INDEX, "Disables sound effects", true,
+ &g_sceneFlags[DISABLE_SFX_INDEX].active},
{"freeze actors", FREEZE_ACTOR_INDEX, "Freezes actors", true,
- &SceneItems[FREEZE_ACTOR_INDEX].active},
+ &g_sceneFlags[FREEZE_ACTOR_INDEX].active},
{"freeze camera", FREEZE_CAMERA_INDEX, "Locks the camera in place", true,
- &SceneItems[FREEZE_CAMERA_INDEX].active},
- {"hide actors", HIDE_ACTOR_INDEX, "Hides actors", true, &SceneItems[HIDE_ACTOR_INDEX].active},
+ &g_sceneFlags[FREEZE_CAMERA_INDEX].active},
+ {"hide actors", HIDE_ACTOR_INDEX, "Hides actors", true, &g_sceneFlags[HIDE_ACTOR_INDEX].active},
{"hide hud", HIDE_HUD_INDEX, "Hides the heads-up display", true,
- &SceneItems[HIDE_HUD_INDEX].active},
+ &g_sceneFlags[HIDE_HUD_INDEX].active},
{"freeze time", FREEZE_TIME_INDEX, "Freezes ingame time", true,
- &SceneItems[FREEZE_TIME_INDEX].active},
+ &g_sceneFlags[FREEZE_TIME_INDEX].active},
{"time (hrs):", TIME_HOURS_INDEX, "The current in-game hour", false},
{"time (mins):", TIME_MINUTES_INDEX, "The current in-game minutes", false},
- {"actor spawner", ACTOR_MENU_INDEX, "Spawn Actors at current position", false}};
+ {"actor spawner", ACTOR_MENU_INDEX, "Spawn Actors at current position", false},
+ {"actor list", ACTOR_LIST_INDEX, "Display info from the actor list", false},
+};
-void SceneMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- init_once = false;
- return;
- };
+void GZ_freezeTime() {
+ if (g_sceneFlags[FREEZE_TIME_INDEX].active) {
+ dStage_roomControl_c__setTimePass(TIME_STOP);
+ }
+}
+
+bool l_initCamLock;
+void GZ_freezeCamera() {
+ l_initCamLock = true;
+ dComIfGp_getEventManager().mCameraPlay = 1;
+}
+
+void GZ_unfreezeCamera() {
+ if (l_initCamLock) {
+ dComIfGp_getEventManager().mCameraPlay = 0;
+ l_initCamLock = false;
+ }
+}
+
+bool l_initHide;
+void GZ_hideHUD() {
+ g_drawHIO.mHUDAlpha = 0.0f;
+ l_initHide = true;
+}
+
+void GZ_showHUD() {
+ if (l_initHide) {
+ g_drawHIO.mHUDAlpha = 1.0f;
+ l_initHide = false;
+ }
+}
+
+bool l_initActorFreeze;
+void GZ_freezeActors() {
+ l_initActorFreeze = true;
+ g_dComIfAc_gameInfo.freeze = true;
+}
+
+void GZ_unfreezeActors() {
+ if (l_initActorFreeze) {
+ g_dComIfAc_gameInfo.freeze = false;
+ l_initActorFreeze = false;
+ }
+}
- if (!init_once) {
- current_input = 0;
- init_once = true;
+bool l_initActorHide;
+void GZ_hideActors() {
+ l_initActorHide = true;
+ fopAc_ac_c__stopStatus |= 0x100;
+}
+
+void GZ_showActors() {
+ if (l_initActorHide) {
+ fopAc_ac_c__stopStatus &= ~0x100;
+ l_initActorHide = false;
+ }
+}
+
+void SceneMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
+
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
+ return;
}
float current_time = dComIfGs_getTime();
@@ -56,40 +111,42 @@ void SceneMenu::render() {
tp_sprintf(lines[TIME_HOURS_INDEX].value, " <%d>", current_hour);
tp_sprintf(lines[TIME_MINUTES_INDEX].value, " <%d>", current_minute);
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ g_sceneFlags[cursor.y].active = !g_sceneFlags[cursor.y].active;
- if (current_input == SELECTION_BUTTON && a_held == false) {
- SceneItems[cursor.y].active = !SceneItems[cursor.y].active;
switch (cursor.y) {
- case ACTOR_MENU_INDEX: {
- MenuRendering::set_menu(MN_ACTOR_SPAWNER_INDEX);
+ case ACTOR_MENU_INDEX:
+ GZ_setMenu(GZ_SPAWN_MENU);
+ return;
+ case ACTOR_LIST_INDEX:
+ GZ_setMenu(GZ_ACLIST_MENU);
return;
- }
}
}
+
switch (cursor.y) {
- case TIME_HOURS_INDEX: {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
+ case TIME_HOURS_INDEX:
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
dComIfGs_setTime(current_time + 15.0f);
- } else if (button_is_pressed(Controller::DPAD_LEFT)) {
+ } else if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
dComIfGs_setTime(current_time - 15.0f);
}
break;
- }
- case TIME_MINUTES_INDEX: {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
+ case TIME_MINUTES_INDEX:
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
dComIfGs_setTime(current_time + 0.25f);
- } else if (button_is_pressed(Controller::DPAD_LEFT)) {
+ } else if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
dComIfGs_setTime(current_time - 0.25f);
}
break;
}
- }
+
if (current_time >= 360.0f) {
dComIfGs_setTime(current_time - 360.0f);
- }
- if (current_time < 0) {
+ } else if (current_time < 0) {
dComIfGs_setTime(current_time + 360.0f);
}
+
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
}
diff --git a/src/menus/settings_menu.cpp b/src/menus/settings_menu.cpp
index 6a57854..5d2f7ae 100644
--- a/src/menus/settings_menu.cpp
+++ b/src/menus/settings_menu.cpp
@@ -1,75 +1,59 @@
#include "menus/settings_menu.h"
-#include "controller.h"
#include "libtp_c/include/msl_c/string.h"
#include "utils/card.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
-
+#include "gz_flags.h"
#include "fifo_queue.h"
-#define LINES 9
+#define LINE_NUM 9
#define MAX_RELOAD_OPTIONS 2
#define MAX_CURSOR_COLOR_OPTIONS 6
#define MAX_FONT_OPTIONS 7
-static Cursor cursor = {0, 0};
-bool g_drop_shadows = true;
-bool init_once = false;
-int g_area_reload_behavior;
-int g_cursor_color;
-bool g_cursor_color_flag;
+Cursor SettingsMenu::cursor;
+bool g_dropShadows;
bool g_swap_equips_flag;
-int g_font = 0;
-
-ListMember reload_options[MAX_RELOAD_OPTIONS] = {"load area", "load file"};
-
-ListMember cursor_color_options[MAX_CURSOR_COLOR_OPTIONS] = {"green", "blue", "red",
- "orange", "yellow", "purple"};
+int g_reloadType;
+int g_fontType = 0;
+int g_cursorColorType;
-ListMember font_options[MAX_FONT_OPTIONS] = {"consola", "calamity-bold", "lib-sans",
- "lib-sans-bold", "lib-serif", "lib-serif-bold",
- "press-start-2p"};
+ListMember font_opt[MAX_FONT_OPTIONS] = {"consola", "calamity-bold", "lib-sans",
+ "lib-sans-bold", "lib-serif", "lib-serif-bold",
+ "press-start-2p"};
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"area reload behavior:", AREA_RELOAD_BEHAVIOR_INDEX,
- "load area = Reload last area; load file = Reload last file", false, nullptr,
+ "Load area: reload last area | Load file = reload last file", false, nullptr,
MAX_RELOAD_OPTIONS},
{"cursor color:", CURSOR_COLOR_INDEX, "Change cursor color", false, nullptr,
MAX_CURSOR_COLOR_OPTIONS},
{"font:", FONT_INDEX, "Change font", false, nullptr, MAX_FONT_OPTIONS},
- {"drop shadows", DROP_SHADOWS_INDEX, "Adds shadows to all font letters", true, &g_drop_shadows},
+ {"drop shadows", DROP_SHADOWS_INDEX, "Adds shadows to all font letters", true, &g_dropShadows},
{"swap equips", SWAP_EQUIPS_INDEX, "Swap equips when loading practice files", true,
&g_swap_equips_flag},
{"save card", SAVE_CARD_INDEX, "Save settings to memory card"},
{"load card", LOAD_CARD_INDEX, "Load settings from memory card"},
{"delete card", DELETE_CARD_INDEX, "Delete settings from memory card"},
{"menu positions", POS_SETTINGS_MENU_INDEX,
- "Change menu object positions (A to toggle selection, DPad to move)", false}};
+ "Change menu object positions (A to toggle selection, DPad to move)", false},
+};
-void SettingsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- return;
- };
+void SettingsMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
+ return;
}
- // Utilities::move_cursor(cursor, LINES, 2);
-
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ // static Storage storage;
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case DROP_SHADOWS_INDEX: {
- g_drop_shadows = !g_drop_shadows;
+ case DROP_SHADOWS_INDEX:
+ g_dropShadows = !g_dropShadows;
break;
- };
- case POS_SETTINGS_MENU_INDEX: {
- MenuRendering::set_menu(MN_POS_SETTINGS_INDEX);
+ case POS_SETTINGS_MENU_INDEX:
+ GZ_setMenu(GZ_POS_SETTINGS_MENU);
return;
- };
case SAVE_CARD_INDEX: {
static Storage storage;
storage.file_name = "tpgz01";
@@ -78,12 +62,12 @@ void SettingsMenu::render() {
#ifndef WII_PLATFORM
storage.result = CARDProbeEx(0, nullptr, &storage.sector_size);
if (storage.result == Ready) {
- Utilities::store_mem_card(storage);
+ GZ_storeMemCard(storage);
}
#endif // WII_PLATFORM
- Utilities::store_mem_card(storage);
+ GZ_storeMemCard(storage);
break;
- };
+ }
case LOAD_CARD_INDEX: {
static Storage storage;
storage.file_name = "tpgz01";
@@ -92,12 +76,12 @@ void SettingsMenu::render() {
#ifndef WII_PLATFORM
storage.result = CARDProbeEx(0, NULL, &storage.sector_size);
if (storage.result == Ready) {
- Utilities::load_mem_card(storage);
+ GZ_loadMemCard(storage);
}
#endif // WII_PLATFORM
- Utilities::load_mem_card(storage);
+ GZ_loadMemCard(storage);
break;
- };
+ }
case DELETE_CARD_INDEX: {
static Storage storage;
storage.file_name = "tpgz01";
@@ -106,75 +90,74 @@ void SettingsMenu::render() {
#ifndef WII_PLATFORM
storage.result = CARDProbeEx(0, nullptr, &storage.sector_size);
if (storage.result == Ready) {
- Utilities::delete_mem_card(storage);
+ GZ_deleteMemCard(storage);
}
#endif // WII_PLATFORM
- Utilities::delete_mem_card(storage);
+ GZ_deleteMemCard(storage);
break;
- };
- case SWAP_EQUIPS_INDEX: {
+ }
+ case SWAP_EQUIPS_INDEX:
g_swap_equips_flag = !g_swap_equips_flag;
break;
- };
}
}
+ ListMember reload_opt[MAX_RELOAD_OPTIONS] = {"load area", "load file"};
+
+ ListMember cursorCol_opt[MAX_CURSOR_COLOR_OPTIONS] = {"green", "blue", "red",
+ "orange", "yellow", "purple"};
+
// handle list rendering
switch (cursor.y) {
- case AREA_RELOAD_BEHAVIOR_INDEX: {
- cursor.x = g_area_reload_behavior;
- Utilities::move_cursor(cursor, LINES, MAX_RELOAD_OPTIONS, false, false, false, true);
+ case AREA_RELOAD_BEHAVIOR_INDEX:
+ cursor.x = g_reloadType;
+ cursor.move(MAX_RELOAD_OPTIONS, LINE_NUM);
+
if (cursor.y == AREA_RELOAD_BEHAVIOR_INDEX) {
- g_area_reload_behavior = cursor.x;
+ g_reloadType = cursor.x;
}
break;
- }
+ case CURSOR_COLOR_INDEX:
+ cursor.x = g_cursorColorType;
+ cursor.move(MAX_CURSOR_COLOR_OPTIONS, LINE_NUM);
- case CURSOR_COLOR_INDEX: {
- cursor.x = g_cursor_color;
- Utilities::move_cursor(cursor, LINES, MAX_CURSOR_COLOR_OPTIONS, false, false, false, true);
if (cursor.y == CURSOR_COLOR_INDEX) {
- g_cursor_color = cursor.x;
+ g_cursorColorType = cursor.x;
}
break;
- }
-
case FONT_INDEX: {
- cursor.x = g_font;
- int old_font = g_font;
- Utilities::move_cursor(cursor, LINES, MAX_FONT_OPTIONS, false, false, false, true);
+ cursor.x = g_fontType;
+ int old_font = g_fontType;
+ cursor.move(MAX_FONT_OPTIONS, LINE_NUM);
+
if (cursor.y == FONT_INDEX) {
- g_font = cursor.x;
+ g_fontType = cursor.x;
}
- if (old_font != g_font) {
- if (g_font >= 0 && g_font < MAX_FONT_OPTIONS) {
- char buf[80];
- tp_sprintf(buf, "tpgz/fonts/%s.fnt", font_options[g_font].member);
- Font::load_font(buf);
+ if (old_font != g_fontType) {
+ if (g_fontType >= 0 && g_fontType < MAX_FONT_OPTIONS) {
+ char buf[40];
+ tp_sprintf(buf, "tpgz/fonts/%s.fnt", font_opt[g_fontType].member);
+ Font::loadFont(buf);
}
}
break;
}
-
- default: {
- Utilities::move_cursor(cursor, LINES, 2, false, false, false, true);
+ default:
+ cursor.move(0, LINE_NUM);
break;
}
- }
- tp_sprintf(lines[AREA_RELOAD_BEHAVIOR_INDEX].value, " <%s>",
- reload_options[g_area_reload_behavior].member);
- tp_sprintf(lines[CURSOR_COLOR_INDEX].value, " <%s>",
- cursor_color_options[g_cursor_color].member);
- tp_sprintf(lines[FONT_INDEX].value, " <%s>", font_options[g_font].member);
+ tp_sprintf(lines[AREA_RELOAD_BEHAVIOR_INDEX].value, " <%s>", reload_opt[g_reloadType].member);
+ tp_sprintf(lines[CURSOR_COLOR_INDEX].value, " <%s>", cursorCol_opt[g_cursorColorType].member);
+ tp_sprintf(lines[FONT_INDEX].value, " <%s>", font_opt[g_fontType].member);
- Utilities::render_lines(lines, cursor.y, LINES);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
}
void SettingsMenu::initFont() {
- if (g_font >= 0 && g_font < MAX_FONT_OPTIONS) {
- char buf[80];
- tp_sprintf(buf, "tpgz/fonts/%s.fnt", font_options[g_font].member);
- Font::load_font(buf);
+ if (g_fontType >= 0 && g_fontType < MAX_FONT_OPTIONS) {
+ char buf[40];
+ tp_sprintf(buf, "tpgz/fonts/%s.fnt", font_opt[g_fontType].member);
+ Font::loadFont(buf);
}
} \ No newline at end of file
diff --git a/src/menus/tools_menu.cpp b/src/menus/tools_menu.cpp
index afa5000..3a858e6 100644
--- a/src/menus/tools_menu.cpp
+++ b/src/menus/tools_menu.cpp
@@ -1,6 +1,5 @@
#include "menus/tools_menu.h"
#include "commands.h"
-#include "controller.h"
#include "free_cam.h"
#include "gorge.h"
#ifdef WII_PLATFORM
@@ -11,240 +10,304 @@
#include "movelink.h"
#include "rollcheck.h"
#include "timer.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "umd.h"
-#define LINES TOOL_AMNT
+#include "gz_flags.h"
+
+#define LINE_NUM TOOL_AMNT
#define MAX_TUNIC_COLORS 7
-using namespace Tools;
-static Cursor cursor = {0, 0};
+Cursor ToolsMenu::cursor;
int g_tunic_color;
-uint8_t tunic_color_index = 0;
-bool init_once = false;
-bool g_tunic_color_flag;
-Tool ToolItems[TOOL_AMNT] = {
- {RELOAD_AREA_INDEX, false}, {FAST_BONK_INDEX, false}, {FAST_MOVEMENT_INDEX, false},
- {GORGE_INDEX, false},
+uint8_t l_tunicCol_idx = 0;
+
+Tool g_tools[TOOL_AMNT] = {
+ {RELOAD_AREA_INDEX, false}, {FRAME_ADVANCE_INDEX, false}, {FAST_BONK_INDEX, false},
+ {FAST_MOVEMENT_INDEX, false}, {GORGE_INDEX, false},
#ifdef WII_PLATFORM
{BIT_INDEX, false},
#endif
- {COROTD_INDEX, false}, {UMD_INDEX, false}, {INPUT_VIEWER_INDEX, false},
- {LINK_DEBUG_INDEX, false}, {SAND_INDEX, false}, {ROLL_INDEX, false},
- {TELEPORT_INDEX, false}, {TURBO_MODE_INDEX, false}, {TIMER_INDEX, false},
- {LOAD_TIMER_INDEX, false}, {IGT_TIMER_INDEX, false}, {FREE_CAM_INDEX, false},
- {MOVE_LINK_INDEX, false}};
+ {COROTD_INDEX, false}, {UMD_INDEX, false}, {INPUT_VIEWER_INDEX, false},
+ {LINK_DEBUG_INDEX, false}, {HEAP_DEBUG_INDEX, false}, {SAND_INDEX, false},
+ {ROLL_INDEX, false}, {TELEPORT_INDEX, false}, {TURBO_MODE_INDEX, false},
+ {TIMER_INDEX, false}, {LOAD_TIMER_INDEX, false}, {IGT_TIMER_INDEX, false},
+ {FREE_CAM_INDEX, false}, {MOVE_LINK_INDEX, false},
+};
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"area reload", RELOAD_AREA_INDEX, "Use " RELOAD_AREA_TEXT " to reload current area", true,
- &ToolItems[RELOAD_AREA_INDEX].active},
+ &g_tools[RELOAD_AREA_INDEX].active},
+ {"frame advance", FRAME_ADVANCE_INDEX, "Use " FRAME_ADVANCE_TEXT " to frame advance", true,
+ &g_tools[FRAME_ADVANCE_INDEX].active},
{"fast bonk recovery", FAST_BONK_INDEX, "Reduces bonk animation significantly", true,
- &ToolItems[FAST_BONK_INDEX].active},
+ &g_tools[FAST_BONK_INDEX].active},
{"fast movement", FAST_MOVEMENT_INDEX, "Link's movement is much faster", true,
- &ToolItems[FAST_MOVEMENT_INDEX].active},
+ &g_tools[FAST_MOVEMENT_INDEX].active},
{"gorge checker", GORGE_INDEX, "Use " GORGE_VOID_TEXT " to warp to Kakariko Gorge", true,
- &ToolItems[GORGE_INDEX].active},
+ &g_tools[GORGE_INDEX].active},
#ifdef WII_PLATFORM
{"bit checker", BIT_INDEX, "Use " BACK_IN_TIME_TEXT " to warp to Ordon Bridge", true,
- &ToolItems[BIT_INDEX].active},
+ &g_tools[BIT_INDEX].active},
#endif
{"coro td checker", COROTD_INDEX, "Show frame info when doing coro td", true,
- &ToolItems[COROTD_INDEX].active},
- {"umd checker", UMD_INDEX, "Practice Snowpeak UMD timing", true, &ToolItems[UMD_INDEX].active},
+ &g_tools[COROTD_INDEX].active},
+ {"umd checker", UMD_INDEX, "Practice Snowpeak UMD timing", true, &g_tools[UMD_INDEX].active},
{"input viewer", INPUT_VIEWER_INDEX, "Show current inputs", true,
- &ToolItems[INPUT_VIEWER_INDEX].active},
+ &g_tools[INPUT_VIEWER_INDEX].active},
{"link debug info", LINK_DEBUG_INDEX, "Show Link's position, angle, and speed", true,
- &ToolItems[LINK_DEBUG_INDEX].active},
+ &g_tools[LINK_DEBUG_INDEX].active},
+ {"heap debug info", HEAP_DEBUG_INDEX, "Show Heap size info", true,
+ &g_tools[HEAP_DEBUG_INDEX].active},
{"no sinking in sand", SAND_INDEX, "Link won't sink in sand", true,
- &ToolItems[SAND_INDEX].active},
+ &g_tools[SAND_INDEX].active},
{"roll checker", ROLL_INDEX, "Frame counter for chaining rolls", true,
- &ToolItems[ROLL_INDEX].active},
+ &g_tools[ROLL_INDEX].active},
{"teleport", TELEPORT_INDEX, STORE_POSITION_TEXT " to set, " LOAD_POSITION_TEXT " to load",
- true, &ToolItems[TELEPORT_INDEX].active},
+ true, &g_tools[TELEPORT_INDEX].active},
{"turbo mode", TURBO_MODE_INDEX, "Simulates turbo controller inputs", true,
- &ToolItems[TURBO_MODE_INDEX].active},
+ &g_tools[TURBO_MODE_INDEX].active},
{"timer", TIMER_INDEX,
"Frame timer: " TIMER_TOGGLE_TEXT " to start/stop, " TIMER_RESET_TEXT " to reset", true,
- &ToolItems[TIMER_INDEX].active},
+ &g_tools[TIMER_INDEX].active},
{"load timer", LOAD_TIMER_INDEX, "Loading zone timer: " TIMER_RESET_TEXT " to reset", true,
- &ToolItems[LOAD_TIMER_INDEX].active},
+ &g_tools[LOAD_TIMER_INDEX].active},
{"igt timer", IGT_TIMER_INDEX,
"In-game time timer: " TIMER_TOGGLE_TEXT " to start/stop, " TIMER_RESET_TEXT " to reset", true,
- &ToolItems[IGT_TIMER_INDEX].active},
+ &g_tools[IGT_TIMER_INDEX].active},
{"free cam", FREE_CAM_INDEX,
FREE_CAM_TEXT " to activate, " FREE_CAM_MOVEMENT_TEXT " to move, " FREE_CAM_VIEW_TEXT
" to view, Z to speed",
- true, &ToolItems[FREE_CAM_INDEX].active},
+ true, &g_tools[FREE_CAM_INDEX].active},
{"move link", MOVE_LINK_INDEX,
MOVE_LINK_TEXT " to activate. " MOVE_LINK_MOVEMENT_TEXT " to move, " MOVE_LINK_ANGLE_TEXT
" to change angle",
- true, &ToolItems[MOVE_LINK_INDEX].active},
+ true, &g_tools[MOVE_LINK_INDEX].active},
{"link tunic color:", TUNIC_COLOR_INDEX, "Changes Link's tunic color", false, nullptr,
MAX_TUNIC_COLORS}};
-void ToolsMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- init_once = false;
- return;
- };
+void ToolsMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
+ return;
}
- ListMember tunic_color_options[MAX_TUNIC_COLORS] = {"green", "blue", "red", "orange",
- "yellow", "white", "cycle"};
+ ListMember tunicCol_opt[MAX_TUNIC_COLORS] = {"green", "blue", "red", "orange",
+ "yellow", "white", "cycle"};
if (cursor.y == TUNIC_COLOR_INDEX) {
- cursor.x = tunic_color_index;
- Utilities::move_cursor(cursor, LINES, MAX_TUNIC_COLORS, false, false, false, true);
+ cursor.x = l_tunicCol_idx;
+ cursor.move(MAX_TUNIC_COLORS, LINE_NUM);
+
if (cursor.y == TUNIC_COLOR_INDEX) {
- tunic_color_index = cursor.x;
+ l_tunicCol_idx = cursor.x;
}
- g_tunic_color = tunic_color_index;
+ g_tunic_color = l_tunicCol_idx;
} else {
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
+ cursor.move(0, LINE_NUM);
}
- tp_sprintf(lines[TUNIC_COLOR_INDEX].value, " <%s>",
- tunic_color_options[tunic_color_index].member);
- Utilities::render_lines(lines, cursor.y, LINES);
- if (current_input == SELECTION_BUTTON && a_held == false) {
- ToolItems[cursor.y].active = !ToolItems[cursor.y].active;
- if (ToolItems[cursor.y].active) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ g_tools[cursor.y].active = !g_tools[cursor.y].active;
+ if (g_tools[cursor.y].active) {
switch (cursor.y) {
- case TIMER_INDEX: {
- Commands::enable_command(Commands::CMD_TIMER_TOGGLE);
- Commands::enable_command(Commands::CMD_TIMER_RESET);
+ case FRAME_ADVANCE_INDEX:
+ GZCmd_enable(Commands::CMD_FRAME_PAUSE);
break;
- }
- case LOAD_TIMER_INDEX: {
- Commands::enable_command(Commands::CMD_TIMER_RESET);
+ case TIMER_INDEX:
+ g_tools[LOAD_TIMER_INDEX].active = false;
+ g_tools[IGT_TIMER_INDEX].active = false;
+ GZCmd_enable(Commands::CMD_TIMER_TOGGLE);
+ GZCmd_enable(Commands::CMD_TIMER_RESET);
break;
- }
- case IGT_TIMER_INDEX: {
- Commands::enable_command(Commands::CMD_TIMER_TOGGLE);
- Commands::enable_command(Commands::CMD_TIMER_RESET);
+ case LOAD_TIMER_INDEX:
+ g_tools[TIMER_INDEX].active = false;
+ g_tools[IGT_TIMER_INDEX].active = false;
+ GZCmd_enable(Commands::CMD_TIMER_RESET);
break;
- }
- case GORGE_INDEX: {
- Commands::enable_command(Commands::CMD_GORGE_VOID);
+ case IGT_TIMER_INDEX:
+ g_tools[TIMER_INDEX].active = false;
+ g_tools[LOAD_TIMER_INDEX].active = false;
+ GZCmd_enable(Commands::CMD_TIMER_TOGGLE);
+ GZCmd_enable(Commands::CMD_TIMER_RESET);
+ break;
+ case GORGE_INDEX:
+ GZCmd_enable(Commands::CMD_GORGE_VOID);
break;
- }
#ifdef WII_PLATFORM
- case BIT_INDEX: {
- Commands::enable_command(Commands::CMD_BIT);
+ case BIT_INDEX:
+ GZCmd_enable(Commands::CMD_BIT);
break;
- }
#endif
- case TELEPORT_INDEX: {
- Commands::enable_command(Commands::CMD_STORE_POSITION);
- Commands::enable_command(Commands::CMD_LOAD_POSITION);
+ case TELEPORT_INDEX:
+ GZCmd_enable(Commands::CMD_STORE_POSITION);
+ GZCmd_enable(Commands::CMD_LOAD_POSITION);
break;
- }
- case RELOAD_AREA_INDEX: {
- Commands::enable_command(Commands::CMD_RELOAD_AREA);
+ case RELOAD_AREA_INDEX:
+ GZCmd_enable(Commands::CMD_RELOAD_AREA);
break;
- }
- case FAST_MOVEMENT_INDEX: {
- tp_link_human_frontroll.roll_factor = 3.0f;
- tp_link_human_swim.swim_up_speed = 50;
- tp_link_human_swim.back_swim_speed = 50;
- tp_link_human_swim.side_swim_speed = 50;
- tp_link_human_swim.dash_swim_max_speed = 50;
- tp_link_human_swim.forward_swim_speed = 50;
- tp_link_human_swim.ib_swim_speed = 50;
- tp_link_human_swim.sinking_speed = -50;
- tp_link_human_swim.initial_sinking_speed = -50;
- tp_link_wolf_general.dash_initial_speed_large_area = 100;
- tp_link_wolf_general.dash_speed_large_area = 100;
- tp_link_wolf_general.dash_initial_speed_small_area = 70;
- tp_link_wolf_general.dash_speed_small_area = 70;
- tp_link_wolf_swim.dash_swim_speed = 50;
- tp_link_wolf_swim.swim_speed = 50;
+ case FAST_MOVEMENT_INDEX:
+ daAlinkHIO_frontRoll.mSpeedRate = 3.0f;
+ daAlinkHIO_swim.mMaxUnderwaterSpeed = 50;
+ daAlinkHIO_swim.mMaxBackwardSpeed = 50;
+ daAlinkHIO_swim.mMaxStrafeSpeed = 50;
+ daAlinkHIO_swim.mDashMaxSpeed = 50;
+ daAlinkHIO_swim.mMaxForwardSpeed = 50;
+ daAlinkHIO_swim.mUnderwaterMaxSinkSpeed = 50;
+ daAlinkHIO_swim.mBootsMaxSinkSpeed = -50;
+ daAlinkHIO_swim.mBootsGravity = -50;
+ daAlinkHIO_wlMove.mDashInitSpeed = 100;
+ daAlinkHIO_wlMove.mDashMaxSpeed = 100;
+ daAlinkHIO_wlMove.mDashInitSpeedSlow = 70;
+ daAlinkHIO_wlMove.mDashMaxSpeedSlow = 70;
+ daAlinkHIO_wlSwim.mMaxSpeed = 50;
+ daAlinkHIO_wlSwim.mMaxSpeedWeak = 50;
break;
- }
- case FAST_BONK_INDEX: {
- tp_link_human_frontroll.bonk_recoil_anim_speed = 50.0f;
- tp_link_human_frontroll.bonk_recovery_anim_factor = 0.0f;
+ case FAST_BONK_INDEX:
+ daAlinkHIO_frontRoll.mCrashAnm.field_0x04 = 50.0f;
+ daAlinkHIO_frontRoll.mCrashAnm.field_0x08 = 0.0f;
break;
- }
- case SAND_INDEX: {
- if (g_dComIfG_gameInfo.play.mPlayer != nullptr) {
+ case SAND_INDEX:
+ if (dComIfGp_getPlayer() != nullptr) {
dComIfGp_getPlayer()->field_0x2ba8 = 0;
}
break;
- }
- case FREE_CAM_INDEX: {
- Commands::enable_command(Commands::CMD_FREE_CAM);
- free_cam_active = false;
+ case FREE_CAM_INDEX:
+ GZCmd_enable(Commands::CMD_FREE_CAM);
+ g_freeCamEnabled = false;
break;
- }
- case MOVE_LINK_INDEX: {
- Commands::enable_command(Commands::CMD_MOVE_LINK);
- move_link_active = false;
+ case MOVE_LINK_INDEX:
+ GZCmd_enable(Commands::CMD_MOVE_LINK);
+ g_moveLinkEnabled = false;
break;
}
- }
} else {
switch (cursor.y) {
- case TELEPORT_INDEX: {
- Commands::disable_command(Commands::CMD_STORE_POSITION);
- Commands::disable_command(Commands::CMD_LOAD_POSITION);
+ case FRAME_ADVANCE_INDEX:
+ GZCmd_disable(Commands::CMD_FRAME_PAUSE);
break;
- }
- case RELOAD_AREA_INDEX: {
- Commands::disable_command(Commands::CMD_RELOAD_AREA);
+ case TELEPORT_INDEX:
+ GZCmd_disable(Commands::CMD_STORE_POSITION);
+ GZCmd_disable(Commands::CMD_LOAD_POSITION);
break;
- }
- case FAST_MOVEMENT_INDEX: {
- tp_link_human_frontroll.roll_factor = 1.3;
- tp_link_human_swim.swim_up_speed = 12;
- tp_link_human_swim.forward_swim_speed = 8;
- tp_link_human_swim.back_swim_speed = 6;
- tp_link_human_swim.side_swim_speed = 8;
- tp_link_human_swim.dash_swim_max_speed = 13;
- tp_link_human_swim.ib_swim_speed = 8;
- tp_link_human_swim.sinking_speed = -20;
- tp_link_human_swim.initial_sinking_speed = -0.699999988;
- tp_link_wolf_general.dash_initial_speed_large_area = 65;
- tp_link_wolf_general.dash_speed_large_area = 45;
- tp_link_wolf_general.dash_initial_speed_small_area = 35;
- tp_link_wolf_general.dash_speed_small_area = 33;
- tp_link_wolf_swim.dash_swim_speed = 20;
- tp_link_wolf_swim.swim_speed = 9;
+ case RELOAD_AREA_INDEX:
+ GZCmd_disable(Commands::CMD_RELOAD_AREA);
break;
- }
- case FAST_BONK_INDEX: {
- tp_link_human_frontroll.bonk_recoil_anim_speed = 3.0f;
- tp_link_human_frontroll.bonk_recovery_anim_factor = 0.800000012f;
+ case FAST_MOVEMENT_INDEX:
+ daAlinkHIO_frontRoll.mSpeedRate = 1.3;
+ daAlinkHIO_swim.mMaxUnderwaterSpeed = 12;
+ daAlinkHIO_swim.mMaxForwardSpeed = 8;
+ daAlinkHIO_swim.mMaxBackwardSpeed = 6;
+ daAlinkHIO_swim.mMaxStrafeSpeed = 8;
+ daAlinkHIO_swim.mDashMaxSpeed = 13;
+ daAlinkHIO_swim.mUnderwaterMaxSinkSpeed = 8;
+ daAlinkHIO_swim.mBootsMaxSinkSpeed = -20;
+ daAlinkHIO_swim.mBootsGravity = -0.699999988;
+ daAlinkHIO_wlMove.mDashInitSpeed = 65;
+ daAlinkHIO_wlMove.mDashMaxSpeed = 45;
+ daAlinkHIO_wlMove.mDashInitSpeedSlow = 35;
+ daAlinkHIO_wlMove.mDashMaxSpeedSlow = 33;
+ daAlinkHIO_wlSwim.mMaxSpeed = 20;
+ daAlinkHIO_wlSwim.mMaxSpeedWeak = 9;
break;
- }
- case FREE_CAM_INDEX: {
- Commands::disable_command(Commands::CMD_FREE_CAM);
- free_cam_active = false;
+ case FAST_BONK_INDEX:
+ daAlinkHIO_frontRoll.mCrashAnm.field_0x04 = 3.0f;
+ daAlinkHIO_frontRoll.mCrashAnm.field_0x08 = 0.800000012f;
break;
- }
- case MOVE_LINK_INDEX: {
- Commands::disable_command(Commands::CMD_MOVE_LINK);
- move_link_active = false;
+ case FREE_CAM_INDEX:
+ GZCmd_disable(Commands::CMD_FREE_CAM);
+ g_freeCamEnabled = false;
break;
- }
- case GORGE_INDEX: {
- Commands::disable_command(Commands::CMD_GORGE_VOID);
+ case MOVE_LINK_INDEX:
+ GZCmd_disable(Commands::CMD_MOVE_LINK);
+ g_moveLinkEnabled = false;
+ break;
+ case GORGE_INDEX:
+ GZCmd_disable(Commands::CMD_GORGE_VOID);
break;
- }
#ifdef WII_PLATFORM
- case BIT_INDEX: {
- Commands::disable_command(Commands::CMD_BIT);
+ case BIT_INDEX:
+ GZCmd_disable(Commands::CMD_BIT);
break;
- }
#endif
}
}
}
-} // namespace Tools \ No newline at end of file
+
+ tp_sprintf(lines[TUNIC_COLOR_INDEX].value, " <%s>", tunicCol_opt[l_tunicCol_idx].member);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
+}
+
+void ToolsMenu::setTunicColor() {
+ static int16_t cycle_r = 0;
+ static int16_t cycle_g = 0;
+ static int16_t cycle_b = 0;
+
+ if (dComIfGp_getPlayer()) {
+ int16_t r = 0;
+ int16_t g = 0;
+ int16_t b = 0;
+
+ switch (g_tunic_color) {
+ case GREEN:
+ default:
+ r = 0x10;
+ g = 0x10;
+ b = 0x10;
+ break;
+ case BLUE:
+ r = 0x00;
+ g = 0x08;
+ b = 0x20;
+ break;
+ case RED:
+ r = 0x18;
+ g = 0x00;
+ b = 0x00;
+ break;
+ case ORANGE:
+ r = 0x20;
+ g = 0x10;
+ b = 0x00;
+ break;
+ case YELLOW:
+ r = 0x20;
+ g = 0x20;
+ b = 0x00;
+ break;
+ case WHITE:
+ r = 0x20;
+ g = 0x1C;
+ b = 0x20;
+ break;
+ case CYCLE:
+ if (cycle_r < 0x0010 && (cycle_g == 0x0000 && cycle_b == 0x0000)) {
+ cycle_r += 0x0001;
+ } else if (cycle_g < 0x0010 && (cycle_b == 0x0000 && cycle_r == 0x0010)) {
+ cycle_g += 0x0001;
+ } else if (cycle_b < 0x0010 && (cycle_g == 0x0010 && cycle_r == 0x0010)) {
+ cycle_b += 0x0001;
+ } else if (cycle_r > 0x0000 && (cycle_g == 0x0010 && cycle_b == 0x0010)) {
+ cycle_r -= 0x0001;
+ } else if (cycle_g > 0x0000 && (cycle_b == 0x0010 && cycle_r == 0x0000)) {
+ cycle_g -= 0x0001;
+ } else {
+ cycle_b -= 0x0001;
+ }
+
+ r = cycle_r;
+ g = cycle_g;
+ b = cycle_b;
+ break;
+ }
+
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.r = r - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.g = g - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.b = b - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.r = r - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.g = g - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.b = b - 0x10;
+ }
+} \ No newline at end of file
diff --git a/src/menus/warping_menu.cpp b/src/menus/warping_menu.cpp
index 55aaef2..8927f14 100644
--- a/src/menus/warping_menu.cpp
+++ b/src/menus/warping_menu.cpp
@@ -1,16 +1,13 @@
#include "menus/warping_menu.h"
#include "commands.h"
#include "fifo_queue.h"
-#include "controller.h"
-#include "font.h"
#include "fs.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/utils.h"
+#include "gz_flags.h"
-#define LINES 7
+#define LINE_NUM 7
#define SPAWN_OFFSET 4
#define SPAWN_READ_LENGTH 32
#define ROOM_READ_LENGTH 64
@@ -19,23 +16,23 @@
#define ROOM_OFFSET 64
#define DEFAULT_LAYER 0xFF
-static Cursor cursor = {0, 0};
-uint8_t layer = 0xFF;
-bool init_once = false;
-bool data_loaded = false;
-bool file;
-int stage_type_counter = 0;
-signed long stage_counter = 0;
-signed long room_counter = 0;
-signed long spawn_counter = 0;
-char file_path[89];
-WarpInfo warp_info;
+Cursor WarpingMenu::cursor;
+
+uint8_t l_warpLayer = 0xFF;
+bool l_dataLoaded = false;
+int l_typeIdx = 0;
+signed long l_stageIdx = 0;
+signed long l_roomIdx = 0;
+signed long l_spawnIdx = 0;
+
+char l_filePath[89];
+WarpInfo l_warpInfo;
enum { DUNGEON, OVERWORLD, INTERIOR, CAVE, SPECIAL };
char stage_types[5][10] = {"dungeon", "overworld", "interior", "cave", "special"};
-Line lines[LINES] = {
+Line lines[LINE_NUM] = {
{"type:", WARP_TYPE_INDEX, "The type of stage", false},
{"stage:", WARP_STAGE_INDEX, "Current stage name", false},
{"room:", WARP_ROOM_INDEX, "Current room name", false},
@@ -44,250 +41,228 @@ Line lines[LINES] = {
{"warp", WARP_BUTTON_INDEX, "Trigger warp", false},
{"save", SAVE_LOCATION_INDEX, "Set savefile location to selected location", false}};
-void load_previous_info(void* buffer, signed long& counter, signed long length, char max_num,
- int offset) {
+void GZWarp_loadPrevInfo(void* buffer, signed long& counter, signed long length, char max_num,
+ int offset) {
if (counter < 0) {
counter = (max_num * offset) - offset;
}
- loadFile(file_path, buffer, length, counter);
+ loadFile(l_filePath, buffer, length, counter);
}
-void load_next_info(void* buffer, signed long& counter, signed long length, char max_num,
- int offset) {
+void GZWarp_loadNextInfo(void* buffer, signed long& counter, signed long length, char max_num,
+ int offset) {
if (counter == (offset * max_num)) {
counter = 0;
}
- loadFile(file_path, buffer, length, counter);
+ loadFile(l_filePath, buffer, length, counter);
}
-void set_stage_path(int current_stage_type) {
+void GZWarp_setStagePath(int current_stage_type) {
switch (current_stage_type) {
- case DUNGEON: {
- tp_strcpy(file_path, "tpgz/stage_info/dungeon.bin");
+ case DUNGEON:
+ tp_strcpy(l_filePath, "tpgz/stage_info/dungeon.bin");
break;
- }
- case OVERWORLD: {
- tp_strcpy(file_path, "tpgz/stage_info/overworld.bin");
+ case OVERWORLD:
+ tp_strcpy(l_filePath, "tpgz/stage_info/overworld.bin");
break;
- }
- case INTERIOR: {
- tp_strcpy(file_path, "tpgz/stage_info/interior.bin");
+ case INTERIOR:
+ tp_strcpy(l_filePath, "tpgz/stage_info/interior.bin");
break;
- }
- case CAVE: {
- tp_strcpy(file_path, "tpgz/stage_info/cave.bin");
+ case CAVE:
+ tp_strcpy(l_filePath, "tpgz/stage_info/cave.bin");
break;
- }
- case SPECIAL: {
- tp_strcpy(file_path, "tpgz/stage_info/special.bin");
+ case SPECIAL:
+ tp_strcpy(l_filePath, "tpgz/stage_info/special.bin");
break;
}
- }
}
-void load_previous_stage_info() {
- set_stage_path(stage_type_counter);
- stage_counter -= STAGE_OFFSET;
- load_previous_info(&warp_info.stage_info, stage_counter, STAGE_READ_LENGTH,
- warp_info.stage_info.num_stages, STAGE_OFFSET);
+void GZWarp_loadPrevStageInfo() {
+ GZWarp_setStagePath(l_typeIdx);
+ l_stageIdx -= STAGE_OFFSET;
+ GZWarp_loadPrevInfo(&l_warpInfo.stage_info, l_stageIdx, STAGE_READ_LENGTH,
+ l_warpInfo.stage_info.num_stages, STAGE_OFFSET);
}
-void load_previous_room_info() {
- tp_sprintf(file_path, "tpgz/stage_info/%s/rooms.bin", warp_info.stage_info.stage_id);
- room_counter -= ROOM_OFFSET;
- load_previous_info(&warp_info.room_info, room_counter, ROOM_READ_LENGTH,
- warp_info.room_info.num_rooms, ROOM_OFFSET);
+void GZWarp_loadPrevRoomInfo() {
+ tp_sprintf(l_filePath, "tpgz/stage_info/%s/rooms.bin", l_warpInfo.stage_info.stage_id);
+ l_roomIdx -= ROOM_OFFSET;
+ GZWarp_loadPrevInfo(&l_warpInfo.room_info, l_roomIdx, ROOM_READ_LENGTH,
+ l_warpInfo.room_info.num_rooms, ROOM_OFFSET);
}
-void load_next_stage_info() {
- set_stage_path(stage_type_counter);
- stage_counter += STAGE_OFFSET;
- load_next_info(&warp_info.stage_info, stage_counter, STAGE_READ_LENGTH,
- warp_info.stage_info.num_stages, STAGE_OFFSET);
+void GZWarp_loadNextStageInfo() {
+ GZWarp_setStagePath(l_typeIdx);
+ l_stageIdx += STAGE_OFFSET;
+ GZWarp_loadNextInfo(&l_warpInfo.stage_info, l_stageIdx, STAGE_READ_LENGTH,
+ l_warpInfo.stage_info.num_stages, STAGE_OFFSET);
}
-void load_next_room_info() {
- tp_sprintf(file_path, "tpgz/stage_info/%s/rooms.bin", warp_info.stage_info.stage_id);
- room_counter += ROOM_OFFSET;
- load_next_info(&warp_info.room_info, room_counter, ROOM_READ_LENGTH,
- warp_info.room_info.num_rooms, ROOM_OFFSET);
+void GZWarp_loadNextRoomInfo() {
+ tp_sprintf(l_filePath, "tpgz/stage_info/%s/rooms.bin", l_warpInfo.stage_info.stage_id);
+ l_roomIdx += ROOM_OFFSET;
+ GZWarp_loadNextInfo(&l_warpInfo.room_info, l_roomIdx, ROOM_READ_LENGTH,
+ l_warpInfo.room_info.num_rooms, ROOM_OFFSET);
}
-void load_next_spawn_info() {
- tp_sprintf(file_path, "tpgz/stage_info/%s/%02d/spawns.bin", warp_info.stage_info.stage_id,
- (int)warp_info.room_info.room_id[0]);
- spawn_counter += SPAWN_OFFSET;
- load_next_info(&warp_info.spawn_info, spawn_counter, SPAWN_READ_LENGTH,
- warp_info.spawn_info.num_spawns, SPAWN_OFFSET);
+void GZWarp_loadNextSpawnInfo() {
+ tp_sprintf(l_filePath, "tpgz/stage_info/%s/%02d/spawns.bin", l_warpInfo.stage_info.stage_id,
+ (int)l_warpInfo.room_info.room_id[0]);
+ l_spawnIdx += SPAWN_OFFSET;
+ GZWarp_loadNextInfo(&l_warpInfo.spawn_info, l_spawnIdx, SPAWN_READ_LENGTH,
+ l_warpInfo.spawn_info.num_spawns, SPAWN_OFFSET);
}
-void load_previous_spawn_info() {
- tp_sprintf(file_path, "tpgz/stage_info/%s/%02d/spawns.bin", warp_info.stage_info.stage_id,
- (int)warp_info.room_info.room_id[0]);
- spawn_counter -= SPAWN_OFFSET;
- load_previous_info(&warp_info.spawn_info, spawn_counter, SPAWN_READ_LENGTH,
- warp_info.spawn_info.num_spawns, SPAWN_OFFSET);
+void GZWarp_loadPrevSpawnInfo() {
+ tp_sprintf(l_filePath, "tpgz/stage_info/%s/%02d/spawns.bin", l_warpInfo.stage_info.stage_id,
+ (int)l_warpInfo.room_info.room_id[0]);
+ l_spawnIdx -= SPAWN_OFFSET;
+ GZWarp_loadPrevInfo(&l_warpInfo.spawn_info, l_spawnIdx, SPAWN_READ_LENGTH,
+ l_warpInfo.spawn_info.num_spawns, SPAWN_OFFSET);
}
-void load_default_stage() {
- stage_counter = -64;
- set_stage_path(stage_type_counter);
- load_next_stage_info();
+void GZWarp_loadDefaultStage() {
+ l_stageIdx = -64;
+ GZWarp_setStagePath(l_typeIdx);
+ GZWarp_loadNextStageInfo();
}
-void load_default_room() {
- room_counter = -64;
- load_next_room_info();
+void GZWarp_loadDefaultRoom() {
+ l_roomIdx = -64;
+ GZWarp_loadNextRoomInfo();
}
-void load_default_spawn() {
- spawn_counter = -4;
- load_next_spawn_info();
+void GZWarp_loadDefaultSpawn() {
+ l_spawnIdx = -4;
+ GZWarp_loadNextSpawnInfo();
}
-void WarpingMenu::render() {
- if (button_is_pressed(BACK_BUTTON)) {
- init_once = false;
- MenuRendering::set_menu(MN_MAIN_MENU_INDEX);
- return;
- };
+void WarpingMenu::draw() {
+ cursor.setMode(Cursor::MODE_LIST);
- if (!init_once) {
- current_input = 0;
- init_once = true;
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ GZ_setMenu(GZ_MAIN_MENU);
+ return;
}
- if (!data_loaded) {
- load_default_stage();
- load_default_room();
- load_default_spawn();
- data_loaded = true;
+ if (!l_dataLoaded) {
+ GZWarp_loadDefaultStage();
+ GZWarp_loadDefaultRoom();
+ GZWarp_loadDefaultSpawn();
+ l_dataLoaded = true;
}
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
switch (cursor.y) {
- case WARP_TYPE_INDEX: {
- stage_type_counter++;
- if (stage_type_counter > 4) {
- stage_type_counter = 0;
+ case WARP_TYPE_INDEX:
+ l_typeIdx++;
+ if (l_typeIdx > 4) {
+ l_typeIdx = 0;
}
- load_default_stage();
- load_default_room();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ GZWarp_loadDefaultStage();
+ GZWarp_loadDefaultRoom();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_STAGE_INDEX: {
- load_next_stage_info();
- load_default_room();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ case WARP_STAGE_INDEX:
+ GZWarp_loadNextStageInfo();
+ GZWarp_loadDefaultRoom();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_ROOM_INDEX: {
- load_next_room_info();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ case WARP_ROOM_INDEX:
+ GZWarp_loadNextRoomInfo();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_SPAWN_INDEX: {
- load_next_spawn_info();
- layer = DEFAULT_LAYER;
+ case WARP_SPAWN_INDEX:
+ GZWarp_loadNextSpawnInfo();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_LAYER_INDEX: {
- layer++;
- if (layer == 0x10) {
- layer = DEFAULT_LAYER;
+ case WARP_LAYER_INDEX:
+ l_warpLayer++;
+ if (l_warpLayer == 0x10) {
+ l_warpLayer = DEFAULT_LAYER;
}
break;
}
- }
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
switch (cursor.y) {
- case WARP_TYPE_INDEX: {
- stage_type_counter--;
- if (stage_type_counter < 0) {
- stage_type_counter = 4;
+ case WARP_TYPE_INDEX:
+ l_typeIdx--;
+ if (l_typeIdx < 0) {
+ l_typeIdx = 4;
}
- load_default_stage();
- load_default_room();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ GZWarp_loadDefaultStage();
+ GZWarp_loadDefaultRoom();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_STAGE_INDEX: {
- load_previous_stage_info();
- load_default_room();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ case WARP_STAGE_INDEX:
+ GZWarp_loadPrevStageInfo();
+ GZWarp_loadDefaultRoom();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_ROOM_INDEX: {
- load_previous_room_info();
- load_default_spawn();
- layer = DEFAULT_LAYER;
+ case WARP_ROOM_INDEX:
+ GZWarp_loadPrevRoomInfo();
+ GZWarp_loadDefaultSpawn();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_SPAWN_INDEX: {
- load_previous_spawn_info();
- layer = DEFAULT_LAYER;
+ case WARP_SPAWN_INDEX:
+ GZWarp_loadPrevSpawnInfo();
+ l_warpLayer = DEFAULT_LAYER;
break;
- }
- case WARP_LAYER_INDEX: {
- layer--;
- if (layer == 0xFE) {
- layer = 0xF;
+ case WARP_LAYER_INDEX:
+ l_warpLayer--;
+ if (l_warpLayer == 0xFE) {
+ l_warpLayer = 0xF;
}
break;
}
- }
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
switch (cursor.y) {
- case WARP_BUTTON_INDEX: {
- setNextStageName(warp_info.stage_info.stage_id);
- setNextStageRoom(warp_info.room_info.room_id[0]);
- setNextStagePoint(warp_info.spawn_info.spawn_id[0]);
- setNextStageLayer(layer);
- init_once = false;
- fifo_visible = true;
- MenuRendering::set_menu(MN_NONE_INDEX);
+ case WARP_BUTTON_INDEX:
+ setNextStageName(l_warpInfo.stage_info.stage_id);
+ setNextStageRoom(l_warpInfo.room_info.room_id[0]);
+ setNextStagePoint(l_warpInfo.spawn_info.spawn_id[0]);
+ setNextStageLayer(l_warpLayer);
+ GZ_setFifoVisible(true);
+ GZ_clearMenu();
g_dComIfG_gameInfo.play.mNextStage.wipe = 13; // instant load
g_dComIfG_gameInfo.info.mRestart.mLastMode = 0;
g_dComIfG_gameInfo.play.mNextStage.enabled = true;
break;
- }
- case SAVE_LOCATION_INDEX: {
- setReturnPlace(warp_info.stage_info.stage_id, warp_info.room_info.room_id[0],
- warp_info.spawn_info.spawn_id[0]);
+ case SAVE_LOCATION_INDEX:
+ setReturnPlace(l_warpInfo.stage_info.stage_id, l_warpInfo.room_info.room_id[0],
+ l_warpInfo.spawn_info.spawn_id[0]);
break;
}
- }
}
// temp fix for tp_sprintf warning
char tmpbuf[32];
- tp_strcpy(tmpbuf, stage_types[stage_type_counter]);
+ tp_strcpy(tmpbuf, stage_types[l_typeIdx]);
tp_sprintf(lines[WARP_TYPE_INDEX].value, " <%s>", tmpbuf);
- tp_strcpy(tmpbuf, warp_info.stage_info.stage_name);
+ tp_strcpy(tmpbuf, l_warpInfo.stage_info.stage_name);
tp_sprintf(lines[WARP_STAGE_INDEX].value, " <%s>", tmpbuf);
- tp_strcpy(tmpbuf, warp_info.room_info.room_name);
+ tp_strcpy(tmpbuf, l_warpInfo.room_info.room_name);
tp_sprintf(lines[WARP_ROOM_INDEX].value, " <%s>", tmpbuf);
- tp_sprintf(lines[WARP_SPAWN_INDEX].value, " <%d>", warp_info.spawn_info.spawn_id[0]);
- if (layer == DEFAULT_LAYER) {
+ tp_sprintf(lines[WARP_SPAWN_INDEX].value, " <%d>", l_warpInfo.spawn_info.spawn_id[0]);
+ if (l_warpLayer == DEFAULT_LAYER) {
tp_sprintf(lines[WARP_LAYER_INDEX].value, " <default>");
} else {
- tp_sprintf(lines[WARP_LAYER_INDEX].value, " <%d>", layer);
+ tp_sprintf(lines[WARP_LAYER_INDEX].value, " <%d>", l_warpLayer);
}
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
+ cursor.move(0, LINE_NUM);
+ GZ_drawMenuLines(lines, cursor.y, LINE_NUM);
} \ No newline at end of file
diff --git a/src/menus/watches_menu.cpp b/src/menus/watches_menu.cpp
index 8636cf4..c06c4e6 100644
--- a/src/menus/watches_menu.cpp
+++ b/src/menus/watches_menu.cpp
@@ -1,12 +1,8 @@
-#include "controller.h"
-#include "font.h"
-#include "libtp_c/include/msl_c/math.h"
#include "libtp_c/include/msl_c/string.h"
#include "menus/memory_editor_menu.h"
#include "menus/memory_menu.h"
#include "menus/settings_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
+#include "gz_flags.h"
#define WATCH_COLUMNS 6
#define WATCH_ADDRESS_X_OFFSET 25.0f
@@ -14,70 +10,48 @@
#define SPEED_THRESHOLD 30
#ifdef GCN_PLATFORM
-#define MEMORY_BUTTON (Controller::Y)
+#define MEMORY_BUTTON (GZPad::Y)
#define MEMORY_TEXT "Y"
#endif
#ifdef WII_PLATFORM
-#define MEMORY_BUTTON (Controller::ONE)
+#define MEMORY_BUTTON (GZPad::ONE)
#define MEMORY_TEXT "1"
#endif
-Cursor cursor;
+Cursor WatchesMenu::cursor;
-bool init_once = false;
-bool lock_cursor_y = false;
-bool lock_cursor_x = false;
uint8_t button_held_counter = 0;
-float speed = 1.0f;
-uint8_t watch_address_index = 3;
-uint8_t offset_index = 2;
-MemoryWatch Watches[MAX_WATCHES] = {};
+float l_scrollSpeed = 1.0f;
+uint8_t l_addrIdx = 3;
+uint8_t l_offsetIdx = 2;
-// returns the width of the rendered string
-float render_selected_number_selector(const char* str, float x, float y, size_t selected_char_index,
- size_t max_char, uint32_t color) {
- float pos = 0.0f;
- for (size_t i = 0; i <= max_char; ++i) {
- Font::gz_renderChar(str[i], x + pos, y, selected_char_index == i ? CURSOR_RGBA : color,
- g_drop_shadows);
- pos += Font::get_char_width(str[i]);
- }
- return pos;
-}
+MemoryWatch g_watches[MAX_WATCHES] = {};
-float max_value_f(float a, float b) {
- return MAX(a, b);
-}
-
-void render_memory_lines(MemoryWatch Watches[MAX_WATCHES], Cursor cursor) {
+void WatchesMenu::drawMemoryLines() {
const float watch_x_pos_x_offset =
- WATCH_ADDRESS_X_OFFSET +
- max_value_f(Font::get_chars_width("Address"), Font::get_chars_width("0x80000000")) + 5.0f;
+ WATCH_ADDRESS_X_OFFSET + maxF(GZ_getTextWidth("Address"), GZ_getTextWidth("0x80000000")) +
+ 5.0f;
const float watch_y_pos_x_offset =
- watch_x_pos_x_offset +
- max_value_f(Font::get_chars_width("X"), Font::get_chars_width("<000>")) + 5.0f;
+ watch_x_pos_x_offset + maxF(GZ_getTextWidth("X"), GZ_getTextWidth("<000>")) + 5.0f;
const float watch_hex_x_offset =
- watch_y_pos_x_offset +
- max_value_f(Font::get_chars_width("Y"), Font::get_chars_width("<000>")) + 5.0f;
+ watch_y_pos_x_offset + maxF(GZ_getTextWidth("Y"), GZ_getTextWidth("<000>")) + 5.0f;
const float watch_type_x_offset =
- watch_hex_x_offset +
- max_value_f(Font::get_chars_width("Hex"), Font::get_chars_width("<false>")) + 5.0f;
+ watch_hex_x_offset + maxF(GZ_getTextWidth("Hex"), GZ_getTextWidth("<false>")) + 5.0f;
const float watch_offset_x_offset =
- watch_type_x_offset +
- max_value_f(Font::get_chars_width("Type"), Font::get_chars_width("<u32>")) + 5.0f;
+ watch_type_x_offset + maxF(GZ_getTextWidth("Type"), GZ_getTextWidth("<u32>")) + 5.0f;
const float watch_visible_x_offset =
- watch_offset_x_offset +
- max_value_f(Font::get_chars_width("Offset"), Font::get_chars_width("0x0000")) + 5.0f;
+ watch_offset_x_offset + maxF(GZ_getTextWidth("Offset"), GZ_getTextWidth("0x0000")) + 5.0f;
+
+ GZ_drawText("Address", WATCH_ADDRESS_X_OFFSET, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("X", watch_x_pos_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("Y", watch_y_pos_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("Hex", watch_hex_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("Type", watch_type_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("Offset", watch_offset_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
+ GZ_drawText("Visible", watch_visible_x_offset, 60.0f, WHITE_RGBA, GZ_checkDropShadows());
- Font::gz_renderChars("Address", WATCH_ADDRESS_X_OFFSET, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("X", watch_x_pos_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("Y", watch_y_pos_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("Hex", watch_hex_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("Type", watch_type_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("Offset", watch_offset_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars("Visible", watch_visible_x_offset, 60.0f, WHITE_RGBA, g_drop_shadows);
for (int i = 0; i < MAX_WATCHES; i++) {
-#define LINE_Y_OFFSET (80.0f + (i * 20.0f))
+ const float line_y_offset = (80.0f + (i * 20.0f));
char watch_address[11];
char watch_x[8];
char watch_y[8];
@@ -86,400 +60,378 @@ void render_memory_lines(MemoryWatch Watches[MAX_WATCHES], Cursor cursor) {
char watch_offset[7];
char watch_visible[4];
- tp_sprintf(watch_address, "0x%08X", Watches[i].address);
- tp_sprintf(watch_x, "%.0f", Watches[i].x);
- tp_sprintf(watch_y, "%.0f", Watches[i].y);
- tp_sprintf(watch_hex, "%s", Watches[i].hex ? "true" : "false");
- switch (Watches[i].type) {
- case u8: {
+ tp_sprintf(watch_address, "0x%08X", g_watches[i].address);
+ tp_sprintf(watch_x, "%.0f", g_watches[i].x);
+ tp_sprintf(watch_y, "%.0f", g_watches[i].y);
+ tp_sprintf(watch_hex, "%s", g_watches[i].hex ? "true" : "false");
+
+ switch (g_watches[i].type) {
+ case u8:
tp_sprintf(watch_type, "u8");
break;
- }
- case u16: {
+ case u16:
tp_sprintf(watch_type, "u16");
break;
- }
- case u32: {
+ case u32:
tp_sprintf(watch_type, "u32");
break;
- }
- case i8: {
- tp_sprintf(watch_type, "i8");
+ case i8:
+ tp_sprintf(watch_type, "s8");
break;
- }
- case i16: {
- tp_sprintf(watch_type, "i16");
+ case i16:
+ tp_sprintf(watch_type, "s16");
break;
- }
- case i32: {
- tp_sprintf(watch_type, "i32");
+ case i32:
+ tp_sprintf(watch_type, "s32");
break;
- }
-
- case f32: {
+ case f32:
tp_sprintf(watch_type, "f32");
break;
- }
- case string: {
+ case string:
tp_sprintf(watch_type, "str");
+ break;
}
- }
- tp_sprintf(watch_offset, "0x%04X", Watches[i].offset);
- tp_sprintf(watch_visible, "%s", Watches[i].visible ? "[X]" : "[ ]");
+ tp_sprintf(watch_offset, "0x%04X", g_watches[i].offset);
+ tp_sprintf(watch_visible, "%s", g_watches[i].visible ? "[X]" : "[ ]");
- if (Watches[i].line_selected) {
+ if (g_watches[i].line_selected) {
switch (cursor.x) {
- case WatchAddress: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (watch_address_index == 9) {
- watch_address_index = 3;
- } else if (watch_address_index >= 3 && watch_address_index < 9) {
- watch_address_index++;
+ case WatchAddress:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (l_addrIdx == 9) {
+ l_addrIdx = 3;
+ } else if (l_addrIdx >= 3 && l_addrIdx < 9) {
+ l_addrIdx++;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (watch_address_index == 3) {
- watch_address_index = 9;
- } else if (watch_address_index > 3 && watch_address_index <= 9) {
- watch_address_index--;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (l_addrIdx == 3) {
+ l_addrIdx = 9;
+ } else if (l_addrIdx > 3 && l_addrIdx <= 9) {
+ l_addrIdx--;
}
}
- if (button_is_pressed(Controller::DPAD_UP)) {
- if (watch_address_index == 3) {
- Watches[i].address = 0x81FFFFFF;
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
+ if (l_addrIdx == 3) {
+ g_watches[i].address = 0x81FFFFFF;
}
- if (watch_address_index <= 9 && watch_address_index > 3) {
- Watches[i].address += 1 << ((9 - watch_address_index) * 4);
+ if (l_addrIdx <= 9 && l_addrIdx > 3) {
+ g_watches[i].address += 1 << ((9 - l_addrIdx) * 4);
}
- if (Watches[i].address > 0x81FFFFFF) {
- Watches[i].address = 0x81FFFFFF;
+ if (g_watches[i].address > 0x81FFFFFF) {
+ g_watches[i].address = 0x81FFFFFF;
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
- if (watch_address_index <= 9 && watch_address_index >= 3) {
- Watches[i].address -= 1 << ((9 - watch_address_index) * 4);
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
+ if (l_addrIdx <= 9 && l_addrIdx >= 3) {
+ g_watches[i].address -= 1 << ((9 - l_addrIdx) * 4);
}
- if (Watches[i].address < 0x80000000) {
- Watches[i].address = 0x80000000;
+ if (g_watches[i].address < 0x80000000) {
+ g_watches[i].address = 0x80000000;
}
}
- render_selected_number_selector(watch_address, WATCH_ADDRESS_X_OFFSET,
- LINE_Y_OFFSET, watch_address_index, 9,
- WHITE_RGBA);
+ GZ_drawSelectChar(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset,
+ l_addrIdx, 9, WHITE_RGBA);
} else {
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
- }
- case WatchX: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (Watches[i].x >= 0.0f && Watches[i].x < 600.0f) {
- Watches[i].x += speed;
+ case WatchX:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (g_watches[i].x >= 0.0f && g_watches[i].x < 600.0f) {
+ g_watches[i].x += l_scrollSpeed;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (Watches[i].x > 0.0f && Watches[i].x <= 600.0f) {
- Watches[i].x -= speed;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (g_watches[i].x > 0.0f && g_watches[i].x <= 600.0f) {
+ g_watches[i].x -= l_scrollSpeed;
}
}
- if (Watches[i].x < 0) {
- Watches[i].x = 0;
+ if (g_watches[i].x < 0) {
+ g_watches[i].x = 0;
}
- if (Watches[i].x > 600) {
- Watches[i].x = 600;
+ if (g_watches[i].x > 600) {
+ g_watches[i].x = 600;
}
- tp_sprintf(watch_x, "<%.0f>", Watches[i].x);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset - 8.0f, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ tp_sprintf(watch_x, "<%.0f>", g_watches[i].x);
+ GZ_drawText(watch_x, watch_x_pos_x_offset - 8.0f, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
} else {
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, CURSOR_RGBA,
- g_drop_shadows);
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
- }
- case WatchY: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (Watches[i].y >= 0.0f && Watches[i].y < 500.0f) {
- Watches[i].y += speed;
+ case WatchY:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (g_watches[i].y >= 0.0f && g_watches[i].y < 500.0f) {
+ g_watches[i].y += l_scrollSpeed;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (Watches[i].y > 0.0f && Watches[i].y <= 500.0f) {
- Watches[i].y -= speed;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (g_watches[i].y > 0.0f && g_watches[i].y <= 500.0f) {
+ g_watches[i].y -= l_scrollSpeed;
}
}
- if (Watches[i].y < 0) {
- Watches[i].y = 0;
+ if (g_watches[i].y < 0) {
+ g_watches[i].y = 0;
}
- if (Watches[i].y > 500) {
- Watches[i].y = 500;
+ if (g_watches[i].y > 500) {
+ g_watches[i].y = 500;
}
- tp_sprintf(watch_y, "<%.0f>", Watches[i].y);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset - 8.0f, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ tp_sprintf(watch_y, "<%.0f>", g_watches[i].y);
+ GZ_drawText(watch_y, watch_y_pos_x_offset - 8.0f, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
} else {
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, CURSOR_RGBA,
- g_drop_shadows);
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
- }
- case WatchHex: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- Watches[i].hex = !Watches[i].hex;
+ case WatchHex:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ g_watches[i].hex = !g_watches[i].hex;
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- Watches[i].hex = !Watches[i].hex;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ g_watches[i].hex = !g_watches[i].hex;
}
- tp_sprintf(watch_hex, "<%s>", Watches[i].hex ? "true" : "false");
- Font::gz_renderChars(watch_hex, watch_hex_x_offset - 8.0f, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ tp_sprintf(watch_hex, "<%s>", g_watches[i].hex ? "true" : "false");
+ GZ_drawText(watch_hex, watch_hex_x_offset - 8.0f, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
} else {
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, CURSOR_RGBA,
- g_drop_shadows);
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
- }
- case WatchType: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (Watches[i].type == string) {
- Watches[i].type = u8;
- } else if (Watches[i].type >= u8 && Watches[i].type < string) {
- Watches[i].type++;
+ case WatchType:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (g_watches[i].type == string) {
+ g_watches[i].type = u8;
+ } else if (g_watches[i].type >= u8 && g_watches[i].type < string) {
+ g_watches[i].type++;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (Watches[i].type == u8) {
- Watches[i].type = string;
- } else if (Watches[i].type > u8 && Watches[i].type <= string) {
- Watches[i].type--;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (g_watches[i].type == u8) {
+ g_watches[i].type = string;
+ } else if (g_watches[i].type > u8 && g_watches[i].type <= string) {
+ g_watches[i].type--;
}
}
- switch (Watches[i].type) {
- case u8: {
+ switch (g_watches[i].type) {
+ case u8:
tp_sprintf(watch_type, "<u8>");
break;
- }
- case u16: {
+ case u16:
tp_sprintf(watch_type, "<u16>");
break;
- }
- case u32: {
+ case u32:
tp_sprintf(watch_type, "<u32>");
break;
- }
- case i8: {
- tp_sprintf(watch_type, "<i8>");
+ case i8:
+ tp_sprintf(watch_type, "<s8>");
break;
- }
- case i16: {
- tp_sprintf(watch_type, "<i16>");
+ case i16:
+ tp_sprintf(watch_type, "<s16>");
break;
- }
- case i32: {
- tp_sprintf(watch_type, "<i32>");
+ case i32:
+ tp_sprintf(watch_type, "<s32>");
break;
- }
-
- case f32: {
+ case f32:
tp_sprintf(watch_type, "<f32>");
break;
- }
- case string: {
+ case string:
tp_sprintf(watch_type, "<str>");
}
- }
- Font::gz_renderChars(watch_type, watch_type_x_offset - 8.0f, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ GZ_drawText(watch_type, watch_type_x_offset - 8.0f, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
} else {
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
- }
- case WatchOffset: {
- if (Watches[i].value_selected) {
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
- if (offset_index == 5) {
- offset_index = 2;
- } else if (offset_index >= 2 && offset_index < 5) {
- offset_index++;
+ case WatchOffset:
+ if (g_watches[i].value_selected) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
+ if (l_offsetIdx == 5) {
+ l_offsetIdx = 2;
+ } else if (l_offsetIdx >= 2 && l_offsetIdx < 5) {
+ l_offsetIdx++;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
- if (offset_index == 2) {
- offset_index = 5;
- } else if (offset_index > 2 && offset_index <= 5) {
- offset_index--;
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
+ if (l_offsetIdx == 2) {
+ l_offsetIdx = 5;
+ } else if (l_offsetIdx > 2 && l_offsetIdx <= 5) {
+ l_offsetIdx--;
}
}
- if (button_is_pressed(Controller::DPAD_UP)) {
- switch (offset_index) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
+ switch (l_offsetIdx) {
case 2: {
- Watches[i].offset += 0x1000;
+ g_watches[i].offset += 0x1000;
break;
}
case 3: {
- Watches[i].offset += 0x100;
+ g_watches[i].offset += 0x100;
break;
}
case 4: {
- Watches[i].offset += 0x10;
+ g_watches[i].offset += 0x10;
break;
}
case 5: {
- Watches[i].offset += 0x1;
+ g_watches[i].offset += 0x1;
break;
}
}
- if (Watches[i].offset > 0xFFFF) {
- Watches[i].offset = 0xFFFF;
+ if (g_watches[i].offset > 0xFFFF) {
+ g_watches[i].offset = 0xFFFF;
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
- switch (offset_index) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
+ switch (l_offsetIdx) {
case 2: {
- Watches[i].offset -= 0x1000;
+ g_watches[i].offset -= 0x1000;
break;
}
case 3: {
- Watches[i].offset -= 0x100;
+ g_watches[i].offset -= 0x100;
break;
}
case 4: {
- Watches[i].offset -= 0x10;
+ g_watches[i].offset -= 0x10;
break;
}
case 5: {
- Watches[i].offset -= 0x1;
+ g_watches[i].offset -= 0x1;
break;
}
}
- if (Watches[i].offset < 0x0000) {
- Watches[i].offset = 0x0000;
+ if (g_watches[i].offset < 0x0000) {
+ g_watches[i].offset = 0x0000;
}
}
- render_selected_number_selector(watch_offset, watch_offset_x_offset,
- LINE_Y_OFFSET, offset_index, 5, WHITE_RGBA);
+ GZ_drawSelectChar(watch_offset, watch_offset_x_offset, line_y_offset,
+ l_offsetIdx, 5, WHITE_RGBA);
} else {
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET,
- CURSOR_RGBA, g_drop_shadows);
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset, CURSOR_RGBA,
+ GZ_checkDropShadows());
}
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- WHITE_RGBA, g_drop_shadows);
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset, WHITE_RGBA,
+ GZ_checkDropShadows());
break;
}
- }
} else {
- Font::gz_renderChars(watch_address, WATCH_ADDRESS_X_OFFSET, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_x, watch_x_pos_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_y, watch_y_pos_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_hex, watch_hex_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_type, watch_type_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_offset, watch_offset_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChars(watch_visible, watch_visible_x_offset, LINE_Y_OFFSET,
- (cursor.y == i ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ int y = cursor.y;
+ GZ_drawText(watch_address, WATCH_ADDRESS_X_OFFSET, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_x, watch_x_pos_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_y, watch_y_pos_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_hex, watch_hex_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_type, watch_type_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_offset, watch_offset_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
+ GZ_drawText(watch_visible, watch_visible_x_offset, line_y_offset,
+ (y == i ? CURSOR_RGBA : WHITE_RGBA), GZ_checkDropShadows());
}
}
}
-bool check_if_any_memory_line_is_selected(MemoryWatch Watches[]) {
+bool checkMemLineSelected() {
bool return_value = false;
for (int i = 0; i < MAX_WATCHES; i++) {
- if (Watches[i].line_selected) {
+ if (g_watches[i].line_selected) {
return_value = true;
}
}
return return_value;
}
-bool check_if_any_line_value_is_selected(MemoryWatch Watches[]) {
+bool checkLineValSelected() {
bool return_value = false;
for (int i = 0; i < MAX_WATCHES; i++) {
- if (Watches[i].value_selected) {
+ if (g_watches[i].value_selected) {
return_value = true;
}
}
@@ -487,80 +439,68 @@ bool check_if_any_line_value_is_selected(MemoryWatch Watches[]) {
return return_value;
}
-void WatchesMenu::render() {
- if (!init_once) {
- current_input = 0;
- init_once = true;
- }
+void WatchesMenu::draw() {
+ cursor.setMode(Cursor::MODE_UNRESTRICTED);
- if (button_is_pressed(BACK_BUTTON)) {
- if (check_if_any_line_value_is_selected(Watches)) {
+ if (GZ_getButtonTrig(BACK_BUTTON)) {
+ if (checkLineValSelected()) {
for (int i = 0; i < MAX_WATCHES; i++) {
- Watches[i].value_selected = false;
+ g_watches[i].value_selected = false;
}
- Watches[cursor.y].value_selected = false;
- lock_cursor_x = false;
- } else if (check_if_any_memory_line_is_selected(Watches)) {
+ g_watches[cursor.y].value_selected = false;
+ cursor.lock_x = false;
+ } else if (checkMemLineSelected()) {
for (int i = 0; i < MAX_WATCHES; i++) {
- Watches[i].line_selected = false;
+ g_watches[i].line_selected = false;
}
- Watches[cursor.y].line_selected = false;
- lock_cursor_y = false;
+ g_watches[cursor.y].line_selected = false;
+ cursor.lock_y = false;
} else {
- init_once = false;
- MenuRendering::set_menu(MN_MEMORY_INDEX);
+ GZ_setMenu(GZ_MEMORY_MENU);
return;
}
- };
-
- if (!init_once) {
- current_input = 0;
- init_once = true;
}
- if (current_input == SELECTION_BUTTON && a_held == false) {
- // finish
- if (Watches[cursor.y].value_selected) {
- Watches[cursor.y].value_selected = false;
- lock_cursor_x = false;
- } else if (Watches[cursor.y].line_selected) {
- Watches[cursor.y].value_selected = true;
- lock_cursor_x = true;
+ if (GZ_getButtonTrig(SELECTION_BUTTON)) {
+ if (g_watches[cursor.y].value_selected) {
+ g_watches[cursor.y].value_selected = false;
+ cursor.lock_x = false;
+ } else if (g_watches[cursor.y].line_selected) {
+ g_watches[cursor.y].value_selected = true;
+ cursor.lock_x = true;
} else {
- Watches[cursor.y].line_selected = true;
- lock_cursor_y = true;
+ g_watches[cursor.y].line_selected = true;
+ cursor.lock_y = true;
}
}
- if (button_is_pressed(Controller::Z)) {
- Watches[cursor.y].visible = !Watches[cursor.y].visible;
+ if (GZ_getButtonTrig(GZPad::Z)) {
+ g_watches[cursor.y].visible = !g_watches[cursor.y].visible;
}
- if (button_is_pressed(MEMORY_BUTTON)) {
- address_index = Watches[cursor.y].address;
- init_once = false;
- MenuRendering::set_menu(MN_MEMORY_EDITOR_INDEX);
+ if (GZ_getButtonTrig(MEMORY_BUTTON)) {
+ if (g_watches[cursor.y].offset > 0 && *(uint32_t*)g_watches[cursor.y].address != 0) {
+ MemoryEditorMenu::mAddressIndex =
+ *(uint32_t*)g_watches[cursor.y].address + g_watches[cursor.y].offset;
+ } else {
+ MemoryEditorMenu::mAddressIndex = g_watches[cursor.y].address;
+ }
+ GZ_setMenu(GZ_MEM_EDITOR_MENU);
}
- if (button_is_down(Controller::DPAD_RIGHT) || button_is_down(Controller::DPAD_LEFT)) {
- button_held_counter++;
- if (button_held_counter < SPEED_THRESHOLD) {
- speed = 1.0f;
- }
- if (button_held_counter > SPEED_THRESHOLD) {
- speed = 20.0f;
+ if (GZ_getButtonPressed(GZPad::DPAD_RIGHT) || GZ_getButtonPressed(GZPad::DPAD_LEFT)) {
+ if (l_scrollSpeed < 20.0f) {
+ l_scrollSpeed += 1.0f;
}
- if (button_held_counter >= 60) {
- button_held_counter = 60;
+ if (l_scrollSpeed > 20.0f) {
+ l_scrollSpeed = 20.0f;
}
} else {
- button_held_counter = 0;
- speed = 1.0f;
+ l_scrollSpeed = 1.0f;
}
- Utilities::move_cursor(cursor, MAX_WATCHES, WATCH_COLUMNS, lock_cursor_x, lock_cursor_y);
- Font::gz_renderChars("Press z to enable/disable watch. " MEMORY_TEXT
- " to jump to editor address",
- 25.0f, 440.f, 0xFFFFFFFF, g_drop_shadows);
- render_memory_lines(Watches, cursor);
-}; \ No newline at end of file
+ cursor.move(WATCH_COLUMNS, MAX_WATCHES);
+ GZ_drawText("Press Z to enable/disable watch. " MEMORY_TEXT " to jump to editor address", 25.0f,
+ 440.f, WHITE_RGBA, GZ_checkDropShadows());
+ drawMemoryLines();
+} \ No newline at end of file
diff --git a/src/movelink.cpp b/src/movelink.cpp
index 24ab899..ad3ebf0 100644
--- a/src/movelink.cpp
+++ b/src/movelink.cpp
@@ -1,15 +1,10 @@
#include "movelink.h"
-#include "controller.h"
-#include "font.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/msl_c/math.h"
#include "libtp_c/include/msl_c/string.h"
-#include "menu.h"
#include "menus/settings_menu.h"
-#include "utils/cursor.h"
-#include "utils/lines.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_draw_tag.h"
+#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
#define ROTATION_SPEED (10)
#define CAM_FAST_SPEED (2.0)
@@ -17,34 +12,32 @@
#define DIST_FROM_LINK (600)
#ifdef GCN_PLATFORM
-#define CONTROL_Y (tp_mPadStatus.control_y)
-#define CONTROL_X (tp_mPadStatus.control_x)
-#define VERTICAL_DISPLACEMENT (tp_mPadStatus.c_y)
-#define HORIZONTAL_DISPLACEMENT (tp_mPadStatus.c_x)
-#define SPEED_PREDICATE (tp_mPadButton.buttons & Controller::Pad::Z)
+#define CONTROL_Y (tp_mPadStatus.stick_y)
+#define CONTROL_X (tp_mPadStatus.stick_x)
+#define VERTICAL_DISPLACEMENT (tp_mPadStatus.substick_y)
+#define HORIZONTAL_DISPLACEMENT (tp_mPadStatus.substick_x)
+#define SPEED_PREDICATE (tp_mPadButton.mButton & CButton::Z)
#endif
+
#ifdef WII_PLATFORM
-#define CONTROL_Y ((tp_mPad.buttons & Controller::Mote::C) == 0 ? tp_mPad.stick.y * 0x48 : 0)
-#define CONTROL_X ((tp_mPad.buttons & Controller::Mote::C) == 0 ? -tp_mPad.stick.x * 0x48 : 0)
-#define VERTICAL_DISPLACEMENT \
- ((tp_mPad.buttons & Controller::Mote::C) != 0 ? tp_mPad.stick.y * 0x3B : 0)
-#define HORIZONTAL_DISPLACEMENT \
- ((tp_mPad.buttons & Controller::Mote::C) != 0 ? -tp_mPad.stick.x * 0x3B : 0)
-#define SPEED_PREDICATE (tp_mPad.buttons & Controller::Mote::Z)
+#define CONTROL_Y ((tp_mPad.mHoldButton & GZPad::C) == 0 ? tp_mPad.stick.y * 72 : 0)
+#define CONTROL_X ((tp_mPad.mHoldButton & GZPad::C) == 0 ? -tp_mPad.stick.x * 72 : 0)
+#define VERTICAL_DISPLACEMENT ((tp_mPad.mHoldButton & GZPad::C) != 0 ? tp_mPad.stick.y * 59 : 0)
+#define HORIZONTAL_DISPLACEMENT ((tp_mPad.mHoldButton & GZPad::C) != 0 ? -tp_mPad.stick.x * 59 : 0)
+#define SPEED_PREDICATE (tp_mPad.mHoldButton & GZPad::Z)
#endif
#define WHITE_RGBA 0xFFFFFFFF
#define LINE_X_OFFSET 20.0f
-bool move_link_active;
+bool g_moveLinkEnabled;
+
+static Cursor cursor;
-static Cursor cursor = {0, 0};
-bool lock_cursor_y = false;
-bool lock_cursor_x = false;
-bool link_angle_selected = false;
+/* bool link_angle_selected = false;
bool link_x_selected = false;
bool link_y_selected = false;
-bool link_z_selected = false;
+bool link_z_selected = false; */
bool init_once = false;
@@ -52,9 +45,8 @@ double pitch = 0.0;
double yaw = 0.0;
float angle = 0.0f;
-namespace MoveLink {
-void move_link() {
- if (move_link_active) {
+void MoveLink::execute() {
+ if (g_moveLinkEnabled) {
auto& cam_target = tp_matrixInfo.matrix_info->target;
auto& cam_pos = tp_matrixInfo.matrix_info->pos;
@@ -63,13 +55,13 @@ void move_link() {
// Freeze the game to prevent control stick inputs to move link
dComIfGp_getEvent().mHalt = true;
+
// Lock the camera to allow for its movement
dComIfGp_getEventManager().mCameraPlay = 1;
+
// Set Link momentum to 0
cXyz tmp(0.0f, 0.0f, 0.0f);
dComIfGp_getPlayer()->mSpeed = tmp;
- // Disable Link collision (causes console crash dont use)
- // g_dComIfG_gameInfo.link_collision_ptr->no_collision = 0x7F;
if (!init_once) {
angle = (float)link_angle / 65536.f * (2 * M_PI);
@@ -98,6 +90,7 @@ void move_link() {
double dz = CONTROL_Y * tp_sin(yaw) * tp_cos(pitch) + CONTROL_X * tp_cos(yaw);
auto speed = SPEED_PREDICATE != 0 ? CAM_FAST_SPEED : CAM_SPEED;
+
// Apply the translation with a speed factor
link_pos.x += speed * dx;
link_pos.y += speed * dy;
@@ -110,13 +103,12 @@ void move_link() {
if (init_once) {
dComIfGp_getEvent().mHalt = false;
dComIfGp_getEventManager().mCameraPlay = 0;
- // g_dComIfG_gameInfo.link_collision_ptr->no_collision = 0x80;
init_once = false;
}
}
}
-void render_info_input() {
+/* void render_info_input() {
char link_angle[20];
char link_x[20];
char link_y[20];
@@ -130,7 +122,7 @@ void render_info_input() {
if (link_angle_selected) {
cursor_x_max = 5;
- if (button_is_pressed(Controller::DPAD_UP)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCollisionRot.mY += 10000;
@@ -154,7 +146,7 @@ void render_info_input() {
}
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCollisionRot.mY -= 10000;
@@ -179,32 +171,32 @@ void render_info_input() {
}
}
- Font::gz_renderChar(link_angle[0], LINE_X_OFFSET, 80.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_angle[1], LINE_X_OFFSET + 8.0f, 80.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_angle[2], LINE_X_OFFSET + 16.0f, 80.0f, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChar(link_angle[3], LINE_X_OFFSET + 26.0f, 80.0f, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChar(link_angle[4], LINE_X_OFFSET + 32.0f, 80.0f, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChar(link_angle[5], LINE_X_OFFSET + 40.0f, 80.0f, WHITE_RGBA,
- g_drop_shadows);
- Font::gz_renderChar(link_angle[6], LINE_X_OFFSET + 48.0f, 80.0f, WHITE_RGBA,
- g_drop_shadows);
-
- Font::gz_renderChar(link_angle[7], LINE_X_OFFSET + 56.0f, 80.0f,
- (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_angle[8], LINE_X_OFFSET + 65.0f, 80.0f,
- (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_angle[9], LINE_X_OFFSET + 74.0f, 80.0f,
- (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_angle[10], LINE_X_OFFSET + 83.0f, 80.0f,
- (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_angle[11], LINE_X_OFFSET + 92.0f, 80.0f,
- (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawChar(link_angle[0], LINE_X_OFFSET, 80.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_angle[1], LINE_X_OFFSET + 8.0f, 80.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_angle[2], LINE_X_OFFSET + 16.0f, 80.0f, WHITE_RGBA,
+ g_dropShadows);
+ Font::GZ_drawChar(link_angle[3], LINE_X_OFFSET + 26.0f, 80.0f, WHITE_RGBA,
+ g_dropShadows);
+ Font::GZ_drawChar(link_angle[4], LINE_X_OFFSET + 32.0f, 80.0f, WHITE_RGBA,
+ g_dropShadows);
+ Font::GZ_drawChar(link_angle[5], LINE_X_OFFSET + 40.0f, 80.0f, WHITE_RGBA,
+ g_dropShadows);
+ Font::GZ_drawChar(link_angle[6], LINE_X_OFFSET + 48.0f, 80.0f, WHITE_RGBA,
+ g_dropShadows);
+
+ Font::GZ_drawChar(link_angle[7], LINE_X_OFFSET + 56.0f, 80.0f,
+ (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_angle[8], LINE_X_OFFSET + 65.0f, 80.0f,
+ (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_angle[9], LINE_X_OFFSET + 74.0f, 80.0f,
+ (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_angle[10], LINE_X_OFFSET + 83.0f, 80.0f,
+ (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_angle[11], LINE_X_OFFSET + 92.0f, 80.0f,
+ (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
} else {
- Font::gz_renderChars(link_angle, LINE_X_OFFSET, 80.0f,
- (cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawStr(link_angle, LINE_X_OFFSET, 80.0f,
+ (cursor.y == 0 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
}
if (link_x_selected) {
@@ -214,7 +206,7 @@ void render_info_input() {
dComIfGp_getPlayer()->mCurrent.mPosition.x = 999998.99f;
}
cursor_x_max = 9;
- if (button_is_pressed(Controller::DPAD_UP)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.x += 100000.0f;
@@ -250,7 +242,7 @@ void render_info_input() {
}
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.x -= 100000.0f;
@@ -287,36 +279,36 @@ void render_info_input() {
}
}
- Font::gz_renderChar(link_x[0], LINE_X_OFFSET, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[1], LINE_X_OFFSET + 10.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[2], LINE_X_OFFSET + 16.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[3], LINE_X_OFFSET + 24.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[4], LINE_X_OFFSET + 34.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[5], LINE_X_OFFSET + 44.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[6], LINE_X_OFFSET + 52.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
-
- Font::gz_renderChar(link_x[7], LINE_X_OFFSET + 56.0f, 100.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_x[8], LINE_X_OFFSET + 66.0f, 100.0f,
- (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[9], LINE_X_OFFSET + 76.0f, 100.0f,
- (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[10], LINE_X_OFFSET + 86.0f, 100.0f,
- (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[11], LINE_X_OFFSET + 96.0f, 100.0f,
- (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[12], LINE_X_OFFSET + 106.0f, 100.0f,
- (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[13], LINE_X_OFFSET + 116.0f, 100.0f,
- (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[14], LINE_X_OFFSET + 126.0f, 100.0f,
- (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[15], LINE_X_OFFSET + 131.0f, 100.0f,
- (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_x[16], LINE_X_OFFSET + 141.0f, 100.0f,
- (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawChar(link_x[0], LINE_X_OFFSET, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[1], LINE_X_OFFSET + 10.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[2], LINE_X_OFFSET + 16.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[3], LINE_X_OFFSET + 24.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[4], LINE_X_OFFSET + 34.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[5], LINE_X_OFFSET + 44.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[6], LINE_X_OFFSET + 52.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+
+ Font::GZ_drawChar(link_x[7], LINE_X_OFFSET + 56.0f, 100.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_x[8], LINE_X_OFFSET + 66.0f, 100.0f,
+ (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[9], LINE_X_OFFSET + 76.0f, 100.0f,
+ (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[10], LINE_X_OFFSET + 86.0f, 100.0f,
+ (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[11], LINE_X_OFFSET + 96.0f, 100.0f,
+ (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[12], LINE_X_OFFSET + 106.0f, 100.0f,
+ (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[13], LINE_X_OFFSET + 116.0f, 100.0f,
+ (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[14], LINE_X_OFFSET + 126.0f, 100.0f,
+ (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[15], LINE_X_OFFSET + 131.0f, 100.0f,
+ (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_x[16], LINE_X_OFFSET + 141.0f, 100.0f,
+ (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
} else {
- Font::gz_renderChars(link_x, LINE_X_OFFSET, 100.0f,
- (cursor.y == 1 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawStr(link_x, LINE_X_OFFSET, 100.0f,
+ (cursor.y == 1 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
}
if (link_y_selected) {
@@ -326,7 +318,7 @@ void render_info_input() {
dComIfGp_getPlayer()->mCurrent.mPosition.y = 999998.99f;
}
cursor_x_max = 9;
- if (button_is_pressed(Controller::DPAD_UP)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.y += 100000.0f;
@@ -362,7 +354,7 @@ void render_info_input() {
}
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.y -= 100000.0f;
@@ -399,36 +391,36 @@ void render_info_input() {
}
}
- Font::gz_renderChar(link_y[0], LINE_X_OFFSET, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[1], LINE_X_OFFSET + 10.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[2], LINE_X_OFFSET + 16.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[3], LINE_X_OFFSET + 24.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[4], LINE_X_OFFSET + 34.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[5], LINE_X_OFFSET + 44.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[6], LINE_X_OFFSET + 52.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
-
- Font::gz_renderChar(link_y[7], LINE_X_OFFSET + 56.0f, 120.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_y[8], LINE_X_OFFSET + 66.0f, 120.0f,
- (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[9], LINE_X_OFFSET + 76.0f, 120.0f,
- (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[10], LINE_X_OFFSET + 86.0f, 120.0f,
- (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[11], LINE_X_OFFSET + 96.0f, 120.0f,
- (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[12], LINE_X_OFFSET + 106.0f, 120.0f,
- (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[13], LINE_X_OFFSET + 116.0f, 120.0f,
- (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[14], LINE_X_OFFSET + 126.0f, 120.0f,
- (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[15], LINE_X_OFFSET + 131.0f, 120.0f,
- (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_y[16], LINE_X_OFFSET + 141.0f, 120.0f,
- (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawChar(link_y[0], LINE_X_OFFSET, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[1], LINE_X_OFFSET + 10.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[2], LINE_X_OFFSET + 16.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[3], LINE_X_OFFSET + 24.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[4], LINE_X_OFFSET + 34.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[5], LINE_X_OFFSET + 44.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[6], LINE_X_OFFSET + 52.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+
+ Font::GZ_drawChar(link_y[7], LINE_X_OFFSET + 56.0f, 120.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_y[8], LINE_X_OFFSET + 66.0f, 120.0f,
+ (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[9], LINE_X_OFFSET + 76.0f, 120.0f,
+ (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[10], LINE_X_OFFSET + 86.0f, 120.0f,
+ (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[11], LINE_X_OFFSET + 96.0f, 120.0f,
+ (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[12], LINE_X_OFFSET + 106.0f, 120.0f,
+ (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[13], LINE_X_OFFSET + 116.0f, 120.0f,
+ (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[14], LINE_X_OFFSET + 126.0f, 120.0f,
+ (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[15], LINE_X_OFFSET + 131.0f, 120.0f,
+ (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_y[16], LINE_X_OFFSET + 141.0f, 120.0f,
+ (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
} else {
- Font::gz_renderChars(link_y, LINE_X_OFFSET, 120.0f,
- (cursor.y == 2 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawStr(link_y, LINE_X_OFFSET, 120.0f,
+ (cursor.y == 2 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
}
if (link_z_selected) {
@@ -438,7 +430,7 @@ void render_info_input() {
dComIfGp_getPlayer()->mCurrent.mPosition.z = 999998.99f;
}
cursor_x_max = 9;
- if (button_is_pressed(Controller::DPAD_UP)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.z += 100000.0f;
@@ -474,7 +466,7 @@ void render_info_input() {
}
}
}
- if (button_is_pressed(Controller::DPAD_DOWN)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
dComIfGp_getPlayer()->mCurrent.mPosition.z -= 100000.0f;
@@ -511,39 +503,39 @@ void render_info_input() {
}
}
- Font::gz_renderChar(link_z[0], LINE_X_OFFSET, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[1], LINE_X_OFFSET + 10.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[2], LINE_X_OFFSET + 16.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[3], LINE_X_OFFSET + 24.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[4], LINE_X_OFFSET + 34.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[5], LINE_X_OFFSET + 44.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[6], LINE_X_OFFSET + 52.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
-
- Font::gz_renderChar(link_z[7], LINE_X_OFFSET + 56.0f, 140.0f, WHITE_RGBA, g_drop_shadows);
- Font::gz_renderChar(link_z[8], LINE_X_OFFSET + 66.0f, 140.0f,
- (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[9], LINE_X_OFFSET + 76.0f, 140.0f,
- (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[10], LINE_X_OFFSET + 86.0f, 140.0f,
- (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[11], LINE_X_OFFSET + 96.0f, 140.0f,
- (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[12], LINE_X_OFFSET + 106.0f, 140.0f,
- (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[13], LINE_X_OFFSET + 116.0f, 140.0f,
- (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[14], LINE_X_OFFSET + 126.0f, 140.0f,
- (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[15], LINE_X_OFFSET + 131.0f, 140.0f,
- (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
- Font::gz_renderChar(link_z[16], LINE_X_OFFSET + 141.0f, 140.0f,
- (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawChar(link_z[0], LINE_X_OFFSET, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[1], LINE_X_OFFSET + 10.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[2], LINE_X_OFFSET + 16.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[3], LINE_X_OFFSET + 24.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[4], LINE_X_OFFSET + 34.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[5], LINE_X_OFFSET + 44.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[6], LINE_X_OFFSET + 52.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+
+ Font::GZ_drawChar(link_z[7], LINE_X_OFFSET + 56.0f, 140.0f, WHITE_RGBA, g_dropShadows);
+ Font::GZ_drawChar(link_z[8], LINE_X_OFFSET + 66.0f, 140.0f,
+ (cursor.x == 0 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[9], LINE_X_OFFSET + 76.0f, 140.0f,
+ (cursor.x == 1 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[10], LINE_X_OFFSET + 86.0f, 140.0f,
+ (cursor.x == 2 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[11], LINE_X_OFFSET + 96.0f, 140.0f,
+ (cursor.x == 3 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[12], LINE_X_OFFSET + 106.0f, 140.0f,
+ (cursor.x == 4 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[13], LINE_X_OFFSET + 116.0f, 140.0f,
+ (cursor.x == 5 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[14], LINE_X_OFFSET + 126.0f, 140.0f,
+ (cursor.x == 6 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[15], LINE_X_OFFSET + 131.0f, 140.0f,
+ (cursor.x == 7 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
+ Font::GZ_drawChar(link_z[16], LINE_X_OFFSET + 141.0f, 140.0f,
+ (cursor.x == 8 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
} else {
- Font::gz_renderChars(link_z, LINE_X_OFFSET, 140.0f,
- (cursor.y == 3 ? CURSOR_RGBA : WHITE_RGBA), g_drop_shadows);
+ Font::GZ_drawStr(link_z, LINE_X_OFFSET, 140.0f,
+ (cursor.y == 3 ? CURSOR_RGBA : WHITE_RGBA), g_dropShadows);
}
- if (button_is_pressed(Controller::B)) {
+ if (GZ_getButtonRepeat(GZPad::B)) {
if (link_angle_selected) {
link_angle_selected = false;
} else if (link_x_selected) {
@@ -557,7 +549,7 @@ void render_info_input() {
lock_cursor_y = false;
}
- if (button_is_pressed(Controller::A)) {
+ if (GZ_getButtonRepeat(GZPad::A)) {
switch (cursor.y) {
case 0: {
link_angle_selected = true;
@@ -579,6 +571,5 @@ void render_info_input() {
lock_cursor_y = true;
}
- Utilities::move_cursor(cursor, 4, cursor_x_max, lock_cursor_x, lock_cursor_y, true);
-};
-} // namespace MoveLink \ No newline at end of file
+ move_cursor(cursor, 4, cursor_x_max, lock_cursor_x, lock_cursor_y, true);
+}; */ \ No newline at end of file
diff --git a/src/rollcheck.cpp b/src/rollcheck.cpp
index 0f1521a..3c812a6 100644
--- a/src/rollcheck.cpp
+++ b/src/rollcheck.cpp
@@ -1,15 +1,12 @@
#include "rollcheck.h"
#include "controller.h"
#include "fifo_queue.h"
-#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/msl_c/string.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#define ROLL_FRAMES 19
-namespace RollIndicator {
-using namespace Controller;
static int current_counter = 0;
static int counter_difference = 0;
static int previous_counter = 0;
@@ -19,7 +16,7 @@ static bool start_counter = false;
static bool missed_pressed_a = false;
uint16_t action_id = 0x0000;
-void run() {
+void RollIndicator::execute() {
// if normal human link gameplay
if (dComIfGp_getEvent().mHalt == false && dComIfGs_getTransformStatus() == STATUS_HUMAN) {
current_counter = cCt_getFrameCount();
@@ -53,12 +50,11 @@ void run() {
counter_difference = 0;
}
- if (counter_difference > 15 && counter_difference < 19 &&
- Controller::button_is_down(A) && !Controller::button_is_held(A)) {
+ if (counter_difference > 15 && counter_difference < 19 && GZ_getButtonPressed(A) &&
+ !GZ_getButtonHold(A)) {
tp_sprintf(buf, "%df early", ROLL_FRAMES - counter_difference);
FIFOQueue::push(buf, Queue, 0x0000FF00);
- } else if (counter_difference == 19 && Controller::button_is_down(A) &&
- !Controller::button_is_held(A)) {
+ } else if (counter_difference == 19 && GZ_getButtonPressed(A) && !GZ_getButtonHold(A)) {
FIFOQueue::push("<3", Queue, 0x00CC0000);
} else if (missed_counter > 0 && missed_pressed_a == false) {
tp_sprintf(buf, "%df late", missed_counter);
@@ -67,15 +63,6 @@ void run() {
counter_difference = 0;
missed_pressed_a = true;
}
-
- // account for roll interupt via bonks or other means
- // if (counter_difference > 20) {
- // counter_difference = 0;
- // previous_counter = 0;
- // current_counter = 0;
- // missed_counter = 0;
- // }
}
}
-}
-} // namespace RollIndicator \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/save_manager.cpp b/src/save_manager.cpp
index b2b71fe..cc2c53e 100644
--- a/src/save_manager.cpp
+++ b/src/save_manager.cpp
@@ -4,6 +4,7 @@
#include "libtp_c/include/dolphin/os/OSCache.h"
#include "menus/settings_menu.h"
#include "menus/practice_menu.h"
+#include "menus/memfiles_menu.h"
#include "save_manager.h"
#include "menu.h"
#include "utils/loading.h"
@@ -11,6 +12,7 @@
#include "utils/card.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
int apply_after_counter = 0;
int apply_during_counter = 0;
@@ -18,29 +20,29 @@ int injection_counter = 0;
char currentFileName[80];
SaveManager gSaveManager;
-void SaveManager::inject_save(void* buffer) {
+void SaveManager::injectSave(void* buffer) {
tp_memcpy((void*)&g_dComIfG_gameInfo, buffer, 2392);
dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
};
-void SaveManager::inject_memfile(void* buffer) {
+void SaveManager::injectMemfile(void* buffer) {
tp_memcpy((void*)&g_dComIfG_gameInfo, buffer, sizeof(dSv_info_c));
dComIfGs_getSave(g_dComIfG_gameInfo.info.mDan.mStageNo);
};
-void SaveManager::inject_default_before() {
+void SaveManager::injectDefault_before() {
g_dComIfG_gameInfo.info.mRestart.mLastSpeedF = 0.0f;
g_dComIfG_gameInfo.play.mNextStage.wipe = 13; // instant load
g_dComIfG_gameInfo.info.mRestart.mLastMode = 0;
g_dComIfG_gameInfo.play.mNextStage.mPoint = 0;
}
-void SaveManager::inject_default_during() {
+void SaveManager::injectDefault_during() {
// Load the save file over game info
- if (!inject_memfile_flag) {
- SaveManager::load_save_file(currentFileName);
+ if (!g_injectMemfile) {
+ SaveManager::loadSavefile(currentFileName);
} else {
- SaveManager::inject_memfile((void*)sTmpBuf);
+ SaveManager::injectMemfile((void*)sTmpBuf);
}
// Get default state based on file info
@@ -89,18 +91,18 @@ void SaveManager::inject_default_during() {
#endif
}
-void SaveManager::inject_default_after() {}
+void SaveManager::injectDefault_after() {}
-void SaveManager::default_load() {
- gSaveManager.mPracticeFileOpts.inject_options_during_load = SaveManager::inject_default_during;
- gSaveManager.mPracticeFileOpts.inject_options_after_load = SaveManager::inject_default_after;
- inject_save_flag = true;
- fifo_visible = true;
- MenuRendering::set_menu(MN_NONE_INDEX);
+void SaveManager::defaultLoad() {
+ gSaveManager.mPracticeFileOpts.inject_options_during_load = SaveManager::injectDefault_during;
+ gSaveManager.mPracticeFileOpts.inject_options_after_load = SaveManager::injectDefault_after;
+ g_injectSave = true;
+ g_fifoVisible = true;
+ GZ_setMenu(MN_NONE_INDEX);
}
-void SaveManager::load_save(uint32_t id, char* category, special i_specials[], int size) {
- SaveManager::inject_default_before();
+void SaveManager::loadSave(uint32_t id, const char* category, special i_specials[], int size) {
+ SaveManager::injectDefault_before();
// Load the corresponding file path and properties
tp_sprintf(currentFileName, "tpgz/save_files/%s.bin", category);
@@ -111,16 +113,14 @@ void SaveManager::load_save(uint32_t id, char* category, special i_specials[], i
// 0xFF is used to identify a call from file reload, which doesn't need to run the default load
if (size != 0xFF) {
- SaveManager::default_load();
+ SaveManager::defaultLoad();
} else {
size = last_special_size;
}
if (gSaveManager.mPracticeSaveInfo.requirements) {
gSaveManager.mPracticeFileOpts.inject_options_after_load =
- gSaveManager.mPracticeSaveInfo.requirements & REQ_CAM ?
- Utilities::set_camera_angle_position :
- Utilities::set_angle_position;
+ gSaveManager.mPracticeSaveInfo.requirements & REQ_CAM ? setPositionCamera : setLinkInfo;
gSaveManager.mPracticeFileOpts.inject_options_after_counter =
gSaveManager.mPracticeSaveInfo.counter;
}
@@ -150,9 +150,9 @@ void SaveManager::load_save(uint32_t id, char* category, special i_specials[], i
last_special_size = size;
}
-void SaveManager::load_save_file(const char* fileName) {
+void SaveManager::loadSavefile(const char* fileName) {
loadFile(fileName, (void*)sTmpBuf, 2400, 0);
- SaveManager::inject_save((void*)sTmpBuf);
+ SaveManager::injectSave((void*)sTmpBuf);
}
#if (GCN_NTSCU)
@@ -173,7 +173,7 @@ void SaveManager::load_save_file(const char* fileName) {
uint32_t setWaterDropColorInstr = 0x60000000;
-void SaveManager::trigger_load() {
+void SaveManager::triggerLoad() {
// Loading hasn't started yet, run the before load function and initiate loading
if (!tp_fopScnRq.isLoading && !gSaveManager.loading_initiated) {
// Patch out setWaterDropColor call temporarily (prevents a crash in some scenarios)
@@ -215,8 +215,8 @@ void SaveManager::trigger_load() {
gSaveManager.mPracticeFileOpts.inject_options_after_counter = 0;
gSaveManager.loading_initiated = false;
- inject_save_flag = false;
- inject_memfile_flag = false;
+ g_injectSave = false;
+ g_injectMemfile = false;
} else {
apply_after_counter++;
}
@@ -244,4 +244,19 @@ void SaveManager::setLinkInfo() {
gSaveManager.mPracticeSaveInfo.position.z);
dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
}
+}
+
+void SaveManager::setPositionCamera() {
+ if (tp_matrixInfo.matrix_info) {
+ tp_matrixInfo.matrix_info->target = gSaveManager.mPracticeSaveInfo.cam_target;
+ tp_matrixInfo.matrix_info->pos = gSaveManager.mPracticeSaveInfo.cam_pos;
+ }
+
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
+ cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x,
+ gSaveManager.mPracticeSaveInfo.position.y,
+ gSaveManager.mPracticeSaveInfo.position.z);
+ dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
+ }
} \ No newline at end of file
diff --git a/src/save_specials.cpp b/src/save_specials.cpp
new file mode 100644
index 0000000..7f90d04
--- /dev/null
+++ b/src/save_specials.cpp
@@ -0,0 +1,213 @@
+#include "save_specials.h"
+#include "gz_flags.h"
+#include "libtp_c/include/utils.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_actor_mng.h"
+#include "libtp_c/include/f_op/f_op_actor_iter.h"
+#include "libtp_c/include/rel/d/a/b/d_a_b_ds.h"
+#include "libtp_c/include/rel/d/a/obj/d_a_obj_lv4sand.h"
+
+void SaveMngSpecial_BossFlags() {
+ gSaveManager.injectDefault_during();
+ tp_bossFlags = 0xFF;
+}
+
+void SaveMngSpecial_Goats1() {
+ gSaveManager.injectDefault_during();
+ setNextStageLayer(5);
+}
+
+void SaveMngSpecial_Goats2() {
+ gSaveManager.injectDefault_during();
+ setNextStageLayer(4);
+}
+
+void SaveMngSpecial_Hugo() {
+ gSaveManager.injectDefault_during();
+ dComIfGs_onSwitch(47, 0); // midna trigger off
+ dComIfGs_offSwitch(63, 0); // hugo alive
+}
+
+void SaveMngSpecial_SpawnHugo() {
+ gSaveManager.setSaveAngle(40166);
+ gSaveManager.setSavePosition(2.9385, 396.9580, -18150.087);
+ gSaveManager.setLinkInfo();
+
+ cXyz position(-289.9785, 401.5400, -18533.078);
+ fopAcM_create(468, 0x0000F100, &position, dComIfGp_getPlayer()->mCurrent.mRoomNo,
+ &dComIfGp_getPlayer()->mCurrent.mAngle, nullptr, 0xFF);
+}
+
+void SaveMngSpecial_PurpleMist() {
+ gSaveManager.injectDefault_during();
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
+}
+
+void SaveMngSpecial_KargOoB() {
+ gSaveManager.mPracticeFileOpts.inject_options_before_load = nullptr;
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
+}
+
+void SaveMngSpecial_WaterfallSidehop() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mRestart.mLastSpeedF = 10.0f; // link spawns swimming forward
+}
+
+void SaveMngSpecial_KB2Skip() {
+ gSaveManager.injectDefault_during();
+ setNextStageLayer(3);
+}
+
+void SaveMngSpecial_Escort() {
+ gSaveManager.injectDefault_during();
+ setNextStageRoom(0xD);
+ setNextStagePoint(98);
+ setNextStageLayer(2);
+ dComIfGs_setKeyNum(2); // give 2 keys for field gates
+}
+
+void SaveMngSpecial_Dangoro() {
+ g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x200000; // turn off intro cs, start fight
+}
+
+void SaveMngSpecial_Norgor() {
+ g_meter2_info.mRentalBombBag = 0; // Rental Bomb Bag Idx set to bag 0
+ dComIfGs_setItem(SLOT_15, NORMAL_BOMB);
+ dComIfGs_setBombNum(0, 30);
+ dComIfGs_setSelectItemIndex(SELECT_ITEM_Y, SLOT_15);
+}
+
+void SaveMngSpecial_LakebedBKSkip() {
+ gSaveManager.injectDefault_during();
+ dComIfGs_onSwitch(2, 0); // bridge turned
+ dComIfGs_onSwitch(122, 0); // dungeon intro cs off
+}
+
+void SaveMngSpecial_Darkhammer() {
+ dComIfGs_onEventBit(0x0B02);
+ dComIfGs_onEventBit(0x0B04); // iza bomb bag stolen
+}
+
+void SaveMngSpecial_Morpheel() {
+ dComIfGp_getPlayer()->mEquipItem = HOOKSHOT; // clawshot
+ dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EQUIP_HEAVY_BOOTS); // ib
+ gSaveManager.setSaveAngle(10754);
+ gSaveManager.setSavePosition(-1193.0f, -23999.0f, -770.0f);
+ gSaveManager.setLinkInfo();
+}
+
+void SaveMngSpecial_Iza1Skip() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mRestart.mLastMode = 0xA; // spawn on kargorok
+ setNextStageName("F_SP112"); // set stage to river
+ setNextStageRoom(1);
+ setNextStagePoint(0);
+ setNextStageLayer(4);
+}
+
+void SaveMngSpecial_Stallord() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
+ setNextStagePoint(1); // spawn at in front of stally
+}
+
+void SaveMngSpecial_Stallord2() {
+ gSaveManager.mPracticeFileOpts.inject_options_after_counter = 20;
+
+ daB_DS_c* stallord = (daB_DS_c*)fopAcM_SearchByName(246); // stallord proc name
+ daObjLv4Sand_c* sand = (daObjLv4Sand_c*)fopAcM_SearchByName(189); // sand proc name
+
+ if (stallord != NULL) {
+ stallord->mBase.mParameters |= 0x2; // make actor phase 2 version
+ stallord->mAttentionInfo.mFlags = 4; // makes stallord targetable when hit down
+ stallord->mActionMode1 = 1; // make stallord head active
+ stallord->mGravity = 0.0f; // change gravity to 0
+ g_env_light.mWeatherPalette = 2; // set arena light
+ sand->mSpeed.y = 1000.0f; // move sand out of the way
+
+ dComIfGs_onOneZoneSwitch(6, stallord->mCurrent.mRoomNo);
+ dComIfGs_onZoneSwitch(7, stallord->mCurrent.mRoomNo); // sets arena to raised
+
+ stallord->mCurrent.mPosition.x = -2097.20f; //-2397.22f;
+ stallord->mCurrent.mPosition.y = 1022.21f; // 1697.20f;
+ stallord->mCurrent.mPosition.z = -1246.87f; // 1131.33f;
+
+ dComIfGp_getPlayer()->mCurrent.mPosition.x = 644.91f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y = 300.3158f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z = 2195.0237f;
+ dComIfGp_getPlayer()->mCollisionRot.mY = 39350;
+ // tp_matrixInfo.matrix_info->target = {865.203f, -1414.390f, 2496.8774f};
+ // tp_matrixInfo.matrix_info->pos = {644.438f, -1480.324f, 2194.693f};
+ }
+}
+
+void SaveMngSpecial_Stallord2_init() {
+ gSaveManager.repeat_during = true;
+ gSaveManager.repeat_count = 120;
+
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x300000; // turn off intro cs, start fight
+ setNextStagePoint(1); // spawn at in front of stally
+}
+
+void SaveMngSpecial_SPRBossKey() {
+ gSaveManager.injectDefault_during();
+ setNextStageRoom(0xB); // boss key room
+ setNextStagePoint(0); // default spawn
+}
+
+void SaveMngSpecial_ToTEarlyPoe() {
+ gSaveManager.injectDefault_during();
+ gSaveManager.setSaveAngle(49299);
+ gSaveManager.setSavePosition(-2462.85f, 2750.0f, -7.10f);
+ gSaveManager.setLinkInfo();
+}
+
+void SaveMngSpecial_ToTEarlyHP() {
+ gSaveManager.injectDefault_during();
+ gSaveManager.setSaveAngle(49152);
+ gSaveManager.setSavePosition(-8000.50f, 5100.0f, -3226.17f);
+ gSaveManager.setLinkInfo();
+}
+
+void SaveMngSpecial_HugoArchery() {
+ gSaveManager.injectDefault_during();
+ // g_dComIfG_gameInfo.temp_flags.flags[14] = 0xC0; // start archery minigame
+}
+
+void SaveMngSpecial_CityPoeCycle() {
+ gSaveManager.injectDefault_during();
+ gSaveManager.setSaveAngle(71);
+ gSaveManager.setSavePosition(-14005.31f, 3000.0f, -15854.05f);
+ gSaveManager.setLinkInfo();
+}
+
+void SaveMngSpecial_FanTower() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0; // reset city switches
+}
+
+void SaveMngSpecial_Argorok() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mZone[0].mBit.mSwitch[0] |= 0x10000;
+}
+
+void SaveMngSpecial_Palace1() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0; // reset palace switches
+}
+
+void SaveMngSpecial_Palace2() {
+ dComIfGp_getPlayer()->mEquipItem = 3; // master sword
+ gSaveManager.injectDefault_during();
+ gSaveManager.setSaveAngle(32731);
+ gSaveManager.setSavePosition(251.83f, -200.0f, 10993.50f);
+ gSaveManager.setLinkInfo();
+}
+
+void SaveMngSpecial_CaveOfOrdeals() {
+ gSaveManager.injectDefault_during();
+ g_dComIfG_gameInfo.info.mDan.mSwitch[0] = 0;
+}
diff --git a/src/system.cpp b/src/system.cpp
deleted file mode 100644
index 3a9ca2f..0000000
--- a/src/system.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-#include "system.h"
-#include "libtp_c/include/d/meter/d_meter_HIO.h"
-
-namespace System {
-bool camera_run_once;
-bool hud_run_once;
-
-void lock_camera() {
- camera_run_once = true;
- dComIfGp_getEventManager().mCameraPlay = 1;
-}
-
-void unlock_camera() {
- if (camera_run_once) {
- dComIfGp_getEventManager().mCameraPlay = 0;
- camera_run_once = false;
- }
-}
-
-void hide_hud() {
- g_drawHIO.mHUDAlpha = 0.0f;
- hud_run_once = true;
-}
-
-void show_hud() {
- if (hud_run_once) {
- g_drawHIO.mHUDAlpha = 1.0f;
- hud_run_once = false;
- }
-}
-} // namespace System \ No newline at end of file
diff --git a/src/time.cpp b/src/time.cpp
deleted file mode 100644
index 2fa9998..0000000
--- a/src/time.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "time.h"
-#include "libtp_c/include/d/d_stage.h"
-#include "menus/scene_menu.h"
-
-namespace Utilities {
-void freeze_time() {
- if (&SceneItems[Scene::FREEZE_TIME_INDEX].active) {
- dStage_roomControl_c__setTimePass(TIME_STOP);
- } else {
- return;
- }
-}
-
-} // namespace Utilities
diff --git a/src/timer.cpp b/src/timer.cpp
index 3cb1fa4..f5b949a 100644
--- a/src/timer.cpp
+++ b/src/timer.cpp
@@ -9,102 +9,90 @@
#define FRAME_RATE 29.97
-bool timer_visible;
-
-namespace Timer {
-static int current_frame = 0;
-static int previous_frame = 0;
-
-// Timer vars
-static int timer_frame = 0;
-static char timer[5];
-static double timer_seconds = 0.0f;
-static char timerS[8];
-
-// Load timer vars
-static int load_timer_frame = 0;
-static double load_timer_seconds = 0.0f;
-static char load_timerS[8];
-
-// IGT timer vars
-static int igt_timer_frame = 0;
-static int igt_timer_hours = 0;
-static int igt_timer_minutes = 0;
-static double igt_timer_seconds = 0.0f;
-static char igt_timer[16];
-
-void render() {
- current_frame = cCt_getFrameCount();
-
- if (ToolItems[Tools::TIMER_INDEX].active) {
- if (timer_started) {
- timer_frame += current_frame - previous_frame;
-
- timer_seconds = timer_frame / FRAME_RATE;
- }
- if (reset_timer) {
- timer_frame = 0;
- timer_seconds = 0.0f;
- reset_timer = false;
- timer_started = false;
- }
- tp_sprintf(timer, "%d", timer_frame);
- tp_sprintf(timerS, "%.2f", timer_seconds);
- previous_frame = current_frame;
- Font::gz_renderChars(timer, (sprite_offsets[TIMER_SPR_INDEX].x),
- (sprite_offsets[TIMER_SPR_INDEX].y), 0XFFFFFFFF, g_drop_shadows);
- Font::gz_renderChars(timerS, (sprite_offsets[TIMER_SPR_INDEX].x),
- 15.0f + (sprite_offsets[TIMER_SPR_INDEX].y), 0XFFFFFFFF,
- g_drop_shadows);
+#if defined(GCN_PAL) || defined(WII_PAL)
+#define FRAME_RATE 25
+#endif
+
+void Timer::drawTimer() {
+ static int sTimer = 0;
+ static float sTimerSec = 0.0f;
+
+ if (g_timerEnabled) {
+ sTimer++;
+ sTimerSec = sTimer / FRAME_RATE;
}
- if (ToolItems[Tools::LOAD_TIMER_INDEX].active) {
- if (tp_fopScnRq.isLoading == 1) {
- load_timer_frame += current_frame - previous_frame;
+ if (g_resetTimer) {
+ sTimer = 0;
+ sTimerSec = 0.0f;
+ g_resetTimer = false;
+ g_timerEnabled = false;
+ }
- load_timer_seconds = load_timer_frame / FRAME_RATE;
- }
- if (reset_timer) {
- load_timer_frame = 0;
- load_timer_seconds = 0.0f;
- reset_timer = false;
+ char timerF[5];
+ char timerS[8];
+ tp_sprintf(timerF, "%d", sTimer);
+ tp_sprintf(timerS, "%.2f", sTimerSec);
+
+ Font::GZ_drawStr(timerF, (g_spriteOffsets[TIMER_SPR_INDEX].x),
+ (g_spriteOffsets[TIMER_SPR_INDEX].y), 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(timerS, (g_spriteOffsets[TIMER_SPR_INDEX].x),
+ 15.0f + (g_spriteOffsets[TIMER_SPR_INDEX].y), 0xFFFFFFFF, g_dropShadows);
+}
+
+void Timer::drawIGT() {
+ static int sTimer = 0;
+ static int sTimerHour = 0;
+ static int sTimerMin = 0;
+ static float sTimerSec = 0.0f;
+
+ if (g_timerEnabled && !tp_fopScnRq.isLoading) {
+ sTimer++;
+ sTimerSec = sTimer / FRAME_RATE;
+
+ if (sTimerSec >= 60.0f) {
+ sTimer = 0;
+ sTimerMin++;
+
+ if (sTimerMin == 60) {
+ sTimerMin = 0;
+ sTimerHour++;
+ }
}
- tp_sprintf(load_timerS, "%.2f", load_timer_seconds);
- previous_frame = current_frame;
- Font::gz_renderChars(load_timerS, sprite_offsets[LOAD_TIMER_SPR_INDEX].x,
- sprite_offsets[LOAD_TIMER_SPR_INDEX].y, 0XFFFFFFFF, g_drop_shadows);
}
- if (ToolItems[Tools::IGT_TIMER_INDEX].active) {
- if (timer_started && tp_fopScnRq.isLoading == 0) {
- igt_timer_frame += current_frame - previous_frame;
+ if (g_resetTimer) {
+ sTimer = 0;
+ sTimerHour = 0;
+ sTimerMin = 0;
+ sTimerSec = 0.0f;
+ g_resetTimer = false;
+ g_timerEnabled = false;
+ }
- igt_timer_seconds = igt_timer_frame / FRAME_RATE;
+ char buf[16];
+ tp_sprintf(buf, "%02d:%02d:%05.2f", sTimerHour, sTimerMin, sTimerSec);
+ Font::GZ_drawStr(buf, g_spriteOffsets[IGT_TIMER_SPR_INDEX].x,
+ g_spriteOffsets[IGT_TIMER_SPR_INDEX].y, 0xFFFFFFFF, g_dropShadows);
+}
- if (igt_timer_seconds >= 60.0f) {
- igt_timer_frame = 0;
- igt_timer_minutes++;
+void Timer::drawLoadTimer() {
+ static int sTimer = 0;
+ static float sTimerSec = 0.0f;
- if (igt_timer_minutes == 60) {
- igt_timer_minutes = 0;
- igt_timer_hours++;
- }
- }
- }
- if (reset_timer) {
- igt_timer_frame = 0;
- igt_timer_hours = 0;
- igt_timer_minutes = 0;
- igt_timer_seconds = 0.0f;
- reset_timer = false;
- timer_started = false;
- }
- tp_sprintf(igt_timer, "%02d:%02d:%05.2f", igt_timer_hours, igt_timer_minutes,
- igt_timer_seconds);
- previous_frame = current_frame;
- Font::gz_renderChars(igt_timer, sprite_offsets[IGT_TIMER_SPR_INDEX].x,
- sprite_offsets[IGT_TIMER_SPR_INDEX].y, 0XFFFFFFFF, g_drop_shadows);
+ if (tp_fopScnRq.isLoading) {
+ sTimer++;
+ sTimerSec = sTimer / FRAME_RATE;
+ }
+
+ if (g_resetTimer) {
+ sTimer = 0;
+ sTimerSec = 0.0f;
+ g_resetTimer = false;
}
-} // namespace Timer
-} // namespace Timer \ No newline at end of file
+ char buf[8];
+ tp_sprintf(buf, "%.2f", sTimerSec);
+ Font::GZ_drawStr(buf, g_spriteOffsets[LOAD_TIMER_SPR_INDEX].x,
+ g_spriteOffsets[LOAD_TIMER_SPR_INDEX].y, 0xFFFFFFFF, g_dropShadows);
+} \ No newline at end of file
diff --git a/src/umd.cpp b/src/umd.cpp
index 99ee3b3..69a26c5 100644
--- a/src/umd.cpp
+++ b/src/umd.cpp
@@ -9,9 +9,6 @@
#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
-namespace UMDIndicator {
-using namespace Controller;
-
static bool lastFrameADown = false;
static bool lastFrameBDown = false;
@@ -24,15 +21,15 @@ static bool exitCheck = false;
static char buf[20];
static const char* getPressedButtonText() {
- if (!button_is_held(A, POST_GAME_LOOP) && button_is_down(A))
+ if (!GZ_getButtonHold(A, POST_GAME_LOOP) && GZ_getButtonPressed(A))
return "A";
- else if (!button_is_held(B, POST_GAME_LOOP) && button_is_down(B))
+ else if (!GZ_getButtonHold(B, POST_GAME_LOOP) && GZ_getButtonPressed(B))
return "B";
return "";
}
-void run() {
+void UMDIndicator::execute() {
// Reset everything if map is not active
if (g_meter2_info.mMapStatus != 2 && g_meter2_info.mMapStatus != 3) {
counter_difference = 0;
@@ -63,17 +60,17 @@ void run() {
// Only care up to 15f after
if (counter_difference < 15) {
// Ensure A or B was freshly pressed
- if ((!button_is_held(A, POST_GAME_LOOP) && button_is_down(A)) ||
- (!button_is_held(B, POST_GAME_LOOP) && button_is_down(B))) {
+ if ((!GZ_getButtonHold(A, POST_GAME_LOOP) && GZ_getButtonPressed(A)) ||
+ (!GZ_getButtonHold(B, POST_GAME_LOOP) && GZ_getButtonPressed(B))) {
if (counter_difference == 0) {
// A or B were pressed together (first button) = BAD
- if ((!button_is_held(A, POST_GAME_LOOP) && button_is_down(A)) &&
- (!button_is_held(B, POST_GAME_LOOP) && button_is_down(B))) {
+ if ((!GZ_getButtonHold(A, POST_GAME_LOOP) && GZ_getButtonPressed(A)) &&
+ (!GZ_getButtonHold(B, POST_GAME_LOOP) && GZ_getButtonPressed(B))) {
FIFOQueue::push("hit both A/B as first", Queue, 0x0000FF00);
exitCheck = true;
} else {
// A or B is pressed here (first button) = GOOD
- if (!button_is_held(A, POST_GAME_LOOP) && button_is_down(A))
+ if (!GZ_getButtonHold(A, POST_GAME_LOOP) && GZ_getButtonPressed(A))
firstPressedButton = 0;
else
firstPressedButton = 1;
@@ -91,8 +88,8 @@ void run() {
// Missed second button
if (firstPressedButton != -1) {
// Ensure this is the button that needs to be pressed
- if ((firstPressedButton == 0 && button_is_down(B)) ||
- (firstPressedButton == 1 && button_is_down(A))) {
+ if ((firstPressedButton == 0 && GZ_getButtonPressed(B)) ||
+ (firstPressedButton == 1 && GZ_getButtonPressed(A))) {
tp_sprintf(buf, "%df late on second %s", counter_difference - 1,
getPressedButtonText());
FIFOQueue::push(buf, Queue, 0x99000000);
@@ -106,10 +103,8 @@ void run() {
}
}
} else { // Neither A or B was freshly pressed
-
- if (counter_difference ==
- 0) { // A or B wasn't pressed on frame 0, we possibly went early
-
+ // A or B wasn't pressed on frame 0, we possibly went early
+ if (counter_difference == 0) {
if (lastFrameADown && lastFrameBDown) {
FIFOQueue::push("1f early on A/B", Queue, 0x0000FF00);
exitCheck = true;
@@ -128,7 +123,6 @@ void run() {
}
}
- lastFrameADown = button_is_down(A) && !button_is_held(A, POST_GAME_LOOP);
- lastFrameBDown = button_is_down(B) && !button_is_held(B, POST_GAME_LOOP);
-}
-} // namespace UMDIndicator \ No newline at end of file
+ lastFrameADown = GZ_getButtonPressed(A) && !GZ_getButtonHold(A, POST_GAME_LOOP);
+ lastFrameBDown = GZ_getButtonPressed(B) && !GZ_getButtonHold(B, POST_GAME_LOOP);
+} \ No newline at end of file
diff --git a/src/utils/audio.cpp b/src/utils/audio.cpp
index 0571a9b..4fe3d93 100644
--- a/src/utils/audio.cpp
+++ b/src/utils/audio.cpp
@@ -1,45 +1,34 @@
#include "utils/audio.h"
-#include "libtp_c/include/m_Do/m_Do_audio.h"
-namespace Utilities {
-void enable_bg_music() {
- tp_zelAudio.bg_audio = 1.0f;
+void GZ_enableBGM() {
+ g_mDoAud_zelAudio.mAudioMgr.mSeqMgr.mHeightVol.mIntensity = 1.0f; // BG Audio
#ifndef WII_PLATFORM
- tp_zelAudio.enemy_bg_music_volume = 1.0f;
- tp_zelAudio.hyrule_castle_bg_music_volume = 1.0f;
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeqMgr.mMove.mParams.mVolume = 1.0f;
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mStreamMgr.mParams.mParams.mVolume = 1.0f;
#endif
}
-void disable_bg_music() {
- tp_zelAudio.bg_audio = 0.0f;
+void GZ_disableBGM() {
+ g_mDoAud_zelAudio.mAudioMgr.mSeqMgr.mHeightVol.mIntensity = 0.0f; // BG Audio
#ifndef WII_PLATFORM
- tp_zelAudio.enemy_bg_music_volume = 0.0f;
- tp_zelAudio.hyrule_castle_bg_music_volume = 0.0f;
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeqMgr.mMove.mParams.mVolume = 0.0f;
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mStreamMgr.mParams.mParams.mVolume = 0.0f;
#endif
}
-void disable_sfx() {
- tp_zelAudio.enemy_sfx_volume = 0.0f;
- tp_zelAudio.env_sfx_volume = 0.0f;
- tp_zelAudio.item_recoil_sfx_volume = 0.0f;
- tp_zelAudio.item_sfx_volume = 0.0f;
- tp_zelAudio.link_idle_sfx_volume = 0.0f;
- tp_zelAudio.link_voice_volume = 0.0f;
- tp_zelAudio.menu_sfx_volume = 0.0f;
- tp_zelAudio.midna_sfx_volume = 0.0f;
- tp_zelAudio.npc_volume = 0.0f;
- tp_zelAudio.pause_button_volume = 0.0f;
-}
-void enable_sfx() {
- tp_zelAudio.enemy_sfx_volume = 1.0f;
- tp_zelAudio.env_sfx_volume = 1.0f;
- tp_zelAudio.item_recoil_sfx_volume = 1.0f;
- tp_zelAudio.item_sfx_volume = 1.0f;
- tp_zelAudio.link_idle_sfx_volume = 1.0f;
- tp_zelAudio.link_voice_volume = 1.0f;
- tp_zelAudio.menu_sfx_volume = 1.0f;
- tp_zelAudio.midna_sfx_volume = 1.0f;
- tp_zelAudio.npc_volume = 1.0f;
- tp_zelAudio.pause_button_volume = 1.0f;
+void GZ_disableSFX() {
+ for (int i = 0; i < 16; i++) {
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeMgr.mCategoryMgrs[i].mParams.mParams.mVolume =
+ 0.0f;
+ }
+
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeMgr.mParams.mParams.mVolume = 0.0f;
}
-} // namespace Utilities \ No newline at end of file
+void GZ_enableSFX() {
+ for (int i = 0; i < 16; i++) {
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeMgr.mCategoryMgrs[i].mParams.mParams.mVolume =
+ 1.0f;
+ }
+
+ g_mDoAud_zelAudio.mAudioMgr.mSoundMgr.mSeMgr.mParams.mParams.mVolume = 1.0f;
+} \ No newline at end of file
diff --git a/src/utils/card.cpp b/src/utils/card.cpp
index bf1ac25..9834303 100644
--- a/src/utils/card.cpp
+++ b/src/utils/card.cpp
@@ -13,14 +13,11 @@
#include "utils/card.h"
#include "utils/loading.h"
-bool inject_memfile_flag = false;
-
-namespace Utilities {
/**
* @brief Like CARDWrite, but allows for arbitrary sizes and offsets.
*/
-int32_t storage_write(Storage* storage, void* data, int32_t size, int32_t offset,
- int32_t sector_size) {
+int32_t GZ_storageWrite(Storage* storage, void* data, int32_t size, int32_t offset,
+ int32_t sector_size) {
uint8_t* buf = (uint8_t*)tp_memalign(-32, sector_size);
int32_t result = Ready;
int32_t read_bytes = 0;
@@ -45,8 +42,8 @@ int32_t storage_write(Storage* storage, void* data, int32_t size, int32_t offset
/**
* @brief Like CARDRead, but allows for arbitrary sizes and offsets.
*/
-int32_t storage_read(Storage* storage, void* data, int32_t size, int32_t offset,
- int32_t sector_size) {
+int32_t GZ_storageRead(Storage* storage, void* data, int32_t size, int32_t offset,
+ int32_t sector_size) {
uint8_t* buf = (uint8_t*)tp_memalign(-32, sector_size);
int32_t result = Ready;
int32_t read_bytes = 0;
@@ -67,40 +64,40 @@ int32_t storage_read(Storage* storage, void* data, int32_t size, int32_t offset,
return result;
}
-void store_save_layout(GZSaveLayout& save_layout) {
- tp_memcpy(save_layout.CheatItems, CheatItems, sizeof(CheatItems));
- tp_memcpy(save_layout.ToolItems, ToolItems, sizeof(ToolItems));
- tp_memcpy(save_layout.SceneItems, SceneItems, sizeof(SceneItems));
- tp_memcpy(save_layout.Watches, Watches, sizeof(Watches));
- tp_memcpy(save_layout.sprite_offsets, sprite_offsets, sizeof(sprite_offsets));
- tp_memcpy(save_layout.commands_states, commands_states, sizeof(commands_states));
- save_layout.g_drop_shadows = g_drop_shadows;
- save_layout.g_area_reload_behavior = g_area_reload_behavior;
- save_layout.g_cursor_color = g_cursor_color;
- save_layout.g_font = g_font;
+void GZ_storeSaveLayout(GZSaveLayout& save_layout) {
+ tp_memcpy(save_layout.mCheats, g_cheats, sizeof(g_cheats));
+ tp_memcpy(save_layout.mTools, g_tools, sizeof(g_tools));
+ tp_memcpy(save_layout.mSceneFlags, g_sceneFlags, sizeof(g_sceneFlags));
+ tp_memcpy(save_layout.mWatches, g_watches, sizeof(g_watches));
+ tp_memcpy(save_layout.mSpriteOffsets, g_spriteOffsets, sizeof(g_spriteOffsets));
+ tp_memcpy(save_layout.mCommandStates, g_commandStates, sizeof(g_commandStates));
+ save_layout.mDropShadows = g_dropShadows;
+ save_layout.mReloadType = g_reloadType;
+ save_layout.mCursorColType = g_cursorColorType;
+ save_layout.mFontType = g_fontType;
}
-void load_save_layout(GZSaveLayout& save_layout) {
- tp_memcpy(CheatItems, save_layout.CheatItems, sizeof(CheatItems));
- tp_memcpy(ToolItems, save_layout.ToolItems, sizeof(ToolItems));
- tp_memcpy(SceneItems, save_layout.SceneItems, sizeof(SceneItems));
- tp_memcpy(Watches, save_layout.Watches, sizeof(Watches));
- tp_memcpy(sprite_offsets, save_layout.sprite_offsets, sizeof(sprite_offsets));
- tp_memcpy(commands_states, save_layout.commands_states, sizeof(commands_states));
- g_drop_shadows = save_layout.g_drop_shadows;
- g_area_reload_behavior = save_layout.g_area_reload_behavior;
- g_cursor_color = save_layout.g_cursor_color;
- g_font = save_layout.g_font;
+void GZ_loadSaveLayout(GZSaveLayout& save_layout) {
+ tp_memcpy(g_cheats, save_layout.mCheats, sizeof(g_cheats));
+ tp_memcpy(g_tools, save_layout.mTools, sizeof(g_tools));
+ tp_memcpy(g_sceneFlags, save_layout.mSceneFlags, sizeof(g_sceneFlags));
+ tp_memcpy(g_watches, save_layout.mWatches, sizeof(g_watches));
+ tp_memcpy(g_spriteOffsets, save_layout.mSpriteOffsets, sizeof(g_spriteOffsets));
+ tp_memcpy(g_commandStates, save_layout.mCommandStates, sizeof(g_commandStates));
+ g_dropShadows = save_layout.mDropShadows;
+ g_reloadType = save_layout.mReloadType;
+ g_cursorColorType = save_layout.mCursorColType;
+ g_fontType = save_layout.mFontType;
}
-void load_position_data(PositionData& pos_data) {
+void GZ_loadPositionData(PositionData& pos_data) {
memfile_posdata.link = pos_data.link;
memfile_posdata.cam.target = pos_data.cam.target;
memfile_posdata.cam.pos = pos_data.cam.pos;
memfile_posdata.angle = pos_data.angle;
}
-void setup_save_file(GZSaveFile& save_file) {
+void GZ_setupSaveFile(GZSaveFile& save_file) {
save_file.header.version = GZ_SAVE_VERSION_NUMBER;
save_file.header.entries = GZ_SAVE_ENTRIES_AMNT;
save_file.header.offsetsLoc = offsetof(GZSaveFile, offsets);
@@ -109,20 +106,20 @@ void setup_save_file(GZSaveFile& save_file) {
save_file.offsets[idx] = offsetof(GZSaveFile, data) + offsetof(GZSaveLayout, attr); \
save_file.sizes[idx] = sizeof(save_file.data.attr)
- set_entry(SV_CHEATS_INDEX, CheatItems);
- set_entry(SV_TOOLS_INDEX, ToolItems);
- set_entry(SV_SCENE_INDEX, SceneItems);
- set_entry(SV_WATCHES_INDEX, Watches);
- set_entry(SV_SPRITES_INDEX, sprite_offsets);
- set_entry(SV_COMMANDS, commands_states);
- set_entry(SV_DROP_SHADOW_INDEX, g_drop_shadows);
- set_entry(SV_AREA_RELOAD_INDEX, g_area_reload_behavior);
- set_entry(SV_CURSOR_COLOR_INDEX, g_cursor_color);
- set_entry(SV_FONT_INDEX, g_font);
+ set_entry(SV_CHEATS_INDEX, mCheats);
+ set_entry(SV_TOOLS_INDEX, mTools);
+ set_entry(SV_SCENE_INDEX, mSceneFlags);
+ set_entry(SV_WATCHES_INDEX, mWatches);
+ set_entry(SV_SPRITES_INDEX, mSpriteOffsets);
+ set_entry(SV_COMMANDS, mCommandStates);
+ set_entry(SV_DROP_SHADOW_INDEX, mDropShadows);
+ set_entry(SV_AREA_RELOAD_INDEX, mReloadType);
+ set_entry(SV_CURSOR_COLOR_INDEX, mCursorColType);
+ set_entry(SV_FONT_INDEX, mFontType);
#undef set_entry
}
-int32_t read_save_file(Storage* storage, GZSaveFile& save_file, int32_t sector_size) {
+int32_t GZ_readSaveFile(Storage* storage, GZSaveFile& save_file, int32_t sector_size) {
int32_t result = Ready;
#define assert_result(stmt) \
if ((result = (stmt)) != Ready) { \
@@ -131,65 +128,65 @@ int32_t read_save_file(Storage* storage, GZSaveFile& save_file, int32_t sector_s
uint32_t pos = 0;
assert_result(
- storage_read(storage, &save_file.header, sizeof(save_file.header), pos, sector_size));
+ GZ_storageRead(storage, &save_file.header, sizeof(save_file.header), pos, sector_size));
pos += sizeof(save_file.header);
if (save_file.header.version != GZ_SAVE_VERSION_NUMBER) {
return -30; // Custom error code for "Version" (means a mismatch in the version number).
}
- assert_result(storage_read(storage, save_file.offsets,
- save_file.header.entries * sizeof(save_file.offsets[0]),
- save_file.header.offsetsLoc, sector_size));
- assert_result(storage_read(storage, save_file.sizes,
- save_file.header.entries * sizeof(save_file.sizes[0]),
- save_file.header.sizesLoc, sector_size));
+ assert_result(GZ_storageRead(storage, save_file.offsets,
+ save_file.header.entries * sizeof(save_file.offsets[0]),
+ save_file.header.offsetsLoc, sector_size));
+ assert_result(GZ_storageRead(storage, save_file.sizes,
+ save_file.header.entries * sizeof(save_file.sizes[0]),
+ save_file.header.sizesLoc, sector_size));
#define assert_read_entry(idx, ptr, size) \
if (idx < save_file.header.entries) { \
- assert_result(storage_read(storage, ptr, MIN(size, save_file.sizes[idx]), \
- save_file.offsets[idx], sector_size)); \
+ assert_result(GZ_storageRead(storage, ptr, MIN(size, save_file.sizes[idx]), \
+ save_file.offsets[idx], sector_size)); \
}
- assert_read_entry(SV_CHEATS_INDEX, save_file.data.CheatItems,
- sizeof(save_file.data.CheatItems));
- assert_read_entry(SV_TOOLS_INDEX, save_file.data.ToolItems, sizeof(save_file.data.ToolItems));
- assert_read_entry(SV_SCENE_INDEX, save_file.data.SceneItems, sizeof(save_file.data.SceneItems));
- assert_read_entry(SV_WATCHES_INDEX, save_file.data.Watches, sizeof(save_file.data.Watches));
- assert_read_entry(SV_SPRITES_INDEX, save_file.data.sprite_offsets,
- sizeof(save_file.data.sprite_offsets));
- assert_read_entry(SV_COMMANDS, save_file.data.commands_states,
- sizeof(save_file.data.commands_states));
- assert_read_entry(SV_DROP_SHADOW_INDEX, &save_file.data.g_drop_shadows,
- sizeof(save_file.data.g_drop_shadows));
- assert_read_entry(SV_AREA_RELOAD_INDEX, &save_file.data.g_area_reload_behavior,
- sizeof(save_file.data.g_area_reload_behavior));
- assert_read_entry(SV_CURSOR_COLOR_INDEX, &save_file.data.g_cursor_color,
- sizeof(save_file.data.g_cursor_color));
- assert_read_entry(SV_FONT_INDEX, &save_file.data.g_font, sizeof(save_file.data.g_font));
+ assert_read_entry(SV_CHEATS_INDEX, save_file.data.mCheats, sizeof(save_file.data.mCheats));
+ assert_read_entry(SV_TOOLS_INDEX, save_file.data.mTools, sizeof(save_file.data.mTools));
+ assert_read_entry(SV_SCENE_INDEX, save_file.data.mSceneFlags,
+ sizeof(save_file.data.mSceneFlags));
+ assert_read_entry(SV_WATCHES_INDEX, save_file.data.mWatches, sizeof(save_file.data.mWatches));
+ assert_read_entry(SV_SPRITES_INDEX, save_file.data.mSpriteOffsets,
+ sizeof(save_file.data.mSpriteOffsets));
+ assert_read_entry(SV_COMMANDS, save_file.data.mCommandStates,
+ sizeof(save_file.data.mCommandStates));
+ assert_read_entry(SV_DROP_SHADOW_INDEX, &save_file.data.mDropShadows,
+ sizeof(save_file.data.mDropShadows));
+ assert_read_entry(SV_AREA_RELOAD_INDEX, &save_file.data.mReloadType,
+ sizeof(save_file.data.mReloadType));
+ assert_read_entry(SV_CURSOR_COLOR_INDEX, &save_file.data.mCursorColType,
+ sizeof(save_file.data.mCursorColType));
+ assert_read_entry(SV_FONT_INDEX, &save_file.data.mFontType, sizeof(save_file.data.mFontType));
#undef assert_read_entry
#undef assert_result
return result;
}
-int32_t read_memfile(Storage* storage, PositionData& posData, int32_t sector_size) {
+int32_t GZ_readMemfile(Storage* storage, PositionData& posData, int32_t sector_size) {
int32_t result = Ready;
#define assert_result(stmt) \
if ((result = (stmt)) != Ready) { \
return result; \
}
- assert_result(storage_read(storage, (void*)sTmpBuf, sizeof(dSv_info_c), 0, sector_size));
+ assert_result(GZ_storageRead(storage, (void*)sTmpBuf, sizeof(dSv_info_c), 0, sector_size));
assert_result(
- storage_read(storage, &posData, sizeof(posData), sizeof(dSv_info_c) + 1, sector_size));
+ GZ_storageRead(storage, &posData, sizeof(posData), sizeof(dSv_info_c) + 1, sector_size));
#undef assert_result
return result;
}
-void store_mem_card(Storage& storage) {
+void GZ_storeMemCard(Storage& storage) {
GZSaveFile save_file;
- Utilities::setup_save_file(save_file);
- Utilities::store_save_layout(save_file.data);
+ GZ_setupSaveFile(save_file);
+ GZ_storeSaveLayout(save_file.data);
uint32_t file_size = (uint32_t)(
tp_ceil((double)sizeof(save_file) / (double)storage.sector_size) * storage.sector_size);
storage.result = StorageDelete(0, storage.file_name_buffer);
@@ -197,8 +194,8 @@ void store_mem_card(Storage& storage) {
if (storage.result == Ready || storage.result == Exist) {
storage.result = StorageOpen(0, storage.file_name_buffer, &storage.info, OPEN_MODE_RW);
if (storage.result == Ready) {
- storage.result = Utilities::storage_write(&storage, &save_file, sizeof(save_file), 0,
- storage.sector_size);
+ storage.result =
+ GZ_storageWrite(&storage, &save_file, sizeof(save_file), 0, storage.sector_size);
if (storage.result == Ready) {
tp_osReport("saved card!");
FIFOQueue::push("saved card!", Queue);
@@ -213,7 +210,7 @@ void store_mem_card(Storage& storage) {
}
}
-void store_memfile(Storage& storage) {
+void GZ_storeMemfile(Storage& storage) {
PositionData posData;
posData.link = dComIfGp_getPlayer()->mCurrent.mPosition;
posData.cam.target = tp_matrixInfo.matrix_info->target;
@@ -233,10 +230,10 @@ void store_memfile(Storage& storage) {
setReturnPlace(g_dComIfG_gameInfo.play.mStartStage.mStage,
g_dComIfG_gameInfo.play.mEvent.field_0x12c, 0);
- storage.result = Utilities::storage_write(&storage, &g_dComIfG_gameInfo,
- sizeof(dSv_info_c), 0, storage.sector_size);
- storage.result = Utilities::storage_write(&storage, &posData, sizeof(posData),
- sizeof(dSv_info_c) + 1, storage.sector_size);
+ storage.result = GZ_storageWrite(&storage, &g_dComIfG_gameInfo, sizeof(dSv_info_c), 0,
+ storage.sector_size);
+ storage.result = GZ_storageWrite(&storage, &posData, sizeof(posData),
+ sizeof(dSv_info_c) + 1, storage.sector_size);
if (storage.result == Ready) {
FIFOQueue::push("saved memfile!", Queue);
} else {
@@ -249,7 +246,7 @@ void store_memfile(Storage& storage) {
}
}
-void delete_mem_card(Storage& storage) {
+void GZ_deleteMemCard(Storage& storage) {
storage.result = StorageDelete(0, storage.file_name_buffer);
if (storage.result == Ready) {
FIFOQueue::push("deleted card!", Queue);
@@ -260,7 +257,7 @@ void delete_mem_card(Storage& storage) {
}
}
-void delete_memfile(Storage& storage) {
+void GZ_deleteMemfile(Storage& storage) {
storage.result = StorageDelete(0, storage.file_name_buffer);
if (storage.result == Ready) {
FIFOQueue::push("deleted memfile!", Queue);
@@ -271,15 +268,15 @@ void delete_memfile(Storage& storage) {
}
}
-void load_mem_card(Storage& storage) {
+void GZ_loadMemCard(Storage& storage) {
storage.result = StorageOpen(0, storage.file_name_buffer, &storage.info, OPEN_MODE_RW);
if (storage.result == Ready) {
GZSaveFile save_file;
- store_save_layout(save_file.data);
- storage.result = read_save_file(&storage, save_file, storage.sector_size);
+ GZ_storeSaveLayout(save_file.data);
+ storage.result = GZ_readSaveFile(&storage, save_file, storage.sector_size);
if (storage.result == Ready) {
FIFOQueue::push("loaded card!", Queue);
- load_save_layout(save_file.data);
+ GZ_loadSaveLayout(save_file.data);
SettingsMenu::initFont();
} else {
char buff[32];
@@ -290,23 +287,23 @@ void load_mem_card(Storage& storage) {
}
}
-void load_memfile(Storage& storage) {
+void GZ_loadMemfile(Storage& storage) {
storage.result = StorageOpen(0, storage.file_name_buffer, &storage.info, OPEN_MODE_RW);
if (storage.result == Ready) {
PositionData posData;
- storage.result = read_memfile(&storage, posData, storage.sector_size);
+ storage.result = GZ_readMemfile(&storage, posData, storage.sector_size);
if (storage.result == Ready) {
FIFOQueue::push("loaded memfile!", Queue);
- inject_memfile_flag = true;
- SaveManager::inject_default_before();
- SaveManager::inject_memfile((void*)sTmpBuf);
- SaveManager::inject_default_during();
- SaveManager::inject_default_after();
- load_position_data(posData);
+ g_injectMemfile = true;
+ SaveManager::injectDefault_before();
+ SaveManager::injectMemfile((void*)sTmpBuf);
+ SaveManager::injectDefault_during();
+ SaveManager::injectDefault_after();
+ GZ_loadPositionData(posData);
set_position_data = true;
- inject_save_flag = true;
- fifo_visible = true;
- MenuRendering::set_menu(MN_NONE_INDEX);
+ g_injectSave = true;
+ g_fifoVisible = true;
+ GZ_setMenu(MN_NONE_INDEX);
} else {
char buff[32];
tp_sprintf(buff, "failed to load: %d", storage.result);
@@ -325,7 +322,7 @@ void load_memfile(Storage& storage) {
#define FILE_NAME "tpgz01.dat"
#endif // WII_PLATFORM
-void load_gz_card(bool& card_load) {
+void GZ_loadGZSave(bool& card_load) {
uint8_t frame_count = cCt_getFrameCount();
if (card_load && frame_count > FRAME_COUNT) {
static Storage storage;
@@ -335,13 +332,12 @@ void load_gz_card(bool& card_load) {
#ifndef WII_PLATFORM
storage.result = CARDProbeEx(0, NULL, &storage.sector_size);
if (storage.result == Ready) {
- Utilities::load_mem_card(storage);
+ GZ_loadMemCard(storage);
}
#else // WII_PLATFORM
- Utilities::load_mem_card(storage);
+ GZ_loadMemCard(storage);
#endif // WII_PLATFORM
card_load = false;
}
-}
-} // namespace Utilities \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/utils/cursor.cpp b/src/utils/cursor.cpp
index 005255d..e84cbff 100644
--- a/src/utils/cursor.cpp
+++ b/src/utils/cursor.cpp
@@ -1,47 +1,78 @@
#include "utils/cursor.h"
#include "controller.h"
+#include "menus/settings_menu.h"
-namespace Utilities {
-void move_cursor(Cursor& cursor, int max_cursor_y_value, int max_cursor_x_value, bool lock_x,
- bool lock_y, bool unrestricted, bool menu_with_list_lines) {
- if (!can_move_cursor && !unrestricted) {
+bool g_cursorEnabled = false;
+
+void Cursor::move(int max_x, int max_y) {
+ if (!g_cursorEnabled) {
return;
}
- if (button_is_pressed(Controller::DPAD_UP) && !lock_y) {
- // reset so other lines aren't affected
- cursor.x = 0;
- cursor.y > 0 ? cursor.y-- : cursor.y = max_cursor_y_value - 1;
+ if (GZ_getButtonRepeat(GZPad::DPAD_UP)) {
+ if (mode != MODE_UNRESTRICTED) {
+ x = 0; // reset so other lines aren't affected
+ }
+
+ if (!lock_y) {
+ y > 0 ? y-- : y = max_y - 1;
+ }
}
- if (button_is_pressed(Controller::DPAD_DOWN) && !lock_y) {
- // reset so other lines aren't affected
- cursor.x = 0;
- cursor.y < max_cursor_y_value - 1 ? cursor.y++ : cursor.y = 0;
+ if (GZ_getButtonRepeat(GZPad::DPAD_DOWN)) {
+ if (mode != MODE_UNRESTRICTED) {
+ x = 0; // reset so other lines aren't affected
+ }
+
+ if (!lock_y) {
+ y < max_y - 1 ? y++ : y = 0;
+ }
}
- if (button_is_pressed(Controller::DPAD_RIGHT)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_RIGHT)) {
// if y and x aren't locked, we must be on a single column menu
- if (!lock_y && !lock_x && !menu_with_list_lines) {
- cursor.y += 10;
- if (cursor.y > max_cursor_y_value - 1) {
- cursor.y = max_cursor_y_value - 1;
+ if (mode == MODE_SINGLE_COLUMN) {
+ y += 10;
+ if (y > max_y - 1) {
+ y = max_y - 1;
}
} else if (!lock_x) {
- cursor.x < max_cursor_x_value - 1 ? cursor.x++ : cursor.x = 0;
+ x < max_x - 1 ? x++ : x = 0;
}
}
- if (button_is_pressed(Controller::DPAD_LEFT)) {
+ if (GZ_getButtonRepeat(GZPad::DPAD_LEFT)) {
// if y and x aren't locked, we must be on a single column menu
- if (!lock_x && !lock_y && !menu_with_list_lines) {
- cursor.y -= 10;
- if (cursor.y < 0) {
- cursor.y = 0;
+ if (mode == MODE_SINGLE_COLUMN) {
+ y -= 10;
+ if (y < 0) {
+ y = 0;
}
} else if (!lock_x) {
- cursor.x > 0 ? cursor.x-- : cursor.x = max_cursor_x_value - 1;
+ x > 0 ? x-- : x = max_x - 1;
}
}
}
-} // namespace Utilities
+
+void GZ_setCursorColor() {
+ switch (g_cursorColorType) {
+ case CURSOR_GREEN:
+ g_cursorColor = 0x00CC00FF;
+ break;
+ case CURSOR_BLUE:
+ g_cursorColor = 0x0080FFFF;
+ break;
+ case CURSOR_RED:
+ g_cursorColor = 0xCC0000FF;
+ break;
+ case CURSOR_ORANGE:
+ g_cursorColor = 0xEE8000FF;
+ break;
+ case CURSOR_YELLOW:
+ g_cursorColor = 0xFFCC00FF;
+ break;
+ case CURSOR_PURPLE:
+ g_cursorColor = 0x6600CCFF;
+ break;
+ }
+}
diff --git a/src/utils/draw.cpp b/src/utils/draw.cpp
index ebe3e0e..11bb552 100644
--- a/src/utils/draw.cpp
+++ b/src/utils/draw.cpp
@@ -58,25 +58,25 @@ void end() {
GX_End();
}
-void draw_quad(uint32_t color, Vec2 p[4]) {
- draw_quad(color, p, &blankTex._texObj);
+void drawQuad(uint32_t color, Vec2 p[4]) {
+ drawQuad(color, p, &blankTex._texObj);
}
-void draw_quad(uint32_t color, Vec2 p[4], Vec2 tex[4]) {
- draw_quad(color, p, tex, &blankTex._texObj);
+void drawQuad(uint32_t color, Vec2 p[4], Vec2 tex[4]) {
+ drawQuad(color, p, tex, &blankTex._texObj);
}
-void draw_quad(uint32_t color, Vec2 p[4], GXTexObj* texture) {
+void drawQuad(uint32_t color, Vec2 p[4], GXTexObj* texture) {
Vec2 tex[4] = {
{0.0, 0.0},
{1.0, 0.0},
{1.0, 1.0},
{0.0, 1.0},
};
- draw_quad(color, p, tex, texture);
+ drawQuad(color, p, tex, texture);
}
-void draw_quad(uint32_t color, Vec2 p[4], Vec2 tex[4], GXTexObj* texture) {
+void drawQuad(uint32_t color, Vec2 p[4], Vec2 tex[4], GXTexObj* texture) {
begin(4, texture);
add_vertex(color, p[0], tex[0]);
add_vertex(color, p[1], tex[1]);
@@ -85,11 +85,11 @@ void draw_quad(uint32_t color, Vec2 p[4], Vec2 tex[4], GXTexObj* texture) {
end();
}
-void draw_quad_outline(uint32_t color, Vec2 p[4]) {
- draw_quad_outline(color, p, DEFAULT_WIDTH);
+void drawQuadOutline(uint32_t color, Vec2 p[4]) {
+ drawQuadOutline(color, p, DEFAULT_WIDTH);
}
-void draw_quad_outline(uint32_t color, Vec2 p[4], uint8_t width) {
+void drawQuadOutline(uint32_t color, Vec2 p[4], uint8_t width) {
begin_outline(5, width);
add_vertex(color, p[0], {0.0, 0.0});
add_vertex(color, p[1], {1.0, 0.0});
@@ -99,42 +99,42 @@ void draw_quad_outline(uint32_t color, Vec2 p[4], uint8_t width) {
end();
}
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim) {
- draw_rect(color, pos, dim, &blankTex._texObj);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim) {
+ drawRect(color, pos, dim, &blankTex._texObj);
}
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, GXTexObj* texture) {
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, GXTexObj* texture) {
Vec2 tex[4] = {
{0.0, 0.0},
{1.0, 0.0},
{1.0, 1.0},
{0.0, 1.0},
};
- draw_rect(color, pos, dim, tex, texture);
+ drawRect(color, pos, dim, tex, texture);
}
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4]) {
- draw_rect(color, pos, dim, tex, &blankTex._texObj);
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4]) {
+ drawRect(color, pos, dim, tex, &blankTex._texObj);
}
-void draw_rect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4], GXTexObj* texture) {
+void drawRect(uint32_t color, Vec2 pos, Vec2 dim, Vec2 tex[4], GXTexObj* texture) {
Vec2 vertices[4] = {{pos.x, pos.y},
{pos.x + dim.x, pos.y},
{pos.x + dim.x, pos.y + dim.y},
{pos.x, pos.y + dim.y}};
- draw_quad(color, vertices, tex, texture);
+ drawQuad(color, vertices, tex, texture);
}
-void draw_rect_outline(uint32_t color, Vec2 pos, Vec2 dim) {
- draw_rect_outline(color, pos, dim, DEFAULT_WIDTH);
+void drawRectOutline(uint32_t color, Vec2 pos, Vec2 dim) {
+ drawRectOutline(color, pos, dim, DEFAULT_WIDTH);
}
-void draw_rect_outline(uint32_t color, Vec2 pos, Vec2 dim, uint8_t width) {
+void drawRectOutline(uint32_t color, Vec2 pos, Vec2 dim, uint8_t width) {
Vec2 vertices[4] = {{pos.x, pos.y},
{pos.x + dim.x, pos.y},
{pos.x + dim.x, pos.y + dim.y},
{pos.x, pos.y + dim.y}};
- draw_quad_outline(color, vertices, width);
+ drawQuadOutline(color, vertices, width);
}
}; // namespace Draw
diff --git a/src/utils/hook.cpp b/src/utils/hook.cpp
index b66f36f..18371f7 100644
--- a/src/utils/hook.cpp
+++ b/src/utils/hook.cpp
@@ -10,6 +10,7 @@
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "utils/card.h"
#include "movelink.h"
+#include "menus/memfiles_menu.h"
#define HOOK_DEF(rettype, name, params) \
typedef rettype(*tp_##name##_t) params; \
@@ -20,10 +21,6 @@ HOOK_DEF(void, fapGm_Execute, (void));
HOOK_DEF(void, ExceptionCallback, (void));
HOOK_DEF(void, draw, (void*));
-struct PadStatus {
- uint8_t ok[12];
-};
-
#ifdef GCN_PLATFORM
#define PAD_READ_RETURN_OFFSET (0x2FC)
#endif
@@ -59,13 +56,14 @@ HOOK_DEF(void, offEventBit, (void*, uint16_t));
HOOK_DEF(void, onSwitch, (void*, int, int));
HOOK_DEF(void, putSave, (void*, int));
+HOOK_DEF(void, dCcS__draw, (void));
+HOOK_DEF(void, BeforeOfPaint, (void));
+
struct {
uint32_t a[2];
} trampolines[HOOK_AMNT];
namespace Hook {
-using namespace mod::patch;
-
void initHook(void* p1, void* p2, void* p3) {
cDyl_InitAsyncTrampoline(p1, p2, p3);
init();
@@ -93,12 +91,12 @@ void myExceptionCallbackHook(void) {
uint32_t readControllerHook(uint16_t* p1) {
auto returnValue = PADReadTrampoline(p1);
- Controller::read_controller();
+ GZ_readController();
return returnValue;
}
uint32_t superClawshotHook(void* p1, void* p2) {
- if (CheatItems[Cheats::SuperClawshot].active) {
+ if (g_cheats[SuperClawshot].active) {
return 1;
} else {
return checkHookshotStickBGTrampoline(p1, p2);
@@ -106,7 +104,7 @@ uint32_t superClawshotHook(void* p1, void* p2) {
}
void disableGravityHook(float p1, float p2, int p3) {
- if (move_link_active) {
+ if (g_moveLinkEnabled) {
return setSpecialGravityTrampoline(0.0f, p2, p3);
} else {
return setSpecialGravityTrampoline(p1, p2, p3);
@@ -114,7 +112,7 @@ void disableGravityHook(float p1, float p2, int p3) {
}
uint32_t unrestrictedItemsHook(uint16_t p1) {
- if (CheatItems[Cheats::UnrestrictedItems].active) {
+ if (g_cheats[UnrestrictedItems].active) {
return 1;
} else {
return checkCastleTownUseItemTrampoline(p1);
@@ -122,7 +120,7 @@ uint32_t unrestrictedItemsHook(uint16_t p1) {
}
uint32_t transformAnywhereHook(void* p1, void* p2, int p3) {
- if (CheatItems[Cheats::TransformAnywhere].active) {
+ if (g_cheats[TransformAnywhere].active) {
return 0;
} else {
return query042Trampoline(p1, p2, p3);
@@ -131,7 +129,7 @@ uint32_t transformAnywhereHook(void* p1, void* p2, int p3) {
static char buf[40];
void onEventBitHook(void* addr, uint16_t pFlag) {
- if (g_flag_log_active) {
+ if (g_flagLogEnabled) {
if (addr == &g_dComIfG_gameInfo.info.mTmp) {
tp_sprintf(buf, "%s[0x%X] : %X | ON", "Event Tmp", pFlag >> 8, pFlag & 0xFF);
} else {
@@ -144,7 +142,7 @@ void onEventBitHook(void* addr, uint16_t pFlag) {
}
void offEventBitHook(void* addr, uint16_t pFlag) {
- if (g_flag_log_active) {
+ if (g_flagLogEnabled) {
if (addr == &g_dComIfG_gameInfo.info.mTmp) {
tp_sprintf(buf, "%s[0x%X] : %X | OFF", "Event Tmp", pFlag >> 8, pFlag & 0xFF);
} else {
@@ -158,7 +156,7 @@ void offEventBitHook(void* addr, uint16_t pFlag) {
void onSwitchHook(void* addr, int pFlag, int i_roomNo) {
int tmp = pFlag;
- if (g_flag_log_active) {
+ if (g_flagLogEnabled) {
if (pFlag < 0x80) {
tp_sprintf(buf, "%s[%d] : %d | ON", "Memory Switch", tmp >> 5, tmp & 0x1F);
} else if (pFlag < 0xC0) {
@@ -178,14 +176,14 @@ void onSwitchHook(void* addr, int pFlag, int i_roomNo) {
// Stops temp flags from being stored to save when loading memfile
void putSaveHook(void* addr, int stageNo) {
- if (inject_memfile_flag) {
+ if (g_injectMemfile) {
return;
} else {
return putSaveTrampoline(addr, stageNo);
}
}
-void apply_hooks() {
+void applyHooks() {
#define APPLY_HOOK(name, addr, idx, func) \
name##Trampoline = hookFunction((tp_##name##_t)addr, trampolines[idx].a, func)
APPLY_HOOK(cDyl_InitAsync, tp_cDyl_InitAsync_addr, HK_LIB_INIT_INDEX, initHook);
diff --git a/src/utils/lines.cpp b/src/utils/lines.cpp
index 0ff9fb0..6315b0f 100644
--- a/src/utils/lines.cpp
+++ b/src/utils/lines.cpp
@@ -6,22 +6,21 @@
#include "utils/draw.h"
#include "utils/texture.h"
-int cursor_rgba;
+int g_cursorColor;
int min_line = 0;
int max_line = 15;
-float max_value_f(float a, float b) {
+float maxF(float a, float b) {
return MAX(a, b);
}
-namespace Utilities {
-void render_lines(Line input_lines[], int cursor, int LINES) {
- float x_offset = sprite_offsets[MENU_INDEX].x;
+void GZ_drawMenuLines(Line input_lines[], int cursor, int LINES) {
+ float x_offset = g_spriteOffsets[MENU_INDEX].x;
float y_offset = 0.0f;
float max_line_width = 0.0f;
for (int i = 0; i < LINES; ++i) {
- max_line_width = max_value_f(max_line_width, Font::get_chars_width(input_lines[i].line));
+ max_line_width = maxF(max_line_width, Font::getStrWidth(input_lines[i].line));
}
if (LINES <= MAX_RENDER_LINES) {
@@ -42,9 +41,9 @@ void render_lines(Line input_lines[], int cursor, int LINES) {
if (i > max_line || i < min_line) {
continue;
}
- y_offset = (sprite_offsets[MENU_INDEX].y + (i - min_line) * 20.0f);
+ y_offset = (g_spriteOffsets[MENU_INDEX].y + (i - min_line) * 20.0f);
- int cursor_color = cursor_rgba;
+ int cursor_color = g_cursorColor;
int description_color = 0xFFFFFF00;
int description_alpha = 0xFF;
@@ -58,57 +57,24 @@ void render_lines(Line input_lines[], int cursor, int LINES) {
// logic for lines that are toggleable
if (input_lines[i].toggleable) {
if (*input_lines[i].activation_flag) {
- Font::gz_renderChars(" [X]", x_offset + max_line_width, y_offset, cursor_color,
- g_drop_shadows);
+ Font::GZ_drawStr(" [X]", x_offset + max_line_width, y_offset, cursor_color,
+ g_dropShadows);
} else {
- Font::gz_renderChars(" [ ]", x_offset + max_line_width, y_offset, cursor_color,
- g_drop_shadows);
+ Font::GZ_drawStr(" [ ]", x_offset + max_line_width, y_offset, cursor_color,
+ g_dropShadows);
}
- Font::gz_renderChars(input_lines[i].line, x_offset, y_offset, cursor_color,
- g_drop_shadows);
+ Font::GZ_drawStr(input_lines[i].line, x_offset, y_offset, cursor_color, g_dropShadows);
} else {
- Font::gz_renderChars(input_lines[i].line, x_offset, y_offset, cursor_color,
- g_drop_shadows);
- Font::gz_renderChars(input_lines[i].value, x_offset + max_line_width, y_offset,
- cursor_color, g_drop_shadows);
+ Font::GZ_drawStr(input_lines[i].line, x_offset, y_offset, cursor_color, g_dropShadows);
+ Font::GZ_drawStr(input_lines[i].value, x_offset + max_line_width, y_offset,
+ cursor_color, g_dropShadows);
}
// render line descriptions
if (input_lines[i].idx == cursor) {
- Font::gz_renderChars(input_lines[i].description, x_offset, 440.f, 0x00000000, true);
+ Font::GZ_drawStr(input_lines[i].description, x_offset, 440.f, 0x00000000, true);
}
- Font::gz_renderChars(input_lines[i].description, x_offset, 440.f, description_color, false);
- };
-}
-
-void change_cursor_color() {
- switch (g_cursor_color) {
- case CURSOR_GREEN: {
- cursor_rgba = 0x00CC00FF;
- break;
- }
- case CURSOR_BLUE: {
- cursor_rgba = 0x0080FFFF;
- break;
- }
- case CURSOR_RED: {
- cursor_rgba = 0xCC0000FF;
- break;
- }
- case CURSOR_ORANGE: {
- cursor_rgba = 0xEE8000FF;
- break;
- }
- case CURSOR_YELLOW: {
- cursor_rgba = 0xFFCC00FF;
- break;
- }
- case CURSOR_PURPLE: {
- cursor_rgba = 0x6600CCFF;
- break;
- }
+ Font::GZ_drawStr(input_lines[i].description, x_offset, 440.f, description_color, false);
}
}
-
-} // namespace Utilities
diff --git a/src/utils/link.cpp b/src/utils/link.cpp
index b4aed1d..1e91595 100644
--- a/src/utils/link.cpp
+++ b/src/utils/link.cpp
@@ -2,158 +2,55 @@
#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
-#include "menus/tools_menu.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/m_Do/m_Do_audio.h"
-uint8_t red;
-uint8_t green;
-uint8_t blue;
+void GZ_displayLinkInfo() {
+ char time[12];
+ tp_sprintf(time, "time: %02d:%02d", g_mDoAud_zelAudio.mAudioMgr.mStatusMgr.mHour,
+ g_mDoAud_zelAudio.mAudioMgr.mStatusMgr.mMinute);
+ Font::GZ_drawStr(time, g_spriteOffsets[DEBUG_INFO_INDEX].x, g_spriteOffsets[DEBUG_INFO_INDEX].y,
+ 0xFFFFFFFF, g_dropShadows);
-namespace Utilities {
-void show_link_debug_info() {
if (dComIfGp_getPlayer()) {
char link_angle[20];
- // char vspeed[4];
+ char y_angle[20];
char link_speed[20];
char link_x[20];
char link_y[20];
char link_z[20];
tp_sprintf(link_angle, "angle: %d", (uint16_t)dComIfGp_getPlayer()->mCollisionRot.mY);
+ tp_sprintf(y_angle, "y-angle: %d", dComIfGp_getPlayer()->mLookAngleY);
tp_sprintf(link_speed, "speed: %.4f", dComIfGp_getPlayer()->mSpeedF);
tp_sprintf(link_x, "x-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.x);
tp_sprintf(link_y, "y-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.y);
tp_sprintf(link_z, "z-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.z);
- Font::gz_renderChars(link_angle, sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y, 0xFFFFFFFF, g_drop_shadows);
- Font::gz_renderChars(link_speed, sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 20.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars(link_x, sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 40.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars(link_y, sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 60.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars(link_z, sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 80.0f, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(link_angle, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 20.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(y_angle, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 40.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(link_speed, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 60.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(link_x, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 80.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(link_y, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 100.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(link_z, g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 120.0f, 0xFFFFFFFF, g_dropShadows);
} else {
- Font::gz_renderChars("angle: n/a", sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y, 0xFFFFFFFF, g_drop_shadows);
- Font::gz_renderChars("speed: n/a", sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 20.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars("x-pos: n/a", sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 40.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars("y-pos: n/a", sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 60.0f, 0xFFFFFFFF,
- g_drop_shadows);
- Font::gz_renderChars("z-pos: n/a", sprite_offsets[DEBUG_INFO_INDEX].x,
- sprite_offsets[DEBUG_INFO_INDEX].y + 80.0f, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr("angle: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 20.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr("y-angle: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 40.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr("speed: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 60.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr("x-pos: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 80.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr("y-pos: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 100.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr("z-pos: n/a", g_spriteOffsets[DEBUG_INFO_INDEX].x,
+ g_spriteOffsets[DEBUG_INFO_INDEX].y + 120.0f, 0xFFFFFFFF, g_dropShadows);
}
-}
-void change_tunic_color() {
- if (dComIfGp_getPlayer()) {
- int16_t red_ = 0;
- int16_t green_ = 0;
- int16_t blue_ = 0;
- switch (g_tunic_color) {
- case GREEN: // passthrough
- default: {
- red_ = 0x10;
- green_ = 0x10;
- blue_ = 0x10;
- break;
- }
- case BLUE: {
- red_ = 0x00;
- green_ = 0x08;
- blue_ = 0x20;
- break;
- }
- case RED: {
- red_ = 0x18;
- green_ = 0x00;
- blue_ = 0x00;
- break;
- }
- case ORANGE: {
- red_ = 0x20;
- green_ = 0x10;
- blue_ = 0x00;
- break;
- }
- case YELLOW: {
- red_ = 0x20;
- green_ = 0x20;
- blue_ = 0x00;
- break;
- }
- case WHITE: {
- red_ = 0x20;
- green_ = 0x1C;
- blue_ = 0x20;
- break;
- }
- case CYCLE: {
- if (red < 0x0010 && (green == 0x0000 && blue == 0x0000)) {
- red += 0x0001;
- } else if (green < 0x0010 && (blue == 0x0000 && red == 0x0010)) {
- green += 0x0001;
- } else if (blue < 0x0010 && (green == 0x0010 && red == 0x0010)) {
- blue += 0x0001;
- } else if (red > 0x0000 && (green == 0x0010 && blue == 0x0010)) {
- red -= 0x0001;
- } else if (green > 0x0000 && (blue == 0x0010 && red == 0x0000)) {
- green -= 0x0001;
- } else {
- blue -= 0x0001;
- }
- red_ = red;
- green_ = green;
- blue_ = blue;
- break;
- }
- }
-#ifdef GCN_PLATFORM
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.r = red_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.g = green_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.b = blue_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.r = red_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.g = green_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.b = blue_ - 0x10;
-#endif
-#ifdef WII_PLATFORM
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.r = red_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.g = green_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[0].mColor.b = blue_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.r = red_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.g = green_ - 0x10;
- dComIfGp_getPlayer()->field_0x32a0[1].mColor.b = blue_ - 0x10;
- // g_dComIfG_gameInfo.link_tunic_ptr->not_tunic_red = 1;
- // g_dComIfG_gameInfo.link_tunic_ptr->tunic_red = red_ - 0x10;
- // g_dComIfG_gameInfo.link_tunic_ptr->tunic_green = green_ - 0x10;
- // g_dComIfG_gameInfo.link_tunic_ptr->tunic_blue = blue_ - 0x10;
-#endif
- }
-}
-} // namespace Utilities
-
-// temp -
-// patch setWaterDropEffect back to it's original code
-// tp_memset((void *)0x801244a4, 0xB0, 1);
-// tp_memset((void *)0x801244a5, 0x03, 1);
-// tp_memset((void *)0x801244a6, 0x32, 1);
-// tp_memset((void *)0x801244a7, 0xA0, 1);
-// tp_memset((void *)0x801244a8, 0xB0, 1);
-// tp_memset((void *)0x801244a9, 0x03, 1);
-// tp_memset((void *)0x801244aa, 0x32, 1);
-// tp_memset((void *)0x801244ab, 0xA2, 1);
-// tp_memset((void *)0x801244ac, 0xB0, 1);
-// tp_memset((void *)0x801244ad, 0x03, 1);
-// tp_memset((void *)0x801244ae, 0x32, 1);
-// tp_memset((void *)0x801244af, 0xA4, 1); \ No newline at end of file
+} \ No newline at end of file
diff --git a/src/utils/loading.cpp b/src/utils/loading.cpp
deleted file mode 100644
index 9500fab..0000000
--- a/src/utils/loading.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "utils/loading.h"
-#include "fifo_queue.h"
-#include "fs.h"
-#include "libtp_c/include/msl_c/string.h"
-#include "menus/practice_menu.h"
-#include "libtp_c/include/f_op/f_op_draw_tag.h"
-#include "libtp_c/include/m_Do/m_Do_audio.h"
-#include "libtp_c/include/d/com/d_com_inf_game.h"
-#include "libtp_c/include/m_Do/m_Do_printf.h"
-#include "menus/any_saves_menu.h"
-#include "save_manager.h"
-
-namespace Utilities {
-
-void set_camera_angle_position() {
- tp_matrixInfo.matrix_info->target = gSaveManager.mPracticeSaveInfo.cam_target;
- tp_matrixInfo.matrix_info->pos = gSaveManager.mPracticeSaveInfo.cam_pos;
- dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
- cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
- gSaveManager.mPracticeSaveInfo.position.z);
- dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
- tp_osReport("%d", gSaveManager.mPracticeSaveInfo.angle);
- tp_osReport("0x%08X", &gSaveManager.mPracticeSaveInfo.angle);
-}
-
-void set_angle_position() {
- dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
-
- cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
- gSaveManager.mPracticeSaveInfo.position.z);
- dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
-}
-
-} // namespace Utilities \ No newline at end of file
diff --git a/src/utils/memory.cpp b/src/utils/memory.cpp
index f107355..fd59d40 100644
--- a/src/utils/memory.cpp
+++ b/src/utils/memory.cpp
@@ -2,110 +2,126 @@
#include "libtp_c/include/msl_c/string.h"
#include "menus/memory_menu.h"
#include "menus/settings_menu.h"
+#include "libtp_c/include/JSystem/JKernel/JKRExpHeap.h"
-namespace Utilities {
-void render_active_watches() {
+void GZ_drawWatches() {
for (int i = 0; i < MAX_WATCHES; i++) {
- if (Watches[i].visible) {
+ if (g_watches[i].visible) {
char rendered_value[8];
- switch (Watches[i].type) {
- case u32: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%08X" : "%u",
- *(uint32_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ switch (g_watches[i].type) {
+ case u32:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(
+ rendered_value, g_watches[i].hex ? "%08X" : "%u",
+ *(uint32_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%08X" : "%u",
- *(uint32_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%08X" : "%u",
+ *(uint32_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case u16: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%04X" : "%u",
- *(uint16_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ case u16:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(
+ rendered_value, g_watches[i].hex ? "%04X" : "%u",
+ *(uint16_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%04X" : "%u",
- *(uint16_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%04X" : "%u",
+ *(uint16_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case u8: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%02X" : "%u",
- *(uint8_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ case u8:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%02X" : "%u",
+ *(uint8_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%02X" : "%u",
- *(uint8_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%02X" : "%u",
+ *(uint8_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case i32: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%08X" : "%i",
- *(int32_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ case i32:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%08X" : "%i",
+ *(int32_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%08X" : "%i",
- *(int32_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%08X" : "%i",
+ *(int32_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case i16: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%04X" : "%i",
- *(int16_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ case i16:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%04X" : "%i",
+ *(int16_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%04X" : "%i",
- *(int16_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%04X" : "%i",
+ *(int16_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case i8: {
- if (Watches[i].offset > 0x0000) {
- tp_sprintf(rendered_value, Watches[i].hex ? "%02X" : "%i",
- *(int8_t*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ case i8:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%02X" : "%i",
+ *(int8_t*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, Watches[i].hex ? "%02X" : "%i",
- *(int8_t*)Watches[i].address);
+ tp_sprintf(rendered_value, g_watches[i].hex ? "%02X" : "%i",
+ *(int8_t*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case f32: {
- if (Watches[i].offset > 0x0000) {
+ case f32:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
tp_sprintf(rendered_value, "%.2f",
- *(float*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ *(float*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, "%.2f", *(float*)Watches[i].address);
+ tp_sprintf(rendered_value, "%.2f", *(float*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
- }
- case string: {
- if (Watches[i].offset > 0x0000) {
+ case string:
+ if (g_watches[i].offset > 0x0000 && *(uint32_t*)g_watches[i].address != 0) {
tp_sprintf(rendered_value, "%s",
- (char*)(*(uint32_t*)Watches[i].address + Watches[i].offset));
+ (char*)(*(uint32_t*)g_watches[i].address + g_watches[i].offset));
} else {
- tp_sprintf(rendered_value, "%s", (char*)Watches[i].address);
+ tp_sprintf(rendered_value, "%s", (char*)g_watches[i].address);
}
- Font::gz_renderChars(rendered_value, Watches[i].x, Watches[i].y, 0xFFFFFFFF,
- g_drop_shadows);
+ Font::GZ_drawStr(rendered_value, g_watches[i].x, g_watches[i].y, 0xFFFFFFFF,
+ g_dropShadows);
break;
}
- }
- // logic to draw the watch
}
}
}
-} // namespace Utilities \ No newline at end of file
+
+void GZ_drawHeapInfo() {
+ if (zeldaHeap && gameHeap && archiveHeap) {
+ uint32_t zeldaFree = JKRHeap__getFreeSize(zeldaHeap);
+ uint32_t zeldaTotal = JKRHeap__getTotalFreeSize(zeldaHeap);
+ uint32_t gameFree = JKRHeap__getFreeSize(gameHeap);
+ uint32_t gameTotal = JKRHeap__getTotalFreeSize(gameHeap);
+ uint32_t archiveFree = JKRHeap__getFreeSize(archiveHeap);
+ uint32_t archiveTotal = JKRHeap__getTotalFreeSize(archiveHeap);
+
+ Font::GZ_drawStr("-- Heap Free / Total Free (KB) --", 145.0f, 25.0f, 0xFFFFFFFF,
+ g_dropShadows);
+ char zelBuf[22];
+ tp_sprintf(zelBuf, " Zelda %5d / %5d", zeldaFree >> 10, zeldaTotal >> 10);
+ char gameBuf[22];
+ tp_sprintf(gameBuf, " Game %5d / %5d", gameFree >> 10, gameTotal >> 10);
+ char arcBuf[22];
+ tp_sprintf(arcBuf, "Archive %5d / %5d", archiveFree >> 10, archiveTotal >> 10);
+
+ Font::GZ_drawStr(zelBuf, 200.0f, 45.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(gameBuf, 200.0f, 65.0f, 0xFFFFFFFF, g_dropShadows);
+ Font::GZ_drawStr(arcBuf, 200.0f, 85.0f, 0xFFFFFFFF, g_dropShadows);
+ }
+} \ No newline at end of file