decomp: finish rolling-obs | hud | title-obs | maincave-obs | lavatube-energy (#1023)

* decomp: `(code caveelevator-one-way-idle-end)` problematic

* decomp: finish `rolling-obs`

* decomp: `snow-obs` finished, but needs s6-1 fix

* stuck: `(code target-title)`

* decomp: finish `hud`

* re-decompile

* decomp: finish `title-obs`

* decomp: finish `maincave-obs`

* decomp: finish `lavatube-energy`

* fixes
This commit is contained in:
Tyler Wilding 2021-12-30 21:27:35 -05:00 committed by GitHub
parent cd9e74819c
commit da0e9a3930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 16016 additions and 2488 deletions

View file

@ -1095,7 +1095,6 @@
(swamp-tethers-completion-sage-precursor-arm #x36b)
(village2-warp-gate-reminder #x36f)
(village2-warp-gate-reminder-annoyed #x370)
(village2-warp-gate-reminder-very-annoyed #x371)
@ -1107,6 +1106,7 @@
(rolling-race-record-string-prefix #x374)
(rolling-race-new-record-string-prefix #x375)
(rolling-race-try-again-string #x376)
(rolling-race-start-race-aborted #x377) ;; double check this
(village3-miner-money #x400)
(village3-oracle-money #x401)
@ -12077,6 +12077,8 @@
(target-clone-anim handle)
target-title
target-demo
target-title-play
target-title-wait
(target-warp-in vector vector)
)
)
@ -21289,7 +21291,7 @@
(define-extern hud-hidden (state hud))
(define-extern hud-leaving (state int hud))
(define-extern hud-in (state hud))
(define-extern hud-collecting (state handle hud)) ;; TODO accepts a handle - CRASH in `hud`
(define-extern hud-collecting (state handle collectable))
;; ----------------------
@ -26221,6 +26223,9 @@
(update-connected-crystals! (_type_) none 20)
(compute-glow (_type_) float 21)
)
(:states
cavecrystal-active
cavecrystal-idle)
)
;; - Unknowns
@ -31993,6 +31998,8 @@
:size-assert #xb0
:heap-base #x40
:flag-assert #x14004000b0
(:states
cavecrusher-idle)
)
(deftype cavetrapdoor (process-drawable)
@ -32023,6 +32030,8 @@
:size-assert #xf0
:heap-base #x80
:flag-assert #x14008000f0
(:states
caveflamepots-active)
)
(deftype cavespatula (process-drawable)
@ -32033,6 +32042,8 @@
:size-assert #xb8
:heap-base #x50
:flag-assert #x14005000b8
(:states
cavespatula-idle)
)
(deftype cavespatulatwo (process-drawable)
@ -32043,6 +32054,8 @@
:size-assert #xb8
:heap-base #x50
:flag-assert #x14005000b8
(:states
cavespatulatwo-idle)
)
(deftype caveelevator (process-drawable)
@ -32054,8 +32067,8 @@
(orig-trans vector :inline :offset-assert 208)
(sync sync-info :inline :offset-assert 224)
(smush smush-control :inline :offset-assert 232)
(anim spool-anim 2 :offset-assert 264)
(wheel-ry-mat matrix :inline :offset-assert 272)
(anim int32 2 :offset-assert 264)
(wheel-ry-mat matrix :inline :offset 272)
)
:method-count-assert 22
:size-assert #x150
@ -32065,6 +32078,12 @@
(TODO-RENAME-20 (_type_) none 20)
(TODO-RENAME-21 (_type_) float 21)
)
(:states
caveelevator-cycle-active
caveelevator-one-way-idle-start
caveelevator-one-way-travel-to-start
caveelevator-one-way-idle-end
caveelevator-one-way-travel-to-end)
)
;; - Functions
@ -32075,20 +32094,11 @@
;; - Unknowns
(define-extern *caveelevator-sg* skeleton-group)
(define-extern caveelevator-cycle-active (state caveelevator)) ;; unknown type
(define-extern caveelevator-one-way-idle-start (state caveelevator)) ;; unknown type
(define-extern caveelevator-one-way-travel-to-start (state caveelevator)) ;; unknown type
(define-extern caveelevator-one-way-idle-end (state caveelevator)) ;; unknown type
(define-extern caveelevator-one-way-travel-to-end (state caveelevator)) ;; unknown type
(define-extern *cavespatulatwo-sg* skeleton-group)
(define-extern cavespatulatwo-idle (state cavespatulatwo)) ;; unknown type
(define-extern *cavespatula-darkcave-sg* skeleton-group)
(define-extern *cavespatula-sg* skeleton-group)
(define-extern cavespatula-idle (state cavespatula)) ;; unknown type
(define-extern caveflamepots-active (state caveflamepots)) ;; unknown type
(define-extern *cavetrapdoor-sg* skeleton-group)
(define-extern *cavecrusher-sg* skeleton-group)
(define-extern cavecrusher-idle (state cavecrusher)) ;; unknown type
(define-extern ripple-for-cave-water ripple-wave-set) ;; unknown type
(define-extern *maincavecam-sg* skeleton-group)
@ -33935,6 +33945,8 @@
:size-assert #xf8
:heap-base #x90
:flag-assert #x14009000f8
(:states
pusher-idle)
)
(deftype gorge-pusher (pusher-base)
@ -33944,6 +33956,8 @@
:size-assert #xb8
:heap-base #x50
:flag-assert #x14005000b8
(:states
gorge-pusher-idle)
)
(deftype dark-plant (process-drawable)
@ -33954,6 +33968,12 @@
:size-assert #xc4
:heap-base #x60
:flag-assert #x14006000c4
(:states
dark-plant-gone
dark-plant-startup
dark-plant-idle
dark-plant-sprout
dark-plant-death)
)
(deftype happy-plant (process-drawable)
@ -33964,6 +33984,10 @@
:size-assert #xb4
:heap-base #x50
:flag-assert #x14005000b4
(:states
happy-plant-opened
happy-plant-init
happy-plant-opening)
)
(deftype race-time (structure)
@ -33983,6 +34007,9 @@
:size-assert #xf5
:heap-base #x90
:flag-assert #x14009000f5
(:states
rolling-start-whole
(rolling-start-break symbol))
)
(deftype gorge (process-drawable)
@ -34010,6 +34037,12 @@
:size-assert #x140
:heap-base #xd0
:flag-assert #x1400d00140
(:states
gorge-start-idle
gorge-start-ready
gorge-start-racing
gorge-start-race-finished
gorge-start-race-aborted)
)
(deftype gorge-finish (gorge)
@ -34019,6 +34052,8 @@
:size-assert #xfc
:heap-base #x90
:flag-assert #x14009000fc
(:states
gorge-finish-idle)
)
(deftype gorge-abort (gorge)
@ -34027,6 +34062,8 @@
:size-assert #xf8
:heap-base #x90
:flag-assert #x14009000f8
(:states
gorge-abort-idle)
)
(deftype rolling-water (water-anim)
@ -34065,31 +34102,12 @@
;; - Unknowns
(define-extern ripple-for-rolling-water object) ;; unknown type
(define-extern gorge-start-idle (state gorge-start)) ;; unknown type
(define-extern gorge-start-ready (state gorge-start)) ;; unknown type
(define-extern gorge-start-racing (state gorge-start)) ;; unknown type
(define-extern gorge-start-race-finished (state gorge-start)) ;; unknown type
(define-extern gorge-start-race-aborted (state gorge-start)) ;; unknown type
(define-extern gorge-finish-idle (state gorge-finish)) ;; unknown type
(define-extern gorge-abort-idle (state gorge-abort)) ;; unknown type
(define-extern *rolling-start-whole-sg* skeleton-group)
(define-extern *rolling-start-broken-sg* skeleton-group)
(define-extern rolling-start-whole (state rolling-start)) ;; unknown type
(define-extern rolling-start-break (state rolling-start)) ;; unknown type
(define-extern *happy-plant-sg* skeleton-group)
(define-extern happy-plant-opened (state happy-plant)) ;; unknown type
(define-extern happy-plant-init (state happy-plant)) ;; unknown type
(define-extern happy-plant-opening (state happy-plant)) ;; unknown type
(define-extern *rollingcam-sg* skeleton-group)
(define-extern *dark-plant-sg* skeleton-group)
(define-extern dark-plant-gone (state dark-plant)) ;; unknown type
(define-extern dark-plant-startup (state dark-plant)) ;; unknown type
(define-extern dark-plant-idle (state dark-plant)) ;; unknown type
(define-extern dark-plant-sprout (state dark-plant)) ;; unknown type
(define-extern dark-plant-death (state dark-plant)) ;; unknown type
(define-extern *pusher-sg* skeleton-group)
(define-extern gorge-pusher-idle (state gorge-pusher)) ;; unknown type
(define-extern pusher-idle (state pusher)) ;; unknown type
;; ----------------------
@ -36091,7 +36109,7 @@
;; - Functions
(define-extern energyarm-init-by-other (function vector float none :behavior energyarm))
(define-extern energyhub-set-lava-height (function float :behavior energyhub))
(define-extern energyhub-set-lava-height (function float float :behavior energyhub))
(define-extern energyhub-trans (function quaternion :behavior energyhub))
(define-extern energyarm-init (function energyarm sparticle-launch-control))
(define-extern energyball-init-by-other (function vector none :behavior energyball))
@ -38100,8 +38118,6 @@
;; - Unknowns
(define-extern target-title-play (state target)) ;; unknown type
(define-extern target-title-wait (state target)) ;; unknown type
(define-extern *logo-japan-sg* skeleton-group)
(define-extern *logo-sg* skeleton-group)
(define-extern *ndi-sg* skeleton-group)

View file

@ -306,8 +306,6 @@
// all unchecked and in level DGO code
"(anon-function 21 plant-boss)", // CFG
"target-flut-falling-anim-trans", // CFG failure
"(anon-function 6 title-obs)",
"(anon-function 43 maincave-obs)",
"(anon-function 2 target-tube)",
"(anon-function 5 orbit-plat)", // CFG
"(anon-function 2 ogreboss)"

View file

@ -1210,6 +1210,17 @@
"rolling-obs": [
["L234", "vector"],
["L238", "vector"],
["L239", "vector"],
["L240", "vector"],
["L241", "vector"],
["L242", "vector"],
["L243", "vector"],
["L244", "vector"],
["L245", "vector"],
["L246", "vector"],
["L247", "vector"],
["L248", "vector"],
["L257", "vector"]
],

View file

@ -2154,7 +2154,8 @@
],
"(code gorge-start-race-aborted)": [
[16, "event-message-block"]
[16, "event-message-block"],
[96, "font-context"]
],
"(enter gorge-start-racing)": [
@ -6012,5 +6013,9 @@
[16, "event-message-block"]
],
"(code gorge-start-idle)": [
[16, "event-message-block"]
],
"placeholder-do-not-add-below!": []
}

View file

@ -4598,8 +4598,7 @@
],
"(code pov-camera-playing maincavecam)": [
[47, "gp", "handle"],
[50, "gp", "handle"]
[[40, 54], "gp", "handle"]
],
"(code cavecrusher-idle)": [
@ -4621,7 +4620,15 @@
],
"(method 11 caveflamepots)": [
[290, "s4", "collide-shape-prim-group"]
["_stack_", 16, "res-tag"],
["_stack_", 32, "res-tag"],
["_stack_", 48, "res-tag"],
[258, "s4", "vector"],
[281, "s4", "collide-shape-prim-group"],
[290, "s4", "collide-shape-prim-group"],
[311, "v0", "(pointer float)"],
[342, "v0", "(pointer float)"],
[372, "v0", "(pointer float)"]
],
"(code pov-camera-playing sunkencam)": [
@ -4686,11 +4693,9 @@
[76, "gp", "handle"],
[84, "gp", "handle"],
[145, "gp", "handle"],
[168, "v1", "handle"],
[171, "v1", "handle"],
[[167, 175], "v1", "handle"],
[179, "gp", "handle"],
[185, "s5", "handle"],
[188, "s5", "handle"]
[[185, 192], "s5", "handle"]
],
"(trans spike-idle)": [
@ -4839,7 +4844,9 @@
],
"(code target-title)": [
[20, "a0", "handle"],
// [[19, 22], "v1", "handle"],
[[57, 65], "v1", "handle"],
[[69, 77], "v1", "handle"],
[214, "s5", "handle"]
],
@ -5456,10 +5463,6 @@
[28, "v1", "process-drawable"]
],
"(trans energyhub-idle)": [
[34, "v1", "energyarm"]
],
"(post idle citb-sage)": [
[3, "t9", "(function none :behavior citb-sage)"]
],
@ -7370,5 +7373,25 @@
[[108, 116], "v1", "handle"]
],
"(code hud-collecting)": [
[[2, 10], "v1", "handle"],
[13, "s4", "hud"],
[25, "s4", "hud"],
[27, "s4", "hud"]
],
"(code caveelevator-one-way-idle-start)": [
[10, "v1", "art-joint-anim"]
],
"(method 11 caveelevator)": [
["_stack_", 16, "res-tag"],
[109, "v0", "(pointer float)"]
],
"(trans energyhub-idle)": [
[31, "s4", "energyarm"]
],
"placeholder-do-not-add-below": []
}

View file

@ -3916,5 +3916,25 @@
}
},
"(code happy-plant-opening)": {
"vars": {
"gp-2": ["gp-2", "handle"],
"v1-40": ["v1-40", "handle"],
"s5-3": ["s5-3", "handle"]
}
},
"(code target-title)": {
"vars": {
"gp-0": ["gp-0", "handle"]
}
},
"(code hud-collecting)": {
"vars": {
"v1-0": ["v1-0", "handle"]
}
},
"aaaaaaaaaaaaaaaaaaaaaaa": {}
}

View file

@ -439,6 +439,7 @@
"goal_src/levels/swamp/swamp-part.gc"
"goal_src/levels/swamp/billy.gc"
"goal_src/levels/maincave/cavecrystal-light.gc"
"goal_src/levels/darkcave/darkcave-obs.gc"
"goal_src/levels/maincave/maincave-obs.gc"
"goal_src/levels/maincave/maincave-part.gc"
"goal_src/levels/maincave/spiderwebs.gc"
@ -450,7 +451,6 @@
"goal_src/levels/maincave/mother-spider.gc"
"goal_src/levels/maincave/gnawer.gc"
"goal_src/levels/maincave/driller-lurker.gc"
"goal_src/levels/darkcave/darkcave-obs.gc"
"goal_src/levels/sunken/sunken-part.gc"
"goal_src/levels/sunken/sunken-part2.gc"
"goal_src/levels/sunken/sunken-part3.gc"

View file

@ -104,6 +104,8 @@
(target-racing-hit handle attack-info)
(target-racing-jump float float symbol)
target-title
target-title-play
target-title-wait
(target-warp-in vector vector)
)
)

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,533 @@
;; TODO - for hud-classes
(define-extern hud-init-by-other (function int none :behavior hud))
(define-extern hud-collecting (state handle hud))
(define-extern hud-collecting (state handle collectable))
(define-extern hud-leaving (state int hud))
(define-extern hud-in (state hud))
(define-extern hud-arriving (state hud))
;; DECOMP BEGINS
(defmethod relocate hud ((obj hud) (arg0 int))
(dotimes (v1-0 (-> obj nb-of-particles))
(if (nonzero? (-> obj particles v1-0 part))
(&+! (-> obj particles v1-0 part) arg0)
)
)
(the-as hud ((method-of-type process relocate) obj arg0))
)
(defmethod deactivate hud ((obj hud))
(dotimes (v1-0 9)
(if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) obj))
(set! (-> *hud-parts* parts v1-0) (the-as (pointer process) #f))
)
)
(dotimes (s5-0 (-> obj nb-of-particles))
(kill-and-free-particles (-> obj particles s5-0 part))
(set! (-> obj particles s5-0 part matrix) -1)
)
((method-of-type process deactivate) obj)
(none)
)
(defmethod dummy-15 hud ((obj hud))
(when (and (not (dummy-14 obj)) (not (paused?)))
(dotimes (s5-0 (-> obj nb-of-particles))
(when (!= s5-0 (-> obj skip-particle))
(if (or (!= (-> obj particles 0 pos x) 0.0) (!= (-> obj particles 0 pos y) 0.0))
(spawn (-> obj particles s5-0 part) *null-vector*)
)
)
)
)
0
(none)
)
(defmethod TODO-RENAME-16 hud ((obj hud) (arg0 int) (arg1 int))
(if (= arg0 (-> obj target-value))
(set! (-> obj last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
)
(when (and (not *progress-process*) (and
(!= (-> obj last-hide-time) (-> *display* base-frame-counter))
(not (movie?))
(>= (- (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) 30)
(>= (- (-> *display* base-frame-counter) (-> *game-info* blackout-time)) 30)
(not (and *target* (logtest? (-> *target* state-flags) 256)))
)
)
(when (or
(!= (-> obj value) arg0)
(!= (-> obj value2) arg1)
(-> obj force-on-screen)
(or
(and (cpad-hold? 0 l2) (not (-> obj disable)))
(and (not *cheat-mode*) (cpad-hold? 0 r2))
(-> obj first-init)
)
)
(cond
((and
(-> obj increment-on-event)
(< (-> obj value) arg0)
(not (-> obj first-init))
(< (- (-> *display* base-frame-counter) (the-as int (-> obj last-target-equal-time))) 450)
)
(when (and
(!= (-> obj value) (-> obj target-value))
(>= (- (-> *display* base-frame-counter) (the-as int (-> obj last-increment-time))) 30)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(+! (-> obj value) 1)
(set! (-> obj last-increment-time) (the-as uint (-> *display* base-frame-counter)))
)
)
(else
(if (not (and
(not (-> obj first-init))
(>= (- (-> *display* base-frame-counter) (the-as int (-> obj last-target-equal-time))) 450)
)
)
(set! (-> obj value) arg0)
)
(set! (-> obj target-value) arg0)
(set! (-> obj last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
)
)
(set! (-> obj value2) arg1)
(when (and (not (movie?)) (= *master-mode* 'game) (not (-> obj first-init)) (not (-> obj disable)))
(if (>= (-> obj friend) 0)
(send-event (ppointer->process (-> *hud-parts* parts (-> obj friend))) 'show)
)
(go hud-arriving)
)
(set! (-> obj trigger-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> obj first-init) #f)
)
)
0
(none)
)
(defmethod dummy-17 hud ((obj hud))
(dotimes (v1-0 (-> obj nb-of-icons))
(set-vector!
(-> obj icons v1-0 icon 0 root scale)
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
(* (-> obj icons v1-0 scale-y) (-> *video-parms* relative-y-scale))
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
1.0
)
(set! (-> obj icons v1-0 icon 0 root trans x)
(the float (+ (-> obj icons v1-0 icon-x) -256 (* (-> obj x-sgn) (-> obj offset))))
)
(set! (-> obj icons v1-0 icon 0 root trans y)
(- (+ (the float (-> obj icons v1-0 icon-y))
(* (the float (-> obj y-sgn))
(the float (-> obj offset))
(-> *video-parms* relative-y-scale)
(-> *video-parms* relative-y-scale)
)
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
)
(the float (-> *video-parms* screen-sy))
)
)
)
0
(none)
)
(defmethod dummy-18 hud ((obj hud))
(dotimes (s5-0 (-> obj nb-of-particles))
(when (!= (-> obj skip-particle) -2)
(set! (-> obj particles s5-0 pos x)
(+ -256.0 (the float (* (-> obj x-sgn) (-> obj offset))) (-> obj particles s5-0 init-pos x))
)
(set! (-> obj particles s5-0 pos y)
(* 0.5 (- (* (-> *video-parms* relative-y-scale)
(+ (-> obj particles s5-0 init-pos y)
(the float (* (-> obj y-sgn) (-> obj offset)))
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
)
)
(the float (-> *video-parms* screen-sy))
)
)
)
(set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z))
)
(if (> (-> obj particles s5-0 part matrix) 0)
(set-vector!
(sprite-get-user-hvdf (-> obj particles s5-0 part matrix))
(the float (+ (the int (-> obj particles s5-0 pos x)) 2048))
(the float (+ (the int (-> obj particles s5-0 pos y)) 2048))
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))
(-> *math-camera* hvdf-off w)
)
)
)
0
(none)
)
(defmethod TODO-RENAME-19 hud ((obj hud))
0
(none)
)
(defmethod init-particles! hud ((obj hud) (arg0 int))
0
(none)
)
(defmethod first-icon-x hud ((obj hud))
0
)
(defmethod first-icon-y hud ((obj hud))
0
)
(defmethod inc-value hud ((obj hud))
0.0
)
(defmethod dec-value hud ((obj hud))
0.0
)
(defmethod animate! hud ((obj hud) (arg0 symbol) (arg1 symbol))
0
(none)
)
(defmethod dummy-14 hud ((obj hud))
(= (-> obj next-state name) 'hud-hidden)
(none)
)
(defstate hud-hidden (hud)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object))
(case arg2
(('show)
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
(go hud-arriving)
)
)
(('hide)
(set! v0-0 (-> *display* base-frame-counter))
(set! (-> self last-hide-time) (the-as uint v0-0))
v0-0
)
(('hide-quick)
(set! v0-0 (-> *display* base-frame-counter))
(set! (-> self last-hide-time) (the-as uint v0-0))
v0-0
)
(('increment)
(set! v0-0 (+ (-> self target-value) 1))
(set! (-> self target-value) (the-as int v0-0))
v0-0
)
(('sync)
(set! v0-0 #t)
(set! (-> self first-init) (the-as symbol v0-0))
v0-0
)
(('disable)
(set! v0-0 #t)
(set! (-> self disable) (the-as symbol v0-0))
v0-0
)
(('enable)
(set! (-> self disable) #f)
#f
)
)
)
:enter
(behavior ()
(set! (-> self offset) 128)
(dummy-17 self)
(dummy-18 self)
(let ((gp-0 (-> self child)))
(while gp-0
(send-event (ppointer->process gp-0) 'draw #f)
(set! gp-0 (-> gp-0 0 brother))
)
)
(dotimes (gp-1 (-> self nb-of-particles))
(kill-and-free-particles (-> self particles gp-1 part))
(set! (-> self particles gp-1 part matrix) -1)
)
(none)
)
:exit
(behavior () (set! (-> self y-offset) (-> self next-y-offset)) (none))
:code
(behavior ()
(logior! (-> self mask) (process-mask sleep-code))
(while #t
(suspend)
)
(none)
)
:post
(behavior ()
(if (-> self deactivate-when-hidden)
(deactivate self)
)
(TODO-RENAME-19 self)
(none)
)
)
(defstate hud-arriving (hud)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-3 object))
(case arg2
(('hide-quick)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(('hide)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(go hud-leaving 10)
)
(('show)
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
(go hud-arriving)
)
)
(('increment)
(set! v0-3 (+ (-> self target-value) 1))
(set! (-> self target-value) (the-as int v0-3))
v0-3
)
(('sync)
(set! v0-3 #t)
(set! (-> self first-init) (the-as symbol v0-3))
v0-3
)
(('disable)
(set! v0-3 #t)
(set! (-> self disable) (the-as symbol v0-3))
v0-3
)
(('enable)
(set! (-> self disable) #f)
#f
)
)
)
:enter
(behavior ()
(let ((gp-0 (-> self child)))
(while gp-0
(send-event (ppointer->process gp-0) 'draw #t)
(set! gp-0 (-> gp-0 0 brother))
)
)
(dotimes (gp-1 (-> self nb-of-particles))
(if (= (-> self particles gp-1 part matrix) -1)
(set! (-> self particles gp-1 part matrix) (sprite-allocate-user-hvdf))
)
)
(none)
)
:code
(behavior ()
(while #t
(if (not (paused?))
(set! (-> self offset) (seekl (-> self offset) 0 (the int (* 15.0 (-> *display* time-adjust-ratio)))))
)
(dummy-17 self)
(if (<= (-> self offset) 0)
(go hud-in)
)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(suspend)
)
(none)
)
:post
(behavior () (TODO-RENAME-19 self) (dummy-18 self) (dummy-15 self) (none))
)
(defstate hud-in (hud)
:event
(-> hud-arriving event)
:code
(behavior ()
(set! (-> self trigger-time) (the-as uint (-> *display* base-frame-counter)))
(while (and (< (- (-> *display* base-frame-counter) (the-as int (-> self trigger-time))) 600) (not (movie?)))
(set! (-> self offset) 0)
(dummy-17 self)
(suspend)
)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(go hud-leaving 5)
(none)
)
:post
(-> hud-arriving post)
)
(defstate hud-leaving (hud)
:event
(-> hud-arriving event)
:code
(behavior ((arg0 int))
(while #t
(if (not (paused?))
(set! (-> self offset)
(seekl (-> self offset) 128 (the int (* (the float arg0) (-> *display* time-adjust-ratio))))
)
)
(dummy-17 self)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(if (>= (-> self offset) 128)
(go hud-hidden)
)
(suspend)
)
(none)
)
:post
(-> hud-arriving post)
)
(defbehavior hud-init-by-other hud ((arg0 int))
(set! (-> self nb-of-icons) 0)
(set! (-> self nb-of-particles) 0)
(set! (-> self max-nb-of-particles) 7)
(set! (-> self first-init) #t)
(set! (-> self friend) -1)
(set! (-> self last-increment-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self increment-on-event) #f)
(set! (-> self skip-particle) -1)
(set! (-> self disable) #f)
(set! (-> self force-on-screen) #f)
(set! (-> self deactivate-when-hidden) #f)
(set! (-> self y-offset) 0)
(set! (-> self next-y-offset) 0)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(logior! (-> self mask) (process-mask menu))
(logclear! (-> self mask) (process-mask pause progress))
(init-particles! self arg0)
(dummy-17 self)
(dummy-18 self)
(go hud-hidden)
(none)
)
(defun send-hud-increment-event ((arg0 hud))
(if (-> arg0 increment-on-event)
(send-event arg0 'increment)
)
)
(defstate hud-collecting (collectable)
:trans
(behavior ()
(case (-> self type)
((fuel-cell)
(fuel-cell-animate)
)
)
(none)
)
:code
(behavior ((arg0 handle))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (handle->process arg0)))
(set! (-> s5-0 x) (- (the float (+ (first-icon-x (the-as hud s4-0)) -256)) (-> self root-override trans x)))
(set! (-> s5-0 y) (- (the float (- (first-icon-y (the-as hud s4-0)) (-> *video-parms* screen-sy)))
(-> self root-override trans y)
)
)
)
(let ((f30-0 4.0)
(f26-0 0.0)
(f28-0 (-> self root-override scale x))
(f24-0 (-> self root-override scale y))
(f22-0 (-> self root-override scale z))
)
(while #t
(let ((f0-7 (* f30-0 (-> *display* seconds-per-frame))))
(+! f26-0 f0-7)
(when (< 1.0 f26-0)
(let ((f0-8 (- f26-0 f0-7)))
(set! f0-7 (- 1.0 f0-8))
)
(set! f26-0 1.0)
)
(+! (-> self root-override trans x) (* f0-7 (-> s5-0 x)))
(+! (-> self root-override trans y) (* f0-7 (-> s5-0 y)))
)
(set-vector!
(-> self root-override scale)
(* f28-0 (-> *video-parms* relative-x-scale))
(* f24-0 (-> *video-parms* relative-y-scale) (-> *video-parms* relative-y-scale))
(* f22-0 (-> *video-parms* relative-x-scale))
1.0
)
(let ((a0-12 (-> self root-override)))
(set-yaw-angle-clear-roll-pitch!
a0-12
(- (y-angle a0-12) (* 182.04445 (* 8.0 (-> *display* time-adjust-ratio))))
)
)
(suspend)
(when (>= f26-0 1.0)
(send-hud-increment-event (the-as hud (handle->process arg0)))
(deactivate self)
)
)
)
)
(none)
)
:post
(the-as (function none :behavior collectable) ja-post)
)
;; decomp begins

View file

@ -308,7 +308,6 @@
(swamp-tethers-completion-sage-precursor-arm #x36b)
(village2-warp-gate-reminder #x36f)
(village2-warp-gate-reminder-annoyed #x370)
(village2-warp-gate-reminder-very-annoyed #x371)
@ -320,6 +319,7 @@
(rolling-race-record-string-prefix #x374)
(rolling-race-new-record-string-prefix #x375)
(rolling-race-try-again-string #x376)
(rolling-race-start-race-aborted #x377) ;; double check this
(village3-miner-money #x400)
(village3-oracle-money #x401)

View file

@ -5,12 +5,7 @@
;; name in dgo: darkcave-obs
;; dgos: DAR, L1
(define-extern *cavecrystal-sg* skeleton-group)
(declare-type cavecrystal process-drawable)
(define-extern cavecrystal-idle (state cavecrystal))
(define-extern cavecrystal-active (state cavecrystal))
; (define-extern *cavecrystal-sg* skeleton-group)
;; DECOMP BEGINS
@ -40,6 +35,10 @@
(update-connected-crystals! (_type_) none 20)
(compute-glow (_type_) float 21)
)
(:states
cavecrystal-active
cavecrystal-idle
)
)
@ -53,220 +52,159 @@
(defmethod update-connected-crystals! cavecrystal ((obj cavecrystal))
(when (-> obj is-master?)
(let ((v1-2 (-> *display* base-frame-counter)))
(when (!= (-> obj last-updated-user-lighting) v1-2)
(set! (-> obj last-updated-user-lighting) (the-as uint v1-2))
(execute-connections *cavecrystal-light-control*)
)
(let ((v1-2 (-> *display* base-frame-counter)))
(when (!= (-> obj last-updated-user-lighting) v1-2)
(set! (-> obj last-updated-user-lighting) (the-as uint v1-2))
(execute-connections *cavecrystal-light-control*)
)
)
)
)
(none)
)
(defmethod compute-glow cavecrystal ((obj cavecrystal))
(set!
(-> obj prev-compute-glow-time)
(the-as uint (-> *display* game-frame-counter))
)
(let*
((gp-1
(max
1
(the-as
int
(+
(- 1 (the-as int (-> obj activated-time)))
(-> *display* game-frame-counter)
)
(set! (-> obj prev-compute-glow-time) (the-as uint (-> *display* game-frame-counter)))
(let* ((gp-1 (max 1 (the-as int (+ (- 1 (the-as int (-> obj activated-time))) (-> *display* game-frame-counter)))))
(f0-2
(/ (the float (mod (+ (-> *display* base-frame-counter) (-> obj glow-wf-offset)) (-> obj glow-wf-period)))
(the float (-> obj glow-wf-period))
)
)
(f30-1 (* 0.1 (cos (* 65536.0 f0-2))))
)
(cond
((>= 20 (the-as int gp-1))
(let ((v1-11 (* 0.05 (the float gp-1))))
(fmax 0.0 (fmin 2.0 (+ (* 2.0 v1-11) (* v1-11 f30-1))))
)
)
)
)
(f0-2
(/
(the
float
(mod
(+ (-> *display* base-frame-counter) (-> obj glow-wf-offset))
(-> obj glow-wf-period)
)
((>= 180 (the-as int gp-1))
(let ((a2-0 (* 0.00625 (the float (+ gp-1 -20)))))
(fmin 2.0 (+ (lerp 2.0 1.0 a2-0) f30-1))
)
)
(the float (-> obj glow-wf-period))
((>= (the-as int (-> obj start-fade-time)) (the-as int gp-1))
(+ 1.0 f30-1)
)
(else
(let ((v1-20 (fmin 1.0 (* 0.004761905 (the float (- gp-1 (-> obj start-fade-time)))))))
(fmax 0.0 (- (+ 1.0 (* (- 1.0 v1-20) f30-1)) v1-20))
)
)
)
)
(f30-1 (* 0.1 (cos (* 65536.0 f0-2))))
)
(cond
((>= 20 (the-as int gp-1))
(let ((v1-11 (* 0.05 (the float gp-1))))
(fmax 0.0 (fmin 2.0 (+ (* 2.0 v1-11) (* v1-11 f30-1))))
)
)
((>= 180 (the-as int gp-1))
(let ((a2-0 (* 0.00625 (the float (+ gp-1 -20)))))
(fmin 2.0 (+ (lerp 2.0 1.0 a2-0) f30-1))
)
)
((>= (the-as int (-> obj start-fade-time)) (the-as int gp-1))
(+ 1.0 f30-1)
)
(else
(let
((v1-20
(fmin 1.0 (* 0.004761905 (the float (- gp-1 (-> obj start-fade-time)))))
)
)
(fmax 0.0 (- (+ 1.0 (* (- 1.0 v1-20) f30-1)) v1-20))
)
)
)
)
)
(defstate cavecrystal-idle (cavecrystal)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('attack)
(go cavecrystal-active)
)
)
)
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2
(('attack)
(go cavecrystal-active)
)
)
)
:trans
(behavior ()
(if
(and
*target*
(>=
40960.0
(vector-vector-distance
(-> self root-override trans)
(-> *target* control trans)
)
)
)
(level-hint-spawn
(game-text-id darkcave-light-crystal-hint)
"sksp0333"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(if (and *target* (>= 40960.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))))
(level-hint-spawn
(game-text-id darkcave-light-crystal-hint)
"sksp0333"
(the-as entity #f)
*entity-pool*
(game-task none)
)
)
(update-connected-crystals! self)
(none)
)
(update-connected-crystals! self)
(none)
)
:code
(behavior ()
(logior! (-> self mask) (process-mask sleep-code))
(suspend)
0
(none)
)
(behavior () (logior! (-> self mask) (process-mask sleep-code)) (suspend) 0 (none))
)
(defstate cavecrystal-active (cavecrystal)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (when (= v1-0 'attack)
(let ((v1-1 (-> arg3 param 2)))
(cond
((!= v1-1 (-> self player-attack-id))
(set! (-> self player-attack-id) v1-1)
(set!
(-> self activated-time)
(the-as uint (-> *display* game-frame-counter))
)
#t
(let ((v1-0 arg2))
(the-as object (when (= v1-0 'attack)
(let ((v1-1 (-> arg3 param 2)))
(cond
((!= v1-1 (-> self player-attack-id))
(set! (-> self player-attack-id) v1-1)
(set! (-> self activated-time) (the-as uint (-> *display* game-frame-counter)))
#t
)
(else
#f
)
)
)
)
(else
#f
)
)
)
)
)
)
)
)
)
:enter
(behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(set!
(-> self activated-time)
(the-as uint (-> *display* game-frame-counter))
(logclear! (-> self mask) (process-mask actor-pause))
(set! (-> self activated-time) (the-as uint (-> *display* game-frame-counter)))
(set! (-> self prev-compute-glow-time) (the-as uint (-> *display* game-frame-counter)))
(none)
)
(set!
(-> self prev-compute-glow-time)
(the-as uint (-> *display* game-frame-counter))
)
(none)
)
:exit
(behavior ()
(stop! (-> self sound))
(if (not (-> self is-master?))
(logior! (-> self mask) (process-mask actor-pause))
(stop! (-> self sound))
(if (not (-> self is-master?))
(logior! (-> self mask) (process-mask actor-pause))
)
(none)
)
(none)
)
:trans
(behavior ()
(let ((f30-0 (compute-glow self)))
(set! (-> self glow-u) f30-0)
(let ((gp-0 (new 'stack-no-clear 'vector))
(f28-0 1.993)
(let ((f30-0 (compute-glow self)))
(set! (-> self glow-u) f30-0)
(let ((gp-0 (new 'stack-no-clear 'vector))
(f28-0 1.993)
)
(let ((s5-0 (-> self draw color-mult)))
(vector-! gp-0 (-> self on-color-mult) (-> self off-color-mult))
(vector+*! s5-0 (-> self off-color-mult) gp-0 f30-0)
(set! (-> s5-0 x) (fmax 0.0 (fmin (-> s5-0 x) f28-0)))
(set! (-> s5-0 y) (fmax 0.0 (fmin (-> s5-0 y) f28-0)))
(set! (-> s5-0 z) (fmax 0.0 (fmin (-> s5-0 z) f28-0)))
(set! (-> s5-0 w) 1.0)
)
(let ((s5-0 (-> self draw color-mult)))
(vector-! gp-0 (-> self on-color-mult) (-> self off-color-mult))
(vector+*! s5-0 (-> self off-color-mult) gp-0 f30-0)
(set! (-> s5-0 x) (fmax 0.0 (fmin (-> s5-0 x) f28-0)))
(set! (-> s5-0 y) (fmax 0.0 (fmin (-> s5-0 y) f28-0)))
(set! (-> s5-0 z) (fmax 0.0 (fmin (-> s5-0 z) f28-0)))
(set! (-> s5-0 w) 1.0)
(let ((s5-1 (-> self draw color-emissive)))
(vector-! gp-0 (-> self on-color-emissive) (-> self off-color-emissive))
(vector+*! s5-1 (-> self off-color-emissive) gp-0 f30-0)
(set! (-> s5-1 x) (fmax 0.0 (fmin (-> s5-1 x) f28-0)))
(set! (-> s5-1 y) (fmax 0.0 (fmin (-> s5-1 y) f28-0)))
(set! (-> s5-1 z) (fmax 0.0 (fmin (-> s5-1 z) f28-0)))
(set! (-> s5-1 w) 0.0)
)
)
(TODO-RENAME-9 *cavecrystal-light-control* (-> self crystal-id) (-> self glow-u) self)
(update-connected-crystals! self)
(when (>= 0.0 f30-0)
(level-hint-spawn
(game-text-id darkcave-light-crystal-low-light-hint)
"sksp0332"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(go cavecrystal-idle)
)
)
(let ((s5-1 (-> self draw color-emissive)))
(vector-! gp-0 (-> self on-color-emissive) (-> self off-color-emissive))
(vector+*! s5-1 (-> self off-color-emissive) gp-0 f30-0)
(set! (-> s5-1 x) (fmax 0.0 (fmin (-> s5-1 x) f28-0)))
(set! (-> s5-1 y) (fmax 0.0 (fmin (-> s5-1 y) f28-0)))
(set! (-> s5-1 z) (fmax 0.0 (fmin (-> s5-1 z) f28-0)))
(set! (-> s5-1 w) 0.0)
)
)
(TODO-RENAME-9
*cavecrystal-light-control*
(-> self crystal-id)
(-> self glow-u)
self
)
(update-connected-crystals! self)
(when (>= 0.0 f30-0)
(level-hint-spawn
(game-text-id darkcave-light-crystal-low-light-hint)
"sksp0332"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(go cavecrystal-idle)
)
(update! (-> self sound))
(none)
)
(update! (-> self sound))
(none)
)
:code
(behavior ()
(logior! (-> self mask) (process-mask sleep-code))
(suspend)
0
(none)
)
(behavior () (logior! (-> self mask) (process-mask sleep-code)) (suspend) 0 (none))
)
(defmethod deactivate cavecrystal ((obj cavecrystal))
(if (nonzero? (-> obj sound))
(stop! (-> obj sound))
)
(stop! (-> obj sound))
)
((method-of-type process-drawable deactivate) obj)
(none)
)
@ -279,46 +217,31 @@
(set-vector! (-> obj off-color-emissive) 0.0 0.0 0.0 0.0)
(set-vector! (-> obj on-color-mult) 1.0 1.0 1.0 1.0)
(set-vector! (-> obj on-color-emissive) 0.0 0.0 0.0 0.0)
(let
((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-others))))
(let
((s3-0
(new
'process
'collide-shape-prim-mesh
s4-0
(the-as uint 0)
(the-as uint 0)
)
(let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-others))))
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
(set! (-> s3-0 prim-core collide-as) (the-as uint 512))
(set! (-> s3-0 collide-with) (the-as uint 16))
(set! (-> s3-0 prim-core action) (the-as uint 1))
(set! (-> s3-0 prim-core offense) 4)
(set! (-> s3-0 transform-index) 0)
(set-vector! (-> s3-0 local-sphere) 0.0 19251.2 0.0 22118.4)
(set-root-prim! s4-0 s3-0)
)
)
(set! (-> s3-0 prim-core collide-as) (the-as uint 512))
(set! (-> s3-0 collide-with) (the-as uint 16))
(set! (-> s3-0 prim-core action) (the-as uint 1))
(set! (-> s3-0 prim-core offense) 4)
(set! (-> s3-0 transform-index) 0)
(set-vector! (-> s3-0 local-sphere) 0.0 19251.2 0.0 22118.4)
(set-root-prim! s4-0 s3-0)
(set! (-> s4-0 nav-radius) 4915.2)
(backup-collide-with-as s4-0)
(set! (-> obj root-override) s4-0)
)
(set! (-> s4-0 nav-radius) 4915.2)
(backup-collide-with-as s4-0)
(set! (-> obj root-override) s4-0)
)
(set! (-> obj link) (new 'process 'actor-link-info obj))
(set! (-> obj crystal-id) (actor-count-before (-> obj link)))
(set! (-> obj is-master?) (= (-> obj crystal-id) 3))
(set! (-> obj glow-wf-period) (rand-vu-int-range 225 375))
(set! (-> obj glow-wf-offset) (rand-vu-int-range 0 300))
(if (-> obj is-master?)
(logclear! (-> obj mask) (process-mask actor-pause))
)
(set!
(-> obj start-fade-time)
(the-as
uint
(the int (* 300.0 (res-lump-float (-> obj entity) 'timeout :default 8.0)))
)
)
(logclear! (-> obj mask) (process-mask actor-pause))
)
(set! (-> obj start-fade-time)
(the-as uint (the int (* 300.0 (res-lump-float (-> obj entity) 'timeout :default 8.0))))
)
(process-drawable-from-entity! obj arg0)
(initialize-skeleton obj *cavecrystal-sg* '())
(nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f))
@ -326,32 +249,30 @@
(set! (-> obj draw color-emissive quad) (-> obj off-color-emissive quad))
(ja-channel-push! 1 0)
(let ((s5-1 (-> obj skel root-channel 0)))
(joint-control-channel-group-eval!
s5-1
(the-as art-joint-anim (-> obj draw art-group data 3))
num-func-identity
(joint-control-channel-group-eval!
s5-1
(the-as art-joint-anim (-> obj draw art-group data 3))
num-func-identity
)
(set! (-> s5-1 frame-num) 0.0)
)
(set! (-> s5-1 frame-num) 0.0)
)
(ja-post)
(dummy-47 (-> obj root-override))
(TODO-RENAME-9 *cavecrystal-light-control* (-> obj crystal-id) 0.0 obj)
(set!
(-> obj sound)
(new
'process
'ambient-sound
(new 'static 'sound-spec
:mask #x80
:num 1.0
:group #x1
:sound-name (static-sound-name "crystal-on")
:volume #x400
:fo-max 80
)
(-> obj root-override trans)
)
)
(set! (-> obj sound) (new
'process
'ambient-sound
(new 'static 'sound-spec
:mask #x80
:num 1.0
:group #x1
:sound-name (static-sound-name "crystal-on")
:volume #x400
:fo-max 80
)
(-> obj root-override trans)
)
)
(go cavecrystal-idle)
(none)
)

File diff suppressed because it is too large Load diff

View file

@ -5,8 +5,6 @@
;; name in dgo: cavecrystal-light
;; dgos: L1, MAI, MAINCAVE
(declare-type cavecrystal process-drawable)
;; DECOMP BEGINS
(define *cavecrystal-engine* (new 'loading-level 'engine 'cavecrystal 64))

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,8 @@ files_with_modifications = [
"collide-shape",
"cam-states",
"plant-boss",
"helix-water"
"helix-water",
"lavatube-energy"
]
for file in files:

View file

@ -54,6 +54,8 @@
(target-racing-hit handle attack-info)
(target-racing-jump float float symbol)
target-title
target-title-play
target-title-wait
(target-warp-in vector vector)
)
)

557
test/decompiler/reference/engine/ui/hud_REF.gc generated vendored Normal file
View file

@ -0,0 +1,557 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 7 of type hud
;; INFO: Return type mismatch process vs hud.
(defmethod relocate hud ((obj hud) (arg0 int))
(dotimes (v1-0 (-> obj nb-of-particles))
(if (nonzero? (-> obj particles v1-0 part))
(&+! (-> obj particles v1-0 part) arg0)
)
)
(the-as hud ((method-of-type process relocate) obj arg0))
)
;; definition for method 10 of type hud
(defmethod deactivate hud ((obj hud))
(dotimes (v1-0 9)
(if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) obj))
(set! (-> *hud-parts* parts v1-0) (the-as (pointer process) #f))
)
)
(dotimes (s5-0 (-> obj nb-of-particles))
(kill-and-free-particles (-> obj particles s5-0 part))
(set! (-> obj particles s5-0 part matrix) -1)
)
((method-of-type process deactivate) obj)
(none)
)
;; definition for method 15 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod dummy-15 hud ((obj hud))
(when (and (not (dummy-14 obj)) (not (paused?)))
(dotimes (s5-0 (-> obj nb-of-particles))
(when (!= s5-0 (-> obj skip-particle))
(if (or (!= (-> obj particles 0 pos x) 0.0) (!= (-> obj particles 0 pos y) 0.0))
(spawn (-> obj particles s5-0 part) *null-vector*)
)
)
)
)
0
(none)
)
;; definition for method 16 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-16 hud ((obj hud) (arg0 int) (arg1 int))
(if (= arg0 (-> obj target-value))
(set! (-> obj last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
)
(when (and (not *progress-process*) (and
(!= (-> obj last-hide-time) (-> *display* base-frame-counter))
(not (movie?))
(>= (- (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) 30)
(>= (- (-> *display* base-frame-counter) (-> *game-info* blackout-time)) 30)
(not (and *target* (logtest? (-> *target* state-flags) 256)))
)
)
(when (or
(!= (-> obj value) arg0)
(!= (-> obj value2) arg1)
(-> obj force-on-screen)
(or
(and (cpad-hold? 0 l2) (not (-> obj disable)))
(and (not *cheat-mode*) (cpad-hold? 0 r2))
(-> obj first-init)
)
)
(cond
((and
(-> obj increment-on-event)
(< (-> obj value) arg0)
(not (-> obj first-init))
(< (- (-> *display* base-frame-counter) (the-as int (-> obj last-target-equal-time))) 450)
)
(when (and
(!= (-> obj value) (-> obj target-value))
(>= (- (-> *display* base-frame-counter) (the-as int (-> obj last-increment-time))) 30)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(+! (-> obj value) 1)
(set! (-> obj last-increment-time) (the-as uint (-> *display* base-frame-counter)))
)
)
(else
(if (not (and
(not (-> obj first-init))
(>= (- (-> *display* base-frame-counter) (the-as int (-> obj last-target-equal-time))) 450)
)
)
(set! (-> obj value) arg0)
)
(set! (-> obj target-value) arg0)
(set! (-> obj last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
)
)
(set! (-> obj value2) arg1)
(when (and (not (movie?)) (= *master-mode* 'game) (not (-> obj first-init)) (not (-> obj disable)))
(if (>= (-> obj friend) 0)
(send-event (ppointer->process (-> *hud-parts* parts (-> obj friend))) 'show)
)
(go hud-arriving)
)
(set! (-> obj trigger-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> obj first-init) #f)
)
)
0
(none)
)
;; definition for method 17 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod dummy-17 hud ((obj hud))
(dotimes (v1-0 (-> obj nb-of-icons))
(set-vector!
(-> obj icons v1-0 icon 0 root scale)
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
(* (-> obj icons v1-0 scale-y) (-> *video-parms* relative-y-scale))
(* (-> obj icons v1-0 scale-x) (-> *video-parms* relative-x-scale))
1.0
)
(set! (-> obj icons v1-0 icon 0 root trans x)
(the float (+ (-> obj icons v1-0 icon-x) -256 (* (-> obj x-sgn) (-> obj offset))))
)
(set! (-> obj icons v1-0 icon 0 root trans y)
(- (+ (the float (-> obj icons v1-0 icon-y))
(* (the float (-> obj y-sgn))
(the float (-> obj offset))
(-> *video-parms* relative-y-scale)
(-> *video-parms* relative-y-scale)
)
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
)
(the float (-> *video-parms* screen-sy))
)
)
)
0
(none)
)
;; definition for method 18 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod dummy-18 hud ((obj hud))
(dotimes (s5-0 (-> obj nb-of-particles))
(when (!= (-> obj skip-particle) -2)
(set! (-> obj particles s5-0 pos x)
(+ -256.0 (the float (* (-> obj x-sgn) (-> obj offset))) (-> obj particles s5-0 init-pos x))
)
(set! (-> obj particles s5-0 pos y)
(* 0.5 (- (* (-> *video-parms* relative-y-scale)
(+ (-> obj particles s5-0 init-pos y)
(the float (* (-> obj y-sgn) (-> obj offset)))
(* (the float (-> obj y-offset)) (-> *video-parms* relative-x-scale-reciprical))
)
)
(the float (-> *video-parms* screen-sy))
)
)
)
(set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z))
)
(if (> (-> obj particles s5-0 part matrix) 0)
(set-vector!
(sprite-get-user-hvdf (-> obj particles s5-0 part matrix))
(the float (+ (the int (-> obj particles s5-0 pos x)) 2048))
(the float (+ (the int (-> obj particles s5-0 pos y)) 2048))
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))
(-> *math-camera* hvdf-off w)
)
)
)
0
(none)
)
;; definition for method 19 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-19 hud ((obj hud))
0
(none)
)
;; definition for method 20 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod init-particles! hud ((obj hud) (arg0 int))
0
(none)
)
;; definition for method 21 of type hud
(defmethod first-icon-x hud ((obj hud))
0
)
;; definition for method 22 of type hud
(defmethod first-icon-y hud ((obj hud))
0
)
;; definition for method 25 of type hud
(defmethod inc-value hud ((obj hud))
0.0
)
;; definition for method 26 of type hud
(defmethod dec-value hud ((obj hud))
0.0
)
;; definition for method 24 of type hud
;; INFO: Return type mismatch int vs none.
(defmethod animate! hud ((obj hud) (arg0 symbol) (arg1 symbol))
0
(none)
)
;; definition for method 14 of type hud
;; INFO: Return type mismatch symbol vs none.
(defmethod dummy-14 hud ((obj hud))
(= (-> obj next-state name) 'hud-hidden)
(none)
)
;; failed to figure out what this is:
(defstate hud-hidden (hud)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object))
(case arg2
(('show)
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
(go hud-arriving)
)
)
(('hide)
(set! v0-0 (-> *display* base-frame-counter))
(set! (-> self last-hide-time) (the-as uint v0-0))
v0-0
)
(('hide-quick)
(set! v0-0 (-> *display* base-frame-counter))
(set! (-> self last-hide-time) (the-as uint v0-0))
v0-0
)
(('increment)
(set! v0-0 (+ (-> self target-value) 1))
(set! (-> self target-value) (the-as int v0-0))
v0-0
)
(('sync)
(set! v0-0 #t)
(set! (-> self first-init) (the-as symbol v0-0))
v0-0
)
(('disable)
(set! v0-0 #t)
(set! (-> self disable) (the-as symbol v0-0))
v0-0
)
(('enable)
(set! (-> self disable) #f)
#f
)
)
)
:enter
(behavior ()
(set! (-> self offset) 128)
(dummy-17 self)
(dummy-18 self)
(let ((gp-0 (-> self child)))
(while gp-0
(send-event (ppointer->process gp-0) 'draw #f)
(set! gp-0 (-> gp-0 0 brother))
)
)
(dotimes (gp-1 (-> self nb-of-particles))
(kill-and-free-particles (-> self particles gp-1 part))
(set! (-> self particles gp-1 part matrix) -1)
)
(none)
)
:exit
(behavior () (set! (-> self y-offset) (-> self next-y-offset)) (none))
:code
(behavior ()
(logior! (-> self mask) (process-mask sleep-code))
(while #t
(suspend)
)
(none)
)
:post
(behavior ()
(if (-> self deactivate-when-hidden)
(deactivate self)
)
(TODO-RENAME-19 self)
(none)
)
)
;; failed to figure out what this is:
(defstate hud-arriving (hud)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-3 object))
(case arg2
(('hide-quick)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(('hide)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(go hud-leaving 10)
)
(('show)
(if (and (not *progress-process*) (!= (-> self last-hide-time) (-> *display* base-frame-counter)))
(go hud-arriving)
)
)
(('increment)
(set! v0-3 (+ (-> self target-value) 1))
(set! (-> self target-value) (the-as int v0-3))
v0-3
)
(('sync)
(set! v0-3 #t)
(set! (-> self first-init) (the-as symbol v0-3))
v0-3
)
(('disable)
(set! v0-3 #t)
(set! (-> self disable) (the-as symbol v0-3))
v0-3
)
(('enable)
(set! (-> self disable) #f)
#f
)
)
)
:enter
(behavior ()
(let ((gp-0 (-> self child)))
(while gp-0
(send-event (ppointer->process gp-0) 'draw #t)
(set! gp-0 (-> gp-0 0 brother))
)
)
(dotimes (gp-1 (-> self nb-of-particles))
(if (= (-> self particles gp-1 part matrix) -1)
(set! (-> self particles gp-1 part matrix) (sprite-allocate-user-hvdf))
)
)
(none)
)
:code
(behavior ()
(while #t
(if (not (paused?))
(set! (-> self offset) (seekl (-> self offset) 0 (the int (* 15.0 (-> *display* time-adjust-ratio)))))
)
(dummy-17 self)
(if (<= (-> self offset) 0)
(go hud-in)
)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(suspend)
)
(none)
)
:post
(behavior () (TODO-RENAME-19 self) (dummy-18 self) (dummy-15 self) (none))
)
;; failed to figure out what this is:
(defstate hud-in (hud)
:event
(-> hud-arriving event)
:code
(behavior ()
(set! (-> self trigger-time) (the-as uint (-> *display* base-frame-counter)))
(while (and (< (- (-> *display* base-frame-counter) (the-as int (-> self trigger-time))) 600) (not (movie?)))
(set! (-> self offset) 0)
(dummy-17 self)
(suspend)
)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(go hud-leaving 5)
(none)
)
:post
(-> hud-arriving post)
)
;; failed to figure out what this is:
(defstate hud-leaving (hud)
:event
(-> hud-arriving event)
:code
(behavior ((arg0 int))
(while #t
(if (not (paused?))
(set! (-> self offset)
(seekl (-> self offset) 128 (the int (* (the float arg0) (-> *display* time-adjust-ratio))))
)
)
(dummy-17 self)
(when (movie?)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self force-on-screen) #f)
(set! (-> self offset) 128)
(dummy-18 self)
(dummy-17 self)
(TODO-RENAME-19 self)
(go hud-hidden)
)
(if (>= (-> self offset) 128)
(go hud-hidden)
)
(suspend)
)
(none)
)
:post
(-> hud-arriving post)
)
;; definition for function hud-init-by-other
;; INFO: Return type mismatch object vs none.
(defbehavior hud-init-by-other hud ((arg0 int))
(set! (-> self nb-of-icons) 0)
(set! (-> self nb-of-particles) 0)
(set! (-> self max-nb-of-particles) 7)
(set! (-> self first-init) #t)
(set! (-> self friend) -1)
(set! (-> self last-increment-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self last-target-equal-time) (the-as uint (-> *display* base-frame-counter)))
(set! (-> self increment-on-event) #f)
(set! (-> self skip-particle) -1)
(set! (-> self disable) #f)
(set! (-> self force-on-screen) #f)
(set! (-> self deactivate-when-hidden) #f)
(set! (-> self y-offset) 0)
(set! (-> self next-y-offset) 0)
(set! (-> self last-hide-time) (the-as uint (-> *display* base-frame-counter)))
(logior! (-> self mask) (process-mask menu))
(logclear! (-> self mask) (process-mask pause progress))
(init-particles! self arg0)
(dummy-17 self)
(dummy-18 self)
(go hud-hidden)
(none)
)
;; definition for function send-hud-increment-event
(defun send-hud-increment-event ((arg0 hud))
(if (-> arg0 increment-on-event)
(send-event arg0 'increment)
)
)
;; failed to figure out what this is:
(defstate hud-collecting (collectable)
:trans
(behavior ()
(case (-> self type)
((fuel-cell)
(fuel-cell-animate)
)
)
(none)
)
:code
(behavior ((arg0 handle))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (handle->process arg0)))
(set! (-> s5-0 x) (- (the float (+ (first-icon-x (the-as hud s4-0)) -256)) (-> self root-override trans x)))
(set! (-> s5-0 y) (- (the float (- (first-icon-y (the-as hud s4-0)) (-> *video-parms* screen-sy)))
(-> self root-override trans y)
)
)
)
(let ((f30-0 4.0)
(f26-0 0.0)
(f28-0 (-> self root-override scale x))
(f24-0 (-> self root-override scale y))
(f22-0 (-> self root-override scale z))
)
(while #t
(let ((f0-7 (* f30-0 (-> *display* seconds-per-frame))))
(+! f26-0 f0-7)
(when (< 1.0 f26-0)
(let ((f0-8 (- f26-0 f0-7)))
(set! f0-7 (- 1.0 f0-8))
)
(set! f26-0 1.0)
)
(+! (-> self root-override trans x) (* f0-7 (-> s5-0 x)))
(+! (-> self root-override trans y) (* f0-7 (-> s5-0 y)))
)
(set-vector!
(-> self root-override scale)
(* f28-0 (-> *video-parms* relative-x-scale))
(* f24-0 (-> *video-parms* relative-y-scale) (-> *video-parms* relative-y-scale))
(* f22-0 (-> *video-parms* relative-x-scale))
1.0
)
(let ((a0-12 (-> self root-override)))
(set-yaw-angle-clear-roll-pitch!
a0-12
(- (y-angle a0-12) (* 182.04445 (* 8.0 (-> *display* time-adjust-ratio))))
)
)
(suspend)
(when (>= f26-0 1.0)
(send-hud-increment-event (the-as hud (handle->process arg0)))
(deactivate self)
)
)
)
)
(none)
)
:post
(the-as (function none :behavior collectable) ja-post)
)

View file

@ -28,6 +28,10 @@
(update-connected-crystals! (_type_) none 20)
(compute-glow (_type_) float 21)
)
(:states
cavecrystal-active
cavecrystal-idle
)
)
;; definition for method 3 of type cavecrystal

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1080
test/decompiler/reference/levels/title/title-obs_REF.gc generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,8 @@
"DGO/OGR.DGO",
"DGO/TRA.DGO",
"DGO/ROL.DGO",
"DGO/DAR.DGO"
"DGO/DAR.DGO",
"DGO/TIT.DGO"
],
"skip_compile_files": [