mirror of
https://github.com/open-goal/jak-project
synced 2026-08-07 18:23:13 -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>
179 lines
6.0 KiB
Common Lisp
Vendored
Generated
179 lines
6.0 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type hud-icon
|
|
(deftype hud-icon (basic)
|
|
((icon (pointer manipy))
|
|
(icon-y int32)
|
|
(icon-x int32)
|
|
(icon-z int32)
|
|
(scale-x float)
|
|
(scale-y float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type hud-icon
|
|
(defmethod inspect ((this hud-icon))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Ticon: #x~X~%" (-> this icon))
|
|
(format #t "~Ticon-y: ~D~%" (-> this icon-y))
|
|
(format #t "~Ticon-x: ~D~%" (-> this icon-x))
|
|
(format #t "~Ticon-z: ~D~%" (-> this icon-z))
|
|
(format #t "~Tscale-x: ~f~%" (-> this scale-x))
|
|
(format #t "~Tscale-y: ~f~%" (-> this scale-y))
|
|
this
|
|
)
|
|
|
|
;; definition of type hud-particle
|
|
(deftype hud-particle (basic)
|
|
((part sparticle-launch-control)
|
|
(init-pos vector :inline)
|
|
(pos vector :inline)
|
|
(prev-pos vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type hud-particle
|
|
(defmethod inspect ((this hud-particle))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tpart: ~A~%" (-> this part))
|
|
(format #t "~Tinit-pos: #<vector @ #x~X>~%" (-> this init-pos))
|
|
(format #t "~Tpos: #<vector @ #x~X>~%" (-> this pos))
|
|
(format #t "~Tprev-pos: #<vector @ #x~X>~%" (-> this prev-pos))
|
|
this
|
|
)
|
|
|
|
;; definition of type hud
|
|
(deftype hud (process)
|
|
((value int32)
|
|
(value2 int32)
|
|
(target-value int32)
|
|
(last-increment-time time-frame)
|
|
(last-target-equal-time time-frame)
|
|
(offset int32)
|
|
(y-offset int32)
|
|
(next-y-offset int32)
|
|
(x-sgn int32)
|
|
(y-sgn int32)
|
|
(text-x int32)
|
|
(text-y int32)
|
|
(friend int32)
|
|
(first-init symbol)
|
|
(increment-on-event symbol)
|
|
(skip-particle int32)
|
|
(disable symbol)
|
|
(force-on-screen symbol)
|
|
(deactivate-when-hidden symbol)
|
|
(trigger-time time-frame)
|
|
(last-hide-time time-frame)
|
|
(nb-of-icons int32)
|
|
(icons hud-icon 6)
|
|
(max-nb-of-particles int32)
|
|
(nb-of-particles int32)
|
|
(particles hud-particle 7)
|
|
)
|
|
(:methods
|
|
(hidden? (_type_) symbol)
|
|
(draw-hud (_type_) none)
|
|
(tally-value (_type_ int int) none)
|
|
(draw-icons (_type_) none)
|
|
(draw-particles (_type_) none)
|
|
(hud-update (_type_) none)
|
|
(init-particles! (_type_ int) none)
|
|
(get-icon-pos-x (_type_) int)
|
|
(get-icon-pos-y (_type_) int)
|
|
(hud-method-23 (_type_) none)
|
|
(set-pos-and-scale (_type_ symbol symbol) none)
|
|
(get-icon-scale-x (_type_) float)
|
|
(get-icon-scale-y (_type_) float)
|
|
)
|
|
(:states
|
|
hud-arriving
|
|
hud-hidden
|
|
hud-in
|
|
(hud-leaving int)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type hud
|
|
(defmethod inspect ((this hud))
|
|
(let ((t9-0 (method-of-type process inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tvalue: ~D~%" (-> this value))
|
|
(format #t "~T~Tvalue2: ~D~%" (-> this value2))
|
|
(format #t "~T~Ttarget-value: ~D~%" (-> this target-value))
|
|
(format #t "~T~Tlast-increment-time: ~D~%" (-> this last-increment-time))
|
|
(format #t "~T~Tlast-target-equal-time: ~D~%" (-> this last-target-equal-time))
|
|
(format #t "~T~Toffset: ~D~%" (-> this offset))
|
|
(format #t "~T~Ty-offset: ~D~%" (-> this y-offset))
|
|
(format #t "~T~Tnext-y-offset: ~D~%" (-> this next-y-offset))
|
|
(format #t "~T~Tx-sgn: ~D~%" (-> this x-sgn))
|
|
(format #t "~T~Ty-sgn: ~D~%" (-> this y-sgn))
|
|
(format #t "~T~Ttext-x: ~D~%" (-> this text-x))
|
|
(format #t "~T~Ttext-y: ~D~%" (-> this text-y))
|
|
(format #t "~T~Tfriend: ~D~%" (-> this friend))
|
|
(format #t "~T~Tfirst-init: ~A~%" (-> this first-init))
|
|
(format #t "~T~Tincrement-on-event: ~A~%" (-> this increment-on-event))
|
|
(format #t "~T~Tskip-particle: ~D~%" (-> this skip-particle))
|
|
(format #t "~T~Tdisable: ~A~%" (-> this disable))
|
|
(format #t "~T~Tforce-on-screen: ~A~%" (-> this force-on-screen))
|
|
(format #t "~T~Tdeactivate-when-hidden: ~A~%" (-> this deactivate-when-hidden))
|
|
(format #t "~T~Ttrigger-time: ~D~%" (-> this trigger-time))
|
|
(format #t "~T~Tlast-hide-time: ~D~%" (-> this last-hide-time))
|
|
(format #t "~T~Tnb-of-icons: ~D~%" (-> this nb-of-icons))
|
|
(format #t "~T~Ticons[6] @ #x~X~%" (-> this icons))
|
|
(format #t "~T~Tmax-nb-of-particles: ~D~%" (-> this max-nb-of-particles))
|
|
(format #t "~T~Tnb-of-particles: ~D~%" (-> this nb-of-particles))
|
|
(format #t "~T~Tparticles[7] @ #x~X~%" (-> this particles))
|
|
this
|
|
)
|
|
|
|
;; definition of type hud-parts
|
|
(deftype hud-parts (structure)
|
|
((pickups (pointer hud-pickups))
|
|
(money (pointer hud-money))
|
|
(fuel-cell (pointer hud-fuel-cell))
|
|
(health (pointer hud-health))
|
|
(buzzers (pointer hud-buzzers))
|
|
(power (pointer hud-power))
|
|
(bike-speed (pointer hud-bike-speed))
|
|
(bike-heat (pointer hud-bike-heat))
|
|
(money-all (pointer hud-money-all))
|
|
(parts (pointer hud) 9 :overlay-at pickups)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type hud-parts
|
|
(defmethod inspect ((this hud-parts))
|
|
(format #t "[~8x] ~A~%" this 'hud-parts)
|
|
(format #t "~Tdata[9] @ #x~X~%" (&-> this pickups))
|
|
(format #t "~Tpickups: #x~X~%" (-> this pickups))
|
|
(format #t "~Tmoney: #x~X~%" (-> this money))
|
|
(format #t "~Tfuel-cell: #x~X~%" (-> this fuel-cell))
|
|
(format #t "~Thealth: #x~X~%" (-> this health))
|
|
(format #t "~Tbuzzers: #x~X~%" (-> this buzzers))
|
|
(format #t "~Tpower: #x~X~%" (-> this power))
|
|
(format #t "~Tbike-speed: #x~X~%" (-> this bike-speed))
|
|
(format #t "~Tbike-heat: #x~X~%" (-> this bike-heat))
|
|
(format #t "~Tmoney-all: #x~X~%" (-> this money-all))
|
|
this
|
|
)
|
|
|
|
;; definition for symbol *hud-parts*, type hud-parts
|
|
(define *hud-parts* (new 'static 'hud-parts
|
|
:pickups #f
|
|
:money #f
|
|
:fuel-cell #f
|
|
:health #f
|
|
:buzzers #f
|
|
:power #f
|
|
:bike-speed #f
|
|
:bike-heat #f
|
|
:money-all #f
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|