mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
24578b64b9
* hardcode `time-frame`things * Update cam-states_REF.gc * Update level-info_REF.gc * update refs 1 * update refs 2 * update refs 3 * update refs 4 * update refs 5 * update detection and casting * Update FormExpressionAnalysis.cpp * update refs 6 * update mood decomp * update refs 7 * update refs 8 * remove temp entity birth code * update time-frame casts * fix compiler * hardcode stuff and fix some types * fix some bitfield detection being wrong * bug fixes * detect seconds on adds with immediate * update refs 9 * fix casts and rand-vu-int-range bugs (update refs 10) * update refs 11 * update 12 * update 13 * update 14 * Update game-info_REF.gc * improve cpad macros detection * remove unused code * update refs * clang * update source code * Update cam-states.gc * `lavatube-energy` finish * update refs * fix actor bank stuff * Update navigate.gc * reduce entity default stack size * Update transformq-h.gc * oops forgot these * fix code and tests * fix mood sound stuff * Update load-dgo.gc * Update README.md
198 lines
8.8 KiB
Common Lisp
198 lines
8.8 KiB
Common Lisp
; ;;-*-Lisp-*-
|
|
; (in-package goal)
|
|
|
|
; ;; name: game-info-h.gc
|
|
; ;; name in dgo: game-info-h
|
|
; ;; dgos: GAME, ENGINE
|
|
|
|
;; Game parameters.
|
|
(deftype game-bank (basic)
|
|
((life-max-default float :offset-assert 4) ;; yes this life system works, but does nothing
|
|
(life-start-default float :offset-assert 8)
|
|
(life-single-inc float :offset-assert 12)
|
|
(money-task-inc float :offset-assert 16)
|
|
(money-oracle-inc float :offset-assert 20)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x18
|
|
:flag-assert #x900000018
|
|
)
|
|
|
|
(define *GAME-bank* (new 'static 'game-bank
|
|
:life-max-default 99.0
|
|
:life-start-default 5.0
|
|
:life-single-inc 1.0
|
|
:money-task-inc 90.0
|
|
:money-oracle-inc 120.0
|
|
)
|
|
)
|
|
|
|
;; aid
|
|
(deftype actor-id (uint32)
|
|
()
|
|
:flag-assert #x900000004
|
|
)
|
|
|
|
;; the possible state for a level.
|
|
(deftype level-buffer-state (structure)
|
|
((name symbol :offset-assert 0) ;; level name
|
|
(display? symbol :offset-assert 4) ;; should it be drawn?
|
|
(force-vis? symbol :offset-assert 8) ;; ? should it have its vis loaded?
|
|
(force-inside? symbol :offset-assert 12) ;; ?
|
|
)
|
|
:pack-me
|
|
:method-count-assert 9
|
|
:size-assert #x10
|
|
:flag-assert #x900000010
|
|
)
|
|
|
|
(deftype load-state (basic)
|
|
((want level-buffer-state 2 :inline :offset-assert 4)
|
|
(vis-nick symbol :offset-assert 36)
|
|
(command-list pair :offset-assert 40)
|
|
(object-name symbol 256 :offset-assert 44)
|
|
(object-status basic 256 :offset-assert 1068)
|
|
)
|
|
:method-count-assert 21
|
|
:size-assert #x82c
|
|
:flag-assert #x150000082c
|
|
(:methods
|
|
(new (symbol type) _type_ 0)
|
|
(reset! (_type_) _type_ 9)
|
|
(update! (_type_) int 10)
|
|
(want-levels (_type_ symbol symbol) int 11)
|
|
(want-display-level (_type_ symbol symbol) int 12)
|
|
(want-vis (_type_ symbol) int 13)
|
|
(want-force-vis (_type_ symbol symbol) int 14)
|
|
(execute-command (_type_ pair) none 15)
|
|
(execute-commands-up-to (_type_ float) int 16)
|
|
(backup-load-state-and-set-cmds (_type_ pair) int 17)
|
|
(restore-load-state-and-cleanup (_type_) int 18)
|
|
(restore-load-state (_type_) int 19)
|
|
(set-force-inside! (_type_ symbol symbol) none 20)
|
|
)
|
|
)
|
|
|
|
(defmethod new load-state ((allocation symbol) (type-to-make type))
|
|
(reset!
|
|
(object-new allocation type-to-make (the-as int (-> type-to-make size)))
|
|
)
|
|
)
|
|
|
|
(define-extern *load-state* load-state)
|
|
|
|
;; a game checkpoint
|
|
(deftype continue-point (basic)
|
|
((name string :offset-assert 4)
|
|
(level symbol :offset-assert 8)
|
|
(flags uint32 :offset-assert 12)
|
|
(trans vector :inline :offset-assert 16)
|
|
(quat quaternion :inline :offset-assert 32)
|
|
(camera-trans vector :inline :offset-assert 48)
|
|
(camera-rot float 9 :offset-assert 64)
|
|
(load-commands pair :offset-assert 100)
|
|
(vis-nick symbol :offset-assert 104)
|
|
(lev0 symbol :offset-assert 108)
|
|
(disp0 symbol :offset-assert 112)
|
|
(lev1 symbol :offset-assert 116)
|
|
(disp1 symbol :offset-assert 120)
|
|
)
|
|
:method-count-assert 10
|
|
:size-assert #x7c
|
|
:flag-assert #xa0000007c
|
|
(:methods
|
|
(debug-draw! (_type_) none 9)
|
|
)
|
|
)
|
|
|
|
(declare-type entity-perm structure)
|
|
(declare-type entity-perm-array basic)
|
|
(declare-type game-save basic)
|
|
;; Game Info is the full state of the game
|
|
;; this information can be saved/loaded from a game save.
|
|
;; also, it must be manually synchronized with entity permanent state in the levels
|
|
(deftype game-info (basic)
|
|
((mode symbol :offset-assert 4) ;; can be play/debug
|
|
(save-name basic :offset-assert 8)
|
|
(life float :offset-assert 12)
|
|
(life-max float :offset-assert 16)
|
|
(money float :offset-assert 20)
|
|
(money-total float :offset-assert 24)
|
|
(money-per-level uint8 32 :offset-assert 28)
|
|
(deaths-per-level uint8 32 :offset-assert 60)
|
|
(buzzer-total float :offset-assert 92)
|
|
(fuel float :offset-assert 96)
|
|
(perm-list entity-perm-array :offset-assert 100) ;; permament storage for entities
|
|
(task-perm-list entity-perm-array :offset-assert 104) ;; permanent storage for task entities
|
|
(current-continue continue-point :offset-assert 108)
|
|
(text-ids-seen bit-array :offset-assert 112)
|
|
(level-opened uint8 32 :offset-assert 116)
|
|
(hint-control (array level-hint-control) :offset-assert 148)
|
|
(task-hint-control (array task-hint-control-group) :offset-assert 152)
|
|
(total-deaths int32 :offset-assert 156)
|
|
(continue-deaths int32 :offset-assert 160)
|
|
(fuel-cell-deaths int32 :offset-assert 164)
|
|
(game-start-time time-frame :offset-assert 168)
|
|
(continue-time time-frame :offset-assert 176)
|
|
(death-time time-frame :offset-assert 184)
|
|
(hit-time time-frame :offset-assert 192)
|
|
(fuel-cell-pickup-time time-frame :offset-assert 200)
|
|
(fuel-cell-time (array time-frame) :offset-assert 208)
|
|
(enter-level-time (array time-frame) :offset-assert 212)
|
|
(in-level-time (array time-frame) :offset-assert 216)
|
|
(blackout-time time-frame :offset-assert 224)
|
|
(letterbox-time time-frame :offset-assert 232) ;; time to turn off letterboxing, base-frame
|
|
(hint-play-time time-frame :offset-assert 240)
|
|
(display-text-time time-frame :offset-assert 248)
|
|
(display-text-handle handle :offset-assert 256)
|
|
(death-movie-tick int32 :offset-assert 264)
|
|
(want-auto-save symbol :offset-assert 268)
|
|
(auto-save-proc handle :offset-assert 272)
|
|
(auto-save-status mc-status-code :offset-assert 280)
|
|
(auto-save-card int32 :offset-assert 284)
|
|
(auto-save-which int32 :offset-assert 288)
|
|
(pov-camera-handle handle :offset-assert 296)
|
|
(other-camera-handle handle :offset-assert 304)
|
|
(death-pos vector-array :offset-assert 312)
|
|
(dummy basic :offset-assert 316)
|
|
(auto-save-count int32 :offset-assert 320)
|
|
)
|
|
:method-count-assert 29
|
|
:size-assert #x144
|
|
:flag-assert #x1d00000144
|
|
(:methods
|
|
(initialize! (_type_ symbol game-save string) _type_ 9)
|
|
(adjust (_type_ symbol float handle) float 10)
|
|
(task-complete? (_type_ game-task) symbol 11)
|
|
(lookup-entity-perm-by-aid (_type_ actor-id) entity-perm 12)
|
|
(get-entity-task-perm (_type_ game-task) entity-perm 13)
|
|
(copy-perms-from-level! (_type_ level) none 14)
|
|
(copy-perms-to-level! (_type_ level) none 15)
|
|
(debug-print (_type_ symbol) _type_ 16)
|
|
(get-or-create-continue! (_type_) continue-point 17)
|
|
(get-continue-by-name (_type_ string) continue-point 18)
|
|
(set-continue! (_type_ basic) continue-point 19)
|
|
(buzzer-count (_type_ game-task) int 20)
|
|
(seen-text? (_type_ game-text-id) symbol 21)
|
|
(mark-text-as-seen (_type_ game-text-id) none 22)
|
|
(got-buzzer? (_type_ game-task int) symbol 23)
|
|
(save-game! (_type_ game-save string) none 24)
|
|
(load-game! (_type_ game-save) game-save 25)
|
|
(clear-text-seen! (_type_ game-text-id) none 26)
|
|
(get-death-count (_type_ symbol) int 27)
|
|
(get-health-percent-lost (_type_ symbol) float 28)
|
|
)
|
|
)
|
|
|
|
(define-extern *game-info* game-info)
|
|
(when (or (not *game-info*) (zero? *game-info*))
|
|
(let ((temp (new 'static 'game-info :mode 'debug :current-continue #f)))
|
|
(set! (-> temp fuel-cell-time) (new 'global 'boxed-array time-frame 116))
|
|
(set! (-> temp enter-level-time) (new 'global 'boxed-array time-frame 32))
|
|
(set! (-> temp in-level-time) (new 'global 'boxed-array time-frame 32))
|
|
(set! *game-info* temp)
|
|
)
|
|
)
|
|
|
|
(define-extern game-task->string (function game-task string))
|