Files
jak-project/test/decompiler/reference/jak1/engine/common-obs/crates_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

1431 lines
45 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(defskelgroup *crate-barrel-sg* crate crate-barrel-lod0-jg crate-barrel-idle-ja
((crate-barrel-lod0-mg (meters 20)) (crate-barrel-lod1-mg (meters 40)) (crate-barrel-lod2-mg (meters 999999)))
:bounds (static-spherem 0 1 0 1.6)
:texture-level 2
)
;; failed to figure out what this is:
(defskelgroup *crate-bucket-sg* crate crate-bucket-lod0-jg crate-bucket-idle-ja
((crate-bucket-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 4)
:texture-level 2
)
;; failed to figure out what this is:
(defskelgroup *crate-wood-sg* crate crate-wood-lod0-jg crate-idle-ja
((crate-wood-lod0-mg (meters 20)) (crate-wood-lod1-mg (meters 40)) (crate-wood-lod2-mg (meters 999999)))
:bounds (static-spherem 0 1 0 1.6)
:texture-level 2
)
;; failed to figure out what this is:
(defskelgroup *crate-iron-sg* crate crate-iron-lod0-jg crate-idle-ja
((crate-iron-lod0-mg (meters 20)) (crate-iron-lod1-mg (meters 40)) (crate-iron-lod2-mg (meters 999999)))
:bounds (static-spherem 0 1 0 1.6)
:texture-level 2
)
;; failed to figure out what this is:
(defskelgroup *crate-steel-sg* crate crate-steel-lod0-jg crate-idle-ja
((crate-steel-lod0-mg (meters 20)) (crate-steel-lod1-mg (meters 40)) (crate-steel-lod2-mg (meters 999999)))
:bounds (static-spherem 0 1 0 1.6)
:texture-level 2
)
;; failed to figure out what this is:
(defskelgroup *crate-darkeco-sg* crate crate-darkeco-lod0-jg crate-idle-ja
((crate-darkeco-lod0-mg (meters 20))
(crate-darkeco-lod1-mg (meters 40))
(crate-darkeco-lod2-mg (meters 999999))
)
:bounds (static-spherem 0 1 0 1.6)
:texture-level 2
)
;; definition of type crate-bank
(deftype crate-bank (basic)
((COLLIDE_YOFF float)
(COLLIDE_RADIUS float)
(DARKECO_EXPLODE_RADIUS float)
)
)
;; definition for method 3 of type crate-bank
(defmethod inspect ((this crate-bank))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~TCOLLIDE_YOFF: ~f~%" (-> this COLLIDE_YOFF))
(format #t "~TCOLLIDE_RADIUS: ~f~%" (-> this COLLIDE_RADIUS))
(format #t "~TDARKECO_EXPLODE_RADIUS: ~f~%" (-> this DARKECO_EXPLODE_RADIUS))
this
)
;; definition for symbol *CRATE-bank*, type crate-bank
(define *CRATE-bank*
(new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 4915.2 :DARKECO_EXPLODE_RADIUS 16384.0)
)
;; definition of type crate
(deftype crate (process-drawable)
((root collide-shape-moving :override)
(smush smush-control :inline)
(base vector :inline)
(look symbol)
(defense symbol)
(incomming-attack-id uint64)
(target handle)
(child-count int32)
(victory-anim spool-anim)
)
(:state-methods
wait
(die symbol int)
special-contents-die
bounce-on
(notice-blue handle)
)
(:methods
(params-init (_type_ entity) none)
(art-init (_type_) crate)
(params-set! (_type_ symbol symbol) none)
(check-dead (_type_) none)
(smush-update! (_type_) none)
)
)
;; definition for method 3 of type crate
(defmethod inspect ((this crate))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~T~Tsmush: #<smush-control @ #x~X>~%" (-> this smush))
(format #t "~T~Tbase: ~`vector`P~%" (-> this base))
(format #t "~T~Tlook: ~A~%" (-> this look))
(format #t "~T~Tdefense: ~A~%" (-> this defense))
(format #t "~T~Tincomming-attack-id: ~D~%" (-> this incomming-attack-id))
(format #t "~T~Ttarget: ~D~%" (-> this target))
(format #t "~T~Tchild-count: ~D~%" (-> this child-count))
(format #t "~T~Tvictory-anim: ~A~%" (-> this victory-anim))
this
)
;; failed to figure out what this is:
(method-set! crate 12 (method-of-type process run-logic?))
;; definition for function crate-post
(defbehavior crate-post crate ()
(rider-trans)
(smush-update! self)
(rider-post)
)
;; failed to figure out what this is:
(defpart 281
:init-specs ((:texture (new 'static 'texture-id :page #x2))
(:num 16.0)
(:y (meters 0.5) (meters 1))
(:scale-x (meters 1.5) (meters 1.5))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 128.0 32.0)
(:g 128.0 32.0)
(:b 128.0 32.0)
(:a 32.0 16.0)
(:vel-y (meters 0.016666668) (meters 0.033333335))
(:rotvel-z (degrees -1.2) (degrees 1.2))
(:accel-y (meters 0.00066666666))
(:timer (seconds 0.4))
(:flags (bit2 bit12 bit14))
(:next-time (seconds 0.1) (seconds 0.197))
(:next-launcher 282)
(:conerot-x (degrees 70) (degrees 20))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpart 282
:init-specs ((:fade-a -1.0666667))
)
;; failed to figure out what this is:
(defpart 283
:init-specs ((:texture (new 'static 'texture-id :index #x2 :page #x2))
(:num 4.0)
(:y (meters 0.75))
(:scale-x (meters 6))
(:rot-x 4)
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3) (meters 1))
(:r 192.0)
(:g 192.0)
(:b 64.0 128.0)
(:a 0.0)
(:scalevel-x (meters 0.009765625))
(:rotvel-z (degrees -0.15) (degrees 0.3))
(:scalevel-y (meters 0.009765625))
(:fade-a 2.1333334)
(:timer (seconds 0.1))
(:flags (bit2 bit3 bit14))
(:next-time (seconds 0.05))
(:next-launcher 284)
(:rotate-y (degrees 0))
)
)
;; failed to figure out what this is:
(defpart 284
:init-specs ((:fade-a -2.1333334))
)
;; failed to figure out what this is:
(defpart 285
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
(:num 1.0)
(:y (meters 1))
(:scale-x (meters 8))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 196.0)
(:g 196.0)
(:b 196.0)
(:a 28.0)
(:timer (seconds 0.035))
(:flags (bit2 bit3 bit14))
)
)
;; failed to figure out what this is:
(defpart 286
:init-specs ((:texture (new 'static 'texture-id :index #x6 :page #x2))
(:num 5.0)
(:x (meters -0.5) (meters 1))
(:y (meters 0.25) (meters 1.5))
(:z (meters -0.5) (meters 1))
(:scale-x (meters 0.6) 2.0 (meters 0.6))
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3))
(:r 160.0)
(:g 160.0)
(:b 160.0)
(:a 128.0)
(:vel-y (meters 0.06666667) (meters 0.06666667))
(:rotvel-x (degrees 1.2))
(:rotvel-y (degrees 2.4))
(:rotvel-z (degrees 0) 2 (degrees 2.4))
(:accel-y (meters -0.0033333334))
(:friction 0.97)
(:timer (seconds 0.5))
(:flags (bit2 bit12 bit14))
(:next-time (seconds 0.25))
(:next-launcher 287)
(:conerot-x (degrees 40) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpart 287
:init-specs ((:scalevel-x (meters -0.0033333334)) (:scalevel-y :copy scalevel-x) (:fade-a -3.4))
)
;; failed to figure out what this is:
(defpart 288
:init-specs ((:texture (new 'static 'texture-id :index #x5 :page #x2))
(:num 4.5)
(:x (meters -0.5) (meters 1))
(:y (meters 0.25) (meters 1.5))
(:z (meters -0.5) (meters 1))
(:scale-x (meters 0.3) 1 (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3))
(:r 100.0)
(:g 100.0)
(:b 100.0)
(:a 128.0)
(:vel-y (meters 0.06666667) (meters 0.06666667))
(:rotvel-x (degrees 1.2))
(:rotvel-y (degrees 2.4))
(:rotvel-z (degrees 0) 3 (degrees 2.4))
(:accel-y (meters -0.0033333334))
(:friction 0.97)
(:timer (seconds 0.5))
(:flags (bit2 bit12 bit14))
(:next-time (seconds 0.25))
(:next-launcher 287)
(:conerot-x (degrees 40) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpartgroup group-crate-explode
:id 71
:duration (seconds 0.017)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 12)
:parts ((sp-item 281) (sp-item 283) (sp-item 285) (sp-item 286) (sp-item 288))
)
;; failed to figure out what this is:
(defpartgroup group-crate-steel-explode
:id 72
:duration (seconds 0.017)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 12)
:parts ((sp-item 281) (sp-item 283) (sp-item 285) (sp-item 288) (sp-item 288) (sp-item 288))
)
;; failed to figure out what this is:
(defpartgroup group-dark-eco-box-explosion
:id 73
:duration (seconds 2)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 12)
:parts ((sp-item 295 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017) :binding 296)
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 296 :flags (start-dead launch-asap) :binding 297)
(sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
(sp-item 292 :fade-after (meters 160) :period (seconds 2) :length (seconds 0.017))
(sp-item 2095 :period (seconds 2) :length (seconds 0.017))
(sp-item 2096 :fade-after (meters 80) :falloff-to (meters 80) :period (seconds 2) :length (seconds 0.135))
(sp-item 2097 :period (seconds 2) :length (seconds 0.067))
(sp-item 2098 :fade-after (meters 120) :falloff-to (meters 120) :period (seconds 2) :length (seconds 0.067))
)
)
;; failed to figure out what this is:
(defpart 2096
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
(:num 6.0)
(:scale-x (meters 0.2) (meters 0.4))
(:scale-y :copy scale-x)
(:r 64.0 128.0)
(:g 0.0 32.0)
(:b 96.0 64.0)
(:a 32.0 96.0)
(:vel-y (meters 0.026666667) (meters 0.10666667))
(:scalevel-x (meters -0.0016666667))
(:scalevel-y :copy scalevel-x)
(:accel-y (meters -0.00016666666) (meters -0.00016666666))
(:friction 0.9)
(:timer (seconds 1))
(:flags (bit2 bit14))
(:next-time (seconds 0.1) (seconds 0.097))
(:next-launcher 2099)
(:conerot-x (degrees 0) (degrees 140))
(:conerot-y (degrees 0) (degrees 360))
(:conerot-radius (meters 2) (meters 4))
)
)
;; failed to figure out what this is:
(defpart 2099
:init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:fade-a -1.4222223))
)
;; failed to figure out what this is:
(defpart 2098
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
(:num 3.0)
(:scale-x (meters 0.2))
(:rot-z (degrees 0) (degrees 180))
(:scale-y (meters 8))
(:r 64.0 192.0)
(:g 0.0 32.0)
(:b 128.0 64.0)
(:a 32.0 64.0)
(:scalevel-y (meters 0.42666668))
(:fade-a -1.6)
(:timer (seconds 0.2))
(:flags (bit2 bit3 bit14))
)
)
;; failed to figure out what this is:
(defpart 2095
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
(:num 1.0)
(:scale-x (meters 16))
(:scale-y :copy scale-x)
(:r 64.0 192.0)
(:g 0.0 32.0)
(:b 128.0 64.0)
(:a 96.0)
(:fade-a -1.7454545)
(:timer (seconds 0.18))
(:flags (bit2 bit3 bit14))
)
)
;; failed to figure out what this is:
(defpart 2097
:init-specs ((:texture (new 'static 'texture-id :page #x2))
(:num 4.0)
(:scale-x (meters 2.5) (meters 1.5))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 0.0 96.0)
(:g 0.0 32.0)
(:b 64.0 32.0)
(:a 64.0 64.0)
(:vel-y (meters 0.053333335) (meters 0.013333334))
(:scalevel-x (meters 0.013333334))
(:rotvel-z (degrees -0.3) (degrees 0.6))
(:scalevel-y :copy scalevel-x)
(:fade-a -0.42666668)
(:accel-y (meters 0.00016666666) (meters 0.00016666666))
(:friction 0.8)
(:timer (seconds 1.7))
(:flags (bit2 bit14))
(:conerot-x (degrees 0) (degrees 110))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpart 295
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
(:num 16.0)
(:y (meters 1))
(:scale-x (meters 0.1))
(:scale-y :copy scale-x)
(:a 0.0)
(:vel-y (meters 0.053333335) (meters 0.026666667))
(:accel-y (meters -0.00033333333))
(:friction 0.94)
(:timer (seconds 0.8))
(:flags (bit3 bit14))
(:conerot-x (degrees 0) (degrees 140))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpart 296
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
(:num 1.0)
(:y (meters 0) (meters 16))
(:z (meters 0.3) (meters 0.3))
(:scale-x (meters 0.3) (meters 0.3))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 0.0 96.0)
(:g 0.0 32.0)
(:b 64.0 32.0)
(:a 64.0 64.0)
(:omega 0.0 65536.0)
(:vel-x (meters 0.026666667) (meters 0.10666667))
(:scalevel-x (meters -0.000909091))
(:rotvel-z (degrees -0.3) 1 (degrees 0.6))
(:scalevel-y :copy scalevel-x)
(:fade-g -0.26666668)
(:fade-a -0.19393939)
(:timer (seconds 0.3) (seconds 0.497))
(:flags (bit2 bit3 bit7 bit14))
)
)
;; failed to figure out what this is:
(defpart 297
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
(:num 1.0)
(:scale-x (meters 0.3) (meters 0.1))
(:scale-y :copy scale-x)
(:r 32.0 96.0)
(:g 0.0 32.0)
(:b 64.0 32.0)
(:a 32.0 32.0)
(:scalevel-x (meters -0.0006190476))
(:scalevel-y :copy scalevel-x)
(:fade-a -0.01904762)
(:accel-y (meters -0.000100000005) (meters -0.00015))
(:timer (seconds 0.1) (seconds 0.997))
(:flags (bit2 bit3 bit14))
(:next-time (seconds 0.8))
(:next-launcher 198)
)
)
;; failed to figure out what this is:
(defpart 292
:init-specs ((:texture (new 'static 'texture-id :index #x5 :page #x2))
(:num 8.0 16.0)
(:x (meters -0.5) (meters 1))
(:y (meters 0.25) (meters 1.5))
(:z (meters -0.5) (meters 1))
(:scale-x (meters 0.3) 1 (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y (meters 0.3))
(:r 128.0)
(:g 64.0 1 32.0)
(:b 32.0)
(:a 128.0)
(:vel-y (meters 0.06666667) (meters 0.06666667))
(:rotvel-x (degrees 1.2))
(:rotvel-y (degrees 2.4))
(:rotvel-z (degrees 0) 3 (degrees 2.4))
(:accel-y (meters -0.0033333334))
(:friction 0.97)
(:timer (seconds 0.5))
(:flags (bit2 bit12 bit14))
(:next-time (seconds 0.25))
(:next-launcher 301)
(:conerot-x (degrees 40) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; failed to figure out what this is:
(defpart 301
:init-specs ((:scalevel-x (meters -0.0033333334)) (:scalevel-y :copy scalevel-x) (:fade-a -3.4))
)
;; definition for function crate-standard-event-handler
(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('attack)
(let ((s4-0 (-> arg3 param 2))
(s5-0 (-> arg3 param 3))
)
(case (-> self defense)
(('iron)
(case (-> arg3 param 1)
(('flop 'uppercut 'explode 'darkeco 'eco-yellow 'bonk 'racer 'tube 'flut-bonk 'flut-attack)
(if (and (logtest? (-> self fact options) (fact-options require-zoomer))
*target*
(not (logtest? (-> *target* control root-prim prim-core action) (collide-action racer)))
)
(return #f)
)
(increment-success-for-hint (text-id sidekick-hint-crate-iron))
(increment-success-for-hint (text-id training-ironcrate))
(send-event arg0 'get-attack-count 1)
(go-virtual die #f (the-as int s5-0))
)
(else
(when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root trans y) (-> self base y)))
(if (not (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese)))
)
(level-hint-spawn (text-id training-ironcrate) "sagevb36" (the-as entity #f) *entity-pool* (game-task none))
)
(case (-> (level-get-target-inside *level*) name)
(('training)
(if (and (can-hint-be-played? (text-id zero) (the-as entity #f) (the-as string #f)) (rand-vu-percent? 0.2))
(clear-text-seen! *game-info* (text-id sidekick-hint-crate-iron))
)
)
)
(level-hint-spawn
(text-id sidekick-hint-crate-iron)
"sksp0005"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(set! (-> self incomming-attack-id) s4-0)
(if (not (!= (-> self smush amp) 0.0))
(sound-play "icrate-nobreak")
)
(activate! (-> self smush) 0.1 90 150 1.0 1.0)
(go-virtual bounce-on)
)
#f
)
)
)
(('steel)
(case (-> arg3 param 1)
(('explode 'darkeco 'eco-yellow 'bonk 'tube 'flut-bonk 'flut-attack 'racer)
(send-event arg0 'get-attack-count 1)
(when (logtest? (-> self draw status) (draw-status was-drawn))
(increment-success-for-hint (text-id sidekick-hint-crate-steel))
(level-hint-spawn
(text-id sidekick-hint-crate-steel-break1)
"sksp0004"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(level-hint-spawn
(text-id sidekick-hint-crate-steel-break2)
"sksp009b"
(the-as entity #f)
*entity-pool*
(game-task none)
)
)
(go-virtual die #f (the-as int s5-0))
)
(else
(when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root trans y) (-> self base y)))
(level-hint-spawn
(text-id sidekick-hint-crate-steel)
"sksp0006"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(set! (-> self incomming-attack-id) s4-0)
(if (not (!= (-> self smush amp) 0.0))
(sound-play "scrate-nobreak")
)
(activate! (-> self smush) 0.1 90 150 1.0 1.0)
(go-virtual bounce-on)
)
#f
)
)
)
(('darkeco)
(send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'darkeco))))
(when (= (-> arg0 type) target)
(level-hint-spawn
(text-id sidekick-hint-crate-darkeco2)
"sksp009c"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(level-hint-spawn
(text-id sidekick-hint-crate-darkeco1)
"sksp0002"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(case (-> (level-get-target-inside *level*) name)
(('rolling)
(level-hint-spawn
(text-id sidekick-hint-crate-darkeco-rolling)
"sksp0110"
(the-as entity #f)
*entity-pool*
(game-task none)
)
)
(('firecanyon)
(level-hint-spawn
(text-id firecanyon-crate-darkeco2)
"sksp0082"
(the-as entity #f)
*entity-pool*
(game-task none)
)
(level-hint-spawn
(text-id firecanyon-crate-darkeco1)
"sksp0081"
(the-as entity #f)
*entity-pool*
(game-task none)
)
)
)
)
(go-virtual die #f (the-as int s5-0))
)
(else
(send-event arg0 'get-attack-count 1)
(go-virtual die #f (the-as int s5-0))
)
)
)
)
(('touch)
(case (-> self defense)
(('darkeco)
(send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'darkeco))))
(go-virtual die #f 0)
)
)
)
(('bonk)
(when (= (-> self root trans y) (-> self base y))
(activate! (-> self smush) -0.1 75 150 1.0 1.0)
(go-virtual bounce-on)
)
)
(('wake)
(let ((v0-0 (the-as object (logclear (-> self mask) (process-mask sleep)))))
(set! (-> self mask) (the-as process-mask v0-0))
v0-0
)
)
(('eco-blue)
(if (not (or (= (-> self defense) 'darkeco)
(or (= (-> self next-state name) 'notice-blue) (= (-> self next-state name) 'die))
(!= (-> self root trans y) (-> self base y))
)
)
(go-virtual notice-blue (process->handle arg0))
)
)
)
)
;; failed to figure out what this is:
(defstate wait (crate)
:virtual #t
:event crate-standard-event-handler
:code (behavior ()
(suspend)
(update-transforms! (-> self root))
(logior! (-> self mask) (process-mask sleep))
(loop
(suspend)
)
)
:post ja-post
)
;; failed to figure out what this is:
(defstate bounce-on (crate)
:virtual #t
:event crate-standard-event-handler
:code (behavior ()
(while (!= (-> self smush amp) 0.0)
(suspend)
)
(go-virtual wait)
)
:post crate-post
)
;; failed to figure out what this is:
(defstate notice-blue (crate)
:virtual #t
:event crate-standard-event-handler
:trans (behavior ()
(cond
((not (send-event *target* 'query 'powerup (pickup-type eco-blue)))
(logior! (-> self mask) (process-mask sleep-code))
(if (not (!= (-> self smush amp) 0.0))
(go-virtual wait)
)
)
(else
(logclear! (-> self mask) (process-mask sleep-code))
)
)
)
:code (behavior ((arg0 handle))
(set! (-> self target) arg0)
(loop
(let* ((gp-0 (handle->process (-> self target)))
(v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable))
gp-0
)
)
)
(when v1-4
(let* ((gp-1 (-> (the-as process-drawable v1-4) root))
(v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape))
gp-1
)
)
)
(when v1-6
(let* ((gp-2 (-> self root root-prim prim-core))
(a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core))
(f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3)))
)
(when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel))
(logior! (-> self fact options) (fact-options can-collect))
(go-virtual die #f 0)
)
(when (rand-vu-percent? 0.5)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> gp-2 world-sphere quad))
(dotimes (gp-3 3)
(+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8))
)
(eco-blue-glow s5-0)
)
)
(activate!
(-> self smush)
(lerp-scale
(rand-vu-float-range 0.1 0.3)
(rand-vu-float-range 0.0 0.02)
f30-0
(-> *FACT-bank* suck-suck-dist)
(-> *FACT-bank* suck-bounce-dist)
)
60
60
1.0
1.0
)
)
)
)
)
)
(suspend)
)
)
:post crate-post
)
;; failed to figure out what this is:
(defstate die (crate)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('touched)
(case (-> self defense)
(('darkeco)
(cond
((= (-> proc type) target)
(send-event proc 'attack (-> block param 0) (static-attack-info ((mode 'darkeco))))
)
(else
(let ((a1-5 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-5 from) self)
(set! (-> a1-5 num-params) 4)
(set! (-> a1-5 message) 'attack)
(set! (-> a1-5 param 0) (-> block param 0))
(set! (-> a1-5 param 1) (the-as uint 'darkeco))
(let ((v1-12 (+ *global-attack-id* 1)))
(set! *global-attack-id* v1-12)
(set! (-> a1-5 param 2) (the-as uint v1-12))
)
(set! (-> a1-5 param 3) (the-as uint 0))
(send-event-function proc a1-5)
)
)
)
)
)
)
)
)
:trans (behavior ()
(case (-> self type)
((crate-buzzer)
(if (and *target* (>= (-> *target* fact buzzer) 6.0))
(spool-push *art-control* (-> self victory-anim name) 0 self -99.0)
)
)
)
)
:code (behavior ((arg0 symbol) (arg1 int))
(clear-collide-with-as (-> self root))
(if (nonzero? (-> self sound))
(stop! (-> self sound))
)
(if (and *target*
(and (logtest? (-> *target* control root-prim prim-core action) (collide-action racer snowball tube flut))
(!= (-> self fact pickup-type) 6)
(not arg0)
)
)
(logior! (-> self fact options) (fact-options instant-collect))
)
(when (not arg0)
(let ((s5-1 (current-time)))
(until (time-elapsed? s5-1 (seconds 0.04))
(suspend)
)
)
(logior! (-> self draw status) (draw-status hidden))
(case (-> self look)
(('iron)
(sound-play "icrate-break")
)
(('steel)
(sound-play "scrate-break")
)
(('darkeco)
(sound-play "dcrate-break")
)
(else
(sound-play "wcrate-break")
)
)
(case (-> self defense)
(('darkeco)
(let ((f0-0 (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root trans) (target-pos 0)) 8192.0 40960.0)))
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3))
)
(process-spawn
touch-tracker
:init touch-tracker-init
(-> self root trans)
(-> *CRATE-bank* DARKECO_EXPLODE_RADIUS)
30
:to self
)
)
)
(case (-> self look)
(('darkeco)
(process-spawn
part-tracker
:init part-tracker-init
(-> *part-group-id-table* 73)
-1
#f
#f
#f
(-> self root trans)
:to *entity-pool*
)
)
(('steel 'iron)
(process-spawn
part-tracker
:init part-tracker-init
(-> *part-group-id-table* 72)
-1
#f
#f
#f
(-> self root trans)
:to *entity-pool*
)
)
(else
(process-spawn
part-tracker
:init part-tracker-init
(-> *part-group-id-table* 71)
-1
#f
#f
#f
(-> self root trans)
:to *entity-pool*
)
)
)
)
(case (-> self fact pickup-type)
(((pickup-type money)
(pickup-type buzzer)
(pickup-type eco-blue)
(pickup-type eco-yellow)
(pickup-type eco-red)
(pickup-type fuel-cell)
)
(go-virtual special-contents-die)
)
)
(drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1)
(process-entity-status! self (entity-perm-status dead) #t)
(process-entity-status! self (entity-perm-status complete) #t)
(let ((gp-1 (current-time)))
(until (time-elapsed? gp-1 (seconds 5))
(suspend)
)
)
)
)
;; failed to figure out what this is:
(defstate special-contents-die (crate)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('notify)
(case (-> block param 0)
(('pickup)
(let ((gp-0 (-> self entity extra perm)))
(logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage))
(set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1)))
(+! (-> self child-count) -1)
(when (<= (-> self child-count) 0)
(if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel))
(process-entity-status! self (entity-perm-status bit-4) #f)
)
(process-entity-status! self (entity-perm-status dead) #t)
(process-entity-status! self (entity-perm-status complete) #t)
(set! (-> gp-0 user-int8 0) 2)
(let ((v0-0 (logclear (-> self mask) (process-mask sleep))))
(set! (-> self mask) v0-0)
v0-0
)
)
)
)
)
)
)
)
:trans (-> (method-of-type crate die) trans)
:code (behavior ()
(when (or (= (-> self fact pickup-type) (pickup-type money))
(= (-> self defense) 'iron)
(= (-> self defense) 'steel)
)
(let ((a0-4 (-> self entity)))
(if (when a0-4
(let ((a0-5 (-> a0-4 extra perm task)))
(if a0-5
(= a0-5 (game-task none))
)
)
)
(set! (-> self entity extra perm task) (game-task complete))
)
)
)
(clear-collide-with-as (-> self root))
(logior! (-> self draw status) (draw-status hidden))
(drop-pickup (-> self fact) #t self (the-as fact-info #f) 0)
(set! (-> self child-count) (+ (process-count self) -1))
(process-entity-status! self (entity-perm-status bit-4) #t)
(let ((v1-21 (-> self entity extra perm)))
(logior! (-> v1-21 status) (entity-perm-status user-set-from-cstage))
(set! (-> v1-21 user-int8 0) 1)
)
(when (-> self child)
(logior! (-> self mask) (process-mask sleep))
(suspend)
(while (-> self child)
(suspend)
)
)
)
)
;; definition for function crate-init-by-other
;; INFO: Used lq/sq
(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol))
(params-init self arg0)
(set! (-> self root trans quad) (-> arg1 quad))
(set! (-> self look) arg2)
(set! (-> self defense) arg2)
(art-init self)
(check-dead self)
(none)
)
;; definition for method 11 of type crate
(defmethod init-from-entity! ((this crate) (arg0 entity-actor))
(params-init this arg0)
(art-init this)
(check-dead this)
(none)
)
;; definition for method 25 of type crate
;; INFO: Return type mismatch crate vs none.
(defmethod params-init ((this crate) (arg0 entity))
(stack-size-set! (-> this main-thread) 128)
(logior! (-> this mask) (process-mask crate))
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s4-0 reaction) default-collision-reaction)
(set! (-> s4-0 no-reaction)
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
)
(alloc-riders s4-0 1)
(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) (collide-kind crate blue-eco-suck))
(set! (-> s3-0 collide-with) (collide-kind target))
(set! (-> s3-0 prim-core action) (collide-action solid rider-plat-sticky))
(set! (-> s3-0 prim-core offense) (collide-offense touch))
(set! (-> s3-0 transform-index) 3)
(set-vector! (-> s3-0 local-sphere) 0.0 3072.0 0.0 6963.2)
(set-root-prim! s4-0 s3-0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(backup-collide-with-as s4-0)
(set! (-> this root) s4-0)
)
(set! (-> this fact)
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
)
(let ((v1-27 (-> this entity extra perm)))
(set! (-> this fact pickup-amount)
(fmax 0.0 (- (-> this fact pickup-amount) (the float (-> v1-27 user-int8 1))))
)
)
(when (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
(set! (-> this fact pickup-type) (pickup-type eco-pill-random))
(set! (-> this fact pickup-amount) 0.0)
)
(when arg0
(process-drawable-from-entity! this (the-as entity-actor arg0))
(logclear! (-> this mask) (process-mask actor-pause))
)
(let ((a0-18 ((method-of-type res-lump get-property-struct)
(-> this entity)
'crate-type
'interp
-1000000000.0
'wood
(the-as (pointer res-tag) #f)
*res-static-buf*
)
)
)
(set! (-> this look) (the-as symbol a0-18))
(set! (-> this defense) (the-as symbol a0-18))
)
(case (-> this fact pickup-type)
(((pickup-type buzzer))
(set! (-> this type) crate-buzzer)
(when (= (-> this look) 'wood)
(set! (-> this look) 'iron)
(set! (-> this defense) 'iron)
)
)
(else
(when (= (-> this look) 'iron)
(set! (-> this look) 'wood)
(set! (-> this defense) 'wood)
)
)
)
(none)
)
;; definition for method 26 of type crate
;; INFO: Used lq/sq
(defmethod art-init ((this crate))
(case (-> this look)
(('iron)
(set! (-> this root root-prim prim-core offense) (collide-offense normal-attack))
(initialize-skeleton this *crate-iron-sg* '())
)
(('steel)
(set! (-> this root root-prim prim-core offense) (collide-offense indestructible))
(initialize-skeleton this *crate-steel-sg* '())
)
(('darkeco)
(when (= (-> this fact pickup-type) (pickup-type eco-pill-random))
(set! (-> this fact pickup-type) (pickup-type none))
(set! (-> this fact pickup-amount) 0.0)
)
(initialize-skeleton this *crate-darkeco-sg* '())
(set-vector! (-> this draw color-mult) 0.8 0.8 0.8 1.0)
(set-vector! (-> this draw color-emissive) 0.2 0.2 0.2 1.0)
)
(('barrel)
(initialize-skeleton this *crate-barrel-sg* '())
)
(('bucket)
(when (= (-> this fact pickup-type) (pickup-type eco-pill-random))
(set! (-> this fact pickup-type) (pickup-type none))
(set! (-> this fact pickup-amount) 0.0)
)
(initialize-skeleton this *crate-bucket-sg* '())
)
(('none)
(initialize-skeleton this *crate-wood-sg* '())
(logior! (-> this draw status) (draw-status hidden))
)
(else
(initialize-skeleton this *crate-wood-sg* '())
)
)
(cond
((logtest? (fact-options indestructible) (-> this fact options))
(set! (-> this root root-prim prim-core offense) (collide-offense indestructible))
)
((logtest? (-> this fact options) (fact-options strong-attack))
(set! (-> this root root-prim prim-core offense) (collide-offense strong-attack))
)
((logtest? (-> this fact options) (fact-options normal-attack))
(set! (-> this root root-prim prim-core offense) (collide-offense normal-attack))
)
((logtest? (-> this fact options) (fact-options touch))
(set! (-> this root root-prim prim-core offense) (collide-offense touch))
)
)
(set! (-> this base quad) (-> this root trans quad))
(crate-post)
(nav-mesh-connect this (-> this root) (the-as nav-control #f))
this
)
;; definition for method 27 of type crate
;; INFO: Return type mismatch crate vs none.
(defmethod params-set! ((this crate) (arg0 symbol) (arg1 symbol))
(if arg0
(set! (-> this look) arg0)
)
(if arg1
(set! (-> this defense) arg1)
)
(none)
)
;; definition for method 28 of type crate
;; INFO: Return type mismatch int vs none.
(defmethod check-dead ((this crate))
(if (>= (-> this entity extra perm user-int8 0) 1)
(go (method-of-object this die) #t 0)
)
0
(go (method-of-object this wait))
0
(none)
)
;; definition for method 29 of type crate
;; INFO: Return type mismatch int vs none.
(defmethod smush-update! ((this crate))
(let ((f0-0 (update! (-> this smush))))
(set! (-> this root scale x) (+ 1.0 (* -0.5 f0-0)))
(set! (-> this root scale y) (+ 1.0 f0-0))
(set! (-> this root scale z) (+ 1.0 (* -0.5 f0-0)))
)
0
(none)
)
;; definition of type barrel
(deftype barrel (crate)
()
)
;; definition for method 3 of type barrel
(defmethod inspect ((this barrel))
(let ((t9-0 (method-of-type crate inspect)))
(t9-0 this)
)
this
)
;; definition for method 25 of type barrel
;; INFO: Return type mismatch barrel vs none.
(defmethod params-init ((this barrel) (arg0 entity))
(let ((t9-0 (method-of-type crate params-init)))
(t9-0 this arg0)
)
(set! (-> this look) 'barrel)
(none)
)
;; definition of type bucket
(deftype bucket (crate)
()
)
;; definition for method 3 of type bucket
(defmethod inspect ((this bucket))
(let ((t9-0 (method-of-type crate inspect)))
(t9-0 this)
)
this
)
;; definition for method 25 of type bucket
;; INFO: Return type mismatch bucket vs none.
(defmethod params-init ((this bucket) (arg0 entity))
(let ((t9-0 (method-of-type crate params-init)))
(t9-0 this arg0)
)
(set! (-> this look) 'bucket)
(none)
)
;; failed to figure out what this is:
(defpartgroup group-buzzer-crate
:id 74
:duration (seconds 0.017)
:linger-duration (seconds 1.5)
:bounds (static-bspherem 0 0 0 2)
:parts ((sp-item 302))
)
;; failed to figure out what this is:
(defpart 302
:init-specs ((:texture (new 'static 'texture-id :page #x2))
(:num 1.0)
(:scale-x (meters 1) (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 128.0)
(:g 96.0 32.0)
(:b 64.0 32.0)
(:a 16.0 32.0)
(:vel-y (meters 0.02) (meters 0.01))
(:scalevel-x (meters 0.0033333334))
(:rotvel-z (degrees -0.2) (degrees 0.4))
(:scalevel-y :copy scalevel-x)
(:fade-a -0.16)
(:accel-y (meters -0.00033333333))
(:friction 0.95)
(:timer (seconds 1))
(:flags (bit2 bit12 bit14))
(:conerot-x (degrees 60) (degrees 30))
(:conerot-y (degrees 0) (degrees 360))
)
)
;; definition of type crate-buzzer
(deftype crate-buzzer (crate)
()
)
;; definition for method 3 of type crate-buzzer
(defmethod inspect ((this crate-buzzer))
(let ((t9-0 (method-of-type crate inspect)))
(t9-0 this)
)
this
)
;; definition for method 26 of type crate-buzzer
;; INFO: Return type mismatch crate-buzzer vs crate.
(defmethod art-init ((this crate-buzzer))
(let ((t9-0 (method-of-type crate art-init)))
(t9-0 this)
)
(set! (-> this part) (create-launch-control (-> *part-group-id-table* 74) this))
(set! (-> this sound)
(new 'process 'ambient-sound (static-sound-spec "buzzer" :pitch-mod -762 :fo-max 40) (-> this root trans))
)
(set! (-> this victory-anim) (fuel-cell-pick-anim this))
(the-as crate this)
)
;; failed to figure out what this is:
(defstate wait (crate-buzzer)
:virtual #t
:trans (behavior ()
(when (and (and *target* (>= 327680.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))))
(time-elapsed? (-> self state-time) (seconds 1.5))
(rand-vu-percent? 0.03)
)
(spawn (-> self part) (-> self root trans))
(activate! (-> self smush) 0.2 90 150 1.0 1.0)
(logclear! (-> self mask) (process-mask sleep-code))
)
(if (nonzero? (-> self sound))
(update! (-> self sound))
)
(if (and *target* (>= (-> *target* fact buzzer) 6.0))
(spool-push *art-control* (-> self victory-anim name) 0 self -99.0)
)
)
:code (behavior ()
(set-time! (-> self state-time))
(suspend)
(update-transforms! (-> self root))
(loop
(set-time! (-> self state-time))
(ja-post)
(logior! (-> self mask) (process-mask sleep-code))
(suspend)
(let ((f30-0 57001.605))
(sound-play "crate-jump")
(while (or (!= (-> self smush amp) 0.0) (!= f30-0 0.0))
(+! f30-0 (* -245760.0 (seconds-per-frame)))
(+! (-> self root trans y) (* f30-0 (seconds-per-frame)))
(when (< (-> self root trans y) (-> self base y))
(set! (-> self root trans y) (-> self base y))
(set! f30-0 (* -0.5 f30-0))
(if (< (fabs f30-0) 16384.0)
(set! f30-0 0.0)
)
)
(crate-post)
(ja-post)
(suspend)
)
)
(set! (-> self root trans y) (-> self base y))
)
)
:post #f
)
;; failed to figure out what this is:
(defstate bounce-on (crate-buzzer)
:virtual #t
:code (behavior ()
(while (!= (-> self smush amp) 0.0)
(spawn (-> self part) (-> self root trans))
(suspend)
)
(go-virtual wait)
)
)
;; definition of type pickup-spawner
(deftype pickup-spawner (crate)
((blocker entity-actor)
)
)
;; definition for method 3 of type pickup-spawner
(defmethod inspect ((this pickup-spawner))
(let ((t9-0 (method-of-type crate inspect)))
(t9-0 this)
)
(format #t "~T~Tblocker: ~A~%" (-> this blocker))
this
)
;; definition for method 25 of type pickup-spawner
;; INFO: Return type mismatch pickup-spawner vs none.
(defmethod params-init ((this pickup-spawner) (arg0 entity))
(let ((t9-0 (method-of-type crate params-init)))
(t9-0 this arg0)
)
(set! (-> this look) 'none)
(set! (-> this blocker) #f)
(if (logtest? (-> this fact options) (fact-options vent-blocked))
(set! (-> this blocker) (entity-actor-lookup (-> this entity) 'alt-actor 0))
)
(none)
)
;; definition for method 28 of type pickup-spawner
;; INFO: Return type mismatch int vs none.
(defmethod check-dead ((this pickup-spawner))
(go (method-of-object this wait))
0
(none)
)
;; failed to figure out what this is:
(defstate wait (pickup-spawner)
:virtual #t
:code (behavior ()
(loop
(if (or (not (-> self blocker)) (logtest? (-> self blocker extra perm status) (entity-perm-status complete)))
(go-virtual die #t 0)
)
(suspend)
)
)
)