mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
339 lines
11 KiB
Common Lisp
339 lines
11 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)
|
|
(process-mask process-mask)
|
|
(unknown-int32-00 int32)
|
|
(language language-enum :offset 16)
|
|
(display-dx int32)
|
|
(display-dy int32)
|
|
(vibration symbol :offset 32)
|
|
(play-hints symbol :offset 36)
|
|
(movie (pointer process) :offset 40)
|
|
(talking (pointer process))
|
|
(spooling (pointer process))
|
|
(hint (pointer process))
|
|
(ambient (pointer process))
|
|
(video-mode symbol)
|
|
(aspect-ratio symbol)
|
|
(use-progressive-scan symbol :offset 68)
|
|
(auto-save symbol :offset 72)
|
|
(bg-r float)
|
|
(bg-g float)
|
|
(bg-b float)
|
|
(bg-a float)
|
|
(bg-a-speed float)
|
|
(bg-a-force float)
|
|
(allow-progress symbol)
|
|
(allow-pause symbol)
|
|
(ocean-off symbol)
|
|
(allow-look-around symbol)
|
|
(camera-stick-dir symbol)
|
|
(movie-name symbol :offset 120)
|
|
(weather symbol)
|
|
(mouse symbol)
|
|
(cursor symbol)
|
|
(task-mask task-mask :offset 136)
|
|
(region-mode symbol)
|
|
(duck symbol :offset 144)
|
|
(attack symbol)
|
|
(gun symbol)
|
|
(board symbol)
|
|
(jump symbol)
|
|
(speed-mult float)
|
|
(features game-feature)
|
|
(sfx-volume float)
|
|
(sfx-movie-volume float)
|
|
(music-volume float)
|
|
(music-volume-movie float)
|
|
(dialog-volume float)
|
|
(dialog-volume-hint float)
|
|
(ambient-volume float)
|
|
(ambient-volume-move 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 uint16)
|
|
(sound-tune uint32)
|
|
(allow-continue symbol)
|
|
(spotlight-color rgba)
|
|
(subtitle symbol)
|
|
(borrow pair)
|
|
(doorway symbol)
|
|
(gem symbol)
|
|
(half-speed symbol)
|
|
(gun-buoy symbol)
|
|
(double-jump symbol)
|
|
(pilot symbol)
|
|
(pilot-exit symbol)
|
|
(exclusive-task int32)
|
|
(speech-control symbol)
|
|
(vehicle-hijacking symbol)
|
|
(darkjak 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)
|
|
(extra-bank pair)
|
|
(beard symbol)
|
|
(ignore-target symbol)
|
|
(subtitle-language language-enum)
|
|
(sound-bank-load symbol)
|
|
(allow-error symbol)
|
|
(under-water-pitch-mod float)
|
|
(dummy object 31)
|
|
)
|
|
(: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-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)
|
|
(string-use-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)
|
|
(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)
|
|
(dummy object 102)
|
|
)
|
|
(: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) none)
|
|
(persist-with-delay (_type_ symbol time-frame symbol symbol float int) none)
|
|
(set-setting (_type_ process symbol object object object) none)
|
|
(remove-setting (_type_ process symbol) none)
|
|
(kill-persister (_type_ engine-pers object) none)
|
|
(setting-control-method-14 (_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
|
|
)
|
|
)
|
|
|
|
;; 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)))
|
|
|