mirror of
https://github.com/open-goal/jak-project
synced 2026-07-31 00:14:38 -04:00
259 lines
8.3 KiB
Common Lisp
259 lines
8.3 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: game-h.gc
|
|
;; name in dgo: game-h
|
|
;; dgos: GAME, ENGINE
|
|
|
|
(declare-type target process-drawable)
|
|
(declare-type voicebox process-drawable)
|
|
(defun-extern voicebox-spawn process vector (pointer process))
|
|
|
|
(declare-type nav-control basic)
|
|
(declare-type path-control basic)
|
|
(declare-type vol-control basic)
|
|
(declare-type actor-link-info basic)
|
|
(declare-type sparticle-launch-control basic)
|
|
(declare-type water-control basic)
|
|
(declare-type collide-shape basic)
|
|
|
|
;; These flags are a bit of a hack and are mostly only meaningful on *target*
|
|
;; except for "fade-out-particles" which is meaninful for eco only.
|
|
(defenum state-flags
|
|
:bitfield #t
|
|
:type uint32
|
|
(fade-out-particles) ;; set so particle callbacks can fade out before death
|
|
(dangerous) ;; set on jak if he is "dangerous" (currently attacking)
|
|
(sf02) ;; never sent, blocks tripping
|
|
(being-attacked) ;; set when attacked
|
|
(invulnerable) ;; set from the debug menu
|
|
(timed-invulnerable) ;; after being attacked
|
|
(invuln-powerup) ;; unused invulnerable mode from powerup
|
|
(do-not-notice) ;; enemies etc shouldn't notice jak
|
|
(grabbed) ;; something else has "grabbed" control of jak
|
|
(first-person-mode) ;; triangle, billy game
|
|
(use-alt-cam-pos) ;; target-cam-pos should use an alternate position (jumping in warp gate, on to flutflut...)
|
|
(prevent-jump) ;; target cannot do any jumps
|
|
(prevent-attack) ;; target cannot do attacks
|
|
(prevent-duck) ;; can't duck or roll
|
|
(remove-prevents) ;; when set, removes the previous 3 prevents on the next frame.
|
|
(dying) ;; set during death anim
|
|
(sf16) ;; unused
|
|
(has-saved-position) ;; is there a saved position?
|
|
(looking-at-enemy) ;; neck mod active to look at enemy
|
|
(falling-into-pool-of-bad) ;; falling into lava, dark eco, or melt
|
|
(flop-hit-ground) ;; set when ground pound hit ground
|
|
)
|
|
|
|
(defmacro static-attack-info (&key (mask ()) &rest args)
|
|
(when (!= (length args) 1)
|
|
(error "static-attack-info can only have 1 arg"))
|
|
(let ((mask-actual mask)
|
|
(arg (car args))
|
|
)
|
|
(when (not (null? (assoc 'shove-up arg))) (cons! mask-actual 'shove-up))
|
|
(when (not (null? (assoc 'shove-back arg))) (cons! mask-actual 'shove-back))
|
|
(when (not (null? (assoc 'mode arg))) (cons! mask-actual 'mode))
|
|
(when (not (null? (assoc 'vector arg))) (cons! mask-actual 'vector))
|
|
(when (not (null? (assoc 'angle arg))) (cons! mask-actual 'angle))
|
|
(when (not (null? (assoc 'control arg))) (cons! mask-actual 'control))
|
|
`(let ((atk (new 'static 'attack-info :mask (attack-mask ,@mask-actual))))
|
|
,@(apply (lambda (x) (if (eq? (car x) 'vector)
|
|
`(vector-copy! (-> atk ,(car x)) ,(cadr x))
|
|
`(set! (-> atk ,(car x)) ,(cadr x))
|
|
)) arg)
|
|
atk)
|
|
)
|
|
)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
|
;; Process drawable is the parent type of most game objects.
|
|
(deftype process-drawable (process)
|
|
;; The "root" is the location of the process-drawable.
|
|
;; It may be a more specific type, and often contains the collision geometry.
|
|
((root trsqv :offset-assert 112)
|
|
|
|
;; The node-list is a list of all the joints and bones, and how
|
|
;; joints update bones.
|
|
(node-list cspace-array :offset-assert 116)
|
|
|
|
;; the draw-control contains references to all data required for drawing
|
|
(draw draw-control :offset-assert 120)
|
|
|
|
;; The skel is a joint-control which combines animations to control joints
|
|
(skel joint-control :offset-assert 124)
|
|
|
|
;; The nav-control allows enemies to navigate on a nav mesh.
|
|
(nav nav-control :offset-assert 128)
|
|
|
|
;; alignment of animation to our position
|
|
(align align-control :offset-assert 132)
|
|
|
|
;; our path (like if we are a platform or enemy that moves along a fixed path)
|
|
(path path-control :offset-assert 136)
|
|
|
|
;; associated volumes (for water)
|
|
(vol vol-control :offset-assert 140)
|
|
|
|
;; our settings
|
|
(fact fact-info :offset-assert 144)
|
|
|
|
;; reference to our entity
|
|
(link actor-link-info :offset-assert 148)
|
|
|
|
;; our particles
|
|
(part sparticle-launch-control :offset-assert 152)
|
|
|
|
;; state related to entering and being in water
|
|
(water water-control :offset-assert 156)
|
|
|
|
;; any sound that we're playing
|
|
(sound ambient-sound :offset-assert 160)
|
|
|
|
;; seems to only be used in target?
|
|
(state-flags state-flags :offset-assert 164)
|
|
|
|
;; the time when we last did something. Used for different things in different objects
|
|
(state-time time-frame :offset-assert 168)
|
|
)
|
|
:heap-base #x40
|
|
:method-count-assert 20
|
|
:size-assert #xb0
|
|
:flag-assert #x14004000b0
|
|
(:methods
|
|
(initialize-skeleton (_type_ skeleton-group pair) none 14)
|
|
(initialize-skeleton-by-name (_type_ string object) _type_ 15)
|
|
(apply-alignment (_type_ align-opts transformq vector) collide-shape 16)
|
|
(do-joint-math! (_type_) none 17)
|
|
(cleanup-for-death (_type_) none 18)
|
|
(evaluate-joint-control (_type_) none 19)
|
|
)
|
|
(:states
|
|
(process-drawable-art-error string)
|
|
process-drawable-idle
|
|
)
|
|
)
|
|
|
|
;; This is unused. Maybe it was useful in development, where it might be slow to add
|
|
;; methods to a type?
|
|
(deftype process-drawable-reserved (process-drawable)
|
|
()
|
|
:heap-base #x40
|
|
:method-count-assert 63
|
|
:size-assert #xb0
|
|
:flag-assert #x3f004000b0
|
|
(:methods
|
|
(dummy-20 () none 20)
|
|
(dummy-21 () none 21)
|
|
(dummy-22 () none 22)
|
|
(dummy-23 () none 23)
|
|
(dummy-24 () none 24)
|
|
(dummy-25 () none 25)
|
|
(dummy-26 () none 26)
|
|
(dummy-27 () none 27)
|
|
(dummy-28 () none 28)
|
|
(dummy-29 () none 29)
|
|
(dummy-30 () none 30)
|
|
(dummy-31 () none 31)
|
|
(dummy-32 () none 32)
|
|
(dummy-33 () none 33)
|
|
(dummy-34 () none 34)
|
|
(dummy-35 () none 35)
|
|
(dummy-36 () none 36)
|
|
(dummy-37 () none 37)
|
|
(dummy-38 () none 38)
|
|
(dummy-39 () none 39)
|
|
(dummy-40 () none 40)
|
|
(dummy-41 () none 41)
|
|
(dummy-42 () none 42)
|
|
(dummy-43 () none 43)
|
|
(dummy-44 () none 44)
|
|
(dummy-45 () none 45)
|
|
(dummy-46 () none 46)
|
|
(dummy-47 () none 47)
|
|
(dummy-48 () none 48)
|
|
(dummy-49 () none 49)
|
|
(dummy-50 () none 50)
|
|
(dummy-51 () none 51)
|
|
(dummy-52 () none 52)
|
|
(dummy-53 () none 53)
|
|
(dummy-54 () none 54)
|
|
(dummy-55 () none 55)
|
|
(dummy-56 () none 56)
|
|
(dummy-57 () none 57)
|
|
(dummy-58 () none 58)
|
|
(dummy-59 () none 59)
|
|
(dummy-60 () none 60)
|
|
(dummy-61 () none 61)
|
|
(dummy-62 () none 62)
|
|
)
|
|
)
|
|
|
|
|
|
(defenum attack-mask
|
|
:bitfield #t
|
|
:type uint32
|
|
(trans)
|
|
(vector)
|
|
(intersection)
|
|
(attacker)
|
|
(invinc-time)
|
|
(mode)
|
|
(shove-back)
|
|
(shove-up)
|
|
(speed)
|
|
(dist)
|
|
(control)
|
|
(angle)
|
|
(rotate-to)
|
|
(atki13)
|
|
)
|
|
|
|
;; The attack-info is generated by attackers and sent to target.
|
|
(deftype attack-info (structure)
|
|
((trans vector :inline :offset-assert 0)
|
|
(vector vector :inline :offset-assert 16)
|
|
(intersection vector :inline :offset-assert 32)
|
|
(attacker handle :offset-assert 48)
|
|
(invinc-time time-frame :offset-assert 56)
|
|
(mask attack-mask :offset-assert 64)
|
|
(mode symbol :offset-assert 68)
|
|
(shove-back meters :offset-assert 72)
|
|
(shove-up meters :offset-assert 76)
|
|
(speed meters :offset-assert 80)
|
|
(dist meters :offset-assert 84)
|
|
(control float :offset-assert 88)
|
|
(angle symbol :offset-assert 92)
|
|
(rotate-to degrees :offset-assert 96)
|
|
(prev-state state :offset-assert 100)
|
|
)
|
|
:method-count-assert 10
|
|
:size-assert #x68
|
|
:flag-assert #xa00000068
|
|
(:methods
|
|
(combine! (_type_ attack-info) none 9)
|
|
)
|
|
)
|
|
|
|
|
|
(define *global-attack-id* 0)
|
|
|
|
(deftype ground-tween-info (structure)
|
|
((chan uint8 3 :offset-assert 0)
|
|
(blend float 3 :offset-assert 4)
|
|
(group uint32 5 :offset-assert 16)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x24
|
|
:flag-assert #x900000024
|
|
)
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|