[decomp] get started on game info (#674)

* temp

* menu text

* wip

* recognize handle to process

* more
This commit is contained in:
water111
2021-07-03 16:18:41 -04:00
committed by GitHub
parent bc41241234
commit 784cd5debb
63 changed files with 9250 additions and 2542 deletions
+78 -94
View File
@@ -49,109 +49,97 @@
)
)
;; 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))))
)
)
(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)
)
)
)
(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)))
)
)
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 (lookup-text! *common-text* (the-as game-text-id s2-0) #t))
)
(when (= s2-0 3841)
(let ((v1-18 (scf-get-territory)))
(cond
((= v1-18 1)
(set! s3-0 (lookup-text! *common-text* (game-text-id europe) #t))
)
((= v1-18 2)
(set! s3-0 (lookup-text! *common-text* (game-text-id inc) #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)))
)
)
)
)
)
)
)
)
)
)
)
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)))))
)
(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))
)
(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))
@@ -163,11 +151,10 @@
(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))))
(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)))
(let ((a0-8 (lookup-text! *common-text* (the-as game-text-id 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)
@@ -182,7 +169,7 @@
(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)))
(let ((a0-11 (lookup-text! *common-text* (the-as game-text-id 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)
@@ -197,6 +184,3 @@
)
)
+19 -15
View File
@@ -25,9 +25,9 @@
)
(deftype task-info-data (basic)
((task-id uint8 :offset-assert 4)
(task-name symbol 4 :offset-assert 8)
(text-index-when-resolved int32 :offset-assert 24)
((task-id game-task :offset-assert 4)
(task-name game-text-id 4 :offset-assert 8)
(text-index-when-resolved int32 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x1c
@@ -35,11 +35,11 @@
)
(deftype level-tasks-info (basic)
((level-name-id uint32 :offset-assert 4)
(text-group-index int32 :offset-assert 8)
(nb-of-tasks int32 :offset-assert 12)
(buzzer-task-index int32 :offset-assert 16)
(task-info task-info-data 8 :offset-assert 20)
((level-name-id game-text-id :offset-assert 4)
(text-group-index int32 :offset-assert 8)
(nb-of-tasks int32 :offset-assert 12)
(buzzer-task-index int32 :offset-assert 16)
(task-info task-info-data 8 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x34
@@ -47,13 +47,13 @@
)
(deftype game-option (basic)
((option-type uint64 :offset-assert 8)
(name uint32 :offset-assert 16)
(scale basic :offset-assert 20)
(param1 float :offset-assert 24)
(param2 float :offset-assert 28)
(param3 int32 :offset-assert 32)
(value-to-modify uint32 :offset-assert 36)
((option-type uint64 :offset-assert 8)
(name game-text-id :offset-assert 16)
(scale basic :offset-assert 20)
(param1 float :offset-assert 24)
(param2 float :offset-assert 28)
(param3 int32 :offset-assert 32)
(value-to-modify uint32 :offset-assert 36)
)
:method-count-assert 9
:size-assert #x28
@@ -173,3 +173,7 @@
(defun-extern activate-progress process int int)
(define-extern *level-task-data* (array level-tasks-info))
(define-extern *level-task-data-remap* (array int32))
(define-extern get-game-count (function int count-info))
(define-extern activate-orb-all (function int int)) ;; maybe in hud?
File diff suppressed because it is too large Load Diff
+186 -2
View File
@@ -9,6 +9,190 @@
;; Each game string is assigned an ID number.
;; This ID is used to lookup the string for the currently selected language.
(defenum game-text-id
:type uint32
:bitfield #f
(zero 0)
(sfx-volume #x10a)
(music-volume #x10b)
(speech-volume #x10c)
(language #x10d)
(vibrations #x10e)
(play-hints #x10f)
(center-screen #x110)
(english #x114)
(french #x115)
(german #x116)
(spanish #x117)
(italian #x118)
(japanese #x119)
(aspect-ratio #x125)
(video-mode #x126)
(game-options #x127)
(graphic-options #x128)
(sound-options #x129)
(hidden-power-cell #x12f) ;; why is this here??
(continue-without-saving #x13f)
(back #x13e)
(load-game #x14b)
(save-game #x14c)
(options #x150)
(new-game #x15c)
(ok #x15e)
(exit-demo #x15f)
(quit-game #x16f)
(village1-mayor-money #x200)
(vollage1-uncle-money #x201)
(village1-yakow-herd #x202)
(village1-yakow-return #x203)
(village1-oracle #x204)
(beach-ecorocks #x205)
(beach-flutflut-push #x206)
(beach-flutflut-meet #x207)
(beach-pelican #x208)
(beach-seagull #x209)
(beach-cannon #x20a)
(beach-buzzer #x20b)
(jungle-lurkerm-connect #x20c)
(jungle-tower #x20d)
(jungle-eggtop #x20e)
(jungle-plant #x20f)
(jungle-fishgame #x210)
(misty-muse-catch #x211)
(misty-muse-return #x212)
(misty-boat #x213)
(misty-cannon #x214)
(misty-return-to-pool #x215) ;; task name??
(misty-find-transpad #x216) ;; task name?
(misty-balloon-lurkers #x217)
(village1-level-name #x220)
(beach-level-name #x221)
(jungle-level-name #x222)
(misty-level-name #x223)
(beach-seagull-get #x22e)
(jungle-lurkerm-unblock #x22f)
(jungle-lurkerm-return #x230)
(MISSING-orb-hint #x233)
(beach-gimmie #x262)
(beach-sentinel #x263)
(jungle-canyon-end #x264)
(jungle-temple-door #x265)
(misty-bike-jump #x266)
(misty-eco-challenge #x267)
(village2-gambler-money #x300)
(village2-geologist-money #x301)
(village2-warrior-money #x302)
(village2-oracle-money #x303)
(swamp-tether #x304)
(swamp-flutflut #x307)
(swamp-billy #x309)
(sunken-elevator-raise #x30a)
(sunken-elevator-get-to-roof #x30b)
(sunken-pipe #x30c)
(sunken-climb-tube #x30d) ;; task name?
(sunken-pool #x30e) ;; task name?
(sunken-platforms #x30f)
(rolling-moles #x310)
(rolling-moles-return #x311)
(rolling-robbers #x312)
(rolling-race #x313)
(rolling-race-return #x314)
(rolling-lake #x315)
(rolling-plants #x316)
(unknown-buzzers #x317)
(village2-level-name #x319)
(rolling-level-name #x31b)
(swamp-level-name #x31c)
(sunken-level-name #x31d)
(ogre-level-name #x31e)
(swamp-battle #x321)
(sunken-bottom #x322) ;; task name?
(reach-center #x323) ;; task name?
(rolling-ring-chase-1 #x324)
(rolling-ring-chase-2 #x325)
(village3-miner-money #x400)
(village3-oracle-money #x401)
(snow-ram-3-left #x402)
(snow-ram-2-left #x403)
(snow-ram-1-left #x404)
(snow-fort #x405)
(snow-bunnies #x406)
(snow-open-door #x408) ;; task name?
(cave-robot-climb #x40e)
(cave-dark-climb #x40f) ;; destroy crystals
(cave-gnawers #x410)
(cave-dark-crystals #x411)
(village3-buzzer #x413)
(village3-level-name #x415)
(snowy-level-name #x417)
(cave-level-name #x419)
(lavatube-level-name #x41b)
(snow-eggtop #x421)
(cave-spider-tunnel #x423)
(cave-platforms #x424)
(cave-swing-poles #x426)
(snow-frozen-crate #x42b) ;; task name?
(snow-bumpers #x42c)
(fire-canyon-end #x500)
(fire-canyon-buzzer #x501)
(fire-canyon-level-name #x50c)
(ogre-end #x600)
(ogre-buzzer #x601)
(ogre-boss #x603)
(lavatube-end #x700)
(lavatube-buzzer #x701)
(citadel-buzzer #x800)
(citadel-level-name #x801)
(citadel-sage-blue #x802)
(citadel-sage-red #x803)
(citadel-sage-yellow #x804)
(citadel-sage-green #x805)
(training-gimmie-task-name #x91b)
(training-buzzer-task-name #x91c)
(training-door-task-name #x91d)
(training-climb-task-name #x91e)
(training-level-name #x91f)
(inc #xf10)
(europe #xf11)
)
;; an individual string.
(deftype game-text (structure)
((id uint32 :offset-assert 0)
@@ -31,8 +215,8 @@
:size-assert #x10
:flag-assert #xa00000010
(:methods
(dummy-9 (_type_ uint symbol) string 9)
)
(lookup-text! (_type_ game-text-id symbol) string 9)
)
)
;; todo, need support for array
+40 -1
View File
@@ -44,6 +44,45 @@
;; todo method 8
;; todo method 9
(defmethod lookup-text! game-text-info ((obj game-text-info) (arg0 game-text-id) (arg1 symbol))
"Look up text by ID. Will return the string.
If the ID can't be found, and arg1 is #t, it will return #f,
otherwise the temp string UNKNOWN ID <id number>"
;; binary search for it
(let* ((a1-1 0) ;; min
(a3-0 (+ (-> obj length) 1)) ;; max
(v1-2 (/ (+ a1-1 a3-0) 2)) ;; mid
)
(let ((t0-0 -1)) ;; last time's lookup
(while (and (!= (-> obj data v1-2 id) arg0) (!= v1-2 t0-0)) ;; while we haven't found it/not the same as last time
(if (< arg0 (-> obj data v1-2 id))
(set! a3-0 v1-2) ;; bisect, right
(set! a1-1 v1-2) ;; bisect, left
)
(set! t0-0 v1-2) ;; remeber last time
(set! v1-2 (/ (+ a1-1 a3-0) 2)) ;; midpoint for next time
)
)
(cond
((!= (-> obj data v1-2 id) arg0) ;; didn't find it :(
(cond
(arg1
(the-as string #f)
)
(else
(format (clear *temp-string*) "UNKNOWN ID ~D" arg0)
*temp-string*
)
)
)
(else
(-> obj data v1-2 text) ;; found it!
)
)
)
)
;; todo text-is-loading
;; todo load-game-text-info
;; todo load-level-text-files
@@ -53,4 +92,4 @@
;; todo print-game-text
;; todo disable-level-text-file-loading
;; todo enable-level-text-file-loading