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

;; name: settings-h.gc
;; name in dgo: settings-h
;; dgos: GAME

(declare-type setting-control structure)
(define-extern *setting-control* setting-control)

;; +++cam-master-options
(defenum cam-master-options
  :type uint64
  :bitfield #t
  (HAVE_TARGET) ;; 1
  (SET_COMBINER_AXIS) ;; 2
  (FLIP_COMBINER) ;; 4
  (HAVE_EASE_TO_POS) ;; 8
  (IN_BASE_REGION) ;; 10
  (IGNORE_ANALOG) ;; 20
  (BLOCK_RIGHT_STICK) ;; 40
  (USE_L1_R1) ;; 80
  (READ_BUTTONS)
  (IMMEDIATE_STRING_MIN_MAX)
  )
;; ---cam-master-options


;; +++cam-slave-options
(defenum cam-slave-options
  :type uint64
  :bitfield #t
  (BUTT_CAM)
  (SAME_SIDE)
  (MOVE_SPHERICAL)
  (ALLOW_Z_ROT)
  (JUMP_PITCHES)
  (COLLIDE)
  (FIND_HIDDEN_TARGET)
  (DRAG)
  (PLAYER_MOVING_CAMERA)
  (LINE_OF_SIGHT)
  (MOVEMENT_BLOCKED)
  (SHRINK_MAX_ANGLE)
  (GOTO_GOOD_POINT)
  (BIKE_MODE)
  (NO_ROTATE)
  (STICKY_ANGLE)
  (BLOCK_RIGHT_STICK)
  (ALLOW_SHIFT_BUTTONS)
  (GUN_CAM)
  (WIDE_FOV)
  (RAPID_TRACKING)
  (EASE_SPLINE_IDX)
  (VERTICAL_FOLLOW_MATCHES_CAMERA)
  (HAVE_BUTT_HANDLE)
  (BOMBBOT)
  (JUMP_LAG)
  )
;; ---cam-slave-options


;; +++game-feature
(defenum game-feature
  :type uint64
  :bitfield #t
  (feature0 0)
  (feature1 1)
  (feature2 2)
  (feature3 3)
  (feature4 4)
  (gun 5)
  (gun-red-1 6)
  (gun-red-2 7)
  (gun-red-3 8)
  (gun-yellow-1 9)
  (gun-yellow-2 10)
  (gun-yellow-3 11)
  (gun-blue-1 12)
  (gun-blue-2 13)
  (gun-blue-3 14)
  (gun-dark-1 15)
  (gun-dark-2 16)
  (gun-dark-3 17)
  (board 18)
  (feature19 19)
  (sidekick 20)
  (feature21 21)
  (feature22 22)
  (gun-upgrade-yellow-ammo-1 23)
  (gun-upgrade-yellow-ammo-2 24)
  (gun-upgrade-red-ammo-1 25)
  (gun-upgrade-red-ammo-2 26)
  (gun-upgrade-blue-ammo-1 27)
  (gun-upgrade-blue-ammo-2 28)
  (gun-upgrade-dark-ammo-1 29)
  (gun-upgrade-dark-ammo-2 30)
  (feature31 31)
  (feature32 32)
  (feature33 33)
  (feature34 34)
  (feature35 35)
  (feature36 36)
  (board-launch 37)
  (board-trail 38)
  (board-zap 39)
  (darkjak 40)
  (darkjak-smack 41)
  (darkjak-bomb0 42)
  (darkjak-bomb1 43)
  (darkjak-tracking 44)
  (darkjak-invinc 45)
  (lightjak 46)
  (lightjak-regen 47)
  (lightjak-swoop 48)
  (lightjak-freeze 49)
  (lightjak-shield 50)
  (artifact-invis 51)
  (armor0 52)
  (armor1 53)
  (armor2 54)
  (armor3 55)
  (jakc 56)
  (lighteco 57)
  (darkeco 58)
  (feature59 59)
  (feature60 60)
  (feature61 61)
  (feature62 62)
  (feature63 63)
  )
;; ---game-feature


;; +++game-secrets
(defenum game-secrets
  :type uint64
  :bitfield #t
  (hero-mode 0)
  (scene-player-1 1)
  (scene-player-2 2)
  (scene-player-3 3)
  (title-commentary 4)
  (level-select-1 5)
  (level-select-2 6)
  (level-select-3 7)
  (scrap-book-1 8)
  (scrap-book-2 9)
  (scrap-book-3 10)
  (model-viewer-1 11)
  (model-viewer-2 12)
  (model-viewer-3 13)
  (toggle-beard 14)
  (hflip-screen 15)
  (endless-ammo 16)
  (invulnerable 17)
  (endless-dark 18)
  (endless-light 19)
  (gs20 20)
  (gs21 21)
  (gungame-ratchet 22)
  (big-head 23)
  (little-head 24)
  (fast-movie 25)
  (slow-movie 26)
  (unlimited-turbos 27)
  (vehicle-hit-points 28)
  (board-fast 29)
  (vehicle-fox 30)
  (vehicle-mirage 31)
  (vehicle-x-ride 32)
  (kleever-diaper 33)
  (bad-weather 34)
  (fast-weather 35)
  (daxter-pants 36)
  (darkjak-tracking 37)
  (commentary 38)
  (jak-is-jak2 39)
  (button-invis 40)
  (statistics 41)
  (gun-upgrade-red-1 42)
  (gun-upgrade-red-2 43)
  (gun-upgrade-red-3 44)
  (gun-upgrade-yellow-1 45)
  (gun-upgrade-yellow-2 46)
  (gun-upgrade-yellow-3 47)
  (gun-upgrade-blue-1 48)
  (gun-upgrade-blue-2 49)
  (gun-upgrade-blue-3 50)
  (gun-upgrade-dark-1 51)
  (gun-upgrade-dark-2 52)
  (gun-upgrade-dark-3 53)
  (gun-upgrade-ammo-red 54)
  (gun-upgrade-ammo-yellow 55)
  (gun-upgrade-ammo-blue 56)
  (gun-upgrade-ammo-dark 57)
  (gs58 58)
  (gs59 59)
  (gs60 60)
  (gs61 61)
  (gs62 62)
  (gs63 63)
  )
;; ---game-secrets

(defmacro setting-control-func! (func s &rest args)
  (let ((argb #f)
        (argi 0)
        (argf 0.0)
        (setting (car s)))
    (cond
      (#t
        (set! argb (car args))
        (set! argf (cadr args))
        (set! argi (caddr args))
        )
      )
    `(,func *setting-control* (with-pp pp) ,s ,argb ,argf ,argi)
    )
  )

(defmacro add-setting! (s &rest args)
  `(setting-control-func! add-setting ,s ,@args)
  )
(defmacro set-setting! (s &rest args)
  `(setting-control-func! set-setting ,s ,@args)
  )
(defmacro remove-setting! (s)
  `(remove-setting *setting-control* (with-pp pp) ,s)
  )

;; +++game-score
(defenum game-score
  :type uint64
  (none)
  (gs0)
  (gs1)
  (gs2)
  (gs3)
  (gs4)
  (gs5)
  (gs6)
  (gs7)
  (gs8)
  (gs9)
  (gs10)
  (gs11)
  (gs12)
  (gs13)
  (gs14)
  (gs15)
  (gs16)
  (gs17)
  (gs18)
  (gs19)
  (gs20)
  )
;; ---game-score


;; +++game-vehicles
(defenum game-vehicles
  :type uint64
  :bitfield #t
  (v-turtle 0)
  (v-snake 1)
  (v-scorpion 2)
  (v-toad 3)
  (v-fox 4)
  (v-rhino 5)
  (v-mirage 6)
  (v-x-ride 7)
  )
;; ---game-vehicles


(declare-type resetter-spec structure)

;; +++game-vehicle-u8
(defenum game-vehicle-u8
  :type uint8
  :bitfield #t
  :copy-entries game-vehicles
  )
;; ---game-vehicle-u8


;; DECOMP BEGINS

(deftype user-setting-data (structure)
  ((border-mode                      symbol)
   (process-mask                     process-mask)
   (common-page                      int32)
   (language                         language-enum)
   (screenx                          int32)
   (screeny                          int32)
   (vibration                        symbol)
   (play-hints                       symbol)
   (movie                            (pointer process))
   (talking                          (pointer process))
   (spooling                         (pointer process))
   (hint                             (pointer process))
   (ambient                          (pointer process))
   (video-mode                       symbol)
   (aspect-ratio                     symbol)
   (set-video-mode                   symbol)
   (auto-save                        symbol)
   (bg-r                             float)
   (bg-g                             float)
   (bg-b                             float)
   (bg-a                             float)
   (bg-a-speed                       float)
   (bg-a-force                       float)
   (blur-a                           float)
   (blur-a-speed                     float)
   (allow-progress                   symbol)
   (allow-pause                      symbol)
   (ocean-off                        symbol)
   (allow-look-around                symbol)
   (camera-stick-dir                 symbol)
   (movie-name                       symbol)
   (weather                          symbol)
   (mouse                            symbol)
   (cursor                           symbol)
   (keybd                            symbol)
   (task-mask                        task-mask)
   (region-mode                      symbol)
   (duck                             symbol)
   (attack                           symbol)
   (gun                              symbol)
   (board                            symbol)
   (jump                             symbol)
   (speed-mult                       float)
   (features                         game-feature)
   (vehicles                         game-vehicles)
   (sfx-volume                       float)
   (sfx-volume-movie                 float)
   (music-volume                     float)
   (music-volume-movie               float)
   (dialog-volume                    float)
   (dialog-volume-talker             float)
   (ambient-volume                   float)
   (ambient-volume-movie             float)
   (dynamic-ambient-volume           float)
   (talker-volume                    float)
   (sound-flava                      uint8)
   (sound-flava-priority             float)
   (mode-sound-bank                  uint32)
   (sound-excitement                 float)
   (sound-reverb                     float)
   (stereo-mode                      int32)
   (music                            symbol)
   (sound-stinger                    int32)
   (spool-anim                       spool-anim)
   (sound-mode                       uint32)
   (task-manager                     (pointer process))
   (task                             symbol)
   (airlock                          symbol)
   (minimap                          uint32)
   (sound-tune                       uint32)
   (allow-continue                   symbol)
   (spotlight-color                  rgba)
   (highlight-color                  rgba)
   (subtitle                         symbol)
   (doorway                          symbol)
   (gem                              symbol)
   (half-speed                       symbol)
   (gun-buoy                         symbol)
   (double-jump                      symbol)
   (pilot                            symbol)
   (pilot-exit                       symbol)
   (pilot-death                      symbol)
   (speech-control                   symbol)
   (vehicle-hijacking                symbol)
   (darkjak                          symbol)
   (lightjak                         symbol)
   (endlessfall                      symbol)
   (rain                             float)
   (snow                             float)
   (exclusive-load                   symbol)
   (render                           symbol)
   (allow-timeout                    symbol)
   (mirror                           symbol)
   (movie-skip-frame                 float)
   (allow-blackout                   symbol)
   (race-minimap                     int32)
   (beard                            symbol)
   (ignore-target                    symbol)
   (subtitle-language                language-enum)
   (sound-bank-load                  symbol)
   (allow-error                      symbol)
   (under-water-pitch-mod            float)
   (slow-time                        float)
   (scanlines                        float)
   (restart-info                     resetter-spec)
   (fail-info                        resetter-spec)
   (death-info                       resetter-spec)
   (quit-info                        resetter-spec)
   (extra-bank-count                 uint32)
   (extra-bank                       pair   3)
   (borrow-count                     uint32)
   (borrow                           pair   3)
   (exclusive-task-count             uint32)
   (exclusive-task                   int32  3)
   (level-trans-time                 int32)
   (scarf                            float)
   (goggles                          float)
   (board-trail                      symbol)
   (kg-primary-target                handle)
   (ff-primary-target                handle)
   (mh-primary-target                handle)
   (kg-target-float                  float)
   (ff-target-float                  float)
   (target-float                     float)
   (kg-difficulty                    float)
   (fog-special-interp-targ          float)
   (fog-special-interp-rate          float)
   (traffic-spawn                    symbol)
   (stop-vehicle?                    symbol)
   (part-bounds-check                symbol)
   (letterbox                        float)
   (letterbox-speed                  float)
   (minimap-level                    symbol)
   (bigmap-level                     symbol)
   (duststorm-push-player?           symbol)
   (dust-storm-fog-scalar            float)
   (dust-storm-sound-scalar          float)
   (citizen-fights                   symbol)
   (allow-logo                       symbol)
   (brightness                       float)
   (contrast                         float)
   (stop-boats?                      symbol)
   (borrow-city-count                uint32)
   (borrow-city                      pair   3)
   (faction-command-count            uint32)
   (faction-command                  pair   3)
   (change-gun                       symbol)
   (kg-enemy-settings                symbol)
   (ff-enemy-settings                symbol)
   (mh-enemy-settings                symbol)
   (city-heap-load                   float)
   (gun-target-guards?               symbol)
   (freeze-screen                    symbol)
   (borrow-hold-perm-count           uint32)
   (borrow-hold-perm                 pair   3)
   (borrow-hold-count                uint32)
   (borrow-hold                      pair   3)
   (cloth                            symbol)
   (player-control-override          cpad-info)
   (player-control-mask              uint32)
   (gun-special-mode                 symbol)
   (airlock-command                  pair)
   (sky-type                         symbol)
   (global-wind                      symbol)
   (ambient-wind-scalar              float)
   (halfpipe-jump-mult               float)
   (audio-language                   language-enum)
   (armor                            symbol)
   (city-sound                       pair   3)
   (board-max-speed                  float)
   (lock-sound-camera-to-target      symbol)
   (hide-crates?                     symbol)
   (pickups                          symbol)
   (sound-ear                        handle)
   (sound-ear-scale                  float)
   (special-volume                   float)
   (dive                             symbol)
   (timer-warn-seconds               uint32)
   (gem-pool-index                   int32)
   (unique-vehicle-mission-critical  symbol)
   (turbo                            symbol)
   (gun-eject                        symbol)
   (disable-parking-spots?           symbol)
   (gem-seek-target-dir?             symbol)
   (unk-volume                       float)
   (nuke-active?                     symbol)
   (disable-guard-chatter?           symbol)
   (use-alternate-bouncer?           symbol)
   (pad                              uint8  60 :offset 848)
   )
  (:methods
    (user-setting-data-method-9 (_type_ engine engine-pers engine) user-setting-data)
    (user-setting-data-method-10 (_type_ object symbol float uint) user-setting-data)
    )
  )


(deftype cam-setting-data (structure)
  ((fov                            degrees)
   (pov-handle                     handle  :offset  16)
   (pov-bone                       int32)
   (pov-offset                     vector  :inline)
   (string-default                 symbol)
   (string-max-length              meters)
   (string-min-length              meters)
   (string-max-height              meters)
   (string-min-height              meters)
   (string-cliff-height            meters)
   (string-camera-floor            meters)
   (string-camera-ceiling          meters)
   (gun-max-height                 meters)
   (gun-min-height                 meters)
   (string-local-down              vector  :inline)
   (slave-options                  cam-slave-options)
   (matrix-blend-max-angle         degrees)
   (matrix-blend-max-partial       float)
   (string-spline-max-move         meters)
   (string-spline-accel            meters)
   (string-spline-max-move-player  meters)
   (string-spline-accel-player     meters)
   (string-startup-vector          vector  :inline)
   (use-string-startup-vector      symbol)
   (look-at-point                  vector  :inline)
   (use-look-at-point              symbol)
   (target-height                  meters)
   (foot-offset                    meters)
   (head-offset                    meters)
   (teleport-on-entity-change      symbol)
   (entity-name                    string)
   (cam-slope                      string)
   (entity-or-mode-changed         symbol)
   (master-options                 cam-master-options)
   (entity-mask                    uint32)
   (mode-name                      symbol)
   (real-entity-name               string)
   (cam-mode                       symbol)
   (interp-time                    uint32)
   (no-intro                       symbol)
   (use-point-of-interest          symbol)
   (point-of-interest              vector  :inline)
   (handle-of-interest             handle)
   (mouse-tumble-point             vector  :inline)
   (use-mouse-tumble-point         symbol)
   (mouse-input                    symbol)
   (cpad1-skip-buttons             symbol)
   (butt-handle                    handle)
   (butt-angle                     float)
   (extra-follow-height            float)
   (interp-time-priority           uint32)
   (string-max-length-default      symbol)
   (string-min-length-default      symbol)
   (string-max-height-default      symbol)
   (string-min-height-default      symbol)
   (flip-vertical                  symbol)
   (flip-horizontal                symbol)
   (unk-float0                     float)
   (fov-priority                   float)
   (dummy                          object  98)
   )
  (:methods
    (cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_)
    (cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_)
    )
  )


(deftype setting-control (basic)
  ((user-current                  user-setting-data  :inline)
   (user-target                   user-setting-data  :inline)
   (user-default                  user-setting-data  :inline)
   (cam-current                   cam-setting-data   :inline)
   (cam-target                    cam-setting-data   :inline)
   (cam-default                   cam-setting-data   :inline)
   (engine                        engine)
   (engine-pers                   engine-pers)
   (engine-hi                     engine)
   (sound-stinger-time            time-frame)
   (sound-stinger-change-time     time-frame         4)
   (sound-excitement-change-time  time-frame)
   (sound-excitement-targ         float)
   (sound-excitement-level        uint32)
   )
  (:methods
    (new (symbol type int) _type_)
    (add-setting (_type_ process symbol object object object) connection)
    (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none)
    (set-setting (_type_ process symbol object object object) connection)
    (remove-setting (_type_ process symbol) none)
    (kill-persister (_type_ engine-pers object) none)
    (setting-control-method-14 (_type_ object) connectable)
    (get-setting (_type_ object) connectable)
    (remove-setting-by-arg0 (_type_ object) none)
    (set-setting-by-param (_type_ symbol object object object) connection)
    (apply-settings (_type_) user-setting-data)
    (update (_type_) user-setting-data)
    )
  )


(defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int))
  (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
    (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0 connection))
    (set! (-> s4-0 engine-hi) ((method-of-type engine new) allocation engine 'setting-control arg0 connection))
    (set! (-> s4-0 engine-pers)
          ((method-of-type engine-pers new) allocation engine-pers 'setting-control arg0 connection-pers)
          )
    s4-0
    )
  )
