[game] music player (#1416)

* music flava hack toggle

* fix hint subtitles not being considered offscreen

* music player works

* fixes + citadel, maincave, lavatube music

* add remaining tracks

* fix test

* fixes

* fix lib
This commit is contained in:
ManDude 2022-06-04 19:53:49 +01:00 committed by GitHub
parent 0c16d3c3d8
commit d01c16f451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 856 additions and 262 deletions

View file

@ -995,6 +995,8 @@
(jungle-level-name #x222) (jungle-level-name #x222)
(misty-level-name #x223) (misty-level-name #x223)
(jungleb-level-name #x225)
(beach-seagull-get #x22e) (beach-seagull-get #x22e)
(jungle-lurkerm-unblock #x22f) (jungle-lurkerm-unblock #x22f)
@ -1354,20 +1356,87 @@
(speaker-auto #x107e) (speaker-auto #x107e)
(hint-log #x107f) (hint-log #x107f)
(cheats #x1080) (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-blue #x1090)
(cheat-eco-red #x1091) (cheat-eco-red #x1091)
(cheat-eco-green #x1092) (cheat-eco-green #x1092)
(cheat-eco-yellow #x1093) (cheat-eco-yellow #x1093)
(cheat-sidekick-alt #x1094) (cheat-sidekick-alt #x1094)
(cheat-invinc #x1095) (cheat-invinc #x1095)
(cheat-tunes #x1096)
(music-player #x10c0) (music-player #x10c0)
(scene-player #x10c1) (scene-player #x10c1)
(play-credits #x10c2) (play-credits #x10c2)
(scrapbook #x10c3) (scrapbook #x10c3)
(scene-0 #x1100) (default #x10d0)
(scene-255 #x11ff) (flava-vi1-unused0 #x10d1)
(hint-0 #x1200) (flava-sage #x10d2)
(hint-511 #x13ff) (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 ;; GAME-TEXT-ID ENUM ENDS
) )
@ -15520,6 +15589,7 @@
(scene-player) (scene-player)
(credits) (credits)
(quit-title) (quit-title)
(flava-player)
;; the last one! ;; the last one!
(max) (max)
@ -15549,6 +15619,8 @@
(language-subtitles) (language-subtitles)
(speaker) (speaker)
(aspect-native) (aspect-native)
(button-music)
(button-flava)
) )
(defenum game-option-menu (defenum game-option-menu
@ -22067,7 +22139,7 @@
;; - Functions ;; - Functions
(define-extern adjust-pos (function int int int)) (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 print-language-name (function int font-context int symbol font-context))
(define-extern hide-progress-icons (function none)) (define-extern hide-progress-icons (function none))
@ -25998,7 +26070,7 @@
;; - Functions ;; - Functions
(define-extern target-has-all-the-cells? (function symbol)) (define-extern target-has-all-the-cells? (function symbol :behavior process))
;; ---------------------- ;; ----------------------

View file

@ -18,8 +18,8 @@
"3RD-PERSON HORIZONTAL CAMERA") "3RD-PERSON HORIZONTAL CAMERA")
(#x1006 "3RD-PERSON VERTICAL CAMERA" (#x1006 "3RD-PERSON VERTICAL CAMERA"
"3RD-PERSON VERTICAL CAMERA") "3RD-PERSON VERTICAL CAMERA")
(#x1007 "RESTORE ORIGINAL GAME CONTROLS" (#x1007 "RESTORE DEFAULTS"
"RESTORE ORIGINAL GAME CONTROLS") "RESTORE DEFAULTS")
(#x100f "MISCELLANEOUS" (#x100f "MISCELLANEOUS"
"MISCELLANEOUS") "MISCELLANEOUS")
@ -115,6 +115,25 @@
(#x1080 "CHEATS" (#x1080 "CHEATS"
"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" (#x1090 "INFINITE BLUE ECO"
"INFINITE BLUE ECO") "INFINITE BLUE ECO")
(#x1091 "INFINITE RED ECO" (#x1091 "INFINITE RED ECO"
@ -127,6 +146,8 @@
"ALTERNATE DAXTER") "ALTERNATE DAXTER")
(#x1095 "INVINCIBILITY" (#x1095 "INVINCIBILITY"
"INVINCIBILITY") "INVINCIBILITY")
(#x1096 "PLAY ALL MUSIC TRACKS"
"PLAY ALL MUSIC TRACKS")
(#x10c0 "MUSIC PLAYER" (#x10c0 "MUSIC PLAYER"
"MUSIC PLAYER") "MUSIC PLAYER")
@ -137,6 +158,119 @@
(#x10c3 "SCRAPBOOK" (#x10c3 "SCRAPBOOK"
"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 ;; test

View file

@ -7,7 +7,8 @@
int gDiscordRpcEnabled; int gDiscordRpcEnabled;
int64_t gStartTime; int64_t gStartTime;
static const char* APPLICATION_ID = "938876425585434654"; static const char* APPLICATION_ID = "938876425585434654";
static std::map<std::string, std::string> jak1_level_names = {{"intro", "Intro"}, static const std::map<std::string, std::string> jak1_level_names = {
{"intro", "Intro"},
{"title", "Title screen"}, {"title", "Title screen"},
{"training", "Geyser Rock"}, {"training", "Geyser Rock"},
{"village1", "Sandover Village"}, {"village1", "Sandover Village"},
@ -26,6 +27,10 @@ static std::map<std::string, std::string> jak1_level_names = {{"intro", "Intro"}
{"lavatube", "Lava Tube"}, {"lavatube", "Lava Tube"},
{"citadel", "Gol and Maia's Citadel"}, {"citadel", "Gol and Maia's Citadel"},
{"finalboss", "Final Boss"}}; {"finalboss", "Final Boss"}};
static const std::map<std::string, std::string> jak1_level_name_remap = {{"jungleb", "jungle"},
{"sunkenb", "sunken"},
{"robocave", "maincave"},
{"darkcave", "maincave"}};
void init_discord_rpc() { void init_discord_rpc() {
gDiscordRpcEnabled = 1; gDiscordRpcEnabled = 1;
@ -47,15 +52,10 @@ void set_discord_rpc(int state) {
// get full level name from symbol name ("village1" -> "Sandover Village") // get full level name from symbol name ("village1" -> "Sandover Village")
const char* jak1_get_full_level_name(const char* level_name) { const char* jak1_get_full_level_name(const char* level_name) {
// ignore sublevels // ignore sublevels
if (!strcmp(level_name, "jungleb")) { auto it = jak1_level_name_remap.find(level_name);
level_name = "jungle"; auto actual_level_name = it == jak1_level_name_remap.end() ? level_name : it->second;
} else if (!strcmp(level_name, "sunkenb")) {
level_name = "sunken";
} else if (!strcmp(level_name, "darkcave") || !strcmp(level_name, "robocave")) {
level_name = "maincave";
}
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()) { if (nice_name != jak1_level_names.end()) {
return nice_name->second.c_str(); return nice_name->second.c_str();
} }

View file

@ -463,7 +463,7 @@ void Merc2::flush_pending_model(SharedRenderState* render_state, ScopedProfilerN
// no existing bucket // no existing bucket
if (m_next_free_level_bucket >= m_level_draw_buckets.size()) { if (m_next_free_level_bucket >= m_level_draw_buckets.size()) {
// out of room, flush // 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); flush_draw_buckets(render_state, prof);
// and retry the whole thing. // and retry the whole thing.
flush_pending_model(render_state, prof); flush_pending_model(render_state, prof);

View file

@ -14,7 +14,7 @@ constexpr bool BIG_MEMORY = true;
//! How much space to leave for the stack when creating the debug heap //! 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. // 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. // need more.
constexpr u32 DEBUG_HEAP_SPACE_FOR_STACK = 0x10000; constexpr u32 DEBUG_HEAP_SPACE_FOR_STACK = 0x10000;

View file

@ -86,10 +86,7 @@ u32 crc32(const u8* data, s32 size) {
crc = crc_table[crc >> 24] ^ ((crc << 8) | *data); crc = crc_table[crc >> 24] ^ ((crc << 8) | *data);
} }
if ((~crc) == 0) { ASSERT(~crc);
// if this happens, I think the hash table implementation breaks.
ASSERT(false);
}
return ~crc; return ~crc;
} }

View file

@ -7,6 +7,8 @@
#include "ksound.h" #include "ksound.h"
#include "kscheme.h" #include "kscheme.h"
#include "kdgo.h" #include "kdgo.h"
#include "game/sound/989snd/ame_handler.h"
#include "common/common_types.h"
/*! /*!
* Does nothing! * Does nothing!
@ -18,6 +20,13 @@ void InitSound() {}
*/ */
void ShutdownSound() {} void ShutdownSound() {}
/*!
* PC port function
*/
void set_flava_hack(u64 val) {
snd::SoundFlavaHack = val;
}
/*! /*!
* Set up some functions which are somewhat related to sound. * 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("rpc-busy?", (void*)RpcBusy);
make_function_symbol_from_c("test-load-dgo-c", (void*)LoadDGOTest); make_function_symbol_from_c("test-load-dgo-c", (void*)LoadDGOTest);
make_stack_arg_function_symbol_from_c("rpc-call", (void*)RpcCall_wrapper); make_stack_arg_function_symbol_from_c("rpc-call", (void*)RpcCall_wrapper);
make_function_symbol_from_c("pc-sound-set-flava-hack", (void*)set_flava_hack);
} }

View file

@ -6,11 +6,6 @@
* but whoever did the sound didn't use this. * but whoever did the sound didn't use this.
*/ */
#ifndef JAK_KSOUND_H
#define JAK_KSOUND_H
void InitSound(); void InitSound();
void ShutdownSound(); void ShutdownSound();
void InitSoundScheme(); void InitSoundScheme();
#endif // JAK_KSOUND_H

View file

@ -2,9 +2,13 @@
// SPDX-License-Identifier: ISC // SPDX-License-Identifier: ISC
#include "ame_handler.h" #include "ame_handler.h"
#include "game/sound/989snd/blocksound_handler.h" #include "game/sound/989snd/blocksound_handler.h"
#include "game/kernel/ksound.h"
namespace snd { namespace snd {
// added!
u64 SoundFlavaHack = 0;
ame_handler::ame_handler(MultiMIDIBlockHeader* block, ame_handler::ame_handler(MultiMIDIBlockHeader* block,
voice_manager& vm, voice_manager& vm,
MIDISound& sound, MIDISound& sound,
@ -41,6 +45,7 @@ bool ame_handler::tick() {
for (auto it = m_midis.begin(); it != m_midis.end();) { for (auto it = m_midis.begin(); it != m_midis.end();) {
bool done = it->second->tick(); bool done = it->second->tick();
if (done) { if (done) {
fmt::print("stopping segment {}\n", it->first);
it = m_midis.erase(it); it = m_midis.erase(it);
} else { } else {
it++; it++;
@ -247,9 +252,14 @@ std::pair<bool, u8*> ame_handler::run_ame(midi_handler& midi, u8* stream) {
} else { } else {
comp = m_register[m_groups[group].basis - 1]; 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++) { for (int i = 0; i < m_groups[group].num_channels; i++) {
if ((m_groups[group].excite_min[i] - 1 >= comp) || // auto xmin = m_groups[group].excite_min[i];
(m_groups[group].excite_max[i] + 1 <= comp)) { // 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]); midi.mute_channel(m_groups[group].channel[i]);
} else { } else {
midi.unmute_channel(m_groups[group].channel[i]); midi.unmute_channel(m_groups[group].channel[i]);

View file

@ -10,6 +10,9 @@
namespace snd { namespace snd {
// added!
extern u64 SoundFlavaHack;
class midi_handler; class midi_handler;
class ame_handler : public sound_handler { class ame_handler : public sound_handler {
friend class midi_handler; friend class midi_handler;

View file

@ -300,7 +300,7 @@ void midi_handler::system_event() {
m_seq_ptr = ptr; m_seq_ptr = ptr;
if (!cont) { 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; m_track_complete = true;
} }
} else { } else {
@ -395,7 +395,7 @@ void midi_handler::step() {
} }
[[fallthrough]]; [[fallthrough]];
default: default:
throw midi_error(fmt::format("MIDI error: invalid status {}", m_status)); throw midi_error(fmt::format("invalid status {}", m_status));
return; return;
} }

View file

@ -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)) (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) (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)) (format *stdcon* "nick ~A continue ~S~%" (-> *load-state* vis-nick) (-> *game-info* current-continue name))
(dotimes (i LEVEL_COUNT) (dotimes (i LEVEL_COUNT)
(format *stdcon* "level ~D ~12A ~A~%" i (-> *level* level i name) (-> *level* level i display?)) (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~%" (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)))
(-> *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*)
*sound-bank-1* *sound-bank-2*)
(let ((pos (target-pos 0))) (let ((pos (target-pos 0)))
(format *stdcon* "target ~m ~m ~m~%" (-> pos x) (-> pos y) (-> pos z)) (format *stdcon* "target ~m ~m ~m~%" (-> pos x) (-> pos y) (-> pos z))
) )
@ -805,6 +804,7 @@
(matrix->quaternion rot (-> *math-camera* camera-rot)) (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* "cam-rot ~f ~f ~f ~f~%" (-> rot x) (-> rot y) (-> rot z) (-> rot w))
) )
(format *stdcon* "~1k")
) )
(when (-> *pc-settings* display-heap-status) (when (-> *pc-settings* display-heap-status)
(draw-memory-bar-kheap debug-buf global :idx 0 :color (static-rgba 32 32 255 64)) (draw-memory-bar-kheap debug-buf global :idx 0 :color (static-rgba 32 32 255 64))

View file

@ -131,13 +131,11 @@
(defmethod new setting-control ((allocation symbol) (type-to-make type) (max-connections int)) (defmethod new setting-control ((allocation symbol) (type-to-make type) (max-connections int))
"Allocate a new setting-control and its engine" "Allocate a new setting-control and its engine"
(local-vars (s4-0 setting-control)) (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(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))
(set! (-> s4-0 engine)
((method-of-type engine new) allocation engine 'setting-control max-connections)
)
s4-0 s4-0
) )
)
;; used for memory card time information ;; used for memory card time information
(deftype scf-time (structure) (deftype scf-time (structure)

View file

@ -5,6 +5,9 @@
;; name in dgo: settings ;; name in dgo: settings
;; dgos: GAME, ENGINE ;; dgos: GAME, ENGINE
(#when PC_PORT
(define *progress-flava* -1)
)
(defmethod update-from-engine setting-data ((obj setting-data) (arg0 engine)) (defmethod update-from-engine setting-data ((obj setting-data) (arg0 engine))
"this goes through the list of desired setting changes in "this goes through the list of desired setting changes in
@ -226,15 +229,10 @@
(s4-0 (-> arg0 connection-list next1)) (s4-0 (-> arg0 connection-list next1))
) )
(while s4-0 (while s4-0
(if (if (and (belongs-to-engine? (the-as connection s4-0) s5-0)
(and
((method-of-type connection belongs-to-engine?)
(the-as connection s4-0)
s5-0
)
(or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0))) (or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0)))
) )
((method-of-type connection move-to-dead) (the-as connection s4-0)) (move-to-dead (the-as connection s4-0))
) )
(set! s4-0 (-> s4-0 next1)) (set! s4-0 (-> s4-0 next1))
) )
@ -342,8 +340,11 @@
(set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as music-flava (-> s5-1 sound-flava))))) (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)) (set! (-> gp-0 sound-flava) (-> s5-1 sound-flava))
(if *sound-player-enable* (if *sound-player-enable*
(#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)) (sound-set-flava (-> gp-0 sound-flava))
) )
)
;; update display settings ;; update display settings
(when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio)) (when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))

View file

@ -119,6 +119,7 @@
(scene-player) (scene-player)
(credits) (credits)
(quit-title) (quit-title)
(flava-player)
;; the last one! ;; the last one!
(max) (max)
@ -148,6 +149,8 @@
(language-subtitles) (language-subtitles)
(speaker) (speaker)
(aspect-native) (aspect-native)
(button-music)
(button-flava)
) )
) )
) )

View file

@ -1462,26 +1462,11 @@
(none) (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)) (with-dma-buffer-add-bucket ((s2-0 (-> (current-frame) global-buf))
(gp-0 (-> s2-0 base)) (bucket-id sprite))
)
(draw-sprite2d-xy s2-0 arg0 arg1 255 14 (new 'static 'rgba :a #x60)) (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)))
(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 0
(none) (none)
@ -1572,7 +1557,7 @@
(a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) (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))) (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! 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)) (set! x-off (+ (the int (* 2.5 (-> (the-as (pointer float) (-> s3-0 s0-0 value-to-modify))))) -100))

View file

@ -872,6 +872,9 @@
(= v1-2 (progress-screen gfx-ps2-options)) (= v1-2 (progress-screen gfx-ps2-options))
(= v1-2 (progress-screen resolution)) (= v1-2 (progress-screen resolution))
(= v1-2 (progress-screen aspect-ratio)) (= v1-2 (progress-screen aspect-ratio))
(= v1-2 (progress-screen secrets))
(= v1-2 (progress-screen music-player))
(= v1-2 (progress-screen flava-player))
) )
) )
) )

View file

@ -147,6 +147,8 @@
(jungle-level-name #x222) (jungle-level-name #x222)
(misty-level-name #x223) (misty-level-name #x223)
(jungleb-level-name #x225)
(beach-seagull-get #x22e) (beach-seagull-get #x22e)
(jungle-lurkerm-unblock #x22f) (jungle-lurkerm-unblock #x22f)
@ -506,20 +508,87 @@
(speaker-auto #x107e) (speaker-auto #x107e)
(hint-log #x107f) (hint-log #x107f)
(cheats #x1080) (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-blue #x1090)
(cheat-eco-red #x1091) (cheat-eco-red #x1091)
(cheat-eco-green #x1092) (cheat-eco-green #x1092)
(cheat-eco-yellow #x1093) (cheat-eco-yellow #x1093)
(cheat-sidekick-alt #x1094) (cheat-sidekick-alt #x1094)
(cheat-invinc #x1095) (cheat-invinc #x1095)
(cheat-tunes #x1096)
(music-player #x10c0) (music-player #x10c0)
(scene-player #x10c1) (scene-player #x10c1)
(play-credits #x10c2) (play-credits #x10c2)
(scrapbook #x10c3) (scrapbook #x10c3)
(scene-0 #x1100) (default #x10d0)
(scene-255 #x11ff) (flava-vi1-unused0 #x10d1)
(hint-0 #x1200) (flava-sage #x10d2)
(hint-511 #x13ff) (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 ;; GAME-TEXT-ID ENUM ENDS
) )

View file

@ -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 ;; Bit Macros
;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -351,6 +351,7 @@
(define-extern pc-discord-rpc-set (function int none)) (define-extern pc-discord-rpc-set (function int none))
(define-extern pc-filepath-exists? (function string symbol)) (define-extern pc-filepath-exists? (function string symbol))
(define-extern pc-mkdir-file-path (function string none)) (define-extern pc-mkdir-file-path (function string none))
(define-extern pc-sound-set-flava-hack (function int none))
(defenum pc-prof-event (defenum pc-prof-event
(begin 0) (begin 0)

View file

@ -125,10 +125,9 @@
(none) (none)
) )
(defun target-has-all-the-cells? () (defbehavior target-has-all-the-cells? process ()
(with-pp
(the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) pp) (set! (-> a1-0 from) self)
(set! (-> a1-0 num-params) 2) (set! (-> a1-0 num-params) 2)
(set! (-> a1-0 message) 'query) (set! (-> a1-0 message) 'query)
(set! (-> a1-0 param 0) (the-as uint 'pickup)) (set! (-> a1-0 param 0) (the-as uint 'pickup))
@ -138,7 +137,6 @@
) )
) )
) )
)
(defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja (defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja
((robotboss-basic-lod0-mg (meters 999999))) ((robotboss-basic-lod0-mg (meters 999999)))

View file

@ -31,7 +31,7 @@
(defglobalconstant PC_KERNEL_VERSION_BUILD #x0001) (defglobalconstant PC_KERNEL_VERSION_BUILD #x0001)
(defglobalconstant PC_KERNEL_VERSION_REVISION #x0004) (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_MAJOR #x0001)
(defglobalconstant PC_KERNEL_VERSION (logior (defglobalconstant PC_KERNEL_VERSION (logior
(ash PC_KERNEL_VERSION_MAJOR 48) (ash PC_KERNEL_VERSION_MAJOR 48)
@ -50,6 +50,12 @@
(defconstant PC_BASE_HEIGHT 480) (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") (defconstant PC_SETTINGS_FILE_NAME "game_config/pc-settings.txt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -114,15 +120,24 @@
(eco-yellow) (eco-yellow)
(invinc) (invinc)
(sidekick-blue) (sidekick-blue)
(tunes)
) )
(defmacro pc-cheats? (obj &rest cheats) (defmacro pc-cheats? (obj &rest cheats)
`(logtest? (-> ,obj cheats) (pc-cheats ,@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 ;; secrets and goodies
(deftype pc-game-secrets (structure) (deftype pc-game-secrets (structure)
((art pc-jak1-concept-art) ;; concept art unlocked ((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-fish-hiscore int32)
(hard-rats? symbol) ;; enable this crap (hard-rats? symbol) ;; enable this crap
(hard-rats-hiscore int32) (hard-rats-hiscore int32)
@ -265,11 +280,14 @@
(secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets! (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 (discord-rpc? symbol) ;; enable discord rich presence integration
(cheats pc-cheats) (cheats pc-cheats)
(cheats-known pc-cheats)
(flava-hack int64)
;; TODO - save/restore original settings (language/sound/etc) ;; TODO - save/restore original settings (language/sound/etc)
) )
@ -295,6 +313,8 @@
(read-from-file (_type_ string) symbol) (read-from-file (_type_ string) symbol)
(write-to-file (_type_ string) symbol) (write-to-file (_type_ string) symbol)
(update-cheats (_type_) int) (update-cheats (_type_) int)
(update-music-log (_type_) int)
(add-to-music-log (_type_ symbol int) int)
(commit-to-file (_type_) none) (commit-to-file (_type_) none)
(load-settings (_type_) int) (load-settings (_type_) int)
) )
@ -451,11 +471,12 @@
(defmethod reset-extra pc-settings ((obj pc-settings)) (defmethod reset-extra pc-settings ((obj pc-settings))
"Set the default goodies settings" "Set the default goodies settings"
(dotimes (i 197) (dotimes (i PC_SPOOL_LOG_LENGTH)
(set! (-> obj scenes-seen i) 0) (set! (-> obj scenes-seen i) 0)
) )
(dotimes (i 30) (dotimes (i PC_MUSIC_LOG_LENGTH)
(set! (-> obj secrets music i) 0) (set! (-> obj secrets music i name) #f)
(set! (-> obj secrets music i flava-mask) 0)
) )
(set! (-> obj secrets art) (pc-jak1-concept-art)) (set! (-> obj secrets art) (pc-jak1-concept-art))
@ -468,6 +489,9 @@
(set! (-> obj secrets hud-counters?) #t) (set! (-> obj secrets hud-counters?) #t)
(set! (-> obj secrets hud-watch?) #f) (set! (-> obj secrets hud-watch?) #f)
(set! (-> obj secrets watch-12hr?) #f) (set! (-> obj secrets watch-12hr?) #f)
(set! (-> obj cheats) (pc-cheats))
(set! (-> obj cheats-known) (pc-cheats))
(none)) (none))
(defmacro with-pc (&rest body) (defmacro with-pc (&rest body)

View file

@ -43,10 +43,6 @@
(unknown 15) (unknown 15)
) )
;; forward declarations needed for discord rpc.
(declare-type ogreboss process-drawable)
(declare-type plant-boss process-drawable)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; updates ;;;; updates
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -169,9 +165,11 @@
(pc-set-collision-mode *collision-mode*) (pc-set-collision-mode *collision-mode*)
) )
(pc-sound-set-flava-hack (-> obj flava-hack))
(none)) (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) (defmacro pc-cheat-toggle-and-tune (obj cheat)
`(begin `(begin
(cpad-clear! 0 r1) (cpad-clear! 0 r1)
@ -197,7 +195,7 @@
(set! (-> info status) "Playing Jak and Daxter: The Precursor Legacy™") (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 level) (symbol->string (-> (level-get-target-inside *level*) name))) ;; grab the name of level we're in
(set! (-> info cutscene?) (-> obj movie?)) (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) ( (set! (-> info ogreboss?) (aif (process-by-ename "ogreboss-1") (case (-> it next-state name) (
('ogreboss-die ('ogreboss-die
'ogreboss-idle 'ogreboss-idle
'ogreboss-stage1 'ogreboss-stage1
@ -205,15 +203,15 @@
'ogreboss-stage3-hit 'ogreboss-stage3-hit
'ogreboss-stage3-shuffle 'ogreboss-stage3-shuffle
'ogreboss-stage3-throw 'ogreboss-stage3-throw
'ogreboss-wait-for-player) #t))))) '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) ( (set! (-> info plant-boss?) (aif (process-by-ename "plant-boss-3") (case (-> it next-state name) (
('plant-boss-idle ('plant-boss-idle
'plant-boss-hit 'plant-boss-hit
'plant-boss-vulnerable 'plant-boss-vulnerable
'plant-boss-spawn 'plant-boss-spawn
'plant-boss-reset 'plant-boss-reset
'plant-boss-attack) #t))))) 'plant-boss-attack) #t))))
(set! (-> info racer?) (the-as symbol (and *target* (case (-> *target* next-state name) ( (set! (-> info racer?) (aif *target* (case (-> it next-state name) (
('target-racing ('target-racing
'target-racing-bounce 'target-racing-bounce
'target-racing-death 'target-racing-death
@ -222,8 +220,8 @@
'target-racing-hit 'target-racing-hit
'target-racing-jump 'target-racing-jump
'target-racing-smack 'target-racing-smack
'target-racing-start) #t))))) 'target-racing-start) #t))))
(set! (-> info flutflut?) (the-as symbol (and *target* (case (-> *target* next-state name) ( (set! (-> info flutflut?) (aif *target* (case (-> it next-state name) (
('target-flut-air-attack ('target-flut-air-attack
'target-flut-air-attack-hit-ground 'target-flut-air-attack-hit-ground
'target-flut-double-jump 'target-flut-double-jump
@ -235,7 +233,7 @@
'target-flut-running-attack 'target-flut-running-attack
'target-flut-stance 'target-flut-stance
'target-flut-start 'target-flut-start
'target-flut-walk) #t))))) 'target-flut-walk) #t))))
(with-profiler "discord-update" (pc-discord-rpc-update info)) (with-profiler "discord-update" (pc-discord-rpc-update info))
) )
@ -277,6 +275,8 @@
;; cheats. ;; cheats.
(update-cheats obj) (update-cheats obj)
;; music.
(update-music-log obj)
(none)) (none))
@ -306,6 +306,9 @@
(pc-check-cheat-code (-> *pc-cheat-temp* 5) 0 (l e a d s) (pc-check-cheat-code (-> *pc-cheat-temp* 5) 0 (l e a d s)
(pc-cheat-toggle-and-tune obj sidekick-blue)) (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* (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) 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 ;;;; 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 ;;;; 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) (defmacro dosettings (bindings &rest body)
"iterate over a list of key-value pairs like so: (<key> <value>) (<key> <value>) ... "iterate over a list of key-value pairs like so: (<key> <value>) (<key> <value>) ...
the name of key is stored in *pc-temp-string*" the name of key is stored in *pc-temp-string*"
@ -498,8 +619,7 @@
,@body ,@body
(file-stream-seek-past-whitespace ,fs) (set! c (file-stream-get-next-char ,fs))
(set! c (file-stream-getc ,fs))
(when (!= #x29 c) (when (!= #x29 c)
(pc-settings-read-throw-error ,fs (string-format "invalid char, ) not found, got #x~X ~A" c *pc-temp-string*)) (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)) (let ((version PC_KERNEL_VERSION))
(with-settings-scope (file) (with-settings-scope (file)
(file-stream-read-word file) (case-str (file-stream-read-word file)
(case-str *pc-temp-string*
(("settings") (("settings")
(set! version (file-stream-read-int file)) (set! version (file-stream-read-int file))
(cond (cond
@ -591,7 +710,7 @@
(("money-starburst?") (set! (-> obj money-starburst?) (file-stream-read-symbol file))) (("money-starburst?") (set! (-> obj money-starburst?) (file-stream-read-symbol file)))
(("extra-hud?") (set! (-> obj extra-hud?) (file-stream-read-symbol file))) (("extra-hud?") (set! (-> obj extra-hud?) (file-stream-read-symbol file)))
(("scenes-seen") (("scenes-seen")
(dotimes (i 197) (dotimes (i PC_SPOOL_LOG_LENGTH)
(set! (-> obj scenes-seen i) (file-stream-read-int file)) (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-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))) (("hard-rats-hiwave") (set! (-> obj secrets hard-rats-hiwave) (file-stream-read-int file)))
(("music") (("music")
(dotimes (i 30) (dotimes (i PC_MUSIC_LOG_LENGTH)
(set! (-> obj secrets music i) (file-stream-read-int file)) (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-language ~D)~%" (-> obj subtitle-language))
(format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?)) (format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?))
#|
(format file " (scenes-seen") (format file " (scenes-seen")
(dotimes (i 197) (dotimes (i PC_SPOOL_LOG_LENGTH)
(if (zero? (mod i 16)) (if (zero? (mod i 16))
(format file "~% ") (format file "~% ")
) )
(format file " ~D" (-> obj scenes-seen i)) (format file " ~D" (-> obj scenes-seen i))
) )
(format file "~% )~%") (format file "~% )~%")
|#
(format file " (secrets~%") (format file " (secrets~%")
#|
(format file " (art #x~X)~%" (-> obj secrets art)) (format file " (art #x~X)~%" (-> obj secrets art))
(format file " (hard-rats? ~A)~%" (-> obj secrets hard-rats?)) (format file " (hard-rats? ~A)~%" (-> obj secrets hard-rats?))
(format file " (hero-mode? ~A)~%" (-> obj secrets hero-mode?)) (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-fish-hiscore ~D)~%" (-> obj secrets hard-fish-hiscore))
(format file " (hard-rats-hiscore ~D)~%" (-> obj secrets hard-rats-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 " (hard-rats-hiwave ~D)~%" (-> obj secrets hard-rats-hiwave))
|#
(format file " (music") (format file " (music")
(dotimes (i 30) (dotimes (i PC_MUSIC_LOG_LENGTH)
(if (zero? (mod i 1)) (if (-> obj secrets music i name)
(format file "~% ") (format file " (~A #x~X)~%" (-> obj secrets music i name) (-> obj secrets music i flava-mask))
) )
(format file " #x~X" (-> obj secrets music i))
) )
(format file "~% )~%")
(format file " )~%")
(format file " )~%") (format file " )~%")
(format file " )~%") (format file " )~%")

View file

@ -72,45 +72,19 @@
(define *progress-carousell* (new 'static 'progress-carousell-state)) (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 (defmacro def-progress-carousell (name texts)
(game-text-id windowed) `(define ,name (new 'static 'boxed-array :type game-text-id
(game-text-id fullscreen) ,@(apply (lambda (x) `(game-text-id ,x)) texts)
(game-text-id borderless)
)) ))
)
(define *carousell-msaa* (new 'static 'boxed-array :type game-text-id :length 5 :allocated-length 5 ;; all carousells
(game-text-id off) (def-progress-carousell *carousell-display-mode* (windowed fullscreen borderless))
(game-text-id 2-times) (def-progress-carousell *carousell-msaa* (off 2-times 4-times 8-times 16-times))
(game-text-id 4-times) (def-progress-carousell *carousell-lod-bg* (lod-high lod-low))
(game-text-id 8-times) (def-progress-carousell *carousell-lod-fg* (lod-high lod-low lod-ps2))
(game-text-id 16-times) (def-progress-carousell *carousell-subtitle-language* (english french german spanish italian japanese))
)) (def-progress-carousell *carousell-speaker* (speaker-always speaker-never speaker-auto))
(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)
))
@ -119,8 +93,7 @@
;; pc menu defines ;; pc menu defines
(define *game-options-pc* (define *game-options-pc* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 6 :allocated-length 6
(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 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 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)) (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* (define *graphic-options-pc* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 8 :allocated-length 9
(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 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 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) (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* (define *misc-options* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 2 :allocated-length 2
(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 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) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t)
) )
) )
(define *camera-options* (define *camera-options* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 6 :allocated-length 6
(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-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-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) (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* (define *accessibility-options* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 2 :allocated-length 2
(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 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) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t)
) )
) )
(define *gfx-ps2-options* (define *gfx-ps2-options* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 4 :allocated-length 4
(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-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 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) (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* (define *aspect-ratio-options* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 6 :allocated-length 6
(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 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 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) (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* (define *sound-options-pc* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 9 :allocated-length 9
(new 'static 'game-option :name (game-text-id sfx-volume) :scale #t :param2 100.0) (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 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 :name (game-text-id speech-volume) :scale #t :param2 100.0)
@ -203,17 +169,90 @@
) )
) )
(define *title-pc* (define *title-pc* (new 'static 'boxed-array :type game-option
(new 'static 'boxed-array :type game-option :length 5 :allocated-length 5
(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 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 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 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 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) (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) (define-perm *temp-options-alloced* symbol #f)
(defconstant RESOLUTIONS 6) (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 () (defmacro add-back-option ()
"add *back-button* to *temp-options*" "add *back-button* to *temp-options*"
`(let ((option (-> *temp-options* (length *temp-options*)))) `(let ((option (-> *temp-options* (length *temp-options*))))
@ -350,6 +401,20 @@
*temp-options* *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)) (defun print-string-in-carousell ((arg0 game-text-id) (arg1 font-context) (arg2 int) (arg3 symbol))
(let ((s5-0 (if arg3 (let ((s5-0 (if arg3
@ -488,6 +553,9 @@
(set! (-> *options-remap* (progress-screen resolution)) *temp-options*) (set! (-> *options-remap* (progress-screen resolution)) *temp-options*)
(set! (-> *options-remap* (progress-screen aspect-ratio)) *aspect-ratio-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 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 default params
(set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio))
@ -555,6 +623,9 @@
;; TODO infinite scrolling ;; TODO infinite scrolling
(build-resolution-options 0 0) (build-resolution-options 0 0)
) )
(((progress-screen flava-player))
(build-flava-player-options *progress-music*)
)
) )
;; run nav code ;; run nav code
(let ((options (-> *options-remap* (-> obj display-state)))) (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 "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) (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)) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid)) (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)) ((= (-> options (-> obj option-index) option-type) (game-option-type button))
;; a button. what? ;; a button. what?
(case (-> options (-> obj option-index) name) (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 "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) (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)) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid)) (set! (-> obj next-display-state) (progress-screen invalid))
) )
@ -1321,6 +1420,8 @@
(set-width! font 370) (set-width! font 370)
(set-height! font 25) (set-height! font 25)
(set! (-> font flags) (font-flags shadow kerning middle left large)) (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 ;; when scrolling we draw an extra line
(cond (cond
((progress-scrolling-down?) (set! y-off (+ (- y-off arg1) (* (the float arg1) (- 1.0 (-> *progress-scroll* transition)))))) ((progress-scrolling-down?) (set! y-off (+ (- y-off arg1) (* (the float arg1) (- 1.0 (-> *progress-scroll* transition))))))
@ -1341,6 +1442,21 @@
-320 -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)) (dotimes (index (length options))
(let ((option-str (the string #f)) ;; the option text (let ((option-str (the string #f)) ;; the option text
(option-x 17) (option-x 17)
@ -1361,6 +1477,20 @@
(set! option-str (the-as string #f)) (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)) (((game-option-type resolution) (game-option-type aspect-new))
;; resolution settings ;; resolution settings
(set! option-str (string-format (lookup-text! *common-text* (-> options index name) #f) (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))) (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))) (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-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)) (set! option-x (+ (the int (* 2.5 (-> (the-as (pointer float) (-> options index value-to-modify))))) -100))
@ -1565,9 +1695,16 @@
(set! scroll-amt 1.0) (set! scroll-amt 1.0)
) )
) )
(set-color! font (if (and (= index (-> obj option-index)) (not (or (progress-scrolling?) (-> obj in-transition)))) (set-color! font (cond
(font-color yellow-green-2) ((and (!= index (-> obj option-index))
(font-color default) (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 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) (set! (-> font origin y) (the float (the int (* (the float option-y) (if (-> options index scale)
@ -1702,14 +1839,23 @@
(progress-screen game-ps2-options) (progress-screen game-ps2-options)
(progress-screen resolution) (progress-screen resolution)
(progress-screen aspect-ratio) (progress-screen aspect-ratio)
(progress-screen secrets)
) )
(hide-progress-icons) (hide-progress-icons)
(draw-options self 115 25 0.82) (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)) (((progress-screen camera-options))
;; camera options lines are a bit too big ;; camera options lines are a bit too big
(hide-progress-icons) (hide-progress-icons)
(draw-options self 125 30 0.65) (draw-options self 115 25 0.65)
) )
(((progress-screen gfx-ps2-options)) (((progress-screen gfx-ps2-options))
(hide-progress-icons) (hide-progress-icons)
@ -1817,6 +1963,9 @@
(lambda :behavior progress () (lambda :behavior progress ()
(sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t) (sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t)
(hide-progress-icons) (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*) (commit-to-file *pc-settings*)
(set! (-> self particles 3 init-pos x) -320.0) (set! (-> self particles 3 init-pos x) -320.0)
(set! (-> self particles 4 init-pos x) -320.0) (set! (-> self particles 4 init-pos x) -320.0)

View file

@ -913,7 +913,7 @@ StaticResult Compiler::fill_static_boxed_array(const goos::Object& form,
auto args = get_va(form, rest); auto args = get_va(form, rest);
if (args.unnamed.size() < 2) { 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")) { 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); auto content_type = parse_typespec(args.get_named("type"), env);
s64 initialized_count = args.unnamed.size() - 2;
s64 length;
if (!args.has_named("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; s64 allocated_length;
if (args.has_named("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); allocated_length = get_constant_integer_or_error(args.get_named("allocated-length"), env);
} else { } else {
allocated_length = length; allocated_length = length;
} }
s64 initialized_count = args.unnamed.size() - 2;
if (initialized_count > length) { if (initialized_count > length) {
throw_compiler_error(form, "Initialized {} elements, but length was {}", initialized_count, throw_compiler_error(form, "Initialized {} elements, but length was {}", initialized_count,
length); length);

View file

@ -282,6 +282,10 @@ void parse_subtitle(const goos::Object& data, GameTextVersion text_ver, GameSubt
auto time = car(entry).as_int(); auto time = car(entry).as_int();
goos::StringObject *speaker = nullptr, *line = nullptr; goos::StringObject *speaker = nullptr, *line = nullptr;
bool offscreen = false; bool offscreen = false;
if (scene.kind() == SubtitleSceneKind::Hint ||
scene.kind() == SubtitleSceneKind::HintNamed) {
offscreen = true;
}
for_each_in_list(cdr(entry), [&](const goos::Object& arg) { for_each_in_list(cdr(entry), [&](const goos::Object& arg) {
if (arg.is_string()) { if (arg.is_string()) {
if (!speaker) { if (!speaker) {

View file

@ -1501,12 +1501,12 @@
;; definition for function draw-percent-bar ;; definition for function draw-percent-bar
;; INFO: Return type mismatch int vs none. ;; 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)) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
(gp-0 (-> s2-0 base)) (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 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 ((a3-3 (-> s2-0 base)))
(let ((v1-3 (the-as dma-packet (-> 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 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))) (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))) (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) (set! sv-304 format)
(let ((a0-42 (clear *temp-string*)) (let ((a0-42 (clear *temp-string*))

View file

@ -180,10 +180,9 @@
;; definition for function target-has-all-the-cells? ;; definition for function target-has-all-the-cells?
;; INFO: Return type mismatch basic vs symbol. ;; INFO: Return type mismatch basic vs symbol.
(defun target-has-all-the-cells? () (defbehavior target-has-all-the-cells? process ()
(with-pp
(the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (the-as symbol (and *target* (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) pp) (set! (-> a1-0 from) self)
(set! (-> a1-0 num-params) 2) (set! (-> a1-0 num-params) 2)
(set! (-> a1-0 message) 'query) (set! (-> a1-0 message) 'query)
(set! (-> a1-0 param 0) (the-as uint 'pickup)) (set! (-> a1-0 param 0) (the-as uint 'pickup))
@ -193,7 +192,6 @@
) )
) )
) )
)
;; failed to figure out what this is: ;; failed to figure out what this is:
(defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja (defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja