diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 4b22740ba0..20551ed87f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -4782,7 +4782,7 @@ (deftype subtitle-range (basic) ((start-frame float :offset-assert 4) (end-frame float :offset-assert 8) - (message object 8 :offset-assert 12) + (message basic 8 :offset-assert 12) ) :method-count-assert 9 :size-assert #x2c @@ -6649,75 +6649,75 @@ (text-xfe #x00fe) (text-xff #x00ff) (text-x100 #x0100) - (pause 257) + (pause #x101) (text-x102 #x0102) (text-x103 #x0103) (text-x104 #x0104) (text-x105 #x0105) (text-x106 #x0106) (text-x107 #x0107) - (progress-sound-music-volume 264) - (progress-sound-speech-volume 265) + (progress-sound-music-volume #x108) + (progress-sound-speech-volume #x109) (text-x109 #x0109) (text-x10a #x010a) (text-x10b #x010b) (text-x10c #x010c) (text-x10d #x010d) - (progress-on 270) - (progress-off 271) - (progress-move-dpad 272) - (progress-aspect-ratio 280) - (progress-progressive-scan 281) - (progress-video-mode 282) - (progress-root-game-options 283) - (progress-root-graphic-options 284) - (progress-root-sound-options 285) - (progress-aspect-4x3 286) - (progress-aspect-16x9 287) - (progress-refresh-60hz 288) - (progress-refresh-50hz 289) - (progress-demo-exit 291) - (progress-yes 292) - (progress-no 293) - (progress-back 294) - (progress-ok 295) - (progress-next 296) - (progress-previous 297) - (progress-continue-without-saving 298) - (progress-select-file-to-save 299) - (progress-select-file-to-load 300) - (progress-load-game 301) - (progress-save-game 302) - (progress-slot-empty 303) - (progress-title-options 304) - (progress-title-new-game 305) - (progress-title-prompt 306) - (progress-quit 307) - (progress-root-show-map 308) + (progress-on #x10e) + (progress-off #x10f) + (progress-move-dpad #x110) + (progress-aspect-ratio #x118) + (progress-progressive-scan #x119) + (progress-video-mode #x11a) + (progress-root-game-options #x11b) + (progress-root-graphic-options #x11c) + (progress-root-sound-options #x11d) + (progress-aspect-4x3 #x11e) + (progress-aspect-16x9 #x11f) + (progress-refresh-60hz #x120) + (progress-refresh-50hz #x121) + (progress-demo-exit #x123) + (progress-yes #x124) + (progress-no #x125) + (progress-back #x126) + (progress-ok #x127) + (progress-next #x128) + (progress-previous #x129) + (progress-continue-without-saving #x12a) + (progress-select-file-to-save #x12b) + (progress-select-file-to-load #x12c) + (progress-load-game #x12d) + (progress-save-game #x12e) + (progress-slot-empty #x12f) + (progress-title-options #x130) + (progress-title-new-game #x131) + (progress-title-prompt #x132) + (progress-quit #x133) + (progress-root-show-map #x134) (text-x135 #x0135) - (progress-root-highscores 310) - (progress-highscores-1st 311) - (progress-highscores-2nd 312) - (progress-highscores-3rd 313) - (progress-highscores-4th 314) - (progress-highscores-5th 315) - (progress-highscores-6th 316) - (progress-highscores-7th 317) - (progress-highscores-8th 318) - (progress-root-secrets 339) - (progress-secrets-unlocked 340) + (progress-root-highscores #x136) + (progress-highscores-1st #x137) + (progress-highscores-2nd #x138) + (progress-highscores-3rd #x139) + (progress-highscores-4th #x13a) + (progress-highscores-5th #x13b) + (progress-highscores-6th #x13c) + (progress-highscores-7th #x13d) + (progress-highscores-8th #x13e) + (progress-root-secrets #x153) + (progress-secrets-unlocked #x154) (text-x155 #x0155) (text-x156 #x0156) (text-x157 #x0157) (text-x158 #x0158) - (progress-main-secrets-hero-mode 345) - (progress-main-secrets-sceneplayer-1 346) - (progress-main-secrets-sceneplayer-2 347) - (progress-main-secrets-sceneplayer-3 348) - (progress-main-secrets-scrapbook 349) - (progress-main-secrets-mega-scrapbook 350) - (progress-main-secrets-scrapbook-3 351) - (progress-main-secrets-levelselect 352) + (progress-main-secrets-hero-mode #x159) + (progress-main-secrets-sceneplayer-1 #x15a) + (progress-main-secrets-sceneplayer-2 #x15b) + (progress-main-secrets-sceneplayer-3 #x15c) + (progress-main-secrets-scrapbook #x15d) + (progress-main-secrets-mega-scrapbook #x15e) + (progress-main-secrets-scrapbook-3 #x15f) + (progress-main-secrets-levelselect #x160) (text-x161 #x0161) (text-x162 #x0162) (text-x163 #x0163) @@ -6725,28 +6725,28 @@ (text-x165 #x0165) (text-x166 #x0166) (text-x167 #x0167) - (progress-secrets-orb-label 360) - (progress-root-missions 361) + (progress-secrets-orb-label #x168) + (progress-root-missions #x169) (text-x16a #x016a) (text-x16b #x016b) (text-x16c #x016c) (text-x16d #x016d) - (progress-root-restart-mission 366) - (progress-missions-icon-todo 367) - (progress-missions-icon-completed 368) - (progress-missions-none 369) - (progress-unknown-game 370) + (progress-root-restart-mission #x16e) + (progress-missions-icon-todo #x16f) + (progress-missions-icon-completed #x170) + (progress-missions-none #x171) + (progress-unknown-game #x172) (text-x173 #x0173) (text-x174 #x0174) (text-x175 #x0175) (text-x176 #x0176) (text-x177 #x0177) (text-x178 #x0178) - (progress-unknown-square-to-reset 377) - (progress-unknown-oi1un23i13 380) - (progress-unknown-kjanskd 381) - (progress-unknown-retry? 382) - (progress-secrets-go-to-title-screen 383) + (progress-unknown-square-to-reset #x179) + (progress-unknown-oi1un23i13 #x17c) + (progress-unknown-kjanskd #x17d) + (progress-unknown-retry? #x17e) + (progress-secrets-go-to-title-screen #x17f) (text-x180 #x0180) (text-x181 #x0181) (text-x182 #x0182) @@ -6759,45 +6759,45 @@ (text-x189 #x0189) (text-x18a #x018a) (text-x18b #x018b) - (progress-graphics-60hz-change-notice 395) - (progress-graphics-progressivescan-change-notice 396) - (progress-graphics-progressivescan-warning-1 397) - (progress-graphics-progressivescan-warning-2 398) - (progress-graphics-60hz-change-complete 399) - (progress-graphics-progressivescan-change-complete 400) - (progress-graphics-mode-revert? 401) - (progress-disc-removed-notice 402) - (progress-disc-removed-prompt 403) - (progress-disc-read-error 404) - (progress-disc-read-error-prompt 405) - (progress-quit-game-confirm 406) - (progress-memcard-not-found 409) - (progress-memcard-unformatted 410) - (progress-memcard-space-requirement 411) - (progress-memcard-insert-card-with-jak2 412) - (progress-memcard-insert-card-with-space-to-save 413) - (progress-memcard-formatting-required-notice 414) - (progress-memcard-loading-data 416) + (progress-graphics-60hz-change-notice #x18b) + (progress-graphics-progressivescan-change-notice #x18c) + (progress-graphics-progressivescan-warning-1 #x18d) + (progress-graphics-progressivescan-warning-2 #x18e) + (progress-graphics-60hz-change-complete #x18f) + (progress-graphics-progressivescan-change-complete #x190) + (progress-graphics-mode-revert? #x191) + (progress-disc-removed-notice #x192) + (progress-disc-removed-prompt #x193) + (progress-disc-read-error #x194) + (progress-disc-read-error-prompt #x195) + (progress-quit-game-confirm #x196) + (progress-memcard-not-found #x199) + (progress-memcard-unformatted #x19a) + (progress-memcard-space-requirement #x19b) + (progress-memcard-insert-card-with-jak2 #x19c) + (progress-memcard-insert-card-with-space-to-save #x19d) + (progress-memcard-formatting-required-notice #x19e) + (progress-memcard-loading-data #x1a0) (text-x1a1 #x01a1) (text-x1a2 #x01a2) - (progress-memcard-dont-remove 419) - (progress-memcard-overwrite-warning 420) - (progress-memcard-overwrite-confirm 421) - (progress-memcard-format-prompt 422) - (progress-memcard-continue? 423) - (progress-memcard-go-back? 424) - (progress-memcard-error-while-saving 426) + (progress-memcard-dont-remove #x1a3) + (progress-memcard-overwrite-warning #x1a4) + (progress-memcard-overwrite-confirm #x1a5) + (progress-memcard-format-prompt #x1a6) + (progress-memcard-continue? #x1a7) + (progress-memcard-go-back? #x1a8) + (progress-memcard-error-while-saving #x1aa) (text-x1ab #x01ab) (text-x1ac #x01ac) - (progress-memcard-check 429) - (progress-memcard-check-and-try-again 430) - (progress-memcard-was-removed 431) - (progress-autosave-disabled 432) - (progress-autosave-reenabling-info 433) - (progress-memcard-no-jak2-found 434) - (progress-memcard-create-jak2-file? 435) - (progress-autosave-explanation 436) - (progress-autosave-dont-remove 437) + (progress-memcard-check #x1ad) + (progress-memcard-check-and-try-again #x1ae) + (progress-memcard-was-removed #x1af) + (progress-autosave-disabled #x1b0) + (progress-autosave-reenabling-info #x1b1) + (progress-memcard-no-jak2-found #x1b2) + (progress-memcard-create-jak2-file? #x1b3) + (progress-autosave-explanation #x1b4) + (progress-autosave-dont-remove #x1b5) (text-x1b6 #x01b6) (text-x1b7 #x01b7) (text-x1b8 #x01b8) @@ -6892,23 +6892,23 @@ (text-x211 #x0211) (text-x212 #x0212) (text-x213 #x0213) - (progress-locations-haven-city 531) - (progress-locations-fortress 532) - (progress-locations-landing-pad 533) - (progress-locations-palace-roof 534) - (progress-locations-palace 535) - (progress-locations-weapons-factory 536) - (progress-locations-dead-town 537) - (progress-locations-pumping-station 538) - (progress-locations-sewer 539) - (progress-locations-strip-mine 540) - (progress-locations-mountain-temple 541) - (progress-locations-haven-forest 542) - (progress-locations-drill-platform 543) - (progress-locations-mars-tomb 544) - (progress-locations-dig 545) - (progress-locations-underport 546) - (progress-locations-nest 547) + (progress-locations-haven-city #x213) + (progress-locations-fortress #x214) + (progress-locations-landing-pad #x215) + (progress-locations-palace-roof #x216) + (progress-locations-palace #x217) + (progress-locations-weapons-factory #x218) + (progress-locations-dead-town #x219) + (progress-locations-pumping-station #x21a) + (progress-locations-sewer #x21b) + (progress-locations-strip-mine #x21c) + (progress-locations-mountain-temple #x21d) + (progress-locations-haven-forest #x21e) + (progress-locations-drill-platform #x21f) + (progress-locations-mars-tomb #x220) + (progress-locations-dig #x221) + (progress-locations-underport #x222) + (progress-locations-nest #x223) (text-x224 #x0224) (text-x225 #x0225) (text-x226 #x0226) @@ -6953,7 +6953,9 @@ (text-x24d #x024d) (text-x24e #x024e) (text-x24f #x024f) - (progress-unknown-continue 784) + (scene-subtitles-enabled #x30d) + (scene-subtitles-disabled #x30e) + (progress-unknown-continue #x310) ) ;; ---text-id-h:game-text-id @@ -8274,7 +8276,9 @@ (bounds-spheres) (actors) (actor-marks) - (special-fma-spheres)) + (special-fma-spheres) + (scene-controls-7) + (scene-controls-8)) ;; ---main-h:scene-controls (define-extern *display-scene-control* scene-controls) @@ -11234,7 +11238,7 @@ :flag-assert #xf000000d8 ;; Failed to read fields. (:methods - ;; (new (symbol type process art-joint-geo) _type_ 0) + (new (symbol type process symbol) _type_ 0) (get-skeleton-origin (_type_) vector 9) (draw-control-method-10 () none 10) ;; (lod-set! (_type_ int) none 10) (draw-control-method-11 () none 11) ;; (lods-assign! (_type_ lod-set) none 11) @@ -15072,14 +15076,14 @@ ) (deftype scene-player (process-drawable) - ((scene-list (pointer symbol) :offset-assert 200) + ((scene-list (array scene) :offset-assert 200) ;; string/scene (scene scene :offset-assert 204) (scene-index int32 :offset-assert 208) (anim spool-anim :offset-assert 212) (next-anim spool-anim :offset-assert 216) (camera handle :offset-assert 224) (main-entity entity-actor :offset-assert 232) - (wait basic :offset-assert 236) + (wait symbol :offset-assert 236) (old-target-pos transformq :inline :offset-assert 240) (pre-cut-frame basic :offset-assert 288) (preload-continue string :offset-assert 292) @@ -15093,7 +15097,7 @@ (speed-press-time time-frame :offset-assert 336) (speed-change-speed float :offset-assert 344) (subtitle-change-time time-frame :offset-assert 352) - (user-sound uint32 4 :offset-assert 360) ;; guess + (user-sound sound-id 4 :offset-assert 360) ;; guess ) :method-count-assert 26 :size-assert #x178 @@ -15103,7 +15107,7 @@ (release () _type_ :state 21) (play-anim () _type_ :state 22) (scene-player-method-23 (_type_ string symbol) none 23) - (scene-player-method-24 (_type_ basic symbol) scene 24) + (scene-player-method-24 "TODO - arg1 can be string/scene" (_type_ basic symbol) scene 24) (scene-player-method-25 (_type_ float) none 25) ) ) @@ -20453,14 +20457,14 @@ (scale-x float :offset-assert 36) (scale-y float :offset-assert 40) (angle float :offset-assert 44) - (tex basic :offset-assert 48) + (tex texture :offset-assert 48) ) :method-count-assert 11 :size-assert #x34 :flag-assert #xb00000034 (:methods (hud-sprite-method-9 (_type_ dma-buffer level) none 9) - (hud-sprite-method-10 () none 10) + (hud-sprite-method-10 (_type_) none 10) ) ) @@ -20510,34 +20514,35 @@ :type uint32 :bitfield #t ) + (deftype hud (process) ((trigger-time time-frame :offset-assert 128) ;; time-frame (last-hide-time time-frame :offset-assert 136) ;; time-frame (offset float :offset-assert 144) ;; int32 (flags hud-flags :offset-assert 148) - (values hud-value 8 :inline :offset-assert 152) - (strings hud-string 14 :inline :offset-assert 288) + (values hud-value 8 :inline :offset-assert 152 :score 999) + (strings hud-string 14 :inline :offset-assert 288 :score 999) (sprites hud-sprite 30 :inline :offset-assert 960) (icons hud-icon 2 :inline :offset-assert 2880) ;; guessed by decompiler - (gui-id uint32 :offset-assert 2976) + (gui-id sound-id :offset-assert 2976) ) :method-count-assert 27 :size-assert #xba4 :flag-assert #x1b0b300ba4 (:methods - (hud-method-14 () none 14) ;; (hidden? (_type_) symbol 14) - (hud-method-15 () none 15) ;; (draw-hud (_type_) none 15) - (hud-method-16 () none 16) ;; (tally-value (_type_ int int) none 16) - (hud-method-17 () none 17) ;; (draw-icons (_type_) none 17) - (hud-method-18 () none 18) ;; (draw-particles (_type_) none 18) - (hud-method-19 () none 19) ;; (hud-update (_type_) none 19) - (hud-method-20 () none 20) ;; (init-particles! (_type_ int) none 20) - (hud-method-21 () none 21) ;; (get-icon-pos-x (_type_) int 21) - (hud-method-22 () none 22) ;; (get-icon-pos-y (_type_) int 22) - (hud-method-23 () none 23) ;; (dummy-23 (_type_) none 23) - (hud-method-24 () none 24) ;; (set-pos-and-scale (_type_ symbol symbol) none 24) - (hud-method-25 () none 25) ;; (get-icon-scale-x (_type_) float 25) - (hud-method-26 () none 26) ;; (get-icon-scale-y (_type_) float 26) + (hidden? (_type_) symbol 14) ;; (hidden? (_type_) symbol 14) + (hud-method-15 (_type_) none 15) ;; (draw-hud (_type_) none 15) + (hud-method-16 (_type_ int int) none 16) ;; (tally-value (_type_ int int) none 16) + (hud-method-17 (_type_) none 17) ;; (draw-icons (_type_) none 17) + (hud-method-18 (_type_) symbol 18) ;; (draw-particles (_type_) none 18) + (hud-method-19 (_type_) none 19) ;; (hud-update (_type_) none 19) + (hud-method-20 (_type_) none 20) ;; (init-particles! (_type_ int) none 20) + (hud-method-21 (_type_) none 21) ;; (get-icon-pos-x (_type_) int 21) + (hud-method-22 (_type_) none 22) ;; (get-icon-pos-y (_type_) int 22) + (hud-method-23 (_type_) none 23) ;; (dummy-23 (_type_) none 23) + (hud-method-24 (_type_ symbol) none 24) ;; (set-pos-and-scale (_type_ symbol symbol) none 24) + (hud-method-25 (_type_) none 25) ;; (get-icon-scale-x (_type_) float 25) + (hud-method-26 (_type_ int) none 26) ;; (get-icon-scale-y (_type_) float 26) ) ) @@ -29867,7 +29872,7 @@ (define-extern *subtitle-work* subtitle-work) (define-extern draw-subtitle-image (function subtitle-image font-context pointer)) (define-extern process-drawable-draw-subtitles (function none :behavior process-drawable)) -(define-extern scene-player-init (function string symbol object none :behavior scene-player)) +(define-extern scene-player-init "`object` arg can be an `(array scene)`, `pair of scene` or a `scene`" (function object symbol string none :behavior scene-player)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pov-camera ;; @@ -29964,8 +29969,8 @@ (mask-tmpl dma-gif-packet :inline :offset-assert 160) (line-tmpl dma-gif-packet :inline :offset-assert 192) (scan-tmpl dma-gif-packet :inline :offset-assert 224) - (line-color uint64 :offset-assert 256) - (scan-colors uint64 32 :offset 272) + (line-color vector4w :inline :offset-assert 256) + (scan-colors vector4w 32 :inline :offset 272) (scanline uint32 :offset 784) ) :method-count-assert 9 @@ -29974,11 +29979,11 @@ ) (define-extern *hud-sprite-work* hud-sprite-work) -;; (define-extern hud-create-icon function) -;; (define-extern hud-hidden state) ;; (state hud) -;; (define-extern hud-arriving state) ;; (state hud) -;; (define-extern hud-in state) ;; (state hud) -;; (define-extern hud-leaving state) ;; (state int hud) +(define-extern hud-create-icon (function none)) +(define-extern hud-hidden (state hud)) ;; (state hud) +(define-extern hud-arriving (state hud)) ;; +(define-extern hud-in (state hud)) ;; (state hud) +(define-extern hud-leaving (state int hud)) ;; (state int hud) (define-extern hud-init-by-other (function object :behavior hud)) (define-extern hide-hud (function symbol none)) ;; (define-extern enable-hud function) ;; (function none) @@ -30288,7 +30293,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype minimap-texture-name-array (structure) - ((data uint32 35 :offset-assert 0) + ((data object 35 :offset-assert 0) ) :method-count-assert 9 :size-assert #x8c diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index b28c27231d..eb3f5a2e84 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -398,7 +398,6 @@ [45, "(function surface object object int float :behavior target)"], [76, "(function surface surface surface int float :behavior target)"] ], - "scene": [[4, "(function symbol)"]], "target-darkjak": [ [6, "(function vector :behavior target)"], [7, "(function vector :behavior target)"], @@ -416,5 +415,6 @@ ], "water": [[10, "(function vector :behavior process-drawable)"]], "dark-eco-pool": [[0, "(function none :behavior dark-eco-pool)"]], - "target-gun": [[22, "(function surface object object int object :behavior target)"]] + "target-gun": [[22, "(function surface object object int object :behavior target)"]], + "scene": [[4, "(function symbol :behavior scene-player)"]] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 048389ab04..9555df9a25 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -122,7 +122,6 @@ "(method 12 effect-control)", "(method 11 effect-control)", "(method 10 effect-control)", - "(anon-function 2 scene)", "(method 10 bigmap)", "(method 9 editable-region)", // condition branch assert hit "(method 57 enemy)", @@ -221,7 +220,8 @@ "(method 8 process-tree)", "(post play-anim scene-player)", "(method 25 scene-player)", - "(method 25 scene-player)" + "(method 25 scene-player)", + "scene-player-init" ], // If format is used with the wrong number of arguments, diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 5f153f31d3..c4a8b6c4eb 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -2877,11 +2877,13 @@ "(method 24 conveyor)": [["_stack_", 16, "res-tag"]], "(method 25 conveyor)": [[11, "v0", "actor-option"]], "(method 24 scene-player)": [[38, "gp", "scene"]], - "process-drawable-draw-subtitles": [[26, "v0", "(pointer vector)"]], + "process-drawable-draw-subtitles": [[26, "v0", "(array subtitle-range)"]], "(post play-anim scene-player)": [ [192, "s4", "process-drawable"], [243, "s4", "process-drawable"], - [306, "s5", "process-drawable"] + [306, "s5", "process-drawable"], + [564, "v0", "sound-rpc-set-param"], + [655, "v0", "sound-rpc-set-param"] ], "(method 9 scene-actor)": [ [43, "s4", "skeleton-group"], @@ -3488,6 +3490,45 @@ [[351,375], "s5", "sound-rpc-set-param"] ], - // placeholder - "placeholder-do-not-add-below": [] + "draw-subtitle-image": [ + [[44, 48], "a0", "dma-packet"], + [[49, 58], "a0", "gs-gif-tag"], + [70, "a0", "(pointer gs-bitbltbuf)"], + [72, "a0", "(pointer gs-reg64)"], + [73, "a0", "(pointer gs-trxpos)"], + [75, "a0", "(pointer gs-reg64)"], + [81, "a0", "(pointer gs-trxreg)"], + [83, "a0", "(pointer gs-reg64)"], + [84, "a0", "(pointer gs-trxdir)"], + [86, "a0", "(pointer gs-reg64)"], + [[106, 112], "a1", "dma-packet"], + [[113, 121], "a1", "gs-gif-tag"], + [128, "a1", "(pointer gs-reg64)"], + [130, "a1", "(pointer gs-alpha)"], + [126, "a1", "(pointer gs-test)"], + [132, "a1", "(pointer gs-reg64)"], + [148, "a1", "(pointer gs-tex0)"], + [150, "a1", "(pointer gs-reg64)"], + [153, "a1", "(pointer gs-reg64)"], + [157, "a1", "(pointer gs-reg64)"], + [160, "a1", "(pointer gs-reg64)"], + [151, "a1", "(pointer gs-tex1)"], + [155, "a1", "(pointer gs-clamp)"], + [158, "a1", "(pointer uint64)"], + [[163, 194], "v1", "(pointer uint128)"], + [[195, 199], "t0", "gs-gif-tag"], + [[201, 206], "t0", "gs-gif-tag"], + [[208, 213], "a2", "gs-gif-tag"], + [[215, 220], "v1", "gs-gif-tag"], + [[223, 254], "v1", "(pointer uint128)"], + [[255, 259], "t0", "gs-gif-tag"], + [[261, 266], "t0", "gs-gif-tag"], + [[268, 273], "a1", "gs-gif-tag"], + [[275, 280], "v1", "gs-gif-tag"], + [[291, 296], "v1", "dma-packet"] + ], + "scene-player-init": [ + [[37, 44], "s5", "(array scene)"], + [83, "v0", "(array scene)"] + ] } diff --git a/game/graphics/display.cpp b/game/graphics/display.cpp index 25c29501e0..5a79c9c754 100644 --- a/game/graphics/display.cpp +++ b/game/graphics/display.cpp @@ -75,6 +75,7 @@ void GfxDisplay::save_display_settings() { json["window_ypos"] = m_last_windowed_ypos; std::string file_path = (file_util::get_user_settings_dir(g_game_version) / "display-settings.json").string(); + file_util::create_dir_if_needed_for_file(file_path); file_util::write_text_file(file_path, json.dump(2)); } diff --git a/goal_src/jak2/engine/ambient/ambient-h.gc b/goal_src/jak2/engine/ambient/ambient-h.gc index 5e515f0f45..6a61f87903 100644 --- a/goal_src/jak2/engine/ambient/ambient-h.gc +++ b/goal_src/jak2/engine/ambient/ambient-h.gc @@ -5,7 +5,8 @@ ;; name in dgo: ambient-h ;; dgos: ENGINE, GAME -(define-extern kill-current-talker (function symbol pair symbol none)) ;; see (exit play-anim scene-player) +;; NOTE - for scene +(define-extern kill-current-talker (function symbol pair symbol none)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/camera/pov-camera-h.gc b/goal_src/jak2/engine/camera/pov-camera-h.gc index 6f814b80a8..d609318a36 100644 --- a/goal_src/jak2/engine/camera/pov-camera-h.gc +++ b/goal_src/jak2/engine/camera/pov-camera-h.gc @@ -13,6 +13,11 @@ (inherit-orientation 2) ) +;; NOTE - for scene +(declare-type pov-camera process-drawable) +(declare-type othercam process) +(define-extern othercam-init-by-other (function pov-camera int symbol symbol none :behavior othercam)) + ;; DECOMP BEGINS (deftype pov-camera (process-drawable) diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index 43c4c2d7f5..b585fe50e9 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -387,6 +387,7 @@ :size-assert #xd8 :flag-assert #xf000000d8 (:methods + (new (symbol type process symbol) _type_ 0) (get-skeleton-origin (_type_) vector 9) (draw-control-method-10 () none 10) (draw-control-method-11 () none 11) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index ff0ade2dc6..4f786cb2be 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -82,6 +82,9 @@ (test 22) ;; hi 64 ) +;; NOTE - for scene +(define-extern auto-save-user (function none)) + ;; DECOMP BEGINS (deftype process-drawable (process) diff --git a/goal_src/jak2/engine/game/main-h.gc b/goal_src/jak2/engine/game/main-h.gc index 120206cdfc..1a5e2e212a 100644 --- a/goal_src/jak2/engine/game/main-h.gc +++ b/goal_src/jak2/engine/game/main-h.gc @@ -34,7 +34,9 @@ (bounds-spheres) (actors) (actor-marks) - (special-fma-spheres)) + (special-fma-spheres) + (scene-controls-7) + (scene-controls-8)) ;; ---scene-controls ;; +++bot-marks-controls @@ -319,6 +321,6 @@ (define-extern paused? (function symbol)) (define-extern set-master-mode (function symbol none)) (define-extern toggle-pause (function int)) - +(define-extern *screen-filter* screen-filter) (define-extern on (function symbol process)) -(define-extern menu-respond-to-pause (function symbol)) \ No newline at end of file +(define-extern menu-respond-to-pause (function symbol)) diff --git a/goal_src/jak2/engine/load/loader-h.gc b/goal_src/jak2/engine/load/loader-h.gc index beed349e3d..8aca1939e3 100644 --- a/goal_src/jak2/engine/load/loader-h.gc +++ b/goal_src/jak2/engine/load/loader-h.gc @@ -205,7 +205,7 @@ (deftype subtitle-range (basic) ((start-frame float :offset-assert 4) (end-frame float :offset-assert 8) - (message object 8 :offset-assert 12) + (message basic 8 :offset-assert 12) ) :method-count-assert 9 :size-assert #x2c diff --git a/goal_src/jak2/engine/scene/scene-h.gc b/goal_src/jak2/engine/scene/scene-h.gc index 276c0bb806..b76b2f3b51 100644 --- a/goal_src/jak2/engine/scene/scene-h.gc +++ b/goal_src/jak2/engine/scene/scene-h.gc @@ -7,7 +7,7 @@ ;; NOTE - for default-menu (declare-type scene-player process-drawable) -(define-extern scene-player-init (function string symbol object none :behavior scene-player)) +(define-extern scene-player-init (function object symbol string none :behavior scene-player)) ;; DECOMP BEGINS @@ -76,28 +76,28 @@ (deftype scene-player (process-drawable) - ((scene-list (pointer symbol) :offset-assert 200) - (scene scene :offset-assert 204) - (scene-index int32 :offset-assert 208) - (anim spool-anim :offset-assert 212) - (next-anim spool-anim :offset-assert 216) - (camera handle :offset-assert 224) - (main-entity entity-actor :offset-assert 232) - (wait basic :offset-assert 236) - (old-target-pos transformq :inline :offset-assert 240) - (pre-cut-frame basic :offset-assert 288) - (preload-continue string :offset-assert 292) - (dma-max uint32 :offset-assert 296) - (gui-id uint32 :offset-assert 300) - (aborted? symbol :offset-assert 304) - (scene-start-time time-frame :offset-assert 312) - (targ-speed float :offset-assert 320) - (cur-speed float :offset-assert 324) - (speed-change-time time-frame :offset-assert 328) - (speed-press-time time-frame :offset-assert 336) - (speed-change-speed float :offset-assert 344) - (subtitle-change-time time-frame :offset-assert 352) - (user-sound uint32 4 :offset-assert 360) + ((scene-list (array scene) :offset-assert 200) + (scene scene :offset-assert 204) + (scene-index int32 :offset-assert 208) + (anim spool-anim :offset-assert 212) + (next-anim spool-anim :offset-assert 216) + (camera handle :offset-assert 224) + (main-entity entity-actor :offset-assert 232) + (wait symbol :offset-assert 236) + (old-target-pos transformq :inline :offset-assert 240) + (pre-cut-frame basic :offset-assert 288) + (preload-continue string :offset-assert 292) + (dma-max uint32 :offset-assert 296) + (gui-id uint32 :offset-assert 300) + (aborted? symbol :offset-assert 304) + (scene-start-time time-frame :offset-assert 312) + (targ-speed float :offset-assert 320) + (cur-speed float :offset-assert 324) + (speed-change-time time-frame :offset-assert 328) + (speed-press-time time-frame :offset-assert 336) + (speed-change-speed float :offset-assert 344) + (subtitle-change-time time-frame :offset-assert 352) + (user-sound sound-id 4 :offset-assert 360) ) :heap-base #x100 :method-count-assert 26 diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index 24ece1d747..c9f8cbd54d 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -7,3 +7,1717 @@ ;; DECOMP BEGINS +(deftype scene-stage (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + + +(defmethod print scene ((obj scene)) + (format #t "#" (-> obj art-group) (-> obj anim) obj) + obj + ) + +;; WARN: Return type mismatch spool-anim vs none. +(defmethod scene-method-15 scene ((obj scene) (arg0 spool-anim)) + (set! (-> arg0 name) (-> obj anim)) + (set! (-> arg0 anim-name) (-> obj anim)) + (set! (-> arg0 parts) (the-as int (-> obj parts))) + (set! (-> arg0 command-list) (the-as pair (-> obj command-list))) + (none) + ) + +;; WARN: Return type mismatch basic vs continue-point. +(defun scene-decode-continue ((arg0 basic)) + (the-as continue-point (cond + ((not arg0) + (the-as basic #f) + ) + ((= (-> arg0 type) continue-point) + arg0 + ) + ((= (-> arg0 type) string) + (get-continue-by-name *game-info* (the-as string arg0)) + ) + (else + (the-as basic #f) + ) + ) + ) + ) + +(defmethod scene-actor-method-9 scene-actor ((obj scene-actor) (arg0 scene-player)) + (local-vars (s4-0 (pointer process)) (sv-96 process) (sv-112 process)) + (let ((s1-0 (if (-> obj level) + (level-get *level* (the-as symbol (-> obj level))) + (-> *level* default-level) + ) + ) + ) + (cond + ((not s1-0) + (-> *level* default-level) + (set! s4-0 (the-as (pointer process) #f)) + (goto cfg-211) + ) + ((= (-> s1-0 status) 'reserved) + ) + ((!= (-> s1-0 status) 'active) + (set! s4-0 (the-as (pointer process) #f)) + (goto cfg-211) + ) + ) + (let* ((s4-1 (art-group-get-by-name *level* (-> obj art-group) (the-as (pointer uint32) #f))) + (s2-0 (if (type? s4-1 skeleton-group) + (the-as skeleton-group s4-1) + ) + ) + (s0-0 (-> arg0 level)) + (s3-0 + (or (string= (-> obj name) "jak-highres") + (string= (-> obj name) "jak-highres-prison") + (string= (-> obj name) "darkjak-highres") + ) + ) + ) + (set! (-> arg0 level) #f) + (set! s4-0 + (when s2-0 + (let ((s1-1 (if (and (nonzero? (-> s1-0 entity)) (> (-> s1-0 entity length) 0)) + (-> s1-0 entity data 0 entity) + (-> arg0 entity) + ) + ) + ) + (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) + (set! s4-0 + (when sv-96 + (let ((t9-7 (method-of-type manipy activate))) + (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) + ) + (let ((t9-8 run-function-in-process) + (a0-11 sv-96) + (a1-9 manipy-init) + (a2-3 (-> arg0 root trans)) + (a3-1 s1-1) + (t0-0 s2-0) + (t1-0 #f) + ) + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ((the-as (function object object object object object object none) t9-8) a0-11 a1-9 a2-3 a3-1 t0-0 t1-0) + ) + (-> sv-96 ppointer) + ) + ) + (set! (-> arg0 level) s0-0) + (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) + (send-event (ppointer->process s4-0) 'blend-shape #t) + (send-event (ppointer->process s4-0) 'prefix (-> obj prefix)) + (cond + ((zero? (-> obj light-index)) + (if (zero? (-> s2-0 light-index)) + (send-event (ppointer->process s4-0) 'light-index 80) + ) + ) + (else + (send-event (ppointer->process s4-0) 'light-index (* (-> obj light-index) 8)) + ) + ) + (if (nonzero? (-> obj shadow-mask)) + (send-event (ppointer->process s4-0) 'shadow-mask (* (-> obj shadow-mask) 8)) + ) + (if (nonzero? (-> obj shadow-values)) + (send-event (ppointer->process s4-0) 'shadow-values (* (-> obj shadow-values) 8)) + ) + (if (and s4-0 (not (logtest? (-> obj flags) 1)) (nonzero? (-> (the-as process-drawable (-> s4-0 0)) draw))) + (logior! (-> (the-as process-drawable (-> s4-0 0)) draw status) (draw-control-status no-draw-bounds)) + ) + (if (-> obj shadow-volume-joint) + (send-event (ppointer->process s4-0) 'shadow-volume (-> obj shadow-volume-joint) (-> obj shadow-flags)) + ) + (if (or (nonzero? (-> obj draw-seg)) (nonzero? (-> obj no-draw-seg))) + (send-event (ppointer->process s4-0) 'segment (* (-> obj draw-seg) 8) (* (-> obj no-draw-seg) 8)) + ) + (when s3-0 + (if (not (-> *setting-control* user-current beard)) + (send-event (ppointer->process s4-0) 'segment 0 16) + ) + (when (and s4-0 (nonzero? (-> (the-as scene-player (-> s4-0 0)) old-target-pos scale x))) + (cond + ((logtest? (game-secrets little-head) (-> *game-info* secrets)) + (mode-set! (-> (the-as manipy (-> s4-0 0)) joint 0) (joint-mod-mode joint-set*)) + (trs-set! + (-> (the-as manipy (-> s4-0 0)) joint 0) + (the-as vector #f) + (the-as quaternion #f) + (new 'static 'vector :x 0.4 :y 0.4 :z 0.4 :w 1.0) + ) + ) + ((logtest? (game-secrets big-head) (-> *game-info* secrets)) + (mode-set! (-> (the-as manipy (-> s4-0 0)) joint 0) (joint-mod-mode joint-set*)) + (trs-set! + (-> (the-as manipy (-> s4-0 0)) joint 0) + (the-as vector #f) + (the-as quaternion #f) + (new 'static 'vector :x 2.0 :y 2.0 :z 2.0 :w 1.0) + ) + ) + ) + ) + ) + (when (and s4-0 (logtest? (-> obj flags) 2)) + (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) + (let ((s0-1 + (when sv-112 + (let ((t9-24 (method-of-type manipy activate))) + (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) + ) + (let ((t9-25 run-function-in-process) + (a0-51 sv-112) + (a1-26 manipy-init) + (a2-8 (-> arg0 root trans)) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) t9-25) a0-51 a1-26 a2-8 s1-1 s2-0 t1-1) + ) + (-> sv-112 ppointer) + ) + ) + ) + (send-event (ppointer->process s0-1) 'mirror #t) + (send-event (ppointer->process s0-1) 'anim-mode 'mirror) + (if (nonzero? (-> obj light-index)) + (send-event (ppointer->process s0-1) 'light-index (* (-> obj light-index) 8)) + ) + (if (nonzero? (-> obj shadow-mask)) + (send-event (ppointer->process s0-1) 'shadow-mask (* (-> obj shadow-mask) 8)) + ) + (if (nonzero? (-> obj shadow-values)) + (send-event (ppointer->process s0-1) 'shadow-values (* (-> obj shadow-values) 8)) + ) + (if (and s0-1 (not (logtest? (-> obj flags) 1)) (nonzero? (-> (the-as process-drawable (-> s0-1 0)) draw))) + (logior! (-> (the-as process-drawable (-> s0-1 0)) draw status) (draw-control-status no-draw-bounds)) + ) + (if (-> obj shadow-volume-joint) + (send-event (ppointer->process s0-1) 'shadow-volume (-> obj shadow-volume-joint) (-> obj shadow-flags)) + ) + (if (or (nonzero? (-> obj draw-seg)) (nonzero? (-> obj no-draw-seg))) + (send-event (ppointer->process s0-1) 'segment (* (-> obj draw-seg) 8) (* (-> obj no-draw-seg) 8)) + ) + (when s3-0 + (if (not (-> *setting-control* user-current beard)) + (send-event (ppointer->process s0-1) 'segment 0 16) + ) + ) + ) + ) + ) + (when (nonzero? (-> obj camera)) + (cond + ((handle->process (-> arg0 camera)) + (change-parent (handle->process (-> arg0 camera)) (ppointer->process s4-0)) + (send-event (handle->process (-> arg0 camera)) 'target (ppointer->process s4-0)) + (send-event (handle->process (-> arg0 camera)) 'joint (* (-> obj camera) 8)) + ) + (else + (set! (-> arg0 camera) (ppointer->handle (process-spawn + othercam + (ppointer->process s4-0) + (-> obj camera) + #t + 'scene-player + :to (ppointer->process s4-0) + ) + ) + ) + ) + ) + ) + s4-0 + ) + ) + ) + ) + (label cfg-211) + s4-0 + ) + +(defmethod deactivate scene-player ((obj scene-player)) + (set! *scene-player* #f) + (kill-persister *setting-control* (the-as engine-pers 'blackout) 'bg-a-force) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch process-drawable vs scene-player. +(defmethod relocate scene-player ((obj scene-player) (arg0 int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) obj) + (set! (-> v1-0 relocating-min) (the-as int (&-> obj type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj))) + ) + (set! (-> v1-0 relocating-offset) arg0) + ) + (let ((v1-2 (-> obj scene-list))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj scene-list) arg0) + ) + ) + (the-as scene-player ((method-of-type process-drawable relocate) obj arg0)) + ) + +(defmethod scene-player-method-25 scene-player ((obj scene-player) (arg0 float)) + (local-vars (v1-11 symbol) (v1-40 symbol) (s0-0 object) (s0-1 object)) + (dotimes (s4-0 (-> obj scene actor length)) + (let ((s3-0 (-> obj scene actor s4-0))) + (let* ((s2-0 (-> s3-0 draw-frames)) + (s1-0 (car s2-0)) + ) + (while (not (null? s2-0)) + (when (and (pair? s1-0) + (let ((a0-4 (car s1-0))) + (set! s0-0 (car (cdr s1-0))) + (or (= a0-4 'min) (>= arg0 (command-get-float a0-4 0.0))) + ) + (or (= s0-0 'max) (< arg0 (command-get-float (car (cdr s1-0)) 0.0))) + ) + (set! v1-11 #t) + (goto cfg-20) + ) + (set! s2-0 (cdr s2-0)) + (set! s1-0 (car s2-0)) + ) + ) + (set! v1-11 #f) + (label cfg-20) + (cond + (v1-11 + (if (not (handle->process (-> s3-0 process))) + (set! (-> s3-0 process) (ppointer->handle (scene-actor-method-9 s3-0 obj))) + ) + (let ((s2-1 (handle->process (-> s3-0 process)))) + (when (and s2-1 (nonzero? (-> (the-as process-drawable s2-1) draw))) + (let* ((s3-1 (-> s3-0 scissor-frames)) + (s1-1 (car s3-1)) + ) + (while (not (null? s3-1)) + (when (and (pair? s1-1) + (let ((a0-20 (car s1-1))) + (set! s0-1 (car (cdr s1-1))) + (or (= a0-20 'min) (>= arg0 (command-get-float a0-20 0.0))) + ) + (or (= s0-1 'max) (< arg0 (command-get-float (car (cdr s1-1)) 0.0))) + ) + (set! v1-40 #t) + (goto cfg-59) + ) + (set! s3-1 (cdr s3-1)) + (set! s1-1 (car s3-1)) + ) + ) + (set! v1-40 #f) + (label cfg-59) + (if v1-40 + (logclear! (-> (the-as process-drawable s2-1) draw status) (draw-control-status force-vu1)) + (logior! (-> (the-as process-drawable s2-1) draw status) (draw-control-status force-vu1)) + ) + ) + ) + ) + ((handle->process (-> s3-0 process)) + (deactivate (handle->process (-> s3-0 process))) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch basic vs scene. +(defun scene-lookup ((arg0 basic)) + "TODO - basic can be a string or a scene" + (let ((v1-0 (-> arg0 type))) + (the-as + scene + (cond + ((= v1-0 string) + (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) + (when (type? s5-0 scene) + (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) + (when (and s5-0 gp-0) + (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) + (when v1-5 + (dotimes (a0-6 6) + (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) + (goto cfg-15) + ) + ) + (format + 0 + "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" + (-> gp-0 name) + (-> v1-5 name) + ) + (return (the-as scene #f)) + ) + ) + ) + ) + (label cfg-15) + s5-0 + ) + ) + ) + ((= v1-0 scene) + arg0 + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch basic vs scene. +(defmethod scene-player-method-24 scene-player ((obj scene-player) (arg0 basic) (arg1 symbol)) + "TODO - arg1 can be string/scene" + (when (= (-> arg0 type) string) + (let ((v1-2 (scene-lookup arg0))) + (if v1-2 + (set! arg0 v1-2) + ) + ) + ) + (when (or (not arg0) (!= (-> arg0 type) scene)) + (format 0 "ERROR: SCENE: scene-player can not find scene ~A~%" arg0) + (go process-drawable-art-error "scene-list format") + ) + (when arg1 + (let ((s4-1 (get-level-by-heap-ptr-and-status *level* (the-as pointer arg0) 'active))) + (scene-method-15 (the-as scene arg0) (-> obj anim)) + (set! (-> obj level) s4-1) + ) + (set! (-> obj scene) (the-as scene arg0)) + ) + (the-as scene arg0) + ) + +(defmethod scene-player-method-23 scene-player ((obj scene-player) (arg0 string) (arg1 symbol)) + (let ((gp-0 (scene-player-method-24 obj arg0 #t))) + (when (-> gp-0 peaceful) + (let ((s3-0 *traffic-manager*)) + (send-event s3-0 'decrease-alert-level 0) + (send-event s3-0 'restore-default-settings) + ) + ) + (send-event *target* 'draw (-> gp-0 draw-target)) + (let ((s3-1 (entity-by-name (-> gp-0 entity)))) + (when (and (-> gp-0 entity) (not s3-1)) + (format 0 "ERROR: SCENE: scene ~A can not find entity ~A~%" (-> gp-0 name) (-> gp-0 entity)) + (go process-drawable-art-error (-> gp-0 entity)) + ) + (set! (-> obj main-entity) (the-as entity-actor s3-1)) + (cond + (s3-1 + (process-drawable-from-entity! obj (-> obj main-entity)) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (else + (vector-reset! (-> obj root trans)) + (quaternion-identity! (-> obj root quat)) + ) + ) + ) + (let ((s3-2 (load-to-heap-by-name (-> *level* default-level art-group) (-> gp-0 art-group) #f global 0))) + (when (not s3-2) + (format 0 "ERROR: SCENE: scene ~A can not find art-group ~A~%" (-> gp-0 name) (-> gp-0 art-group)) + (go process-drawable-art-error (-> gp-0 art-group)) + ) + (set! (-> obj draw art-group) s3-2) + (countdown (v1-33 (-> s3-2 length)) + (when (-> s3-2 data v1-33) + (cond + ((= (-> s3-2 data v1-33 type) merc-ctrl) + (set! (-> obj draw mgeo) (the-as merc-ctrl (-> s3-2 data v1-33))) + ) + ((= (-> s3-2 data v1-33 type) art-joint-geo) + (set! (-> obj draw jgeo) (the-as art-joint-geo (-> s3-2 data v1-33))) + ) + ) + ) + ) + ) + (cond + ((< (+ (-> obj scene-index) 1) (-> obj scene-list length)) + (let ((a0-34 (scene-player-method-24 obj (-> obj scene-list (+ (-> obj scene-index) 1)) #f))) + (cond + (a0-34 + (scene-method-15 a0-34 (-> obj next-anim)) + ) + (else + (set! (-> obj next-anim anim-name) (the-as basic 0)) + 0 + ) + ) + ) + ) + (else + (set! (-> obj next-anim anim-name) (the-as basic 0)) + 0 + ) + ) + (dotimes (s3-3 (-> gp-0 actor length)) + (let ((s2-0 (-> gp-0 actor s3-3))) + (set! (-> s2-0 process) (the-as handle #f)) + (let ((s1-0 (if (-> s2-0 level) + (level-get *level* (the-as symbol (-> s2-0 level))) + (-> *level* default-level) + ) + ) + (v1-55 (when level + (let ((s0-0 (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)))) + (if (type? s0-0 skeleton-group) + s0-0 + ) + ) + ) + ) + ) + (cond + ((or (not s1-0) (not (or (= (-> s1-0 status) 'active) (= (-> s1-0 status) 'reserved)))) + (format + 0 + "ERROR: SCENE: scene actor ~A can not find an active level ~A~%" + (-> s2-0 art-group) + (-> s2-0 level) + ) + ) + ((not v1-55) + (format + 0 + "ERROR: SCENE: scene actor ~A can not find skeleton-group ~A~%" + (-> s2-0 art-group) + (-> s2-0 art-group) + ) + ) + (else + (load-to-heap-by-name (-> s1-0 art-group) (the-as string (-> v1-55 data 0)) #f global 0) + ) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (when arg1 + (set-setting! 'region-mode #f 0 0) + (set-setting! 'process-mask 'set 0 (-> gp-0 mask-to-clear)) + (set-setting! 'sound-bank-load #f 0 0) + (set-setting! 'movie (process->ppointer obj) 0 0) + (set-setting! 'movie-name (-> gp-0 name) 0 0) + (set-setting! + 'music-volume + 'rel + (if (>= (-> gp-0 music-volume) 0.0) + (-> gp-0 music-volume) + (-> *setting-control* user-current music-volume-movie) + ) + 0 + ) + (set-setting! + 'sfx-volume + 'rel + (if (>= (-> gp-0 sfx-volume) 0.0) + (-> gp-0 sfx-volume) + (-> *setting-control* user-current sfx-movie-volume) + ) + 0 + ) + (set-setting! + 'ambient-volume + 'rel + (if (>= (-> gp-0 ambient-volume) 0.0) + (-> gp-0 ambient-volume) + (-> *setting-control* user-current ambient-volume-move) + ) + 0 + ) + (if (nonzero? (the int (-> gp-0 music-delay))) + (set-setting! 'sound-mode #f 0 2) + ) + (set-setting! 'gem #f 0 0) + (apply-settings *setting-control*) + ) + ) + 0 + (none) + ) + +(deftype subtitle-work (structure) + ((draw-tmpl dma-gif-packet :inline :offset-assert 0) + (color0 vector4w :inline :offset-assert 32) + (color1 vector4w :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + + +(define *subtitle-work* + (new 'static 'subtitle-work + :draw-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif0 (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :abe #x1 :fst #x1) + :nreg #x5 + ) + :gif1 (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id uv) + :regs2 (gif-reg-id xyz2) + :regs3 (gif-reg-id uv) + :regs4 (gif-reg-id xyz2) + ) + ) + :color0 (new 'static 'vector4w :w #x80) + :color1 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + ) + +(defun draw-subtitle-image ((arg0 subtitle-image) (arg1 font-context)) + (local-vars (sv-16 pointer) (sv-32 int)) + (let ((gp-0 (-> arg0 width)) + (s5-0 (-> arg0 height)) + ) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))) + (set! sv-16 (-> s4-0 base)) + (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) + (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) + ) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s4-1 (-> s3-0 base)) + ) + (upload-vram-data s3-0 0 (-> arg0 palette) 2 8) + (let ((s0-0 20)) + (let* ((v1-13 s3-0) + (a0-7 (the-as object (-> v1-13 base))) + ) + (set! (-> (the-as dma-packet a0-7) dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-7) vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-13 base) (the-as pointer (the-as gs-gif-tag (&+ (the-as pointer a0-7) 16)))) + ) + (let* ((v1-14 s3-0) + (a0-9 (the-as gs-gif-tag (-> v1-14 base))) + ) + (set! (-> a0-9 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x4)) + (set! (-> a0-9 regs) GIF_REGS_ALL_AD) + (set! (-> v1-14 base) (the-as pointer (&+ a0-9 16))) + ) + (let* ((v1-15 s3-0) + (a0-11 (-> v1-15 base)) + ) + (set! (-> (the-as (pointer gs-bitbltbuf) a0-11) 0) + (new 'static 'gs-bitbltbuf :dbp #x1 :dbw (shr gp-0 6) :dpsm s0-0) + ) + (set! (-> (the-as (pointer gs-reg64) a0-11) 1) (gs-reg64 bitbltbuf)) + (set! (-> (the-as (pointer gs-trxpos) a0-11) 2) (new 'static 'gs-trxpos)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 3) (gs-reg64 trxpos)) + (set! (-> (the-as (pointer gs-trxreg) a0-11) 4) (new 'static 'gs-trxreg :rrw gp-0 :rrh s5-0)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 5) (gs-reg64 trxreg)) + (set! (-> (the-as (pointer gs-trxdir) a0-11) 6) (new 'static 'gs-trxdir)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 7) (gs-reg64 trxdir)) + (set! (-> v1-15 base) (&+ a0-11 64)) + ) + (let ((t9-2 dma-buffer-add-ref-texture) + (a0-13 s3-0) + (a2-8 gp-0) + (a3-1 s5-0) + (t0-1 s0-0) + ) + (t9-2 a0-13 sv-16 (the-as int a2-8) (the-as int a3-1) (the-as gs-psm t0-1)) + ) + (set! sv-32 (+ (log2 (the-as int (+ gp-0 -1))) 1)) + (let ((v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1))) + (let* ((a0-16 s3-0) + (a1-23 (the-as object (-> a0-16 base))) + ) + (set! (-> (the-as dma-packet a1-23) dma) (new 'static 'dma-tag :qwc #x7 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-23) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-23) vif1) (new 'static 'vif-tag :imm #x7 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a0-16 base) (the-as pointer (the-as gs-gif-tag (&+ (the-as pointer a1-23) 16)))) + ) + (let* ((a0-17 s3-0) + (a1-25 (the-as object (-> a0-17 base))) + ) + (set! (-> (the-as gs-gif-tag a1-25) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x6)) + (set! (-> (the-as gs-gif-tag a1-25) regs) GIF_REGS_ALL_AD) + (set! (-> a0-17 base) (&+ (the-as pointer a1-25) 16)) + ) + (let* ((a0-18 s3-0) + (a1-27 (-> a0-18 base)) + ) + (set! (-> (the-as (pointer gs-test) a1-27) 0) + (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-alpha) a1-27) 2) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 3) (gs-reg64 alpha-1)) + (set! (-> (the-as (pointer gs-tex0) a1-27) 4) + (new 'static 'gs-tex0 :tbp0 #x1 :tcc #x1 :cld #x1 :psm s0-0 :th v1-17 :tw sv-32 :tbw (shr gp-0 6)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 5) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a1-27) 6) (new 'static 'gs-tex1)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 7) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer gs-clamp) a1-27) 8) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 9) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer uint64) a1-27) 10) (the-as uint 0)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 11) (gs-reg64 texflush)) + (set! (-> a0-18 base) (&+ a1-27 96)) + ) + ) + ) + (let* ((v1-28 (-> s3-0 base)) + (a2-23 + (+ (- 1793 (the-as int (shr (-> arg0 width) 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width))))) + ) + (a3-8 (+ (the int (-> arg1 origin y)) 1841)) + (a0-23 (+ a2-23 (-> arg0 width))) + (a1-33 (+ a3-8 (-> arg0 height))) + ) + (set! (-> (the-as (pointer uint128) v1-28) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) v1-28) 1) (-> *subtitle-work* draw-tmpl quad 1)) + (set! (-> (the-as (pointer uint128) v1-28) 2) (-> *subtitle-work* color0 quad)) + (let ((t0-8 (the-as gs-gif-tag (&+ v1-28 48)))) + (set! (-> t0-8 word 0) (the-as uint 0)) + (set! (-> t0-8 word 1) (the-as uint 0)) + (set! (-> t0-8 word 2) (the-as uint 0)) + (set! (-> t0-8 word 3) (the-as uint 0)) + ) + (let ((t0-9 (the-as object (&+ v1-28 64)))) + (set! (-> (the-as gs-gif-tag t0-9) word 0) (* a2-23 16)) + (set! (-> (the-as gs-gif-tag t0-9) word 1) (the-as uint (* a3-8 16))) + (set! (-> (the-as gs-gif-tag t0-9) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag t0-9) word 3) (the-as uint 0)) + ) + (let ((a2-26 (the-as object (&+ v1-28 80)))) + (set! (-> (the-as gs-gif-tag a2-26) word 0) (* gp-0 16)) + (set! (-> (the-as gs-gif-tag a2-26) word 1) (* s5-0 16)) + (set! (-> (the-as gs-gif-tag a2-26) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag a2-26) word 3) (the-as uint 0)) + ) + (let ((v1-29 (the-as object (&+ v1-28 96)))) + (set! (-> (the-as gs-gif-tag v1-29) word 0) (* a0-23 16)) + (set! (-> (the-as gs-gif-tag v1-29) word 1) (the-as uint (* a1-33 16))) + (set! (-> (the-as gs-gif-tag v1-29) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag v1-29) word 3) (the-as uint 0)) + ) + ) + (&+! (-> s3-0 base) 112) + (let* ((v1-32 (-> s3-0 base)) + (a1-38 + (+ (- 1792 (the-as int (shr (-> arg0 width) 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width))))) + ) + (a3-11 (+ (the int (-> arg1 origin y)) 1840)) + (a0-30 (+ a1-38 (-> arg0 width))) + (a2-28 (+ a3-11 (-> arg0 height))) + ) + (set! (-> (the-as (pointer uint128) v1-32) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) v1-32) 1) (-> *subtitle-work* draw-tmpl quad 1)) + (set! (-> (the-as (pointer uint128) v1-32) 2) (-> *subtitle-work* color1 quad)) + (let ((t0-16 (the-as gs-gif-tag (&+ v1-32 48)))) + (set! (-> t0-16 word 0) (the-as uint 0)) + (set! (-> t0-16 word 1) (the-as uint 0)) + (set! (-> t0-16 word 2) (the-as uint 0)) + (set! (-> t0-16 word 3) (the-as uint 0)) + ) + (let ((t0-17 (the-as object (&+ v1-32 64)))) + (set! (-> (the-as gs-gif-tag t0-17) word 0) (* a1-38 16)) + (set! (-> (the-as gs-gif-tag t0-17) word 1) (the-as uint (* a3-11 16))) + (set! (-> (the-as gs-gif-tag t0-17) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag t0-17) word 3) (the-as uint 0)) + ) + (let ((a1-41 (the-as object (&+ v1-32 80)))) + (set! (-> (the-as gs-gif-tag a1-41) word 0) (* gp-0 16)) + (set! (-> (the-as gs-gif-tag a1-41) word 1) (* s5-0 16)) + (set! (-> (the-as gs-gif-tag a1-41) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag a1-41) word 3) (the-as uint 0)) + ) + (let ((v1-33 (the-as object (&+ v1-32 96)))) + (set! (-> (the-as gs-gif-tag v1-33) word 0) (* a0-30 16)) + (set! (-> (the-as gs-gif-tag v1-33) word 1) (the-as uint (* a2-28 16))) + (set! (-> (the-as gs-gif-tag v1-33) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag v1-33) word 3) (the-as uint 0)) + ) + ) + (&+! (-> s3-0 base) 112) + (set-dirty-mask! (-> *level* default-level) 8 (the-as int (* gp-0 s5-0)) 256) + (let ((a3-15 (-> s3-0 base))) + (let ((v1-37 (the-as object (-> s3-0 base)))) + (set! (-> (the-as dma-packet v1-37) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-37) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-37) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (&+ (the-as pointer v1-37) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id bucket-322) + s4-1 + (the-as (pointer dma-tag) a3-15) + ) + ) + ) + ) + ) + +(defbehavior process-drawable-draw-subtitles process-drawable () + (when (and (nonzero? (-> self skel)) + (> (-> self skel active-channels) 0) + (-> *setting-control* user-current subtitle) + ) + (let ((v1-9 (-> self skel root-channel 0 frame-group))) + (when v1-9 + (let ((gp-0 (res-lump-struct (-> v1-9 extra) 'subtitle-range (array subtitle-range)))) + (when gp-0 + (let ((f30-0 (ja-aframe-num 0)) + (s5-0 (the-as int (-> *setting-control* user-current subtitle-language))) + ) + (if (and (= (the-as language-enum s5-0) (language-enum english)) (= (scf-get-territory) 1)) + (set! s5-0 7) + ) + (dotimes (s4-0 (-> gp-0 length)) + (let ((v1-16 (-> gp-0 s4-0))) + (when (and (>= f30-0 (-> v1-16 start-frame)) (< f30-0 (-> v1-16 end-frame))) + (let ((s3-0 (-> v1-16 message s5-0))) + (when (and s3-0 (nonzero? s3-0)) + (let ((s2-0 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 290 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-20 s2-0)) + (set! (-> v1-20 width) (the float (the-as float #x1d1))) + ) + (let ((v1-21 s2-0)) + (set! (-> v1-21 height) (the float (the-as float #x46))) + ) + (let ((v1-22 s2-0)) + (set! (-> v1-22 scale) 0.5) + ) + (set! (-> s2-0 flags) (font-flags shadow kerning middle large)) + (case (-> s3-0 type) + ((string) + (when (= (-> *setting-control* user-default subtitle-language) (language-enum korean)) + (set! s3-0 (convert-korean-text (the-as string s3-0))) + (let ((v1-27 s2-0)) + (set! (-> v1-27 scale) 0.6) + ) + ) + (set! (-> s2-0 flags) (font-flags kerning middle left large)) + (set! (-> s2-0 origin x) (+ -1.0 (-> s2-0 origin x))) + (set! (-> s2-0 origin y) (+ -1.0 (-> s2-0 origin y))) + (set! (-> s2-0 color) (font-color #000000)) + (set! (-> s2-0 origin x) (+ 1.0 (-> s2-0 origin x))) + (set! (-> s2-0 origin y) (+ 1.0 (-> s2-0 origin y))) + (set! (-> s2-0 color) (font-color default-#cddbcd)) + (set! (-> s2-0 flags) (font-flags shadow kerning middle left large)) + (print-game-text (the-as string s3-0) s2-0 #f 44 322) + (gui-control-method-12 + *gui-control* + self + (gui-channel subtitle) + (gui-action play) + "scene" + 0 + 81920.0 + (new 'static 'sound-id) + ) + ) + ((subtitle-image) + (draw-subtitle-image (the-as subtitle-image s3-0) s2-0) + ) + (else + (if *debug-segment* + (format *stdcon* "unknown message ~A~%" s3-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defstate wait (scene-player) + :virtual #t + :enter (behavior ((arg0 symbol)) + (set! (-> self state-time) (-> self clock frame-counter)) + (when (or (-> self scene) (-> self preload-continue)) + (let ((gp-0 (scene-decode-continue (if (-> self scene) + (-> self scene load-point) + (-> self preload-continue) + ) + ) + ) + ) + (when gp-0 + (when (-> self scene) + (set-setting! 'borrow (-> self scene borrow) 0 0) + (apply-settings *setting-control*) + ) + (cond + ((and *target* + (zero? (-> self scene-index)) + (or (not (-> self scene)) (!= (level-status *level* (-> gp-0 vis-nick)) 'active)) + ) + (send-event *target* 'continue gp-0) + ) + (else + (let ((a0-9 (lookup-level-info (-> gp-0 vis-nick)))) + (set! (-> *load-state* vis-nick) (if a0-9 + (-> a0-9 name) + ) + ) + ) + (dotimes (v1-23 6) + (set! (-> *load-state* want v1-23 name) (-> gp-0 want v1-23 name)) + (set! (-> *load-state* want v1-23 display?) (-> gp-0 want v1-23 display?)) + (set! (-> *load-state* want v1-23 force-vis?) #f) + (set! (-> *load-state* want v1-23 force-inside?) #f) + ) + (update-task-masks 'event) + ) + ) + ) + ) + ) + (none) + ) + :trans (behavior () + (if (and (-> self scene) (nonzero? (-> self anim anim-name)) (not (load-in-progress? *level*))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + (set! (-> *ACTOR-bank* birth-max) 1000) + (none) + ) + :code (behavior ((arg0 symbol)) + (local-vars (v1-18 symbol) (v1-118 symbol)) + (when (and (-> self scene) (zero? (-> self scene wait-max-time))) + (while *progress-process* + (suspend) + ) + (set-setting! 'allow-progress #f 0 0) + (set-setting! 'bg-a-force 'abs #x3f800000 0) + (apply-settings *setting-control*) + ) + (if (or (not *target*) (or (logtest? (-> *target* focus-status) (focus-status grabbed)) + (begin + (dotimes (v1-17 6) + (when (= (-> *load-state* want v1-17 name) (-> *target* current-level name)) + (set! v1-18 #f) + (goto cfg-19) + ) + ) + #t + (set! v1-18 #t) + (label cfg-19) + (or v1-18 (not (-> self scene))) + ) + ) + ) + (set! arg0 #f) + ) + (while (and arg0 + (or (logtest? (-> *target* focus-status) (focus-status in-air)) + (and (-> *target* next-state) (= (-> *target* next-state name) 'target-flop-hit-ground)) + ) + (-> self scene) + (< (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-air-time)) + ) + (suspend) + ) + (suspend) + (let ((s5-0 (-> self clock frame-counter))) + (when (and *target* (zero? (logand (-> *target* focus-status) (focus-status grabbed)))) + (label cfg-44) + (let ((t9-3 process-grab?) + (a0-17 *target*) + ) + (when (not (t9-3 a0-17)) + (suspend) + (goto cfg-44) + ) + ) + ) + (process-entity-status! self (entity-perm-status no-kill) #t) + (until (not (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + ) + ) + (set-setting! 'allow-progress #f 0 0) + (apply-settings *setting-control*) + (dotimes (s4-0 2) + (while (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + (or (and (-> *setting-control* user-current movie) + (!= (-> *setting-control* user-current movie) (process->ppointer self)) + ) + *progress-process* + (!= (gui-control-method-17 *gui-control* (the-as sound-id (-> self gui-id))) 3) + ) + ) + (suspend) + ) + ) + (when arg0 + (while (and (-> self scene) + (not (or (>= (- (-> self clock frame-counter) s5-0) (-> self scene wait-ground-time)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-max-time)) + ) + ) + ) + (suspend) + ) + ) + (remove-setting! 'movie) + (remove-setting! 'sound-bank-load) + (remove-setting! 'movie-name) + (remove-setting! 'bg-a-force) + (apply-settings *setting-control*) + (set-blackout-frames (seconds 0.1)) + (suspend) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + ) + (send-event *target* 'trans 'save (-> self old-target-pos)) + (let ((gp-1 *load-state*)) + (when gp-1 + (dotimes (s5-1 2) + (while (begin + (dotimes (s4-1 6) + (when (not (or (not (-> gp-1 want s4-1 name)) + (not (-> gp-1 want s4-1 display?)) + (= (level-status *level* (-> gp-1 want s4-1 name)) 'active) + ) + ) + (set! v1-118 #t) + (goto cfg-109) + ) + ) + (set! v1-118 #f) + (label cfg-109) + v1-118 + ) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + (when (and (zero? s5-1) (< (-> self scene-index) (-> self scene-list length))) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + (when (-> self scene) + (set-setting! 'borrow (-> self scene borrow) 0 0) + (apply-settings *setting-control*) + ) + ) + ) + ) + ) + (if (and *target* (logtest? (focus-status in-head flut board pilot mech dark) (-> *target* focus-status))) + (send-event *target* 'change-mode 'normal) + ) + (when (< (-> self scene-index) (-> self scene-list length)) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + (while (and (-> self scene) + (nonzero? (-> self anim anim-name)) + (let ((v1-161 (file-status *art-control* (-> self anim name) 0))) + (or (not (or (= v1-161 'active) (= v1-161 'locked))) + (let* ((a1-26 (gui-control-method-14 + *gui-control* + (the-as string (-> self anim anim-name)) + (gui-channel none) + (gui-action none) + ) + ) + (v1-167 (gui-control-method-17 *gui-control* (the-as sound-id a1-26))) + ) + (not (or (= v1-167 (gui-action play)) (= v1-167 (gui-action playing)))) + ) + ) + ) + ) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + ) + (go-virtual play-anim) + (none) + ) + ) + +(defstate release (scene-player) + :virtual #t + :code (behavior () + (when (= (-> *game-info* demo-state) 100) + (logclear! (-> self mask) (process-mask pause progress)) + (set-blackout-frames (seconds 0.05)) + (set-setting! 'music-volume 'abs 0 0) + (set-setting! 'sfx-volume 'abs 0 0) + (set-setting! 'ambient-volume 'abs 0 0) + (set-setting! 'allow-pause #f 0 0) + (set-setting! 'allow-progress #f 0 0) + (setup + *screen-filter* + (new 'static 'vector) + (new 'static 'vector :w 128.0) + (* 30.0 (-> self clock seconds-per-frame)) + (bucket-id screen-filter) + ) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (suspend) + ) + ) + (set! (-> *setting-control* user-current bg-a) 0.0) + (remove-setting! 'movie) + (remove-setting! 'movie-name) + (while (or (-> *setting-control* user-current movie) + (not *target*) + (!= (-> *setting-control* user-current bg-a) 0.0) + ) + (suspend) + ) + (set! (-> *game-info* blackout-time) 0) + (set! (-> *game-info* demo-state) (the-as uint 1)) + (set! (-> *setting-control* user-current bg-a-force) 0.0) + (set-setting! 'allow-progress #t 0 0) + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + (send-event *target* 'draw #t) + (send-event *target* 'trans 'reset) + (send-event *target* 'change-mode 'normal) + (activate-progress *dproc* 'select-scene-special) + (dotimes (gp-1 5) + (suspend) + ) + (disable *screen-filter*) + (deactivate self) + ) + (when (< (-> self scene-index) (+ (-> self scene-list length) -1)) + (set! (-> self scene-index) (+ (-> self scene-list length) -1)) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + ) + (let ((gp-2 (or (not (-> self scene)) (-> self scene blackout-end)))) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + (send-event *target* 'draw #t) + (send-event *target* 'trans 'reset) + (suspend) + (while (not (process-release? *target*)) + (suspend) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + ) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + ) + (if (nonzero? (the int (-> self scene music-delay))) + (persist-with-delay + *setting-control* + 'music-delay + (the-as time-frame (the int (-> self scene music-delay))) + 'sound-mode + #f + 0.0 + 2 + ) + ) + (cond + ((and *target* (-> self scene) (-> self scene end-point)) + (let ((gp-3 (scene-decode-continue (-> self scene end-point)))) + (when gp-3 + (set-continue! *game-info* gp-3 #f) + (send-event *target* 'continue gp-3) + ) + ) + ) + (else + (send-event *target* 'trans 'restore (-> self old-target-pos)) + ) + ) + (if (and (-> self scene) (-> self scene save)) + (auto-save-user) + ) + (none) + ) + ) + +(defstate play-anim (scene-player) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('abort) + (set! (-> self aborted?) #t) + (set-blackout-frames (seconds 0.2)) + (let ((a0-3 (-> self anim))) + (when (and a0-3 (= (-> *setting-control* user-current spooling) (process->ppointer self))) + (ja-abort-spooled-anim a0-3 (the-as art-joint-anim #f) -1) + (ja-channel-set! 0) + ) + ) + (go-virtual release) + ) + ) + ) + :exit (behavior () + (while (-> self child) + (deactivate (-> self child 0)) + ) + (kill-current-talker (the-as symbol '()) '(daxter voicebox message) 'exit) + (set! (-> *setting-control* user-current bg-a) 0.0) + (kill-persister *setting-control* (the-as engine-pers 'bg-a) 'bg-a) + (kill-persister *setting-control* (the-as engine-pers 'bg-a-speed) 'bg-a-speed) + (remove-setting! 'borrow) + (remove-setting! 'gem) + (apply-settings *setting-control*) + (none) + ) + :trans (behavior () + (cond + ((not (-> *setting-control* user-current spooling)) + (if (and (-> self scene) (nonzero? (-> self anim anim-name))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + ) + (else + (if (and (-> self scene) (nonzero? (-> self next-anim anim-name))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self next-anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (local-vars (a0-24 symbol)) + (if (and (= (-> *game-info* demo-state) 100) (-> self scene) (nonzero? (-> self scene scene-task))) + (task-node-open! (the-as game-task-node (-> self scene scene-task))) + ) + (dotimes (gp-0 2) + (let ((v1-11 (-> *art-control* buffer gp-0))) + (if (= (-> v1-11 status) 'active) + (link-art! (-> v1-11 art-group)) + ) + ) + ) + (while (and (< (-> self scene-index) (-> self scene-list length)) (not (-> self aborted?))) + (scene-player-method-23 self (the-as string (-> self scene-list (-> self scene-index))) #t) + (set-blackout-frames (seconds 0.1)) + (suspend) + (set-blackout-frames (seconds 0.1)) + (suspend) + (scene-player-method-25 self 0.0) + (set! (-> self cur-speed) 0.0) + (set! (-> self scene-start-time) (-> self clock frame-counter)) + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (the-as + (function process-drawable symbol) + (if (-> self scene abort) + (lambda :behavior scene-player () (when (cpad-pressed? 0 triangle) + (set! (-> self aborted?) #t) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + #t + ) + ) + false-func + ) + ) + ) + (while (-> self child) + (deactivate (-> self child 0)) + ) + (+! (-> self scene-index) 1) + (when (and (< (-> self scene-index) (-> self scene-list length)) (not (-> self aborted?))) + (let ((v1-41 (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t))) + (when v1-41 + (let ((a0-21 (scene-decode-continue (-> v1-41 load-point)))) + (set! a0-24 (when (and a0-21 (logtest? (-> a0-21 flags) (continue-flags cf1))) + (go-virtual wait a0-24) + a0-24 + ) + ) + ) + ) + ) + ) + ) + (if (and (-> self wait) *target* (logtest? (-> *target* focus-status) (focus-status grabbed))) + (go-virtual release) + ) + (none) + ) + :post (behavior () + (when (-> self scene) + (let ((gp-0 (-> self scene cut-list)) + (s5-0 (-> self skel root-channel 0 frame-group)) + ) + (when (not (or (null? gp-0) (not s5-0) (zero? s5-0))) + (let ((v1-8 (the int (ja-frame-num 0))) + (a0-2 (car gp-0)) + ) + (while (not (null? gp-0)) + (let ((f0-5 (/ (- (the float (/ (the-as int a0-2) 8)) (-> s5-0 artist-base)) (-> s5-0 artist-step)))) + (when (= v1-8 (if (= f0-5 (the float (the int f0-5))) + (+ (the int f0-5) -1) + (the int f0-5) + ) + ) + (set! (-> self skel root-channel 0 frame-num) (the float (the int (-> self skel root-channel 0 frame-num)))) + (set! (-> self pre-cut-frame) (the-as basic #t)) + ) + ) + (set! gp-0 (cdr gp-0)) + (set! a0-2 (car gp-0)) + ) + ) + ) + ) + (if (-> self pre-cut-frame) + (set! (-> self pre-cut-frame) #f) + ) + ) + (when (and (-> self scene) (nonzero? (-> self skel active-channels))) + (if (and (< (ja-aframe-num 0) 2.0) (logtest? (-> self skel status) (joint-control-status valid-spooled-frame))) + (set-blackout-frames 0) + ) + (scene-player-method-25 self (ja-aframe-num 0)) + (set! (-> self dma-max) + (the-as uint (max + (the-as int (-> self dma-max)) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) global-buf)) 16) + ) + ) + ) + (let ((gp-4 *display-scene-control*)) + (when (nonzero? gp-4) + (if (logtest? gp-4 (scene-controls bounds-spheres)) + (debug-print-channels (-> self skel) (the-as symbol *stdcon*)) + ) + (if (logtest? gp-4 (scene-controls actors)) + (format *stdcon* "anim ~-30S " (-> self scene anim)) + ) + (if (logtest? gp-4 (scene-controls actor-marks)) + (format + *stdcon* + "dma ~DK / ~DK" + (shr (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) global-buf)) 16) 10) + (shr (-> self dma-max) 10) + ) + ) + (if (logtest? gp-4 (scene-controls actors actor-marks)) + (format *stdcon* "~%") + ) + (when (logtest? gp-4 (scene-controls special-fma-spheres)) + (dotimes (s5-3 (-> self scene actor length)) + (let* ((s4-1 (handle->process (-> self scene actor s5-3 process))) + (v1-63 (if (type? s4-1 process-drawable) + (the-as process-drawable s4-1) + ) + ) + ) + (if (and v1-63 (nonzero? (-> v1-63 draw))) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> v1-63 draw origin) + (-> v1-63 draw bounds w) + (new 'static 'rgba :b #xff :a #x80) + ) + ) + ) + ) + ) + (when (logtest? gp-4 (scene-controls scene-controls-7)) + (dotimes (s5-4 (-> self scene actor length)) + (let* ((s4-2 (handle->process (-> self scene actor s5-4 process))) + (v1-79 (if (type? s4-2 process-drawable) + (the-as process-drawable s4-2) + ) + ) + ) + (if (and v1-79 (nonzero? (-> v1-79 draw))) + (format + *stdcon* + "~0K ~-30S ~S d:~4,,0m r:~4,,0m~1K~%" + (-> self scene actor s5-4 art-group) + (if (logtest? (-> v1-79 draw status) (draw-control-status on-screen)) + "os" + " " + ) + (-> v1-79 draw distance) + (-> v1-79 draw bounds w) + ) + ) + ) + ) + ) + (when (logtest? gp-4 (scene-controls scene-controls-8)) + (dotimes (gp-5 (-> self scene actor length)) + (let* ((s5-5 (handle->process (-> self scene actor gp-5 process))) + (v1-94 (if (type? s5-5 process-drawable) + (the-as process-drawable s5-5) + ) + ) + ) + (if (and v1-94 (nonzero? (-> v1-94 draw))) + (add-debug-text-3d + #t + (bucket-id debug-no-zbuf1) + (-> v1-94 name) + (-> v1-94 draw origin) + (font-color yellow-#f3f300) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) + ) + ) + ) + ) + ) + ) + ) + ) + (when (cpad-pressed? 0 square) + (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle))) + (set! (-> self subtitle-change-time) (-> self clock frame-counter)) + ) + (when (and (< (- (-> self clock frame-counter) (-> self subtitle-change-time)) (seconds 2)) + (< (mod (- (-> self clock frame-counter) (-> self subtitle-change-time)) 300) 210) + ) + (let ((gp-6 (new + 'stack + 'font-context + *font-default-matrix* + 36 + 60 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-121 gp-6)) + (set! (-> v1-121 width) (the float (the-as float #x1b8))) + ) + (let ((v1-122 gp-6)) + (set! (-> v1-122 height) (the float (the-as float #x30))) + ) + (let ((v1-123 gp-6)) + (set! (-> v1-123 scale) 0.5) + ) + (set! (-> gp-6 flags) (font-flags shadow kerning middle large)) + (print-game-text + (lookup-text! + *common-text* + (if (-> *setting-control* user-default subtitle) + (game-text-id scene-subtitles-enabled) + (game-text-id scene-subtitles-disabled) + ) + #f + ) + gp-6 + #f + 44 + 322 + ) + ) + ) + (process-drawable-draw-subtitles) + (when (and (= *cheat-mode* 'debug) (-> self scene)) + (let ((gp-7 + (gui-control-method-15 *gui-control* self (gui-channel art-load) (-> self scene name) (new 'static 'sound-id)) + ) + ) + (when (!= *external-cam-mode* 'pad-0) + (cond + ((cpad-hold? 0 r1) + (if (cpad-pressed? 0 circle) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + ) + (seek! + (-> self speed-change-speed) + 8.0 + (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (-> self clock time-adjust-ratio) + ) + ) + ) + ((cpad-hold? 0 l1) + (if (cpad-pressed? 0 square) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + ) + (seek! + (-> self speed-change-speed) + -8.0 + (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (-> self clock time-adjust-ratio) + ) + ) + ) + ((cpad-hold? 0 x) + (when (cpad-pressed? 0 x) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + (cond + ((= (-> self cur-speed) 0.0) + (set! (-> self speed-change-speed) -1000.0) + ) + (else + (set! (-> self targ-speed) 0.0) + (set! (-> self speed-change-speed) 0.0) + ) + ) + ) + ) + (else + (set! (-> self speed-change-speed) 0.0) + ) + ) + ) + (cond + ((= (-> self cur-speed) -1000.0) + (format *stdcon* "scene paused~%") + (when (!= (-> self targ-speed) -1000.0) + (sound-continue (-> gp-7 id)) + (when *sound-player-enable* + (let ((v1-186 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-186 command) (sound-command set-param)) + (set! (-> v1-186 id) (-> gp-7 id)) + (set! (-> v1-186 params pitch-mod) 0) + (set! (-> v1-186 params mask) (the-as uint 2)) + (-> v1-186 id) + ) + ) + (set! (-> self targ-speed) 0.0) + (set! (-> self cur-speed) 0.0) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + ) + ) + ((= (-> self speed-change-speed) -1000.0) + (when (!= (-> self cur-speed) -1000.0) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self targ-speed) -1000.0) + (set! (-> self cur-speed) -1000.0) + (sound-pause (-> gp-7 id)) + ) + ) + (else + (set! (-> self targ-speed) + (fmax + -10.0 + (fmin 10.0 (+ (-> self targ-speed) (* (-> self speed-change-speed) (-> self clock seconds-per-frame)))) + ) + ) + (if (< (- (-> self clock frame-counter) (-> self speed-change-time)) (seconds 3)) + (format + *stdcon* + "id ~d speed ~f~%" + (if gp-7 + (the-as int (-> gp-7 id)) + 0 + ) + (-> self targ-speed) + ) + ) + (when (and gp-7 (and (!= (-> self targ-speed) (-> self cur-speed)) + (< (-> self speed-change-time) (-> self clock frame-counter)) + (>= (- (-> self clock frame-counter) (-> self scene-start-time)) (seconds 1)) + ) + ) + (when *sound-player-enable* + (let ((v1-211 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-211 command) (sound-command set-param)) + (set! (-> v1-211 id) (-> gp-7 id)) + (set! (-> v1-211 params pitch-mod) (the int (* 1524.0 (-> self targ-speed)))) + (set! (-> v1-211 params mask) (the-as uint 2)) + (-> v1-211 id) + ) + ) + (set! (-> self cur-speed) (-> self targ-speed)) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +(defbehavior scene-player-init scene-player ((arg0 object) (arg1 symbol) (arg2 string)) + "`object` arg can be an `(array scene)`, `pair of scene` or a `scene`" + (process-entity-set! self (the-as entity-actor #f)) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self root) (new 'process 'trsqv)) + (case (rtype-of arg0) + ((array) + (set! (-> self scene-list) (new 'process 'boxed-array scene (-> (the-as (array scene) arg0) length))) + (dotimes (v1-7 (-> self scene-list length)) + (set! (-> self scene-list v1-7) (-> (the-as (array scene) arg0) v1-7)) + ) + ) + ((pair) + (let ((s3-0 (method-of-type array new)) + (s2-0 'process) + (s1-0 array) + (s0-0 scene) + (a0-14 arg0) + ) + (set! (-> self scene-list) + (the-as (array scene) (s3-0 s2-0 s1-0 s0-0 ((method-of-type (rtype-of a0-14) length) a0-14))) + ) + ) + (dotimes (s3-1 (-> self scene-list length)) + (set! (-> self scene-list s3-1) (the-as scene (ref arg0 s3-1))) + ) + ) + (else + (set! (-> self scene-list) (new 'process 'boxed-array scene 1)) + (set! (-> self scene-list 0) (the-as scene arg0)) + ) + ) + (set! (-> self preload-continue) arg2) + (set! (-> self camera) (the-as handle #f)) + (set! (-> self wait) arg1) + (set! (-> self pre-cut-frame) #f) + (set! (-> self aborted?) #f) + (set! (-> self draw) (new 'process 'draw-control self #f)) + (set! (-> self skel) (new 'process 'joint-control 48)) + (set! (-> self anim) (new 'static 'spool-anim)) + (set! (-> self next-anim) (new 'static 'spool-anim)) + (dotimes (s4-1 (-> self scene-list length)) + (let ((v1-29 (scene-lookup (-> self scene-list s4-1)))) + (if v1-29 + (set! (-> self scene-list s4-1) v1-29) + ) + ) + ) + (cond + ((= (-> self scene-list (-> self scene-index) type) scene) + (set! (-> self scene) (-> self scene-list (-> self scene-index))) + (if (-> self scene) + (scene-method-15 (-> self scene) (-> self anim)) + ) + ) + (else + (set-blackout-frames (seconds 0.2)) + (set! (-> self scene) #f) + ) + ) + (set! (-> self gui-id) (the-as uint (gui-control-method-9 + *gui-control* + self + (gui-channel movie) + (gui-action play) + (the-as string (cond + ((= (rtype-of arg0) string) + (empty) + arg0 + ) + (else + "movie" + ) + ) + ) + -99.0 + 0 + ) + ) + ) + (set! *scene-player* (the-as scene-player (process->ppointer self))) + (set! *display-entity-errors* #f) + (set-setting! 'speech-control #f 0 0) + (set-setting! 'allow-progress #f 0 0) + (apply-settings *setting-control*) + (go-virtual wait arg1) + (none) + ) + +(defmethod scene-method-16 scene ((obj scene)) + (let ((v1-1 (-> *level* loading-level))) + (if v1-1 + (set-loaded-art (-> v1-1 art-group) obj) + ) + ) + obj + ) diff --git a/goal_src/jak2/engine/ui/hud-h.gc b/goal_src/jak2/engine/ui/hud-h.gc index 644d101d66..abf554065b 100644 --- a/goal_src/jak2/engine/ui/hud-h.gc +++ b/goal_src/jak2/engine/ui/hud-h.gc @@ -41,14 +41,14 @@ (scale-x float :offset-assert 36) (scale-y float :offset-assert 40) (angle float :offset-assert 44) - (tex basic :offset-assert 48) + (tex texture :offset-assert 48) ) :method-count-assert 11 :size-assert #x34 :flag-assert #xb00000034 (:methods (hud-sprite-method-9 (_type_ dma-buffer level) none 9) - (hud-sprite-method-10 () none 10) + (hud-sprite-method-10 (_type_) none 10) ) ) @@ -107,26 +107,26 @@ (strings hud-string 14 :inline :offset-assert 288) (sprites hud-sprite 30 :inline :offset-assert 960) (icons hud-icon 2 :inline :offset-assert 2880) - (gui-id uint32 :offset-assert 2976) + (gui-id sound-id :offset-assert 2976) ) :heap-base #xb30 :method-count-assert 27 :size-assert #xba4 :flag-assert #x1b0b300ba4 (:methods - (hud-method-14 () none 14) - (hud-method-15 () none 15) - (hud-method-16 () none 16) - (hud-method-17 () none 17) - (hud-method-18 () none 18) - (hud-method-19 () none 19) - (hud-method-20 () none 20) - (hud-method-21 () none 21) - (hud-method-22 () none 22) - (hud-method-23 () none 23) - (hud-method-24 () none 24) - (hud-method-25 () none 25) - (hud-method-26 () none 26) + (hidden? (_type_) symbol 14) + (hud-method-15 (_type_) none 15) + (hud-method-16 (_type_ int int) none 16) + (hud-method-17 (_type_) none 17) + (hud-method-18 (_type_) symbol 18) + (hud-method-19 (_type_) none 19) + (hud-method-20 (_type_) none 20) + (hud-method-21 (_type_) none 21) + (hud-method-22 (_type_) none 22) + (hud-method-23 (_type_) none 23) + (hud-method-24 (_type_ symbol) none 24) + (hud-method-25 (_type_) none 25) + (hud-method-26 (_type_ int) none 26) ) ) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 9fe5d0170c..03553b8a56 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -67,75 +67,75 @@ (text-xfe #x00fe) (text-xff #x00ff) (text-x100 #x0100) - (pause 257) + (pause #x101) (text-x102 #x0102) (text-x103 #x0103) (text-x104 #x0104) (text-x105 #x0105) (text-x106 #x0106) (text-x107 #x0107) - (progress-sound-music-volume 264) - (progress-sound-speech-volume 265) + (progress-sound-music-volume #x108) + (progress-sound-speech-volume #x109) (text-x109 #x0109) (text-x10a #x010a) (text-x10b #x010b) (text-x10c #x010c) (text-x10d #x010d) - (progress-on 270) - (progress-off 271) - (progress-move-dpad 272) - (progress-aspect-ratio 280) - (progress-progressive-scan 281) - (progress-video-mode 282) - (progress-root-game-options 283) - (progress-root-graphic-options 284) - (progress-root-sound-options 285) - (progress-aspect-4x3 286) - (progress-aspect-16x9 287) - (progress-refresh-60hz 288) - (progress-refresh-50hz 289) - (progress-demo-exit 291) - (progress-yes 292) - (progress-no 293) - (progress-back 294) - (progress-ok 295) - (progress-next 296) - (progress-previous 297) - (progress-continue-without-saving 298) - (progress-select-file-to-save 299) - (progress-select-file-to-load 300) - (progress-load-game 301) - (progress-save-game 302) - (progress-slot-empty 303) - (progress-title-options 304) - (progress-title-new-game 305) - (progress-title-prompt 306) - (progress-quit 307) - (progress-root-show-map 308) + (progress-on #x10e) + (progress-off #x10f) + (progress-move-dpad #x110) + (progress-aspect-ratio #x118) + (progress-progressive-scan #x119) + (progress-video-mode #x11a) + (progress-root-game-options #x11b) + (progress-root-graphic-options #x11c) + (progress-root-sound-options #x11d) + (progress-aspect-4x3 #x11e) + (progress-aspect-16x9 #x11f) + (progress-refresh-60hz #x120) + (progress-refresh-50hz #x121) + (progress-demo-exit #x123) + (progress-yes #x124) + (progress-no #x125) + (progress-back #x126) + (progress-ok #x127) + (progress-next #x128) + (progress-previous #x129) + (progress-continue-without-saving #x12a) + (progress-select-file-to-save #x12b) + (progress-select-file-to-load #x12c) + (progress-load-game #x12d) + (progress-save-game #x12e) + (progress-slot-empty #x12f) + (progress-title-options #x130) + (progress-title-new-game #x131) + (progress-title-prompt #x132) + (progress-quit #x133) + (progress-root-show-map #x134) (text-x135 #x0135) - (progress-root-highscores 310) - (progress-highscores-1st 311) - (progress-highscores-2nd 312) - (progress-highscores-3rd 313) - (progress-highscores-4th 314) - (progress-highscores-5th 315) - (progress-highscores-6th 316) - (progress-highscores-7th 317) - (progress-highscores-8th 318) - (progress-root-secrets 339) - (progress-secrets-unlocked 340) + (progress-root-highscores #x136) + (progress-highscores-1st #x137) + (progress-highscores-2nd #x138) + (progress-highscores-3rd #x139) + (progress-highscores-4th #x13a) + (progress-highscores-5th #x13b) + (progress-highscores-6th #x13c) + (progress-highscores-7th #x13d) + (progress-highscores-8th #x13e) + (progress-root-secrets #x153) + (progress-secrets-unlocked #x154) (text-x155 #x0155) (text-x156 #x0156) (text-x157 #x0157) (text-x158 #x0158) - (progress-main-secrets-hero-mode 345) - (progress-main-secrets-sceneplayer-1 346) - (progress-main-secrets-sceneplayer-2 347) - (progress-main-secrets-sceneplayer-3 348) - (progress-main-secrets-scrapbook 349) - (progress-main-secrets-mega-scrapbook 350) - (progress-main-secrets-scrapbook-3 351) - (progress-main-secrets-levelselect 352) + (progress-main-secrets-hero-mode #x159) + (progress-main-secrets-sceneplayer-1 #x15a) + (progress-main-secrets-sceneplayer-2 #x15b) + (progress-main-secrets-sceneplayer-3 #x15c) + (progress-main-secrets-scrapbook #x15d) + (progress-main-secrets-mega-scrapbook #x15e) + (progress-main-secrets-scrapbook-3 #x15f) + (progress-main-secrets-levelselect #x160) (text-x161 #x0161) (text-x162 #x0162) (text-x163 #x0163) @@ -143,28 +143,28 @@ (text-x165 #x0165) (text-x166 #x0166) (text-x167 #x0167) - (progress-secrets-orb-label 360) - (progress-root-missions 361) + (progress-secrets-orb-label #x168) + (progress-root-missions #x169) (text-x16a #x016a) (text-x16b #x016b) (text-x16c #x016c) (text-x16d #x016d) - (progress-root-restart-mission 366) - (progress-missions-icon-todo 367) - (progress-missions-icon-completed 368) - (progress-missions-none 369) - (progress-unknown-game 370) + (progress-root-restart-mission #x16e) + (progress-missions-icon-todo #x16f) + (progress-missions-icon-completed #x170) + (progress-missions-none #x171) + (progress-unknown-game #x172) (text-x173 #x0173) (text-x174 #x0174) (text-x175 #x0175) (text-x176 #x0176) (text-x177 #x0177) (text-x178 #x0178) - (progress-unknown-square-to-reset 377) - (progress-unknown-oi1un23i13 380) - (progress-unknown-kjanskd 381) - (progress-unknown-retry? 382) - (progress-secrets-go-to-title-screen 383) + (progress-unknown-square-to-reset #x179) + (progress-unknown-oi1un23i13 #x17c) + (progress-unknown-kjanskd #x17d) + (progress-unknown-retry? #x17e) + (progress-secrets-go-to-title-screen #x17f) (text-x180 #x0180) (text-x181 #x0181) (text-x182 #x0182) @@ -177,45 +177,45 @@ (text-x189 #x0189) (text-x18a #x018a) (text-x18b #x018b) - (progress-graphics-60hz-change-notice 395) - (progress-graphics-progressivescan-change-notice 396) - (progress-graphics-progressivescan-warning-1 397) - (progress-graphics-progressivescan-warning-2 398) - (progress-graphics-60hz-change-complete 399) - (progress-graphics-progressivescan-change-complete 400) - (progress-graphics-mode-revert? 401) - (progress-disc-removed-notice 402) - (progress-disc-removed-prompt 403) - (progress-disc-read-error 404) - (progress-disc-read-error-prompt 405) - (progress-quit-game-confirm 406) - (progress-memcard-not-found 409) - (progress-memcard-unformatted 410) - (progress-memcard-space-requirement 411) - (progress-memcard-insert-card-with-jak2 412) - (progress-memcard-insert-card-with-space-to-save 413) - (progress-memcard-formatting-required-notice 414) - (progress-memcard-loading-data 416) + (progress-graphics-60hz-change-notice #x18b) + (progress-graphics-progressivescan-change-notice #x18c) + (progress-graphics-progressivescan-warning-1 #x18d) + (progress-graphics-progressivescan-warning-2 #x18e) + (progress-graphics-60hz-change-complete #x18f) + (progress-graphics-progressivescan-change-complete #x190) + (progress-graphics-mode-revert? #x191) + (progress-disc-removed-notice #x192) + (progress-disc-removed-prompt #x193) + (progress-disc-read-error #x194) + (progress-disc-read-error-prompt #x195) + (progress-quit-game-confirm #x196) + (progress-memcard-not-found #x199) + (progress-memcard-unformatted #x19a) + (progress-memcard-space-requirement #x19b) + (progress-memcard-insert-card-with-jak2 #x19c) + (progress-memcard-insert-card-with-space-to-save #x19d) + (progress-memcard-formatting-required-notice #x19e) + (progress-memcard-loading-data #x1a0) (text-x1a1 #x01a1) (text-x1a2 #x01a2) - (progress-memcard-dont-remove 419) - (progress-memcard-overwrite-warning 420) - (progress-memcard-overwrite-confirm 421) - (progress-memcard-format-prompt 422) - (progress-memcard-continue? 423) - (progress-memcard-go-back? 424) - (progress-memcard-error-while-saving 426) + (progress-memcard-dont-remove #x1a3) + (progress-memcard-overwrite-warning #x1a4) + (progress-memcard-overwrite-confirm #x1a5) + (progress-memcard-format-prompt #x1a6) + (progress-memcard-continue? #x1a7) + (progress-memcard-go-back? #x1a8) + (progress-memcard-error-while-saving #x1aa) (text-x1ab #x01ab) (text-x1ac #x01ac) - (progress-memcard-check 429) - (progress-memcard-check-and-try-again 430) - (progress-memcard-was-removed 431) - (progress-autosave-disabled 432) - (progress-autosave-reenabling-info 433) - (progress-memcard-no-jak2-found 434) - (progress-memcard-create-jak2-file? 435) - (progress-autosave-explanation 436) - (progress-autosave-dont-remove 437) + (progress-memcard-check #x1ad) + (progress-memcard-check-and-try-again #x1ae) + (progress-memcard-was-removed #x1af) + (progress-autosave-disabled #x1b0) + (progress-autosave-reenabling-info #x1b1) + (progress-memcard-no-jak2-found #x1b2) + (progress-memcard-create-jak2-file? #x1b3) + (progress-autosave-explanation #x1b4) + (progress-autosave-dont-remove #x1b5) (text-x1b6 #x01b6) (text-x1b7 #x01b7) (text-x1b8 #x01b8) @@ -310,23 +310,23 @@ (text-x211 #x0211) (text-x212 #x0212) (text-x213 #x0213) - (progress-locations-haven-city 531) - (progress-locations-fortress 532) - (progress-locations-landing-pad 533) - (progress-locations-palace-roof 534) - (progress-locations-palace 535) - (progress-locations-weapons-factory 536) - (progress-locations-dead-town 537) - (progress-locations-pumping-station 538) - (progress-locations-sewer 539) - (progress-locations-strip-mine 540) - (progress-locations-mountain-temple 541) - (progress-locations-haven-forest 542) - (progress-locations-drill-platform 543) - (progress-locations-mars-tomb 544) - (progress-locations-dig 545) - (progress-locations-underport 546) - (progress-locations-nest 547) + (progress-locations-haven-city #x213) + (progress-locations-fortress #x214) + (progress-locations-landing-pad #x215) + (progress-locations-palace-roof #x216) + (progress-locations-palace #x217) + (progress-locations-weapons-factory #x218) + (progress-locations-dead-town #x219) + (progress-locations-pumping-station #x21a) + (progress-locations-sewer #x21b) + (progress-locations-strip-mine #x21c) + (progress-locations-mountain-temple #x21d) + (progress-locations-haven-forest #x21e) + (progress-locations-drill-platform #x21f) + (progress-locations-mars-tomb #x220) + (progress-locations-dig #x221) + (progress-locations-underport #x222) + (progress-locations-nest #x223) (text-x224 #x0224) (text-x225 #x0225) (text-x226 #x0226) @@ -371,7 +371,9 @@ (text-x24d #x024d) (text-x24e #x024e) (text-x24f #x024f) - (progress-unknown-continue 784) + (scene-subtitles-enabled #x30d) + (scene-subtitles-disabled #x30e) + (progress-unknown-continue #x310) ) ;; ---game-text-id diff --git a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc index 73526e75d3..250f5f9d12 100644 --- a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc @@ -608,6 +608,7 @@ :size-assert #xd8 :flag-assert #xf000000d8 (:methods + (new (symbol type process symbol) _type_ 0) (get-skeleton-origin (_type_) vector 9) (draw-control-method-10 () none 10) (draw-control-method-11 () none 11) diff --git a/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc b/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc index 13b6d5e2d1..a135cbd80c 100644 --- a/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc @@ -255,9 +255,9 @@ ;; definition of type subtitle-range (deftype subtitle-range (basic) - ((start-frame float :offset-assert 4) - (end-frame float :offset-assert 8) - (message object 8 :offset-assert 12) + ((start-frame float :offset-assert 4) + (end-frame float :offset-assert 8) + (message basic 8 :offset-assert 12) ) :method-count-assert 9 :size-assert #x2c diff --git a/test/decompiler/reference/jak2/engine/scene/scene-h_REF.gc b/test/decompiler/reference/jak2/engine/scene/scene-h_REF.gc index 11fd905036..195ce32097 100644 --- a/test/decompiler/reference/jak2/engine/scene/scene-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/scene/scene-h_REF.gc @@ -135,28 +135,28 @@ ;; definition of type scene-player (deftype scene-player (process-drawable) - ((scene-list (pointer symbol) :offset-assert 200) - (scene scene :offset-assert 204) - (scene-index int32 :offset-assert 208) - (anim spool-anim :offset-assert 212) - (next-anim spool-anim :offset-assert 216) - (camera handle :offset-assert 224) - (main-entity entity-actor :offset-assert 232) - (wait basic :offset-assert 236) - (old-target-pos transformq :inline :offset-assert 240) - (pre-cut-frame basic :offset-assert 288) - (preload-continue string :offset-assert 292) - (dma-max uint32 :offset-assert 296) - (gui-id uint32 :offset-assert 300) - (aborted? symbol :offset-assert 304) - (scene-start-time time-frame :offset-assert 312) - (targ-speed float :offset-assert 320) - (cur-speed float :offset-assert 324) - (speed-change-time time-frame :offset-assert 328) - (speed-press-time time-frame :offset-assert 336) - (speed-change-speed float :offset-assert 344) - (subtitle-change-time time-frame :offset-assert 352) - (user-sound uint32 4 :offset-assert 360) + ((scene-list (array scene) :offset-assert 200) + (scene scene :offset-assert 204) + (scene-index int32 :offset-assert 208) + (anim spool-anim :offset-assert 212) + (next-anim spool-anim :offset-assert 216) + (camera handle :offset-assert 224) + (main-entity entity-actor :offset-assert 232) + (wait symbol :offset-assert 236) + (old-target-pos transformq :inline :offset-assert 240) + (pre-cut-frame basic :offset-assert 288) + (preload-continue string :offset-assert 292) + (dma-max uint32 :offset-assert 296) + (gui-id uint32 :offset-assert 300) + (aborted? symbol :offset-assert 304) + (scene-start-time time-frame :offset-assert 312) + (targ-speed float :offset-assert 320) + (cur-speed float :offset-assert 324) + (speed-change-time time-frame :offset-assert 328) + (speed-press-time time-frame :offset-assert 336) + (speed-change-speed float :offset-assert 344) + (subtitle-change-time time-frame :offset-assert 352) + (user-sound sound-id 4 :offset-assert 360) ) :heap-base #x100 :method-count-assert 26 diff --git a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc new file mode 100644 index 0000000000..e6e89570b9 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc @@ -0,0 +1,1892 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type scene-stage +(deftype scene-stage (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + +;; definition for method 3 of type scene-stage +(defmethod inspect scene-stage ((obj scene-stage)) + (when (not obj) + (set! obj obj) + (goto cfg-68) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tmask: #x~X : (process-mask " (-> obj mask)) + (let ((s5-0 (-> obj mask))) + (if (= (logand s5-0 (process-mask process-tree)) (process-mask process-tree)) + (format #t "process-tree ") + ) + (if (= (logand s5-0 (process-mask target)) (process-mask target)) + (format #t "target ") + ) + (if (= (logand (process-mask collectable) s5-0) (process-mask collectable)) + (format #t "attackable ") + ) + (if (= (logand (process-mask bit18) s5-0) (process-mask bit18)) + (format #t "collectable ") + ) + (if (= (logand (process-mask projectile) s5-0) (process-mask projectile)) + (format #t "projectile ") + ) + (if (= (logand (process-mask no-track) s5-0) (process-mask no-track)) + (format #t "no-track ") + ) + (if (= (logand s5-0 (process-mask sleep-code)) (process-mask sleep-code)) + (format #t "sleep-code ") + ) + (if (= (logand s5-0 (process-mask actor-pause)) (process-mask actor-pause)) + (format #t "actor-pause ") + ) + (if (= (logand (process-mask bot) s5-0) (process-mask bot)) + (format #t "bot ") + ) + (if (= (logand (process-mask vehicle) s5-0) (process-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand (process-mask enemy) s5-0) (process-mask enemy)) + (format #t "enemy ") + ) + (if (= (logand (process-mask entity) s5-0) (process-mask entity)) + (format #t "entity ") + ) + (if (= (logand s5-0 (process-mask heap-shrunk)) (process-mask heap-shrunk)) + (format #t "heap-shrunk ") + ) + (if (= (logand (process-mask sidekick) s5-0) (process-mask sidekick)) + (format #t "sidekick ") + ) + (if (= (logand s5-0 (process-mask going)) (process-mask going)) + (format #t "going ") + ) + (if (= (logand s5-0 (process-mask execute)) (process-mask execute)) + (format #t "execute ") + ) + (if (= (logand (process-mask civilian) s5-0) (shl #x8000 16)) + (format #t "civilian ") + ) + (if (= (logand (process-mask death) s5-0) (process-mask death)) + (format #t "death ") + ) + (if (= (logand (process-mask guard) s5-0) (process-mask guard)) + (format #t "guard ") + ) + (if (= (logand s5-0 (process-mask no-kill)) (process-mask no-kill)) + (format #t "no-kill ") + ) + (if (= (logand (process-mask platform) s5-0) (process-mask platform)) + (format #t "platform ") + ) + (if (= (logand s5-0 (process-mask freeze)) (process-mask freeze)) + (format #t "freeze ") + ) + (if (= (logand s5-0 (process-mask sleep)) (process-mask sleep)) + (format #t "sleep ") + ) + (if (= (logand s5-0 (process-mask progress)) (process-mask progress)) + (format #t "progress ") + ) + (if (= (logand s5-0 (process-mask menu)) (process-mask menu)) + (format #t "menu ") + ) + (if (= (logand (process-mask camera) s5-0) (process-mask camera)) + (format #t "camera ") + ) + (if (= (logand (process-mask ambient) s5-0) (process-mask ambient)) + (format #t "ambient ") + ) + (if (= (logand s5-0 (process-mask dark-effect)) (process-mask dark-effect)) + (format #t "dark-effect ") + ) + (if (= (logand (process-mask crate) s5-0) (process-mask crate)) + (format #t "crate ") + ) + (if (= (logand s5-0 (process-mask kernel-run)) (process-mask kernel-run)) + (format #t "kernel-run ") + ) + (if (= (logand s5-0 (process-mask movie)) (process-mask movie)) + (format #t "movie ") + ) + (if (= (logand s5-0 (process-mask pause)) (process-mask pause)) + (format #t "pause ") + ) + ) + (format #t ")~%") + (format #t "~1Tclock: ~A~%" (-> obj clock)) + (format #t "~1Tparent: #x~X~%" (-> obj parent)) + (format #t "~1Tbrother: #x~X~%" (-> obj brother)) + (format #t "~1Tchild: #x~X~%" (-> obj child)) + (format #t "~1Tppointer: #x~X~%" (-> obj ppointer)) + (format #t "~1Tself: ~A~%" (-> obj self)) + (format #t "~1Tpool: ~A~%" (-> obj pool)) + (format #t "~1Tstatus: ~A~%" (-> obj status)) + (format #t "~1Tpid: ~D~%" (-> obj pid)) + (format #t "~1Tmain-thread: ~A~%" (-> obj main-thread)) + (format #t "~1Ttop-thread: ~A~%" (-> obj top-thread)) + (format #t "~1Tentity: ~A~%" (-> obj entity)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Tstate: ~A~%" (-> obj state)) + (format #t "~1Tnext-state: ~A~%" (-> obj next-state)) + (format #t "~1Ttrans-hook: ~A~%" (-> obj trans-hook)) + (format #t "~1Tpost-hook: ~A~%" (-> obj post-hook)) + (format #t "~1Tevent-hook: ~A~%" (-> obj event-hook)) + (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~1Theap-base: #x~X~%" (-> obj heap-base)) + (format #t "~1Theap-top: #x~X~%" (-> obj heap-top)) + (format #t "~1Theap-cur: #x~X~%" (-> obj heap-cur)) + (format #t "~1Tstack-frame-top: ~A~%" (-> obj stack-frame-top)) + (format #t "~1Theap: #~%" (&-> obj heap-base)) + (format #t "~1Tconnection-list: ~`connectable`P~%" (-> obj connection-list)) + (format #t "~1Tstack[0] @ #x~X~%" (-> obj stack)) + (label cfg-68) + obj + ) + +;; definition for method 2 of type scene +(defmethod print scene ((obj scene)) + (format #t "#" (-> obj art-group) (-> obj anim) obj) + obj + ) + +;; definition for method 15 of type scene +;; WARN: Return type mismatch spool-anim vs none. +(defmethod scene-method-15 scene ((obj scene) (arg0 spool-anim)) + (set! (-> arg0 name) (-> obj anim)) + (set! (-> arg0 anim-name) (-> obj anim)) + (set! (-> arg0 parts) (the-as int (-> obj parts))) + (set! (-> arg0 command-list) (the-as pair (-> obj command-list))) + (none) + ) + +;; definition for function scene-decode-continue +;; WARN: Return type mismatch basic vs continue-point. +(defun scene-decode-continue ((arg0 basic)) + (the-as continue-point (cond + ((not arg0) + (the-as basic #f) + ) + ((= (-> arg0 type) continue-point) + arg0 + ) + ((= (-> arg0 type) string) + (get-continue-by-name *game-info* (the-as string arg0)) + ) + (else + (the-as basic #f) + ) + ) + ) + ) + +;; definition for method 9 of type scene-actor +;; INFO: Used lq/sq +(defmethod scene-actor-method-9 scene-actor ((obj scene-actor) (arg0 scene-player)) + (local-vars (s4-0 (pointer process)) (sv-96 process) (sv-112 process)) + (let ((s1-0 (if (-> obj level) + (level-get *level* (the-as symbol (-> obj level))) + (-> *level* default-level) + ) + ) + ) + (cond + ((not s1-0) + (-> *level* default-level) + (set! s4-0 (the-as (pointer process) #f)) + (goto cfg-211) + ) + ((= (-> s1-0 status) 'reserved) + ) + ((!= (-> s1-0 status) 'active) + (set! s4-0 (the-as (pointer process) #f)) + (goto cfg-211) + ) + ) + (let* ((s4-1 (art-group-get-by-name *level* (-> obj art-group) (the-as (pointer uint32) #f))) + (s2-0 (if (type? s4-1 skeleton-group) + (the-as skeleton-group s4-1) + ) + ) + (s0-0 (-> arg0 level)) + (s3-0 + (or (string= (-> obj name) "jak-highres") + (string= (-> obj name) "jak-highres-prison") + (string= (-> obj name) "darkjak-highres") + ) + ) + ) + (set! (-> arg0 level) #f) + (set! s4-0 + (when s2-0 + (let ((s1-1 (if (and (nonzero? (-> s1-0 entity)) (> (-> s1-0 entity length) 0)) + (-> s1-0 entity data 0 entity) + (-> arg0 entity) + ) + ) + ) + (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) + (set! s4-0 + (when sv-96 + (let ((t9-7 (method-of-type manipy activate))) + (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) + ) + (let ((t9-8 run-function-in-process) + (a0-11 sv-96) + (a1-9 manipy-init) + (a2-3 (-> arg0 root trans)) + (a3-1 s1-1) + (t0-0 s2-0) + (t1-0 #f) + ) + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ((the-as (function object object object object object object none) t9-8) a0-11 a1-9 a2-3 a3-1 t0-0 t1-0) + ) + (-> sv-96 ppointer) + ) + ) + (set! (-> arg0 level) s0-0) + (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) + (send-event (ppointer->process s4-0) 'blend-shape #t) + (send-event (ppointer->process s4-0) 'prefix (-> obj prefix)) + (cond + ((zero? (-> obj light-index)) + (if (zero? (-> s2-0 light-index)) + (send-event (ppointer->process s4-0) 'light-index 80) + ) + ) + (else + (send-event (ppointer->process s4-0) 'light-index (* (-> obj light-index) 8)) + ) + ) + (if (nonzero? (-> obj shadow-mask)) + (send-event (ppointer->process s4-0) 'shadow-mask (* (-> obj shadow-mask) 8)) + ) + (if (nonzero? (-> obj shadow-values)) + (send-event (ppointer->process s4-0) 'shadow-values (* (-> obj shadow-values) 8)) + ) + (if (and s4-0 (not (logtest? (-> obj flags) 1)) (nonzero? (-> (the-as process-drawable (-> s4-0 0)) draw))) + (logior! (-> (the-as process-drawable (-> s4-0 0)) draw status) (draw-control-status no-draw-bounds)) + ) + (if (-> obj shadow-volume-joint) + (send-event (ppointer->process s4-0) 'shadow-volume (-> obj shadow-volume-joint) (-> obj shadow-flags)) + ) + (if (or (nonzero? (-> obj draw-seg)) (nonzero? (-> obj no-draw-seg))) + (send-event (ppointer->process s4-0) 'segment (* (-> obj draw-seg) 8) (* (-> obj no-draw-seg) 8)) + ) + (when s3-0 + (if (not (-> *setting-control* user-current beard)) + (send-event (ppointer->process s4-0) 'segment 0 16) + ) + (when (and s4-0 (nonzero? (-> (the-as scene-player (-> s4-0 0)) old-target-pos scale x))) + (cond + ((logtest? (game-secrets little-head) (-> *game-info* secrets)) + (mode-set! (-> (the-as manipy (-> s4-0 0)) joint 0) (joint-mod-mode joint-set*)) + (trs-set! + (-> (the-as manipy (-> s4-0 0)) joint 0) + (the-as vector #f) + (the-as quaternion #f) + (new 'static 'vector :x 0.4 :y 0.4 :z 0.4 :w 1.0) + ) + ) + ((logtest? (game-secrets big-head) (-> *game-info* secrets)) + (mode-set! (-> (the-as manipy (-> s4-0 0)) joint 0) (joint-mod-mode joint-set*)) + (trs-set! + (-> (the-as manipy (-> s4-0 0)) joint 0) + (the-as vector #f) + (the-as quaternion #f) + (new 'static 'vector :x 2.0 :y 2.0 :z 2.0 :w 1.0) + ) + ) + ) + ) + ) + (when (and s4-0 (logtest? (-> obj flags) 2)) + (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) + (let ((s0-1 + (when sv-112 + (let ((t9-24 (method-of-type manipy activate))) + (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) + ) + (let ((t9-25 run-function-in-process) + (a0-51 sv-112) + (a1-26 manipy-init) + (a2-8 (-> arg0 root trans)) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) t9-25) a0-51 a1-26 a2-8 s1-1 s2-0 t1-1) + ) + (-> sv-112 ppointer) + ) + ) + ) + (send-event (ppointer->process s0-1) 'mirror #t) + (send-event (ppointer->process s0-1) 'anim-mode 'mirror) + (if (nonzero? (-> obj light-index)) + (send-event (ppointer->process s0-1) 'light-index (* (-> obj light-index) 8)) + ) + (if (nonzero? (-> obj shadow-mask)) + (send-event (ppointer->process s0-1) 'shadow-mask (* (-> obj shadow-mask) 8)) + ) + (if (nonzero? (-> obj shadow-values)) + (send-event (ppointer->process s0-1) 'shadow-values (* (-> obj shadow-values) 8)) + ) + (if (and s0-1 (not (logtest? (-> obj flags) 1)) (nonzero? (-> (the-as process-drawable (-> s0-1 0)) draw))) + (logior! (-> (the-as process-drawable (-> s0-1 0)) draw status) (draw-control-status no-draw-bounds)) + ) + (if (-> obj shadow-volume-joint) + (send-event (ppointer->process s0-1) 'shadow-volume (-> obj shadow-volume-joint) (-> obj shadow-flags)) + ) + (if (or (nonzero? (-> obj draw-seg)) (nonzero? (-> obj no-draw-seg))) + (send-event (ppointer->process s0-1) 'segment (* (-> obj draw-seg) 8) (* (-> obj no-draw-seg) 8)) + ) + (when s3-0 + (if (not (-> *setting-control* user-current beard)) + (send-event (ppointer->process s0-1) 'segment 0 16) + ) + ) + ) + ) + ) + (when (nonzero? (-> obj camera)) + (cond + ((handle->process (-> arg0 camera)) + (change-parent (handle->process (-> arg0 camera)) (ppointer->process s4-0)) + (send-event (handle->process (-> arg0 camera)) 'target (ppointer->process s4-0)) + (send-event (handle->process (-> arg0 camera)) 'joint (* (-> obj camera) 8)) + ) + (else + (set! (-> arg0 camera) (ppointer->handle (process-spawn + othercam + (ppointer->process s4-0) + (-> obj camera) + #t + 'scene-player + :to (ppointer->process s4-0) + ) + ) + ) + ) + ) + ) + s4-0 + ) + ) + ) + ) + (label cfg-211) + s4-0 + ) + +;; definition for method 10 of type scene-player +(defmethod deactivate scene-player ((obj scene-player)) + (set! *scene-player* #f) + (kill-persister *setting-control* (the-as engine-pers 'blackout) 'bg-a-force) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for method 7 of type scene-player +;; WARN: Return type mismatch process-drawable vs scene-player. +(defmethod relocate scene-player ((obj scene-player) (arg0 int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) obj) + (set! (-> v1-0 relocating-min) (the-as int (&-> obj type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj))) + ) + (set! (-> v1-0 relocating-offset) arg0) + ) + (let ((v1-2 (-> obj scene-list))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj scene-list) arg0) + ) + ) + (the-as scene-player ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 25 of type scene-player +;; WARN: Return type mismatch int vs none. +(defmethod scene-player-method-25 scene-player ((obj scene-player) (arg0 float)) + (local-vars (v1-11 symbol) (v1-40 symbol) (s0-0 object) (s0-1 object)) + (dotimes (s4-0 (-> obj scene actor length)) + (let ((s3-0 (-> obj scene actor s4-0))) + (let* ((s2-0 (-> s3-0 draw-frames)) + (s1-0 (car s2-0)) + ) + (while (not (null? s2-0)) + (when (and (pair? s1-0) + (let ((a0-4 (car s1-0))) + (set! s0-0 (car (cdr s1-0))) + (or (= a0-4 'min) (>= arg0 (command-get-float a0-4 0.0))) + ) + (or (= s0-0 'max) (< arg0 (command-get-float (car (cdr s1-0)) 0.0))) + ) + (set! v1-11 #t) + (goto cfg-20) + ) + (set! s2-0 (cdr s2-0)) + (set! s1-0 (car s2-0)) + ) + ) + (set! v1-11 #f) + (label cfg-20) + (cond + (v1-11 + (if (not (handle->process (-> s3-0 process))) + (set! (-> s3-0 process) (ppointer->handle (scene-actor-method-9 s3-0 obj))) + ) + (let ((s2-1 (handle->process (-> s3-0 process)))) + (when (and s2-1 (nonzero? (-> (the-as process-drawable s2-1) draw))) + (let* ((s3-1 (-> s3-0 scissor-frames)) + (s1-1 (car s3-1)) + ) + (while (not (null? s3-1)) + (when (and (pair? s1-1) + (let ((a0-20 (car s1-1))) + (set! s0-1 (car (cdr s1-1))) + (or (= a0-20 'min) (>= arg0 (command-get-float a0-20 0.0))) + ) + (or (= s0-1 'max) (< arg0 (command-get-float (car (cdr s1-1)) 0.0))) + ) + (set! v1-40 #t) + (goto cfg-59) + ) + (set! s3-1 (cdr s3-1)) + (set! s1-1 (car s3-1)) + ) + ) + (set! v1-40 #f) + (label cfg-59) + (if v1-40 + (logclear! (-> (the-as process-drawable s2-1) draw status) (draw-control-status force-vu1)) + (logior! (-> (the-as process-drawable s2-1) draw status) (draw-control-status force-vu1)) + ) + ) + ) + ) + ((handle->process (-> s3-0 process)) + (deactivate (handle->process (-> s3-0 process))) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function scene-lookup +;; WARN: Return type mismatch basic vs scene. +(defun scene-lookup ((arg0 basic)) + "TODO - basic can be a string or a scene" + (let ((v1-0 (-> arg0 type))) + (the-as + scene + (cond + ((= v1-0 string) + (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) + (when (type? s5-0 scene) + (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) + (when (and s5-0 gp-0) + (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) + (when v1-5 + (dotimes (a0-6 6) + (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) + (goto cfg-15) + ) + ) + (format + 0 + "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" + (-> gp-0 name) + (-> v1-5 name) + ) + (return (the-as scene #f)) + ) + ) + ) + ) + (label cfg-15) + s5-0 + ) + ) + ) + ((= v1-0 scene) + arg0 + ) + ) + ) + ) + ) + +;; definition for method 24 of type scene-player +;; WARN: Return type mismatch basic vs scene. +(defmethod scene-player-method-24 scene-player ((obj scene-player) (arg0 basic) (arg1 symbol)) + "TODO - arg1 can be string/scene" + (when (= (-> arg0 type) string) + (let ((v1-2 (scene-lookup arg0))) + (if v1-2 + (set! arg0 v1-2) + ) + ) + ) + (when (or (not arg0) (!= (-> arg0 type) scene)) + (format 0 "ERROR: SCENE: scene-player can not find scene ~A~%" arg0) + (go process-drawable-art-error "scene-list format") + ) + (when arg1 + (let ((s4-1 (get-level-by-heap-ptr-and-status *level* (the-as pointer arg0) 'active))) + (scene-method-15 (the-as scene arg0) (-> obj anim)) + (set! (-> obj level) s4-1) + ) + (set! (-> obj scene) (the-as scene arg0)) + ) + (the-as scene arg0) + ) + +;; definition for method 23 of type scene-player +;; WARN: Return type mismatch int vs none. +(defmethod scene-player-method-23 scene-player ((obj scene-player) (arg0 string) (arg1 symbol)) + (let ((gp-0 (scene-player-method-24 obj arg0 #t))) + (when (-> gp-0 peaceful) + (let ((s3-0 *traffic-manager*)) + (send-event s3-0 'decrease-alert-level 0) + (send-event s3-0 'restore-default-settings) + ) + ) + (send-event *target* 'draw (-> gp-0 draw-target)) + (let ((s3-1 (entity-by-name (-> gp-0 entity)))) + (when (and (-> gp-0 entity) (not s3-1)) + (format 0 "ERROR: SCENE: scene ~A can not find entity ~A~%" (-> gp-0 name) (-> gp-0 entity)) + (go process-drawable-art-error (-> gp-0 entity)) + ) + (set! (-> obj main-entity) (the-as entity-actor s3-1)) + (cond + (s3-1 + (process-drawable-from-entity! obj (-> obj main-entity)) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (else + (vector-reset! (-> obj root trans)) + (quaternion-identity! (-> obj root quat)) + ) + ) + ) + (let ((s3-2 (load-to-heap-by-name (-> *level* default-level art-group) (-> gp-0 art-group) #f global 0))) + (when (not s3-2) + (format 0 "ERROR: SCENE: scene ~A can not find art-group ~A~%" (-> gp-0 name) (-> gp-0 art-group)) + (go process-drawable-art-error (-> gp-0 art-group)) + ) + (set! (-> obj draw art-group) s3-2) + (countdown (v1-33 (-> s3-2 length)) + (when (-> s3-2 data v1-33) + (cond + ((= (-> s3-2 data v1-33 type) merc-ctrl) + (set! (-> obj draw mgeo) (the-as merc-ctrl (-> s3-2 data v1-33))) + ) + ((= (-> s3-2 data v1-33 type) art-joint-geo) + (set! (-> obj draw jgeo) (the-as art-joint-geo (-> s3-2 data v1-33))) + ) + ) + ) + ) + ) + (cond + ((< (+ (-> obj scene-index) 1) (-> obj scene-list length)) + (let ((a0-34 (scene-player-method-24 obj (-> obj scene-list (+ (-> obj scene-index) 1)) #f))) + (cond + (a0-34 + (scene-method-15 a0-34 (-> obj next-anim)) + ) + (else + (set! (-> obj next-anim anim-name) (the-as basic 0)) + 0 + ) + ) + ) + ) + (else + (set! (-> obj next-anim anim-name) (the-as basic 0)) + 0 + ) + ) + (dotimes (s3-3 (-> gp-0 actor length)) + (let ((s2-0 (-> gp-0 actor s3-3))) + (set! (-> s2-0 process) (the-as handle #f)) + (let ((s1-0 (if (-> s2-0 level) + (level-get *level* (the-as symbol (-> s2-0 level))) + (-> *level* default-level) + ) + ) + (v1-55 (when level + (let ((s0-0 (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)))) + (if (type? s0-0 skeleton-group) + s0-0 + ) + ) + ) + ) + ) + (cond + ((or (not s1-0) (not (or (= (-> s1-0 status) 'active) (= (-> s1-0 status) 'reserved)))) + (format + 0 + "ERROR: SCENE: scene actor ~A can not find an active level ~A~%" + (-> s2-0 art-group) + (-> s2-0 level) + ) + ) + ((not v1-55) + (format + 0 + "ERROR: SCENE: scene actor ~A can not find skeleton-group ~A~%" + (-> s2-0 art-group) + (-> s2-0 art-group) + ) + ) + (else + (load-to-heap-by-name (-> s1-0 art-group) (the-as string (-> v1-55 data 0)) #f global 0) + ) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (when arg1 + (set-setting! 'region-mode #f 0 0) + (set-setting! 'process-mask 'set 0 (-> gp-0 mask-to-clear)) + (set-setting! 'sound-bank-load #f 0 0) + (set-setting! 'movie (process->ppointer obj) 0 0) + (set-setting! 'movie-name (-> gp-0 name) 0 0) + (set-setting! + 'music-volume + 'rel + (if (>= (-> gp-0 music-volume) 0.0) + (-> gp-0 music-volume) + (-> *setting-control* user-current music-volume-movie) + ) + 0 + ) + (set-setting! + 'sfx-volume + 'rel + (if (>= (-> gp-0 sfx-volume) 0.0) + (-> gp-0 sfx-volume) + (-> *setting-control* user-current sfx-movie-volume) + ) + 0 + ) + (set-setting! + 'ambient-volume + 'rel + (if (>= (-> gp-0 ambient-volume) 0.0) + (-> gp-0 ambient-volume) + (-> *setting-control* user-current ambient-volume-move) + ) + 0 + ) + (if (nonzero? (the int (-> gp-0 music-delay))) + (set-setting! 'sound-mode #f 0 2) + ) + (set-setting! 'gem #f 0 0) + (apply-settings *setting-control*) + ) + ) + 0 + (none) + ) + +;; definition of type subtitle-work +(deftype subtitle-work (structure) + ((draw-tmpl dma-gif-packet :inline :offset-assert 0) + (color0 vector4w :inline :offset-assert 32) + (color1 vector4w :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + +;; definition for method 3 of type subtitle-work +(defmethod inspect subtitle-work ((obj subtitle-work)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'subtitle-work) + (format #t "~1Tdraw-tmpl: #~%" (-> obj draw-tmpl)) + (format #t "~1Tcolor0: #~%" (-> obj color0)) + (format #t "~1Tcolor1: #~%" (-> obj color1)) + (label cfg-4) + obj + ) + +;; definition for symbol *subtitle-work*, type subtitle-work +(define *subtitle-work* + (new 'static 'subtitle-work + :draw-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif0 (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :abe #x1 :fst #x1) + :nreg #x5 + ) + :gif1 (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id uv) + :regs2 (gif-reg-id xyz2) + :regs3 (gif-reg-id uv) + :regs4 (gif-reg-id xyz2) + ) + ) + :color0 (new 'static 'vector4w :w #x80) + :color1 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + ) + +;; definition for function draw-subtitle-image +;; INFO: Used lq/sq +(defun draw-subtitle-image ((arg0 subtitle-image) (arg1 font-context)) + (local-vars (sv-16 pointer) (sv-32 int)) + (let ((gp-0 (-> arg0 width)) + (s5-0 (-> arg0 height)) + ) + (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))) + (set! sv-16 (-> s4-0 base)) + (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) + (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) + ) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s4-1 (-> s3-0 base)) + ) + (upload-vram-data s3-0 0 (-> arg0 palette) 2 8) + (let ((s0-0 20)) + (let* ((v1-13 s3-0) + (a0-7 (the-as object (-> v1-13 base))) + ) + (set! (-> (the-as dma-packet a0-7) dma) (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-7) vif1) (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> v1-13 base) (the-as pointer (the-as gs-gif-tag (&+ (the-as pointer a0-7) 16)))) + ) + (let* ((v1-14 s3-0) + (a0-9 (the-as gs-gif-tag (-> v1-14 base))) + ) + (set! (-> a0-9 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x4)) + (set! (-> a0-9 regs) GIF_REGS_ALL_AD) + (set! (-> v1-14 base) (the-as pointer (&+ a0-9 16))) + ) + (let* ((v1-15 s3-0) + (a0-11 (-> v1-15 base)) + ) + (set! (-> (the-as (pointer gs-bitbltbuf) a0-11) 0) + (new 'static 'gs-bitbltbuf :dbp #x1 :dbw (shr gp-0 6) :dpsm s0-0) + ) + (set! (-> (the-as (pointer gs-reg64) a0-11) 1) (gs-reg64 bitbltbuf)) + (set! (-> (the-as (pointer gs-trxpos) a0-11) 2) (new 'static 'gs-trxpos)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 3) (gs-reg64 trxpos)) + (set! (-> (the-as (pointer gs-trxreg) a0-11) 4) (new 'static 'gs-trxreg :rrw gp-0 :rrh s5-0)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 5) (gs-reg64 trxreg)) + (set! (-> (the-as (pointer gs-trxdir) a0-11) 6) (new 'static 'gs-trxdir)) + (set! (-> (the-as (pointer gs-reg64) a0-11) 7) (gs-reg64 trxdir)) + (set! (-> v1-15 base) (&+ a0-11 64)) + ) + (let ((t9-2 dma-buffer-add-ref-texture) + (a0-13 s3-0) + (a2-8 gp-0) + (a3-1 s5-0) + (t0-1 s0-0) + ) + (t9-2 a0-13 sv-16 (the-as int a2-8) (the-as int a3-1) (the-as gs-psm t0-1)) + ) + (set! sv-32 (+ (log2 (the-as int (+ gp-0 -1))) 1)) + (let ((v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1))) + (let* ((a0-16 s3-0) + (a1-23 (the-as object (-> a0-16 base))) + ) + (set! (-> (the-as dma-packet a1-23) dma) (new 'static 'dma-tag :qwc #x7 :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a1-23) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a1-23) vif1) (new 'static 'vif-tag :imm #x7 :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a0-16 base) (the-as pointer (the-as gs-gif-tag (&+ (the-as pointer a1-23) 16)))) + ) + (let* ((a0-17 s3-0) + (a1-25 (the-as object (-> a0-17 base))) + ) + (set! (-> (the-as gs-gif-tag a1-25) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x6)) + (set! (-> (the-as gs-gif-tag a1-25) regs) GIF_REGS_ALL_AD) + (set! (-> a0-17 base) (&+ (the-as pointer a1-25) 16)) + ) + (let* ((a0-18 s3-0) + (a1-27 (-> a0-18 base)) + ) + (set! (-> (the-as (pointer gs-test) a1-27) 0) + (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 1) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-alpha) a1-27) 2) (new 'static 'gs-alpha :b #x1 :d #x1)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 3) (gs-reg64 alpha-1)) + (set! (-> (the-as (pointer gs-tex0) a1-27) 4) + (new 'static 'gs-tex0 :tbp0 #x1 :tcc #x1 :cld #x1 :psm s0-0 :th v1-17 :tw sv-32 :tbw (shr gp-0 6)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 5) (gs-reg64 tex0-1)) + (set! (-> (the-as (pointer gs-tex1) a1-27) 6) (new 'static 'gs-tex1)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 7) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer gs-clamp) a1-27) 8) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)) + ) + (set! (-> (the-as (pointer gs-reg64) a1-27) 9) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer uint64) a1-27) 10) (the-as uint 0)) + (set! (-> (the-as (pointer gs-reg64) a1-27) 11) (gs-reg64 texflush)) + (set! (-> a0-18 base) (&+ a1-27 96)) + ) + ) + ) + (let* ((v1-28 (-> s3-0 base)) + (a2-23 + (+ (- 1793 (the-as int (shr (-> arg0 width) 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width))))) + ) + (a3-8 (+ (the int (-> arg1 origin y)) 1841)) + (a0-23 (+ a2-23 (-> arg0 width))) + (a1-33 (+ a3-8 (-> arg0 height))) + ) + (set! (-> (the-as (pointer uint128) v1-28) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) v1-28) 1) (-> *subtitle-work* draw-tmpl quad 1)) + (set! (-> (the-as (pointer uint128) v1-28) 2) (-> *subtitle-work* color0 quad)) + (let ((t0-8 (the-as gs-gif-tag (&+ v1-28 48)))) + (set! (-> t0-8 word 0) (the-as uint 0)) + (set! (-> t0-8 word 1) (the-as uint 0)) + (set! (-> t0-8 word 2) (the-as uint 0)) + (set! (-> t0-8 word 3) (the-as uint 0)) + ) + (let ((t0-9 (the-as object (&+ v1-28 64)))) + (set! (-> (the-as gs-gif-tag t0-9) word 0) (* a2-23 16)) + (set! (-> (the-as gs-gif-tag t0-9) word 1) (the-as uint (* a3-8 16))) + (set! (-> (the-as gs-gif-tag t0-9) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag t0-9) word 3) (the-as uint 0)) + ) + (let ((a2-26 (the-as object (&+ v1-28 80)))) + (set! (-> (the-as gs-gif-tag a2-26) word 0) (* gp-0 16)) + (set! (-> (the-as gs-gif-tag a2-26) word 1) (* s5-0 16)) + (set! (-> (the-as gs-gif-tag a2-26) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag a2-26) word 3) (the-as uint 0)) + ) + (let ((v1-29 (the-as object (&+ v1-28 96)))) + (set! (-> (the-as gs-gif-tag v1-29) word 0) (* a0-23 16)) + (set! (-> (the-as gs-gif-tag v1-29) word 1) (the-as uint (* a1-33 16))) + (set! (-> (the-as gs-gif-tag v1-29) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag v1-29) word 3) (the-as uint 0)) + ) + ) + (&+! (-> s3-0 base) 112) + (let* ((v1-32 (-> s3-0 base)) + (a1-38 + (+ (- 1792 (the-as int (shr (-> arg0 width) 1))) (the int (+ (-> arg1 origin x) (* 0.5 (-> arg1 width))))) + ) + (a3-11 (+ (the int (-> arg1 origin y)) 1840)) + (a0-30 (+ a1-38 (-> arg0 width))) + (a2-28 (+ a3-11 (-> arg0 height))) + ) + (set! (-> (the-as (pointer uint128) v1-32) 0) (-> *subtitle-work* draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) v1-32) 1) (-> *subtitle-work* draw-tmpl quad 1)) + (set! (-> (the-as (pointer uint128) v1-32) 2) (-> *subtitle-work* color1 quad)) + (let ((t0-16 (the-as gs-gif-tag (&+ v1-32 48)))) + (set! (-> t0-16 word 0) (the-as uint 0)) + (set! (-> t0-16 word 1) (the-as uint 0)) + (set! (-> t0-16 word 2) (the-as uint 0)) + (set! (-> t0-16 word 3) (the-as uint 0)) + ) + (let ((t0-17 (the-as object (&+ v1-32 64)))) + (set! (-> (the-as gs-gif-tag t0-17) word 0) (* a1-38 16)) + (set! (-> (the-as gs-gif-tag t0-17) word 1) (the-as uint (* a3-11 16))) + (set! (-> (the-as gs-gif-tag t0-17) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag t0-17) word 3) (the-as uint 0)) + ) + (let ((a1-41 (the-as object (&+ v1-32 80)))) + (set! (-> (the-as gs-gif-tag a1-41) word 0) (* gp-0 16)) + (set! (-> (the-as gs-gif-tag a1-41) word 1) (* s5-0 16)) + (set! (-> (the-as gs-gif-tag a1-41) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag a1-41) word 3) (the-as uint 0)) + ) + (let ((v1-33 (the-as object (&+ v1-32 96)))) + (set! (-> (the-as gs-gif-tag v1-33) word 0) (* a0-30 16)) + (set! (-> (the-as gs-gif-tag v1-33) word 1) (the-as uint (* a2-28 16))) + (set! (-> (the-as gs-gif-tag v1-33) word 2) (the-as uint 0)) + (set! (-> (the-as gs-gif-tag v1-33) word 3) (the-as uint 0)) + ) + ) + (&+! (-> s3-0 base) 112) + (set-dirty-mask! (-> *level* default-level) 8 (the-as int (* gp-0 s5-0)) 256) + (let ((a3-15 (-> s3-0 base))) + (let ((v1-37 (the-as object (-> s3-0 base)))) + (set! (-> (the-as dma-packet v1-37) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-37) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-37) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (&+ (the-as pointer v1-37) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id bucket-322) + s4-1 + (the-as (pointer dma-tag) a3-15) + ) + ) + ) + ) + ) + +;; definition for function process-drawable-draw-subtitles +;; WARN: Return type mismatch int vs none. +(defbehavior process-drawable-draw-subtitles process-drawable () + (when (and (nonzero? (-> self skel)) + (> (-> self skel active-channels) 0) + (-> *setting-control* user-current subtitle) + ) + (let ((v1-9 (-> self skel root-channel 0 frame-group))) + (when v1-9 + (let ((gp-0 (res-lump-struct (-> v1-9 extra) 'subtitle-range (array subtitle-range)))) + (when gp-0 + (let ((f30-0 (ja-aframe-num 0)) + (s5-0 (the-as int (-> *setting-control* user-current subtitle-language))) + ) + (if (and (= (the-as language-enum s5-0) (language-enum english)) (= (scf-get-territory) 1)) + (set! s5-0 7) + ) + (dotimes (s4-0 (-> gp-0 length)) + (let ((v1-16 (-> gp-0 s4-0))) + (when (and (>= f30-0 (-> v1-16 start-frame)) (< f30-0 (-> v1-16 end-frame))) + (let ((s3-0 (-> v1-16 message s5-0))) + (when (and s3-0 (nonzero? s3-0)) + (let ((s2-0 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 290 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-20 s2-0)) + (set! (-> v1-20 width) (the float (the-as float #x1d1))) + ) + (let ((v1-21 s2-0)) + (set! (-> v1-21 height) (the float (the-as float #x46))) + ) + (let ((v1-22 s2-0)) + (set! (-> v1-22 scale) 0.5) + ) + (set! (-> s2-0 flags) (font-flags shadow kerning middle large)) + (case (-> s3-0 type) + ((string) + (when (= (-> *setting-control* user-default subtitle-language) (language-enum korean)) + (set! s3-0 (convert-korean-text (the-as string s3-0))) + (let ((v1-27 s2-0)) + (set! (-> v1-27 scale) 0.6) + ) + ) + (set! (-> s2-0 flags) (font-flags kerning middle left large)) + (set! (-> s2-0 origin x) (+ -1.0 (-> s2-0 origin x))) + (set! (-> s2-0 origin y) (+ -1.0 (-> s2-0 origin y))) + (set! (-> s2-0 color) (font-color #000000)) + (set! (-> s2-0 origin x) (+ 1.0 (-> s2-0 origin x))) + (set! (-> s2-0 origin y) (+ 1.0 (-> s2-0 origin y))) + (set! (-> s2-0 color) (font-color default-#cddbcd)) + (set! (-> s2-0 flags) (font-flags shadow kerning middle left large)) + (print-game-text (the-as string s3-0) s2-0 #f 44 322) + (gui-control-method-12 + *gui-control* + self + (gui-channel subtitle) + (gui-action play) + "scene" + 0 + 81920.0 + (new 'static 'sound-id) + ) + ) + ((subtitle-image) + (draw-subtitle-image (the-as subtitle-image s3-0) s2-0) + ) + (else + (if *debug-segment* + (format *stdcon* "unknown message ~A~%" s3-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate wait (scene-player) + :virtual #t + :enter (behavior ((arg0 symbol)) + (set! (-> self state-time) (-> self clock frame-counter)) + (when (or (-> self scene) (-> self preload-continue)) + (let ((gp-0 (scene-decode-continue (if (-> self scene) + (-> self scene load-point) + (-> self preload-continue) + ) + ) + ) + ) + (when gp-0 + (when (-> self scene) + (set-setting! 'borrow (-> self scene borrow) 0 0) + (apply-settings *setting-control*) + ) + (cond + ((and *target* + (zero? (-> self scene-index)) + (or (not (-> self scene)) (!= (level-status *level* (-> gp-0 vis-nick)) 'active)) + ) + (send-event *target* 'continue gp-0) + ) + (else + (let ((a0-9 (lookup-level-info (-> gp-0 vis-nick)))) + (set! (-> *load-state* vis-nick) (if a0-9 + (-> a0-9 name) + ) + ) + ) + (dotimes (v1-23 6) + (set! (-> *load-state* want v1-23 name) (-> gp-0 want v1-23 name)) + (set! (-> *load-state* want v1-23 display?) (-> gp-0 want v1-23 display?)) + (set! (-> *load-state* want v1-23 force-vis?) #f) + (set! (-> *load-state* want v1-23 force-inside?) #f) + ) + (update-task-masks 'event) + ) + ) + ) + ) + ) + (none) + ) + :trans (behavior () + (if (and (-> self scene) (nonzero? (-> self anim anim-name)) (not (load-in-progress? *level*))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + (set! (-> *ACTOR-bank* birth-max) 1000) + (none) + ) + :code (behavior ((arg0 symbol)) + (local-vars (v1-18 symbol) (v1-118 symbol)) + (when (and (-> self scene) (zero? (-> self scene wait-max-time))) + (while *progress-process* + (suspend) + ) + (set-setting! 'allow-progress #f 0 0) + (set-setting! 'bg-a-force 'abs #x3f800000 0) + (apply-settings *setting-control*) + ) + (if (or (not *target*) (or (logtest? (-> *target* focus-status) (focus-status grabbed)) + (begin + (dotimes (v1-17 6) + (when (= (-> *load-state* want v1-17 name) (-> *target* current-level name)) + (set! v1-18 #f) + (goto cfg-19) + ) + ) + #t + (set! v1-18 #t) + (label cfg-19) + (or v1-18 (not (-> self scene))) + ) + ) + ) + (set! arg0 #f) + ) + (while (and arg0 + (or (logtest? (-> *target* focus-status) (focus-status in-air)) + (and (-> *target* next-state) (= (-> *target* next-state name) 'target-flop-hit-ground)) + ) + (-> self scene) + (< (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-air-time)) + ) + (suspend) + ) + (suspend) + (let ((s5-0 (-> self clock frame-counter))) + (when (and *target* (zero? (logand (-> *target* focus-status) (focus-status grabbed)))) + (label cfg-44) + (let ((t9-3 process-grab?) + (a0-17 *target*) + ) + (when (not (t9-3 a0-17)) + (suspend) + (goto cfg-44) + ) + ) + ) + (process-entity-status! self (entity-perm-status no-kill) #t) + (until (not (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + ) + ) + (set-setting! 'allow-progress #f 0 0) + (apply-settings *setting-control*) + (dotimes (s4-0 2) + (while (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + (or (and (-> *setting-control* user-current movie) + (!= (-> *setting-control* user-current movie) (process->ppointer self)) + ) + *progress-process* + (!= (gui-control-method-17 *gui-control* (the-as sound-id (-> self gui-id))) 3) + ) + ) + (suspend) + ) + ) + (when arg0 + (while (and (-> self scene) + (not (or (>= (- (-> self clock frame-counter) s5-0) (-> self scene wait-ground-time)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-max-time)) + ) + ) + ) + (suspend) + ) + ) + (remove-setting! 'movie) + (remove-setting! 'sound-bank-load) + (remove-setting! 'movie-name) + (remove-setting! 'bg-a-force) + (apply-settings *setting-control*) + (set-blackout-frames (seconds 0.1)) + (suspend) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + ) + (send-event *target* 'trans 'save (-> self old-target-pos)) + (let ((gp-1 *load-state*)) + (when gp-1 + (dotimes (s5-1 2) + (while (begin + (dotimes (s4-1 6) + (when (not (or (not (-> gp-1 want s4-1 name)) + (not (-> gp-1 want s4-1 display?)) + (= (level-status *level* (-> gp-1 want s4-1 name)) 'active) + ) + ) + (set! v1-118 #t) + (goto cfg-109) + ) + ) + (set! v1-118 #f) + (label cfg-109) + v1-118 + ) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + (when (and (zero? s5-1) (< (-> self scene-index) (-> self scene-list length))) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + (when (-> self scene) + (set-setting! 'borrow (-> self scene borrow) 0 0) + (apply-settings *setting-control*) + ) + ) + ) + ) + ) + (if (and *target* (logtest? (focus-status in-head flut board pilot mech dark) (-> *target* focus-status))) + (send-event *target* 'change-mode 'normal) + ) + (when (< (-> self scene-index) (-> self scene-list length)) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + (while (and (-> self scene) + (nonzero? (-> self anim anim-name)) + (let ((v1-161 (file-status *art-control* (-> self anim name) 0))) + (or (not (or (= v1-161 'active) (= v1-161 'locked))) + (let* ((a1-26 (gui-control-method-14 + *gui-control* + (the-as string (-> self anim anim-name)) + (gui-channel none) + (gui-action none) + ) + ) + (v1-167 (gui-control-method-17 *gui-control* (the-as sound-id a1-26))) + ) + (not (or (= v1-167 (gui-action play)) (= v1-167 (gui-action playing)))) + ) + ) + ) + ) + (set-blackout-frames (seconds 0.1)) + (suspend) + ) + ) + (go-virtual play-anim) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate release (scene-player) + :virtual #t + :code (behavior () + (when (= (-> *game-info* demo-state) 100) + (logclear! (-> self mask) (process-mask pause progress)) + (set-blackout-frames (seconds 0.05)) + (set-setting! 'music-volume 'abs 0 0) + (set-setting! 'sfx-volume 'abs 0 0) + (set-setting! 'ambient-volume 'abs 0 0) + (set-setting! 'allow-pause #f 0 0) + (set-setting! 'allow-progress #f 0 0) + (setup + *screen-filter* + (new 'static 'vector) + (new 'static 'vector :w 128.0) + (* 30.0 (-> self clock seconds-per-frame)) + (bucket-id screen-filter) + ) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (suspend) + ) + ) + (set! (-> *setting-control* user-current bg-a) 0.0) + (remove-setting! 'movie) + (remove-setting! 'movie-name) + (while (or (-> *setting-control* user-current movie) + (not *target*) + (!= (-> *setting-control* user-current bg-a) 0.0) + ) + (suspend) + ) + (set! (-> *game-info* blackout-time) 0) + (set! (-> *game-info* demo-state) (the-as uint 1)) + (set! (-> *setting-control* user-current bg-a-force) 0.0) + (set-setting! 'allow-progress #t 0 0) + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + (send-event *target* 'draw #t) + (send-event *target* 'trans 'reset) + (send-event *target* 'change-mode 'normal) + (activate-progress *dproc* 'select-scene-special) + (dotimes (gp-1 5) + (suspend) + ) + (disable *screen-filter*) + (deactivate self) + ) + (when (< (-> self scene-index) (+ (-> self scene-list length) -1)) + (set! (-> self scene-index) (+ (-> self scene-list length) -1)) + (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t) + ) + (let ((gp-2 (or (not (-> self scene)) (-> self scene blackout-end)))) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + (send-event *target* 'draw #t) + (send-event *target* 'trans 'reset) + (suspend) + (while (not (process-release? *target*)) + (suspend) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + ) + (if gp-2 + (set-blackout-frames (seconds 0.1)) + ) + ) + (if (nonzero? (the int (-> self scene music-delay))) + (persist-with-delay + *setting-control* + 'music-delay + (the-as time-frame (the int (-> self scene music-delay))) + 'sound-mode + #f + 0.0 + 2 + ) + ) + (cond + ((and *target* (-> self scene) (-> self scene end-point)) + (let ((gp-3 (scene-decode-continue (-> self scene end-point)))) + (when gp-3 + (set-continue! *game-info* gp-3 #f) + (send-event *target* 'continue gp-3) + ) + ) + ) + (else + (send-event *target* 'trans 'restore (-> self old-target-pos)) + ) + ) + (if (and (-> self scene) (-> self scene save)) + (auto-save-user) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate play-anim (scene-player) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('abort) + (set! (-> self aborted?) #t) + (set-blackout-frames (seconds 0.2)) + (let ((a0-3 (-> self anim))) + (when (and a0-3 (= (-> *setting-control* user-current spooling) (process->ppointer self))) + (ja-abort-spooled-anim a0-3 (the-as art-joint-anim #f) -1) + (ja-channel-set! 0) + ) + ) + (go-virtual release) + ) + ) + ) + :exit (behavior () + (while (-> self child) + (deactivate (-> self child 0)) + ) + (kill-current-talker (the-as symbol '()) '(daxter voicebox message) 'exit) + (set! (-> *setting-control* user-current bg-a) 0.0) + (kill-persister *setting-control* (the-as engine-pers 'bg-a) 'bg-a) + (kill-persister *setting-control* (the-as engine-pers 'bg-a-speed) 'bg-a-speed) + (remove-setting! 'borrow) + (remove-setting! 'gem) + (apply-settings *setting-control*) + (none) + ) + :trans (behavior () + (cond + ((not (-> *setting-control* user-current spooling)) + (if (and (-> self scene) (nonzero? (-> self anim anim-name))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + ) + (else + (if (and (-> self scene) (nonzero? (-> self next-anim anim-name))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> self next-anim name) + 0 + -1.0 + (new 'static 'sound-id) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (local-vars (a0-24 symbol)) + (if (and (= (-> *game-info* demo-state) 100) (-> self scene) (nonzero? (-> self scene scene-task))) + (task-node-open! (the-as game-task-node (-> self scene scene-task))) + ) + (dotimes (gp-0 2) + (let ((v1-11 (-> *art-control* buffer gp-0))) + (if (= (-> v1-11 status) 'active) + (link-art! (-> v1-11 art-group)) + ) + ) + ) + (while (and (< (-> self scene-index) (-> self scene-list length)) (not (-> self aborted?))) + (scene-player-method-23 self (the-as string (-> self scene-list (-> self scene-index))) #t) + (set-blackout-frames (seconds 0.1)) + (suspend) + (set-blackout-frames (seconds 0.1)) + (suspend) + (scene-player-method-25 self 0.0) + (set! (-> self cur-speed) 0.0) + (set! (-> self scene-start-time) (-> self clock frame-counter)) + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (the-as + (function process-drawable symbol) + (if (-> self scene abort) + (lambda :behavior scene-player () (when (cpad-pressed? 0 triangle) + (set! (-> self aborted?) #t) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + #t + ) + ) + false-func + ) + ) + ) + (while (-> self child) + (deactivate (-> self child 0)) + ) + (+! (-> self scene-index) 1) + (when (and (< (-> self scene-index) (-> self scene-list length)) (not (-> self aborted?))) + (let ((v1-41 (scene-player-method-24 self (-> self scene-list (-> self scene-index)) #t))) + (when v1-41 + (let ((a0-21 (scene-decode-continue (-> v1-41 load-point)))) + (set! a0-24 (when (and a0-21 (logtest? (-> a0-21 flags) (continue-flags cf1))) + (go-virtual wait a0-24) + a0-24 + ) + ) + ) + ) + ) + ) + ) + (if (and (-> self wait) *target* (logtest? (-> *target* focus-status) (focus-status grabbed))) + (go-virtual release) + ) + (none) + ) + :post (behavior () + (when (-> self scene) + (let ((gp-0 (-> self scene cut-list)) + (s5-0 (-> self skel root-channel 0 frame-group)) + ) + (when (not (or (null? gp-0) (not s5-0) (zero? s5-0))) + (let ((v1-8 (the int (ja-frame-num 0))) + (a0-2 (car gp-0)) + ) + (while (not (null? gp-0)) + (let ((f0-5 (/ (- (the float (/ (the-as int a0-2) 8)) (-> s5-0 artist-base)) (-> s5-0 artist-step)))) + (when (= v1-8 (if (= f0-5 (the float (the int f0-5))) + (+ (the int f0-5) -1) + (the int f0-5) + ) + ) + (set! (-> self skel root-channel 0 frame-num) (the float (the int (-> self skel root-channel 0 frame-num)))) + (set! (-> self pre-cut-frame) (the-as basic #t)) + ) + ) + (set! gp-0 (cdr gp-0)) + (set! a0-2 (car gp-0)) + ) + ) + ) + ) + (if (-> self pre-cut-frame) + (set! (-> self pre-cut-frame) #f) + ) + ) + (when (and (-> self scene) (nonzero? (-> self skel active-channels))) + (if (and (< (ja-aframe-num 0) 2.0) (logtest? (-> self skel status) (joint-control-status valid-spooled-frame))) + (set-blackout-frames 0) + ) + (scene-player-method-25 self (ja-aframe-num 0)) + (set! (-> self dma-max) + (the-as uint (max + (the-as int (-> self dma-max)) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) global-buf)) 16) + ) + ) + ) + (let ((gp-4 *display-scene-control*)) + (when (nonzero? gp-4) + (if (logtest? gp-4 (scene-controls bounds-spheres)) + (debug-print-channels (-> self skel) (the-as symbol *stdcon*)) + ) + (if (logtest? gp-4 (scene-controls actors)) + (format *stdcon* "anim ~-30S " (-> self scene anim)) + ) + (if (logtest? gp-4 (scene-controls actor-marks)) + (format + *stdcon* + "dma ~DK / ~DK" + (shr (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) global-buf)) 16) 10) + (shr (-> self dma-max) 10) + ) + ) + (if (logtest? gp-4 (scene-controls actors actor-marks)) + (format *stdcon* "~%") + ) + (when (logtest? gp-4 (scene-controls special-fma-spheres)) + (dotimes (s5-3 (-> self scene actor length)) + (let* ((s4-1 (handle->process (-> self scene actor s5-3 process))) + (v1-63 (if (type? s4-1 process-drawable) + (the-as process-drawable s4-1) + ) + ) + ) + (if (and v1-63 (nonzero? (-> v1-63 draw))) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> v1-63 draw origin) + (-> v1-63 draw bounds w) + (new 'static 'rgba :b #xff :a #x80) + ) + ) + ) + ) + ) + (when (logtest? gp-4 (scene-controls scene-controls-7)) + (dotimes (s5-4 (-> self scene actor length)) + (let* ((s4-2 (handle->process (-> self scene actor s5-4 process))) + (v1-79 (if (type? s4-2 process-drawable) + (the-as process-drawable s4-2) + ) + ) + ) + (if (and v1-79 (nonzero? (-> v1-79 draw))) + (format + *stdcon* + "~0K ~-30S ~S d:~4,,0m r:~4,,0m~1K~%" + (-> self scene actor s5-4 art-group) + (if (logtest? (-> v1-79 draw status) (draw-control-status on-screen)) + "os" + " " + ) + (-> v1-79 draw distance) + (-> v1-79 draw bounds w) + ) + ) + ) + ) + ) + (when (logtest? gp-4 (scene-controls scene-controls-8)) + (dotimes (gp-5 (-> self scene actor length)) + (let* ((s5-5 (handle->process (-> self scene actor gp-5 process))) + (v1-94 (if (type? s5-5 process-drawable) + (the-as process-drawable s5-5) + ) + ) + ) + (if (and v1-94 (nonzero? (-> v1-94 draw))) + (add-debug-text-3d + #t + (bucket-id debug-no-zbuf1) + (-> v1-94 name) + (-> v1-94 draw origin) + (font-color yellow-#f3f300) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) + ) + ) + ) + ) + ) + ) + ) + ) + (when (cpad-pressed? 0 square) + (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle))) + (set! (-> self subtitle-change-time) (-> self clock frame-counter)) + ) + (when (and (< (- (-> self clock frame-counter) (-> self subtitle-change-time)) (seconds 2)) + (< (mod (- (-> self clock frame-counter) (-> self subtitle-change-time)) 300) 210) + ) + (let ((gp-6 (new + 'stack + 'font-context + *font-default-matrix* + 36 + 60 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-121 gp-6)) + (set! (-> v1-121 width) (the float (the-as float #x1b8))) + ) + (let ((v1-122 gp-6)) + (set! (-> v1-122 height) (the float (the-as float #x30))) + ) + (let ((v1-123 gp-6)) + (set! (-> v1-123 scale) 0.5) + ) + (set! (-> gp-6 flags) (font-flags shadow kerning middle large)) + (print-game-text + (lookup-text! + *common-text* + (if (-> *setting-control* user-default subtitle) + (game-text-id scene-subtitles-enabled) + (game-text-id scene-subtitles-disabled) + ) + #f + ) + gp-6 + #f + 44 + 322 + ) + ) + ) + (process-drawable-draw-subtitles) + (when (and (= *cheat-mode* 'debug) (-> self scene)) + (let ((gp-7 + (gui-control-method-15 *gui-control* self (gui-channel art-load) (-> self scene name) (new 'static 'sound-id)) + ) + ) + (when (!= *external-cam-mode* 'pad-0) + (cond + ((cpad-hold? 0 r1) + (if (cpad-pressed? 0 circle) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + ) + (seek! + (-> self speed-change-speed) + 8.0 + (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (-> self clock time-adjust-ratio) + ) + ) + ) + ((cpad-hold? 0 l1) + (if (cpad-pressed? 0 square) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + ) + (seek! + (-> self speed-change-speed) + -8.0 + (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (-> self clock time-adjust-ratio) + ) + ) + ) + ((cpad-hold? 0 x) + (when (cpad-pressed? 0 x) + (set! (-> self speed-press-time) (-> self clock frame-counter)) + (cond + ((= (-> self cur-speed) 0.0) + (set! (-> self speed-change-speed) -1000.0) + ) + (else + (set! (-> self targ-speed) 0.0) + (set! (-> self speed-change-speed) 0.0) + ) + ) + ) + ) + (else + (set! (-> self speed-change-speed) 0.0) + ) + ) + ) + (cond + ((= (-> self cur-speed) -1000.0) + (format *stdcon* "scene paused~%") + (when (!= (-> self targ-speed) -1000.0) + (sound-continue (-> gp-7 id)) + (when *sound-player-enable* + (let ((v1-186 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-186 command) (sound-command set-param)) + (set! (-> v1-186 id) (-> gp-7 id)) + (set! (-> v1-186 params pitch-mod) 0) + (set! (-> v1-186 params mask) (the-as uint 2)) + (-> v1-186 id) + ) + ) + (set! (-> self targ-speed) 0.0) + (set! (-> self cur-speed) 0.0) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + ) + ) + ((= (-> self speed-change-speed) -1000.0) + (when (!= (-> self cur-speed) -1000.0) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self targ-speed) -1000.0) + (set! (-> self cur-speed) -1000.0) + (sound-pause (-> gp-7 id)) + ) + ) + (else + (set! (-> self targ-speed) + (fmax + -10.0 + (fmin 10.0 (+ (-> self targ-speed) (* (-> self speed-change-speed) (-> self clock seconds-per-frame)))) + ) + ) + (if (< (- (-> self clock frame-counter) (-> self speed-change-time)) (seconds 3)) + (format + *stdcon* + "id ~d speed ~f~%" + (if gp-7 + (the-as int (-> gp-7 id)) + 0 + ) + (-> self targ-speed) + ) + ) + (when (and gp-7 (and (!= (-> self targ-speed) (-> self cur-speed)) + (< (-> self speed-change-time) (-> self clock frame-counter)) + (>= (- (-> self clock frame-counter) (-> self scene-start-time)) (seconds 1)) + ) + ) + (when *sound-player-enable* + (let ((v1-211 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-211 command) (sound-command set-param)) + (set! (-> v1-211 id) (-> gp-7 id)) + (set! (-> v1-211 params pitch-mod) (the int (* 1524.0 (-> self targ-speed)))) + (set! (-> v1-211 params mask) (the-as uint 2)) + (-> v1-211 id) + ) + ) + (set! (-> self cur-speed) (-> self targ-speed)) + (set! (-> self speed-change-time) (-> self clock frame-counter)) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for function scene-player-init +;; WARN: Return type mismatch object vs none. +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +(defbehavior scene-player-init scene-player ((arg0 object) (arg1 symbol) (arg2 string)) + "`object` arg can be an `(array scene)`, `pair of scene` or a `scene`" + (process-entity-set! self (the-as entity-actor #f)) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self root) (new 'process 'trsqv)) + (case (rtype-of arg0) + ((array) + (set! (-> self scene-list) (new 'process 'boxed-array scene (-> (the-as (array scene) arg0) length))) + (dotimes (v1-7 (-> self scene-list length)) + (set! (-> self scene-list v1-7) (-> (the-as (array scene) arg0) v1-7)) + ) + ) + ((pair) + (let ((s3-0 (method-of-type array new)) + (s2-0 'process) + (s1-0 array) + (s0-0 scene) + (a0-14 arg0) + ) + (set! (-> self scene-list) + (the-as (array scene) (s3-0 s2-0 s1-0 s0-0 ((method-of-type (rtype-of a0-14) length) a0-14))) + ) + ) + (dotimes (s3-1 (-> self scene-list length)) + (set! (-> self scene-list s3-1) (the-as scene (ref arg0 s3-1))) + ) + ) + (else + (set! (-> self scene-list) (new 'process 'boxed-array scene 1)) + (set! (-> self scene-list 0) (the-as scene arg0)) + ) + ) + (set! (-> self preload-continue) arg2) + (set! (-> self camera) (the-as handle #f)) + (set! (-> self wait) arg1) + (set! (-> self pre-cut-frame) #f) + (set! (-> self aborted?) #f) + (set! (-> self draw) (new 'process 'draw-control self #f)) + (set! (-> self skel) (new 'process 'joint-control 48)) + (set! (-> self anim) (new 'static 'spool-anim)) + (set! (-> self next-anim) (new 'static 'spool-anim)) + (dotimes (s4-1 (-> self scene-list length)) + (let ((v1-29 (scene-lookup (-> self scene-list s4-1)))) + (if v1-29 + (set! (-> self scene-list s4-1) v1-29) + ) + ) + ) + (cond + ((= (-> self scene-list (-> self scene-index) type) scene) + (set! (-> self scene) (-> self scene-list (-> self scene-index))) + (if (-> self scene) + (scene-method-15 (-> self scene) (-> self anim)) + ) + ) + (else + (set-blackout-frames (seconds 0.2)) + (set! (-> self scene) #f) + ) + ) + (set! (-> self gui-id) (the-as uint (gui-control-method-9 + *gui-control* + self + (gui-channel movie) + (gui-action play) + (the-as string (cond + ((= (rtype-of arg0) string) + (empty) + arg0 + ) + (else + "movie" + ) + ) + ) + -99.0 + 0 + ) + ) + ) + (set! *scene-player* (the-as scene-player (process->ppointer self))) + (set! *display-entity-errors* #f) + (set-setting! 'speech-control #f 0 0) + (set-setting! 'allow-progress #f 0 0) + (apply-settings *setting-control*) + (go-virtual wait arg1) + (none) + ) + +;; definition for method 16 of type scene +(defmethod scene-method-16 scene ((obj scene)) + (let ((v1-1 (-> *level* loading-level))) + (if v1-1 + (set-loaded-art (-> v1-1 art-group) obj) + ) + ) + obj + ) diff --git a/test/decompiler/reference/jak2/engine/ui/hud-h_REF.gc b/test/decompiler/reference/jak2/engine/ui/hud-h_REF.gc index b141f64979..4ad93e29e7 100644 --- a/test/decompiler/reference/jak2/engine/ui/hud-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/hud-h_REF.gc @@ -38,14 +38,14 @@ (scale-x float :offset-assert 36) (scale-y float :offset-assert 40) (angle float :offset-assert 44) - (tex basic :offset-assert 48) + (tex texture :offset-assert 48) ) :method-count-assert 11 :size-assert #x34 :flag-assert #xb00000034 (:methods (hud-sprite-method-9 (_type_ dma-buffer level) none 9) - (hud-sprite-method-10 () none 10) + (hud-sprite-method-10 (_type_) none 10) ) ) @@ -166,26 +166,26 @@ (strings hud-string 14 :inline :offset-assert 288) (sprites hud-sprite 30 :inline :offset-assert 960) (icons hud-icon 2 :inline :offset-assert 2880) - (gui-id uint32 :offset-assert 2976) + (gui-id sound-id :offset-assert 2976) ) :heap-base #xb30 :method-count-assert 27 :size-assert #xba4 :flag-assert #x1b0b300ba4 (:methods - (hud-method-14 () none 14) - (hud-method-15 () none 15) - (hud-method-16 () none 16) - (hud-method-17 () none 17) - (hud-method-18 () none 18) - (hud-method-19 () none 19) - (hud-method-20 () none 20) - (hud-method-21 () none 21) - (hud-method-22 () none 22) - (hud-method-23 () none 23) - (hud-method-24 () none 24) - (hud-method-25 () none 25) - (hud-method-26 () none 26) + (hidden? (_type_) symbol 14) + (hud-method-15 (_type_) none 15) + (hud-method-16 (_type_ int int) none 16) + (hud-method-17 (_type_) none 17) + (hud-method-18 (_type_) symbol 18) + (hud-method-19 (_type_) none 19) + (hud-method-20 (_type_) none 20) + (hud-method-21 (_type_) none 21) + (hud-method-22 (_type_) none 22) + (hud-method-23 (_type_) none 23) + (hud-method-24 (_type_ symbol) none 24) + (hud-method-25 (_type_) none 25) + (hud-method-26 (_type_ int) none 26) ) ) @@ -202,8 +202,8 @@ (format #t "~2Tlast-hide-time: ~D~%" (-> obj last-hide-time)) (format #t "~2Toffset: ~f~%" (-> obj offset)) (format #t "~2Tflags: ~D~%" (-> obj flags)) - (format #t "~2Tvalues[8] @ #x~X~%" (&-> obj stack 24)) - (format #t "~2Tstrings[14] @ #x~X~%" (&-> obj stack 160)) + (format #t "~2Tvalues[8] @ #x~X~%" (&-> obj values 0 type)) + (format #t "~2Tstrings[14] @ #x~X~%" (&-> obj strings 0 type)) (format #t "~2Tsprites[30] @ #x~X~%" (-> obj sprites)) (format #t "~2Ticons[2] @ #x~X~%" (&-> obj stack 2752)) (format #t "~2Tgui-id: ~D~%" (-> obj gui-id))