mirror of
https://github.com/open-goal/jak-project
synced 2026-08-19 22:12:24 -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>
275 lines
11 KiB
Common Lisp
Vendored
Generated
275 lines
11 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
(local-vars (gp-0 game-info))
|
|
|
|
;; definition of type game-bank
|
|
(deftype game-bank (basic)
|
|
((life-max-default float)
|
|
(life-start-default float)
|
|
(life-single-inc float)
|
|
(money-task-inc float)
|
|
(money-oracle-inc float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type game-bank
|
|
(defmethod inspect ((this game-bank))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tlife-max-default: ~f~%" (-> this life-max-default))
|
|
(format #t "~Tlife-start-default: ~f~%" (-> this life-start-default))
|
|
(format #t "~Tlife-single-inc: ~f~%" (-> this life-single-inc))
|
|
(format #t "~Tmoney-task-inc: ~f~%" (-> this money-task-inc))
|
|
(format #t "~Tmoney-oracle-inc: ~f~%" (-> this money-oracle-inc))
|
|
this
|
|
)
|
|
|
|
;; definition for symbol *GAME-bank*, type game-bank
|
|
(define *GAME-bank* (new 'static 'game-bank
|
|
:life-max-default 99.0
|
|
:life-start-default 5.0
|
|
:life-single-inc 1.0
|
|
:money-task-inc 90.0
|
|
:money-oracle-inc 120.0
|
|
)
|
|
)
|
|
|
|
;; definition of type actor-id
|
|
(deftype actor-id (uint32)
|
|
()
|
|
)
|
|
|
|
;; definition of type level-buffer-state
|
|
(deftype level-buffer-state (structure)
|
|
((name symbol)
|
|
(display? symbol)
|
|
(force-vis? symbol)
|
|
(force-inside? symbol)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
;; definition for method 3 of type level-buffer-state
|
|
(defmethod inspect ((this level-buffer-state))
|
|
(format #t "[~8x] ~A~%" this 'level-buffer-state)
|
|
(format #t "~Tname: ~A~%" (-> this name))
|
|
(format #t "~Tdisplay?: ~A~%" (-> this display?))
|
|
(format #t "~Tforce-vis?: ~A~%" (-> this force-vis?))
|
|
(format #t "~Tforce-inside?: ~A~%" (-> this force-inside?))
|
|
this
|
|
)
|
|
|
|
;; definition of type load-state
|
|
(deftype load-state (basic)
|
|
((want level-buffer-state 2 :inline)
|
|
(vis-nick symbol)
|
|
(command-list pair)
|
|
(object-name symbol 256)
|
|
(object-status basic 256)
|
|
)
|
|
(:methods
|
|
(new (symbol type) _type_)
|
|
(reset! (_type_) _type_)
|
|
(update! (_type_) int)
|
|
(want-levels (_type_ symbol symbol) int)
|
|
(want-display-level (_type_ symbol symbol) int)
|
|
(want-vis (_type_ symbol) int)
|
|
(want-force-vis (_type_ symbol symbol) int)
|
|
(execute-command (_type_ pair) none)
|
|
(execute-commands-up-to (_type_ float) int)
|
|
(backup-load-state-and-set-cmds (_type_ pair) int)
|
|
(restore-load-state-and-cleanup (_type_) int)
|
|
(restore-load-state (_type_) int)
|
|
(set-force-inside! (_type_ symbol symbol) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type load-state
|
|
(defmethod inspect ((this load-state))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Twant[2] @ #x~X~%" (-> this want))
|
|
(format #t "~Tvis-nick: ~A~%" (-> this vis-nick))
|
|
(format #t "~Tcommand-list: ~A~%" (-> this command-list))
|
|
(format #t "~Tobject-name[256] @ #x~X~%" (-> this object-name))
|
|
(format #t "~Tobject-status[256] @ #x~X~%" (-> this object-status))
|
|
this
|
|
)
|
|
|
|
;; definition for method 0 of type load-state
|
|
(defmethod new load-state ((allocation symbol) (type-to-make type))
|
|
(reset! (object-new allocation type-to-make (the-as int (-> type-to-make size))))
|
|
)
|
|
|
|
;; definition of type continue-point
|
|
(deftype continue-point (basic)
|
|
((name string)
|
|
(level symbol)
|
|
(flags continue-flags)
|
|
(trans vector :inline)
|
|
(quat quaternion :inline)
|
|
(camera-trans vector :inline)
|
|
(camera-rot float 9)
|
|
(load-commands pair)
|
|
(vis-nick symbol)
|
|
(lev0 symbol)
|
|
(disp0 symbol)
|
|
(lev1 symbol)
|
|
(disp1 symbol)
|
|
)
|
|
(:methods
|
|
(debug-draw! (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type continue-point
|
|
(defmethod inspect ((this continue-point))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tname: ~A~%" (-> this name))
|
|
(format #t "~Tlevel: ~A~%" (-> this level))
|
|
(format #t "~Tflags: ~D~%" (-> this flags))
|
|
(format #t "~Ttrans: ~`vector`P~%" (-> this trans))
|
|
(format #t "~Tquat: ~`vector`P~%" (-> this quat))
|
|
(format #t "~Tcamera-trans: ~`vector`P~%" (-> this camera-trans))
|
|
(format #t "~Tcamera-rot[9] @ #x~X~%" (-> this camera-rot))
|
|
(format #t "~Tload-commands: ~A~%" (-> this load-commands))
|
|
(format #t "~Tvis-nick: ~A~%" (-> this vis-nick))
|
|
(format #t "~Tlev0: ~A~%" (-> this lev0))
|
|
(format #t "~Tdisp0: ~A~%" (-> this disp0))
|
|
(format #t "~Tlev1: ~A~%" (-> this lev1))
|
|
(format #t "~Tdisp1: ~A~%" (-> this disp1))
|
|
this
|
|
)
|
|
|
|
;; definition of type game-info
|
|
(deftype game-info (basic)
|
|
((mode symbol)
|
|
(save-name basic)
|
|
(life float)
|
|
(life-max float)
|
|
(money float)
|
|
(money-total float)
|
|
(money-per-level uint8 32)
|
|
(deaths-per-level uint8 32)
|
|
(buzzer-total float)
|
|
(fuel float)
|
|
(perm-list entity-perm-array)
|
|
(task-perm-list entity-perm-array)
|
|
(current-continue continue-point)
|
|
(text-ids-seen bit-array)
|
|
(level-opened uint8 32)
|
|
(hint-control (array level-hint-control))
|
|
(task-hint-control (array task-hint-control-group))
|
|
(total-deaths int32)
|
|
(continue-deaths int32)
|
|
(fuel-cell-deaths int32)
|
|
(game-start-time time-frame)
|
|
(continue-time time-frame)
|
|
(death-time time-frame)
|
|
(hit-time time-frame)
|
|
(fuel-cell-pickup-time time-frame)
|
|
(fuel-cell-time (array time-frame))
|
|
(enter-level-time (array time-frame))
|
|
(in-level-time (array time-frame))
|
|
(blackout-time time-frame)
|
|
(letterbox-time time-frame)
|
|
(hint-play-time time-frame)
|
|
(display-text-time time-frame)
|
|
(display-text-handle handle)
|
|
(death-movie-tick int32)
|
|
(want-auto-save symbol)
|
|
(auto-save-proc handle)
|
|
(auto-save-status mc-status-code)
|
|
(auto-save-card int32)
|
|
(auto-save-which int32)
|
|
(pov-camera-handle handle)
|
|
(other-camera-handle handle)
|
|
(death-pos vector-array)
|
|
(dummy basic)
|
|
(auto-save-count int32)
|
|
)
|
|
(:methods
|
|
(initialize! (_type_ symbol game-save string) _type_)
|
|
(adjust (_type_ symbol float handle) float)
|
|
(task-complete? (_type_ game-task) symbol)
|
|
(lookup-entity-perm-by-aid (_type_ actor-id) entity-perm)
|
|
(get-entity-task-perm (_type_ game-task) entity-perm)
|
|
(copy-perms-from-level! (_type_ level) none)
|
|
(copy-perms-to-level! (_type_ level) none)
|
|
(debug-print (_type_ symbol) _type_)
|
|
(get-or-create-continue! (_type_) continue-point)
|
|
(get-continue-by-name (_type_ string) continue-point)
|
|
(set-continue! (_type_ basic) continue-point)
|
|
(buzzer-count (_type_ game-task) int)
|
|
(seen-text? (_type_ text-id) symbol)
|
|
(mark-text-as-seen (_type_ text-id) none)
|
|
(got-buzzer? (_type_ game-task int) symbol)
|
|
(save-game! (_type_ game-save string) none)
|
|
(load-game! (_type_ game-save) game-save)
|
|
(clear-text-seen! (_type_ text-id) none)
|
|
(get-death-count (_type_ symbol) int)
|
|
(get-health-percent-lost (_type_ symbol) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type game-info
|
|
(defmethod inspect ((this game-info))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tmode: ~A~%" (-> this mode))
|
|
(format #t "~Tsave-name: ~A~%" (-> this save-name))
|
|
(format #t "~Tlife: ~f~%" (-> this life))
|
|
(format #t "~Tlife-max: ~f~%" (-> this life-max))
|
|
(format #t "~Tmoney: ~f~%" (-> this money))
|
|
(format #t "~Tmoney-total: ~f~%" (-> this money-total))
|
|
(format #t "~Tmoney-per-level[32] @ #x~X~%" (-> this money-per-level))
|
|
(format #t "~Tdeaths-per-level[32] @ #x~X~%" (-> this deaths-per-level))
|
|
(format #t "~Tbuzzer-total: ~f~%" (-> this buzzer-total))
|
|
(format #t "~Tfuel: ~f~%" (-> this fuel))
|
|
(format #t "~Tperm-list: ~A~%" (-> this perm-list))
|
|
(format #t "~Ttask-perm-list: ~A~%" (-> this task-perm-list))
|
|
(format #t "~Tcurrent-continue: ~A~%" (-> this current-continue))
|
|
(format #t "~Ttext-ids-seen: ~A~%" (-> this text-ids-seen))
|
|
(format #t "~Tlevel-opened[32] @ #x~X~%" (-> this level-opened))
|
|
(format #t "~Thint-control: ~A~%" (-> this hint-control))
|
|
(format #t "~Ttask-hint-control: ~A~%" (-> this task-hint-control))
|
|
(format #t "~Ttotal-deaths: ~D~%" (-> this total-deaths))
|
|
(format #t "~Tcontinue-deaths: ~D~%" (-> this continue-deaths))
|
|
(format #t "~Tfuel-cell-deaths: ~D~%" (-> this fuel-cell-deaths))
|
|
(format #t "~Tgame-start-time: ~D~%" (-> this game-start-time))
|
|
(format #t "~Tcontinue-time: ~D~%" (-> this continue-time))
|
|
(format #t "~Tdeath-time: ~D~%" (-> this death-time))
|
|
(format #t "~Thit-time: ~D~%" (-> this hit-time))
|
|
(format #t "~Tfuel-cell-pickup-time: ~D~%" (-> this fuel-cell-pickup-time))
|
|
(format #t "~Tfuel-cell-time: ~A~%" (-> this fuel-cell-time))
|
|
(format #t "~Tenter-level-time: ~A~%" (-> this enter-level-time))
|
|
(format #t "~Tin-level-time: ~A~%" (-> this in-level-time))
|
|
(format #t "~Tblackout-time: ~D~%" (-> this blackout-time))
|
|
(format #t "~Tletterbox-time: ~D~%" (-> this letterbox-time))
|
|
(format #t "~Thint-play-time: ~D~%" (-> this hint-play-time))
|
|
(format #t "~Tdisplay-text-time: ~D~%" (-> this display-text-time))
|
|
(format #t "~Tdisplay-text-handle: ~D~%" (-> this display-text-handle))
|
|
(format #t "~Tdeath-movie-tick: ~D~%" (-> this death-movie-tick))
|
|
(format #t "~Twant-auto-save: ~A~%" (-> this want-auto-save))
|
|
(format #t "~Tauto-save-proc: ~D~%" (-> this auto-save-proc))
|
|
(format #t "~Tauto-save-status: ~D~%" (-> this auto-save-status))
|
|
(format #t "~Tauto-save-card: ~D~%" (-> this auto-save-card))
|
|
(format #t "~Tauto-save-which: ~D~%" (-> this auto-save-which))
|
|
(format #t "~Tpov-camera-handle: ~D~%" (-> this pov-camera-handle))
|
|
(format #t "~Tother-camera-handle: ~D~%" (-> this other-camera-handle))
|
|
(format #t "~Tdeath-pos: ~A~%" (-> this death-pos))
|
|
(format #t "~Tdummy: ~A~%" (-> this dummy))
|
|
(format #t "~Tauto-save-count: ~D~%" (-> this auto-save-count))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set! gp-0
|
|
(when (or (not *game-info*) (zero? *game-info*))
|
|
(set! gp-0 (new 'static 'game-info :mode 'debug :current-continue #f))
|
|
(set! (-> gp-0 fuel-cell-time) (the-as (array time-frame) (new 'global 'boxed-array uint64 116)))
|
|
(set! (-> gp-0 enter-level-time) (the-as (array time-frame) (new 'global 'boxed-array uint64 32)))
|
|
(set! (-> gp-0 in-level-time) (the-as (array time-frame) (new 'global 'boxed-array uint64 32)))
|
|
(set! *game-info* gp-0)
|
|
gp-0
|
|
)
|
|
)
|