mirror of
https://github.com/open-goal/jak-project
synced 2026-06-28 03:03:29 -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>
177 lines
5.2 KiB
Common Lisp
177 lines
5.2 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: task-control-h.gc
|
|
;; name in dgo: task-control-h
|
|
;; dgos: GAME, ENGINE
|
|
|
|
;; for process-taskable
|
|
(declare-type process-taskable process-drawable)
|
|
(define-extern othercam-init-by-other (function process-taskable symbol symbol symbol none :behavior othercam))
|
|
|
|
;; There are a fixed number of game tasks. Most are just getting a power cell,
|
|
;; but there are also ones for using the levitator etc.
|
|
|
|
;; The list of all tasks is the game-task enum in game-info-h.gc
|
|
|
|
;; the task control contains a list of all cstage.
|
|
;; Each task may have multiple cstages.
|
|
;; Each cstage corresponds to a game-task and a task-status.
|
|
|
|
;; There is a concept of a "current stage" being played, but it may sometimes be invalid (-1).
|
|
;; it is an index into the task-control list
|
|
|
|
;; names from task-status->string function
|
|
;; the status value will increase.
|
|
;; some tasks may do their own thing and not use these values.
|
|
(defenum task-status
|
|
:type uint64
|
|
(invalid 0)
|
|
(unknown 1)
|
|
(need-hint 2)
|
|
(need-introduction 3)
|
|
(need-reminder-a 4)
|
|
(need-reminder 5)
|
|
(need-reward-speech 6)
|
|
(need-resolution 7)
|
|
)
|
|
|
|
;; our names
|
|
(defenum task-flags
|
|
:type uint8
|
|
:bitfield #t
|
|
(closed 0)
|
|
(has-entity 1)
|
|
(closed-by-default 2)
|
|
)
|
|
|
|
(declare-type task-control basic)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype task-cstage (structure)
|
|
((game-task game-task)
|
|
(status task-status)
|
|
(flags task-flags)
|
|
(condition (function task-control symbol))
|
|
)
|
|
(:methods
|
|
(get-task (_type_) game-task)
|
|
(get-status (_type_) task-status)
|
|
(task-available? (_type_ task-control) symbol)
|
|
(closed? (_type_) symbol)
|
|
(closed-by-default? (_type_) symbol)
|
|
(close-task! (_type_) int)
|
|
(open-task! (_type_) int)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype task-control (basic)
|
|
((current-stage int16)
|
|
(stage (array task-cstage))
|
|
)
|
|
(:methods
|
|
(current-task (_type_) game-task)
|
|
(current-status (_type_) task-status)
|
|
(close-current! (_type_) game-task)
|
|
(close-status! (_type_ task-status) game-task)
|
|
(first-any (_type_ symbol) game-task)
|
|
(reset! (_type_ symbol symbol) int)
|
|
(closed? (_type_ game-task task-status) symbol)
|
|
(get-reminder (_type_ int) int)
|
|
(save-reminder (_type_ int int) int)
|
|
(exists? (_type_ game-task task-status) symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype ambient-control (structure)
|
|
((last-ambient-time time-frame)
|
|
(last-ambient string)
|
|
(last-ambient-id sound-id)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(ambient-control-method-9 (_type_) none)
|
|
(ambient-control-method-10 (_type_ vector time-frame float process-drawable) vector)
|
|
(play-ambient (_type_ string symbol vector) symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype process-taskable (process-drawable)
|
|
((root collide-shape :override)
|
|
(tasks task-control)
|
|
(query gui-query :inline)
|
|
(old-target-pos transformq :inline)
|
|
(cell-for-task game-task)
|
|
(cell-x handle)
|
|
(cam-joint-index int32)
|
|
(skippable symbol)
|
|
(blend-on-exit art-joint-anim)
|
|
(camera handle)
|
|
(will-talk symbol)
|
|
(talk-message text-id)
|
|
(last-talk time-frame)
|
|
(bounce-away symbol)
|
|
(ambient ambient-control :inline)
|
|
(center-joint-index int32)
|
|
(draw-bounds-y-offset float)
|
|
(neck-joint-index int32)
|
|
(fuel-cell-anim spool-anim)
|
|
(sound-flava music-flava)
|
|
(have-flava symbol)
|
|
(music symbol)
|
|
(have-music symbol)
|
|
(been-kicked symbol)
|
|
(cur-trans-hook (function none))
|
|
(shadow-backup shadow-geo)
|
|
)
|
|
(:state-methods
|
|
release
|
|
give-cell
|
|
lose
|
|
enter-playing
|
|
play-accept
|
|
play-reject
|
|
query
|
|
play-anim
|
|
hidden
|
|
(be-clone handle)
|
|
idle
|
|
)
|
|
(:methods
|
|
(get-art-elem (_type_) art-element)
|
|
(play-anim! (_type_ symbol) basic)
|
|
(process-taskable-method-33 (_type_) none)
|
|
(get-accept-anim (_type_ symbol) spool-anim)
|
|
(push-accept-anim (_type_) none)
|
|
(get-reject-anim (_type_ symbol) spool-anim)
|
|
(push-reject-anim (_type_) none)
|
|
(process-taskable-method-38 (_type_) none)
|
|
(should-display? (_type_) symbol)
|
|
(process-taskable-method-40 (_type_ object skeleton-group int int vector int) none)
|
|
(initialize-collision (_type_ int vector) none)
|
|
(process-taskable-method-42 (_type_) none)
|
|
(process-taskable-method-43 (_type_) symbol)
|
|
(play-reminder (_type_) symbol)
|
|
(process-taskable-method-45 (_type_) symbol)
|
|
(process-taskable-method-46 (_type_) none)
|
|
(target-above-threshold? (_type_) symbol)
|
|
(draw-npc-shadow (_type_) none)
|
|
(hidden-other () _type_ :state)
|
|
(process-taskable-method-50 (_type_) symbol)
|
|
(close-anim-file! (_type_) symbol)
|
|
(process-taskable-method-52 (_type_) none)
|
|
)
|
|
)
|
|
|
|
(defun-extern task-known? game-task symbol)
|
|
(defun-extern task-control-reset symbol none)
|
|
|
|
(define-extern task-closed? (function game-task task-status symbol))
|
|
(define-extern get-task-status (function game-task task-status))
|
|
(define-extern get-task-control (function game-task task-control))
|
|
(define-extern close-specific-task! (function game-task task-status game-task))
|