;;-*-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. |# (#when PC_PORT ;;--------------------------- ;;--------------------------- ;; 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)))) ;; ############################ ;; 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)) (define *carousell-display-mode* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 (game-text-id windowed) (game-text-id fullscreen) (game-text-id borderless) )) (define *carousell-msaa* (new 'static 'boxed-array :type game-text-id :length 5 :allocated-length 5 (game-text-id off) (game-text-id 2-times) (game-text-id 4-times) (game-text-id 8-times) (game-text-id 16-times) )) (define *carousell-lod-bg* (new 'static 'boxed-array :type game-text-id :length 2 :allocated-length 2 (game-text-id lod-high) (game-text-id lod-low) )) (define *carousell-lod-fg* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 (game-text-id lod-high) (game-text-id lod-low) (game-text-id lod-ps2) )) (define *carousell-subtitle-language* (new 'static 'boxed-array :type game-text-id :length 6 :allocated-length 6 (game-text-id english) (game-text-id french) (game-text-id german) (game-text-id spanish) (game-text-id italian) (game-text-id japanese) )) (define *carousell-speaker* (new 'static 'boxed-array :type game-text-id :length 3 :allocated-length 3 (game-text-id speaker-always) (game-text-id speaker-never) (game-text-id speaker-auto) )) ;;--------------------------- ;;--------------------------- ;; pc menu defines (define *game-options-pc* (new 'static 'boxed-array :type game-option :length 6 :allocated-length 6 (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id vibrations) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id play-hints) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id camera-options) :scale #t :param3 (game-option-menu camera-options)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id accessibility-options) :scale #t :param3 (game-option-menu accessibility-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 :length 8 :allocated-length 9 (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id game-resolution) :scale #t :param3 (game-option-menu resolution)) (new 'static 'game-option :option-type (game-option-type display-mode) :name (game-text-id display-mode) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-native) :name (game-text-id ps2-aspect-ratio) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-ratio) :name (game-text-id aspect-ratio-ps2) :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 *misc-options* (new 'static 'boxed-array :type game-option :length 2 :allocated-length 2 (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id discord-rpc) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *camera-options* (new 'static 'boxed-array :type game-option :length 3 :allocated-length 3 (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-horz) :scale #t) (new 'static 'game-option :option-type (game-option-type normal-inverted) :name (game-text-id camera-controls-vert) :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 :length 2 :allocated-length 2 (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id money-starburst) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) (define *gfx-ps2-options* (new 'static 'boxed-array :type game-option :length 4 :allocated-length 4 (new 'static 'game-option :option-type (game-option-type lod-bg) :name (game-text-id lod-bg) :scale #t) (new 'static 'game-option :option-type (game-option-type lod-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 button) :name (game-text-id back) :scale #t) ) ) (define *aspect-ratio-options* (new 'static 'boxed-array :type game-option :length 6 :allocated-length 6 (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id fit-to-screen) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-fmt) :param1 4.0 :param2 3.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-fmt) :param1 16.0 :param2 9.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-fmt) :param1 21.0 :param2 9.0 :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-new) :name (game-text-id resolution-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 :length 9 :allocated-length 9 (new 'static 'game-option :name (game-text-id sfx-volume) :scale #t :param2 100.0) (new 'static 'game-option :name (game-text-id music-volume) :scale #t :param2 100.0) (new 'static 'game-option :name (game-text-id speech-volume) :scale #t :param2 100.0) (new 'static 'game-option :option-type (game-option-type language) :name (game-text-id language) :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-subtitles) :name (game-text-id subtitles-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 button) :name (game-text-id back) :scale #t) ) ) (define *back-button* (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t)) (define-perm *temp-options-alloced* symbol #f) (defconstant RESOLUTIONS 6) (define *resolutions* (new 'static 'array int32 RESOLUTIONS 640 720 768 800 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)) (the (pointer int32) 0)) (if (> sy sx) (set! sy sx)) (until found (dotimes (i RESOLUTIONS) (let ((thisr (the int (* mult (the float (-> *resolutions* i)))))) (cond ((< sy thisr) (if (zero? i) (*! mult 0.5)) (set! i RESOLUTIONS) (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-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) (vmodes 0) (flip? #f) (aspect 0.0) ;; hack - do not use screen resolution in windowed mode, taskbar etc. messes it up and makes it useless! (skip? (= 'windowed (pc-get-fullscreen))) ;; shortcut (max-options (1- (-> *temp-options* allocated-length)))) ;; portrait mode. unused (set! flip? (> sy sx)) ;; get screen size (for capping) (pc-get-screen-size -1 (the (pointer int32) (& sx)) (the (pointer int32) (& sy)) (the (pointer int32) (& vmodes))) (case (pc-get-fullscreen) (('fullscreen) ;; insert psyched out trollface here (set! sx 0) (set! sy 0) (countdown (i vmodes) (let ((thisx 0) (thisy 0)) (pc-get-screen-size i (the (pointer int32) (& thisx)) (the (pointer int32) (& thisy)) (the (pointer int32) 0)) (when (not (and (= thisx sx) (= thisy sy))) (add-resolution-option thisx thisy) ) (set! sx thisx) (set! sy thisy) ) ) ) (else ;; 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)) ) ;; game aspect ratio (set! aspect (-> *pc-settings* aspect-ratio)) (until (or done? (= (length *temp-options*) max-options)) (countdown (i RESOLUTIONS) (let ((thisr (the int (* mult (the float (-> *resolutions* i)))))) (when (and (< (length *temp-options*) max-options) (<= thisr sy) (not skip?)) (add-resolution-option (* aspect (the float thisr)) thisr) )) (false! skip?) ) (if (> mult GAME_MIN_RES_MULT) (*! mult 0.5) (true! done?)) ) ) ) (add-back-option) ) *temp-options* ) (defun print-string-in-carousell ((arg0 game-text-id) (arg1 font-context) (arg2 int) (arg3 symbol)) (let ((s5-0 (if arg3 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) ) (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) ) ) ) ) (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) ) ;; set up options for each screen (set! (-> *options-remap* (progress-screen settings)) *main-options*) (set! (-> *options-remap* (progress-screen game-settings)) *game-options-pc*) (set! (-> *options-remap* (progress-screen graphic-settings)) *graphic-options-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*) (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 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! (-> *graphic-title-options-pal* 1 value-to-modify) (&-> *progress-state* video-mode-choice)) (set! (-> *graphic-title-options-pal* 2 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) (set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) (set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume)) (set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) (set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice)) ;; 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! (-> *graphic-options-pc* 1 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 2 value-to-modify) (&-> *progress-carousell* aspect-native-choice)) (set! (-> *graphic-options-pc* 3 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) (set! (-> *graphic-options-pc* 5 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *misc-options* 0 value-to-modify) (&-> *pc-settings* discord-rpc?)) (set! (-> *camera-options* 0 value-to-modify) (&-> *pc-settings* camera-hflip?)) (set! (-> *camera-options* 1 value-to-modify) (&-> *pc-settings* camera-vflip?)) (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! (-> *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)) (set! (-> *sound-options-pc* 3 value-to-modify) (&-> *setting-control* default language)) (set! (-> *sound-options-pc* 4 value-to-modify) (&-> *pc-settings* subtitles?)) (set! (-> *sound-options-pc* 5 value-to-modify) (&-> *pc-settings* hinttitles?)) (set! (-> *sound-options-pc* 6 value-to-modify) (&-> *progress-carousell* subtitle-backup)) (set! (-> *sound-options-pc* 7 value-to-modify) (&-> *progress-carousell* int-backup)) (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) ) ) ;; 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-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) ) (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) (cond ((> (-> obj option-index) 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-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t) ) (set! (-> obj last-option-index-change) (-> *display* real-frame-counter)) (cond ((< (-> obj option-index) (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)) ;; 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. broken in original game. (if (= (-> options (-> obj option-index) value-to-modify) (&-> *setting-control* default 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) ) ;; 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) ) (((game-option-type language-subtitles)) ;; a carousell like language (if (> (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (the-as pc-subtitle-lang 0)) (+! (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (the-as pc-subtitle-lang -1)) (set! (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (the-as pc-subtitle-lang (1- (length (-> *progress-carousell* current-carousell))))) ) ;; updated. (set! (-> *progress-carousell* transition) #t) (set! (-> *progress-carousell* direction) #t) (set! sound? #t) ) ) (if sound? (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t) ) ) ) ) (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-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 vol)) 0 0 1 #t) ) ) ) ) ) ) ) ) ((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) ) ;; 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) ) ;; 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) ) (((game-option-type language-subtitles)) ;; same thing as before. if at last, go to first. otherwise, keep going forward. (if (< (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (1- (length (-> *progress-carousell* current-carousell)))) (+! (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (the-as pc-subtitle-lang 1)) (set! (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (the-as pc-subtitle-lang 0)) ) (set! (-> *progress-carousell* transition) #t) (set! (-> *progress-carousell* direction) #f) (set! sound? #t) ) ) ;; play sound if desired (if sound? (sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t) ) ) ) ) (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-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 vol)) 0 0 1 #t) ) ) ) ) ) ) ) ) ((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-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) (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-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t) (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) ) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ) ((or (cpad-pressed? 0 x) (cpad-pressed? 0 circle)) ;; pressed x or circle. advance! (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) (push! obj) (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) (set! (-> obj next-display-state) (the-as progress-screen (-> 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-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t) (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) ) (load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index)) (set! (-> obj next-display-state) (progress-screen invalid)) ) ) ;; other behaviors are hardcoded elsewhere because screw you. ) ((= (-> 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) (cpad-clear! 0 square) (cpad-clear! 0 triangle) (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) (set! (-> obj next-display-state) (progress-screen invalid)) ) ((= (-> options (-> obj option-index) option-type) (game-option-type aspect-new)) ;; resolution button. change resolution! (let ((newx (the int (-> options (-> obj option-index) param1))) (newy (the int (-> options (-> obj option-index) param2)))) (if (= (-> options (-> obj option-index) name) (game-text-id fit-to-screen)) (true! (-> *pc-settings* aspect-ratio-auto?)) (set-aspect! *pc-settings* newx newy))) (cpad-clear! 0 x) (cpad-clear! 0 circle) (cpad-clear! 0 square) (cpad-clear! 0 triangle) (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) (set! (-> obj next-display-state) (progress-screen invalid)) ) ((!= (-> 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 language-subtitles)) (set! (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))) (-> *pc-settings* subtitle-language)) ) (((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 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)) ) ) ) (sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t) (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 language-subtitles)) (set! (-> *progress-carousell* current-carousell) *carousell-subtitle-language*) (set! (-> *progress-carousell* selection) (the int (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))))) ) ) ) ) ) ) ) (else ;; an option was selected. write stuff! (sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t) (set! (-> obj selected-option) #f) (case (-> options (-> obj option-index) option-type) (((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)) (if (not (-> obj language-transition)) (load-level-text-files (-> obj display-level-index))) ) (((game-option-type language-subtitles)) (set! (-> *pc-settings* subtitle-language) (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify)))) ) (((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)) ) ) ) ) ) ) ) ) ) (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))) ) ;; 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)) ;; 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 ))) ) (dotimes (index (length options)) (let ((option-str (the string #f)) ;; the option text (option-x 17) (option-y y-off) ) (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 (the-as string #f)) ) ) (((game-option-type resolution) (game-option-type aspect-new)) ;; resolution settings (set! option-str (string-format (lookup-text! *common-text* (-> options index name) #f) (the int (-> options index param1)) (the int (-> options index param2)))) ) (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 int 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 normal) #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 inverted) #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 display-mode) (game-option-type msaa) (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) ) ;; 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-subtitles)) ;; crunched down to one generic function. (progress-draw-carousell-from-string-list (-> *progress-carousell* current-carousell) font y-off (the int (-> (the-as (pointer pc-subtitle-lang) (-> 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) ) (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) ) ) ) ) (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) ) ;; 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 normal-inverted)) ;; etc (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 normal) #f) (lookup-text! *common-text* (game-text-id inverted) #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)) (let ((stupidity (the int (-> (the-as (pointer pc-subtitle-lang) (-> options index value-to-modify)))))) (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) (lookup-text! *common-text* (-> *carousell-subtitle-language* stupidity) #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 (if (and (= index (-> obj option-index)) (not (or (progress-scrolling?) (-> obj in-transition)))) (font-color yellow-green-2) (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) ) ;; override the post handler for progress-normal (set! (-> progress-normal post) (lambda :behavior progress () ;; scroll stuff TODO time ratio (when (progress-scrolling?) (seek! (-> *progress-scroll* transition) 1.0 (* 1.75 (1/ 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 game-settings) (progress-screen settings) (progress-screen misc-options) (progress-screen accessibility-options) (progress-screen game-ps2-options) (progress-screen resolution) (progress-screen aspect-ratio) ) (hide-progress-icons) (draw-options self 115 25 0.82) ) (((progress-screen camera-options)) ;; camera options lines are a bit too big (hide-progress-icons) (draw-options self 115 36 0.77) ) (((progress-screen gfx-ps2-options)) (hide-progress-icons) (draw-options self 115 25 0.72) ) (((progress-screen sound-settings)) (hide-progress-icons) (draw-options self 115 25 0.76) ) (((progress-screen memcard-removed) (progress-screen memcard-auto-save-error)) (draw-notice-screen self) (draw-options self 192 0 0.82) ) (((progress-screen memcard-no-data)) (draw-notice-screen self) (draw-options self 165 0 0.82) ) (((progress-screen memcard-format)) (draw-notice-screen self) (draw-options self 172 0 0.82) ) (((progress-screen memcard-no-space) (progress-screen memcard-not-inserted) (progress-screen memcard-not-formatted) ) (draw-notice-screen self) (draw-options self 195 0 0.82) ) (((progress-screen memcard-error-loading) (progress-screen memcard-error-saving) (progress-screen memcard-error-formatting) (progress-screen memcard-error-creating) (progress-screen memcard-auto-save-error) (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)) (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-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t) (hide-progress-icons) (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) )) )