Files
jak-project/test/decompiler/reference/jak2/engine/scene/scene-h_REF.gc
T
ManDude cd68cb671e deftype and defmethod syntax major changes (#3094)
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>
2023-10-30 03:20:02 +00:00

212 lines
7.7 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type scene-actor
(deftype scene-actor (basic)
((name string)
(level symbol)
(art-group string)
(prefix string)
(draw-frames pair)
(scissor-frames pair)
(camera int16)
(light-index uint8)
(shadow-mask uint8)
(shadow-values uint32)
(flags uint32)
(command-list basic)
(shadow-flags int32)
(shadow-volume-joint basic)
(draw-seg uint64)
(no-draw-seg uint64)
(process handle)
)
(:methods
(scene-actor-method-9 (_type_ scene-player) (pointer process))
)
)
;; definition for method 3 of type scene-actor
(defmethod inspect ((this scene-actor))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Tlevel: ~A~%" (-> this level))
(format #t "~1Tart-group: ~A~%" (-> this art-group))
(format #t "~1Tprefix: ~A~%" (-> this prefix))
(format #t "~1Tdraw-frames: ~A~%" (-> this draw-frames))
(format #t "~1Tscissor-frames: ~A~%" (-> this scissor-frames))
(format #t "~1Tcamera: ~D~%" (-> this camera))
(format #t "~1Tlight-index: ~D~%" (-> this light-index))
(format #t "~1Tshadow-mask: ~D~%" (-> this shadow-mask))
(format #t "~1Tshadow-values: ~D~%" (-> this shadow-values))
(format #t "~1Tflags: ~D~%" (-> this flags))
(format #t "~1Tcommand-list: ~A~%" (-> this command-list))
(format #t "~1Tshadow-flags: ~D~%" (-> this shadow-flags))
(format #t "~1Tshadow-volume-joint: ~A~%" (-> this shadow-volume-joint))
(format #t "~1Tdraw-seg: ~D~%" (-> this draw-seg))
(format #t "~1Tno-draw-seg: ~D~%" (-> this no-draw-seg))
(format #t "~1Tprocess: ~D~%" (-> this process))
(label cfg-4)
this
)
;; definition of type scene
(deftype scene (art-group)
((mask-to-clear process-mask)
(entity string)
(art-group string)
(anim string)
(parts int32)
(command-list pair)
(cut-list pair)
(wait-max-time time-frame)
(wait-air-time time-frame)
(wait-ground-time time-frame)
(draw-target symbol)
(abort symbol)
(actor (array scene-actor))
(load-point-obj object)
(load-point continue-point :overlay-at load-point-obj)
(load-point-name string :overlay-at load-point-obj)
(end-point-obj object)
(end-point continue-point :overlay-at end-point-obj)
(end-point-name string :overlay-at end-point-obj)
(borrow pair)
(sfx-volume float)
(ambient-volume float)
(music-volume float)
(blackout-end symbol)
(peaceful symbol)
(music-delay float)
(save symbol)
(scene-task uint16)
)
(:methods
(scene-method-15 (_type_ spool-anim) none)
(scene-method-16 (_type_) _type_)
)
)
;; definition for method 3 of type scene
(defmethod inspect ((this scene))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Tlength: ~D~%" (-> this length))
(format #t "~1Textra: ~A~%" (-> this extra))
(format #t "~1Tinfo: ~A~%" (-> this info))
(format #t "~1Tdata[0] @ #x~X~%" (&-> this mask-to-clear))
(format #t "~1Tmask-to-clear: ~D~%" (-> this mask-to-clear))
(format #t "~1Tentity: ~A~%" (-> this entity))
(format #t "~1Tart-group: ~A~%" (-> this art-group))
(format #t "~1Tanim: ~A~%" (-> this anim))
(format #t "~1Tparts: ~D~%" (-> this parts))
(format #t "~1Tcommand-list: ~A~%" (-> this command-list))
(format #t "~1Tcut-list: ~A~%" (-> this cut-list))
(format #t "~1Twait-max-time: ~D~%" (-> this wait-max-time))
(format #t "~1Twait-air-time: ~D~%" (-> this wait-air-time))
(format #t "~1Twait-ground-time: ~D~%" (-> this wait-ground-time))
(format #t "~1Tdraw-target: ~A~%" (-> this draw-target))
(format #t "~1Tabort: ~A~%" (-> this abort))
(format #t "~1Tactor: ~A~%" (-> this actor))
(format #t "~1Tload-point: ~A~%" (-> this load-point-obj))
(format #t "~1Tend-point: ~A~%" (-> this end-point-obj))
(format #t "~1Tborrow: ~A~%" (-> this borrow))
(format #t "~1Tsfx-volume: ~f~%" (-> this sfx-volume))
(format #t "~1Tambient-volume: ~f~%" (-> this ambient-volume))
(format #t "~1Tmusic-volume: ~f~%" (-> this music-volume))
(format #t "~1Tblackout-end: ~A~%" (-> this blackout-end))
(format #t "~1Tpeaceful: ~A~%" (-> this peaceful))
(format #t "~1Tmusic-delay: ~f~%" (-> this music-delay))
(format #t "~1Tsave: ~A~%" (-> this save))
(format #t "~1Tscene-task: ~D~%" (-> this scene-task))
(label cfg-4)
this
)
;; definition of type scene-player
(deftype scene-player (process-drawable)
((scene-list (array scene))
(scene scene)
(scene-index int32)
(anim spool-anim)
(next-anim spool-anim)
(camera handle)
(main-entity entity-actor)
(wait symbol)
(old-target-pos transformq :inline)
(pre-cut-frame basic)
(preload-continue string)
(dma-max uint32)
(gui-id sound-id)
(aborted? symbol)
(scene-start-time time-frame)
(targ-speed float)
(cur-speed float)
(speed-change-time time-frame)
(speed-press-time time-frame)
(speed-change-speed float)
(unknown-time time-frame :overlay-at speed-change-speed)
(subtitle-change-time time-frame)
(user-sound sound-id 4)
)
(:state-methods
(wait symbol)
release
play-anim
)
(:methods
(scene-player-method-23 (_type_ string symbol) none)
(scene-player-method-24 (_type_ basic symbol) scene)
(scene-player-method-25 (_type_ float) none)
)
)
;; definition for method 3 of type scene-player
(defmethod inspect ((this scene-player))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~2Tscene-list: ~A~%" (-> this scene-list))
(format #t "~2Tscene: ~A~%" (-> this scene))
(format #t "~2Tscene-index: ~D~%" (-> this scene-index))
(format #t "~2Tanim: ~A~%" (-> this anim))
(format #t "~2Tnext-anim: ~A~%" (-> this next-anim))
(format #t "~2Tcamera: ~D~%" (-> this camera))
(format #t "~2Tmain-entity: ~A~%" (-> this main-entity))
(format #t "~2Twait: ~A~%" (-> this wait))
(format #t "~2Told-target-pos: #<transformq @ #x~X>~%" (-> this old-target-pos))
(format #t "~2Tpre-cut-frame: ~A~%" (-> this pre-cut-frame))
(format #t "~2Tpreload-continue: ~A~%" (-> this preload-continue))
(format #t "~2Tdma-max: ~D~%" (-> this dma-max))
(format #t "~2Tgui-id: ~D~%" (-> this gui-id))
(format #t "~2Taborted?: ~A~%" (-> this aborted?))
(format #t "~2Tscene-start-time: ~D~%" (-> this scene-start-time))
(format #t "~2Ttarg-speed: ~f~%" (-> this targ-speed))
(format #t "~2Tcur-speed: ~f~%" (-> this cur-speed))
(format #t "~2Tspeed-change-time: ~D~%" (-> this speed-change-time))
(format #t "~2Tspeed-press-time: ~D~%" (-> this speed-press-time))
(format #t "~2Tspeed-change-speed: ~f~%" (-> this speed-change-speed))
(format #t "~2Tsubtitle-change-time: ~D~%" (-> this subtitle-change-time))
(format #t "~2Tuser-sound[4] @ #x~X~%" (-> this user-sound))
(label cfg-4)
this
)
;; definition for symbol *scene-player*, type (pointer scene-player)
(define *scene-player* (the-as (pointer scene-player) #f))
;; failed to figure out what this is:
0