From b21f0d33975b2c180967413b06a89a1ddef48451 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Thu, 10 Mar 2022 19:25:01 -0500 Subject: [PATCH] Add PC Port settings to legit start menu (#1217) * decompiler: support adding new strings to the game_text.txt file * gsrc: expand the pckernel type and functions to work better with the menu * gsrc: add new text-ids * gsrc: add new macros to help with menu code * gsrc: make a new type to generalize their list menu options * gsrc: add new menu options and enums * gsrc: cleanup and refactor the list menu option drawing code this allows us to easily add a new list menu option...well as easy as the rest is atleast (setting up static lists properly, etc) * gsrc: add and cleanup handling of new menu options * scripts: add checks with nice error messages for user facing taskfile recipes * lint: formatting * address simple feedback * gsrc: move modified files to `pc/` folder * gsrc: revert changes to originally decompiled files * gsrc: move modified and new files to `goal_src/pc` folder * gsrc: update paths in `all_files.gc` --- Taskfile.yml | 12 + decompiler/ObjectFile/ObjectFileDB.cpp | 6 +- decompiler/ObjectFile/ObjectFileDB.h | 2 +- decompiler/config.cpp | 13 + decompiler/config.h | 3 + decompiler/config/all-types.gc | 4 +- decompiler/config/jak1_ntsc_black_label.jsonc | 1 + .../config/jak1_ntsc_black_label/hacks.jsonc | 2 +- .../jak1_ntsc_black_label/label_types.jsonc | 16 +- .../jak1_ntsc_black_label/new_strings.jsonc | 56 + .../stack_structures.jsonc | 8 +- .../jak1_ntsc_black_label/type_casts.jsonc | 16 +- decompiler/data/game_text.cpp | 33 +- decompiler/data/game_text.h | 2 + decompiler/main.cpp | 2 +- goal_src/build/all_files.gc | 6 +- goal_src/engine/debug/default-menu.gc | 6 +- goal_src/engine/ui/progress-h.gc | 1 - goal_src/engine/ui/progress/progress-draw.gc | 1 - .../engine/ui/progress/progress-static.gc | 1 - goal_src/engine/ui/progress/progress.gc | 1 - goal_src/engine/ui/text-h.gc | 5 +- goal_src/engine/ui/text.gc | 4 +- goal_src/game.gp | 21 +- goal_src/goal-lib.gc | 36 + goal_src/pc/README.md | 3 + goal_src/pc/engine/ui/progress-h.gc | 271 ++ .../pc/engine/ui/progress/progress-draw.gc | 2155 +++++++++++++ .../pc/engine/ui/progress/progress-static.gc | 1515 +++++++++ goal_src/pc/engine/ui/progress/progress.gc | 2732 +++++++++++++++++ goal_src/pc/engine/ui/text-h.gc | 560 ++++ goal_src/{engine => }/pc/pckernel-h.gc | 19 +- goal_src/{engine => }/pc/pckernel.gc | 100 +- goal_src/{engine => }/pc/subtitle.gc | 0 scripts/tasks/Taskfile_darwin.yml | 1 + scripts/tasks/Taskfile_linux.yml | 1 + scripts/tasks/Taskfile_windows.yml | 1 + scripts/update-game-text-id.py | 19 + 38 files changed, 7547 insertions(+), 88 deletions(-) create mode 100644 decompiler/config/jak1_ntsc_black_label/new_strings.jsonc create mode 100644 goal_src/pc/README.md create mode 100644 goal_src/pc/engine/ui/progress-h.gc create mode 100644 goal_src/pc/engine/ui/progress/progress-draw.gc create mode 100644 goal_src/pc/engine/ui/progress/progress-static.gc create mode 100644 goal_src/pc/engine/ui/progress/progress.gc create mode 100644 goal_src/pc/engine/ui/text-h.gc rename goal_src/{engine => }/pc/pckernel-h.gc (96%) rename goal_src/{engine => }/pc/pckernel.gc (90%) rename goal_src/{engine => }/pc/subtitle.gc (100%) diff --git a/Taskfile.yml b/Taskfile.yml index 6558388b53..140eaf953b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,17 +6,29 @@ includes: tasks: # GENERAL extract-jak1: + preconditions: + - sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/decompiler{{.EXE_FILE_EXTENSION}} + msg: "Couldn't locate decompiler executable -- Have you compiled in release mode?" cmds: - '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/jak1_ntsc_black_label.jsonc" "./iso_data" "./decompiler_out" "decompile_code=false"' boot-game: + preconditions: + - sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} + msg: "Couldn't locate runtime executable -- Have you compiled in release mode?" cmds: - "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v" run-game: + preconditions: + - sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} + msg: "Couldn't locate runtime executable -- Have you compiled in release mode?" cmds: - "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso -debug -v" repl: env: OPENGOAL_DECOMP_DIR: "jak1/" + preconditions: + - sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/goalc{{.EXE_FILE_EXTENSION}} + msg: "Couldn't locate compiler executable -- Have you compiled in release mode?" cmds: - "{{.GOALC_BIN_RELEASE_DIR}}/goalc" # DEVELOPMENT diff --git a/decompiler/ObjectFile/ObjectFileDB.cpp b/decompiler/ObjectFile/ObjectFileDB.cpp index 76a1207950..a25cc16040 100644 --- a/decompiler/ObjectFile/ObjectFileDB.cpp +++ b/decompiler/ObjectFile/ObjectFileDB.cpp @@ -615,7 +615,7 @@ std::string ObjectFileDB::process_tpages(TextureDB& tex_db) { return result; } -std::string ObjectFileDB::process_game_text_files(GameTextVersion version) { +std::string ObjectFileDB::process_game_text_files(const Config& cfg) { lg::info("- Finding game text..."); std::string text_string = "COMMON"; Timer timer; @@ -627,7 +627,7 @@ std::string ObjectFileDB::process_game_text_files(GameTextVersion version) { for_each_obj([&](ObjectFileData& data) { if (data.name_in_dgo.substr(1) == text_string) { file_count++; - auto statistics = process_game_text(data, version); + auto statistics = process_game_text(data, cfg.text_version); string_count += statistics.total_text; char_count += statistics.total_chars; if (text_by_language_by_id.find(statistics.language) != text_by_language_by_id.end()) { @@ -643,7 +643,7 @@ std::string ObjectFileDB::process_game_text_files(GameTextVersion version) { if (text_by_language_by_id.empty()) { return {}; } - return write_game_text(text_by_language_by_id); + return write_game_text(cfg, text_by_language_by_id); } std::string ObjectFileDB::process_game_count_file() { diff --git a/decompiler/ObjectFile/ObjectFileDB.h b/decompiler/ObjectFile/ObjectFileDB.h index f87012a5f5..a9851fb6e1 100644 --- a/decompiler/ObjectFile/ObjectFileDB.h +++ b/decompiler/ObjectFile/ObjectFileDB.h @@ -99,7 +99,7 @@ class ObjectFileDB { std::string process_tpages(TextureDB& tex_db); std::string process_game_count_file(); - std::string process_game_text_files(GameTextVersion version); + std::string process_game_text_files(const Config& cfg); ObjectFileData& lookup_record(const ObjectFileRecord& rec); DecompilerTypeSystem dts; diff --git a/decompiler/config.cpp b/decompiler/config.cpp index 7001926a96..183b88dd38 100644 --- a/decompiler/config.cpp +++ b/decompiler/config.cpp @@ -224,6 +224,19 @@ Config read_config_file(const std::string& path_to_config_file, config.levels_to_extract = inputs_json.at("levels_to_extract").get>(); config.levels_extract = cfg.at("levels_extract").get(); + + // get new strings + if (!cfg.contains("new_strings_file")) { + return config; + } + + auto new_strings_json = read_json_file_from_config(cfg, "new_strings_file"); + config.new_strings_same_across_langs = new_strings_json.at("same_across_languages") + .get>(); + config.new_strings_different_across_langs = + new_strings_json.at("different_across_languages") + .get>>(); + return config; } diff --git a/decompiler/config.h b/decompiler/config.h index 2ca494b48b..40c62f6ed1 100644 --- a/decompiler/config.h +++ b/decompiler/config.h @@ -131,6 +131,9 @@ struct Config { std::unordered_map> stack_structure_hints_by_function; + std::unordered_map new_strings_same_across_langs; + std::unordered_map> new_strings_different_across_langs; + std::unordered_map bad_format_strings; std::vector levels_to_extract; diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index acb7074e29..1543a86a06 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -856,10 +856,10 @@ (max 116) ) -;; GAME-TEXT-ID ENUM BEGINS (defenum game-text-id :type uint32 :bitfield #f +;; GAME-TEXT-ID ENUM BEGINS (zero 0) (one 1) (confirm #x103) @@ -1300,8 +1300,8 @@ (inc #xf10) (europe #xf11) - ) ;; GAME-TEXT-ID ENUM ENDS + ) ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label.jsonc b/decompiler/config/jak1_ntsc_black_label.jsonc index b7ee43f008..d35033104a 100644 --- a/decompiler/config/jak1_ntsc_black_label.jsonc +++ b/decompiler/config/jak1_ntsc_black_label.jsonc @@ -77,6 +77,7 @@ "stack_structures_file": "decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc", "hacks_file": "decompiler/config/jak1_ntsc_black_label/hacks.jsonc", "inputs_file": "decompiler/config/jak1_ntsc_black_label/inputs.jsonc", + "new_strings_file": "decompiler/config/jak1_ntsc_black_label/new_strings.jsonc", // optional: a predetermined object file name map from a file. // this will make decompilation naming consistent even if you only run on some objects. diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index 9b178babfa..90c010bc82 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -488,7 +488,7 @@ "draw-bones-merc": [1, 3, 5, 7, 8, 10, 11, 12, 13], "(anon-function 48 lavatube-energy)": [13], "generic-tie-execute": [4, 9], - "generic-merc-execute-all":[3,7, 12] + "generic-merc-execute-all": [3, 7, 12] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index b96b810bc0..c166bb0620 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -2083,18 +2083,14 @@ ["L44", "float", true] ], - "ocean-mid": [ - ["L150", "vu-function"] - ], + "ocean-mid": [["L150", "vu-function"]], "generic-merc": [ ["L161", "(inline-array invinitdata)", 8], ["L162", "vu-function"] ], - "generic-vu0": [ - ["L1", "vu-function"] - ], + "generic-vu0": [["L1", "vu-function"]], "generic-vu1": [ ["L8", "vector4w"], @@ -2102,18 +2098,14 @@ ["L10", "vu-function"] ], - "generic-effect": [ - ["L95", "generic-consts"] - ], + "generic-effect": [["L95", "generic-consts"]], "shadow-vu1": [ ["L5", "vu-function"], ["L6", "shadow-vu1-gifbuf-template"] ], - "generic-vu0": [ - ["L1", "vu-function"] - ], + "generic-vu0": [["L1", "vu-function"]], // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] diff --git a/decompiler/config/jak1_ntsc_black_label/new_strings.jsonc b/decompiler/config/jak1_ntsc_black_label/new_strings.jsonc new file mode 100644 index 0000000000..8cb290dd67 --- /dev/null +++ b/decompiler/config/jak1_ntsc_black_label/new_strings.jsonc @@ -0,0 +1,56 @@ +{ + "same_across_languages": { + "1008": "UK ENGLISH", + "1009": "PORTUGUÊS", + "1010": "SUOMALAINEN", + "1011": "SVENSKA", + "1012": "DANSK", + "1013": "NORSK", + "1014": "KOREAN", + "1015": "RUSSIAN", + "1022": "4:3", + "1023": "5:4", + "1024": "16:9", + "1025": "21:9", + "1026": "32:9", + "1027": "640X480", + "1028": "800X600", + "1029": "1024X768", + "1030": "1280X960", + "1031": "1600X1200", + "1032": "960X768", + "1033": "1280X1024", + "1034": "1500X1200", + "1035": "854X480", + "1036": "1280X720", + "1037": "1920X1080", + "1038": "2560X1440", + "1039": "2880X1620", + "1040": "3840X2160", + "1041": "5120X2880", + "1042": "2560X1080", + "1043": "3120X1440", + "1044": "3200X1440", + "1045": "3440X1440", + "1046": "3840X1600", + "1047": "5120X2160", + "1048": "5120X1440" + }, + // will pad the rest of the array with 'TODO' placeholder + "different_across_languages": { + "1000": ["RESOLUTION"], + "1001": ["DISPLAY MODE"], + "1002": ["LETTERBOX"], + "1003": ["SUBTITLES"], + "1004": ["SUBTITLE SPEAKER"], + "1005": ["DISCORD RPC"], + "1006": ["LANGUAGE OPTIONS"], + "1007": ["SUBTITLE LANGUAGE"], + "1016": ["ON"], + "1017": ["OFF"], + "1018": ["AUTO"], + "1019": ["BORDERLESS"], + "1020": ["FULLSCREEN"], + "1021": ["WINDOWED"] + } +} diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index fb36685cb4..526c5cb6c1 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -3069,9 +3069,7 @@ "(exit target-racing-death)": [[16, "event-message-block"]], - "(anon-function 17 racer-states)": [ - [16, "joint-exploder-tuning"] - ], + "(anon-function 17 racer-states)": [[16, "joint-exploder-tuning"]], "(code target-racing-death)": [ [16, "event-message-block"], @@ -5472,9 +5470,7 @@ [48, "eye"] ], - "ocean-near-add-matrices": [ - [16, "matrix"] - ], + "ocean-near-add-matrices": [[16, "matrix"]], "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 08ae852c68..e58752c620 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -4023,9 +4023,7 @@ [251, "a0", "process-drawable"] ], - "(anon-function 46 racer-states)": [ - [[4, 32], "v1", "target"] - ], + "(anon-function 46 racer-states)": [[[4, 32], "v1", "target"]], "(anon-function 45 racer-states)": [ [19, "a0", "target"], @@ -7263,7 +7261,7 @@ [8, "a0", "dma-packet"], [10, "a0", "dma-packet"] ], - + "ocean-near-add-matrices": [ [7, "a0", "dma-packet"], [12, "a0", "dma-packet"], @@ -7275,9 +7273,7 @@ [47, "v1", "matrix"] ], - "ocean-near-add-constants": [ - [3, "a0", "dma-packet"] - ], + "ocean-near-add-constants": [[3, "a0", "dma-packet"]], "draw-ocean-near": [ [2, "a0", "dma-packet"], @@ -7342,7 +7338,7 @@ [24, "a0", "dma-packet"] ], - "draw-bones-generic-merc":[ + "draw-bones-generic-merc": [ [11, "v1", "generic-merc-ctrl"], [198, "v1", "generic-merc-ctrl"], [274, "a0", "generic-merc-ctrl"], @@ -7356,7 +7352,7 @@ ], "generic-merc-execute-all": [ - [[165,170], "v1", "terrain-context"], + [[165, 170], "v1", "terrain-context"], [92, "a0", "terrain-context"], [96, "v1", "terrain-context"], [100, "v1", "terrain-context"], @@ -7374,7 +7370,7 @@ [32, "a0", "terrain-context"] ], - "generic-work-init":[ + "generic-work-init": [ [10, "a0", "terrain-context"], [13, "a0", "terrain-context"], [16, "a0", "terrain-context"], diff --git a/decompiler/data/game_text.cpp b/decompiler/data/game_text.cpp index e3192ec0c0..195f20514e 100644 --- a/decompiler/data/game_text.cpp +++ b/decompiler/data/game_text.cpp @@ -134,17 +134,18 @@ GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version) } std::string write_game_text( + const Config& cfg, const std::unordered_map>& data) { // first sort languages: - std::vector langauges; + std::vector languages; for (const auto& lang : data) { - langauges.push_back(lang.first); + languages.push_back(lang.first); } - std::sort(langauges.begin(), langauges.end()); + std::sort(languages.begin(), languages.end()); // build map std::map> text_by_id; - for (auto lang : langauges) { + for (auto lang : languages) { for (auto& text : data.at(lang)) { text_by_id[text.first].push_back(text.second); } @@ -152,7 +153,7 @@ std::string write_game_text( // write! std::string result; // = "\xEF\xBB\xBF"; // UTF-8 encode (don't need this anymore) - result += fmt::format("(language-count {})\n", langauges.size()); + result += fmt::format("(language-count {})\n", languages.size()); result += "(group-name \"common\")\n"; for (auto& x : text_by_id) { result += fmt::format("(#x{:04x}\n ", x.first); @@ -162,6 +163,28 @@ std::string write_game_text( result += ")\n\n"; } + // add our own custom text additions from new_strings.jsonc + // - first add the strings that are the same across all languages + for (auto const& [key, val] : cfg.new_strings_same_across_langs) { + result += fmt::format("(#x{}\n ", key); + for (int i = 0; i < languages.size(); i++) { + result += fmt::format("\"{}\"\n ", val); + } + result += ")\n\n"; + } + // - now add the ones that are different, if they do not have all languages defined, pad with + // placeholders + for (auto const& [key, val] : cfg.new_strings_different_across_langs) { + result += fmt::format("(#x{}\n ", key); + for (auto const& str : val) { + result += fmt::format("\"{}\"\n ", str); + } + for (int i = 0; i < languages.size() - val.size(); i++) { + result += fmt::format("\"{}\"\n ", "TODO"); + } + result += ")\n\n"; + } + return result; } } // namespace decompiler diff --git a/decompiler/data/game_text.h b/decompiler/data/game_text.h index e7b0769249..01fc17c234 100644 --- a/decompiler/data/game_text.h +++ b/decompiler/data/game_text.h @@ -5,6 +5,7 @@ namespace decompiler { struct ObjectFileData; +struct Config; struct GameTextResult { int total_text = 0; @@ -15,5 +16,6 @@ struct GameTextResult { GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version); std::string write_game_text( + const Config& cfg, const std::unordered_map>& data); } // namespace decompiler diff --git a/decompiler/main.cpp b/decompiler/main.cpp index b838d7305c..ebcf610a66 100644 --- a/decompiler/main.cpp +++ b/decompiler/main.cpp @@ -181,7 +181,7 @@ int main(int argc, char** argv) { } if (config.process_game_text) { - auto result = db.process_game_text_files(config.text_version); + auto result = db.process_game_text_files(config); if (!result.empty()) { file_util::write_text_file(file_util::get_file_path({"assets", "game_text.txt"}), result); } diff --git a/goal_src/build/all_files.gc b/goal_src/build/all_files.gc index 41768da958..a6651ea29c 100644 --- a/goal_src/build/all_files.gc +++ b/goal_src/build/all_files.gc @@ -42,7 +42,7 @@ "goal_src/engine/dma/dma-buffer.gc" "goal_src/engine/dma/dma-bucket.gc" "goal_src/engine/dma/dma-disasm.gc" - "goal_src/engine/pc/pckernel-h.gc" ;; added + "goal_src/pc/pckernel-h.gc" ;; added "goal_src/engine/ps2/pad.gc" "goal_src/engine/gfx/hw/gs.gc" "goal_src/engine/gfx/hw/display-h.gc" @@ -154,7 +154,7 @@ "goal_src/engine/load/load-dgo.gc" "goal_src/engine/load/ramdisk.gc" "goal_src/engine/sound/gsound.gc" - "goal_src/engine/pc/pckernel.gc" ;; added + "goal_src/pc/pckernel.gc" ;; added "goal_src/engine/math/transformq.gc" "goal_src/engine/collide/collide-func.gc" "goal_src/engine/anim/joint.gc" @@ -217,7 +217,7 @@ "goal_src/engine/level/level-info.gc" "goal_src/engine/level/level.gc" "goal_src/engine/ui/text.gc" - "goal_src/engine/pc/subtitle.gc" ;; added + "goal_src/pc/subtitle.gc" ;; added "goal_src/engine/collide/collide-probe.gc" "goal_src/engine/collide/collide-frag.gc" "goal_src/engine/collide/collide-mesh.gc" diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index cbb31aac57..2624755135 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -4356,9 +4356,9 @@ (function "Custom" #f (lambda () (set-aspect! *pc-settings* (-> *pc-settings* aspect-custom-x) (-> *pc-settings* aspect-custom-y)))) ) (menu "Fullscreen" - (function "Windowed" #f (lambda () (set-fullscreen! *pc-settings* #f))) - (function "Fullscreen" #f (lambda () (set-fullscreen! *pc-settings* #t))) - (function "Borderless" #f (lambda () (set-fullscreen! *pc-settings* 'borderless))) + (function "Windowed" #f (lambda () (set-display-mode! *pc-settings* 'windowed))) + (function "Fullscreen" #f (lambda () (set-display-mode! *pc-settings* 'fullscreen))) + (function "Borderless" #f (lambda () (set-display-mode! *pc-settings* 'borderless))) ) (menu "Sizes" (function "640 x 480" #f (lambda () (set-size! *pc-settings* 640 480))) diff --git a/goal_src/engine/ui/progress-h.gc b/goal_src/engine/ui/progress-h.gc index a535821a23..555baa45cb 100644 --- a/goal_src/engine/ui/progress-h.gc +++ b/goal_src/engine/ui/progress-h.gc @@ -255,4 +255,3 @@ - diff --git a/goal_src/engine/ui/progress/progress-draw.gc b/goal_src/engine/ui/progress/progress-draw.gc index e8479fba94..8235f15f56 100644 --- a/goal_src/engine/ui/progress/progress-draw.gc +++ b/goal_src/engine/ui/progress/progress-draw.gc @@ -2156,4 +2156,3 @@ - diff --git a/goal_src/engine/ui/progress/progress-static.gc b/goal_src/engine/ui/progress/progress-static.gc index 2b4aae95dd..122b5ec991 100644 --- a/goal_src/engine/ui/progress/progress-static.gc +++ b/goal_src/engine/ui/progress/progress-static.gc @@ -1381,4 +1381,3 @@ - diff --git a/goal_src/engine/ui/progress/progress.gc b/goal_src/engine/ui/progress/progress.gc index a3501c9618..ef35fb5f50 100644 --- a/goal_src/engine/ui/progress/progress.gc +++ b/goal_src/engine/ui/progress/progress.gc @@ -2518,4 +2518,3 @@ ) ) - diff --git a/goal_src/engine/ui/text-h.gc b/goal_src/engine/ui/text-h.gc index 8169ffd902..62252845c5 100644 --- a/goal_src/engine/ui/text-h.gc +++ b/goal_src/engine/ui/text-h.gc @@ -11,10 +11,10 @@ ;; These ID's are shared with short spoken audio clips (daxter hints) ;; most (all?) of the daxter clips don't have text strings. -;; GAME-TEXT-ID ENUM BEGINS (defenum game-text-id :type uint32 :bitfield #f +;; GAME-TEXT-ID ENUM BEGINS (zero 0) (one 1) (confirm #x103) @@ -455,8 +455,9 @@ (inc #xf10) (europe #xf11) - ) ;; GAME-TEXT-ID ENUM ENDS + ) + ;; an individual string. (deftype game-text (structure) diff --git a/goal_src/engine/ui/text.gc b/goal_src/engine/ui/text.gc index 67e7f1612c..77749e9a16 100644 --- a/goal_src/engine/ui/text.gc +++ b/goal_src/engine/ui/text.gc @@ -22,9 +22,9 @@ ;; allocate the game text heap if it isn't already allocated. (when (= 0 (-> *common-text-heap* base)) (let ((heap *common-text-heap*)) - (set! (-> heap base) (malloc 'global 34816)) + (set! (-> heap base) (malloc 'global 64000)) (set! (-> heap current) (-> heap base)) - (set! (-> heap top-base) (&+ (-> heap base) 34816)) + (set! (-> heap top-base) (&+ (-> heap base) 64000)) (set! (-> heap top) (-> heap top-base)) ) ) diff --git a/goal_src/game.gp b/goal_src/game.gp index 98eb2272c8..e5380d6739 100644 --- a/goal_src/game.gp +++ b/goal_src/game.gp @@ -1568,7 +1568,6 @@ "dma/dma-buffer.gc" "dma/dma-bucket.gc" "dma/dma-disasm.gc" - "pc/pckernel-h.gc" ;; added "ps2/pad.gc" "gfx/hw/gs.gc" "gfx/hw/display-h.gc" @@ -1583,7 +1582,6 @@ "gfx/decomp-h.gc" "gfx/hw/display.gc" "engine/connect.gc" - "ui/text-h.gc" "game/settings-h.gc" "gfx/capture.gc" "debug/memory-usage-h.gc" @@ -1673,14 +1671,12 @@ "camera/cam-update-h.gc" "debug/assert-h.gc" "ui/hud-h.gc" - "ui/progress-h.gc" "ps2/rpc-h.gc" "nav/path-h.gc" "nav/navigate-h.gc" "load/load-dgo.gc" "load/ramdisk.gc" "sound/gsound.gc" - "pc/pckernel.gc" ;; added "math/transformq.gc" "collide/collide-func.gc" "anim/joint.gc" @@ -1743,7 +1739,6 @@ "level/level-info.gc" "level/level.gc" "ui/text.gc" - "pc/subtitle.gc" ;; added "collide/collide-probe.gc" "collide/collide-frag.gc" "collide/collide-mesh.gc" @@ -1809,10 +1804,7 @@ "game/crates.gc" "ui/hud.gc" "ui/hud-classes.gc" - "ui/progress/progress-static.gc" "ui/progress/progress-part.gc" - "ui/progress/progress-draw.gc" - "ui/progress/progress.gc" "ui/credits.gc" "game/projectiles.gc" "gfx/ocean/ocean.gc" @@ -1880,3 +1872,16 @@ "out/iso/0SUBTIT.TXT" ) ) + + +;; Custom or Modified Code +(goal-src "pc/pckernel-h.gc" "dma-disasm") +(goal-src "pc/pckernel.gc" "gsound") +(goal-src "pc/subtitle.gc" "text") + +(goal-src "pc/engine/ui/text-h.gc" "connect") +(goal-src "pc/engine/ui/progress-h.gc" "hud-h") +(goal-src "pc/engine/ui/progress/progress-static.gc" "hud-classes") +(goal-src "pc/engine/ui/progress/progress-draw.gc" "progress-part") +(goal-src "pc/engine/ui/progress/progress.gc" "progress-draw") + diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 1ab7fb3a99..cdd1020c30 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -510,6 +510,10 @@ `(+ ,var 1) ) +(defmacro inc (val) + "Increments a value" + `(1+ ,val)) + (defmacro +! (place amount) `(set! ,place (+ ,place ,amount)) ) @@ -522,6 +526,10 @@ `(- ,var 1) ) +(defmacro dec (val) + "Decrements a value" + `(1- ,val)) + (defmacro -! (place amount) `(set! ,place (- ,place ,amount)) ) @@ -552,14 +560,17 @@ (defmacro not! (var) `(set! ,var (not ,var))) + (defmacro true! (var) `(set! ,var #t)) + (defmacro false! (var) `(set! ,var #f)) (defmacro minmax (val minval maxval) `(max (min ,val ,maxval) ,minval) ) + (defmacro fminmax (val minval maxval) `(fmax (fmin ,val ,maxval) ,minval) ) @@ -573,6 +584,7 @@ (defmacro maxmin (val minval maxval) `(min (max ,val ,maxval) ,minval) ) + (defmacro fmaxmin (val minval maxval) `(fmin (fmax ,val ,maxval) ,minval) ) @@ -756,6 +768,30 @@ `(new 'debug 'pair ,a ,b) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ARRAYS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defmacro first-arr (coll) + "Returns the first element in an array" + `(-> ,coll 0)) + +(defmacro last-arr (coll) + "Returns the last element in an array" + `(-> ,coll (dec (length ,coll)))) + +(defmacro last-idx-arr (coll) + "Returns the index of the last element in an array" + `(dec (length ,coll))) + +(defmacro arr-idx-of (coll val def) + "Returns the index of an item in an array, returns if is nothing is found." + `(block find-element + (dotimes (i (length ,coll)) + (if (= ,val (-> ,coll i)) + (return-from find-element i))) + ,def)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; METHOD STUFF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/pc/README.md b/goal_src/pc/README.md new file mode 100644 index 0000000000..763908b3cb --- /dev/null +++ b/goal_src/pc/README.md @@ -0,0 +1,3 @@ +This directory contains either completely new source code files OR files we've significantly modified from the original + +Please try to preserve the original file path (with the addition of `pc/`) to make regression testing easy if it falls into the category of the latter. diff --git a/goal_src/pc/engine/ui/progress-h.gc b/goal_src/pc/engine/ui/progress-h.gc new file mode 100644 index 0000000000..dd63829d43 --- /dev/null +++ b/goal_src/pc/engine/ui/progress-h.gc @@ -0,0 +1,271 @@ +;;-*-Lisp-*- +(in-package goal) + +;; name: progress-h.gc +;; name in dgo: progress-h +;; dgos: GAME, ENGINE + + +(defenum progress-screen + :type int64 + (invalid -1) + (fuel-cell 0) + (money 1) + (buzzer 2) + (settings 3) + (game-settings 4) + (graphic-settings 5) + (sound-settings 6) + (memcard-no-space 7) + (memcard-not-inserted 8) + (memcard-not-formatted 9) + (memcard-format 10) + (memcard-data-exists 11) + (memcard-loading 12) + (memcard-saving 13) + (memcard-formatting 14) + (memcard-creating 15) + (load-game 16) + (save-game 17) + (save-game-title 18) + (memcard-insert 19) + (memcard-error-loading 20) + (memcard-error-saving 21) + (memcard-removed 22) + (memcard-no-data 23) + (memcard-error-formatting 24) + (memcard-error-creating 25) + (memcard-auto-save-error 26) + (title 27) + (settings-title 28) + (auto-save 29) + (pal-change-to-60hz 30) + (pal-now-60hz 31) + (no-disc 32) + (bad-disc 33) + (quit 34) + ;; custom + (language-options 35) + ) + +(defun-extern activate-progress process progress-screen none) +(defun-extern hide-progress-screen none) +(defun-extern hide-progress-icons none) + +(declare-type level-tasks-info basic) + +(define-extern *level-task-data* (array level-tasks-info)) +(define-extern *level-task-data-remap* (array int32)) + +(declare-type count-info structure) + +(defun-extern get-game-count int count-info) +(defun-extern progress-allowed? symbol) +(defun-extern pause-allowed? symbol) + +(declare-type progress process) + +(defun-extern deactivate-progress none) +(defun-extern calculate-completion progress float) +(defun-extern make-current-level-available-to-progress none) + +;; DECOMP BEGINS + +(deftype count-info (structure) + ((money-count int32 :offset-assert 0) + (buzzer-count int32 :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(deftype game-count-info (basic) + ((length int32 :offset-assert 4) + (data count-info :inline :dynamic :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(deftype task-info-data (basic) + ((task-id game-task :offset-assert 4) + (task-name game-text-id 4 :offset-assert 8) + (text-index-when-resolved int32 :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + + +(deftype level-tasks-info (basic) + ((level-name-id game-text-id :offset-assert 4) + (text-group-index int32 :offset-assert 8) + (nb-of-tasks int32 :offset-assert 12) + (buzzer-task-index int32 :offset-assert 16) + (task-info task-info-data 8 :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + + +(deftype game-option (basic) + ((option-type uint64 :offset-assert 8) + (name game-text-id :offset-assert 16) + (scale basic :offset-assert 20) + (param1 float :offset-assert 24) + (param2 float :offset-assert 28) + (param3 int32 :offset-assert 32) + (value-to-modify pointer :offset-assert 36) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + ) + +;; new custom type to extend the very limited progress-menu system +;; the user can only interact with one element at a time, so a single global is sufficient +(deftype progress-menu-list-tracker (basic) + ((direction symbol :offset-assert 4) ; 'left | 'right + (transition? symbol :offset-assert 8) ; '?? + (x-offset int32 :offset-assert 12) + (selected-index int32 :offset-assert 16))) + +;; why a new global? because i dont want to modify the type below....but that would get me what i want as well! +(define *progress-menu-list-tracker* (new 'static 'progress-menu-list-tracker)) + +(deftype progress (process) + ((current-debug-string int32 :offset-assert 112) + (current-debug-language int32 :offset-assert 116) + (current-debug-group int32 :offset-assert 120) + (in-out-position int32 :offset-assert 124) + (display-state progress-screen :offset-assert 128) + (next-display-state progress-screen :offset-assert 136) + (option-index int32 :offset-assert 144) + (selected-option basic :offset-assert 148) + (completion-percentage float :offset-assert 152) + (ready-to-run basic :offset-assert 156) + (display-level-index int32 :offset-assert 160) + (next-level-index int32 :offset-assert 164) + (task-index int32 :offset-assert 168) + (in-transition basic :offset-assert 172) + (last-in-transition basic :offset-assert 176) + (force-transition basic :offset-assert 180) + (stat-transition basic :offset-assert 184) + (level-transition int32 :offset-assert 188) + (language-selection uint64 :offset-assert 192) + ; true = left | false = right + (language-direction symbol :offset-assert 200) + (language-transition symbol :offset-assert 204) + (language-x-offset int32 :offset-assert 208) + (sides-x-scale float :offset-assert 212) + (sides-y-scale float :offset-assert 216) + (left-x-offset int32 :offset-assert 220) + (right-x-offset int32 :offset-assert 224) + (button-scale float :offset-assert 228) + (slot-scale float :offset-assert 232) + (left-side-x-scale float :offset-assert 236) + (left-side-y-scale float :offset-assert 240) + (right-side-x-scale float :offset-assert 244) + (right-side-y-scale float :offset-assert 248) + (small-orb-y-offset int32 :offset-assert 252) + (big-orb-y-offset int32 :offset-assert 256) + (transition-offset int32 :offset-assert 260) + (transition-offset-invert int32 :offset-assert 264) + (transition-percentage float :offset-assert 268) + (transition-percentage-invert float :offset-assert 272) + (transition-speed float :offset-assert 276) + (total-nb-of-power-cells int32 :offset-assert 280) + (total-nb-of-orbs int32 :offset-assert 284) + (total-nb-of-buzzers int32 :offset-assert 288) + (card-info mc-slot-info :offset-assert 292) + (last-option-index-change time-frame :offset-assert 296) + (video-mode-timeout time-frame :offset-assert 304) + (display-state-stack progress-screen 5 :offset-assert 312) + (option-index-stack int32 5 :offset-assert 352) + (display-state-pos int32 :offset-assert 372) + (nb-of-icons int32 :offset-assert 376) + (icons hud-icon 6 :offset-assert 380) + (max-nb-of-particles int32 :offset-assert 404) + (nb-of-particles int32 :offset-assert 408) + (particles hud-particle 40 :offset-assert 412) + (particle-state int32 40 :offset-assert 572) + ) + :heap-base #x270 + :method-count-assert 59 + :size-assert #x2dc + :flag-assert #x3b027002dc + (:methods + (dummy-14 (_type_) none 14) + (dummy-15 (_type_) none 15) + (dummy-16 (_type_) none 16) + (draw-progress (_type_) none 17) + (dummy-18 () none 18) + (dummy-19 (_type_) symbol 19) + (hidden? (_type_) symbol 20) + (adjust-sprites (_type_) none 21) + (adjust-icons (_type_) none 22) + (adjust-ratios (_type_ symbol symbol) none 23) + (draw-fuel-cell-screen (_type_ int) none 24) + (draw-money-screen (_type_ int) none 25) + (draw-buzzer-screen (_type_ int) none 26) + (draw-notice-screen (_type_) none 27) + (draw-options (_type_ int int float) none 28) + (dummy-29 (_type_) none 29) + (respond-progress (_type_) none 30) + (dummy-31 (_type_) none 31) + (dummy-32 (_type_) symbol 32) + (initialize-icons (_type_) none 33) + (initialize-particles (_type_) none 34) + (draw-memcard-storage-error (_type_ font-context) none 35) + (draw-memcard-data-exists (_type_ font-context) none 36) + (draw-memcard-no-data (_type_ font-context) none 37) + (draw-memcard-accessing (_type_ font-context) none 38) + (draw-memcard-insert (_type_ font-context) none 39) + (draw-memcard-file-select (_type_ font-context) none 40) + (draw-memcard-auto-save-error (_type_ font-context) none 41) + (draw-memcard-removed (_type_ font-context) none 42) + (draw-memcard-error (_type_ font-context) none 43) + (dummy-44 (_type_) none 44) + (push! (_type_) none 45) + (pop! (_type_) none 46) + (dummy-47 (_type_) none 47) + (enter! (_type_ progress-screen int) none 48) + (draw-memcard-format (_type_ font-context) none 49) + (draw-auto-save (_type_ font-context) none 50) + (set-transition-progress! (_type_ int) none 51) + (set-transition-speed! (_type_) none 52) + (dummy-53 (_type_ progress-screen) progress-screen 53) + (draw-pal-change-to-60hz (_type_ font-context) none 54) + (draw-pal-now-60hz (_type_ font-context) none 55) + (draw-no-disc (_type_ font-context) none 56) + (draw-bad-disc (_type_ font-context) none 57) + (draw-quit (_type_ font-context) none 58) + ) + (:states + progress-coming-in + progress-debug + progress-going-out + progress-gone + progress-normal + progress-waiting + ) + ) + + +(define *progress-process* (the-as (pointer progress) #f)) + +(define *progress-last-task-index* 0) + +0 + + + + diff --git a/goal_src/pc/engine/ui/progress/progress-draw.gc b/goal_src/pc/engine/ui/progress/progress-draw.gc new file mode 100644 index 0000000000..27a40a20e0 --- /dev/null +++ b/goal_src/pc/engine/ui/progress/progress-draw.gc @@ -0,0 +1,2155 @@ +;;-*-Lisp-*- +(in-package goal) + +;; name: progress-draw.gc +;; name in dgo: progress-draw +;; dgos: GAME, ENGINE + +;; DECOMP BEGINS + +(defun adjust-pos ((arg0 int) (arg1 int)) + (if (< arg0 arg1) + 0 + (- arg0 arg1) + ) + ) + +(defmethod draw-fuel-cell-screen progress ((obj progress) (arg0 int)) + (local-vars + (sv-112 int) + (sv-128 int) + (sv-144 int) + (sv-160 (function trsqv float quaternion)) + (sv-176 trsqv) + (sv-192 int) + (sv-208 int) + (sv-224 (function string float font-context int none)) + ) + (hide-progress-icons) + (let ((s5-0 (-> *level-task-data* arg0))) + (if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) + (format *stdcon* "fcd:~d~%" (-> *game-info* fuel-cell-deaths)) + ) + (set! (-> *progress-process* 0 particles 14 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 15 init-pos x) -320.0) + (set! (-> *progress-process* 0 icons 4 icon-x) -320) + (when (and (!= s5-0 #f) (= (-> *game-info* level-opened arg0) 1)) + (set! sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> obj left-x-offset))) + (set! sv-128 (the int (* 47.0 (-> obj transition-percentage-invert)))) + 0 + (let ((s0-0 6) + (s2-0 0) + (s4-1 (if (= (-> obj level-transition) 1) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (f30-0 (-> obj transition-percentage-invert)) + (s1-0 0) + (s3-0 #f) + ) + (when (-> obj stat-transition) + (set! sv-128 47) + (set! s2-0 (if (!= (-> obj display-state) (-> obj next-display-state)) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (set! s4-1 0) + (set! f30-0 1.0) + ) + (set! sv-144 0) + (while (< sv-144 4) + (let ((a0-18 (-> obj icons sv-144 icon 0 root))) + (set! sv-176 a0-18) + (set! sv-160 (method-of-object sv-176 set-yaw-angle-clear-roll-pitch!)) + (let ((a1-2 (+ (y-angle a0-18) (* 182.04445 (* 0.5 (-> *display* time-adjust-ratio)))))) + (sv-160 sv-176 a1-2) + ) + ) + (set! sv-144 (+ sv-144 1)) + ) + (set! sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2))) + (set! sv-208 0) + (while (< sv-208 (-> s5-0 nb-of-tasks)) + (let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id))) + (v1-59 -1) + (a0-25 #f) + ) + (set! (-> obj particle-state s0-0) 2) + (cond + ((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown))) + (if (= *kernel-boot-message* 'play) + (set! (-> obj particle-state s0-0) 1) + ) + ) + ((= v0-4 (task-status invalid)) + (set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved)) + (set! (-> obj particle-state s0-0) 3) + (set! a0-25 #t) + ) + ((= v0-4 (task-status need-introduction)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder-a)) + (set! v1-59 0) + ) + ((= v0-4 (task-status need-reminder)) + (set! v1-59 1) + ) + ((= v0-4 (task-status need-reward-speech)) + (set! v1-59 2) + ) + ((= v0-4 (task-status need-resolution)) + (set! v1-59 2) + ) + ) + (if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) + (set! v1-59 0) + ) + (set! (-> obj particles s0-0 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> obj particles s0-0 init-pos y) (the float (+ s4-1 204))) + (+! s0-0 1) + (when (= sv-208 (-> obj task-index)) + (set! s1-0 v1-59) + (set! s3-0 a0-25) + (set! (-> obj particles 5 init-pos x) (the float (+ sv-192 s2-0))) + (set! (-> obj particles 5 init-pos y) (the float (+ s4-1 204))) + ) + ) + (set! sv-192 (+ sv-192 sv-128)) + (set! sv-208 (+ sv-208 1)) + ) + (dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks))) + (set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320))) + (set! (-> obj particles s0-0 init-pos y) (the float (+ s4-1 194))) + (+! s0-0 1) + ) + (when *common-text* + (when (and (!= s1-0 -1) + (> (-> s5-0 nb-of-tasks) 0) + (>= (-> obj task-index) 0) + (< (-> obj task-index) (-> s5-0 nb-of-tasks)) + ) + (let ((s0-1 (new + 'stack + 'font-context + *font-default-matrix* + (- (+ s2-0 32) (-> obj left-x-offset)) + (+ (/ s4-1 2) 125) + 8325000.0 + (font-color yellow-orange) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-91 s0-1)) + (set! (-> v1-91 width) (the float 328)) + ) + (let ((v1-92 s0-1)) + (set! (-> v1-92 height) (the float 50)) + ) + (let ((v1-93 s0-1)) + (set! (-> v1-93 scale) 0.7) + ) + (set! (-> s0-1 flags) (font-flags shadow kerning middle left large)) + (set! sv-224 print-game-text-scaled) + (let ((a0-47 (lookup-text! *common-text* (-> s5-0 task-info (-> obj task-index) task-name s1-0) #f)) + (a1-57 f30-0) + (a2-15 s0-1) + (a3-2 (the int (* 128.0 f30-0))) + ) + (sv-224 a0-47 a1-57 a2-15 a3-2) + ) + (when s3-0 + (set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> obj left-x-offset)))) + (set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175))) + (let ((a0-49 s0-1)) + (set! (-> a0-49 color) (font-color lighter-lighter-blue)) + ) + (let ((v1-104 s0-1)) + (set! (-> v1-104 height) (the float 15)) + ) + (let ((v1-105 s0-1)) + (set! (-> v1-105 scale) 0.5) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id task-completed) #f) + f30-0 + s0-1 + (the int (* 128.0 f30-0)) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-money-screen progress ((obj progress) (arg0 int)) + (hide-progress-icons) + (let* ((v1-1 (/ (-> obj transition-offset) 16)) + (s4-0 (if (= (-> obj level-transition) 1) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (f30-0 (-> obj transition-percentage-invert)) + (s3-0 (- v1-1)) + ) + (when (-> obj stat-transition) + (set! v1-1 (if (!= (-> obj display-state) (-> obj next-display-state)) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (set! s3-0 v1-1) + (set! s4-0 0) + (set! f30-0 1.0) + ) + (set! (-> obj particles 15 init-pos x) (the float (- (+ v1-1 150) (-> obj left-x-offset)))) + (set! (-> obj particles 15 init-pos y) (the float (+ s4-0 214))) + (set! (-> obj icons 4 icon-x) (- (+ v1-1 148) (-> obj left-x-offset))) + (set! (-> obj icons 4 icon-y) (+ (-> obj big-orb-y-offset) s4-0)) + (let ((a0-15 (-> obj icons 4 icon 0 root))) + (set-yaw-angle-clear-roll-pitch! + a0-15 + (- (y-angle a0-15) (* 182.04445 (* 4.0 (-> *display* time-adjust-ratio)))) + ) + ) + (let ((s4-1 + (new + 'stack + 'font-context + *font-default-matrix* + (- (+ s3-0 200) (-> obj left-x-offset)) + (+ (/ s4-0 2) 96) + 8325000.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-19 s4-1)) + (set! (-> v1-19 width) (the float 328)) + ) + (let ((v1-20 s4-1)) + (set! (-> v1-20 height) (the float 70)) + ) + (set! (-> s4-1 flags) (font-flags shadow kerning large)) + (let ((s3-1 print-game-text-scaled)) + (format + (clear *temp-string*) + "~D/~D" + (-> *game-info* money-per-level arg0) + (-> *game-counts* data arg0 money-count) + ) + (s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))) + ) + (let ((v1-26 s4-1)) + (set! (-> v1-26 width) (the float 428)) + ) + (set! (-> s4-1 origin x) (+ -220.0 (-> s4-1 origin x))) + (set! (-> s4-1 origin y) (+ 40.0 (-> s4-1 origin y))) + (set! (-> s4-1 flags) (font-flags shadow kerning middle large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id total-collected) #f) + (* 0.7 f30-0) + s4-1 + (the int (* 128.0 f30-0)) + ) + (set! (-> s4-1 origin y) (+ 15.0 (-> s4-1 origin y))) + (let ((s5-2 print-game-text-scaled)) + (format (clear *temp-string*) "~D/~D" (the int (-> *game-info* money-total)) (-> obj total-nb-of-orbs)) + (s5-2 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-buzzer-screen progress ((obj progress) (arg0 int)) + (hide-progress-icons) + (let* ((v1-2 (-> *level-task-data* arg0)) + (a0-3 (/ (-> obj transition-offset) 16)) + (s4-0 (if (= (-> obj level-transition) 1) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (f30-0 (-> obj transition-percentage-invert)) + (s3-0 (- a0-3)) + ) + (when (-> obj stat-transition) + (set! a0-3 (if (!= (-> obj display-state) (-> obj next-display-state)) + (- (-> obj transition-offset)) + (-> obj transition-offset) + ) + ) + (set! s3-0 a0-3) + (set! s4-0 0) + (set! f30-0 1.0) + ) + (set! (-> obj particles 14 init-pos x) (the float (- (+ a0-3 150) (-> obj left-x-offset)))) + (set! (-> obj particles 14 init-pos y) (the float (+ s4-0 214))) + (let ((s2-0 0)) + (let ((a1-8 (-> v1-2 buzzer-task-index))) + (if (!= a1-8 -1) + (set! s2-0 (buzzer-count *game-info* (-> v1-2 task-info a1-8 task-id))) + ) + ) + (let ((s4-1 + (new + 'stack + 'font-context + *font-default-matrix* + (- (+ s3-0 200) (-> obj left-x-offset)) + (+ (/ s4-0 2) 96) + 8325000.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-9 s4-1)) + (set! (-> v1-9 width) (the float 328)) + ) + (let ((v1-10 s4-1)) + (set! (-> v1-10 height) (the float 70)) + ) + (set! (-> s4-1 flags) (font-flags shadow kerning large)) + (let ((s3-1 print-game-text-scaled)) + (format (clear *temp-string*) "~D/~D" s2-0 (-> *game-counts* data arg0 buzzer-count)) + (s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))) + ) + (let ((v1-14 s4-1)) + (set! (-> v1-14 width) (the float 428)) + ) + (set! (-> s4-1 origin x) (+ -220.0 (-> s4-1 origin x))) + (set! (-> s4-1 origin y) (+ 40.0 (-> s4-1 origin y))) + (set! (-> s4-1 flags) (font-flags shadow kerning middle large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id total-collected) #f) + (* 0.7 f30-0) + s4-1 + (the int (* 128.0 f30-0)) + ) + (set! (-> s4-1 origin y) (+ 15.0 (-> s4-1 origin y))) + (let ((s5-2 print-game-text-scaled)) + (format (clear *temp-string*) "~D/~D" (the int (-> *game-info* buzzer-total)) (-> obj total-nb-of-buzzers)) + (s5-2 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-memcard-storage-error progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.55) + ) + (let ((v1-1 arg0)) + (set! (-> v1-1 width) (the float 265)) + ) + (let ((v1-2 arg0)) + (set! (-> v1-2 height) (the float 55)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (let ((s4-0 (game-text-id card-not-formatted-title))) + (case (-> obj display-state) + (((progress-screen memcard-no-space)) + (set! s4-0 (game-text-id memcard-no-space)) + ) + (((progress-screen memcard-not-inserted)) + (set! s4-0 (game-text-id memcard-not-inserted)) + ) + ) + (let ((s3-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* s4-0 #f) 1) + (s3-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 70.0) + (let ((v1-12 arg0)) + (set! (-> v1-12 width) (the float 350)) + ) + (let ((v1-13 arg0)) + (set! (-> v1-13 height) (the float 40)) + ) + (let ((s4-1 print-game-text-scaled)) + (format + (clear *temp-string*) + (lookup-text! *common-text* (game-text-id memcard-space-requirement1) #f) + (if (-> obj card-info) + (-> obj card-info mem-required) + 0 + ) + ) + (s4-1 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (set! (-> arg0 origin y) 115.0) + (let ((v1-17 arg0)) + (set! (-> v1-17 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id memcard-space-requirement2) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-19 arg0)) + (set! (-> v1-19 scale) 0.65) + ) + (set! (-> arg0 origin y) 160.0) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-format progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin y) 35.0) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.55) + ) + (let ((v1-1 arg0)) + (set! (-> v1-1 width) (the float 265)) + ) + (let ((v1-2 arg0)) + (set! (-> v1-2 height) (the float 55)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (let ((s4-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id card-not-formatted-title) #f) 1) + (s4-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 105.0) + (let ((v1-7 arg0)) + (set! (-> v1-7 width) (the float 360)) + ) + (let ((v1-8 arg0)) + (set! (-> v1-8 height) (the float 40)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id card-not-formatted-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 scale) 0.65) + ) + (set! (-> arg0 origin y) 138.0) + (let ((v1-11 arg0)) + (set! (-> v1-11 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id format?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-data-exists progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.65) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 55.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 365)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 75)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id save-data-already-exists) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin y) 140.0) + (let ((v1-7 arg0)) + (set! (-> v1-7 width) (the float 360)) + ) + (let ((v1-8 arg0)) + (set! (-> v1-8 height) (the float 40)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id overwrite?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-no-data progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.65) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 40.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 365)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 75)) + ) + (let ((s4-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id no-save-data) #f) 1) + (s4-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (set! (-> arg0 origin y) 130.0) + (let ((v1-7 arg0)) + (set! (-> v1-7 width) (the float 360)) + ) + (let ((v1-8 arg0)) + (set! (-> v1-8 height) (the float 40)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id create-save-data?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-accessing progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 1.0) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 35.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 365)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 75)) + ) + (when (or (< (mod (-> *display* real-frame-counter) 300) 150) (!= (-> obj transition-percentage-invert) 1.0)) + (let ((a1-1 (game-text-id loading-data))) + (case (-> obj display-state) + (((progress-screen memcard-saving)) + (set! a1-1 (game-text-id saving-data)) + ) + (((progress-screen memcard-formatting)) + (set! a1-1 (game-text-id formatting)) + ) + (((progress-screen memcard-creating)) + (set! a1-1 (game-text-id creating-save-data)) + ) + ) + (print-game-text-scaled (lookup-text! *common-text* a1-1 #f) (-> obj transition-percentage-invert) arg0 128) + ) + ) + (let ((v1-18 arg0)) + (set! (-> v1-18 scale) 0.65) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 15 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 100.0) + (let ((v1-22 arg0)) + (set! (-> v1-22 width) (the float 370)) + ) + (let ((v1-23 arg0)) + (set! (-> v1-23 height) (the float 75)) + ) + (let ((s4-1 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id do-not-remove-mem-card) #f) 1) + (s4-1 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + 0 + (none) + ) + +(defmethod draw-memcard-insert progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.65) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 35.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 310)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 110)) + ) + (let ((s4-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id insert-memcard) #f) 1) + (s4-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (let ((v1-7 arg0)) + (set! (-> v1-7 scale) 0.65) + ) + (set! (-> arg0 origin y) 130.0) + (let ((v1-8 arg0)) + (set! (-> v1-8 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id back?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-file-select progress ((obj progress) (arg0 font-context)) + (local-vars + (sv-16 (function _varargs_ object)) + (sv-32 (function _varargs_ object)) + (sv-48 (function _varargs_ object)) + (sv-64 (function _varargs_ object)) + (sv-80 (function _varargs_ object)) + (sv-96 (function _varargs_ object)) + (sv-112 (function _varargs_ object)) + (sv-128 (function _varargs_ object)) + (sv-144 (function _varargs_ object)) + ) + (let ((s4-0 (* (+ (-> obj transition-offset) -256) 2))) + (if (< s4-0 0) + (set! s4-0 0) + ) + (if (< 500 s4-0) + (set! s4-0 700) + ) + (set! (-> obj particles 19 init-pos x) (the float (- (- 202 (adjust-pos s4-0 150)) (-> obj left-x-offset)))) + (set! (-> obj particles 20 init-pos x) (the float (- (+ (adjust-pos s4-0 100) 202) (-> obj left-x-offset)))) + (set! (-> obj particles 21 init-pos x) (the float (- (- 202 (adjust-pos s4-0 50)) (-> obj left-x-offset)))) + (set! (-> obj particles 22 init-pos x) (the float (- (+ s4-0 202) (-> obj left-x-offset)))) + ) + (cond + ((= (-> *setting-control* current video-mode) 'pal) + (set! (-> obj particles 21 init-pos y) 256.0) + (set! (-> obj particles 22 init-pos y) 338.0) + ) + (else + (set! (-> obj particles 21 init-pos y) 255.0) + (set! (-> obj particles 22 init-pos y) 336.0) + ) + ) + (let ((f0-13 (* 2.0 (+ -0.5 (-> obj transition-percentage-invert))))) + 128 + (if (< f0-13 0.0) + (set! f0-13 0.0) + ) + (let ((s4-1 (the int (* 128.0 f0-13)))) + (let ((v1-29 arg0)) + (set! (-> v1-29 scale) 0.5) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 102 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 5.0) + (let ((v1-33 arg0)) + (set! (-> v1-33 width) (the float 200)) + ) + (let ((v1-34 arg0)) + (set! (-> v1-34 height) (the float 20)) + ) + (print-game-text + (lookup-text! + *common-text* + (the-as game-text-id (if (= (-> obj display-state) (progress-screen load-game)) + 321 + 320 + ) + ) + #f + ) + arg0 + #f + s4-1 + 22 + ) + (set! (-> arg0 origin y) 26.0) + (let ((v1-37 arg0)) + (set! (-> v1-37 height) (the float 20)) + ) + (let ((s3-3 (-> obj card-info)) + (s2-0 23) + ) + (dotimes (s1-0 4) + (set! (-> arg0 origin x) (the float (- 41 (-> obj left-x-offset)))) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (let ((a0-17 arg0)) + (set! (-> a0-17 color) (font-color default)) + ) + (let ((v1-42 arg0)) + (set! (-> v1-42 width) (the float 320)) + ) + (cond + ((and s3-3 (= (-> s3-3 formatted) 1) (= (-> s3-3 inited) 1) (= (-> s3-3 file s1-0 present) 1)) + (set! (-> obj particles s2-0 init-pos x) (the float (- 66 (-> obj left-x-offset)))) + (let ((v1-57 arg0)) + (set! (-> v1-57 scale) 0.6) + ) + (if (and (< (-> s3-3 file s1-0 level-index) (length *level-task-data-remap*)) + (> (-> s3-3 file s1-0 level-index) 0) + ) + (print-game-text + (lookup-text! + *common-text* + (-> *level-task-data* (-> *level-task-data-remap* (+ (-> s3-3 file s1-0 level-index) -1)) level-name-id) + #f + ) + arg0 + #f + s4-1 + 22 + ) + (print-game-text "OLD SAVE GAME" arg0 #f s4-1 22) + ) + (let ((a0-28 arg0)) + (set! (-> a0-28 color) (font-color blue-white)) + ) + (cond + ((or (>= (seconds 2) (- (-> *display* real-frame-counter) (-> obj last-option-index-change))) + (or (< (mod (- (-> *display* real-frame-counter) (-> obj last-option-index-change)) 1200) 600) + (!= (-> obj option-index) s1-0) + (-> obj in-transition) + ) + ) + (let ((v1-87 arg0)) + (set! (-> v1-87 scale) 0.5) + ) + (set! (-> arg0 origin y) (+ 16.0 (-> arg0 origin y))) + (set! (-> arg0 flags) (font-flags shadow kerning middle large)) + (set! (-> arg0 origin x) (the float (- -73 (-> obj left-x-offset)))) + (let ((v1-91 arg0)) + (set! (-> v1-91 width) (the float 350)) + ) + (let ((s0-2 print-game-text)) + (set! sv-16 format) + (let ((a0-40 (clear *temp-string*)) + (a1-13 "~D") + (a2-5 (the int (-> s3-3 file s1-0 fuel-cell-count))) + ) + (sv-16 a0-40 a1-13 a2-5) + ) + (s0-2 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin x) (the float (- 1 (-> obj left-x-offset)))) + (let ((s0-3 print-game-text)) + (set! sv-32 format) + (let ((a0-44 (clear *temp-string*)) + (a1-15 "~D") + (a2-7 (the int (-> s3-3 file s1-0 money-count))) + ) + (sv-32 a0-44 a1-15 a2-7) + ) + (s0-3 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin x) (the float (- 79 (-> obj left-x-offset)))) + (let ((s0-4 print-game-text)) + (set! sv-48 format) + (let ((a0-48 (clear *temp-string*)) + (a1-17 "~D") + (a2-9 (the int (-> s3-3 file s1-0 buzzer-count))) + ) + (sv-48 a0-48 a1-17 a2-9) + ) + (s0-4 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin y) (+ 1.0 (-> arg0 origin y))) + (let ((v1-108 arg0)) + (set! (-> v1-108 scale) 1.0) + ) + (set! (-> arg0 flags) (font-flags shadow kerning right large)) + (set! (-> arg0 origin x) (the float (- 352 (-> obj left-x-offset)))) + (let ((s0-5 print-game-text)) + (set! sv-64 format) + (let ((a0-52 (clear *temp-string*)) + (a1-19 "~D%") + (a2-11 (the int (-> s3-3 file s1-0 completion-percentage))) + ) + (sv-64 a0-52 a1-19 a2-11) + ) + (s0-5 *temp-string* arg0 #f s4-1 22) + ) + (let ((v1-116 arg0)) + (set! (-> v1-116 scale) 0.5) + ) + (set! (-> arg0 origin y) (+ 9.0 (-> arg0 origin y))) + (set! (-> arg0 flags) (font-flags shadow kerning large)) + (set! (-> arg0 origin x) (the float (- 85 (-> obj left-x-offset)))) + (let ((s0-6 print-game-text)) + (set! sv-80 format) + (let ((a0-56 (clear *temp-string*)) + (a1-21 "/~D") + (a2-17 (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) + (-> obj total-nb-of-power-cells) + 100 + ) + ) + ) + (sv-80 a0-56 a1-21 a2-17) + ) + (s0-6 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin x) (the float (- 150 (-> obj left-x-offset)))) + (let ((s0-7 print-game-text)) + (set! sv-96 format) + (let ((a0-60 (clear *temp-string*)) + (a1-23 "/~D") + (a2-19 (-> obj total-nb-of-orbs)) + ) + (sv-96 a0-60 a1-23 a2-19) + ) + (s0-7 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin x) (the float (- 238 (-> obj left-x-offset)))) + (let ((s0-8 print-game-text)) + (set! sv-112 format) + (let ((a0-64 (clear *temp-string*)) + (a1-25 "/~D") + (a2-21 (-> obj total-nb-of-buzzers)) + ) + (sv-112 a0-64 a1-25 a2-21) + ) + (s0-8 *temp-string* arg0 #f s4-1 22) + ) + (set! (-> arg0 origin y) (+ 15.0 (-> arg0 origin y))) + ) + (else + (set! (-> arg0 origin y) (+ 18.0 (-> arg0 origin y))) + (set! (-> arg0 origin x) (the float (- 28 (-> obj left-x-offset)))) + (let ((v1-131 arg0)) + (set! (-> v1-131 scale) 0.8) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle large)) + (let ((v1-133 arg0)) + (set! (-> v1-133 width) (the float 350)) + ) + (cond + ((= (scf-get-territory) 1) + (let ((s0-10 print-game-text)) + (set! sv-128 format) + (let ((a0-69 (clear *temp-string*)) + (a1-27 "~X/~X/20~2X ~2X:~2X") + (a2-23 (-> s3-3 file s1-0 day)) + (a3-10 (-> s3-3 file s1-0 month)) + (t0-10 (-> s3-3 file s1-0 year)) + (t1-0 (-> s3-3 file s1-0 hour)) + (t2-0 (-> s3-3 file s1-0 minute)) + ) + (sv-128 a0-69 a1-27 a2-23 a3-10 t0-10 t1-0 t2-0) + ) + (s0-10 *temp-string* arg0 #f s4-1 22) + ) + ) + (else + (let ((s0-11 print-game-text)) + (set! sv-144 format) + (let ((a0-72 (clear *temp-string*)) + (a1-29 "~X/~X/20~2X ~2X:~2X") + (a2-25 (-> s3-3 file s1-0 month)) + (a3-12 (-> s3-3 file s1-0 day)) + (t0-12 (-> s3-3 file s1-0 year)) + (t1-1 (-> s3-3 file s1-0 hour)) + (t2-1 (-> s3-3 file s1-0 minute)) + ) + (sv-144 a0-72 a1-29 a2-25 a3-12 t0-12 t1-1 t2-1) + ) + (s0-11 *temp-string* arg0 #f s4-1 22) + ) + ) + ) + (set! (-> obj particles s2-0 init-pos x) -320.0) + (set! (-> arg0 origin y) (+ 23.0 (-> arg0 origin y))) + ) + ) + ) + (else + (set! (-> obj particles s2-0 init-pos x) -320.0) + (set! (-> arg0 origin y) (+ 12.0 (-> arg0 origin y))) + (let ((v1-173 arg0)) + (set! (-> v1-173 scale) 0.7) + ) + (print-game-text (lookup-text! *common-text* (game-text-id empty) #f) arg0 #f s4-1 22) + (set! (-> arg0 origin y) (+ 29.0 (-> arg0 origin y))) + ) + ) + (+! s2-0 1) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-memcard-auto-save-error progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.6) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 70 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 5.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 265)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 35)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id error-saving) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 34.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 360)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 50)) + ) + (let ((s4-1 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id check-memcard) #f) 1) + (s4-1 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (set! (-> arg0 origin y) 89.0) + (let ((v1-12 arg0)) + (set! (-> v1-12 width) (the float 360)) + ) + (let ((v1-13 arg0)) + (set! (-> v1-13 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-disabled-title) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin y) 118.0) + (let ((v1-15 arg0)) + (set! (-> v1-15 width) (the float 360)) + ) + (let ((v1-16 arg0)) + (set! (-> v1-16 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-disabled-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-18 arg0)) + (set! (-> v1-18 scale) 0.65) + ) + (set! (-> arg0 origin y) 160.0) + (let ((v1-19 arg0)) + (set! (-> v1-19 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-removed progress ((obj progress) (arg0 font-context)) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.6) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (set! (-> arg0 origin x) (the float (- 70 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 10.0) + (let ((v1-4 arg0)) + (set! (-> v1-4 width) (the float 265)) + ) + (let ((v1-5 arg0)) + (set! (-> v1-5 height) (the float 55)) + ) + (let ((s4-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id memcard-removed) #f) 1) + (s4-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 78.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 360)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-disabled-title) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin y) 112.0) + (let ((v1-12 arg0)) + (set! (-> v1-12 width) (the float 360)) + ) + (let ((v1-13 arg0)) + (set! (-> v1-13 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-disabled-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-15 arg0)) + (set! (-> v1-15 scale) 0.65) + ) + (set! (-> arg0 origin y) 160.0) + (let ((v1-16 arg0)) + (set! (-> v1-16 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-memcard-error progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin y) 15.0) + (let ((v1-0 arg0)) + (set! (-> v1-0 scale) 0.7) + ) + (let ((v1-1 arg0)) + (set! (-> v1-1 width) (the float 265)) + ) + (let ((v1-2 arg0)) + (set! (-> v1-2 height) (the float 55)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (let ((s4-0 (game-text-id error-loading))) + (case (-> obj display-state) + (((progress-screen memcard-error-saving)) + (set! s4-0 (game-text-id error-saving)) + ) + (((progress-screen memcard-error-formatting)) + (set! s4-0 (game-text-id error-formatting)) + ) + (((progress-screen memcard-error-creating)) + (set! s4-0 (game-text-id error-creating-data)) + ) + ) + (let ((s3-0 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* s4-0 #f) 1) + (s3-0 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 80.0) + (let ((v1-13 arg0)) + (set! (-> v1-13 width) (the float 360)) + ) + (let ((v1-14 arg0)) + (set! (-> v1-14 height) (the float 70)) + ) + (let ((s4-1 print-game-text-scaled)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id check-memcard-and-retry) #f) 1) + (s4-1 *temp-string* (-> obj transition-percentage-invert) arg0 128) + ) + (let ((v1-16 arg0)) + (set! (-> v1-16 scale) 0.65) + ) + (set! (-> arg0 origin y) 155.0) + (let ((v1-17 arg0)) + (set! (-> v1-17 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-auto-save progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 35 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 18.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 330)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 60)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-warn-title) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin x) (the float (- 15 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 110.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 370)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id autosave-warn-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-12 arg0)) + (set! (-> v1-12 scale) 0.65) + ) + (set! (-> arg0 origin y) 175.0) + (let ((v1-13 arg0)) + (set! (-> v1-13 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> *progress-process* 0 particles 31 init-pos y) (the float (if (= (get-aspect-ratio) 'aspect16x9) + 170 + 180 + ) + ) + ) + (set! (-> *progress-process* 0 particles 31 init-pos x) + (the float + (- (if (or (< (mod (-> *display* real-frame-counter) 300) 270) (!= (-> obj transition-percentage-invert) 1.0)) + 205 + -320 + ) + (-> obj left-x-offset) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-pal-change-to-60hz progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 20.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 300)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 40)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id screen-change-to-60hz) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin x) (the float (- 15 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 60.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 370)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id screen-60hz-warn-support) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin y) 120.0) + (let ((v1-12 arg0)) + (set! (-> v1-12 height) (the float 50)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id screen-60hz-warn-timer) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-14 arg0)) + (set! (-> v1-14 scale) 0.65) + ) + (set! (-> arg0 origin y) 175.0) + (let ((v1-15 arg0)) + (set! (-> v1-15 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-no-disc progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 50.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 300)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 40)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id no-disc-title) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 90.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 360)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id no-disc-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (when (is-cd-in?) + (let ((v1-13 arg0)) + (set! (-> v1-13 scale) 0.65) + ) + (set! (-> arg0 origin y) 155.0) + (let ((v1-14 arg0)) + (set! (-> v1-14 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + ) + 0 + (none) + ) + +(defmethod draw-bad-disc progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 50.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 300)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 40)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id bad-disc-title) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin x) (the float (- 20 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 90.0) + (let ((v1-9 arg0)) + (set! (-> v1-9 width) (the float 360)) + ) + (let ((v1-10 arg0)) + (set! (-> v1-10 height) (the float 60)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id bad-disc-msg) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (let ((v1-12 arg0)) + (set! (-> v1-12 scale) 0.65) + ) + (set! (-> arg0 origin y) 155.0) + (let ((v1-13 arg0)) + (set! (-> v1-13 height) (the float 20)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-quit progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 70.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 300)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 40)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id quit?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-pal-now-60hz progress ((obj progress) (arg0 font-context)) + (set! (-> arg0 origin x) (the float (- 50 (-> obj left-x-offset)))) + (set! (-> arg0 origin y) 45.0) + (let ((v1-2 arg0)) + (set! (-> v1-2 scale) 0.6) + ) + (let ((v1-3 arg0)) + (set! (-> v1-3 width) (the float 300)) + ) + (let ((v1-4 arg0)) + (set! (-> v1-4 height) (the float 50)) + ) + (set! (-> arg0 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id screen-now-60hz) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + (set! (-> arg0 origin y) 95.0) + (let ((v1-7 arg0)) + (set! (-> v1-7 height) (the float 50)) + ) + (print-game-text-scaled + (lookup-text! *common-text* (game-text-id screen-60hz-keep?) #f) + (-> obj transition-percentage-invert) + arg0 + 128 + ) + 0 + (none) + ) + +(defmethod draw-notice-screen progress ((obj progress)) + (hide-progress-icons) + (when *common-text* + (let ((a1-1 (new + 'stack + 'font-context + *font-default-matrix* + (- 70 (-> obj left-x-offset)) + 10 + 0.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (case (-> obj display-state) + (((progress-screen memcard-format)) + (draw-memcard-format obj a1-1) + ) + (((progress-screen memcard-no-space) + (progress-screen memcard-not-inserted) + (progress-screen memcard-not-formatted) + ) + (draw-memcard-storage-error obj a1-1) + ) + (((progress-screen memcard-data-exists)) + (draw-memcard-data-exists obj a1-1) + ) + (((progress-screen memcard-no-data)) + (draw-memcard-no-data obj a1-1) + ) + (((progress-screen memcard-loading) + (progress-screen memcard-saving) + (progress-screen memcard-formatting) + (progress-screen memcard-creating) + ) + (draw-memcard-accessing obj a1-1) + ) + (((progress-screen memcard-insert)) + (draw-memcard-insert obj a1-1) + ) + (((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title)) + (draw-memcard-file-select obj a1-1) + ) + (((progress-screen memcard-auto-save-error)) + (draw-memcard-auto-save-error obj a1-1) + ) + (((progress-screen memcard-removed)) + (draw-memcard-removed obj a1-1) + ) + (((progress-screen memcard-error-loading) + (progress-screen memcard-error-saving) + (progress-screen memcard-error-formatting) + (progress-screen memcard-error-creating) + ) + (draw-memcard-error obj a1-1) + ) + (((progress-screen auto-save)) + (draw-auto-save obj a1-1) + ) + (((progress-screen pal-change-to-60hz)) + (draw-pal-change-to-60hz obj a1-1) + ) + (((progress-screen pal-now-60hz)) + (draw-pal-now-60hz obj a1-1) + ) + (((progress-screen no-disc)) + (draw-no-disc obj a1-1) + ) + (((progress-screen bad-disc)) + (draw-bad-disc obj a1-1) + ) + (((progress-screen quit)) + (draw-quit obj a1-1) + ) + ) + ) + ) + 0 + (none) + ) + +(defun draw-percent-bar ((arg0 int) (arg1 int) (arg2 float) (arg3 int)) + (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-0 (-> s2-0 base)) + ) + (draw-sprite2d-xy s2-0 arg0 arg1 255 14 (new 'static 'rgba :a #x60)) + (draw-sprite2d-xy s2-0 arg0 (+ arg1 2) (the int (* 255.0 arg2)) 10 (the-as rgba arg3)) + (let ((a3-3 (-> s2-0 base))) + (let ((v1-3 (the-as dma-packet (-> s2-0 base)))) + (set! (-> v1-3 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-3 vif0) (new 'static 'vif-tag)) + (set! (-> v1-3 vif1) (new 'static 'vif-tag)) + (set! (-> s2-0 base) (&+ (the-as pointer v1-3) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id sprite) + gp-0 + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + 0 + (none) + ) + +(defun print-list-item-name ((arg0 int) (arg1 font-context) (arg2 int) (arg3 symbol) (name-list (array game-text-id))) + (let ((s5-0 (if arg3 + arg2 + (- arg2) + ) + ) + ) + (+! (-> arg1 origin x) (the float s5-0)) + (let ((f30-0 (- 1.0 (* 0.0033333334 (the float arg2))))) + (print-game-text-scaled + (lookup-text! *common-text* (-> name-list arg0) #f) + f30-0 + arg1 + (the int (* 128.0 f30-0)) + ) + ) + (set! (-> arg1 origin x) (- (-> arg1 origin x) (the float s5-0))) + ) + (set! (-> arg1 color) (font-color default)) + arg1 + ) + + +(defun draw-options-list ((obj progress) + (font-ctx font-context) + (something-unknown int) + (name-list (array game-text-id))) + "Given a progress object, draw it's arbitrarily sized list of options. This is option-type `1`" + (local-vars + (list-size int) + (curr-selection-index int) + (unknown-modified-index int) + (unknown-modified-index-2 int) + (unknown-modified-index-3 int) + (unknown-modified-index-4 int) + (screen-arr (array game-option))) + + (set! list-size (length name-list)) + (set! screen-arr (-> *options-remap* (-> obj display-state))) + (set! curr-selection-index (-> *progress-menu-list-tracker* selected-index)) + (if (-> *progress-menu-list-tracker* transition?) + (set! (-> *progress-menu-list-tracker* x-offset) + (seekl (-> *progress-menu-list-tracker* x-offset) + 200 + (the int (* 10.0 (-> *display* time-adjust-ratio)))))) + + (when (>= (-> *progress-menu-list-tracker* x-offset) 100) + (set! (-> *progress-menu-list-tracker* transition?) #f) + (set! (-> *progress-menu-list-tracker* x-offset) 0)) + + (set! (-> font-ctx origin y) (the float (+ something-unknown 3))) + (set! (-> font-ctx color) (font-color lighter-lighter-blue)) + (set! unknown-modified-index (mod (+ curr-selection-index 1) list-size)) + + (let ((unknown-modified-index-2 (mod (+ list-size -1 curr-selection-index) list-size)) + (unknown-modified-index-3 (mod (the-as int (+ curr-selection-index 2)) list-size))) + (set! unknown-modified-index-4 (mod (+ list-size -2 curr-selection-index) list-size)) + ; cleanup this logic, doesnt have to all be conds + (cond + ((= (-> *progress-menu-list-tracker* direction) 'left) + (let ((a2-22 (- 200 (+ (-> *progress-menu-list-tracker* x-offset) 100)))) + (print-list-item-name unknown-modified-index-2 font-ctx a2-22 #f name-list)) + (let ((a2-23 (+ (-> *progress-menu-list-tracker* x-offset) 100))) + (if (< a2-23 150) + (print-list-item-name unknown-modified-index font-ctx a2-23 #t name-list) + (print-list-item-name unknown-modified-index-4 font-ctx (- 200 (-> *progress-menu-list-tracker* x-offset)) #f name-list)))) + (else + (let ((a2-25 (+ (-> *progress-menu-list-tracker* x-offset) 100))) + (cond + ((< a2-25 150) + (print-list-item-name unknown-modified-index-2 font-ctx a2-25 #f name-list)) + (else + (let ((a2-26 (- 200 (-> *progress-menu-list-tracker* x-offset)))) + (print-list-item-name unknown-modified-index-3 font-ctx a2-26 #t name-list))))) + (let ((a2-27 (- 200 (+ (-> *progress-menu-list-tracker* x-offset) 100)))) + (print-list-item-name unknown-modified-index font-ctx a2-27 #t name-list))))) + (when (not (-> *progress-menu-list-tracker* transition?)) + (let ((a0-75 font-ctx)) + (set! (-> a0-75 color) (font-color yellow-green-2)))) + (print-list-item-name (the-as int curr-selection-index) + font-ctx + (-> *progress-menu-list-tracker* x-offset) + (-> *progress-menu-list-tracker* direction) + name-list)) + + +(defmethod draw-options progress ((obj progress) (arg0 int) (arg1 int) (arg2 float)) + (local-vars + (font-ctx font-context) + (sv-128 int) + (sv-144 int) + (sv-160 (function _varargs_ object)) + (sv-176 string) + (sv-192 string) + (sv-208 string) + (sv-224 (function _varargs_ object)) + (sv-240 string) + (sv-256 string) + (sv-272 string) + (sv-288 (function string font-context symbol int int float)) + (sv-304 (function _varargs_ object)) + (sv-320 (function _varargs_ object)) + (sv-336 string) + (sv-352 string) + (sv-368 string) + (sv-384 (function _varargs_ object)) + (sv-400 string) + (sv-416 string) + (sv-432 string) + (sv-448 uint) + (sv-464 int) + (sv-480 int) + (sv-496 int) + (sv-512 uint) + (sv-528 (function _varargs_ object)) + (sv-544 string) + (sv-560 string) + (sv-576 string) + (sv-592 (function _varargs_ object)) + (sv-608 string) + (sv-624 string) + (sv-640 string) + (sv-656 (function _varargs_ object)) + (sv-672 string) + (sv-688 string) + (sv-704 string) + (sv-720 (function _varargs_ object)) + (sv-736 string) + (sv-752 string) + (sv-768 string) + (sv-784 (function _varargs_ object)) + (sv-800 string) + (sv-816 string) + (sv-832 string) + (sv-848 (function _varargs_ object)) + (sv-864 string) + (sv-880 string) + (sv-896 string) + (sv-912 string) + ) + (let ((s3-0 (-> *options-remap* (-> obj display-state)))) + (when s3-0 + (let ((s2-1 (- arg0 (/ (* arg1 (length s3-0)) 2))) + (s1-0 0) + ) + 27 + 0 + (set! font-ctx + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) + (let ((v1-11 font-ctx)) + (set! (-> v1-11 width) (the float 350)) + ) + (let ((v1-12 font-ctx)) + (set! (-> v1-12 height) (the float 25)) + ) + (set! (-> font-ctx flags) (font-flags shadow kerning middle left large)) + (dotimes (s0-0 (length s3-0)) + (set! sv-912 (the-as string #f)) + (set! sv-128 27) + (set! sv-144 s2-1) + (let ((v1-18 (-> s3-0 s0-0 option-type))) + (cond + ((= v1-18 7) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (set! sv-160 format) + (set! sv-176 (clear *temp-string*)) + (set! sv-192 "~30L~S~0L ~S") + (set! sv-208 (lookup-text! *common-text* (game-text-id yes) #f)) + (let ((a3-2 (lookup-text! *common-text* (game-text-id no) #f))) + (sv-160 sv-176 sv-192 sv-208 a3-2) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (set! sv-224 format) + (set! sv-240 (clear *temp-string*)) + (set! sv-256 "~0L~S ~30L~S~1L") + (set! sv-272 (lookup-text! *common-text* (game-text-id yes) #f)) + (let ((a3-3 (lookup-text! *common-text* (game-text-id no) #f))) + (sv-224 sv-240 sv-256 sv-272 a3-3) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ((or (= v1-18 6) (= v1-18 8)) + (cond + ((nonzero? (-> s3-0 s0-0 name)) + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912 + ) + (else + (set! sv-912 (the-as string #f)) + (the-as symbol sv-912) + ) + ) + ) + ((and (-> obj selected-option) (= (-> obj option-index) s0-0)) + (let ((a0-19 font-ctx)) + (set! (-> a0-19 color) (font-color default)) + ) + (set! (-> font-ctx origin x) (the float (- sv-128 (-> obj left-x-offset)))) + (case (-> s3-0 s0-0 option-type) + ((3) + (set! (-> font-ctx origin y) (the float (+ s2-1 -20))) + ) + (else + (set! (-> font-ctx origin y) (the float (+ s2-1 -8))) + ) + ) + (let ((v1-64 font-ctx)) + (set! (-> v1-64 scale) 0.6) + ) + (set! sv-288 print-game-text) + (let ((a0-23 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + (a1-11 font-ctx) + (a2-10 #f) + (a3-4 128) + (t0-1 22) + ) + (sv-288 a0-23 a1-11 a2-10 a3-4 t0-1) + ) + (case (-> s3-0 s0-0 option-type) + ((3) + (set! sv-144 (+ s2-1 3)) + sv-144 + ) + (else + (set! sv-144 (+ s2-1 7)) + sv-144 + ) + ) + (let ((v1-81 (-> s3-0 s0-0 option-type))) + (cond + ((zero? v1-81) + (let* ((v1-82 (the-as uint #x8000ffff)) + (f0-12 (* 0.01 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) + (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) + (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) + ) + (draw-percent-bar (- 75 (-> obj left-x-offset)) (+ s2-1 8) f0-12 (the-as int a3-5)) + ) + (set! sv-304 format) + (let ((a0-42 (clear *temp-string*)) + (a1-13 "~D") + (a2-12 (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) + ) + (sv-304 a0-42 a1-13 a2-12) + ) + (set! sv-912 *temp-string*) + (set! sv-128 (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) + sv-128 + ) + ((= v1-81 2) + (cond + ((-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (set! sv-320 format) + (set! sv-336 (clear *temp-string*)) + (set! sv-352 "~30L~S~0L ~S") + (set! sv-368 (lookup-text! *common-text* (game-text-id on) #f)) + (let ((a3-6 (lookup-text! *common-text* (game-text-id off) #f))) + (sv-320 sv-336 sv-352 sv-368 a3-6) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (set! sv-384 format) + (set! sv-400 (clear *temp-string*)) + (set! sv-416 "~0L~S ~30L~S~1L") + (set! sv-432 (lookup-text! *common-text* (game-text-id on) #f)) + (let ((a3-7 (lookup-text! *common-text* (game-text-id off) #f))) + (sv-384 sv-400 sv-416 sv-432 a3-7) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ;; language selection - when selected + ((= v1-81 1) + (draw-options-list obj font-ctx s2-1 *language-name-remap*)) + ((= v1-81 #x10) + (draw-options-list obj font-ctx s2-1 *pc-graphics-aspect-ratio-mode-remap*)) + ((= v1-81 #x11) + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (draw-options-list obj font-ctx s2-1 *pc-graphics-4x3-valid-resolutions-names*)) + (('pc-aspect-5x4) + (draw-options-list obj font-ctx s2-1 *pc-graphics-5x4-valid-resolutions-names*)) + (('pc-aspect-16x9) + (draw-options-list obj font-ctx s2-1 *pc-graphics-16x9-valid-resolutions-names*)) + (('pc-aspect-21x9) + (draw-options-list obj font-ctx s2-1 *pc-graphics-21x9-valid-resolutions-names*)) + (('pc-aspect-32x9) + (draw-options-list obj font-ctx s2-1 *pc-graphics-32x9-valid-resolutions-names*)))) + ((= v1-81 #x12) + (draw-options-list obj font-ctx s2-1 *pc-graphics-display-mode-remap*)) + ((= v1-81 #x13) + (draw-options-list obj font-ctx s2-1 *pc-subtitle-language-name-remap*)) + ((= v1-81 #x14) + (draw-options-list obj font-ctx s2-1 *pc-subtitle-speaker-setting-remap*)) + ((= v1-81 3) + (set! sv-912 (lookup-text! *common-text* (game-text-id move-dpad) #f)) + sv-912 + ) + ;; aspect ratio - original + ((= v1-81 4) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'aspect4x3) + (format (clear *temp-string*) + "~30L~S~0L ~S" + (lookup-text! *common-text* (game-text-id 4x3) #f) + (lookup-text! *common-text* (game-text-id 16x9) #f)) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (format (clear *temp-string*) + "~0L~S ~30L~S~1L" + (lookup-text! *common-text* (game-text-id 4x3) #f) + (lookup-text! *common-text* (game-text-id 16x9) #f)) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ;; pal refresh rate + ((= v1-81 5) + (cond + ((= (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) 'ntsc) + (set! sv-656 format) + (set! sv-672 (clear *temp-string*)) + (set! sv-688 "~0L~S ~30L~S~1L") + (set! sv-704 (lookup-text! *common-text* (game-text-id 50hz) #f)) + (let ((a3-17 (lookup-text! *common-text* (game-text-id 60hz) #f))) + (sv-656 sv-672 sv-688 sv-704 a3-17) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (set! sv-720 format) + (set! sv-736 (clear *temp-string*)) + (set! sv-752 "~30L~S~0L ~S") + (set! sv-768 (lookup-text! *common-text* (game-text-id 50hz) #f)) + (let ((a3-18 (lookup-text! *common-text* (game-text-id 60hz) #f))) + (sv-720 sv-736 sv-752 sv-768 a3-18) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ) + ) + ) + ) + ) + (else + (let ((v1-195 (-> s3-0 s0-0 option-type))) + (cond + ;; boolean flag + ((= v1-195 2) + (set! sv-784 format) + (set! sv-800 (clear *temp-string*)) + (set! sv-816 "~S: ~S") + (set! sv-832 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + ;; Danger -- assumes there is a value to be modified, iniitalized in progress! + (let ((a3-19 (if (-> (the-as (pointer uint32) (-> s3-0 s0-0 value-to-modify))) + (lookup-text! *common-text* (game-text-id on) #f) + (lookup-text! *common-text* (game-text-id off) #f) + ) + ) + ) + (sv-784 sv-800 sv-816 sv-832 a3-19) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + ;; language selection + ;; unfortunate everything is hard-coded with these ids.. + ((= v1-195 1) + (set! sv-848 format) + (set! sv-864 (clear *temp-string*)) + (set! sv-880 "~S: ~S") + (set! sv-896 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + (let ((a3-20 (lookup-text! + *common-text* + (-> *language-name-remap* (-> (the-as (pointer uint64) (-> s3-0 s0-0 value-to-modify)))) + #f + ) + ) + ) + (sv-848 sv-864 sv-880 sv-896 a3-20) + ) + (set! sv-912 *temp-string*) + sv-912 + ) + (else + (set! sv-912 (lookup-text! *common-text* (-> s3-0 s0-0 name) #f)) + sv-912) + ) + ) + ) + ) + ) + (when sv-912 + (let ((f0-23 (-> obj transition-percentage-invert))) + (let ((v1-235 font-ctx)) + (set! (-> v1-235 color) + (the-as font-color (if (and (= s0-0 (-> obj option-index)) (not (-> obj in-transition))) + 30 + 0 + ) + ) + ) + ) + (set! (-> font-ctx origin x) (the float (- sv-128 (-> obj left-x-offset)))) + (set! (-> font-ctx origin y) (the float (the int (* (the float sv-144) (if (-> s3-0 s0-0 scale) + f0-23 + 1.0 + ) + ) + ) + ) + ) + (let ((v1-246 font-ctx)) + (set! (-> v1-246 scale) (* arg2 f0-23)) + ) + (let ((t9-60 print-game-text) + (a1-64 font-ctx) + (a2-50 #f) + (a3-21 (the int (* 128.0 f0-23))) + (t0-2 22) + ) + (t9-60 sv-912 a1-64 a2-50 a3-21 t0-2) + ) + ) + ) + (+! s2-1 arg1) + (+! s1-0 1) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod draw-progress progress ((obj progress)) + (let ((f30-0 (+ -409.0 (-> obj particles 2 init-pos x) (* 0.8 (the float (-> obj left-x-offset))))) + (s5-0 (if (or (-> obj stat-transition) (nonzero? (-> obj level-transition))) + 0 + (-> obj transition-offset) + ) + ) + ) + (let ((f28-0 (if (or (-> obj stat-transition) (nonzero? (-> obj level-transition))) + 1.0 + (-> obj transition-percentage-invert) + ) + ) + ) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s4-0 (-> s3-0 base)) + ) + (let ((s2-0 draw-string-xy)) + (format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* game money)))) + (s2-0 + *temp-string* + s3-0 + (the int (+ 428.0 (the float s5-0) f30-0)) + (- 12 (the int (* 0.16666667 f30-0))) + (font-color default) + (font-flags shadow kerning large) + ) + ) + (let ((s2-1 draw-string-xy)) + (format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* game fuel)))) + (s2-1 + *temp-string* + s3-0 + (the int (+ 456.0 (the float (adjust-pos s5-0 50)) f30-0)) + (- 48 (the int (* 0.125 f30-0))) + (font-color default) + (font-flags shadow kerning large) + ) + ) + (let ((s2-2 draw-string-xy)) + (format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* fact-info-target buzzer)))) + (s2-2 + *temp-string* + s3-0 + (the int (+ 469.0 (the float (adjust-pos s5-0 100)) f30-0)) + 89 + (font-color default) + (font-flags shadow kerning large) + ) + ) + (let ((a3-4 (-> s3-0 base))) + (let ((v1-20 (the-as object (-> s3-0 base)))) + (set! (-> (the-as dma-packet v1-20) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-20) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-20) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (&+ (the-as pointer v1-20) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + s4-0 + (the-as (pointer dma-tag) a3-4) + ) + ) + ) + (let ((s4-2 + (new + 'stack + 'font-context + *font-default-matrix* + (the int (+ (- 423.0 (the float (/ (-> obj left-x-offset) 2))) f30-0 (the float (adjust-pos s5-0 150)))) + 131 + 0.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-29 s4-2)) + (set! (-> v1-29 width) (the float 100)) + ) + (let ((v1-30 s4-2)) + (set! (-> v1-30 height) (the float 15)) + ) + (let ((v1-31 s4-2)) + (set! (-> v1-31 scale) 0.5) + ) + (set! (-> s4-2 flags) (font-flags shadow kerning large)) + (print-game-text (lookup-text! *common-text* (game-text-id options) #f) s4-2 #f 128 22) + (let ((v1-34 s4-2)) + (set! (-> v1-34 width) (the float 160)) + ) + (let ((v1-35 s4-2)) + (set! (-> v1-35 height) (the float 22)) + ) + (let ((v1-36 s4-2)) + (set! (-> v1-36 scale) 1.3) + ) + (let ((a0-31 s4-2)) + (set! (-> a0-31 color) (font-color another-light-blue)) + ) + (set! (-> s4-2 origin x) + (+ (- 435.0 (the float (if (< (-> *progress-process* 0 completion-percentage) 10.0) + 93 + 80 + ) + ) + ) + f30-0 + ) + ) + (set! (-> s4-2 origin y) 180.0) + (set! (-> s4-2 flags) (font-flags shadow kerning middle left large)) + (let ((s3-3 print-game-text)) + (format (clear *temp-string*) "~2D%" (the int (-> *progress-process* 0 completion-percentage))) + (s3-3 *temp-string* s4-2 #f (the int (* 128.0 f28-0)) 22) + ) + ) + ) + 0.0 + (let ((f28-1 (+ -94.0 (-> obj particles 2 init-pos x))) + (s3-4 90) + (s4-3 224) + (s2-5 (/ s5-0 5)) + (f26-3 (-> obj button-scale)) + ) + (let ((f24-0 (* 182.04445 (- (/ -36.0 f26-3) (the float s2-5))))) + (set! (-> obj particles 27 init-pos x) (the float (+ s3-4 (the int (* f28-1 (cos f24-0)))))) + (set! (-> obj particles 27 init-pos y) (the float (+ s4-3 (the int (* f28-1 (sin f24-0)))))) + ) + (let ((f24-2 (* 182.04445 (- (/ -21.0 f26-3) (the float (adjust-pos s2-5 10)))))) + (set! (-> obj particles 28 init-pos x) (the float (+ s3-4 (the int (* f28-1 (cos f24-2)))))) + (set! (-> obj particles 28 init-pos y) (the float (+ s4-3 (the int (* f28-1 (sin f24-2)))))) + ) + (let ((f24-4 (* 182.04445 (- (/ -6.0 f26-3) (the float (adjust-pos s2-5 15)))))) + (set! (-> obj particles 29 init-pos x) (the float (+ s3-4 (the int (* f28-1 (cos f24-4)))))) + (set! (-> obj particles 29 init-pos y) (the float (+ s4-3 (the int (* f28-1 (sin f24-4)))))) + ) + (let ((f26-5 (* 182.04445 (- (/ 9.0 f26-3) (the float (adjust-pos s2-5 20)))))) + (set! (-> obj particles 30 init-pos x) (the float (+ s3-4 (the int (* f28-1 (cos f26-5)))))) + (set! (-> obj particles 30 init-pos y) (the float (+ s4-3 (the int (* f28-1 (sin f26-5)))))) + ) + ) + (when *cheat-mode* + (let ((a0-46 "AUTO SAVE OFF")) + (if (-> *setting-control* current auto-save) + (set! a0-46 "AUTO SAVE ON") + ) + (let* ((s3-5 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s4-4 (-> s3-5 base)) + ) + (draw-string-xy + a0-46 + s3-5 + (the int (+ 430.0 f30-0)) + 200 + (font-color blue-white) + (font-flags shadow kerning middle) + ) + (let ((a3-9 (-> s3-5 base))) + (let ((v1-81 (the-as object (-> s3-5 base)))) + (set! (-> (the-as dma-packet v1-81) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-81) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-81) vif1) (new 'static 'vif-tag)) + (set! (-> s3-5 base) (&+ (the-as pointer v1-81) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + s4-4 + (the-as (pointer dma-tag) a3-9) + ) + ) + ) + ) + ) + (let ((a0-52 (-> obj icons 5 icon 0 root))) + (set-yaw-angle-clear-roll-pitch! + a0-52 + (- (y-angle a0-52) (* 182.04445 (* 4.0 (-> *display* time-adjust-ratio)))) + ) + ) + (let* ((f28-2 (* 0.00024414062 (the float (-> *progress-process* 0 in-out-position)))) + (f30-1 (* 300.0 f28-2)) + ) + (set! (-> obj particles 18 init-pos x) + (the float (+ (the int (the float (adjust-pos s5-0 50))) 394 (the int f30-1) (-> obj right-x-offset))) + ) + (set! (-> obj particles 18 init-pos y) (the float (- 40 (the int (* 80.0 f28-2))))) + (set! (-> obj icons 5 icon-x) + (+ (the int (the float (adjust-pos s5-0 50))) 393 (the int f30-1) (-> obj right-x-offset)) + ) + (set! (-> obj icons 5 icon-y) (- (-> obj small-orb-y-offset) (the int (* 80.0 f28-2)))) + (set! (-> obj particles 16 init-pos x) + (the float (+ (the int (the float (adjust-pos s5-0 100))) 425 (the int f30-1) (-> obj right-x-offset))) + ) + (set! (-> obj particles 16 init-pos y) (the float (- 112 (the int (* 60.0 f28-2))))) + (set! (-> obj particles 17 init-pos x) (the float (+ (the int (the float (adjust-pos s5-0 150))) + 442 + (the int f30-1) + (the int (* 0.7 (the float (-> obj right-x-offset)))) + ) + ) + ) + ) + ) + (set! (-> obj particles 17 init-pos y) 193.0) + 0 + (none) + ) + + + + diff --git a/goal_src/pc/engine/ui/progress/progress-static.gc b/goal_src/pc/engine/ui/progress/progress-static.gc new file mode 100644 index 0000000000..6c50bd91cb --- /dev/null +++ b/goal_src/pc/engine/ui/progress/progress-static.gc @@ -0,0 +1,1515 @@ +;;-*-Lisp-*- +(in-package goal) + +;; name: progress-static.gc +;; name in dgo: progress-static +;; dgos: GAME, ENGINE + +;; This file contains the layouts for all of the menus. + +;; options in the start menu options +(define *main-options* + (new 'static 'boxed-array :type game-option :length 7 :allocated-length 7 + (new 'static 'game-option :option-type #x6 :name (game-text-id game-options) :scale #t :param3 4) + (new 'static 'game-option :option-type #x6 :name (game-text-id graphic-options) :scale #t :param3 5) + (new 'static 'game-option :option-type #x6 :name (game-text-id sound-options) :scale #t :param3 6) + (new 'static 'game-option :option-type #x6 :name (game-text-id load-game) :scale #t :param3 16) + (new 'static 'game-option :option-type #x6 :name (game-text-id save-game) :scale #t :param3 17) + (new 'static 'game-option :option-type #x6 :name (game-text-id quit-game) :scale #t :param3 34) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *title* + (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 + (new 'static 'game-option :option-type #x6 :name (game-text-id new-game) :scale #t :param3 18) + (new 'static 'game-option :option-type #x6 :name (game-text-id load-game) :scale #t :param3 16) + (new 'static 'game-option :option-type #x6 :name (game-text-id options) :scale #t :param3 28) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *options* + (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 + (new 'static 'game-option :option-type #x6 :name (game-text-id game-options) :scale #t :param3 4) + (new 'static 'game-option :option-type #x6 :name (game-text-id graphic-options) :scale #t :param3 5) + (new 'static 'game-option :option-type #x6 :name (game-text-id sound-options) :scale #t :param3 6) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *main-options-demo* + (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 + (new 'static 'game-option :option-type #x6 :name (game-text-id game-options) :scale #t :param3 4) + (new 'static 'game-option :option-type #x6 :name (game-text-id graphic-options) :scale #t :param3 5) + (new 'static 'game-option :option-type #x6 :name (game-text-id sound-options) :scale #t :param3 6) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +;; param3 corresponds to the index defined in `*options-remap*` in progress.gc +;; it is the screen it should go to next, it's only used for type `6` + +(define *main-options-demo-shared* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x6 :name (game-text-id game-options) :scale #t :param3 4) + (new 'static 'game-option :option-type #x6 :name (game-text-id graphic-options) :scale #t :param3 5) + (new 'static 'game-option :option-type #x6 :name (game-text-id sound-options) :scale #t :param3 6) + (new 'static 'game-option :option-type #x8 :name (game-text-id exit-demo) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +;; TODO - option type should be an enum +;; 1 - a list? (only used by language so there might be some bad assumptions here...) +;; 2 - boolean +;; 3 - dpad input (center screen) +;; 4 - used for aspect ratio, also a list +;; 6 - go forward a screen +;; 8 - go back a screen +;; --- +;; 10 - port aspect ratio +;; 11 - port resolution +;; 12 - port window type +;; 13 - port subtitle language +;; 14 - port subtitle speaker + +(define *game-options* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x2 :name (game-text-id vibrations) :scale #t) + (new 'static 'game-option :option-type #x2 :name (game-text-id play-hints) :scale #t) + (new 'static 'game-option :option-type #x6 :name (game-text-id progress-language-options) :scale #t :param3 35) + (new 'static 'game-option :option-type #x2 :name (game-text-id progress-discord-rpc) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *game-options-japan* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x2 :name (game-text-id vibrations) :scale #t) + (new 'static 'game-option :option-type #x2 :name (game-text-id play-hints) :scale #t) + (new 'static 'game-option :option-type #x1 :name (game-text-id progress-language-options) :scale #t :param3 35) + (new 'static 'game-option :option-type #x2 :name (game-text-id progress-discord-rpc) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *game-options-demo* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x2 :name (game-text-id vibrations) :scale #t) + (new 'static 'game-option :option-type #x2 :name (game-text-id play-hints) :scale #t) + (new 'static 'game-option :option-type #x1 :name (game-text-id progress-language-options) :scale #t :param3 35) + (new 'static 'game-option :option-type #x2 :name (game-text-id progress-discord-rpc) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *language-options* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x1 :name (game-text-id language) :scale #t) + (new 'static 'game-option :option-type #x2 :name (game-text-id progress-subtitles) :scale #t) + (new 'static 'game-option :option-type #x13 :name (game-text-id progress-subtitles-language) :scale #t) + (new 'static 'game-option :option-type #x14 :name (game-text-id progress-subtitles-label-speaker) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + )) + +(define *graphic-options* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x12 :name (game-text-id progress-display-mode) :scale #t) + (new 'static 'game-option :option-type #x10 :name (game-text-id aspect-ratio) :scale #t) + (new 'static 'game-option :option-type #x11 :name (game-text-id progress-resolution) :scale #t) + (new 'static 'game-option :option-type #x2 :name (game-text-id progress-letterbox) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *graphic-title-options-pal* + (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 + (new 'static 'game-option :option-type #x3 :name (game-text-id center-screen) :scale #t) + (new 'static 'game-option :option-type #x5 :name (game-text-id video-mode) :scale #t) + (new 'static 'game-option :option-type #x4 :name (game-text-id aspect-ratio) :scale #t) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *sound-options* + (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 + (new 'static 'game-option :name (game-text-id sfx-volume) :scale #t :param2 100.0) + (new 'static 'game-option :name (game-text-id music-volume) :scale #t :param2 100.0) + (new 'static 'game-option :name (game-text-id speech-volume) :scale #t :param2 100.0) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #t) + ) + ) + +(define *yes-no-options* + (new 'static 'boxed-array :type game-option :length 1 :allocated-length 1 + (new 'static 'game-option :option-type #x7 :scale #f) + ) + ) + +(define *ok-options* + (new 'static 'boxed-array :type game-option :length 1 :allocated-length 1 + (new 'static 'game-option :option-type #x8 :name (game-text-id ok) :scale #f) + ) + ) + +(define *load-options* + (new 'static 'boxed-array + :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #f) + ) + ) + +(define *save-options* + (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #f) + ) + ) + +(define *save-options-title* + (new 'static 'boxed-array + :type game-option :length 6 :allocated-length 6 + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :scale #f) + (new 'static 'game-option :option-type #x8 :name (game-text-id continue-without-saving) :scale #f) + (new 'static 'game-option :option-type #x8 :name (game-text-id back) :scale #f) + ) + ) + +;; maps options to a progress screen +(define *options-remap* + (new 'static 'boxed-array :type (array game-option) :length 0 :allocated-length 36) + ) + +;; TODO probably an enum. +;; maps "levels" to the appropriate offset in *level-task-data* +(define *level-task-data-remap* + (new 'static 'boxed-array :type int32 :length 23 :allocated-length 23 + 0 + 1 + 2 + 3 ;; jungle? + 3 ;; jungleb? + 4 + 5 + 6 + 7 ;; sunken? + 7 ;; sunkenb? + 8 + 9 + 10 + 11 + 12 + 13 ;; maincave? + 13 ;; robocave? + 13 ;; darkcave? + 14 + 15 ;; citadel? + 15 ;; finalboss? + 4 ;; demo? + 4 ;; intro? + ) + ) + +;; maps goal language ID to its name string ID +(define *language-name-remap* + (new 'static 'boxed-array :type game-text-id :length 6 :allocated-length 6 + (game-text-id english) + (game-text-id french) + (game-text-id german) + (game-text-id spanish) + (game-text-id italian) + (game-text-id japanese) + ) + ) + +(define *pc-subtitle-language-name-remap* + (new 'static 'boxed-array :type game-text-id :length 14 :allocated-length 14 + (game-text-id english) + (game-text-id french) + (game-text-id german) + (game-text-id spanish) + (game-text-id italian) + (game-text-id japanese) + (game-text-id progress-subtitle-language-uk-english) + (game-text-id progress-subtitle-language-portuguese) + (game-text-id progress-subtitle-language-finnish) + (game-text-id progress-subtitle-language-swedish) + (game-text-id progress-subtitle-language-danish) + (game-text-id progress-subtitle-language-norwegian) + (game-text-id progress-subtitle-language-korean) + (game-text-id progress-subtitle-language-russian))) + +(define *pc-subtitle-speaker-setting-remap* + (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 + (game-text-id progress-subtitles-label-speaker-on) + (game-text-id progress-subtitles-label-speaker-off) + (game-text-id progress-subtitles-label-speaker-auto))) + +(define *pc-subtitle-speaker-valid-options* + (new 'static 'boxed-array :type symbol :length 3 :allocated-length 3 #t #f 'auto)) + +(define *pc-graphics-display-mode-symbol-options* + (new 'static 'boxed-array :type symbol :length 3 :allocated-length 3 'borderless 'fullscreen 'windowed)) + +(define *pc-graphics-display-mode-remap* + (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 + (game-text-id progress-display-mode-borderless) + (game-text-id progress-display-mode-fullscreen) + (game-text-id progress-display-mode-windowed))) + +(define *pc-graphics-aspect-ratio-options* + (new 'static 'boxed-array :type symbol :length 5 :allocated-length 5 'pc-aspect-4x3 'pc-aspect-5x4 'pc-aspect-16x9 'pc-aspect-21x9 'pc-aspect-32x9)) + +(define *pc-graphics-aspect-ratio-mode-remap* + (new 'static 'boxed-array :type game-text-id :length 5 :allocated-length 5 + (game-text-id process-aspect-ratio-4x3) + (game-text-id process-aspect-ratio-5x4) + (game-text-id process-aspect-ratio-16x9) + (game-text-id process-aspect-ratio-21x9) + (game-text-id process-aspect-ratio-32x9))) + +(define *pc-graphics-4x3-valid-resolutions* + (new 'static 'boxed-array :type symbol :length 5 :allocated-length 5 '640x480 '800x600 '1024x768 '1280x960 '1600x1200)) + +(define *pc-graphics-4x3-valid-resolutions-names* + (new 'static 'boxed-array :type game-text-id :length 5 :allocated-length 5 + (game-text-id process-res-4x3-640x480) + (game-text-id process-res-4x3-800x600) + (game-text-id process-res-4x3-1024x768) + (game-text-id process-res-4x3-1280x960) + (game-text-id process-res-4x3-1600x1200))) + +(define *pc-graphics-5x4-valid-resolutions* + (new 'static 'boxed-array :type symbol :length 3 :allocated-length 3 '960x768 '1280x1024 '1500x1200)) + +(define *pc-graphics-5x4-valid-resolutions-names* + (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 + (game-text-id process-res-5x4-960x768) + (game-text-id process-res-5x4-1280x1024) + (game-text-id process-res-5x4-1500x1200))) + +(define *pc-graphics-16x9-valid-resolutions* + (new 'static 'boxed-array :type symbol :length 7 :allocated-length 7 '854x480 '1280x720 '1920x1080 '2560x1440 '2880x1620 '3840x2160 '5120x2880)) + +(define *pc-graphics-16x9-valid-resolutions-names* + (new 'static 'boxed-array :type game-text-id :length 7 :allocated-length 7 + (game-text-id process-res-16x9-854x480) + (game-text-id process-res-16x9-1280x720) + (game-text-id process-res-16x9-1920x1080) + (game-text-id process-res-16x9-2560x1440) + (game-text-id process-res-16x9-2880x1620) + (game-text-id process-res-16x9-3840x2160) + (game-text-id process-res-16x9-5120x2880))) + +(define *pc-graphics-21x9-valid-resolutions* + (new 'static 'boxed-array :type symbol :length 6 :allocated-length 6 '2560x1080 '3120x1440 '3200x1440 '3440x1440 '3840x1600 '5120x2160)) + +(define *pc-graphics-21x9-valid-resolutions-names* + (new 'static 'boxed-array :type game-text-id :length 6 :allocated-length 6 + (game-text-id process-res-21x9-2560x1080) + (game-text-id process-res-21x9-3120x1440) + (game-text-id process-res-21x9-3200x1440) + (game-text-id process-res-21x9-3440x1440) + (game-text-id process-res-21x9-3840x1600) + (game-text-id process-res-21x9-5120x2160))) + +(define *pc-graphics-32x9-valid-resolutions* + (new 'static 'boxed-array :type symbol :length 1 :allocated-length 1 '5120x1440)) + +(define *pc-graphics-32x9-valid-resolutions-names* + (new 'static 'boxed-array :type game-text-id :length 1 :allocated-length 1 + (game-text-id process-res-32x9-5120x1440))) + +;; all level tasks +(define *level-task-data* + (new 'static 'boxed-array :type level-tasks-info :length 16 :allocated-length 16 + (new 'static 'level-tasks-info + :level-name-id (game-text-id training-level-name) + :text-group-index 1 + :nb-of-tasks 4 + :buzzer-task-index 3 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task training-gimmie) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id training-gimmie-task-name) + (game-text-id training-gimmie-task-name) + (game-text-id training-gimmie-task-name) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task training-door) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id training-door-task-name) + (game-text-id training-door-task-name) + (game-text-id training-door-task-name) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task training-climb) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id training-climb-task-name) + (game-text-id training-climb-task-name) + (game-text-id training-climb-task-name) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task training-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id training-buzzer-task-name) + (game-text-id training-buzzer-task-name) + (game-text-id training-buzzer-task-name) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id village1-level-name) + :text-group-index 1 + :nb-of-tasks 6 + :buzzer-task-index 5 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task village1-mayor-money) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village1-mayor-money) + (game-text-id village1-mayor-money) + (game-text-id village1-mayor-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village1-uncle-money) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id vollage1-uncle-money) + (game-text-id vollage1-uncle-money) + (game-text-id vollage1-uncle-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village1-yakow) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village1-yakow-herd) + (game-text-id village1-yakow-herd) + (game-text-id village1-yakow-return) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village1-oracle-money1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village1-oracle) + (game-text-id village1-oracle) + (game-text-id village1-oracle) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village1-oracle-money2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village1-oracle) + (game-text-id village1-oracle) + (game-text-id village1-oracle) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village1-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id beach-level-name) + :text-group-index 1 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task beach-ecorocks) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-ecorocks) + (game-text-id beach-ecorocks) + (game-text-id beach-ecorocks) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-flutflut) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-flutflut-push) + (game-text-id beach-flutflut-push) + (game-text-id beach-flutflut-meet) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-pelican) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-pelican) + (game-text-id beach-pelican) + (game-text-id beach-pelican) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-seagull) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-seagull) + (game-text-id beach-seagull) + (game-text-id beach-seagull-get) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-cannon) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-cannon) + (game-text-id beach-cannon) + (game-text-id beach-cannon) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-gimmie) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-gimmie) + (game-text-id beach-gimmie) + (game-text-id beach-gimmie) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-sentinel) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-sentinel) + (game-text-id beach-sentinel) + (game-text-id beach-sentinel) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task beach-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id jungle-level-name) + :text-group-index 1 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task jungle-lurkerm) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-lurkerm-unblock) + (game-text-id jungle-lurkerm-connect) + (game-text-id jungle-lurkerm-return) + (game-text-id zero) + ) + :text-index-when-resolved 1 + ) + (new 'static 'task-info-data + :task-id (game-task jungle-tower) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-tower) + (game-text-id jungle-tower) + (game-text-id jungle-tower) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-eggtop) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-eggtop) + (game-text-id jungle-eggtop) + (game-text-id jungle-eggtop) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-plant) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-plant) + (game-text-id jungle-plant) + (game-text-id jungle-plant) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-fishgame) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-fishgame) + (game-text-id jungle-fishgame) + (game-text-id jungle-fishgame) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-canyon-end) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-canyon-end) + (game-text-id jungle-canyon-end) + (game-text-id jungle-canyon-end) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-temple-door) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id jungle-temple-door) + (game-text-id jungle-temple-door) + (game-text-id jungle-temple-door) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task jungle-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id misty-level-name) + :text-group-index 1 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task misty-muse) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-muse-catch) + (game-text-id misty-muse-catch) + (game-text-id misty-muse-return) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-boat) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-boat) + (game-text-id misty-boat) + (game-text-id misty-boat) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-cannon) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-cannon) + (game-text-id misty-cannon) + (game-text-id misty-cannon) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-warehouse) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-return-to-pool) + (game-text-id misty-return-to-pool) + (game-text-id misty-return-to-pool) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-bike) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-find-transpad) + (game-text-id misty-balloon-lurkers) + (game-text-id misty-find-transpad) + (game-text-id zero) + ) + :text-index-when-resolved 1 + ) + (new 'static 'task-info-data + :task-id (game-task misty-bike-jump) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-bike-jump) + (game-text-id misty-bike-jump) + (game-text-id misty-bike-jump) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-eco-challenge) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id misty-eco-challenge) + (game-text-id misty-eco-challenge) + (game-text-id misty-eco-challenge) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task misty-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id beach-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id fire-canyon-level-name) + :text-group-index 5 + :nb-of-tasks 2 + :buzzer-task-index 1 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task firecanyon-end) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id fire-canyon-end) + (game-text-id fire-canyon-end) + (game-text-id fire-canyon-end) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task firecanyon-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id fire-canyon-buzzer) + (game-text-id fire-canyon-buzzer) + (game-text-id fire-canyon-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id village2-level-name) + :text-group-index 2 + :nb-of-tasks 6 + :buzzer-task-index 5 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task village2-gambler-money) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village2-gambler-money) + (game-text-id village2-gambler-money) + (game-text-id village2-gambler-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village2-geologist-money) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village2-geologist-money) + (game-text-id village2-geologist-money) + (game-text-id village2-geologist-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village2-warrior-money) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village2-warrior-money) + (game-text-id village2-warrior-money) + (game-text-id village2-warrior-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village2-oracle-money1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village2-oracle-money) + (game-text-id village2-oracle-money) + (game-text-id village2-oracle-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village2-oracle-money2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village2-oracle-money) + (game-text-id village2-oracle-money) + (game-text-id village2-oracle-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village2-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id sunken-level-name) + :text-group-index 2 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task sunken-room) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-elevator-raise) + (game-text-id sunken-elevator-raise) + (game-text-id sunken-elevator-get-to-roof) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-pipe) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-pipe) + (game-text-id sunken-pipe) + (game-text-id sunken-pipe) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-slide) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-bottom) + (game-text-id sunken-bottom) + (game-text-id sunken-bottom) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-sharks) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-pool) + (game-text-id sunken-pool) + (game-text-id sunken-pool) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-platforms) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-platforms) + (game-text-id sunken-platforms) + (game-text-id sunken-platforms) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-top-of-helix) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id sunken-climb-tube) + (game-text-id sunken-climb-tube) + (game-text-id sunken-climb-tube) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-spinning-room) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id reach-center) + (game-text-id reach-center) + (game-text-id reach-center) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task sunken-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id swamp-level-name) + :text-group-index 2 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task swamp-flutflut) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-flutflut) + (game-text-id swamp-flutflut) + (game-text-id swamp-flutflut) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-billy) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-billy) + (game-text-id swamp-billy) + (game-text-id swamp-billy) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-battle) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-battle) + (game-text-id swamp-battle) + (game-text-id swamp-battle) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-tether-4) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-tether-1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-tether-2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-tether-3) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id swamp-tether) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task swamp-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id rolling-level-name) + :text-group-index 2 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task rolling-moles) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-moles) + (game-text-id rolling-moles) + (game-text-id rolling-moles-return) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-robbers) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-robbers) + (game-text-id rolling-robbers) + (game-text-id rolling-robbers) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-race) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-race) + (game-text-id rolling-race) + (game-text-id rolling-race-return) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-lake) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-lake) + (game-text-id rolling-lake) + (game-text-id rolling-lake) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-plants) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-plants) + (game-text-id rolling-plants) + (game-text-id rolling-plants) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-ring-chase-1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-ring-chase-1) + (game-text-id rolling-ring-chase-1) + (game-text-id rolling-ring-chase-1) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-ring-chase-2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id rolling-ring-chase-2) + (game-text-id rolling-ring-chase-2) + (game-text-id rolling-ring-chase-2) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task rolling-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id unknown-buzzers) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id ogre-level-name) + :text-group-index 6 + :nb-of-tasks 4 + :buzzer-task-index 3 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task ogre-boss) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id ogre-boss) + (game-text-id ogre-boss) + (game-text-id ogre-boss) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task ogre-end) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id ogre-end) + (game-text-id ogre-end) + (game-text-id ogre-end) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task ogre-secret) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id hidden-power-cell) + (game-text-id hidden-power-cell) + (game-text-id hidden-power-cell) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task ogre-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id ogre-buzzer) + (game-text-id ogre-buzzer) + (game-text-id ogre-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id village3-level-name) + :text-group-index 3 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task village3-miner-money1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-miner-money2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-miner-money3) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-miner-money4) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id village3-miner-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-oracle-money1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-oracle-money) + (game-text-id village3-oracle-money) + (game-text-id village3-oracle-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-oracle-money2) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-oracle-money) + (game-text-id village3-oracle-money) + (game-text-id village3-oracle-money) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-extra1) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id hidden-power-cell) + (game-text-id hidden-power-cell) + (game-text-id hidden-power-cell) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task village3-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id snowy-level-name) + :text-group-index 3 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task snow-eggtop) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-eggtop) + (game-text-id snow-eggtop) + (game-text-id snow-eggtop) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-ram) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-ram-3-left) + (game-text-id snow-ram-2-left) + (game-text-id snow-ram-1-left) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-bumpers) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-bumpers) + (game-text-id snow-bumpers) + (game-text-id snow-bumpers) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-cage) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-frozen-crate) + (game-text-id snow-frozen-crate) + (game-text-id snow-frozen-crate) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-fort) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-fort) + (game-text-id snow-fort) + (game-text-id snow-fort) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-ball) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-open-door) + (game-text-id snow-open-door) + (game-text-id snow-open-door) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-bunnies) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id snow-bunnies) + (game-text-id snow-bunnies) + (game-text-id snow-bunnies) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task snow-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id cave-level-name) + :text-group-index 3 + :nb-of-tasks 8 + :buzzer-task-index 7 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task cave-gnawers) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-gnawers) + (game-text-id cave-gnawers) + (game-text-id cave-gnawers) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-dark-crystals) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-dark-crystals) + (game-text-id cave-dark-crystals) + (game-text-id cave-dark-crystals) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-dark-climb) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-dark-climb) + (game-text-id cave-dark-climb) + (game-text-id cave-dark-climb) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-robot-climb) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-robot-climb) + (game-text-id cave-robot-climb) + (game-text-id cave-robot-climb) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-swing-poles) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-swing-poles) + (game-text-id cave-swing-poles) + (game-text-id cave-swing-poles) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-spider-tunnel) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-spider-tunnel) + (game-text-id cave-spider-tunnel) + (game-text-id cave-spider-tunnel) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-platforms) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id cave-platforms) + (game-text-id cave-platforms) + (game-text-id cave-platforms) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task cave-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id village3-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id lavatube-level-name) + :text-group-index 3 + :nb-of-tasks 2 + :buzzer-task-index 1 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task lavatube-end) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id lavatube-end) + (game-text-id lavatube-end) + (game-text-id lavatube-end) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task lavatube-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id lavatube-buzzer) + (game-text-id lavatube-buzzer) + (game-text-id lavatube-buzzer) + (game-text-id zero) + ) + ) + ) + ) + (new 'static 'level-tasks-info + :level-name-id (game-text-id citadel-level-name) + :text-group-index 4 + :nb-of-tasks 5 + :buzzer-task-index 4 + :task-info + (new 'static 'array task-info-data 8 + (new 'static 'task-info-data + :task-id (game-task citadel-sage-blue) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id citadel-sage-blue) + (game-text-id citadel-sage-blue) + (game-text-id citadel-sage-blue) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task citadel-sage-red) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id citadel-sage-red) + (game-text-id citadel-sage-red) + (game-text-id citadel-sage-red) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task citadel-sage-yellow) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id citadel-sage-yellow) + (game-text-id citadel-sage-yellow) + (game-text-id citadel-sage-yellow) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task citadel-sage-green) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id citadel-sage-green) + (game-text-id citadel-sage-green) + (game-text-id citadel-sage-green) + (game-text-id zero) + ) + ) + (new 'static 'task-info-data + :task-id (game-task citadel-buzzer) + :task-name + (new 'static 'array game-text-id 4 + (game-text-id citadel-buzzer) + (game-text-id citadel-buzzer) + (game-text-id citadel-buzzer) + (game-text-id zero) + ) + ) + ) + ) + ) + ) + +;; goes down by 24 or 23 every time +(define *task-egg-starting-x* + (new 'static 'boxed-array :type int32 :length 9 :allocated-length 9 + 218 + 194 + 171 + 147 + 124 + 100 + 77 + 53 + 30 + ) + ) + +(define *game-counts* (the-as game-count-info #f)) + + + + diff --git a/goal_src/pc/engine/ui/progress/progress.gc b/goal_src/pc/engine/ui/progress/progress.gc new file mode 100644 index 0000000000..ccdbc7cd21 --- /dev/null +++ b/goal_src/pc/engine/ui/progress/progress.gc @@ -0,0 +1,2732 @@ +;;-*-Lisp-*- +(in-package goal) + +;; name: progress.gc +;; name in dgo: progress +;; dgos: GAME, ENGINE + +;; DECOMP BEGINS + +(deftype progress-global-state (basic) + ((aspect-ratio-choice symbol :offset-assert 4) + (video-mode-choice symbol :offset-assert 8) + (yes-no-choice symbol :offset-assert 12) + (which int32 :offset-assert 16) + (starting-state progress-screen :offset-assert 24) + (last-slot-saved int32 :offset-assert 32) + (slider-backup float :offset-assert 36) + (language-backup int64 :offset-assert 40) + (on-off-backup symbol :offset-assert 48) + (center-x-backup int32 :offset-assert 52) + (center-y-backup int32 :offset-assert 56) + (aspect-ratio-backup symbol :offset-assert 60) + (last-slider-sound time-frame :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x48 + :flag-assert #x900000048 + ) + +(define *progress-state* + (new 'static 'progress-global-state + :yes-no-choice #f + :which -1 + :last-slot-saved -1 + ) + ) + + +(defun get-game-count ((arg0 int)) + (-> *game-counts* data arg0) + ) + +(defun progress-allowed? () + (not (or (-> *setting-control* current talking) + (-> *setting-control* current movie) + (movie?) + (handle->process (-> *game-info* pov-camera-handle)) + (handle->process (-> *game-info* other-camera-handle)) + (< (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) + (< (-> *display* base-frame-counter) (-> *game-info* blackout-time)) + (!= (-> *setting-control* current bg-a) 0.0) + (!= (-> *setting-control* current bg-a-force) 0.0) + (not (-> *setting-control* current allow-progress)) + (or (and (handle->process (-> *game-info* auto-save-proc)) + (not (send-event (handle->process (-> *game-info* auto-save-proc)) 'progress-allowed?)) + ) + (not *target*) + ) + ) + ) + ) + +(defun pause-allowed? () + (not (or (< (-> *display* base-frame-counter) (-> *game-info* blackout-time)) + (!= (-> *setting-control* current bg-a) 0.0) + (!= (-> *setting-control* current bg-a-force) 0.0) + (not (-> *setting-control* current allow-pause)) + (handle->process (-> *game-info* auto-save-proc)) + (not *target*) + ) + ) + ) + +(defun init-game-options ((obj progress)) + "Set the options for all of the menus." + + ;; start off by making them all invalid + (dotimes (i (-> *options-remap* allocated-length)) + (set! (-> *options-remap* i) #f) + ) + + ;; main menu + (set! (-> *options-remap* 3) + (case *kernel-boot-message* + (('demo) + ;; game demo + *main-options-demo* + ) + (('demo-shared) + ;; game demo with external launcher + *main-options-demo-shared* + ) + (else + ;; normal game + *main-options* + ) + ) + ) + (set! (-> *options-remap* 4) + (cond + ((!= *kernel-boot-message* 'play) + (if (= (scf-get-territory) GAME_TERRITORY_SCEE) + *game-options* + *game-options-demo* + ) + ) + ((and (= (scf-get-territory) GAME_TERRITORY_SCEI) + (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))) + ;; if ntsc-j and we're not using language cheat (needs l2+r2) + *game-options-japan* + ) + (else + *game-options* + ) + ) + ) + (set! (-> *options-remap* 5) + (if (and (= (-> *progress-state* starting-state) 27) + (or (= (scf-get-territory) GAME_TERRITORY_SCEE) + (and (= *progress-cheat* 'pal) + (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2)) + (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r2)) + ) + ) + ) + ;; (only if we came from title) if PAL or we're using the PAL cheat (needs l2+r2) + *graphic-title-options-pal* + *graphic-options* + ) + ) + (set! (-> *options-remap* 6) *sound-options*) + (set! (-> *options-remap* 7) *ok-options*) + (set! (-> *options-remap* 8) *ok-options*) + (set! (-> *options-remap* 9) *ok-options*) + (set! (-> *options-remap* 10) *yes-no-options*) + (set! (-> *options-remap* 11) *yes-no-options*) + (set! (-> *options-remap* 19) *ok-options*) + (set! (-> *options-remap* 16) *load-options*) + (set! (-> *options-remap* 17) *save-options*) + (set! (-> *options-remap* 18) *save-options-title*) + (set! (-> *options-remap* 20) *ok-options*) + (set! (-> *options-remap* 21) *ok-options*) + (set! (-> *options-remap* 24) *ok-options*) + (set! (-> *options-remap* 25) *ok-options*) + (set! (-> *options-remap* 26) *ok-options*) + (set! (-> *options-remap* 22) *ok-options*) + (set! (-> *options-remap* 23) *yes-no-options*) + (set! (-> *options-remap* 27) *title*) + (set! (-> *options-remap* 28) *options*) + (set! (-> *options-remap* 29) *ok-options*) + (set! (-> *options-remap* 30) *yes-no-options*) + (set! (-> *options-remap* 31) *yes-no-options*) + (set! (-> *options-remap* 32) *ok-options*) + (set! (-> *options-remap* 33) *ok-options*) + (set! (-> *options-remap* 34) *yes-no-options*) + (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) + (set! (-> *progress-state* video-mode-choice) (get-video-mode)) + (set! (-> *progress-state* yes-no-choice) #f) + (set! (-> *game-options* 0 value-to-modify) (&-> *setting-control* default vibration)) + (set! (-> *game-options* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *game-options-japan* 0 value-to-modify) (&-> *setting-control* default vibration)) + (set! (-> *game-options-japan* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *game-options-demo* 0 value-to-modify) (&-> *setting-control* default vibration)) + (set! (-> *game-options-demo* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *graphic-title-options-pal* 1 value-to-modify) (&-> *progress-state* video-mode-choice)) + (set! (-> *graphic-title-options-pal* 2 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) + (set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) + (set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume)) + (set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) + (set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice)) + + ;; new stuff + (set! (-> *options-remap* 35) *language-options*) + (set! (-> *game-options* 3 value-to-modify) (&-> *pc-settings* discord-rpc?)) + (set! (-> *language-options* 0 value-to-modify) (&-> *setting-control* default language)) + (set! (-> *language-options* 1 value-to-modify) (&-> *pc-settings* subtitles?)) + (set! (-> *language-options* 2 value-to-modify) (&-> *pc-settings* subtitle-language)) + (set! (-> *language-options* 3 value-to-modify) (&-> *pc-settings* subtitle-speaker?)) ;; TODO - refactor this like i did with display-mode + (set! (-> *graphic-options* 0 value-to-modify) (&-> *pc-settings* display-mode)) + (set! (-> *graphic-options* 1 value-to-modify) (&-> *pc-settings* aspect-ratio-mode)) + (set! (-> *graphic-options* 2 value-to-modify) (&-> *pc-settings* resolution)) + (set! (-> *graphic-options* 3 value-to-modify) (&-> *pc-settings* letterbox?)) + + (none) + ) + +(defun make-current-level-available-to-progress () + "exactly what it says on the tin." + + (when (and *target* (-> *level* border?)) + (let* ((cur-lev (-> *target* current-level)) + (lev-idx (+ (-> cur-lev info index) -1)) + ) + (if (and (>= lev-idx 0) + (< lev-idx (-> *level-task-data-remap* length)) + (zero? (-> *game-info* level-opened (-> *level-task-data-remap* lev-idx))) + (or (= *kernel-boot-message* 'play) (= (-> cur-lev nickname) 'mis)) + ) + (set! (-> *game-info* level-opened (-> *level-task-data-remap* lev-idx)) (the-as uint 1)) + ) + ) + ) + 0 + (none) + ) + +(defun make-levels-with-tasks-available-to-progress () + "Open levels that have tasks to do!" + + ;; go through EVERY LEVEL'S TASKS + (dotimes (i (length *level-task-data*)) + ;; level tasks + (let ((tasks (-> *level-task-data* i))) + ;; unless there's no tasks or the level is already open... + (unless (or (= tasks #f) (= (-> *game-info* level-opened i) 1)) + (cond + ((!= *kernel-boot-message* 'play) + (if (= (-> tasks level-name-id) (game-text-id misty-level-name)) + (set! (-> *game-info* level-opened i) (the-as uint 1)) + ) + ) + (*cheat-mode* + (set! (-> *game-info* level-opened i) (the-as uint 1)) + ) + (else + (dotimes (ii (-> tasks nb-of-tasks)) + (if (and (zero? (-> *game-info* level-opened ii)) + (!= ii (-> tasks buzzer-task-index)) + (task-known? (-> tasks task-info ii task-id)) + ) + (set! (-> *game-info* level-opened ii) (the-as uint 1)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defun get-next-task-up ((cur-task-idx int) (lev-idx int)) + "find next available task. skips over unknown tasks and doesn't do anything if none are found" + + (let ((gp-0 cur-task-idx)) + (let ((s4-0 (+ cur-task-idx 1)) + (s3-0 (-> *level-task-data* lev-idx)) + ) + (while (and (< s4-0 (-> s3-0 nb-of-tasks)) (= gp-0 cur-task-idx)) + (if (or *cheat-mode* (task-known? (-> s3-0 task-info s4-0 task-id))) + (set! gp-0 s4-0) + ) + (+! s4-0 1) + ) + ) + gp-0 + ) + ) + +(defun get-next-task-down ((cur-task-idx int) (lev-idx int)) + "find previous available task. skips over unknown tasks and doesn't do anything if none are found" + + (let ((gp-0 cur-task-idx)) + (let ((s4-0 (+ cur-task-idx -1)) + (s3-0 (-> *level-task-data* lev-idx)) + ) + (while (and (>= s4-0 0) (= gp-0 cur-task-idx)) + (if (or *cheat-mode* (task-known? (-> s3-0 task-info s4-0 task-id))) + (set! gp-0 s4-0) + ) + (+! s4-0 -1) + ) + ) + gp-0 + ) + ) + +(defun get-next-level-up ((lev-idx int)) + (let ((gp-0 lev-idx)) + (let ((s4-0 (+ lev-idx 1))) + (while (and (< s4-0 (length *level-task-data*)) (= gp-0 lev-idx)) + (if (= (-> *game-info* level-opened s4-0) 1) + (set! gp-0 s4-0) + ) + (+! s4-0 1) + ) + ) + gp-0 + ) + ) + +(defun get-next-level-down ((lev-idx int)) + (let ((v0-0 lev-idx)) + (let ((v1-0 (+ lev-idx -1))) + (while (and (>= v1-0 0) (= v0-0 lev-idx)) + (if (= (-> *game-info* level-opened v1-0) 1) + (set! v0-0 v1-0) + ) + (+! v1-0 -1) + ) + ) + v0-0 + ) + ) + +(defun calculate-completion ((the-progress progress)) + "Updates counters and calculates game completion. + Cells are tallied 80% + Buzzers are tallied 10% + Orbs are tallied 10%" + + (local-vars + (current-cells int) + (current-buzzers int) + (current-orbs int) + (total-cells int) + (total-buzzers int) + (total-orbs int) + ) + (set! current-cells 0) + (set! current-buzzers 0) + (set! current-orbs 0) + (set! total-cells 0) + (set! total-buzzers 0) + (set! total-orbs 0) + (dotimes (s5-0 (length *level-task-data*)) + (let ((s4-0 (-> *level-task-data* s5-0))) + (when (!= s4-0 #f) + (when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (game-text-id misty-level-name))) + (dotimes (s3-0 (-> s4-0 nb-of-tasks)) + (if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid)) + (set! current-cells (+ current-cells 1)) + ) + ) + (set! total-cells (+ total-cells (-> s4-0 nb-of-tasks))) + (set! current-orbs (+ current-orbs (-> *game-info* money-per-level s5-0))) + (set! total-orbs (+ total-orbs (-> *game-counts* data s5-0 money-count))) + (let ((v1-20 (-> s4-0 buzzer-task-index))) + (when (!= v1-20 -1) + (set! current-buzzers (+ current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id)))) + (set! total-buzzers (+ total-buzzers (-> *game-counts* data s5-0 buzzer-count))) + ) + ) + ) + ) + ) + ) + (when the-progress + (set! (-> the-progress total-nb-of-power-cells) total-cells) + (set! (-> the-progress total-nb-of-buzzers) total-buzzers) + (set! (-> the-progress total-nb-of-orbs) total-orbs) + ) + (+ (/ (* 80.0 (the float current-cells)) (the float total-cells)) + (/ (* 10.0 (the float current-orbs)) (the float total-orbs)) + (/ (* 10.0 (the float current-buzzers)) (the float total-buzzers)) + ) + ) + +(define *progress-save-info* (new 'global 'mc-slot-info)) + +(defmacro progress-make-manipy-icon (obj &key skel + &key x + &key y + &key z + &key scale-x + &key scale-y + ) + `(when (< (-> ,obj nb-of-icons) 6) + (let ((icon-idx (-> ,obj nb-of-icons))) + (set! (-> ,obj icons icon-idx) (new 'static 'hud-icon)) + (let ((new-manipy (make-init-process manipy manipy-init (new 'static 'vector :w 1.0) #f ,skel #f + :to ,obj + :stack *scratch-memory-top* + ))) + (when new-manipy + (set! (-> (-> new-manipy) draw dma-add-func) dma-add-process-drawable-hud) + (set-vector! (-> (-> new-manipy) root trans) 0.0 0.0 0.0 1.0) + (set-vector! (-> (-> new-manipy) root scale) ,scale-x ,scale-y ,scale-x 1.0) + (when #f + (send-event (ppointer->process new-manipy) 'trans-hook #f) + ) + ) + (set! (-> ,obj icons icon-idx icon) new-manipy) + (when new-manipy + (logior! (-> new-manipy 0 mask) (process-mask pause)) + (logclear! (-> new-manipy 0 mask) (process-mask menu progress)) + (set! (-> (-> new-manipy) root trans z) ,z) + (set! (-> ,obj icons icon-idx icon-x) ,x) + (set! (-> ,obj icons icon-idx icon-y) ,y) + (set! (-> ,obj icons icon-idx icon-z) 0) + (set! (-> ,obj icons icon-idx scale-x) ,scale-x) + (set! (-> ,obj icons icon-idx scale-y) ,scale-y) + ) + ) + ) + (+! (-> ,obj nb-of-icons) 1) + ) + ) + +(defmethod initialize-icons progress ((obj progress)) + (progress-make-manipy-icon obj :skel *fuelcell-naked-sg* + :x 256 + :y 77 + :z (meters 0.5) + :scale-x 0.006 + :scale-y 0.006 + ) + (progress-make-manipy-icon obj :skel *fuelcell-naked-sg* + :x 256 + :y 77 + :z (meters 0.5) + :scale-x 0.006 + :scale-y 0.006 + ) + (progress-make-manipy-icon obj :skel *fuelcell-naked-sg* + :x 256 + :y 77 + :z (meters 0.5) + :scale-x 0.006 + :scale-y 0.006 + ) + (progress-make-manipy-icon obj :skel *fuelcell-naked-sg* + :x 256 + :y 77 + :z (meters 0.5) + :scale-x 0.006 + :scale-y 0.006 + ) + (progress-make-manipy-icon obj :skel *money-sg* + :x -320 + :y 253 + :z (meters 17) + :scale-x 0.013 + :scale-y -0.015 + ) + (progress-make-manipy-icon obj :skel *money-sg* + :x -320 + :y 253 + :z (meters 0.25) + :scale-x 0.008 + :scale-y -0.009 + ) + (send-event (ppointer->process (-> obj icons 1 icon)) 'set-frame-num 2.5) + (send-event (ppointer->process (-> obj icons 2 icon)) 'set-frame-num 10.0) + (send-event (ppointer->process (-> obj icons 3 icon)) 'set-frame-num 15.5) + 0 + (none) + ) + +(defmethod enter! progress ((obj progress) (screen progress-screen) (option int)) + (when (!= (-> obj display-state) screen) + (set! (-> *progress-state* yes-no-choice) #f) + (set! (-> obj selected-option) #f) + (set! (-> obj option-index) option) + (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) + (set! (-> obj display-state) screen) + (set! (-> obj next-display-state) screen) + (set-transition-speed! obj) + (case (-> obj display-state) + (((progress-screen memcard-creating)) + (auto-save-command 'create-file 0 0 obj) + ) + (((progress-screen memcard-loading)) + (set! (-> *progress-state* last-slot-saved) (-> *progress-state* which)) + (sound-volume-off) + (auto-save-command 'restore 0 (-> *progress-state* which) obj) + ) + (((progress-screen memcard-saving)) + (set! (-> *progress-state* last-slot-saved) (-> *progress-state* which)) + (auto-save-command 'save 0 (-> *progress-state* which) obj) + ) + (((progress-screen memcard-formatting)) + (auto-save-command 'format-card 0 0 obj) + ) + (((progress-screen save-game) (progress-screen load-game)) + (set! (-> obj option-index) (max 0 (-> *progress-state* last-slot-saved))) + ) + (((progress-screen memcard-removed)) + (set! (-> *progress-state* last-slot-saved) 0) + 0 + ) + ) + ) + 0 + (none) + ) + +(defmethod push! progress ((obj progress)) + (let ((v1-0 (-> obj display-state-pos))) + (cond + ((< v1-0 5) + (set! (-> obj display-state-stack v1-0) (-> obj display-state)) + (set! (-> obj option-index-stack v1-0) (-> obj option-index)) + (set! (-> obj display-state-pos) (+ v1-0 1)) + ) + (else + (format #t "ERROR: Can't push any more states on the display-state-stack.~%") + ) + ) + ) + 0 + (none) + ) + +(defmethod pop! progress ((obj progress)) + (let ((v1-0 (-> obj display-state-pos))) + (cond + ((> v1-0 0) + (let ((a2-0 (+ v1-0 -1))) + (set! (-> obj display-state-pos) a2-0) + (enter! obj (-> obj display-state-stack a2-0) (-> obj option-index-stack a2-0)) + ) + ) + (else + (set-master-mode 'game) + ) + ) + ) + 0 + (none) + ) + +(defmethod set-transition-progress! progress ((obj progress) (arg0 int)) + (set! (-> obj transition-offset) arg0) + (set! (-> obj transition-offset-invert) (- 512 arg0)) + (set! (-> obj transition-percentage) (* 0.001953125 (the float arg0))) + (set! (-> obj transition-percentage-invert) (- 1.0 (-> obj transition-percentage))) + 0 + (none) + ) + +(defmethod set-transition-speed! progress ((obj progress)) + (case (-> obj display-state) + (((progress-screen fuel-cell) + (progress-screen money) + (progress-screen buzzer) + (progress-screen load-game) + (progress-screen save-game) + (progress-screen save-game-title) + ) + (set! (-> obj transition-speed) 15.0) + ) + (else + (set! (-> obj transition-speed) 45.0) + ) + ) + 0 + (none) + ) + +(defbehavior progress-init-by-other progress () + (logclear! (-> self mask) (process-mask menu progress)) + (set! (-> self nb-of-particles) 0) + (set! (-> self max-nb-of-particles) 40) + (set! (-> self nb-of-icons) 0) + (set! (-> self in-out-position) 4096) + (set! (-> self current-debug-string) 0) + (set! (-> self current-debug-group) 0) + (set! (-> self display-level-index) 0) + (set! (-> self next-level-index) 0) + (set! (-> self option-index) 0) + (set! (-> self selected-option) #f) + (set! (-> self card-info) #f) + (set! (-> self last-option-index-change) (-> *display* real-frame-counter)) + (set! (-> self display-state-pos) 0) + (set! (-> self in-transition) #f) + (set! (-> self force-transition) #f) + (set! (-> self stat-transition) #f) + (set! (-> self level-transition) 0) + (set! (-> self left-side-x-scale) 0.0) + (set! (-> self left-side-y-scale) 0.0) + (set! (-> self right-side-x-scale) 0.0) + (set! (-> self right-side-y-scale) 0.0) + (dotimes (v1-6 5) + (set! (-> self display-state-stack v1-6) (progress-screen fuel-cell)) + ) + (init-game-options self) + (initialize-icons self) + (initialize-particles self) + (set! (-> self particle-state 0) 0) + (set! (-> self particle-state 1) 0) + (set! (-> self particle-state 2) 0) + (set! (-> self particle-state 3) 0) + (set! (-> self particle-state 4) 0) + (set! (-> self particle-state 5) 0) + (set! (-> self particle-state 6) 1) + (set! (-> self particle-state 7) 1) + (set! (-> self particle-state 8) 1) + (set! (-> self particle-state 9) 1) + (set! (-> self particle-state 10) 1) + (set! (-> self particle-state 11) 1) + (set! (-> self particle-state 12) 1) + (set! (-> self particle-state 13) 1) + (set! (-> self particle-state 14) 0) + (set! (-> self particle-state 15) 0) + (set! (-> self particle-state 16) 3) + (set! (-> self particle-state 17) 0) + (set! (-> self particle-state 18) 0) + (set! (-> self particle-state 19) 0) + (set! (-> self particle-state 20) 0) + (set! (-> self particle-state 21) 0) + (set! (-> self particle-state 22) 0) + (set! (-> self particle-state 23) 0) + (set! (-> self particle-state 24) 0) + (set! (-> self particle-state 25) 0) + (set! (-> self particle-state 26) 0) + (set! (-> self particle-state 27) 0) + (set! (-> self particle-state 28) 0) + (set! (-> self particle-state 29) 0) + (set! (-> self particle-state 30) 0) + (set! (-> self particle-state 31) 0) + (let ((gp-0 (new 'stack-no-clear 'quaternion))) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 16384.0) + (quaternion*! (-> self icons 0 icon 0 root quat) gp-0 (-> self icons 0 icon 0 root quat)) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 32768.0) + (quaternion*! (-> self icons 1 icon 0 root quat) gp-0 (-> self icons 1 icon 0 root quat)) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 49152.0) + (quaternion*! (-> self icons 2 icon 0 root quat) gp-0 (-> self icons 2 icon 0 root quat)) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 0.0) + (quaternion*! (-> self icons 3 icon 0 root quat) gp-0 (-> self icons 3 icon 0 root quat)) + ) + (adjust-ratios self (get-aspect-ratio) (get-video-mode)) + (adjust-icons self) + (set! (-> self event-hook) (-> progress-waiting event)) + (go progress-waiting) + (none) + ) + +(define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800))) +(defconstant *progress-stack-top* (&-> *progress-stack* #x3800)) + +(defun activate-progress ((creator process) (screen progress-screen)) + (when *target* + (cond + ((not *progress-process*) + (when (progress-allowed?) + (hide-hud) + (make-levels-with-tasks-available-to-progress) + (disable-level-text-file-loading) + (set! (-> *progress-state* starting-state) screen) + (let ((s4-0 (get-process *default-dead-pool* progress #x4000))) + (set! *progress-process* + (the-as (pointer progress) (when s4-0 + (let ((t9-5 (method-of-type progress activate))) + (t9-5 (the-as progress s4-0) creator 'progress (&-> *progress-stack* 14336)) + ) + (run-now-in-process s4-0 progress-init-by-other) + (-> s4-0 ppointer) + ) + ) + ) + ) + (let ((s5-1 *progress-process*)) + (set! (-> s5-1 0 completion-percentage) (calculate-completion (-> s5-1 0))) + (set! *master-mode* 'progress) + (let ((s4-1 (-> *target* current-level))) + (cond + ((!= *kernel-boot-message* 'play) + (set! (-> s5-1 0 display-level-index) 4) + ) + ((or (= s4-1 #f) (< (length *level-task-data-remap*) (-> s4-1 info index))) + (set! (-> s5-1 0 display-level-index) 0) + 0 + ) + (else + (set! (-> s5-1 0 display-level-index) (-> *level-task-data-remap* (+ (-> s4-1 info index) -1))) + ) + ) + ) + (set! (-> s5-1 0 next-level-index) (-> s5-1 0 display-level-index)) + (set! (-> s5-1 0 display-state) (progress-screen invalid)) + (set-transition-progress! (-> s5-1 0) 512) + (set! (-> s5-1 0 task-index) (get-next-task-up -1 (-> s5-1 0 display-level-index))) + ) + ) + (when *progress-process* + (enter! (-> *progress-process* 0) screen 0) + (set! (-> *progress-process* 0 card-info) #f) + ) + ) + (else + (push! (-> *progress-process* 0)) + (set! (-> *progress-process* 0 next-display-state) screen) + (set! (-> *progress-process* 0 card-info) #f) + ) + ) + ) + 0 + (none) + ) + +(defun deactivate-progress () + (when (and *progress-process* (= (-> *progress-process* 0 next-state name) 'progress-gone)) + (copy-settings-from-target! *setting-control*) + (dotimes (gp-0 (-> *progress-process* 0 nb-of-particles)) + (kill-and-free-particles (-> *progress-process* 0 particles gp-0 part)) + (set! (-> *progress-process* 0 particles gp-0 part matrix) -1) + ) + (set! (-> *progress-process* 0 nb-of-particles) 0) + (deactivate (-> *progress-process* 0)) + (set! *progress-process* (the-as (pointer progress) #f)) + (enable-level-text-file-loading) + ) + 0 + (none) + ) + +(defun hide-progress-screen () + "shoo!" + + (if *progress-process* + (send-event (ppointer->process *progress-process*) 'go-away) + ) + 0 + (none) + ) + +(defun hide-progress-icons () + (let ((v1-0 6)) + (dotimes (a0-0 8) + (set! (-> *progress-process* 0 particles v1-0 init-pos x) -320.0) + (+! v1-0 1) + ) + ) + (set! (-> *progress-process* 0 particles 5 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 14 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 15 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 19 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 20 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 21 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 22 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 23 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 24 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 25 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 26 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 27 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 28 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 29 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 30 init-pos x) -320.0) + (set! (-> *progress-process* 0 particles 31 init-pos x) -320.0) + (set! (-> *progress-process* 0 icons 4 icon-x) -320) + 0 + (none) + ) + +(defmethod relocate game-count-info ((obj game-count-info) (arg0 int)) + "Load in the game-count-info. This is a bit of a hack." + (set! *game-counts* obj) + ) + +(defmethod relocate progress ((obj progress) (arg0 int)) + (dotimes (v1-0 (-> obj nb-of-particles)) + (when (-> obj particles v1-0 part) + (if (nonzero? (-> obj particles v1-0 part)) + (set! (-> obj particles v1-0 part) + (the-as sparticle-launch-control (&+ (the-as pointer (-> obj particles v1-0 part)) arg0)) + ) + ) + ) + ) + (the-as progress ((method-of-type process relocate) obj arg0)) + ) + +(defmethod adjust-sprites progress ((obj progress)) + (let ((f0-1 (* (1/ METER_LENGTH) (the float (-> obj in-out-position))))) + (set! (-> obj particles 2 init-pos x) (the float (+ (-> obj right-x-offset) 409 (the int (* 301.5 f0-1))))) + (set! (-> obj particles 1 init-pos x) (the float (+ (-> obj left-x-offset) 59))) + (set! (-> obj left-side-x-scale) (meters (+ (/ 3.5 (-> obj sides-x-scale)) (* 10.0 f0-1)))) + (set! (-> obj left-side-y-scale) (meters (+ (-> obj sides-y-scale) (* 10.0 f0-1)))) + (set! (-> obj right-side-x-scale) (meters (+ (/ 6.0 (-> obj sides-x-scale)) (* 4.0 f0-1)))) + (set! (-> obj right-side-y-scale) (meters (+ (-> obj sides-y-scale) (* 4.0 f0-1)))) + ) + (dotimes (s5-0 (-> obj nb-of-particles)) + (set! (-> obj particles s5-0 pos x) (+ -256.0 (-> obj particles s5-0 init-pos x))) + (set! (-> obj particles s5-0 pos y) + (* 0.5 (- (* (-> obj particles s5-0 init-pos y) (-> *video-parms* relative-y-scale)) + (the float (-> *video-parms* screen-sy)) + ) + ) + ) + (set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z)) + (if (> (-> obj particles s5-0 part matrix) 0) + (set-vector! (sprite-get-user-hvdf (-> obj particles s5-0 part matrix)) + (the float (+ (the int (-> obj particles s5-0 pos x)) 2048)) + (the float (+ (the int (-> obj particles s5-0 pos y)) 2048)) + (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z))) + (-> *math-camera* hvdf-off w) + ) + ) + (spawn (-> obj particles s5-0 part) *null-vector*) + ) + 0 + (none) + ) + +(defmethod adjust-icons progress ((obj progress)) + (dotimes (v1-0 (-> obj nb-of-icons)) + (when (>= v1-0 4) + (set-vector! (-> obj icons v1-0 icon 0 root scale) + (* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale)) + (* (-> obj icons v1-0 scale-y) (-> *video-parms* relative-y-scale)) + (* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale)) + 1.0 + ) + (set! (-> obj icons v1-0 icon 0 root trans x) (the float (+ (-> obj icons v1-0 icon-x) -256))) + (set! (-> obj icons v1-0 icon 0 root trans y) + (* (-> *video-parms* relative-y-scale) + (- (* (-> *video-parms* relative-y-scale) (the float (-> obj icons v1-0 icon-y))) + (the float (-> *video-parms* screen-sy)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod adjust-ratios progress ((obj progress) (aspect symbol) (video-mode symbol)) + (case aspect + (('aspect4x3) + (set! (-> obj sides-x-scale) 1.0) + (set! (-> obj sides-y-scale) 13.0) + (set! (-> obj left-x-offset) 0) + (set! (-> obj right-x-offset) 0) + (set! (-> obj button-scale) 1.0) + (set! (-> obj slot-scale) 8192.0) + (set! (-> obj small-orb-y-offset) 58) + (set! (-> obj icons 5 scale-x) 0.008) + (set! (-> obj icons 5 scale-y) -0.009) + (set! (-> obj big-orb-y-offset) 243) + (set! (-> obj icons 4 scale-x) 0.013) + (set! (-> obj icons 4 scale-y) -0.015) + ) + (('aspect16x9) + (set! (-> obj sides-x-scale) 1.2) + (set! (-> obj sides-y-scale) 9.8) + (set! (-> obj left-x-offset) -10) + (set! (-> obj right-x-offset) 17) + (set! (-> obj button-scale) 1.05) + (set! (-> obj slot-scale) 6144.0) + (set! (-> obj small-orb-y-offset) 59) + (set! (-> obj icons 5 scale-x) 0.008) + (set! (-> obj icons 5 scale-y) -0.0098) + (set! (-> obj big-orb-y-offset) 255) + (set! (-> obj icons 4 scale-x) 0.017) + (set! (-> obj icons 4 scale-y) -0.0205) + ) + ) + (when (= video-mode 'pal) + (set! (-> obj icons 5 scale-y) (* 1.15 (-> obj icons 5 scale-y))) + (set! (-> obj icons 4 scale-x) (* 1.05 (-> obj icons 4 scale-x))) + (set! (-> obj icons 4 scale-y) (* (-> obj icons 4 scale-y) (the-as float (if (= aspect 'aspect16x9) + 1.18 + 1.15 + ) + ) + ) + ) + (+! (-> obj big-orb-y-offset) (if (= aspect 'aspect16x9) + 3 + 2 + ) + ) + ) + 0 + (none) + ) + +(defmethod dummy-32 progress ((obj progress)) + (let ((v1-2 (-> *progress-process* 0 display-state)) + (a1-1 (-> *progress-state* starting-state)) + ) + (and (= (-> obj next-state name) 'progress-normal) + (not (-> obj in-transition)) + (not (-> obj selected-option)) + (or (= v1-2 (progress-screen fuel-cell)) + (= v1-2 (progress-screen money)) + (= v1-2 (progress-screen buzzer)) + (and (or (= a1-1 (progress-screen fuel-cell)) + (= a1-1 (progress-screen money)) + (= a1-1 (progress-screen buzzer)) + (= a1-1 (progress-screen title)) + ) + (or (= v1-2 (progress-screen settings)) + (= v1-2 (progress-screen game-settings)) + (= v1-2 (progress-screen graphic-settings)) + (= v1-2 (progress-screen sound-settings)) + (= v1-2 (progress-screen title)) + (= v1-2 (progress-screen settings-title)) + (= v1-2 (progress-screen language-options)) + ) + ) + ) + ) + ) + ) + +(defmethod dummy-19 progress ((obj progress)) + (the-as symbol (and *progress-process* (zero? (-> *progress-process* 0 in-out-position)))) + ) + +(defmethod hidden? progress ((obj progress)) + (or (not *progress-process*) (= (-> *progress-process* 0 in-out-position) 4096)) + ) + +(defstate progress-waiting (progress) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go-away) + (go progress-gone) + ) + ) + ) + :code + (behavior () + (loop + (when (hud-hidden?) + (dotimes (gp-0 (-> self nb-of-particles)) + (if (= (-> self particles gp-0 part matrix) -1) + (set! (-> self particles gp-0 part matrix) (sprite-allocate-user-hvdf)) + ) + ) + (set-setting! *setting-control* self 'common-page 'set 0.0 1) + (suspend) + (go progress-coming-in) + ) + (suspend) + ) + (none) + ) + ) + +(defstate progress-gone (progress) + :code + (behavior () + (clear-pending-settings-from-process *setting-control* self 'process-mask) + (copy-settings-from-target! *setting-control*) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + (none) + ) + ) + +(defmethod dummy-53 progress ((obj progress) (arg0 progress-screen)) + "Changes the next progress screen if need be for saving related reasons" + (let ((s4-0 (-> obj card-info)) + (gp-0 arg0) + ) + (when s4-0 + (case arg0 + (((progress-screen memcard-no-space) + (progress-screen memcard-not-inserted) + (progress-screen memcard-not-formatted) + ) + (cond + ((zero? (-> s4-0 handle)) + (set! gp-0 (progress-screen memcard-not-inserted)) + ) + ((zero? (-> s4-0 formatted)) + (cond + ((or (zero? (-> obj display-state-pos)) + (and (!= (-> *progress-state* starting-state) 27) (nonzero? (-> *progress-state* starting-state))) + ) + (set-master-mode 'game) + ) + (else + (if (!= arg0 (progress-screen memcard-not-formatted)) + (set! gp-0 (progress-screen memcard-format)) + ) + ) + ) + ) + ((and (zero? (-> s4-0 inited)) (< (-> s4-0 mem-actual) (-> s4-0 mem-required))) + (set! gp-0 (progress-screen memcard-no-space)) + ) + ((or (zero? (-> obj display-state-pos)) + (and (!= (-> *progress-state* starting-state) 27) (nonzero? (-> *progress-state* starting-state))) + ) + (set-master-mode 'game) + ) + (else + (set! gp-0 (progress-screen save-game)) + ) + ) + ) + (((progress-screen memcard-insert)) + (if (= (-> s4-0 inited) 1) + (set! gp-0 (progress-screen load-game)) + ) + ) + ) + (cond + ((zero? (-> s4-0 handle)) + (cond + ((-> *setting-control* current auto-save) + (set! gp-0 (progress-screen memcard-removed)) + ) + (else + (cond + ((= arg0 (progress-screen load-game)) + (set! gp-0 (progress-screen memcard-insert)) + ) + ((or (= arg0 (progress-screen memcard-format)) + (= arg0 (progress-screen memcard-no-space)) + (= arg0 (progress-screen memcard-not-formatted)) + (= arg0 (progress-screen save-game)) + (= arg0 (progress-screen save-game-title)) + (= arg0 (progress-screen memcard-no-data)) + (= arg0 (progress-screen memcard-data-exists)) + ) + (set! gp-0 (progress-screen memcard-not-inserted)) + ) + ) + ) + ) + ) + ((zero? (-> s4-0 formatted)) + (case arg0 + (((progress-screen load-game)) + (set! gp-0 (progress-screen memcard-insert)) + ) + (((progress-screen save-game) (progress-screen save-game-title)) + (set! gp-0 (progress-screen memcard-format)) + ) + ) + ) + ((zero? (-> s4-0 inited)) + (case arg0 + (((progress-screen save-game) (progress-screen save-game-title)) + (if (>= (-> s4-0 mem-actual) (-> s4-0 mem-required)) + (set! gp-0 (progress-screen memcard-no-data)) + (set! gp-0 (progress-screen memcard-no-space)) + ) + ) + (((progress-screen load-game)) + (set! gp-0 (progress-screen memcard-insert)) + ) + ) + ) + ) + ) + gp-0 + ) + ) + +(defmethod dummy-31 progress ((obj progress)) + (let ((s5-0 (-> obj card-info))) + (when (and s5-0 (not (-> obj in-transition))) + (when (or (cpad-pressed? 0 x) (cpad-pressed? 0 circle)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + (case (-> obj display-state) + (((progress-screen load-game)) + (cond + ((< (-> obj option-index) 4) + (when (nonzero? (-> s5-0 file (-> obj option-index) present)) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> *progress-state* which) (-> obj option-index)) + (set! (-> obj next-display-state) (progress-screen memcard-loading)) + ) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + (((progress-screen save-game) (progress-screen save-game-title)) + (cond + ((< (-> obj option-index) 4) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> *progress-state* which) (-> obj option-index)) + (if (zero? (-> s5-0 file (-> obj option-index) present)) + (set! (-> obj next-display-state) (progress-screen memcard-saving)) + (set! (-> obj next-display-state) (progress-screen memcard-data-exists)) + ) + ) + ((and (= (-> obj display-state) (progress-screen save-game-title)) (= (-> obj option-index) 4)) + (sound-play-by-name (static-sound-name "starts-options") (new-sound-id) 1024 0 0 1 #t) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set-master-mode 'game) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + (((progress-screen memcard-insert)) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + (((progress-screen memcard-data-exists)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen memcard-saving)) + ) + ((begin + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (= (-> obj display-state-stack 0) (progress-screen title)) + ) + (set! (-> obj next-display-state) (progress-screen save-game-title)) + ) + (else + (set! (-> obj next-display-state) (progress-screen save-game)) + ) + ) + ) + (((progress-screen memcard-no-data)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen memcard-creating)) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set-master-mode 'game) + ) + ) + ) + (((progress-screen memcard-no-space) + (progress-screen memcard-not-inserted) + (progress-screen memcard-not-formatted) + ) + (cond + ((= (-> obj display-state-stack 0) (progress-screen title)) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set-master-mode 'game) + ) + ((nonzero? (-> obj display-state-stack 0)) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set-master-mode 'game) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + (((progress-screen memcard-error-loading) + (progress-screen memcard-error-saving) + (progress-screen memcard-error-formatting) + (progress-screen memcard-error-creating) + (progress-screen memcard-auto-save-error) + (progress-screen memcard-removed) + (progress-screen auto-save) + ) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + (((progress-screen pal-change-to-60hz)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice)) + (set! (-> obj video-mode-timeout) (-> *display* real-frame-counter)) + (set! (-> obj next-display-state) (progress-screen pal-now-60hz)) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> *progress-state* video-mode-choice) 'pal) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + (((progress-screen pal-now-60hz)) + (cond + ((not (-> *progress-state* yes-no-choice)) + (set! (-> *progress-state* video-mode-choice) 'pal) + (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice)) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + ) + (else + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + ) + ) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + (((progress-screen no-disc) (progress-screen bad-disc)) + (when (is-cd-in?) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + (((progress-screen quit)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "title-start") + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + (((progress-screen memcard-format)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen memcard-formatting)) + ) + ((= (-> obj display-state-stack 0) (progress-screen title)) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set-master-mode 'game) + ) + (else + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod dummy-29 progress ((obj progress)) + (mc-get-slot-info 0 *progress-save-info*) + (set! (-> obj card-info) *progress-save-info*) + (let ((s5-0 (-> *options-remap* (-> obj display-state)))) + (when (and s5-0 (not (-> obj in-transition))) + (cond + ((cpad-hold? 0 up) + (cond + ((cpad-pressed? 0 up) + (when (not (-> obj selected-option)) + (if (!= (length s5-0) 1) + (sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) + ) + (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) + (if (> (-> obj option-index) 0) + (+! (-> obj option-index) -1) + (set! (-> obj option-index) (+ (length s5-0) -1)) + ) + ) + ) + (else + (when (-> obj selected-option) + (let ((v1-34 #f)) + (case (-> s5-0 (-> obj option-index) option-type) + ((3) + (when (< -48 (-> *setting-control* current screeny)) + (set! v1-34 #t) + (+! (-> *setting-control* default screeny) -1) + ) + ) + ) + (when v1-34 + (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) + (sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t) + ) + ) + ) + ) + ) + ) + ) + ((cpad-hold? 0 down) + (cond + ((cpad-pressed? 0 down) + (when (not (-> obj selected-option)) + (if (!= (length s5-0) 1) + (sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) + ) + (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) + (cond + ((< (-> obj option-index) (+ (length s5-0) -1)) + (+! (-> obj option-index) 1) + ) + (else + (set! (-> obj option-index) 0) + 0 + ) + ) + ) + ) + (else + (when (-> obj selected-option) + (let ((v1-69 #f)) + (case (-> s5-0 (-> obj option-index) option-type) + ((3) + (when (< (-> *setting-control* current screeny) 48) + (set! v1-69 #t) + (+! (-> *setting-control* default screeny) 1) + ) + ) + ) + (when v1-69 + (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) + (sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t) + ) + ) + ) + ) + ) + ) + ) + ((cpad-hold? 0 left) + (cond + ((cpad-pressed? 0 left) + (when (or (-> obj selected-option) (= (-> s5-0 (-> obj option-index) option-type) 7)) + (let ((play-sound? #f)) + (case (-> s5-0 (-> obj option-index) option-type) + ((2 7) + (when (not (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)))) + (set! play-sound? #t) + (if (= (-> s5-0 (-> obj option-index) value-to-modify) (&-> *setting-control* current vibration)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) + ) + ) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) #t) + ) + ((4) + (set! play-sound? (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'aspect16x9)) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'aspect4x3) + ) + ((5) + (set! play-sound? (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'ntsc)) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'pal) + ) + ;; arbitrary list options + ((1 #x10 #x11 #x12 #x13 #x14) + ;; every list moves the same way, common logic + (set! (-> *progress-menu-list-tracker* transition?) #t) + (set! (-> *progress-menu-list-tracker* direction) 'left) + (set! play-sound? #t) + ;; now the per menu logic...this should all be refactored and made easier but...must resist + (case (-> s5-0 (-> obj option-index) option-type) + ;; language selection + ((1) + (if (= (-> *progress-menu-list-tracker* selected-index) 0) + (set! (-> *progress-menu-list-tracker* selected-index) (dec (length *language-name-remap*))) + (set! (-> *progress-menu-list-tracker* selected-index) (dec (-> *progress-menu-list-tracker* selected-index)))) + (set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-menu-list-tracker* selected-index))) + ;; display mode setting + ((#x12) + ;; get the current selected item + (let ((curr-val (-> *pc-graphics-display-mode-symbol-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (first-arr *pc-graphics-display-mode-symbol-options*)) + ;; if we've hit the beginning, wrap around to the end + (set! (-> *progress-menu-list-tracker* selected-index) + (last-idx-arr *pc-graphics-display-mode-symbol-options*)) + ;; else just move left + (set! (-> *progress-menu-list-tracker* selected-index) + (dec (-> *progress-menu-list-tracker* selected-index)))))) + ;; aspect ratio setting + ((#x10) + ;; get the current selected item + (let ((curr-val (-> *pc-graphics-aspect-ratio-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (first-arr *pc-graphics-aspect-ratio-options*)) + ;; if we've hit the beginning, wrap around to the end + (set! (-> *progress-menu-list-tracker* selected-index) + (last-idx-arr *pc-graphics-aspect-ratio-options*)) + ;; else just move left + (set! (-> *progress-menu-list-tracker* selected-index) + (dec (-> *progress-menu-list-tracker* selected-index)))))) + ;; resolution setting + ;; this is a little more sophisticated -- only display the ones related to the aspect ratio + ((#x11) + (let ((curr-idx (-> *progress-menu-list-tracker* selected-index)) + (new-idx (dec (-> *progress-menu-list-tracker* selected-index)))) + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (when (= (-> *pc-graphics-4x3-valid-resolutions* curr-idx) + (first-arr *pc-graphics-4x3-valid-resolutions*)) + (set! new-idx (last-idx-arr *pc-graphics-4x3-valid-resolutions*)))) + (('pc-aspect-5x4) + (when (= (-> *pc-graphics-5x4-valid-resolutions* curr-idx) + (first-arr *pc-graphics-5x4-valid-resolutions*)) + (set! new-idx (last-idx-arr *pc-graphics-5x4-valid-resolutions*)))) + (('pc-aspect-16x9) + (when (= (-> *pc-graphics-16x9-valid-resolutions* curr-idx) + (first-arr *pc-graphics-16x9-valid-resolutions*)) + (set! new-idx (last-idx-arr *pc-graphics-16x9-valid-resolutions*)))) + (('pc-aspect-21x9) + (when (= (-> *pc-graphics-21x9-valid-resolutions* curr-idx) + (first-arr *pc-graphics-21x9-valid-resolutions*)) + (set! new-idx (last-idx-arr *pc-graphics-21x9-valid-resolutions*)))) + (('pc-aspect-32x9) + (when (= (-> *pc-graphics-32x9-valid-resolutions* curr-idx) + (first-arr *pc-graphics-32x9-valid-resolutions*)) + (set! new-idx (last-idx-arr *pc-graphics-32x9-valid-resolutions*))))) + (set! (-> *progress-menu-list-tracker* selected-index) new-idx))) + ;; subtitle language selection + ((#x13) + (if (= (-> *progress-menu-list-tracker* selected-index) 0) + (set! (-> *progress-menu-list-tracker* selected-index) (dec (length *pc-subtitle-language-name-remap*))) + (set! (-> *progress-menu-list-tracker* selected-index) (dec (-> *progress-menu-list-tracker* selected-index))))) + ((#x14) + ;; get the current selected item + (let ((curr-val (-> *pc-subtitle-speaker-valid-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (first-arr *pc-subtitle-speaker-valid-options*)) + (set! (-> *progress-menu-list-tracker* selected-index) + (last-idx-arr *pc-subtitle-speaker-valid-options*)) + (set! (-> *progress-menu-list-tracker* selected-index) + (dec (-> *progress-menu-list-tracker* selected-index))))))) + (format #t "VAS: Moving Left. New Index: ~D" (-> *progress-menu-list-tracker* selected-index)))) + (if play-sound? + (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t))))) + (else + (when (-> obj selected-option) + (let ((v1-157 #f)) + (let ((a0-101 (-> s5-0 (-> obj option-index) option-type))) + (cond + ((zero? a0-101) + (cond + ((>= (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (+ 1.0 (-> s5-0 (-> obj option-index) param1)) + ) + (set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (+ -1.0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + (set! v1-157 #t) + ) + ((< (-> s5-0 (-> obj option-index) param1) + (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + ) + (set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> s5-0 (-> obj option-index) param1) + ) + (set! v1-157 #t) + ) + ) + ) + ((= a0-101 3) + (when (< -96 (-> *setting-control* default screenx)) + (set! v1-157 #t) + (+! (-> *setting-control* default screenx) -1) + ) + ) + ) + ) + (when v1-157 + (let ((f30-0 100.0)) + (case (-> s5-0 (-> obj option-index) name) + (((game-text-id music-volume) (game-text-id speech-volume)) + (set! f30-0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) + (sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-0)) 0 0 1 #t) + ) + ) + ) + ) + ) + ) + ) + ) + ((cpad-hold? 0 right) + (cond + ((cpad-pressed? 0 right) + (when (or (-> obj selected-option) (= (-> s5-0 (-> obj option-index) option-type) 7)) + (let ((play-sound? #f)) + (case (-> s5-0 (-> obj option-index) option-type) + ((2 7) + (set! play-sound? (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)))) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) #f) + ) + ((4) + (set! play-sound? (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'aspect4x3)) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'aspect16x9) + ) + ((5) + (set! play-sound? (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'pal)) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) 'ntsc) + ) + ;; arbitrary list options + ((1 #x10 #x11 #x12 #x13 #x14) + ;; every list moves the same way, common logic + (set! (-> *progress-menu-list-tracker* transition?) #t) + (set! (-> *progress-menu-list-tracker* direction) 'right) + (set! play-sound? #t) + ;; now the per menu logic...this should all be refactored and made easier but...must resist + (case (-> s5-0 (-> obj option-index) option-type) + ;; language selection + ((1) + (if (= (-> *progress-menu-list-tracker* selected-index) (dec (length *language-name-remap*))) + (set! (-> *progress-menu-list-tracker* selected-index) 0) + (set! (-> *progress-menu-list-tracker* selected-index) (inc (-> *progress-menu-list-tracker* selected-index)))) + (set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-menu-list-tracker* selected-index))) + ;; display mode setting + ((#x12) + ;; get the current selected item + (let ((curr-val (-> *pc-graphics-display-mode-symbol-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (last-arr *pc-graphics-display-mode-symbol-options*)) + ;; if we've hit the end, wrap around to the beginning + (set! (-> *progress-menu-list-tracker* selected-index) 0) + ;; else just move right + (set! (-> *progress-menu-list-tracker* selected-index) + (inc (-> *progress-menu-list-tracker* selected-index)))))) + ;; aspect ratio setting + ((#x10) + ;; get the current selected item + (let ((curr-val (-> *pc-graphics-aspect-ratio-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (last-arr *pc-graphics-aspect-ratio-options*)) + ;; if we've hit the end, wrap around to the beginning + (set! (-> *progress-menu-list-tracker* selected-index) 0) + ;; else just move left + (set! (-> *progress-menu-list-tracker* selected-index) + (inc (-> *progress-menu-list-tracker* selected-index)))))) + ;; resolution setting + ;; this is a little more sophisticated -- only display the ones related to the aspect ratio + ((#x11) + (let ((curr-idx (-> *progress-menu-list-tracker* selected-index)) + (new-idx (inc (-> *progress-menu-list-tracker* selected-index)))) + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (when (= (-> *pc-graphics-4x3-valid-resolutions* curr-idx) + (last-arr *pc-graphics-4x3-valid-resolutions*)) + (set! new-idx 0))) + (('pc-aspect-5x4) + (when (= (-> *pc-graphics-5x4-valid-resolutions* curr-idx) + (last-arr *pc-graphics-5x4-valid-resolutions*)) + (set! new-idx 0))) + (('pc-aspect-16x9) + (when (= (-> *pc-graphics-16x9-valid-resolutions* curr-idx) + (last-arr *pc-graphics-16x9-valid-resolutions*)) + (set! new-idx 0))) + (('pc-aspect-21x9) + (when (= (-> *pc-graphics-21x9-valid-resolutions* curr-idx) + (last-arr *pc-graphics-21x9-valid-resolutions*)) + (set! new-idx 0))) + (('pc-aspect-32x9) + (when (= (-> *pc-graphics-32x9-valid-resolutions* curr-idx) + (last-arr *pc-graphics-32x9-valid-resolutions*)) + (set! new-idx 0)))) + (set! (-> *progress-menu-list-tracker* selected-index) new-idx))) + ;; subtitle language selection + ((#x13) + (if (= (-> *progress-menu-list-tracker* selected-index) (dec (length *pc-subtitle-language-name-remap*))) + (set! (-> *progress-menu-list-tracker* selected-index) 0) + (set! (-> *progress-menu-list-tracker* selected-index) (inc (-> *progress-menu-list-tracker* selected-index))))) + ((#x14) + ;; get the current selected item + (let ((curr-val (-> *pc-subtitle-speaker-valid-options* + (-> *progress-menu-list-tracker* selected-index)))) + (if (= curr-val (last-arr *pc-subtitle-speaker-valid-options*)) + (set! (-> *progress-menu-list-tracker* selected-index) 0) + (set! (-> *progress-menu-list-tracker* selected-index) + (inc (-> *progress-menu-list-tracker* selected-index))))))) + (format #t "VAS: Moving Right. New Index: ~D" (-> *progress-menu-list-tracker* selected-index)))) + (if play-sound? + (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t))))) + (else + (when (-> obj selected-option) + (let ((v1-263 #f)) + (let ((a0-177 (-> s5-0 (-> obj option-index) option-type))) + (cond + ((zero? a0-177) + (cond + ((>= (+ -1.0 (-> s5-0 (-> obj option-index) param2)) + (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + ) + (set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (+ 1.0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + (set! v1-263 #t) + ) + ((< (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> s5-0 (-> obj option-index) param2) + ) + (set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> s5-0 (-> obj option-index) param2) + ) + (set! v1-263 #t) + ) + ) + ) + ((= a0-177 3) + (when (< (-> *setting-control* default screenx) 96) + (set! v1-263 #t) + (+! (-> *setting-control* default screenx) 1) + ) + ) + ) + ) + (when v1-263 + (let ((f30-1 100.0)) + (case (-> s5-0 (-> obj option-index) name) + (((game-text-id music-volume) (game-text-id speech-volume)) + (set! f30-1 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) + (sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-1)) 0 0 1 #t) + ) + ) + ) + ) + ) + ) + ) + ) + ((or (cpad-pressed? 0 square) (cpad-pressed? 0 triangle)) + (cond + ((-> obj selected-option) + (let ((v1-319 (-> s5-0 (-> obj option-index) option-type))) + (cond + ((zero? v1-319) + (set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-state* slider-backup) + ) + ) + ((= v1-319 1) + (set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-state* language-backup) + ) + ) + ((= v1-319 2) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-state* on-off-backup) + ) + ) + ((= v1-319 3) + (set! (-> *setting-control* default screenx) (-> *progress-state* center-x-backup)) + (set! (-> *setting-control* default screeny) (-> *progress-state* center-y-backup)) + ) + ((or (= v1-319 4) (= v1-319 5)) + (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) + (-> *progress-state* aspect-ratio-backup) + ) + ) + ) + ) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj selected-option) #f) + ) + ((or (dummy-32 obj) + (= (-> obj display-state) (progress-screen load-game)) + (= (-> obj display-state) (progress-screen save-game)) + (= (-> obj display-state) (progress-screen save-game-title)) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (if (= (-> obj display-state) (progress-screen settings)) + (sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + ) + (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + ;; confirm selection + ((or (cpad-pressed? 0 x) (cpad-pressed? 0 circle)) + (cond + ((not (-> obj selected-option)) + (cond + ((= (-> s5-0 (-> obj option-index) option-type) 6) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + (push! obj) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (the-as progress-screen (-> s5-0 (-> obj option-index) param3))) + (case (-> obj next-display-state) + (((progress-screen load-game) + (progress-screen save-game) + (progress-screen save-game-title)) + (set! (-> obj next-display-state) + (dummy-53 obj (-> obj next-display-state))) + ) + ) + ) + ((= (-> s5-0 (-> obj option-index) option-type) 8) + (cond + ((= (-> s5-0 (-> obj option-index) name) (game-text-id exit-demo)) + (set! *master-exit* 'force) + (set-master-mode 'game) + ) + ((= (-> s5-0 (-> obj option-index) name) (game-text-id back)) + (if (= (-> obj display-state) (progress-screen settings)) + (sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t) + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + ) + (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) + ((!= (-> s5-0 (-> obj option-index) option-type) 7) + (let ((v1-427 (-> s5-0 (-> obj option-index) option-type))) + (cond + ((zero? v1-427) + (set! (-> *progress-state* slider-backup) + (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))) + ) + ) + ((= v1-427 1) + (set! (-> *progress-state* language-backup) + (the-as int (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + ((= v1-427 2) + (set! (-> *progress-state* on-off-backup) + (the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + ((= v1-427 3) + (set! (-> *progress-state* center-x-backup) (-> *setting-control* default screenx)) + (set! (-> *progress-state* center-y-backup) (-> *setting-control* default screeny)) + ) + ((or (= v1-427 4) (= v1-427 5)) + (set! (-> *progress-state* aspect-ratio-backup) + (the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + ) + ) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + (set! (-> obj selected-option) #t) + ;; arbitrary sized list options, they always scroll in the same manner + (when (or (= (-> s5-0 (-> obj option-index) option-type) 1) + (= (-> s5-0 (-> obj option-index) option-type) #x10) + (= (-> s5-0 (-> obj option-index) option-type) #x11) + (= (-> s5-0 (-> obj option-index) option-type) #x12) + (= (-> s5-0 (-> obj option-index) option-type) #x13) + (= (-> s5-0 (-> obj option-index) option-type) #x14)) + (format #t "VAS: list option opened") + ;; reset tracker to defaults ;; defaults to left? + (set! (-> *progress-menu-list-tracker* direction) 'left) + (set! (-> *progress-menu-list-tracker* transition?) #f) + (set! (-> *progress-menu-list-tracker* x-offset) 0) + ;; each one has a slightly different handling though + ;; set the currently selected item + (case (-> s5-0 (-> obj option-index) option-type) + ((1) + (set! (-> *progress-menu-list-tracker* selected-index) + (the-as int (-> *setting-control* current language)))) + ((#x10) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-aspect-ratio-options* (-> *pc-settings* aspect-ratio-mode) 0))) + ((#x11) + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-4x3-valid-resolutions* (-> *pc-settings* resolution) 0))) + (('pc-aspect-5x4) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-5x4-valid-resolutions* (-> *pc-settings* resolution) 0))) + (('pc-aspect-16x9) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-16x9-valid-resolutions* (-> *pc-settings* resolution) 0))) + (('pc-aspect-21x9) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-21x9-valid-resolutions* (-> *pc-settings* resolution) 0))) + (('pc-aspect-32x9) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-32x9-valid-resolutions* (-> *pc-settings* resolution) 0))))) + ((#x12) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-graphics-display-mode-symbol-options* (-> *pc-settings* display-mode) 0))) + ((#x13) + (set! (-> *progress-menu-list-tracker* selected-index) + (the-as int (-> *pc-settings* subtitle-language)))) + ((#x14) + (set! (-> *progress-menu-list-tracker* selected-index) + (arr-idx-of *pc-subtitle-speaker-valid-options* (-> *pc-settings* subtitle-speaker?) 0))))) + ) + ) + ) + (else + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj selected-option) #f) + (format #t "VAS: list selection confirmed!") + (case (-> s5-0 (-> obj option-index) option-type) + ((4) + (set! (-> *setting-control* default aspect-ratio) + (the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + ((5) + (case (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))) + (('pal) + (set! (-> *setting-control* default video-mode) + (the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify)))) + ) + ) + (('ntsc) + (push! obj) + (set! (-> obj next-display-state) (progress-screen pal-change-to-60hz)) + ) + ) + ) + ((1) + (when (not (-> *progress-menu-list-tracker* transition?)) + (load-level-text-files (-> obj display-level-index)))) + ((#x10) + (set-aspect-ratio-mode! *pc-settings* + (-> *pc-graphics-aspect-ratio-options* (-> *progress-menu-list-tracker* selected-index))) + ;; change to the lowest option for that resolution as well + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (set-resolution! *pc-settings* (-> *pc-graphics-4x3-valid-resolutions* 0))) + (('pc-aspect-5x4) + (set-resolution! *pc-settings* (-> *pc-graphics-5x4-valid-resolutions* 0))) + (('pc-aspect-16x9) + (set-resolution! *pc-settings* (-> *pc-graphics-16x9-valid-resolutions* 0))) + (('pc-aspect-21x9) + (set-resolution! *pc-settings* (-> *pc-graphics-21x9-valid-resolutions* 0))) + (('pc-aspect-32x9) + (set-resolution! *pc-settings* (-> *pc-graphics-32x9-valid-resolutions* 0)))) + ) + ((#x11) + (case (-> *pc-settings* aspect-ratio-mode) + (('pc-aspect-4x3) + (set-resolution! *pc-settings* + (-> *pc-graphics-4x3-valid-resolutions* (-> *progress-menu-list-tracker* selected-index)))) + (('pc-aspect-5x4) + (set-resolution! *pc-settings* + (-> *pc-graphics-5x4-valid-resolutions* (-> *progress-menu-list-tracker* selected-index)))) + (('pc-aspect-16x9) + (set-resolution! *pc-settings* + (-> *pc-graphics-16x9-valid-resolutions* (-> *progress-menu-list-tracker* selected-index)))) + (('pc-aspect-21x9) + (set-resolution! *pc-settings* + (-> *pc-graphics-21x9-valid-resolutions* (-> *progress-menu-list-tracker* selected-index)))) + (('pc-aspect-32x9) + (set-resolution! *pc-settings* + (-> *pc-graphics-32x9-valid-resolutions* (-> *progress-menu-list-tracker* selected-index)))))) + ((#x12) + (set-display-mode! *pc-settings* + (-> *pc-graphics-display-mode-symbol-options* (-> *progress-menu-list-tracker* selected-index)))) + ((#x13) + (set! (-> *pc-settings* subtitle-language) + (the pc-subtitle-lang (-> *progress-menu-list-tracker* selected-index)))) + ((#x14) + (set! (-> *pc-settings* subtitle-speaker?) + (-> *pc-subtitle-speaker-valid-options* (-> *progress-menu-list-tracker* selected-index)))) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod respond-progress progress ((obj progress)) + (when (not (-> obj in-transition)) + (cond + ((cpad-pressed? 0 up) + (let ((s5-0 (-> obj display-level-index))) + (set! (-> obj next-level-index) (get-next-level-down s5-0)) + (when (!= s5-0 (-> obj next-level-index)) + (sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj level-transition) 2) + ) + ) + ) + ((cpad-pressed? 0 down) + (let ((s5-2 (-> obj next-level-index))) + (set! (-> obj next-level-index) (get-next-level-up s5-2)) + (when (!= s5-2 (-> obj next-level-index)) + (sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj level-transition) 1) + ) + ) + ) + ((cpad-pressed? 0 square) + (when (nonzero? (-> obj display-state)) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen fuel-cell)) + (set! (-> obj stat-transition) #t) + ) + ) + ((cpad-pressed? 0 x) + (when (!= (-> obj display-state) (progress-screen money)) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen money)) + (set! (-> obj stat-transition) #t) + ) + ) + ((cpad-pressed? 0 triangle) + (when (!= (-> obj display-state) (progress-screen buzzer)) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen buzzer)) + (set! (-> obj stat-transition) #t) + ) + ) + ((cpad-pressed? 0 circle) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) + (push! obj) + (set! (-> obj next-display-state) (progress-screen settings)) + ) + ((= (-> obj display-state) (progress-screen fuel-cell)) + (cond + ((cpad-pressed? 0 left) + (let ((s5-8 (-> obj task-index))) + (set! (-> obj task-index) (get-next-task-down (-> obj task-index) (-> obj display-level-index))) + (if (!= s5-8 (-> obj task-index)) + (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t) + ) + ) + ) + ((cpad-pressed? 0 right) + (let ((s5-10 (-> obj task-index))) + (set! (-> obj task-index) (get-next-task-up (-> obj task-index) (-> obj display-level-index))) + (if (!= s5-10 (-> obj task-index)) + (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defstate progress-normal (progress) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'go-away) + (go progress-going-out) + ) + ((= v1-0 'notify) + (cond + ((= (-> arg3 param 0) 'done) + (case (-> self display-state) + (((progress-screen memcard-saving)) + (cond + ((= (-> self display-state-stack 0) (progress-screen title)) + (let ((gp-1 (-> *setting-control* default auto-save))) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set! (-> *setting-control* default auto-save) gp-1) + ) + (set-master-mode 'game) + ) + (else + (set! v0-0 (the-as none -1)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + ) + ) + (((progress-screen memcard-formatting)) + (set! (-> self force-transition) #t) + (set! v0-0 (the-as none 15)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-creating)) + (cond + ((= (-> self display-state-stack 0) (progress-screen title)) + (set! v0-0 (the-as none 18)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + ) + (else + (set! v0-0 (the-as none 17)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + ) + ) + v0-0 + ) + ) + ) + ((= (-> arg3 param 0) 'error) + (let ((t9-4 format) + (a0-17 #t) + (a1-2 "ERROR NOTIFY: ~S ~D~%") + (v1-13 (-> arg3 param 1)) + ) + (t9-4 + a0-17 + a1-2 + (cond + ((= v1-13 17) + "no-auto-save" + ) + ((= v1-13 16) + "no-process" + ) + ((= v1-13 15) + "bad-version" + ) + ((= v1-13 14) + "no-space" + ) + ((= v1-13 13) + "no-save" + ) + ((= v1-13 12) + "no-file" + ) + ((= v1-13 11) + "no-format" + ) + ((= v1-13 10) + "no-last" + ) + ((= v1-13 9) + "no-card" + ) + ((= v1-13 8) + "no-memory" + ) + ((= v1-13 7) + "new-game" + ) + ((= v1-13 6) + "read-error" + ) + ((= v1-13 5) + "write-error" + ) + ((= v1-13 4) + "internal-error" + ) + ((= v1-13 3) + "format-failed" + ) + ((= v1-13 2) + "bad-handle" + ) + ((= v1-13 1) + "ok" + ) + ((zero? v1-13) + "busy" + ) + (else + "*unknown*" + ) + ) + (-> self display-state) + ) + ) + (case (-> arg3 param 1) + ((14) + (set! v0-0 (the-as none 7)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (else + (case (-> self display-state) + (((progress-screen memcard-formatting)) + (set! v0-0 (the-as none 24)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-creating)) + (set! v0-0 (the-as none 25)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-saving)) + (set! v0-0 (the-as none 21)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-loading)) + (set! v0-0 (the-as none 20)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + :code + (behavior () + (loop + (when (and (cpad-hold? 0 l1) (cpad-hold? 0 r1) *cheat-mode*) + (when (and (< (-> self task-index) (-> *level-task-data* (-> self display-level-index) nb-of-tasks)) + (>= (-> self task-index) 0) + ) + (let ((gp-0 (-> *level-task-data* (-> self display-level-index) task-info (-> self task-index) task-id))) + (close-specific-task! gp-0 (task-status need-resolution)) + (send-event *target* 'get-pickup 6 (the float gp-0)) + ) + ) + ) + (if (and (= (-> self display-state) (-> self next-display-state)) + (= (-> self display-level-index) (-> self next-level-index)) + ) + (set! (-> self transition-offset) + (seekl + (-> self transition-offset) + 0 + (* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) + (if (or (-> self stat-transition) (nonzero? (-> self level-transition))) + 2 + 1 + ) + ) + ) + ) + (set! (-> self transition-offset) + (seekl + (-> self transition-offset) + 512 + (* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) + (if (or (-> self stat-transition) (nonzero? (-> self level-transition))) + 2 + 1 + ) + ) + ) + ) + ) + (set-transition-progress! self (-> self transition-offset)) + (set! (-> self in-transition) (or (-> self force-transition) (nonzero? (-> self transition-offset)))) + (when (and (not (handle->process (-> *game-info* auto-save-proc))) + (or (-> self force-transition) (-> self in-transition)) + (>= (-> self transition-offset) (if (and (zero? (-> self level-transition)) + (nonzero? (-> self next-display-state)) + (!= (-> self next-display-state) 1) + (!= (-> self next-display-state) 2) + ) + 512 + 256 + ) + ) + ) + (if (>= (the-as int (-> self next-display-state)) 0) + ;; transition to the next menu + (enter! self (-> self next-display-state) 0) + (pop! self) + ) + (set! (-> self display-level-index) (-> self next-level-index)) + (when (nonzero? (-> self level-transition)) + (set! (-> self task-index) (get-next-task-up -1 (-> self display-level-index))) + (case (-> self level-transition) + ((1) + (set! (-> self level-transition) 2) + ) + ((2) + (set! (-> self level-transition) 1) + ) + ) + ) + (set! (-> self force-transition) #f) + ) + (when (zero? (-> self transition-offset)) + (set! (-> self stat-transition) #f) + (set! (-> self level-transition) 0) + 0 + ) + (let ((gp-1 #f)) + (let ((v1-62 #f)) + (case (-> self display-state) + (((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer)) + (let ((s5-0 (-> self display-level-index))) + (when (and (< (mod (-> *display* real-frame-counter) 60) 30) + (zero? (-> *progress-process* 0 in-out-position)) + (not (-> self in-transition)) + (zero? (-> self transition-offset)) + ) + (set! gp-1 (!= s5-0 (get-next-level-up s5-0))) + (set! v1-62 (!= s5-0 (get-next-level-down s5-0))) + ) + ) + ) + ) + (set! (-> self particles 3 init-pos x) (the float (if v1-62 + (- 195 (-> *progress-process* 0 left-x-offset)) + -320 + ) + ) + ) + ) + (set! (-> self particles 4 init-pos x) (the float (if gp-1 + (- 195 (-> *progress-process* 0 left-x-offset)) + -320 + ) + ) + ) + ) + (dummy-29 self) + (set! (-> self next-display-state) + (dummy-53 self (-> self next-display-state))) + (let ((v1-74 (-> self display-state))) + (cond + ((or (= v1-74 (progress-screen fuel-cell)) + (or (= v1-74 (progress-screen money)) (= v1-74 (progress-screen buzzer))) + ) + (respond-progress self) + ) + ((or (= v1-74 (progress-screen memcard-no-space)) + (= v1-74 (progress-screen memcard-format)) + (= v1-74 (progress-screen memcard-data-exists)) + (= v1-74 (progress-screen memcard-insert)) + (= v1-74 (progress-screen load-game)) + (= v1-74 (progress-screen save-game)) + (= v1-74 (progress-screen save-game-title)) + (= v1-74 (progress-screen memcard-error-loading)) + (= v1-74 (progress-screen memcard-error-saving)) + (= v1-74 (progress-screen memcard-error-formatting)) + (= v1-74 (progress-screen memcard-error-creating)) + (= v1-74 (progress-screen memcard-auto-save-error)) + (= v1-74 (progress-screen memcard-removed)) + (= v1-74 (progress-screen memcard-no-data)) + (= v1-74 (progress-screen memcard-not-inserted)) + (= v1-74 (progress-screen memcard-not-formatted)) + (= v1-74 (progress-screen auto-save)) + (= v1-74 (progress-screen pal-change-to-60hz)) + (= v1-74 (progress-screen pal-now-60hz)) + (= v1-74 (progress-screen no-disc)) + (= v1-74 (progress-screen bad-disc)) + (= v1-74 (progress-screen quit)) + ) + (dummy-31 self) + ) + ) + ) + (suspend) + ) + (none) + ) + :post + (behavior () + (let* ((a1-0 (-> self display-level-index)) + (gp-0 (-> *level-task-data* a1-0)) + ) + #t + (let ((s5-0 #f)) + (case (-> self display-state) + (((progress-screen fuel-cell)) + (set! s5-0 #t) + (draw-fuel-cell-screen self a1-0) + ) + (((progress-screen money)) + (set! s5-0 #t) + (draw-money-screen self a1-0) + ) + (((progress-screen buzzer)) + (set! s5-0 #t) + (draw-buzzer-screen self a1-0) + ) + (((progress-screen game-settings) (progress-screen settings)) + (hide-progress-icons) + (draw-options self 115 30 0.82) + ) + (((progress-screen graphic-settings) + (progress-screen sound-settings) + (progress-screen settings-title) + (progress-screen title) + (progress-screen language-options) + ) + (hide-progress-icons) + (draw-options self 115 30 0.82) + ) + (((progress-screen memcard-removed) (progress-screen memcard-auto-save-error)) + (draw-notice-screen self) + (draw-options self 192 0 0.82) + ) + (((progress-screen memcard-no-data)) + (draw-notice-screen self) + (draw-options self 165 0 0.82) + ) + (((progress-screen memcard-format)) + (draw-notice-screen self) + (draw-options self 172 0 0.82) + ) + (((progress-screen memcard-no-space) + (progress-screen memcard-not-inserted) + (progress-screen memcard-not-formatted) + ) + (draw-notice-screen self) + (draw-options self 195 0 0.82) + ) + (((progress-screen memcard-error-loading) + (progress-screen memcard-error-saving) + (progress-screen memcard-error-formatting) + (progress-screen memcard-error-creating) + (progress-screen memcard-auto-save-error) + ) + (draw-notice-screen self) + (draw-options self 190 0 0.82) + ) + (((progress-screen pal-change-to-60hz)) + (draw-notice-screen self) + (draw-options self 190 0 0.82) + ) + (((progress-screen pal-now-60hz)) + (when (< (seconds 10) (- (-> *display* real-frame-counter) (-> self video-mode-timeout))) + (set! (-> *progress-state* video-mode-choice) 'pal) + (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice)) + (set! (-> self next-display-state) (progress-screen invalid)) + ) + (draw-notice-screen self) + (draw-options self 140 0 0.82) + ) + (((progress-screen no-disc) (progress-screen bad-disc)) + (draw-notice-screen self) + (if (is-cd-in?) + (draw-options self 170 0 0.82) + ) + ) + (((progress-screen quit)) + (draw-notice-screen self) + (draw-options self 110 0 0.82) + ) + (((progress-screen auto-save)) + (draw-notice-screen self) + (draw-options self 190 0 0.82) + ) + (((progress-screen memcard-insert)) + (draw-notice-screen self) + (draw-options self 165 0 0.82) + ) + (((progress-screen memcard-data-exists)) + (draw-notice-screen self) + (draw-options self 168 0 0.82) + ) + (((progress-screen memcard-loading) + (progress-screen memcard-saving) + (progress-screen memcard-formatting) + (progress-screen memcard-creating) + ) + (draw-notice-screen self) + ) + (((progress-screen load-game) (progress-screen save-game)) + (draw-notice-screen self) + (draw-options self 190 0 0.82) + ) + (((progress-screen save-game-title)) + (draw-notice-screen self) + (draw-options self 169 15 0.6) + ) + ) + (when s5-0 + (let* ((v1-98 (cond + ((-> self stat-transition) + 0 + ) + ((= (-> self level-transition) 1) + (- (-> self transition-offset)) + ) + (else + (-> self transition-offset) + ) + ) + ) + (f30-0 (the-as float (if (-> self stat-transition) + 1.0 + (-> self transition-percentage-invert) + ) + ) + ) + (s5-1 + (new + 'stack + 'font-context + *font-default-matrix* + (- 32 (-> self left-x-offset)) + (the int (* (+ 42.0 (the float (/ v1-98 2))) f30-0)) + 8325000.0 + (font-color lighter-lighter-blue) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-103 s5-1)) + (set! (-> v1-103 width) (the float 328)) + ) + (let ((v1-104 s5-1)) + (set! (-> v1-104 height) (the float 45)) + ) + (set! (-> s5-1 flags) (font-flags shadow kerning middle left large)) + (print-game-text-scaled + (lookup-text! *common-text* (-> gp-0 level-name-id) #f) + f30-0 + s5-1 + (the int (* 128.0 f30-0)) + ) + ) + ) + ) + ) + (case (-> self display-state) + (((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer)) + (draw-progress self) + ) + ) + (adjust-sprites self) + (adjust-icons self) + (none) + ) + ) + +(defstate progress-coming-in (progress) + :event + (-> progress-waiting event) + :enter + (behavior () + (sound-group-pause (the-as uint 255)) + (logclear! (-> *setting-control* default process-mask) (process-mask pause menu)) + (push-setting! *setting-control* self 'process-mask 'set 0.0 16) + (copy-settings-from-target! *setting-control*) + (sound-play-by-name (static-sound-name "select-menu") (new-sound-id) 1024 0 0 1 #t) + (set-blackout-frames 0) + (set! *pause-lock* #f) + (none) + ) + :code + (behavior () + (loop + (set! (-> self in-out-position) + (seekl (-> self in-out-position) 0 (the int (* 170.0 (-> *display* time-adjust-ratio)))) + ) + (when (< (-> self in-out-position) 2867) + (set! (-> self transition-offset) (seekl + (-> self transition-offset) + 0 + (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) + ) + ) + (set-transition-progress! self (-> self transition-offset)) + ) + (if (zero? (-> self in-out-position)) + (go progress-normal) + ) + (suspend) + ) + (none) + ) + :post + (-> progress-normal post) + ) + +(defstate progress-going-out (progress) + :enter + (behavior () + (sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t) + (hide-progress-icons) + (set! (-> self particles 3 init-pos x) -320.0) + (set! (-> self particles 4 init-pos x) -320.0) + (case (-> self display-state) + (((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title)) + (set! (-> self transition-speed) 30.0) + ) + ) + (none) + ) + :code + (behavior () + (loop + (set! (-> self transition-offset) (seekl + (-> self transition-offset) + 512 + (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) + ) + ) + (set-transition-progress! self (-> self transition-offset)) + (when (< 153 (-> self transition-offset)) + (set! (-> self in-out-position) + (seekl (-> self in-out-position) 4096 (the int (* 170.0 (-> *display* time-adjust-ratio)))) + ) + (if (= (-> self in-out-position) 4096) + (go progress-gone) + ) + ) + (suspend) + ) + (none) + ) + :post + (-> progress-normal post) + ) + +(defstate progress-debug (progress) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go-away) + (go progress-going-out) + ) + ) + ) + :code + (behavior () + (loop + (cond + ((cpad-pressed? 0 left) + (if (> (-> self current-debug-string) 0) + (+! (-> self current-debug-string) -1) + ) + ) + ((cpad-pressed? 0 right) + (if (< (-> self current-debug-string) (+ (-> *common-text* length) -1)) + (+! (-> self current-debug-string) 1) + ) + ) + ((cpad-pressed? 0 up) + (when (> (-> self current-debug-group) 0) + (+! (-> self current-debug-group) -1) + (set! (-> self current-debug-string) 0) + 0 + ) + ) + ((cpad-pressed? 0 down) + (when (< (-> self current-debug-group) (+ (-> *text-group-names* length) -1)) + (+! (-> self current-debug-group) 1) + (set! (-> self current-debug-string) 0) + 0 + ) + ) + ((cpad-pressed? 0 l1) + (if (> (the-as int (-> *setting-control* default language)) 0) + (+! (-> *setting-control* default language) -1) + ) + ) + ((cpad-pressed? 0 r1) + (if (< (the-as int (-> *setting-control* default language)) 6) + (+! (-> *setting-control* default language) 1) + ) + ) + ((cpad-pressed? 0 l2) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l2)) + (go progress-normal) + ) + ) + (load-game-text-info (-> *text-group-names* (-> self current-debug-group)) '*common-text* *common-text-heap*) + (suspend) + ) + (none) + ) + :post + (behavior () + (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-0 (-> s5-0 base)) + ) + (let ((s4-0 draw-string-xy)) + (let ((s3-0 format) + (a0-4 (clear *temp-string*)) + (a1-0 "TEXT DEBUG: LANGUAGE ~S ID 0x~X") + (v1-4 (-> *setting-control* current language)) + ) + (s3-0 + a0-4 + a1-0 + (cond + ((= v1-4 (language-enum uk-english)) + "uk-english" + ) + ((= v1-4 (language-enum japanese)) + "japanese" + ) + ((= v1-4 (language-enum italian)) + "italian" + ) + ((= v1-4 (language-enum spanish)) + "spanish" + ) + ((= v1-4 (language-enum german)) + "german" + ) + ((= v1-4 (language-enum french)) + "french" + ) + ((= v1-4 (language-enum english)) + "english" + ) + (else + "*unknown*" + ) + ) + (-> *common-text* data (-> self current-debug-string) id) + ) + ) + (s4-0 *temp-string* s5-0 40 40 (font-color default) (font-flags shadow kerning)) + ) + (let ((a3-4 (-> s5-0 base))) + (let ((v1-7 (the-as dma-packet (-> s5-0 base)))) + (set! (-> v1-7 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-7 vif0) (new 'static 'vif-tag)) + (set! (-> v1-7 vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-7) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-0 + (the-as (pointer dma-tag) a3-4) + ) + ) + ) + (let* ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-1 (-> s5-1 base)) + ) + (let ((s4-1 draw-string-xy)) + (format (clear *temp-string*) "USE LEFT/RIGHT TO SELECT STRING") + (s4-1 *temp-string* s5-1 40 155 (font-color default) (font-flags shadow kerning)) + ) + (let ((a3-6 (-> s5-1 base))) + (let ((v1-16 (the-as dma-packet (-> s5-1 base)))) + (set! (-> v1-16 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-16 vif0) (new 'static 'vif-tag)) + (set! (-> v1-16 vif1) (new 'static 'vif-tag)) + (set! (-> s5-1 base) (the-as pointer (the-as dma-packet (&+ v1-16 16)))) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-1 + (the-as (pointer dma-tag) a3-6) + ) + ) + ) + (let* ((s5-2 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-2 (-> s5-2 base)) + ) + (let ((s4-2 draw-string-xy)) + (format (clear *temp-string*) "USE UP/DOWN TO SELECT GROUP") + (s4-2 *temp-string* s5-2 40 165 (font-color default) (font-flags shadow kerning)) + ) + (let ((a3-8 (-> s5-2 base))) + (let ((v1-25 (the-as dma-packet (-> s5-2 base)))) + (set! (-> v1-25 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-25 vif0) (new 'static 'vif-tag)) + (set! (-> v1-25 vif1) (new 'static 'vif-tag)) + (set! (-> s5-2 base) (the-as pointer (the-as dma-packet (&+ v1-25 16)))) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-2 + (the-as (pointer dma-tag) a3-8) + ) + ) + ) + (let* ((s5-3 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-3 (-> s5-3 base)) + ) + (let ((s4-3 draw-string-xy)) + (format (clear *temp-string*) "USE L1/R1 TO SELECT LANGUAGE") + (s4-3 *temp-string* s5-3 40 175 (font-color default) (font-flags shadow kerning)) + ) + (let ((a3-10 (-> s5-3 base))) + (let ((v1-34 (the-as dma-packet (-> s5-3 base)))) + (set! (-> v1-34 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-34 vif0) (new 'static 'vif-tag)) + (set! (-> v1-34 vif1) (new 'static 'vif-tag)) + (set! (-> s5-3 base) (the-as pointer (the-as dma-packet (&+ v1-34 16)))) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-3 + (the-as (pointer dma-tag) a3-10) + ) + ) + ) + (let ((gp-4 (new + 'stack + 'font-context + *font-default-matrix* + 32 + 50 + 0.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-42 gp-4)) + (set! (-> v1-42 width) (the float 328)) + ) + (let ((v1-43 gp-4)) + (set! (-> v1-43 height) (the float 100)) + ) + (logior! (-> gp-4 flags) (font-flags shadow kerning large)) + (draw-debug-text-box gp-4) + (print-game-text (-> *common-text* data (-> self current-debug-string) text) gp-4 #f 128 22) + ) + (none) + ) + ) + + diff --git a/goal_src/pc/engine/ui/text-h.gc b/goal_src/pc/engine/ui/text-h.gc new file mode 100644 index 0000000000..1a64cd8d5b --- /dev/null +++ b/goal_src/pc/engine/ui/text-h.gc @@ -0,0 +1,560 @@ +;;-*-Lisp-*- +(in-package goal) + +;; name: text-h.gc +;; name in dgo: text-h +;; dgos: GAME, ENGINE + +;; This file contains types related to game text. +;; Each game string is assigned an ID number. +;; This ID is used to lookup the string for the currently selected language. +;; These ID's are shared with short spoken audio clips (daxter hints) +;; most (all?) of the daxter clips don't have text strings. + +(defenum game-text-id + :type uint32 + :bitfield #f +;; GAME-TEXT-ID ENUM BEGINS + (zero 0) + (one 1) + (confirm #x103) + (press-to-talk #x104) + (press-to-use #x105) + (confirm-play #x106) + (play-again? #x107) + (quit #x108) + (pause #x109) + (sfx-volume #x10a) + (music-volume #x10b) + (speech-volume #x10c) + (language #x10d) + (vibrations #x10e) + (play-hints #x10f) + (center-screen #x110) + (on #x111) + (off #x112) + (move-dpad #x113) + (english #x114) + (french #x115) + (german #x116) + (spanish #x117) + (italian #x118) + (japanese #x119) + (press-to-trade-money #x11a) + (press-to-trade-money-oracle #x11b) + (press-to-warp #x11c) + (press-to-exit #x11d) + (press-to-talk-to-sage #x123) + (press-to-talk-to-assistant #x124) + (aspect-ratio #x125) + (video-mode #x126) + (game-options #x127) + (graphic-options #x128) + (sound-options #x129) + (4x3 #x12a) + (16x9 #x12b) + (60hz #x12c) + (50hz #x12d) + (game-title #x12e) + (hidden-power-cell #x12f) ;; why is this here?? + (memcard-no-space #x130) + (memcard-not-inserted #x131) + (card-not-formatted-title #x132) + (memcard-space-requirement1 #x133) + (memcard-space-requirement2 #x134) + (card-not-formatted-msg #x135) + (saving-data #x136) + (loading-data #x137) + (do-not-remove-mem-card #x138) + (overwrite? #x139) + (format? #x13a) + + (yes #x13c) + (no #x13d) + (back #x13e) + (continue-without-saving #x13f) + (select-file-to-save #x140) + (select-file-to-load #x141) + (save-data-already-exists #x142) + (insert-memcard #x143) + (continue? #x144) + (load-game #x14b) + (save-game #x14c) + (formatting #x14d) + (creating-save-data #x14e) + (empty #x14f) + (options #x150) + (error-loading #x151) + (error-saving #x152) + (error-formatting #x153) + (error-creating-data #x154) + (memcard-removed #x156) + (autosave-disabled-title #x157) + (autosave-disabled-msg #x158) + (no-save-data #x159) + (create-save-data? #x15a) + (check-memcard #x15b) + (new-game #x15c) + (back? #x15d) + (ok #x15e) + (exit-demo #x15f) + (autosave-warn-title #x160) + (autosave-warn-msg #x161) + (task-completed #x162) + (check-memcard-and-retry #x163) + (screen-change-to-60hz #x164) + (screen-60hz-warn-support #x165) + (screen-60hz-warn-timer #x166) + (screen-now-60hz #x167) + (screen-60hz-keep? #x168) + (warp-gate-use-dpad #x169) + (no-disc-title #x16a) + (no-disc-msg #x16b) + (bad-disc-title #x16c) + (bad-disc-msg #x16d) + (press-start #x16e) + (quit-game #x16f) + (quit? #x170) + (total-collected #x171) + + (village1-mayor-money #x200) + (vollage1-uncle-money #x201) + (village1-yakow-herd #x202) + (village1-yakow-return #x203) + (village1-oracle #x204) + (beach-ecorocks #x205) + (beach-flutflut-push #x206) + (beach-flutflut-meet #x207) + (beach-pelican #x208) + (beach-seagull #x209) + (beach-cannon #x20a) + (beach-buzzer #x20b) + (jungle-lurkerm-connect #x20c) + (jungle-tower #x20d) + (jungle-eggtop #x20e) + (jungle-plant #x20f) + (jungle-fishgame #x210) + (misty-muse-catch #x211) + (misty-muse-return #x212) + (misty-boat #x213) + (misty-cannon #x214) + (misty-return-to-pool #x215) ;; task name?? + (misty-find-transpad #x216) ;; task name? + (misty-balloon-lurkers #x217) + + (village1-level-name #x220) + (beach-level-name #x221) + (jungle-level-name #x222) + (misty-level-name #x223) + + (beach-seagull-get #x22e) + + (jungle-lurkerm-unblock #x22f) + (jungle-lurkerm-return #x230) + + (MISSING-orb-hint #x233) + + (beach-eco-rock-increment #x239) + + (jungle-maindoor-hint #x23c) + + (firecanyon-not-enough-cells #x24f) + + (sidekick-hint-orb-cache-top #x251) + + (jungle-precursorbridge-hint #x25b) + (daxter-launcher-no-eco #x25c) + + (jungle-mirrors-completion-talk-to-mayor #x25e) + + (beach-gimmie #x262) + (beach-sentinel #x263) + (jungle-canyon-end #x264) + (jungle-temple-door #x265) + (misty-bike-jump #x266) + (misty-eco-challenge #x267) + (beach-seagull-chased-one #x268) + (beach-seagull-chased-two #x26a) + (beach-seagull-chased-three #x26b) + (beach-seagull-chased-four #x26c) + + (misty-daxter-scared #x26f) + + (beach-seagulls-avalanche #x273) + + (beach-pelican-quick-get-cell #x274) + + (beach-flutflutegg-hint #x275) + + (sidekick-hint-fish-powerup #x278) + (misty-racer-hit-the-ballon-lurkers #x27e) + (misty-daxter-hit-lurkers-not-mines #x27f) + + (sidekick-speech-hint-crate-darkeco1 #x281) + (sidekick-speech-crate-steel-break1 #x283) + (sidekick-speech-hint-crate-iron #x284) + (sidekick-speech-hint-crate-steel #x285) + (beach-collectors-unblocked #x288) + (misty-stopped-lurkers-at-silo #x28a) + (misty-stopped-balloon-lurkers #x28b) + (jungleb-eco-vents-opened #x289) + (sidekick-speech-crate-steel-break2 #x28e) + (sidekick-speech-hint-crate-darkeco2 #x28f) + + (daxter-screaming-jump #x290) + (daxter-wahoo-jump #x291) + (daxter-get-some #x292) + + (collectables-scout-flies-red-boxes #x295) + (found-all-scout-flies #x296) + (yakow-owed-powercell #x297) + + (jungle-mirrors-tutorial #x29c) + (jungle-mirrors-break-the-mirror-jak #x29d) + (jungle-mirrors-go-to-the-next-tower #x29f) + (jungle-mirrors-follow-the-beam #x2a0) + + (misty-teetertotter-bonk-dax-tutorial #x2a4) + (sidekick-hint-misty-get-red-eco #x2a5) + + (red-eco-tutorial #x2a6) + + (daxter-blue-eco-plat-tutorial #x2a7) + + (fish? #x2a9) + + (misty-bone-bridge-hint #x2aa) + + (beach-grottopole-increment #x2af) + + (firecanyon-collect-cells-collected #x2b1) + (firecanyon-collect-cells-collected-reminder #x2b2) + (firecanyon-collect-cells-text #x2b3) + (caught #x2b4) + (missed #x2b5) + (lose! #x2b6) + + (village2-gambler-money #x300) + (village2-geologist-money #x301) + (village2-warrior-money #x302) + (village2-oracle-money #x303) + (swamp-tether #x304) + + (swamp-flutflut #x307) + + (swamp-billy #x309) + + (sunken-elevator-raise #x30a) + (sunken-elevator-get-to-roof #x30b) + (sunken-pipe #x30c) + (sunken-climb-tube #x30d) ;; task name? + (sunken-pool #x30e) ;; task name? + (sunken-platforms #x30f) + + (rolling-moles #x310) + (rolling-moles-return #x311) + (rolling-robbers #x312) + (rolling-race #x313) + (rolling-race-return #x314) + (rolling-lake #x315) + (rolling-plants #x316) + + (unknown-buzzers #x317) + + (village2-level-name #x319) + + (rolling-level-name #x31b) + (swamp-level-name #x31c) + (sunken-level-name #x31d) + (ogre-level-name #x31e) + + (swamp-battle #x321) + (sunken-bottom #x322) ;; task name? + (reach-center #x323) ;; task name? + (rolling-ring-chase-1 #x324) + (rolling-ring-chase-2 #x325) + (sunken-kiera-you-raised-a-piece-of-lpc #x326) + (rolling-beat-lurkers #x327) + (swamp-finished-with-flutflut #x328) + (rolling-race-beat-record #x335) + (sidekick-speech-hint-rolling-crate-darkeco #x336) + (rolling-lightning-moles-completion #x338) + (rolling-dark-plants-location-hint #x339) + (rolling-dark-plants-hint #x33a) + (rolling-flying-lurker-intro #x33c) + (rolling-ring-hint-one-ring-down #x33f) + (rolling-ring-hint-be-quick-to-next #x340) + (rolling-ring-hint-be-quick-all #x341) + + (sunken-pipegame-follow-it #x343) + (sunken-helix-daxter-bad-feeling #x344) + (sunken-blue-eco-charger-hint #x345) + (sunken-double-lurker-hint #x347) + (sunken-helix-daxter-eco-rising #x348) + (sunken-qbert-plat-hint #x34a) + (sunken-bully-dive-hint #x34b) + (sunken-take-it-easy-hot-pipes #x34e) + + (sunken-blue-eco-charger-all-hint #x34d) + + (swamp-tethers-advice-hint #x352) + + (kermit-break-tongue #x357) + (swamp-rats-nest-hint #x358) + (daxter-you-can-shoot-with-yellow-eco #x359) + + (kermit-run-away-jak #x35f) + + (swamp-bats-hint #x364) ;; maybe we can duck the bats + (swamp-tethers-three-to-go #x365) + (swamp-tethers-two-to-go #x366) + (swamp-tethers-lefts-find-the-last #x367) + (flutflut-reminder #x368) + + (sage-golfclap-i-have-low-expectations #x36a) ;; where was this said? + + (swamp-tethers-completion-sage-precursor-arm #x36b) + + (village2-warp-gate-reminder #x36f) + (village2-warp-gate-reminder-annoyed #x370) + (village2-warp-gate-reminder-very-annoyed #x371) + + (village2-not-enough-cells-levitator #x36c) + (villlage2-levitator-cell-req-text #x372) + + (rolling-race-time-string-prefix #x373) + (rolling-race-record-string-prefix #x374) + (rolling-race-new-record-string-prefix #x375) + (rolling-race-try-again-string #x376) + (rolling-race-start-race-aborted #x377) ;; double check this + + (village3-miner-money #x400) + (village3-oracle-money #x401) + (snow-ram-3-left #x402) + (snow-ram-2-left #x403) + (snow-ram-1-left #x404) + (snow-fort #x405) + (snow-bunnies #x406) + (snow-open-door #x408) ;; task name? + + (cave-robot-climb #x40e) + (cave-dark-climb #x40f) ;; destroy crystals + + (cave-gnawers #x410) + (cave-dark-crystals #x411) + + (village3-buzzer #x413) + + (village3-level-name #x415) + + (snowy-level-name #x417) + + (cave-level-name #x419) + + (lavatube-level-name #x41b) + + (snow-eggtop #x421) + + (cave-spider-tunnel #x423) + (cave-platforms #x424) + + (cave-swing-poles #x426) + + (assistant-lavatube-powercell-hint #x428) + (village3-gondola-malfunctioning #x429) + (village3-gondola-reactivated #x42a) + + (snow-frozen-crate #x42b) ;; task name? + (snow-bumpers #x42c) + + (dark-crystal-last-one #x432) + (daxter-maybe-you-can-shoot-better-goggles #x433) + + (darkcave-light-crystal-low-light-hint #x437) + (darkcave-light-crystal-hint #x438) + (dark-crystal-run-away #x439) + (cave-trap-nest-hint #x440) + (snow-fort-reminder #x443) + (ram-boss-red-eco-hint #x444) + + (ice-cube-hint #x448) + + (snowy-turned-on-yellow-vents #x44c) + + (village3-warp-gate-reminder #x452) + (village3-warp-gate-reminder=annoyed #x453) + (village3-warp-gate-reminder-very-annoyed #x454) + (lavatube-powercell-req-text #x455) + + (fire-canyon-end #x500) + (fire-canyon-buzzer #x501) + + (daxter-maybe-i-should-drive #x506) + (daxter-you-are-trying-to-avoid-dark-eco #x507) + + (fire-canyon-level-name #x50c) + + (fire-canyon-we-made-it #x515) + + (collectables-theres-scout-flys-here-too #x516) + + (ogre-end #x600) + (ogre-buzzer #x601) + (ogre-boss #x603) + (ogre-boss-killed #x604) + + (assistant-voicebox-intro-ogre-race #x605) + + (sidekick-speech-hint-ogre-race #x61c) + (assistant-finished-mountain-pass-race #x61d) + + (lavatube-end #x700) + (lavatube-buzzer #x701) + + (lavatube-shoot-the-spheres #x70d) + + (lavatube-spheres-door-open #x710) + + (citadel-buzzer #x800) + (citadel-level-name #x801) + (citadel-sage-blue #x802) + (citadel-sage-red #x803) + (citadel-sage-yellow #x804) + (citadel-sage-green #x805) + (citadel-break-generator-hint #x806) + (citadel-lurker-bunny-alert #x808) + (citadel-break-generators-reminder #x809) + (citadel-climb-plat-hint #x80c) + + (daxter-dont-miss-the-next-launcher #x80d) + + (daxter-land-on-the-next-launcher #x812) + (misty-battle-finished #x813) + + (training-precursor-orbs #x901) + (training-power-cells #x902) + (training-assistant-found-scout-fly #x903) + (training-assistant-found-scout-fly-cell #x904) + (training-blue-eco-vent #x907) + (training-eco-green #x908) + (training-eco-blue #x909) + (training-more-eco-more-time #x90a) + (training-precursor-door #x90b) + (training-eco-opened-door #x90c) + (training-double-jump #x90e) + + (sage-voicebox-hint-crate-iron #x917) + (training-warp-gate-blocked #x919) + (training-warp-gate-reminder #x91a) + + (training-gimmie-task-name #x91b) + (training-buzzer-task-name #x91c) + (training-door-task-name #x91d) + (training-climb-task-name #x91e) + (training-level-name #x91f) + + (inc #xf10) + (europe #xf11) +;; GAME-TEXT-ID ENUM ENDS + + ; PC Port TEXT + (progress-resolution #x1000) + (progress-display-mode #x1001) + (progress-letterbox #x1002) + (progress-subtitles #x1003) + (progress-subtitles-label-speaker #x1004) + (progress-discord-rpc #x1005) + (progress-language-options #x1006) + ;; subtitle languages + (progress-subtitles-language #x1007) + (progress-subtitle-language-uk-english #x1008) + (progress-subtitle-language-portuguese #x1009) + (progress-subtitle-language-finnish #x1010) + (progress-subtitle-language-swedish #x1011) + (progress-subtitle-language-danish #x1012) + (progress-subtitle-language-norwegian #x1013) + (progress-subtitle-language-korean #x1014) + (progress-subtitle-language-russian #x1015) + (progress-subtitles-label-speaker-on #x1016) + (progress-subtitles-label-speaker-off #x1017) + (progress-subtitles-label-speaker-auto #x1018) + ;; display modes + (progress-display-mode-borderless #x1019) + (progress-display-mode-fullscreen #x1020) + (progress-display-mode-windowed #x1021) + ;; aspect ratios + (process-aspect-ratio-4x3 #x1022) + (process-aspect-ratio-5x4 #x1023) + (process-aspect-ratio-16x9 #x1024) + (process-aspect-ratio-21x9 #x1025) + (process-aspect-ratio-32x9 #x1026) + ;; 4:3 resolutions + (process-res-4x3-640x480 #x1027) + (process-res-4x3-800x600 #x1028) + (process-res-4x3-1024x768 #x1029) + (process-res-4x3-1280x960 #x1030) + (process-res-4x3-1600x1200 #x1031) + ;; 5:4 resolutions + (process-res-5x4-960x768 #x1032) + (process-res-5x4-1280x1024 #x1033) + (process-res-5x4-1500x1200 #x1034) + ;; 16:9 resolutions + (process-res-16x9-854x480 #x1035) + (process-res-16x9-1280x720 #x1036) + (process-res-16x9-1920x1080 #x1037) + (process-res-16x9-2560x1440 #x1038) + (process-res-16x9-2880x1620 #x1039) + (process-res-16x9-3840x2160 #x1040) + (process-res-16x9-5120x2880 #x1041) + ;; 21:9 resolutions + (process-res-21x9-2560x1080 #x1042) + (process-res-21x9-3120x1440 #x1043) + (process-res-21x9-3200x1440 #x1044) + (process-res-21x9-3440x1440 #x1045) + (process-res-21x9-3840x1600 #x1046) + (process-res-21x9-5120x2160 #x1047) + ;; 32:9 resolutions + (process-res-32x9-5120x1440 #x1048) + ) + +;; an individual string. +(deftype game-text (structure) + ((id game-text-id :offset-assert 0) + (text string :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; A table of all strings. +(deftype game-text-info (basic) + ((length int32 :offset-assert 4) + (language-id int32 :offset-assert 8) + (group-name string :offset-assert 12) + (data game-text :inline :dynamic :offset-assert 16) + ) + :method-count-assert 10 + :size-assert #x10 + :flag-assert #xa00000010 + (:methods + (lookup-text! (_type_ game-text-id symbol) string 9) + ) + ) + +;; all text is stored in the COMMON text files (one file per language). +;; in theory, you could have multiple text files that are only loaded when needed, but they didn't do this. +(define *text-group-names* (new 'static 'boxed-array :type string :length 1 "common")) + +;; The heap for storing text +(define *common-text-heap* (new 'global 'kheap)) + +;; will store the COMMON text when it is loaded. +(define *common-text* (the-as game-text-info #f)) + + +(defun-extern print-game-text string font-context symbol int int float) + + + diff --git a/goal_src/engine/pc/pckernel-h.gc b/goal_src/pc/pckernel-h.gc similarity index 96% rename from goal_src/engine/pc/pckernel-h.gc rename to goal_src/pc/pckernel-h.gc index 99480b063f..16ae4af52c 100644 --- a/goal_src/engine/pc/pckernel-h.gc +++ b/goal_src/pc/pckernel-h.gc @@ -207,7 +207,9 @@ (aspect-ratio float) ;; the desired aspect ratio. set auto to off and then this to 4/3 to force 4x3 aspect. (aspect-ratio-scale float) ;; aspect ratio compared to 4x3 (aspect-ratio-reciprocal float) ;; aspect ratio compared to 3x4 - (fullscreen? symbol) ;; fullscreen status. can be #f, #t or borderless + (resolution symbol) ;; selected resolution + (display-mode symbol) ;; display mode. can be windowed, fullscreen or borderless + (aspect-ratio-mode symbol) ;; explicit vetted aspect ratios - 4:3 | 5:4 | 16:9 | 21:9 | 32:9 (letterbox? symbol) ;; letterbox. #f = stretched (vsync? symbol) ;; vsync. (font-scale float) ;; font scaling. @@ -304,10 +306,12 @@ (reset-fixes (_type_) none) (reset-extra (_type_) none) (draw (_type_ dma-buffer) none) - (set-fullscreen! (_type_ symbol) int) - (set-size! (_type_ int int) int) - (set-aspect! (_type_ int int) int) - (set-aspect-ratio! (_type_ float) int) + (set-display-mode! (_type_ symbol) none) + (set-aspect-ratio-mode! (_type_ symbol) none) + (set-resolution! (_type_ symbol) none) + (set-size! (_type_ int int) none) + (set-aspect! (_type_ int int) none) + (set-aspect-ratio! (_type_ float) none) (read-from-file (_type_ string) symbol) (write-to-file (_type_ string) symbol) (actor-force-visible? (_type_) symbol) @@ -388,10 +392,13 @@ (set! (-> obj height) PC_BASE_HEIGHT) (set! (-> obj use-vis?) #t) (set! (-> obj aspect-ratio-auto?) #f) - (set! (-> obj fullscreen?) #f) (set! (-> obj vsync?) #t) (set! (-> obj letterbox?) #t) + (set-aspect-ratio-mode! obj 'pc-aspect-4x3) + (set-resolution! obj '640x480) + (set-display-mode! obj 'windowed) + (none)) (defmethod reset-audio pc-settings ((obj pc-settings)) diff --git a/goal_src/engine/pc/pckernel.gc b/goal_src/pc/pckernel.gc similarity index 90% rename from goal_src/engine/pc/pckernel.gc rename to goal_src/pc/pckernel.gc index 326eee2a2d..b50a42dc0a 100644 --- a/goal_src/engine/pc/pckernel.gc +++ b/goal_src/pc/pckernel.gc @@ -32,26 +32,29 @@ -(defmethod set-fullscreen! pc-settings ((obj pc-settings) (mode symbol)) - "toggles fullscreen mode" +(defmethod set-display-mode! pc-settings ((obj pc-settings) (mode symbol)) + "sets the game's display mode" - (if (= (-> obj fullscreen?) mode) ;; already fullscreen + ;; changing to same mode, no-op + (if (= (-> obj display-mode) mode) (return 0)) - (set! (-> obj fullscreen?) mode) - (pc-set-fullscreen - (cond ((= mode 'borderless) 2) - (mode 1) - (else 0) - ) - 0) - 0) + ;; else change it and update it + (set! (-> obj display-mode) mode) + (cond + ((= mode 'borderless) + (pc-set-fullscreen 2 0)) + ((= mode 'fullscreen) + (pc-set-fullscreen 1 0)) + (else ;; default to windowed + (pc-set-fullscreen 0 0))) + (none)) (defmethod set-size! pc-settings ((obj pc-settings) (width int) (height int)) - "sets window size" + "sets the size of the display window" (pc-set-window-size width height) - 0) + (none)) (defmethod set-aspect! pc-settings ((obj pc-settings) (aw int) (ah int)) @@ -61,7 +64,7 @@ (set! (-> obj aspect-ratio-auto?) #f) (set! (-> obj use-vis?) #f) ) - 0) + (none)) (defmethod set-aspect-ratio! pc-settings ((obj pc-settings) (aspect float)) @@ -69,9 +72,64 @@ (set! (-> obj aspect-ratio) aspect) (set! (-> obj aspect-ratio-scale) (/ aspect ASPECT_4X3)) (set! (-> obj aspect-ratio-reciprocal) (/ ASPECT_4X3 aspect)) - 0) + (none)) +(defmethod set-aspect-ratio-mode! pc-settings ((obj pc-settings) (mode symbol)) + "sets the game's aspect ratio mode" + ;; changing to same mode, no-op + (if (= (-> obj aspect-ratio-mode) mode) + (return 0)) + + ;; else change it and update it + (set! (-> obj aspect-ratio-mode) mode) + (cond + ((= mode 'pc-aspect-5x4) + (set-aspect! obj 5 4)) + ((= mode 'pc-aspect-16x9) + (set-aspect! obj 16 9)) + ((= mode 'pc-aspect-21x9) + (set-aspect! obj 21 9)) + ((= mode 'pc-aspect-32x9) + (set-aspect! obj 32 9)) + (else ;; default to 4x3 + (set-aspect! obj 4 3))) + (none)) + +(defmethod set-resolution! pc-settings ((obj pc-settings) (mode symbol)) + "sets the game's resolution" + + ;; changing to same mode, no-op + (if (= (-> obj resolution) mode) + (none)) + + ;; else change it and update it + (set! (-> obj resolution) mode) + ;; give me string splitting! + (case mode + (('640x480) (set-size! obj 640 480)) + (('800x600) (set-size! obj 800 600)) + (('1024x768) (set-size! obj 1024 768)) + (('1280x960) (set-size! obj 1280 960)) + (('1600x1200) (set-size! obj 1600 1200)) + (('960x768) (set-size! obj 960 768)) + (('1280x1024) (set-size! obj 1280 1024)) + (('1500x1200) (set-size! obj 1500 1200)) + (('854x480) (set-size! obj 854 480)) + (('1280x720) (set-size! obj 1280 720)) + (('1920x1080) (set-size! obj 1920 1080)) + (('2560x1440) (set-size! obj 2560 1440)) + (('2880x1620) (set-size! obj 2880 1620)) + (('3840x2160) (set-size! obj 3840 2160)) + (('5120x2880) (set-size! obj 5120 2880)) + (('2560x1080) (set-size! obj 2560 1080)) + (('3120x1440) (set-size! obj 3120 1440)) + (('3200x1440) (set-size! obj 3200 1440)) + (('3440x1440) (set-size! obj 3440 1440)) + (('3840x1600) (set-size! obj 3840 1600)) + (('5120x2160) (set-size! obj 5120 2160)) + (('5120x1440) (set-size! obj 5120 1440))) + (none)) (defmethod update-from-os pc-settings ((obj pc-settings)) "Update settings from the PC kernel to GOAL." @@ -292,7 +350,7 @@ (format *pc-temp-string* "game resolution: ~D x ~D~%" (-> obj width) (-> obj height)) (format *pc-temp-string* "window size: ~D x ~D (~,,1f x ~,,1f)~%" (-> obj win-width) (-> obj win-height) (-> obj dpi-x) (-> obj dpi-y)) (format *pc-temp-string* "target aspect: ~,,3f/~,,3f A: ~A/~A L: ~A~%" (-> obj aspect-ratio) (/ (the float (-> obj win-width)) (the float (-> obj win-height))) (-> obj aspect-ratio-auto?) (-> obj use-vis?) (-> obj letterbox?)) - (format *pc-temp-string* "fullscreen: ~A ~A~%" (-> obj fullscreen?) (-> obj vsync?)) + (format *pc-temp-string* "display-type: ~A ~A~%" (-> obj display-mode) (-> obj vsync?)) (draw-string-xy *pc-temp-string* buf 0 (- 224 (* 8 4)) (font-color default) (font-flags shadow kerning)) @@ -473,7 +531,9 @@ ) (("aspect-auto") (set! (-> obj aspect-ratio-auto?) (file-stream-read-symbol file))) (("aspect-game") (set! (-> obj aspect-setting) (file-stream-read-symbol file))) - (("fullscreen") (set-fullscreen! obj (file-stream-read-symbol file))) + (("display-mode") (set-display-mode! obj (file-stream-read-symbol file))) + (("aspect-ratio-mode") (set-aspect-ratio-mode! obj (file-stream-read-symbol file))) + (("resolution") (set-resolution! obj (file-stream-read-symbol file))) (("letterbox") (set! (-> obj letterbox?) (file-stream-read-symbol file))) (("vsync") (set! (-> obj vsync?) (file-stream-read-symbol file))) (("font-scale") (set! (-> obj font-scale) (file-stream-read-float file))) @@ -555,7 +615,7 @@ (file-stream-close file) (reset obj) (write-to-file obj filename) - (set-fullscreen! obj #f) + (set-display-mode! obj #f) (return #f) ) ) @@ -605,7 +665,9 @@ (format file " (aspect ~D ~D)~%" (-> obj aspect-custom-x) (-> obj aspect-custom-y)) (format file " (aspect-auto ~A)~%" (-> obj aspect-ratio-auto?)) (format file " (aspect-game ~A)~%" (-> *setting-control* default aspect-ratio)) - (format file " (fullscreen ~A)~%" (-> obj fullscreen?)) + (format file " (display-mode ~A)~%" (-> obj display-mode)) + (format file " (aspect-ratio-mode ~A)~%" (-> obj aspect-ratio-mode)) + (format file " (resolution ~A)~%" (-> obj resolution)) (format file " (letterbox ~A)~%" (-> obj letterbox?)) (format file " (vsync ~A)~%" (-> obj vsync?)) (format file " (font-scale ~f)~%" (-> obj font-scale)) diff --git a/goal_src/engine/pc/subtitle.gc b/goal_src/pc/subtitle.gc similarity index 100% rename from goal_src/engine/pc/subtitle.gc rename to goal_src/pc/subtitle.gc diff --git a/scripts/tasks/Taskfile_darwin.yml b/scripts/tasks/Taskfile_darwin.yml index ccddd79310..0131351b9e 100644 --- a/scripts/tasks/Taskfile_darwin.yml +++ b/scripts/tasks/Taskfile_darwin.yml @@ -7,3 +7,4 @@ vars: MEMDUMP_BIN_RELEASE_DIR: './build/tools' OFFLINETEST_BIN_RELEASE_DIR: './build' GOALCTEST_BIN_RELEASE_DIR: './build' + EXE_FILE_EXTENSION: '' diff --git a/scripts/tasks/Taskfile_linux.yml b/scripts/tasks/Taskfile_linux.yml index ccddd79310..0131351b9e 100644 --- a/scripts/tasks/Taskfile_linux.yml +++ b/scripts/tasks/Taskfile_linux.yml @@ -7,3 +7,4 @@ vars: MEMDUMP_BIN_RELEASE_DIR: './build/tools' OFFLINETEST_BIN_RELEASE_DIR: './build' GOALCTEST_BIN_RELEASE_DIR: './build' + EXE_FILE_EXTENSION: '' diff --git a/scripts/tasks/Taskfile_windows.yml b/scripts/tasks/Taskfile_windows.yml index 33c018704f..613e9ec7da 100644 --- a/scripts/tasks/Taskfile_windows.yml +++ b/scripts/tasks/Taskfile_windows.yml @@ -7,3 +7,4 @@ vars: MEMDUMP_BIN_RELEASE_DIR: './out/build/Release/bin' OFFLINETEST_BIN_RELEASE_DIR: './out/build/Release/bin' GOALCTEST_BIN_RELEASE_DIR: './out/build/Release/bin' + EXE_FILE_EXTENSION: '.exe' diff --git a/scripts/update-game-text-id.py b/scripts/update-game-text-id.py index 8c67a1b90f..9561c71554 100644 --- a/scripts/update-game-text-id.py +++ b/scripts/update-game-text-id.py @@ -38,5 +38,24 @@ with open('goal_src/engine/ui/text-h.gc') as f: os.remove('goal_src/engine/ui/text-h.gc') with open('goal_src/engine/ui/text-h.gc', "w") as f: f.writelines(new_texth_lines) +with open('goal_src/engine/pc/ui/text-h.gc') as f: + lines = f.readlines() + found_enum = False + for line in lines: + if begin_str in line: + found_enum = True + new_texth_lines.append(begin_str + "\n") + new_texth_lines += enum_lines + new_texth_lines.append(end_str + "\n") + continue + if end_str in line: + found_enum = False + continue + if found_enum: + continue + new_texth_lines.append(line) +os.remove('goal_src/engine/pc/ui/text-h.gc') +with open('goal_src/engine/pc/ui/text-h.gc', "w") as f: + f.writelines(new_texth_lines) print("game-text-id enum updated!")