Files
jak-project/goal_src/engine/ui/progress/progress.gc
T
ManDude 66e395d547 [decompiler] detect seek! and seekl! macros (#1317)
* detect `seek!` and `seekl!`

* fancy struct instead of pair mess

* fixes

* i think this was wrong?

* update refs

* update source

* More logical branching

* even better branching
2022-04-18 15:01:44 -04:00

2493 lines
101 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: progress.gc
;; name in dgo: progress
;; dgos: GAME, ENGINE
;; DECOMP BEGINS
(deftype progress-global-state (basic)
((aspect-ratio-choice symbol :offset-assert 4)
(video-mode-choice symbol :offset-assert 8)
(yes-no-choice symbol :offset-assert 12)
(which int32 :offset-assert 16)
(starting-state progress-screen :offset-assert 24)
(last-slot-saved int32 :offset-assert 32)
(slider-backup float :offset-assert 36)
(language-backup language-enum :offset-assert 40)
(on-off-backup symbol :offset-assert 48)
(center-x-backup int32 :offset-assert 52)
(center-y-backup int32 :offset-assert 56)
(aspect-ratio-backup symbol :offset-assert 60)
(last-slider-sound time-frame :offset-assert 64)
)
:method-count-assert 9
:size-assert #x48
:flag-assert #x900000048
)
(define *progress-state* (new 'static 'progress-global-state :yes-no-choice #f :which -1 :last-slot-saved -1))
(defun get-game-count ((arg0 int))
(-> *game-counts* data arg0)
)
(defun progress-allowed? ()
(not (or (-> *setting-control* current talking)
(-> *setting-control* current movie)
(movie?)
(handle->process (-> *game-info* pov-camera-handle))
(handle->process (-> *game-info* other-camera-handle))
(< (-> *display* base-frame-counter) (-> *game-info* letterbox-time))
(< (-> *display* base-frame-counter) (-> *game-info* blackout-time))
(!= (-> *setting-control* current bg-a) 0.0)
(!= (-> *setting-control* current bg-a-force) 0.0)
(not (-> *setting-control* 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*)
)
)
)
)
(defun pause-allowed? ()
(not (or (< (-> *display* base-frame-counter) (-> *game-info* blackout-time))
(!= (-> *setting-control* current bg-a) 0.0)
(!= (-> *setting-control* current bg-a-force) 0.0)
(not (-> *setting-control* current allow-pause))
(handle->process (-> *game-info* auto-save-proc))
(not *target*)
)
)
)
(defun init-game-options ((obj progress))
"Set the options for all of the menus."
;; start off by making them all invalid
(dotimes (i (progress-screen max))
(set! (-> *options-remap* i) #f)
)
;; main menu
(set! (-> *options-remap* (progress-screen settings))
(case *kernel-boot-message*
(('demo)
;; game demo
*main-options-demo*
)
(('demo-shared)
;; game demo with external launcher
*main-options-demo-shared*
)
(else
;; normal game
*main-options*
)
)
)
(set! (-> *options-remap* (progress-screen game-settings))
(cond
((!= *kernel-boot-message* 'play)
(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))))
;; if ntsc-j and we're not using language cheat (and holding l2+r2)
*game-options-japan*
)
(else
*game-options*
)
)
)
(set! (-> *options-remap* (progress-screen graphic-settings))
(if (and (= (-> *progress-state* starting-state) (progress-screen title))
(or (= (scf-get-territory) GAME_TERRITORY_SCEE)
(and (= *progress-cheat* 'pal) (cpad-hold? 0 l2) (cpad-hold? 0 r2))))
;; (only if we came from title) if PAL or we're using the PAL cheat (and holding l2+r2)
*graphic-title-options-pal*
*graphic-options*
)
)
(set! (-> *options-remap* (progress-screen sound-settings)) *sound-options*)
(set! (-> *options-remap* (progress-screen memcard-no-space)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-not-inserted)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-not-formatted)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-format)) *yes-no-options*)
(set! (-> *options-remap* (progress-screen memcard-data-exists)) *yes-no-options*)
(set! (-> *options-remap* (progress-screen memcard-insert)) *ok-options*)
(set! (-> *options-remap* (progress-screen load-game)) *load-options*)
(set! (-> *options-remap* (progress-screen save-game)) *save-options*)
(set! (-> *options-remap* (progress-screen save-game-title)) *save-options-title*)
(set! (-> *options-remap* (progress-screen memcard-error-loading)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-error-saving)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-error-formatting)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-error-creating)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-auto-save-error)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-removed)) *ok-options*)
(set! (-> *options-remap* (progress-screen memcard-no-data)) *yes-no-options*)
(set! (-> *options-remap* (progress-screen title)) *title*)
(set! (-> *options-remap* (progress-screen settings-title)) *options*)
(set! (-> *options-remap* (progress-screen auto-save)) *ok-options*)
(set! (-> *options-remap* (progress-screen pal-change-to-60hz)) *yes-no-options*)
(set! (-> *options-remap* (progress-screen pal-now-60hz)) *yes-no-options*)
(set! (-> *options-remap* (progress-screen no-disc)) *ok-options*)
(set! (-> *options-remap* (progress-screen bad-disc)) *ok-options*)
(set! (-> *options-remap* (progress-screen quit)) *yes-no-options*)
(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! (-> *game-options* 0 value-to-modify) (&-> *setting-control* default vibration))
(set! (-> *game-options* 1 value-to-modify) (&-> *setting-control* default play-hints))
(set! (-> *game-options* 2 value-to-modify) (&-> *setting-control* default language))
(set! (-> *game-options-japan* 0 value-to-modify) (&-> *setting-control* default vibration))
(set! (-> *game-options-japan* 1 value-to-modify) (&-> *setting-control* default play-hints))
(set! (-> *game-options-demo* 0 value-to-modify) (&-> *setting-control* default vibration))
(set! (-> *game-options-demo* 1 value-to-modify) (&-> *setting-control* default play-hints))
(set! (-> *graphic-options* 1 value-to-modify) (&-> *progress-state* aspect-ratio-choice))
(set! (-> *graphic-title-options-pal* 1 value-to-modify) (&-> *progress-state* video-mode-choice))
(set! (-> *graphic-title-options-pal* 2 value-to-modify) (&-> *progress-state* aspect-ratio-choice))
(set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume))
(set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume))
(set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume))
(set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice))
(none)
)
(defun make-current-level-available-to-progress ()
"exactly what it says on the tin."
(when (and *target* (-> *level* border?))
(let* ((cur-lev (-> *target* current-level))
(lev-idx (+ (-> cur-lev info index) -1))
)
(if (and (>= lev-idx 0)
(< lev-idx (-> *level-task-data-remap* length))
(zero? (-> *game-info* level-opened (-> *level-task-data-remap* lev-idx)))
(or (= *kernel-boot-message* 'play) (= (-> cur-lev nickname) 'mis))
)
(set! (-> *game-info* level-opened (-> *level-task-data-remap* lev-idx)) (the-as uint 1))
)
)
)
0
(none)
)
(defun make-levels-with-tasks-available-to-progress ()
"Open levels that have tasks to do!"
;; go through EVERY LEVEL'S TASKS
(dotimes (i (length *level-task-data*))
;; level tasks
(let ((tasks (-> *level-task-data* i)))
;; unless there's no tasks or the level is already open...
(unless (or (= tasks #f) (= (-> *game-info* level-opened i) 1))
(cond
((!= *kernel-boot-message* 'play)
(if (= (-> tasks level-name-id) (game-text-id misty-level-name))
(set! (-> *game-info* level-opened i) (the-as uint 1))
)
)
(*cheat-mode*
(set! (-> *game-info* level-opened i) (the-as uint 1))
)
(else
(dotimes (ii (-> tasks nb-of-tasks))
(if (and (zero? (-> *game-info* level-opened ii))
(!= ii (-> tasks buzzer-task-index))
(task-known? (-> tasks task-info ii task-id))
)
(set! (-> *game-info* level-opened ii) (the-as uint 1))
)
)
)
)
)
)
)
0
(none)
)
(defun get-next-task-up ((cur-task-idx int) (lev-idx int))
"find next available task. skips over unknown tasks and doesn't do anything if none are found"
(let ((gp-0 cur-task-idx))
(let ((s4-0 (+ cur-task-idx 1))
(s3-0 (-> *level-task-data* lev-idx))
)
(while (and (< s4-0 (-> s3-0 nb-of-tasks)) (= gp-0 cur-task-idx))
(if (or *cheat-mode* (task-known? (-> s3-0 task-info s4-0 task-id)))
(set! gp-0 s4-0)
)
(+! s4-0 1)
)
)
gp-0
)
)
(defun get-next-task-down ((cur-task-idx int) (lev-idx int))
"find previous available task. skips over unknown tasks and doesn't do anything if none are found"
(let ((gp-0 cur-task-idx))
(let ((s4-0 (+ cur-task-idx -1))
(s3-0 (-> *level-task-data* lev-idx))
)
(while (and (>= s4-0 0) (= gp-0 cur-task-idx))
(if (or *cheat-mode* (task-known? (-> s3-0 task-info s4-0 task-id)))
(set! gp-0 s4-0)
)
(+! s4-0 -1)
)
)
gp-0
)
)
(defun get-next-level-up ((lev-idx int))
(let ((gp-0 lev-idx))
(let ((s4-0 (+ lev-idx 1)))
(while (and (< s4-0 (length *level-task-data*)) (= gp-0 lev-idx))
(if (= (-> *game-info* level-opened s4-0) 1)
(set! gp-0 s4-0)
)
(+! s4-0 1)
)
)
gp-0
)
)
(defun get-next-level-down ((lev-idx int))
(let ((v0-0 lev-idx))
(let ((v1-0 (+ lev-idx -1)))
(while (and (>= v1-0 0) (= v0-0 lev-idx))
(if (= (-> *game-info* level-opened v1-0) 1)
(set! v0-0 v1-0)
)
(+! v1-0 -1)
)
)
v0-0
)
)
(defun calculate-completion ((the-progress progress))
"Updates counters and calculates game completion.
Cells are tallied 80%
Buzzers are tallied 10%
Orbs are tallied 10%"
(let ((current-cells 0)
(current-buzzers 0)
(current-orbs 0)
(total-cells 0)
(total-buzzers 0)
(total-orbs 0))
(dotimes (s5-0 (length *level-task-data*))
(let ((s4-0 (-> *level-task-data* s5-0)))
(when (!= s4-0 #f)
(when (or (= *kernel-boot-message* 'play) (= (-> s4-0 level-name-id) (game-text-id misty-level-name)))
(dotimes (s3-0 (-> s4-0 nb-of-tasks))
(if (= (get-task-status (-> s4-0 task-info s3-0 task-id)) (task-status invalid))
(1+! current-cells)
)
)
(set! total-cells (+ total-cells (-> s4-0 nb-of-tasks)))
(set! current-orbs (+ current-orbs (-> *game-info* money-per-level s5-0)))
(set! total-orbs (+ total-orbs (-> *game-counts* data s5-0 money-count)))
(let ((v1-20 (-> s4-0 buzzer-task-index)))
(when (!= v1-20 -1)
(set! current-buzzers (+ current-buzzers (buzzer-count *game-info* (-> s4-0 task-info v1-20 task-id))))
(set! total-buzzers (+ total-buzzers (-> *game-counts* data s5-0 buzzer-count)))
)
)
)
)
)
)
(when the-progress
(set! (-> the-progress total-nb-of-power-cells) total-cells)
(set! (-> the-progress total-nb-of-buzzers) total-buzzers)
(set! (-> the-progress total-nb-of-orbs) total-orbs)
)
(+ (/ (* 80.0 (the float current-cells)) (the float total-cells))
(/ (* 10.0 (the float current-orbs)) (the float total-orbs))
(/ (* 10.0 (the float current-buzzers)) (the float total-buzzers))
))
)
(define *progress-save-info* (new 'global 'mc-slot-info))
(defmacro progress-make-manipy-icon (obj &key skel
&key x
&key y
&key z
&key scale-x
&key scale-y
)
`(when (< (-> ,obj nb-of-icons) 6)
(let ((icon-idx (-> ,obj nb-of-icons)))
(set! (-> ,obj icons icon-idx) (new 'static 'hud-icon))
(let ((new-manipy (make-init-process manipy manipy-init (new 'static 'vector :w 1.0) #f ,skel #f
:to ,obj
:stack *scratch-memory-top*
)))
(when new-manipy
(set! (-> (-> new-manipy) draw dma-add-func) dma-add-process-drawable-hud)
(set-vector! (-> (-> new-manipy) root trans) 0.0 0.0 0.0 1.0)
(set-vector! (-> (-> new-manipy) root scale) ,scale-x ,scale-y ,scale-x 1.0)
(when #f
(send-event (ppointer->process new-manipy) 'trans-hook #f)
)
)
(set! (-> ,obj icons icon-idx icon) new-manipy)
(when new-manipy
(logior! (-> new-manipy 0 mask) (process-mask pause))
(logclear! (-> new-manipy 0 mask) (process-mask menu progress))
(set! (-> (-> new-manipy) root trans z) ,z)
(set! (-> ,obj icons icon-idx icon-x) ,x)
(set! (-> ,obj icons icon-idx icon-y) ,y)
(set! (-> ,obj icons icon-idx icon-z) 0)
(set! (-> ,obj icons icon-idx scale-x) ,scale-x)
(set! (-> ,obj icons icon-idx scale-y) ,scale-y)
)
)
)
(+! (-> ,obj nb-of-icons) 1)
)
)
(defmethod initialize-icons progress ((obj progress))
(progress-make-manipy-icon obj :skel *fuelcell-naked-sg*
:x 256
:y 77
:z (meters 0.5)
:scale-x 0.006
:scale-y 0.006
)
(progress-make-manipy-icon obj :skel *fuelcell-naked-sg*
:x 256
:y 77
:z (meters 0.5)
:scale-x 0.006
:scale-y 0.006
)
(progress-make-manipy-icon obj :skel *fuelcell-naked-sg*
:x 256
:y 77
:z (meters 0.5)
:scale-x 0.006
:scale-y 0.006
)
(progress-make-manipy-icon obj :skel *fuelcell-naked-sg*
:x 256
:y 77
:z (meters 0.5)
:scale-x 0.006
:scale-y 0.006
)
(progress-make-manipy-icon obj :skel *money-sg*
:x -320
:y 253
:z (meters 17)
:scale-x 0.013
:scale-y -0.015
)
(progress-make-manipy-icon obj :skel *money-sg*
:x -320
:y 253
:z (meters 0.25)
:scale-x 0.008
:scale-y -0.009
)
(send-event (ppointer->process (-> obj icons 1 icon)) 'set-frame-num 2.5)
(send-event (ppointer->process (-> obj icons 2 icon)) 'set-frame-num 10.0)
(send-event (ppointer->process (-> obj icons 3 icon)) 'set-frame-num 15.5)
0
(none)
)
(defmethod enter! progress ((obj progress) (screen progress-screen) (option int))
(when (!= (-> obj display-state) screen)
(set! (-> *progress-state* yes-no-choice) #f)
(set! (-> obj selected-option) #f)
(set! (-> obj option-index) option)
(set! (-> obj last-option-index-change) (-> *display* real-frame-counter))
(set! (-> obj display-state) screen)
(set! (-> obj next-display-state) screen)
(set-transition-speed! obj)
(case (-> obj display-state)
(((progress-screen memcard-creating))
(auto-save-command 'create-file 0 0 obj)
)
(((progress-screen memcard-loading))
(set! (-> *progress-state* last-slot-saved) (-> *progress-state* which))
(sound-volume-off)
(auto-save-command 'restore 0 (-> *progress-state* which) obj)
)
(((progress-screen memcard-saving))
(set! (-> *progress-state* last-slot-saved) (-> *progress-state* which))
(auto-save-command 'save 0 (-> *progress-state* which) obj)
)
(((progress-screen memcard-formatting))
(auto-save-command 'format-card 0 0 obj)
)
(((progress-screen save-game) (progress-screen load-game))
(set! (-> obj option-index) (max 0 (-> *progress-state* last-slot-saved)))
)
(((progress-screen memcard-removed))
(set! (-> *progress-state* last-slot-saved) 0)
)
)
)
0
(none)
)
(defmethod push! progress ((obj progress))
(let ((v1-0 (-> obj display-state-pos)))
(cond
((< v1-0 5)
(set! (-> obj display-state-stack v1-0) (-> obj display-state))
(set! (-> obj option-index-stack v1-0) (-> obj option-index))
(set! (-> obj display-state-pos) (+ v1-0 1))
)
(else
(format #t "ERROR: Can't push any more states on the display-state-stack.~%")
)
)
)
0
(none)
)
(defmethod pop! progress ((obj progress))
(let ((v1-0 (-> obj display-state-pos)))
(cond
((> v1-0 0)
(let ((a2-0 (+ v1-0 -1)))
(set! (-> obj display-state-pos) a2-0)
(enter! obj (-> obj display-state-stack a2-0) (-> obj option-index-stack a2-0))
)
)
(else
(set-master-mode 'game)
)
)
)
0
(none)
)
(defmethod set-transition-progress! progress ((obj progress) (arg0 int))
(set! (-> obj transition-offset) arg0)
(set! (-> obj transition-offset-invert) (- 512 arg0))
(set! (-> obj transition-percentage) (* (1/ 512) (the float arg0)))
(set! (-> obj transition-percentage-invert) (- 1.0 (-> obj transition-percentage)))
0
(none)
)
(defmethod set-transition-speed! progress ((obj progress))
(case (-> obj display-state)
(((progress-screen fuel-cell)
(progress-screen money)
(progress-screen buzzer)
(progress-screen load-game)
(progress-screen save-game)
(progress-screen save-game-title)
)
(set! (-> obj transition-speed) 15.0)
)
(else
(set! (-> obj transition-speed) 45.0)
)
)
0
(none)
)
(defbehavior progress-init-by-other progress ()
(logclear! (-> self mask) (process-mask menu progress))
(set! (-> self nb-of-particles) 0)
(set! (-> self max-nb-of-particles) 40)
(set! (-> self nb-of-icons) 0)
(set! (-> self in-out-position) 4096)
(set! (-> self current-debug-string) 0)
(set! (-> self current-debug-group) 0)
(set! (-> self display-level-index) 0)
(set! (-> self next-level-index) 0)
(set! (-> self option-index) 0)
(set! (-> self selected-option) #f)
(set! (-> self card-info) #f)
(set! (-> self last-option-index-change) (-> *display* real-frame-counter))
(set! (-> self display-state-pos) 0)
(set! (-> self in-transition) #f)
(set! (-> self force-transition) #f)
(set! (-> self stat-transition) #f)
(set! (-> self level-transition) 0)
(set! (-> self left-side-x-scale) 0.0)
(set! (-> self left-side-y-scale) 0.0)
(set! (-> self right-side-x-scale) 0.0)
(set! (-> self right-side-y-scale) 0.0)
(dotimes (v1-6 5)
(set! (-> self display-state-stack v1-6) (progress-screen fuel-cell))
)
(init-game-options self)
(initialize-icons self)
(initialize-particles self)
(set! (-> self particle-state 0) 0)
(set! (-> self particle-state 1) 0)
(set! (-> self particle-state 2) 0)
(set! (-> self particle-state 3) 0)
(set! (-> self particle-state 4) 0)
(set! (-> self particle-state 5) 0)
(set! (-> self particle-state 6) 1)
(set! (-> self particle-state 7) 1)
(set! (-> self particle-state 8) 1)
(set! (-> self particle-state 9) 1)
(set! (-> self particle-state 10) 1)
(set! (-> self particle-state 11) 1)
(set! (-> self particle-state 12) 1)
(set! (-> self particle-state 13) 1)
(set! (-> self particle-state 14) 0)
(set! (-> self particle-state 15) 0)
(set! (-> self particle-state 16) 3)
(set! (-> self particle-state 17) 0)
(set! (-> self particle-state 18) 0)
(set! (-> self particle-state 19) 0)
(set! (-> self particle-state 20) 0)
(set! (-> self particle-state 21) 0)
(set! (-> self particle-state 22) 0)
(set! (-> self particle-state 23) 0)
(set! (-> self particle-state 24) 0)
(set! (-> self particle-state 25) 0)
(set! (-> self particle-state 26) 0)
(set! (-> self particle-state 27) 0)
(set! (-> self particle-state 28) 0)
(set! (-> self particle-state 29) 0)
(set! (-> self particle-state 30) 0)
(set! (-> self particle-state 31) 0)
(let ((gp-0 (new 'stack-no-clear 'quaternion)))
(quaternion-axis-angle! gp-0 0.0 1.0 0.0 16384.0)
(quaternion*! (-> self icons 0 icon 0 root quat) gp-0 (-> self icons 0 icon 0 root quat))
(quaternion-axis-angle! gp-0 0.0 1.0 0.0 32768.0)
(quaternion*! (-> self icons 1 icon 0 root quat) gp-0 (-> self icons 1 icon 0 root quat))
(quaternion-axis-angle! gp-0 0.0 1.0 0.0 49152.0)
(quaternion*! (-> self icons 2 icon 0 root quat) gp-0 (-> self icons 2 icon 0 root quat))
(quaternion-axis-angle! gp-0 0.0 1.0 0.0 0.0)
(quaternion*! (-> self icons 3 icon 0 root quat) gp-0 (-> self icons 3 icon 0 root quat))
)
(adjust-ratios self (get-aspect-ratio) (get-video-mode))
(adjust-icons self)
(set! (-> self event-hook) (-> progress-waiting event))
(go progress-waiting)
(none)
)
(define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800)))
(defconstant *progress-stack-top* (&-> *progress-stack* #x3800))
(defun activate-progress ((creator process) (screen progress-screen))
(when *target*
(cond
((not *progress-process*)
(when (progress-allowed?)
(hide-hud)
(make-levels-with-tasks-available-to-progress)
(disable-level-text-file-loading)
(set! (-> *progress-state* starting-state) screen)
(let ((s4-0 (get-process *default-dead-pool* progress #x4000)))
(set! *progress-process*
(the-as (pointer progress) (when s4-0
(let ((t9-5 (method-of-type progress activate)))
(t9-5 (the-as progress s4-0) creator 'progress (&-> *progress-stack* 14336))
)
(run-now-in-process s4-0 progress-init-by-other)
(-> s4-0 ppointer)
)
)
)
)
(let ((s5-1 *progress-process*))
(set! (-> s5-1 0 completion-percentage) (calculate-completion (-> s5-1 0)))
(set! *master-mode* 'progress)
(let ((s4-1 (-> *target* current-level)))
(cond
((!= *kernel-boot-message* 'play)
(set! (-> s5-1 0 display-level-index) 4)
)
((or (= s4-1 #f) (< (length *level-task-data-remap*) (-> s4-1 info index)))
(set! (-> s5-1 0 display-level-index) 0)
0
)
(else
(set! (-> s5-1 0 display-level-index) (-> *level-task-data-remap* (+ (-> s4-1 info index) -1)))
)
)
)
(set! (-> s5-1 0 next-level-index) (-> s5-1 0 display-level-index))
(set! (-> s5-1 0 display-state) (progress-screen invalid))
(set-transition-progress! (-> s5-1 0) 512)
(set! (-> s5-1 0 task-index) (get-next-task-up -1 (-> s5-1 0 display-level-index)))
)
)
(when *progress-process*
(enter! (-> *progress-process* 0) screen 0)
(set! (-> *progress-process* 0 card-info) #f)
)
)
(else
(push! (-> *progress-process* 0))
(set! (-> *progress-process* 0 next-display-state) screen)
(set! (-> *progress-process* 0 card-info) #f)
)
)
)
0
(none)
)
(defun deactivate-progress ()
(when (and *progress-process* (= (-> *progress-process* 0 next-state name) 'progress-gone))
(copy-settings-from-target! *setting-control*)
(dotimes (gp-0 (-> *progress-process* 0 nb-of-particles))
(kill-and-free-particles (-> *progress-process* 0 particles gp-0 part))
(set! (-> *progress-process* 0 particles gp-0 part matrix) -1)
)
(set! (-> *progress-process* 0 nb-of-particles) 0)
(deactivate (-> *progress-process* 0))
(set! *progress-process* (the-as (pointer progress) #f))
(enable-level-text-file-loading)
)
0
(none)
)
(defun hide-progress-screen ()
"shoo!"
(if *progress-process*
(send-event (ppointer->process *progress-process*) 'go-away)
)
0
(none)
)
(defun hide-progress-icons ()
(let ((v1-0 6))
(dotimes (a0-0 8)
(set! (-> *progress-process* 0 particles v1-0 init-pos x) -320.0)
(+! v1-0 1)
)
)
(set! (-> *progress-process* 0 particles 5 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 14 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 15 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 19 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 20 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 21 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 22 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 23 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 24 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 25 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 26 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 27 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 28 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 29 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 30 init-pos x) -320.0)
(set! (-> *progress-process* 0 particles 31 init-pos x) -320.0)
(set! (-> *progress-process* 0 icons 4 icon-x) -320)
0
(none)
)
(defmethod relocate game-count-info ((obj game-count-info) (arg0 int))
"Load in the game-count-info. This is a bit of a hack."
(set! *game-counts* obj)
)
(defmethod relocate progress ((obj progress) (arg0 int))
(dotimes (v1-0 (-> obj nb-of-particles))
(when (-> obj particles v1-0 part)
(if (nonzero? (-> obj particles v1-0 part))
(set! (-> obj particles v1-0 part)
(the-as sparticle-launch-control (&+ (the-as pointer (-> obj particles v1-0 part)) arg0))
)
)
)
)
(the-as progress ((method-of-type process relocate) obj arg0))
)
(defmethod adjust-sprites progress ((obj progress))
(let ((f0-1 (* (1/ METER_LENGTH) (the float (-> obj in-out-position)))))
(set! (-> obj particles 2 init-pos x) (the float (+ (-> obj right-x-offset) 409 (the int (* 301.5 f0-1)))))
(set! (-> obj particles 1 init-pos x) (the float (+ (-> obj left-x-offset) 59)))
(set! (-> obj left-side-x-scale) (meters (+ (/ 3.5 (-> obj sides-x-scale)) (* 10.0 f0-1))))
(set! (-> obj left-side-y-scale) (meters (+ (-> obj sides-y-scale) (* 10.0 f0-1))))
(set! (-> obj right-side-x-scale) (meters (+ (/ 6.0 (-> obj sides-x-scale)) (* 4.0 f0-1))))
(set! (-> obj right-side-y-scale) (meters (+ (-> obj sides-y-scale) (* 4.0 f0-1))))
)
(dotimes (s5-0 (-> obj nb-of-particles))
(set! (-> obj particles s5-0 pos x) (+ -256.0 (-> obj particles s5-0 init-pos x)))
(set! (-> obj particles s5-0 pos y)
(* 0.5 (- (* (-> obj particles s5-0 init-pos y) (-> *video-parms* relative-y-scale))
(the float (-> *video-parms* screen-sy))
)
)
)
(set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z))
(if (> (-> obj particles s5-0 part matrix) 0)
(set-vector! (sprite-get-user-hvdf (-> obj particles s5-0 part matrix))
(the float (+ (the int (-> obj particles s5-0 pos x)) 2048))
(the float (+ (the int (-> obj particles s5-0 pos y)) 2048))
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))
(-> *math-camera* hvdf-off w)
)
)
(spawn (-> obj particles s5-0 part) *null-vector*)
)
0
(none)
)
(defmethod adjust-icons progress ((obj progress))
(dotimes (v1-0 (-> obj nb-of-icons))
(when (>= v1-0 4)
(set-vector! (-> obj icons v1-0 icon 0 root scale)
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
(* (-> obj icons v1-0 scale-y) (-> *video-parms* relative-y-scale))
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
1.0
)
(set! (-> obj icons v1-0 icon 0 root trans x) (the float (+ (-> obj icons v1-0 icon-x) -256)))
(set! (-> obj icons v1-0 icon 0 root trans y)
(* (-> *video-parms* relative-y-scale)
(- (* (-> *video-parms* relative-y-scale) (the float (-> obj icons v1-0 icon-y)))
(the float (-> *video-parms* screen-sy))
)
)
)
)
)
0
(none)
)
(defmethod adjust-ratios progress ((obj progress) (aspect symbol) (video-mode symbol))
(case aspect
(('aspect4x3)
(set! (-> obj sides-x-scale) 1.0)
(set! (-> obj sides-y-scale) 13.0)
(set! (-> obj left-x-offset) 0)
(set! (-> obj right-x-offset) 0)
(set! (-> obj button-scale) 1.0)
(set! (-> obj slot-scale) 8192.0)
(set! (-> obj small-orb-y-offset) 58)
(set! (-> obj icons 5 scale-x) 0.008)
(set! (-> obj icons 5 scale-y) -0.009)
(set! (-> obj big-orb-y-offset) 243)
(set! (-> obj icons 4 scale-x) 0.013)
(set! (-> obj icons 4 scale-y) -0.015)
)
(('aspect16x9)
(set! (-> obj sides-x-scale) 1.2)
(set! (-> obj sides-y-scale) 9.8)
(set! (-> obj left-x-offset) -10)
(set! (-> obj right-x-offset) 17)
(set! (-> obj button-scale) 1.05)
(set! (-> obj slot-scale) 6144.0)
(set! (-> obj small-orb-y-offset) 59)
(set! (-> obj icons 5 scale-x) 0.008)
(set! (-> obj icons 5 scale-y) -0.0098)
(set! (-> obj big-orb-y-offset) 255)
(set! (-> obj icons 4 scale-x) 0.017)
(set! (-> obj icons 4 scale-y) -0.0205)
)
)
(when (= video-mode 'pal)
(set! (-> obj icons 5 scale-y) (* 1.15 (-> obj icons 5 scale-y)))
(set! (-> obj icons 4 scale-x) (* 1.05 (-> obj icons 4 scale-x)))
(set! (-> obj icons 4 scale-y) (* (-> obj icons 4 scale-y) (the-as float (if (= aspect 'aspect16x9)
1.18
1.15
)
)
)
)
(+! (-> obj big-orb-y-offset) (if (= aspect 'aspect16x9)
3
2
)
)
)
0
(none)
)
(defmethod can-go-back? progress ((obj progress))
(let ((v1-2 (-> *progress-process* 0 display-state))
(a1-1 (-> *progress-state* starting-state))
)
(and (= (-> obj next-state name) 'progress-normal)
(not (-> obj in-transition))
(not (-> obj selected-option))
(or (= v1-2 (progress-screen fuel-cell))
(= v1-2 (progress-screen money))
(= v1-2 (progress-screen buzzer))
(and (or (= a1-1 (progress-screen fuel-cell))
(= a1-1 (progress-screen money))
(= a1-1 (progress-screen buzzer))
(= a1-1 (progress-screen title))
)
(#if (not PC_PORT)
(or (= v1-2 (progress-screen settings))
(= v1-2 (progress-screen game-settings))
(= v1-2 (progress-screen graphic-settings))
(= v1-2 (progress-screen sound-settings))
(= v1-2 (progress-screen title))
(= v1-2 (progress-screen settings-title)))
(or (= v1-2 (progress-screen settings))
(= v1-2 (progress-screen game-settings))
(= v1-2 (progress-screen graphic-settings))
(= v1-2 (progress-screen sound-settings))
(= v1-2 (progress-screen title))
(= v1-2 (progress-screen settings-title))
(= v1-2 (progress-screen camera-options))
(= v1-2 (progress-screen accessibility-options))
(= v1-2 (progress-screen misc-options))
(= v1-2 (progress-screen game-ps2-options))
(= v1-2 (progress-screen gfx-ps2-options))
(= v1-2 (progress-screen resolution))
(= v1-2 (progress-screen aspect-ratio))
)
)
)
)
)
)
)
(defmethod visible? progress ((obj progress))
(the-as symbol (and *progress-process* (zero? (-> *progress-process* 0 in-out-position))))
)
(defmethod hidden? progress ((obj progress))
(or (not *progress-process*) (= (-> *progress-process* 0 in-out-position) 4096))
)
(defstate progress-waiting (progress)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('go-away)
(go progress-gone)
)
)
)
:code
(behavior ()
(loop
(when (hud-hidden?)
(dotimes (gp-0 (-> self nb-of-particles))
(if (= (-> self particles gp-0 part matrix) -1)
(set! (-> self particles gp-0 part matrix) (sprite-allocate-user-hvdf))
)
)
(set-setting! *setting-control* self 'common-page 'set 0.0 1)
(suspend)
(go progress-coming-in)
)
(suspend)
)
(none)
)
)
(defstate progress-gone (progress)
:code
(behavior ()
(clear-pending-settings-from-process *setting-control* self 'process-mask)
(copy-settings-from-target! *setting-control*)
(logior! (-> self mask) (process-mask sleep))
(suspend)
0
(none)
)
)
(defmethod set-memcard-screen progress ((obj progress) (arg0 progress-screen))
(let ((s4-0 (-> obj card-info))
(gp-0 arg0)
)
(when s4-0
(case arg0
(((progress-screen memcard-no-space)
(progress-screen memcard-not-inserted)
(progress-screen memcard-not-formatted)
)
(cond
((zero? (-> s4-0 handle))
(set! gp-0 (progress-screen memcard-not-inserted))
)
((zero? (-> s4-0 formatted))
(cond
((or (zero? (-> obj display-state-pos))
(and (!= (-> *progress-state* starting-state) 27) (nonzero? (-> *progress-state* starting-state)))
)
(set-master-mode 'game)
)
(else
(if (!= arg0 (progress-screen memcard-not-formatted))
(set! gp-0 (progress-screen memcard-format))
)
)
)
)
((and (zero? (-> s4-0 inited)) (< (-> s4-0 mem-actual) (-> s4-0 mem-required)))
(set! gp-0 (progress-screen memcard-no-space))
)
((or (zero? (-> obj display-state-pos))
(and (!= (-> *progress-state* starting-state) 27) (nonzero? (-> *progress-state* starting-state)))
)
(set-master-mode 'game)
)
(else
(set! gp-0 (progress-screen save-game))
)
)
)
(((progress-screen memcard-insert))
(if (= (-> s4-0 inited) 1)
(set! gp-0 (progress-screen load-game))
)
)
)
(cond
((zero? (-> s4-0 handle))
(cond
((-> *setting-control* current auto-save)
(set! gp-0 (progress-screen memcard-removed))
)
(else
(cond
((= arg0 (progress-screen load-game))
(set! gp-0 (progress-screen memcard-insert))
)
((or (= arg0 (progress-screen memcard-format))
(= arg0 (progress-screen memcard-no-space))
(= arg0 (progress-screen memcard-not-formatted))
(= arg0 (progress-screen save-game))
(= arg0 (progress-screen save-game-title))
(= arg0 (progress-screen memcard-no-data))
(= arg0 (progress-screen memcard-data-exists))
)
(set! gp-0 (progress-screen memcard-not-inserted))
)
)
)
)
)
((zero? (-> s4-0 formatted))
(case arg0
(((progress-screen load-game))
(set! gp-0 (progress-screen memcard-insert))
)
(((progress-screen save-game) (progress-screen save-game-title))
(set! gp-0 (progress-screen memcard-format))
)
)
)
((zero? (-> s4-0 inited))
(case arg0
(((progress-screen save-game) (progress-screen save-game-title))
(if (>= (-> s4-0 mem-actual) (-> s4-0 mem-required))
(set! gp-0 (progress-screen memcard-no-data))
(set! gp-0 (progress-screen memcard-no-space))
)
)
(((progress-screen load-game))
(set! gp-0 (progress-screen memcard-insert))
)
)
)
)
)
gp-0
)
)
(defmethod respond-memcard progress ((obj progress))
(let ((s5-0 (-> obj card-info)))
(when (and s5-0 (not (-> obj in-transition)))
(when (or (cpad-pressed? 0 x) (cpad-pressed? 0 circle))
(cpad-clear! 0 x)
(cpad-clear! 0 circle)
(case (-> obj display-state)
(((progress-screen load-game))
(cond
((< (-> obj option-index) 4)
(when (nonzero? (-> s5-0 file (-> obj option-index) present))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> *progress-state* which) (-> obj option-index))
(set! (-> obj next-display-state) (progress-screen memcard-loading))
)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen save-game) (progress-screen save-game-title))
(cond
((< (-> obj option-index) 4)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> *progress-state* which) (-> obj option-index))
(if (zero? (-> s5-0 file (-> obj option-index) present))
(set! (-> obj next-display-state) (progress-screen memcard-saving))
(set! (-> obj next-display-state) (progress-screen memcard-data-exists))
)
)
((and (= (-> obj display-state) (progress-screen save-game-title)) (= (-> obj option-index) 4))
(sound-play-by-name (static-sound-name "starts-options") (new-sound-id) 1024 0 0 1 #t)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen memcard-insert))
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen memcard-data-exists))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen memcard-saving))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(if (= (-> obj display-state-stack 0) (progress-screen title))
(set! (-> obj next-display-state) (progress-screen save-game-title))
(set! (-> obj next-display-state) (progress-screen save-game))
)
)
)
)
(((progress-screen memcard-no-data))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen memcard-creating))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
)
)
(((progress-screen memcard-no-space)
(progress-screen memcard-not-inserted)
(progress-screen memcard-not-formatted)
)
(cond
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
((nonzero? (-> obj display-state-stack 0))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen memcard-error-loading)
(progress-screen memcard-error-saving)
(progress-screen memcard-error-formatting)
(progress-screen memcard-error-creating)
(progress-screen memcard-auto-save-error)
(progress-screen memcard-removed)
(progress-screen auto-save)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen pal-change-to-60hz))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
(set! (-> obj video-mode-timeout) (-> *display* real-frame-counter))
(set! (-> obj next-display-state) (progress-screen pal-now-60hz))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen pal-now-60hz))
(cond
((not (-> *progress-state* yes-no-choice))
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
)
(else
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
)
)
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen no-disc) (progress-screen bad-disc))
(when (is-cd-in?)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
(((progress-screen quit))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "title-start")
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen memcard-format))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen memcard-formatting))
)
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
)
)
)
)
0
(none)
)
(defmethod respond-common progress ((obj progress))
(mc-get-slot-info 0 *progress-save-info*)
(set! (-> obj card-info) *progress-save-info*)
(let ((s5-0 (-> *options-remap* (-> obj display-state))))
(when (and s5-0 (not (-> obj in-transition)))
(cond
((cpad-hold? 0 up)
(cond
((cpad-pressed? 0 up)
(when (not (-> obj selected-option))
(if (!= (length s5-0) 1)
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
)
(set! (-> obj last-option-index-change) (-> *display* real-frame-counter))
(if (> (-> obj option-index) 0)
(+! (-> obj option-index) -1)
(set! (-> obj option-index) (+ (length s5-0) -1))
)
)
)
(else
(when (-> obj selected-option)
(let ((v1-34 #f))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type center-screen))
(when (< -48 (-> *setting-control* current screeny))
(set! v1-34 #t)
(+! (-> *setting-control* default screeny) -1)
)
)
)
(when v1-34
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t)
)
)
)
)
)
)
)
((cpad-hold? 0 down)
(cond
((cpad-pressed? 0 down)
(when (not (-> obj selected-option))
(if (!= (length s5-0) 1)
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
)
(set! (-> obj last-option-index-change) (-> *display* real-frame-counter))
(cond
((< (-> obj option-index) (+ (length s5-0) -1))
(+! (-> obj option-index) 1)
)
(else
(set! (-> obj option-index) 0)
0
)
)
)
)
(else
(when (-> obj selected-option)
(let ((v1-69 #f))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type center-screen))
(when (< (-> *setting-control* current screeny) 48)
(set! v1-69 #t)
(+! (-> *setting-control* default screeny) 1)
)
)
)
(when v1-69
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t)
)
)
)
)
)
)
)
((cpad-hold? 0 left)
(cond
((cpad-pressed? 0 left)
(when (or (-> obj selected-option) (= (-> s5-0 (-> obj option-index) option-type) (game-option-type yes-no)))
(let ((s4-5 #f))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type on-off) (game-option-type yes-no))
(when (not (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
(set! s4-5 #t)
(if (= (-> s5-0 (-> obj option-index) value-to-modify) (&-> *setting-control* current vibration))
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3))
)
)
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify))) #t)
)
(((game-option-type aspect-ratio))
(set! s4-5 (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'aspect16x9))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'aspect4x3)
)
(((game-option-type video-mode))
(set! s4-5 (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'ntsc))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'pal)
)
(((game-option-type language))
(if (> (the-as int (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify)))) 0)
(+! (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify))) -1)
(set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify)))
(if (and (zero? (scf-get-territory))
(not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))
)
4
5
)
)
)
(set! (-> obj language-transition) #t)
(set! (-> obj language-direction) #t)
(set! s4-5 #t)
)
)
(if s4-5
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
)
)
)
)
(else
(when (-> obj selected-option)
(let ((v1-157 #f))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type slider))
(cond
((>= (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(+ 1.0 (-> s5-0 (-> obj option-index) param1))
)
(set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(+ -1.0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))))
)
(set! v1-157 #t)
)
((< (-> s5-0 (-> obj option-index) param1)
(-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
)
(set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(-> s5-0 (-> obj option-index) param1)
)
(set! v1-157 #t)
)
)
)
(((game-option-type center-screen))
(when (< -96 (-> *setting-control* default screenx))
(set! v1-157 #t)
(+! (-> *setting-control* default screenx) -1)
)
)
)
(when v1-157
(let ((f30-0 100.0))
(case (-> s5-0 (-> obj option-index) name)
(((game-text-id music-volume) (game-text-id speech-volume))
(set! f30-0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-0)) 0 0 1 #t)
)
)
)
)
)
)
)
)
((cpad-hold? 0 right)
(cond
((cpad-pressed? 0 right)
(when (or (-> obj selected-option) (= (-> s5-0 (-> obj option-index) option-type) (game-option-type yes-no)))
(let ((v1-217 (the-as object #f)))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type on-off) (game-option-type yes-no))
(set! v1-217 (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) #f)
)
(((game-option-type aspect-ratio))
(set! v1-217 (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'aspect4x3))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'aspect16x9)
)
(((game-option-type video-mode))
(set! v1-217 (= (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'pal))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'ntsc)
)
(((game-option-type language))
(let ((v1-243 (if (and (zero? (scf-get-territory))
(not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))
)
4
5
)
)
)
(cond
((< (the-as int (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify)))) v1-243)
(+! (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify))) 1)
)
(else
(set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify))) 0)
0
)
)
)
(set! (-> obj language-transition) #t)
(set! (-> obj language-direction) #f)
(set! v1-217 #t)
)
)
(if v1-217
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
)
)
)
)
(else
(when (-> obj selected-option)
(let ((v1-263 #f))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type slider))
(cond
((>= (+ -1.0 (-> s5-0 (-> obj option-index) param2))
(-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
)
(set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(+ 1.0 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))))
)
(set! v1-263 #t)
)
((< (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(-> s5-0 (-> obj option-index) param2)
)
(set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(-> s5-0 (-> obj option-index) param2)
)
(set! v1-263 #t)
)
)
)
(((game-option-type center-screen))
(when (< (-> *setting-control* default screenx) 96)
(set! v1-263 #t)
(+! (-> *setting-control* default screenx) 1)
)
)
)
(when v1-263
(let ((f30-1 100.0))
(case (-> s5-0 (-> obj option-index) name)
(((game-text-id music-volume) (game-text-id speech-volume))
(set! f30-1 (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-1)) 0 0 1 #t)
)
)
)
)
)
)
)
)
((or (cpad-pressed? 0 square) (cpad-pressed? 0 triangle))
(cond
((-> obj selected-option)
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type slider))
(set! (-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
(-> *progress-state* slider-backup)
)
)
(((game-option-type language))
(set! (-> (the-as (pointer language-enum) (-> s5-0 (-> obj option-index) value-to-modify)))
(-> *progress-state* language-backup)
)
)
(((game-option-type on-off))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0)
(-> *progress-state* on-off-backup)
)
)
(((game-option-type center-screen))
(set! (-> *setting-control* default screenx) (-> *progress-state* center-x-backup))
(set! (-> *setting-control* default screeny) (-> *progress-state* center-y-backup))
)
(((game-option-type aspect-ratio) (game-option-type video-mode))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0)
(-> *progress-state* aspect-ratio-backup)
)
)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj selected-option) #f)
)
((or (can-go-back? obj)
(= (-> obj display-state) (progress-screen load-game))
(= (-> obj display-state) (progress-screen save-game))
(= (-> obj display-state) (progress-screen save-game-title))
)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (= (-> obj display-state) (progress-screen settings))
(sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
)
(load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
((or (cpad-pressed? 0 x) (cpad-pressed? 0 circle))
(cond
((not (-> obj selected-option))
(cond
((= (-> s5-0 (-> obj option-index) option-type) (game-option-type menu))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(push! obj)
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (the-as progress-screen (-> s5-0 (-> obj option-index) param3)))
(case (-> obj next-display-state)
(((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title))
(set! (-> obj next-display-state) (set-memcard-screen obj (-> obj next-display-state)))
)
)
)
((= (-> s5-0 (-> obj option-index) option-type) (game-option-type button))
(cond
((= (-> s5-0 (-> obj option-index) name) (game-text-id exit-demo))
(set! *master-exit* 'force)
(set-master-mode 'game)
)
((= (-> s5-0 (-> obj option-index) name) (game-text-id back))
(if (= (-> obj display-state) (progress-screen settings))
(sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
)
(load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
((!= (-> s5-0 (-> obj option-index) option-type) (game-option-type yes-no))
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type slider))
(set! (-> *progress-state* slider-backup)
(-> (the-as (pointer float) (-> s5-0 (-> obj option-index) value-to-modify)))
)
)
(((game-option-type language))
(set! (-> *progress-state* language-backup)
(-> (the-as (pointer language-enum) (-> s5-0 (-> obj option-index) value-to-modify)))
)
)
(((game-option-type on-off))
(set! (-> *progress-state* on-off-backup)
(the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
(((game-option-type center-screen))
(set! (-> *progress-state* center-x-backup) (-> *setting-control* default screenx))
(set! (-> *progress-state* center-y-backup) (-> *setting-control* default screeny))
)
(((game-option-type aspect-ratio) (game-option-type video-mode))
(set! (-> *progress-state* aspect-ratio-backup)
(the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
)
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(set! (-> obj selected-option) #t)
(when (= (-> s5-0 (-> obj option-index) option-type) (game-option-type language))
(set! (-> obj language-selection) (-> *setting-control* current language))
(set! (-> obj language-direction) #t)
(set! (-> obj language-transition) #f)
(set! (-> obj language-x-offset) 0)
0
)
)
)
)
(else
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj selected-option) #f)
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type aspect-ratio))
(set! (-> *setting-control* default aspect-ratio)
(the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
(((game-option-type video-mode))
(case (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify)))
(('pal)
(set! (-> *setting-control* default video-mode)
(the-as symbol (-> (the-as (pointer uint32) (-> s5-0 (-> obj option-index) value-to-modify))))
)
)
(('ntsc)
(push! obj)
(set! (-> obj next-display-state) (progress-screen pal-change-to-60hz))
)
)
)
(((game-option-type language))
(if (not (-> obj language-transition))
(load-level-text-files (-> obj display-level-index))
)
)
)
)
)
)
)
)
)
0
(none)
)
(defmethod respond-progress progress ((obj progress))
(when (not (-> obj in-transition))
(cond
((cpad-pressed? 0 up)
(let ((s5-0 (-> obj display-level-index)))
(set! (-> obj next-level-index) (get-next-level-down s5-0))
(when (!= s5-0 (-> obj next-level-index))
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj level-transition) 2)
)
)
)
((cpad-pressed? 0 down)
(let ((s5-2 (-> obj next-level-index)))
(set! (-> obj next-level-index) (get-next-level-up s5-2))
(when (!= s5-2 (-> obj next-level-index))
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj level-transition) 1)
)
)
)
((cpad-pressed? 0 square)
(when (nonzero? (-> obj display-state))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen fuel-cell))
(set! (-> obj stat-transition) #t)
)
)
((cpad-pressed? 0 x)
(when (!= (-> obj display-state) (progress-screen money))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen money))
(set! (-> obj stat-transition) #t)
)
)
((cpad-pressed? 0 triangle)
(when (!= (-> obj display-state) (progress-screen buzzer))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(set! (-> obj next-display-state) (progress-screen buzzer))
(set! (-> obj stat-transition) #t)
)
)
((cpad-pressed? 0 circle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(push! obj)
(set! (-> obj next-display-state) (progress-screen settings))
)
((= (-> obj display-state) (progress-screen fuel-cell))
(cond
((cpad-pressed? 0 left)
(let ((s5-8 (-> obj task-index)))
(set! (-> obj task-index) (get-next-task-down (-> obj task-index) (-> obj display-level-index)))
(if (!= s5-8 (-> obj task-index))
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
)
)
)
((cpad-pressed? 0 right)
(let ((s5-10 (-> obj task-index)))
(set! (-> obj task-index) (get-next-task-up (-> obj task-index) (-> obj display-level-index)))
(if (!= s5-10 (-> obj task-index))
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
)
)
)
)
)
)
)
0
(none)
)
(defstate progress-normal (progress)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 none))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'go-away)
(go progress-going-out)
)
((= v1-0 'notify)
(cond
((= (-> arg3 param 0) 'done)
(case (-> self display-state)
(((progress-screen memcard-saving))
(cond
((= (-> self display-state-stack 0) (progress-screen title))
(let ((gp-1 (-> *setting-control* default auto-save)))
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set! (-> *setting-control* default auto-save) gp-1)
)
(set-master-mode 'game)
)
(else
(set! v0-0 (the-as none -1))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
)
)
(((progress-screen memcard-formatting))
(set! (-> self force-transition) #t)
(set! v0-0 (the-as none 15))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
(((progress-screen memcard-creating))
(cond
((= (-> self display-state-stack 0) (progress-screen title))
(set! v0-0 (the-as none 18))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
)
(else
(set! v0-0 (the-as none 17))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
)
)
v0-0
)
)
)
((= (-> arg3 param 0) 'error)
(let ((t9-4 format)
(a0-17 #t)
(a1-2 "ERROR NOTIFY: ~S ~D~%")
(v1-13 (-> arg3 param 1))
)
(t9-4
a0-17
a1-2
(cond
((= v1-13 17)
"no-auto-save"
)
((= v1-13 16)
"no-process"
)
((= v1-13 15)
"bad-version"
)
((= v1-13 14)
"no-space"
)
((= v1-13 13)
"no-save"
)
((= v1-13 12)
"no-file"
)
((= v1-13 11)
"no-format"
)
((= v1-13 10)
"no-last"
)
((= v1-13 9)
"no-card"
)
((= v1-13 8)
"no-memory"
)
((= v1-13 7)
"new-game"
)
((= v1-13 6)
"read-error"
)
((= v1-13 5)
"write-error"
)
((= v1-13 4)
"internal-error"
)
((= v1-13 3)
"format-failed"
)
((= v1-13 2)
"bad-handle"
)
((= v1-13 1)
"ok"
)
((zero? v1-13)
"busy"
)
(else
"*unknown*"
)
)
(-> self display-state)
)
)
(case (-> arg3 param 1)
((14)
(set! v0-0 (the-as none 7))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
(else
(case (-> self display-state)
(((progress-screen memcard-formatting))
(set! v0-0 (the-as none 24))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
(((progress-screen memcard-creating))
(set! v0-0 (the-as none 25))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
(((progress-screen memcard-saving))
(set! v0-0 (the-as none 21))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
(((progress-screen memcard-loading))
(set! v0-0 (the-as none 20))
(set! (-> self next-display-state) (the-as progress-screen v0-0))
v0-0
)
)
)
)
)
)
)
)
)
)
)
:code
(behavior ()
(loop
(when (and (cpad-hold? 0 l1) (cpad-hold? 0 r1) *cheat-mode*)
(when (and (< (-> self task-index) (-> *level-task-data* (-> self display-level-index) nb-of-tasks))
(>= (-> self task-index) 0)
)
(let ((gp-0 (-> *level-task-data* (-> self display-level-index) task-info (-> self task-index) task-id)))
(close-specific-task! gp-0 (task-status need-resolution))
(send-event *target* 'get-pickup 6 (the float gp-0))
)
)
)
(if (and (= (-> self display-state) (-> self next-display-state))
(= (-> self display-level-index) (-> self next-level-index))
)
(seekl!
(-> self transition-offset)
0
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
(seekl!
(-> self transition-offset)
512
(* (the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
(if (or (-> self stat-transition) (nonzero? (-> self level-transition)))
2
1
)
)
)
)
(set-transition-progress! self (-> self transition-offset))
(set! (-> self in-transition) (or (-> self force-transition) (nonzero? (-> self transition-offset))))
(when (and (not (handle->process (-> *game-info* auto-save-proc)))
(or (-> self force-transition) (-> self in-transition))
(>= (-> self transition-offset) (if (and (zero? (-> self level-transition))
(nonzero? (-> self next-display-state))
(!= (-> self next-display-state) 1)
(!= (-> self next-display-state) 2)
)
512
256
)
)
)
(if (>= (the-as int (-> self next-display-state)) 0)
(enter! self (-> self next-display-state) 0)
(pop! self)
)
(set! (-> self display-level-index) (-> self next-level-index))
(when (nonzero? (-> self level-transition))
(set! (-> self task-index) (get-next-task-up -1 (-> self display-level-index)))
(case (-> self level-transition)
((1)
(set! (-> self level-transition) 2)
)
((2)
(set! (-> self level-transition) 1)
)
)
)
(set! (-> self force-transition) #f)
)
(when (zero? (-> self transition-offset))
(set! (-> self stat-transition) #f)
(set! (-> self level-transition) 0)
0
)
(let ((gp-1 #f))
(let ((v1-62 #f))
(case (-> self display-state)
(((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer))
(let ((s5-0 (-> self display-level-index)))
(when (and (< (mod (-> *display* real-frame-counter) (seconds 0.2)) (seconds 0.1))
(zero? (-> *progress-process* 0 in-out-position))
(not (-> self in-transition))
(zero? (-> self transition-offset))
)
(set! gp-1 (!= s5-0 (get-next-level-up s5-0)))
(set! v1-62 (!= s5-0 (get-next-level-down s5-0)))
)
)
)
)
(set! (-> self particles 3 init-pos x) (the float (if v1-62
(- 195 (-> *progress-process* 0 left-x-offset))
-320
)
)
)
)
(set! (-> self particles 4 init-pos x) (the float (if gp-1
(- 195 (-> *progress-process* 0 left-x-offset))
-320
)
)
)
)
(respond-common self)
(set! (-> self next-display-state) (set-memcard-screen self (-> self next-display-state)))
(let ((v1-74 (-> self display-state)))
(cond
((or (= v1-74 (progress-screen fuel-cell))
(or (= v1-74 (progress-screen money)) (= v1-74 (progress-screen buzzer)))
)
(respond-progress self)
)
((or (= v1-74 (progress-screen memcard-no-space))
(= v1-74 (progress-screen memcard-format))
(= v1-74 (progress-screen memcard-data-exists))
(= v1-74 (progress-screen memcard-insert))
(= v1-74 (progress-screen load-game))
(= v1-74 (progress-screen save-game))
(= v1-74 (progress-screen save-game-title))
(= v1-74 (progress-screen memcard-error-loading))
(= v1-74 (progress-screen memcard-error-saving))
(= v1-74 (progress-screen memcard-error-formatting))
(= v1-74 (progress-screen memcard-error-creating))
(= v1-74 (progress-screen memcard-auto-save-error))
(= v1-74 (progress-screen memcard-removed))
(= v1-74 (progress-screen memcard-no-data))
(= v1-74 (progress-screen memcard-not-inserted))
(= v1-74 (progress-screen memcard-not-formatted))
(= v1-74 (progress-screen auto-save))
(= v1-74 (progress-screen pal-change-to-60hz))
(= v1-74 (progress-screen pal-now-60hz))
(= v1-74 (progress-screen no-disc))
(= v1-74 (progress-screen bad-disc))
(= v1-74 (progress-screen quit))
)
(respond-memcard self)
)
)
)
(suspend)
)
(none)
)
:post
(behavior ()
(let* ((a1-0 (-> self display-level-index))
(gp-0 (-> *level-task-data* a1-0))
(unk #t)
(s5-0 #f)
)
(case (-> self display-state)
(((progress-screen fuel-cell))
(set! s5-0 #t)
(draw-fuel-cell-screen self a1-0)
)
(((progress-screen money))
(set! s5-0 #t)
(draw-money-screen self a1-0)
)
(((progress-screen buzzer))
(set! s5-0 #t)
(draw-buzzer-screen self a1-0)
)
(((progress-screen game-settings) (progress-screen settings))
(hide-progress-icons)
(draw-options self 115 30 0.82)
)
(((progress-screen graphic-settings)
(progress-screen sound-settings)
(progress-screen settings-title)
(progress-screen title)
)
(hide-progress-icons)
(draw-options self 115 30 0.82)
)
(((progress-screen memcard-removed) (progress-screen memcard-auto-save-error))
(draw-notice-screen self)
(draw-options self 192 0 0.82)
)
(((progress-screen memcard-no-data))
(draw-notice-screen self)
(draw-options self 165 0 0.82)
)
(((progress-screen memcard-format))
(draw-notice-screen self)
(draw-options self 172 0 0.82)
)
(((progress-screen memcard-no-space)
(progress-screen memcard-not-inserted)
(progress-screen memcard-not-formatted)
)
(draw-notice-screen self)
(draw-options self 195 0 0.82)
)
(((progress-screen memcard-error-loading)
(progress-screen memcard-error-saving)
(progress-screen memcard-error-formatting)
(progress-screen memcard-error-creating)
(progress-screen memcard-auto-save-error)
)
(draw-notice-screen self)
(draw-options self 190 0 0.82)
)
(((progress-screen pal-change-to-60hz))
(draw-notice-screen self)
(draw-options self 190 0 0.82)
)
(((progress-screen pal-now-60hz))
(when (< (seconds 10) (- (-> *display* real-frame-counter) (-> self video-mode-timeout)))
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
(set! (-> self next-display-state) (progress-screen invalid))
)
(draw-notice-screen self)
(draw-options self 140 0 0.82)
)
(((progress-screen no-disc) (progress-screen bad-disc))
(draw-notice-screen self)
(if (is-cd-in?)
(draw-options self 170 0 0.82)
)
)
(((progress-screen quit))
(draw-notice-screen self)
(draw-options self 110 0 0.82)
)
(((progress-screen auto-save))
(draw-notice-screen self)
(draw-options self 190 0 0.82)
)
(((progress-screen memcard-insert))
(draw-notice-screen self)
(draw-options self 165 0 0.82)
)
(((progress-screen memcard-data-exists))
(draw-notice-screen self)
(draw-options self 168 0 0.82)
)
(((progress-screen memcard-loading)
(progress-screen memcard-saving)
(progress-screen memcard-formatting)
(progress-screen memcard-creating)
)
(draw-notice-screen self)
)
(((progress-screen load-game) (progress-screen save-game))
(draw-notice-screen self)
(draw-options self 190 0 0.82)
)
(((progress-screen save-game-title))
(draw-notice-screen self)
(draw-options self 169 15 0.6)
)
)
(when s5-0
(let* ((v1-98 (cond
((-> self stat-transition)
0
)
((= (-> self level-transition) 1)
(- (-> self transition-offset))
)
(else
(-> self transition-offset)
)
)
)
(f30-0 (the-as float (if (-> self stat-transition)
1.0
(-> self transition-percentage-invert)
)
)
)
(s5-1
(new
'stack
'font-context
*font-default-matrix*
(- 32 (-> self left-x-offset))
(the int (* (+ 42.0 (the float (/ v1-98 2))) f30-0))
8325000.0
(font-color lighter-lighter-blue)
(font-flags shadow kerning)
)
)
)
(let ((v1-103 s5-1))
(set! (-> v1-103 width) (the float 328))
)
(let ((v1-104 s5-1))
(set! (-> v1-104 height) (the float 45))
)
(set! (-> s5-1 flags) (font-flags shadow kerning middle left large))
(print-game-text-scaled
(lookup-text! *common-text* (-> gp-0 level-name-id) #f)
f30-0
s5-1
(the int (* 128.0 f30-0))
)
)
)
)
(case (-> self display-state)
(((progress-screen fuel-cell) (progress-screen money) (progress-screen buzzer))
(draw-progress self)
)
)
(adjust-sprites self)
(adjust-icons self)
(none)
)
)
(defstate progress-coming-in (progress)
:event
(-> progress-waiting event)
:enter
(behavior ()
(sound-group-pause (the-as uint 255))
(logclear! (-> *setting-control* default process-mask) (process-mask pause menu))
(push-setting! *setting-control* self 'process-mask 'set 0.0 16)
(copy-settings-from-target! *setting-control*)
(sound-play-by-name (static-sound-name "select-menu") (new-sound-id) 1024 0 0 1 #t)
(set-blackout-frames 0)
(set! *pause-lock* #f)
(none)
)
:code
(behavior ()
(loop
(seekl! (-> self in-out-position) 0 (the int (* 170.0 (-> *display* time-adjust-ratio))))
(when (< (-> self in-out-position) 2867)
(seekl!
(-> self transition-offset)
0
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
(set-transition-progress! self (-> self transition-offset))
)
(if (zero? (-> self in-out-position))
(go progress-normal)
)
(suspend)
)
(none)
)
:post
(-> progress-normal post)
)
(defstate progress-going-out (progress)
:enter
(behavior ()
(sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t)
(hide-progress-icons)
(set! (-> self particles 3 init-pos x) -320.0)
(set! (-> self particles 4 init-pos x) -320.0)
(case (-> self display-state)
(((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title))
(set! (-> self transition-speed) 30.0)
)
)
(none)
)
:code
(behavior ()
(loop
(seekl!
(-> self transition-offset)
512
(the int (* (-> self transition-speed) (-> *display* time-adjust-ratio)))
)
(set-transition-progress! self (-> self transition-offset))
(when (< 153 (-> self transition-offset))
(seekl! (-> self in-out-position) 4096 (the int (* 170.0 (-> *display* time-adjust-ratio))))
(if (= (-> self in-out-position) 4096)
(go progress-gone)
)
)
(suspend)
)
(none)
)
:post
(-> progress-normal post)
)
(defstate progress-debug (progress)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('go-away)
(go progress-going-out)
)
)
)
:code
(behavior ()
(loop
(cond
((cpad-pressed? 0 left)
(if (> (-> self current-debug-string) 0)
(+! (-> self current-debug-string) -1)
)
)
((cpad-pressed? 0 right)
(if (< (-> self current-debug-string) (+ (-> *common-text* length) -1))
(+! (-> self current-debug-string) 1)
)
)
((cpad-pressed? 0 up)
(when (> (-> self current-debug-group) 0)
(+! (-> self current-debug-group) -1)
(set! (-> self current-debug-string) 0)
0
)
)
((cpad-pressed? 0 down)
(when (< (-> self current-debug-group) (+ (-> *text-group-names* length) -1))
(+! (-> self current-debug-group) 1)
(set! (-> self current-debug-string) 0)
0
)
)
((cpad-pressed? 0 l1)
(if (> (the-as int (-> *setting-control* default language)) 0)
(+! (-> *setting-control* default language) -1)
)
)
((cpad-pressed? 0 r1)
(if (< (the-as int (-> *setting-control* default language)) 6)
(+! (-> *setting-control* default language) 1)
)
)
((cpad-pressed? 0 l2)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l2))
(go progress-normal)
)
)
(load-game-text-info (-> *text-group-names* (-> self current-debug-group)) '*common-text* *common-text-heap*)
(suspend)
)
(none)
)
:post
(behavior ()
(let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
(gp-0 (-> s5-0 base))
)
(let ((s4-0 draw-string-xy))
(let ((s3-0 format)
(a0-4 (clear *temp-string*))
(a1-0 "TEXT DEBUG: LANGUAGE ~S ID 0x~X")
(v1-4 (-> *setting-control* current language))
)
(s3-0
a0-4
a1-0
(cond
((= v1-4 (language-enum uk-english))
"uk-english"
)
((= v1-4 (language-enum japanese))
"japanese"
)
((= v1-4 (language-enum italian))
"italian"
)
((= v1-4 (language-enum spanish))
"spanish"
)
((= v1-4 (language-enum german))
"german"
)
((= v1-4 (language-enum french))
"french"
)
((= v1-4 (language-enum english))
"english"
)
(else
"*unknown*"
)
)
(-> *common-text* data (-> self current-debug-string) id)
)
)
(s4-0 *temp-string* s5-0 40 40 (font-color default) (font-flags shadow kerning))
)
(let ((a3-4 (-> s5-0 base)))
(let ((v1-7 (the-as dma-packet (-> s5-0 base))))
(set! (-> v1-7 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> v1-7 vif0) (new 'static 'vif-tag))
(set! (-> v1-7 vif1) (new 'static 'vif-tag))
(set! (-> s5-0 base) (&+ (the-as pointer v1-7) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
gp-0
(the-as (pointer dma-tag) a3-4)
)
)
)
(let* ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
(gp-1 (-> s5-1 base))
)
(let ((s4-1 draw-string-xy))
(format (clear *temp-string*) "USE LEFT/RIGHT TO SELECT STRING")
(s4-1 *temp-string* s5-1 40 155 (font-color default) (font-flags shadow kerning))
)
(let ((a3-6 (-> s5-1 base)))
(let ((v1-16 (the-as dma-packet (-> s5-1 base))))
(set! (-> v1-16 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> v1-16 vif0) (new 'static 'vif-tag))
(set! (-> v1-16 vif1) (new 'static 'vif-tag))
(set! (-> s5-1 base) (the-as pointer (the-as dma-packet (&+ v1-16 16))))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
gp-1
(the-as (pointer dma-tag) a3-6)
)
)
)
(let* ((s5-2 (-> *display* frames (-> *display* on-screen) frame global-buf))
(gp-2 (-> s5-2 base))
)
(let ((s4-2 draw-string-xy))
(format (clear *temp-string*) "USE UP/DOWN TO SELECT GROUP")
(s4-2 *temp-string* s5-2 40 165 (font-color default) (font-flags shadow kerning))
)
(let ((a3-8 (-> s5-2 base)))
(let ((v1-25 (the-as dma-packet (-> s5-2 base))))
(set! (-> v1-25 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> v1-25 vif0) (new 'static 'vif-tag))
(set! (-> v1-25 vif1) (new 'static 'vif-tag))
(set! (-> s5-2 base) (the-as pointer (the-as dma-packet (&+ v1-25 16))))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
gp-2
(the-as (pointer dma-tag) a3-8)
)
)
)
(let* ((s5-3 (-> *display* frames (-> *display* on-screen) frame global-buf))
(gp-3 (-> s5-3 base))
)
(let ((s4-3 draw-string-xy))
(format (clear *temp-string*) "USE L1/R1 TO SELECT LANGUAGE")
(s4-3 *temp-string* s5-3 40 175 (font-color default) (font-flags shadow kerning))
)
(let ((a3-10 (-> s5-3 base)))
(let ((v1-34 (the-as dma-packet (-> s5-3 base))))
(set! (-> v1-34 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> v1-34 vif0) (new 'static 'vif-tag))
(set! (-> v1-34 vif1) (new 'static 'vif-tag))
(set! (-> s5-3 base) (the-as pointer (the-as dma-packet (&+ v1-34 16))))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
gp-3
(the-as (pointer dma-tag) a3-10)
)
)
)
(let ((gp-4 (new
'stack
'font-context
*font-default-matrix*
32
50
0.0
(font-color default)
(font-flags shadow kerning)
)
)
)
(let ((v1-42 gp-4))
(set! (-> v1-42 width) (the float 328))
)
(let ((v1-43 gp-4))
(set! (-> v1-43 height) (the float 100))
)
(logior! (-> gp-4 flags) (font-flags shadow kerning large))
(draw-debug-text-box gp-4)
(print-game-text (-> *common-text* data (-> self current-debug-string) text) gp-4 #f 128 22)
)
(none)
)
)