Files
jak-project/test/decompiler/reference/jak1/levels/demo/static-screen_REF.gc
T
ManDude fe491c2b5e [opengoal] make none a child of object (#3001)
Previously, `object` and `none` were both top-level types. This made
decompilation rather messy as they have no LCA and resulted in a lot of
variables coming out as type `none` which is very very wrong and
additionally there were plenty of casts to `object`. This changes it so
`none` becomes a child of `object` (it is still represented by
`NullType` which remains unusable in compilation).

This change makes `object` the sole top-level type, and the type that
can represent *any* GOAL object. I believe this matches the original
GOAL built-in type structure. A function that has a return type of
`object` can now return an integer or a `none` at the same time.
However, keep in mind that the return value of `(none)` is still
undefined, just as before. This also makes a cast to `object`
meaningless in 90% of the situations it showed up in (as every single
thing is already an `object`) and the decompiler will no longer emit
them. Casts to `none` are also reduced. Yay!

Additionally, state handlers also don't get the final `(none)` printed
out anymore. The return type of a state handler is completely
meaningless outside the event handler (which is return type `object`
anyway) so there are no limitations on what the last form needs to be. I
did this instead of making them return `object` to trick the decompiler
into not trying to output a variable to be used as a return value
(internally, in the decompiler they still have return type `none`, but
they have `object` elsewhere).

Fixes #1703 
Fixes #830 
Fixes #928
2023-09-22 10:54:49 +01:00

190 lines
5.8 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type static-screen
(deftype static-screen (process)
((part sparticle-launch-control 1 :offset-assert 112)
(state-time time-frame :offset-assert 120)
)
:heap-base #x10
:method-count-assert 15
:size-assert #x80
:flag-assert #xf00100080
(:methods
(idle (int time-frame symbol) _type_ :state 14)
)
)
;; definition for method 3 of type static-screen
(defmethod inspect static-screen ((obj static-screen))
(let ((t9-0 (method-of-type process inspect)))
(t9-0 obj)
)
(format #t "~T~Tpart[1] @ #x~X~%" (-> obj stack))
(format #t "~T~Tstate-time: ~D~%" (-> obj state-time))
obj
)
;; definition for method 7 of type static-screen
;; INFO: Return type mismatch process vs static-screen.
(defmethod relocate static-screen ((obj static-screen) (arg0 int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) obj)
(set! (-> v1-0 relocating-min) (the-as int (&-> obj type)))
(set! (-> v1-0 relocating-max)
(the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj)))
)
(set! (-> v1-0 relocating-offset) arg0)
)
(dotimes (v1-2 1)
(if (nonzero? (-> obj part v1-2))
(&+! (-> obj part v1-2) arg0)
)
)
(the-as static-screen ((method-of-type process relocate) obj arg0))
)
;; definition for method 10 of type static-screen
(defmethod deactivate static-screen ((obj static-screen))
(dotimes (s5-0 1)
(if (nonzero? (-> obj part s5-0))
(kill-and-free-particles (-> obj part s5-0))
)
)
((method-of-type process deactivate) obj)
(none)
)
;; failed to figure out what this is:
(defpart 2966
:init-specs ((:texture (new 'static 'texture-id :page #x5c6))
(:num 1.0)
(:y (meters 1.18))
(:scale-x (meters 15))
(:scale-y (meters 6.5))
(:r 128.0)
(:g 128.0)
(:b 128.0)
(:a 128.0)
(:timer (seconds -0.005))
(:flags (bit2 bit9 bit13))
)
)
;; failed to figure out what this is:
(defpart 2967
:init-specs ((:texture (new 'static 'texture-id :index #x1 :page #x5c6))
(:num 1.0)
(:y (meters -1.264))
(:scale-x (meters 15))
(:scale-y (meters 3.25))
(:r 128.0)
(:g 128.0)
(:b 128.0)
(:a 128.0)
(:timer (seconds -0.005))
(:flags (bit2 bit9 bit13))
)
)
;; failed to figure out what this is:
(defpart 2968
:init-specs ((:texture (new 'static 'texture-id :index #x2 :page #x5c6))
(:num 1.0)
(:y (meters -2.482))
(:scale-x (meters 15))
(:scale-y (meters 1.625))
(:r 128.0)
(:g 128.0)
(:b 128.0)
(:a 128.0)
(:timer (seconds -0.005))
(:flags (bit2 bit9 bit13))
)
)
;; failed to figure out what this is:
(defpartgroup group-part-screen1
:id 707
:flags (screen-space)
:bounds (static-bspherem 0 0 0 1)
:parts ((sp-item 2966 :flags (launch-asap)) (sp-item 2967 :flags (launch-asap)) (sp-item 2968 :flags (launch-asap)))
)
;; failed to figure out what this is:
(defstate idle (static-screen)
:virtual #t
:enter (behavior ((arg0 int) (arg1 time-frame) (arg2 symbol))
(set! (-> *setting-control* current bg-a) 1.0)
(set! (-> *setting-control* default bg-a) 0.0)
(add-setting! 'common-page 'set 0.0 (ash 1 (+ arg0 1)))
)
:trans (behavior ()
(hide-hud-quick)
(spawn (-> self part 0) *zero-vector*)
0
)
:code (behavior ((arg0 int) (arg1 time-frame) (arg2 symbol))
(local-vars (v1-6 symbol))
(set! (-> self state-time) (-> *display* base-frame-counter))
(until v1-6
(suspend)
(set! v1-6 (or (and (> arg1 0) (>= (- (-> *display* base-frame-counter) (-> self state-time)) arg1))
(and arg2
(>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1))
(cpad-pressed? 0 select start triangle circle x square)
)
)
)
)
(set! (-> *setting-control* default bg-a) 1.0)
(while (!= (-> *setting-control* current bg-a) (-> *setting-control* default bg-a))
(suspend)
)
(remove-setting! 'common-page)
(suspend)
0
)
)
;; definition for function static-screen-init-by-other
;; INFO: Return type mismatch int vs none.
(defbehavior static-screen-init-by-other static-screen ((arg0 int) (arg1 texture-id) (arg2 texture-id) (arg3 texture-id) (arg4 time-frame) (arg5 symbol))
(let ((s3-0 (lookup-part-group-by-name "group-part-screen1")))
(when (and s3-0 (nonzero? s3-0) (type-type? (-> s3-0 type) sparticle-launch-group))
(set! (-> *part-id-table* 2966 init-specs 0 initial-valuef) (the-as float arg1))
(set! (-> *part-id-table* 2967 init-specs 0 initial-valuef) (the-as float arg2))
(set! (-> *part-id-table* 2968 init-specs 0 initial-valuef) (the-as float arg3))
(set! (-> self part 0) (create-launch-control (the-as sparticle-launch-group s3-0) self))
(go-virtual idle arg0 arg4 arg5)
)
)
0
(none)
)
;; definition for function static-screen-spawn
;; INFO: Used lq/sq
;; INFO: Return type mismatch (pointer process) vs (pointer static-screen).
(defun static-screen-spawn ((arg0 int)
(arg1 texture-id)
(arg2 texture-id)
(arg3 texture-id)
(arg4 time-frame)
(arg5 symbol)
(arg6 process-tree)
)
(local-vars (sv-16 process))
(set! sv-16 (get-process *default-dead-pool* static-screen #x4000))
(the-as
(pointer static-screen)
(when sv-16
(let ((t9-1 (method-of-type static-screen activate)))
(t9-1 (the-as static-screen sv-16) arg6 'static-screen (the-as pointer #x70004000))
)
(run-now-in-process sv-16 static-screen-init-by-other arg0 arg1 arg2 arg3 arg4 arg5)
(-> sv-16 ppointer)
)
)
)