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>
368 lines
4.9 KiB
Common Lisp
368 lines
4.9 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: hud-h.gc
|
|
;; name in dgo: hud-h
|
|
;; dgos: ENGINE, GAME
|
|
|
|
(defenum hud-flags
|
|
:type uint32
|
|
:bitfield #t
|
|
(disable 0)
|
|
(should-die 1)
|
|
(show 2)
|
|
)
|
|
|
|
;; NOTE - for progress
|
|
(define-extern hide-hud (function symbol none))
|
|
(define-extern hud-hidden? (function symbol))
|
|
(declare-type hud-sprite structure)
|
|
(define-extern set-hud-piece-position! (function hud-sprite int int none))
|
|
(define-extern show-hud (function object none))
|
|
(declare-type hud process)
|
|
(define-extern hud-init-by-other (function object :behavior hud))
|
|
(define-extern hud-arriving (state hud))
|
|
(define-extern hud-leaving (state float hud))
|
|
(define-extern hud-in (state hud))
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype hud-string (basic)
|
|
((text string)
|
|
(scale float)
|
|
(color font-color)
|
|
(flags font-flags)
|
|
(pos int32 4 :offset 32)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
|
|
(deftype hud-sprite (structure)
|
|
((pos vector4w :inline)
|
|
(color vector4w :inline)
|
|
(color2 int32 4 :overlay-at (-> color data 0))
|
|
(flags uint32)
|
|
(scale-x float)
|
|
(scale-y float)
|
|
(angle float)
|
|
(tex texture)
|
|
)
|
|
(:methods
|
|
(draw (_type_ dma-buffer level) none)
|
|
(hud-sprite-method-10 (_type_ dma-buffer level int int int int) object)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype hud-box (structure)
|
|
((min vector2 :inline)
|
|
(max vector2 :inline)
|
|
(color vector4w :inline)
|
|
)
|
|
(:methods
|
|
(draw-box-prim-only (_type_ dma-buffer) none)
|
|
(draw-box-alpha-1 (_type_ dma-buffer) none)
|
|
(draw-box-alpha-2 (_type_ dma-buffer) none)
|
|
(draw-box-alpha-3 (_type_ dma-buffer) none)
|
|
(draw-scan-and-line (_type_ dma-buffer float) int)
|
|
(setup-scissor (_type_ dma-buffer) none)
|
|
(restore-scissor (_type_ dma-buffer) none)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype hud-icon (basic)
|
|
((icon (pointer manipy))
|
|
(pos int32 4 :offset 16)
|
|
(scale-x float)
|
|
(scale-y float)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
|
|
(deftype hud-value (basic)
|
|
((current int32)
|
|
(target int32)
|
|
(flags uint16)
|
|
(counter uint16)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
|
|
(deftype hud (process)
|
|
((trigger-time time-frame)
|
|
(last-hide-time time-frame)
|
|
(offset float)
|
|
(flags hud-flags)
|
|
(values hud-value 8 :inline :overlay-at flags)
|
|
(strings hud-string 14 :inline :offset 284)
|
|
(sprites hud-sprite 30 :inline :offset 960)
|
|
(icons hud-icon 2 :inline :offset 2876)
|
|
(gui-id sound-id :offset 2976)
|
|
)
|
|
(:methods
|
|
(hidden? (_type_) symbol)
|
|
(draw (_type_) none)
|
|
(update-values (_type_) none)
|
|
(init-callback (_type_) none)
|
|
(event-callback (_type_ process int symbol event-message-block) symbol)
|
|
(hud-method-19 (_type_) none)
|
|
(hud-method-20 (_type_) none)
|
|
(hud-method-21 (_type_) none)
|
|
(hud-method-22 (_type_) none)
|
|
(hud-method-23 (_type_) none)
|
|
(check-ready-and-maybe-show (_type_ symbol) symbol)
|
|
(update-value-callback (_type_ int int) none)
|
|
(alloc-string-if-needed (_type_ int) none)
|
|
)
|
|
(:states
|
|
hud-arriving
|
|
hud-hidden
|
|
hud-in
|
|
(hud-leaving float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype hud-ashelin (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-cargo (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-citizen (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-cpanel (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-dig-clasp (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-gun (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-health (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-dark-eco-symbol (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-helldog (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-lurker (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-map (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-moneybag (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-pegasus (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-plasmite (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-dig-button (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-predator (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-heatmeter (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-progress (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-rocketsensor (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-ruffians (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-score (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-sig (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-skill (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-skullgem (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-timer (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-turret (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-squid (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-gunturret (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-gruntegg (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-crimsonhover (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-metalkor (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-big-score (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-goal (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-miss (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-timer (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-lap-counter (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-turbo-counter (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-position (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-map (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-samos-old (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-samos-young (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-lurker-button (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-widow (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-race-final-stats (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-mech-air-tank (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-homing-beacon (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-dark-eco-pickup (hud)
|
|
()
|
|
)
|
|
|
|
|
|
(deftype hud-green-eco-pickup (hud)
|
|
()
|
|
)
|