[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;
} }
// third (.vmove.w vf6 vf0) if (!is_add) {
if (!is_set_w_1(Register(Reg::VF, 6), elts->at(2).elt, env)) { // third (.vmove.w vf6 vf0)
return false; if (!is_set_w_1(Register(Reg::VF, 6), elts->at(idx++).elt, env)) {
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 false; 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;
}
// 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,51 +5,31 @@
;; 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 quad))
(let ((a0-3 f0-0))
(.mov vf2 a0-3)
) )
(.lvf vf1 a0-2) )
(let ((a0-3 f0-0)) (.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mov vf2 a0-3) (.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-0 quad) vf1)
) )
) (vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
(.add.x.vf vf1 vf0 vf0 :mask #b1000) (vector+! arg0 arg0 (-> *math-camera* trans))
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-0 quad) vf1)
)
(vector+float*!
arg0 arg0
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
)
) )
;; definition for function matrix-local->world ;; definition for function matrix-local->world
@ -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)) (cond
(init-vf0-vector) (arg0
(cond (set! (-> obj target quad) (-> arg0 quad))
(arg0 (set! (-> obj value quad) (-> arg0 quad))
(set! (-> obj target quad) (-> arg0 quad)) )
(set! (-> obj value quad) (-> arg0 quad)) (else
) (vector-reset! (-> obj target))
(else (vector-reset! (-> obj value))
(.svf (&-> (-> obj target) quad) vf0) )
(.svf (&-> (-> obj value) quad) vf0)
)
)
(.svf (&-> (-> obj vel) quad) vf0)
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
)
(none)
) )
(vector-reset! (-> obj vel))
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(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,44 +109,27 @@
;; 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) (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(vf4 :class vf) (s5-0 (new-stack-vector0))
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(s5-0 (new-stack-vector0))
)
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
)
(set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
(set! (-> s5-0 y) 0.0)
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
) )
(set! (-> s5-0 w) 0.0) (let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
(let ((a0-6 s5-0)) (f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
(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+! (set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
(.svf (&-> a0-6 quad) vf6) (set! (-> s5-0 y) 0.0)
) (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
(add-debug-sphere
#t
(bucket-id debug-draw0)
s5-0
2048.0
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
) )
(none) (set! (-> s5-0 w) 0.0)
(vector+! s5-0 s5-0 (-> arg0 root trans))
(add-debug-sphere
#t
(bucket-id debug-draw0)
s5-0
2048.0
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
) )
(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))

View file

@ -101,77 +101,72 @@
(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)) (set! (-> obj mode) handler-mode)
(init-vf0-vector) (let ((joint (-> obj joint))
(set! (-> obj mode) handler-mode) (mode handler-mode)
(let ((joint (-> obj joint)) )
(mode handler-mode)
)
(cond (cond
((= mode (joint-mod-handler-mode flex-blend)) ((= mode (joint-mod-handler-mode flex-blend))
(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)
)
((= mode (joint-mod-handler-mode reset))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
;; set blend to 0 for no effect.
(set! (-> obj blend) 0.0)
(set! (-> obj shutting-down?) #f)
)
((= mode (joint-mod-handler-mode look-at))
(set! (-> joint param0) joint-mod-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode world-look-at))
(set! (-> joint param0) joint-mod-world-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode rotate))
(set! (-> joint param0) joint-mod-rotate-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(set! (-> obj blend) 1.0)
)
((= mode (joint-mod-handler-mode joint-set))
(set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0)
(quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0)
(set! (-> v1-2 y) 1.0)
(set! (-> v1-2 z) 1.0)
(set! (-> v1-2 w) 1.0)
) )
(set! (-> obj max-dist) (the-as float #f)) ((= mode (joint-mod-handler-mode reset))
) (set! (-> joint param0) #f)
((= mode (joint-mod-handler-mode joint-set*)) (set! (-> joint param1) #f)
(set! (-> joint param0) joint-mod-joint-set*-handler) (set! (-> joint param2) #f)
(set! (-> joint param1) obj) (set! (-> obj blend) 0.0)
(set! (-> joint param2) #f) (set! (-> obj shutting-down?) #f)
(.svf (&-> (-> obj trans) quad) vf0) )
(quaternion-identity! (-> obj quat)) ((= mode (joint-mod-handler-mode look-at))
(let ((v1-4 (-> obj scale))) (set! (-> joint param0) joint-mod-look-at-handler)
(set! (-> v1-4 x) 1.0) (set! (-> joint param1) obj)
(set! (-> v1-4 y) 1.0) (set! (-> joint param2) #f)
(set! (-> v1-4 z) 1.0) )
(set! (-> v1-4 w) 1.0) ((= mode (joint-mod-handler-mode world-look-at))
(set! (-> joint param0) joint-mod-world-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode rotate))
(set! (-> joint param0) joint-mod-rotate-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(set! (-> obj blend) 1.0)
)
((= mode (joint-mod-handler-mode joint-set))
(set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0)
(set! (-> v1-2 y) 1.0)
(set! (-> v1-2 z) 1.0)
(set! (-> v1-2 w) 1.0)
)
(set! (-> obj max-dist) (the-as float #f))
)
((= mode (joint-mod-handler-mode joint-set*))
(set! (-> joint param0) joint-mod-joint-set*-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat))
(let ((v1-4 (-> obj scale)))
(set! (-> v1-4 x) 1.0)
(set! (-> v1-4 y) 1.0)
(set! (-> v1-4 z) 1.0)
(set! (-> v1-4 w) 1.0)
)
(set! (-> obj max-dist) (the-as float #f))
) )
(set! (-> obj max-dist) (the-as float #f))
) )
)
) )
obj obj
)
) )
(defmethod reset-blend! joint-mod ((obj joint-mod)) (defmethod reset-blend! joint-mod ((obj joint-mod))
@ -676,44 +671,23 @@
;; 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) (let ((s5-0 (the-as joint-mod (-> arg0 param1))))
(vf4 :class vf) (vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(vf5 :class vf) (quaternion-normalize!
(vf6 :class vf) (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))
) )
(init-vf0-vector) (vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale))
(let ((s5-0 (the-as joint-mod (-> arg0 param1)))) (cspace<-parented-transformq-joint! arg0 arg1)
(let ((a1-1 (-> arg1 trans))) (when (-> s5-0 max-dist)
(let ((v1-0 (-> arg1 trans)) (let ((v1-4 (-> arg0 bone scale)))
(a0-1 (-> s5-0 trans)) (set! (-> v1-4 x) 1.0)
) (set! (-> v1-4 y) 1.0)
(.mov.vf vf6 vf0 :mask #b1000) (set! (-> v1-4 z) 1.0)
(.lvf vf4 (&-> v1-0 quad)) (set! (-> v1-4 w) 1.0)
(.lvf vf5 (&-> a0-1 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-1 quad) vf6)
)
(quaternion-normalize!
(quaternion*!
(the-as quaternion (-> arg1 rot))
(the-as quaternion (-> arg1 rot))
(-> s5-0 quat)
)
)
(vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale))
(cspace<-parented-transformq-joint! arg0 arg1)
(when (-> s5-0 max-dist)
(let ((v1-4 (-> arg0 bone scale)))
(set! (-> v1-4 x) 1.0)
(set! (-> v1-4 y) 1.0)
(set! (-> v1-4 z) 1.0)
(set! (-> v1-4 w) 1.0)
)
) )
) )
(none)
) )
(none)
) )
(define *joint-axis-vectors* (define *joint-axis-vectors*

View file

@ -472,21 +472,15 @@
) )
;; 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 (set! (-> obj min-time) arg0)
delayed-rand-vector (set! (-> obj max-time) arg1)
((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float)) (set! (-> obj xz-max) (* 0.5 arg2))
(rlet ((vf0 :class vf)) (set! (-> obj y-max) (* 0.5 arg3))
(init-vf0-vector) (set! (-> obj start-time) (the-as uint 0))
(set! (-> obj min-time) arg0) (set! (-> obj timer) 0)
(set! (-> obj max-time) arg1) (vector-reset! (-> obj value))
(set! (-> obj xz-max) (* 0.5 arg2)) (-> obj value)
(set! (-> obj y-max) (* 0.5 arg3))
(set! (-> obj start-time) (the-as uint 0))
(set! (-> obj timer) 0)
(.svf (&-> (-> obj value) quad) vf0)
(-> obj value)
)
) )
;; definition for method 10 of type delayed-rand-vector ;; definition for method 10 of type 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) (-> obj timer)
(if )
(>= (dummy-10 obj)
(the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (vector-reset! (-> obj value))
(-> obj timer) )
) (-> obj value)
(dummy-10 obj)
(.svf (&-> (-> obj value) quad) vf0)
)
(-> 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 (cond
oscillating-vector
((obj oscillating-vector)
(arg0 vector)
(arg1 float)
(arg2 float)
(arg3 float)
)
(rlet ((vf0 :class vf))
(init-vf0-vector)
(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,26 +344,23 @@
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)) (cond
(init-vf0-vector) (arg0
(cond (set! (-> obj target quad) (-> arg0 quad))
(arg0 (set! (-> obj value quad) (-> arg0 quad))
(set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad))
)
(else
(.svf (&-> (-> obj target) quad) vf0)
(.svf (&-> (-> obj value) quad) vf0)
)
) )
(.svf (&-> (-> obj vel) quad) vf0) (else
(set! (-> obj accel) arg1) (vector-reset! (-> obj target))
(set! (-> obj max-vel) arg2) (vector-reset! (-> obj value))
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
) )
(none)
) )
(vector-reset! (-> obj vel))
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
)
(none)
) )
;; definition for method 10 of type cam-vector-seeker ;; definition for method 10 of type cam-vector-seeker
@ -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,35 +318,32 @@
;; 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)) (let
(init-vf0-vector) ((gp-0
(let (object-new allocation type-to-make (the-as int (-> type-to-make size)))
((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))
(.svf (&-> (-> gp-0 trans) quad) vf0)
(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)
) )
(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)
) )
) )
@ -366,118 +363,100 @@
;; 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) (let ((local-trans (new-stack-vector0)))
(vf4 :class vf) (set! (-> local-trans x) (cond
(vf5 :class vf) ((nonzero?
(vf6 :class vf) (logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons circle)
)
)
-80.0
)
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons square)
)
)
80.0
)
(else
0.0
)
)
)
(set! (-> local-trans y) 0.0)
(set! (-> local-trans z) (cond
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons down)
)
)
-80.0
)
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons up)
)
)
80.0
)
(else
0.0
)
)
)
(set! (-> local-trans w) 1.0)
(let ((inv-cam-rot (new-stack-vector0))
(cam-rot-mat (new-stack-matrix0))
) )
(init-vf0-vector) (vector-negate! inv-cam-rot (-> trans rot))
(let ((local-trans (new-stack-vector0))) (matrix-rotate-zyx! cam-rot-mat (-> trans rot))
(set! (-> local-trans x) (cond (vector-matrix*! local-trans local-trans cam-rot-mat)
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons circle)
)
)
-80.0
)
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons square)
)
)
80.0
)
(else
0.0
)
)
)
(set! (-> local-trans y) 0.0)
(set! (-> local-trans z) (cond
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons down)
)
)
-80.0
)
((nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons up)
)
)
80.0
)
(else
0.0
)
)
)
(set! (-> local-trans w) 1.0)
(let ((inv-cam-rot (new-stack-vector0))
(cam-rot-mat (new-stack-matrix0))
)
(vector-negate! inv-cam-rot (-> trans rot))
(matrix-rotate-zyx! cam-rot-mat (-> trans rot))
(vector-matrix*! local-trans local-trans cam-rot-mat)
)
(let ((a0-8 (-> trans 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) (vector+! (-> trans trans) (-> trans trans) local-trans)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r1))
)
(set! (-> trans trans y) (+ 80.0 (-> trans trans y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r2))
)
(set! (-> trans trans y) (+ -80.0 (-> trans trans y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons x))
)
(set! (-> trans rot x) (+ 546.13336 (-> trans rot x)))
)
(if
(nonzero?
(logand
(-> *cpad-list* cpads pad-idx button0-abs 0)
(pad-buttons triangle)
)
)
(set! (-> trans rot x) (+ -546.13336 (-> trans rot x)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons left))
)
(set! (-> trans rot y) (+ 546.13336 (-> trans rot y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons right))
)
(set! (-> trans rot y) (+ -546.13336 (-> trans rot y)))
)
trans
) )
(set! (-> trans trans w) 1.0)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r1))
)
(set! (-> trans trans y) (+ 80.0 (-> trans trans y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r2))
)
(set! (-> trans trans y) (+ -80.0 (-> trans trans y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons x))
)
(set! (-> trans rot x) (+ 546.13336 (-> trans rot x)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons triangle))
)
(set! (-> trans rot x) (+ -546.13336 (-> trans rot x)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons left))
)
(set! (-> trans rot y) (+ 546.13336 (-> trans rot y)))
)
(if
(nonzero?
(logand (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons right))
)
(set! (-> trans rot y) (+ -546.13336 (-> trans rot y)))
)
trans
) )
;; definition for function transform-point-vector! ;; definition for function transform-point-vector!

View file

@ -141,44 +141,27 @@
(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) (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(vf4 :class vf) (s5-0 (new-stack-vector0))
(vf5 :class vf) )
(vf6 :class vf) (let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
) )
(init-vf0-vector) (set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat)))) (set! (-> s5-0 y) 0.0)
(s5-0 (new-stack-vector0)) (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
) )
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z)))) (set! (-> s5-0 w) 0.0)
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z)))) (vector+! s5-0 s5-0 (-> arg0 root trans))
) (add-debug-sphere
(set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0)))) #t
(set! (-> s5-0 y) 0.0) (bucket-id debug-draw0)
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0)))) s5-0
) 2048.0
(set! (-> s5-0 w) 0.0) (new 'static 'rgba :r #xff :g #xff :a #x80)
(let ((a0-6 s5-0))
(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
#t
(bucket-id debug-draw0)
s5-0
2048.0
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
) )
(none)
) )
(none)
) )
;; definition for function ripple-slow-add-sine-waves ;; definition for function ripple-slow-add-sine-waves

View file

@ -112,75 +112,72 @@
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)) (set! (-> obj mode) handler-mode)
(init-vf0-vector) (let ((joint (-> obj joint))
(set! (-> obj mode) handler-mode) (mode handler-mode)
(let ((joint (-> obj joint)) )
(mode handler-mode) (cond
) ((= mode (joint-mod-handler-mode flex-blend))
(cond (set! (-> joint param0) #f)
((= mode (joint-mod-handler-mode flex-blend)) (set! (-> joint param1) #f)
(set! (-> joint param0) #f) (set! (-> joint param2) #f)
(set! (-> joint param1) #f) (set! (-> obj blend) 0.0)
(set! (-> joint param2) #f) (set! (-> obj flex-blend) 1.0)
(set! (-> obj blend) 0.0) )
(set! (-> obj flex-blend) 1.0) ((= mode (joint-mod-handler-mode reset))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
(set! (-> obj blend) 0.0)
(set! (-> obj shutting-down?) #f)
)
((= mode (joint-mod-handler-mode look-at))
(set! (-> joint param0) joint-mod-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode world-look-at))
(set! (-> joint param0) joint-mod-world-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode rotate))
(set! (-> joint param0) joint-mod-rotate-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(set! (-> obj blend) 1.0)
)
((= mode (joint-mod-handler-mode joint-set))
(set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(vector-reset! (-> obj trans))
(quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0)
(set! (-> v1-2 y) 1.0)
(set! (-> v1-2 z) 1.0)
(set! (-> v1-2 w) 1.0)
) )
((= mode (joint-mod-handler-mode reset)) (set! (-> obj max-dist) (the-as float #f))
(set! (-> joint param0) #f) )
(set! (-> joint param1) #f) ((= mode (joint-mod-handler-mode joint-set*))
(set! (-> joint param2) #f) (set! (-> joint param0) joint-mod-joint-set*-handler)
(set! (-> obj blend) 0.0) (set! (-> joint param1) obj)
(set! (-> obj shutting-down?) #f) (set! (-> joint param2) #f)
) (vector-reset! (-> obj trans))
((= mode (joint-mod-handler-mode look-at)) (quaternion-identity! (-> obj quat))
(set! (-> joint param0) joint-mod-look-at-handler) (let ((v1-4 (-> obj scale)))
(set! (-> joint param1) obj) (set! (-> v1-4 x) 1.0)
(set! (-> joint param2) #f) (set! (-> v1-4 y) 1.0)
) (set! (-> v1-4 z) 1.0)
((= mode (joint-mod-handler-mode world-look-at)) (set! (-> v1-4 w) 1.0)
(set! (-> joint param0) joint-mod-world-look-at-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
)
((= mode (joint-mod-handler-mode rotate))
(set! (-> joint param0) joint-mod-rotate-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(set! (-> obj blend) 1.0)
)
((= mode (joint-mod-handler-mode joint-set))
(set! (-> joint param0) joint-mod-joint-set-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0)
(quaternion-identity! (-> obj quat))
(let ((v1-2 (-> obj scale)))
(set! (-> v1-2 x) 1.0)
(set! (-> v1-2 y) 1.0)
(set! (-> v1-2 z) 1.0)
(set! (-> v1-2 w) 1.0)
)
(set! (-> obj max-dist) (the-as float #f))
)
((= mode (joint-mod-handler-mode joint-set*))
(set! (-> joint param0) joint-mod-joint-set*-handler)
(set! (-> joint param1) obj)
(set! (-> joint param2) #f)
(.svf (&-> (-> obj trans) quad) vf0)
(quaternion-identity! (-> obj quat))
(let ((v1-4 (-> obj scale)))
(set! (-> v1-4 x) 1.0)
(set! (-> v1-4 y) 1.0)
(set! (-> v1-4 z) 1.0)
(set! (-> v1-4 w) 1.0)
)
(set! (-> obj max-dist) (the-as float #f))
) )
(set! (-> obj max-dist) (the-as float #f))
) )
) )
obj
) )
obj
) )
;; definition for method 12 of type joint-mod ;; definition for method 12 of type joint-mod
@ -742,42 +739,25 @@
;; 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) (let ((s5-0 (the-as joint-mod (-> arg0 param1))))
(vf4 :class vf) (vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(vf5 :class vf) (quaternion-normalize!
(vf6 :class vf) (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))
) )
(init-vf0-vector) (vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale))
(let ((s5-0 (the-as joint-mod (-> arg0 param1)))) (cspace<-parented-transformq-joint! arg0 arg1)
(let ((a1-1 (-> arg1 trans))) (when (-> s5-0 max-dist)
(let ((v1-0 (-> arg1 trans)) (let ((v1-4 (-> arg0 bone scale)))
(a0-1 (-> s5-0 trans)) (set! (-> v1-4 x) 1.0)
) (set! (-> v1-4 y) 1.0)
(.mov.vf vf6 vf0 :mask #b1000) (set! (-> v1-4 z) 1.0)
(.lvf vf4 (&-> v1-0 quad)) (set! (-> v1-4 w) 1.0)
(.lvf vf5 (&-> a0-1 quad))
)
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a1-1 quad) vf6)
)
(quaternion-normalize!
(quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))
)
(vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale))
(cspace<-parented-transformq-joint! arg0 arg1)
(when (-> s5-0 max-dist)
(let ((v1-4 (-> arg0 bone scale)))
(set! (-> v1-4 x) 1.0)
(set! (-> v1-4 y) 1.0)
(set! (-> v1-4 z) 1.0)
(set! (-> v1-4 w) 1.0)
)
) )
) )
(let ((v0-4 0))
)
(none)
) )
(let ((v0-4 0))
)
(none)
) )
;; definition for symbol *joint-axis-vectors*, type (inline-array vector) ;; definition for symbol *joint-axis-vectors*, type (inline-array vector)

View file

@ -471,17 +471,14 @@
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)) (set! (-> obj min-time) arg0)
(init-vf0-vector) (set! (-> obj max-time) arg1)
(set! (-> obj min-time) arg0) (set! (-> obj xz-max) (* 0.5 arg2))
(set! (-> obj max-time) arg1) (set! (-> obj y-max) (* 0.5 arg3))
(set! (-> obj xz-max) (* 0.5 arg2)) (set! (-> obj start-time) (the-as uint 0))
(set! (-> obj y-max) (* 0.5 arg3)) (set! (-> obj timer) 0)
(set! (-> obj start-time) (the-as uint 0)) (vector-reset! (-> obj value))
(set! (-> obj timer) 0) (-> obj value)
(.svf (&-> (-> obj value) quad) vf0)
(-> obj value)
)
) )
;; definition for method 10 of type delayed-rand-vector ;; definition for method 10 of type delayed-rand-vector
@ -517,18 +514,15 @@
;; 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
(init-vf0-vector) (>=
(if (the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
(>= (-> obj timer)
(the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
(-> obj timer)
)
(dummy-10 obj)
(.svf (&-> (-> obj value) quad) vf0)
) )
(-> obj value) (dummy-10 obj)
(vector-reset! (-> obj value))
) )
(-> obj value)
) )
;; definition for method 9 of type oscillating-vector ;; definition for method 9 of type oscillating-vector
@ -542,24 +536,21 @@
(arg2 float) (arg2 float)
(arg3 float) (arg3 float)
) )
(rlet ((vf0 :class vf)) (cond
(init-vf0-vector) (arg0
(cond (set! (-> obj value quad) (-> arg0 quad))
(arg0 (set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad)) )
(set! (-> obj target quad) (-> arg0 quad)) (else
) (vector-reset! (-> obj value))
(else (vector-reset! (-> obj target))
(.svf (&-> (-> obj value) quad) vf0)
(.svf (&-> (-> obj target) quad) vf0)
)
) )
(.svf (&-> (-> obj vel) quad) vf0)
(set! (-> obj max-vel) arg2)
(set! (-> obj damping) arg3)
(set! (-> obj accel) arg1)
(-> obj value)
) )
(vector-reset! (-> obj vel))
(set! (-> obj max-vel) arg2)
(set! (-> obj damping) arg3)
(set! (-> obj accel) arg1)
(-> obj value)
) )
;; definition for method 10 of type oscillating-vector ;; definition for method 10 of type oscillating-vector
@ -567,23 +558,12 @@
(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)
) )