;;-*-Lisp-*-
(in-package goal)

;; definition of type progress-global-state
(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
  )

;; definition for method 3 of type progress-global-state
(defmethod inspect progress-global-state ((obj progress-global-state))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Taspect-ratio-choice: ~A~%" (-> obj aspect-ratio-choice))
  (format #t "~Tvideo-mode-choice: ~A~%" (-> obj video-mode-choice))
  (format #t "~Tyes-no-choice: ~A~%" (-> obj yes-no-choice))
  (format #t "~Twhich: ~D~%" (-> obj which))
  (format #t "~Tstarting-state: ~D~%" (-> obj starting-state))
  (format #t "~Tlast-slot-saved: ~D~%" (-> obj last-slot-saved))
  (format #t "~Tslider-backup: ~f~%" (-> obj slider-backup))
  (format #t "~Tlanguage-backup: ~D~%" (-> obj language-backup))
  (format #t "~Ton-off-backup: ~A~%" (-> obj on-off-backup))
  (format #t "~Tcenter-x-backup: ~D~%" (-> obj center-x-backup))
  (format #t "~Tcenter-y-backup: ~D~%" (-> obj center-y-backup))
  (format #t "~Taspect-ratio-backup: ~A~%" (-> obj aspect-ratio-backup))
  (format #t "~Tlast-slider-sound: ~D~%" (-> obj last-slider-sound))
  obj
  )

;; definition for symbol *progress-state*, type progress-global-state
(define *progress-state* (new 'static 'progress-global-state :yes-no-choice #f :which -1 :last-slot-saved -1))

;; definition for function get-game-count
(defun get-game-count ((arg0 int))
  (-> *game-counts* data arg0)
  )

;; definition for function progress-allowed?
(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*)
               )
           )
       )
  )

;; definition for function pause-allowed?
(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*)
           )
       )
  )

;; definition for function init-game-options
;; INFO: Return type mismatch (pointer symbol) vs none.
(defun init-game-options ((arg0 progress))
  (dotimes (v1-0 35)
    (set! (-> *options-remap* v1-0) #f)
    )
  (let ((v1-3 *kernel-boot-message*))
    (set! (-> *options-remap* 3) (cond
                                   ((= v1-3 'demo)
                                    *main-options-demo*
                                    )
                                   ((= v1-3 'demo-shared)
                                    *main-options-demo-shared*
                                    )
                                   (else
                                     *main-options*
                                     )
                                   )
          )
    )
  (set! (-> *options-remap* 4)
        (cond
          ((!= *kernel-boot-message* 'play)
           (if (= (scf-get-territory) 1)
               *game-options*
               *game-options-demo*
               )
           )
          ((and (= (scf-get-territory) 2) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))))
           *game-options-japan*
           )
          (else
            *game-options*
            )
          )
        )
  (set! (-> *options-remap* 5)
        (if (and (= (-> *progress-state* starting-state) (progress-screen title))
                 (or (= (scf-get-territory) 1) (and (= *progress-cheat* 'pal) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))
                 )
            *graphic-title-options-pal*
            *graphic-options*
            )
        )
  (set! (-> *options-remap* 6) *sound-options*)
  (set! (-> *options-remap* 7) *ok-options*)
  (set! (-> *options-remap* 8) *ok-options*)
  (set! (-> *options-remap* 9) *ok-options*)
  (set! (-> *options-remap* 10) *yes-no-options*)
  (set! (-> *options-remap* 11) *yes-no-options*)
  (set! (-> *options-remap* 19) *ok-options*)
  (set! (-> *options-remap* 16) *load-options*)
  (set! (-> *options-remap* 17) *save-options*)
  (set! (-> *options-remap* 18) *save-options-title*)
  (set! (-> *options-remap* 20) *ok-options*)
  (set! (-> *options-remap* 21) *ok-options*)
  (set! (-> *options-remap* 24) *ok-options*)
  (set! (-> *options-remap* 25) *ok-options*)
  (set! (-> *options-remap* 26) *ok-options*)
  (set! (-> *options-remap* 22) *ok-options*)
  (set! (-> *options-remap* 23) *yes-no-options*)
  (set! (-> *options-remap* 27) *title*)
  (set! (-> *options-remap* 28) *options*)
  (set! (-> *options-remap* 29) *ok-options*)
  (set! (-> *options-remap* 30) *yes-no-options*)
  (set! (-> *options-remap* 31) *yes-no-options*)
  (set! (-> *options-remap* 32) *ok-options*)
  (set! (-> *options-remap* 33) *ok-options*)
  (set! (-> *options-remap* 34) *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)
  )

;; definition for function make-current-level-available-to-progress
;; INFO: Return type mismatch int vs none.
(defun make-current-level-available-to-progress ()
  (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)
  )

;; definition for function make-levels-with-tasks-available-to-progress
;; INFO: Return type mismatch int vs none.
(defun make-levels-with-tasks-available-to-progress ()
  (dotimes (i (length *level-task-data*))
    (let ((tasks (-> *level-task-data* i)))
      (when (not (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)
  )

;; definition for function get-next-task-up
(defun get-next-task-up ((cur-task-idx int) (lev-idx int))
  (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
    )
  )

;; definition for function get-next-task-down
(defun get-next-task-down ((cur-task-idx int) (lev-idx int))
  (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
    )
  )

;; definition for function get-next-level-up
(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
    )
  )

;; definition for function get-next-level-down
(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
    )
  )

;; definition for function calculate-completion
(defun calculate-completion ((the-progress progress))
  (local-vars
    (current-cells int)
    (current-buzzers int)
    (current-orbs int)
    (total-cells int)
    (total-buzzers int)
    (total-orbs int)
    )
  (set! current-cells 0)
  (set! current-buzzers 0)
  (set! current-orbs 0)
  (set! total-cells 0)
  (set! total-buzzers 0)
  (set! 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))
                (set! current-cells (+ current-cells 1))
                )
            )
          (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))
     )
  )

;; definition for symbol *progress-save-info*, type mc-slot-info
(define *progress-save-info* (new 'global 'mc-slot-info))

;; definition for method 33 of type progress
;; INFO: Return type mismatch int vs none.
(defmethod initialize-icons progress ((obj progress))
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-0 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-0) (new 'static 'hud-icon))
      (let* ((s3-0 (get-process *default-dead-pool* manipy #x4000))
             (s4-0 (when s3-0
                     (let ((t9-1 (method-of-type manipy activate)))
                       (t9-1 (the-as manipy s3-0) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-0
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *fuelcell-naked-sg*
                      #f
                      )
                     (-> s3-0 ppointer)
                     )
                   )
             )
        (when s4-0
          (set! (-> (the-as manipy (-> s4-0 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-0 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-0 0)) root scale) 0.006 0.006 0.006 1.0)
          (if #f
              (send-event (ppointer->process s4-0) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-0 icon) (the-as (pointer manipy) s4-0))
        (when s4-0
          (logior! (-> s4-0 0 mask) (process-mask pause))
          (logclear! (-> s4-0 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-0 0)) root trans z) 2048.0)
          (set! (-> obj icons s5-0 icon-x) 256)
          (set! (-> obj icons s5-0 icon-y) 77)
          (set! (-> obj icons s5-0 icon-z) 0)
          (set! (-> obj icons s5-0 scale-x) 0.006)
          (set! (-> obj icons s5-0 scale-y) 0.006)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-1 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-1) (new 'static 'hud-icon))
      (let* ((s3-1 (get-process *default-dead-pool* manipy #x4000))
             (s4-1 (when s3-1
                     (let ((t9-5 (method-of-type manipy activate)))
                       (t9-5 (the-as manipy s3-1) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-1
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *fuelcell-naked-sg*
                      #f
                      )
                     (-> s3-1 ppointer)
                     )
                   )
             )
        (when s4-1
          (set! (-> (the-as manipy (-> s4-1 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-1 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-1 0)) root scale) 0.006 0.006 0.006 1.0)
          (if #f
              (send-event (ppointer->process s4-1) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-1 icon) (the-as (pointer manipy) s4-1))
        (when s4-1
          (logior! (-> s4-1 0 mask) (process-mask pause))
          (logclear! (-> s4-1 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-1 0)) root trans z) 2048.0)
          (set! (-> obj icons s5-1 icon-x) 256)
          (set! (-> obj icons s5-1 icon-y) 77)
          (set! (-> obj icons s5-1 icon-z) 0)
          (set! (-> obj icons s5-1 scale-x) 0.006)
          (set! (-> obj icons s5-1 scale-y) 0.006)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-2 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-2) (new 'static 'hud-icon))
      (let* ((s3-2 (get-process *default-dead-pool* manipy #x4000))
             (s4-2 (when s3-2
                     (let ((t9-9 (method-of-type manipy activate)))
                       (t9-9 (the-as manipy s3-2) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-2
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *fuelcell-naked-sg*
                      #f
                      )
                     (-> s3-2 ppointer)
                     )
                   )
             )
        (when s4-2
          (set! (-> (the-as manipy (-> s4-2 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-2 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-2 0)) root scale) 0.006 0.006 0.006 1.0)
          (if #f
              (send-event (ppointer->process s4-2) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-2 icon) (the-as (pointer manipy) s4-2))
        (when s4-2
          (logior! (-> s4-2 0 mask) (process-mask pause))
          (logclear! (-> s4-2 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-2 0)) root trans z) 2048.0)
          (set! (-> obj icons s5-2 icon-x) 256)
          (set! (-> obj icons s5-2 icon-y) 77)
          (set! (-> obj icons s5-2 icon-z) 0)
          (set! (-> obj icons s5-2 scale-x) 0.006)
          (set! (-> obj icons s5-2 scale-y) 0.006)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-3 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-3) (new 'static 'hud-icon))
      (let* ((s3-3 (get-process *default-dead-pool* manipy #x4000))
             (s4-3 (when s3-3
                     (let ((t9-13 (method-of-type manipy activate)))
                       (t9-13 (the-as manipy s3-3) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-3
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *fuelcell-naked-sg*
                      #f
                      )
                     (-> s3-3 ppointer)
                     )
                   )
             )
        (when s4-3
          (set! (-> (the-as manipy (-> s4-3 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-3 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-3 0)) root scale) 0.006 0.006 0.006 1.0)
          (if #f
              (send-event (ppointer->process s4-3) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-3 icon) (the-as (pointer manipy) s4-3))
        (when s4-3
          (logior! (-> s4-3 0 mask) (process-mask pause))
          (logclear! (-> s4-3 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-3 0)) root trans z) 2048.0)
          (set! (-> obj icons s5-3 icon-x) 256)
          (set! (-> obj icons s5-3 icon-y) 77)
          (set! (-> obj icons s5-3 icon-z) 0)
          (set! (-> obj icons s5-3 scale-x) 0.006)
          (set! (-> obj icons s5-3 scale-y) 0.006)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-4 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-4) (new 'static 'hud-icon))
      (let* ((s3-4 (get-process *default-dead-pool* manipy #x4000))
             (s4-4 (when s3-4
                     (let ((t9-17 (method-of-type manipy activate)))
                       (t9-17 (the-as manipy s3-4) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-4
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *money-sg*
                      #f
                      )
                     (-> s3-4 ppointer)
                     )
                   )
             )
        (when s4-4
          (set! (-> (the-as manipy (-> s4-4 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-4 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-4 0)) root scale) 0.013 -0.015 0.013 1.0)
          (if #f
              (send-event (ppointer->process s4-4) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-4 icon) (the-as (pointer manipy) s4-4))
        (when s4-4
          (logior! (-> s4-4 0 mask) (process-mask pause))
          (logclear! (-> s4-4 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-4 0)) root trans z) 69632.0)
          (set! (-> obj icons s5-4 icon-x) -320)
          (set! (-> obj icons s5-4 icon-y) 253)
          (set! (-> obj icons s5-4 icon-z) 0)
          (set! (-> obj icons s5-4 scale-x) 0.013)
          (set! (-> obj icons s5-4 scale-y) -0.015)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (when (< (-> obj nb-of-icons) 6)
    (let ((s5-5 (-> obj nb-of-icons)))
      (set! (-> obj icons s5-5) (new 'static 'hud-icon))
      (let* ((s3-5 (get-process *default-dead-pool* manipy #x4000))
             (s4-5 (when s3-5
                     (let ((t9-21 (method-of-type manipy activate)))
                       (t9-21 (the-as manipy s3-5) obj 'manipy (the-as pointer #x70004000))
                       )
                     ((the-as (function process function object object object object object) run-function-in-process)
                      s3-5
                      manipy-init
                      (new 'static 'vector :w 1.0)
                      #f
                      *money-sg*
                      #f
                      )
                     (-> s3-5 ppointer)
                     )
                   )
             )
        (when s4-5
          (set! (-> (the-as manipy (-> s4-5 0)) draw dma-add-func) dma-add-process-drawable-hud)
          (set-vector! (-> (the-as manipy (-> s4-5 0)) root trans) 0.0 0.0 0.0 1.0)
          (set-vector! (-> (the-as manipy (-> s4-5 0)) root scale) 0.008 -0.009 0.008 1.0)
          (if #f
              (send-event (ppointer->process s4-5) 'trans-hook #f)
              )
          )
        (set! (-> obj icons s5-5 icon) (the-as (pointer manipy) s4-5))
        (when s4-5
          (logior! (-> s4-5 0 mask) (process-mask pause))
          (logclear! (-> s4-5 0 mask) (process-mask menu progress))
          (set! (-> (the-as manipy (-> s4-5 0)) root trans z) 1024.0)
          (set! (-> obj icons s5-5 icon-x) -320)
          (set! (-> obj icons s5-5 icon-y) 253)
          (set! (-> obj icons s5-5 icon-z) 0)
          (set! (-> obj icons s5-5 scale-x) 0.008)
          (set! (-> obj icons s5-5 scale-y) -0.009)
          )
        )
      )
    (+! (-> obj nb-of-icons) 1)
    )
  (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)
  )

;; definition for method 48 of type progress
;; INFO: Return type mismatch int vs 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
       )
      )
    )
  0
  (none)
  )

;; definition for method 45 of type progress
;; INFO: Return type mismatch int vs 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)
  )

;; definition for method 46 of type progress
;; INFO: Return type mismatch int vs 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)
  )

;; definition for method 51 of type progress
;; INFO: Return type mismatch int vs 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) (* 0.001953125 (the float arg0)))
  (set! (-> obj transition-percentage-invert) (- 1.0 (-> obj transition-percentage)))
  0
  (none)
  )

;; definition for method 52 of type progress
;; INFO: Return type mismatch int vs 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)
  )

;; definition for function progress-init-by-other
;; INFO: Return type mismatch object vs 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 (the-as float 0.0) (the-as float 1.0) (the-as float 0.0) (the-as float 16384.0))
    (quaternion*! (-> self icons 0 icon 0 root quat) gp-0 (-> self icons 0 icon 0 root quat))
    (quaternion-axis-angle! gp-0 (the-as float 0.0) (the-as float 1.0) (the-as float 0.0) (the-as float 32768.0))
    (quaternion*! (-> self icons 1 icon 0 root quat) gp-0 (-> self icons 1 icon 0 root quat))
    (quaternion-axis-angle! gp-0 (the-as float 0.0) (the-as float 1.0) (the-as float 0.0) (the-as float 49152.0))
    (quaternion*! (-> self icons 2 icon 0 root quat) gp-0 (-> self icons 2 icon 0 root quat))
    (quaternion-axis-angle! gp-0 (the-as float 0.0) (the-as float 1.0) (the-as float 0.0) (the-as float 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)
  )

;; definition for symbol *progress-stack*, type (pointer uint8)
(define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800)))

;; definition for function activate-progress
;; INFO: Return type mismatch int vs none.
(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)
         (set! *progress-process* (process-spawn progress :to creator :stack (&-> *progress-stack* 14336)))
         (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)
  )

;; definition for function deactivate-progress
;; INFO: Return type mismatch int vs none.
(defun deactivate-progress ()
  (when (and *progress-process* (= (-> *progress-process* 0 next-state name) 'progress-gone))
    (apply-settings *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)
  )

;; definition for function hide-progress-screen
;; INFO: Return type mismatch int vs none.
(defun hide-progress-screen ()
  (if *progress-process*
      (send-event (ppointer->process *progress-process*) 'go-away)
      )
  0
  (none)
  )

;; definition for function hide-progress-icons
;; INFO: Return type mismatch int vs 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)
  )

;; definition for method 7 of type game-count-info
(defmethod relocate game-count-info ((obj game-count-info) (arg0 int))
  (set! *game-counts* obj)
  obj
  )

;; definition for method 7 of type progress
;; INFO: Return type mismatch process vs progress.
(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))
  )

;; definition for method 21 of type progress
;; INFO: Return type mismatch int vs none.
(defmethod adjust-sprites progress ((obj progress))
  (let ((f0-1 (* 0.00024414062 (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) (* 4096.0 (+ (/ 3.5 (-> obj sides-x-scale)) (* 10.0 f0-1))))
    (set! (-> obj left-side-y-scale) (* 4096.0 (+ (-> obj sides-y-scale) (* 10.0 f0-1))))
    (set! (-> obj right-side-x-scale) (* 4096.0 (+ (/ 6.0 (-> obj sides-x-scale)) (* 4.0 f0-1))))
    (set! (-> obj right-side-y-scale) (* 4096.0 (+ (-> 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)
  )

;; definition for method 22 of type progress
;; INFO: Return type mismatch int vs 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)
  )

;; definition for method 23 of type progress
;; INFO: Return type mismatch int vs 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)
  )

;; definition for method 32 of type progress
(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))
                      )
                  (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))
                      )
                  )
             )
         )
    )
  )

;; definition for method 19 of type progress
;; INFO: Return type mismatch object vs symbol.
(defmethod visible? progress ((obj progress))
  (the-as symbol (and *progress-process* (zero? (-> *progress-process* 0 in-out-position))))
  )

;; definition for method 20 of type progress
(defmethod hidden? progress ((obj progress))
  (or (not *progress-process*) (= (-> *progress-process* 0 in-out-position) 4096))
  )

;; failed to figure out what this is:
(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! 'common-page 'set 0.0 1)
        (suspend)
        (go progress-coming-in)
        )
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate progress-gone (progress)
  :code (behavior ()
    (remove-setting! 'process-mask)
    (apply-settings *setting-control*)
    (logior! (-> self mask) (process-mask sleep))
    (suspend)
    0
    (none)
    )
  )

;; definition for method 53 of type progress
(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
    )
  )

;; definition for method 31 of type progress
;; INFO: Return type mismatch int vs none.
(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))
        (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))
        (case (-> obj display-state)
          (((progress-screen load-game))
           (cond
             ((< (-> obj option-index) 4)
              (when (nonzero? (-> s5-0 file (-> obj option-index) present))
                (sound-play "start-options")
                (set! (-> *progress-state* which) (-> obj option-index))
                (set! (-> obj next-display-state) (progress-screen memcard-loading))
                )
              )
             (else
               (sound-play "cursor-options")
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          (((progress-screen save-game) (progress-screen save-game-title))
           (cond
             ((< (-> obj option-index) 4)
              (sound-play "start-options")
              (set! (-> *progress-state* which) (-> obj option-index))
              (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 "starts-options")
              (sound-volume-off)
              (set! (-> *game-info* mode) 'play)
              (initialize! *game-info* 'game (the-as game-save #f) "intro-start")
              (set-master-mode 'game)
              )
             (else
               (sound-play "cursor-options")
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          (((progress-screen memcard-insert))
           (sound-play "cursor-options")
           (set! (-> obj next-display-state) (progress-screen invalid))
           )
          (((progress-screen memcard-data-exists))
           (cond
             ((-> *progress-state* yes-no-choice)
              (sound-play "start-options")
              (set! (-> obj next-display-state) (progress-screen memcard-saving))
              )
             (else
               (sound-play "cursor-options")
               (if (= (-> obj display-state-stack 0) (progress-screen title))
                   (set! (-> obj next-display-state) (progress-screen save-game-title))
                   (set! (-> obj next-display-state) (progress-screen save-game))
                   )
               )
             )
           )
          (((progress-screen memcard-no-data))
           (cond
             ((-> *progress-state* yes-no-choice)
              (sound-play "start-options")
              (set! (-> obj next-display-state) (progress-screen memcard-creating))
              )
             (else
               (sound-play "cursor-options")
               (sound-volume-off)
               (set! (-> *game-info* mode) 'play)
               (initialize! *game-info* 'game (the-as game-save #f) "intro-start")
               (set-master-mode 'game)
               )
             )
           )
          (((progress-screen memcard-no-space)
            (progress-screen memcard-not-inserted)
            (progress-screen memcard-not-formatted)
            )
           (cond
             ((= (-> obj display-state-stack 0) (progress-screen title))
              (sound-play "start-options")
              (sound-volume-off)
              (set! (-> *game-info* mode) 'play)
              (initialize! *game-info* 'game (the-as game-save #f) "intro-start")
              (set-master-mode 'game)
              )
             ((nonzero? (-> obj display-state-stack 0))
              (sound-play "start-options")
              (set-master-mode 'game)
              )
             (else
               (sound-play "cursor-options")
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          (((progress-screen memcard-error-loading)
            (progress-screen memcard-error-saving)
            (progress-screen memcard-error-formatting)
            (progress-screen memcard-error-creating)
            (progress-screen memcard-auto-save-error)
            (progress-screen memcard-removed)
            (progress-screen auto-save)
            )
           (sound-play "cursor-options")
           (set! (-> obj next-display-state) (progress-screen invalid))
           )
          (((progress-screen pal-change-to-60hz))
           (cond
             ((-> *progress-state* yes-no-choice)
              (sound-play "start-options")
              (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
              (set! (-> obj video-mode-timeout) (-> *display* real-frame-counter))
              (set! (-> obj next-display-state) (progress-screen pal-now-60hz))
              )
             (else
               (sound-play "cursor-options")
               (set! (-> *progress-state* video-mode-choice) 'pal)
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          (((progress-screen pal-now-60hz))
           (cond
             ((not (-> *progress-state* yes-no-choice))
              (set! (-> *progress-state* video-mode-choice) 'pal)
              (set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
              (sound-play "cursor-options")
              )
             (else
               (sound-play "start-options")
               )
             )
           (set! (-> obj next-display-state) (progress-screen invalid))
           )
          (((progress-screen no-disc) (progress-screen bad-disc))
           (when (is-cd-in?)
             (sound-play "cursor-options")
             (set! (-> obj next-display-state) (progress-screen invalid))
             )
           )
          (((progress-screen quit))
           (cond
             ((-> *progress-state* yes-no-choice)
              (sound-play "start-options")
              (sound-volume-off)
              (set! (-> *game-info* mode) 'play)
              (initialize! *game-info* 'game (the-as game-save #f) "title-start")
              )
             (else
               (sound-play "cursor-options")
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          (((progress-screen memcard-format))
           (cond
             ((-> *progress-state* yes-no-choice)
              (sound-play "start-options")
              (set! (-> obj next-display-state) (progress-screen memcard-formatting))
              )
             ((= (-> obj display-state-stack 0) (progress-screen title))
              (sound-play "start-options")
              (sound-volume-off)
              (set! (-> *game-info* mode) 'play)
              (initialize! *game-info* 'game (the-as game-save #f) "intro-start")
              (set-master-mode 'game)
              )
             (else
               (sound-play "cursor-options")
               (set! (-> obj next-display-state) (progress-screen invalid))
               )
             )
           )
          )
        )
      )
    )
  0
  (none)
  )

;; definition for method 29 of type progress
;; INFO: Return type mismatch int vs 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 "cursor-up-down")
                  )
              (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 "slider2001")
                     )
                   )
                 )
               )
             )
           )
         )
        ((cpad-hold? 0 down)
         (cond
           ((cpad-pressed? 0 down)
            (when (not (-> obj selected-option))
              (if (!= (length s5-0) 1)
                  (sound-play "cursor-up-down")
                  )
              (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 "slider2001")
                     )
                   )
                 )
               )
             )
           )
         )
        ((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)) 0) #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 "cursor-l-r")
                    )
                )
              )
            )
           (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 "slider2001" :vol f30-0)
                       )
                     )
                   )
                 )
               )
             )
           )
         )
        ((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 "cursor-l-r")
                    )
                )
              )
            )
           (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 "slider2001" :vol f30-1)
                       )
                     )
                   )
                 )
               )
             )
           )
         )
        ((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)) 0)
                     (-> *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 "cursor-options")
            (set! (-> obj selected-option) #f)
            )
           ((or (can-go-back? obj)
                (= (-> obj display-state) (progress-screen load-game))
                (= (-> obj display-state) (progress-screen save-game))
                (= (-> obj display-state) (progress-screen save-game-title))
                )
            (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 "menu-stats")
                (sound-play "cursor-options")
                )
            (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 "select-option")
               (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 "menu-stats")
                      (sound-play "cursor-options")
                      )
                  (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 language-enum (-> (the-as (pointer uint64) (-> 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 "select-option")
               (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 "start-options")
             (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)
  )

;; definition for method 30 of type progress
;; INFO: Return type mismatch int vs 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 "cursor-up-down")
           (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 "cursor-up-down")
           (set! (-> obj level-transition) 1)
           )
         )
       )
      ((cpad-pressed? 0 square)
       (when (nonzero? (-> obj display-state))
         (sound-play "select-option")
         (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 "select-option")
         (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 "select-option")
         (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 "start-options")
       (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 "cursor-l-r")
                )
            )
          )
         ((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 "cursor-l-r")
                )
            )
          )
         )
       )
      )
    )
  0
  (none)
  )

;; failed to figure out what this is:
(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) 60) 30)
                          (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))
           )
      #t
      (let ((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 (the-as float 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 (the-as float 0.82))
           )
          (((progress-screen memcard-removed) (progress-screen memcard-auto-save-error))
           (draw-notice-screen self)
           (draw-options self 192 0 (the-as float 0.82))
           )
          (((progress-screen memcard-no-data))
           (draw-notice-screen self)
           (draw-options self 165 0 (the-as float 0.82))
           )
          (((progress-screen memcard-format))
           (draw-notice-screen self)
           (draw-options self 172 0 (the-as float 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 (the-as float 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 (the-as float 0.82))
           )
          (((progress-screen pal-change-to-60hz))
           (draw-notice-screen self)
           (draw-options self 190 0 (the-as float 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 (the-as float 0.82))
           )
          (((progress-screen no-disc) (progress-screen bad-disc))
           (draw-notice-screen self)
           (if (is-cd-in?)
               (draw-options self 170 0 (the-as float 0.82))
               )
           )
          (((progress-screen quit))
           (draw-notice-screen self)
           (draw-options self 110 0 (the-as float 0.82))
           )
          (((progress-screen auto-save))
           (draw-notice-screen self)
           (draw-options self 190 0 (the-as float 0.82))
           )
          (((progress-screen memcard-insert))
           (draw-notice-screen self)
           (draw-options self 165 0 (the-as float 0.82))
           )
          (((progress-screen memcard-data-exists))
           (draw-notice-screen self)
           (draw-options self 168 0 (the-as float 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 (the-as float 0.82))
           )
          (((progress-screen save-game-title))
           (draw-notice-screen self)
           (draw-options self 169 15 (the-as float 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))
                     (the-as float 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)
    )
  )

;; failed to figure out what this is:
(defstate progress-coming-in (progress)
  :event (-> progress-waiting event)
  :enter (behavior ()
    (sound-group-pause (sound-group sfx music dialog sog3 ambient sog5 sog6 sog7))
    (logclear! (-> *setting-control* default process-mask) (process-mask pause menu))
    (add-setting! 'process-mask 'set 0.0 (process-mask progress))
    (apply-settings *setting-control*)
    (sound-play "select-menu")
    (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)
  )

;; failed to figure out what this is:
(defstate progress-going-out (progress)
  :enter (behavior ()
    (sound-play "menu-close")
    (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)
  )

;; failed to figure out what this is:
(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)
          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)
          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)
          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)
          gp-3
          (the-as (pointer dma-tag) a3-10)
          )
        )
      )
    (let ((gp-4 (new
                  'stack
                  'font-context
                  *font-default-matrix*
                  32
                  50
                  (the-as float 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)
    )
  )

;; failed to figure out what this is:
0
