[decompiler] recognize more inlined vector functions (#637)

* detect vector+

* recognize reset
This commit is contained in:
water111 2021-06-27 12:11:30 -04:00 committed by GitHub
parent b19a2c82f0
commit bfb1fbe1fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 592 additions and 797 deletions

View file

@ -3911,32 +3911,14 @@ Form* repop_arg(Form* in, FormStack& stack, const Env& env, FormPool& pool) {
*/ */
Form* repop_passthrough_arg(Form* in, Form* repop_passthrough_arg(Form* in,
FormStack& stack, FormStack& stack,
const Env& env,
RegisterAccess* orig_out, RegisterAccess* orig_out,
bool* found_orig_out) { bool* found_orig_out) {
*found_orig_out = false; *found_orig_out = false;
auto as_atom = form_as_atom(in); auto as_atom = form_as_atom(in);
if (as_atom && as_atom->is_var()) { if (as_atom && as_atom->is_var()) {
// get the last active thing on the stack and see if its what we want. return stack.pop_reg(as_atom->var().reg(), {}, env, true, -1, orig_out, found_orig_out);
auto last_in_stack = stack.active_back();
if (!last_in_stack) {
return in;
}
if (!last_in_stack->destination) {
return in;
}
if (last_in_stack->destination->reg() != as_atom->var().reg()) {
return in;
}
// the x regaccess
*orig_out = *last_in_stack->destination;
auto val = last_in_stack->source;
*found_orig_out = true;
stack.pop_active_back();
return val;
} }
return in; return in;
} }
@ -3955,39 +3937,56 @@ std::optional<RegisterAccess> form_as_ra(Form* form) {
/*! /*!
* Handle an inlined call to vector-! * Handle an inlined call to vector-!
*/ */
bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) { bool try_vector_add_sub_inline(const Env& env,
// we are looking for 5 ops, none are sets FormPool& pool,
auto elts = stack.try_getting_active_stack_entries({false, false, false, false, false}); FormStack& stack,
bool is_add,
FormElement* store_element) {
// we are looking for 5 ops, none are sets, the store element is passed in separately, before
// propagating
auto elts = stack.try_getting_active_stack_entries({false, false, false, false});
if (!elts) { if (!elts) {
return false; return false;
} }
int idx = 0;
if (is_add) {
// third (.vmove.w vf6 vf0)
if (!is_set_w_1(Register(Reg::VF, 6), elts->at(idx++).elt, env)) {
return false;
}
}
// check first: (.lvf vf4 (&-> arg1 quad)) // check first: (.lvf vf4 (&-> arg1 quad))
auto first = is_load_store_vector_to_reg(Register(Reg::VF, 4), elts->at(0).elt, true, nullptr); auto first =
is_load_store_vector_to_reg(Register(Reg::VF, 4), elts->at(idx++).elt, true, nullptr);
if (!first) { if (!first) {
return false; return false;
} }
// second (.lvf vf5 (&-> a0-1 quad)) // second (.lvf vf5 (&-> a0-1 quad))
auto second = is_load_store_vector_to_reg(Register(Reg::VF, 5), elts->at(1).elt, true, nullptr); auto second =
is_load_store_vector_to_reg(Register(Reg::VF, 5), elts->at(idx++).elt, true, nullptr);
if (!second) { if (!second) {
return false; return false;
} }
if (!is_add) {
// third (.vmove.w vf6 vf0) // third (.vmove.w vf6 vf0)
if (!is_set_w_1(Register(Reg::VF, 6), elts->at(2).elt, env)) { if (!is_set_w_1(Register(Reg::VF, 6), elts->at(idx++).elt, env)) {
return false; return false;
} }
}
// 4th (.vsub.xyz vf6 vf4 vf5) // 4th (.vsub.xyz vf6 vf4 vf5)
if (!is_vf_3op_dst(InstructionKind::VSUB, 14, vfr(6), vfr(4), vfr(5), elts->at(3).elt)) { if (!is_vf_3op_dst(is_add ? InstructionKind::VADD : InstructionKind::VSUB, 14, vfr(6), vfr(4),
vfr(5), elts->at(idx++).elt)) {
return false; return false;
} }
// 5th (and remember the index) // 5th (and remember the index)
int store_idx = -1; int store_idx = -1;
auto store = auto store = is_load_store_vector_to_reg(Register(Reg::VF, 6), store_element, false, &store_idx);
is_load_store_vector_to_reg(Register(Reg::VF, 6), elts->at(4).elt, false, &store_idx);
if (!store) { if (!store) {
return false; return false;
} }
@ -3997,12 +3996,12 @@ bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) {
// the function that attempts the pop. // the function that attempts the pop.
auto store_var = form_as_ra(store); auto store_var = form_as_ra(store);
if (!store_var) { if (!store_var) {
env.func->warnings.general_warning("Almost found vector sub, but couldn't get store var."); env.func->warnings.general_warning("Almost found vector add/sub, but couldn't get store var.");
return false; return false;
} }
// remove these from the stack. // remove these from the stack.
stack.pop(5); stack.pop(4);
// ignore the store as a use. This will allow the entire vector-! expression to be expression // ignore the store as a use. This will allow the entire vector-! expression to be expression
// propagated, if it is appropriate. // propagated, if it is appropriate.
@ -4019,13 +4018,14 @@ bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) {
// now try to see if we can pop the first arg (destination vector). // now try to see if we can pop the first arg (destination vector).
bool got_orig = false; bool got_orig = false;
RegisterAccess orig; RegisterAccess orig;
store = repop_passthrough_arg(store, stack, &orig, &got_orig);
store = repop_passthrough_arg(store, stack, env, &orig, &got_orig);
// create the actual vector-! form // create the actual vector-! form
Form* new_thing = pool.alloc_single_element_form<GenericElement>( Form* new_thing = pool.alloc_single_element_form<GenericElement>(
nullptr, nullptr,
GenericOperator::make_function( GenericOperator::make_function(pool.alloc_single_element_form<ConstantTokenElement>(
pool.alloc_single_element_form<ConstantTokenElement>(nullptr, "vector-!")), nullptr, is_add ? "vector+!" : "vector-!")),
std::vector<Form*>{store, first, second}); std::vector<Form*>{store, first, second});
if (got_orig) { if (got_orig) {
@ -4047,7 +4047,73 @@ bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) {
stack.push_form_element(new_thing->elts().at(0), true); stack.push_form_element(new_thing->elts().at(0), true);
} }
return true;
}
bool try_vector_reset_inline(const Env& env,
FormPool& pool,
FormStack& stack,
FormElement* store_element) {
// the store
int store_idx = -1;
auto store = is_load_store_vector_to_reg(Register(Reg::VF, 0), store_element, false, &store_idx);
if (!store) {
return false; return false;
}
// remove these from the stack.
// stack.pop(1);
// the store here _should_ have failed propagation and just given us a variable.
// if this is causing issues, we can run this check before propagating, as well call this from
// the function that attempts the pop.
auto store_var = form_as_ra(store);
if (!store_var) {
env.func->warnings.general_warning("Almost found vector reset, but couldn't get store var.");
// stack.push_form_element(new_thing->elts().at(0), true);
return false;
}
// ignore the store as a use. This will allow the entire vector-! expression to be expression
// propagated, if it is appropriate.
if (store_var) {
auto menv = const_cast<Env*>(&env);
menv->disable_use(*store_var);
}
// now try to see if we can pop the first arg (destination vector).
bool got_orig = false;
RegisterAccess orig;
store = repop_passthrough_arg(store, stack, env, &orig, &got_orig);
// create the actual form
Form* new_thing = pool.alloc_single_element_form<GenericElement>(
nullptr,
GenericOperator::make_function(
pool.alloc_single_element_form<ConstantTokenElement>(nullptr, "vector-reset!")),
std::vector<Form*>{store});
if (got_orig) {
// we got a value for the destination. because we used the special repop passthrough,
// we're responsible for inserting a set to set the var that we "stole" from.
// We do this through push_value_to_reg, so it can be propagated if needed, but only if
// somebody will actually read the output.
// to tell, we look at the live out of the store op and the end - the earlier one would of
// course be live out always because the store will read it again.
auto& op_info = env.reg_use().op.at(store_idx);
if (op_info.live.find(orig.reg()) == op_info.live.end()) {
// nobody reads it, don't bother.
stack.push_form_element(new_thing->elts().at(0), true);
} else {
stack.push_value_to_reg(orig, new_thing, true, TypeSpec("vector"));
}
} else {
stack.push_form_element(new_thing->elts().at(0), true);
}
return true;
} }
} // namespace } // namespace
@ -4060,15 +4126,33 @@ void VectorFloatLoadStoreElement::push_to_stack(const Env& env, FormPool& pool,
auto atom = form_as_atom(root); auto atom = form_as_atom(root);
if (atom && atom->get_kind() == SimpleAtom::Kind::VARIABLE) { if (atom && atom->get_kind() == SimpleAtom::Kind::VARIABLE) {
m_addr_type = env.get_variable_type(atom->var(), true); m_addr_type = env.get_variable_type(atom->var(), true);
}
}
auto name = env.func->guessed_name.to_string();
// don't find vector-! inside of vector-!.
if (!m_is_load && name != "vector-!" && name != "vector+!" && name != "vector-reset!") {
if (try_vector_add_sub_inline(env, pool, stack, true, this)) {
return;
}
if (try_vector_add_sub_inline(env, pool, stack, false, this)) {
return;
}
if (try_vector_reset_inline(env, pool, stack, this)) {
return;
}
}
if (loc_as_deref) {
auto root = loc_as_deref->base();
auto atom = form_as_atom(root);
if (atom && atom->get_kind() == SimpleAtom::Kind::VARIABLE) {
loc_as_deref->set_base(pop_to_forms({atom->var()}, env, pool, stack, true).at(0)); loc_as_deref->set_base(pop_to_forms({atom->var()}, env, pool, stack, true).at(0));
} }
} }
stack.push_form_element(this, true); stack.push_form_element(this, true);
// don't find vector-! inside of vector-!.
if (!m_is_load && env.func->guessed_name.to_string() != "vector-!") {
try_vector_sub_inline(env, pool, stack);
}
} }
void MethodOfTypeElement::update_from_stack(const Env& env, void MethodOfTypeElement::update_from_stack(const Env& env,

View file

@ -131,7 +131,12 @@ Form* FormStack::pop_reg(Register reg,
const RegSet& barrier, const RegSet& barrier,
const Env& env, const Env& env,
bool allow_side_effects, bool allow_side_effects,
int begin_idx) { int begin_idx,
RegisterAccess* orig_out,
bool* found_orig_out) {
if (found_orig_out) {
*found_orig_out = false;
}
assert(allow_side_effects); assert(allow_side_effects);
(void)env; // keep this for easy debugging. (void)env; // keep this for easy debugging.
RegSet modified; RegSet modified;
@ -158,9 +163,18 @@ Form* FormStack::pop_reg(Register reg,
assert(entry.sequence_point == false); assert(entry.sequence_point == false);
auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i); auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i);
if (result) { if (result) {
if (found_orig_out) {
*found_orig_out = true;
*orig_out = *entry.destination;
}
return result; return result;
} }
} }
if (found_orig_out) {
*found_orig_out = true;
*orig_out = *entry.destination;
}
return entry.source; return entry.source;
} else { } else {
// we didn't match // we didn't match

View file

@ -39,7 +39,9 @@ class FormStack {
const RegSet& barrier, const RegSet& barrier,
const Env& env, const Env& env,
bool allow_side_effects, bool allow_side_effects,
int begin_idx = -1); int begin_idx = -1,
RegisterAccess* orig_out = nullptr,
bool* found_orig_out = nullptr);
FormElement* pop_back(FormPool& pool); FormElement* pop_back(FormPool& pool);
bool is_single_expression(); bool is_single_expression();
std::vector<FormElement*> rewrite(FormPool& pool, const Env& env) const; std::vector<FormElement*> rewrite(FormPool& pool, const Env& env) const;

View file

@ -5,24 +5,19 @@
;; name in dgo: cam-interface ;; name in dgo: cam-interface
;; dgos: GAME, ENGINE ;; dgos: GAME, ENGINE
(rlet ((vf0 :class vf))
(init-vf0-vector)
;; definition for function position-in-front-of-camera! ;; definition for function position-in-front-of-camera!
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float)) (defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((v1-0 arg0)) (let ((v1-0 arg0))
(let ((a0-2 (&-> *math-camera* inv-camera-rot data 8)) (let ((a0-2 (-> *math-camera* inv-camera-rot vector 2))
(f0-0 arg1) (f0-0 arg1)
) )
(.lvf vf1 a0-2) (.lvf vf1 (&-> a0-2 quad))
(let ((a0-3 f0-0)) (let ((a0-3 f0-0))
(.mov vf2 a0-3) (.mov vf2 a0-3)
) )
@ -31,23 +26,8 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-0 quad) vf1) (.svf (&-> v1-0 quad) vf1)
) )
(vector+float*! (vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
arg0 (vector+! arg0 arg0 (-> *math-camera* trans))
arg0
(the-as vector (&-> *math-camera* inv-camera-rot data 4))
arg2
)
(let ((a0-5 arg0))
(let ((v1-3 arg0)
(a1-3 (-> *math-camera* trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-3 quad))
(.lvf vf5 (&-> a1-3 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-5 quad) vf6)
)
arg0 arg0
) )
) )
@ -65,13 +45,7 @@
(-> *math-camera* camera-rot) (-> *math-camera* camera-rot)
) )
;; failed to figure out what this is: (define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
(when (or (not *camera-dummy-vector*) (zero? *camera-dummy-vector*))
(let ((v1-8 (new 'global 'vector)))
(.svf (&-> v1-8 quad) vf0)
(set! *camera-dummy-vector* v1-8)
)
)
;; definition for function camera-pos ;; definition for function camera-pos
;; INFO: Return type mismatch object vs vector. ;; INFO: Return type mismatch object vs vector.
@ -126,4 +100,3 @@
(none) (none)
) )
) )
)

View file

@ -216,37 +216,31 @@
;; INFO: Return type mismatch int vs none. ;; INFO: Return type mismatch int vs none.
;; Used lq/sq ;; Used lq/sq
(defmethod TODO-RENAME-9 cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) (defmethod TODO-RENAME-9 cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(cond (cond
(arg0 (arg0
(set! (-> obj target quad) (-> arg0 quad)) (set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad)) (set! (-> obj value quad) (-> arg0 quad))
) )
(else (else
(.svf (&-> (-> obj target) quad) vf0) (vector-reset! (-> obj target))
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
) )
) )
(.svf (&-> (-> obj vel) quad) vf0) (vector-reset! (-> obj vel))
(set! (-> obj accel) arg1) (set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2) (set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3) (set! (-> obj max-partial) arg3)
(let ((v0-0 0))
)
(none) (none)
) )
)
;; definition for method 10 of type cam-vector-seeker ;; definition for method 10 of type cam-vector-seeker
;; INFO: Return type mismatch int vs none. ;; INFO: Return type mismatch int vs none.
;; TODO - vector-float*! replacement
(defmethod TODO-RENAME-10 cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector)) (defmethod TODO-RENAME-10 cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector))
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((gp-0 (new 'stack-no-clear 'vector))) (let ((gp-0 (new 'stack-no-clear 'vector)))
@ -254,15 +248,7 @@
) )
(cond (cond
(arg0 (arg0
(let ((a0-1 gp-0)) (vector+! gp-0 (-> obj target) arg0)
(let ((v1-0 (-> obj target)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
)
(.lvf vf5 (&-> arg0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111) ;; todo add
(.svf (&-> a0-1 quad) vf6)
)
(vector-! gp-0 gp-0 (-> obj value)) (vector-! gp-0 gp-0 (-> obj value))
) )
(else (else
@ -283,17 +269,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1) (.svf (&-> v1-3 quad) vf1)
) )
(let ((a1-4 (-> obj vel))) (vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((v1-4 (-> obj vel))
(a0-7 gp-0)
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-4 quad))
(.lvf vf5 (&-> a0-7 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-4 quad) vf6)
)
(let ((f0-4 (vector-length (-> obj vel))) (let ((f0-4 (vector-length (-> obj vel)))
(f1-2 (fmin f30-1 (-> obj max-vel))) (f1-2 (fmin f30-1 (-> obj max-vel)))
) )
@ -327,15 +303,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-7 quad) vf1) (.svf (&-> v1-7 quad) vf1)
) )
(let ((v1-8 (-> obj value))) (vector+! (-> obj value) (-> obj value) gp-0)
(let ((a0-13 (-> obj value)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> a0-13 quad))
)
(.lvf vf5 (&-> gp-0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> v1-8 quad) vf6)
)
) )
(let ((v0-2 0)) (let ((v0-2 0))
) )

View file

@ -277,6 +277,32 @@
math-cam math-cam
) )
(defmethod new math-camera ((allocation symbol) (type-to-make type))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> gp-0 d) 1024.0)
(set! (-> gp-0 f) 40960000.0)
(set! (-> gp-0 fov) 11650.845)
(set! (-> gp-0 x-pix) 256.0)
(set! (-> gp-0 x-clip) 1024.0)
(set! (-> gp-0 y-pix) 112.0)
(set! (-> gp-0 y-clip) 448.0)
(set! (-> gp-0 fog-start) 40960.0)
(set! (-> gp-0 fog-end) 819200.0)
(set! (-> gp-0 fog-max) 255.0)
(set! (-> gp-0 fog-min) 150.0)
(matrix-identity! (-> gp-0 inv-camera-rot))
(matrix-identity! (-> gp-0 camera-rot))
(vector-reset! (-> gp-0 trans))
(set! (-> gp-0 isometric vector 0 x) 1.0)
(set! (-> gp-0 isometric vector 1 y) 0.5)
(set! (-> gp-0 isometric vector 2 z) -1.0)
(set! (-> gp-0 reset) 1)
(set! (-> gp-0 smooth-step) 0.0)
(set! (-> gp-0 smooth-t) 0.0)
(update-math-camera gp-0 'ntsc 'aspect4x3)
)
)
(define *math-camera* (new 'global 'math-camera)) (define *math-camera* (new 'global 'math-camera))
(defun math-cam-start-smoothing ((arg0 float) (arg1 float)) (defun math-cam-start-smoothing ((arg0 float) (arg1 float))

View file

@ -109,12 +109,6 @@
;; ERROR: function was not converted to expressions. Cannot decompile. ;; ERROR: function was not converted to expressions. Cannot decompile.
(defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float)) (defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat)))) (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(s5-0 (new-stack-vector0)) (s5-0 (new-stack-vector0))
) )
@ -126,17 +120,7 @@
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0)))) (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
) )
(set! (-> s5-0 w) 0.0) (set! (-> s5-0 w) 0.0)
(let ((a0-6 s5-0)) (vector+! s5-0 s5-0 (-> arg0 root trans))
(let ((v1-1 s5-0)
(a1-2 (-> arg0 root trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-1 quad))
(.lvf vf5 (&-> a1-2 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111) ;; todo vector+!
(.svf (&-> a0-6 quad) vf6)
)
(add-debug-sphere (add-debug-sphere
#t #t
(bucket-id debug-draw0) (bucket-id debug-draw0)
@ -147,7 +131,6 @@
) )
(none) (none)
) )
)
(defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float)) (defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float))
(let ((f30-0 0.0)) (let ((f30-0 0.0))

View file

@ -101,8 +101,6 @@
(defmethod set-mode! joint-mod ((obj joint-mod) (handler-mode joint-mod-handler-mode)) (defmethod set-mode! joint-mod ((obj joint-mod) (handler-mode joint-mod-handler-mode))
"Set up the joint-mod for the given mode. You can only pick one mode at a time." "Set up the joint-mod for the given mode. You can only pick one mode at a time."
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj mode) handler-mode) (set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint)) (let ((joint (-> obj joint))
(mode handler-mode) (mode handler-mode)
@ -112,7 +110,6 @@
(set! (-> joint param0) #f) (set! (-> joint param0) #f)
(set! (-> joint param1) #f) (set! (-> joint param1) #f)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
;; use flex-bend instead of bend.
(set! (-> obj blend) 0.0) (set! (-> obj blend) 0.0)
(set! (-> obj flex-blend) 1.0) (set! (-> obj flex-blend) 1.0)
) )
@ -120,7 +117,6 @@
(set! (-> joint param0) #f) (set! (-> joint param0) #f)
(set! (-> joint param1) #f) (set! (-> joint param1) #f)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
;; set blend to 0 for no effect.
(set! (-> obj blend) 0.0) (set! (-> obj blend) 0.0)
(set! (-> obj shutting-down?) #f) (set! (-> obj shutting-down?) #f)
) )
@ -144,7 +140,7 @@
(set! (-> joint param0) joint-mod-joint-set-handler) (set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj) (set! (-> joint param1) obj)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0) (vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat)) (quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale))) (let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0) (set! (-> v1-2 x) 1.0)
@ -158,7 +154,7 @@
(set! (-> joint param0) joint-mod-joint-set*-handler) (set! (-> joint param0) joint-mod-joint-set*-handler)
(set! (-> joint param1) obj) (set! (-> joint param1) obj)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0) (vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat)) (quaternion-identity! (-> obj quat))
(let ((v1-4 (-> obj scale))) (let ((v1-4 (-> obj scale)))
(set! (-> v1-4 x) 1.0) (set! (-> v1-4 x) 1.0)
@ -172,7 +168,6 @@
) )
obj obj
) )
)
(defmethod reset-blend! joint-mod ((obj joint-mod)) (defmethod reset-blend! joint-mod ((obj joint-mod))
"Reset the blend to 0." "Reset the blend to 0."
@ -676,30 +671,10 @@
;; todo vector+! ;; todo vector+!
(defun joint-mod-joint-set*-handler ((arg0 cspace) (arg1 transformq)) (defun joint-mod-joint-set*-handler ((arg0 cspace) (arg1 transformq))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (the-as joint-mod (-> arg0 param1)))) (let ((s5-0 (the-as joint-mod (-> arg0 param1))))
(let ((a1-1 (-> arg1 trans))) (vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(let ((v1-0 (-> arg1 trans))
(a0-1 (-> s5-0 trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
(.lvf vf5 (&-> a0-1 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-1 quad) vf6)
)
(quaternion-normalize! (quaternion-normalize!
(quaternion*! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))
(the-as quaternion (-> arg1 rot))
(the-as quaternion (-> arg1 rot))
(-> s5-0 quat)
)
) )
(vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale)) (vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale))
(cspace<-parented-transformq-joint! arg0 arg1) (cspace<-parented-transformq-joint! arg0 arg1)
@ -714,7 +689,6 @@
) )
(none) (none)
) )
)
(define *joint-axis-vectors* (define *joint-axis-vectors*
(new 'static 'inline-array vector 6 (new 'static 'inline-array vector 6

View file

@ -472,22 +472,16 @@
) )
;; definition for method 9 of type delayed-rand-vector ;; definition for method 9 of type delayed-rand-vector
(defmethod (defmethod dummy-9 delayed-rand-vector ((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
dummy-9
delayed-rand-vector
((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj min-time) arg0) (set! (-> obj min-time) arg0)
(set! (-> obj max-time) arg1) (set! (-> obj max-time) arg1)
(set! (-> obj xz-max) (* 0.5 arg2)) (set! (-> obj xz-max) (* 0.5 arg2))
(set! (-> obj y-max) (* 0.5 arg3)) (set! (-> obj y-max) (* 0.5 arg3))
(set! (-> obj start-time) (the-as uint 0)) (set! (-> obj start-time) (the-as uint 0))
(set! (-> obj timer) 0) (set! (-> obj timer) 0)
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
(-> obj value) (-> obj value)
) )
)
;; definition for method 10 of type delayed-rand-vector ;; definition for method 10 of type delayed-rand-vector
(defmethod dummy-10 delayed-rand-vector ((obj delayed-rand-vector)) (defmethod dummy-10 delayed-rand-vector ((obj delayed-rand-vector))
@ -522,77 +516,47 @@
;; definition for method 12 of type delayed-rand-vector ;; definition for method 12 of type delayed-rand-vector
(defmethod dummy-12 delayed-rand-vector ((obj delayed-rand-vector)) (defmethod dummy-12 delayed-rand-vector ((obj delayed-rand-vector))
(rlet ((vf0 :class vf)) (if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
(init-vf0-vector)
(if
(>=
(the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
(-> obj timer) (-> obj timer)
) )
(dummy-10 obj) (dummy-10 obj)
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
) )
(-> obj value) (-> obj value)
) )
)
;; definition for method 9 of type oscillating-vector ;; definition for method 9 of type oscillating-vector
;; Used lq/sq ;; Used lq/sq
(defmethod (defmethod dummy-9 oscillating-vector ((obj oscillating-vector) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
dummy-9
oscillating-vector
((obj oscillating-vector)
(arg0 vector)
(arg1 float)
(arg2 float)
(arg3 float)
)
(rlet ((vf0 :class vf))
(init-vf0-vector)
(cond (cond
(arg0 (arg0
(let ((v1-0 (-> obj value))) (set! (-> obj value quad) (-> arg0 quad))
(set! (-> v1-0 quad) (-> arg0 quad)) (set! (-> obj target quad) (-> arg0 quad))
)
(let ((v1-1 (-> obj target)))
(set! (-> v1-1 quad) (-> arg0 quad))
)
) )
(else (else
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
(.svf (&-> (-> obj target) quad) vf0) (vector-reset! (-> obj target))
) )
) )
(.svf (&-> (-> obj vel) quad) vf0) (vector-reset! (-> obj vel))
(set! (-> obj max-vel) arg2) (set! (-> obj max-vel) arg2)
(set! (-> obj damping) arg3) (set! (-> obj damping) arg3)
(set! (-> obj accel) arg1) (set! (-> obj accel) arg1)
(-> obj value) (-> obj value)
) )
)
;; definition for method 10 of type oscillating-vector ;; definition for method 10 of type oscillating-vector
;; todo vector-float*!
(defmethod dummy-10 oscillating-vector ((obj oscillating-vector) (arg0 vector)) (defmethod dummy-10 oscillating-vector ((obj oscillating-vector) (arg0 vector))
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector)))
(cond (cond
(arg0 (arg0
(let ((a0-1 s5-0)) (vector+! s5-0 (-> obj target) arg0)
(let ((v1-0 (-> obj target)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
)
(.lvf vf5 (&-> arg0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-1 quad) vf6)
)
(vector-! s5-0 s5-0 (-> obj value)) (vector-! s5-0 s5-0 (-> obj value))
) )
(else (else
@ -612,17 +576,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1) (.svf (&-> v1-3 quad) vf1)
) )
(let ((a1-4 (-> obj vel))) (vector+! (-> obj vel) (-> obj vel) s5-0)
(let ((v1-4 (-> obj vel))
(a0-6 s5-0)
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-4 quad))
(.lvf vf5 (&-> a0-6 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-4 quad) vf6)
)
(let ((f0-2 (vector-length (-> obj vel)))) (let ((f0-2 (vector-length (-> obj vel))))
(when (< (-> obj max-vel) f0-2) (when (< (-> obj max-vel) f0-2)
(let ((v1-6 (-> obj vel))) (let ((v1-6 (-> obj vel)))
@ -666,15 +620,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-8 quad) vf1) (.svf (&-> v1-8 quad) vf1)
) )
(let ((a0-14 (-> obj value))) (vector+! (-> obj value) (-> obj value) s5-0)
(let ((v1-9 (-> obj value)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-9 quad))
)
(.lvf vf5 (&-> s5-0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-14 quad) vf6)
)
) )
(-> obj value) (-> obj value)
) )

View file

@ -1,17 +1,11 @@
;;-*-Lisp-*- ;;-*-Lisp-*-
(in-package goal) (in-package goal)
(rlet ((vf0 :class vf))
(init-vf0-vector)
;; definition for function position-in-front-of-camera! ;; definition for function position-in-front-of-camera!
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float)) (defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((v1-0 arg0)) (let ((v1-0 arg0))
@ -28,17 +22,7 @@
(.svf (&-> v1-0 quad) vf1) (.svf (&-> v1-0 quad) vf1)
) )
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2) (vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
(let ((a0-5 arg0)) (vector+! arg0 arg0 (-> *math-camera* trans))
(let ((v1-3 arg0)
(a1-3 (-> *math-camera* trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-3 quad))
(.lvf vf5 (&-> a1-3 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-5 quad) vf6)
)
arg0 arg0
) )
) )
@ -56,13 +40,8 @@
(-> *math-camera* camera-rot) (-> *math-camera* camera-rot)
) )
;; failed to figure out what this is: ;; definition (perm) for symbol *camera-dummy-vector*, type vector
(when (or (not *camera-dummy-vector*) (zero? *camera-dummy-vector*)) (define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
(let ((v1-8 (new 'global 'vector)))
(.svf (&-> v1-8 quad) vf0)
(set! *camera-dummy-vector* v1-8)
)
)
;; definition for function camera-pos ;; definition for function camera-pos
;; INFO: Return type mismatch object vs vector. ;; INFO: Return type mismatch object vs vector.
@ -119,8 +98,3 @@
(none) (none)
) )
) )
;; failed to figure out what this is:
(none)
)

View file

@ -1,9 +1,6 @@
;;-*-Lisp-*- ;;-*-Lisp-*-
(in-package goal) (in-package goal)
(rlet ((vf0 :class vf))
(init-vf0-vector)
;; definition for symbol *external-cam-options*, type int ;; definition for symbol *external-cam-options*, type int
(define *external-cam-options* 0) (define *external-cam-options* 0)
@ -20,13 +17,8 @@
;; definition (perm) for symbol *camera-other-fov*, type bfloat ;; definition (perm) for symbol *camera-other-fov*, type bfloat
(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845)) (define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845))
;; failed to figure out what this is: ;; definition (perm) for symbol *camera-other-trans*, type vector
(when (or (not *camera-other-trans*) (zero? *camera-other-trans*)) (define-perm *camera-other-trans* vector (vector-reset! (new 'global 'vector)))
(let ((v1-15 (new 'global 'vector)))
(.svf (&-> v1-15 quad) vf0)
(set! *camera-other-trans* v1-15)
)
)
;; definition (perm) for symbol *camera-other-matrix*, type matrix ;; definition (perm) for symbol *camera-other-matrix*, type matrix
(define-perm *camera-other-matrix* matrix (define-perm *camera-other-matrix* matrix
@ -38,22 +30,9 @@
(set-zero! (new 'global 'smush-control)) (set-zero! (new 'global 'smush-control))
) )
;; failed to figure out what this is: ;; definition (perm) for symbol *camera-other-root*, type vector
(when (or (not *camera-other-root*) (zero? *camera-other-root*)) (define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
(let ((v1-34 (new 'global 'vector)))
(.svf (&-> v1-34 quad) vf0)
(set! *camera-other-root* v1-34)
)
)
;; failed to figure out what this is: ;; failed to figure out what this is:
(let ((v0-6 0)) (let ((v0-6 0))
) )
;; failed to figure out what this is:
(none)
)

View file

@ -344,19 +344,17 @@
TODO-RENAME-9 TODO-RENAME-9
cam-vector-seeker cam-vector-seeker
((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) ((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(cond (cond
(arg0 (arg0
(set! (-> obj target quad) (-> arg0 quad)) (set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad)) (set! (-> obj value quad) (-> arg0 quad))
) )
(else (else
(.svf (&-> (-> obj target) quad) vf0) (vector-reset! (-> obj target))
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
) )
) )
(.svf (&-> (-> obj vel) quad) vf0) (vector-reset! (-> obj vel))
(set! (-> obj accel) arg1) (set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2) (set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3) (set! (-> obj max-partial) arg3)
@ -364,7 +362,6 @@
) )
(none) (none)
) )
)
;; definition for method 10 of type cam-vector-seeker ;; definition for method 10 of type cam-vector-seeker
;; INFO: Return type mismatch int vs none. ;; INFO: Return type mismatch int vs none.
@ -375,9 +372,6 @@
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((gp-0 (new 'stack-no-clear 'vector))) (let ((gp-0 (new 'stack-no-clear 'vector)))
@ -385,15 +379,7 @@
) )
(cond (cond
(arg0 (arg0
(let ((a0-1 gp-0)) (vector+! gp-0 (-> obj target) arg0)
(let ((v1-0 (-> obj target)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
)
(.lvf vf5 (&-> arg0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-1 quad) vf6)
)
(vector-! gp-0 gp-0 (-> obj value)) (vector-! gp-0 gp-0 (-> obj value))
) )
(else (else
@ -414,17 +400,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1) (.svf (&-> v1-3 quad) vf1)
) )
(let ((a1-4 (-> obj vel))) (vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((v1-4 (-> obj vel))
(a0-7 gp-0)
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-4 quad))
(.lvf vf5 (&-> a0-7 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-4 quad) vf6)
)
(let ((f0-4 (vector-length (-> obj vel))) (let ((f0-4 (vector-length (-> obj vel)))
(f1-2 (fmin f30-1 (-> obj max-vel))) (f1-2 (fmin f30-1 (-> obj max-vel)))
) )
@ -458,15 +434,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-7 quad) vf1) (.svf (&-> v1-7 quad) vf1)
) )
(let ((v1-8 (-> obj value))) (vector+! (-> obj value) (-> obj value) gp-0)
(let ((a0-13 (-> obj value)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> a0-13 quad))
)
(.lvf vf5 (&-> gp-0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> v1-8 quad) vf6)
)
) )
(let ((v0-2 0)) (let ((v0-2 0))
) )

View file

@ -318,8 +318,6 @@
;; definition for method 0 of type math-camera ;; definition for method 0 of type math-camera
(defmethod new math-camera ((allocation symbol) (type-to-make type)) (defmethod new math-camera ((allocation symbol) (type-to-make type))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(let (let
((gp-0 ((gp-0
(object-new allocation type-to-make (the-as int (-> type-to-make size))) (object-new allocation type-to-make (the-as int (-> type-to-make size)))
@ -338,7 +336,7 @@
(set! (-> gp-0 fog-min) 150.0) (set! (-> gp-0 fog-min) 150.0)
(matrix-identity! (-> gp-0 inv-camera-rot)) (matrix-identity! (-> gp-0 inv-camera-rot))
(matrix-identity! (-> gp-0 camera-rot)) (matrix-identity! (-> gp-0 camera-rot))
(.svf (&-> (-> gp-0 trans) quad) vf0) (vector-reset! (-> gp-0 trans))
(set! (-> gp-0 isometric vector 0 x) 1.0) (set! (-> gp-0 isometric vector 0 x) 1.0)
(set! (-> gp-0 isometric vector 1 y) 0.5) (set! (-> gp-0 isometric vector 1 y) 0.5)
(set! (-> gp-0 isometric vector 2 z) -1.0) (set! (-> gp-0 isometric vector 2 z) -1.0)
@ -348,7 +346,6 @@
(update-math-camera gp-0 'ntsc 'aspect4x3) (update-math-camera gp-0 'ntsc 'aspect4x3)
) )
) )
)
;; definition for symbol *math-camera*, type math-camera ;; definition for symbol *math-camera*, type math-camera
(define *math-camera* (new 'global 'math-camera)) (define *math-camera* (new 'global 'math-camera))
@ -366,12 +363,6 @@
;; definition for function move-target-from-pad ;; definition for function move-target-from-pad
;; Used lq/sq ;; Used lq/sq
(defun move-target-from-pad ((trans transform) (pad-idx int)) (defun move-target-from-pad ((trans transform) (pad-idx int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((local-trans (new-stack-vector0))) (let ((local-trans (new-stack-vector0)))
(set! (-> local-trans x) (cond (set! (-> local-trans x) (cond
((nonzero? ((nonzero?
@ -426,15 +417,7 @@
(matrix-rotate-zyx! cam-rot-mat (-> trans rot)) (matrix-rotate-zyx! cam-rot-mat (-> trans rot))
(vector-matrix*! local-trans local-trans cam-rot-mat) (vector-matrix*! local-trans local-trans cam-rot-mat)
) )
(let ((a0-8 (-> trans trans))) (vector+! (-> trans trans) (-> trans trans) local-trans)
(let ((v1-23 (-> trans trans)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-23 quad))
)
(.lvf vf5 (&-> local-trans quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-8 quad) vf6)
)
) )
(set! (-> trans trans w) 1.0) (set! (-> trans trans w) 1.0)
(if (if
@ -457,10 +440,7 @@
) )
(if (if
(nonzero? (nonzero?
(logand (logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons triangle))
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons triangle)
)
) )
(set! (-> trans rot x) (+ -546.13336 (-> trans rot x))) (set! (-> trans rot x) (+ -546.13336 (-> trans rot x)))
) )
@ -478,7 +458,6 @@
) )
trans trans
) )
)
;; definition for function transform-point-vector! ;; definition for function transform-point-vector!
;; WARN: Inline assembly instruction marked with TODO - [TODO.VCLIP] ;; WARN: Inline assembly instruction marked with TODO - [TODO.VCLIP]

View file

@ -141,12 +141,6 @@
(defun-debug (defun-debug
ripple-add-debug-sphere ripple-add-debug-sphere
((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float)) ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat)))) (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(s5-0 (new-stack-vector0)) (s5-0 (new-stack-vector0))
) )
@ -158,17 +152,7 @@
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0)))) (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
) )
(set! (-> s5-0 w) 0.0) (set! (-> s5-0 w) 0.0)
(let ((a0-6 s5-0)) (vector+! s5-0 s5-0 (-> arg0 root trans))
(let ((v1-1 s5-0)
(a1-2 (-> arg0 root trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-1 quad))
(.lvf vf5 (&-> a1-2 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-6 quad) vf6)
)
(add-debug-sphere (add-debug-sphere
#t #t
(bucket-id debug-draw0) (bucket-id debug-draw0)
@ -179,7 +163,6 @@
) )
(none) (none)
) )
)
;; definition for function ripple-slow-add-sine-waves ;; definition for function ripple-slow-add-sine-waves
(defun (defun

View file

@ -112,8 +112,6 @@
set-mode! set-mode!
joint-mod joint-mod
((obj joint-mod) (handler-mode joint-mod-handler-mode)) ((obj joint-mod) (handler-mode joint-mod-handler-mode))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj mode) handler-mode) (set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint)) (let ((joint (-> obj joint))
(mode handler-mode) (mode handler-mode)
@ -153,7 +151,7 @@
(set! (-> joint param0) joint-mod-joint-set-handler) (set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj) (set! (-> joint param1) obj)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0) (vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat)) (quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale))) (let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0) (set! (-> v1-2 x) 1.0)
@ -167,7 +165,7 @@
(set! (-> joint param0) joint-mod-joint-set*-handler) (set! (-> joint param0) joint-mod-joint-set*-handler)
(set! (-> joint param1) obj) (set! (-> joint param1) obj)
(set! (-> joint param2) #f) (set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0) (vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat)) (quaternion-identity! (-> obj quat))
(let ((v1-4 (-> obj scale))) (let ((v1-4 (-> obj scale)))
(set! (-> v1-4 x) 1.0) (set! (-> v1-4 x) 1.0)
@ -181,7 +179,6 @@
) )
obj obj
) )
)
;; definition for method 12 of type joint-mod ;; definition for method 12 of type joint-mod
(defmethod reset-blend! joint-mod ((obj joint-mod)) (defmethod reset-blend! joint-mod ((obj joint-mod))
@ -742,24 +739,8 @@
;; definition for function joint-mod-joint-set*-handler ;; definition for function joint-mod-joint-set*-handler
;; INFO: Return type mismatch int vs none. ;; INFO: Return type mismatch int vs none.
(defun joint-mod-joint-set*-handler ((arg0 cspace) (arg1 transformq)) (defun joint-mod-joint-set*-handler ((arg0 cspace) (arg1 transformq))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (the-as joint-mod (-> arg0 param1)))) (let ((s5-0 (the-as joint-mod (-> arg0 param1))))
(let ((a1-1 (-> arg1 trans))) (vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(let ((v1-0 (-> arg1 trans))
(a0-1 (-> s5-0 trans))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
(.lvf vf5 (&-> a0-1 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-1 quad) vf6)
)
(quaternion-normalize! (quaternion-normalize!
(quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat)) (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))
) )
@ -778,7 +759,6 @@
) )
(none) (none)
) )
)
;; definition for symbol *joint-axis-vectors*, type (inline-array vector) ;; definition for symbol *joint-axis-vectors*, type (inline-array vector)
(define (define

View file

@ -471,18 +471,15 @@
dummy-9 dummy-9
delayed-rand-vector delayed-rand-vector
((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float)) ((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj min-time) arg0) (set! (-> obj min-time) arg0)
(set! (-> obj max-time) arg1) (set! (-> obj max-time) arg1)
(set! (-> obj xz-max) (* 0.5 arg2)) (set! (-> obj xz-max) (* 0.5 arg2))
(set! (-> obj y-max) (* 0.5 arg3)) (set! (-> obj y-max) (* 0.5 arg3))
(set! (-> obj start-time) (the-as uint 0)) (set! (-> obj start-time) (the-as uint 0))
(set! (-> obj timer) 0) (set! (-> obj timer) 0)
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
(-> obj value) (-> obj value)
) )
)
;; definition for method 10 of type delayed-rand-vector ;; definition for method 10 of type delayed-rand-vector
(defmethod dummy-10 delayed-rand-vector ((obj delayed-rand-vector)) (defmethod dummy-10 delayed-rand-vector ((obj delayed-rand-vector))
@ -517,19 +514,16 @@
;; definition for method 12 of type delayed-rand-vector ;; definition for method 12 of type delayed-rand-vector
(defmethod dummy-12 delayed-rand-vector ((obj delayed-rand-vector)) (defmethod dummy-12 delayed-rand-vector ((obj delayed-rand-vector))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(if (if
(>= (>=
(the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
(-> obj timer) (-> obj timer)
) )
(dummy-10 obj) (dummy-10 obj)
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
) )
(-> obj value) (-> obj value)
) )
)
;; definition for method 9 of type oscillating-vector ;; definition for method 9 of type oscillating-vector
;; Used lq/sq ;; Used lq/sq
@ -542,48 +536,34 @@
(arg2 float) (arg2 float)
(arg3 float) (arg3 float)
) )
(rlet ((vf0 :class vf))
(init-vf0-vector)
(cond (cond
(arg0 (arg0
(set! (-> obj value quad) (-> arg0 quad)) (set! (-> obj value quad) (-> arg0 quad))
(set! (-> obj target quad) (-> arg0 quad)) (set! (-> obj target quad) (-> arg0 quad))
) )
(else (else
(.svf (&-> (-> obj value) quad) vf0) (vector-reset! (-> obj value))
(.svf (&-> (-> obj target) quad) vf0) (vector-reset! (-> obj target))
) )
) )
(.svf (&-> (-> obj vel) quad) vf0) (vector-reset! (-> obj vel))
(set! (-> obj max-vel) arg2) (set! (-> obj max-vel) arg2)
(set! (-> obj damping) arg3) (set! (-> obj damping) arg3)
(set! (-> obj accel) arg1) (set! (-> obj accel) arg1)
(-> obj value) (-> obj value)
) )
)
;; definition for method 10 of type oscillating-vector ;; definition for method 10 of type oscillating-vector
(defmethod dummy-10 oscillating-vector ((obj oscillating-vector) (arg0 vector)) (defmethod dummy-10 oscillating-vector ((obj oscillating-vector) (arg0 vector))
(rlet ((vf0 :class vf) (rlet ((vf0 :class vf)
(vf1 :class vf) (vf1 :class vf)
(vf2 :class vf) (vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
) )
(init-vf0-vector) (init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector)))
(cond (cond
(arg0 (arg0
(let ((a0-1 s5-0)) (vector+! s5-0 (-> obj target) arg0)
(let ((v1-0 (-> obj target)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-0 quad))
)
(.lvf vf5 (&-> arg0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-1 quad) vf6)
)
(vector-! s5-0 s5-0 (-> obj value)) (vector-! s5-0 s5-0 (-> obj value))
) )
(else (else
@ -603,17 +583,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1) (.svf (&-> v1-3 quad) vf1)
) )
(let ((a1-4 (-> obj vel))) (vector+! (-> obj vel) (-> obj vel) s5-0)
(let ((v1-4 (-> obj vel))
(a0-6 s5-0)
)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-4 quad))
(.lvf vf5 (&-> a0-6 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-4 quad) vf6)
)
(let ((f0-2 (vector-length (-> obj vel)))) (let ((f0-2 (vector-length (-> obj vel))))
(when (< (-> obj max-vel) f0-2) (when (< (-> obj max-vel) f0-2)
(let ((v1-6 (-> obj vel))) (let ((v1-6 (-> obj vel)))
@ -657,15 +627,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-8 quad) vf1) (.svf (&-> v1-8 quad) vf1)
) )
(let ((a0-14 (-> obj value))) (vector+! (-> obj value) (-> obj value) s5-0)
(let ((v1-9 (-> obj value)))
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> v1-9 quad))
)
(.lvf vf5 (&-> s5-0 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-14 quad) vf6)
)
) )
(-> obj value) (-> obj value)
) )