[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,
FormStack& stack,
const Env& env,
RegisterAccess* orig_out,
bool* found_orig_out) {
*found_orig_out = false;
auto as_atom = form_as_atom(in);
if (as_atom && as_atom->is_var()) {
// get the last active thing on the stack and see if its what we want.
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 stack.pop_reg(as_atom->var().reg(), {}, env, true, -1, orig_out, found_orig_out);
}
return in;
}
@ -3955,39 +3937,56 @@ std::optional<RegisterAccess> form_as_ra(Form* form) {
/*!
* Handle an inlined call to vector-!
*/
bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) {
// we are looking for 5 ops, none are sets
auto elts = stack.try_getting_active_stack_entries({false, false, false, false, false});
bool try_vector_add_sub_inline(const Env& env,
FormPool& pool,
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) {
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))
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) {
return false;
}
// 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) {
return false;
}
// third (.vmove.w vf6 vf0)
if (!is_set_w_1(Register(Reg::VF, 6), elts->at(2).elt, env)) {
return false;
if (!is_add) {
// third (.vmove.w vf6 vf0)
if (!is_set_w_1(Register(Reg::VF, 6), elts->at(idx++).elt, env)) {
return false;
}
}
// 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;
}
// 5th (and remember the index)
int store_idx = -1;
auto store =
is_load_store_vector_to_reg(Register(Reg::VF, 6), elts->at(4).elt, false, &store_idx);
auto store = is_load_store_vector_to_reg(Register(Reg::VF, 6), store_element, false, &store_idx);
if (!store) {
return false;
}
@ -3997,12 +3996,12 @@ bool try_vector_sub_inline(const Env& env, FormPool& pool, FormStack& stack) {
// the function that attempts the pop.
auto store_var = form_as_ra(store);
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;
}
// 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
// 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).
bool got_orig = false;
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
Form* new_thing = pool.alloc_single_element_form<GenericElement>(
nullptr,
GenericOperator::make_function(
pool.alloc_single_element_form<ConstantTokenElement>(nullptr, "vector-!")),
GenericOperator::make_function(pool.alloc_single_element_form<ConstantTokenElement>(
nullptr, is_add ? "vector+!" : "vector-!")),
std::vector<Form*>{store, first, second});
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);
}
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
@ -4060,15 +4126,33 @@ void VectorFloatLoadStoreElement::push_to_stack(const Env& env, FormPool& pool,
auto atom = form_as_atom(root);
if (atom && atom->get_kind() == SimpleAtom::Kind::VARIABLE) {
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));
}
}
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,

View file

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

View file

@ -39,7 +39,9 @@ class FormStack {
const RegSet& barrier,
const Env& env,
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);
bool is_single_expression();
std::vector<FormElement*> rewrite(FormPool& pool, const Env& env) const;

View file

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

View file

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

View file

@ -277,6 +277,32 @@
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))
(defun math-cam-start-smoothing ((arg0 float) (arg1 float))

View file

@ -109,44 +109,27 @@
;; ERROR: function was not converted to expressions. Cannot decompile.
(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))))
(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))))
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
(s5-0 (new-stack-vector0))
)
(set! (-> s5-0 w) 0.0)
(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))
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
)
(.add.vf vf6 vf4 vf5 :mask #b111) ;; todo vector+!
(.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)
)
(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))))
)
(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))

View file

@ -101,77 +101,72 @@
(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."
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint))
(mode handler-mode)
)
(set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint))
(mode handler-mode)
)
(cond
((= mode (joint-mod-handler-mode flex-blend))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
;; use flex-bend instead of bend.
(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 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)
((= mode (joint-mod-handler-mode flex-blend))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
(set! (-> obj blend) 0.0)
(set! (-> obj flex-blend) 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)
((= 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)
)
(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))
@ -676,44 +671,23 @@
;; todo vector+!
(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 ((a1-1 (-> arg1 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*!
(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)
)
(let ((s5-0 (the-as joint-mod (-> arg0 param1))))
(vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(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)
)
)
(none)
)
(none)
)
(define *joint-axis-vectors*

View file

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

View file

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

View file

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

View file

@ -344,26 +344,23 @@
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
(arg0
(set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad))
)
(else
(.svf (&-> (-> obj target) quad) vf0)
(.svf (&-> (-> obj value) quad) vf0)
)
(cond
(arg0
(set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad))
)
(.svf (&-> (-> obj vel) quad) vf0)
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
(else
(vector-reset! (-> obj target))
(vector-reset! (-> obj value))
)
(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
@ -375,9 +372,6 @@
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (new 'stack-no-clear 'vector)))
@ -385,15 +379,7 @@
)
(cond
(arg0
(let ((a0-1 gp-0))
(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 (-> obj target) arg0)
(vector-! gp-0 gp-0 (-> obj value))
)
(else
@ -414,17 +400,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1)
)
(let ((a1-4 (-> obj vel)))
(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)
)
(vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((f0-4 (vector-length (-> obj vel)))
(f1-2 (fmin f30-1 (-> obj max-vel)))
)
@ -458,15 +434,7 @@
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-7 quad) vf1)
)
(let ((v1-8 (-> obj value)))
(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)
)
(vector+! (-> obj value) (-> obj value) gp-0)
)
(let ((v0-2 0))
)

View file

@ -318,35 +318,32 @@
;; definition for method 0 of type math-camera
(defmethod new math-camera ((allocation symbol) (type-to-make type))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(let
((gp-0
(object-new allocation type-to-make (the-as int (-> type-to-make size)))
)
(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))
(.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
;; Used lq/sq
(defun move-target-from-pad ((trans transform) (pad-idx int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(let ((local-trans (new-stack-vector0)))
(set! (-> local-trans x) (cond
((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))
)
(init-vf0-vector)
(let ((local-trans (new-stack-vector0)))
(set! (-> local-trans x) (cond
((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)
)
(vector-negate! inv-cam-rot (-> trans rot))
(matrix-rotate-zyx! cam-rot-mat (-> trans rot))
(vector-matrix*! local-trans local-trans cam-rot-mat)
)
(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
(vector+! (-> trans trans) (-> trans trans) local-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!

View file

@ -141,44 +141,27 @@
(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)
(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))))
)
(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 ((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)
)
(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)
(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)
)
(none)
)
;; definition for function ripple-slow-add-sine-waves

View file

@ -112,75 +112,72 @@
set-mode!
joint-mod
((obj joint-mod) (handler-mode joint-mod-handler-mode))
(rlet ((vf0 :class vf))
(init-vf0-vector)
(set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint))
(mode handler-mode)
)
(cond
((= mode (joint-mod-handler-mode flex-blend))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
(set! (-> obj blend) 0.0)
(set! (-> obj flex-blend) 1.0)
(set! (-> obj mode) handler-mode)
(let ((joint (-> obj joint))
(mode handler-mode)
)
(cond
((= mode (joint-mod-handler-mode flex-blend))
(set! (-> joint param0) #f)
(set! (-> joint param1) #f)
(set! (-> joint param2) #f)
(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! (-> 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)
(.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))
)
((= 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))
)
)
obj
)
obj
)
;; definition for method 12 of type joint-mod
@ -742,42 +739,25 @@
;; definition for function joint-mod-joint-set*-handler
;; INFO: Return type mismatch int vs none.
(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 ((a1-1 (-> arg1 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*! (-> 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 ((s5-0 (the-as joint-mod (-> arg0 param1))))
(vector+! (-> arg1 trans) (-> arg1 trans) (-> s5-0 trans))
(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)

View file

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