mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
[decompiler] do not use time-elapsed?
on unsigned comps (#3031)
This commit is contained in:
parent
fc43870d85
commit
a662150327
|
@ -5284,14 +5284,14 @@ FormElement* ConditionElement::make_time_elapsed(const Env& env,
|
|||
std::vector<Form*> args;
|
||||
args.push_back(time_elapsed);
|
||||
args.push_back(time);
|
||||
if (m_kind == IR2_Condition::Kind::LESS_THAN_SIGNED ||
|
||||
m_kind == IR2_Condition::Kind::LESS_THAN_UNSIGNED) {
|
||||
// TODO - how to handle unsigned case?
|
||||
if (m_kind == IR2_Condition::Kind::LESS_THAN_SIGNED) {
|
||||
return pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_compare(IR2_Condition::Kind::FALSE),
|
||||
pool.form<GenericElement>(
|
||||
GenericOperator::make_function(pool.form<ConstantTokenElement>("time-elapsed?")),
|
||||
make_casts_if_needed(args, types, TypeSpec("time-frame"), pool, env)));
|
||||
} else {
|
||||
} else if (m_kind == IR2_Condition::Kind::GEQ_SIGNED) {
|
||||
return pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_function(pool.form<ConstantTokenElement>("time-elapsed?")),
|
||||
make_casts_if_needed(args, types, TypeSpec("time-frame"), pool, env));
|
||||
|
|
|
@ -737,7 +737,7 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(when (not (time-elapsed? (the-as int s4-0) (seconds 1)))
|
||||
(when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300))
|
||||
(let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))))
|
||||
(set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0)))
|
||||
(let ((s4-2 (new 'stack 'sound-spec)))
|
||||
|
|
|
@ -555,7 +555,7 @@
|
|||
(if (logtest? (-> self control unknown-surface01 flags) (surface-flags no-turn-around))
|
||||
(set! (-> v1-6 0) (the-as uint (current-time)))
|
||||
)
|
||||
(and (time-elapsed? (the-as int (-> v1-6 0)) (seconds 1))
|
||||
(and (>= (the-as uint (- (current-time) (the-as int (-> v1-6 0)))) (the-as uint 300))
|
||||
(< f0-1 0.0)
|
||||
(< 32768.0 f1-1)
|
||||
(< 0.7 (-> self control unknown-float20))
|
||||
|
|
|
@ -2104,7 +2104,7 @@
|
|||
#t
|
||||
)
|
||||
(or (zero? (-> self control unknown-uint20))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
(!= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
|
@ -2189,13 +2189,13 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
)
|
||||
(go target-falling #f)
|
||||
)
|
||||
((and (nonzero? (-> self control unknown-uint30))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 12))
|
||||
)
|
||||
(set-forward-vel (the-as float 0.0))
|
||||
)
|
||||
|
@ -2916,7 +2916,7 @@
|
|||
(set! gp-0 (the-as int (current-time)))
|
||||
)
|
||||
(when (and (or (smack-surface? #f) (>= (-> self control unknown-float63) 0.7))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.01))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 3))
|
||||
(time-elapsed? (-> self state-time) 1)
|
||||
)
|
||||
(if (>= 6.0 (ja-aframe-num 0))
|
||||
|
|
|
@ -1383,7 +1383,7 @@
|
|||
)
|
||||
(ja-no-eval :group! eichar-yellow-running-blast-ja :num! (seek!) :frame-num (ja-aframe (the-as float 9.0) 0))
|
||||
(until (ja-done? 0)
|
||||
(if (or (not (time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.1)))
|
||||
(if (or (< (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 30))
|
||||
(= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
(send-event (handle->process gp-0) 'die)
|
||||
|
@ -2072,7 +2072,7 @@
|
|||
)
|
||||
(cond
|
||||
((= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0)
|
||||
(if (time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.05))
|
||||
(if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 15))
|
||||
(go target-swim-stance)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1255,7 +1255,7 @@
|
|||
#t
|
||||
)
|
||||
(or (zero? (-> self control unknown-uint20))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
(!= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
|
@ -1306,13 +1306,13 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
)
|
||||
(go target-flut-falling #f)
|
||||
)
|
||||
((and (nonzero? (-> self control unknown-uint30))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 12))
|
||||
)
|
||||
(set-forward-vel (the-as float 0.0))
|
||||
(set! f30-0 0.0)
|
||||
|
|
|
@ -641,7 +641,7 @@
|
|||
(if (logtest? (-> self control current-surface flags) (surface-flag no-turn-around))
|
||||
(set-time! (-> v1-7 0))
|
||||
)
|
||||
(and (time-elapsed? (-> v1-7 0) (seconds 1))
|
||||
(and (>= (the-as uint (- (current-time) (-> v1-7 0))) (the-as uint 300))
|
||||
(< f0-1 0.0)
|
||||
(< 32768.0 f1-1)
|
||||
(< 0.7 (-> self control pad-magnitude))
|
||||
|
|
|
@ -553,7 +553,7 @@
|
|||
)
|
||||
(cond
|
||||
((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0)
|
||||
(if (time-elapsed? (the-as int (-> self control unknown-word04)) (seconds 0.05))
|
||||
(if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 15))
|
||||
(go target-swim-stance)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -3608,7 +3608,7 @@
|
|||
(set! (-> self gun combo-window-state) (-> self state name))
|
||||
)
|
||||
(when (and (or (smack-surface? #f) (>= (-> self control surface-slope-z) 0.7))
|
||||
(time-elapsed? (the-as int (-> self control unknown-word04)) (seconds 0.01))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 3))
|
||||
(time-elapsed? (-> self state-time) 1)
|
||||
)
|
||||
(when (>= 6.0 (ja-aframe-num 0))
|
||||
|
|
|
@ -641,7 +641,7 @@
|
|||
)
|
||||
)
|
||||
(((race-state-enum countdown-scene-start))
|
||||
(when (time-elapsed? (the-as int (-> this countdown-start-time)) (seconds 1))
|
||||
(when (>= (the-as uint (- (current-time) (the-as int (-> this countdown-start-time)))) (the-as uint 300))
|
||||
(set! (-> this state) (race-state-enum countdown-scene))
|
||||
(set! (-> this scene-player)
|
||||
(ppointer->handle (process-spawn scene-player :init scene-player-init (-> this info countdown-scene) #t #f))
|
||||
|
|
2
test/decompiler/reference/jak1/engine/entity/ambient_REF.gc
generated
vendored
2
test/decompiler/reference/jak1/engine/entity/ambient_REF.gc
generated
vendored
|
@ -718,7 +718,7 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(when (not (time-elapsed? (the-as int s4-0) (seconds 1)))
|
||||
(when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300))
|
||||
(let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))))
|
||||
(set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0)))
|
||||
(let ((s4-2 (new 'stack 'sound-spec)))
|
||||
|
|
169
test/decompiler/reference/jak1/engine/nav/path-h_REF.gc
generated
vendored
169
test/decompiler/reference/jak1/engine/nav/path-h_REF.gc
generated
vendored
|
@ -1,169 +0,0 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type path-control
|
||||
(deftype path-control (basic)
|
||||
((flags path-control-flag :offset-assert 4)
|
||||
(name symbol :offset-assert 8)
|
||||
(process process-drawable :offset-assert 12)
|
||||
(curve curve :inline :offset-assert 16)
|
||||
(num-cverts int32 :offset 20)
|
||||
(cverts (inline-array vector) :offset 16)
|
||||
)
|
||||
:method-count-assert 21
|
||||
:size-assert #x24
|
||||
:flag-assert #x1500000024
|
||||
(:methods
|
||||
(new (symbol type process symbol float) _type_ 0)
|
||||
(debug-draw (_type_) none 9)
|
||||
(eval-path-curve-div! (_type_ vector float symbol) vector 10)
|
||||
(get-random-point (_type_ vector) vector 11)
|
||||
(path-control-method-12 (_type_ vector float) vector 12)
|
||||
(eval-path-curve! (_type_ vector float symbol) vector 13)
|
||||
(path-control-method-14 (_type_ vector float) vector 14)
|
||||
(length-as-float (_type_) float 15)
|
||||
(path-distance (_type_) float 16)
|
||||
(get-num-verts (_type_) int 17)
|
||||
(should-display? (_type_) symbol 18)
|
||||
(path-control-method-19 (_type_) float 19)
|
||||
(path-control-method-20 (_type_) float 20)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type path-control
|
||||
(defmethod inspect path-control ((obj path-control))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tflags: #x~X~%" (-> obj flags))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
(format #t "~Tprocess: ~A~%" (-> obj process))
|
||||
(format #t "~Tcurve: #<curve @ #x~X>~%" (&-> obj cverts))
|
||||
(format #t "~Tnum-cverts: ~D~%" (-> obj curve num-cverts))
|
||||
(format #t "~Tcverts: #x~X~%" (-> obj cverts))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type curve-control
|
||||
(deftype curve-control (path-control)
|
||||
()
|
||||
:method-count-assert 21
|
||||
:size-assert #x24
|
||||
:flag-assert #x1500000024
|
||||
(:methods
|
||||
(new (symbol type process symbol float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type curve-control
|
||||
(defmethod inspect curve-control ((obj curve-control))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tflags: #x~X~%" (-> obj flags))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
(format #t "~Tprocess: ~A~%" (-> obj process))
|
||||
(format #t "~Tcurve: #<curve @ #x~X>~%" (&-> obj cverts))
|
||||
(format #t "~Tnum-cverts: ~D~%" (-> obj curve num-cverts))
|
||||
(format #t "~Tcverts: #x~X~%" (-> obj cverts))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for method 0 of type path-control
|
||||
;; INFO: Used lq/sq
|
||||
;; INFO: Return type mismatch object vs path-control.
|
||||
(defmethod new path-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float))
|
||||
(local-vars (tag res-tag))
|
||||
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(when (zero? obj)
|
||||
(go process-drawable-art-error "memory")
|
||||
(set! obj (the-as path-control 0))
|
||||
(goto cfg-9)
|
||||
)
|
||||
(set! (-> obj process) (the-as process-drawable proc))
|
||||
(set! (-> obj name) name)
|
||||
(let ((ent (-> proc entity)))
|
||||
(when (= name 'path)
|
||||
(let ((lookup-entity (entity-actor-lookup ent 'path-actor 0)))
|
||||
(if lookup-entity
|
||||
(set! ent lookup-entity)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! tag (new 'static 'res-tag))
|
||||
(let ((data (res-lump-data ent name pointer :tag-ptr (& tag) :time time)))
|
||||
(cond
|
||||
(data
|
||||
(set! (-> obj cverts) (the-as (inline-array vector) data))
|
||||
(set! (-> obj curve num-cverts) (the-as int (-> tag elt-count)))
|
||||
)
|
||||
(else
|
||||
(logior! (-> obj flags) (path-control-flag not-found))
|
||||
(set! (-> obj cverts) (the-as (inline-array vector) #f))
|
||||
(set! (-> obj curve num-cverts) 0)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label cfg-9)
|
||||
(the-as path-control obj)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 18 of type path-control
|
||||
(defmethod should-display? path-control ((obj path-control))
|
||||
(and *display-path-marks* (logtest? (-> obj flags) (path-control-flag display)))
|
||||
)
|
||||
|
||||
;; definition for method 15 of type path-control
|
||||
(defmethod length-as-float path-control ((obj path-control))
|
||||
(the float (+ (-> obj curve num-cverts) -1))
|
||||
)
|
||||
|
||||
;; definition for method 17 of type path-control
|
||||
(defmethod get-num-verts path-control ((obj path-control))
|
||||
(-> obj curve num-cverts)
|
||||
)
|
||||
|
||||
;; definition for method 0 of type curve-control
|
||||
(defmethod new curve-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float))
|
||||
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(set! (-> obj process) (the-as process-drawable proc))
|
||||
(set! (-> obj name) name)
|
||||
(let* ((ent (-> proc entity))
|
||||
(v1-2 name)
|
||||
(s2-0 (cond
|
||||
((= v1-2 'path)
|
||||
'path-k
|
||||
)
|
||||
(else
|
||||
(let ((s2-1 string->symbol))
|
||||
(format (clear *temp-string*) "~A-k" name)
|
||||
(s2-1 *temp-string*)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((lookup-entity (entity-actor-lookup ent 'path-actor 0)))
|
||||
(if lookup-entity
|
||||
(set! ent lookup-entity)
|
||||
)
|
||||
)
|
||||
(when (not (get-curve-data! ent (the-as curve (&-> obj cverts)) name s2-0 time))
|
||||
(cond
|
||||
((> (-> obj curve num-cverts) 0)
|
||||
(set! (-> obj type) path-control)
|
||||
)
|
||||
(else
|
||||
(logior! (-> obj flags) (path-control-flag not-found))
|
||||
(set! (-> obj cverts) (the-as (inline-array vector) #f))
|
||||
(set! (-> obj curve num-cverts) 0)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
0
|
337
test/decompiler/reference/jak1/engine/nav/path_REF.gc
generated
vendored
337
test/decompiler/reference/jak1/engine/nav/path_REF.gc
generated
vendored
|
@ -1,337 +0,0 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for method 9 of type path-control
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defmethod debug-draw path-control ((obj path-control))
|
||||
(cond
|
||||
((logtest? (-> obj flags) (path-control-flag not-found))
|
||||
(when (and (type-type? (-> obj process type) process-drawable) *display-entity-errors*)
|
||||
(let ((s5-0 add-debug-text-3d)
|
||||
(s4-0 #t)
|
||||
(s3-0 68)
|
||||
)
|
||||
(format (clear *temp-string*) "path data error in ~S" (-> obj process name))
|
||||
(s5-0
|
||||
s4-0
|
||||
(the-as bucket-id s3-0)
|
||||
*temp-string*
|
||||
(-> obj process root trans)
|
||||
(font-color red)
|
||||
(the-as vector2h #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((let ((a0-5 obj))
|
||||
(and *display-path-marks* (logtest? (-> a0-5 flags) (path-control-flag display)))
|
||||
)
|
||||
(dotimes (s5-1 (-> obj curve num-cverts))
|
||||
(let ((s4-1 (-> obj cverts s5-1)))
|
||||
(if (and (logtest? (-> obj flags) (path-control-flag draw-line)) (< s5-1 (+ (-> obj curve num-cverts) -1)))
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
s4-1
|
||||
(-> obj cverts (+ s5-1 1))
|
||||
(new 'static 'rgba :r #xff :g #x80 :a #x80)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
)
|
||||
(if (logtest? (-> obj flags) (path-control-flag draw-point))
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf) s4-1 (new 'static 'rgba :r #xff :a #x80))
|
||||
)
|
||||
(when (logtest? (-> obj flags) (path-control-flag draw-text))
|
||||
(let ((s3-1 add-debug-text-3d)
|
||||
(s2-1 #t)
|
||||
(s1-0 68)
|
||||
)
|
||||
(format (clear *temp-string*) "~D" s5-1)
|
||||
(s3-1 s2-1 (the-as bucket-id s1-0) *temp-string* s4-1 (font-color orange) (the-as vector2h #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for method 16 of type path-control
|
||||
(defmethod path-distance path-control ((obj path-control))
|
||||
(let ((f30-0 0.0))
|
||||
(dotimes (s5-0 (+ (-> obj curve num-cverts) -1))
|
||||
(+! f30-0 (vector-vector-distance (-> obj cverts s5-0) (-> obj cverts (+ s5-0 1))))
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 16 of type curve-control
|
||||
(defmethod path-distance curve-control ((obj curve-control))
|
||||
(let ((f0-0 (-> obj curve length)))
|
||||
(when (= f0-0 0.0)
|
||||
(set! f0-0 (curve-length (the-as curve (&-> obj cverts))))
|
||||
(set! (-> obj curve length) f0-0)
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 10 of type path-control
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod eval-path-curve-div! path-control ((obj path-control) (arg0 vector) (arg1 float) (arg2 symbol))
|
||||
(let ((a1-1 (-> obj curve num-cverts))
|
||||
(f0-3 (the float (the int arg1)))
|
||||
)
|
||||
(cond
|
||||
((< arg1 0.0)
|
||||
(set! (-> arg0 quad) (-> obj cverts 0 quad))
|
||||
)
|
||||
((>= f0-3 (the float (+ a1-1 -1)))
|
||||
(set! (-> arg0 quad) (-> obj cverts (+ a1-1 -1) quad))
|
||||
)
|
||||
((or (= arg2 'exact) (= f0-3 arg1))
|
||||
(set! (-> arg0 quad) (-> obj cverts (the int f0-3) quad))
|
||||
)
|
||||
(else
|
||||
(vector-lerp! arg0 (-> obj cverts (the int f0-3)) (-> obj cverts (the int (+ 1.0 f0-3))) (- arg1 f0-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for method 11 of type path-control
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod get-random-point path-control ((obj path-control) (arg0 vector))
|
||||
(with-pp
|
||||
(cond
|
||||
((> (-> obj curve num-cverts) 0)
|
||||
(let ((s4-0 (rand-vu-int-count (-> obj curve num-cverts))))
|
||||
(when *run-time-assert-enable*
|
||||
(set-pos *__private-assert-info* "path" (the-as uint 83) (the-as uint 6))
|
||||
(__assert-zero-lim-range-int s4-0 (-> obj curve num-cverts) "rand-index" "(-> obj num-cverts)")
|
||||
)
|
||||
(set! (-> arg0 quad) (-> obj cverts s4-0 quad))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format #t "WARNING: method get-random-point called on a path-control object with no vertices.~%")
|
||||
(if pp
|
||||
(format #t "current process is ~A~%" (-> pp name))
|
||||
)
|
||||
(set! (-> arg0 quad) (-> *null-vector* quad))
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 13 of type path-control
|
||||
(defmethod eval-path-curve! path-control ((obj path-control) (arg0 vector) (arg1 float) (arg2 symbol))
|
||||
(eval-path-curve-div! obj arg0 (* arg1 (the float (+ (-> obj curve num-cverts) -1))) arg2)
|
||||
)
|
||||
|
||||
;; definition for method 13 of type curve-control
|
||||
;; INFO: Return type mismatch object vs vector.
|
||||
(defmethod eval-path-curve! curve-control ((obj curve-control) (arg0 vector) (arg1 float) (arg2 symbol))
|
||||
(the-as vector (if (logtest? (-> obj flags) (path-control-flag not-found))
|
||||
0.0
|
||||
(curve-evaluate!
|
||||
arg0
|
||||
arg1
|
||||
(-> obj cverts)
|
||||
(-> obj curve num-cverts)
|
||||
(-> obj curve knots)
|
||||
(-> obj curve num-knots)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 10 of type curve-control
|
||||
;; INFO: Return type mismatch object vs vector.
|
||||
(defmethod eval-path-curve-div! curve-control ((obj curve-control) (arg0 vector) (arg1 float) (arg2 symbol))
|
||||
(the-as vector (if (logtest? (-> obj flags) (path-control-flag not-found))
|
||||
0.0
|
||||
(curve-evaluate!
|
||||
arg0
|
||||
(/ arg1 (the float (+ (-> obj curve num-cverts) -1)))
|
||||
(-> obj cverts)
|
||||
(-> obj curve num-cverts)
|
||||
(-> obj curve knots)
|
||||
(-> obj curve num-knots)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 12 of type path-control
|
||||
(defmethod path-control-method-12 path-control ((obj path-control) (arg0 vector) (arg1 float))
|
||||
(when (not (logtest? (-> obj flags) (path-control-flag not-found)))
|
||||
(let ((v1-3 (-> obj curve num-cverts))
|
||||
(f0-3 (the float (the int arg1)))
|
||||
)
|
||||
(cond
|
||||
((< v1-3 2)
|
||||
)
|
||||
((< arg1 0.0)
|
||||
(vector-! arg0 (-> obj cverts 1) (-> obj cverts 0))
|
||||
)
|
||||
(else
|
||||
(let ((f0-4 (fmin f0-3 (the float (+ v1-3 -2)))))
|
||||
(vector-! arg0 (-> obj cverts (the int (+ 1.0 f0-4))) (-> obj cverts (the int f0-4)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-normalize! arg0 1.0)
|
||||
)
|
||||
|
||||
;; definition for method 14 of type path-control
|
||||
(defmethod path-control-method-14 path-control ((obj path-control) (arg0 vector) (arg1 float))
|
||||
(path-control-method-12 obj arg0 (* arg1 (the float (+ (-> obj curve num-cverts) -1))))
|
||||
)
|
||||
|
||||
;; definition for method 14 of type curve-control
|
||||
(defmethod path-control-method-14 curve-control ((obj curve-control) (arg0 vector) (arg1 float))
|
||||
(when (not (logtest? (-> obj flags) (path-control-flag not-found)))
|
||||
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
||||
(curve-evaluate!
|
||||
arg0
|
||||
arg1
|
||||
(-> obj cverts)
|
||||
(-> obj curve num-cverts)
|
||||
(-> obj curve knots)
|
||||
(-> obj curve num-knots)
|
||||
)
|
||||
(cond
|
||||
((< arg1 0.99)
|
||||
(curve-evaluate!
|
||||
s4-0
|
||||
(+ 0.01 arg1)
|
||||
(-> obj cverts)
|
||||
(-> obj curve num-cverts)
|
||||
(-> obj curve knots)
|
||||
(-> obj curve num-knots)
|
||||
)
|
||||
(vector-! arg0 s4-0 arg0)
|
||||
)
|
||||
(else
|
||||
(curve-evaluate!
|
||||
s4-0
|
||||
(+ -0.01 arg1)
|
||||
(-> obj cverts)
|
||||
(-> obj curve num-cverts)
|
||||
(-> obj curve knots)
|
||||
(-> obj curve num-knots)
|
||||
)
|
||||
(vector-! arg0 arg0 s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-normalize! arg0 1.0)
|
||||
)
|
||||
|
||||
;; definition for method 12 of type curve-control
|
||||
(defmethod path-control-method-12 curve-control ((obj curve-control) (arg0 vector) (arg1 float))
|
||||
(path-control-method-14 obj arg0 (/ arg1 (the float (+ (-> obj curve num-cverts) -1))))
|
||||
)
|
||||
|
||||
;; definition for method 19 of type path-control
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod path-control-method-19 path-control ((obj path-control))
|
||||
(let ((s5-0 (new 'stack-no-clear 'vector))
|
||||
(s4-0 (new 'stack-no-clear 'vector))
|
||||
(s3-0 (new 'stack-no-clear 'vector))
|
||||
(f30-0 4096000000.0)
|
||||
(f28-0 0.0)
|
||||
)
|
||||
(let ((s2-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> s3-0 quad) (-> (target-pos 0) quad))
|
||||
(set! (-> s3-0 y) 0.0)
|
||||
(eval-path-curve-div! obj s4-0 0.0 'interp)
|
||||
(set! (-> s4-0 y) 0.0)
|
||||
(dotimes (s1-1 (+ (-> obj curve num-cverts) -1))
|
||||
(set! (-> s5-0 quad) (-> s4-0 quad))
|
||||
(eval-path-curve-div! obj s4-0 (the float (+ s1-1 1)) 'interp)
|
||||
(set! (-> s4-0 y) 0.0)
|
||||
(let ((f0-5 (vector-segment-distance-point! s3-0 s5-0 s4-0 s2-0)))
|
||||
(when (< f0-5 f30-0)
|
||||
(set! f30-0 f0-5)
|
||||
(set! f28-0
|
||||
(+ (/ (vector-vector-xz-distance s2-0 s5-0) (vector-vector-xz-distance s4-0 s5-0)) (the float s1-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
f28-0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 20 of type path-control
|
||||
(defmethod path-control-method-20 path-control ((obj path-control))
|
||||
(/ (path-control-method-19 obj) (the float (+ (-> obj curve num-cverts) -1)))
|
||||
)
|
||||
|
||||
;; definition for method 9 of type curve-control
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defmethod debug-draw curve-control ((obj curve-control))
|
||||
(cond
|
||||
((logtest? (-> obj flags) (path-control-flag not-found))
|
||||
(when (and (type-type? (-> obj process type) process-drawable) *display-entity-errors*)
|
||||
(let ((s5-0 add-debug-text-3d)
|
||||
(s4-0 #t)
|
||||
(s3-0 68)
|
||||
)
|
||||
(format (clear *temp-string*) "curve data error in ~S" (-> obj process name))
|
||||
(s5-0
|
||||
s4-0
|
||||
(the-as bucket-id s3-0)
|
||||
*temp-string*
|
||||
(-> obj process root trans)
|
||||
(font-color red)
|
||||
(the-as vector2h #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((let ((a0-5 obj))
|
||||
(and *display-path-marks* (logtest? (-> a0-5 flags) (path-control-flag display)))
|
||||
)
|
||||
(if (and (logtest? (-> obj flags) (path-control-flag draw-line)) (> (-> obj curve num-cverts) 0))
|
||||
(add-debug-curve2
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as curve (&-> obj cverts))
|
||||
(new 'static 'rgba :r #xff :g #x80 :a #x80)
|
||||
#f
|
||||
)
|
||||
)
|
||||
(dotimes (s5-1 (-> obj curve num-cverts))
|
||||
(let ((s4-1 (-> obj cverts s5-1)))
|
||||
(if (logtest? (-> obj flags) (path-control-flag draw-point))
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf) s4-1 (new 'static 'rgba :r #xff :a #x80))
|
||||
)
|
||||
(when (logtest? (-> obj flags) (path-control-flag draw-text))
|
||||
(let ((s3-1 add-debug-text-3d)
|
||||
(s2-1 #t)
|
||||
(s1-0 68)
|
||||
)
|
||||
(format (clear *temp-string*) "~D" s5-1)
|
||||
(s3-1 s2-1 (the-as bucket-id s1-0) *temp-string* s4-1 (font-color orange) (the-as vector2h #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
2
test/decompiler/reference/jak1/engine/target/logic-target_REF.gc
generated
vendored
2
test/decompiler/reference/jak1/engine/target/logic-target_REF.gc
generated
vendored
|
@ -567,7 +567,7 @@
|
|||
(if (logtest? (-> self control unknown-surface01 flags) (surface-flags no-turn-around))
|
||||
(set! (-> v1-6 0) (the-as uint (current-time)))
|
||||
)
|
||||
(and (time-elapsed? (the-as int (-> v1-6 0)) (seconds 1))
|
||||
(and (>= (the-as uint (- (current-time) (the-as int (-> v1-6 0)))) (the-as uint 300))
|
||||
(< f0-1 0.0)
|
||||
(< 32768.0 f1-1)
|
||||
(< 0.7 (-> self control unknown-float20))
|
||||
|
|
4
test/decompiler/reference/jak1/engine/target/target2_REF.gc
generated
vendored
4
test/decompiler/reference/jak1/engine/target/target2_REF.gc
generated
vendored
|
@ -1422,7 +1422,7 @@
|
|||
)
|
||||
(ja-no-eval :group! eichar-yellow-running-blast-ja :num! (seek!) :frame-num (ja-aframe (the-as float 9.0) 0))
|
||||
(until (ja-done? 0)
|
||||
(if (or (not (time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.1)))
|
||||
(if (or (< (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 30))
|
||||
(= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
(send-event (handle->process gp-0) 'die)
|
||||
|
@ -2119,7 +2119,7 @@
|
|||
)
|
||||
(cond
|
||||
((= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0)
|
||||
(if (time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.05))
|
||||
(if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 15))
|
||||
(go target-swim-stance)
|
||||
)
|
||||
)
|
||||
|
|
8
test/decompiler/reference/jak1/engine/target/target_REF.gc
generated
vendored
8
test/decompiler/reference/jak1/engine/target/target_REF.gc
generated
vendored
|
@ -2063,7 +2063,7 @@
|
|||
#t
|
||||
)
|
||||
(or (zero? (-> self control unknown-uint20))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
(!= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
|
@ -2148,13 +2148,13 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
)
|
||||
(go target-falling #f)
|
||||
)
|
||||
((and (nonzero? (-> self control unknown-uint30))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 12))
|
||||
)
|
||||
(set-forward-vel (the-as float 0.0))
|
||||
)
|
||||
|
@ -2872,7 +2872,7 @@
|
|||
(set! gp-0 (the-as int (current-time)))
|
||||
)
|
||||
(when (and (or (smack-surface? #f) (>= (-> self control unknown-float63) 0.7))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.01))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 3))
|
||||
(time-elapsed? (-> self state-time) 1)
|
||||
)
|
||||
(if (>= 6.0 (ja-aframe-num 0))
|
||||
|
|
6
test/decompiler/reference/jak1/levels/flut_common/target-flut_REF.gc
generated
vendored
6
test/decompiler/reference/jak1/levels/flut_common/target-flut_REF.gc
generated
vendored
|
@ -1298,7 +1298,7 @@
|
|||
#t
|
||||
)
|
||||
(or (zero? (-> self control unknown-uint20))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
(!= (-> self control unknown-uint31) 1)
|
||||
)
|
||||
|
@ -1349,13 +1349,13 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint20)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint20)))) (the-as uint 12))
|
||||
)
|
||||
)
|
||||
(go target-flut-falling #f)
|
||||
)
|
||||
((and (nonzero? (-> self control unknown-uint30))
|
||||
(time-elapsed? (the-as int (-> self control unknown-uint30)) (seconds 0.04))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-uint30)))) (the-as uint 12))
|
||||
)
|
||||
(set-forward-vel (the-as float 0.0))
|
||||
(set! f30-0 0.0)
|
||||
|
|
2
test/decompiler/reference/jak2/engine/target/logic-target_REF.gc
generated
vendored
2
test/decompiler/reference/jak2/engine/target/logic-target_REF.gc
generated
vendored
|
@ -628,7 +628,7 @@
|
|||
(if (logtest? (-> self control current-surface flags) (surface-flag no-turn-around))
|
||||
(set-time! (-> v1-7 0))
|
||||
)
|
||||
(and (time-elapsed? (-> v1-7 0) (seconds 1))
|
||||
(and (>= (the-as uint (- (current-time) (-> v1-7 0))) (the-as uint 300))
|
||||
(< f0-1 0.0)
|
||||
(< 32768.0 f1-1)
|
||||
(< 0.7 (-> self control pad-magnitude))
|
||||
|
|
2
test/decompiler/reference/jak2/engine/target/target-swim_REF.gc
generated
vendored
2
test/decompiler/reference/jak2/engine/target/target-swim_REF.gc
generated
vendored
|
@ -552,7 +552,7 @@
|
|||
)
|
||||
(cond
|
||||
((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0)
|
||||
(if (time-elapsed? (the-as int (-> self control unknown-word04)) (seconds 0.05))
|
||||
(if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 15))
|
||||
(go target-swim-stance)
|
||||
)
|
||||
)
|
||||
|
|
2
test/decompiler/reference/jak2/engine/target/target_REF.gc
generated
vendored
2
test/decompiler/reference/jak2/engine/target/target_REF.gc
generated
vendored
|
@ -3643,7 +3643,7 @@
|
|||
(set! (-> self gun combo-window-state) (-> self state name))
|
||||
)
|
||||
(when (and (or (smack-surface? #f) (>= (-> self control surface-slope-z) 0.7))
|
||||
(time-elapsed? (the-as int (-> self control unknown-word04)) (seconds 0.01))
|
||||
(>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 3))
|
||||
(time-elapsed? (-> self state-time) 1)
|
||||
)
|
||||
(when (>= 6.0 (ja-aframe-num 0))
|
||||
|
|
2
test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc
generated
vendored
2
test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc
generated
vendored
|
@ -656,7 +656,7 @@
|
|||
)
|
||||
)
|
||||
(((race-state-enum countdown-scene-start))
|
||||
(when (time-elapsed? (the-as int (-> this countdown-start-time)) (seconds 1))
|
||||
(when (>= (the-as uint (- (current-time) (the-as int (-> this countdown-start-time)))) (the-as uint 300))
|
||||
(set! (-> this state) (race-state-enum countdown-scene))
|
||||
(set! (-> this scene-player)
|
||||
(ppointer->handle (process-spawn scene-player :init scene-player-init (-> this info countdown-scene) #t #f))
|
||||
|
|
Loading…
Reference in a new issue