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

;; name: default-menu.gc
;; name in dgo: default-menu
;; dgos: GAME

(define-extern *ocean-map-sewer* ocean-map)

;; DECOMP BEGINS

;; this file is debug only
(declare-file (debug))

(define *debug-menu-context* (new 'debug 'debug-menu-context))

(define *dm-cam-mode-interpolation* 0)

(defun dm-cam-mode-func ((arg0 (state camera-slave)) (arg1 debug-menu-msg))
  (if (and (= arg1 (debug-menu-msg press)) arg0)
      (set-setting-by-param *setting-control* 'mode-name (-> arg0 name) 0 0)
      )
  (if *camera*
      (send-event *camera* 'query-state arg0)
      (not arg0)
      )
  )

(defun dm-cam-mode-default ((arg0 object) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (remove-setting-by-arg0 *setting-control* 'mode-name)
      )
  (not (get-setting *setting-control* 'mode-name))
  )

(defun dm-cam-settings-default ((arg0 object) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (remove-setting-by-arg0 *setting-control* 'fov)
    (remove-setting-by-arg0 *setting-control* 'slave-options)
    )
  (and (not (get-setting *setting-control* 'fov)) (not (get-setting *setting-control* 'slave-options)))
  )

(defun dm-cam-settings-func ((arg0 int) (arg1 debug-menu-msg))
  (when (and (= arg1 (debug-menu-msg press)) *camera*)
    (cond
      ((zero? arg0)
       (send-event *camera* 'toggle-slave-option (cam-slave-options BUTT_CAM))
       )
      ((= arg0 1)
       (send-event *camera* 'toggle-slave-option (cam-slave-options SAME_SIDE))
       )
      ((= arg0 2)
       (send-event *camera* 'toggle-slave-option (cam-slave-options MOVE_SPHERICAL))
       )
      ((= arg0 3)
       (send-event *camera* 'toggle-slave-option (cam-slave-options DRAG))
       )
      ((= arg0 4)
       (send-event *camera* 'toggle-slave-option (cam-slave-options ALLOW_Z_ROT))
       )
      ((= arg0 6)
       (set-setting-by-param *setting-control* 'slave-options 'clear 0 16)
       )
      ((= arg0 7)
       (send-event *camera* 'toggle-slave-option (cam-slave-options FIND_HIDDEN_TARGET))
       )
      ((= arg0 8)
       (send-event *camera* 'toggle-slave-option (cam-slave-options COLLIDE))
       )
      ((= arg0 9)
       (send-event *camera* 'toggle-slave-option (cam-slave-options LINE_OF_SIGHT))
       )
      ((= arg0 10)
       (send-event *camera* 'toggle-slave-option (cam-slave-options NO_ROTATE))
       )
      ((= arg0 11)
       (send-event *camera* 'toggle-slave-option (cam-slave-options STICKY_ANGLE))
       )
      )
    )
  (cond
    (*camera*
      (cond
        ((zero? arg0)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 BUTT_CAM))
         )
        ((= arg0 1)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 SAME_SIDE))
         )
        ((= arg0 2)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 MOVE_SPHERICAL))
         )
        ((= arg0 3)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 DRAG))
         )
        ((= arg0 4)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 ALLOW_Z_ROT))
         )
        ((= arg0 6)
         (not (get-setting *setting-control* 'slave-options))
         )
        ((= arg0 7)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 FIND_HIDDEN_TARGET))
         )
        ((= arg0 8)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 COLLIDE))
         )
        ((= arg0 9)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 LINE_OF_SIGHT))
         )
        ((= arg0 10)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 NO_ROTATE))
         )
        ((= arg0 11)
         (logtest? (-> *camera* slave-options) (cam-slave-options-u32 STICKY_ANGLE))
         )
        (else
          #f
          )
        )
      )
    (else
      #f
      )
    )
  )

(defun dm-cam-settings-func-int ((arg0 int) (arg1 debug-menu-msg) (arg2 int) (arg3 int))
  (when (and (= arg1 (debug-menu-msg press)) *camera*)
    (if (= (/ arg0 8) 5)
        (set! *dm-cam-mode-interpolation* arg2)
        )
    )
  (cond
    (*camera*
      (if (= (/ arg0 8) 5)
          *dm-cam-mode-interpolation*
          arg3
          )
      )
    (else
      arg3
      )
    )
  )

(defun dm-cam-externalize ((arg0 symbol) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (cond
      ((= arg0 'reset)
       (if (!= *external-cam-mode* 'locked)
           (external-cam-reset!)
           )
       )
      ((= arg0 'allow-z)
       (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z)))
       )
      ((= *external-cam-mode* arg0)
       (set! *external-cam-mode* #f)
       )
      (else
        (if (not *external-cam-mode*)
            (external-cam-reset!)
            )
        (set! *external-cam-mode* arg0)
        )
      )
    )
  (if (= arg0 'allow-z)
      (logtest? *external-cam-options* (external-cam-option allow-z))
      (= *external-cam-mode* arg0)
      )
  )

(defun dm-cam-setting-float ((arg0 float) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
  (when (= arg1 (debug-menu-msg press))
    (let ((v1-2 arg0))
      (when (= (the-as int v1-2) 'fov)
        (if (not (get-setting *setting-control* 'fov))
            (set! arg2 64.0)
            )
        (set-setting-by-param *setting-control* 'fov #f (* 182.04445 arg2) 0)
        (if *camera-combiner*
            (set! (-> *camera-combiner* fov) (* 182.04445 arg2))
            )
        (if (and *camera* (-> *camera* slave))
            (set! (-> *camera* slave 0 fov) (* 182.04445 arg2))
            )
        )
      )
    )
  (cond
    ((= (the-as int arg0) 'fov)
     (cond
       ((get-setting *setting-control* 'fov)
        (empty)
        arg2
        )
       (*math-camera*
         (* 0.005493164 (-> *math-camera* fov))
         )
       (else
         arg3
         )
       )
     )
    (else
      arg3
      )
    )
  )

(defun dm-cam-render-float ((arg0 int) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
  (when (= arg1 (debug-menu-msg press))
    (when (zero? (/ arg0 8))
      (when *math-camera*
        (set! (-> *math-camera* fov) (* 182.04445 arg2))
        (update-math-camera
          *math-camera*
          (-> *setting-control* user-current video-mode)
          (-> *setting-control* user-current aspect-ratio)
          (-> *math-camera* fov)
          )
        )
      )
    )
  (cond
    ((zero? (/ arg0 8))
     (cond
       (*math-camera*
         (* 0.005493164 (-> *math-camera* fov))
         )
       (else
         (empty)
         arg3
         )
       )
     )
    (else
      (empty)
      arg3
      )
    )
  )

(defun dm-subdiv-float ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
  (when (= arg1 (debug-menu-msg press))
    (case arg0
      (('close)
       (when (and *math-camera* *subdivide-settings*)
         (dotimes (v1-6 12)
           (set! (-> *subdivide-settings* close v1-6) (* 4096.0 arg2))
           )
         )
       )
      (('far)
       (when (and *math-camera* *subdivide-settings*)
         (dotimes (v1-13 12)
           (set! (-> *subdivide-settings* far v1-13) (* 4096.0 arg2))
           )
         )
       )
      )
    )
  (case arg0
    (('close)
     (if (and *math-camera* *subdivide-settings*)
         (/ (-> *subdivide-settings* close 0) METER_LENGTH)
         arg3
         )
     )
    (('far)
     (if (and *math-camera* *subdivide-settings*)
         (/ (-> *subdivide-settings* far 0) METER_LENGTH)
         arg3
         )
     )
    (else
      arg3
      )
    )
  )

(defun dm-subdiv-int ((arg0 symbol) (arg1 debug-menu-msg) (arg2 int) (arg3 int))
  (when (= arg1 (debug-menu-msg press))
    (case arg0
      (('anim-speed)
       (if *anim-tester*
           (set! (-> *anim-tester* 0 speed) arg2)
           )
       )
      )
    )
  (case arg0
    (('anim-speed)
     (if *anim-tester*
         (-> *anim-tester* 0 speed)
         arg3
         )
     )
    (else
      arg3
      )
    )
  )

(defun dm-select-race-path ((arg0 object) (arg1 debug-menu-msg) (arg2 int))
  (if (= arg1 (debug-menu-msg press))
      (set! *select-race-path* arg2)
      )
  *select-race-path*
  )

(defun dm-setting-language ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *setting-control* user-default language) (the-as language-enum (/ arg0 8)))
      )
  (= (-> *setting-control* user-default language) (/ arg0 8))
  )

(defun dm-setting-subtitle-language ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *setting-control* user-default subtitle-language) (the-as language-enum (/ arg0 8)))
      )
  (= (-> *setting-control* user-default subtitle-language) (/ arg0 8))
  )

(defun dm-setting-audio-language ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *setting-control* user-default audio-language) (the-as language-enum (/ arg0 8)))
      )
  (= (-> *setting-control* user-default audio-language) (/ arg0 8))
  )

(defun dm-setting-stereo-mode ((arg0 object) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *setting-control* user-default stereo-mode) (the-as int (/ (the-as int arg0) 8)))
      )
  (= (-> *setting-control* user-default stereo-mode) (/ (the-as int arg0) 8))
  )

(defun dm-current-continue ((arg0 string) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (start 'play (get-continue-by-name *game-info* arg0))
      )
  (string= (-> (get-current-continue-forced *game-info*) name) arg0)
  )

(defun dm-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *subdivide-draw-mode* (the-as subdivide-setting (/ arg0 8)))
      )
  (= (/ arg0 8) *subdivide-draw-mode*)
  )

(defun dm-scissor-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *subdivide-scissor-draw-mode* (the-as subdivide-setting (/ arg0 8)))
      )
  (= (/ arg0 8) *subdivide-scissor-draw-mode*)
  )

(defun dm-foreground-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (set! *subdivide-foreground-draw-mode* (the-as subdivide-setting (/ arg0 8)))
    (let ((v1-3 *generic-consts*)
          (a1-1 (/ arg0 8))
          )
      (cond
        ((zero? a1-1)
         (set! (-> v1-3 base-strgif str-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         (set! (-> v1-3 base-strgif fan-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         )
        ((= a1-1 1)
         (set! (-> v1-3 base-strgif str-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         (set! (-> v1-3 base-strgif fan-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         )
        ((= a1-1 2)
         (set! (-> v1-3 base-strgif str-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         (set! (-> v1-3 base-strgif fan-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         )
        ((= a1-1 3)
         (set! (-> v1-3 base-strgif str-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         (set! (-> v1-3 base-strgif fan-prim)
               (new 'static 'gif-tag-prim
                 :pre #x1
                 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe #x1)
                 :nreg #x3
                 )
               )
         )
        )
      )
    )
  (= (/ arg0 8) *subdivide-foreground-draw-mode*)
  )

(defun dm-col-rend-on-func ((arg0 object) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 draw?) (not (-> v1-0 draw?)))
        )
    (-> v1-0 draw?)
    )
  )

(defun dm-col-rend-outline-func ((arg0 object) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 outline?) (not (-> v1-0 outline?)))
        )
    (-> v1-0 outline?)
    )
  )

(defun dm-col-rend-back-face-func ((arg0 object) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 show-back-faces?) (not (-> v1-0 show-back-faces?)))
        )
    (-> v1-0 show-back-faces?)
    )
  )

(defun dm-col-rend-normals-func ((arg0 object) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 show-normals?) (not (-> v1-0 show-normals?)))
        )
    (-> v1-0 show-normals?)
    )
  )

(defun dm-col-rend-ghost-hidden-func ((arg0 object) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 ghost-hidden?) (not (-> v1-0 ghost-hidden?)))
        )
    (-> v1-0 ghost-hidden?)
    )
  )

(defun dm-col-rend-track-func ((arg0 int) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 track) (the-as uint (/ arg0 8)))
        )
    (= (/ arg0 8) (-> v1-0 track))
    )
  )

(defun dm-col-rend-show-only-toggle-func ((arg0 uint) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (when (= arg1 (debug-menu-msg press))
      (logxor! (-> v1-0 show-only) arg0)
      (logand! (-> v1-0 show-only) -57)
      )
    (logtest? (-> v1-0 show-only) arg0)
    )
  )

(defun dm-col-rend-show-only-set-func ((arg0 uint) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 show-only) arg0)
        )
    (= (-> v1-0 show-only) arg0)
    )
  )

(defun dm-col-rend-cspec-toggle ((arg0 uint) (arg1 debug-menu-msg))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (logxor! (-> v1-0 cspec) (the-as uint arg0))
        )
    (logtest? (-> v1-0 cspec) arg0)
    )
  )

(defun dm-col-rend-size ((arg0 object) (arg1 debug-menu-msg) (arg2 float))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 bbox-radius) (* 2048.0 arg2))
        )
    (* 0.00024414062 (* 2.0 (-> v1-0 bbox-radius)))
    )
  )

(defun dm-col-rend-cam-dist ((arg0 object) (arg1 debug-menu-msg) (arg2 float))
  (let ((v1-0 *col-rend*))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> v1-0 camera-to-bbox-dist) (* 4096.0 arg2))
        )
    (/ (-> v1-0 camera-to-bbox-dist) METER_LENGTH)
    )
  )

(defun dm-ocean-height-func ((arg0 ocean-height-hack) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (set! *ocean-height-hack* (the-as ocean-height-hack (/ (the-as int arg0) 8)))
    (let* ((v1-3 (/ (the-as int arg0) 8))
           (f0-0 (cond
                   ((= v1-3 2)
                    -16384000.0
                    )
                   ((= v1-3 3)
                    -216498.17
                    )
                   ((= v1-3 4)
                    -265650.2
                    )
                   ((= v1-3 5)
                    -314802.2
                    )
                   ((= v1-3 6)
                    -368050.2
                    )
                   (else
                     0.0
                     )
                   )
                 )
           )
      (set-height! *ocean-map-sewer* f0-0)
      )
    )
  (= (/ (the-as int arg0) 8) *ocean-height-hack*)
  )

(defun dm-ocean-subdiv-draw-func ((arg0 object) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *subdivide-ocean-draw-mode* (the-as subdivide-setting (/ (the-as int arg0) 8)))
      )
  (= (/ (the-as int arg0) 8) *subdivide-ocean-draw-mode*)
  )

(defun dm-time-of-day-func ((arg0 int) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (cond
      ((zero? (/ arg0 8))
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 7)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 1)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 10)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 2)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 12)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 3)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 14)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 4)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 18)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 5)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 19)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 6)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 23)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 7)
       (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
       (send-event (ppointer->process *time-of-day*) 'change 'hour 4)
       (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ arg0 8)))
       )
      ((= (/ arg0 8) 8)
       (send-event
         (ppointer->process *time-of-day*)
         'dest-clock-ratio-set
         (if *time-of-day-fast*
             #x42700000
             #x3f800000
             )
         (seconds 2)
         )
       )
      (else
        (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
        (set! (-> *time-of-day-context* mode)
              (logand (logxor (-> *time-of-day-context* mode) (the-as uint (/ arg0 8)))
                      (time-of-day-palette-id palette-0 palette-1 palette-2 palette-3 palette-4 palette-5 palette-6 palette-7)
                      )
              )
        )
      )
    (send-event (ppointer->process *time-of-day*) 'change 'minutes 0)
    (send-event (ppointer->process *time-of-day*) 'change 'seconds 0)
    (send-event (ppointer->process *time-of-day*) 'change 'frames 0)
    (set! *teleport-count* 1)
    )
  (cond
    ((< (/ arg0 8) 9)
     (= (/ arg0 8) (-> *time-of-day-context* mode))
     )
    ((< (/ arg0 8) 8)
     #f
     )
    (else
      (logtest? (-> *time-of-day-context* mode) (/ arg0 8))
      )
    )
  )

(defun dm-time-of-day-func2 ((arg0 symbol) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (set! (-> arg0 value) (not (-> arg0 value)))
    (if (nonzero? (send-event (ppointer->process *time-of-day*) 'ratio))
        (send-event
          (ppointer->process *time-of-day*)
          'dest-clock-ratio-set
          (if *time-of-day-fast*
              #x42700000
              #x3f800000
              )
          (seconds 2)
          )
        )
    )
  (-> arg0 value)
  )

(defun dm-time-of-day-palette-func ((arg0 int) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (set! (-> *time-of-day-context* overide-palette) (the-as time-of-day-palette-id (/ arg0 8)))
    (cond
      ((zero? (/ arg0 8))
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-0))
       )
      ((= (/ arg0 8) 1)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-1))
       )
      ((= (/ arg0 8) 2)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-2))
       )
      ((= (/ arg0 8) 3)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-3))
       )
      ((= (/ arg0 8) 4)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-4))
       )
      ((= (/ arg0 8) 5)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-5))
       )
      ((= (/ arg0 8) 6)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-6))
       )
      ((= (/ arg0 8) 7)
       (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-7))
       )
      )
    (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0)
    )
  (cond
    ((zero? (/ arg0 8))
     (= (-> *time-of-day-context* mode) 16)
     )
    ((= (/ arg0 8) 1)
     (= (-> *time-of-day-context* mode) 32)
     )
    ((= (/ arg0 8) 2)
     (= (-> *time-of-day-context* mode) 64)
     )
    ((= (/ arg0 8) 3)
     (= (-> *time-of-day-context* mode) 128)
     )
    ((= (/ arg0 8) 4)
     (= (-> *time-of-day-context* mode) 256)
     )
    ((= (/ arg0 8) 5)
     (= (-> *time-of-day-context* mode) 512)
     )
    ((= (/ arg0 8) 6)
     (= (-> *time-of-day-context* mode) 1024)
     )
    ((= (/ arg0 8) 7)
     (= (-> *time-of-day-context* mode) 2048)
     )
    )
  )

(defun dm-boolean-toggle-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> arg0 value) (not (-> arg0 value)))
      )
  (-> arg0 value)
  )

(defun dm-time-of-day-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (time-of-day-setup (= arg1 (debug-menu-msg press)))
  )

(defun dm-stats-memory-func ((arg0 int) (arg1 debug-menu-msg))
  (let ((v1-0 (/ arg0 8)))
    (if (= arg1 (debug-menu-msg press))
        (set! *stats-memory-level-index* v1-0)
        )
    (= *stats-memory-level-index* v1-0)
    )
  )

(defun dm-actor-marks-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-actor-marks* arg0)
      )
  (= *display-actor-marks* arg0)
  )

;; WARN: Return type mismatch number vs object.
(defun dm-debug-actor-lod-dist ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
  (local-vars (sv-16 res-tag))
  (when (= arg1 (debug-menu-msg press))
    (when (and *debug-actor* (>= (-> (the-as process-drawable *debug-actor*) draw lod-set max-lod) (/ arg0 8)))
      (let ((a0-4 (&+ (-> (the-as process-drawable *debug-actor*) draw jgeo extra data-base) (* (/ arg0 8) 4))))
        (mem-set32! a0-4 1 (the-as int (* 4096.0 arg2)))
        )
      (reset-actors 'debug)
      )
    )
  (cond
    (*debug-actor*
      (let ((f30-0 0.00024414062))
        (set! sv-16 (new 'static 'res-tag))
        (let ((v1-21 (res-lump-data
                       (-> (the-as process-drawable *debug-actor*) draw jgeo extra)
                       'lod-dist
                       (pointer float)
                       :tag-ptr (& sv-16)
                       )
                     )
              )
          (* f30-0 (if (and v1-21 (< (/ arg0 8) (the-as int (-> sv-16 elt-count))))
                       (-> v1-21 (/ arg0 8))
                       0.0
                       )
             )
          )
        )
      )
    (else
      0
      )
    )
  )

(defun dm-select-race-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *select-race* (the-as race-selection (/ arg0 8)))
      )
  (= (/ arg0 8) *select-race*)
  )

(defun dm-compact-actor-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *compact-actors* arg0)
      )
  (= *compact-actors* arg0)
  )

(defun dm-actor-vis-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-actor-vis* arg0)
      )
  (= *display-actor-vis* arg0)
  )

(defun dm-game-mode-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *game-info* mode) arg0)
      )
  (= (-> *game-info* mode) arg0)
  )

(defun dm-game-feature-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (let ((v1-1 (ash 1 (/ arg0 8))))
    (when (= arg1 (debug-menu-msg press))
      (logxor! (-> *game-info* features) (the-as uint v1-1))
      (set! (-> *game-info* debug-features)
            (logior (logclear (-> *game-info* debug-features) v1-1) (logand (-> *game-info* features) v1-1))
            )
      (if (logtest? (game-feature
                      gun-red-1
                      gun-red-2
                      gun-red-3
                      gun-yellow-1
                      gun-yellow-2
                      gun-yellow-3
                      gun-blue-1
                      gun-blue-2
                      gun-blue-3
                      gun-dark-1
                      gun-dark-2
                      gun-dark-3
                      )
                    (-> *game-info* features)
                    )
          (logior! (-> *game-info* features) (game-feature gun))
          (logclear! (-> *game-info* features) (game-feature gun))
          )
      (if (logtest? (game-feature
                      gun-red-1
                      gun-red-2
                      gun-red-3
                      gun-yellow-1
                      gun-yellow-2
                      gun-yellow-3
                      gun-blue-1
                      gun-blue-2
                      gun-blue-3
                      gun-dark-1
                      gun-dark-2
                      gun-dark-3
                      )
                    (-> *game-info* debug-features)
                    )
          (logior! (-> *game-info* debug-features) (game-feature gun))
          (logclear! (-> *game-info* debug-features) (game-feature gun))
          )
      )
    (logtest? (-> *game-info* features) v1-1)
    )
  )

(defun dm-game-vehicle-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (let ((v1-1 (ash 1 (/ arg0 8))))
    (when (= arg1 (debug-menu-msg press))
      (logxor! (-> *game-info* vehicles) (the-as uint v1-1))
      (set! (-> *game-info* debug-vehicles)
            (logior (logclear (-> *game-info* debug-vehicles) v1-1) (logand (-> *game-info* vehicles) v1-1))
            )
      )
    (logtest? (-> *game-info* vehicles) v1-1)
    )
  )

(defun dm-game-secret-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (logxor! (-> *game-info* secrets) (the-as uint (ash 1 (/ arg0 8))))
    (update-task-masks 'event)
    )
  (logtest? (-> *game-info* secrets) (ash 1 (/ arg0 8)))
  )

(defun display-scene-control-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-scene-control* (logxor *display-scene-control* (the-as uint arg0)))
      )
  (logtest? *display-scene-control* arg0)
  )

(defun display-scene-control-set-pick-func ((arg0 scene-controls) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-scene-control* arg0)
      )
  (= *display-scene-control* arg0)
  )

(defun display-bot-marks-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-bot-marks* (logxor *display-bot-marks* (the-as uint arg0)))
      )
  (logtest? *display-bot-marks* arg0)
  )

(defun display-bot-marks-set-pick-func ((arg0 bot-marks-controls) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-bot-marks* arg0)
      )
  (= *display-bot-marks* arg0)
  )

(defun display-race-marks-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-race-marks* (logxor *display-race-marks* (the-as uint arg0)))
      )
  (logtest? *display-race-marks* arg0)
  )

(defun display-race-marks-set-pick-func ((arg0 race-marks-controls) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-race-marks* arg0)
      )
  (= *display-race-marks* arg0)
  )

(defun dm-vu1-user-toggle-pick-func ((arg0 vu1-renderer-mask) (arg1 debug-menu-msg))
  (let ((v1-1 (ash 1 (/ (the-as int arg0) 8))))
    (if (= arg1 (debug-menu-msg press))
        (logxor! (-> *display* vu1-enable-user-menu) (the-as uint v1-1))
        )
    (logtest? (-> *display* vu1-enable-user-menu) v1-1)
    )
  )

(defun dm-vu1-user-all-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (let ((v1-1 (the-as uint #x17fffffff8)))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> *display* vu1-enable-user-menu) (the-as vu1-renderer-mask v1-1))
        )
    (= (-> *display* vu1-enable-user-menu) v1-1)
    )
  )

(defun dm-vu1-user-none-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (let ((v1-0 0))
    (if (= arg1 (debug-menu-msg press))
        (set! (-> *display* vu1-enable-user-menu) (the-as vu1-renderer-mask v1-0))
        )
    (= (-> *display* vu1-enable-user-menu) v1-0)
    )
  )

(defun dm-texture-user-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (logxor! (-> *texture-pool* texture-enable-user-menu) (the-as uint arg0))
      )
  (logtest? (-> *texture-pool* texture-enable-user-menu) arg0)
  )

(defun dm-texture-user-set-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! (-> *texture-pool* texture-enable-user-menu) (the-as texture-enable-mask arg0))
      )
  (= (-> *texture-pool* texture-enable-user-menu) arg0)
  )

(defun dm-strip-lines-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-strip-lines* (logxor *display-strip-lines* (the-as uint (/ arg0 8))))
      )
  (logtest? *display-strip-lines* (/ arg0 8))
  )

(defun dm-strip-lines-set-pick-func ((arg0 strip-lines-controls) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *display-strip-lines* (the-as strip-lines-controls (/ (the-as int arg0) 8)))
      )
  (= *display-strip-lines* (/ (the-as int arg0) 8))
  )

(defun dm-edit-instance-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (dotimes (s4-0 (-> *level* length))
    (let ((a1-1 (-> *level* level s4-0)))
      (when (= (-> a1-1 status) 'active)
        (let ((v1-4 (find-instance-by-name-level *edit-instance* a1-1)))
          (when v1-4
            (if (= arg1 (debug-menu-msg press))
                (logxor! (-> v1-4 flags) (the-as uint arg0))
                )
            (logtest? (-> v1-4 flags) arg0)
            )
          )
        )
      )
    )
  #f
  )

;; og:preserve-this
(defun all-texture-tweak-adjust ((arg0 texture-page-dir) (arg1 float))
  (none)
  )

(defun dm-float-field-tie-rvanish-func ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
  (let ((f30-0 arg3))
    (dotimes (s3-0 (-> *level* length))
      (let ((a1-1 (-> *level* level s3-0)))
        (when (= (-> a1-1 status) 'active)
          (let ((s2-0 (find-instance-by-name-level (the-as string (-> arg0 value)) a1-1)))
            (when s2-0
              (case (prototype-bucket-type s2-0)
                ((instance-tie)
                 (let* ((f0-0 (-> (the-as prototype-bucket-tie s2-0) tie-vanish-far))
                        (f1-2 (- f0-0 (/ 128.0 (-> (the-as prototype-bucket-tie s2-0) tie-rvanish))))
                        )
                   (let ((f2-1 (-> (the-as prototype-bucket-tie s2-0) dists w)))
                     (when (= arg1 (debug-menu-msg press))
                       (logior! (-> (the-as prototype-bucket-tie s2-0) flags) (prototype-flags vanish))
                       (set! f1-2 (fmax (fmin (* 4096.0 arg2) f0-0) (+ 4096.0 f2-1)))
                       (let ((f0-1 (fmax f0-0 (+ 4096.0 f1-2))))
                         (set! (-> (the-as prototype-bucket-tie s2-0) tie-rvanish) (/ 128.0 (- f0-1 f1-2)))
                         (set! (-> (the-as prototype-bucket-tie s2-0) tie-vanish-far) f0-1)
                         )
                       )
                     )
                   (set! f30-0 (/ f1-2 METER_LENGTH))
                   )
                 )
                )
              )
            )
          )
        )
      )
    f30-0
    )
  )

(defun dm-float-field-tie-vanish-far-func ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
  (let ((f30-0 arg3))
    (dotimes (s3-0 (-> *level* length))
      (let ((a1-1 (-> *level* level s3-0)))
        (when (= (-> a1-1 status) 'active)
          (let ((s2-0 (find-instance-by-name-level (the-as string (-> arg0 value)) a1-1)))
            (when s2-0
              (case (prototype-bucket-type s2-0)
                ((instance-tie)
                 (let ((f0-0 (-> (the-as prototype-bucket-tie s2-0) tie-vanish-far)))
                   (let ((f2-1 (- f0-0 (/ 128.0 (-> (the-as prototype-bucket-tie s2-0) tie-rvanish))))
                         (f1-2 (-> (the-as prototype-bucket-tie s2-0) dists w))
                         )
                     (when (= arg1 (debug-menu-msg press))
                       (logior! (-> s2-0 flags) (prototype-flags vanish))
                       (set! f0-0 (fmax (* 4096.0 arg2) (+ 4096.0 f2-1)))
                       (let ((f1-4 (fmax (fmin f2-1 f0-0) (+ 4096.0 f1-2))))
                         (set! (-> (the-as prototype-bucket-tie s2-0) tie-rvanish) (/ 128.0 (- f0-0 f1-4)))
                         )
                       (set! (-> (the-as prototype-bucket-tie s2-0) tie-vanish-far) f0-0)
                       )
                     )
                   (set! f30-0 (/ f0-0 METER_LENGTH))
                   )
                 )
                )
              )
            )
          )
        )
      )
    f30-0
    )
  )

(defun dm-bug-report-output-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (set! *bug-report-output-mode* arg0)
      )
  (= *bug-report-output-mode* arg0)
  )

(defun dm-bug-report-report-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (bug-report-display arg0)
      )
  0
  (none)
  )

(defun debug-menu-node<? ((arg0 debug-menu-node) (arg1 debug-menu-node))
  (string<=? (-> arg0 name) (-> arg1 name))
  )

(defun dm-shader-pick-func ((arg0 texture-id) (arg1 debug-menu-msg))
  (if (and (= arg1 (debug-menu-msg press))
           *texture-page-dir*
           (-> *texture-page-dir* entries (-> arg0 page) page)
           (-> *texture-page-dir* entries (-> arg0 page) link)
           (nonzero? (-> *texture-page-dir* entries (-> arg0 page) link next (-> arg0 index)))
           )
      (set! *edit-shader* arg0)
      )
  (and (nonzero? *edit-shader*) (= arg0 *edit-shader*))
  )

(define *shader-pick-menu* (the-as debug-menu #f))

;; WARN: Return type mismatch pair vs none.
(defun build-shader-list ()
  (debug-menu-remove-all-items *shader-pick-menu*)
  (when *texture-page-dir*
    (dotimes (gp-0 (-> *texture-page-dir* length))
      (let ((s5-0 (-> *texture-page-dir* entries gp-0 page))
            (s4-0 (-> *texture-page-dir* entries gp-0 link))
            )
        (when (and s5-0 s4-0)
          (dotimes (s3-0 (-> s5-0 length))
            (when (and (-> s5-0 data s3-0) (nonzero? (-> s4-0 next s3-0)))
              (let ((a1-1 (new
                            'debug
                            'debug-menu-item-flag
                            (-> s5-0 data s3-0 name)
                            (logior (shr (shl s3-0 52) 44) (shr (shl gp-0 52) 32))
                            dm-shader-pick-func
                            )
                          )
                    )
                (debug-menu-append-item *shader-pick-menu* a1-1)
                )
              )
            )
          )
        )
      )
    )
  (set! (-> *shader-pick-menu* items) (sort (-> *shader-pick-menu* items) debug-menu-node<?))
  (none)
  )

;; WARN: Return type mismatch object vs basic.
(defun dm-instance-pick-func ((arg0 string) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (set! *edit-instance* #f)
    (dotimes (s5-0 (-> *level* length))
      (let ((a1-1 (-> *level* level s5-0)))
        (when (= (-> a1-1 status) 'active)
          (if (find-instance-by-name-level arg0 a1-1)
              (set! *edit-instance* arg0)
              )
          )
        )
      )
    )
  (the-as basic (and *edit-instance* (string= arg0 *edit-instance*)))
  )

(defun dm-enable-instance-func ((arg0 string) (arg1 debug-menu-msg))
  (let ((s3-0 #f))
    (dotimes (s4-0 (-> *level* length))
      (let ((a1-1 (-> *level* level s4-0)))
        (when (= (-> a1-1 status) 'active)
          (let ((v1-4 (find-instance-by-name-level arg0 a1-1)))
            (when v1-4
              (if (= arg1 (debug-menu-msg press))
                  (logxor! (-> v1-4 flags) (prototype-flags disable))
                  )
              (set! s3-0 (not (logtest? (-> v1-4 flags) (prototype-flags disable))))
              )
            )
          )
        )
      )
    s3-0
    )
  )

(define *instance-shrub-menu* (the-as debug-menu #f))

(define *instance-tie-menu* (the-as debug-menu #f))

(define *enable-instance-shrub-menu* (the-as debug-menu #f))

(define *enable-instance-tie-menu* (the-as debug-menu #f))

(defun build-instance-list ((arg0 object))
  (debug-menu-remove-all-items *instance-shrub-menu*)
  (debug-menu-remove-all-items *instance-tie-menu*)
  (debug-menu-remove-all-items *enable-instance-shrub-menu*)
  (debug-menu-remove-all-items *enable-instance-tie-menu*)
  (set! *display-instance-info* #f)
  (dotimes (gp-0 (-> *level* length))
    (let ((v1-3 (-> *level* level gp-0)))
      (when (= (-> v1-3 status) 'active)
        (let ((s5-0 (-> v1-3 bsp drawable-trees)))
          (dotimes (s4-0 (-> s5-0 length))
            (let ((v1-7 (-> s5-0 trees s4-0)))
              (case (-> v1-7 type)
                ((drawable-tree-instance-shrub)
                 (let ((s3-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub)))
                   (dotimes (s2-0 (-> s3-0 length))
                     (let ((a1-4
                             (new 'global 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-instance-pick-func)
                             )
                           )
                       (debug-menu-append-item *instance-shrub-menu* a1-4)
                       )
                     (let ((a1-6
                             (new 'debug 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-enable-instance-func)
                             )
                           )
                       (set! (-> a1-6 is-on) #t)
                       (debug-menu-append-item *enable-instance-shrub-menu* a1-6)
                       )
                     )
                   )
                 )
                ((drawable-tree-instance-tie)
                 (let ((s3-1 (-> (the-as drawable-tree-instance-tie v1-7) prototypes prototype-array-tie)))
                   (dotimes (s2-1 (-> s3-1 length))
                     (let ((a1-9
                             (new
                               'debug
                               'debug-menu-item-flag
                               (-> s3-1 array-data s2-1 name)
                               (-> s3-1 array-data s2-1 name)
                               dm-instance-pick-func
                               )
                             )
                           )
                       (debug-menu-append-item *instance-tie-menu* a1-9)
                       )
                     (let ((a1-11
                             (new
                               'debug
                               'debug-menu-item-flag
                               (-> s3-1 array-data s2-1 name)
                               (-> s3-1 array-data s2-1 name)
                               dm-enable-instance-func
                               )
                             )
                           )
                       (set! (-> a1-11 is-on) #t)
                       (debug-menu-append-item *enable-instance-tie-menu* a1-11)
                       )
                     )
                   )
                 )
                )
              )
            )
          )
        )
      )
    )
  (set! (-> *instance-shrub-menu* items)
        (sort
          (-> *instance-shrub-menu* items)
          (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name)))
          )
        )
  (set! (-> *instance-tie-menu* items)
        (sort
          (-> *instance-tie-menu* items)
          (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name)))
          )
        )
  (set! (-> *enable-instance-shrub-menu* items)
        (sort
          (-> *enable-instance-shrub-menu* items)
          (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name)))
          )
        )
  (set! (-> *enable-instance-tie-menu* items)
        (sort
          (-> *enable-instance-tie-menu* items)
          (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name)))
          )
        )
  0
  (none)
  )

(defun dm-scene-load-pick-func ((arg0 pair) (arg1 debug-menu-msg))
  (when (= arg1 (debug-menu-msg press))
    (let ((s5-0 *display-profile*))
      (play-clean #f)
      (set! *display-profile* s5-0)
      )
    (set! *debug-menu-scene-play* #t)
    (let ((s5-1 (car (cdr arg0))))
      (process-spawn scene-player :init scene-player-init s5-1 #t (car arg0) :name "scene-player")
      )
    (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
    (set-master-mode 'game)
    )
  #f
  )

;; WARN: Return type mismatch object vs none.
(defun debug-create-cam-restore ()
  (cond
    (*math-camera*
      (format #t "(defun-debug cam-restore ()~%")
      (format #t " ;;this function is a hack, don't use it as an example~%")
      (format #t " (let ((pos (new 'stack 'vector))~%")
      (format #t "       (rot (new 'stack 'matrix)))~%")
      (format #t "  (set! (-> pos x) ~12F)~%" (-> *math-camera* trans x))
      (format #t "  (set! (-> pos y) ~12F)~%" (-> *math-camera* trans y))
      (format #t "  (set! (-> pos z) ~12F)~%" (-> *math-camera* trans z))
      (format #t "  (set! (-> pos w) 1.0)~%")
      (format #t "  (set! (-> rot data  0) ~12F)~%" (-> *math-camera* inv-camera-rot rvec x))
      (format #t "  (set! (-> rot data  1) ~12F)~%" (-> *math-camera* inv-camera-rot rvec y))
      (format #t "  (set! (-> rot data  2) ~12F)~%" (-> *math-camera* inv-camera-rot rvec z))
      (format #t "  (set! (-> rot data  3) ~12F)~%" (-> *math-camera* inv-camera-rot rvec w))
      (format #t "  (set! (-> rot data  4) ~12F)~%" (-> *math-camera* inv-camera-rot uvec x))
      (format #t "  (set! (-> rot data  5) ~12F)~%" (-> *math-camera* inv-camera-rot uvec y))
      (format #t "  (set! (-> rot data  6) ~12F)~%" (-> *math-camera* inv-camera-rot uvec z))
      (format #t "  (set! (-> rot data  7) ~12F)~%" (-> *math-camera* inv-camera-rot uvec w))
      (format #t "  (set! (-> rot data  8) ~12F)~%" (-> *math-camera* inv-camera-rot fvec x))
      (format #t "  (set! (-> rot data  9) ~12F)~%" (-> *math-camera* inv-camera-rot fvec y))
      (format #t "  (set! (-> rot data 10) ~12F)~%" (-> *math-camera* inv-camera-rot fvec z))
      (format #t "  (set! (-> rot data 11) ~12F)~%" (-> *math-camera* inv-camera-rot fvec w))
      (format #t "  (set! (-> rot data 12) ~12F)~%" 0)
      (format #t "  (set! (-> rot data 13) ~12F)~%" 0)
      (format #t "  (set! (-> rot data 14) ~12F)~%" 0)
      (format #t "  (set! (-> rot data 15) ~12F)~%" #x3f800000)
      (let ((gp-0 (new 'stack-no-clear 'euler-angles)))
        (matrix->eul gp-0 (-> *math-camera* inv-camera-rot) 21)
        (format #t "  ;; euler angles (xyz order degrees) x ~R y ~R z ~R~%" (-> gp-0 x) (-> gp-0 y) (-> gp-0 z))
        (format
          #t
          "  ;; MAYA euler angles (xyz order degrees) x ~R y ~R z ~R~%"
          (-> gp-0 x)
          (- 32768.0 (-> gp-0 y))
          (-> gp-0 z)
          )
        )
      (format #t "  (debug-set-camera-pos-rot! pos rot)~%")
      (format #t "  (send-event *camera* 'set-fov (deg ~f))~%" (* 0.005493164 (-> *math-camera* fov)))
      (format #t "  (clear *camera-old-level*)~%")
      (format #t "  (format *camera-old-level* \"~A\")~%" (-> *level* level0 name))
      (let ((t9-31 format)
            (a0-31 #t)
            (a1-31 "  (set! *camera-old-cpu* ~D)~%")
            (a2-25 (-> *display* frames (-> *display* last-screen) profile-array data 0))
            )
        (t9-31 a0-31 a1-31 (- (-> a2-25 data 0 end-time) (-> a2-25 data 0 start-time)))
        )
      (let ((t9-32 format)
            (a0-32 #t)
            (a1-32 "  (set! *camera-old-vu*  ~D)~%")
            (a2-29 (-> *display* frames (-> *display* on-screen) profile-array data 1))
            )
        (t9-32 a0-32 a1-32 (- (-> a2-29 data 0 end-time) (-> a2-29 data 0 start-time)))
        )
      (compute-memory-usage! (the-as level (-> *level* level)) #f)
      (format #t "   (set! *camera-old-tfrag-bytes* ~D)~%" (+ (-> *level* level0 mem-usage-block data 1 total)
                                                              (-> *level* level0 mem-usage-block data 2 total)
                                                              (-> *level* level0 mem-usage-block data 3 total)
                                                              (-> *level* level0 mem-usage-block data 4 total)
                                                              (-> *level* level0 mem-usage-block data 5 total)
                                                              (-> *level* level0 mem-usage-block data 6 total)
                                                              (-> *level* level0 mem-usage-block data 7 total)
                                                              (-> *level* level0 mem-usage-block data 8 total)
                                                              )
              )
      (format #t "   (clear *camera-old-stat-string-tfrag*)~%")
      (format #t "   (clear *camera-old-stat-string-tfrag-near*)~%")
      (format #t "   (clear *camera-old-stat-string-total*)~%")
      (when *stats-poly*
        (format #t "   (format *camera-old-stat-string-tfrag*      \"~S\")~%" *stat-string-tfrag*)
        (format #t "   (format *camera-old-stat-string-tfrag-near* \"~S\")~%" *stat-string-tfrag-scissor*)
        (format #t "   (format *camera-old-stat-string-total*      \"~S\")~%" *stat-string-total*)
        )
      (format #t "   (set! *display-camera-old-stats* #t)~%")
      (format #t "  )~%")
      (format #t " )~%")
      )
    (else
      (format #t "camera save failed~%")
      )
    )
  (none)
  )

(defun debug-menu-make-camera-mode-menu ((arg0 debug-menu) (arg1 debug-menu))
  (new 'debug 'debug-menu-item-submenu "Camera" arg0)
  (let ((a1-3 (new 'debug 'debug-menu-item-submenu "Mode" arg1)))
    (debug-menu-append-item arg0 a1-3)
    )
  (let ((a1-5 (new 'debug 'debug-menu-item-flag "Default" #f dm-cam-mode-default)))
    (debug-menu-append-item arg1 a1-5)
    )
  (let ((a1-7 (new 'debug 'debug-menu-item-flag "Free-floating" cam-free-floating dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-7)
    )
  (let ((a1-9 (new 'debug 'debug-menu-item-flag "Fixed" cam-fixed dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-9)
    )
  (let ((a1-11 (new 'debug 'debug-menu-item-flag "No Trans" cam-no-trans dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-11)
    )
  (let ((a1-13 (new 'debug 'debug-menu-item-flag "Pov" cam-pov dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-13)
    )
  (let ((a1-15 (new 'debug 'debug-menu-item-flag "Pov180" cam-pov180 dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-15)
    )
  (let ((a1-17 (new 'debug 'debug-menu-item-flag "Pov-track" cam-pov-track dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-17)
    )
  (let ((a1-19 (new 'debug 'debug-menu-item-flag "Decel" cam-decel dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-19)
    )
  (let ((a1-21 (new 'debug 'debug-menu-item-flag "Endless fall" cam-endlessfall dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-21)
    )
  (let ((a1-23 (new 'debug 'debug-menu-item-flag "Eye" cam-eye dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-23)
    )
  (let ((a1-25 (new 'debug 'debug-menu-item-flag "Stick" cam-stick dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-25)
    )
  (let ((a1-27 (new 'debug 'debug-menu-item-flag "String" cam-string dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-27)
    )
  (let ((a1-29 (new 'debug 'debug-menu-item-flag "Standoff" cam-standoff dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-29)
    )
  (let ((a1-31 (new 'debug 'debug-menu-item-flag "Circular" cam-circular dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-31)
    )
  (let ((a1-33 (new 'debug 'debug-menu-item-flag "Look At" cam-lookat dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-33)
    )
  (let ((a1-35 (new 'debug 'debug-menu-item-flag "Center of world" cam-point-watch dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-35)
    )
  (let ((a1-37 (new 'debug 'debug-menu-item-flag "Spline" cam-spline dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-37)
    )
  (let ((a1-39 (new 'debug 'debug-menu-item-flag "Tube Sled" cam-tube-sled dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-39)
    )
  (let ((a1-41 (new 'debug 'debug-menu-item-flag "Bike" cam-bike dm-cam-mode-func)))
    (debug-menu-append-item arg1 a1-41)
    )
  )

(defun debug-menu-make-camera-menu ((arg0 debug-menu-context))
  (let* ((gp-0 (new 'debug 'debug-menu arg0 "Camera menu"))
         (s5-0 (new 'debug 'debug-menu-item-submenu "Camera" gp-0))
         )
    (let ((a1-3 (new 'debug 'debug-menu arg0 "Camera mode menu")))
      (debug-menu-make-camera-mode-menu gp-0 a1-3)
      )
    (let ((s3-0 (new 'debug 'debug-menu arg0 "Camera externalize menu")))
      (let ((a1-6 (new 'debug 'debug-menu-item-submenu "External" s3-0)))
        (debug-menu-append-item gp-0 a1-6)
        )
      (let ((a1-8 (new 'debug 'debug-menu-item-flag "CPad 0" 'pad-0 dm-cam-externalize)))
        (debug-menu-append-item s3-0 a1-8)
        )
      (let ((a1-10 (new 'debug 'debug-menu-item-flag "CPad 1" 'pad-1 dm-cam-externalize)))
        (debug-menu-append-item s3-0 a1-10)
        )
      (let ((a1-12 (new 'debug 'debug-menu-item-flag "Lock" 'locked dm-cam-externalize)))
        (debug-menu-append-item s3-0 a1-12)
        )
      (let ((a1-14 (new 'debug 'debug-menu-item-flag "Reset" 'reset dm-cam-externalize)))
        (debug-menu-append-item s3-0 a1-14)
        )
      (let ((a1-16 (new 'debug 'debug-menu-item-flag "Allow z rot" 'allow-z dm-cam-externalize)))
        (debug-menu-append-item s3-0 a1-16)
        )
      (let ((s2-0 (new 'debug 'debug-menu-item-var "Fov" 0 80)))
        (debug-menu-item-var-make-float s2-0 dm-cam-render-float 1.0 #t 15.0 180.0 1)
        (debug-menu-append-item s3-0 s2-0)
        )
      (let ((a1-21 (new 'debug 'debug-menu-item-flag "turbo free" '*camera-turbo-free* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s3-0 a1-21)
        )
      )
    (let ((s3-1 (new 'debug 'debug-menu arg0 "Camera collision menu")))
      (let ((a1-24 (new 'debug 'debug-menu-item-submenu "Collision" s3-1)))
        (debug-menu-append-item gp-0 a1-24)
        )
      (let ((a1-26 (new 'debug 'debug-menu-item-flag "Record" '*record-cam-collide-history* dm-boolean-toggle-pick-func))
            )
        (debug-menu-append-item s3-1 a1-26)
        )
      (let ((a1-28
              (new 'debug 'debug-menu-item-flag "Display" '*display-cam-collide-history* dm-boolean-toggle-pick-func)
              )
            )
        (debug-menu-append-item s3-1 a1-28)
        )
      )
    (let ((s4-1 (new 'debug 'debug-menu arg0 "Camera settings menu")))
      (let ((a1-31 (new 'debug 'debug-menu-item-submenu "Settings" s4-1)))
        (debug-menu-append-item gp-0 a1-31)
        )
      (let ((a1-33 (new 'debug 'debug-menu-item-flag "Default" #f dm-cam-settings-default)))
        (debug-menu-append-item s4-1 a1-33)
        )
      (let ((a1-35 (new 'debug 'debug-menu-item-flag "turbo free" '*camera-turbo-free* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-35)
        )
      (let ((s3-2 (new 'debug 'debug-menu-item-var "Fov" (the-as int 'fov) 80)))
        (debug-menu-item-var-make-float
          s3-2
          (the-as (function int debug-menu-msg float float float) dm-cam-setting-float)
          1.0
          #t
          15.0
          180.0
          1
          )
        (debug-menu-append-item s4-1 s3-2)
        )
      (let ((a1-40 (new 'debug 'debug-menu-item-flag "Butt cam" 0 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-40)
        )
      (let ((a1-42 (new 'debug 'debug-menu-item-flag "Same side" 1 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-42)
        )
      (let ((a1-44 (new 'debug 'debug-menu-item-flag "Move spherical" 2 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-44)
        )
      (let ((a1-46 (new 'debug 'debug-menu-item-flag "Drag" 3 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-46)
        )
      (let ((a1-48 (new 'debug 'debug-menu-item-flag "Allow Z rot" 4 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-48)
        )
      (let ((a1-50 (new 'debug 'debug-menu-item-flag "Pitch for jump" 6 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-50)
        )
      (let ((a1-52 (new 'debug 'debug-menu-item-flag "Find hidden target" 7 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-52)
        )
      (let ((a1-54 (new 'debug 'debug-menu-item-flag "Collide" 8 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-54)
        )
      (let ((a1-56 (new 'debug 'debug-menu-item-flag "Line of Sight" 9 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-56)
        )
      (let ((a1-58 (new 'debug 'debug-menu-item-flag "No Rotate" 10 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-58)
        )
      (let ((a1-60 (new 'debug 'debug-menu-item-flag "Sticky Angle" 11 dm-cam-settings-func)))
        (debug-menu-append-item s4-1 a1-60)
        )
      (let ((s3-3 (new 'debug 'debug-menu-item-var "Interp Frms" 40 80)))
        (debug-menu-item-var-make-int s3-3 dm-cam-settings-func-int 1 #f 0 0 #f)
        (debug-menu-append-item s4-1 s3-3)
        )
      (let ((a1-65 (new
                     'debug
                     'debug-menu-item-flag
                     "no mip/lod correction"
                     '*camera-no-mip-correction*
                     dm-boolean-toggle-pick-func
                     )
                   )
            )
        (debug-menu-append-item s4-1 a1-65)
        )
      (let ((a1-67
              (new 'debug 'debug-menu-item-flag "last attacker" '*display-camera-last-attacker* dm-boolean-toggle-pick-func)
              )
            )
        (debug-menu-append-item s4-1 a1-67)
        )
      (let ((a1-69 (new 'debug 'debug-menu-item-flag "old stats" '*display-camera-old-stats* dm-boolean-toggle-pick-func))
            )
        (debug-menu-append-item s4-1 a1-69)
        )
      (let ((a1-71 (new 'debug 'debug-menu-item-flag "Amy cam" '*amy-cam* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-71)
        )
      (let ((a1-73 (new 'debug 'debug-menu-item-flag "xyz axes" '*display-xyz-axes* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-73)
        )
      (let ((a1-75
              (new 'debug 'debug-menu-item-flag "Master Marks" '*display-cam-master-marks* dm-boolean-toggle-pick-func)
              )
            )
        (debug-menu-append-item s4-1 a1-75)
        )
      (let ((a1-77 (new 'debug 'debug-menu-item-flag "Other Marks" '*display-cam-other* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-77)
        )
      (let ((a1-79 (new 'debug 'debug-menu-item-flag "los debug" '*display-cam-los-debug* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-79)
        )
      (let ((a1-81 (new 'debug 'debug-menu-item-flag "los info" '*display-cam-los-info* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-81)
        )
      (let ((a1-83 (new 'debug 'debug-menu-item-flag "los Marks" '*display-cam-los-marks* dm-boolean-toggle-pick-func)))
        (debug-menu-append-item s4-1 a1-83)
        )
      (let ((a1-85 (new 'debug 'debug-menu-item-flag "coll Marks" '*display-cam-coll-marks* dm-boolean-toggle-pick-func))
            )
        (debug-menu-append-item s4-1 a1-85)
        )
      (let ((a1-87 (new 'debug 'debug-menu-item-flag "Camera Marks" '*display-camera-marks* dm-boolean-toggle-pick-func))
            )
        (debug-menu-append-item s4-1 a1-87)
        )
      )
    (let ((a1-89 (new 'debug 'debug-menu-item-flag "Edit" '*cam-layout* (lambda ((arg0 symbol) (arg1 debug-menu-msg))
                                                                          (when (= arg1 (debug-menu-msg press))
                                                                            (if (-> arg0 value)
                                                                                (cam-layout-stop)
                                                                                (cam-layout-start)
                                                                                )
                                                                            )
                                                                          (-> arg0 value)
                                                                          )
                      )
                 )
          )
      (debug-menu-append-item gp-0 a1-89)
      )
    (let ((a1-91 (new
                   'debug
                   'debug-menu-item-function
                   "Save Pos"
                   #f
                   (the-as (function object object) debug-create-cam-restore)
                   )
                 )
          )
      (debug-menu-append-item gp-0 a1-91)
      )
    s5-0
    )
  )

(defun debug-menu-make-shader-menu ((arg0 debug-menu-context))
  (let* ((gp-0 (new 'debug 'debug-menu arg0 "Shader menu"))
         (s5-0 (new 'debug 'debug-menu-item-submenu "Shader" gp-0))
         )
    (let ((a3-3 (new 'debug 'debug-menu arg0 "Shader pick menu")))
      (set! *shader-pick-menu* a3-3)
      (let ((a1-4 (new 'debug 'debug-menu-item-submenu "Pick Shader" a3-3)))
        (debug-menu-append-item gp-0 a1-4)
        )
      )
    (let ((a1-6 (new 'debug 'debug-menu-item-function "Refresh" #f (the-as (function object object) build-shader-list)))
          )
      (debug-menu-append-item gp-0 a1-6)
      )
    (let ((s4-1 (new 'debug 'debug-menu-item-var "tweak" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-float
        s4-1
        (the-as
          (function int debug-menu-msg float float float)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((s4-0 (the-as texture-id (-> arg0 value)))
                       (gp-0 (lookup-texture-by-id s4-0))
                       (v1-3 (-> *texture-page-dir* entries (-> s4-0 page) link))
                       )
                  (cond
                    ((and gp-0 v1-3)
                     (when (= arg1 (debug-menu-msg press))
                       (set! (-> gp-0 uv-dist) arg2)
                       (let ((s5-1 (the-as object (* (-> v1-3 next (-> s4-0 index) shader) 16))))
                         (while (nonzero? (the-as uint s5-1))
                           (adgif-shader-update! (the-as adgif-shader s5-1) gp-0)
                           (set! s5-1 (* (-> (the-as adgif-shader s5-1) next shader) 16))
                           )
                         )
                       )
                     (-> gp-0 uv-dist)
                     )
                    (else
                      (empty)
                      arg3
                      )
                    )
                  )
                )
              (else
                (empty)
                arg3
                )
              )
            )
          )
        0.1
        #t
        0.1
        30.0
        1
        )
      (debug-menu-append-item gp-0 s4-1)
      )
    (let ((a1-11 (new
                   'debug
                   'debug-menu-item-function
                   "all tweak+"
                   #f
                   (the-as (function object object) (lambda () (all-texture-tweak-adjust *texture-page-dir* 0.1)))
                   )
                 )
          )
      (debug-menu-append-item gp-0 a1-11)
      )
    (let ((a1-13 (new
                   'debug
                   'debug-menu-item-function
                   "all tweak-"
                   #f
                   (the-as (function object object) (lambda () (all-texture-tweak-adjust *texture-page-dir* -0.1)))
                   )
                 )
          )
      (debug-menu-append-item gp-0 a1-13)
      )
    (let ((s4-2 (new 'debug 'debug-menu-item-var "l" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-2
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 l) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex1 l)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        3
        #f
        )
      (debug-menu-append-item gp-0 s4-2)
      )
    (let ((s4-3 (new 'debug 'debug-menu-item-var "k" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-3
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        ;; og:preserve-this
                        (let ((a1-8 (the-as object (* (the-as int (-> a0-3 next (-> v1-1 index) shader)) 16))))
                          (while (nonzero? (the-as int a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 k) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (sar (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex1))) 20) 52)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        -2048
        2047
        #f
        )
      (debug-menu-append-item gp-0 s4-3)
      )
    (let ((s4-4 (new 'debug 'debug-menu-item-var "mmin" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-4
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 mmin) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex1 mmin)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        5
        #t
        )
      (debug-menu-append-item gp-0 s4-4)
      )
    (let ((s4-5 (new 'debug 'debug-menu-item-var "mmag" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-5
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 mmag) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex1 mmag)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        1
        #t
        )
      (debug-menu-append-item gp-0 s4-5)
      )
    (let ((s4-6 (new 'debug 'debug-menu-item-var "lcm" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-6
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 lcm) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex1 lcm)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        1
        #t
        )
      (debug-menu-append-item gp-0 s4-6)
      )
    (let ((s4-7 (new 'debug 'debug-menu-item-var "tfx" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-7
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        ;; og:preserve-this
                        (let ((a1-8 (the-as object (* (the-as int (-> a0-3 next (-> v1-1 index) shader)) 16))))
                          (while (nonzero? (the-as int a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex0 tfx) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex0))) 27) 62)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        3
        #t
        )
      (debug-menu-append-item gp-0 s4-7)
      )
    (let ((s4-8 (new 'debug 'debug-menu-item-var "tbp" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-8
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex0 tbp0) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex0 tbp0)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        #x4000
        #t
        )
      (debug-menu-append-item gp-0 s4-8)
      )
    (let ((s4-9 (new 'debug 'debug-menu-item-var "tbw" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-9
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex0 tbw) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex0 tbw)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        15
        #t
        )
      (debug-menu-append-item gp-0 s4-9)
      )
    (let ((s4-10 (new 'debug 'debug-menu-item-var "tw" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-10
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex0 tw) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex0 tw)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        10
        #t
        )
      (debug-menu-append-item gp-0 s4-10)
      )
    (let ((s4-11 (new 'debug 'debug-menu-item-var "th" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-11
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        ;; og:preserve-this
                        (let ((a1-8 (the-as object (* (the-as int (-> a0-3 next (-> v1-1 index) shader)) 16))))
                          (while (nonzero? (the-as int a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex0 th) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex0))) 30) 60)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        10
        #t
        )
      (debug-menu-append-item gp-0 s4-11)
      )
    (let ((s4-12 (new 'debug 'debug-menu-item-var "mxl" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-12
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) tex1 mxl) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) tex1 mxl)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        6
        #t
        )
      (debug-menu-append-item gp-0 s4-12)
      )
    (let ((s4-13 (new 'debug 'debug-menu-item-var "wms" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-13
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp wms) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) clamp wms)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        3
        #t
        )
      (debug-menu-append-item gp-0 s4-13)
      )
    (let ((s4-14 (new 'debug 'debug-menu-item-var "wmt" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-14
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp wmt) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) clamp wmt)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        3
        #t
        )
      (debug-menu-append-item gp-0 s4-14)
      )
    (let ((s4-15 (new 'debug 'debug-menu-item-var "minu" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-15
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp minu) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) clamp minu)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        511
        #t
        )
      (debug-menu-append-item gp-0 s4-15)
      )
    (let ((s4-16 (new 'debug 'debug-menu-item-var "maxu" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-16
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                          (while (nonzero? (the-as uint a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp maxu) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (-> (the-as adgif-shader v1-8) clamp maxu)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        511
        #t
        )
      (debug-menu-append-item gp-0 s4-16)
      )
    (let ((s4-17 (new 'debug 'debug-menu-item-var "minv" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-17
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        ;; og:preserve-this
                        (let ((a1-8 (the-as object (* (the-as int (-> a0-3 next (-> v1-1 index) shader)) 16))))
                          (while (nonzero? (the-as int a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp minv) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) clamp))) 30) 54)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        511
        #t
        )
      (debug-menu-append-item gp-0 s4-17)
      )
    (let ((s4-18 (new 'debug 'debug-menu-item-var "maxv" (the-as int '*edit-shader*) 80)))
      (debug-menu-item-var-make-int
        s4-18
        (the-as
          (function int debug-menu-msg int int int)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (cond
              (*texture-page-dir*
                (let* ((v1-1 (the-as texture-id (-> arg0 value)))
                       (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link))
                       )
                  (cond
                    (a0-3
                      (when (= arg1 (debug-menu-msg press))
                        ;; og:preserve-this
                        (let ((a1-8 (the-as object (* (the-as int (-> a0-3 next (-> v1-1 index) shader)) 16))))
                          (while (nonzero? (the-as int a1-8))
                            (set! (-> (the-as adgif-shader a1-8) clamp maxv) (the-as int arg2))
                            (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16))
                            )
                          )
                        )
                      (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16))))
                        (if (nonzero? (the-as uint v1-8))
                            (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) clamp))) 20) 54)
                            arg3
                            )
                        )
                      )
                    (else
                      arg3
                      )
                    )
                  )
                )
              (else
                arg3
                )
              )
            )
          )
        1
        #t
        0
        511
        #t
        )
      (debug-menu-append-item gp-0 s4-18)
      )
    s5-0
    )
  )

(defun debug-menu-make-instance-menu ((arg0 debug-menu-context))
  (let* ((gp-0 (new 'debug 'debug-menu arg0 "Instance menu"))
         (s5-0 (new 'debug 'debug-menu-item-submenu "Instance" gp-0))
         )
    (let ((a3-3 (new 'debug 'debug-menu arg0 "Instance shrub menu")))
      (set! *instance-shrub-menu* a3-3)
      (let ((a1-4 (new 'debug 'debug-menu-item-submenu "Pick Shrub" a3-3)))
        (debug-menu-append-item gp-0 a1-4)
        )
      )
    (let ((a3-5 (new 'debug 'debug-menu arg0 "Instance tie menu")))
      (set! *instance-tie-menu* a3-5)
      (let ((a1-7 (new 'debug 'debug-menu-item-submenu "Pick Tie" a3-5)))
        (debug-menu-append-item gp-0 a1-7)
        )
      )
    (let ((a1-9 (new 'debug 'debug-menu-item-function "Refresh" #f build-instance-list)))
      (debug-menu-append-item gp-0 a1-9)
      )
    (let ((a1-11
            (new 'debug 'debug-menu-item-function "Print Info" #f (the-as (function object object) print-prototype-list))
            )
          )
      (debug-menu-append-item gp-0 a1-11)
      )
    (let ((s3-0 (new 'debug 'debug-menu-item-var "near" (the-as int '*edit-instance*) 80)))
      (debug-menu-item-var-make-float
        s3-0
        (the-as
          (function int debug-menu-msg float float float)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (let ((f30-0 arg3))
              (dotimes (s3-0 (-> *level* length))
                (let ((a1-1 (-> *level* level s3-0)))
                  (when (= (-> a1-1 status) 'active)
                    (let ((s2-0 (find-instance-by-name-level (the-as string (-> arg0 value)) a1-1)))
                      (when s2-0
                        (when (= arg1 (debug-menu-msg press))
                          (set! (-> s2-0 dists x) (* 4096.0 arg2))
                          (prototype-bucket-recalc-fields s2-0)
                          )
                        (set! f30-0 (/ (-> s2-0 dists x) METER_LENGTH))
                        )
                      )
                    )
                  )
                )
              f30-0
              )
            )
          )
        1.0
        #t
        10.0
        250.0
        1
        )
      (debug-menu-append-item gp-0 s3-0)
      )
    (let ((s3-1 (new 'debug 'debug-menu-item-var "far" (the-as int '*edit-instance*) 80)))
      (debug-menu-item-var-make-float
        s3-1
        (the-as
          (function int debug-menu-msg float float float)
          (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float))
            (let ((f30-0 arg3))
              (dotimes (s3-0 (-> *level* length))
                (let ((a1-1 (-> *level* level s3-0)))
                  (when (= (-> a1-1 status) 'active)
                    (let ((s2-0 (find-instance-by-name-level (the-as string (-> arg0 value)) a1-1)))
                      (when s2-0
                        (when (= arg1 (debug-menu-msg press))
                          (set! (-> s2-0 dists w) (* 4096.0 arg2))
                          (prototype-bucket-recalc-fields s2-0)
                          )
                        (set! f30-0 (/ (-> s2-0 dists w) METER_LENGTH))
                        )
                      )
                    )
                  )
                )
              f30-0
              )
            )
          )
        1.0
        #t
        10.0
        250.0
        1
        )
      (debug-menu-append-item gp-0 s3-1)
      )
    (let ((s3-2 (new 'debug 'debug-menu-item-var "tie vanish near" (the-as int '*edit-instance*) 80)))
      (debug-menu-item-var-make-float
        s3-2
        (the-as (function int debug-menu-msg float float float) dm-float-field-tie-rvanish-func)
        1.0
        #t
        10.0
        250.0
        1
        )
      (debug-menu-append-item gp-0 s3-2)
      )
    (let ((s3-3 (new 'debug 'debug-menu-item-var "tie vanish far" (the-as int '*edit-instance*) 80)))
      (debug-menu-item-var-make-float
        s3-3
        (the-as (function int debug-menu-msg float float float) dm-float-field-tie-vanish-far-func)
        1.0
        #t
        10.0
        250.0
        1
        )
      (debug-menu-append-item gp-0 s3-3)
      )
    (let ((a1-25 (new 'debug 'debug-menu-item-flag "invisible" 1 dm-edit-instance-toggle-pick-func)))
      (debug-menu-append-item gp-0 a1-25)
      )
    (let ((a3-18 (new 'debug 'debug-menu arg0 "Enable Instance Shrub Menu")))
      (set! *enable-instance-shrub-menu* a3-18)
      (let ((a1-28 (new 'debug 'debug-menu-item-submenu "Enable Shrub" a3-18)))
        (debug-menu-append-item gp-0 a1-28)
        )
      )
    (let ((a3-20 (new 'debug 'debug-menu arg0 "Enable Instance Tie Menu")))
      (set! *enable-instance-tie-menu* a3-20)
      (let ((a1-31 (new 'debug 'debug-menu-item-submenu "Enable Tie" a3-20)))
        (debug-menu-append-item gp-0 a1-31)
        )
      )
    (let ((a1-33
            (new 'debug 'debug-menu-item-flag "Instance Info" '*display-instance-info* dm-boolean-toggle-pick-func)
            )
          )
      (debug-menu-append-item gp-0 a1-33)
      )
    s5-0
    )
  )

(defun dm-task-menu-pick-func ((arg0 game-task) (arg1 debug-menu-msg))
  (let ((gp-0 (/ (the-as int arg0) 8)))
    (when (= arg1 (debug-menu-msg press))
      (if (cpad-hold? 0 l1)
          (task-node-open! (the-as game-task-node gp-0) 'menu)
          (task-node-close! (the-as game-task-node gp-0) 'menu)
          )
      )
    (if (and (not (task-node-closed? (the-as game-task-node gp-0)))
             (not (task-node-open? (the-as game-task-node gp-0)))
             )
        (return 'invalid)
        )
    (task-node-closed? (the-as game-task-node gp-0))
    )
  )

(defun debug-menu-make-continue-sub-menu ((arg0 game-info) (arg1 symbol))
  (local-vars
    (sv-16 (function symbol type object object pair))
    (sv-32 symbol)
    (sv-48 type)
    (sv-64 symbol)
    (sv-80 (function symbol type object object pair))
    (sv-96 symbol)
    (sv-112 type)
    (sv-128 string)
    (sv-144 (function symbol type object object pair))
    (sv-160 symbol)
    (sv-176 type)
    (sv-192 string)
    (sv-208 symbol)
    (sv-224 type)
    )
  (let ((s4-0 *level-load-list*)
        (s5-0 '())
        )
    (while (not (null? s4-0))
      (let ((v1-1 (-> (the-as symbol (car s4-0)) value)))
        (when (or (= arg1 'test) (= (-> (the-as level-load-info v1-1) taskname) arg1))
          (let ((s3-0 (-> (the-as level-load-info v1-1) continues)))
            (while (not (null? s3-0))
              (let ((v1-2 (car s3-0))
                    (a0-5 arg1)
                    )
                (when (if (= a0-5 'test)
                          (logtest? (continue-flags test) (-> (the-as continue-point v1-2) flags))
                          #t
                          )
                  (let ((s2-0 (method-of-type pair new))
                        (s1-0 'global)
                        (s0-0 pair)
                        )
                    (set! sv-16 (method-of-type pair new))
                    (set! sv-32 'global)
                    (set! sv-48 pair)
                    (set! sv-64 'flag)
                    (set! sv-80 (method-of-type pair new))
                    (set! sv-96 'global)
                    (set! sv-112 pair)
                    (set! sv-128 (-> (the-as continue-point v1-2) name))
                    (set! sv-144 (method-of-type pair new))
                    (set! sv-160 'global)
                    (set! sv-176 pair)
                    (set! sv-192 (-> (the-as continue-point v1-2) name))
                    (let* ((a3-1 (cons 'dm-current-continue '()))
                           (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1))
                           (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2))
                           )
                      (set! s5-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) s5-0))
                      )
                    )
                  )
                )
              (set! s3-0 (cdr s3-0))
              )
            )
          )
        )
      (set! s4-0 (cdr s4-0))
      )
    (let ((s4-1 s5-0)
          (s5-1 '())
          )
      (let ((a2-6 (car s4-1)))
        (while (not (null? s4-1))
          (set! s5-1 (cons a2-6 s5-1))
          (set! s4-1 (cdr s4-1))
          (set! a2-6 (car s4-1))
          )
        )
      (let ((s4-2 (method-of-type pair new))
            (s3-1 'global)
            (s2-1 pair)
            (s1-1 'menu)
            (s0-1 (method-of-type pair new))
            )
        (set! sv-208 'global)
        (set! sv-224 pair)
        (let ((a2-7 (symbol->string-debug arg1))
              (a3-6 s5-1)
              )
          (s4-2 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-7 a3-6))
          )
        )
      )
    )
  )

(defun debug-menu-make-task-sub-menu ((arg0 symbol))
  (local-vars
    (sv-16 (function symbol type object object pair))
    (sv-32 symbol)
    (sv-48 type)
    (sv-64 symbol)
    (sv-80 (function symbol type object object pair))
    (sv-96 symbol)
    (sv-112 type)
    (sv-128 string)
    (sv-144 (function symbol type object object pair))
    (sv-160 symbol)
    (sv-176 type)
    (sv-192 int)
    (sv-208 symbol)
    (sv-224 type)
    )
  (let ((gp-0 '()))
    (let ((s4-0 (-> *game-info* sub-task-list)))
      (countdown (s3-0 (-> s4-0 length))
        (when (nonzero? s3-0)
          (let ((v1-4 (-> s4-0 s3-0)))
            (when (= (-> v1-4 level) arg0)
              (let ((s2-0 (method-of-type pair new))
                    (s1-0 'global)
                    (s0-0 pair)
                    )
                (set! sv-16 (method-of-type pair new))
                (set! sv-32 'global)
                (set! sv-48 pair)
                (set! sv-64 'flag)
                (set! sv-80 (method-of-type pair new))
                (set! sv-96 'global)
                (set! sv-112 pair)
                (set! sv-128 (-> v1-4 name))
                (set! sv-144 (method-of-type pair new))
                (set! sv-160 'global)
                (set! sv-176 pair)
                (set! sv-192 (* s3-0 8))
                (let* ((a3-1 (cons 'dm-task-menu-pick-func '()))
                       (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1))
                       (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2))
                       )
                  (set! gp-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) gp-0))
                  )
                )
              )
            )
          )
        )
      )
    (let ((s4-1 (method-of-type pair new))
          (s3-1 'global)
          (s2-1 pair)
          (s1-1 'menu)
          (s0-1 (method-of-type pair new))
          )
      (set! sv-208 'global)
      (set! sv-224 pair)
      (let ((a2-5 (symbol->string-debug arg0))
            (a3-5 gp-0)
            )
        (s4-1 s3-1 s2-1 s1-1 (s0-1 sv-208 sv-224 a2-5 a3-5))
        )
      )
    )
  )

(defun debug-menu-make-task-menu ((arg0 debug-menu-context))
  (local-vars (sv-16 debug-menu-context))
  (let* ((s5-0 (new 'debug 'debug-menu arg0 "Task menu"))
         (s4-0 (new 'debug 'debug-menu-item-submenu "Task" s5-0))
         )
    (let* ((s3-0 '(city
                    comb
                    desert
                    factory
                    forest
                    mine
                    nest
                    palace
                    sewer
                    wascity
                    arena
                    temple
                    tower
                    volcano
                    precursor
                    default
                    test
                    )
                 )
           (a0-3 (car s3-0))
           )
      (while (not (null? s3-0))
        (let ((s2-0 debug-menu-append-item)
              (s1-0 s5-0)
              (s0-0 debug-menu-make-from-template)
              )
          (set! sv-16 arg0)
          (let ((a1-2 (debug-menu-make-task-sub-menu (the-as symbol a0-3))))
            (s2-0 s1-0 (s0-0 sv-16 a1-2))
            )
          )
        (set! s3-0 (cdr s3-0))
        (set! a0-3 (car s3-0))
        )
      )
    s4-0
    )
  )

;; WARN: Return type mismatch int vs object.
(defun dm-play-task-with-continue ((arg0 game-task) (arg1 string))
  (let* ((t9-0 play-task)
         (a1-1 'debug)
         (a2-0 (cond
                 ((cpad-hold? 0 l1)
                  'pre-play
                  )
                 ((cpad-hold? 0 r1)
                  'kiosk
                  )
                 )
               )
         (a1-2 (t9-0 arg0 a1-1 a2-0))
         )
    (if arg1
        (set! a1-2 arg1)
        )
    (start 'play (get-continue-by-name *game-info* a1-2))
    )
  (set-master-mode 'game)
  0
  )

(defun dm-play-task ((arg0 game-task))
  (dm-play-task-with-continue (the-as game-task (/ (the-as int arg0) 8)) (the-as string #f))
  )

(defun dm-play-race ((arg0 race-selection) (arg1 symbol))
  (let ((s5-0 (the-as string #f))
        (gp-0 0)
        )
    (case arg0
      (((race-selection desertb-race-record))
       (set! gp-0 15)
       (set! s5-0 "desertb-race-record")
       )
      (((race-selection rs1))
       (set! gp-0 131)
       (set! s5-0 "desertb-race-record")
       )
      (((race-selection desrally-record))
       (set! gp-0 132)
       (set! s5-0 "desrally-record")
       )
      )
    (if (not arg1)
        (set! s5-0 (the-as string #f))
        )
    (format #t "dm-play-race starting task ~d continue ~s~%" gp-0 s5-0)
    (if (nonzero? gp-0)
        (dm-play-task-with-continue (the-as game-task gp-0) s5-0)
        )
    )
  )

(defun debug-menu-make-play-menu ((arg0 debug-menu-context))
  (local-vars
    (sv-16 type)
    (sv-32 (function symbol type object object pair))
    (sv-48 symbol)
    (sv-64 type)
    (sv-80 symbol)
    (sv-96 (function symbol type object object pair))
    (sv-112 symbol)
    (sv-128 type)
    (sv-144 string)
    (sv-160 (function symbol type object object pair))
    (sv-176 symbol)
    (sv-192 type)
    (sv-208 symbol)
    (sv-224 type)
    (sv-240 (function symbol type object object pair))
    (sv-256 symbol)
    (sv-272 type)
    (sv-288 symbol)
    (sv-304 (function symbol type object object pair))
    (sv-320 symbol)
    (sv-336 type)
    (sv-352 (function symbol type object object pair))
    (sv-368 symbol)
    (sv-384 type)
    (sv-400 int)
    (sv-416 type)
    (sv-432 symbol)
    (sv-448 (function symbol type object object pair))
    (sv-464 symbol)
    (sv-480 type)
    (sv-496 string)
    (sv-512 (function symbol type object object pair))
    (sv-528 symbol)
    (sv-544 type)
    (sv-560 symbol)
    )
  (let ((s5-0 '()))
    (let ((s2-0 #x200000))
      (countdown (s4-0 (-> *game-info* play-list length))
        (let ((s3-0 (-> *game-info* play-list s4-0)))
          (when (-> s3-0 play-continue)
            (let ((s1-0
                    (logand (game-task-node-flag act1 act2 act3 bbush) (-> *game-info* sub-task-list (-> s3-0 play-node) flags))
                    )
                  )
              (when (!= s1-0 s2-0)
                (let ((s2-1 (method-of-type pair new))
                      (s0-0 'global)
                      )
                  (set! sv-16 pair)
                  (set! sv-32 (method-of-type pair new))
                  (set! sv-48 'global)
                  (set! sv-64 pair)
                  (set! sv-80 'function)
                  (set! sv-96 (method-of-type pair new))
                  (set! sv-112 'global)
                  (set! sv-128 pair)
                  (cond
                    ((logtest? (game-task-node-flag act3) s1-0)
                     (set! sv-144 "=== Burning Bush ===")
                     )
                    ((logtest? (game-task-node-flag act2) s1-0)
                     (set! sv-144 "====== ACT 3 ======")
                     )
                    ((logtest? (game-task-node-flag act1) s1-0)
                     (set! sv-144 "====== ACT 2 ======")
                     )
                    (else
                      (set! sv-144 "======= END =======")
                      )
                    )
                  (set! sv-160 (method-of-type pair new))
                  (set! sv-176 'global)
                  (set! sv-192 pair)
                  (set! sv-208 (the-as symbol #f))
                  (let* ((a3-1 (cons 'nothing '()))
                         (a3-2 (sv-160 sv-176 sv-192 sv-208 a3-1))
                         (a3-3 (sv-96 sv-112 sv-128 sv-144 a3-2))
                         (a2-4 (sv-32 sv-48 sv-64 sv-80 a3-3))
                         )
                    (set! s5-0 (s2-1 s0-0 sv-16 a2-4 s5-0))
                    )
                  )
                (set! s2-0 (the-as int s1-0))
                )
              )
            (let ((s1-1 (method-of-type pair new))
                  (s0-1 'global)
                  )
              (set! sv-224 pair)
              (set! sv-240 (method-of-type pair new))
              (set! sv-256 'global)
              (set! sv-272 pair)
              (set! sv-288 'function)
              (set! sv-304 (method-of-type pair new))
              (set! sv-320 'global)
              (set! sv-336 pair)
              (let ((s3-1 (-> s3-0 name)))
                (set! sv-352 (method-of-type pair new))
                (set! sv-368 'global)
                (set! sv-384 pair)
                (set! sv-400 (* s4-0 8))
                (let* ((a3-6 (cons 'dm-play-task '()))
                       (a3-7 (sv-352 sv-368 sv-384 sv-400 a3-6))
                       (a3-8 (sv-304 sv-320 sv-336 s3-1 a3-7))
                       (a2-9 (sv-240 sv-256 sv-272 sv-288 a3-8))
                       (a3-9 s5-0)
                       )
                  (set! s5-0 (s1-1 s0-1 sv-224 a2-9 a3-9))
                  )
                )
              )
            )
          )
        )
      )
    (let ((s4-1 (method-of-type pair new))
          (s3-2 'global)
          (s2-2 pair)
          (s1-2 (method-of-type pair new))
          (s0-2 'global)
          )
      (set! sv-416 pair)
      (set! sv-432 'function)
      (set! sv-448 (method-of-type pair new))
      (set! sv-464 'global)
      (set! sv-480 pair)
      (set! sv-496 "====== ACT 1 ======")
      (set! sv-512 (method-of-type pair new))
      (set! sv-528 'global)
      (set! sv-544 pair)
      (set! sv-560 (the-as symbol #f))
      (let* ((a3-11 (cons 'nothing '()))
             (a3-12 (sv-512 sv-528 sv-544 sv-560 a3-11))
             (a3-13 (sv-448 sv-464 sv-480 sv-496 a3-12))
             (a3-15 (s4-1 s3-2 s2-2 (s1-2 s0-2 sv-416 sv-432 a3-13) s5-0))
             )
        (debug-menu-make-from-template arg0 (cons 'menu (cons "Play" a3-15)))
        )
      )
    )
  )

(defun dm-anim-tester-flag-func ((arg0 int) (arg1 debug-menu-msg))
  (when *anim-tester*
    (case arg0
      (('at-apply-align)
       (if (= arg1 (debug-menu-msg press))
           (logxor! (-> *anim-tester* 0 flags) (anim-tester-flags fanimt5))
           )
       (return (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt5)))
       )
      (('at-show-joint-info)
       (if (= arg1 (debug-menu-msg press))
           (logxor! (-> *anim-tester* 0 flags) (anim-tester-flags fanimt4))
           )
       (return (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt4)))
       )
      )
    )
  #f
  )

(defun dm-anim-tester-func ((arg0 int) (arg1 debug-menu-msg))
  (local-vars (v0-1 symbol))
  (if (not *anim-tester*)
      (anim-tester-start)
      )
  (when *anim-tester*
    (cond
      ((= arg0 'at-pick-object)
       (send-event (ppointer->process *anim-tester*) 'pick-object)
       (set! v0-1 #t)
       (set! (-> *debug-menu-context* is-hidden) v0-1)
       v0-1
       )
      ((= arg0 'at-pick-joint-anim)
       (send-event (ppointer->process *anim-tester*) 'pick-joint-anim)
       (set! v0-1 #t)
       (set! (-> *debug-menu-context* is-hidden) v0-1)
       v0-1
       )
      )
    )
  )

(defun dm-pilot-mode ((arg0 object))
  (if (not *target*)
      (start 'debug (get-current-continue-forced *game-info*))
      )
  (send-event *target* 'change-mode 'pilot #f arg0 #t)
  )

(defun dm-game-opengoal-cheat-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg))
  (if (= arg1 (debug-menu-msg press))
      (logxor! (-> *pc-settings* cheats) (the-as uint (/ arg0 8)))
      )
  (logtest? (-> *pc-settings* cheats) (/ arg0 8))
  )

(defun stop-watch-display ((arg0 object) (arg1 object))
  (let ((v1-3 (- (-> *display* base-clock frame-counter) (-> *game-info* stop-watch-start))))
    (format arg1 "Stop watch ~D:~D:~D~%" (/ v1-3 #x4650) (/ (mod v1-3 #x4650) 300) (/ (* 100 (mod v1-3 300)) 300))
    )
  #f
  )

(defun debug-menu-context-make-default-menus ((arg0 debug-menu-context))
  (local-vars (sv-16 debug-menu-context))
  (let ((s5-0 (new 'debug 'debug-menu arg0 "Main menu")))
    (debug-menu-context-set-root-menu arg0 s5-0)
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Artist"
           (flag "Poly Stats" *stats-poly* dm-boolean-toggle-pick-func)
           (menu
             "Memory Stats"
             (flag "Enable" *stats-memory* dm-boolean-toggle-pick-func)
             (flag "Short" *stats-memory-short* dm-boolean-toggle-pick-func)
             (flag "Level 0" 0 dm-stats-memory-func)
             (flag "Level 1" 1 dm-stats-memory-func)
             (flag "Level 2" 2 dm-stats-memory-func)
             (flag "Level 3" 3 dm-stats-memory-func)
             (flag "Level 4" 4 dm-stats-memory-func)
             (flag "Level 5" 5 dm-stats-memory-func)
             (flag "Level 6" 6 dm-stats-memory-func)
             (flag "Level 7" 7 dm-stats-memory-func)
             (flag "Level 8" 8 dm-stats-memory-func)
             (flag "Level 9" 9 dm-stats-memory-func)
             )
           (flag "All Visible" *artist-all-visible* dm-boolean-toggle-pick-func)
           (flag "Flip Visible" *artist-flip-visible* dm-boolean-toggle-pick-func)
           (flag "Fix Visible" *artist-fix-visible* dm-boolean-toggle-pick-func)
           (flag "Fix Frustum" *artist-fix-frustum* dm-boolean-toggle-pick-func)
           (flag "Manual Sample Point" *manual-sample-point* dm-boolean-toggle-pick-func)
           (flag "Error Spheres" *artist-error-spheres* dm-boolean-toggle-pick-func)
           (flag "Use menu subdiv" *artist-use-menu-subdiv* dm-boolean-toggle-pick-func)
           (float-var "Subdiv Close" close dm-subdiv-float 10 1 #t 1 1000 1)
           (float-var "Subdiv Far" far dm-subdiv-float 10 1 #t 1 1000 1)
           (function
             "Target Start"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (start 'debug (get-current-continue-forced *game-info*))
                )
             )
           (function "Target Stop" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (stop 'debug)))
           ;; (menu
           ;;   "Anim Tester"
           ;;   (int-var "Speed" anim-speed dm-subdiv-int 10 10 #t -300 1000)
           ;;   (flag "Apply Align" at-apply-align dm-anim-tester-flag-func)
           ;;   (flag "Show Joint Inf" at-show-joint-info dm-anim-tester-flag-func)
           ;;   (function "Pick Object" at-pick-object dm-anim-tester-func)
           ;;   (function "Pick Joint Anim" at-pick-joint-anim dm-anim-tester-func)
           ;;   (function "Pick Sequence" at-pick-sequence dm-anim-tester-func)
           ;;   (function "Save Sequences" at-save-sequences dm-anim-tester-func)
           ;;   )
           (flag "Show Entity Errors" *display-entity-errors* dm-boolean-toggle-pick-func)
           (flag "Capture Mode" *display-capture-mode* dm-boolean-toggle-pick-func)
           (flag "Sprite Info" *display-sprite-info* dm-boolean-toggle-pick-func)
           (flag "Sprite Marks" *display-sprite-marks* dm-boolean-toggle-pick-func)
           (flag "Sprite Spheres" *display-sprite-spheres* dm-boolean-toggle-pick-func)
           (flag "Time of Day" #f dm-time-of-day-pick-func)
           (flag "Preload Anims" *preload-spool-anims* dm-boolean-toggle-pick-func)
           (function
             "Mike F"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (debug-actor "drill-crane-14")
                (send-event *debug-actor* 'die)
                )
             )
           (function
             "Editor"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (kill-by-type editable-player *active-pool*)
                (process-spawn editable-player :init editable-player-init #f :name "editable-player" :to *entity-pool*)
                (set-master-mode 'game)
                )
             )
           (flag
             "Screen shot highres enable"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (if (= arg1 (debug-menu-msg press))
                    (set! (-> *screen-shot-work* highres-enable) (not (-> *screen-shot-work* highres-enable)))
                    )
                (-> *screen-shot-work* highres-enable)
                )
             )
           (flag
             "Screen shot hud enable"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (if (= arg1 (debug-menu-msg press))
                    (set! (-> *screen-shot-work* hud-enable) (not (-> *screen-shot-work* hud-enable)))
                    )
                (-> *screen-shot-work* hud-enable)
                )
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Game"
           (function
             "New Game"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f))
                )
             )
           (function
             "New Life"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (initialize! *game-info* 'dead (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f))
                )
             )
           (function
             "Kill Target"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (set! (-> *game-info* mode) 'play)
                (send-event
                  *target*
                  'attack
                  #f
                  (static-attack-info
                    :mask (vehicle-impulse-factor)
                    ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'death))
                    )
                  )
                )
             )
           (function
             "Hit Target"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (set! (-> *game-info* mode) 'play)
                (send-event
                  *target*
                  'attack
                  #f
                  (static-attack-info
                    :mask (vehicle-impulse-factor)
                    ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0))
                    )
                  )
                )
             )
           (function
             "Reset Game"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (set! (-> *game-info* mode) 'debug)
                (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f))
                )
             )
           (function "Reset Actors" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (reset-actors 'debug)))
           (function
             "Save Game"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (auto-save-command 'save 0 0 *default-pool* #f))
             )
           (function
             "Load Game"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (auto-save-command 'restore 0 0 *default-pool* #f))
             )
           (function
             "Manager Complete"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (script-eval '(send-event *task-manager* 'complete)))
             )
           (flag "Target" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                (when (= arg1 (debug-menu-msg press))
                                  (if *target*
                                      (stop 'debug)
                                      (start 'debug (get-current-continue-forced *game-info*))
                                      )
                                  )
                                *target*
                                )
                 )
           (flag "Game Mode" play dm-game-mode-pick-func)
           (flag "Debug Mode" debug dm-game-mode-pick-func)
           (function
             "Stop Watch Start"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (remove-by-param0 *debug-engine* stop-watch-display)
                (add-connection *debug-engine* *dproc* stop-watch-display *dproc* *stdcon0* #f)
                (set! (-> *game-info* stop-watch-start) (-> *display* base-clock frame-counter))
                (set! (-> *game-info* stop-watch-stop) 0)
                (format #t "Stop watch started!~%")
                )
             )
           (function
             "Stop Watch Stop"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (remove-by-param0 *debug-engine* stop-watch-display)
                (set! (-> *game-info* stop-watch-stop) (-> *display* base-clock frame-counter))
                (let ((v1-7 (- (-> *game-info* stop-watch-stop) (-> *game-info* stop-watch-start))))
                  (format
                    #t
                    "Stop watch elasped time was ~D:~D:~D~%"
                    (/ v1-7 #x4650)
                    (/ (mod v1-7 #x4650) 300)
                    (/ (* 100 (mod v1-7 300)) 300)
                    )
                  )
                )
             )
           (function
             "Continue Start"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (start 'play (-> *game-info* current-continue)))
             )
           (function
             "Kiosk Reset"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (auto-save-command 'restore 0 0 *default-pool* #f))
             )
           (menu
             "Secrets"
             (flag "hero-mode" 0 dm-game-secret-toggle-pick-func)
             (flag "toggle-beard" 14 dm-game-secret-toggle-pick-func)
             (flag "hflip-screen" 15 dm-game-secret-toggle-pick-func)
             (flag "endless-ammo" 16 dm-game-secret-toggle-pick-func)
             (flag "invulnerable" 17 dm-game-secret-toggle-pick-func)
             (flag "endless-dark" 18 dm-game-secret-toggle-pick-func)
             (flag "endless-light" 19 dm-game-secret-toggle-pick-func)
             (flag "scene-player-1" 1 dm-game-secret-toggle-pick-func)
             (flag "scene-player-2" 2 dm-game-secret-toggle-pick-func)
             (flag "scene-player-3" 3 dm-game-secret-toggle-pick-func)
             (flag "level-select-1" 5 dm-game-secret-toggle-pick-func)
             (flag "level-select-2" 6 dm-game-secret-toggle-pick-func)
             (flag "level-select-3" 7 dm-game-secret-toggle-pick-func)
             (flag "scrap-book-1" 8 dm-game-secret-toggle-pick-func)
             (flag "scrap-book-2" 9 dm-game-secret-toggle-pick-func)
             (flag "scrap-book-3" 10 dm-game-secret-toggle-pick-func)
             (flag "gungame-blue" 20 dm-game-secret-toggle-pick-func)
             (flag "gungame-dark" 21 dm-game-secret-toggle-pick-func)
             (flag "gungame-ratchet" 22 dm-game-secret-toggle-pick-func)
             (flag "big-head" 23 dm-game-secret-toggle-pick-func)
             (flag "little-head" 24 dm-game-secret-toggle-pick-func)
             (flag "fast-movie" 25 dm-game-secret-toggle-pick-func)
             (flag "slow-movie" 26 dm-game-secret-toggle-pick-func)
             (flag "unlimited-turbos" 27 dm-game-secret-toggle-pick-func)
             (flag "vehicle-hit-points" 28 dm-game-secret-toggle-pick-func)
             (flag "board-fast" 29 dm-game-secret-toggle-pick-func)
             (flag "vehicle-fox" 30 dm-game-secret-toggle-pick-func)
             (flag "vehicle-mirage" 31 dm-game-secret-toggle-pick-func)
             (flag "vehicle-x-ride" 32 dm-game-secret-toggle-pick-func)
             (flag "model-viewer-1" 11 dm-game-secret-toggle-pick-func)
             (flag "model-viewer-2" 12 dm-game-secret-toggle-pick-func)
             (flag "model-viewer-3" 13 dm-game-secret-toggle-pick-func)
             (flag "kleever-diaper" 33 dm-game-secret-toggle-pick-func)
             (flag "bad-weather" 34 dm-game-secret-toggle-pick-func)
             (flag "fast-weather" 35 dm-game-secret-toggle-pick-func)
             (flag "daxter-pants" 36 dm-game-secret-toggle-pick-func)
             (flag "darkjak-tracking" 37 dm-game-secret-toggle-pick-func)
             (flag "commentary" 4 dm-game-secret-toggle-pick-func)
             (flag "jak-is-jak2" 38 dm-game-secret-toggle-pick-func)
             (flag "button-invis" 40 dm-game-secret-toggle-pick-func)
             (flag "statistics" 39 dm-game-secret-toggle-pick-func)
             (flag "gun-dark-4" 41 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-red-1" 42 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-red-2" 43 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-red-3" 44 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-yellow-1" 45 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-yellow-2" 46 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-yellow-3" 47 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-blue-1" 48 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-blue-2" 49 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-blue-3" 50 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-dark-1" 51 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-dark-2" 52 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-dark-3" 53 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-ammo-red" 54 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-ammo-yellow" 55 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-ammo-blue" 56 dm-game-secret-toggle-pick-func)
             (flag "gun-upgrade-ammo-dark" 57 dm-game-secret-toggle-pick-func)
             )
           ;; og:preserve-this new menu
           (menu
             "OpenGOAL Cheats"
             (flag "turbo-board" 1 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "health-bars" 2 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "vehicle-health-bars" 4 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "vehicle-invuln" 8 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "statistics" 16 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "suck-in-all" 32 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "music-player" 64 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "no-textures" 128 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "fast-speed" 256 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "slow-speed" 512 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "fast-travel" 1024 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "orb-tracker" 2048 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "real-time-of-day" 4096 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "city-peace" 8192 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "board-tricks" 16384 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "weather-bad" 32768 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "weather-good" 65536 dm-game-opengoal-cheat-toggle-pick-func)
             (flag "desert-peace" 131072 dm-game-opengoal-cheat-toggle-pick-func)
             )
           (function "Print Load State" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                              (dotimes (gp-0 11)
                                                (let ((s5-0 (-> *level* level gp-0)))
                                                  (if (!= (-> s5-0 status) 'inactive)
                                                      (format
                                                        #t
                                                        "~Tlevel ~2D ~16S ~16S bits #b~18,'0B ~A~%"
                                                        gp-0
                                                        (-> s5-0 name)
                                                        (if (nonzero? (-> s5-0 info))
                                                            (level-memory-mode->string (-> s5-0 info memory-mode))
                                                            )
                                                        (-> s5-0 memory-mask)
                                                        (-> s5-0 status)
                                                        )
                                                      )
                                                  )
                                                )
                                              #t
                                              )
                     )
           (menu "Continue")
           (menu
             "Settings"
             (float-var
               "sfx-volume"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default sfx-volume) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default sfx-volume)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.01)
               #t
               0
               1
               0
               )
             (float-var
               "ambient-volume"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default ambient-volume) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default ambient-volume)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.01)
               #t
               0
               1
               0
               )
             (float-var
               "music-volume"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default music-volume) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default music-volume)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.01)
               #t
               0
               1
               0
               )
             (float-var
               "dialog-volume"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default dialog-volume) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default dialog-volume)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.01)
               #t
               0
               1
               0
               )
             (float-var
               "contrast"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default contrast) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default contrast)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.00390625)
               #t
               (new 'static 'bfloat :data 0.25)
               (new 'static 'bfloat :data 1.0)
               0
               )
             (float-var
               "brightness"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *setting-control* (nonzero? *setting-control*))
                         (set! (-> *setting-control* user-default brightness) arg2)
                         )
                     )
                    ((or (not *setting-control*) (zero? *setting-control*))
                     0
                     )
                    (else
                      (-> *setting-control* user-default brightness)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.00390625)
               #t
               (new 'static 'bfloat :data 0.25)
               (new 'static 'bfloat :data 1.0)
               0
               )
             (function
               "reset contrast and brightness"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (set! (-> *setting-control* user-default contrast) 0.5)
                  (set! (-> *setting-control* user-default brightness) 0.5)
                  )
               )
             (menu
               "Language"
               (flag "english" 0 dm-setting-language)
               (flag "french" 1 dm-setting-language)
               (flag "german" 2 dm-setting-language)
               (flag "spanish" 3 dm-setting-language)
               (flag "italian" 4 dm-setting-language)
               (flag "korean" 7 dm-setting-language)
               (flag "russian" 8 dm-setting-language)
               (flag "portuguese" 9 dm-setting-language)
               (flag "uk-english" 11 dm-setting-language)
               (flag "finnish" 12 dm-setting-language)
               )
             (menu
               "Audio Language"
               (flag "english" 0 dm-setting-audio-language)
               (flag "french" 1 dm-setting-audio-language)
               (flag "german" 2 dm-setting-audio-language)
               (flag "spanish" 3 dm-setting-audio-language)
               (flag "italian" 4 dm-setting-audio-language)
               (flag "commentary" 5 dm-setting-audio-language)
               )
             (menu
               "Subtitle Language"
               (flag "english" 0 dm-setting-subtitle-language)
               (flag "french" 1 dm-setting-subtitle-language)
               (flag "german" 2 dm-setting-subtitle-language)
               (flag "spanish" 3 dm-setting-subtitle-language)
               (flag "italian" 4 dm-setting-subtitle-language)
               ;; og:preserve-this added
               (flag "commentary" 5 dm-setting-subtitle-language)
               (flag "korean" 7 dm-setting-subtitle-language)
               (flag "russian" 8 dm-setting-subtitle-language)
               (flag "portuguese" 9 dm-setting-subtitle-language)
               (flag "uk-english" 11 dm-setting-subtitle-language)
               (flag "finnish" 12 dm-setting-subtitle-language)
               )
             (flag
               "play-hints "
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *setting-control* user-default play-hints) (not (-> *setting-control* user-default play-hints)))
                      )
                  (-> *setting-control* user-default play-hints)
                  )
               )
             (flag
               "subtitle "
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle)))
                      )
                  (-> *setting-control* user-default subtitle)
                  )
               )
             (flag
               "vibration"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *setting-control* user-default vibration) (not (-> *setting-control* user-default vibration)))
                      )
                  (-> *setting-control* user-default vibration)
                  )
               )
             (menu
               "Stereo Mode"
               (flag "mono" 0 dm-setting-stereo-mode)
               (flag "stereo" 1 dm-setting-stereo-mode)
               (flag "surround" 2 dm-setting-stereo-mode)
               )
             (flag
               "camera-stick-dir"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *setting-control* user-default camera-stick-dir)
                            (not (-> *setting-control* user-default camera-stick-dir))
                            )
                      )
                  (-> *setting-control* user-default camera-stick-dir)
                  )
               )
             (flag
               "progressive-scan"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *setting-control* user-default set-video-mode)
                            (not (-> *setting-control* user-default set-video-mode))
                            )
                      )
                  (-> *setting-control* user-default set-video-mode)
                  )
               )
             (flag
               "border-mode"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                  (when (= arg1 (debug-menu-msg press))
                    (set! (-> *setting-control* user-default border-mode) (not (-> *setting-control* user-default border-mode)))
                    (set! (-> *level* play?) (-> *setting-control* user-default border-mode))
                    )
                  (-> *setting-control* user-default border-mode)
                  )
               )
             )
           (menu
             "Features"
             (flag "armor0" 52 dm-game-feature-toggle-pick-func)
             (flag "armor1" 53 dm-game-feature-toggle-pick-func)
             (flag "armor2" 54 dm-game-feature-toggle-pick-func)
             (flag "armor3" 55 dm-game-feature-toggle-pick-func)
             (flag "artifact-invis" 51 dm-game-feature-toggle-pick-func)
             (flag "board" 18 dm-game-feature-toggle-pick-func)
             (flag "board-training" 36 dm-game-feature-toggle-pick-func)
             (flag "board-launch" 37 dm-game-feature-toggle-pick-func)
             (flag "board-zap" 39 dm-game-feature-toggle-pick-func)
             (flag "board-trail" 38 dm-game-feature-toggle-pick-func)
             (flag "carry" 19 dm-game-feature-toggle-pick-func)
             (flag "sidekick" 20 dm-game-feature-toggle-pick-func)
             (flag "darkeco" 58 dm-game-feature-toggle-pick-func)
             (flag "darkjak" 40 dm-game-feature-toggle-pick-func)
             (flag "darkjak-smack" 41 dm-game-feature-toggle-pick-func)
             (flag "darkjak-bomb0" 42 dm-game-feature-toggle-pick-func)
             (flag "darkjak-bomb1" 43 dm-game-feature-toggle-pick-func)
             (flag "darkjak-tracking" 44 dm-game-feature-toggle-pick-func)
             (flag "darkjak-invinc" 45 dm-game-feature-toggle-pick-func)
             (flag "lighteco" 57 dm-game-feature-toggle-pick-func)
             (flag "lightjak" 46 dm-game-feature-toggle-pick-func)
             (flag "lightjak-regen" 47 dm-game-feature-toggle-pick-func)
             (flag "lightjak-swoop" 48 dm-game-feature-toggle-pick-func)
             (flag "lightjak-freeze" 49 dm-game-feature-toggle-pick-func)
             (flag "lightjak-shield" 50 dm-game-feature-toggle-pick-func)
             (flag "gun-yellow-1" 9 dm-game-feature-toggle-pick-func)
             (flag "gun-yellow-2" 10 dm-game-feature-toggle-pick-func)
             (flag "gun-yellow-3" 11 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-yellow-ammo-1" 23 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-yellow-ammo-2" 24 dm-game-feature-toggle-pick-func)
             (flag "gun-red-1" 6 dm-game-feature-toggle-pick-func)
             (flag "gun-red-2" 7 dm-game-feature-toggle-pick-func)
             (flag "gun-red-3" 8 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-red-ammo-1" 25 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-red-ammo-2" 26 dm-game-feature-toggle-pick-func)
             (flag "gun-blue-1" 12 dm-game-feature-toggle-pick-func)
             (flag "gun-blue-2" 13 dm-game-feature-toggle-pick-func)
             (flag "gun-blue-3" 14 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-blue-ammo-1" 27 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-blue-ammo-2" 28 dm-game-feature-toggle-pick-func)
             (flag "gun-dark-1" 15 dm-game-feature-toggle-pick-func)
             (flag "gun-dark-2" 16 dm-game-feature-toggle-pick-func)
             (flag "gun-dark-3" 17 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-dark-ammo-1" 29 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-dark-ammo-2" 30 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-speed" 21 dm-game-feature-toggle-pick-func)
             (flag "gun-upgrade-damage" 22 dm-game-feature-toggle-pick-func)
             (flag "pass-port-mh" 31 dm-game-feature-toggle-pick-func)
             (flag "pass-port-inda" 32 dm-game-feature-toggle-pick-func)
             (flag "pass-inda-indb" 33 dm-game-feature-toggle-pick-func)
             (flag "pass-indb-sluma" 34 dm-game-feature-toggle-pick-func)
             (flag "pass-slumb-genb" 35 dm-game-feature-toggle-pick-func)
             (flag "turtle" 0 dm-game-vehicle-toggle-pick-func)
             (flag "snake" 1 dm-game-vehicle-toggle-pick-func)
             (flag "scorpion" 2 dm-game-vehicle-toggle-pick-func)
             (flag "toad" 3 dm-game-vehicle-toggle-pick-func)
             (flag "fox" 4 dm-game-vehicle-toggle-pick-func)
             (flag "rhino" 5 dm-game-vehicle-toggle-pick-func)
             (flag "mirage" 6 dm-game-vehicle-toggle-pick-func)
             (flag "x-ride" 7 dm-game-vehicle-toggle-pick-func)
             )
           )
        )
      )
    (let* ((s4-2 (debug-menu-find-from-template arg0 '("Game" "Continue")))
           (s3-2
             '(city
                comb
                desert
                factory
                forest
                mine
                nest
                palace
                sewer
                wascity
                arena
                temple
                tower
                volcano
                precursor
                default
                test
                )
             )
           (a1-7 (car s3-2))
           )
      (while (not (null? s3-2))
        (let ((s2-0 debug-menu-append-item)
              (s1-0 s4-2)
              (s0-0 debug-menu-make-from-template)
              )
          (set! sv-16 arg0)
          (let ((a1-8 (debug-menu-make-continue-sub-menu *game-info* (the-as symbol a1-7))))
            (s2-0 s1-0 (s0-0 sv-16 a1-8))
            )
          )
        (set! s3-2 (cdr s3-2))
        (set! a1-7 (car s3-2))
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Stats"
           (flag "Poly" *stats-poly* dm-boolean-toggle-pick-func)
           (flag "Collide" *stats-collide* dm-boolean-toggle-pick-func)
           (flag "Bsp" *stats-bsp* dm-boolean-toggle-pick-func)
           (flag "Buffer" *stats-buffer* dm-boolean-toggle-pick-func)
           (flag "Target" *stats-target* dm-boolean-toggle-pick-func)
           (flag "Blerc" *stats-blerc* dm-boolean-toggle-pick-func)
           (flag "Profile bars" *stats-profile-bars* dm-boolean-toggle-pick-func)
           (flag "Perf" *stats-perf* dm-boolean-toggle-pick-func)
           (menu
             "Memory Stats"
             (flag "Enable" *stats-memory* dm-boolean-toggle-pick-func)
             (flag "Short" *stats-memory-short* dm-boolean-toggle-pick-func)
             (flag "Level 0" 0 dm-stats-memory-func)
             (flag "Level 1" 1 dm-stats-memory-func)
             (flag "Level 2" 2 dm-stats-memory-func)
             (flag "Level 3" 3 dm-stats-memory-func)
             (flag "Level 4" 4 dm-stats-memory-func)
             (flag "Level 5" 5 dm-stats-memory-func)
             (flag "Level 6" 6 dm-stats-memory-func)
             (flag "Level 7" 7 dm-stats-memory-func)
             (flag "Level 8" 8 dm-stats-memory-func)
             (flag "Level 9" 9 dm-stats-memory-func)
             )
           (function
             "Print Entity Memory"
             #f
             ,(lambda ()
                (format #t "~%~%========================= Entity Memory =========================~%~%")
                (let ((gp-0 (-> *level* level)))
                  (inspect (-> gp-0 0 art-group))
                  (dotimes (s5-0 (-> gp-0 0 art-group art-group-array length))
                    (inspect (-> gp-0 0 art-group art-group-array s5-0))
                    )
                  )
                #f
                )
             )
           (function
             "Print Texture Info"
             #f
             ,(lambda ()
                (format #t "~%~%========================= Texture Info =========================~%~%")
                (inspect *texture-page-dir*)
                )
             )
           (function
             "Print Texture Verbose"
             #f
             ,(lambda ()
                (format #t "~%~%========================= Texture Info =========================~%~%")
                (texture-page-dir-inspect *texture-page-dir* #t)
                )
             )
           (function
             "Print Merc Stats"
             #f
             ,(lambda ()
                (format #t "~%~%========================== Merc Stats ==========================~%~%")
                (merc-stats)
                )
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Render"
           (menu
             "Background"
             (flag "Textured" 0 dm-subdiv-draw-func)
             (flag "Outline" 1 dm-subdiv-draw-func)
             (flag "Gouraud" 2 dm-subdiv-draw-func)
             (flag "Hack" 3 dm-subdiv-draw-func)
             )
           (menu
             "Background Scissor"
             (flag "Textured" 0 dm-scissor-subdiv-draw-func)
             (flag "Outline" 1 dm-scissor-subdiv-draw-func)
             (flag "Gouraud" 2 dm-scissor-subdiv-draw-func)
             (flag "Hack" 3 dm-scissor-subdiv-draw-func)
             )
           (menu
             "Foreground"
             (flag "Textured" 0 dm-foreground-subdiv-draw-func)
             (flag "Outline" 1 dm-foreground-subdiv-draw-func)
             (flag "Gouraud" 2 dm-foreground-subdiv-draw-func)
             (flag "Hack" 3 dm-foreground-subdiv-draw-func)
             )
           (menu
             "Ocean"
             (flag "Textured" 0 dm-ocean-subdiv-draw-func)
             (flag "Outline" 1 dm-ocean-subdiv-draw-func)
             (flag "Gouraud" 2 dm-ocean-subdiv-draw-func)
             (flag "Hack" 3 dm-ocean-subdiv-draw-func)
             )
           (flag "SKY TEXTURES" 32 dm-texture-user-toggle-pick-func)
           (flag "sky" 3 dm-vu1-user-toggle-pick-func)
           (flag "ocean" 4 dm-vu1-user-toggle-pick-func)
           (flag "ocean-wave" 5 dm-vu1-user-toggle-pick-func)
           (flag "HFRAG TIE TEXTURES" 64 dm-texture-user-toggle-pick-func)
           (flag "hfrag" 6 dm-vu1-user-toggle-pick-func)
           (flag "hfrag-scissor" 7 dm-vu1-user-toggle-pick-func)
           (flag "TFRAG TIE TEXTURES" #x1 dm-texture-user-toggle-pick-func)
           (flag "tfrag" 8 dm-vu1-user-toggle-pick-func)
           (flag "tie" 10 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap" 11 dm-vu1-user-toggle-pick-func)
           (flag "tie-scissor" 9 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap-scissor" 12 dm-vu1-user-toggle-pick-func)
           (flag "tie-vanish" 13 dm-vu1-user-toggle-pick-func)
           (flag "SHRUB TEXTURES" #x4 dm-texture-user-toggle-pick-func)
           (flag "shrub-near" 18 dm-vu1-user-toggle-pick-func)
           (flag "shrubbery" 17 dm-vu1-user-toggle-pick-func)
           (flag "shrubbery-vanish" 20 dm-vu1-user-toggle-pick-func)
           (flag "billboard" 19 dm-vu1-user-toggle-pick-func)
           (flag "ALPHA TEXTURES" 1 dm-texture-user-toggle-pick-func)
           (flag "tfrag-trans" 21 dm-vu1-user-toggle-pick-func)
           (flag "tie-trans" 23 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap-trans" 24 dm-vu1-user-toggle-pick-func)
           (flag "tie-scissor-trans" 22 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap-scissor-trans" 25 dm-vu1-user-toggle-pick-func)
           (flag "PRIS TEXTURES" #x2 dm-texture-user-toggle-pick-func)
           (flag "merc" 15 dm-vu1-user-toggle-pick-func)
           (flag "emerc" 16 dm-vu1-user-toggle-pick-func)
           (flag "generic" 14 dm-vu1-user-toggle-pick-func)
           (flag "WATER TEXTURES" 2 dm-texture-user-toggle-pick-func)
           (flag "tfrag-water" 26 dm-vu1-user-toggle-pick-func)
           (flag "tie-water" 28 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap-water" 29 dm-vu1-user-toggle-pick-func)
           (flag "tie-scissor-water" 27 dm-vu1-user-toggle-pick-func)
           (flag "tie-envmap-scissor-water" 30 dm-vu1-user-toggle-pick-func)
           (flag "SPRITE TEXTURES" 8 dm-texture-user-toggle-pick-func)
           (flag "sprite" 31 dm-vu1-user-toggle-pick-func)
           (flag "shadow" 32 dm-vu1-user-toggle-pick-func)
           (flag "shadow-debug" *shadow-debug* dm-boolean-toggle-pick-func)
           (flag "depth-cue" 36 dm-vu1-user-toggle-pick-func)
           (flag "WARP TEXTURES" 4 dm-texture-user-toggle-pick-func)
           (flag "HUD TEXTURES" 16 dm-texture-user-toggle-pick-func)
           (flag "all on" #f dm-vu1-user-all-pick-func)
           (flag "all off" #f dm-vu1-user-none-pick-func)
           (flag "all textures on" #x3ff dm-texture-user-set-pick-func)
           (flag "all textures off" 0 dm-texture-user-set-pick-func)
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Collision"
           (menu
             "Collision Renderer"
             (flag "On" 0 dm-col-rend-on-func)
             (flag "Track Player" 0 dm-col-rend-track-func)
             (flag "Track Camera" 1 dm-col-rend-track-func)
             (float-var "  Dist" #f dm-col-rend-cam-dist 10 1 #t 0 80 1)
             (flag "Fixed Pos" 2 dm-col-rend-track-func)
             (float-var "Size" #f dm-col-rend-size 10 1 #t 1 20 1)
             (flag "Outline" 0 dm-col-rend-outline-func)
             (flag "Show Back-faces" 0 dm-col-rend-back-face-func)
             (flag "Show Normals" 0 dm-col-rend-normals-func)
             (flag "Ghost Hidden" 0 dm-col-rend-ghost-hidden-func)
             (menu
               "Show Only"
               (flag "(board)" 1 dm-col-rend-show-only-set-func)
               (flag "(grind)" 2 dm-col-rend-show-only-set-func)
               (flag "(grindonly)" 4 dm-col-rend-show-only-set-func)
               (flag "melt" 16384 dm-col-rend-show-only-toggle-func)
               (flag "noboard" 8 dm-col-rend-show-only-toggle-func)
               (flag "nocamera" 16 dm-col-rend-show-only-toggle-func)
               (flag "noedge" 32 dm-col-rend-show-only-toggle-func)
               (flag "noendlessfall" 64 dm-col-rend-show-only-toggle-func)
               (flag "noentity" 128 dm-col-rend-show-only-toggle-func)
               (flag "nogrind" 256 dm-col-rend-show-only-toggle-func)
               (flag "nojak" 512 dm-col-rend-show-only-toggle-func)
               (flag "nolineofsight" 1024 dm-col-rend-show-only-toggle-func)
               (flag "nomech" 2048 dm-col-rend-show-only-toggle-func)
               (flag "nopilot" 4096 dm-col-rend-show-only-toggle-func)
               (flag "noproj" 8192 dm-col-rend-show-only-toggle-func)
               (flag "probe" 32768 dm-col-rend-show-only-toggle-func)
               (flag "Select All" 49144 dm-col-rend-show-only-set-func)
               (flag "Unselect All" 0 dm-col-rend-show-only-set-func)
               )
             (menu
               "Find"
               (flag "background" 1 dm-col-rend-cspec-toggle)
               (flag "obstacles" 2 dm-col-rend-cspec-toggle)
               (flag "pushers" 4 dm-col-rend-cspec-toggle)
               (flag "Jak" 8 dm-col-rend-cspec-toggle)
               (flag "other" 16 dm-col-rend-cspec-toggle)
               )
             )
           (flag "Collision Cache" *display-collide-cache* dm-boolean-toggle-pick-func)
           (flag "Collision Marks" *display-collision-marks* dm-boolean-toggle-pick-func)
           (flag "Ground Stats" *display-ground-stats* dm-boolean-toggle-pick-func)
           (flag "Hipri Collision Marks" *display-hipri-collision-marks* dm-boolean-toggle-pick-func)
           (flag "Edge Collision Marks" *display-edge-collision-marks* dm-boolean-toggle-pick-func)
           (flag "Collide Stats" *stats-collide* dm-boolean-toggle-pick-func)
           (flag "Render Collision" *display-render-collision* dm-boolean-toggle-pick-func)
           (flag "Collide List Boxes" *collide-list-boxes* dm-boolean-toggle-pick-func)
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Display"
           (flag "Profile" *display-profile* dm-boolean-toggle-pick-func)
           (flag "Ticks" *profile-ticks* dm-boolean-toggle-pick-func)
           (flag "File Info" *display-file-info* dm-boolean-toggle-pick-func)
           (flag "Level Spheres" *display-level-spheres* dm-boolean-toggle-pick-func)
           (flag "Camera Marks" *display-camera-marks* dm-boolean-toggle-pick-func)
           (flag "Camera Info" *display-camera-info* dm-boolean-toggle-pick-func)
           (flag "Geometry Marks" *display-geo-marks* dm-boolean-toggle-pick-func)
           (flag "Art Control" *display-art-control* dm-boolean-toggle-pick-func)
           (flag "Gui Control" *display-gui-control* dm-boolean-toggle-pick-func)
           (flag "Instance Info" *display-instance-info* dm-boolean-toggle-pick-func)
           (menu
             "strip lines"
             (flag "strippable" 1 dm-strip-lines-toggle-pick-func)
             (flag "convertible" 2 dm-strip-lines-toggle-pick-func)
             (flag "edgeable" 4 dm-strip-lines-toggle-pick-func)
             (flag "ordinary" 8 dm-strip-lines-toggle-pick-func)
             (flag "color mismatch" 16 dm-strip-lines-toggle-pick-func)
             (flag "shader mismatch" 32 dm-strip-lines-toggle-pick-func)
             (flag "uv mismatch" 64 dm-strip-lines-toggle-pick-func)
             (flag "too big" 128 dm-strip-lines-toggle-pick-func)
             (flag "good" 3 dm-strip-lines-set-pick-func)
             (flag "bad" 240 dm-strip-lines-set-pick-func)
             (flag "all edges" 255 dm-strip-lines-set-pick-func)
             (flag "strips" 256 dm-strip-lines-set-pick-func)
             (flag "frags" 512 dm-strip-lines-set-pick-func)
             (flag "none" 0 dm-strip-lines-set-pick-func)
             )
           (menu
             "collision mesh"
             (flag "wall" 1024 dm-strip-lines-toggle-pick-func)
             (flag "ground" 2048 dm-strip-lines-toggle-pick-func)
             (flag "all" 3072 dm-strip-lines-set-pick-func)
             (flag "none" 0 dm-strip-lines-set-pick-func)
             )
           (flag "Texture Distances" *display-texture-distances* dm-boolean-toggle-pick-func)
           (flag "Texture Download" *display-texture-download* dm-boolean-toggle-pick-func)
           (flag "Level Border" *display-level-border* dm-boolean-toggle-pick-func)
           (flag "Split Boxes" *display-split-boxes* dm-boolean-toggle-pick-func)
           (flag "Split Box Info" *display-split-box-info* dm-boolean-toggle-pick-func)
           (flag "Memcard Info" *display-memcard-info* dm-boolean-toggle-pick-func)
           (flag "Trail Graph" *display-trail-graph* dm-boolean-toggle-pick-func)
           (flag "Color Bars" *display-color-bars* dm-boolean-toggle-pick-func)
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Actor"
           (flag "Spawn Actors" *spawn-actors* dm-boolean-toggle-pick-func)
           (function "Reset Actors" #f ,(lambda () (reset-actors 'debug)))
           (function "Traffic Start" #f ,(lambda () (let ((gp-0 traffic-start))
                                                      (if (valid? gp-0 function "" #t 0)
                                                          (gp-0)
                                                          )
                                                      )
                                                 )
                     )
           (function "Traffic Kill" #f ,(lambda () (let ((gp-0 traffic-kill))
                                                     (if (valid? gp-0 function "" #t 0)
                                                         (gp-0)
                                                         )
                                                     )
                                                )
                     )
           (menu
             "Bot"
             (function
               "Bot Next"
               #f
               ,(lambda ()
                  (send-event (process-by-name "sig-atoll-1" *active-pool*) 'skip)
                  (send-event (process-by-name "hal-sewer-1" *active-pool*) 'skip)
                  (send-event (process-by-name "hal-escort-1" *active-pool*) 'skip)
                  (send-event (process-by-name "squid-2" *active-pool*) 'skip)
                  (send-event (process-by-name "metalkor-1" *active-pool*) 'skip)
                  (send-event (process-by-name "sig-under-1" *active-pool*) 'skip)
                  (send-event (process-by-name "scorpion-gun-manager-1" *active-pool*) 'skip)
                  (send-event (process-by-name "terraformer-1" *active-pool*) 'skip)
                  )
               )
             (menu
               "Bot Marks"
               (flag "course spots" 1 display-bot-marks-toggle-pick-func)
               (flag "task spots" 2 display-bot-marks-toggle-pick-func)
               (flag "all on" 3 display-bot-marks-set-pick-func)
               (flag "all off" 0 display-bot-marks-set-pick-func)
               )
             )
           (menu
             "Actor Compaction"
             (flag "off" #f dm-compact-actor-pick-func)
             (flag "on" #t dm-compact-actor-pick-func)
             (flag "debug" debug dm-compact-actor-pick-func)
             )
           (flag "Traffic height map" *display-traffic-height-map* dm-boolean-toggle-pick-func)
           (flag "View Anims" *debug-view-anims* dm-boolean-toggle-pick-func)
           (flag "Unkillable" *debug-unkillable* dm-boolean-toggle-pick-func)
           (flag "Jak Vehicle Unkillable" *debug-player-vehicle-unkillable* dm-boolean-toggle-pick-func)
           (flag "Regions" *execute-regions* dm-boolean-toggle-pick-func)
           (flag "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func)
           (flag "Actor Vis" *vis-actors* dm-boolean-toggle-pick-func)
           (float-var
             "Entity clock"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (cond
                  ((= arg1 (debug-menu-msg press))
                   (if (and *display* (nonzero? *display*))
                       (update-rates! (-> *display* entity-clock) arg2)
                       )
                   )
                  ((or (not *display*) (zero? *display*))
                   0
                   )
                  (else
                    (-> *display* entity-clock clock-ratio)
                    )
                  )
                )
             4
             (new 'static 'bfloat :data 0.01)
             #t
             (new 'static 'bfloat)
             (new 'static 'bfloat :data 1.0)
             (new 'static 'bfloat :data 0.0001)
             )
           (flag "Battle Marks" *display-battle-marks* dm-boolean-toggle-pick-func)
           (menu
             "Hover Marks"
             (flag "Nav Network" *display-nav-network* dm-boolean-toggle-pick-func)
             (flag "Debug Hover" *debug-hover* dm-boolean-toggle-pick-func)
             )
           (flag "Path Marks" *display-path-marks* dm-boolean-toggle-pick-func)
           (flag "Nav Marks" *display-nav-marks* dm-boolean-toggle-pick-func)
           (flag "Vol Marks" *display-vol-marks* dm-boolean-toggle-pick-func)
           (flag "Collision Marks" *display-collision-marks* dm-boolean-toggle-pick-func)
           (menu
             "Debug Actor"
             (float-var "lod0-dist" 0 dm-debug-actor-lod-dist 10 (new 'static 'bfloat :data 1.0) #f 0 0 1)
             (float-var "lod1-dist" 1 dm-debug-actor-lod-dist 10 (new 'static 'bfloat :data 1.0) #f 0 0 1)
             (float-var "lod2-dist" 2 dm-debug-actor-lod-dist 10 (new 'static 'bfloat :data 1.0) #f 0 0 1)
             (flag "Joint Axes" *display-joint-axes* dm-boolean-toggle-pick-func)
             )
           (menu
             "Actor Vis"
             (flag "off" #f dm-actor-vis-pick-func)
             (flag "box" box dm-actor-vis-pick-func)
             (flag "sphere" sphere dm-actor-vis-pick-func)
             (flag "all" #t dm-actor-vis-pick-func)
             )
           (menu
             "Actor Marks"
             (flag "off" #f dm-actor-marks-pick-func)
             (flag "alive entities" #t dm-actor-marks-pick-func)
             (flag "all entities" full dm-actor-marks-pick-func)
             (flag "processes" process dm-actor-marks-pick-func)
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Target"
           (menu
             "Mode"
             (function
               "normal"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (send-event *target* 'change-mode 'normal))
               )
             (function "racer" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                     (if (not *target*)
                                         (start 'debug (get-current-continue-forced *game-info*))
                                         )
                                     (send-event *target* 'change-mode 'racer #f)
                                     )
                       )
             (function "flut" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                    (if (not *target*)
                                        (start 'debug (get-current-continue-forced *game-info*))
                                        )
                                    (send-event *target* 'change-mode 'flut #f)
                                    )
                       )
             (function "board" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                     (if (not *target*)
                                         (start 'debug (get-current-continue-forced *game-info*))
                                         )
                                     (logior! (-> *game-info* features) (game-feature board))
                                     (logior! (-> *game-info* debug-features) (game-feature board))
                                     (send-event *target* 'change-mode 'board #f)
                                     )
                       )
             (function "mech" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                    (if (not *target*)
                                        (start 'debug (get-current-continue-forced *game-info*))
                                        )
                                    (send-event *target* 'change-mode 'mech #f)
                                    )
                       )
             (function "gun" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                   (if (not *target*)
                                       (start 'debug (get-current-continue-forced *game-info*))
                                       )
                                   (logior! (-> *game-info* features) (game-feature gun))
                                   (logior! (-> *game-info* debug-features) (game-feature gun))
                                   (send-event *target* 'change-mode 'gun #f (pickup-type none))
                                   )
                       )
             (function
               "darkjak"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active))
                  )
               )
             (function
               "lightjak"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'lightjak #f 5)
                  )
               )
             (function "indax" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                     (if (not *target*)
                                         (start 'debug (get-current-continue-forced *game-info*))
                                         )
                                     (send-event *target* 'change-mode 'indax #f #f)
                                     )
                       )
             (function
               "invisible"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature artifact-invis) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature artifact-invis) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'invisible #f)
                  )
               )
             )
           (menu
             "Pilot Mode"
             (function "h-bike-a" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 0)))
             (function "h-bike-b" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 1)))
             (function "h-bike-c" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 2)))
             (function "h-bike-d" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 6)))
             (function "h-car-a" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 3)))
             (function "h-car-b" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 4)))
             (function "h-car-c" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 5)))
             (function "h-hellcat" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 7)))
             (function "h-warf" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 8)))
             (function "h-glider" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 9)))
             (function "h-sled" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 10)))
             (function "v-turtle" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 12)))
             (function "v-snake" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 13)))
             (function "v-scorpion" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 14)))
             (function "v-toad" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 15)))
             (function "v-fox" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 16)))
             (function "v-rhino" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 17)))
             (function "v-mirage" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 18)))
             (function "v-x-ride" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 19)))
             (function "v-marauder" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 20)))
             (function "v-faccar" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 21)))
             (function "v-catapult" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 22)))
             (function "v-marauder-b" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 23)))
             (function "evantestbike" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 29)))
             (function "test-car" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 25)))
             (function "wbike-test" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dm-pilot-mode 26)))
             )
           (flag "Target" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                (when (= arg1 (debug-menu-msg press))
                                  (if *target*
                                      (stop 'debug)
                                      (start 'debug (get-current-continue-forced *game-info*))
                                      )
                                  )
                                *target*
                                )
                 )
           (menu
             "Darkjak"
             (function
               "get all"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (set! (-> *game-info* features)
                        (the-as
                          game-feature
                          (logior (game-feature darkjak darkjak-smack darkjak-bomb0 darkjak-bomb1 darkjak-tracking darkjak-invinc)
                                  (-> *game-info* features)
                                  )
                          )
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as
                          game-feature
                          (logior (game-feature darkjak darkjak-smack darkjak-bomb0 darkjak-bomb1 darkjak-tracking darkjak-invinc)
                                  (-> *game-info* debug-features)
                                  )
                          )
                        )
                  (send-event *target* 'get-pickup (pickup-type eco-pill-dark) 100.0)
                  )
               )
             (function
               "debug"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (set! (-> *game-info* features)
                        (the-as
                          game-feature
                          (logior (game-feature darkjak darkjak-smack darkjak-bomb0 darkjak-bomb1 darkjak-tracking darkjak-invinc)
                                  (-> *game-info* features)
                                  )
                          )
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as
                          game-feature
                          (logior (game-feature darkjak darkjak-smack darkjak-bomb0 darkjak-bomb1 darkjak-tracking darkjak-invinc)
                                  (-> *game-info* debug-features)
                                  )
                          )
                        )
                  (send-event *target* 'get-pickup (pickup-type eco-pill-dark) 100.0)
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage endless-dark active tracking invinc))
                  )
               )
             (function
               "manual"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active))
                  )
               )
             (function
               "rapid"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature darkjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage active))
                  )
               )
             (function "smack" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                     (if (not *target*)
                                         (start 'debug (get-current-continue-forced *game-info*))
                                         )
                                     (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active smack))
                                     )
                       )
             (function
               "bomb0"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active smack bomb0))
                  )
               )
             (function
               "bomb1"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active smack bomb0 bomb1))
                  )
               )
             (function
               "tracking"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active smack bomb0 bomb1 tracking))
                  )
               )
             (function
               "invinc"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active bomb0 bomb1 tracking invinc))
                  )
               )
             )
           (menu
             "Lightjak"
             (function
               "get all"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (set! (-> *game-info* features)
                        (the-as
                          game-feature
                          (logior (game-feature lightjak lightjak-regen lightjak-swoop lightjak-freeze lightjak-shield)
                                  (-> *game-info* features)
                                  )
                          )
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'get-pickup (pickup-type eco-pill-light) 100.0)
                  )
               )
             (function
               "debug"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as
                          game-feature
                          (logior (game-feature lightjak lightjak-regen lightjak-swoop lightjak-freeze lightjak-shield)
                                  (-> *game-info* features)
                                  )
                          )
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'get-pickup (pickup-type eco-pill-light) 100.0)
                  (send-event *target* 'change-mode 'lightjak #f 6)
                  )
               )
             (function
               "manual"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'lightjak #f 5)
                  )
               )
             (function
               "normal"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (not *target*)
                      (start 'debug (get-current-continue-forced *game-info*))
                      )
                  (set! (-> *game-info* features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* features)))
                        )
                  (set! (-> *game-info* debug-features)
                        (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                        )
                  (send-event *target* 'change-mode 'lightjak #f 4)
                  )
               )
             )
           (flag "Target Marks" *display-target-marks* dm-boolean-toggle-pick-func)
           (flag "Gun Marks" *gun-marks* dm-boolean-toggle-pick-func)
           (flag "Target Stats" *stats-target* dm-boolean-toggle-pick-func)
           (flag "Sidekick Stats" *display-sidekick-stats* dm-boolean-toggle-pick-func)
           (flag "Invulnerable" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                      (when (= arg1 (debug-menu-msg press))
                                        (if *target*
                                            (logxor! (-> *target* target-flags) (target-flags tf2))
                                            )
                                        )
                                      (and *target* (logtest? (-> *target* target-flags) (target-flags tf2)))
                                      )
                 )
           (flag
             "Endless Ammo"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (when (= arg1 (debug-menu-msg press))
                  (if *target*
                      (set! (-> *target* target-flags) (logxor (target-flags tf16) (the-as int (-> *target* target-flags))))
                      )
                  )
                (and *target* (logtest? (target-flags tf16) (-> *target* target-flags)))
                )
             )
           (function
             "Full Stuff"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (send-event *target* 'get-pickup (pickup-type health) 1000.0)
                (send-event *target* 'get-pickup (pickup-type shield) 1000.0)
                (send-event *target* 'get-pickup (pickup-type skill) 100.0)
                (send-event *target* 'get-pickup (pickup-type gem) 100.0)
                (send-event *target* 'get-pickup (pickup-type ammo-yellow) 1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-red) 1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-blue) 1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-dark) 1000.0)
                (send-event *target* 'get-pickup (pickup-type eco-pill-dark) 100.0)
                (send-event *target* 'get-pickup (pickup-type eco-pill-light) 100.0)
                (set! (-> *game-info* features)
                      (the-as
                        game-feature
                        (logior (game-feature
                                  gun
                                  gun-red-1
                                  gun-red-2
                                  gun-red-3
                                  gun-yellow-1
                                  gun-yellow-2
                                  gun-yellow-3
                                  gun-blue-1
                                  gun-blue-2
                                  gun-blue-3
                                  gun-dark-1
                                  gun-dark-2
                                  gun-dark-3
                                  board
                                  darkjak
                                  )
                                (-> *game-info* features)
                                )
                        )
                      )
                (let ((v0-10
                        (logior (game-feature gun gun-red-1 gun-yellow-1 gun-blue-1 gun-dark-1 board darkjak)
                                (-> *game-info* debug-features)
                                )
                        )
                      )
                  (set! (-> *game-info* debug-features) (the-as game-feature v0-10))
                  v0-10
                  )
                )
             )
           (function
             "Dump Stuff"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (send-event *target* 'get-pickup (pickup-type shield) -1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-yellow) -1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-red) -1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-blue) -1000.0)
                (send-event *target* 'get-pickup (pickup-type ammo-dark) -1000.0)
                )
             )
           (function
             "Trick Mode"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (send-event *target* 'get-pickup (pickup-type trick-judge) 18000.0)
                )
             )
           (function
             "Reset Trans"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (when *target*
                  (position-in-front-of-camera! (target-pos 0) 40960.0 4096.0)
                  (set! (-> *target* control transv quad) (the-as uint128 0))
                  (quaternion-identity! (-> *target* control quat))
                  (quaternion-identity! (-> *target* control quat-for-control))
                  (quaternion-identity! (-> *target* control dir-targ))
                  )
                )
             )
           (function
             "Zero Trans"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (when *target*
                  (set-vector! (-> *target* control trans) 0.0 163840.0 0.0 1.0)
                  (set! (-> *target* control transv quad) (the-as uint128 0))
                  (quaternion-identity! (-> *target* control quat))
                  (quaternion-identity! (-> *target* control quat-for-control))
                  (quaternion-identity! (-> *target* control dir-targ))
                  )
                )
             )
           (flag "Slow Frame Rate" *slow-frame-rate* dm-boolean-toggle-pick-func)
           (function "Print Pos" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                       (let ((v1-0 (target-pos 0)))
                                         (format #t "~6,,2m ~6,,2m ~6,,2m~%" (-> v1-0 x) (-> v1-0 y) (-> v1-0 z))
                                         )
                                       0
                                       )
                     )
           (flag "Goggles" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                                 (when (= arg1 (debug-menu-msg press))
                                   (cond
                                     ((not *target*)
                                      )
                                     ((= (-> *target* goggles-interp-targ) 0.0)
                                      (set! (-> *target* goggles-interp-targ) 1.0)
                                      )
                                     (else
                                       (set! (-> *target* goggles-interp-targ) 0.0)
                                       )
                                     )
                                   )
                                 (if *target*
                                     (!= (-> *target* goggles-interp-targ) 0.0)
                                     #f
                                     )
                                 )
                 )
           (flag "Scarf" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                               (when (= arg1 (debug-menu-msg press))
                                 (cond
                                   ((not *target*)
                                    )
                                   ((= (-> *target* scarf-interp-targ) 0.0)
                                    (set! (-> *target* scarf-interp-targ) 1.0)
                                    )
                                   (else
                                     (set! (-> *target* scarf-interp-targ) 0.0)
                                     )
                                   )
                                 )
                               (if *target*
                                   (!= (-> *target* scarf-interp-targ) 0.0)
                                   #f
                                   )
                               )
                 )
           (function
             "Save Continue"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (if *target*
                                                                          (trsq->continue-point (-> *target* control))
                                                                          )
                      )
             )
           (flag "RC Board Controls" *target-rc-board-controls* dm-boolean-toggle-pick-func)
           )
        )
      )
    (debug-menu-append-item s5-0 (debug-menu-make-camera-menu arg0))
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Racing"
           (flag "Desertb" 0 dm-select-race-pick-func)
           (flag "Desert Rally" 2 dm-select-race-pick-func)
           (int-var "Select Path" 0 dm-select-race-path 10 1 #t 0 7)
           (menu
             "Race Marks"
             (flag "Path 0 (Red)" 1 display-race-marks-toggle-pick-func)
             (flag "Path 1 (Green)" 2 display-race-marks-toggle-pick-func)
             (flag "Path 2 (Blue)" 4 display-race-marks-toggle-pick-func)
             (flag "Path 3 (Yellow)" 8 display-race-marks-toggle-pick-func)
             (flag "Path 4 (Cyan)" 16 display-race-marks-toggle-pick-func)
             (flag "Path 5 (Violet)" 32 display-race-marks-toggle-pick-func)
             (flag "Path 6 (Orange)" 64 display-race-marks-toggle-pick-func)
             (flag "Path 7 (Black)" 128 display-race-marks-toggle-pick-func)
             (flag "All Paths On" 255 display-race-marks-set-pick-func)
             (flag "All Off" 0 display-race-marks-set-pick-func)
             )
           (flag "Race Mesh" *display-race-mesh* dm-boolean-toggle-pick-func)
           (function
             "Record Selected Path"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (set! *race-record-path* #t)
                (dm-play-race *select-race* #t)
                )
             )
           (function
             "Play Race"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (set! *race-record-path* #f)
                (dm-play-race *select-race* #f)
                )
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Nav Graph"
           (function
             "Start Editor"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (when (not (get-nav-graph-editor))
                                                                        (let ((t9-1 run-nav-graph-editor)
                                                                              (a0-1 'test)
                                                                              )
                                                                          (t9-1 a0-1)
                                                                          )
                                                                        )
                      )
             )
           (function
             "Exit Editor"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (if (get-nav-graph-editor)
                                                                          (exit-nav-graph-editor)
                                                                          )
                      )
             )
           (function
             "Toggle Plane Mode"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (let ((a0-1 (get-nav-graph-editor)))
                  (if a0-1
                      ((method-of-object a0-1 nav-graph-editor-method-64))
                      )
                  )
                )
             )
           (function
             "Toggle Hover Mode"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (let ((a0-1 (get-nav-graph-editor)))
                  (if a0-1
                      ((method-of-object a0-1 nav-graph-editor-method-65))
                      )
                  )
                )
             )
           (menu
             "Load"
             (function
               "Hover Foresta"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'hover
                        'foresta
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Hover Sewc"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'hover
                        'sewc
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Hover Sewg"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'hover
                        'sewg
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Hover Sewl"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'hover
                        'sewl
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Traffic"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'traffic
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Minimap"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'minimap
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "flyingsaw_2"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'flyingsaw_2
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "flyingsaw_3"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'flyingsaw_3
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "forest-plant-1"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'forest-plant-1
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "forest-plant-2"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'forest-plant-2
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "forest-plant-3"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'forest-plant-3
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "forest-plant-4"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'forest-plant-4
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Desert Beast"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'beast
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Was Minimap"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'wasminimap
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Desert Rescue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'desrescue
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Assault"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'assault
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Timer Chase 1"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'timer-chase-1
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "ProtectHQ"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'protect-hq
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Blow Tower"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'blow-tower
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "desert-lizard"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'desert-lizard
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "terraformer-walk"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'terraformer-walk
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "terraformer-fly"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'terraformer-fly
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Desert Beast Battle"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'beast-battle
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             (function
               "Desert Chase Marauder"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (let ((a0-1 (get-nav-graph-editor)))
                    (when a0-1
                      (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66)))
                        'desert-chase-marauder
                        (t9-1)
                        )
                      )
                    )
                  )
               )
             )
           (function
             "Save"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (let ((a0-1 (get-nav-graph-editor)))
                  (if a0-1
                      ((method-of-object a0-1 nav-graph-editor-method-67))
                      )
                  )
                )
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Nav Mesh"
           (function
             "Start Editor"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (when (not *nav-mesh-editor*)
                  (kill-by-type nav-mesh-editor *active-pool*)
                  (let ((gp-0 (get-process *default-dead-pool* nav-mesh-editor #x4000 1)))
                    (when gp-0
                      (let ((t9-2 (method-of-type nav-mesh-editor activate)))
                        (t9-2 (the-as nav-mesh-editor gp-0) *entity-pool* "nav-mesh-editor" (the-as pointer #x70004000))
                        )
                      (let ((t9-3 run-function-in-process)
                            (a0-4 gp-0)
                            (a1-4 nav-mesh-editor-init)
                            )
                        ((the-as (function object object none) t9-3) a0-4 a1-4)
                        )
                      (-> gp-0 ppointer)
                      )
                    )
                  )
                )
             )
           (function
             "Exit Editor"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (kill-by-type nav-mesh-editor *active-pool*))
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Ocean"
           (menu
             "Ocean Height"
             (flag "zero" 1 dm-ocean-height-func)
             (flag "far-below" 2 dm-ocean-height-func)
             (flag "sewer-start" 3 dm-ocean-height-func)
             (flag "sewer-hi" 4 dm-ocean-height-func)
             (flag "sewer-med" 5 dm-ocean-height-func)
             (flag "sewer-lo" 6 dm-ocean-height-func)
             )
           (menu
             "Ocean Subdiv"
             (flag "Textured" 0 dm-ocean-subdiv-draw-func)
             (flag "Outline" 1 dm-ocean-subdiv-draw-func)
             (flag "Gouraud" 2 dm-ocean-subdiv-draw-func)
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Time of day"
           (flag "7am  sunrise" 0 dm-time-of-day-func)
           (flag "10am  morning" 1 dm-time-of-day-func)
           (flag "12pm noon" 2 dm-time-of-day-func)
           (flag "2pm  afternoon" 3 dm-time-of-day-func)
           (flag "6pm  sunset" 4 dm-time-of-day-func)
           (flag "7pm  twilight" 5 dm-time-of-day-func)
           (flag "11pm evening" 6 dm-time-of-day-func)
           (flag "4am  green sun" 7 dm-time-of-day-func)
           (flag "palette 0" 16 dm-time-of-day-func)
           (flag "palette 1" 32 dm-time-of-day-func)
           (flag "palette 2" 64 dm-time-of-day-func)
           (flag "palette 3" 128 dm-time-of-day-func)
           (flag "palette 4" 256 dm-time-of-day-func)
           (flag "palette 5" 512 dm-time-of-day-func)
           (flag "palette 6" 1024 dm-time-of-day-func)
           (flag "palette 7" 2048 dm-time-of-day-func)
           (flag "on" #f dm-time-of-day-pick-func)
           (flag "Fast" *time-of-day-fast* dm-time-of-day-func2)
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Mood"
           (flag
             "Overide Enable"
             #f
             ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                (if (= arg1 (debug-menu-msg press))
                    (set! (-> *time-of-day-context* overide-enable) (not (-> *time-of-day-context* overide-enable)))
                    )
                (-> *time-of-day-context* overide-enable)
                )
             )
           (menu
             "Weather"
             (flag
               "Overide Weather Enable"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *mood-control* overide-weather-flag) (not (-> *mood-control* overide-weather-flag)))
                      )
                  (-> *mood-control* overide-weather-flag)
                  )
               )
             (flag
               "Display Values"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (if (= arg1 (debug-menu-msg press))
                      (set! (-> *mood-control* display-flag) (not (-> *mood-control* display-flag)))
                      )
                  (-> *mood-control* display-flag)
                  )
               )
             (float-var
               "Clouds"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *mood-control* (nonzero? *mood-control*))
                         (set! (-> *mood-control* overide cloud) arg2)
                         )
                     )
                    ((or (not *mood-control*) (zero? *mood-control*))
                     0
                     )
                    (else
                      (-> *mood-control* overide cloud)
                      )
                    )
                  )
               1
               (new 'static 'bfloat :data 0.00390625)
               #t
               0
               (new 'static 'bfloat :data 1.0)
               0
               )
             (float-var
               "Fog"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *mood-control* (nonzero? *mood-control*))
                         (set! (-> *mood-control* overide fog) arg2)
                         )
                     )
                    ((or (not *mood-control*) (zero? *mood-control*))
                     0
                     )
                    (else
                      (-> *mood-control* overide fog)
                      )
                    )
                  )
               1
               (new 'static 'bfloat :data 0.00390625)
               #t
               0
               (new 'static 'bfloat :data 1.0)
               0
               )
             )
           (menu
             "Colors"
             (flag "7am  sunrise" 0 dm-time-of-day-func)
             (flag "10am  morning" 1 dm-time-of-day-func)
             (flag "12pm noon" 2 dm-time-of-day-func)
             (flag "2pm  afternoon" 3 dm-time-of-day-func)
             (flag "6pm  sunset" 4 dm-time-of-day-func)
             (flag "7pm  twilight" 5 dm-time-of-day-func)
             (flag "11pm evening" 6 dm-time-of-day-func)
             (flag "4am  green sun" 7 dm-time-of-day-func)
             (flag "time of day on" #f dm-time-of-day-pick-func)
             (float-var
               "Ambient Red"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   amb-color
                                   x
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          amb-color
                          x
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Ambient Green"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   amb-color
                                   y
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          amb-color
                          y
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Ambient Blue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   amb-color
                                   z
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          amb-color
                          z
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Ambient Mult"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   amb-color
                                   w
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          amb-color
                          w
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               2
               0
               )
             (float-var
               "Light Red"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   lgt-color
                                   x
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          lgt-color
                          x
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Light Green"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   lgt-color
                                   y
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          lgt-color
                          y
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Light Blue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   lgt-color
                                   z
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          lgt-color
                          z
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Light Mult"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*))
                         (set! (-> *overide-mood-color-table*
                                   data
                                   (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                                   lgt-color
                                   w
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          lgt-color
                          w
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               2
               0
               )
             (function
               "reset selected time"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (mem-copy!
                    (the-as
                      pointer
                      (-> *overide-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          )
                      )
                    (the-as
                      pointer
                      (-> *debug-mood-color-table*
                          data
                          (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                          )
                      )
                    32
                    )
                  (set! (-> *overide-mood-color-table*
                            data
                            (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                            lgt-color
                            w
                            )
                        1.0
                        )
                  (set! (-> *overide-mood-color-table*
                            data
                            (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))
                            amb-color
                            w
                            )
                        1.0
                        )
                  )
               )
             (function
               "reset all times"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (mem-copy! (the-as pointer *overide-mood-color-table*) (the-as pointer *debug-mood-color-table*) 256)
                  (dotimes (v1-0 8)
                    (set! (-> *overide-mood-color-table* data v1-0 lgt-color w) 1.0)
                    (set! (-> *overide-mood-color-table* data v1-0 amb-color w) 1.0)
                    )
                  #f
                  )
               )
             )
           (menu
             "Fog"
             (flag "7am  sunrise" 0 dm-time-of-day-func)
             (flag "10am  morning" 1 dm-time-of-day-func)
             (flag "12pm noon" 2 dm-time-of-day-func)
             (flag "2pm  afternoon" 3 dm-time-of-day-func)
             (flag "6pm  sunset" 4 dm-time-of-day-func)
             (flag "7pm  twilight" 5 dm-time-of-day-func)
             (flag "11pm evening" 6 dm-time-of-day-func)
             (flag "4am  green sun" 7 dm-time-of-day-func)
             (flag "time of day on" #f dm-time-of-day-pick-func)
             (float-var
               "Red"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-color
                                   x
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-color
                          x
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 1.0)
               #t
               0
               255
               0
               )
             (float-var
               "Green"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-color
                                   y
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-color
                          y
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 1.0)
               #t
               0
               255
               0
               )
             (float-var
               "Blue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-color
                                   z
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-color
                          z
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 1.0)
               #t
               0
               255
               0
               )
             (float-var
               "Mult"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-color
                                   w
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-color
                          w
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.00390625)
               #t
               0
               1
               0
               )
             (float-var
               "Start"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-dists
                                   x
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-dists
                          x
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 1.0)
               #t
               -1000
               10000
               0
               )
             (float-var
               "End"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-dists
                                   y
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-dists
                          y
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 1.0)
               #t
               0
               10000
               0
               )
             (float-var
               "Max"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-dists
                                   w
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-dists
                          w
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.5)
               #t
               0
               255
               0
               )
             (float-var
               "Min"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*))
                         (set! (-> *overide-mood-fog-table*
                                   data
                                   (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                                   fog-dists
                                   z
                                   )
                               arg2
                               )
                         )
                     )
                    ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*))
                     0
                     )
                    (else
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          fog-dists
                          z
                          )
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.5)
               #t
               0
               255
               0
               )
             (function
               "reset selected time"
               #f
               ,(lambda ()
                  (mem-copy!
                    (the-as
                      pointer
                      (-> *overide-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          )
                      )
                    (the-as
                      pointer
                      (-> *debug-mood-fog-table*
                          data
                          (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                          )
                      )
                    48
                    )
                  (set! (-> *overide-mood-fog-table*
                            data
                            (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                            fog-color
                            w
                            )
                        1.0
                        )
                  (set! (-> *overide-mood-fog-table*
                            data
                            (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                            fog-dists
                            x
                            )
                        (/ (-> *overide-mood-fog-table*
                               data
                               (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                               fog-dists
                               x
                               )
                           METER_LENGTH
                           )
                        )
                  (set! (-> *overide-mood-fog-table*
                            data
                            (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                            fog-dists
                            y
                            )
                        (/ (-> *overide-mood-fog-table*
                               data
                               (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)))
                               fog-dists
                               y
                               )
                           METER_LENGTH
                           )
                        )
                  )
               )
             (function
               "reset all times"
               #f
               ,(lambda ()
                  (mem-copy! (the-as pointer *overide-mood-fog-table*) (the-as pointer *debug-mood-fog-table*) 384)
                  (dotimes (v1-0 8)
                    (set! (-> *overide-mood-fog-table* data v1-0 fog-color w) 1.0)
                    (set! (-> *overide-mood-fog-table* data v1-0 fog-dists x)
                          (/ (-> *overide-mood-fog-table* data v1-0 fog-dists x) METER_LENGTH)
                          )
                    (set! (-> *overide-mood-fog-table* data v1-0 fog-dists y)
                          (/ (-> *overide-mood-fog-table* data v1-0 fog-dists y) METER_LENGTH)
                          )
                    )
                  #f
                  )
               )
             )
           (menu
             "Palette"
             (flag "palette 0" 0 dm-time-of-day-palette-func)
             (flag "palette 1" 1 dm-time-of-day-palette-func)
             (flag "palette 2" 2 dm-time-of-day-palette-func)
             (flag "palette 3" 3 dm-time-of-day-palette-func)
             (flag "palette 4" 4 dm-time-of-day-palette-func)
             (flag "palette 5" 5 dm-time-of-day-palette-func)
             (flag "palette 6" 6 dm-time-of-day-palette-func)
             (flag "palette 7" 7 dm-time-of-day-palette-func)
             (flag "time of day on" #f dm-time-of-day-pick-func)
             (float-var
               "Red"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) x) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) x)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Green"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) y) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) y)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Blue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) z) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) z)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Mult"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) w) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) w)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (function
               "reset selected time"
               #f
               ,(lambda () (let ((v0-0 (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette))))
                             (set! (-> v0-0 x) 1.0)
                             (set! (-> v0-0 y) 1.0)
                             (set! (-> v0-0 z) 1.0)
                             (set! (-> v0-0 w) 1.0)
                             v0-0
                             )
                        )
               )
             (function "reset all times" #f ,(lambda ()
                                               (dotimes (v1-0 8)
                                                 (set-vector! (-> *time-of-day-context* times v1-0) 1.0 1.0 1.0 1.0)
                                                 )
                                               #f
                                               )
                       )
             )
           (menu
             "Filter"
             (float-var
               "Red"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* filter-color x) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* filter-color x)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Green"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* filter-color y) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* filter-color y)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Blue"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* filter-color z) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* filter-color z)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               (new 'static 'bfloat :data 1.9921875)
               0
               )
             (float-var
               "Mult"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* filter-color w) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* filter-color w)
                      )
                    )
                  )
               2
               (new 'static 'bfloat :data 0.007781982)
               #t
               0
               2
               0
               )
             (function "reset filter" #f ,(lambda () (let ((v0-0 (-> *time-of-day-context* filter-color)))
                                                       (set! (-> v0-0 x) 1.0)
                                                       (set! (-> v0-0 y) 1.0)
                                                       (set! (-> v0-0 z) 1.0)
                                                       (set! (-> v0-0 w) 1.0)
                                                       v0-0
                                                       )
                                                  )
                       )
             )
           (menu
             "Sky"
             (float-var
               "Cloud Min"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* current-clouds cloud-min) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* current-clouds cloud-min)
                      )
                    )
                  )
               1
               (new 'static 'bfloat :data 0.00390625)
               #t
               0
               1
               0
               )
             (float-var
               "Cloud Max"
               #f
               ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                  (cond
                    ((= arg1 (debug-menu-msg press))
                     (if (and *time-of-day-context* (nonzero? *time-of-day-context*))
                         (set! (-> *time-of-day-context* current-clouds cloud-max) arg2)
                         )
                     )
                    ((or (not *time-of-day-context*) (zero? *time-of-day-context*))
                     0
                     )
                    (else
                      (-> *time-of-day-context* current-clouds cloud-max)
                      )
                    )
                  )
               1
               (new 'static 'bfloat :data 0.00390625)
               #t
               0
               1
               0
               )
             (function
               "reset sky"
               #f
               ,(lambda ()
                  (set! (-> *time-of-day-context* current-clouds cloud-min) (-> *mood-control* mood-clouds cloud-min))
                  (set! (-> *time-of-day-context* current-clouds cloud-max) (-> *mood-control* mood-clouds cloud-max))
                  )
               )
             )
           (function "Print mood tables" #f ,(lambda () (print-mood-tables)))
           (function
             "reset everything"
             #f
             ,(lambda ()
                (mem-copy! (the-as pointer *overide-mood-color-table*) (the-as pointer *debug-mood-color-table*) 256)
                (mem-copy! (the-as pointer *overide-mood-fog-table*) (the-as pointer *debug-mood-fog-table*) 384)
                (dotimes (v1-0 8)
                  (set! (-> *overide-mood-color-table* data v1-0 lgt-color w) 1.0)
                  (set! (-> *overide-mood-color-table* data v1-0 amb-color w) 1.0)
                  (set! (-> *overide-mood-fog-table* data v1-0 fog-color w) 1.0)
                  (set! (-> *overide-mood-fog-table* data v1-0 fog-dists x)
                        (/ (-> *overide-mood-fog-table* data v1-0 fog-dists x) METER_LENGTH)
                        )
                  (set! (-> *overide-mood-fog-table* data v1-0 fog-dists y)
                        (/ (-> *overide-mood-fog-table* data v1-0 fog-dists y) METER_LENGTH)
                        )
                  (set-vector! (-> *time-of-day-context* times v1-0) 1.0 1.0 1.0 1.0)
                  )
                (set-vector! (-> *time-of-day-context* filter-color) 1.0 1.0 1.0 1.0)
                (set! (-> *time-of-day-context* current-clouds cloud-min) (-> *mood-control* mood-clouds cloud-min))
                (set! (-> *time-of-day-context* current-clouds cloud-max) (-> *mood-control* mood-clouds cloud-max))
                )
             )
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Sound"
           (flag "Effect Debug" *debug-effect-control* dm-boolean-toggle-pick-func)
           (flag "Regions" *execute-regions* dm-boolean-toggle-pick-func)
           (flag "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func)
           (flag "Sound channels" *display-iop-info* dm-boolean-toggle-pick-func)
           (function "Reload Banks" #f sound-bank-reload)
           (function "List Sounds" #f ,(lambda () (list-sounds)))
           (function "IOP Info" #f ,(lambda () (loader-test-command (sound-command iop-mem) (the-as uint 0))))
           )
        )
      )
    (debug-menu-append-item s5-0 (debug-menu-make-shader-menu arg0))
    (debug-menu-append-item s5-0 (debug-menu-make-instance-menu arg0))
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Bug Report"
           (flag "display" *display-bug-report* dm-boolean-toggle-pick-func)
           (function "Start" #f ,(lambda () (bug-report-start)))
           (function "Stop" #f ,(lambda () (bug-report-stop)))
           )
        )
      )
    (debug-menu-append-item
      s5-0
      (debug-menu-make-from-template
        arg0
        '(menu
           "Scene"
           (menu
             "Scene Info"
             (flag "channel" 1 display-scene-control-toggle-pick-func)
             (flag "anim name" 2 display-scene-control-toggle-pick-func)
             (flag "dma size" 4 display-scene-control-toggle-pick-func)
             (flag "bounds spheres" 8 display-scene-control-toggle-pick-func)
             (flag "actors" 16 display-scene-control-toggle-pick-func)
             (flag "actor-marks" 32 display-scene-control-toggle-pick-func)
             (flag "special fma spheres" 64 display-scene-control-toggle-pick-func)
             (flag "all on" 95 display-scene-control-set-pick-func)
             (flag "all off" 0 display-scene-control-set-pick-func)
             )
           (menu
             "arena"
             (function
               "arena-training-1-intro"
               ("waspala-intro-training" "arena-training-1-intro")
               dm-scene-load-pick-func
               )
             (function "arena-fight-1-intro" ("wasstada-pre-fight-1" "arena-fight-1-intro") dm-scene-load-pick-func)
             (function "arena-fight-1-res" ("wasstada-fight" "arena-fight-1-res") dm-scene-load-pick-func)
             (function "wascity-chase-intro" ("wasstada-wascity-chase" "wascity-chase-intro") dm-scene-load-pick-func)
             (function "arena-fight-2-res" ("wasstada-fight" "arena-fight-2-res") dm-scene-load-pick-func)
             (function "arena-fight-3-intro" ("wasstada-fight" "arena-fight-3-intro") dm-scene-load-pick-func)
             (function "arena-fight-3-res" ("wasstada-fight" "arena-fight-3-res") dm-scene-load-pick-func)
             )
           (menu
             "city"
             (function "sewer-hum-kg-entrance" ("ctyslumb-sewer" "sewer-hum-kg-entrance") dm-scene-load-pick-func)
             (function "sewer-kg-entrance" ("ctyinda-sewer" "sewer-kg-entrance") dm-scene-load-pick-func)
             (function "sewer-genb-entrance" ("ctygenb-sewer" "sewer-genb-entrance") dm-scene-load-pick-func)
             (function "city-gun-course-intro" ("gungame-start" "city-gun-course-intro") dm-scene-load-pick-func)
             (function "city-gun-course-1-res" ("gungame-start" "city-gun-course-1-res") dm-scene-load-pick-func)
             (function "city-gun-course-2-intro" ("gungame-start" "city-gun-course-2-intro") dm-scene-load-pick-func)
             (function "city-gun-course-2-res" ("gungame-start" "city-gun-course-2-res") dm-scene-load-pick-func)
             (function "city-port-attack-intro-b" ("ctyport-hiphog" "ctyport-attack-get-on-nuke") dm-scene-load-pick-func)
             (function "city-port-attack-res" ("ctyport-attack-res" "city-port-attack-res") dm-scene-load-pick-func)
             (function "city-hijack-vehicle-res" ("ctyhijack-res" "city-hijack-vehicle-res") dm-scene-load-pick-func)
             (function "city-get-dark-punch" ("mhcitya-fma" "city-get-dark-punch") dm-scene-load-pick-func)
             (function "sewer-met-hum-intro" ("ctygenb-samos" "sewer-met-hum-intro") dm-scene-load-pick-func)
             (function "city-destroy-grid-res" ("ctyinda-grid-res-a" "city-destroy-grid-res") dm-scene-load-pick-func)
             (function "tower-destroy-intro" ("mhcityb-tower-fma" "tower-destroy-intro") dm-scene-load-pick-func)
             )
           (menu
             "desert"
             (function "nest-destroy-barrier" ("desertg-egg-wall-scene" "nest-destroy-barrier") dm-scene-load-pick-func)
             (function "nest-hunt-intro" ("desertg-egg-wall-scene" "nest-hunt-intro") dm-scene-load-pick-func)
             (function "nest-hunt-res" ("desertg-hunt-res-start" "nest-hunt-res") dm-scene-load-pick-func)
             (function
               "desert-oasis-defense-res"
               ("desert-ashelin-movie" "desert-oasis-defense-res")
               dm-scene-load-pick-func
               )
             (function "desert-rescue-res-a" ("desert-rescue-movie" "desert-rescue-res-a") dm-scene-load-pick-func)
             (function "desert-hover-res" ("desert-hover-movie" "desert-hover-res") dm-scene-load-pick-func)
             (function "desert-lizard-catch" ("desert-lizard-corral" "desert-lizard-catch") dm-scene-load-pick-func)
             (function "desert-lizard-catch-2" ("desert-lizard-corral" "desert-lizard-catch-2") dm-scene-load-pick-func)
             (function "desert-lizard-catch-3" ("desert-lizard-corral" "desert-lizard-resolution") dm-scene-load-pick-func)
             (function
               "desert-oasis-defense-res-b"
               ("desert-ashelin-movie" "desert-oasis-defense-res-b")
               dm-scene-load-pick-func
               )
             (function "desert-glide-res" ("volcanox-vola-start" "desert-glide-res") dm-scene-load-pick-func)
             (function "desert-courserace-win" ("desertg-hunt-res-start" "desert-courserace-win") dm-scene-load-pick-func)
             (function
               "desert-final-boss-res"
               ("desert-final-boss-res-movie-a" "desert-final-boss-res")
               dm-scene-load-pick-func
               )
             (function
               "desert-final-boss-res-b"
               ("desert-final-boss-res-movie" "desert-final-boss-res-b")
               dm-scene-load-pick-func
               )
             (function
               "desert-final-boss-intro"
               ("wasall-final-boss-intro-movie" "desert-final-boss-intro")
               dm-scene-load-pick-func
               )
             (function
               "full desert-jak-gets-on-terraformer"
               ("desert-boss-res-a" ("desert-jak-gets-on-t-a" "desert-jak-gets-on-t-b" "desert-jak-gets-on-t-c"))
               dm-scene-load-pick-func
               )
             (function "desert-jak-gets-on-t-a" ("desert-boss-res-a" "desert-jak-gets-on-t-a") dm-scene-load-pick-func)
             (function "desert-jak-gets-on-t-b" ("desert-boss-res-b" "desert-jak-gets-on-t-b") dm-scene-load-pick-func)
             (function "desert-jak-gets-on-t-c" ("desert-boss-res-b" "desert-jak-gets-on-t-c") dm-scene-load-pick-func)
             (function
               "full outro"
               ("desert-final-boss-res-movie-a" ("desert-final-boss-res" "desert-final-boss-res-b" "arena-outro"))
               dm-scene-load-pick-func
               )
             )
           (menu
             "comb"
             (function "comb-exit" ("combn-start" "comb-exit") dm-scene-load-pick-func)
             (function "comb-entrance-temple" ("temple-comb-entrance" "comb-entrance-temple") dm-scene-load-pick-func)
             (function "catacombs-wild-ride-res" ("railx-start" "catacombs-wild-ride-res") dm-scene-load-pick-func)
             (function "catacomb-get-shield" ("combn-start" "catacomb-get-shield") dm-scene-load-pick-func)
             )
           (menu
             "factory"
             (function "factory-sky-battle-res" ("factorya-movie" "factory-sky-battle-res") dm-scene-load-pick-func)
             (function
               "factory-sky-battle-intro-b"
               ("factorya-intro-b" "factory-sky-battle-intro-b")
               dm-scene-load-pick-func
               )
             (function "factory-indax-1-intro" ("factoryc-start" "factory-indax-1-intro") dm-scene-load-pick-func)
             (function "factory-indax-2-intro" ("factoryc-start" "factory-indax-2-intro") dm-scene-load-pick-func)
             (function "factory-indax-3-intro" ("factoryc-start" "factory-indax-3-intro") dm-scene-load-pick-func)
             (function "factory-indax-4-intro" ("factoryc-start" "factory-indax-4-intro") dm-scene-load-pick-func)
             (function "factory-boss-intro" ("factoryd-start" "factory-boss-intro") dm-scene-load-pick-func)
             (function "factory-boss-res" ("factoryd-res-fma" "factory-boss-res") dm-scene-load-pick-func)
             )
           (menu
             "forest"
             (function "forest-tower" ("foresta-start" "forest-tower") dm-scene-load-pick-func)
             (function
               "forest-turn-on-machine-res"
               ("forest-pillar-start" "forest-turn-on-machine-res")
               dm-scene-load-pick-func
               )
             (function "precursor-tour-res" ("precura-foresta" "precursor-tour-res") dm-scene-load-pick-func)
             (function "forest-ring-chase-res" ("foresta-start" "forest-ring-chase-res") dm-scene-load-pick-func)
             (function "forest-res-b" ("foresta-start" "forest-res-b") dm-scene-load-pick-func)
             )
           (menu
             "freehq"
             (function "factory-sky-battle-intro" ("freehq-movie" "factory-sky-battle-intro") dm-scene-load-pick-func)
             (function "city-protect-hq-intro" ("freehq-movie" "city-protect-hq-intro") dm-scene-load-pick-func)
             (function "city-protect-hq-res" ("freehq-movie" "city-protect-hq-res") dm-scene-load-pick-func)
             (function "city-blow-tower-intro" ("freehq-movie" "city-blow-tower-intro") dm-scene-load-pick-func)
             (function "temple-defend-intro" ("freehq-movie" "temple-defend-intro") dm-scene-load-pick-func)
             )
           (menu
             "hiphog"
             (function "sewer-kg-met-intro" ("hiphog-movie" "sewer-kg-met-intro") dm-scene-load-pick-func)
             (function "port-assault-intro" ("hiphog-movie" "port-assault-intro") dm-scene-load-pick-func)
             (function "city-blow-barricade-intro" ("hiphog-movie" "city-blow-barricade-intro") dm-scene-load-pick-func)
             (function "city-blow-barricade-res" ("hiphog-movie" "city-blow-barricade-res") dm-scene-load-pick-func)
             (function "city-port-fight-intro" ("hiphog-movie" "city-port-fight-intro") dm-scene-load-pick-func)
             (function "city-sniper-fight-intro" ("hiphog-movie" "city-sniper-fight-intro") dm-scene-load-pick-func)
             (function "city-port-attack-intro" ("hiphog-movie" "city-port-attack-intro") dm-scene-load-pick-func)
             )
           (menu
             "intro"
             (function
               "full intro"
               ("wasintro-start" ("intro-drop" "intro-lost" "intro-ffhq" "intro-tired" "intro-palace" "intro-rescue"))
               dm-scene-load-pick-func
               )
             (function "intro-drop" ("wasintro-start" "intro-drop") dm-scene-load-pick-func)
             (function "intro-lost" ("wasintro-start" "intro-lost") dm-scene-load-pick-func)
             (function "intro-ffhq" ("freehq-intro" "intro-ffhq") dm-scene-load-pick-func)
             (function "intro-tired" ("wasintro-tired" "intro-tired") dm-scene-load-pick-func)
             (function "intro-palace" ("wasintro-palace" "intro-palace") dm-scene-load-pick-func)
             (function "intro-rescue" ("wasintro-rescue" "intro-rescue") dm-scene-load-pick-func)
             )
           (menu
             "mine"
             (function "catacombs-travel-res" ("minec-start" "catacombs-travel-res") dm-scene-load-pick-func)
             (function "mine-train-intro" ("mineb-elevator-room" "mine-train-intro") dm-scene-load-pick-func)
             (function "mine-train-res" ("minec-train" "mine-train-res") dm-scene-load-pick-func)
             (function "mine-boss-intro" ("prebot-intro" "mine-boss-intro") dm-scene-load-pick-func)
             (function "prebot-hit-a" ("prebot-fight" "prebot-hit-a") dm-scene-load-pick-func)
             (function "prebot-hit-b" ("prebot-fight" "prebot-hit-b") dm-scene-load-pick-func)
             (function "mine-boss-res" ("prebot-fight" "mine-boss-res") dm-scene-load-pick-func)
             (function "minee-genb-exit" ("minee-exit" "minee-genb-exit") dm-scene-load-pick-func)
             (function "mine-explore-res" ("mineb-elevator-room" "mine-explore-res") dm-scene-load-pick-func)
             )
           (menu
             "onintent"
             (function
               "city-find-catacomb-ent-intro"
               ("onintent-start" "city-find-catacomb-ent-intro")
               dm-scene-load-pick-func
               )
             )
           (menu "outro" (function "arena-outro" ("wasstada-outro" "arena-outro") dm-scene-load-pick-func))
           (menu
             "precursor"
             (function "precursor-destroy-ship-res" ("precurd-start" "precursor-destroy-ship-res") dm-scene-load-pick-func)
             (function "desert-final-boss-intro-a" ("precurd-escape" "desert-final-boss-intro-a") dm-scene-load-pick-func)
             (function
               "precursor-destroy-ship-exp-res"
               ("precurd-escape" "precursor-destroy-ship-exp-res")
               dm-scene-load-pick-func
               )
             (function
               "precursor-destroy-ship-lose"
               ("precura-start" "precursor-destroy-ship-lose")
               dm-scene-load-pick-func
               )
             (function
               "full final-boss-intro"
               ("precurd-escape" ("desert-final-boss-intro-a" "precursor-destroy-ship-exp-res" "desert-final-boss-intro"))
               dm-scene-load-pick-func
               )
             )
           (menu
             "rubble"
             (function "palace-ruins-attack-intro" ("rubblea-start" "palace-ruins-attack-intro") dm-scene-load-pick-func)
             (function
               "full palace-ruins-attack-res"
               ("rubblec-fma" ("palace-ruins-attack-res-a" "palace-ruins-attack-res"))
               dm-scene-load-pick-func
               )
             (function "palace-ruins-attack-res" ("rubblec-fma" "palace-ruins-attack-res") dm-scene-load-pick-func)
             (function "palace-ruins-attack-res-a" ("rubblec-fma" "palace-ruins-attack-res-a") dm-scene-load-pick-func)
             (function "palace-ruins-patrol-intro" ("stadium-tunnel" "palace-ruins-patrol-intro") dm-scene-load-pick-func)
             )
           (menu
             "sewer"
             (function "sewer-kg-exit" ("sewf-start" "sewer-kg-exit") dm-scene-load-pick-func)
             (function "sewer-mh-exit" ("sewj-exit" "sewer-mh-exit") dm-scene-load-pick-func)
             (function "sewer-port-exit" ("sewo-exit" "sewer-port-exit") dm-scene-load-pick-func)
             (function "sewer-waterslide" ("sewd-start" "sewer-waterslide") dm-scene-load-pick-func)
             (function "sewer-hum-kg-res" ("sewe-switch" "sewer-hum-kg-res") dm-scene-load-pick-func)
             (function "sewer-met-hum-intro" ("ctygenb-samos" "sewer-met-hum-intro") dm-scene-load-pick-func)
             )
           (menu
             "temple"
             (function "temple-climb-intro" ("templex-start" "temple-climb-intro") dm-scene-load-pick-func)
             (function "temple-climb-res" ("templex-pre-hang" "temple-climb-res") dm-scene-load-pick-func)
             (function "temple-oracle-intro" ("templeb-oracle-movie" "temple-oracle-intro") dm-scene-load-pick-func)
             (function "temple-oracle-res" ("templeb-start" "temple-oracle-res") dm-scene-load-pick-func)
             (function
               "temple-jak-gets-light-glide"
               ("templeb-glide" "temple-jak-gets-light-glide")
               dm-scene-load-pick-func
               )
             (function "temple-tests-res-a" ("templeb-flash-freeze" "temple-tests-res-a") dm-scene-load-pick-func)
             (function "temple-tests-res-b" ("comba-elevator" "temple-tests-res-b") dm-scene-load-pick-func)
             (function "temple-tests-intro" ("templea-mardoor" "temple-tests-intro") dm-scene-load-pick-func)
             (function "temple-defend-res" ("templed-start" "temple-defend-res") dm-scene-load-pick-func)
             )
           (menu
             "throne"
             (function
               "full training intro"
               ("waspala-intro-training" ("intro-training" "arena-training-1-intro"))
               dm-scene-load-pick-func
               )
             (function "intro-training" ("waspala-intro-training" "intro-training") dm-scene-load-pick-func)
             (function "arena-fight-2-intro" ("waspala-start" "arena-fight-2-intro") dm-scene-load-pick-func)
             (function "nest-eggs-intro" ("waspala-start" "nest-eggs-intro") dm-scene-load-pick-func)
             (function "desert-rescue-intro" ("waspala-start" "desert-rescue-intro") dm-scene-load-pick-func)
             (function "desert-jump-mission-intro" ("waspala-start" "desert-jump-mission-intro") dm-scene-load-pick-func)
             )
           (menu
             "tower"
             (function "tower-destroy-res" ("towerb-top" "tower-destroy-res") dm-scene-load-pick-func)
             (function "tower-destroy-res-b" ("ltowerb-fma" "tower-destroy-res-b") dm-scene-load-pick-func)
             )
           (menu
             "vinroom"
             (function "city-power-game-intro" ("vinroom-movie" "city-power-game-intro") dm-scene-load-pick-func)
             (function "city-power-game-res" ("vinroom-movie" "city-power-game-res") dm-scene-load-pick-func)
             )
           (menu
             "volcano"
             (function "volcano-darkeco-res" ("volcano-movie" "volcano-darkeco-res") dm-scene-load-pick-func)
             (function "volcano-indax-1-intro" ("volcano-movie" "volcano-indax-1-intro") dm-scene-load-pick-func)
             (function "volcano-indax-1-res" ("volcano-movie" "volcano-indax-1-res") dm-scene-load-pick-func)
             (function "volcano-indax-2-intro" ("volcano-movie" "volcano-indax-2-intro") dm-scene-load-pick-func)
             (function "volcano-indax-2-res" ("volcano-movie" "volcano-indax-2-res") dm-scene-load-pick-func)
             )
           (menu
             "warp"
             (function "desert-air-train-in" ("desert-warp" "desert-air-train-in") dm-scene-load-pick-func)
             (function "desert-air-train-out" ("desert-warp" "desert-air-train-out") dm-scene-load-pick-func)
             (function "city-air-train-out" ("ctyport-air-train" "city-air-train-out") dm-scene-load-pick-func)
             (function "city-air-train-in-desert" ("ctyport-air-train" "city-air-train-in-desert") dm-scene-load-pick-func)
             )
           (menu
             "wasdoors"
             (function "desert-course-race-intro" ("wasdoors-desert" "desert-course-race-intro") dm-scene-load-pick-func)
             (function
               "desert-artifact-race-1-intro"
               ("wasdoors-desert" "desert-artifact-race-1-intro")
               dm-scene-load-pick-func
               )
             (function
               "desert-artifact-race-1-res"
               ("wasdoors-desert" "desert-artifact-race-1-res")
               dm-scene-load-pick-func
               )
             (function
               "desert-artifact-race-2-intro"
               ("wasdoors-desert" "desert-artifact-race-2-intro")
               dm-scene-load-pick-func
               )
             (function "desert-hover-intro" ("wasdoors-desert" "desert-hover-intro") dm-scene-load-pick-func)
             (function "desert-beast-battle-intro" ("wasdoors-desert" "desert-beast-battle-intro") dm-scene-load-pick-func)
             (function
               "desert-catch-lizards-intro"
               ("wasdoors-desert" "desert-catch-lizards-intro")
               dm-scene-load-pick-func
               )
             )
           (menu
             "wasteland"
             (function "wascity-pre-game-intro" ("wascityb-seem" "wascity-pre-game-intro") dm-scene-load-pick-func)
             (function "wascity-pre-game-res" ("wascityb-seem" "wascity-pre-game-res") dm-scene-load-pick-func)
             (function "wascity-leaper-race-intro" ("wascitya-seem" "wascity-leaper-race-intro") dm-scene-load-pick-func)
             (function "wascity-leaper-race-res" ("wascityb-flut" "wascity-leaper-race-res") dm-scene-load-pick-func)
             (function "wascity-gun-intro" ("wascityb-gungame" "wascity-gun-intro") dm-scene-load-pick-func)
             (function "wascity-gun-res" ("wascityb-gungame" "wascity-gun-res") dm-scene-load-pick-func)
             (function "nest-eggs-intro" ("waspala-nest" "nest-eggs-intro") dm-scene-load-pick-func)
             (function "wascity-defend-res" ("wascityb-gungame" "wascity-defend-res") dm-scene-load-pick-func)
             )
           )
        )
      )
    (debug-menu-append-item s5-0 (debug-menu-make-task-menu arg0))
    (debug-menu-append-item s5-0 (debug-menu-make-play-menu arg0))
    )
  arg0
  )

(define *popup-menu-context* (new 'debug 'debug-menu-context))

(defun popup-menu-context-make-default-menus ((arg0 debug-menu-context))
  (debug-menu-make-from-template
    arg0
    '(main-menu
       "Popup"
       (flag "Cam 1" pad-1 dm-cam-externalize)
       (flag "Turbo Cam" *camera-turbo-free* dm-boolean-toggle-pick-func)
       (flag "Target" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float))
                            (when (= arg1 (debug-menu-msg press))
                              (if *target*
                                  (stop 'debug)
                                  (start 'debug (get-current-continue-forced *game-info*))
                                  )
                              )
                            *target*
                            )
             )
       (menu
         "Mode"
         (function "normal" #f ,(lambda () (send-event *target* 'change-mode 'normal)))
         (function "racer" #f ,(lambda ()
                                 (if (not *target*)
                                     (start 'debug (get-current-continue-forced *game-info*))
                                     )
                                 (send-event *target* 'change-mode 'racer #f)
                                 )
                   )
         (function "flut" #f ,(lambda ()
                                (if (not *target*)
                                    (start 'debug (get-current-continue-forced *game-info*))
                                    )
                                (send-event *target* 'change-mode 'flut #f)
                                )
                   )
         (function "board" #f ,(lambda ()
                                 (if (not *target*)
                                     (start 'debug (get-current-continue-forced *game-info*))
                                     )
                                 (logior! (-> *game-info* features) (game-feature board))
                                 (logior! (-> *game-info* debug-features) (game-feature board))
                                 (send-event *target* 'change-mode 'board #f)
                                 )
                   )
         (function "mech" #f ,(lambda ()
                                (if (not *target*)
                                    (start 'debug (get-current-continue-forced *game-info*))
                                    )
                                (send-event *target* 'change-mode 'mech #f)
                                )
                   )
         (function "gun" #f ,(lambda ()
                               (if (not *target*)
                                   (start 'debug (get-current-continue-forced *game-info*))
                                   )
                               (logior! (-> *game-info* features) (game-feature gun))
                               (logior! (-> *game-info* debug-features) (game-feature gun))
                               (send-event *target* 'change-mode 'gun #f (pickup-type none))
                               )
                   )
         (function
           "darkjak"
           #f
           ,(lambda ()
              (if (not *target*)
                  (start 'debug (get-current-continue-forced *game-info*))
                  )
              (set! (-> *game-info* features)
                    (the-as game-feature (logior (game-feature darkjak) (-> *game-info* features)))
                    )
              (set! (-> *game-info* debug-features)
                    (the-as game-feature (logior (game-feature darkjak) (-> *game-info* debug-features)))
                    )
              (send-event *target* 'change-mode 'darkjak #f (darkjak-stage force-on active))
              )
           )
         (function
           "lightjak"
           #f
           ,(lambda ()
              (if (not *target*)
                  (start 'debug (get-current-continue-forced *game-info*))
                  )
              (set! (-> *game-info* features)
                    (the-as game-feature (logior (game-feature lightjak) (-> *game-info* features)))
                    )
              (set! (-> *game-info* debug-features)
                    (the-as game-feature (logior (game-feature lightjak) (-> *game-info* debug-features)))
                    )
              (send-event *target* 'change-mode 'lightjak #f 5)
              )
           )
         (function "indax" #f ,(lambda ()
                                 (if (not *target*)
                                     (start 'debug (get-current-continue-forced *game-info*))
                                     )
                                 (send-event *target* 'change-mode 'indax #f)
                                 )
                   )
         (function
           "invisible"
           #f
           ,(lambda ()
              (if (not *target*)
                  (start 'debug (get-current-continue-forced *game-info*))
                  )
              (set! (-> *game-info* features)
                    (the-as game-feature (logior (game-feature artifact-invis) (-> *game-info* features)))
                    )
              (set! (-> *game-info* debug-features)
                    (the-as game-feature (logior (game-feature artifact-invis) (-> *game-info* debug-features)))
                    )
              (send-event *target* 'change-mode 'invisible #f)
              )
           )
         )
       (flag "Game" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg))
                          (when (= arg1 (debug-menu-msg press))
                            (let ((v1-3 (-> *game-info* mode)))
                              (set! (-> *game-info* mode) (cond
                                                            ((= v1-3 'play)
                                                             'debug
                                                             )
                                                            ((= v1-3 'debug)
                                                             'play
                                                             )
                                                            (else
                                                              (-> *game-info* mode)
                                                              )
                                                            )
                                    )
                              )
                            )
                          (= (-> *game-info* mode) 'play)
                          )
             )
       (function "Clean" #f ,(lambda ()
                               (if (time-of-day-setup #f)
                                   (time-of-day-setup #t)
                                   )
                               (play-clean #f)
                               )
                 )
       (flag "Stats" *stats-target* dm-boolean-toggle-pick-func)
       (function "Reset" #f ,(lambda () (reset-actors 'debug)))
       (function "Start" #f ,(lambda () (start 'play (-> *game-info* current-continue))))
       (function
         "Editor"
         #f
         ,(lambda ()
            (kill-by-type editable-player *active-pool*)
            (process-spawn editable-player :init editable-player-init #f :name "editable-player" :to *entity-pool*)
            (set-master-mode 'game)
            )
         )
       )
    )
  arg0
  )

(debug-menu-context-make-default-menus *debug-menu-context*)

(popup-menu-context-make-default-menus *popup-menu-context*)

(defun menu-respond-to-pause ()
  (case *master-mode*
    (('menu)
     (cond
       ((and (cpad-hold? 0 l3) (cpad-hold? 0 select))
        (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg activate) (debug-menu-dest activation))
        (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        )
       ((and (cpad-hold? 1 start) *editable*)
        ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg activate) (debug-menu-dest activation))
        (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        )
       ((and (cpad-hold? 0 l3) (cpad-hold? 0 start))
        (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg activate) (debug-menu-dest activation))
        (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
        )
       )
     )
    (else
      (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
      (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
      ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation))
      )
    )
  #f
  )

(defun *menu-hook* ()
  (debug-menus-handler *debug-menu-context*)
  (debug-menus-handler *popup-menu-context*)
  )
