[decomp] some of fact-h (#473)

* update scripts

* decomp some of `fact-h`
This commit is contained in:
ManDude 2021-05-13 02:45:36 +01:00 committed by GitHub
parent ea2a6613e0
commit 7d69311552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 98 additions and 60 deletions

View File

@ -326,7 +326,7 @@
(pid int32 :offset-assert #x28)
(main-thread cpu-thread :offset-assert #x2c)
(top-thread thread :offset-assert #x30)
(entity basic :offset-assert #x34)
(entity basic :offset-assert #x34) ;; entity
(state state :offset-assert #x38)
(trans-hook function :offset-assert #x3c)
(post-hook function :offset-assert #x40)
@ -8520,7 +8520,7 @@
(dummy-9 (_type_ symbol symbol int symbol (pointer res-tag) pointer) symbol 9)
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
(dummy-12 (_type_ symbol symbol int int symbol pointer) float 12)
(dummy-12 (_type_ symbol symbol float float symbol pointer) float 12)
(dummy-13 (_type_ int) pointer 13) ;; advance tag pointer
(dummy-14 (_type_ uint) pointer 14)
(dummy-15 (_type_) none 15)
@ -8777,8 +8777,8 @@
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 (_type_) none 11)
(dummy-10 (_type_ symbol) none 10)
(dummy-11 (_type_) float 11)
)
)
@ -8805,6 +8805,9 @@
:method-count-assert 12
:size-assert #x90
:flag-assert #xc00000090
(:methods
(new (symbol type process pickup-type float) _type_ 0)
)
)
;; fact-h
@ -8820,6 +8823,9 @@
:method-count-assert 12
:size-assert #x44
:flag-assert #xc00000044
(:methods
(new (symbol type process pickup-type float) _type_ 0)
)
)
;; aligner-h
@ -33640,7 +33646,7 @@
;;(define-extern notice-top object) ;; unknown type
;;(define-extern speed object) ;; unknown type
;;(define-extern cam-notice-dist object) ;; unknown type
;;(define-extern process-drawable-art-error object) ;; unknown type
(define-extern process-drawable-art-error symbol) ;; unknown type
;;(define-extern notice-bottom object) ;; unknown type
;;(define-extern eco-info object) ;; unknown type
;;(define-extern cam-horz object) ;; unknown type
@ -33711,7 +33717,6 @@
;;(define-extern collide-frag-vertex object) ;; unknown type
(define-extern drawable-tree-collide-fragment type)
;;(define-extern projectile-blue object) ;; unknown type
;;(define-extern *sidekick* object) ;; unknown type
(define-extern bsp-header type)
(define-extern inspect-bsp-tree function)
(define-extern map-bsp-tree function)

View File

@ -275,6 +275,16 @@
["L373", "uint64", true],
["L371", "uint64", true]
],
"fact-h": [
["L36", "float", true],
["L37", "float", true],
["L38", "float", true],
["L39", "float", true],
["L40", "float", true],
["L41", "float", true],
["L42", "float", true]
],
"lights": [
["L8", "float", true],

View File

@ -393,5 +393,13 @@
// SHADOW-CPU-H
"(method 10 shadow-control)": [
[1, "v1", "int"]
],
// FACT-H
"(method 0 fact-info-enemy)": [
[3, "v0", "fact-info-enemy"]
],
"(method 0 fact-info-target)": [
[3, "v0", "fact-info-target"]
]
}

View File

@ -1561,5 +1561,10 @@
"(method 0 shadow-control)": {
"args": ["allocation", "type-to-make", "bottom-offset", "top-offset", "dir", "center", "fade"],
"vars": { "v0-0": "obj" }
},
// FACT-H
"(method 0 fact-info-target)": {
"vars": { "gp-0": "obj" }
}
}

View File

@ -31,7 +31,7 @@
(dummy-9 (_type_ symbol symbol int symbol (pointer res-tag) pointer) symbol 9)
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
(dummy-12 (_type_ symbol symbol int int symbol pointer) float 12)
(dummy-12 (_type_ symbol symbol float float symbol pointer) float 12)
(dummy-13 (_type_ int) pointer 13) ;; advance tag pointer
(dummy-14 (_type_ uint) pointer 14)
(dummy-15 (_type_) none 15)

View File

@ -8,44 +8,43 @@
;; NOT FINISHED
(deftype fact-bank (basic)
((eco-level-max float :offset-assert 4)
(eco-single-inc float :offset-assert 8)
(eco-full-inc float :offset-assert 12)
((eco-level-max float :offset-assert 4)
(eco-single-inc float :offset-assert 8)
(eco-full-inc float :offset-assert 12)
(eco-single-timeout uint64 :offset-assert 16) ; usec
(eco-full-timeout uint64 :offset-assert 24) ; usec
(dummy uint64 :offset-assert 32) ; usec
(health-max-default float :offset-assert 40)
(health-single-inc float :offset-assert 44)
(eco-pill-max-default float :offset-assert 48)
(health-small-inc float :offset-assert 52)
(buzzer-max-default float :offset-assert 56)
(buzzer-single-inc float :offset-assert 60)
(suck-bounce-dist float :offset-assert 64) ; meters
(suck-suck-dist float :offset-assert 68) ; meters
(default-pill-inc float :offset-assert 72)
(health-max-default float :offset-assert 40)
(health-single-inc float :offset-assert 44)
(eco-pill-max-default float :offset-assert 48)
(health-small-inc float :offset-assert 52)
(buzzer-max-default float :offset-assert 56)
(buzzer-single-inc float :offset-assert 60)
(suck-bounce-dist float :offset-assert 64) ; meters
(suck-suck-dist float :offset-assert 68) ; meters
(default-pill-inc float :offset-assert 72)
)
:method-count-assert 9
:size-assert #x4c
:flag-assert #x90000004c
)
(define *FACT-bank*
(new 'static 'fact-bank
:eco-level-max 2.000000
:eco-single-inc 1.000000
:eco-full-inc 5.000000
:eco-single-timeout #x5dc
:eco-full-timeout #x1770
:dummy #x1194
:health-max-default 3.000000
:health-single-inc 1.000000
:eco-pill-max-default 50.000000
:health-small-inc 1.000000
:buzzer-max-default 7.000000
:buzzer-single-inc 1.000000
:suck-bounce-dist 73728.000000
:suck-suck-dist 30720.000000
)
(define *FACT-bank* (new 'static 'fact-bank
:eco-level-max 2.0
:eco-single-inc 1.0
:eco-full-inc 5.0
:eco-single-timeout (seconds 5)
:eco-full-timeout (seconds 20)
:dummy (seconds 15)
:health-max-default 3.0
:health-single-inc 1.0
:eco-pill-max-default 50.0
:health-small-inc 1.0
:buzzer-max-default 7.0
:buzzer-single-inc 1.0
:suck-bounce-dist (meters 18)
:suck-suck-dist (meters 7.5)
)
)
(defenum pickup-type
@ -91,8 +90,8 @@
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 (_type_) none 11)
(dummy-10 (_type_ symbol) none 10)
(dummy-11 (_type_) float 11)
)
)
@ -100,7 +99,7 @@
((eco-type int32 :offset-assert 40)
(eco-level float :offset-assert 44)
(eco-pickup-time uint64 :offset-assert 48)
(eco-timeout uint64 :offset-assert 56) ;; usec
(eco-timeout uint64 :offset-assert 56) ;; usec
(health float :offset-assert 64)
(health-max float :offset-assert 68)
(buzzer float :offset-assert 72)
@ -118,18 +117,28 @@
:method-count-assert 12
:size-assert #x90
:flag-assert #xc00000090
(:methods
(new (symbol type process pickup-type float) _type_ 0)
)
)
(deftype fact-info-enemy (fact-info)
((speed float :offset-assert 40)
(idle-distance float :offset-assert 44) ; meters
(notice-top float :offset-assert 48) ; meters
(notice-bottom float :offset-assert 52) ; meters
(cam-horz float :offset-assert 56) ; meters
(cam-vert float :offset-assert 60) ; meters
(cam-notice-dist float :offset-assert 64) ; meters
(idle-distance float :offset-assert 44) ; meters
(notice-top float :offset-assert 48) ; meters
(notice-bottom float :offset-assert 52) ; meters
(cam-horz float :offset-assert 56) ; meters
(cam-vert float :offset-assert 60) ; meters
(cam-notice-dist float :offset-assert 64) ; meters
)
:method-count-assert 12
:size-assert #x44
:flag-assert #xc00000044
(:methods
(new (symbol type process pickup-type float) _type_ 0)
)
)
(defmethod dummy-11 fact-info ((obj fact-info))
0.0
)

View File

@ -5,13 +5,6 @@
;; name in dgo: dynamics-h
;; dgos: GAME, ENGINE
;; TODO move these elsewhere
(defglobalconstant TICKS_TO_SECONDS (/ 1.0 300)) ;; #x3b5a740e - 0.0033333333...
(defmacro vel-to-tick (vel)
"turn a velocity value into a per-tick value"
`(* ,TICKS_TO_SECONDS ,vel)
)
(deftype dynamics (basic)
((name basic :offset-assert 4)
(gravity-max float :offset-assert 8) ;; meters
@ -27,7 +20,7 @@
)
(defun time-to-apex ((arg0 float) (arg1 float))
(the int (/ arg0 (- (vel-to-tick arg1))))
(the int (/ arg0 (- (vel-tick arg1))))
)
(defun time-to-ground ((velocity float) (gravity float) (height float))
@ -36,8 +29,8 @@
(ticks 0))
;; loop in ticks until we reach the ground
(while (< (- height) height-checked)
(let ((velocity (- velocity (vel-to-tick gravity))))
(+! height-checked (vel-to-tick velocity))
(let ((velocity (- velocity (vel-tick gravity))))
(+! height-checked (vel-tick velocity))
)
(+! ticks 1)
)

View File

@ -54,17 +54,25 @@
)
)
(defglobalconstant TICKS_PER_SECOND 300) ;; 5 t/frame @ 60fps, 6 t/frame @ 50fps
(defmacro seconds (x)
"Convert number to seconds unit."
(cond
((float? x)
(* 300.0 x)
(* (* 1.0 TICKS_PER_SECOND) x)
)
((integer? x)
(* 300 x)
(* TICKS_PER_SECOND x)
)
(#t
`(* 300.0 ,x)
`(* (* 1.0 TICKS_PER_SECOND) ,x)
)
)
)
;; maybe rename to "velocity"?
(defmacro vel-tick (vel)
"turn a velocity value into a per-tick value"
`(* (/ 1.0 ,TICKS_PER_SECOND) ,vel)
)

View File

@ -1,2 +1,2 @@
cd ..\..
git update-index --assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc
git update-index --assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc decompiler\config\jak1_ntsc_black_label\inputs.jsonc

View File

@ -1,2 +1,2 @@
cd ..\..
git update-index --no-assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc
git update-index --no-assume-unchanged decompiler\config\jak1_ntsc_black_label.jsonc decompiler\config\jak1_ntsc_black_label\inputs.jsonc