Files
jak-project/test/decompiler/reference/jak2/engine/ui/text_REF.gc
T
Tyler Wilding f6bdc07990 d/jak2: finish progress menu code and initialize the camera (#1945)
This PR does a few main things:
- finish decompiling the progress related code
- implemented changes necessary to load the text files end-to-end
   - japanese/korean character encodings were not added
- finish more camera code, which is required to spawn the progress menu
/ init the default language settings needed for text
  - initialized the camera as well

Still havn't opened the menu as there are a lot of checks around
`*target*` which I havn't yet gone through and attempted to comment out.
2022-10-11 18:30:26 -04:00

879 lines
29 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(kmemopen global "text")
;; definition for symbol *expand-buf-number*, type int
(define *expand-buf-number* 0)
;; definition for symbol *game-text-word*, type string
(define *game-text-word* (new 'global 'string 256 (the-as string #f)))
;; definition for symbol *game-text-line*, type string
(define *game-text-line* (new 'global 'string 1024 (the-as string #f)))
;; definition for symbol *expanded-text-line0*, type string
(define *expanded-text-line0* (new 'global 'string 1024 (the-as string #f)))
;; definition for symbol *expanded-text-line1*, type string
(define *expanded-text-line1* (new 'global 'string 1024 (the-as string #f)))
;; definition for symbol *level-text-file-load-flag*, type symbol
(define *level-text-file-load-flag* #t)
;; failed to figure out what this is:
(when (zero? (-> *common-text-heap* base))
(let ((gp-0 *common-text-heap*))
(set! (-> gp-0 base) (kmalloc global #x10000 (kmalloc-flags) "heap"))
(set! (-> gp-0 current) (-> gp-0 base))
(set! (-> gp-0 top-base) (&+ (-> gp-0 base) #x10000))
(set! (-> gp-0 top) (-> gp-0 top-base))
)
)
;; failed to figure out what this is:
(kmemclose)
;; definition for method 7 of type game-text-info
(defmethod relocate game-text-info ((obj game-text-info) (arg0 int))
(let ((v1-1 (-> *level* loading-level)))
(when v1-1
(set! (-> v1-1 loaded-text-info (-> v1-1 loaded-text-info-count)) obj)
(+! (-> v1-1 loaded-text-info-count) 1)
)
)
obj
)
;; definition for method 4 of type game-text-info
(defmethod length game-text-info ((obj game-text-info))
(-> obj length)
)
;; definition for method 5 of type game-text-info
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of game-text-info ((obj game-text-info))
(the-as int (+ (-> obj type size) (* (-> obj length) 8)))
)
;; definition for method 3 of type game-text-info
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect game-text-info ((obj game-text-info))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tlength: ~D~%" (-> obj length))
(format #t "~Tlanguage-id: ~D~%" (-> obj language-id))
(format #t "~Tgroup-name: ~A~%" (-> obj group-name))
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj length) (-> obj data))
(dotimes (s5-0 (-> obj length))
(format #t "~T [~D] #x~X ~A~%" s5-0 (-> obj data s5-0 id) (-> obj data s5-0 text))
)
obj
)
;; definition for method 8 of type game-text-info
(defmethod mem-usage game-text-info ((obj game-text-info) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 84 (-> arg0 length)))
(set! (-> arg0 data 83 name) "string")
(+! (-> arg0 data 83 count) 1)
(let ((v1-6 (asize-of obj)))
(+! (-> arg0 data 83 used) v1-6)
(+! (-> arg0 data 83 total) (logand -16 (+ v1-6 15)))
)
(dotimes (s4-0 (-> obj length))
(set! (-> arg0 length) (max 84 (-> arg0 length)))
(set! (-> arg0 data 83 name) "string")
(+! (-> arg0 data 83 count) 1)
(let ((v1-18 (asize-of (-> obj data s4-0 text))))
(+! (-> arg0 data 83 used) v1-18)
(+! (-> arg0 data 83 total) (logand -16 (+ v1-18 15)))
)
)
obj
)
;; definition for function convert-korean-text
(defun convert-korean-text ((arg0 string))
"Converts the provided [[string]] of [[game-text]] into korean. Returns a [[string]]"
(local-vars (v1-21 int))
(let ((gp-0 (-> arg0 data)))
*expanded-text-line0*
(let ((s4-0 0))
0
(let ((s1-0 0)
(s5-0 (length arg0))
)
(set! *expand-buf-number* (logxor *expand-buf-number* 1))
(let ((s3-0 (if (zero? *expand-buf-number*)
*expanded-text-line0*
*expanded-text-line1*
)
)
)
(let ((s2-0 (+ (-> s3-0 allocated-length) -1)))
(clear s3-0)
(while (< s4-0 s5-0)
(cond
((= (-> gp-0 s4-0) 3)
(+! s4-0 1)
(while (and (< s4-0 s5-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4))
(set! (-> s3-0 data s1-0) (-> gp-0 s4-0))
(+! s4-0 1)
(+! s1-0 1)
)
)
(else
(let ((v1-17 (+ s4-0 1)))
(-> gp-0 v1-17)
(set! s4-0 (+ v1-17 1))
)
(set! (-> s3-0 data s1-0) (the-as uint 126))
(let ((v1-19 (+ s1-0 1)))
(set! (-> s3-0 data v1-19) (the-as uint 89))
(let ((v1-20 (+ v1-19 1)))
(while (and (< s4-0 s5-0) (< v1-20 s2-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4))
(cond
((= (-> gp-0 s4-0) 5)
(set! (-> s3-0 data v1-20) (the-as uint 1))
(+! s4-0 1)
(set! v1-21 (+ v1-20 1))
)
(else
(set! (-> s3-0 data v1-20) (the-as uint 3))
(set! v1-21 (+ v1-20 1))
)
)
(set! (-> s3-0 data v1-21) (-> gp-0 s4-0))
(+! s4-0 1)
(let ((v1-22 (+ v1-21 1)))
(set! (-> s3-0 data v1-22) (the-as uint 126))
(let ((v1-23 (+ v1-22 1)))
(set! (-> s3-0 data v1-23) (the-as uint 90))
(set! v1-20 (+ v1-23 1))
)
)
)
(set! (-> s3-0 data v1-20) (the-as uint 126))
(let ((v1-24 (+ v1-20 1)))
(set! (-> s3-0 data v1-24) (the-as uint 43))
(let ((v1-25 (+ v1-24 1)))
(set! (-> s3-0 data v1-25) (the-as uint 50))
(let ((v1-26 (+ v1-25 1)))
(set! (-> s3-0 data v1-26) (the-as uint 54))
(let ((v1-27 (+ v1-26 1)))
(set! (-> s3-0 data v1-27) (the-as uint 72))
(set! s1-0 (+ v1-27 1))
)
)
)
)
)
)
)
)
)
)
(set! (-> s3-0 data s1-0) (the-as uint 0))
s3-0
)
)
)
)
)
;; definition for method 9 of type game-text-info
(defmethod lookup-text! game-text-info ((obj game-text-info) (arg0 game-text-id) (arg1 symbol))
(cond
((= obj #f)
(cond
(arg1
(the-as string #f)
)
(else
(format (clear *temp-string*) "NO GAME TEXT")
*temp-string*
)
)
)
(else
(let* ((a1-2 0)
(a3-0 (+ (-> obj length) 1))
(v1-2 (/ (+ a1-2 a3-0) 2))
)
(let ((t0-0 -1))
(while (and (!= (-> obj data v1-2 id) arg0) (!= v1-2 t0-0))
(if (< (the-as uint arg0) (the-as uint (-> obj data v1-2 id)))
(set! a3-0 v1-2)
(set! a1-2 v1-2)
)
(set! t0-0 v1-2)
(set! v1-2 (/ (+ a1-2 a3-0) 2))
)
)
(cond
((!= (-> obj data v1-2 id) arg0)
(cond
(arg1
(the-as string #f)
)
(else
(format (clear *temp-string*) "UNKNOWN ID ~X" arg0)
*temp-string*
)
)
)
((= (-> obj language-id) 6)
(convert-korean-text (-> obj data v1-2 text))
)
(else
(-> obj data v1-2 text)
)
)
)
)
)
)
;; definition for method 23 of type level
(defmethod lookup-text level ((obj level) (arg0 game-text-id) (arg1 symbol))
(let ((v1-0 *common-text*))
(dotimes (a3-0 (-> obj loaded-text-info-count))
(if (= (-> obj loaded-text-info a3-0 language-id) (-> *setting-control* user-current language))
(set! v1-0 (-> obj loaded-text-info a3-0))
)
)
(lookup-text! v1-0 arg0 arg1)
)
)
;; definition for symbol text-is-loading, type symbol
(define text-is-loading #f)
;; definition for function load-game-text-info
;; WARN: Found some very strange gotos. Check result carefully, this is not well tested.
;; ERROR: failed type prop at 3: Could not figure out load: (set! v1 (l.wu gp))
;; WARN: Return type mismatch none vs int.
(defun load-game-text-info ((a0-0 string) (a1-0 symbol) (a2-0 kheap))
"Load text, if needed. txt-name is the group name, curr-text is the _symbol_ for
the game-text-info, and heap is the heap to load to. The heap will be cleared."
(local-vars
(v0-0 none)
(v0-1 none)
(v0-2 none)
(v0-3 none)
(v0-4 none)
(v0-5 none)
(v0-6 none)
(v0-7 none)
(v0-8 none)
(v0-9 none)
(v0-10 none)
(v0-11 none)
(v0-12 none)
(v0-13 none)
(v1-0 game-text-info)
(v1-1 none)
(v1-2 none)
(v1-3 none)
(v1-4 none)
(v1-5 none)
(v1-6 none)
(v1-7 none)
(v1-9 none)
(v1-10 none)
(v1-11 none)
(v1-12 none)
(v1-13 none)
(v1-14 none)
(v1-16 none)
(v1-17 none)
(v1-18 none)
(v1-20 none)
(v1-21 none)
(v1-24 none)
(v1-25 none)
(v1-26 none)
(a0-1 none)
(a0-2 none)
(a0-3 none)
(a0-4 none)
(a0-5 none)
(a0-6 none)
(a0-7 none)
(a0-8 none)
(a0-10 none)
(a0-11 none)
(a0-12 none)
(a0-13 none)
(a0-14 none)
(a0-15 none)
(a0-17 none)
(a0-18 none)
(a0-19 none)
(a0-20 none)
(a0-21 none)
(a0-22 none)
(a1-2 none)
(a1-3 none)
(a1-4 none)
(a1-5 none)
(a1-6 none)
(a1-7 none)
(a1-8 none)
(a1-9 none)
(a2-1 none)
(a2-2 none)
(a2-3 none)
(a2-4 none)
(a2-5 none)
(a2-6 none)
(a3-1 none)
(a3-2 none)
(t0-0 none)
(s1-0 none)
(s2-0 none)
(s2-1 none)
(s3-0 none)
(s3-1 none)
(t9-0 none)
(t9-1 none)
(t9-2 none)
(t9-3 none)
(t9-4 none)
(t9-5 none)
(t9-6 none)
(t9-7 none)
(t9-8 none)
(t9-9 none)
(t9-10 none)
(t9-11 none)
(t9-12 none)
(sv-16 none)
(sv-24 none)
(sv-32 none)
(sv-40 none)
)
(when (begin
(when (begin
(and (begin
(set! v1-0 (the-as game-text-info (l.wu a1-0)))
(set! sv-16 v1-0)
(set! v1-1 (the-as none *setting-control*))
(set! v1-2 (the-as none (l.d (+ v1-1 28))))
(set! sv-24 v1-2)
(set! sv-32 0)
(set! v1-3 (the-as none (-> a2-0 top)))
(set! a0-1 (the-as none (-> a2-0 base)))
(set! v1-4 (the-as none (- v1-3 a0-1)))
(set! sv-40 v1-4)
(set! t9-0 (the-as none scf-get-territory))
(set! v0-0 (the-as none (call!)))
(set! v1-5 (the-as none (+ v0-0 -1)))
(set! a0-2 (the-as none (zero? v1-5)))
a0-2
)
(begin (set! v1-7 sv-24) (zero? v1-7))
(begin (set! t9-1 (the-as none demo?)) (set! v0-1 (the-as none (call!))) (set! v1-6 (the-as none (not v0-1))))
)
v1-6
)
(set! v1-9 (the-as none 7))
(set! sv-24 v1-9)
)
(or (begin (set! v1-10 sv-16) (set! a0-3 (the-as none (= v1-10 #f))) a0-3)
(begin
(set! v1-12 sv-16)
(set! v1-13 (the-as none (l.w (+ v1-12 4))))
(set! a0-4 sv-24)
(set! a0-5 (the-as none (!= v1-13 a0-4)))
a0-5
)
(begin
(set! t9-2 (the-as none string=))
(set! v1-14 sv-16)
(set! a0-6 (the-as none (l.wu (+ v1-14 8))))
(set! a1-1 (the-as none a0-0))
(set! v0-2 (the-as none (call!)))
(set! v1-11 (the-as none (not v0-2)))
)
)
v1-11
)
(cond
((begin
(set! v1-16 (the-as none a2-0))
(set! a0-7 (the-as none (l.wu v1-16)))
(s.w! (+ v1-16 8) a0-7)
((b! #t L50 (nop!)) (nop!))
(label cfg-16)
(set! v0-3 (the-as none 0))
((b! #t L56 (nop!)) (nop!))
(label cfg-17)
(set! s3-0 (the-as none str-load))
(set! s2-0 (the-as none format))
(set! t9-3 (the-as none clear))
(set! a0-8 (the-as none *temp-string*))
(call!)
(set! a0-9 (the-as none v0-4))
(set! a1-2 (the-as none L100))
(set! a2-1 sv-24)
(set! a3-0 (the-as none a0-0))
(set! t9-4 (the-as none s2-0))
(call!)
(set! a0-10 (the-as none *temp-string*))
(set! a1-3 (the-as none -1))
(set! v1-17 (the-as none -64))
(set! a2-2 (the-as none (l.wu (+ a2-0 8))))
(set! a2-3 (the-as none (+ a2-2 63)))
(set! a2-4 (the-as none (logand v1-17 a2-3)))
(set! v1-18 (the-as none (l.wu (+ a2-0 4))))
(set! a3-1 (the-as none (l.wu (+ a2-0 8))))
(set! a3-2 (the-as none (- v1-18 a3-1)))
(set! t9-5 (the-as none s3-0))
(set! v0-6 (the-as none (call!)))
((b! (not v0-6) L49 (nop!)) (nop!))
(label cfg-19)
(set! t9-6 (the-as none str-load-status))
(set! a0-11 (& sv-32))
(set! v0-7 (the-as none (call!)))
(set! v1-20 (the-as none v0-7))
(set! a0-12 (the-as none 'error))
((b! (!= v1-20 a0-12) L52 (set! a0-13 #f)) (empty-form))
(set! t9-7 (the-as none format))
(set! a0-14 (the-as none 0))
(set! a1-4 (the-as none L99))
(call!)
(set! v0-3 (the-as none 0))
((b! #t L56 (nop!)) (nop!))
(set! v1-21 (the-as none 0))
((b! #t L54 (nop!)) (nop!))
(label cfg-22)
(set! a0-15 sv-32)
(set! a1-5 sv-40)
(set! a1-6 (the-as none (+ a1-5 -300)))
(>=.si a0-15 a1-6)
)
(return (begin
(set! t9-8 (the-as none format))
(set! a0-17 (the-as none 0))
(set! a1-7 (the-as none L98))
(call!)
(set! v0-3 (the-as none 0))
)
)
)
((begin (set! a0-18 (the-as none 'busy)) (= v1-20 a0-18))
(begin (nop!) (nop!) (nop!) (nop!) (nop!) (nop!) (goto cfg-19))
)
)
(if (begin
(label cfg-27)
(set! v1-24 (the-as none -64))
(set! a0-19 (the-as none (l.wu (+ a2-0 8))))
(set! a0-20 (the-as none (+ a0-19 63)))
(set! s2-1 (the-as none (logand v1-24 a0-20)))
(set! t9-9 (the-as none flush-cache))
(set! a0-21 (the-as none 0))
(call!)
(set! s3-1 (the-as none link))
(set! s1-0 (the-as none format))
(set! t9-10 (the-as none clear))
(set! a0-22 (the-as none *temp-string*))
(call!)
(set! a0-23 (the-as none v0-11))
(set! a1-8 (the-as none L100))
(set! a2-5 sv-24)
(set! t9-11 (the-as none s1-0))
(set! a3-3 (the-as none a0-0))
(call!)
(set! v1-25 (the-as none *temp-string*))
(set! a1-9 (the-as none (+ v1-25 4)))
(set! a2-6 sv-32)
(set! t0-0 (the-as none 0))
(set! t9-12 (the-as none s3-1))
(set! a0-24 (the-as none s2-1))
(set! a3-4 (the-as none a2-0))
(set! v0-13 (the-as none (call!)))
(s.w! a1-0 v0-13)
(set! v1-26 (the-as none (l.wu a1-0)))
(<=0.si v1-26)
)
(s.w! a1-0 #f)
)
)
(set! v0-3 (the-as none 0))
(label cfg-30)
(ret-value v0-3)
)
;; definition for function load-level-text-files
;; WARN: Return type mismatch int vs none.
(defun load-level-text-files ((arg0 int))
"Load the text files needed for level idx.
This function made more sense back when text files were split up, but in the end they put everything
in a single text group and file."
(if (or *level-text-file-load-flag* (>= arg0 0))
(load-game-text-info "common" '*common-text* *common-text-heap*)
)
0
(none)
)
;; definition for function draw-debug-text-box
;; WARN: Return type mismatch int vs none.
(defun draw-debug-text-box ((arg0 font-context))
"Draws some lines"
(when *cheat-mode*
(let ((s5-0 (new 'static 'vector4w))
(gp-0 (new 'static 'vector4w-4))
)
(set-vector!
(-> gp-0 vector 0)
(the int (+ -256.0 (-> arg0 origin x)))
(the int (+ -208.0 (-> arg0 origin y)))
0
1
)
(set-vector!
(-> gp-0 vector 1)
(the int (+ -256.0 (-> arg0 width) (-> arg0 origin x)))
(the int (+ -208.0 (-> arg0 origin y)))
0
1
)
(set-vector!
(-> gp-0 vector 2)
(the int (+ -256.0 (-> arg0 width) (-> arg0 origin x)))
(the int (+ -208.0 (-> arg0 height) (-> arg0 origin y)))
0
1
)
(set-vector!
(-> gp-0 vector 3)
(the int (+ -256.0 (-> arg0 origin x)))
(the int (+ -208.0 (-> arg0 height) (-> arg0 origin y)))
0
1
)
(set-vector! s5-0 128 128 128 128)
(add-debug-line2d #t (bucket-id debug-no-zbuf1) (the-as vector4w (-> gp-0 vector)) (-> gp-0 vector 1) s5-0)
(add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 vector 1) (-> gp-0 vector 2) s5-0)
(add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 vector 2) (-> gp-0 vector 3) s5-0)
(add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 vector 3) (the-as vector4w (-> gp-0 vector)) s5-0)
)
)
0
(none)
)
;; definition for function print-game-text-scaled
;; WARN: Return type mismatch int vs none.
(defun print-game-text-scaled ((arg0 string) (arg1 float) (arg2 font-context) (arg3 int))
"Print text, with a given scaling"
(let ((f26-0 (-> arg2 width))
(f30-0 (-> arg2 height))
(f24-0 (-> arg2 origin x))
(f22-0 (-> arg2 origin y))
(f28-0 (-> arg2 scale))
)
(let ((f0-1 (* (-> arg2 width) arg1))
(f1-2 (* (-> arg2 height) arg1))
)
(if (logtest? (-> arg2 flags) (font-flags middle))
(+! (-> arg2 origin x) (* 0.5 (- f26-0 f0-1)))
)
(if (logtest? (-> arg2 flags) (font-flags left))
(+! (-> arg2 origin y) (* 0.5 (- f30-0 f1-2)))
)
(let ((v1-10 arg2))
(set! (-> v1-10 scale) (* f28-0 arg1))
)
(set! (-> arg2 width) f0-1)
(set! (-> arg2 height) f1-2)
)
(print-game-text arg0 arg2 #f 44 320)
(set! (-> arg2 origin x) f24-0)
(set! (-> arg2 origin y) f22-0)
(set! (-> arg2 width) f26-0)
(set! (-> arg2 height) f30-0)
(set! (-> arg2 scale) f28-0)
)
0
(none)
)
;; definition for function print-game-text
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 40 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 40 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 40 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 40 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 44 signed mismatch
;; WARN: Stack slot offset 36 signed mismatch
;; WARN: Stack slot offset 48 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 56 signed mismatch
(defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 int))
"Print text."
(local-vars
(sv-16 float)
(sv-20 float)
(sv-24 font-flags)
(sv-28 font-color)
(sv-32 (pointer uint8))
(sv-36 float)
(sv-40 float)
(sv-44 float)
(sv-48 float)
(sv-52 float)
(sv-56 float)
(sv-64 int)
(sv-72 uint)
(sv-80 int)
(sv-88 int)
(sv-96 int)
(sv-104 uint)
(sv-108 symbol)
(sv-112 int)
(sv-120 int)
)
(cond
((< 0.1 (-> arg1 scale))
(set! sv-16 (-> arg1 origin x))
(set! sv-20 (-> arg1 origin y))
(set! sv-24 (-> arg1 flags))
(set! sv-28 (-> arg1 color))
(when (logtest? (-> arg1 flags) (font-flags left))
(logclear! (-> arg1 flags) (font-flags left))
(+! (-> arg1 origin y)
(the float (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 320)))))
)
)
(set! sv-32 (-> arg0 data))
(set! sv-36 (-> arg1 origin x))
(set! sv-40 (-> arg1 origin x))
(set! sv-44 (+ (-> arg1 origin x) (-> arg1 width)))
(set! sv-48 (+ (-> arg1 origin y) (-> arg1 height)))
(set! sv-52 (-> (get-string-length " " arg1) length))
(set! sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large))
(the float arg3)
28.0
)
(-> arg1 scale)
)
)
(set! sv-64 0)
(if (logtest? (-> arg1 flags) (font-flags middle))
(+! (-> arg1 origin x) (* 0.5 (-> arg1 width)))
)
(set! sv-72 (-> sv-32 0))
(set! sv-80 0)
(set! sv-88 0)
(set! sv-96 0)
(set! sv-104 (-> sv-32 1))
(set! sv-108 (the-as symbol #f))
(set! sv-112 0)
(set! sv-120 0)
(set! (-> *game-text-line* data 0) (the-as uint 0))
(while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y)))
(set! sv-120 0)
(set! sv-32 (&-> sv-32 1))
(set! sv-104 (-> sv-32 0))
(set! sv-32 (&-> sv-32 -1))
(cond
((and (> sv-72 0) (< sv-72 (the-as uint 4)))
(set! (-> *game-text-word* data sv-80) sv-72)
(set! sv-80 (+ sv-80 1))
(set! (-> *game-text-word* data sv-80) sv-104)
(set! sv-80 (+ sv-80 1))
(set! sv-32 (&-> sv-32 1))
)
((= sv-72 32)
(set! (-> *game-text-word* data sv-80) sv-72)
(set! sv-80 (+ sv-80 1))
(set! sv-108 #t)
)
((zero? sv-72)
(if (nonzero? sv-80)
(set! sv-108 #t)
)
(set! sv-112 (+ sv-112 1))
)
((and (= sv-72 92) (= sv-104 92))
(set! sv-32 (&-> sv-32 1))
(if (nonzero? sv-80)
(set! sv-108 #t)
)
(set! sv-112 (+ sv-112 1))
)
((and (= sv-72 95) (= sv-104 95))
(set! sv-32 (&-> sv-32 1))
(set! (-> *game-text-word* data sv-80) (the-as uint 32))
(set! sv-80 (+ sv-80 1))
)
(else
(set! (-> *game-text-word* data sv-80) sv-72)
(set! sv-80 (+ sv-80 1))
)
)
(when sv-108
(set! (-> *game-text-word* data sv-80) (the-as uint 0))
(let ((f30-1 sv-36))
(set! sv-120 (the int (the-as float (-> (get-string-length *game-text-word* arg1) length))))
(let ((f0-26 (+ f30-1 (the float sv-120))))
(if (= (-> *game-text-word* data (+ sv-80 -1)) 32)
(set! f0-26 (- f0-26 (the-as float sv-52)))
)
(cond
((< sv-44 f0-26)
(set! sv-112 (+ sv-112 1))
)
(else
(copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data))
(set! sv-88 (+ sv-88 sv-80))
(set! sv-80 0)
(set! sv-36 (+ sv-36 (the float sv-120)))
(set! sv-108 (the-as symbol #f))
)
)
)
)
)
(while (> sv-112 0)
(let ((f30-2 (+ (-> arg1 origin y) sv-56)))
(when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t)
(when (= (-> *game-text-line* data (+ sv-88 -1)) 32)
(set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0))
0
)
(if (nonzero? (-> *game-text-line* data 0))
(set! sv-64 (+ sv-64 1))
)
(when (not arg2)
(let* ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf))
(s3-1 (-> s2-1 base))
)
(draw-string *game-text-line* s2-1 arg1)
(set! (-> arg1 color) (-> *font-work* last-color))
(let ((a3-2 (-> s2-1 base)))
(let ((v1-121 (the-as object (-> s2-1 base))))
(set! (-> (the-as dma-packet v1-121) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-121) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-121) vif1) (new 'static 'vif-tag))
(set! (-> s2-1 base) (&+ (the-as pointer v1-121) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) bucket-group)
(the-as bucket-id arg4)
s3-1
(the-as (pointer dma-tag) a3-2)
)
)
)
)
(set! (-> arg1 origin y) f30-2)
)
)
(set! sv-96 (+ sv-96 1))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(set! sv-88 0)
(set! sv-112 (+ sv-112 -1))
(set! sv-36 sv-40)
(when sv-108
(copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data))
(set! sv-88 (+ sv-88 sv-80))
(set! sv-80 0)
(set! sv-108 (the-as symbol #f))
(set! sv-36 (+ sv-36 (the float sv-120)))
)
)
(when (nonzero? sv-72)
(set! sv-32 (&-> sv-32 1))
(set! sv-72 (-> sv-32 0))
)
)
(set! (-> arg1 origin x) sv-16)
(set! (-> arg1 origin y) sv-20)
(set! (-> arg1 flags) sv-24)
(set! (-> arg1 color) sv-28)
(if (> sv-64 0)
(* sv-56 (the float sv-64))
0.0
)
)
(else
0.0
)
)
)
;; definition for function disable-level-text-file-loading
;; WARN: Return type mismatch int vs none.
(defun disable-level-text-file-loading ()
"Disables [[*level-text-file-load-flag*]]"
(set! *level-text-file-load-flag* #f)
0
(none)
)
;; definition for function enable-level-text-file-loading
;; WARN: Return type mismatch int vs none.
(defun enable-level-text-file-loading ()
"Disables [[*level-text-file-load-flag*]]"
(set! *level-text-file-load-flag* #t)
0
(none)
)