decomp: credits (#533)

* decomp: `credits` but there are still issues

* issues over creating a `new` `font-context`

* decomp: finalized `credits`
This commit is contained in:
Tyler Wilding
2021-06-06 19:57:40 -04:00
committed by GitHub
parent fef7fad65a
commit c19bcd37aa
10 changed files with 443 additions and 20 deletions
+10 -9
View File
@@ -4915,7 +4915,7 @@
:size-assert #x10
:flag-assert #xa00000010
(:methods
(dummy-9 () none 9)
(dummy-9 (_type_ uint symbol) string 9)
)
)
@@ -4924,7 +4924,7 @@
(define-extern *text-group-names* (array string))
(define-extern kheap type)
(define-extern *common-text-heap* kheap)
(define-extern *common-text* symbol)
(define-extern *common-text* game-text-info) ; TODO guess, but its definitely not just a symbol!
;; ----------------------
@@ -16229,12 +16229,12 @@
(define-extern progress-allowed? (function symbol))
(define-extern lookup-level-info (function symbol level-load-info))
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
;; - Symbols
(define-extern auto-save-command function)
(define-extern auto-save-init-by-other function)
(define-extern print-game-text function)
(define-extern get-aspect-ratio function)
(define-extern get-task-status function)
(define-extern calculate-completion function)
@@ -19253,6 +19253,7 @@
(define-extern set-letterbox-frames (function uint none))
(define-extern letterbox (function none))
(define-extern blackout (function none))
(define-extern scf-get-territory (function int))
;; - Symbols
@@ -19271,7 +19272,6 @@
;; - Unknowns
;;(define-extern scf-get-territory object) ;; unknown type
;;(define-extern scf-get-timeout object) ;; unknown type
;;(define-extern scf-get-inactive-timeout object) ;; unknown type
;;(define-extern kernel-shutdown object) ;; unknown type
@@ -20443,14 +20443,15 @@
;; - Symbols
(define-extern set-credits-font-color function)
(define-extern draw-title-credits function)
(define-extern draw-end-credits function)
(define-extern draw-title-credits (function float none))
(define-extern set-credits-font-color (function float none))
(define-extern draw-end-credits (function int symbol))
;; - Unknowns
;;(define-extern *title-credits-scale* object) ;; unknown type
;;(define-extern *title-credits-spacing* object) ;; unknown type
(define-extern *title-credits-spacing* (array int32))
(define-extern *title-credits-scale* (array float))
;; ----------------------
@@ -494,5 +494,11 @@
"effect-control-h": [
["L6", "float", true]
],
"credits": [
["L32", "(array int32)", true],
["L33", "(array float)", true],
["L49", "float", true]
]
}
@@ -292,5 +292,13 @@
[16, "vector"],
[32, "vector"],
[48, "vector"]
],
"draw-end-credits": [
[16, "font-context"]
],
"draw-title-credits": [
[16, "font-context"]
]
}
+2
View File
@@ -5,3 +5,5 @@
;; name in dgo: game-save
;; dgos: GAME, ENGINE
;; TODO - for credits
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
+3
View File
@@ -9,3 +9,6 @@
"Are we in a movie?"
(nonzero? (logand (-> *kernel-context* prevent-from-run) (process-mask movie)))
)
;; TODO - for credits
(define-extern scf-get-territory (function int))
+195
View File
@@ -5,3 +5,198 @@
;; name in dgo: credits
;; dgos: GAME, ENGINE
;; definition for function set-credits-font-color
;; INFO: Return type mismatch int vs none.
(defun set-credits-font-color ((arg0 float))
(let ((f0-0 255.0))
)
(dotimes (v1-0 4)
(let ((f0-2 (* 64.0 arg0)))
(if (< 128.0 f0-2)
(set! f0-2 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 r) (the int f0-2))
)
(let ((f0-5 (* 64.0 arg0)))
(if (< 128.0 f0-5)
(set! f0-5 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 g) (the int f0-5))
)
(let ((f0-8 (* 64.0 arg0)))
(if (< 128.0 f0-8)
(set! f0-8 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 b) (the int f0-8))
)
)
(none)
)
;; definition for symbol *title-credits-scale*, type (array float)
(define
*title-credits-scale*
(the-as (array float)
(new 'static 'boxed-array float 8 0.9 0.9 0.6 0.6 1.0 0.9 1.1 0.9)
)
)
;; definition for symbol *title-credits-spacing*, type (array int32)
(define
*title-credits-spacing*
(the-as (array int32)
(new 'static 'boxed-array int32 8 15 20 15 15 20 15 20 15)
)
)
;; definition for function draw-title-credits
;; INFO: Return type mismatch int vs none.
(defun draw-title-credits ((arg0 float))
(when (>= 1.0 arg0)
(let* ((s4-0 11)
(f30-0 (* arg0 (the float (+ s4-0 -2))))
(s5-0 (the int f30-0))
(gp-0
(new
'stack
'font-context
*font-default-matrix*
0
0
0.0
0
(the-as uint 3)
)
)
)
(let ((f0-3 1.0))
)
(let ((v1-3 gp-0))
(set! (-> v1-3 width) (the float 600))
)
(let ((v1-4 gp-0))
(set! (-> v1-4 height) (the float 10))
)
(set! (-> gp-0 flags) (the-as uint 38))
(let* ((s5-1 (- s5-0 (mod s5-0 3)))
(f0-10 (- f30-0 (the float s5-1)))
)
(when (and (>= s5-1 0) (< s5-1 s4-0))
(let ((f30-1 (cond
((< f0-10 0.8)
0.0
)
((< f0-10 1.6)
(* 160.0 (+ -0.8 f0-10))
)
((< f0-10 2.2)
128.0
)
(else
(* 128.0 (- 1.0 (* 1.25 (+ -2.2 f0-10))))
)
)
)
)
(set! (-> gp-0 origin x) -44.0)
(set! (-> gp-0 origin y) 90.0)
(dotimes (s4-1 3)
(let* ((s2-0 (+ (+ s4-1 3840) s5-1))
(s3-0 (dummy-9 *common-text* (the-as uint s2-0) #t))
)
(when (= s2-0 3841)
(let ((v1-18 (scf-get-territory)))
(cond
((= v1-18 1)
(set! s3-0 (dummy-9 *common-text* (the-as uint 3857) #t))
)
((= v1-18 2)
(set! s3-0 (dummy-9 *common-text* (the-as uint 3856) #t))
)
)
)
)
(when s3-0
(let ((v1-25 gp-0))
(set! (-> v1-25 scale) (-> *title-credits-scale* (+ s5-1 s4-1)))
)
(print-game-text s3-0 gp-0 #f (the int f30-1) 22)
)
)
(set!
(-> gp-0 origin y)
(+
(-> gp-0 origin y)
(the float (-> *title-credits-spacing* (+ s5-1 s4-1)))
)
)
)
)
)
)
)
)
(none)
)
;; definition for function draw-end-credits
(defun draw-end-credits ((arg0 int))
(local-vars (v1-13 int))
(let
((s4-0
(+ (- arg0) (the int (* 1.5 (the float (-> *video-parms* screen-sy)))))
)
(gp-0 2815)
(s3-0 0)
(s2-0 #t)
(s5-0
(new 'stack 'font-context *font-default-matrix* 31 0 0.0 0 (the-as uint 3))
)
)
(let ((v1-2 s5-0))
(set! (-> v1-2 width) (the float 450))
)
(let ((v1-3 s5-0))
(set! (-> v1-3 height) (the float 10))
)
(let ((v1-4 s5-0))
(set! (-> v1-4 scale) 1.0)
)
(set! (-> s5-0 flags) (the-as uint 39))
(while
(or s2-0 (and (< s4-0 (- s3-0)) (< (the-as uint gp-0) (the-as uint 3249))))
(+! s4-0 s3-0)
(+! gp-0 1)
(let ((a0-8 (dummy-9 *common-text* (the-as uint gp-0) #t)))
(if a0-8
(set! s3-0 (the int (+ 5.0 (print-game-text a0-8 s5-0 #t 128 20))))
(set! s3-0 25)
)
)
(set! s2-0 #f)
)
(cond
((>= (the-as uint gp-0) (the-as uint 3249))
#t
)
(else
(set! (-> s5-0 origin y) (the float s4-0))
(while (< (-> s5-0 origin y) (the float (-> *video-parms* screen-sy)))
(let ((a0-11 (dummy-9 *common-text* (the-as uint gp-0) #t)))
(if a0-11
(set! v1-13 (the int (+ 5.0 (print-game-text a0-11 s5-0 #f 128 20))))
(set! v1-13 25)
)
)
(set! (-> s5-0 origin y) (+ (-> s5-0 origin y) (the float v1-13)))
(+! gp-0 1)
)
#f
)
)
)
)
+8 -7
View File
@@ -22,16 +22,16 @@
;; A table of all strings.
(deftype game-text-info (basic)
((length int32 :offset-assert 4)
(language-id int32 :offset-assert 8)
(group-name string :offset-assert 12)
(data game-text :dynamic :inline :offset-assert 16)
((length int32 :offset-assert 4)
(language-id int32 :offset-assert 8)
(group-name string :offset-assert 12)
(data game-text :inline :dynamic :offset-assert 16)
)
:method-count-assert 10
:size-assert #x10
:flag-assert #xa00000010
(:methods
(dummy-9 () none 9)
(dummy-9 (_type_ uint symbol) string 9)
)
)
@@ -39,5 +39,6 @@
(define *text-group-names* (new 'static 'boxed-array string 1 "common"))
(define *common-text-heap* (new 'global 'kheap))
;; probably some other type.
(define *common-text* #f)
;; definition for symbol *common-text*, type game-text-info
(define *common-text* (the-as game-text-info #f))
@@ -820,4 +820,9 @@
(declare-type joint-control-channel structure)
(define-extern cspace-index-by-name (function process-drawable string int))
(define-extern cspace-by-name (function process-drawable string cspace))
(define-extern joint-control-reset! (function joint-control joint-control-channel none))
(define-extern joint-control-reset! (function joint-control joint-control-channel none))
;; TODO - for credits
(define-extern scf-get-territory (function int))
(declare-type font-context basic)
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
@@ -0,0 +1,202 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function set-credits-font-color
;; INFO: Return type mismatch int vs none.
(defun set-credits-font-color ((arg0 float))
(let ((f0-0 255.0))
)
(dotimes (v1-0 4)
(let ((f0-2 (* 64.0 arg0)))
(if (< 128.0 f0-2)
(set! f0-2 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 r) (the int f0-2))
)
(let ((f0-5 (* 64.0 arg0)))
(if (< 128.0 f0-5)
(set! f0-5 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 g) (the int f0-5))
)
(let ((f0-8 (* 64.0 arg0)))
(if (< 128.0 f0-8)
(set! f0-8 128.0)
)
(set! (-> *font-work* color-table 32 color v1-0 b) (the int f0-8))
)
)
(let ((v0-0 0))
)
(none)
)
;; definition for symbol *title-credits-scale*, type (array float)
(define
*title-credits-scale*
(the-as (array float)
(new 'static 'boxed-array float 8 0.9 0.9 0.6 0.6 1.0 0.9 1.1 0.9)
)
)
;; definition for symbol *title-credits-spacing*, type (array int32)
(define
*title-credits-spacing*
(the-as (array int32)
(new 'static 'boxed-array int32 8 15 20 15 15 20 15 20 15)
)
)
;; definition for function draw-title-credits
;; INFO: Return type mismatch int vs none.
(defun draw-title-credits ((arg0 float))
(when (>= 1.0 arg0)
(let* ((s4-0 11)
(f30-0 (* arg0 (the float (+ s4-0 -2))))
(s5-0 (the int f30-0))
(gp-0
(new
'stack
'font-context
*font-default-matrix*
0
0
0.0
0
(the-as uint 3)
)
)
)
(let ((f0-3 1.0))
)
(let ((v1-3 gp-0))
(set! (-> v1-3 width) (the float 600))
)
(let ((v1-4 gp-0))
(set! (-> v1-4 height) (the float 10))
)
(set! (-> gp-0 flags) (the-as uint 38))
(let* ((s5-1 (- s5-0 (mod s5-0 3)))
(f0-10 (- f30-0 (the float s5-1)))
)
(when (and (>= s5-1 0) (< s5-1 s4-0))
(let ((f30-1 (cond
((< f0-10 0.8)
0.0
)
((< f0-10 1.6)
(* 160.0 (+ -0.8 f0-10))
)
((< f0-10 2.2)
128.0
)
(else
(* 128.0 (- 1.0 (* 1.25 (+ -2.2 f0-10))))
)
)
)
)
(set! (-> gp-0 origin x) -44.0)
(set! (-> gp-0 origin y) 90.0)
(dotimes (s4-1 3)
(let* ((s2-0 (+ (+ s4-1 3840) s5-1))
(s3-0 (dummy-9 *common-text* (the-as uint s2-0) #t))
)
(when (= s2-0 3841)
(let ((v1-18 (scf-get-territory)))
(cond
((= v1-18 1)
(set! s3-0 (dummy-9 *common-text* (the-as uint 3857) #t))
)
((= v1-18 2)
(set! s3-0 (dummy-9 *common-text* (the-as uint 3856) #t))
)
)
)
)
(when s3-0
(let ((v1-25 gp-0))
(set! (-> v1-25 scale) (-> *title-credits-scale* (+ s5-1 s4-1)))
)
(print-game-text s3-0 gp-0 #f (the int f30-1) 22)
)
)
(set!
(-> gp-0 origin y)
(+
(-> gp-0 origin y)
(the float (-> *title-credits-spacing* (+ s5-1 s4-1)))
)
)
)
)
)
)
)
)
(let ((v0-6 0))
)
(none)
)
;; definition for function draw-end-credits
(defun draw-end-credits ((arg0 int))
(local-vars (v1-13 int))
(let
((s4-0
(+ (- arg0) (the int (* 1.5 (the float (-> *video-parms* screen-sy)))))
)
(gp-0 2815)
(s3-0 0)
(s2-0 #t)
(s5-0
(new 'stack 'font-context *font-default-matrix* 31 0 0.0 0 (the-as uint 3))
)
)
(let ((v1-2 s5-0))
(set! (-> v1-2 width) (the float 450))
)
(let ((v1-3 s5-0))
(set! (-> v1-3 height) (the float 10))
)
(let ((v1-4 s5-0))
(set! (-> v1-4 scale) 1.0)
)
(set! (-> s5-0 flags) (the-as uint 39))
(while
(or s2-0 (and (< s4-0 (- s3-0)) (< (the-as uint gp-0) (the-as uint 3249))))
(+! s4-0 s3-0)
(+! gp-0 1)
(let ((a0-8 (dummy-9 *common-text* (the-as uint gp-0) #t)))
(if a0-8
(set! s3-0 (the int (+ 5.0 (print-game-text a0-8 s5-0 #t 128 20))))
(set! s3-0 25)
)
)
(set! s2-0 #f)
)
(cond
((>= (the-as uint gp-0) (the-as uint 3249))
#t
)
(else
(set! (-> s5-0 origin y) (the float s4-0))
(while (< (-> s5-0 origin y) (the float (-> *video-parms* screen-sy)))
(let ((a0-11 (dummy-9 *common-text* (the-as uint gp-0) #t)))
(if a0-11
(set! v1-13 (the int (+ 5.0 (print-game-text a0-11 s5-0 #f 128 20))))
(set! v1-13 25)
)
)
(set! (-> s5-0 origin y) (+ (-> s5-0 origin y) (the float v1-13)))
(+! gp-0 1)
)
#f
)
)
)
)
@@ -31,7 +31,7 @@
:size-assert #x10
:flag-assert #xa00000010
(:methods
(dummy-9 () none 9)
(dummy-9 (_type_ uint symbol) string 9)
)
)
@@ -54,8 +54,8 @@
;; definition for symbol *common-text-heap*, type kheap
(define *common-text-heap* (new 'global 'kheap))
;; definition for symbol *common-text*, type symbol
(define *common-text* #f)
;; definition for symbol *common-text*, type game-text-info
(define *common-text* (the-as game-text-info #f))
;; failed to figure out what this is:
(let ((v0-3 0))