diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index b718ae00f..5d1f486e5 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -994,6 +994,8 @@ (beach-level-name #x221) (jungle-level-name #x222) (misty-level-name #x223) + + (jungleb-level-name #x225) (beach-seagull-get #x22e) @@ -1354,20 +1356,87 @@ (speaker-auto #x107e) (hint-log #x107f) (cheats #x1080) + (secrets #x1081) + (select-level #x1082) + (select-flava #x1083) + (finalboss-level-name #x1084) + (credits #x1085) + (locked #x1086) + (ogreboss #x1087) + (fishgame #x1088) + (danger-mus #x1089) + (flava-player-controls #x108a) (cheat-eco-blue #x1090) (cheat-eco-red #x1091) (cheat-eco-green #x1092) (cheat-eco-yellow #x1093) (cheat-sidekick-alt #x1094) (cheat-invinc #x1095) + (cheat-tunes #x1096) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) (scrapbook #x10c3) - (scene-0 #x1100) - (scene-255 #x11ff) - (hint-0 #x1200) - (hint-511 #x13ff) + (default #x10d0) + (flava-vi1-unused0 #x10d1) + (flava-sage #x10d2) + (flava-sage-hut #x10d3) + (flava-birdlady #x10d4) + (flava-farmer #x10d5) + (flava-assistant #x10d6) + (flava-mayor #x10d7) + (flava-sculptor #x10d8) + (flava-explorer #x10d9) + (flava-dock #x10da) + (flava-jun-temple-exit #x10db) + (flava-jun-lurkerm #x10dc) + (flava-jun-temple-top #x10dd) + (flava-jub-eggtop #x10de) + (flava-jub-plant-boss #x10df) + (flava-bea-sentinel #x10e0) + (flava-bea-cannon #x10e1) + (flava-bea-grotto #x10e2) + (flava-mis-battle #x10e3) + (flava-mis-boat #x10e4) + (flava-mis-unused0 #x10e5) + (flava-racer #x10e6) + (flava-flutflut #x10e7) + (flava-fic-unused0 #x10e8) + (flava-warrior #x10e9) + (flava-geologist #x10ea) + (flava-gambler #x10eb) + (flava-levitator #x10ec) + (flava-swa-game #x10ed) + (flava-swa-launcher #x10ee) + (flava-swa-battle #x10ef) + (flava-rol-gorge #x10f0) + (flava-ogr-middle #x10f1) + (flava-ogr-end #x10f2) + (flava-vi3-mai #x10f3) + (flava-vi3-sno #x10f4) + (flava-vi3-miners #x10f5) + (flava-mai-rob #x10f6) + (flava-mai-rob-top #x10f7) + (flava-mai-mai #x10f8) + (flava-mai-dar #x10f9) + (flava-sno-battle #x10fa) + (flava-sno-cave #x10fb) + (flava-sno-fort #x10fc) + (flava-sno-balls #x10fd) + (flava-lav-middle #x10fe) + (flava-lav-end #x10ff) + (flava-cit-yellowsage #x1100) + (flava-cit-redsage #x1101) + (flava-cit-bluesage #x1102) + (flava-cit-hub #x1103) + (flava-fin-middle #x1104) + (flava-fin-end #x1105) + (flava-credits-middle #x1106) + (flava-credits-end #x1107) + (scene-0 #x1200) + (scene-255 #x12ff) + (hint-0 #x1300) + (hint-511 #x14ff) ;; GAME-TEXT-ID ENUM ENDS ) @@ -15520,6 +15589,7 @@ (scene-player) (credits) (quit-title) + (flava-player) ;; the last one! (max) @@ -15549,6 +15619,8 @@ (language-subtitles) (speaker) (aspect-native) + (button-music) + (button-flava) ) (defenum game-option-menu @@ -22067,7 +22139,7 @@ ;; - Functions (define-extern adjust-pos (function int int int)) -(define-extern draw-percent-bar (function int int float int none)) +(define-extern draw-percent-bar (function int int float rgba none)) (define-extern print-language-name (function int font-context int symbol font-context)) (define-extern hide-progress-icons (function none)) @@ -25998,7 +26070,7 @@ ;; - Functions -(define-extern target-has-all-the-cells? (function symbol)) +(define-extern target-has-all-the-cells? (function symbol :behavior process)) ;; ---------------------- diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index d750a6c13..b7a801368 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -18,8 +18,8 @@ "3RD-PERSON HORIZONTAL CAMERA") (#x1006 "3RD-PERSON VERTICAL CAMERA" "3RD-PERSON VERTICAL CAMERA") -(#x1007 "RESTORE ORIGINAL GAME CONTROLS" - "RESTORE ORIGINAL GAME CONTROLS") +(#x1007 "RESTORE DEFAULTS" + "RESTORE DEFAULTS") (#x100f "MISCELLANEOUS" "MISCELLANEOUS") @@ -115,6 +115,25 @@ (#x1080 "CHEATS" "CHEATS") +(#x1081 "SECRETS" + "SECRETS") +(#x1082 "SELECT LEVEL" + "SELECT LEVEL") +(#x1083 "SELECT FLAVOR" + "SELECT FLAVOUR") +(#x1084 "FINAL BOSS" + "FINAL BOSS") +(#x1085 "CREDITS" + "CREDITS") +(#x1086 "LOCKED" + "LOCKED") +(#x1087 "KLAWW" + "KLAWW") +(#x1088 "FISHING MINI-GAME" + "FISHING MINI-GAME") +(#x1089 "CHALLENGE THEME" + "CHALLENGE THEME") + (#x1090 "INFINITE BLUE ECO" "INFINITE BLUE ECO") (#x1091 "INFINITE RED ECO" @@ -127,6 +146,8 @@ "ALTERNATE DAXTER") (#x1095 "INVINCIBILITY" "INVINCIBILITY") +(#x1096 "PLAY ALL MUSIC TRACKS" + "PLAY ALL MUSIC TRACKS") (#x10c0 "MUSIC PLAYER" "MUSIC PLAYER") @@ -137,6 +158,119 @@ (#x10c3 "SCRAPBOOK" "SCRAPBOOK") +(#x10d0 "DEFAULT" + "DEFAULT") +(#x10d1 "UNUSED" + "UNUSED") +(#x10d2 "SAGE" + "SAGE") +(#x10d3 "SAGE'S HUT" + "SAGE'S HUT") +(#x10d4 "BIRDWATCHER" + "BIRDWATCHER") +(#x10d5 "FARMER" + "FARMER") +(#x10d6 "KEIRA" + "KEIRA") +(#x10d7 "MAYOR" + "MAYOR") +(#x10d8 "SCULPTOR" + "SCULPTOR") +(#x10d9 "JAK'S UNCLE" + "JAK'S UNCLE") +(#x10da "DOCK" + "DOCK") +(#x10db "FORBIDDEN TEMPLE EXIT" + "FORBIDDEN TEMPLE EXIT") +(#x10dc "LURKER MACHINE" + "LURKER MACHINE") +(#x10dd "TOP OF THE TOWER" + "TOP OF THE TOWER") +(#x10de "BLUE VENT SWITCH" + "BLUE VENT SWITCH") +(#x10df "UNUSED" + "UNUSED") +(#x10e0 "SENTINELS" + "SENTINELS") +(#x10e1 "LURKER CANNON" + "LURKER CANNON") +(#x10e2 "GROTTO" + "GROTTO") +(#x10e3 "UNUSED 1" + "UNUSED 1") +(#x10e4 "LURKER BOAT" + "LURKER BOAT") +(#x10e5 "UNUSED 2" + "UNUSED 2") +(#x10e6 "ZOOMER" + "ZOOMER") +(#x10e7 "FLUT FLUT" + "FLUT FLUT") +(#x10e8 "UNUSED" + "UNUSED") +(#x10e9 "WARRIOR" + "WARRIOR") +(#x10ea "GEOLOGIST" + "GEOLOGIST") +(#x10eb "GAMBLER" + "GAMBLER") +(#x10ec "LEVITATOR MACHINE" + "LEVITATOR MACHINE") +(#x10ed "UNUSED 1" + "UNUSED 1") +(#x10ee "LAUNCHER TRAPS" + "LAUNCHER TRAPS") +(#x10ef "UNUSED 2" + "UNUSED 2") +(#x10f0 "DEAD MAN'S GORGE" + "DEAD MAN'S GORGE") +(#x10f1 "MIDDLE OF THE PASS" + "MIDDLE OF THE PASS") +(#x10f2 "END OF THE PASS" + "END OF THE PASS") +(#x10f3 "TO SPIDER CAVE" + "TO SPIDER CAVE") +(#x10f4 "TO SNOWY MOUNTAIN" + "TO SNOWY MOUNTAIN") +(#x10f5 "MINERS" + "MINERS") +(#x10f6 "ROBOT CAVE SCAFFOLDING" + "ROBOT CAVE SCAFFOLDING") +(#x10f7 "PRECURSOR ROBOT TOP" + "PRECURSOR ROBOT TOP") +(#x10f8 "MAIN CAVE" + "MAIN CAVE") +(#x10f9 "DARK CAVE" + "DARK CAVE") +(#x10fa "UNUSED" + "UNUSED") +(#x10fb "HIDDEN CAVE" + "HIDDEN CAVE") +(#x10fc "LURKER FORT" + "LURKER FORT") +(#x10fd "SNOWBALLS" + "SNOWBALLS") +(#x10fe "MIDDLE OF THE TUBE" + "MIDDLE OF THE TUBE") +(#x10ff "END OF THE TUBE" + "END OF THE TUBE") +(#x1100 "YELLOW SAGE" + "YELLOW SAGE") +(#x1101 "RED SAGE" + "RED SAGE") +(#x1102 "BLUE SAGE" + "BLUE SAGE") +(#x1103 "CITADEL HUB" + "CITADEL HUB") +(#x1104 "MIDDLE OF THE BOSS" + "MIDDLE OF THE BOSS") +(#x1105 "END OF THE BOSS" + "END OF THE BOSS") +(#x1106 "FLAVOR 1" + "FLAVOUR 1") +(#x1107 "FLAVOR 2" + "FLAVOUR 2") + ;; ----------------- ;; test diff --git a/game/discord.cpp b/game/discord.cpp index 99d3a39e3..627714487 100644 --- a/game/discord.cpp +++ b/game/discord.cpp @@ -7,25 +7,30 @@ int gDiscordRpcEnabled; int64_t gStartTime; static const char* APPLICATION_ID = "938876425585434654"; -static std::map jak1_level_names = {{"intro", "Intro"}, - {"title", "Title screen"}, - {"training", "Geyser Rock"}, - {"village1", "Sandover Village"}, - {"beach", "Sentinel Beach"}, - {"jungle", "Forbidden Jungle"}, - {"misty", "Misty Island"}, - {"firecanyon", "Fire Canyon"}, - {"village2", "Rock Village"}, - {"swamp", "Boggy Swamp"}, - {"rolling", "Precursor Basin"}, - {"sunken", "Lost Precursor City"}, - {"ogre", "Mountain Pass"}, - {"village3", "Volcanic Crater"}, - {"snow", "Snowy Mountain"}, - {"maincave", "Spider Cave"}, - {"lavatube", "Lava Tube"}, - {"citadel", "Gol and Maia's Citadel"}, - {"finalboss", "Final Boss"}}; +static const std::map jak1_level_names = { + {"intro", "Intro"}, + {"title", "Title screen"}, + {"training", "Geyser Rock"}, + {"village1", "Sandover Village"}, + {"beach", "Sentinel Beach"}, + {"jungle", "Forbidden Jungle"}, + {"misty", "Misty Island"}, + {"firecanyon", "Fire Canyon"}, + {"village2", "Rock Village"}, + {"swamp", "Boggy Swamp"}, + {"rolling", "Precursor Basin"}, + {"sunken", "Lost Precursor City"}, + {"ogre", "Mountain Pass"}, + {"village3", "Volcanic Crater"}, + {"snow", "Snowy Mountain"}, + {"maincave", "Spider Cave"}, + {"lavatube", "Lava Tube"}, + {"citadel", "Gol and Maia's Citadel"}, + {"finalboss", "Final Boss"}}; +static const std::map jak1_level_name_remap = {{"jungleb", "jungle"}, + {"sunkenb", "sunken"}, + {"robocave", "maincave"}, + {"darkcave", "maincave"}}; void init_discord_rpc() { gDiscordRpcEnabled = 1; @@ -47,15 +52,10 @@ void set_discord_rpc(int state) { // get full level name from symbol name ("village1" -> "Sandover Village") const char* jak1_get_full_level_name(const char* level_name) { // ignore sublevels - if (!strcmp(level_name, "jungleb")) { - level_name = "jungle"; - } else if (!strcmp(level_name, "sunkenb")) { - level_name = "sunken"; - } else if (!strcmp(level_name, "darkcave") || !strcmp(level_name, "robocave")) { - level_name = "maincave"; - } + auto it = jak1_level_name_remap.find(level_name); + auto actual_level_name = it == jak1_level_name_remap.end() ? level_name : it->second; - const auto& nice_name = jak1_level_names.find(level_name); + const auto& nice_name = jak1_level_names.find(actual_level_name); if (nice_name != jak1_level_names.end()) { return nice_name->second.c_str(); } diff --git a/game/graphics/opengl_renderer/foreground/Merc2.cpp b/game/graphics/opengl_renderer/foreground/Merc2.cpp index 4310ac270..82f09eb0d 100644 --- a/game/graphics/opengl_renderer/foreground/Merc2.cpp +++ b/game/graphics/opengl_renderer/foreground/Merc2.cpp @@ -463,7 +463,7 @@ void Merc2::flush_pending_model(SharedRenderState* render_state, ScopedProfilerN // no existing bucket if (m_next_free_level_bucket >= m_level_draw_buckets.size()) { // out of room, flush - fmt::print("MERC2 out of levels, consider increasing MAX_LEVELS\n"); + // fmt::print("MERC2 out of levels, consider increasing MAX_LEVELS\n"); flush_draw_buckets(render_state, prof); // and retry the whole thing. flush_pending_model(render_state, prof); diff --git a/game/kernel/kmachine.h b/game/kernel/kmachine.h index d7a65882c..6d74ca89b 100644 --- a/game/kernel/kmachine.h +++ b/game/kernel/kmachine.h @@ -14,7 +14,7 @@ constexpr bool BIG_MEMORY = true; //! How much space to leave for the stack when creating the debug heap // In the game, it's 16 kB, but we increase it to 64 kB. -// ASAN builds + fmt / spdlog stuff uses a _ton_ of stack when no optimizations are on and we +// ASAN builds + fmt stuff uses a _ton_ of stack when no optimizations are on and we // need more. constexpr u32 DEBUG_HEAP_SPACE_FOR_STACK = 0x10000; diff --git a/game/kernel/kscheme.cpp b/game/kernel/kscheme.cpp index c64322042..daecc47fb 100644 --- a/game/kernel/kscheme.cpp +++ b/game/kernel/kscheme.cpp @@ -86,10 +86,7 @@ u32 crc32(const u8* data, s32 size) { crc = crc_table[crc >> 24] ^ ((crc << 8) | *data); } - if ((~crc) == 0) { - // if this happens, I think the hash table implementation breaks. - ASSERT(false); - } + ASSERT(~crc); return ~crc; } diff --git a/game/kernel/ksound.cpp b/game/kernel/ksound.cpp index 7bbc05641..77250ec95 100644 --- a/game/kernel/ksound.cpp +++ b/game/kernel/ksound.cpp @@ -7,6 +7,8 @@ #include "ksound.h" #include "kscheme.h" #include "kdgo.h" +#include "game/sound/989snd/ame_handler.h" +#include "common/common_types.h" /*! * Does nothing! @@ -18,6 +20,13 @@ void InitSound() {} */ void ShutdownSound() {} +/*! + * PC port function + */ +void set_flava_hack(u64 val) { + snd::SoundFlavaHack = val; +} + /*! * Set up some functions which are somewhat related to sound. */ @@ -26,4 +35,5 @@ void InitSoundScheme() { make_function_symbol_from_c("rpc-busy?", (void*)RpcBusy); make_function_symbol_from_c("test-load-dgo-c", (void*)LoadDGOTest); make_stack_arg_function_symbol_from_c("rpc-call", (void*)RpcCall_wrapper); -} \ No newline at end of file + make_function_symbol_from_c("pc-sound-set-flava-hack", (void*)set_flava_hack); +} diff --git a/game/kernel/ksound.h b/game/kernel/ksound.h index 865de0895..b48a88306 100644 --- a/game/kernel/ksound.h +++ b/game/kernel/ksound.h @@ -6,11 +6,6 @@ * but whoever did the sound didn't use this. */ -#ifndef JAK_KSOUND_H -#define JAK_KSOUND_H - void InitSound(); void ShutdownSound(); void InitSoundScheme(); - -#endif // JAK_KSOUND_H diff --git a/game/sound/989snd/ame_handler.cpp b/game/sound/989snd/ame_handler.cpp index 18ab6f5a3..18c832547 100644 --- a/game/sound/989snd/ame_handler.cpp +++ b/game/sound/989snd/ame_handler.cpp @@ -2,9 +2,13 @@ // SPDX-License-Identifier: ISC #include "ame_handler.h" #include "game/sound/989snd/blocksound_handler.h" +#include "game/kernel/ksound.h" namespace snd { +// added! +u64 SoundFlavaHack = 0; + ame_handler::ame_handler(MultiMIDIBlockHeader* block, voice_manager& vm, MIDISound& sound, @@ -41,6 +45,7 @@ bool ame_handler::tick() { for (auto it = m_midis.begin(); it != m_midis.end();) { bool done = it->second->tick(); if (done) { + fmt::print("stopping segment {}\n", it->first); it = m_midis.erase(it); } else { it++; @@ -247,9 +252,14 @@ std::pair ame_handler::run_ame(midi_handler& midi, u8* stream) { } else { comp = m_register[m_groups[group].basis - 1]; } + // fmt::print("group: {} basis: {} excite: {}\n", group, m_groups[group].basis, comp); for (int i = 0; i < m_groups[group].num_channels; i++) { - if ((m_groups[group].excite_min[i] - 1 >= comp) || - (m_groups[group].excite_max[i] + 1 <= comp)) { + // auto xmin = m_groups[group].excite_min[i]; + // auto xmax = m_groups[group].excite_max[i]; + // fmt::print("chan {} excite: {}-{}\n", i, xmin, xmax); + // note : added hack here! :-) + if (!SoundFlavaHack && + (comp < m_groups[group].excite_min[i] || comp > m_groups[group].excite_max[i])) { midi.mute_channel(m_groups[group].channel[i]); } else { midi.unmute_channel(m_groups[group].channel[i]); diff --git a/game/sound/989snd/ame_handler.h b/game/sound/989snd/ame_handler.h index 198092f88..ab9450c7a 100644 --- a/game/sound/989snd/ame_handler.h +++ b/game/sound/989snd/ame_handler.h @@ -10,6 +10,9 @@ namespace snd { +// added! +extern u64 SoundFlavaHack; + class midi_handler; class ame_handler : public sound_handler { friend class midi_handler; diff --git a/game/sound/989snd/midi_handler.cpp b/game/sound/989snd/midi_handler.cpp index d87f654d7..65e5bb84f 100644 --- a/game/sound/989snd/midi_handler.cpp +++ b/game/sound/989snd/midi_handler.cpp @@ -300,7 +300,7 @@ void midi_handler::system_event() { m_seq_ptr = ptr; if (!cont) { - fmt::print("{:x} track stopped by ame\n", (u64)this); + // fmt::print("{:x} track stopped by ame\n", (u64)this); m_track_complete = true; } } else { @@ -395,7 +395,7 @@ void midi_handler::step() { } [[fallthrough]]; default: - throw midi_error(fmt::format("MIDI error: invalid status {}", m_status)); + throw midi_error(fmt::format("invalid status {}", m_status)); return; } diff --git a/goal_src/engine/game/main.gc b/goal_src/engine/game/main.gc index 6f6c8ffcf..3f7ffedc9 100644 --- a/goal_src/engine/game/main.gc +++ b/goal_src/engine/game/main.gc @@ -787,14 +787,13 @@ (draw-string-xy (string-format "Actor Bank: ~,,1m/~,,1m (~D)" (-> *ACTOR-bank* pause-dist) (-> *ACTOR-bank* birth-dist) (-> *ACTOR-bank* birth-max)) debug-buf 512 (- 224 8) (font-color default) (font-flags shadow kerning right)) ) (when (-> *pc-settings* display-bug-report) - (format *stdcon* "bug-report ~A~%" *user*) + (format *stdcon* "~0kbug-report ~A~%" *user*) (format *stdcon* "nick ~A continue ~S~%" (-> *load-state* vis-nick) (-> *game-info* current-continue name)) (dotimes (i LEVEL_COUNT) (format *stdcon* "level ~D ~12A ~A~%" i (-> *level* level i name) (-> *level* level i display?)) ) - (format *stdcon* "music ~A (f: ~D/~S) sound ~A ~A~%" - (-> *setting-control* current music) (-> *setting-control* current sound-flava) (enum->string music-flava (-> *setting-control* default sound-flava)) - *sound-bank-1* *sound-bank-2*) + (format *stdcon* "music ~A (f: ~D/~S)~%" (-> *setting-control* current music) (-> *setting-control* current sound-flava) (enum->string music-flava (-> *setting-control* default sound-flava))) + (format *stdcon* "sound ~A ~A~%" *sound-bank-1* *sound-bank-2*) (let ((pos (target-pos 0))) (format *stdcon* "target ~m ~m ~m~%" (-> pos x) (-> pos y) (-> pos z)) ) @@ -805,6 +804,7 @@ (matrix->quaternion rot (-> *math-camera* camera-rot)) (format *stdcon* "cam-rot ~f ~f ~f ~f~%" (-> rot x) (-> rot y) (-> rot z) (-> rot w)) ) + (format *stdcon* "~1k") ) (when (-> *pc-settings* display-heap-status) (draw-memory-bar-kheap debug-buf global :idx 0 :color (static-rgba 32 32 255 64)) diff --git a/goal_src/engine/game/settings-h.gc b/goal_src/engine/game/settings-h.gc index 140b21d44..7705643b9 100644 --- a/goal_src/engine/game/settings-h.gc +++ b/goal_src/engine/game/settings-h.gc @@ -131,12 +131,10 @@ (defmethod new setting-control ((allocation symbol) (type-to-make type) (max-connections int)) "Allocate a new setting-control and its engine" - (local-vars (s4-0 setting-control)) - (set! s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) - (set! (-> s4-0 engine) - ((method-of-type engine new) allocation engine 'setting-control max-connections) - ) - s4-0 + (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control max-connections)) + s4-0 + ) ) ;; used for memory card time information diff --git a/goal_src/engine/game/settings.gc b/goal_src/engine/game/settings.gc index 46d7ef6e9..d12444c07 100644 --- a/goal_src/engine/game/settings.gc +++ b/goal_src/engine/game/settings.gc @@ -5,6 +5,9 @@ ;; name in dgo: settings ;; dgos: GAME, ENGINE +(#when PC_PORT + (define *progress-flava* -1) + ) (defmethod update-from-engine setting-data ((obj setting-data) (arg0 engine)) "this goes through the list of desired setting changes in @@ -222,24 +225,19 @@ (defmethod clear-pending-settings-from-process setting-control ((obj setting-control) (arg0 process) (arg1 symbol)) "Remove requests to change settings from the given process." (when arg0 - (let ((s5-0 (-> obj engine)) - (s4-0 (-> arg0 connection-list next1)) - ) - (while s4-0 - (if - (and - ((method-of-type connection belongs-to-engine?) - (the-as connection s4-0) - s5-0 + (let ((s5-0 (-> obj engine)) + (s4-0 (-> arg0 connection-list next1)) + ) + (while s4-0 + (if (and (belongs-to-engine? (the-as connection s4-0) s5-0) + (or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0))) + ) + (move-to-dead (the-as connection s4-0)) + ) + (set! s4-0 (-> s4-0 next1)) ) - (or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0))) - ) - ((method-of-type connection move-to-dead) (the-as connection s4-0)) ) - (set! s4-0 (-> s4-0 next1)) - ) ) - ) 0 (none) ) @@ -342,7 +340,10 @@ (set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as music-flava (-> s5-1 sound-flava))))) (set! (-> gp-0 sound-flava) (-> s5-1 sound-flava)) (if *sound-player-enable* - (sound-set-flava (-> gp-0 sound-flava)) + (#if PC_PORT + (sound-set-flava (if (>= *progress-flava* 0) (the uint *progress-flava*) (-> gp-0 sound-flava))) + (sound-set-flava (-> gp-0 sound-flava)) + ) ) ;; update display settings diff --git a/goal_src/engine/ui/progress-h.gc b/goal_src/engine/ui/progress-h.gc index 4ee13c140..d16e803fa 100644 --- a/goal_src/engine/ui/progress-h.gc +++ b/goal_src/engine/ui/progress-h.gc @@ -119,6 +119,7 @@ (scene-player) (credits) (quit-title) + (flava-player) ;; the last one! (max) @@ -148,6 +149,8 @@ (language-subtitles) (speaker) (aspect-native) + (button-music) + (button-flava) ) ) ) diff --git a/goal_src/engine/ui/progress/progress-draw.gc b/goal_src/engine/ui/progress/progress-draw.gc index 23a0aaf72..04d4e02de 100644 --- a/goal_src/engine/ui/progress/progress-draw.gc +++ b/goal_src/engine/ui/progress/progress-draw.gc @@ -1462,26 +1462,11 @@ (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)) - ) +(defun draw-percent-bar ((arg0 int) (arg1 int) (arg2 float) (arg3 rgba)) + (with-dma-buffer-add-bucket ((s2-0 (-> (current-frame) global-buf)) + (bucket-id sprite)) (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) - ) - ) + (draw-sprite2d-xy s2-0 arg0 (+ arg1 2) (the int (* 255.0 arg2)) 10 arg3) ) 0 (none) @@ -1572,7 +1557,7 @@ (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)) + (draw-percent-bar (- 75 (-> obj left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) ) (set! option-str (string-format "~D" (the int (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify)))))) (set! x-off (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100)) diff --git a/goal_src/engine/ui/progress/progress.gc b/goal_src/engine/ui/progress/progress.gc index ebe42e741..bbbca2872 100644 --- a/goal_src/engine/ui/progress/progress.gc +++ b/goal_src/engine/ui/progress/progress.gc @@ -872,6 +872,9 @@ (= v1-2 (progress-screen gfx-ps2-options)) (= v1-2 (progress-screen resolution)) (= v1-2 (progress-screen aspect-ratio)) + (= v1-2 (progress-screen secrets)) + (= v1-2 (progress-screen music-player)) + (= v1-2 (progress-screen flava-player)) ) ) ) diff --git a/goal_src/engine/ui/text-h.gc b/goal_src/engine/ui/text-h.gc index ed07f70d3..ffbac0251 100644 --- a/goal_src/engine/ui/text-h.gc +++ b/goal_src/engine/ui/text-h.gc @@ -146,6 +146,8 @@ (beach-level-name #x221) (jungle-level-name #x222) (misty-level-name #x223) + + (jungleb-level-name #x225) (beach-seagull-get #x22e) @@ -506,20 +508,87 @@ (speaker-auto #x107e) (hint-log #x107f) (cheats #x1080) + (secrets #x1081) + (select-level #x1082) + (select-flava #x1083) + (finalboss-level-name #x1084) + (credits #x1085) + (locked #x1086) + (ogreboss #x1087) + (fishgame #x1088) + (danger-mus #x1089) + (flava-player-controls #x108a) (cheat-eco-blue #x1090) (cheat-eco-red #x1091) (cheat-eco-green #x1092) (cheat-eco-yellow #x1093) (cheat-sidekick-alt #x1094) (cheat-invinc #x1095) + (cheat-tunes #x1096) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) (scrapbook #x10c3) - (scene-0 #x1100) - (scene-255 #x11ff) - (hint-0 #x1200) - (hint-511 #x13ff) + (default #x10d0) + (flava-vi1-unused0 #x10d1) + (flava-sage #x10d2) + (flava-sage-hut #x10d3) + (flava-birdlady #x10d4) + (flava-farmer #x10d5) + (flava-assistant #x10d6) + (flava-mayor #x10d7) + (flava-sculptor #x10d8) + (flava-explorer #x10d9) + (flava-dock #x10da) + (flava-jun-temple-exit #x10db) + (flava-jun-lurkerm #x10dc) + (flava-jun-temple-top #x10dd) + (flava-jub-eggtop #x10de) + (flava-jub-plant-boss #x10df) + (flava-bea-sentinel #x10e0) + (flava-bea-cannon #x10e1) + (flava-bea-grotto #x10e2) + (flava-mis-battle #x10e3) + (flava-mis-boat #x10e4) + (flava-mis-unused0 #x10e5) + (flava-racer #x10e6) + (flava-flutflut #x10e7) + (flava-fic-unused0 #x10e8) + (flava-warrior #x10e9) + (flava-geologist #x10ea) + (flava-gambler #x10eb) + (flava-levitator #x10ec) + (flava-swa-game #x10ed) + (flava-swa-launcher #x10ee) + (flava-swa-battle #x10ef) + (flava-rol-gorge #x10f0) + (flava-ogr-middle #x10f1) + (flava-ogr-end #x10f2) + (flava-vi3-mai #x10f3) + (flava-vi3-sno #x10f4) + (flava-vi3-miners #x10f5) + (flava-mai-rob #x10f6) + (flava-mai-rob-top #x10f7) + (flava-mai-mai #x10f8) + (flava-mai-dar #x10f9) + (flava-sno-battle #x10fa) + (flava-sno-cave #x10fb) + (flava-sno-fort #x10fc) + (flava-sno-balls #x10fd) + (flava-lav-middle #x10fe) + (flava-lav-end #x10ff) + (flava-cit-yellowsage #x1100) + (flava-cit-redsage #x1101) + (flava-cit-bluesage #x1102) + (flava-cit-hub #x1103) + (flava-fin-middle #x1104) + (flava-fin-end #x1105) + (flava-credits-middle #x1106) + (flava-credits-end #x1107) + (scene-0 #x1200) + (scene-255 #x12ff) + (hint-0 #x1300) + (hint-511 #x14ff) ;; GAME-TEXT-ID ENUM ENDS ) diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 940670f50..31d464093 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -670,6 +670,11 @@ ) ) +(defmacro float->int (a) + "forcefully casts something as a float to int. be careful." + `(the int (the float ,a)) + ) + ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Bit Macros ;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/kernel-defs.gc b/goal_src/kernel-defs.gc index 6f8d16a94..cf2e9edc0 100644 --- a/goal_src/kernel-defs.gc +++ b/goal_src/kernel-defs.gc @@ -351,6 +351,7 @@ (define-extern pc-discord-rpc-set (function int none)) (define-extern pc-filepath-exists? (function string symbol)) (define-extern pc-mkdir-file-path (function string none)) +(define-extern pc-sound-set-flava-hack (function int none)) (defenum pc-prof-event (begin 0) diff --git a/goal_src/levels/finalboss/robotboss-h.gc b/goal_src/levels/finalboss/robotboss-h.gc index a9de18761..f3ceb70b1 100644 --- a/goal_src/levels/finalboss/robotboss-h.gc +++ b/goal_src/levels/finalboss/robotboss-h.gc @@ -125,19 +125,17 @@ (none) ) -(defun target-has-all-the-cells? () - (with-pp - (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) pp) - (set! (-> a1-0 num-params) 2) - (set! (-> a1-0 message) 'query) - (set! (-> a1-0 param 0) (the-as uint 'pickup)) - (set! (-> a1-0 param 1) (the-as uint 6)) - (>= (the int (the-as float (send-event-function *target* a1-0))) 100) - ) - ) - ) - ) +(defbehavior target-has-all-the-cells? process () + (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'pickup)) + (set! (-> a1-0 param 1) (the-as uint 6)) + (>= (the int (the-as float (send-event-function *target* a1-0))) 100) + ) + ) + ) ) (defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja diff --git a/goal_src/pc/pckernel-h.gc b/goal_src/pc/pckernel-h.gc index 023d904a7..07a41670d 100644 --- a/goal_src/pc/pckernel-h.gc +++ b/goal_src/pc/pckernel-h.gc @@ -31,7 +31,7 @@ (defglobalconstant PC_KERNEL_VERSION_BUILD #x0001) (defglobalconstant PC_KERNEL_VERSION_REVISION #x0004) -(defglobalconstant PC_KERNEL_VERSION_MINOR #x0001) +(defglobalconstant PC_KERNEL_VERSION_MINOR #x0003) (defglobalconstant PC_KERNEL_VERSION_MAJOR #x0001) (defglobalconstant PC_KERNEL_VERSION (logior (ash PC_KERNEL_VERSION_MAJOR 48) @@ -50,6 +50,12 @@ (defconstant PC_BASE_HEIGHT 480) +;; how many entries the music log has. the game only has 21 tracks but let's have more space for no reason. +(defconstant PC_MUSIC_LOG_LENGTH 30) +;; how many entries the spool anim log has. only 164 are used in-game. +(defconstant PC_SPOOL_LOG_LENGTH 170) + + (defconstant PC_SETTINGS_FILE_NAME "game_config/pc-settings.txt") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -114,15 +120,24 @@ (eco-yellow) (invinc) (sidekick-blue) + (tunes) ) (defmacro pc-cheats? (obj &rest cheats) `(logtest? (-> ,obj cheats) (pc-cheats ,@cheats))) +;; music log info +(deftype pc-music-log-entry (structure) + ((name symbol) + (flava-mask int32) + ) + :pack-me + ) + ;; secrets and goodies (deftype pc-game-secrets (structure) ((art pc-jak1-concept-art) ;; concept art unlocked - (music uint64 30) ;; flavas unlocked, for each track (there's like 30 musics, right?) + (music pc-music-log-entry PC_MUSIC_LOG_LENGTH :inline) (hard-fish-hiscore int32) (hard-rats? symbol) ;; enable this crap (hard-rats-hiscore int32) @@ -265,12 +280,15 @@ (secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets! - (scenes-seen uint8 197) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?) + (scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?) (discord-rpc? symbol) ;; enable discord rich presence integration (cheats pc-cheats) + (cheats-known pc-cheats) + (flava-hack int64) + ;; TODO - save/restore original settings (language/sound/etc) ) @@ -295,6 +313,8 @@ (read-from-file (_type_ string) symbol) (write-to-file (_type_ string) symbol) (update-cheats (_type_) int) + (update-music-log (_type_) int) + (add-to-music-log (_type_ symbol int) int) (commit-to-file (_type_) none) (load-settings (_type_) int) ) @@ -451,11 +471,12 @@ (defmethod reset-extra pc-settings ((obj pc-settings)) "Set the default goodies settings" - (dotimes (i 197) + (dotimes (i PC_SPOOL_LOG_LENGTH) (set! (-> obj scenes-seen i) 0) ) - (dotimes (i 30) - (set! (-> obj secrets music i) 0) + (dotimes (i PC_MUSIC_LOG_LENGTH) + (set! (-> obj secrets music i name) #f) + (set! (-> obj secrets music i flava-mask) 0) ) (set! (-> obj secrets art) (pc-jak1-concept-art)) @@ -468,6 +489,9 @@ (set! (-> obj secrets hud-counters?) #t) (set! (-> obj secrets hud-watch?) #f) (set! (-> obj secrets watch-12hr?) #f) + + (set! (-> obj cheats) (pc-cheats)) + (set! (-> obj cheats-known) (pc-cheats)) (none)) (defmacro with-pc (&rest body) diff --git a/goal_src/pc/pckernel.gc b/goal_src/pc/pckernel.gc index 1e14ba96a..c1c12c4d4 100644 --- a/goal_src/pc/pckernel.gc +++ b/goal_src/pc/pckernel.gc @@ -43,10 +43,6 @@ (unknown 15) ) -;; forward declarations needed for discord rpc. -(declare-type ogreboss process-drawable) -(declare-type plant-boss process-drawable) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; updates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -169,9 +165,11 @@ (pc-set-collision-mode *collision-mode*) ) + (pc-sound-set-flava-hack (-> obj flava-hack)) + (none)) -(define *pc-cheat-temp* (the-as (pointer int32) (malloc 'global 24))) +(define *pc-cheat-temp* (the-as (pointer int32) (malloc 'global (* 4 7)))) (defmacro pc-cheat-toggle-and-tune (obj cheat) `(begin (cpad-clear! 0 r1) @@ -197,45 +195,45 @@ (set! (-> info status) "Playing Jak and Daxter: The Precursor Legacy™") (set! (-> info level) (symbol->string (-> (level-get-target-inside *level*) name))) ;; grab the name of level we're in (set! (-> info cutscene?) (-> obj movie?)) - (set! (-> info ogreboss?) (the-as symbol (and (process-by-ename "ogreboss-1") (case (-> (process-by-ename "ogreboss-1") next-state name) ( - ('ogreboss-die - 'ogreboss-idle - 'ogreboss-stage1 - 'ogreboss-stage2 - 'ogreboss-stage3-hit - 'ogreboss-stage3-shuffle - 'ogreboss-stage3-throw - 'ogreboss-wait-for-player) #t))))) - (set! (-> info plant-boss?) (the-as symbol (and (process-by-ename "plant-boss-3") (case (-> (process-by-ename "plant-boss-3") next-state name) ( - ('plant-boss-idle - 'plant-boss-hit - 'plant-boss-vulnerable - 'plant-boss-spawn - 'plant-boss-reset - 'plant-boss-attack) #t))))) - (set! (-> info racer?) (the-as symbol (and *target* (case (-> *target* next-state name) ( - ('target-racing - 'target-racing-bounce - 'target-racing-death - 'target-racing-falling - 'target-racing-grab - 'target-racing-hit - 'target-racing-jump - 'target-racing-smack - 'target-racing-start) #t))))) - (set! (-> info flutflut?) (the-as symbol (and *target* (case (-> *target* next-state name) ( - ('target-flut-air-attack - 'target-flut-air-attack-hit-ground - 'target-flut-double-jump - 'target-flut-falling - 'target-flut-grab - 'target-flut-hit - 'target-flut-hit-ground - 'target-flut-jump - 'target-flut-running-attack - 'target-flut-stance - 'target-flut-start - 'target-flut-walk) #t))))) + (set! (-> info ogreboss?) (aif (process-by-ename "ogreboss-1") (case (-> it next-state name) ( + ('ogreboss-die + 'ogreboss-idle + 'ogreboss-stage1 + 'ogreboss-stage2 + 'ogreboss-stage3-hit + 'ogreboss-stage3-shuffle + 'ogreboss-stage3-throw + 'ogreboss-wait-for-player) #t)))) + (set! (-> info plant-boss?) (aif (process-by-ename "plant-boss-3") (case (-> it next-state name) ( + ('plant-boss-idle + 'plant-boss-hit + 'plant-boss-vulnerable + 'plant-boss-spawn + 'plant-boss-reset + 'plant-boss-attack) #t)))) + (set! (-> info racer?) (aif *target* (case (-> it next-state name) ( + ('target-racing + 'target-racing-bounce + 'target-racing-death + 'target-racing-falling + 'target-racing-grab + 'target-racing-hit + 'target-racing-jump + 'target-racing-smack + 'target-racing-start) #t)))) + (set! (-> info flutflut?) (aif *target* (case (-> it next-state name) ( + ('target-flut-air-attack + 'target-flut-air-attack-hit-ground + 'target-flut-double-jump + 'target-flut-falling + 'target-flut-grab + 'target-flut-hit + 'target-flut-hit-ground + 'target-flut-jump + 'target-flut-running-attack + 'target-flut-stance + 'target-flut-start + 'target-flut-walk) #t)))) (with-profiler "discord-update" (pc-discord-rpc-update info)) ) @@ -277,6 +275,8 @@ ;; cheats. (update-cheats obj) + ;; music. + (update-music-log obj) (none)) @@ -306,6 +306,9 @@ (pc-check-cheat-code (-> *pc-cheat-temp* 5) 0 (l e a d s) (pc-cheat-toggle-and-tune obj sidekick-blue)) + + (pc-check-cheat-code (-> *pc-cheat-temp* 6) 0 (t u n e s) + (pc-cheat-toggle-and-tune obj tunes)) ) (when *target* @@ -342,9 +345,87 @@ ) ) + + (if (pc-cheats? obj tunes) + (set! (-> obj flava-hack) -1) + (set! (-> obj flava-hack) 0) + ) + + (logior! (-> obj cheats-known) (-> obj cheats)) 0) +(defmethod add-to-music-log pc-settings ((obj pc-settings) (music symbol) (flava int)) + "add music and flava information to the music log. + if music already exists, adds flava. if flava already exists, nothing happens." + + ;; go through our music log + (dotimes (i PC_MUSIC_LOG_LENGTH) + (cond + ;; an empty log entry! place the currently playing music there, and fill flava. + ((not (-> obj secrets music i name)) + (set! (-> obj secrets music i name) music) + (set! (-> obj secrets music i flava-mask) (ash 1 flava)) + (return 0) + ) + ;; an existing log entry for the current music. fill flava. + ((= music (-> obj secrets music i name)) + (logior! (-> obj secrets music i flava-mask) (ash 1 flava)) + (return 0) + ) + ;; something else. maybe the wrong entry, in which case nothing to do. + ) + ) + + 0) + +(defmethod update-music-log pc-settings ((obj pc-settings)) + "update music log settings." + + ;; add whatever is playing to the music log. + (add-to-music-log obj (-> *setting-control* current music) (the int (-> *setting-control* current sound-flava))) + + ;; special cases. for example, npc's that despawn and you can't hear their music anymore. + (if (task-closed? (game-task beach-ecorocks) (task-status need-introduction)) + (add-to-music-log obj 'village1 1)) + (if (task-closed? (game-task jungle-plant) (task-status need-resolution)) + (add-to-music-log obj 'jungleb 2)) + (if (task-closed? (game-task beach-flutflut) (task-status need-resolution)) + (add-to-music-log obj 'beach (flava-lookup 'beach (music-flava birdlady)))) + (if (task-closed? (game-task beach-flutflut) (task-status need-resolution)) + (add-to-music-log obj 'village1 (flava-lookup 'village1 (music-flava birdlady)))) + (if (task-closed? (game-task misty-warehouse) (task-status need-resolution)) + (add-to-music-log obj 'misty (flava-lookup 'misty (music-flava misty-battle)))) + (if (task-closed? (game-task misty-cannon) (task-status need-resolution)) + (add-to-music-log obj 'misty 4)) + (if (task-closed? (game-task firecanyon-end) (task-status need-resolution)) + (add-to-music-log obj 'firecanyon 2)) + (if (task-closed? (game-task swamp-billy) (task-status need-resolution)) + (add-to-music-log obj 'swamp 1)) + (if (task-closed? (game-task swamp-battle) (task-status need-resolution)) + (add-to-music-log obj 'swamp (flava-lookup 'swamp (music-flava swamp-battle)))) + (if (task-closed? (game-task snow-bunnies) (task-status need-resolution)) + (add-to-music-log obj 'snow (flava-lookup 'snow (music-flava snow-battle)))) + (if (task-closed? (game-task citadel-sage-yellow) (task-status need-resolution)) + (add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava sage-yellow)))) + (if (task-closed? (game-task citadel-sage-red) (task-status need-resolution)) + (add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava sage-red)))) + (if (task-closed? (game-task citadel-sage-blue) (task-status need-resolution)) + (add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava sage-blue)))) + (if (task-closed? (game-task citadel-sage-green) (task-status need-resolution)) + (add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava sage)))) + (if (task-closed? (game-task citadel-buzzer) (task-status need-resolution)) + (add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava assistant)))) + (when (and *target* (>= (float->int (send-event *target* 'query 'pickup (pickup-type fuel-cell))) 100)) + (add-to-music-log obj 'credits 0) + (add-to-music-log obj 'credits 1) + (add-to-music-log obj 'credits 2) + ) + + 0) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -368,6 +449,31 @@ ) +(defun find-music-log ((music symbol)) + "return #t if the given music is logged into the *pc-settings*, #f otherwise." + (dotimes (i PC_MUSIC_LOG_LENGTH) + (if (= music (-> *pc-settings* secrets music i name)) + (return #t))) + #f) + +(defun find-flava-log ((music symbol) (flava-idx int)) + "return #t if the given music's flava is logged into the *pc-settings*, #f otherwise." + (dotimes (i PC_MUSIC_LOG_LENGTH) + (if (= music (-> *pc-settings* secrets music i name)) + (return (logtest? (-> *pc-settings* secrets music i flava-mask) (ash 1 flava-idx))))) + #f) + +(defun print-music-log ((out object)) + "prints the *pc-settings* music log." + + (dotimes (i PC_MUSIC_LOG_LENGTH) + (if (-> *pc-settings* secrets music i name) + (format out "music log ~D: ~A (f #x~x)~%" i (-> *pc-settings* secrets music i name) (-> *pc-settings* secrets music i flava-mask))) + ) + + 0) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; file IO @@ -488,6 +594,21 @@ ) ) +(defmacro file-stream-get-next-char-ret (fs) + `(begin + (file-stream-seek-past-whitespace ,fs) + (let ((c (file-stream-getc ,fs))) + (file-stream-seek ,fs -1 SCE_SEEK_CUR) + c)) + ) + +(defmacro file-stream-get-next-char (fs) + `(begin + (file-stream-seek-past-whitespace ,fs) + (file-stream-getc ,fs) + ) + ) + (defmacro dosettings (bindings &rest body) "iterate over a list of key-value pairs like so: ( ) ( ) ... the name of key is stored in *pc-temp-string*" @@ -498,8 +619,7 @@ ,@body - (file-stream-seek-past-whitespace ,fs) - (set! c (file-stream-getc ,fs)) + (set! c (file-stream-get-next-char ,fs)) (when (!= #x29 c) (pc-settings-read-throw-error ,fs (string-format "invalid char, ) not found, got #x~X ~A" c *pc-temp-string*)) ) @@ -521,8 +641,7 @@ (let ((version PC_KERNEL_VERSION)) (with-settings-scope (file) - (file-stream-read-word file) - (case-str *pc-temp-string* + (case-str (file-stream-read-word file) (("settings") (set! version (file-stream-read-int file)) (cond @@ -591,7 +710,7 @@ (("money-starburst?") (set! (-> obj money-starburst?) (file-stream-read-symbol file))) (("extra-hud?") (set! (-> obj extra-hud?) (file-stream-read-symbol file))) (("scenes-seen") - (dotimes (i 197) + (dotimes (i PC_SPOOL_LOG_LENGTH) (set! (-> obj scenes-seen i) (file-stream-read-int file)) ) ) @@ -609,8 +728,13 @@ (("hard-rats-hiscore") (set! (-> obj secrets hard-rats-hiscore) (file-stream-read-int file))) (("hard-rats-hiwave") (set! (-> obj secrets hard-rats-hiwave) (file-stream-read-int file))) (("music") - (dotimes (i 30) - (set! (-> obj secrets music i) (file-stream-read-int file)) + (dotimes (i PC_MUSIC_LOG_LENGTH) + (when (!= #x29 (file-stream-get-next-char-ret file)) + (with-settings-scope (file) + (set! (-> obj secrets music i name) (file-stream-read-symbol file)) + (set! (-> obj secrets music i flava-mask) (file-stream-read-int file)) + ) + ) ) ) ) @@ -703,16 +827,19 @@ (format file " (subtitle-language ~D)~%" (-> obj subtitle-language)) (format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?)) + #| (format file " (scenes-seen") - (dotimes (i 197) + (dotimes (i PC_SPOOL_LOG_LENGTH) (if (zero? (mod i 16)) (format file "~% ") ) (format file " ~D" (-> obj scenes-seen i)) ) (format file "~% )~%") + |# (format file " (secrets~%") + #| (format file " (art #x~X)~%" (-> obj secrets art)) (format file " (hard-rats? ~A)~%" (-> obj secrets hard-rats?)) (format file " (hero-mode? ~A)~%" (-> obj secrets hero-mode?)) @@ -721,14 +848,17 @@ (format file " (hard-fish-hiscore ~D)~%" (-> obj secrets hard-fish-hiscore)) (format file " (hard-rats-hiscore ~D)~%" (-> obj secrets hard-rats-hiscore)) (format file " (hard-rats-hiwave ~D)~%" (-> obj secrets hard-rats-hiwave)) + |# + (format file " (music") - (dotimes (i 30) - (if (zero? (mod i 1)) - (format file "~% ") - ) - (format file " #x~X" (-> obj secrets music i)) + (dotimes (i PC_MUSIC_LOG_LENGTH) + (if (-> obj secrets music i name) + (format file " (~A #x~X)~%" (-> obj secrets music i name) (-> obj secrets music i flava-mask)) + ) ) - (format file "~% )~%") + + (format file " )~%") + (format file " )~%") (format file " )~%") diff --git a/goal_src/pc/progress-pc.gc b/goal_src/pc/progress-pc.gc index 0d85041da..525498adc 100644 --- a/goal_src/pc/progress-pc.gc +++ b/goal_src/pc/progress-pc.gc @@ -72,45 +72,19 @@ (define *progress-carousell* (new 'static 'progress-carousell-state)) -(define *carousell-display-mode* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 - (game-text-id windowed) - (game-text-id fullscreen) - (game-text-id borderless) - )) +(defmacro def-progress-carousell (name texts) + `(define ,name (new 'static 'boxed-array :type game-text-id + ,@(apply (lambda (x) `(game-text-id ,x)) texts) + )) + ) -(define *carousell-msaa* (new 'static 'boxed-array :type game-text-id :length 5 :allocated-length 5 - (game-text-id off) - (game-text-id 2-times) - (game-text-id 4-times) - (game-text-id 8-times) - (game-text-id 16-times) - )) - -(define *carousell-lod-bg* (new 'static 'boxed-array :type game-text-id :length 2 :allocated-length 2 - (game-text-id lod-high) - (game-text-id lod-low) - )) - -(define *carousell-lod-fg* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 - (game-text-id lod-high) - (game-text-id lod-low) - (game-text-id lod-ps2) - )) - -(define *carousell-subtitle-language* (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 *carousell-speaker* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 - (game-text-id speaker-always) - (game-text-id speaker-never) - (game-text-id speaker-auto) - )) +;; all carousells +(def-progress-carousell *carousell-display-mode* (windowed fullscreen borderless)) +(def-progress-carousell *carousell-msaa* (off 2-times 4-times 8-times 16-times)) +(def-progress-carousell *carousell-lod-bg* (lod-high lod-low)) +(def-progress-carousell *carousell-lod-fg* (lod-high lod-low lod-ps2)) +(def-progress-carousell *carousell-subtitle-language* (english french german spanish italian japanese)) +(def-progress-carousell *carousell-speaker* (speaker-always speaker-never speaker-auto)) @@ -119,8 +93,7 @@ ;; pc menu defines -(define *game-options-pc* - (new 'static 'boxed-array :type game-option :length 6 :allocated-length 6 +(define *game-options-pc* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id vibrations) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id play-hints) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id camera-options) :scale #t :param3 (game-option-menu camera-options)) @@ -130,8 +103,7 @@ ) ) -(define *graphic-options-pc* - (new 'static 'boxed-array :type game-option :length 8 :allocated-length 9 +(define *graphic-options-pc* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id game-resolution) :scale #t :param3 (game-option-menu resolution)) (new 'static 'game-option :option-type (game-option-type display-mode) :name (game-text-id display-mode) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-native) :name (game-text-id ps2-aspect-ratio) :scale #t) @@ -144,15 +116,13 @@ ) ) -(define *misc-options* - (new 'static 'boxed-array :type game-option :length 2 :allocated-length 2 +(define *misc-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id discord-rpc) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) -(define *camera-options* - (new 'static 'boxed-array :type game-option :length 6 :allocated-length 6 +(define *camera-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-first-horz) :scale #t) (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-first-vert) :scale #t) (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-third-horz) :scale #t) @@ -162,15 +132,13 @@ ) ) -(define *accessibility-options* - (new 'static 'boxed-array :type game-option :length 2 :allocated-length 2 +(define *accessibility-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id money-starburst) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) -(define *gfx-ps2-options* - (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 +(define *gfx-ps2-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type lod-bg) :name (game-text-id lod-bg) :scale #t) (new 'static 'game-option :option-type (game-option-type lod-fg) :name (game-text-id lod-fg) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id ps2-parts) :scale #t) @@ -178,8 +146,7 @@ ) ) -(define *aspect-ratio-options* - (new 'static 'boxed-array :type game-option :length 6 :allocated-length 6 +(define *aspect-ratio-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id fit-to-screen) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-fmt) :param1 4.0 :param2 3.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-fmt) :param1 16.0 :param2 9.0 :scale #t) @@ -189,8 +156,7 @@ ) ) -(define *sound-options-pc* - (new 'static 'boxed-array :type game-option :length 9 :allocated-length 9 +(define *sound-options-pc* (new 'static 'boxed-array :type game-option (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) @@ -203,17 +169,90 @@ ) ) -(define *title-pc* - (new 'static 'boxed-array :type game-option :length 5 :allocated-length 5 +(define *title-pc* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id new-game) :scale #t :param3 (game-option-menu save-game-title)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id load-game) :scale #t :param3 (game-option-menu load-game)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id options) :scale #t :param3 (game-option-menu settings-title)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id secrets) :scale #t :param3 (game-option-menu secrets)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id quit-game) :scale #t :param3 (game-option-menu quit-title)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) -(define *back-button* (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t)) +(define *secrets-options* (new 'static 'boxed-array :type game-option + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id music-player) :scale #t :param3 (game-option-menu music-player)) + (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) + ) + ) + +(define *music-player-options* (new 'static 'boxed-array :type game-option + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id village1-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id beach-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id jungle-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id fishgame) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id jungleb-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id misty-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id fire-canyon-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id village2-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id rolling-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id swamp-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id sunken-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id ogre-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id ogreboss) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id village3-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id snowy-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id cave-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id lavatube-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id citadel-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id finalboss-level-name) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id credits) :scale #t) + (new 'static 'game-option :option-type (game-option-type button-music) :name (game-text-id danger-mus) :scale #t) + (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) + ) + ) + +(define *music-list* '(village1 beach jungle fishgame jungleb misty firecanyon + village2 rolling swamp sunken ogre ogreboss + village3 snow maincave lavatube + citadel finalboss credits danger)) +(define *progress-music* -1) +(defmacro progress-get-music-by-index (idx) + `(the symbol (ref *music-list* ,idx))) +(defmacro progress-reset-music-parms () + `(begin + (set! *progress-music* -1) + (set! *progress-flava* -1))) + +(defmacro static-text-list-array (&rest texts) + `(new 'static 'boxed-array :type game-text-id + ,@(apply (lambda (x) `(game-text-id ,x)) texts) + ) + ) +(define *music-flava-name-list* (new 'static 'boxed-array :type (array game-text-id) + (static-text-list-array village1-level-name flava-vi1-unused0 flava-sage flava-sage-hut flava-birdlady flava-farmer flava-assistant flava-mayor flava-sculptor flava-explorer flava-dock) + (static-text-list-array beach-level-name flava-bea-sentinel flava-bea-cannon flava-bea-grotto flava-birdlady) + (static-text-list-array jungle-level-name flava-jun-temple-exit flava-jun-lurkerm flava-jun-temple-top) + (static-text-list-array fishgame) + (static-text-list-array jungleb-level-name flava-jub-eggtop flava-jub-plant-boss) + (static-text-list-array misty-level-name flava-mis-battle flava-mis-boat flava-racer flava-mis-unused0) + (static-text-list-array fire-canyon-level-name flava-racer flava-fic-unused0) + (static-text-list-array village2-level-name flava-sage flava-assistant flava-warrior flava-geologist flava-gambler flava-levitator) + (static-text-list-array rolling-level-name flava-rol-gorge) + (static-text-list-array swamp-level-name flava-swa-game flava-swa-launcher flava-swa-battle flava-flutflut) + (static-text-list-array sunken-level-name) + (static-text-list-array ogre-level-name flava-ogr-middle flava-ogr-end) + (static-text-list-array ogreboss) + (static-text-list-array village3-level-name flava-vi3-miners flava-sage flava-assistant flava-vi3-mai flava-vi3-sno) + (static-text-list-array snowy-level-name flava-sno-battle flava-flutflut flava-sno-cave flava-sno-fort flava-sno-balls) + (static-text-list-array cave-level-name flava-mai-rob flava-mai-rob-top flava-mai-mai flava-mai-dar) + (static-text-list-array zero lavatube-level-name flava-lav-middle flava-lav-end) + (static-text-list-array citadel-level-name flava-sage flava-assistant flava-cit-yellowsage flava-cit-redsage flava-cit-bluesage flava-cit-hub) + (static-text-list-array finalboss-level-name flava-fin-middle flava-fin-end) + (static-text-list-array credits flava-credits-middle flava-credits-end) + (static-text-list-array danger-mus) + )) + + (define-perm *temp-options-alloced* symbol #f) (defconstant RESOLUTIONS 6) @@ -274,6 +313,18 @@ ) ) +(defmacro add-flava-player-option (text-id flava) + "add a resolution button to *temp-options* with specified size" + `(let ((option (-> *temp-options* (length *temp-options*)))) + (set! (-> option option-type) (game-option-type button-flava)) + (set! (-> option name) ,text-id) + (set! (-> option param1) (the float ,flava)) + (set! (-> option scale) #t) + + (1+! (-> *temp-options* length)) + ) + ) + (defmacro add-back-option () "add *back-button* to *temp-options*" `(let ((option (-> *temp-options* (length *temp-options*)))) @@ -350,6 +401,20 @@ *temp-options* ) +(defun build-flava-player-options ((mus-idx int)) + + (set! (-> *temp-options* length) 0) + + (dotimes (i (-> *music-flava-name-list* mus-idx length)) + (if (nonzero? (-> *music-flava-name-list* mus-idx i)) + (add-flava-player-option (-> *music-flava-name-list* mus-idx i) i) + ) + ) + (add-back-option) + + *temp-options* + ) + (defun print-string-in-carousell ((arg0 game-text-id) (arg1 font-context) (arg2 int) (arg3 symbol)) (let ((s5-0 (if arg3 @@ -488,6 +553,9 @@ (set! (-> *options-remap* (progress-screen resolution)) *temp-options*) (set! (-> *options-remap* (progress-screen aspect-ratio)) *aspect-ratio-options*) (set! (-> *options-remap* (progress-screen quit-title)) *yes-no-options*) + (set! (-> *options-remap* (progress-screen secrets)) *secrets-options*) + (set! (-> *options-remap* (progress-screen music-player)) *music-player-options*) + (set! (-> *options-remap* (progress-screen flava-player)) *temp-options*) ;; set default params (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) @@ -555,6 +623,9 @@ ;; TODO infinite scrolling (build-resolution-options 0 0) ) + (((progress-screen flava-player)) + (build-flava-player-options *progress-music*) + ) ) ;; run nav code (let ((options (-> *options-remap* (-> obj display-state)))) @@ -867,6 +938,9 @@ (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) ) + (when (= (-> obj display-state) (progress-screen music-player)) + (sound-group-pause (the-as uint 2)) + (progress-reset-music-parms)) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) (set! (-> obj next-display-state) (progress-screen invalid)) ) @@ -891,6 +965,28 @@ ) ) ) + ((= (-> options (-> obj option-index) option-type) (game-option-type button-music)) + ;; go to the music+flava player + (when (find-music-log (progress-get-music-by-index (-> obj option-index))) + (cpad-clear! 0 x) + (cpad-clear! 0 circle) + (set! *progress-music* (-> obj option-index)) + (push! obj) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + (set! (-> obj next-display-state) (progress-screen flava-player)) + ) + ) + ((= (-> options (-> obj option-index) option-type) (game-option-type button-flava)) + ;; set flava + (when (find-flava-log (progress-get-music-by-index *progress-music*) (the int (-> options (-> obj option-index) param1))) + (cpad-clear! 0 x) + (cpad-clear! 0 circle) + (set-setting! *setting-control* obj 'music (progress-get-music-by-index *progress-music*) 0.0 0) + (set! *progress-flava* (the int (-> options (-> obj option-index) param1))) + (sound-group-continue (the-as uint 2)) + (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) + ) + ) ((= (-> options (-> obj option-index) option-type) (game-option-type button)) ;; a button. what? (case (-> options (-> obj option-index) name) @@ -905,6 +1001,9 @@ (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) ) + (when (= (-> obj display-state) (progress-screen music-player)) + (sound-group-pause (the-as uint 2)) + (progress-reset-music-parms)) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) (set! (-> obj next-display-state) (progress-screen invalid)) ) @@ -1321,6 +1420,8 @@ (set-width! font 370) (set-height! font 25) (set! (-> font flags) (font-flags shadow kerning middle left large)) + ;; set scroll arrow sprite vertical position right now + (set! (-> obj particles 32 init-pos y) (the float (* 2 (- y-off 20)))) ;; when scrolling we draw an extra line (cond ((progress-scrolling-down?) (set! y-off (+ (- y-off arg1) (* (the float arg1) (- 1.0 (-> *progress-scroll* transition)))))) @@ -1341,6 +1442,21 @@ -320 ))) ) + ;; cheating a bit and putting some screen-specific code here. it's not a big deal. + (case (-> obj display-state) + (((progress-screen music-player)) + (set-color! font (font-color default)) + (set-origin! font (- 17 (-> obj left-x-offset)) 15) + (set-scale! font (* 0.6 (-> obj transition-percentage-invert))) + (print-game-text (lookup-text! *common-text* (game-text-id select-level) #f) font #f (the int (* 128.0 (-> obj transition-percentage-invert))) 22) + ) + (((progress-screen flava-player)) + (set-color! font (font-color default)) + (set-origin! font (- 17 (-> obj left-x-offset)) 15) + (set-scale! font (* 0.6 (-> obj transition-percentage-invert))) + (print-game-text (lookup-text! *common-text* (game-text-id select-flava) #f) font #f (the int (* 128.0 (-> obj transition-percentage-invert))) 22) + ) + ) (dotimes (index (length options)) (let ((option-str (the string #f)) ;; the option text (option-x 17) @@ -1361,6 +1477,20 @@ (set! option-str (the-as string #f)) ) ) + (((game-option-type button-music)) + ;; a button for the music player. has the text "locked" sometimes! + (if (and (nonzero? (-> options index name)) (find-music-log (progress-get-music-by-index index))) + (set! option-str (lookup-text! *common-text* (-> options index name) #f)) + (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + ) + ) + (((game-option-type button-flava)) + ;; a button for the flava player. has the text "locked" sometimes! + (if (and (nonzero? (-> options index name)) (find-flava-log (progress-get-music-by-index *progress-music*) (the int (-> options index param1)))) + (set! option-str (lookup-text! *common-text* (-> options index name) #f)) + (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + ) + ) (((game-option-type resolution) (game-option-type aspect-new)) ;; resolution settings (set! option-str (string-format (lookup-text! *common-text* (-> options index name) #f) @@ -1385,7 +1515,7 @@ (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)) (+ y-off 8) f0-12 (the-as int a3-5)) + (draw-percent-bar (- 75 (-> obj left-x-offset)) (+ y-off 8) f0-12 (the-as rgba a3-5)) ) (set! option-str (string-format "~D" (the int (-> (the-as (pointer float) (-> options index value-to-modify)))))) (set! option-x (+ (the int (* 2.5 (-> (the-as (pointer float) (-> options index value-to-modify))))) -100)) @@ -1565,10 +1695,17 @@ (set! scroll-amt 1.0) ) ) - (set-color! font (if (and (= index (-> obj option-index)) (not (or (progress-scrolling?) (-> obj in-transition)))) - (font-color yellow-green-2) - (font-color default) - )) + (set-color! font (cond + ((and (!= index (-> obj option-index)) + (string= (lookup-text! *common-text* (game-text-id locked) #f) option-str)) ;; hacky.. + ;; for "locked" options! + (font-color flat-dark-purple)) + ((and (= index (-> obj option-index)) + (not (or (progress-scrolling?) (-> obj in-transition)))) + (font-color yellow-green-2)) + (else + (font-color default)) + )) (set! (-> font origin x) (the float (- option-x (-> obj left-x-offset)))) (set! (-> font origin y) (the float (the int (* (the float option-y) (if (-> options index scale) f0-23 @@ -1702,14 +1839,23 @@ (progress-screen game-ps2-options) (progress-screen resolution) (progress-screen aspect-ratio) + (progress-screen secrets) ) (hide-progress-icons) (draw-options self 115 25 0.82) ) + (((progress-screen music-player)) + (hide-progress-icons) + (draw-options self 128 21 0.82) + ) + (((progress-screen flava-player)) + (hide-progress-icons) + (draw-options self 128 21 0.82) + ) (((progress-screen camera-options)) ;; camera options lines are a bit too big (hide-progress-icons) - (draw-options self 125 30 0.65) + (draw-options self 115 25 0.65) ) (((progress-screen gfx-ps2-options)) (hide-progress-icons) @@ -1817,6 +1963,9 @@ (lambda :behavior progress () (sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t) (hide-progress-icons) + (clear-pending-settings-from-process *setting-control* self 'music) + (copy-settings-from-target! *setting-control*) + (progress-reset-music-parms) (commit-to-file *pc-settings*) (set! (-> self particles 3 init-pos x) -320.0) (set! (-> self particles 4 init-pos x) -320.0) diff --git a/goalc/compiler/compilation/Static.cpp b/goalc/compiler/compilation/Static.cpp index 3d2446c2b..1b562ad66 100644 --- a/goalc/compiler/compilation/Static.cpp +++ b/goalc/compiler/compilation/Static.cpp @@ -913,7 +913,7 @@ StaticResult Compiler::fill_static_boxed_array(const goos::Object& form, auto args = get_va(form, rest); if (args.unnamed.size() < 2) { - throw_compiler_error(form, "new static boxed array must have type and min-size arguments"); + throw_compiler_error(form, "new static boxed array must have heap and type arguments"); } if (!args.has_named("type")) { @@ -921,20 +921,25 @@ StaticResult Compiler::fill_static_boxed_array(const goos::Object& form, } auto content_type = parse_typespec(args.get_named("type"), env); + s64 initialized_count = args.unnamed.size() - 2; + + s64 length; if (!args.has_named("length")) { - throw_compiler_error(form, "boxed array must have length"); + length = initialized_count; + } else { + length = get_constant_integer_or_error(args.get_named("length"), env); } - s64 length = get_constant_integer_or_error(args.get_named("length"), env); s64 allocated_length; if (args.has_named("allocated-length")) { + if (!args.has_named("length")) { + throw_compiler_error(form, "boxed array must length if it also has allocated-length"); + } allocated_length = get_constant_integer_or_error(args.get_named("allocated-length"), env); } else { allocated_length = length; } - s64 initialized_count = args.unnamed.size() - 2; - if (initialized_count > length) { throw_compiler_error(form, "Initialized {} elements, but length was {}", initialized_count, length); diff --git a/goalc/data_compiler/game_text_common.cpp b/goalc/data_compiler/game_text_common.cpp index 812cc354d..7730e1611 100644 --- a/goalc/data_compiler/game_text_common.cpp +++ b/goalc/data_compiler/game_text_common.cpp @@ -282,6 +282,10 @@ void parse_subtitle(const goos::Object& data, GameTextVersion text_ver, GameSubt auto time = car(entry).as_int(); goos::StringObject *speaker = nullptr, *line = nullptr; bool offscreen = false; + if (scene.kind() == SubtitleSceneKind::Hint || + scene.kind() == SubtitleSceneKind::HintNamed) { + offscreen = true; + } for_each_in_list(cdr(entry), [&](const goos::Object& arg) { if (arg.is_string()) { if (!speaker) { diff --git a/test/decompiler/reference/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/engine/ui/progress/progress-draw_REF.gc index ae827af4c..1c208602e 100644 --- a/test/decompiler/reference/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/engine/ui/progress/progress-draw_REF.gc @@ -1501,12 +1501,12 @@ ;; definition for function draw-percent-bar ;; INFO: Return type mismatch int vs none. -(defun draw-percent-bar ((arg0 int) (arg1 int) (arg2 float) (arg3 int)) +(defun draw-percent-bar ((arg0 int) (arg1 int) (arg2 float) (arg3 rgba)) (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)) + (draw-sprite2d-xy s2-0 arg0 (+ arg1 2) (the int (* 255.0 arg2)) 10 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))) @@ -1709,7 +1709,7 @@ (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)) + (draw-percent-bar (- 75 (-> obj left-x-offset)) (+ s2-1 8) f0-12 (the-as rgba a3-5)) ) (set! sv-304 format) (let ((a0-42 (clear *temp-string*)) diff --git a/test/decompiler/reference/levels/finalboss/robotboss-h_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss-h_REF.gc index 7b8fedce7..a1967439b 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss-h_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss-h_REF.gc @@ -180,19 +180,17 @@ ;; definition for function target-has-all-the-cells? ;; INFO: Return type mismatch basic vs symbol. -(defun target-has-all-the-cells? () - (with-pp - (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) pp) - (set! (-> a1-0 num-params) 2) - (set! (-> a1-0 message) 'query) - (set! (-> a1-0 param 0) (the-as uint 'pickup)) - (set! (-> a1-0 param 1) (the-as uint 6)) - (>= (the int (the-as float (send-event-function *target* a1-0))) 100) - ) - ) - ) - ) +(defbehavior target-has-all-the-cells? process () + (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'pickup)) + (set! (-> a1-0 param 1) (the-as uint 6)) + (>= (the int (the-as float (send-event-function *target* a1-0))) 100) + ) + ) + ) ) ;; failed to figure out what this is: