;;-*-Lisp-*- (in-package goal) #| Code for the progress menu in the PC port. The original code is still loaded, this just has some overriden functions. |# ;;--------------------------- ;;--------------------------- ;; pc menu extra stuff (defconstant PROGRESS_PC_PAGE_HEIGHT 7) (defconstant PROGRESS_SCROLL_DIR_UP -1) (defconstant PROGRESS_SCROLL_DIR_DOWN 1) (defconstant GAME_MIN_RES_MULT 0.5) (deftype progress-scroll (structure) ((transition float) (start-index int16) (real-index int16) (direction int8) (last-screen progress-screen) ) ) (define *progress-scroll* (new 'static 'progress-scroll)) (defmacro progress-scrolling? () `(< (-> *progress-scroll* transition) 1.0)) (defmacro progress-scrolling-up? () `(and (progress-scrolling?) (= (-> *progress-scroll* direction) PROGRESS_SCROLL_DIR_UP))) (defmacro progress-scrolling-down? () `(and (progress-scrolling?) (= (-> *progress-scroll* direction) PROGRESS_SCROLL_DIR_DOWN))) (defconstant *progress-scroll-start* (-> *progress-scroll* start-index)) (defconstant *progress-scroll-end* (+ -1 PROGRESS_PC_PAGE_HEIGHT (-> *progress-scroll* start-index))) (defmacro progress-scroll-reset () "resets scroll. nothing will be scrolling, as if it had finished." `(begin (set! (-> *progress-scroll* transition) 1.0) (set! (-> *progress-scroll* direction) 0) (set! (-> *progress-scroll* start-index) 0))) (defmacro progress-scroll-up! () `(begin (set! (-> *progress-scroll* transition) 0.0) (set! (-> *progress-scroll* direction) PROGRESS_SCROLL_DIR_UP) (1-! (-> *progress-scroll* start-index)))) (defmacro progress-scroll-down! () `(begin (set! (-> *progress-scroll* transition) 0.0) (set! (-> *progress-scroll* direction) PROGRESS_SCROLL_DIR_DOWN) (1+! (-> *progress-scroll* start-index)))) (defun progress-fast-save-and-start-speedrun ((category speedrun-category)) "saves to first slot, updates last-slot-saved for cursor, then starts speedrun" (set! (-> *progress-state* last-slot-saved) 0) (auto-save-command 'save 0 0 *default-pool*) (start-speedrun category) ) ;; used in title logo (define *quit-to-title* #f) ;; ############################ ;; CAROUSELL STUFF ;; ############################ (deftype progress-carousell-state (structure) ((int-backup int) (symbol-backup symbol) (subtitle-backup pc-subtitle-lang) (aspect-native-choice symbol) (current-carousell (array game-text-id)) (selection int) (direction symbol) (transition symbol) (x-offset int32) ) ) (define *progress-carousell* (new 'static 'progress-carousell-state)) (defmacro def-progress-carousell (name texts) `(define ,name (new 'static 'boxed-array :type game-text-id ,@(apply (lambda (x) `(game-text-id ,x)) texts) )) ) ;; 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-speaker* (speaker-always speaker-never speaker-auto)) (def-progress-carousell *carousell-frame-rate-150fps* (60fps 100fps 150fps)) (def-progress-carousell *carousell-frame-rate-100fps* (60fps 100fps)) (define *carousell-frame-rate* *carousell-frame-rate-150fps*) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MENU OPTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define *main-options-pc* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id game-options) :scale #t :param3 (game-option-menu game-settings)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id graphic-options) :scale #t :param3 (game-option-menu graphic-settings)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id sound-options) :scale #t :param3 (game-option-menu sound-settings)) (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 save-game) :scale #t :param3 (game-option-menu save-game)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id disable-auto-save) :scale #t :param3 (game-option-menu memcard-disable-auto-save)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id quit-game) :scale #t :param3 (game-option-menu quit)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *main-options-secrets* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id game-options) :scale #t :param3 (game-option-menu game-settings)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id graphic-options) :scale #t :param3 (game-option-menu graphic-settings)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id sound-options) :scale #t :param3 (game-option-menu sound-settings)) (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 save-game) :scale #t :param3 (game-option-menu save-game)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id disable-auto-save) :scale #t :param3 (game-option-menu memcard-disable-auto-save)) (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)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 on-off) :name (game-text-id subtitles) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id hinttitles) :scale #t) (new 'static 'game-option :option-type (game-option-type language) :name (game-text-id language) :scale #t) (new 'static 'game-option :option-type (game-option-type language-subtitles) :name (game-text-id subtitles-language) :scale #t) (new 'static 'game-option :option-type (game-option-type language-text) :name (game-text-id text-language) :scale #t) (new 'static 'game-option :option-type (game-option-type speaker) :name (game-text-id subtitles-speaker) :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 misc-options) :scale #t :param3 (game-option-menu misc-options)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 menu) :name (game-text-id display) :scale #t :param3 (game-option-menu monitor)) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id vsync) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id aspect-ratio) :scale #t :param3 (game-option-menu aspect-ratio)) (new 'static 'game-option :option-type (game-option-type msaa) :name (game-text-id msaa) :scale #t) (new 'static 'game-option :option-type (game-option-type frame-rate) :name (game-text-id frame-rate) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id ps2-options) :scale #t :param3 (game-option-menu gfx-ps2-options)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *graphic-options-no-frame-rate-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 on-off) :name (game-text-id vsync) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id aspect-ratio) :scale #t :param3 (game-option-menu aspect-ratio)) (new 'static 'game-option :option-type (game-option-type msaa) :name (game-text-id msaa) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id ps2-options) :scale #t :param3 (game-option-menu gfx-ps2-options)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 money-starburst) :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 on-off) :name (game-text-id cutscene-skips) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id speedrunner-mode) :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 (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) (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-third-vert) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id restore-defaults) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 (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) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id force-envmap) :scale #t) ;(new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id force-actors) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 aspect-fmt) :param1 4.0 :param2 3.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect-fmt) :param1 16.0 :param2 9.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect4x3-ps2) :param1 -1.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect16x9-ps2) :param1 -2.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect-fmt) :param1 16.0 :param2 10.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect-fmt) :param1 21.0 :param2 9.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id aspect-fmt) :param1 64.0 :param2 27.0 :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *sound-options-pc* (new 'static 'boxed-array :type game-option (new 'static 'game-option :name (game-text-id sfx-volume) :scale #t :param1 0.0 :param2 100.0) (new 'static 'game-option :name (game-text-id music-volume) :scale #t :param1 0.0 :param2 100.0) (new 'static 'game-option :name (game-text-id speech-volume) :scale #t :param1 0.0 :param2 100.0) ;(new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id music-fadein) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (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 *speedrun-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-reset-current-run) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-new-full-game) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id speedrun-new-individual-level) :scale #t :param3 (game-option-menu speedrun-il-options)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id speedrun-new-cat-ext) :scale #t :param3 (game-option-menu speedrun-cat-ext-options)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *speedrun-il-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-training) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-village1) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-beach) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-jungle) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-misty) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-firecanyon) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-village2) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-sunken) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-swamp) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-rolling) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-ogre) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-village3) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-snow) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-cave) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-lavatube) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-il-citadel) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *speedrun-cat-ext-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-new-full-game) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-new-game-plus) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-hub1-100) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-hub2-100) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-hub3-100) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id speedrun-all-cutscenes) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *secrets-title* (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 menu) :name (game-text-id cheats) :scale #t :param3 (game-option-menu cheats)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *secrets* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id cheats) :scale #t :param3 (game-option-menu cheats)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id checkpoint-select) :scale #t :param3 (game-option-menu checkpoint-select) :option-disabled-func (lambda () (not (task-closed? (game-task finalboss-movies) (task-status need-reminder))))) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *checkpoint-select-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id training-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id village1-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id beach-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id jungle-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id misty-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id firecanyon-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id village2-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id sunken-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id swamp-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id rolling-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id ogre-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id village3-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id snow-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id cave-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id lavatube-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id citadel-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id finalboss-level-name) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *cheats* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sidekick-alt) :scale #t :param1 5.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-head) :scale #t :param1 9.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-small-head) :scale #t :param1 10.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-fist) :scale #t :param1 11.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-head-npc) :scale #t :param1 16.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-tunes) :scale #t :param1 6.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sky) :scale #t :param1 7.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-huge-head) :scale #t :param1 15.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-mirror) :scale #t :param1 8.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-yellow) :scale #t :param1 3.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-blue) :scale #t :param1 2.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-red) :scale #t :param1 1.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-green) :scale #t :param1 0.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-invinc) :scale #t :param1 4.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-no-tex) :scale #t :param1 12.0) (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 firecanyon-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 snow-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) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DATA LISTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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 firecanyon-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 snow-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) )) (defmacro def-language-remap-info (name langs) `(define ,name (quote ,(apply (lambda (x) `((the binteger (game-text-id ,x)) (the binteger (pc-subtitle-lang ,x)))) langs))) ) (def-language-remap-info *language-remap-info-pc* (english uk-english french german spanish italian japanese portuguese br-portuguese swedish finnish danish norwegian hungarian)) (define *text-languages* (static-text-list-array english uk-english french german spanish italian japanese hungarian)) (define *subtitle-languages* (static-text-list-array english french german spanish italian br-portuguese)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DYNAMIC MENU THINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-perm *temp-options-alloced* symbol #f) (define *resolutions* (new 'static 'boxed-array :type int32 640 720 768 800 900 960 1080)) ;; this is to avoid changing the value of *temp-options* or reallocating the options when reloading file (unless *temp-options-alloced* (define *temp-options* (new 'static 'boxed-array :type game-option :length 200 :allocated-length 200)) (dotimes (i (-> *temp-options* length)) (set! (-> *temp-options* i) (new 'global 'game-option))) (true! *temp-options-alloced*)) (defun find-highest-resolution () (let ((sx 0) (sy 0) (found #f) (mult GAME_MIN_RES_MULT) (lastr 0) (hir 0) (lor 0)) (pc-get-screen-size -1 (the (pointer int32) (& sx)) (the (pointer int32) (& sy))) (if (> sy sx) (set! sy sx)) (until found (dotimes (i (-> *resolutions* length)) (let ((thisr (the int (* mult (the float (-> *resolutions* i)))))) (cond ((< sy thisr) (if (zero? i) (*! mult 0.5)) (set! i (-> *resolutions* length)) (true! found) ) (else (set! lastr thisr)) ) )) (if (not found) (*! mult 2)) ) (set! hir lastr) mult ) ) (defmacro add-resolution-option (x y) "add a resolution button to *temp-options* with specified size" `(let ((option (-> *temp-options* (length *temp-options*)))) (set! (-> option option-type) (game-option-type resolution)) (set! (-> option name) (game-text-id resolution-fmt)) (set! (-> option param1) (the float ,x)) (set! (-> option param2) (the float ,y)) (set! (-> option scale) #t) (1+! (-> *temp-options* length)) ) ) (defmacro add-flava-player-option (text-id flava) "add a music player w/ flava 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-monitor-option (text-id monitor) "add a display button to *temp-options* with specified size" `(let ((option (-> *temp-options* (length *temp-options*)))) (set! (-> option option-type) (game-option-type monitor)) (set! (-> option name) ,text-id) (set! (-> option param1) (the float ,monitor)) (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*)))) (set! (-> option option-type) (game-option-type button)) (set! (-> option name) (game-text-id back)) (set! (-> option scale) #t) (1+! (-> *temp-options* length)) ) ) (defun build-resolution-options ((skip int) (amount int)) (set! (-> *temp-options* length) 0) (let* ((done? #f) (mult (find-highest-resolution)) (sx 0) (sy 0) (display-mode (pc-get-fullscreen)) ;; hack - do not use screen resolution in windowed mode, taskbar etc. messes it up and makes it useless! (skip? (= 'windowed display-mode)) ;; shortcut ;; we reserve 3 options. (max-options (+ -3 (-> *temp-options* allocated-length)))) ;; get screen size (for capping) (pc-get-screen-size -1 (the (pointer int32) (& sx)) (the (pointer int32) (& sy))) ;; extra button when fullscreen (when (not skip?) (add-resolution-option sx sy) (set! (-> *temp-options* (1- (length *temp-options*)) name) (game-text-id fit-to-screen)) ) ;; supersampling in fullscreen and stuff. this results in way too many resolution options lol. (when (!= display-mode 'windowed) (*! sx 2) (*! sy 2) (*! mult 2) ) ;; game aspect ratio (let ((aspect (-> *pc-settings* aspect-ratio))) (until (or done? (= (length *temp-options*) max-options)) (countdown (i (-> *resolutions* length)) (let* ((thisr (the int (* mult (the float (-> *resolutions* i))))) (thisx (the int (* aspect (the float thisr)))) (thisy thisr) ) (when (and (not skip?) (< (length *temp-options*) max-options) (<= thisy sy) (<= thisx sx) (= aspect (/ (the float thisx) (the float thisy))) (>= thisx PC_MIN_WIDTH) (>= thisy PC_MIN_HEIGHT)) (add-resolution-option thisx thisy) )) (false! skip?) ) (if (> mult GAME_MIN_RES_MULT) (/! mult 2) (true! done?)) )) ;; extra funny options (when (!= display-mode 'windowed) (add-resolution-option 512 224) (add-resolution-option 512 448)) (add-back-option) ) *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 build-monitor-options () (set! (-> *temp-options* length) 0) (dotimes (i (pc-get-monitor-count)) (add-monitor-option (game-text-id display-fmt) i) ) (add-back-option) *temp-options*) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CAROUSELL FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun get-language-name ((lang pc-subtitle-lang)) "get the game-text-id from a lang" (dolist (item *language-remap-info-pc*) (when (= lang (the pc-subtitle-lang (/ (the int (cadr (car item))) 8))) (return (the game-text-id (/ (the int (car (car item))) 8)))) ) (game-text-id zero) ) (defun print-string-in-carousell ((arg0 game-text-id) (arg1 font-context) (arg2 int) (arg3 symbol)) (let ((s5-0 (if arg3 arg2 (- arg2) ) ) ) (+! (-> arg1 origin x) (the float s5-0)) (let ((f30-0 (- 1.0 (* 0.0033333334 (the float arg2))))) (print-game-text-scaled (lookup-text! *common-text* arg0 #f) f30-0 arg1 (the int (* 128.0 f30-0))) ) (set! (-> arg1 origin x) (- (-> arg1 origin x) (the float s5-0))) ) (set! (-> arg1 color) (font-color default)) arg1 ) (defun progress-draw-carousell-from-string-list ((options (array game-text-id)) (font font-context) (y-off int) (new-val int)) "yep." (let ((old-lang (-> *progress-carousell* selection)) (new-lang new-val) (max-lang (length options)) ) (if (-> *progress-carousell* transition) (seekl! (-> *progress-carousell* x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio))))) (when (>= (-> *progress-carousell* x-offset) 100) (set! (-> *progress-carousell* selection) new-lang) (set! old-lang new-lang) (set! (-> *progress-carousell* transition) #f) (set! (-> *progress-carousell* x-offset) 0) ) (set! (-> font origin y) (the float (+ y-off 3))) (set-color! font (font-color lighter-lighter-blue)) 0 (let ((next-lang (mod (+ old-lang 1) max-lang)) (prev-lang (mod (+ max-lang -1 old-lang) max-lang)) ;; these are used during the transition since it technically allows you to see 4 langs at once. (next2-lang (mod (+ old-lang 2) max-lang)) (prev2-lang (mod (+ max-lang -2 old-lang) max-lang)) ) (cond ((-> *progress-carousell* direction) (let ((a2-22 (- 200 (+ (-> *progress-carousell* x-offset) 100)))) (print-string-in-carousell (-> options prev-lang) font a2-22 #f) ) (set-color! font (font-color lighter-lighter-blue)) (let ((a2-23 (+ (-> *progress-carousell* x-offset) 100))) (cond ((< a2-23 150) (print-string-in-carousell (-> options next-lang) font a2-23 #t) ) (else (let ((a2-24 (- 200 (-> *progress-carousell* x-offset)))) (print-string-in-carousell (-> options prev2-lang) font a2-24 #f) ) ) ) ) ) (else (let ((a2-25 (+ (-> *progress-carousell* x-offset) 100))) (cond ((< a2-25 150) (print-string-in-carousell (-> options prev-lang) font a2-25 #f) ) (else (let ((a2-26 (- 200 (-> *progress-carousell* x-offset)))) (print-string-in-carousell (-> options next2-lang) font a2-26 #t) ) ) ) ) (set-color! font (font-color lighter-lighter-blue)) (let ((a2-27 (- 200 (+ (-> *progress-carousell* x-offset) 100)))) (print-string-in-carousell (-> options next-lang) font a2-27 #t) ) ) ) ) (if (not (-> *progress-carousell* transition)) (set-color! font (font-color yellow-green-2))) (print-string-in-carousell (-> options old-lang) font (-> *progress-carousell* x-offset) (-> *progress-carousell* direction)) ) ) ;;--------------------------- ;;--------------------------- ;; function overrides (defun init-game-options ((obj progress)) "Set the options for all of the menus." ;; start off by making them all invalid (dotimes (i (progress-screen max)) (set! (-> *options-remap* i) #f) ) ;; give cheats (when (task-closed? (game-task finalboss-movies) (task-status need-reminder)) (logior! (-> *pc-settings* cheats-known) (pc-cheats sidekick-blue tunes sky big-head small-head big-fist big-head-npc)) (when (>= (calculate-completion (the progress #f)) 100.0) (logior! (-> *pc-settings* cheats-known) (pc-cheats invinc eco-blue eco-red eco-green eco-yellow huge-head mirror no-tex)))) ;; set up options for each screen (set! (-> *options-remap* (progress-screen settings)) (if (or *cheat-mode* (nonzero? (-> *pc-settings* cheats-known))) *main-options-secrets* *main-options-pc*)) (set! (-> *options-remap* (progress-screen game-settings)) *game-options-pc*) (let ((max-refresh-rate (pc-get-screen-rate -1))) (cond ((or *debug-segment* (> max-refresh-rate 100)) (set! (-> *options-remap* (progress-screen graphic-settings)) *graphic-options-pc*) (set! *carousell-frame-rate* *carousell-frame-rate-150fps*) ) ((> max-refresh-rate 60) (set! (-> *options-remap* (progress-screen graphic-settings)) *graphic-options-pc*) (set! *carousell-frame-rate* *carousell-frame-rate-100fps*) ) (else (set! (-> *options-remap* (progress-screen graphic-settings)) *graphic-options-no-frame-rate-pc*) ) )) (set! (-> *options-remap* (progress-screen sound-settings)) *sound-options-pc*) (set! (-> *options-remap* (progress-screen memcard-no-space)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-not-inserted)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-not-formatted)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-format)) *yes-no-options*) (set! (-> *options-remap* (progress-screen memcard-data-exists)) *yes-no-options*) (set! (-> *options-remap* (progress-screen memcard-insert)) *ok-options*) (set! (-> *options-remap* (progress-screen load-game)) *load-options*) (set! (-> *options-remap* (progress-screen save-game)) *save-options*) (set! (-> *options-remap* (progress-screen save-game-title)) *save-options-title*) (set! (-> *options-remap* (progress-screen memcard-error-loading)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-error-saving)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-error-formatting)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-error-creating)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-auto-save-error)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-removed)) *ok-options*) (set! (-> *options-remap* (progress-screen memcard-no-data)) *yes-no-options*) (set! (-> *options-remap* (progress-screen title)) *title-pc*) (set! (-> *options-remap* (progress-screen settings-title)) *options*) (set! (-> *options-remap* (progress-screen auto-save)) *ok-options*) (set! (-> *options-remap* (progress-screen pal-change-to-60hz)) *yes-no-options*) (set! (-> *options-remap* (progress-screen pal-now-60hz)) *yes-no-options*) (set! (-> *options-remap* (progress-screen no-disc)) *ok-options*) (set! (-> *options-remap* (progress-screen bad-disc)) *ok-options*) (set! (-> *options-remap* (progress-screen quit)) *yes-no-options*) ;; our screens! (set! (-> *options-remap* (progress-screen aspect-msg)) *yes-no-options*) (set! (-> *options-remap* (progress-screen camera-options)) *camera-options*) (set! (-> *options-remap* (progress-screen misc-options)) *misc-options*) (set! (-> *options-remap* (progress-screen accessibility-options)) *accessibility-options*) (set! (-> *options-remap* (progress-screen gfx-ps2-options)) *gfx-ps2-options*) (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-title*) (set! (-> *options-remap* (progress-screen cheats)) *cheats*) (set! (-> *options-remap* (progress-screen checkpoint-select)) *checkpoint-select-options*) (set! (-> *options-remap* (progress-screen music-player)) *music-player-options*) (set! (-> *options-remap* (progress-screen flava-player)) *temp-options*) (set! (-> *options-remap* (progress-screen memcard-disable-auto-save)) *yes-no-options*) (set! (-> *options-remap* (progress-screen memcard-auto-save-disabled)) *ok-options*) (set! (-> *options-remap* (progress-screen monitor)) *temp-options*) (set! (-> *options-remap* (progress-screen speedrun-options)) *speedrun-options*) (set! (-> *options-remap* (progress-screen speedrun-il-options)) *speedrun-il-options*) (set! (-> *options-remap* (progress-screen speedrun-cat-ext-options)) *speedrun-cat-ext-options*) ;; set default params (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) (set! (-> *progress-state* video-mode-choice) (get-video-mode)) (set! (-> *progress-state* yes-no-choice) #f) ;; set variable pointers (set! (-> *game-options* 0 value-to-modify) (&-> *setting-control* default vibration)) (set! (-> *game-options* 1 value-to-modify) (&-> *setting-control* default play-hints)) (set! (-> *game-options* 2 value-to-modify) (&-> *setting-control* default language)) (set! (-> *game-options-japan* 0 value-to-modify) (&-> *setting-control* default vibration)) (set! (-> *game-options-japan* 1 value-to-modify) (&-> *setting-control* default play-hints)) (set! (-> *game-options-demo* 0 value-to-modify) (&-> *setting-control* default vibration)) (set! (-> *game-options-demo* 1 value-to-modify) (&-> *setting-control* default play-hints)) (set! (-> *graphic-options* 1 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) (set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) (set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume)) (set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) (set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice)) ;; our options! (set! (-> *game-options-pc* 0 value-to-modify) (&-> *setting-control* default vibration)) (set! (-> *game-options-pc* 1 value-to-modify) (&-> *setting-control* default play-hints)) (set! (-> *game-options-pc* 2 value-to-modify) (&-> *pc-settings* subtitles?)) (set! (-> *game-options-pc* 3 value-to-modify) (&-> *pc-settings* hinttitles?)) (set! (-> *game-options-pc* 4 value-to-modify) (&-> *setting-control* default language)) (set! (-> *game-options-pc* 5 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *game-options-pc* 6 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *game-options-pc* 7 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 1 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 2 value-to-modify) (&-> *pc-settings* monitor)) (set! (-> *graphic-options-pc* 3 value-to-modify) (&-> *pc-settings* vsync?)) (set! (-> *graphic-options-pc* 5 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 6 value-to-modify) (&-> *progress-carousell* int-backup)) ;; disable changes to frame-rate while in speedrunner mode (set! (-> *graphic-options-pc* 6 option-disabled-func) (lambda () (-> *pc-settings* speedrunner-mode?))) (set! (-> *graphic-options-no-frame-rate-pc* 1 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-no-frame-rate-pc* 2 value-to-modify) (&-> *pc-settings* vsync?)) (set! (-> *graphic-options-no-frame-rate-pc* 4 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *misc-options* 0 value-to-modify) (&-> *pc-settings* money-starburst?)) (set! (-> *misc-options* 1 value-to-modify) (&-> *pc-settings* discord-rpc?)) (set! (-> *misc-options* 2 value-to-modify) (&-> *pc-settings* skip-movies?)) (set! (-> *misc-options* 3 value-to-modify) (&-> *pc-settings* speedrunner-mode?)) (set! (-> *camera-options* 0 value-to-modify) (&-> *pc-settings* first-camera-h-inverted?)) (set! (-> *camera-options* 1 value-to-modify) (&-> *pc-settings* first-camera-v-inverted?)) (set! (-> *camera-options* 2 value-to-modify) (&-> *pc-settings* third-camera-h-inverted?)) (set! (-> *camera-options* 3 value-to-modify) (&-> *pc-settings* third-camera-v-inverted?)) (set! (-> *accessibility-options* 0 value-to-modify) (&-> *pc-settings* money-starburst?)) (set! (-> *gfx-ps2-options* 0 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *gfx-ps2-options* 1 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *gfx-ps2-options* 2 value-to-modify) (&-> *pc-settings* ps2-parts?)) (set! (-> *gfx-ps2-options* 3 value-to-modify) (&-> *pc-settings* force-envmap?)) ;(set! (-> *gfx-ps2-options* 3 value-to-modify) (&-> *pc-settings* force-actors?)) (set! (-> *sound-options-pc* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) (set! (-> *sound-options-pc* 1 value-to-modify) (&-> *setting-control* default music-volume)) (set! (-> *sound-options-pc* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) (dotimes (i (1- (-> *cheats* length))) (set! (-> *cheats* i value-to-modify) (&-> *progress-carousell* symbol-backup)) ) ;(set! (-> *sound-options-pc* 3 value-to-modify) (&-> *pc-settings* music-fadein?)) (set! (-> *progress-carousell* aspect-native-choice) (-> *pc-settings* use-vis?)) ;; scroll stuff! (progress-scroll-reset) (none) ) (defmethod respond-common progress ((obj progress)) "common logic for navigating the progress menu. this is the overriden version, purged of no longer necessary code and with additional new code." ;; read memcard (mc-get-slot-info 0 *progress-save-info*) (set! (-> obj card-info) *progress-save-info*) ;; build custom dynamic menus (case (-> obj display-state) (((progress-screen resolution)) ;; TODO infinite scrolling (build-resolution-options 0 0) ) (((progress-screen flava-player)) (build-flava-player-options *progress-music*) ) (((progress-screen secrets)) (if (= (-> obj display-state-stack 0) (progress-screen title)) (set! (-> *options-remap* (-> obj display-state)) *secrets-title*) (set! (-> *options-remap* (-> obj display-state)) *secrets*)) ) (((progress-screen monitor)) (build-monitor-options) ) ) ;; run nav code (let ((options (-> *options-remap* (-> obj display-state)))) ;; snap scroll if oob (when (> (length options) PROGRESS_PC_PAGE_HEIGHT) (set! (-> *progress-scroll* start-index) (max (-> *progress-scroll* start-index) (- (-> obj option-index) (+ PROGRESS_PC_PAGE_HEIGHT -2)))) ) (when (and options (not (or (progress-scrolling?) (-> obj in-transition)))) ;; only respond to inputs when transition is done (and also there's options at all) (cond ((cpad-pressed? 0 up) ;; pressed up ;; original code checked hold and then press, because hold can be used during center screen option. which we don't use. (when (not (-> obj selected-option)) (if (!= (length options) 1) (sound-play "cursor-up-down") ) (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) (cond ((> (-> obj option-index) 0) (1-! (-> obj option-index)) (when (and (> (length options) PROGRESS_PC_PAGE_HEIGHT) (< (-> obj option-index) *progress-scroll-start*)) (progress-scroll-up!) ) ) (else (set! (-> obj option-index) (1- (length options))) (set! (-> *progress-scroll* start-index) (max 0 (- (length options) PROGRESS_PC_PAGE_HEIGHT -1))) ) ) ) ) ((cpad-pressed? 0 down) ;; pressed down. (when (not (-> obj selected-option)) (if (!= (length options) 1) (sound-play "cursor-up-down") ) (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) (cond ((< (-> obj option-index) (1- (length options))) (1+! (-> obj option-index)) (when (and (> (length options) PROGRESS_PC_PAGE_HEIGHT) (>= (-> obj option-index) *progress-scroll-end*)) (progress-scroll-down!) ) ) (else (set! (-> obj option-index) 0) (set! (-> *progress-scroll* start-index) 0) ) ) ) ) ((cpad-hold? 0 left) ;; holding left. sliders use hold. (cond ((cpad-pressed? 0 left) ;; navigate left. (when (or (-> obj selected-option) (= (-> options (-> obj option-index) option-type) (game-option-type yes-no))) (let ((sound? #f)) (case (-> options (-> obj option-index) option-type) (((game-option-type on-off) (game-option-type yes-no) (game-option-type normal-inverted) (game-option-type aspect-native) (game-option-type cheat-toggle)) ;; pressed left on an on/off yes/no option (when (not (-> (the-as (pointer uint32) (-> options (-> obj option-index) value-to-modify)))) ;; it was on 'off' or 'no' (set! sound? #t) ;; vibrate if this toggles vibration. this doesn't actually work AND it checks the wrong field. (if (= (-> options (-> obj option-index) value-to-modify) (&-> *setting-control* current vibration)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) ) ) ;; it's on 'on' or 'yes' now (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) #t) ) (((game-option-type aspect-ratio)) (set! sound? (= (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) 'aspect16x9)) (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) 'aspect4x3) ) (((game-option-type language)) ;; language selection. if not on first language, go back. if on first language, go to last. (if (> (the-as int (-> (the-as (pointer uint64) (-> options (-> obj option-index) value-to-modify)))) 0) (+! (-> (the-as (pointer uint64) (-> options (-> obj option-index) value-to-modify))) -1) (set! (-> (the-as (pointer int64) (-> options (-> obj option-index) value-to-modify))) 5) ) ;; language was updated. (set! (-> obj language-transition) #t) (set! (-> obj language-direction) #t) (set! sound? #t) ) (((game-option-type display-mode) (game-option-type msaa) (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) (game-option-type frame-rate) (game-option-type language-subtitles) (game-option-type language-text) ) ;; a carousell like language (if (> (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) 0) (+! (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) -1) (set! (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) (1- (length (-> *progress-carousell* current-carousell)))) ) ;; updated. (set! (-> *progress-carousell* transition) #t) (set! (-> *progress-carousell* direction) #t) (set! sound? #t) ) ) (if sound? (sound-play "cursor-l-r") ) ) ) ) (else ;; holding left (when (-> obj selected-option) (let ((sound? #f)) (case (-> options (-> obj option-index) option-type) (((game-option-type slider)) ;; slider is selected (cond ((>= (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (+ 1.0 (-> options (-> obj option-index) param1))) ;; we're 1 above minimum, so reduce by 1 (set! (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (+ -1.0 (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))))) (set! sound? #t) ) ((< (-> options (-> obj option-index) param1) ;; not at least 1 above minimum, just set to minimum (why not just use max or something!!) (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify)))) (set! (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (-> options (-> obj option-index) param1)) (set! sound? #t) ) ) ) ) ;; play sound (when sound? (let ((vol 100.0)) (case (-> options (-> obj option-index) name) (((game-text-id music-volume) (game-text-id speech-volume)) (set! vol (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify)))) ) ) (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) (sound-play "slider2001" :vol vol) ) ) ) ) ) ) ) ) ((cpad-hold? 0 right) ;; holding right (cond ((cpad-pressed? 0 right) ;; pressed right (when (or (-> obj selected-option) (= (-> options (-> obj option-index) option-type) (game-option-type yes-no))) (let ((sound? #f)) (case (-> options (-> obj option-index) option-type) (((game-option-type on-off) (game-option-type yes-no) (game-option-type normal-inverted) (game-option-type aspect-native) (game-option-type cheat-toggle)) ;; play sound if it was on 'yes' because we're going to 'no' now (set! sound? (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify)))) ;; set to no (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) #f) ) (((game-option-type aspect-ratio)) ;; same shit different toilet (set! sound? (= (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) 'aspect4x3)) (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) 'aspect16x9) ) (((game-option-type language)) ;; same thing as before. if at last, go to first. otherwise, keep going forward. (if (< (the-as int (-> (the-as (pointer uint64) (-> options (-> obj option-index) value-to-modify)))) 5) (1+! (-> (the-as (pointer uint64) (-> options (-> obj option-index) value-to-modify)))) (set! (-> (the-as (pointer int64) (-> options (-> obj option-index) value-to-modify))) 0) ) (set! (-> obj language-transition) #t) (set! (-> obj language-direction) #f) (set! sound? #t) ) (((game-option-type display-mode) (game-option-type msaa) (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) (game-option-type frame-rate) (game-option-type language-subtitles) (game-option-type language-text) ) ;; same thing as before. if at last, go to first. otherwise, keep going forward. (if (< (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) (1- (length (-> *progress-carousell* current-carousell)))) (1+! (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify)))) (set! (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) 0) ) (set! (-> *progress-carousell* transition) #t) (set! (-> *progress-carousell* direction) #f) (set! sound? #t) ) ) ;; play sound if desired (if sound? (sound-play "cursor-l-r") ) ) ) ) (else ;; holding right, but didnt just press it. same slider stuff as before (when (-> obj selected-option) (let ((sound? #f)) (case (-> options (-> obj option-index) option-type) (((game-option-type slider)) (cond ((>= (+ -1.0 (-> options (-> obj option-index) param2)) (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify)))) (set! (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (+ 1.0 (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))))) (set! sound? #t) ) ((< (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (-> options (-> obj option-index) param2)) (set! (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (-> options (-> obj option-index) param2)) (set! sound? #t) ) ) ) ) (when sound? (let ((vol 100.0)) (case (-> options (-> obj option-index) name) (((game-text-id music-volume) (game-text-id speech-volume)) (set! vol (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify)))) ) ) (when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound))) (set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter)) (sound-play "slider2001" :vol vol) ) ) ) ) ) ) ) ) ((or (cpad-pressed? 0 square) (cpad-pressed? 0 triangle)) ;; pressed square or triangle, cancel out! (cond ((-> obj selected-option) ;; an option is selected. AHHH!!! just restore to whatever was on the backup (case (-> options (-> obj option-index) option-type) (((game-option-type slider)) (set! (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify))) (-> *progress-state* slider-backup)) ) (((game-option-type language)) (set! (-> (the-as (pointer language-enum) (-> options (-> obj option-index) value-to-modify))) (-> *progress-state* language-backup)) ) (((game-option-type on-off) (game-option-type normal-inverted)) (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) (-> *progress-state* on-off-backup)) ) ) ;; ding (sound-play "cursor-options") (set! (-> obj selected-option) #f) ) ((or (can-go-back? obj) (= (-> obj display-state) (progress-screen load-game)) (= (-> obj display-state) (progress-screen save-game)) (= (-> obj display-state) (progress-screen save-game-title)) ) ;; no option selected, go back (cpad-clear! 0 square) (cpad-clear! 0 triangle) (if (= (-> obj display-state) (progress-screen settings)) (sound-play "menu-stats") (sound-play "cursor-options") ) (when (= (-> obj display-state) (progress-screen music-player)) (sound-group-pause (sound-group music)) (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)) ) ) ) ((or (cpad-pressed? 0 x) (cpad-pressed? 0 circle)) ;; pressed x or circle. advance! ;; first check if the option is disabled, if so leave early and do nothing (when (and (!= (-> options (-> obj option-index) option-disabled-func) 0) ((-> options (-> obj option-index) option-disabled-func))) (sound-play "menu-stats") (return #f)) (cond ((not (-> obj selected-option)) ;; no option already selected. (cond ((= (-> options (-> obj option-index) option-type) (game-option-type menu)) ;; go to a menu (cpad-clear! 0 x) (cpad-clear! 0 circle) (cond ((and (not (-> *setting-control* default auto-save)) (= (game-text-id disable-auto-save) (-> options (-> obj option-index) name))) (sound-play "cursor-options") ) (else (push! obj) (sound-play "select-option") (set! (-> obj next-display-state) (the-as progress-screen (-> options (-> obj option-index) param3))) (case (-> obj next-display-state) (((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title)) (set! (-> obj next-display-state) (set-memcard-screen obj (-> obj next-display-state))) ) ) ) ) ) ((= (-> options (-> obj option-index) option-type) (game-option-type button)) ;; a button. what? (case (-> options (-> obj option-index) name) (((game-text-id exit-demo)) ;; exit demo! (set! *master-exit* 'force) (set-master-mode 'game) ) (((game-text-id back)) ;; go back! (if (= (-> obj display-state) (progress-screen settings)) (sound-play "menu-stats") (sound-play "cursor-options") ) (when (= (-> obj display-state) (progress-screen music-player)) (sound-group-pause (sound-group music)) (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)) ) (((game-text-id restore-defaults)) ;; restore default camera controls (reset-original-camera *pc-settings*) (sound-play "cursor-options") ) ;; LEVEL SELECT (((game-text-id training-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "game-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id village1-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "village1-warp")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id beach-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "beach-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id jungle-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "jungle-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id misty-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "misty-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id firecanyon-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "firecanyon-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id village2-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "village2-warp")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id sunken-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "sunken-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id swamp-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "swamp-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id rolling-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "rolling-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id ogre-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "ogre-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id village3-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "village3-warp")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id snow-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "snow-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id cave-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "maincave-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id lavatube-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "lavatube-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id citadel-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "citadel-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) (((game-text-id finalboss-level-name)) (set! (-> *game-info* current-continue) (get-continue-by-name *game-info* "finalboss-start")) (initialize! *game-info* 'die (the-as game-save #f) (the-as string #f)) ) ;; SPEEDRUNS ;; Restart current run (((game-text-id speedrun-reset-current-run)) (progress-fast-save-and-start-speedrun (the-as speedrun-category #f)) ) ;; Full game runs (((game-text-id speedrun-new-full-game)) (progress-fast-save-and-start-speedrun (speedrun-category full-game)) ) ;; Individual Levels (((game-text-id speedrun-il-training)) (progress-fast-save-and-start-speedrun (speedrun-category il-training)) ) (((game-text-id speedrun-il-village1)) (progress-fast-save-and-start-speedrun (speedrun-category il-village1)) ) (((game-text-id speedrun-il-beach)) (progress-fast-save-and-start-speedrun (speedrun-category il-beach)) ) (((game-text-id speedrun-il-jungle)) (progress-fast-save-and-start-speedrun (speedrun-category il-jungle)) ) (((game-text-id speedrun-il-misty)) (progress-fast-save-and-start-speedrun (speedrun-category il-misty)) ) (((game-text-id speedrun-il-firecanyon)) (progress-fast-save-and-start-speedrun (speedrun-category il-firecanyon)) ) (((game-text-id speedrun-il-village2)) (progress-fast-save-and-start-speedrun (speedrun-category il-village2)) ) (((game-text-id speedrun-il-sunken)) (progress-fast-save-and-start-speedrun (speedrun-category il-sunken)) ) (((game-text-id speedrun-il-swamp)) (progress-fast-save-and-start-speedrun (speedrun-category il-swamp)) ) (((game-text-id speedrun-il-rolling)) (progress-fast-save-and-start-speedrun (speedrun-category il-rolling)) ) (((game-text-id speedrun-il-ogre)) (progress-fast-save-and-start-speedrun (speedrun-category il-ogre)) ) (((game-text-id speedrun-il-village3)) (progress-fast-save-and-start-speedrun (speedrun-category il-village3)) ) (((game-text-id speedrun-il-snow)) (progress-fast-save-and-start-speedrun (speedrun-category il-snow)) ) (((game-text-id speedrun-il-cave)) (progress-fast-save-and-start-speedrun (speedrun-category il-cave)) ) (((game-text-id speedrun-il-lavatube)) (progress-fast-save-and-start-speedrun (speedrun-category il-lavatube)) ) (((game-text-id speedrun-il-citadel)) (progress-fast-save-and-start-speedrun (speedrun-category il-citadel)) ) (((game-text-id speedrun-new-game-plus)) (progress-fast-save-and-start-speedrun (speedrun-category new-game-plus)) ) (((game-text-id speedrun-hub1-100)) (progress-fast-save-and-start-speedrun (speedrun-category hub1-100)) ) (((game-text-id speedrun-hub2-100)) (progress-fast-save-and-start-speedrun (speedrun-category hub2-100)) ) (((game-text-id speedrun-hub3-100)) (progress-fast-save-and-start-speedrun (speedrun-category hub3-100)) ) (((game-text-id speedrun-all-cutscenes)) (progress-fast-save-and-start-speedrun (speedrun-category all-cutscenes)) ) ) (commit-to-file *pc-settings*) ;; other behaviors are hardcoded elsewhere because screw you. ) ((= (-> 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 "select-option") (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 (sound-group music)) (sound-play "select-option") ) ) ((= (-> options (-> obj option-index) option-type) (game-option-type resolution)) ;; resolution button. change resolution! (let ((newx (the int (-> options (-> obj option-index) param1))) (newy (the int (-> options (-> obj option-index) param2)))) (set-size! *pc-settings* newx newy)) (cpad-clear! 0 x) (cpad-clear! 0 circle) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) (commit-to-file *pc-settings*) ) ((= (-> options (-> obj option-index) option-type) (game-option-type monitor)) ;; monitor button (let ((monitor (the int (-> options (-> obj option-index) param1)))) (set-monitor! *pc-settings* monitor) ) (cpad-clear! 0 x) (cpad-clear! 0 circle) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) (commit-to-file *pc-settings*) ) ((= (-> options (-> obj option-index) option-type) (game-option-type aspect-new)) ;; aspect ratio button. (let ((newx (the int (-> options (-> obj option-index) param1))) (newy (the int (-> options (-> obj option-index) param2)))) (cond ((= (-> options (-> obj option-index) name) (game-text-id fit-to-screen)) (set-aspect! *pc-settings* 4 3) (false! (-> *pc-settings* use-vis?)) (set-aspect-ratio 'aspect4x3) (true! (-> *pc-settings* aspect-ratio-auto?)) ) ((= newx -1.0) (set-aspect! *pc-settings* 4 3) (true! (-> *pc-settings* use-vis?)) (set! (-> *setting-control* default aspect-ratio) 'aspect4x3) (set-aspect-ratio 'aspect4x3) ) ((= newx -2.0) (set-aspect! *pc-settings* 4 3) (true! (-> *pc-settings* use-vis?)) (set! (-> *setting-control* default aspect-ratio) 'aspect16x9) (set-aspect-ratio 'aspect16x9) ) (else (set-aspect! *pc-settings* newx newy)))) (cpad-clear! 0 x) (cpad-clear! 0 circle) (sound-play "cursor-options") (commit-to-file *pc-settings*) (set! (-> obj next-display-state) (progress-screen invalid)) ) ((and (= (-> options (-> obj option-index) option-type) (game-option-type cheat-toggle)) (not (logtest? (-> *pc-settings* cheats-known) (ash 1 (the int (-> options (-> obj option-index) param1)))))) (sound-play "cursor-options") (if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l1) (cpad-hold? 0 r1)) (logior! (-> *pc-settings* cheats-known) (ash 1 (the int (-> options (-> obj option-index) param1))))) ) ((!= (-> options (-> obj option-index) option-type) (game-option-type yes-no)) ;; not yes-no ;; set backups! we're entering some toggle or whatever (case (-> options (-> obj option-index) option-type) (((game-option-type slider)) (set! (-> *progress-state* slider-backup) (-> (the-as (pointer float) (-> options (-> obj option-index) value-to-modify)))) ) (((game-option-type language)) (set! (-> *progress-state* language-backup) (-> (the-as (pointer language-enum) (-> options (-> obj option-index) value-to-modify)))) ) (((game-option-type on-off) (game-option-type normal-inverted)) (set! (-> *progress-state* on-off-backup) (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify)))) ) (((game-option-type cheat-toggle)) (set! (-> *progress-state* on-off-backup) (logtest? (-> *pc-settings* cheats) (ash 1 (the int (-> options (-> obj option-index) param1))))) (set! (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify))) (-> *progress-state* on-off-backup)) ) (((game-option-type display-mode)) ;; display-mode just reuses language stuff (case (pc-get-fullscreen) (('windowed #f) (set! (-> *progress-carousell* int-backup) 0)) (('fullscreen #t) (set! (-> *progress-carousell* int-backup) 1)) (('borderless) (set! (-> *progress-carousell* int-backup) 2)) ) ) (((game-option-type msaa)) (case (-> *pc-settings* gfx-msaa) ((2) (set! (-> *progress-carousell* int-backup) 1)) ((4) (set! (-> *progress-carousell* int-backup) 2)) ((8) (set! (-> *progress-carousell* int-backup) 3)) ((16) (set! (-> *progress-carousell* int-backup) 4)) (else (set! (-> *progress-carousell* int-backup) 0)) ) ) (((game-option-type lod-bg)) (case (-> *pc-settings* lod-force-tfrag) ((0) (set! (-> *progress-carousell* int-backup) 0)) ((1 2) (set! (-> *progress-carousell* int-backup) 1)) (else (set! (-> *progress-carousell* int-backup) 2)) ) ) (((game-option-type lod-fg)) (cond ((-> *pc-settings* ps2-lod-dist?) (set! (-> *progress-carousell* int-backup) 1)) (else (set! (-> *progress-carousell* int-backup) 0)) ) ) (((game-option-type speaker)) (case (-> *pc-settings* subtitle-speaker?) ((#t) (set! (-> *progress-carousell* int-backup) 0)) ((#f) (set! (-> *progress-carousell* int-backup) 1)) (('auto) (set! (-> *progress-carousell* int-backup) 2)) ) ) (((game-option-type frame-rate)) (case (-> *pc-settings* target-fps) ((60) (set! (-> *progress-carousell* int-backup) 0)) ((100) (set! (-> *progress-carousell* int-backup) 1)) ((150) (set! (-> *progress-carousell* int-backup) 2)) ) ) (((game-option-type language-subtitles)) (let ((cur-lang (get-language-name (-> *pc-settings* subtitle-language)))) (dotimes (i (-> *subtitle-languages* length)) (if (= (-> *subtitle-languages* i) cur-lang) (set! (-> *progress-carousell* int-backup) i)) )) ) (((game-option-type language-text)) (let ((cur-lang (get-language-name (-> *pc-settings* text-language)))) (dotimes (i (-> *text-languages* length)) (if (= (-> *text-languages* i) cur-lang) (set! (-> *progress-carousell* int-backup) i)) )) ) ) (sound-play "select-option") (cpad-clear! 0 x) (cpad-clear! 0 circle) (set! (-> obj selected-option) #t) (case (-> options (-> obj option-index) option-type) (((game-option-type language)) (set! (-> obj language-selection) (-> *setting-control* current language)) (set! (-> obj language-direction) #t) (set! (-> obj language-transition) #f) (set! (-> obj language-x-offset) 0) ) (else (set! (-> *progress-carousell* selection) (-> *progress-carousell* int-backup)) (set! (-> *progress-carousell* direction) #t) (set! (-> *progress-carousell* transition) #f) (set! (-> *progress-carousell* x-offset) 0) (case (-> options (-> obj option-index) option-type) (((game-option-type display-mode)) (set! (-> *progress-carousell* current-carousell) *carousell-display-mode*)) (((game-option-type msaa)) (set! (-> *progress-carousell* current-carousell) *carousell-msaa*)) (((game-option-type lod-bg)) (set! (-> *progress-carousell* current-carousell) *carousell-lod-bg*)) (((game-option-type lod-fg)) (set! (-> *progress-carousell* current-carousell) *carousell-lod-bg*)) (((game-option-type speaker)) (set! (-> *progress-carousell* current-carousell) *carousell-speaker*)) (((game-option-type frame-rate)) (set! (-> *progress-carousell* current-carousell) *carousell-frame-rate*)) (((game-option-type language-subtitles)) (set! (-> *progress-carousell* current-carousell) *subtitle-languages*)) (((game-option-type language-text)) (set! (-> *progress-carousell* current-carousell) *text-languages*)) ) ) ) ) ) ) (else ;; an option was selected. write stuff! (sound-play "start-options") (set! (-> obj selected-option) #f) (case (-> options (-> obj option-index) option-type) (((game-option-type cheat-toggle)) (let ((the-cheat (ash 1 (the int (-> options (-> obj option-index) param1))))) (cond ((-> (the (pointer symbol) (-> options (-> obj option-index) value-to-modify))) (logior! (-> *pc-settings* cheats) the-cheat)) (else (logclear! (-> *pc-settings* cheats) the-cheat) (when (and *target* (= the-cheat (pc-cheats invinc))) (logclear! (-> *target* state-flags) (state-flags invulnerable))))) ) ) (((game-option-type aspect-ratio)) ;; aspect ratio is first written to the backup. so this is for applying the change if we went through with it. (set! (-> *setting-control* default aspect-ratio) (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify)))) ) (((game-option-type aspect-native)) (set! (-> *pc-settings* use-vis?) (-> (the-as (pointer symbol) (-> options (-> obj option-index) value-to-modify)))) (if (-> *pc-settings* use-vis?) (set! (-> *setting-control* current aspect-ratio) #f) (set-aspect! *pc-settings* (-> *pc-settings* aspect-custom-x) (-> *pc-settings* aspect-custom-y))) ) (((game-option-type display-mode)) ;; same thing. (case (-> *progress-carousell* int-backup) ((0) (set-display-mode! *pc-settings* 'windowed)) ((1) (set-display-mode! *pc-settings* 'fullscreen)) ((2) (set-display-mode! *pc-settings* 'borderless)) ) ) (((game-option-type msaa)) (case (-> *progress-carousell* int-backup) ((0) (set! (-> *pc-settings* gfx-msaa) 1)) ((1) (set! (-> *pc-settings* gfx-msaa) 2)) ((2) (set! (-> *pc-settings* gfx-msaa) 4)) ((3) (set! (-> *pc-settings* gfx-msaa) 8)) ((4) (set! (-> *pc-settings* gfx-msaa) 16)) ) ) (((game-option-type lod-bg)) (case (-> *progress-carousell* int-backup) ((0) (set! (-> *pc-settings* lod-force-tfrag) 0) (set! (-> *pc-settings* lod-force-tie) 0)) ((1) (set! (-> *pc-settings* lod-force-tfrag) 2) (set! (-> *pc-settings* lod-force-tie) 2)) ((2) (set! (-> *pc-settings* lod-force-tfrag) 2) (set! (-> *pc-settings* lod-force-tie) 3)) ) ) (((game-option-type lod-fg)) (case (-> *progress-carousell* int-backup) ((0) (set! (-> *pc-settings* lod-force-actor) 0) (set! (-> *pc-settings* ps2-lod-dist?) #f)) ((1) (set! (-> *pc-settings* lod-force-actor) 0) (set! (-> *pc-settings* ps2-lod-dist?) #t)) ) ) (((game-option-type language-subtitles)) (let ((lang (assoc (the binteger (-> *subtitle-languages* (-> *progress-carousell* int-backup))) *language-remap-info-pc*))) (set! (-> *pc-settings* subtitle-language) (the pc-subtitle-lang (/ (the int (cadr lang)) 8))) ) ) (((game-option-type language-text)) (let ((lang (assoc (the binteger (-> *text-languages* (-> *progress-carousell* int-backup))) *language-remap-info-pc*))) (set! (-> *pc-settings* text-language) (the pc-subtitle-lang (/ (the int (cadr lang)) 8))) ) (if (not (-> *progress-carousell* transition)) (load-level-text-files (-> obj display-level-index))) ) (((game-option-type speaker)) ;; same thing. (case (-> *progress-carousell* int-backup) ((0) (set! (-> *pc-settings* subtitle-speaker?) #t)) ((1) (set! (-> *pc-settings* subtitle-speaker?) #f)) ((2) (set! (-> *pc-settings* subtitle-speaker?) 'auto)) ) ) (((game-option-type frame-rate)) (case (-> *progress-carousell* int-backup) ((0) (set-frame-rate! *pc-settings* 60)) ((1) (set-frame-rate! *pc-settings* 100)) ((2) (set-frame-rate! *pc-settings* 150)) ) (set-video-mode (-> *setting-control* default video-mode)) ) ) (commit-to-file *pc-settings*) ) ) ) ) ) ) (none) ) (defmethod respond-memcard progress ((obj progress)) "logic for handling input in memcard screens." (let ((s5-0 (-> obj card-info))) (when (and s5-0 (not (-> obj in-transition))) (when (or (cpad-pressed? 0 x) (cpad-pressed? 0 circle)) (cpad-clear! 0 x) (cpad-clear! 0 circle) (case (-> obj display-state) (((progress-screen load-game)) (cond ((< (-> obj option-index) 4) (when (nonzero? (-> s5-0 file (-> obj option-index) present)) (sound-play "start-options") (set! (-> *progress-state* which) (-> obj option-index)) (set! (-> obj next-display-state) (progress-screen memcard-loading)) ) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen save-game) (progress-screen save-game-title)) (cond ((< (-> obj option-index) 4) (sound-play "start-options") (set! (-> *progress-state* which) (-> obj option-index)) ;; save slot selected (if (zero? (-> s5-0 file (-> obj option-index) present)) (set! (-> obj next-display-state) (progress-screen memcard-saving)) (set! (-> obj next-display-state) (progress-screen memcard-data-exists)) ) ) ;; continue without saving ((and (= (-> obj display-state) (progress-screen save-game-title)) (= (-> obj option-index) 4)) (sound-play "starts-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) (initialize! *game-info* 'game (the-as game-save #f) "intro-start") (set-master-mode 'game) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen memcard-insert)) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) (((progress-screen memcard-data-exists)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (set! (-> obj next-display-state) (progress-screen memcard-saving)) ) (else (sound-play "cursor-options") (if (= (-> obj display-state-stack 0) (progress-screen title)) (set! (-> obj next-display-state) (progress-screen save-game-title)) (set! (-> obj next-display-state) (progress-screen save-game)) ) ) ) ) (((progress-screen memcard-no-data)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (set! (-> obj next-display-state) (progress-screen memcard-creating)) ) (else (sound-play "cursor-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((-> *pc-settings* speedrunner-mode?) (speedrun-start-full-game-run)) ;; start the game normally (else (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) ) ) (((progress-screen memcard-no-space) (progress-screen memcard-not-inserted) (progress-screen memcard-not-formatted) ) (cond ((= (-> obj display-state-stack 0) (progress-screen title)) (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((-> *pc-settings* speedrunner-mode?) (speedrun-start-full-game-run)) ;; start the game normally (else (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) ((nonzero? (-> obj display-state-stack 0)) (sound-play "start-options") (set-master-mode 'game) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen memcard-error-loading) (progress-screen memcard-error-saving) (progress-screen memcard-error-formatting) (progress-screen memcard-error-creating) (progress-screen memcard-auto-save-error) (progress-screen memcard-removed) (progress-screen auto-save) (progress-screen memcard-auto-save-disabled) ) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) (((progress-screen pal-change-to-60hz)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice)) (set! (-> obj video-mode-timeout) (-> *display* real-frame-counter)) (set! (-> obj next-display-state) (progress-screen pal-now-60hz)) ) (else (sound-play "cursor-options") (set! (-> *progress-state* video-mode-choice) 'pal) (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen pal-now-60hz)) (cond ((not (-> *progress-state* yes-no-choice)) (set! (-> *progress-state* video-mode-choice) 'pal) (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice)) (sound-play "cursor-options") ) (else (sound-play "start-options") ) ) (set! (-> obj next-display-state) (progress-screen invalid)) ) (((progress-screen no-disc) (progress-screen bad-disc)) (when (is-cd-in?) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) (((progress-screen quit)) (cond ((-> *progress-state* yes-no-choice) (set! *quit-to-title* #t) (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) (initialize! *game-info* 'game (the-as game-save #f) "title-start") ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen memcard-format)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (set! (-> obj next-display-state) (progress-screen memcard-formatting)) ) ((= (-> obj display-state-stack 0) (progress-screen title)) (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((-> *pc-settings* speedrunner-mode?) (speedrun-start-full-game-run)) ;; start the game normally (else (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen quit-title)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (commit-to-file *pc-settings*) (sound-volume-off) (kernel-shutdown) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) (((progress-screen memcard-disable-auto-save)) (cond ((-> *progress-state* yes-no-choice) (sound-play "start-options") (set! (-> *setting-control* default auto-save) #f) (set! (-> obj next-display-state) (progress-screen memcard-auto-save-disabled)) ) (else (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) ) ) ) ) 0 (none) ) (defmethod draw-options progress ((obj progress) (arg0 int) (arg1 int) (arg2 float)) "common logic for drawing options menus." (let ((options (-> *options-remap* (-> obj display-state)))) (when options ;; this menu has options to draw omg (let* ((line-amt (if (> (length options) PROGRESS_PC_PAGE_HEIGHT) (1- PROGRESS_PC_PAGE_HEIGHT) (length options))) (y-off (- arg0 (/ (* arg1 line-amt) 2))) (option-count 0) (unkx 27) (unk2 0) (font (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning))) (locked-str (lookup-text! *common-text* (game-text-id locked) #f)) ) ;; set the common params for the text drawing (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)))))) ((progress-scrolling-up?) (set! y-off (+ (- y-off arg1) (* (the float arg1) (-> *progress-scroll* transition))))) ) (let ((draw-arrows (and (not (-> obj in-transition)) (= (-> obj next-state name) 'progress-normal) (> (length options) PROGRESS_PC_PAGE_HEIGHT) (< (mod (-> *display* real-frame-counter) (seconds 0.2)) (seconds 0.1)))) (draw-prev (< 0 *progress-scroll-start*)) (draw-next (> (length options) *progress-scroll-end*))) (set! (-> obj particles 32 init-pos x) (the float (if (and draw-arrows draw-prev) (- 195 (-> *progress-process* 0 left-x-offset)) -320 ))) (set! (-> obj particles 33 init-pos x) (the float (if (and draw-arrows draw-next) (- 195 (-> *progress-process* 0 left-x-offset)) -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)) 14) (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)) 14) (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) (option-y y-off) (locked? #f) ) ;; Check if the option should be disabled (when (and (!= (-> options index option-disabled-func) 0) ((-> options index option-disabled-func))) (set! locked? #t)) (case (-> options index option-type) (((game-option-type yes-no)) ;; yes-no option. text is either '->YES<- NO' or 'YES ->NO<-', not the most robust but this option is a strange hack anyway. (if (-> (the-as (pointer uint32) (-> options index value-to-modify))) (set! option-str (string-format "~30L~S~0L ~S" (lookup-text! *common-text* (game-text-id yes) #f) (lookup-text! *common-text* (game-text-id no) #f))) (set! option-str (string-format "~0L~S ~30L~S" (lookup-text! *common-text* (game-text-id yes) #f) (lookup-text! *common-text* (game-text-id no) #f))) ) ) (((game-option-type menu) (game-option-type button)) ;; menu option or simple button. just draw its text! (if (nonzero? (-> options index name)) (set! option-str (lookup-text! *common-text* (-> options index name) #f)) (set! option-str #f) ) ;; if autosave disabled, update text and lock it (when (and (not (-> *setting-control* default auto-save)) (= (game-text-id disable-auto-save) (-> options index name))) (set! option-str (lookup-text! *common-text* (game-text-id auto-save-disabled) #f)) (true! locked?)) ;; checkpoint-select only unlocked after beating finalboss (when (and (not (task-closed? (game-task finalboss-movies) (task-status need-reminder))) (= (game-text-id checkpoint-select) (-> options index name))) (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-beat-game) #f)) (true! locked?)) ) (((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 locked-str) ) ) (((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 locked-str) ) ) (((game-option-type resolution) (game-option-type aspect-new)) ;; resolution settings (set! option-str (string-format (lookup-text! *common-text* (-> options index name) #f) (the int (-> options index param1)) (the int (-> options index param2)))) ) (((game-option-type monitor)) ;; monitor list (set! option-str (string-format (lookup-text! *common-text* (-> options index name) #f) (+ 1 (the int (-> options index param1))) ) ) ) (else (cond ((and (-> obj selected-option) (= (-> obj option-index) index)) ;; this option is SELECTED! (set-color! font (font-color default)) (set! (-> font origin x) (the float (- option-x (-> obj left-x-offset)))) (set! (-> font origin y) (the float (+ y-off -8))) (set-scale! font 0.6) (print-game-text (lookup-text! *common-text* (-> options index name) #f) font #f 128 22) (set! option-y (+ y-off 7)) (case (-> options index option-type) (((game-option-type slider)) ;; draw a slider and its text. ;; this ugliness is just decompiler stuff. all it does is fade the alpha according to value. (let* ((v1-82 (the-as uint #x8000ffff)) (f0-12 (* 0.01 (-> (the-as (pointer float) (-> options index value-to-modify))))) (a0-34 (logior (logand v1-82 -256) (shr (shl (the int (+ 64.0 (* 191.0 f0-12))) 56) 56))) (a3-5 (logior (logand a0-34 -65281) (shr (shl (shr (shl a0-34 56) 56) 56) 48))) ) (draw-percent-bar (- 75 (-> obj left-x-offset)) (+ 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)) ) (((game-option-type on-off) (game-option-type normal-inverted) (game-option-type aspect-native)) ;; on-off option or some other toggle. same logic as yes-no. changed to cut down code duping. (let ( (on-str (case (-> options index option-type) (((game-option-type on-off) (game-option-type aspect-native)) (lookup-text! *common-text* (game-text-id on) #f)) (((game-option-type normal-inverted)) (lookup-text! *common-text* (game-text-id inverted) #f)) )) (off-str (case (-> options index option-type) (((game-option-type on-off) (game-option-type aspect-native)) (lookup-text! *common-text* (game-text-id off) #f)) (((game-option-type normal-inverted)) (lookup-text! *common-text* (game-text-id normal) #f)) )) ) (if (-> (the-as (pointer symbol) (-> options index value-to-modify))) (set! option-str (string-format "~30L~S~0L ~S" on-str off-str)) (set! option-str (string-format "~0L~S ~30L~S" on-str off-str)) ) ) ) (((game-option-type cheat-toggle)) (if (-> (the-as (pointer symbol) (-> options index value-to-modify))) (set! option-str (string-format "~30L~S~0L ~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) (set! option-str (string-format "~0L~S ~30L~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) ) ) (((game-option-type display-mode) (game-option-type msaa) (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) (game-option-type frame-rate) (game-option-type language-subtitles) (game-option-type language-text) ) ;; crunched down to one generic function. (progress-draw-carousell-from-string-list (-> *progress-carousell* current-carousell) font y-off (-> (the-as (pointer int) (-> options index value-to-modify)))) ) (((game-option-type language)) ;; language carousell. who knew this could be so complicated. (let ((old-lang (-> obj language-selection)) (new-lang (-> (the-as (pointer language-enum) (-> options index value-to-modify)))) (max-lang 6) ) (if (-> obj language-transition) (seekl! (-> obj language-x-offset) 200 (the int (* 10.0 (-> *display* time-adjust-ratio))))) (when (>= (-> obj language-x-offset) 100) (set! (-> obj language-selection) new-lang) (set! old-lang new-lang) (set! (-> obj language-transition) #f) (set! (-> obj language-x-offset) 0) ) (set! (-> font origin y) (the float (+ y-off 3))) (set-color! font (font-color lighter-lighter-blue)) 0 (let ((next-lang (mod (+ old-lang 1) max-lang)) (prev-lang (mod (+ max-lang -1 old-lang) max-lang)) ;; these are used during the transition since it technically allows you to see 4 langs at once. (next2-lang (mod (+ old-lang 2) max-lang)) (prev2-lang (mod (+ max-lang -2 old-lang) max-lang)) ) (cond ((-> obj language-direction) (let ((a2-22 (- 200 (+ (-> obj language-x-offset) 100)))) (print-language-name prev-lang font a2-22 #f) ) (set-color! font (font-color lighter-lighter-blue)) (let ((a2-23 (+ (-> obj language-x-offset) 100))) (cond ((< a2-23 150) (print-language-name (the int next-lang) font a2-23 #t) ) (else (let ((a2-24 (- 200 (-> obj language-x-offset)))) (print-language-name prev2-lang font a2-24 #f) ) ) ) ) ) (else (let ((a2-25 (+ (-> obj language-x-offset) 100))) (cond ((< a2-25 150) (print-language-name prev-lang font a2-25 #f) ) (else (let ((a2-26 (- 200 (-> obj language-x-offset)))) (print-language-name (the int next2-lang) font a2-26 #t) ) ) ) ) (set-color! font (font-color lighter-lighter-blue)) (let ((a2-27 (- 200 (+ (-> obj language-x-offset) 100)))) (print-language-name (the int next-lang) font a2-27 #t) ) ) ) ) (if (not (-> obj language-transition)) (set-color! font (font-color yellow-green-2))) (print-language-name (the-as int old-lang) font (-> obj language-x-offset) (-> obj language-direction)) )) (((game-option-type aspect-ratio)) ;; same as on-off but checks a different symbol (if (= (-> (the-as (pointer symbol) (-> options index value-to-modify))) 'aspect4x3) (set! option-str (string-format "~30L~S~0L ~S" (lookup-text! *common-text* (game-text-id 4x3) #f) (lookup-text! *common-text* (game-text-id 16x9) #f))) (set! option-str (string-format "~0L~S ~30L~S" (lookup-text! *common-text* (game-text-id 4x3) #f) (lookup-text! *common-text* (game-text-id 16x9) #f))) ) ) ) ) (else ;; this option is not selected :-( (case (-> options index option-type) (((game-option-type slider) (game-option-type aspect-ratio) (game-option-type display-mode) (game-option-type msaa) (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) (game-option-type frame-rate) (game-option-type normal-inverted) ) ;; slider and aspect ratio options just show their text (set! option-str (lookup-text! *common-text* (-> options index name) #f)) ) (((game-option-type on-off) (game-option-type aspect-native)) ;; on-off options show their text + on or off (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (if (-> (the-as (pointer uint32) (-> options index value-to-modify))) (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f) ))) ) (((game-option-type cheat-toggle)) (cond ((not (logtest? (-> *pc-settings* cheats-known) (ash 1 (the int (-> options index param1))))) (true! locked?) (case (ash 1 (the int (-> options index param1))) (((pc-cheats eco-blue) (pc-cheats eco-green) (pc-cheats eco-red) (pc-cheats eco-yellow) (pc-cheats invinc) (pc-cheats huge-head) (pc-cheats mirror) (pc-cheats no-tex) ) (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-100-percent) #f))) (((pc-cheats sky) (pc-cheats sidekick-blue) (pc-cheats tunes) (pc-cheats big-head) (pc-cheats small-head) (pc-cheats big-fist) (pc-cheats big-head-npc) ) (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-beat-game) #f))) (else ;; (format 0 "weird case ~f #x~x~%" (-> options index param1) (ash 1 (the int (-> options index param1)))) (set! option-str locked-str)) ) ) (else (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (if (logtest? (-> *pc-settings* cheats) (ash 1 (the int (-> options index param1)))) (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f) ))) ) ) ) (((game-option-type language)) ;; language options show their text + language name (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (lookup-text! *common-text* (-> *language-name-remap* (-> (the-as (pointer uint64) (-> options index value-to-modify)))) #f))) ) (((game-option-type language-subtitles)) (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (lookup-text! *common-text* (get-language-name (-> *pc-settings* subtitle-language)) #f))) ) (((game-option-type language-text)) (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (lookup-text! *common-text* (get-language-name (-> *pc-settings* text-language)) #f))) ) ) ) )) ) (when (or (<= (length options) PROGRESS_PC_PAGE_HEIGHT) (and (not (progress-scrolling?)) (>= index *progress-scroll-start*) (< index *progress-scroll-end*)) (and (progress-scrolling-down?) (>= index (1- *progress-scroll-start*)) (< index *progress-scroll-end*)) (and (progress-scrolling-up?) (>= index *progress-scroll-start*) (< index (1+ *progress-scroll-end*))) ) (when option-str ;; draw the actual text! (let ((f0-23 (-> obj transition-percentage-invert)) (scroll-amt (-> *progress-scroll* transition))) (cond ((or (and (progress-scrolling-up?) (= index *progress-scroll-start*)) (and (progress-scrolling-down?) (= index (1- *progress-scroll-end*)))) ) ((or (and (progress-scrolling-down?) (= index (1- *progress-scroll-start*))) (and (progress-scrolling-up?) (= index *progress-scroll-end*))) (set! scroll-amt (- 1.0 scroll-amt)) ) (else (set! scroll-amt 1.0) ) ) (set-color! font (cond ((and (!= index (-> obj option-index)) (or locked? (= locked-str option-str))) ;; 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 1.0 ))))) (set-scale! font (* arg2 f0-23 scroll-amt)) (print-game-text option-str font #f (the int (* 128.0 f0-23 scroll-amt)) 22) ) ) (+! y-off arg1) (+! option-count 1) ) )) ) ) ) 0 (none) ) (defun draw-memcard-speedrun-options ((obj progress) (arg0 font-context)) (set-scale! arg0 0.85) (set-flags! arg0 (font-flags shadow kerning middle left large)) (set-origin! arg0 (- 20 (-> obj left-x-offset)) 30) (set-width! arg0 360) (set-color! arg0 (font-color lighter-lighter-blue)) (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (game-text-id speedrun-options-heading) #f) (-> obj transition-percentage-invert) arg0 128) (set-scale! arg0 0.6) (set-flags! arg0 (font-flags shadow kerning middle left large)) (set-origin! arg0 (- 20 (-> obj left-x-offset)) 60) (set-width! arg0 360) (set-height! arg0 20) (set-color! arg0 (font-color yellow-orange)) (print-game-text-scaled (lookup-text! *common-text* (game-text-id speedrun-options-warning) #f) (-> obj transition-percentage-invert) arg0 128) 0) (defun draw-memcard-auto-save-disabled ((obj progress) (arg0 font-context)) (set-scale! arg0 0.6) (set-flags! arg0 (font-flags shadow kerning middle left large)) (set-origin! arg0 (- 20 (-> obj left-x-offset)) 38) (set-width! arg0 360) (set-height! arg0 20) (print-game-text-scaled (lookup-text! *common-text* (game-text-id autosave-disabled-title) #f) (-> obj transition-percentage-invert) arg0 128) (set! (-> arg0 origin y) 72.0) (set-width! arg0 360) (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (game-text-id autosave-disabled-msg) #f) (-> obj transition-percentage-invert) arg0 128) (set-scale! arg0 0.65) (set! (-> arg0 origin y) 120.0) (set-height! arg0 60) (print-game-text-scaled (lookup-text! *common-text* (game-text-id continue?) #f) (-> obj transition-percentage-invert) arg0 128) 0) (defun draw-memcard-disable-auto-save ((obj progress) (arg0 font-context)) (set-origin! arg0 (- 50 (-> obj left-x-offset)) 70) (set-scale! arg0 0.6) (set-width! arg0 300) (set-height! arg0 40) (set-flags! arg0 (font-flags shadow kerning middle left large)) (print-game-text-scaled (lookup-text! *common-text* (game-text-id disable-auto-save-query) #f) (-> obj transition-percentage-invert) arg0 128) 0) (defmethod draw-notice-screen progress ((obj progress)) (hide-progress-icons) (when *common-text* (let ((a1-1 (new 'stack 'font-context *font-default-matrix* (- 70 (-> obj left-x-offset)) 10 0.0 (font-color default) (font-flags shadow kerning)))) (case (-> obj display-state) (((progress-screen memcard-format)) (draw-memcard-format obj a1-1) ) (((progress-screen memcard-no-space) (progress-screen memcard-not-inserted) (progress-screen memcard-not-formatted) ) (draw-memcard-storage-error obj a1-1) ) (((progress-screen memcard-data-exists)) (draw-memcard-data-exists obj a1-1) ) (((progress-screen memcard-no-data)) (draw-memcard-no-data obj a1-1) ) (((progress-screen memcard-loading) (progress-screen memcard-saving) (progress-screen memcard-formatting) (progress-screen memcard-creating) ) (draw-memcard-accessing obj a1-1) ) (((progress-screen memcard-insert)) (draw-memcard-insert obj a1-1) ) (((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title)) (draw-memcard-file-select obj a1-1) ) (((progress-screen memcard-auto-save-error)) (draw-memcard-auto-save-error obj a1-1) ) (((progress-screen memcard-removed)) (draw-memcard-removed obj a1-1) ) (((progress-screen memcard-error-loading) (progress-screen memcard-error-saving) (progress-screen memcard-error-formatting) (progress-screen memcard-error-creating) ) (draw-memcard-error obj a1-1) ) (((progress-screen auto-save)) (draw-auto-save obj a1-1) ) (((progress-screen pal-change-to-60hz)) (draw-pal-change-to-60hz obj a1-1) ) (((progress-screen pal-now-60hz)) (draw-pal-now-60hz obj a1-1) ) (((progress-screen no-disc)) (draw-no-disc obj a1-1) ) (((progress-screen bad-disc)) (draw-bad-disc obj a1-1) ) (((progress-screen quit) (progress-screen quit-title)) (draw-quit obj a1-1) ) (((progress-screen memcard-disable-auto-save)) (draw-memcard-disable-auto-save obj a1-1) ) (((progress-screen memcard-auto-save-disabled)) (draw-memcard-auto-save-disabled obj a1-1) ) (((progress-screen speedrun-options)) (draw-memcard-speedrun-options obj a1-1) ) ) ) ) 0 (none) ) ;; override the post handler for progress-normal (set! (-> progress-normal post) (lambda :behavior progress () (when (progress-scrolling?) (seek! (-> *progress-scroll* transition) 1.0 (* (/ 1.75 512) (-> self transition-speed) (-> *display* time-adjust-ratio))) ) (when (!= (-> self display-state) (-> *progress-scroll* last-screen)) (progress-scroll-reset) (set! (-> *progress-scroll* last-screen) (-> self display-state)) ) ;; draw the menus!! (let* ((a1-0 (-> self display-level-index)) (gp-0 (-> *level-task-data* a1-0)) (unk #t) (stats? #f) ) (case (-> self display-state) (((progress-screen fuel-cell)) (set! stats? #t) (draw-fuel-cell-screen self a1-0) ) (((progress-screen money)) (set! stats? #t) (draw-money-screen self a1-0) ) (((progress-screen buzzer)) (set! stats? #t) (draw-buzzer-screen self a1-0) ) (((progress-screen graphic-settings) (progress-screen settings-title) (progress-screen title) (progress-screen sound-settings) (progress-screen accessibility-options) (progress-screen game-ps2-options) (progress-screen resolution) (progress-screen aspect-ratio) (progress-screen secrets) (progress-screen cheats) (progress-screen monitor) ) (hide-progress-icons) (draw-options self 115 25 0.82) ) (((progress-screen settings) (progress-screen settings-title) ) (hide-progress-icons) (draw-options self 115 25 0.78) ) (((progress-screen misc-options)) (hide-progress-icons) (draw-options self 115 25 0.79) ) (((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 speedrun-options)) (hide-progress-icons) (draw-notice-screen self) (draw-options self 155 25 0.65) ) (((progress-screen camera-options) (progress-screen checkpoint-select) (progress-screen speedrun-il-options) (progress-screen speedrun-cat-ext-options)) ;; camera options lines are a bit too big (hide-progress-icons) (draw-options self 115 25 0.65) ) (((progress-screen gfx-ps2-options)) (hide-progress-icons) (draw-options self 115 25 0.67) ) (((progress-screen game-settings)) (hide-progress-icons) (draw-options self 115 25 0.70) ) (((progress-screen memcard-removed) (progress-screen memcard-auto-save-error)) (draw-notice-screen self) (draw-options self 192 0 0.82) ) (((progress-screen memcard-no-data) (progress-screen memcard-auto-save-disabled)) (draw-notice-screen self) (draw-options self 165 0 0.82) ) (((progress-screen memcard-format)) (draw-notice-screen self) (draw-options self 172 0 0.82) ) (((progress-screen memcard-no-space) (progress-screen memcard-not-inserted) (progress-screen memcard-not-formatted) ) (draw-notice-screen self) (draw-options self 195 0 0.82) ) (((progress-screen memcard-error-loading) (progress-screen memcard-error-saving) (progress-screen memcard-error-formatting) (progress-screen memcard-error-creating) (progress-screen memcard-auto-save-error) (progress-screen auto-save) (progress-screen load-game) (progress-screen save-game) ) (draw-notice-screen self) (draw-options self 190 0 0.82) ) (((progress-screen no-disc) (progress-screen bad-disc)) (draw-notice-screen self) (if (is-cd-in?) (draw-options self 170 0 0.82) ) ) (((progress-screen quit) (progress-screen quit-title) (progress-screen memcard-disable-auto-save)) (draw-notice-screen self) (draw-options self 110 0 0.82) ) (((progress-screen memcard-insert)) (draw-notice-screen self) (draw-options self 165 0 0.82) ) (((progress-screen memcard-data-exists)) (draw-notice-screen self) (draw-options self 168 0 0.82) ) (((progress-screen memcard-loading) (progress-screen memcard-saving) (progress-screen memcard-formatting) (progress-screen memcard-creating) ) (draw-notice-screen self) ) (((progress-screen save-game-title)) (draw-notice-screen self) (draw-options self 169 15 0.6) ) ) (when stats? (let* ((v1-98 (cond ((-> self stat-transition) 0) ((= (-> self level-transition) 1) (- (-> self transition-offset))) (else (-> self transition-offset)) )) (f30-0 (the-as float (if (-> self stat-transition) 1.0 (-> self transition-percentage-invert) ))) (s5-1 (new 'stack 'font-context *font-default-matrix* (- 32 (-> self left-x-offset)) (the int (* (+ 42.0 (the float (/ v1-98 2))) f30-0)) 8325000.0 (font-color lighter-lighter-blue) (font-flags shadow kerning) )) ) (set-width! s5-1 328) (set-height! s5-1 45) (set! (-> s5-1 flags) (font-flags shadow kerning middle left large)) (print-game-text-scaled (lookup-text! *common-text* (-> gp-0 level-name-id) #f) f30-0 s5-1 (the int (* 128.0 f30-0))) ) ) ) (case (-> self display-state) (((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer)) (draw-progress self) ) ) (adjust-sprites self) (adjust-icons self) (none) )) ;; override the enter handler for progress-going-out (set! (-> progress-going-out enter) (lambda :behavior progress () (sound-play "menu-close") (hide-progress-icons) (remove-setting! 'music) (apply-settings *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) (set! (-> self particles 32 init-pos x) -320.0) (set! (-> self particles 33 init-pos x) -320.0) (case (-> self display-state) (((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title)) (set! (-> self transition-speed) 30.0) ) ) (none) )) ;; these need to be overridden as well (set! (-> progress-going-out post) (-> progress-normal post)) (set! (-> progress-coming-in post) (-> progress-normal post)) ;; override this as well... (set! (-> progress-normal code) (lambda :behavior progress () (loop (when (and (cpad-hold? 0 l1) (cpad-hold? 0 r1) *cheat-mode*) (when (and (< (-> self task-index) (-> *level-task-data* (-> self display-level-index) nb-of-tasks)) (>= (-> self task-index) 0) ) (let ((gp-0 (-> *level-task-data* (-> self display-level-index) task-info (-> self task-index) task-id))) (close-specific-task! gp-0 (task-status need-resolution)) (send-event *target* 'get-pickup (pickup-type fuel-cell) (the float gp-0)) ) ) ) (if (and (= (-> self display-state) (-> self next-display-state)) (= (-> self display-level-index) (-> self next-level-index)) ) (seekl! (-> self transition-offset) 0 (* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) (if (or (-> self stat-transition) (nonzero? (-> self level-transition))) 2 1 ) ) ) (seekl! (-> self transition-offset) 512 (* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio))) (if (or (-> self stat-transition) (nonzero? (-> self level-transition))) 2 1 ) ) ) ) (set-transition-progress! self (-> self transition-offset)) (set! (-> self in-transition) (or (-> self force-transition) (nonzero? (-> self transition-offset)))) (when (and (not (handle->process (-> *game-info* auto-save-proc))) (or (-> self force-transition) (-> self in-transition)) (>= (-> self transition-offset) (if (and (zero? (-> self level-transition)) (nonzero? (-> self next-display-state)) (!= (-> self next-display-state) 1) (!= (-> self next-display-state) 2) ) 512 256 ) ) ) (if (>= (the-as int (-> self next-display-state)) 0) (enter! self (-> self next-display-state) 0) (pop! self) ) (set! (-> self display-level-index) (-> self next-level-index)) (when (nonzero? (-> self level-transition)) (set! (-> self task-index) (get-next-task-up -1 (-> self display-level-index))) (case (-> self level-transition) ((1) (set! (-> self level-transition) 2) ) ((2) (set! (-> self level-transition) 1) ) ) ) (set! (-> self force-transition) #f) ) (when (zero? (-> self transition-offset)) (set! (-> self stat-transition) #f) (set! (-> self level-transition) 0) 0 ) (let ((gp-1 #f)) (let ((v1-62 #f)) (case (-> self display-state) (((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer)) (let ((s5-0 (-> self display-level-index))) (when (and (< (mod (-> *display* real-frame-counter) (seconds 0.2)) (seconds 0.1)) (zero? (-> *progress-process* 0 in-out-position)) (not (-> self in-transition)) (zero? (-> self transition-offset)) ) (set! gp-1 (!= s5-0 (get-next-level-up s5-0))) (set! v1-62 (!= s5-0 (get-next-level-down s5-0))) ) ) ) ) (set! (-> self particles 3 init-pos x) (the float (if v1-62 (- 195 (-> *progress-process* 0 left-x-offset)) -320 ) ) ) ) (set! (-> self particles 4 init-pos x) (the float (if gp-1 (- 195 (-> *progress-process* 0 left-x-offset)) -320 ) ) ) ) (respond-common self) (set! (-> self next-display-state) (set-memcard-screen self (-> self next-display-state))) (let ((v1-74 (-> self display-state))) (cond ((or (= v1-74 (progress-screen fuel-cell)) (or (= v1-74 (progress-screen money)) (= v1-74 (progress-screen buzzer))) ) (respond-progress self) ) ((or (= v1-74 (progress-screen memcard-no-space)) (= v1-74 (progress-screen memcard-format)) (= v1-74 (progress-screen memcard-data-exists)) (= v1-74 (progress-screen memcard-insert)) (= v1-74 (progress-screen load-game)) (= v1-74 (progress-screen save-game)) (= v1-74 (progress-screen save-game-title)) (= v1-74 (progress-screen memcard-error-loading)) (= v1-74 (progress-screen memcard-error-saving)) (= v1-74 (progress-screen memcard-error-formatting)) (= v1-74 (progress-screen memcard-error-creating)) (= v1-74 (progress-screen memcard-auto-save-error)) (= v1-74 (progress-screen memcard-removed)) (= v1-74 (progress-screen memcard-no-data)) (= v1-74 (progress-screen memcard-not-inserted)) (= v1-74 (progress-screen memcard-not-formatted)) (= v1-74 (progress-screen auto-save)) (= v1-74 (progress-screen pal-change-to-60hz)) (= v1-74 (progress-screen pal-now-60hz)) (= v1-74 (progress-screen no-disc)) (= v1-74 (progress-screen bad-disc)) (= v1-74 (progress-screen quit)) (= v1-74 (progress-screen quit-title)) (= v1-74 (progress-screen memcard-auto-save-disabled)) (= v1-74 (progress-screen memcard-disable-auto-save)) ) (respond-memcard self) ) ) ) (suspend) ) (none) ) )