Files
jak-project/goal_src/jak2/engine/ui/progress/progress.gc
ManDude 349919f788 [jak2] implement pc cheats in menu (#3275)
Adds the opengoal cheats to the secrets menu. Only cheats that are fully
functional and unlockable are there right now, which is eight cheats.

This update will reset most Jak 2 settings.

Also fixes #3274 .
2023-12-28 11:14:10 +00:00

3830 lines
140 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: progress.gc
;; name in dgo: progress
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(deftype progress-global-state (basic)
((aspect-ratio-choice symbol)
(video-mode-choice symbol)
(yes-no-choice symbol)
(on-off-choice symbol)
(which-slot int32)
(starting-state symbol)
(last-slot-saved int32)
(slider-backup float)
(language-backup language-enum)
(center-x-backup int32)
(center-y-backup int32)
(aspect-ratio-backup symbol)
(last-slider-sound time-frame)
(video-mode-timeout time-frame)
(progressive-mode-timeout time-frame)
(current-task-index int32)
(current-line-index int32)
(first-closed-line-index int32)
(extra-text-state int32)
(current-task uint8)
(num-open-tasks-found int32)
(num-closed-tasks-found int32)
(color-flash-counter int32)
(num-unlocked-secrets int32)
(game-options-item-selected int32)
(game-options-item-picked basic)
(game-options-last-move time-frame)
(game-options-vibrations symbol)
(game-options-subtitles symbol)
(game-options-language-index int32)
(game-options-subtitle-language-index int32)
(graphic-options-item-selected int32)
(graphic-options-item-picked symbol)
(graphic-options-last-move time-frame)
(graphic-options-aspect-ratio symbol)
(graphic-options-progressive-scan symbol)
(qr-options-item-selected int32)
(qr-options-item-picked basic)
(qr-options-last-move time-frame)
(qr-options-restart basic)
(qr-options-quit basic)
(total-num-tasks int32)
(scene-player-act int32)
(stereo-mode-backup int32)
(secrets-unlocked symbol)
(missions-total-spacing float)
(clear-screen symbol)
)
)
(define *progress-stack* (the-as (pointer uint8) (malloc 'global DPROCESS_STACK_SIZE)))
(define *progress-process* (the-as (pointer progress) #f))
(define *progress-state* (new 'static 'progress-global-state :which-slot -1 :last-slot-saved -1))
(kmemopen global "mc-slot-info")
(define *progress-save-info* (new 'global 'mc-slot-info))
(kmemclose)
(defun min-max-wrap-around ((arg0 int) (arg1 int) (arg2 int))
(let ((v1-2 (+ (- 1 arg1) arg2)))
(while (< arg0 arg1)
(+! arg0 v1-2)
)
(while (< arg2 arg0)
(set! arg0 (- arg0 v1-2))
)
)
arg0
)
(defun progress-intro-start ((hero-mode? symbol))
(set! (-> *game-info* mode) 'play)
(cond
;; Start a new game differently if speedrunning mode is active
((= (-> *pc-settings* speedrunner-mode?) #t)
(if hero-mode?
(set-category! *speedrun-info* (speedrun-category newgame-heromode))
(set-category! *speedrun-info* (speedrun-category newgame-normal)))
(start-run! *speedrun-info*))
;; start the game normally
(else
(if hero-mode?
(initialize! *game-info* 'game (the-as game-save #f) "intro-start-hero")
(initialize! *game-info* 'game (the-as game-save #f) "intro-start"))))
(set-master-mode 'game)
0)
(defmethod init-defaults ((this progress))
"Initialize default menu settings."
(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! (-> *progress-state* on-off-choice) #f)
(set! (-> *progress-state* color-flash-counter) 0)
(set! (-> *progress-state* game-options-item-selected) 0)
(set! (-> *progress-state* game-options-item-picked) #f)
(set! (-> *progress-state* game-options-vibrations) (-> *setting-control* user-default vibration))
(set! (-> *progress-state* game-options-subtitles) (-> *setting-control* user-default subtitle))
(set! (-> *progress-state* game-options-language-index)
(the-as int (-> *setting-control* user-default language))
)
(set! (-> *progress-state* game-options-subtitle-language-index)
(the-as int (-> *setting-control* user-default subtitle-language))
)
(set! (-> *progress-state* graphic-options-item-selected) 0)
(set! (-> *progress-state* graphic-options-item-picked) #f)
(set! (-> *progress-state* graphic-options-aspect-ratio) (get-aspect-ratio))
(set! (-> *progress-state* graphic-options-progressive-scan)
(-> *setting-control* user-default use-progressive-scan)
)
(set! (-> *progress-state* qr-options-item-selected) 0)
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> *progress-state* total-num-tasks) 0)
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> *progress-state* clear-screen) #f)
(set! (-> this sliding) 0.0)
(set! (-> this sliding-height) 0.0)
(set! (-> this sliding-off) 1.0)
(set! (-> this scanlines-alpha) 0.0)
(set! (-> (the-as menu-on-off-game-vibrations-option (-> *game-options* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-game-subtitles-option (-> *game-options* options 1)) value-to-modify)
(&-> *setting-control* user-default subtitle)
)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-selection)
(-> *setting-control* user-current language)
)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-direction) #t)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-transition) #f)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-x-offset) 0)
(set! (-> (the-as menu-on-off-option (-> *game-options-japan* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-option (-> *game-options-demo* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-option (-> *graphic-options* options 2)) value-to-modify)
(&-> *setting-control* user-default use-progressive-scan)
)
(set! (-> (the-as menu-on-off-option (-> *graphic-title-options-pal* options 2)) value-to-modify)
(&-> *setting-control* user-default use-progressive-scan)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 0)) value-to-modify)
(&-> *setting-control* user-default sfx-volume)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 1)) value-to-modify)
(&-> *setting-control* user-default music-volume)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 2)) value-to-modify)
(&-> *setting-control* user-default dialog-volume)
)
(set! (-> (the-as menu-missions-option (-> *missions-options* options 0)) task-line-index) 0)
(set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0)
)
(deftype hud-ring-cell (process-drawable)
((parent (pointer progress) :override)
(joint-idx int32)
(init-angle degrees)
(graphic-index int32)
)
(:state-methods
idle
)
)
(defbehavior hud-ring-cell-init-by-other hud-ring-cell ((arg0 int) (arg1 float) (arg2 int))
(set! (-> self root) (new 'process 'trsqv))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-hud-ring-part" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(logclear! (-> self mask) (process-mask actor-pause))
(set! (-> self joint-idx) arg0)
(set! (-> self init-angle) arg1)
(set! (-> self graphic-index) arg2)
(set! (-> self root trans quad) (-> self parent 0 root trans quad))
(quaternion-copy! (-> self root quat) (-> self parent 0 root quat))
(quaternion-normalize! (-> self root quat))
(set! (-> self root scale quad) (-> self parent 0 root scale quad))
(let ((gp-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *z-vector* (-> self init-angle))))
(quaternion-normalize! gp-1)
(quaternion*! (-> self root quat) (-> self root quat) gp-1)
)
(quaternion-normalize! (-> self root quat))
(set! (-> self draw color-mult x) 0.8)
(set! (-> self draw color-mult y) 0.8)
(set! (-> self draw color-mult z) 0.8)
(logior! (-> self draw global-effect) (draw-control-global-effect title-light))
(logior! (-> self draw status) (draw-control-status hud))
(setup-masks (-> self draw) 1 0)
(setup-masks (-> self draw) 0 2046)
(cond
((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk))
(setup-masks
(-> self draw)
(the-as
int
(-> *hud-ring-kiosk-graphic-remap*
(mod (+ (-> self graphic-index) (-> self parent 0 graphic-index)) (-> *hud-ring-kiosk-graphic-remap* length))
)
)
0
)
)
((and (= *cheat-mode* #f) (demo?))
(setup-masks
(-> self draw)
(the-as
int
(-> *hud-ring-demo-graphic-remap*
(mod (+ (-> self graphic-index) (-> self parent 0 graphic-index)) (-> *hud-ring-kiosk-graphic-remap* length))
)
)
0
)
)
(else
(setup-masks
(-> self draw)
(the-as
int
(-> *hud-ring-graphic-remap*
(mod (+ (-> self graphic-index) (-> self parent 0 graphic-index)) (-> *hud-ring-graphic-remap* length))
)
)
0
)
)
)
(go-virtual idle)
)
(defstate idle (hud-ring-cell)
:virtual #t
:code (behavior ()
(until #f
(ja :num-func num-func-identity :frame-num 0.0)
(suspend)
)
#f
)
:post (behavior ()
(vector<-cspace!
(-> self root trans)
(-> (the-as progress (-> self parent 0)) node-list data (-> self joint-idx))
)
(when (-> (the-as progress (-> self parent 0)) main-menu)
(setup-masks (-> self draw) 0 2046)
(cond
((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk))
(setup-masks
(-> self draw)
(the-as int (-> *hud-ring-kiosk-graphic-remap*
(mod
(+ (-> self graphic-index) (-> (the-as progress (-> self parent 0)) graphic-index))
(-> *hud-ring-kiosk-graphic-remap* length)
)
)
)
0
)
)
((and (= *cheat-mode* #f) (demo?))
(setup-masks
(-> self draw)
(the-as int (-> *hud-ring-demo-graphic-remap*
(mod
(+ (-> self graphic-index) (-> (the-as progress (-> self parent 0)) graphic-index))
(-> *hud-ring-kiosk-graphic-remap* length)
)
)
)
0
)
)
(else
(setup-masks
(-> self draw)
(the-as int (-> *hud-ring-graphic-remap*
(mod
(+ (-> self graphic-index) (-> (the-as progress (-> self parent 0)) graphic-index))
(-> *hud-ring-graphic-remap* length)
)
)
)
0
)
)
)
)
(when (= (-> self init-angle) 0.0)
(cond
((= (-> (the-as progress (-> self parent 0)) ring-angle)
(-> (the-as progress (-> self parent 0)) ring-want-angle)
)
(set! (-> self draw color-mult x) 1.2)
(set! (-> self draw color-mult y) 1.2)
(set! (-> self draw color-mult z) 1.2)
)
(else
(set! (-> self draw color-mult x) 0.8)
(set! (-> self draw color-mult y) 0.8)
(set! (-> self draw color-mult z) 0.8)
)
)
)
(let* ((t9-6 quaternion-vector-angle!)
(a0-8 (new 'stack-no-clear 'quaternion))
(a1-26 *z-vector*)
(f0-8 (-> self init-angle))
(f1-2 (-> (the-as progress (-> self parent 0)) ring-angle))
(gp-0 (t9-6 a0-8 a1-26 (+ f0-8 (- f1-2 (* (the float (the int (/ f1-2 6553.6))) 6553.6)))))
)
(quaternion-normalize! gp-0)
(quaternion-copy! (-> self root quat) (-> (the-as progress (-> self parent 0)) root quat))
(quaternion-normalize! (-> self root quat))
(quaternion*! (-> self root quat) (-> self root quat) gp-0)
)
(quaternion-normalize! (-> self root quat))
(ja-post)
)
)
(defbehavior progress-init-by-other progress ((arg0 symbol))
(hide-hud #f)
(disable-level-text-file-loading)
(logclear! (-> self mask) (process-mask menu progress actor-pause))
(add-setting! 'process-mask 'set 0.0 (process-mask progress))
(set! (-> self clock) (-> *display* real-clock))
(apply-settings *setting-control*)
(set-blackout-frames 0)
(set! *pause-lock* #f)
(set! (-> self root) (new 'process 'trsqv))
(matrix->quaternion (-> self root quat) (-> *math-camera* inv-camera-rot))
(let ((a2-2 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* 32768.0)))
(quaternion*! (-> self root quat) (-> self root quat) a2-2)
)
(quaternion-normalize! (-> self root quat))
(quaternion-copy! (-> self init-quat) (-> self root quat))
(set-vector! (-> self root scale) 0.09 0.09 0.09 1.0)
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-hud-ring" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(logior! (-> self draw global-effect) (draw-control-global-effect title-light))
(logior! (-> self skel status) (joint-control-status sync-math))
(set! (-> self state-pos) 0)
(set! (-> self menu-transition) 1.0)
(set! (-> self anim-frame) 0.0)
(set! (-> self pos-transition) 1.0)
(init-defaults self)
(set-next-state self arg0 0)
(set! (-> *progress-state* starting-state) (-> self next))
(set! (-> self current) (-> self next))
(if (= arg0 'main)
(set! (-> self next) 'none)
)
(set! (-> self ring-angle) 0.0)
(set! (-> self ring-want-angle) 0.0)
(set! (-> self option-index) 0)
(set! (-> self want-option-index) 0)
(set! (-> self graphic-index) 0)
(set! (-> self swing) 0.0)
(set! (-> self main-menu) #f)
(set-menu-options self (-> self current))
(logior! (-> self draw status) (draw-control-status hud))
(let ((f30-0 -6571.804))
(process-spawn hud-ring-cell 15 (* 0.0 f30-0) 0 :to self)
(process-spawn hud-ring-cell 9 f30-0 1 :to self)
(process-spawn hud-ring-cell 8 (* 2.0 f30-0) 2 :to self)
(process-spawn hud-ring-cell 7 (* 3.0 f30-0) 3 :to self)
(process-spawn hud-ring-cell 6 (* 4.0 f30-0) 4 :to self)
(process-spawn hud-ring-cell 16 (* -5.0 f30-0) 5 :to self)
(process-spawn hud-ring-cell 14 (* -4.0 f30-0) 6 :to self)
(process-spawn hud-ring-cell 13 (* -3.0 f30-0) 7 :to self)
(process-spawn hud-ring-cell 12 (* -2.0 f30-0) 8 :to self)
(process-spawn hud-ring-cell 11 (* -1.0 f30-0) 9 :to self)
)
(enable-drawing *bigmap*)
(go-virtual come-in)
)
(defun set-ring-position ((arg0 progress))
(let ((s3-0 (new-stack-vector0))
(s4-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
)
(+! (-> s3-0 y) -8.0)
(case (get-aspect-ratio)
(('aspect4x3)
(position-in-front-of-screen! s4-0 12288.0 s3-0)
(position-in-front-of-screen! s5-0 -4096.0 s3-0)
)
(else
(position-in-front-of-screen! s4-0 16384.0 s3-0)
(position-in-front-of-screen! s5-0 -18022.4 s3-0)
)
)
(vector-! s5-0 s5-0 s4-0)
(set! (-> arg0 root trans x) (+ (-> s4-0 x) (* (-> arg0 pos-transition) (-> s5-0 x))))
(set! (-> arg0 root trans y) (+ (-> s4-0 y) (* (-> arg0 pos-transition) (-> s5-0 y))))
(set! (-> arg0 root trans z) (+ (-> s4-0 z) (* (-> arg0 pos-transition) (-> s5-0 z))))
)
)
(defun activate-progress ((arg0 process) (arg1 symbol))
(when *target*
(when (progress-allowed?)
(when (nonzero? (-> *progress-state* video-mode-timeout))
(set! (-> *progress-state* video-mode-timeout) 0)
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice))
)
(when (nonzero? (-> *progress-state* progressive-mode-timeout))
(set! (-> *progress-state* progressive-mode-timeout) 0)
(set! (-> *setting-control* user-default use-progressive-scan) #f)
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(set-progressive-scan #f)
)
(cond
(*progress-process*
(deactivate (-> *progress-process* 0))
(set! (-> *blit-displays-work* menu-mode) #t)
(set! *progress-process* (process-spawn progress arg1 :to arg0 :stack (&-> *progress-stack* DPROCESS_STACK_SIZE)))
(set-master-mode 'progress)
)
(else
(set! *progress-process* (process-spawn progress arg1 :to arg0 :stack (&-> *progress-stack* DPROCESS_STACK_SIZE)))
(set-master-mode 'progress)
)
)
)
)
0
(none)
)
(defmethod deactivate ((this progress))
(remove-setting-by-arg0 *setting-control* 'extra-bank)
(disable-drawing *bigmap*)
(set! (-> *blit-displays-work* menu-mode) #f)
(set! *progress-process* (the-as (pointer progress) #f))
(enable-level-text-file-loading)
(persist-with-delay *setting-control* 'allow-progress (seconds 0.1) 'allow-progress #f 0.0 0)
(persist-with-delay *setting-control* 'allow-pause (seconds 0.1) 'allow-pause #f 0.0 0)
(call-parent-method this)
(none)
)
(defun deactivate-progress ()
(if *progress-process*
(deactivate (-> *progress-process* 0))
)
0
(none)
)
(defun hide-progress-screen ()
(if (and *progress-process* *progress-state* (!= (-> *progress-state* starting-state) 'title))
(set-next-state (-> *progress-process* 0) 'go-away 0)
)
0
(none)
)
(defmethod gone? ((this progress))
(and *progress-process*
(-> *progress-process* 0 next-state)
(= (-> *progress-process* 0 next-state name) 'gone)
)
)
(defun progress-allowed? ()
(not (or (-> *setting-control* user-current talking)
(-> *setting-control* user-current movie)
(movie?)
(handle->process (-> *game-info* pov-camera-handle))
(handle->process (-> *game-info* other-camera-handle))
(< (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time))
(< (-> *display* base-clock frame-counter) (-> *game-info* blackout-time))
(!= (-> *setting-control* user-current bg-a) 0.0)
(!= (-> *setting-control* user-current bg-a-force) 0.0)
(not (-> *setting-control* user-current allow-progress))
(or (and (handle->process (-> *game-info* auto-save-proc))
(not (send-event (handle->process (-> *game-info* auto-save-proc)) 'progress-allowed?))
)
(not *target*)
(= *cheat-mode* 'camera)
(= *master-mode* 'freeze)
*master-exit*
(not *common-text*)
(< (memory-free *nk-dead-pool*) #x8000)
)
)
)
)
(defmethod can-go-back? ((this progress))
(and (= (-> this menu-transition) 0.0)
(not (-> this selected-option))
(!= (-> this current) 'loading)
(!= (-> this current) 'saving)
(!= (-> this current) 'formatting)
(!= (-> this current) 'creating)
(!= (-> this current) 'error-disc-removed)
(!= (-> this current) 'error-reading)
(!= (-> this current) 'card-removed)
(!= (-> this current) 'error-auto-saving)
(!= (-> this current) 'title)
(!= (-> this current) 'insufficient-space)
(!= (-> this current) 'secrets-insufficient-space)
(!= (-> this current) 'no-memory-card)
(!= (-> this current) 'icon-info)
(!= (-> this current) 'insert-card)
(!= (-> this current) 'progressive-mode-ok)
(!= (-> this current) 'video-mode-ok)
(!= (-> this current) 'progressive-mode-warning)
(!= (-> this current) 'video-mode-warning)
)
)
;; WARN: Return type mismatch symbol vs none.
(defun menu-update-purchase-secrets ((arg0 menu-secret-option))
(let* ((a1-1 (logtest? (-> *game-info* secrets) (game-secrets hero-mode)))
(v1-3 (if (not a1-1)
0
(-> arg0 num-items)
)
)
(a1-3 (if (not a1-1)
(+ (-> arg0 num-items) -1)
(+ (-> arg0 num-items) -1 (-> arg0 num-hero-items))
)
)
)
(while (>= a1-3 v1-3)
(let* ((a2-1 v1-3)
(t0-1 (-> arg0 secret-items a2-1 cost))
(a3-6 (-> arg0 secret-items a2-1 flag))
(t2-1 (-> arg0 secret-items a2-1 avail-after))
(t1-5 (the int (-> *game-info* skill-total)))
)
(when (and (logtest? (-> *game-info* sub-task-list t2-1 flags) (game-task-node-flag closed)) (>= t1-5 t0-1))
(logior! (-> *game-info* purchase-secrets) a3-6)
(if (= (-> arg0 secret-items a2-1 can-toggle) 'auto)
(logior! (-> *game-info* secrets) a3-6)
)
)
)
(+! v1-3 1)
)
)
(none)
)
(defmethod get-state-check-card ((this progress) (arg0 symbol))
(let ((v1-0 *progress-save-info*)
(v0-0 arg0)
)
(when v1-0
(when (and v1-0 (= (-> this menu-transition) 0.0))
(case arg0
(('insufficient-space 'no-memory-card 'unformatted-card)
(cond
((zero? (-> v1-0 handle))
(set! v0-0 'no-memory-card)
)
((zero? (-> v1-0 formatted))
(cond
((or (zero? (-> this state-pos)) (!= (-> *progress-state* starting-state) 'title))
(set! v0-0 'go-away)
)
(else
(if (!= arg0 'unformatted-card)
(set! v0-0 'format-card)
)
)
)
)
((and (zero? (-> v1-0 inited)) (< (-> v1-0 mem-actual) (-> v1-0 mem-required)))
(set! v0-0 'insufficient-space)
)
((or (zero? (-> this state-pos)) (!= (-> *progress-state* starting-state) 'title))
(set! v0-0 'go-away)
)
(else
(set! v0-0 'select-save)
)
)
)
(('insert-card)
(if (= (-> v1-0 inited) 1)
(set! v0-0 'select-load)
)
)
)
(cond
((zero? (-> v1-0 handle))
(cond
((-> *setting-control* user-current auto-save)
(set! v0-0 'card-removed)
)
(else
(case arg0
(('select-load)
(set! v0-0 'insert-card)
)
(('format-card
'insufficient-space
'unformatted-card
'select-save
'select-save-title
'select-save-title-hero
'create-game
'already-exists
)
(set! v0-0 'no-memory-card)
)
)
)
)
)
((zero? (-> v1-0 formatted))
(case arg0
(('select-load)
(set! v0-0 'insert-card)
)
(('select-save 'select-save-title 'select-state-title-hero)
(set! v0-0 'format-card)
)
)
)
((zero? (-> v1-0 inited))
(case arg0
(('select-save 'select-save-title 'select-save-title-hero)
(if (>= (-> v1-0 mem-actual) (-> v1-0 mem-required))
(set! v0-0 'create-game)
(set! v0-0 'insufficient-space)
)
)
(('select-load)
(set! v0-0 'insert-card)
)
)
)
)
)
)
v0-0
)
)
(defmethod push-state ((this progress))
(let ((v1-0 (-> this state-pos)))
(cond
((< v1-0 5)
(set! (-> this state-stack v1-0) (-> this current))
(set! (-> this option-index-stack v1-0) (-> this option-index))
(set! (-> this state-pos) (+ v1-0 1))
)
(else
(format #t "ERROR: Can't push any more states on the state-stack.~%")
)
)
)
0
)
(defmethod pop-state ((this progress))
(let ((v1-0 (-> this state-pos)))
(cond
((> v1-0 0)
(let ((a2-0 (+ v1-0 -1)))
(set! (-> this state-pos) a2-0)
(set-next-state this (-> this state-stack a2-0) (-> this option-index-stack a2-0))
)
)
(else
(set-next-state this 'go-away 0)
)
)
)
(set! (-> *progress-state* game-options-item-selected) 0)
(set! (-> *progress-state* game-options-item-picked) #f)
(set! (-> *progress-state* graphic-options-item-selected) 0)
(set! (-> *progress-state* graphic-options-item-picked) #f)
(set! (-> *progress-state* qr-options-item-selected) 0)
(set! (-> *progress-state* qr-options-item-picked) #f)
0
)
(defmethod set-next-state ((this progress) (arg0 symbol) (arg1 int))
"Set the next menu state specified by arg0 at the index specified by arg1."
(set! (-> *progress-state* clear-screen) #f)
(when (!= arg0 (-> this current))
(set! (-> *progress-state* yes-no-choice) #f)
(set! (-> this selected-option) #f)
(set! (-> this next-option-index) arg1)
(set! (-> this next) arg0)
(case (-> this next)
(('select-load 'select-save 'select-save-title 'select-save-title-hero)
(set! (-> this next) (get-state-check-card this (-> this next)))
)
)
(case (-> this next)
(('creating)
(auto-save-command 'create-file 0 0 this #f)
)
(('loading)
(set! (-> *progress-state* last-slot-saved) (-> *progress-state* which-slot))
(auto-save-command 'restore 0 (-> *progress-state* which-slot) this #f)
(set! (-> (the-as menu-missions-option (-> (the-as (array menu-option) (-> *missions-options* options)) 0))
task-line-index
)
0
)
0
)
(('saving)
(set! (-> *progress-state* last-slot-saved) (-> *progress-state* which-slot))
(auto-save-command 'save 0 (-> *progress-state* which-slot) this #f)
)
(('formatting)
(auto-save-command 'format-card 0 0 this #f)
)
(('select-save 'select-load)
(set! (-> this next-option-index) (max 0 (-> *progress-state* last-slot-saved)))
)
(('card-removed)
(set! (-> *progress-state* last-slot-saved) 0)
0
)
)
)
0
)
(defmethod set-menu-options ((this progress) (arg0 symbol))
"Set the menu options for the menu state specified by arg0."
(set! (-> this current-options) #f)
(case arg0
(('go-away)
(go (method-of-object this go-away))
)
(('main)
(set! (-> this current-options) (cond
(*cheat-mode*
*main-options*
)
((= *kernel-boot-message* 'kiosk)
*main-kiosk-options*
)
((demo?)
*main-demo-options*
)
(else
*main-options*
)
)
)
)
(('game-options)
(set! (-> this current-options)
(cond
((demo?)
(if (= (scf-get-territory) GAME_TERRITORY_SCEE)
*game-options*
*game-options-demo*
)
)
((and (= (scf-get-territory) GAME_TERRITORY_SCEI) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))))
*game-options*
)
(else
*game-options*
)
)
)
)
(('graphic-options)
(set! (-> this current-options)
(if (or (= (scf-get-territory) GAME_TERRITORY_SCEE) (and (= *progress-cheat* 'pal) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))
*graphic-title-options-pal*
*graphic-options*
)
)
)
(('sound-options)
(set! (-> this current-options) *sound-options*)
)
(('select-load 'select-save)
(set! (-> this current-options) *load-save-options*)
)
(('select-save-title)
(set! (-> this current-options) *save-options-title*)
)
(('select-save-title-hero)
(logior! (-> *game-info* purchase-secrets) (game-secrets hero-mode))
(logior! (-> *game-info* secrets) (game-secrets hero-mode))
(set! (-> this current-options) *save-options-title*)
)
(('loading 'saving 'creating 'formatting)
(set! (-> this current-options) *loading-options*)
)
(('unformatted-card 'insufficient-space 'no-memory-card)
(set! (-> this current-options) *insufficient-space-options*)
)
(('secrets-insufficient-space 'secrets-no-memory-card)
(set! (-> this current-options) *secrets-insufficient-space-options*)
)
(('insert-card)
(set! (-> this current-options) *insert-card-options*)
)
(('error-loading 'error-saving 'error-formatting 'error-creating)
(set! (-> this current-options) *error-loading-options*)
)
(('error-auto-saving)
(set! (-> this current-options) *error-auto-saving-options*)
)
(('card-removed)
(set! (-> this current-options) *card-removed-options*)
)
(('error-disc-removed)
(set! (-> this current-options) *error-disc-removed-options*)
)
(('error-reading)
(set! (-> this current-options) *error-reading-options*)
)
(('icon-info)
(set! (-> this current-options) *icon-info-options*)
)
(('format-card)
(set! (-> this current-options) *format-card-options*)
)
(('already-exists)
(set! (-> this current-options) *already-exists-options*)
)
(('create-game)
(set! (-> this current-options) *create-game-options*)
)
(('video-mode-warning)
(set! (-> this current-options) *video-mode-warning-options*)
)
(('video-mode-ok)
(set! (-> this current-options) *video-mode-ok-options*)
)
(('progressive-mode-warning)
(set! (-> this current-options) *progressive-mode-warning-options*)
)
(('progressive-mode-ok)
(set! (-> this current-options) *progressive-mode-ok-options*)
)
(('quit)
(set! (-> this current-options) *quit-options*)
)
(('title)
(set! (-> this current-options) *title*)
)
(('title-options)
(set! (-> this current-options) *options*)
)
(('select-start 'select-pre-start 'select-kiosk-start)
(set! (-> this current-options) *select-start-options*)
(set! (-> (the-as menu-select-start-option (-> (the-as (array menu-option) (-> *select-start-options* options)) 0))
task-index
)
0
)
0
)
(('select-scene)
(set! (-> this current-options) *select-scene-options*)
(set! (-> (the-as menu-select-scene-option (-> (the-as (array menu-option) (-> *select-scene-options* options)) 0))
task-index
)
0
)
0
)
(('select-scene-special)
(set! (-> *progress-state* starting-state) 'title)
(set! (-> this state-pos) 0)
(let ((v1-67 (-> this state-pos)))
(set! (-> this state-stack v1-67) 'title)
(set! (-> this option-index-stack v1-67) 3)
(let ((v1-68 (+ v1-67 1)))
(set! (-> this state-stack v1-68) 'unlocked-secrets)
(set! (-> this option-index-stack v1-68) (-> this option-index))
(set! (-> this state-pos) (+ v1-68 1))
)
)
(dotimes (s5-1 (-> this state-pos))
(format
#t
"select-scene-special: ~S ~D~%"
(symbol->string (-> this state-stack s5-1))
(-> this option-index-stack s5-1)
)
)
(set! (-> this current-options) *select-scene-options*)
)
(('bigmap)
(set! (-> this current-options) *bigmap-options*)
)
(('missions)
(set! (-> *progress-state* missions-total-spacing) 0.0)
(set! (-> (the-as menu-missions-option (-> (the-as (array menu-option) (-> *missions-options* options)) 0))
task-line-index
)
0
)
(set! (-> this current-options) *missions-options*)
)
(('highscores)
(set! (-> (the-as menu-highscores-option (-> (the-as (array menu-option) (-> *highscores-options* options)) 0))
page-index
)
0
)
(set! (-> (the-as menu-highscores-option (-> (the-as (array menu-option) (-> *highscores-options* options)) 0))
prev-page-index
)
0
)
(set! (-> this current-options) *highscores-options*)
)
(('secret)
(set! (-> this secret-buying) #f)
(set! (-> this current-options) *secret-options*)
)
(('quit-restart)
(set! (-> this current-options) *quit-restart-options*)
)
(('unlocked-secrets)
(set! (-> this current-options) *unlocked-secrets*)
)
)
(when (= (-> this current-options) #f)
(format #t "Didn't find new menu settings!!~%")
(pop-state this)
)
0
)
(defmethod respond-to-cpad ((this progress))
(mc-get-slot-info 0 *progress-save-info*)
(when (-> this current-options)
(let ((option-array (-> this current-options options)))
(when (and option-array (= (-> this menu-transition) 0.0))
(respond-progress
(the-as menu-option (-> option-array (-> this option-index)))
this
(and (= (-> this menu-transition) 0.0) (-> this selected-option))
)
(cond
((-> this selected-option)
(cond
((cpad-pressed? 0 confirm)
(set! (-> this selected-option) #f)
)
((cpad-pressed? 0 triangle)
(if (= (-> this current-options) *main-options*)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(set! (-> this selected-option) #f)
)
)
)
(else
(cond
((cpad-pressed? 0 up l-analog-up)
(cond
((= (-> this current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
(if (and (= *title* (-> this current-options)) (not (memcard-unlocked-secrets? #f)) (zero? (-> this option-index)))
(set! (-> this option-index) 3)
)
(cond
((> (-> this want-option-index) 0)
(set! (-> this want-option-index) -1)
)
((< -2 (-> this want-option-index))
(+! (-> this want-option-index) -1)
)
)
)
((cpad-pressed? 0 down l-analog-down)
(cond
((= (-> this current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
(cond
((< (-> this want-option-index) 0)
(set! (-> this want-option-index) 1)
)
((< (-> this want-option-index) 2)
(+! (-> this want-option-index) 1)
)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(if (not (-> *progress-state* clear-screen))
(sound-play "generic-beep")
)
(set! (-> this selected-option) #t)
)
((cpad-pressed? 0 triangle)
(when (can-go-back? this)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (and (= (-> *progress-state* starting-state) 'main) (!= (-> this current-options) *main-options*))
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state this)
)
)
)
)
)
)
)
)
0
(none)
)
(defbehavior progress-trans progress ()
;; og:preserve-this pc port note : added variable
(let ((speed-mod (if (-> *pc-settings* fast-progress?) (-> *pc-cheat-state* progress-speed) 1.0)))
(cond
((and (= (-> self next) 'none)
(or (= (-> *progress-state* starting-state) 'main) (= (-> self anim-frame) 1.0))
)
(set! (-> self menu-transition)
(seek-ease
(-> self menu-transition)
0.0
(* speed-mod 0.1 (-> self clock time-adjust-ratio))
0.4
(* 0.01 (-> self clock time-adjust-ratio))
)
)
)
(else
(seek! (-> self menu-transition) 1.0 (* 0.1 (-> self clock time-adjust-ratio)))
(when (and (= (-> self menu-transition) 1.0)
(or (and (nonzero? (-> self state-pos)) (= (-> self anim-frame) 1.0))
(or (and (zero? (-> self state-pos)) (= (-> self anim-frame) 0.0))
(and (!= (-> *progress-state* starting-state) 'main) (!= (-> self next) 'none))
)
)
)
(set! (-> self current) (-> self next))
(set! (-> self next) 'none)
(set! (-> self option-index) (-> self next-option-index))
(set! (-> self want-option-index) 0)
(set-menu-options self (-> self current))
(set! (-> self scanlines-alpha) 0.0)
)
)
)
(set! (-> self main-menu)
(and (zero? (-> self state-pos)) (and (= (-> self menu-transition) 0.0)
(= (-> self next) 'none)
(or (= (-> self state-stack 0) 'main) (= (-> self current) 'main))
)
)
)
(when *cheat-mode*
(when (zero? (-> self state-pos))
(cond
((and (cpad-hold? 0 l2) (cpad-hold? 0 r1))
(if (= (-> self current-options) *main-options*)
(set! (-> self current-options) *main-options-debug*)
)
)
((= (-> self current-options) *main-options-debug*)
(set! (-> self current-options) *main-options*)
)
)
)
)
(if (= (-> self ring-angle) (-> self ring-want-angle))
(respond-to-cpad self)
)
(let ((f30-0 (* 0.005 (-> self clock time-adjust-ratio))))
(cond
((= (-> self menu-transition) 1.0)
(if (and (zero? (-> self state-pos)) (= (-> *progress-state* starting-state) 'main))
(seek! (-> self anim-frame) 0.0 (* 0.02 (-> self clock time-adjust-ratio)))
(seek! (-> self anim-frame) 1.0 (* 0.02 (-> self clock time-adjust-ratio)))
)
(let ((f0-27 (if (and (zero? (-> self state-pos)) (!= (-> *progress-state* starting-state) 'title))
0.0
0.2
)
)
)
(when (= (-> self next) 'bigmap)
(set! f0-27 0.4)
(set! f30-0 (* 0.008 (-> self clock time-adjust-ratio)))
)
(seek! (-> self pos-transition) f0-27 f30-0)
)
)
((zero? (-> self state-pos))
(if (= (-> self current) 'bigmap)
(set! f30-0 (* 0.05 (-> self clock time-adjust-ratio)))
)
(if (!= (-> *progress-state* starting-state) 'title)
(seek! (-> self pos-transition) 0.0 f30-0)
)
)
)
)
(if (!= (-> *progress-state* starting-state) 'main)
(set! (-> self pos-transition) 0.2)
)
(set-ring-position self)
(when (= (-> self ring-angle) (-> self ring-want-angle))
(cond
((< (-> self want-option-index) 0)
(cond
((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk))
(if (> (-> self option-index) 0)
(+! (-> self option-index) -1)
)
)
(else
(set! (-> self option-index)
(min-max-wrap-around (+ (-> self option-index) -1) 0 (+ (length (-> self current-options options)) -1))
)
)
)
(set! (-> self graphic-index) (-> self option-index))
(+! (-> self want-option-index) 1)
)
((> (-> self want-option-index) 0)
(cond
((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk))
(if (< (-> self option-index) (+ (length (-> self current-options options)) -1))
(+! (-> self option-index) 1)
)
)
(else
(set! (-> self option-index)
(min-max-wrap-around (+ (-> self option-index) 1) 0 (+ (length (-> self current-options options)) -1))
)
)
)
(+! (-> self want-option-index) -1)
)
)
)
(if (= (-> self anim-frame) 0.0)
(set! (-> self swing) (seek-ease
(-> self swing)
4.0
(* 0.05 (-> self clock time-adjust-ratio))
0.5
(* 0.005 (-> self clock time-adjust-ratio))
)
)
(set! (-> self swing) (seek-ease
(-> self swing)
0.0
(* 0.07 (-> self clock time-adjust-ratio))
0.5
(* 0.007 (-> self clock time-adjust-ratio))
)
)
)
(when (-> self main-menu)
(set! (-> self ring-want-angle) (ceil (* 182.04445 (* 36.0 (the float (-> self option-index))))))
(if (and (= (-> self ring-want-angle) 0.0) (< 32768.0 (-> self ring-angle)))
(set! (-> self ring-want-angle) 65536.0)
)
(let ((f0-54 (- (-> self ring-want-angle) (-> self ring-angle))))
(when (< 32768.0 (fabs f0-54))
(if (< 0.0 f0-54)
(+! (-> self ring-angle) 65536.0)
(+! (-> self ring-angle) -65536.0)
)
)
)
(seek! (-> self ring-angle) (-> self ring-want-angle) (* speed-mod 455.1111 (-> self clock time-adjust-ratio)))
)
(let ((gp-4 (quaternion-vector-angle!
(new 'stack-no-clear 'quaternion)
*x-vector*
(* 182.04445 (* (-> self swing) (sin (the float (* 40 (current-time))))))
)
)
(s5-4 (quaternion-vector-angle!
(new 'stack-no-clear 'quaternion)
*y-vector*
(* 182.04445 (* (-> self swing) (sin (the float (* 0 (current-time))))))
)
)
)
(quaternion*! (-> self root quat) (-> self init-quat) gp-4)
(quaternion*! (-> self root quat) (-> self root quat) s5-4)
)
(quaternion-normalize! (-> self root quat))
(if (= (-> self ring-angle) (-> self ring-want-angle))
(set! (-> self graphic-index) (-> self option-index))
)
0
(none)
))
(defun begin-scan ((arg0 hud-box) (arg1 progress))
(cond
((or (= (-> arg1 current) 'bigmap) (= (-> arg1 next) 'bigmap))
(case (get-aspect-ratio)
(('aspect4x3)
(set! (-> arg0 min x) 0.0)
(set! (-> arg0 min y) 0.0)
(set! (-> arg0 max x) 512.0)
(set! (-> arg0 max y) 416.0)
)
(('aspect16x9)
(set! (-> arg0 min x) 0.0)
(set! (-> arg0 min y) 0.0)
(set! (-> arg0 max x) 512.0)
(set! (-> arg0 max y) 424.0)
)
)
)
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> arg0 min x) 19.0)
(set! (-> arg0 min y) 38.0)
(set! (-> arg0 max x) 494.0)
(set! (-> arg0 max y) 362.0)
)
(else
(set! (-> arg0 min x) 70.0)
(set! (-> arg0 min y) 70.0)
(set! (-> arg0 max x) 444.0)
(set! (-> arg0 max y) 329.0)
)
)
0
)
(defun end-scan ((arg0 hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-scan-and-line arg0 s5-0 arg1)
)
0
)
(defbehavior progress-post progress ()
(local-vars (sv-144 font-context) (sv-148 int) (sv-152 hud-box) (sv-156 symbol))
(when (-> self current-options)
(let ((gp-0 (-> self current-options options))
(s4-0 (-> self current-options y-center))
(s5-0 (-> self current-options y-space))
)
(set! sv-144
(new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning))
)
(set! sv-148 (- s4-0 (/ (* s5-0 (length gp-0)) 2)))
(set! sv-152 (new 'stack-no-clear 'hud-box))
(set! sv-156 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0))))
(if sv-156
(begin-scan sv-152 self)
)
;; og:preserve-this
(if (or (= (-> self current-options) *title-pc*) (= (-> self current-options) *options-pc*))
(+! s5-0 10)
)
(dotimes (s4-1 (length gp-0))
(let ((v1-24 sv-144))
(set! (-> v1-24 scale) 0.5)
)
(set! (-> sv-144 origin x) 79.0)
(set! (-> sv-144 origin y) (the float sv-148))
(set-width! sv-144 355)
(set-height! sv-144 30)
(set! (-> sv-144 flags) (if (text-language? japanese) ;; og:preserve-this text-language patch
(font-flags middle middle-vert large)
(font-flags kerning middle middle-vert large)
)
)
(let ((s3-0 sv-144))
(set! (-> s3-0 color) (if (and (= s4-1 (-> self option-index)) (= (-> self menu-transition) 0.0))
(progress-selected 0)
(font-color progress)
)
)
)
;; og:preserve-this added for proper aspect ratio-ing
(#when PC_PORT
(when (not (-> *pc-settings* use-vis?))
(set! (-> sv-144 origin x) (the float (the int (adjust-game-x (-> sv-144 origin x)))))
(set! (-> sv-144 width) (the float (the int (* (-> sv-144 width) (-> *pc-settings* aspect-ratio-reciprocal)))))
)
)
(draw-option
(-> gp-0 s4-1)
self
sv-144
s4-1
(and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s4-1 (-> self option-index)))
)
(if (!= (-> self current-options) *unlocked-secrets*)
(set! sv-148 (+ s5-0 7 sv-148))
(set! sv-148 (+ sv-148 s5-0))
)
)
)
(when sv-156
(set! (-> self scanlines-alpha) (seek-ease
(-> self scanlines-alpha)
(- 1.0 (-> self menu-transition))
(* 0.05 (-> self clock time-adjust-ratio))
0.3
(* 0.001 (-> self clock time-adjust-ratio))
)
)
(end-scan sv-152 (-> self scanlines-alpha))
)
)
(when (and (< 0.8 (-> self anim-frame)) (or (= (-> self current) 'bigmap) (= (-> self next) 'bigmap)))
(cond
((>= (-> self pos-transition) 0.38)
(draw *bigmap* 1792 1840 2304 2256)
)
(else
(let ((s4-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 21)))
(s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 24)))
(gp-1 (new 'stack-no-clear 'vector4w))
)
(set! (-> gp-1 quad) (the-as uint128 0))
(let ((s5-1 (new 'stack-no-clear 'vector4w)))
(set! (-> s5-1 quad) (the-as uint128 0))
(if (and (transform-point-qword! gp-1 s4-2) (transform-point-qword! s5-1 s3-1))
(draw *bigmap* (/ (-> s5-1 x) 16) (/ (-> s5-1 y) 16) (/ (-> gp-1 x) 16) (/ (-> gp-1 y) 16))
)
)
)
)
)
)
(ja-post)
0
(none)
)
(defstate come-in (progress)
:virtual #t
:enter (behavior ()
(sound-play "ring-appear")
(set! (-> self pos-transition) 1.0)
)
:trans (behavior ()
(let ((f30-0 (if (= (-> *progress-state* starting-state) 'main)
0.0
0.2
)
)
;; og:preserve-this added variable
(speed-mod (if (-> *pc-settings* fast-progress?) (-> *pc-cheat-state* progress-speed) 1.0))
)
(when (hud-hidden?)
(set! (-> *blit-displays-work* menu-mode) #t)
(set! (-> self pos-transition) (seek-ease
(-> self pos-transition)
f30-0
(* speed-mod 0.03 (-> self clock time-adjust-ratio))
0.4
(* 0.003 (-> self clock time-adjust-ratio))
)
)
)
(set-ring-position self)
(if (= (-> self pos-transition) f30-0)
(go-virtual idle)
)
)
)
:code (behavior ()
(until #f
(suspend)
(ja :num-func num-func-identity :frame-num 0.0)
(suspend)
)
#f
)
:post ja-post
)
(defstate idle (progress)
:virtual #t
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
(the-as
object
(case event-type
(('notify)
(cond
((= (-> event param 0) 'done)
(let ((t9-0 format)
(a0-3 #t)
(a1-1 "DONE NOTIFY: ~S ~S~%")
(v1-3 (the-as mc-status-code (-> event param 1)))
)
(t9-0
a0-3
a1-1
(cond
((= v1-3 (mc-status-code bad-version))
"bad-version"
)
((= v1-3 (mc-status-code no-save))
"no-save"
)
((= v1-3 (mc-status-code no-last))
"no-last"
)
((= v1-3 (mc-status-code no-space))
"no-space"
)
((= v1-3 (mc-status-code internal-error))
"internal-error"
)
((= v1-3 (mc-status-code no-memory))
"no-memory"
)
((= v1-3 (mc-status-code bad-handle))
"bad-handle"
)
((= v1-3 (mc-status-code busy))
"busy"
)
((= v1-3 (mc-status-code write-error))
"write-error"
)
((= v1-3 (mc-status-code read-error))
"read-error"
)
((= v1-3 (mc-status-code no-card))
"no-card"
)
((= v1-3 (mc-status-code no-format))
"no-format"
)
((= v1-3 (mc-status-code ok))
"ok"
)
((= v1-3 (mc-status-code no-process))
"no-process"
)
((= v1-3 (mc-status-code no-auto-save))
"no-auto-save"
)
((= v1-3 (mc-status-code no-file))
"no-file"
)
((= v1-3 (mc-status-code format-failed))
"format-failed"
)
((= v1-3 (mc-status-code new-game))
"new-game"
)
(else
"*unknown*"
)
)
(symbol->string (-> self current))
)
)
(case (-> self next) ;; og:preserve-this patched to next instead of current because we save synchronously
(('saving)
(cond
((= (-> self state-stack 0) 'title)
(let ((gp-1 (-> *setting-control* user-default auto-save)))
(sound-volume-off)
(let ((v0-0 (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))))
(set! (-> *setting-control* user-default auto-save) gp-1)
v0-0
)
)
)
(else
(pop-state self)
)
)
)
(('formatting)
(set-next-state self 'creating 0)
)
(('creating)
(if (= (-> self state-stack 0) 'title)
(set-next-state self 'select-save-title 0)
(set-next-state self 'select-save 0)
)
)
)
)
((= (-> event param 0) 'error)
(let ((t9-7 format)
(a0-18 #t)
(a1-5 "ERROR NOTIFY: ~S ~S ~S~%")
(v1-19 (the-as mc-status-code (-> event param 1)))
)
(t9-7
a0-18
a1-5
(cond
((= v1-19 (mc-status-code bad-version))
"bad-version"
)
((= v1-19 (mc-status-code no-save))
"no-save"
)
((= v1-19 (mc-status-code no-last))
"no-last"
)
((= v1-19 (mc-status-code no-space))
"no-space"
)
((= v1-19 (mc-status-code internal-error))
"internal-error"
)
((= v1-19 (mc-status-code no-memory))
"no-memory"
)
((= v1-19 (mc-status-code bad-handle))
"bad-handle"
)
((= v1-19 (mc-status-code busy))
"busy"
)
((= v1-19 (mc-status-code write-error))
"write-error"
)
((= v1-19 (mc-status-code read-error))
"read-error"
)
((= v1-19 (mc-status-code no-card))
"no-card"
)
((= v1-19 (mc-status-code no-format))
"no-format"
)
((= v1-19 (mc-status-code ok))
"ok"
)
((= v1-19 (mc-status-code no-process))
"no-process"
)
((= v1-19 (mc-status-code no-auto-save))
"no-auto-save"
)
((= v1-19 (mc-status-code no-file))
"no-file"
)
((= v1-19 (mc-status-code format-failed))
"format-failed"
)
((= v1-19 (mc-status-code new-game))
"new-game"
)
(else
"*unknown*"
)
)
(-> self current)
(-> self next)
)
)
(case (-> event param 1)
((14)
(set-next-state self 'insufficient-space 0)
)
(else
(case (-> self next) ;; og:preserve-this patched to next instead of current because we save synchronously
(('formatting 'format-card)
(set-next-state self 'error-formatting 0)
) ;; og:preserve-this jp patch
(('creating 'create-game)
(set-next-state self 'error-creating 0)
) ;; jp patch
(('saving 'select-save 'select-save-title 'select-save-title-hero 'already-exists)
(set-next-state self 'error-saving 0)
)
(('loading 'select-load)
(set-next-state self 'error-loading 0)
)
)
)
)
)
)
)
)
)
)
:enter (behavior ()
(set! (-> self menu-transition) 1.0)
)
:trans progress-trans
:code (behavior ()
(until #f
(ja :num-func num-func-identity :frame-num (* 12.0 (-> self anim-frame)))
(suspend)
)
#f
)
:post progress-post
)
(defstate go-away (progress)
:virtual #t
:enter (behavior ()
(remove-setting-by-arg0 *setting-control* 'extra-bank)
(let ((v1-2 *blit-displays-work*))
(set! (-> v1-2 progress-interp-dest) 0.0)
(set! (-> v1-2 progress-interp-speed) (/ 1.0 45))
(#when PC_PORT
(when (-> *pc-settings* fast-progress?)
(*! (-> v1-2 progress-interp-speed) (-> *pc-cheat-state* progress-speed))
)
)
)
)
:trans (behavior ()
;; og:preserve-this added variable
(let ((speed-mod (if (-> *pc-settings* fast-progress?) (-> *pc-cheat-state* progress-speed) 1.0)))
(seek! (-> self anim-frame) 0.0 (* speed-mod 0.02 (-> self clock time-adjust-ratio)))
(cond
((= (-> self anim-frame) 0.0)
(seek! (-> self pos-transition) 1.0 (* speed-mod 0.02 (-> self clock time-adjust-ratio)))
(if (= (-> self pos-transition) 1.0)
(go-virtual gone)
)
)
(else
(seek! (-> self pos-transition) 0.0 (* speed-mod 0.02 (-> self clock time-adjust-ratio)))
)
)
(set-ring-position self)
))
:code (behavior ()
(let ((gp-0 #f))
(until #f
(when (and (not gp-0) (= (-> self anim-frame) 0.0))
(sound-play "ring-disappear")
(set! gp-0 #t)
)
(ja :num-func num-func-identity :frame-num (* 12.0 (-> self anim-frame)))
(suspend)
)
)
#f
)
:post ja-post
)
(defstate gone (progress)
:virtual #t
:code (behavior ()
(disable-drawing *bigmap*)
(set! (-> *blit-displays-work* menu-mode) #f)
(while (or (-> *blit-displays-work* screen-copied) (nonzero? (-> *blit-displays-work* count-down)))
(suspend)
)
(remove-setting! 'process-mask)
(set-master-mode *last-master-mode*)
(logior! (-> self mask) (process-mask sleep))
(suspend)
0
)
)
(defmethod respond-progress ((this menu-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
0
)
(defmethod respond-progress ((this menu-on-off-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* on-off-choice))
(gp-0 #f)
)
(cond
(arg1
(cond
((cpad-pressed? 0 left l-analog-left)
(when (not (-> v1-1 0))
(set! gp-0 #t)
(when (= (-> this value-to-modify) (&-> *setting-control* user-default vibration))
(set! (-> *cpad-list* cpads 0 buzz-pause-val 0) (the-as uint 255))
(set! (-> *cpad-list* cpads 0 buzz-pause-time) (the-as uint 15))
)
(set! (-> v1-1 0) #t)
)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(cond
((and (-> v1-1 0) (= (-> this value-to-modify) (&-> *setting-control* user-default use-progressive-scan)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(push-state arg0)
(set-next-state arg0 'progressive-mode-warning 0)
)
(else
(set! (-> this value-to-modify 0) (-> *progress-state* on-off-choice))
)
)
)
)
)
(else
(if (cpad-pressed? 0 confirm)
(set! (-> *progress-state* on-off-choice) (-> this value-to-modify 0))
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-yes-no-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(when arg1
(cond
((cpad-pressed? 0 left l-analog-left)
(when (not (-> v1-1 0))
(set! gp-0 #t)
(set! (-> v1-1 0) #t)
)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(cond
((and (-> v1-1 0) (= (-> this name) (text-id progress-root-restart-mission)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(restart-mission)
(set-next-state arg0 'go-away 0)
)
((and (-> v1-1 0) (= (-> this name) (text-id progress-quit)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-slider-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (-> *bigmap* progress-minimap)
(let ((gp-0 (-> this value-to-modify))
(s4-0 #f)
)
(cond
(arg1
(cond
((cpad-hold? 0 left l-analog-left)
(seek! (-> (the-as (pointer float) gp-0)) 0.0 (* 0.02 (-> self clock time-adjust-ratio)))
(if (!= (-> (the-as (pointer float) gp-0)) 0.0)
(set! s4-0 #t)
)
)
((cpad-hold? 0 right l-analog-right)
(seek! (-> (the-as (pointer float) gp-0)) 1.0 (* 0.02 (-> self clock time-adjust-ratio)))
(if (!= (-> (the-as (pointer float) gp-0)) 1.0)
(set! s4-0 #t)
)
)
((cpad-pressed? 0 triangle)
(set! (-> (the-as (pointer float) gp-0)) (-> *progress-state* slider-backup))
)
)
)
(else
(cond
((cpad-hold? 0 left l-analog-left)
(seek! (-> (the-as (pointer float) gp-0)) 0.0 (* 0.02 (-> self clock time-adjust-ratio)))
(if (!= (-> (the-as (pointer float) gp-0)) 0.0)
(set! s4-0 #t)
)
)
((cpad-hold? 0 right l-analog-right)
(seek! (-> (the-as (pointer float) gp-0)) 1.0 (* 0.02 (-> self clock time-adjust-ratio)))
(if (!= (-> (the-as (pointer float) gp-0)) 1.0)
(set! s4-0 #t)
)
)
)
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
)
(when (cpad-pressed? 0 triangle)
(cond
((!= (-> *progress-state* starting-state) 'title)
)
(else
(sound-play "generic-beep")
)
)
)
)
)
(when s4-0
(let ((f30-0 1.0))
(case (-> this name)
(((text-id progress-sound-music-volume) (text-id progress-sound-speech-volume))
(set! f30-0 (-> (the-as (pointer float) gp-0)))
)
)
(when (< (seconds 0.03) (- (current-time) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (current-time))
(sound-play-by-name
(static-sound-name "menu-slide")
(new-sound-id)
(the int (* 1024.0 f30-0))
0
0
(sound-group sfx)
#t
)
)
)
)
)
)
0
)
(defmethod respond-progress ((this menu-stereo-mode-sound-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (-> *bigmap* progress-minimap)
(let ((a0-1 (-> *setting-control* user-default stereo-mode))
(v1-4 #f)
)
(let ((a3-0 2))
(cond
(arg1
(cond
((cpad-pressed? 0 left l-analog-left)
(set! (-> *setting-control* user-default stereo-mode) (min-max-wrap-around (+ a0-1 -1) 0 a3-0))
(set! v1-4 #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! (-> *setting-control* user-default stereo-mode) (min-max-wrap-around (+ a0-1 1) 0 a3-0))
(set! v1-4 #t)
)
((cpad-pressed? 0 triangle)
(set! (-> *setting-control* user-default stereo-mode) (-> *progress-state* stereo-mode-backup))
)
)
)
(else
(if (cpad-pressed? 0 confirm)
(set! (-> *progress-state* stereo-mode-backup) (-> *setting-control* user-default stereo-mode))
)
)
)
)
(if v1-4
(sound-play "generic-beep")
)
)
)
0
)
(defmethod respond-progress ((this menu-main-menu-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(cond
((cpad-pressed? 0 start)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(when (and (= (-> arg0 ring-angle) (-> arg0 ring-want-angle)) #t)
(cond
((= (-> this name) (text-id progress-demo-exit))
(case *kernel-boot-message*
(('demo-shared)
(set! *master-exit* 'force)
(set-master-mode 'game)
)
(('demo)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "demo-restart")
)
)
)
((or (= (-> this name) (text-id progress-main-secrets-sceneplayer-1))
(= (-> this name) (text-id progress-main-secrets-sceneplayer-2))
(= (-> this name) (text-id progress-main-secrets-sceneplayer-3))
)
(case (-> this name)
(((text-id progress-main-secrets-sceneplayer-2))
(set! (-> *progress-state* scene-player-act) 2)
)
(((text-id progress-main-secrets-sceneplayer-3))
(set! (-> *progress-state* scene-player-act) 3)
)
(else
(set! (-> *progress-state* scene-player-act) 1)
)
)
(sound-play "window-expand")
(push-state arg0)
(set-next-state arg0 (-> this next-state) 0)
)
((= (-> this next-state) 'back)
(pop-state arg0)
)
((= (-> this next-state) 'restart)
(sound-volume-off)
(restart-mission)
(pop-state arg0)
)
(else
(sound-play "window-expand")
(push-state arg0)
(set-next-state arg0 (-> this next-state) 0)
)
)
)
)
((not (-> arg0 selected-option))
(let ((a0-53 (-> arg0 current-options options)))
(cond
((cpad-pressed? 0 left l-analog-left)
(if (!= (length a0-53) 1)
(sound-play "ring-select")
)
(cond
((> (-> arg0 want-option-index) 0)
(set! (-> arg0 want-option-index) -1)
)
((< -2 (-> arg0 want-option-index))
(+! (-> arg0 want-option-index) -1)
)
)
)
((cpad-pressed? 0 right l-analog-right)
(if (!= (length a0-53) 1)
(sound-play "ring-select")
)
(cond
((< (-> arg0 want-option-index) 0)
(set! (-> arg0 want-option-index) 1)
)
((< (-> arg0 want-option-index) 2)
(+! (-> arg0 want-option-index) 1)
)
)
)
)
)
)
)
0
)
(defmethod respond-progress ((this menu-sub-menu-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (and (-> *progress-state* secrets-unlocked)
(not (memcard-unlocked-secrets? #f))
(or (= (-> arg0 current-options) *title*)
(= (-> arg0 current-options) *unlocked-secrets*)
(= (-> arg0 current-options) *select-scene-options*)
(= (-> arg0 current-options) *select-start-options*)
(= (-> arg0 current-options) *save-options-title*)
)
)
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> arg0 state-pos) 0)
(set-next-state arg0 'secrets-insufficient-space 0)
)
(when (= (-> this name) (text-id progress-continue-without-saving))
(let ((a1-3 (get-state-check-card arg0 (-> arg0 current))))
(set-next-state arg0 a1-3 0)
)
)
(when (and (= (-> this name) (text-id progress-root-secrets))
(= *title* (-> arg0 current-options))
(not (memcard-unlocked-secrets? #f))
(= (-> arg0 option-index) 3)
)
(set! (-> arg0 option-index) 0)
0
)
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((= (-> this name) (text-id progress-demo-exit))
(case *kernel-boot-message*
(('demo-shared)
(set! *master-exit* 'force)
(set-master-mode 'game)
)
(('demo)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "demo-restart")
)
)
)
((= (-> this name) (text-id progress-continue-without-saving))
(progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
((= (-> this next-state) 'back)
(pop-state arg0)
)
(else
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 (-> this next-state) 0)
)
)
)
0
)
(defmethod respond-progress ((this menu-unlocked-menu-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((s4-0 (memcard-unlocked-secrets? #t)))
(logclear! (-> *game-info* purchase-secrets) (game-secrets hero-mode))
(logclear! (-> *game-info* secrets) (game-secrets hero-mode))
(when (not (-> *progress-state* secrets-unlocked))
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> arg0 state-pos) 0)
(set-next-state arg0 'secrets-insufficient-space 0)
)
(cond
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((and (= (-> this name) (text-id progress-main-secrets-scrapbook)) (logtest? s4-0 (game-secrets scrap-book-1)))
(sound-play "generic-beep")
(cond
((send-event (handle->process (-> *game-info* controller 0)) 'scrap-book 1)
(set-next-state arg0 'go-away 0)
)
(else
(set! (-> *game-info* demo-state) (the-as uint 201))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
((and (= (-> this name) (text-id progress-main-secrets-mega-scrapbook))
(logtest? s4-0 (game-secrets scrap-book-2))
)
(sound-play "generic-beep")
(cond
((send-event (handle->process (-> *game-info* controller 0)) 'scrap-book 2)
(set-next-state arg0 'go-away 0)
)
(else
(set! (-> *game-info* demo-state) (the-as uint 202))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
((and (= (-> this name) (text-id progress-main-secrets-scrapbook-3))
(logtest? s4-0 (game-secrets scrap-book-3))
)
(sound-play "generic-beep")
(cond
((send-event (handle->process (-> *game-info* controller 0)) 'scrap-book 3)
(set-next-state arg0 'go-away 0)
)
(else
(set! (-> *game-info* demo-state) (the-as uint 203))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
((and (= (-> this name) (text-id progress-main-secrets-sceneplayer-1))
(logtest? s4-0 (game-secrets scene-player-1))
)
(set! (-> *progress-state* scene-player-act) 1)
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'select-scene 0)
)
((and (= (-> this name) (text-id progress-main-secrets-sceneplayer-2))
(logtest? s4-0 (game-secrets scene-player-2))
)
(set! (-> *progress-state* scene-player-act) 2)
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'select-scene 0)
)
((and (= (-> this name) (text-id progress-main-secrets-sceneplayer-3))
(logtest? s4-0 (game-secrets scene-player-3))
)
(set! (-> *progress-state* scene-player-act) 3)
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'select-scene 0)
)
((and (= (-> this name) (text-id progress-main-secrets-hero-mode)) (logtest? s4-0 (game-secrets hero-mode)))
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'select-save-title-hero 0)
)
((and (= (-> this name) (text-id progress-main-secrets-levelselect))
(logtest? s4-0 (game-secrets level-select))
)
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'select-start 0)
)
((= (-> this next-state) 'back)
(pop-state arg0)
)
;; added for pc port
((and (= (-> this name) (text-id progress-music-player))
(pc-cheats? (-> *pc-settings* cheats) music-player)
)
(sound-play "generic-beep")
(push-state arg0)
(set-next-state arg0 'music-player 0)
)
)
)
((not (-> arg0 selected-option))
(let ((a0-131 (-> arg0 current-options options)))
(cond
((cpad-pressed? 0 left l-analog-left)
(when (!= (length a0-131) 1)
)
(cond
((> (-> arg0 want-option-index) 0)
(set! (-> arg0 want-option-index) -1)
)
((< -2 (-> arg0 want-option-index))
(+! (-> arg0 want-option-index) -1)
)
)
)
((cpad-pressed? 0 right l-analog-right)
(when (!= (length a0-131) 1)
)
(cond
((< (-> arg0 want-option-index) 0)
(set! (-> arg0 want-option-index) 1)
)
((< (-> arg0 want-option-index) 2)
(+! (-> arg0 want-option-index) 1)
)
)
)
)
)
)
)
)
0
)
(defmethod respond-progress ((this menu-memcard-slot-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(memcard-unlocked-secrets? #t)
(let ((a1-2 (get-state-check-card arg0 (-> arg0 current))))
(set-next-state arg0 a1-2 0)
)
(set! (-> arg0 selected-option) #f)
(when (-> *bigmap* progress-minimap)
(cond
((cpad-pressed? 0 triangle)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(let ((s5-0 #f))
*progress-save-info*
(set! (-> *progress-state* which-slot) (-> arg0 option-index))
(cond
((= (-> arg0 current) 'select-load)
(when (= (-> *progress-save-info* file (-> arg0 option-index) present) 1)
(set! s5-0 #t)
(set-next-state arg0 'loading 0)
)
)
((= (-> *progress-save-info* file (-> *progress-state* which-slot) present) 1)
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0)))
(set-next-state arg0 'already-exists 0)
)
(else
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0)))
(set-next-state arg0 'saving 0)
)
)
(if s5-0
(sound-play "generic-beep")
)
)
)
)
)
0
)
(defmethod respond-progress ((this menu-already-exists-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
(a1-2 (get-state-check-card arg0 'select-save))
(gp-0 #f)
)
(if (!= a1-2 'select-save)
(set-next-state arg0 a1-2 0)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> s4-0 0)))
(set! (-> s4-0 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> s4-0 0))
(set! (-> s4-0 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((-> *progress-state* yes-no-choice)
(sound-play "generic-beep")
(set-next-state arg0 'saving 0)
)
((begin (sound-play "generic-beep") (= (-> arg0 state-stack 0) 'title))
(set-next-state arg0 'select-save-title 0)
)
(else
(set-next-state arg0 'select-save 0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-create-game-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(let ((a1-2 (get-state-check-card arg0 'select-save)))
(if (!= a1-2 'select-save)
(set-next-state arg0 a1-2 0)
)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> s4-0 0)))
(set! (-> s4-0 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> s4-0 0))
(set! (-> s4-0 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((-> *progress-state* yes-no-choice)
(set-next-state arg0 'creating 0)
)
((= (-> arg0 state-stack 0) 'title)
(sound-play "generic-beep")
(sound-volume-off)
(progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
(else
(sound-play "generic-beep")
(pop-state arg0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-insufficient-space-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((s5-0 (&-> *progress-state* yes-no-choice))
(s3-0 (get-state-check-card arg0 'select-save))
)
(cond
((or (= (-> *progress-state* starting-state) 'insufficient-space)
(= (-> *progress-state* starting-state) 'no-memory-card)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(when (and (not (-> s5-0 0)) (not (-> *progress-state* clear-screen)))
(sound-play "generic-beep")
(set! (-> s5-0 0) #t)
)
)
((cpad-pressed? 0 right l-analog-right)
(when (and (-> s5-0 0) (not (-> *progress-state* clear-screen)))
(sound-play "generic-beep")
(set! (-> s5-0 0) #f)
)
)
((and (cpad-pressed? 0 confirm) (!= (-> arg0 current) 'none))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* clear-screen) #t)
(cond
((-> s5-0 0)
(sound-play "generic-beep")
(pop-state arg0)
)
((and (not (-> s5-0 0))
(!= (get-state-check-card arg0 'select-save) 'insufficient-space)
(!= (get-state-check-card arg0 'select-save) 'no-memory-card)
)
(pop-state arg0)
)
(else
(sound-play "generic-beep")
(set! (-> this last-move) (current-time))
(set! (-> arg0 current) 'none)
(set-next-state arg0 s3-0 0)
)
)
)
)
)
(else
(let ((a1-9 'select-save-title-hero))
'select-save
(cond
((and (= (-> *progress-state* starting-state) 'main)
(not (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
(set! a1-9 'select-save)
)
((and (= (-> *progress-state* starting-state) 'title)
(not (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
(set! a1-9 'select-save-title)
)
)
(let ((a1-10 (get-state-check-card arg0 a1-9)))
(set-next-state arg0 a1-10 0)
)
)
(cond
((and (cpad-pressed? 0 triangle)
(or (= (-> *progress-state* starting-state) 'title) (= (-> *progress-state* starting-state) 'main))
)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((= (-> arg0 state-stack 0) 'title)
(sound-play "generic-beep")
(sound-volume-off)
(progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
(else
(sound-play "generic-beep")
(pop-state arg0)
)
)
)
)
)
)
)
0
)
(defmethod respond-progress ((this menu-secrets-insufficient-space-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(&-> *progress-state* yes-no-choice)
(cond
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(set-next-state arg0 'title 0)
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
)
)
0
)
(defmethod respond-progress ((this menu-video-mode-warning-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> v1-1 0)))
(set! (-> v1-1 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* video-mode-timeout) 0)
(cond
((-> *progress-state* yes-no-choice)
(set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice))
(set! (-> *progress-state* video-mode-timeout) (current-time))
(set-next-state arg0 'video-mode-ok 0)
)
(else
(set! (-> *progress-state* video-mode-choice) 'pal)
(pop-state arg0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-video-mode-ok-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(s5-0 #f)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! s5-0 (not (-> v1-1 0)))
(set! (-> v1-1 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! s5-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((not (-> *progress-state* yes-no-choice))
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice))
(sound-play "generic-beep")
)
(else
(sound-play "generic-beep")
)
)
(set! (-> *progress-state* video-mode-timeout) 0)
(pop-state arg0)
)
)
(if s5-0
(sound-play "generic-beep")
)
)
(when (and (nonzero? (-> *progress-state* video-mode-timeout))
(< (seconds 10) (- (current-time) (-> *progress-state* video-mode-timeout)))
)
(set! (-> *progress-state* video-mode-timeout) 0)
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice))
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-progressive-mode-warning-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> v1-1 0)))
(set! (-> v1-1 0) #t)
(set! (-> *progress-state* graphic-options-progressive-scan) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* progressive-mode-timeout) 0)
(cond
((-> *progress-state* yes-no-choice)
(sound-play "generic-beep")
(set-progressive-scan #t)
(set! (-> *progress-state* graphic-options-progressive-scan) #t)
(set! (-> *progress-state* progressive-mode-timeout) (current-time))
(set-next-state arg0 'progressive-mode-ok 0)
)
(else
(sound-play "generic-beep")
(set! (-> *progress-state* on-off-choice) #f)
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(set-progressive-scan #f)
(pop-state arg0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-progressive-mode-ok-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(s5-0 #f)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! s5-0 (not (-> v1-1 0)))
(set! (-> v1-1 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! s5-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((not (-> *progress-state* yes-no-choice))
(set! (-> *setting-control* user-default use-progressive-scan) #f)
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(sound-play "generic-beep")
)
(else
(sound-play "generic-beep")
(set! (-> *progress-state* graphic-options-progressive-scan) #t)
)
)
(set! (-> *progress-state* progressive-mode-timeout) 0)
(pop-state arg0)
)
)
(if s5-0
(sound-play "generic-beep")
)
)
(when (and (nonzero? (-> *progress-state* progressive-mode-timeout))
(< (seconds 10) (- (current-time) (-> *progress-state* progressive-mode-timeout)))
)
(set! (-> *progress-state* progressive-mode-timeout) 0)
(set! (-> *setting-control* user-default use-progressive-scan) #f)
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(set-progressive-scan #f)
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-card-removed-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-insert-card-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
*progress-save-info*
(cond
((= (get-state-check-card arg0 'select-load) 'select-load)
(set-next-state arg0 'select-load 0)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
)
0
)
(defmethod respond-progress ((this menu-error-loading-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-error-auto-saving-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-error-disc-removed-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(when (is-cd-in?)
(sound-play "generic-beep")
(pop-state arg0)
)
)
0
)
(defmethod respond-progress ((this menu-error-reading-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-icon-info-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(when (cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(pop-state arg0)
)
0
)
(defmethod respond-progress ((this menu-quit-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> v1-1 0)))
(set! (-> v1-1 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((-> *progress-state* yes-no-choice)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(case *kernel-boot-message*
(('demo-shared 'demo)
(initialize! *game-info* 'game (the-as game-save #f) "demo-start")
)
(else
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
(else
(sound-play "generic-beep")
(pop-state arg0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
(defmethod respond-progress ((this menu-format-card-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(let ((a1-2 (get-state-check-card arg0 (-> arg0 current))))
(set-next-state arg0 a1-2 0)
)
(cond
((cpad-pressed? 0 left l-analog-left)
(set! gp-0 (not (-> s4-0 0)))
(set! (-> s4-0 0) #t)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> s4-0 0))
(set! (-> s4-0 0) #f)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(cond
((-> *progress-state* yes-no-choice)
(sound-play "generic-beep")
(set-next-state arg0 'formatting 0)
)
((= (-> arg0 state-stack 0) 'title)
(sound-play "generic-beep")
(sound-volume-off)
(progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode)))
)
(else
(sound-play "generic-beep")
(pop-state arg0)
)
)
)
)
(if gp-0
(sound-play "generic-beep")
)
)
0
)
;; WARN: disable def twice: 110. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod respond-progress ((this menu-select-start-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding-height) (seek-ease
(-> arg0 sliding-height)
0.0
(* 0.1 (-> self clock time-adjust-ratio))
0.3
(* 0.001 (-> self clock time-adjust-ratio))
)
)
(let ((s4-0 #f))
(memcard-unlocked-secrets? #t)
(when (not (-> *progress-state* secrets-unlocked))
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> arg0 state-pos) 0)
(set-next-state arg0 'secrets-insufficient-space 0)
)
(cond
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(when (> (-> this task-index) 0)
(set! s4-0 #t)
(+! (-> this task-index) -1)
(set! (-> arg0 sliding-height) -1.0)
)
)
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(let ((s3-0 -1))
(dotimes (s2-0 (-> *game-info* play-list length))
(let* ((v1-41 (-> *game-info* play-list s2-0))
(a0-20 (-> arg0 current))
(a0-22 (cond
((= a0-20 'select-pre-start)
(or (-> v1-41 play-continue) (-> v1-41 pre-play-continue))
)
((= a0-20 'select-kiosk-start)
(-> v1-41 kiosk-play-continue)
)
(else
(-> v1-41 play-continue)
)
)
)
)
(if (and a0-22 (lookup-text! *common-text* (-> v1-41 text-name) #t))
(+! s3-0 1)
)
)
)
(when (< (-> this task-index) s3-0)
(set! s4-0 #t)
(+! (-> this task-index) 1)
(set! (-> arg0 sliding-height) 1.0)
)
)
)
;; og:preserve-this - Added to make scrolling these menus faster (jak3 has this)
((or (cpad-pressed? 0 left l-analog-left) (and (cpad-hold? 0 left l-analog-left) (>= (- (current-time) (-> this last-move)) (seconds 0.075))))
(when (> (-> this task-index) 0)
(set! (-> this last-move) (current-time))
(set! s4-0 #t)
(set! (-> this task-index) (max (- (-> this task-index) 5) 0))
(set! (-> arg0 sliding-height) 0.0)))
;; og:preserve-this - Added to make scrolling these menus faster (jak3 has this)
((or (cpad-pressed? 0 right l-analog-right) (and (cpad-hold? 0 right l-analog-right) (>= (- (current-time) (-> this last-move)) (seconds 0.075))))
(let ((max-task-index -1))
(dotimes (s2-0 (-> *game-info* play-list length))
(let* ((v1-41 (-> *game-info* play-list s2-0))
(a0-20 (-> arg0 current))
(a0-22 (cond
((= a0-20 'select-pre-start)
(or (-> v1-41 play-continue) (-> v1-41 pre-play-continue))
)
((= a0-20 'select-kiosk-start)
(-> v1-41 kiosk-play-continue)
)
(else
(-> v1-41 play-continue)
)
)
)
)
(if (and a0-22 (lookup-text! *common-text* (-> v1-41 text-name) #t))
(+! max-task-index 1)
)
)
)
(when (< (-> this task-index) max-task-index)
(set! (-> this last-move) (current-time))
(set! s4-0 #t)
(set! (-> this task-index) (min (+ (-> this task-index) 5) max-task-index))
(set! (-> arg0 sliding-height) 0.0))))
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(let* ((t9-6 play-task)
(a0-40 (-> this real-task-index))
(a1-8 'debug)
(v1-64 (-> arg0 current))
(a1-9 (t9-6 (the-as game-task a0-40) a1-8 (cond
((= v1-64 'select-pre-start)
'pre-play
)
((= v1-64 'select-kiosk-start)
'kiosk
)
(else
'play
)
)
)
)
)
(start 'play (get-continue-by-name *game-info* a1-9))
)
(set-master-mode 'game)
)
)
(if s4-0
(sound-play "secrets-scroll")
)
)
0
)
(defmethod respond-progress ((this menu-select-scene-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding-height) (seek-ease
(-> arg0 sliding-height)
0.0
(* 0.1 (-> self clock time-adjust-ratio))
0.3
(* 0.01 (-> self clock time-adjust-ratio))
)
)
(let ((gp-0 #f))
(let ((s4-0 *hud-select-scene-act1*))
(memcard-unlocked-secrets? #t)
(when (not (-> *progress-state* secrets-unlocked))
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> arg0 state-pos) 0)
(set-next-state arg0 'secrets-insufficient-space 0)
)
(case (-> *progress-state* scene-player-act)
((1)
(set! s4-0 *hud-select-scene-act1*)
)
((2)
(set! s4-0 *hud-select-scene-act2*)
)
((3)
(set! s4-0 *hud-select-scene-act3*)
)
)
(cond
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(when (> (-> this task-index) 0)
(set! gp-0 #t)
(+! (-> this task-index) -1)
(set! (-> arg0 sliding-height) -1.0)
)
)
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(when (< (-> this task-index) (+ (length s4-0) -1))
(set! gp-0 #t)
(+! (-> this task-index) 1)
(set! (-> arg0 sliding-height) 1.0)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(let ((s3-2 *display-profile*))
(play-clean 'debug)
(set! *display-profile* s3-2)
)
(set! (-> *game-info* mode) 'play)
(let ((s5-1 (-> s4-0 (-> this task-index))))
(set! (-> *game-info* demo-state) (the-as uint 100))
(logior! (-> *game-info* secrets) (game-secrets scene-player-1))
(process-spawn scene-player :init scene-player-init (-> s5-1 info) #t (-> s5-1 continue))
)
(set-master-mode 'game)
)
)
)
(if gp-0
(sound-play "secrets-scroll")
)
)
0
)
(defmethod respond-progress ((this menu-bigmap-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(handle-cpad-inputs *bigmap*)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
0
)
(defmethod respond-progress ((this menu-missions-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding-height) (seek-ease
(-> arg0 sliding-height)
0.0
(* 0.1 (-> self clock time-adjust-ratio))
0.3
(* 0.01 (-> self clock time-adjust-ratio))
)
)
(let ((s5-0 #f))
(cond
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(when (> (-> this task-line-index) 0)
(set! s5-0 #t)
(+! (-> this task-line-index) -1)
(set! (-> arg0 sliding-height) -1.0)
)
)
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(set! (-> this last-move) (current-time))
(when (< (-> this task-line-index) (+ (-> *progress-state* total-num-tasks) -1))
(+! (-> this task-line-index) 1)
(set! (-> arg0 sliding-height) 1.0)
(set! s5-0 #t)
)
)
((cpad-pressed? 0 triangle confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle confirm))
(if (!= (-> *progress-state* starting-state) 'title)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state arg0)
)
)
(if s5-0
(sound-play "mission-scroll")
)
)
0
)
(defmethod respond-progress ((this menu-highscores-option) (progress progress) (selected? symbol))
"Handle progress menu navigation logic."
(set! (-> progress sliding) (seek-ease
(-> progress sliding)
0.0
(* 0.1 (-> self clock time-adjust-ratio))
0.3
(* 0.001 (-> self clock time-adjust-ratio))
)
)
(set! (-> progress sliding-off) (seek-ease
(-> progress sliding-off)
1.0
(* 0.1 (-> self clock time-adjust-ratio))
-0.3
(* 0.001 (-> self clock time-adjust-ratio))
)
)
(when (-> *bigmap* progress-minimap)
(let ((play-sound? #f))
(cond
((or (cpad-pressed? 0 right l-analog-right)
(and (cpad-hold? 0 right l-analog-right) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(when (< 1 (get-num-highscores))
(set! (-> this last-move) (current-time))
(set! play-sound? #t)
(set! (-> this prev-page-index) (-> this page-index))
(set! (-> this page-index) (get-next-highscore (-> this page-index)))
(set! (-> progress sliding) 1.0)
(set! (-> progress sliding-off) 0.0)
(set! (-> this slide-dir) -1.0)
)
)
((or (cpad-pressed? 0 left l-analog-left)
(and (cpad-hold? 0 left l-analog-left) (>= (- (current-time) (-> this last-move)) (seconds 0.2)))
)
(when (< 1 (get-num-highscores))
(set! (-> this last-move) (current-time))
(set! (-> this prev-page-index) (-> this page-index))
(set! (-> this page-index) (get-prev-highscore (-> this page-index)))
(set! play-sound? #t)
(set! (-> progress sliding) -1.0)
(set! (-> progress sliding-off) 0.0)
(set! (-> this slide-dir) 1.0)
)
)
((cpad-pressed? 0 triangle confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle confirm))
(set! (-> progress sliding) 0.0)
(set! (-> progress sliding-off) 1.0)
(if (!= (-> *progress-state* starting-state) 'title)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state progress)
)
)
(if play-sound?
(sound-play "score-slide")
)
)
)
0
)
(defmethod respond-progress ((this menu-secret-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(let* ((hero? (logtest? (-> *game-info* secrets) (game-secrets hero-mode)))
(min-item (if (not hero?)
0
(-> this num-items)
)
)
(max-item (if (not hero?)
(+ (-> this num-items) -1)
(+ (-> this num-items) -1 (-> this num-hero-items))
)
)
)
(set! (-> arg0 sliding) (seek-ease
(-> arg0 sliding)
0.0
(* 0.1 (-> self clock time-adjust-ratio))
0.3
(* 0.001 (-> self clock time-adjust-ratio))
)
)
(cond
((and hero? (< (-> this item-index) min-item))
(set! (-> this item-index) min-item)
(set! (-> this prev-item-index) min-item)
)
((and (not hero?) (< max-item (-> this item-index)))
(set! (-> this item-index) min-item)
(set! (-> this prev-item-index) min-item)
)
)
(menu-update-purchase-secrets this)
(when (-> *bigmap* progress-minimap)
(let ((scroll-sound? #f))
(cond
((= arg1 #t)
(when (cpad-pressed? 0 confirm)
(cpad-clear! 0 confirm)
(sound-play "generic-beep")
(set! (-> arg0 selected-option) #f)
)
)
(else
(cond
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down) (time-elapsed? (-> this last-move) (seconds 0.2)))
)
(set-time! (-> this last-move))
(when (< (-> this item-index) max-item)
(set! (-> this prev-item-index) (-> this item-index))
(set! scroll-sound? #t)
(+! (-> this item-index) 1)
(set! (-> arg0 sliding) 1.0)
(set! (-> arg0 sliding-off) 0.0)
)
)
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up) (time-elapsed? (-> this last-move) (seconds 0.2)))
)
(set-time! (-> this last-move))
(when (< min-item (-> this item-index))
(set! (-> this prev-item-index) (-> this item-index))
(+! (-> this item-index) -1)
(set! scroll-sound? #t)
(set! (-> arg0 sliding) -1.0)
(set! (-> arg0 sliding-off) 0.0)
)
)
((cpad-pressed? 0 confirm)
(cpad-clear! 0 confirm)
(let ((item (-> this item-index)))
(-> this secret-items item cost)
(let ((flag (-> this secret-items item flag))
(on-off? (= (-> this secret-items item can-toggle) #t))
)
(-> this secret-items item avail-after)
(the int (-> *game-info* skill))
(cond
((and (logtest? (-> *game-info* purchase-secrets) flag) on-off?)
(set! (-> arg0 selected-option) #t)
(sound-play "generic-beep")
)
((= (-> this secret-items item can-toggle) 'auto)
)
((logtest? (-> *game-info* purchase-secrets) flag)
(set! (-> arg0 selected-option) #t)
(sound-play "generic-beep")
)
)
)
)
)
((cpad-pressed? 0 triangle)
(cpad-clear! 0 triangle)
(if (!= (-> *progress-state* starting-state) 'title)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state arg0)
)
)
(if scroll-sound?
(sound-play "secrets-scroll")
)
)
)
)
)
)
(cpad-clear! 0 confirm)
0
)
(defmethod respond-progress ((this menu-game-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(-> *progress-state* game-options-vibrations)
(-> *progress-state* game-options-subtitles)
(let ((gp-0 #f))
(load-level-text-files (the-as int (#if PC_PORT (-> *pc-settings* text-language) (-> *setting-control* user-current language)))) ;; og:preserve-this text-language patch
(cond
((= (-> *progress-state* game-options-item-picked) #f)
(cond
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down)
(>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5))
)
)
(set! (-> *progress-state* game-options-last-move) (current-time))
(cond
((< (-> *progress-state* game-options-item-selected) 3)
(+! (-> *progress-state* game-options-item-selected) 1)
)
(else
(set! (-> *progress-state* game-options-item-selected) 0)
0
)
)
)
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up)
(>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5))
)
)
(set! (-> *progress-state* game-options-last-move) (current-time))
(if (> (-> *progress-state* game-options-item-selected) 0)
(+! (-> *progress-state* game-options-item-selected) -1)
(set! (-> *progress-state* game-options-item-selected) 3)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* game-options-last-move) (current-time))
(set! (-> *progress-state* game-options-item-picked) (the-as basic #t))
(sound-play "generic-beep")
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (= (-> *progress-state* starting-state) 'main)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state arg0)
)
)
)
((-> *progress-state* game-options-item-picked)
(cond
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(set! (-> *progress-state* game-options-item-picked) #f)
(set! (-> *progress-state* game-options-vibrations) (-> *setting-control* user-default vibration))
(set! (-> *progress-state* game-options-subtitles) (-> *setting-control* user-default subtitle))
(set! (-> *progress-state* game-options-language-index)
(the-as int (-> *setting-control* user-default language))
)
(set! (-> *progress-state* game-options-subtitle-language-index)
(the-as int (-> *setting-control* user-default subtitle-language))
)
)
((cpad-pressed? 0 up l-analog-up)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up l-analog-up))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up l-analog-up))
)
((cpad-pressed? 0 down l-analog-down)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down l-analog-down))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down l-analog-down))
)
((and (zero? (-> *progress-state* game-options-item-selected)) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(when (not (-> *progress-state* game-options-vibrations))
(set! (-> *cpad-list* cpads 0 buzz-pause-val 0) (the-as uint 255))
(set! (-> *cpad-list* cpads 0 buzz-pause-time) (the-as uint 15))
(set! (-> *progress-state* game-options-vibrations) #t)
)
)
((and (= (-> *progress-state* game-options-item-selected) 1) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(if (not (-> *progress-state* game-options-subtitles))
(set! (-> *progress-state* game-options-subtitles) #t)
)
)
((and (= (-> *progress-state* game-options-item-selected) 2) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(if (zero? (-> *progress-state* game-options-subtitle-language-index))
(set! (-> *progress-state* game-options-subtitle-language-index) 6)
(+! (-> *progress-state* game-options-subtitle-language-index) -1)
)
)
((and (= (-> *progress-state* game-options-item-selected) 3) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(if (zero? (-> *progress-state* game-options-language-index))
(set! (-> *progress-state* game-options-language-index) 6)
(+! (-> *progress-state* game-options-language-index) -1)
)
)
((and (zero? (-> *progress-state* game-options-item-selected)) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(set! (-> *progress-state* game-options-vibrations) #f)
)
((and (= (-> *progress-state* game-options-item-selected) 1) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(set! (-> *progress-state* game-options-subtitles) #f)
)
((and (= (-> *progress-state* game-options-item-selected) 2) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(cond
((= (-> *progress-state* game-options-subtitle-language-index) 6)
(set! (-> *progress-state* game-options-subtitle-language-index) 0)
0
)
(else
(+! (-> *progress-state* game-options-subtitle-language-index) 1)
)
)
)
((and (= (-> *progress-state* game-options-item-selected) 3) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(cond
((= (-> *progress-state* game-options-language-index) 6)
(set! (-> *progress-state* game-options-language-index) 0)
0
)
(else
(+! (-> *progress-state* game-options-language-index) 1)
)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(if (zero? (-> *progress-state* game-options-item-selected))
(set! (-> *setting-control* user-default vibration) (-> *progress-state* game-options-vibrations))
)
(if (= (-> *progress-state* game-options-item-selected) 1)
(set! (-> *setting-control* user-default subtitle) (-> *progress-state* game-options-subtitles))
)
(if (= (-> *progress-state* game-options-item-selected) 2)
(set! (-> *setting-control* user-default subtitle-language)
(the-as language-enum (-> *progress-state* game-options-subtitle-language-index))
)
)
(when (= (-> *progress-state* game-options-item-selected) 3)
(set! (-> *setting-control* user-default language)
(the-as language-enum (-> *progress-state* game-options-language-index))
)
(load-level-text-files (-> *progress-state* game-options-language-index))
)
(set! (-> *progress-state* game-options-item-picked) #f)
)
)
)
)
(when (and gp-0 (-> *progress-state* game-options-item-picked))
)
)
0
)
(defun update-center-screen ((arg0 menu-graphic-option) (arg1 progress) (arg2 symbol))
(let ((v1-0 #f))
(cond
(#t
(cond
((cpad-hold? 0 left l-analog-left)
(set! (-> *setting-control* user-default display-dx)
(min-max-wrap-around (+ (-> *setting-control* user-default display-dx) -2) -96 96)
)
(set! v1-0 #t)
)
((cpad-hold? 0 right l-analog-right)
(set! (-> *setting-control* user-default display-dx)
(min-max-wrap-around (+ (-> *setting-control* user-default display-dx) 2) -96 96)
)
(set! v1-0 #t)
)
((cpad-hold? 0 up l-analog-up)
(set! (-> *setting-control* user-default display-dy)
(min-max-wrap-around (+ (-> *setting-control* user-default display-dy) -2) -48 48)
)
(set! v1-0 #f)
)
((cpad-hold? 0 down l-analog-down)
(set! (-> *setting-control* user-default display-dy)
(min-max-wrap-around (+ (-> *setting-control* user-default display-dy) 2) -48 48)
)
(set! v1-0 #f)
)
((cpad-pressed? 0 triangle)
(set! (-> *setting-control* user-default display-dx) (-> *progress-state* center-x-backup))
(set! (-> *setting-control* user-default display-dy) (-> *progress-state* center-y-backup))
)
)
)
(else
(when (cpad-pressed? 0 confirm)
(set! (-> *progress-state* center-x-backup) (-> *setting-control* user-default display-dx))
(set! (-> *progress-state* center-y-backup) (-> *setting-control* user-default display-dy))
)
)
)
(when v1-0
(when (< (seconds 0.3) (- (current-time) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (current-time))
(sound-play "roll-over")
)
)
)
0
)
(defmethod respond-progress ((this menu-graphic-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(-> *progress-state* graphic-options-aspect-ratio)
(-> *progress-state* graphic-options-progressive-scan)
(-> *progress-state* video-mode-choice)
(cond
((= (-> *progress-state* graphic-options-item-picked) #f)
(cond
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down)
(>= (- (current-time) (-> *progress-state* graphic-options-last-move)) (seconds 0.5))
)
)
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> arg0 selected-option) #f)
(cond
((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) GAME_TERRITORY_SCEE)
3
2
)
)
(+! (-> *progress-state* graphic-options-item-selected) 1)
(set! (-> arg0 option-index) (-> *progress-state* graphic-options-item-selected))
)
(else
(set! (-> *progress-state* graphic-options-item-selected) 0)
(set! (-> arg0 option-index) (-> *progress-state* graphic-options-item-selected))
)
)
)
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up)
(>= (- (current-time) (-> *progress-state* graphic-options-last-move)) (seconds 0.5))
)
)
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> arg0 selected-option) #f)
(cond
((> (-> *progress-state* graphic-options-item-selected) 0)
(+! (-> *progress-state* graphic-options-item-selected) -1)
(set! (-> arg0 option-index) (-> *progress-state* graphic-options-item-selected))
)
(else
(set! (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) GAME_TERRITORY_SCEE)
3
2
)
)
(set! (-> arg0 option-index) (-> *progress-state* graphic-options-item-selected))
)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> *progress-state* graphic-options-item-picked) #t)
(set! (-> arg0 selected-option) #f)
(sound-play "generic-beep")
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (= (-> *progress-state* starting-state) 'main)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state arg0)
)
)
)
((-> *progress-state* graphic-options-item-picked)
(cond
((and (cpad-pressed? 0 square) (zero? (-> *progress-state* graphic-options-item-selected)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(set! (-> *setting-control* user-default display-dx) 0)
(set! (-> *setting-control* user-default display-dy) 8)
(sound-play "generic-beep")
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(set! (-> *progress-state* graphic-options-item-picked) #f)
(set! (-> *progress-state* graphic-options-aspect-ratio) (get-aspect-ratio))
(set! (-> *progress-state* graphic-options-progressive-scan)
(-> *setting-control* user-default use-progressive-scan)
)
(set! (-> *progress-state* video-mode-choice) (get-video-mode))
)
((and (zero? (-> *progress-state* graphic-options-item-selected))
(cpad-pressed? 0 up right down left l-analog-up l-analog-right l-analog-down l-analog-left)
)
(update-center-screen this arg0 #t)
)
((and (= (-> *progress-state* graphic-options-item-selected) 1) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(set! (-> *progress-state* graphic-options-aspect-ratio) 'aspect4x3)
)
((and (= (-> *progress-state* graphic-options-item-selected) 2) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(if (not (-> *progress-state* graphic-options-progressive-scan))
(set! (-> *progress-state* graphic-options-progressive-scan) #t)
)
)
((and (= (-> *progress-state* graphic-options-item-selected) 3) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(if (!= (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *progress-state* video-mode-choice) 'pal)
)
)
((and (= (-> *progress-state* graphic-options-item-selected) 1) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(set! (-> *progress-state* graphic-options-aspect-ratio) 'aspect16x9)
)
((and (= (-> *progress-state* graphic-options-item-selected) 2) (cpad-pressed? 0 right l-analog-right))
(when (-> *progress-state* graphic-options-progressive-scan)
(sound-play "generic-beep")
(set! (-> *progress-state* graphic-options-progressive-scan) #f)
(set! (-> *setting-control* user-default use-progressive-scan) #f)
)
)
((and (= (-> *progress-state* graphic-options-item-selected) 3) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(if (!= (-> *progress-state* video-mode-choice) 'ntsc)
(set! (-> *progress-state* video-mode-choice) 'ntsc)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(if (zero? (-> *progress-state* graphic-options-item-selected))
(update-center-screen this arg0 #t)
)
(when (= (-> *progress-state* graphic-options-item-selected) 1)
(if (!= (-> *progress-state* graphic-options-aspect-ratio) (-> *setting-control* user-default aspect-ratio))
(set! (-> *setting-control* user-default aspect-ratio) (-> *progress-state* graphic-options-aspect-ratio))
)
)
(when (and (= (-> *progress-state* graphic-options-item-selected) 2)
(-> *progress-state* graphic-options-progressive-scan)
(not (-> *setting-control* user-default use-progressive-scan))
)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(push-state arg0)
(set-next-state arg0 'progressive-mode-warning 0)
)
(when (and (= (-> *progress-state* graphic-options-item-selected) 3)
(!= (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice))
)
(let ((a0-173 (-> *progress-state* video-mode-choice)))
(case a0-173
(('pal)
(set! (-> *setting-control* user-default video-mode) a0-173)
)
(('ntsc)
(push-state arg0)
(set-next-state arg0 'video-mode-warning 0)
)
)
)
)
(set! (-> *progress-state* graphic-options-item-picked) #f)
)
)
)
)
0
)
(defun update-restart-quit ((arg0 menu-option) (arg1 progress) (arg2 symbol))
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
)
(when arg2
(cond
((cpad-pressed? 0 left l-analog-left)
(when (not (-> v1-1 0))
(set! gp-0 #t)
(set! (-> v1-1 0) #t)
)
)
((cpad-pressed? 0 right l-analog-right)
(set! gp-0 (-> v1-1 0))
(set! (-> v1-1 0) #f)
(format #t "HL ~A~%" (-> v1-1 0))
)
((cpad-pressed? 0 confirm)
(cond
((and (-> v1-1 0) (= (-> arg0 name) (text-id progress-root-restart-mission)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(restart-mission)
(set-next-state arg1 'go-away 0)
)
((and (-> v1-1 0) (= (-> arg0 name) (text-id progress-quit)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(initialize! *game-info* 'game (the-as game-save #f) "title-restart")
)
)
)
)
)
(when gp-0
)
)
0
)
(defmethod respond-progress ((this menu-qr-option) (arg0 progress) (arg1 symbol))
"Handle progress menu navigation logic."
(-> *progress-state* qr-options-restart)
(-> *progress-state* qr-options-quit)
(cond
((= (-> *progress-state* qr-options-item-picked) #f)
(set! (-> arg0 selected-option) #f)
(set! (-> arg0 option-index) (-> *progress-state* qr-options-item-selected))
(cond
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down)
(>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5))
)
)
(set! (-> *progress-state* qr-options-last-move) (current-time))
(cond
((< (-> *progress-state* qr-options-item-selected) 1)
(+! (-> *progress-state* qr-options-item-selected) 1)
(set! (-> arg0 selected-option) #f)
(set! (-> arg0 option-index) 0)
0
)
(else
(set! (-> *progress-state* qr-options-item-selected) 0)
(set! (-> arg0 selected-option) #f)
(set! (-> arg0 option-index) 0)
0
)
)
)
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up)
(>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5))
)
)
(set! (-> *progress-state* qr-options-last-move) (current-time))
(cond
((> (-> *progress-state* qr-options-item-selected) 0)
(+! (-> *progress-state* qr-options-item-selected) -1)
(set! (-> arg0 selected-option) #f)
(set! (-> arg0 option-index) 1)
)
(else
(set! (-> *progress-state* qr-options-item-selected) 1)
(set! (-> arg0 selected-option) #f)
(set! (-> arg0 option-index) 1)
)
)
)
((cpad-pressed? 0 confirm)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(set! (-> *progress-state* qr-options-last-move) (current-time))
(set! (-> *progress-state* qr-options-item-picked) (the-as basic #t))
(set! (-> arg0 selected-option) #t)
(sound-play "generic-beep")
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (!= (-> *progress-state* starting-state) 'title)
(sound-play "window-contract")
(sound-play "generic-beep")
)
(pop-state arg0)
)
)
)
((-> *progress-state* qr-options-item-picked)
(cond
((and (cpad-pressed? 0 triangle) (zero? (-> *progress-state* qr-options-item-selected)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(sound-play "generic-beep")
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> arg0 selected-option) #f)
(set! (-> *progress-state* yes-no-choice) #f)
)
((and (cpad-pressed? 0 triangle) (= (-> *progress-state* qr-options-item-selected) 1))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(sound-play "generic-beep")
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> arg0 selected-option) #f)
(set! (-> *progress-state* yes-no-choice) #f)
)
((and (zero? (-> *progress-state* qr-options-item-selected)) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(update-restart-quit this arg0 #t)
)
((and (zero? (-> *progress-state* qr-options-item-selected)) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(update-restart-quit this arg0 #t)
)
((and (= (-> *progress-state* qr-options-item-selected) 1) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
(update-restart-quit this arg0 #t)
)
((and (= (-> *progress-state* qr-options-item-selected) 1) (cpad-pressed? 0 right l-analog-right))
(sound-play "generic-beep")
(update-restart-quit this arg0 #t)
)
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> arg0 selected-option) #f)
(set! (-> *progress-state* yes-no-choice) #f)
)
((cpad-pressed? 0 confirm)
(sound-play "generic-beep")
(when (zero? (-> *progress-state* qr-options-item-selected))
(set! (-> arg0 selected-option) #t)
(set! (-> arg0 option-index) 0)
(update-restart-quit this arg0 #t)
)
(when (= (-> *progress-state* qr-options-item-selected) 1)
(set! (-> arg0 selected-option) #t)
(set! (-> arg0 option-index) 1)
(update-restart-quit this arg0 #t)
)
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> *progress-state* yes-no-choice) #f)
)
)
)
)
0
)