[jak2] prepare scf-get-territory usage (#2890)

This commit is contained in:
ManDude
2023-08-08 17:21:29 +01:00
committed by GitHub
parent 988fdfb5b0
commit 39d989cfcc
21 changed files with 264 additions and 859 deletions
+29 -55
View File
@@ -455,22 +455,21 @@
)
;; definition for function demo-screen-change
;; WARN: Return type mismatch int vs none.
(defbehavior demo-screen-change demo-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int))
(defbehavior demo-screen-change demo-control ((arg0 int) (arg1 int) (arg2 symbol) (arg3 symbol))
(when arg3
(let ((s3-0 (the-as int (-> *setting-control* user-current language))))
(if (and (= (the-as language-enum s3-0) (language-enum english)) (= (scf-get-territory) 1))
(set! s3-0 7)
)
(if (>= (the-as int arg0) 0)
(set! arg0 (the-as symbol (+ (the-as uint arg0) (* 3 s3-0))))
(if (>= arg0 0)
(+! arg0 (* 3 s3-0))
)
(if (>= arg1 0)
(+! arg1 (* 3 s3-0))
)
)
)
(set! (-> self want 0) (the-as int arg0))
(set! (-> self want 0) arg0)
(set! (-> self want 1) (-> self draw))
(when arg2
(set-setting! 'bg-a 'abs 1.0 0)
@@ -484,7 +483,7 @@
(suspend)
)
)
(set! (-> self draw) (the-as int arg0))
(set! (-> self draw) arg0)
(set! (-> self active) #f)
(while (and (>= (-> self draw) 0) (not (-> self active)))
(suspend)
@@ -492,11 +491,10 @@
(remove-setting! 'bg-a)
(set! (-> self want 1) arg1)
0
(none)
)
;; definition for function demo-wait-for-press
(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol))
(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame))
(let ((s4-0 (current-time))
(s3-0 #f)
)
@@ -601,32 +599,20 @@
(when (zero? (-> *game-info* demo-state))
(case (scf-get-territory)
((2)
(let ((t9-1 demo-screen-change)
(a0-3 25)
(a1-1 26)
(a2-0 #t)
)
(t9-1 (the-as symbol a0-3) a1-1 a2-0 (the-as int #f))
(let ((a1-2 (new 'stack-no-clear 'array 'symbol 6)))
(set! (-> a1-2 5) #f)
(set! (-> a1-2 4) #f)
(set! (-> a1-2 3) #f)
(set! (-> a1-2 2) 'ctywide)
(set! (-> a1-2 1) 'ctysluma)
(set! (-> a1-2 0) 'demo)
(want-levels *load-state* a1-2)
)
(demo-wait-for-press (seconds 1) (seconds 5) a2-0)
(demo-screen-change 25 26 #t #f)
(let ((a1-2 (new 'stack-no-clear 'array 'symbol 6)))
(set! (-> a1-2 5) #f)
(set! (-> a1-2 4) #f)
(set! (-> a1-2 3) #f)
(set! (-> a1-2 2) 'ctywide)
(set! (-> a1-2 1) 'ctysluma)
(set! (-> a1-2 0) 'demo)
(want-levels *load-state* a1-2)
)
(let ((t9-4 demo-screen-change)
(a0-6 26)
(a1-4 -1)
(a2-1 #f)
)
(t9-4 (the-as symbol a0-6) a1-4 a2-1 (the-as int #f))
(demo-wait-for-press (seconds 1) (seconds 5) a2-1)
)
(demo-screen-change (the-as symbol -1) -1 #f (the-as int #t))
(demo-wait-for-press (seconds 1) (seconds 5))
(demo-screen-change 26 -1 #f #f)
(demo-wait-for-press (seconds 1) (seconds 5))
(demo-screen-change -1 -1 #f #t)
)
)
)
@@ -651,8 +637,8 @@
(add-process *gui-control* self (gui-channel jak) (gui-action queue) "demoend" -99.0 0)
)
(if (and (!= (scf-get-territory) 2) (= (-> *setting-control* user-current language) (language-enum japanese)))
(demo-screen-change (the-as symbol 2) -1 #t (the-as int #f))
(demo-screen-change (the-as symbol 2) -1 #t (the-as int #t))
(demo-screen-change 2 -1 #t #f)
(demo-screen-change 2 -1 #t #t)
)
(while (!= (get-status *gui-control* (-> self gui-id)) (gui-status ready))
(suspend)
@@ -806,7 +792,7 @@
(suspend)
)
)
(demo-screen-change (the-as symbol -1) -1 #f (the-as int #t))
(demo-screen-change -1 -1 #f #t)
(set! (-> *game-info* demo-state) (the-as uint 1))
(start 'play (get-continue-by-name *game-info* "demo-start"))
(sleep-code)
@@ -850,15 +836,9 @@
)
(set-setting! 'allow-timeout #f 0.0 0)
(set-setting! 'allow-pause #f 0.0 0)
(let ((t9-49 demo-screen-change)
(a0-81 0)
(a1-39 -1)
(a2-30 #t)
)
(t9-49 (the-as symbol a0-81) a1-39 a2-30 (the-as int #t))
(demo-wait-for-press (seconds 1) (seconds 15) a2-30)
)
(demo-screen-change (the-as symbol -1) -1 #f (the-as int #t))
(demo-screen-change 0 -1 #t #t)
(demo-wait-for-press (seconds 1) (seconds 15))
(demo-screen-change -1 -1 #f #t)
(start 'play (get-continue-by-name *game-info* "atoll-start"))
)
((= gp-24 1)
@@ -887,21 +867,15 @@
)
(set-setting! 'allow-timeout #f 0.0 0)
(set-setting! 'allow-pause #f 0.0 0)
(let ((t9-63 demo-screen-change)
(a0-105 1)
(a1-54 -1)
(a2-42 #t)
)
(t9-63 (the-as symbol a0-105) a1-54 a2-42 (the-as int #t))
(demo-wait-for-press (seconds 1) (seconds 15) a2-42)
)
(demo-screen-change (the-as symbol -1) -1 #f (the-as int #t))
(demo-screen-change 1 -1 #t #t)
(demo-wait-for-press (seconds 1) (seconds 15))
(demo-screen-change -1 -1 #f #t)
(start 'play (get-continue-by-name *game-info* "strip-warp"))
)
((= gp-24 2)
(set-setting! 'allow-timeout #f 0.0 0)
(set-setting! 'allow-pause #f 0.0 0)
(demo-screen-change (the-as symbol -1) -1 #f (the-as int #t))
(demo-screen-change -1 -1 #f #t)
(set! (-> *setting-control* user-default music-volume) 0.0)
(case *kernel-boot-message*
(('demo-shared)
+13 -13
View File
@@ -9,10 +9,10 @@
(sprite-draw uint32 :offset-assert 288)
(buffer external-art-buffer 2 :offset-assert 292)
(want int32 2 :offset-assert 300)
(want-name basic 2 :offset-assert 308)
(want-name string 2 :offset-assert 308)
(have int32 2 :offset-assert 316)
(draw int32 :offset-assert 324)
(draw-name basic :offset-assert 328)
(draw-name string :offset-assert 328)
(active symbol :offset-assert 332)
(spark-time time-frame :offset-assert 336)
(gui-id sound-id :offset-assert 344)
@@ -461,7 +461,7 @@
;; definition for function title-screen-change
;; WARN: Return type mismatch int vs none.
(defbehavior title-screen-change title-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int) (arg4 symbol) (arg5 symbol))
(defbehavior title-screen-change title-control ((arg0 string) (arg1 int) (arg2 string) (arg3 int) (arg4 symbol) (arg5 symbol))
(when arg5
(let ((s1-0 (the-as int (-> *setting-control* user-current language))))
(if (and (= (the-as language-enum s1-0) (language-enum english)) (= (scf-get-territory) 1))
@@ -475,7 +475,7 @@
)
)
)
(set! (-> self want-name 0) (the-as basic arg0))
(set! (-> self want-name 0) arg0)
(set! (-> self want 0) arg1)
(set! (-> self want-name 1) (-> self draw-name))
(set! (-> self want 1) (-> self draw))
@@ -493,13 +493,13 @@
)
)
(set! (-> self draw) arg1)
(set! (-> self draw-name) (the-as basic arg0))
(set! (-> self draw-name) arg0)
(set! (-> self active) #f)
(while (and (>= (-> self draw) 0) (not (-> self active)))
(suspend)
)
(remove-setting! 'bg-a)
(set! (-> self want-name 1) (the-as basic arg2))
(set! (-> self want-name 1) arg2)
(set! (-> self want 1) arg3)
0
(none)
@@ -684,12 +684,12 @@
(want-display-level *load-state* 'ctysluma 'display)
(want-display-level *load-state* 'ctywide 'display)
(when (zero? (-> *game-info* demo-state))
(title-screen-change (the-as symbol "demo-screens") 27 #f -1 #t #f)
(title-screen-change "demo-screens" 27 (the-as string #f) -1 #t #f)
(wait-for-press (seconds 1) (seconds 5) #f)
(while (not (and (= (level-status *level* 'ctysluma) 'active) (= (level-status *level* 'ctywide) 'active)))
(suspend)
)
(title-screen-change #f -1 #f -1 #f #f)
(title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f)
(set-blackout-frames (seconds 0.2))
)
(label cfg-12)
@@ -783,7 +783,7 @@
)
(when (>= s5-1 0)
(dotimes (s3-0 2)
(case (file-status (-> self buffer s3-0) (the-as string s4-0) s5-1)
(case (file-status (-> self buffer s3-0) s4-0 s5-1)
(('locked 'active)
(set! (-> self buffer s3-0 frame-lock) #t)
(set! (-> self have gp-2) s3-0)
@@ -800,7 +800,7 @@
(when (and (>= a2-1 0) (< (-> self have gp-3) 0))
(dotimes (v1-46 2)
(when (not (-> self buffer v1-46 frame-lock))
(set-pending-file (-> self buffer v1-46) (the-as string a1-9) a2-1 (process->handle self) -1.0)
(set-pending-file (-> self buffer v1-46) a1-9 a2-1 (process->handle self) -1.0)
(goto cfg-45)
)
)
@@ -814,7 +814,7 @@
(set! (-> self active) #f)
(when (>= (-> self draw) 0)
(dotimes (gp-5 2)
(when (file-status (-> self buffer gp-5) (the-as string (-> self draw-name)) (-> self draw))
(when (file-status (-> self buffer gp-5) (-> self draw-name) (-> self draw))
(set! v1-73 (-> self buffer gp-5))
(goto cfg-58)
)
@@ -919,14 +919,14 @@
)
)
)
(t9-1 (the-as symbol a0-4) a1-0 (the-as symbol a2-0) a3-0 (= s4-0 gp-0) #f)
(t9-1 a0-4 a1-0 a2-0 a3-0 (= s4-0 gp-0) #f)
)
(set! v1-6 (wait-for-press (seconds 1) (seconds 5) #t))
(+! s4-0 1)
(set! a3-0 (+ s4-0 1))
)
)
(title-screen-change #f -1 #f -1 #f #f)
(title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f)
(set-blackout-frames (seconds 0.2))
(set! (-> *game-info* demo-state) (the-as uint 1))
(go-virtual idle)