;;-*-Lisp-*- (in-package goal) ;; name: level-h.gc ;; name in dgo: level-h ;; dgos: GAME, ENGINE ;; Information related to visibility data for a level. ;; Unclear why there are 8 of these per level. ;; Perhaps there are up to 8 "chunks" of the visibility loaded at a single time? ;; The full visibility data lives on the IOP. (deftype level-vis-info (basic) ((level basic :offset-assert 4) (from-level basic :offset-assert 8) (from-bsp basic :offset-assert 12) (flags uint32 :offset-assert 16) (length uint32 :offset-assert 20) (allocated-length uint32 :offset-assert 24) (dictionary-length uint32 :offset-assert 28) (dictionary uint32 :offset-assert 32) (string-block uint32 :offset-assert 36) (ramdisk uint32 :offset-assert 40) (vis-bits uint32 :offset-assert 44) (current-vis-string uint32 :offset-assert 48) (vis-string uint8 :dynamic :offset-assert 52) ) :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 ) (defmethod asize-of level-vis-info ((obj level-vis-info)) "Get the size of a level-vis-info in memory" (the-as int (+ (-> level-vis-info size) (-> obj dictionary-length))) ) ;; Per level information related to how to load the level. ;; These are stored in level-info.gc (deftype level-load-info (basic) ((name-list symbol 3 :offset-assert 4) (index int32 :offset-assert 16) ;; the level number (starting with 1?) (name symbol :offset 4) ;; symbol with full name, like "misty" (visname symbol :offset 8) ;; symbol with vis file name, like "misty-vis" (nickname symbol :offset 12) ;; 3 letter name for DGO, like "mis" (packages pair :offset-assert 20) ;; list of symbols, usually empty or the level name (sound-banks pair :offset-assert 24) ;; require sound bank files (list of symbols) (music-bank symbol :offset-assert 28) ;; name of level music (ambient-sounds pair :offset-assert 32) ;; always empty list. (mood symbol :offset-assert 36) ;; mood object name (mood-func symbol :offset-assert 40) ;; mood update function name (ocean symbol :offset-assert 44) ;; ocean map object (sky symbol :offset-assert 48) ;; boolean to enable sky (sun-fade float :offset-assert 52) ;; sun/sky setting (continues pair :offset-assert 56) ;; list of checkpoints (tasks pair :offset-assert 60) ;; list of boxed integers for tasks (priority int32 :offset-assert 64) ;; either 100 or 200 (load-commands pair :offset-assert 68) ;; ?? (alt-load-commands pair :offset-assert 72) ;; ?? (bsp-mask uint64 :offset-assert 80) ;; ?? (bsphere sphere :offset-assert 88) ;; boundings sphere of level? (buzzer int32 :offset-assert 92) ;; which task is the scout fly? (bottom-height float :offset-assert 96) ;; meters (run-packages pair :offset-assert 100) ;; possibly unused? (prev-level basic :offset-assert 104) (next-level basic :offset-assert 108) (wait-for-load symbol :offset-assert 112) ) :method-count-assert 9 :size-assert #x74 :flag-assert #x900000074 ) (declare-type drawable basic) (deftype login-state (basic) ((state int32 :offset-assert 4) (pos uint32 :offset-assert 8) (elts uint32 :offset-assert 12) (elt drawable 16 :offset-assert 16) ;; might be more specific ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) (declare-type bsp-header basic) (declare-type engine basic) (declare-type entity-links-array basic) (declare-type entity-ambient-data-array basic) (declare-type mood-context basic) ;; Per level-buffer info about the current loaded level. (deftype level (basic) ((name symbol :offset-assert 4) (load-name symbol :offset-assert 8) (nickname symbol :offset-assert 12) (index int32 :offset-assert 16) (status symbol :offset-assert 20) (other level :offset-assert 24) (heap kheap :inline :offset-assert 32) (bsp bsp-header :offset-assert 48) (art-group load-dir-art-group :offset-assert 52) (info level-load-info :offset-assert 56) (texture-page texture-page 9 :offset-assert 60) (loaded-texture-page basic 16 :offset-assert 96) (loaded-texture-page-count int32 :offset-assert 160) ; (foreground-sink-group-0 dma-foreground-sink-group :inline :offset-assert 176) ; (foreground-sink-group-1 dma-foreground-sink-group :inline :offset-assert 208) ; (foreground-sink-group-2 dma-foreground-sink-group :inline :offset-assert 240) ; (array-pad uint8 12) (foreground-sink-group dma-foreground-sink-group 3 :inline :offset-assert 176) ;; inline basic (foreground-draw-engine engine 3 :offset-assert 272) (entity entity-links-array :offset-assert 284) (ambient entity-ambient-data-array :offset-assert 288) (closest-object float 9 :offset-assert 292) (upload-size int32 9 :offset-assert 328) (level-distance float :offset-assert 364) ; meters (inside-sphere? symbol :offset-assert 368) (inside-boxes? symbol :offset-assert 372) (display? symbol :offset-assert 376) (meta-inside? symbol :offset-assert 380) (mood mood-context :offset-assert 384) (mood-func function :offset-assert 388) (vis-bits uint32 :offset-assert 392) (all-visible? symbol :offset-assert 396) (force-all-visible? symbol :offset-assert 400) (linking basic :offset-assert 404) (vis-info level-vis-info 8 :offset-assert 408) (vis-self-index int32 :offset-assert 440) (vis-adj-index int32 :offset-assert 444) (vis-buffer uint8 2048 :offset-assert 448) (mem-usage-block basic :offset-assert 2496) (mem-usage int32 :offset-assert 2500) (code-memory-start uint32 :offset-assert 2504) (code-memory-end uint32 :offset-assert 2508) (texture-mask uint32 9 :offset-assert 2512) (force-inside? symbol :offset-assert 2548) (pad uint8 56) ) :method-count-assert 29 :size-assert #xa30 :flag-assert #x1d00000a30 (:methods (dummy-9 () none 9) (dummy-10 () none 10) (dummy-11 (_type_) none 11) (dummy-12 () none 12) (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) (dummy-16 () none 16) (dummy-17 () none 17) (dummy-18 () none 18) (dummy-19 () none 19) (dummy-20 () none 20) (dummy-21 () none 21) (dummy-22 () none 22) (dummy-23 (_type_ symbol) none 23) (dummy-24 () none 24) (dummy-25 () none 25) (dummy-26 () none 26) (dummy-27 () none 27) (dummy-28 (_type_ string) symbol 28) ) ) (declare-type entity-links structure) ;; Main *level* object. ;; There are actually three levels. level0 and level1 correspond to the actual buffered levels ;; The level-default seems to be a fake level that can possibly be used by renderers that ;; don't belong to any level, for example to render Jak. (deftype level-group (basic) ((length int32 :offset-assert 4) (unknown-level-1 level :offset-assert 8) (unknown-level-2 level :offset-assert 12) (entity-link entity-links :offset 16) ;; not sure what's going on here (border? basic :offset-assert 20) (vis? basic :offset-assert 24) (want-level basic :offset-assert 28) (receiving-level basic :offset-assert 32) (load-commands pair :offset-assert 36) (play? basic :offset-assert 40) ;; there's something? from 40 -> 96. (hack-pad uint8 :offset 90) ;(level level 3 :inline :offset-assert 96) ;(data level 3 :inline :offset-assert 100) (level0 level :inline :offset-assert 96) ;; inline basic (level1 level :inline :offset-assert 2704) ;; inline basic (level-default level :inline :offset-assert 5312) ;; inline basic (level level 3 :inline :offset 96) (pad uint32) ) :method-count-assert 27 :size-assert #x1ef4 :flag-assert #x1b00001ef4 (:methods (dummy-9 (_type_ symbol) level 9) (dummy-10 (_type_ symbol) symbol 10) (dummy-11 (_type_ symbol symbol) level 11) (dummy-12 (_type_) none 12) (dummy-13 () none 13) (dummy-14 () none 14) (dummy-15 () none 15) (dummy-16 () none 16) (dummy-17 (_type_) none 17) (dummy-18 (_type_ symbol) none 18) (dummy-19 (_type_ pair) none 19) (dummy-20 () none 20) (dummy-21 (_type_ level-group int) pair 21) (dummy-22 () none 22) (dummy-23 () none 23) (dummy-24 () none 24) (dummy-25 () none 25) (dummy-26 () none 26) ) ) (define-extern *level* level-group) (if (zero? *level*) (set! *level* (new 'static 'level-group :length 2 :unknown-level-1 #f :unknown-level-2 #f :entity-link #f :border? #f :want-level #f :load-commands '() :play? #f :level0 (new 'static 'level :name #f :status 'inactive :foreground-sink-group (new 'static 'inline-array dma-foreground-sink-group 3 (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 10) (new 'static 'generic-dma-foreground-sink :bucket 11 :foreground-output-bucket 1 ) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 49 :foreground-texture-page 1 ) (new 'static 'generic-dma-foreground-sink :bucket 50 :foreground-texture-page 1 :foreground-output-bucket 1) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 58 :foreground-texture-page 2 ) (new 'static 'generic-dma-foreground-sink :bucket 59 :foreground-texture-page 2 :foreground-output-bucket 1 ) ) ) ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f ) :level1 (new 'static 'level :name #f :index 1 :status 'inactive :foreground-sink-group (new 'static 'inline-array dma-foreground-sink-group 3 (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 17 :foreground-texture-level 1 ) (new 'static 'generic-dma-foreground-sink :bucket 18 :foreground-texture-level 1 :foreground-output-bucket 1 ) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 52 :foreground-texture-page 1 :foreground-texture-level 1 ) (new 'static 'generic-dma-foreground-sink :bucket 53 :foreground-texture-page 1 :foreground-texture-level 1 :foreground-output-bucket 1 ) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 61 :foreground-texture-page 2 :foreground-texture-level 1 ) (new 'static 'generic-dma-foreground-sink :bucket 62 :foreground-texture-page 2 :foreground-texture-level 1 :foreground-output-bucket 1 ) ) ) ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f ) :level-default (new 'static 'level :name 'default :index 2 :status 'reserved :foreground-sink-group (new 'static 'inline-array dma-foreground-sink-group 3 (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 45 :foreground-texture-level 2 ) (new 'static 'generic-dma-foreground-sink :bucket 46 :foreground-texture-level 2 :foreground-output-bucket 1 ) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 55 :foreground-texture-page 1 :foreground-texture-level 2 ) (new 'static 'generic-dma-foreground-sink :bucket 56 :foreground-texture-page 1 :foreground-texture-level 2 :foreground-output-bucket 1 ) ) ) (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 (new 'static 'dma-foreground-sink :bucket 58 :foreground-texture-page 2 :foreground-texture-level 2 ) (new 'static 'generic-dma-foreground-sink :bucket 59 :foreground-texture-page 2 :foreground-texture-level 2 :foreground-output-bucket 1 ) ) ) ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f ) ) ) )