jak-project/goal_src/jak2/engine/game/settings-h.gc
Hat Kid fc43870d85
decompiler: obj -> this, set-time! and time-elapsed? macros (#3026)
This renames the method object in `defmethod`s to `this` and adds
detection for the `set-time!` and `time-elapsed?` macros.

Definitely my biggest PR yet...
2023-09-26 15:17:00 +01:00

348 lines
16 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: settings-h.gc
;; name in dgo: settings-h
;; dgos: ENGINE, GAME
(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)
)
(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
(READ_BUTTONS) ;; 40
(IMMEDIATE_STRING_MIN_MAX) ;; 80
)
(defenum cam-slave-options-u32
:type uint32
:bitfield #t
:copy-entries cam-slave-options)
(defenum cam-master-options-u32
:type uint32
:bitfield #t
:copy-entries cam-master-options)
(declare-type setting-control basic)
(define-extern *setting-control* setting-control)
(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)
)
(defenum game-feature
:type uint64
:bitfield #t
(unk-game-feature-01)
(unk-game-feature-02)
(unk-game-feature-03)
(unk-game-feature-04)
(unk-game-feature-05)
(gun) ;; used for having any gun.
(gun-yellow)
(gun-red)
(gun-blue)
(gun-dark)
(board)
(carry)
(sidekick)
(darkjak)
(gun-upgrade-speed)
(gun-upgrade-ammo)
(gun-upgrade-damage)
(unk-game-feature-18)
(pass-red)
(pass-green)
(pass-yellow)
(pass-blue)
(darkjak-bomb0)
(darkjak-bomb1)
(darkjak-invinc)
(darkjak-giant)
(board-training))
;; DECOMP BEGINS
(deftype user-setting-data (structure)
((border-mode symbol :offset-assert 0)
(process-mask process-mask :offset-assert 4)
(unknown-int32-00 int32 :offset-assert 8)
(language language-enum :offset 16)
(display-dx int32 :offset-assert 24)
(display-dy int32 :offset-assert 28)
(vibration symbol :offset 32)
(play-hints symbol :offset 36)
(movie (pointer process) :offset 40)
(talking (pointer process) :offset-assert 44)
(spooling (pointer process) :offset-assert 48)
(hint (pointer process) :offset-assert 52)
(ambient (pointer process) :offset-assert 56)
(video-mode symbol :offset-assert 60)
(aspect-ratio symbol :offset-assert 64)
(use-progressive-scan symbol :offset 68)
(auto-save symbol :offset 72)
(bg-r float :offset-assert 76)
(bg-g float :offset-assert 80)
(bg-b float :offset-assert 84)
(bg-a float :offset-assert 88)
(bg-a-speed float :offset-assert 92)
(bg-a-force float :offset-assert 96)
(allow-progress symbol :offset-assert 100)
(allow-pause symbol :offset-assert 104)
(ocean-off symbol :offset-assert 108)
(allow-look-around symbol :offset-assert 112)
(camera-stick-dir symbol :offset-assert 116)
(movie-name symbol :offset 120)
(weather symbol :offset-assert 124)
(mouse symbol :offset-assert 128)
(cursor symbol :offset-assert 132)
(task-mask task-mask :offset 136)
(region-mode symbol :offset-assert 140)
(duck symbol :offset 144)
(attack symbol :offset-assert 148)
(gun symbol :offset-assert 152)
(board symbol :offset-assert 156)
(jump symbol :offset-assert 160)
(speed-mult float :offset-assert 164)
(features game-feature :offset-assert 168)
(sfx-volume float :offset-assert 176)
(sfx-movie-volume float :offset-assert 180)
(music-volume float :offset-assert 184)
(music-volume-movie float :offset-assert 188)
(dialog-volume float :offset-assert 192)
(dialog-volume-hint float :offset-assert 196)
(ambient-volume float :offset-assert 200)
(ambient-volume-move float :offset-assert 204)
(sound-flava uint8 :offset-assert 208)
(sound-flava-priority float :offset-assert 212)
(mode-sound-bank uint32 :offset-assert 216)
(sound-excitement float :offset-assert 220)
(sound-reverb float :offset-assert 224)
(stereo-mode int32 :offset-assert 228)
(music symbol :offset-assert 232)
(sound-stinger int32 :offset-assert 236)
(spool-anim spool-anim :offset-assert 240)
(sound-mode uint32 :offset-assert 244)
(task-manager (pointer process) :offset-assert 248)
(task symbol :offset-assert 252)
(airlock symbol :offset-assert 256)
(minimap uint16 :offset-assert 260)
(sound-tune uint32 :offset-assert 264)
(allow-continue symbol :offset-assert 268)
(spotlight-color rgba :offset-assert 272)
(subtitle symbol :offset-assert 276)
(borrow pair :offset-assert 280)
(doorway symbol :offset-assert 284)
(gem symbol :offset-assert 288)
(half-speed symbol :offset-assert 292)
(gun-buoy symbol :offset-assert 296)
(double-jump symbol :offset-assert 300)
(pilot symbol :offset-assert 304)
(pilot-exit symbol :offset-assert 308)
(exclusive-task int32 :offset-assert 312)
(speech-control symbol :offset-assert 316)
(vehicle-hijacking symbol :offset-assert 320)
(darkjak symbol :offset-assert 324)
(endlessfall symbol :offset-assert 328)
(rain float :offset-assert 332)
(snow float :offset-assert 336)
(exclusive-load symbol :offset-assert 340)
(render symbol :offset-assert 344)
(allow-timeout symbol :offset-assert 348)
(mirror symbol :offset-assert 352)
(movie-skip-frame float :offset-assert 356)
(allow-blackout symbol :offset-assert 360)
(race-minimap int32 :offset-assert 364)
(extra-bank pair :offset-assert 368)
(beard symbol :offset-assert 372)
(ignore-target symbol :offset-assert 376)
(subtitle-language language-enum :offset-assert 384)
(sound-bank-load symbol :offset-assert 392)
(allow-error symbol :offset-assert 396)
(under-water-pitch-mod float :offset-assert 400)
(dummy object 31 :offset-assert 404)
)
:method-count-assert 11
:size-assert #x210
:flag-assert #xb00000210
(:methods
(user-setting-data-method-9 (_type_ engine engine-pers engine) user-setting-data 9)
(user-setting-data-method-10 (_type_ object symbol float uint) user-setting-data 10)
)
)
(deftype cam-setting-data (structure)
((fov degrees :offset-assert 0)
(pov-handle handle :offset 16)
(pov-bone int32 :offset-assert 24)
(pov-offset vector :inline :offset-assert 32)
(string-default symbol :offset-assert 48)
(string-max-length meters :offset-assert 52)
(string-min-length meters :offset-assert 56)
(string-max-height meters :offset-assert 60)
(string-min-height meters :offset-assert 64)
(string-cliff-height meters :offset-assert 68)
(string-camera-ceiling meters :offset-assert 72)
(gun-max-height meters :offset-assert 76)
(gun-min-height meters :offset-assert 80)
(string-local-down vector :inline :offset-assert 96)
(slave-options cam-slave-options :offset-assert 112)
(matrix-blend-max-angle degrees :offset-assert 120)
(matrix-blend-max-partial float :offset-assert 124)
(string-spline-max-move meters :offset-assert 128)
(string-spline-accel meters :offset-assert 132)
(string-spline-max-move-player meters :offset-assert 136)
(string-spline-accel-player meters :offset-assert 140)
(string-startup-vector vector :inline :offset-assert 144)
(string-use-startup-vector symbol :offset-assert 160)
(look-at-point vector :inline :offset-assert 176)
(use-look-at-point symbol :offset-assert 192)
(target-height meters :offset-assert 196)
(foot-offset meters :offset-assert 200)
(head-offset meters :offset-assert 204)
(teleport-on-entity-change symbol :offset-assert 208)
(entity-name string :offset-assert 212)
(entity-or-mode-changed symbol :offset-assert 216)
(master-options cam-master-options :offset-assert 224)
(entity-mask uint32 :offset-assert 232)
(mode-name symbol :offset-assert 236)
(real-entity-name string :offset-assert 240)
(cam-mode symbol :offset-assert 244)
(interp-time uint32 :offset-assert 248)
(no-intro symbol :offset-assert 252)
(use-point-of-interest symbol :offset-assert 256)
(point-of-interest vector :inline :offset-assert 272)
(handle-of-interest handle :offset-assert 288)
(mouse-tumble-point vector :inline :offset-assert 304)
(use-mouse-tumble-point symbol :offset-assert 320)
(mouse-input symbol :offset-assert 324)
(cpad1-skip-buttons symbol :offset-assert 328)
(butt-handle handle :offset-assert 336)
(butt-angle float :offset-assert 344)
(extra-follow-height float :offset-assert 348)
(interp-time-priority uint32 :offset-assert 352)
(string-max-length-default symbol :offset-assert 356)
(string-min-length-default symbol :offset-assert 360)
(string-max-height-default symbol :offset-assert 364)
(string-min-height-default symbol :offset-assert 368)
(dummy object 102 :offset-assert 372)
)
:method-count-assert 11
:size-assert #x30c
:flag-assert #xb0000030c
(:methods
(cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_ 9)
(cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_ 10)
)
)
(deftype setting-control (basic)
((user-current user-setting-data :inline :offset-assert 16)
(user-target user-setting-data :inline :offset-assert 544)
(user-default user-setting-data :inline :offset-assert 1072)
(cam-current cam-setting-data :inline :offset-assert 1600)
(cam-target cam-setting-data :inline :offset-assert 2384)
(cam-default cam-setting-data :inline :offset-assert 3168)
(engine engine :offset-assert 3948)
(engine-pers engine-pers :offset-assert 3952)
(engine-hi engine :offset-assert 3956)
(sound-stinger-time time-frame :offset-assert 3960)
(sound-stinger-change-time time-frame 4 :offset-assert 3968)
(sound-excitement-change-time time-frame :offset-assert 4000)
(sound-excitement-targ float :offset-assert 4008)
(sound-excitement-level uint32 :offset-assert 4012)
)
:method-count-assert 19
:size-assert #xfb0
:flag-assert #x1300000fb0
(:methods
(new (symbol type int) _type_ 0)
(add-setting (_type_ process symbol object object object) none 9)
(persist-with-delay (_type_ symbol time-frame symbol symbol float int) none 10)
(set-setting (_type_ process symbol object object object) none 11)
(remove-setting (_type_ process symbol) none 12)
(kill-persister (_type_ engine-pers object) none 13)
(setting-control-method-14 (_type_ object) connectable 14)
(remove-setting-by-arg0 (_type_ object) none 15)
(set-setting-by-param (_type_ symbol object object object) connection 16)
(apply-settings (_type_) user-setting-data 17)
(update (_type_) user-setting-data 18)
)
)
(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
)
)
;; og:preserve-this added macro
(defmacro language? (&rest langs)
"is the current language any of the ones specified?"
`(or ,@(apply (lambda (x) `(= (-> *setting-control* user-default language) (language-enum ,x))) langs)))