Some cleanup/fixes
This commit is contained in:
1 parent
4ec50b8123
commit
4adf87f622
19 files changed
+120
-171
No files matched your search
@@ -887,7 +887,7 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
position[1] = (f32) values[retrieve_animation_index(frame, &attribute)];
|
||||
position[2] = (f32) values[retrieve_animation_index(frame, &attribute)];
|
||||
} else {
|
||||
vec3f_set(position, 0, 0, 0);
|
||||
vec3_zero(position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -460,8 +460,8 @@ static void level_cmd_23(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_init_mario(void) {
|
||||
vec3s_set(gMarioSpawnInfo->startPos, 0, 0, 0);
|
||||
vec3s_set(gMarioSpawnInfo->startAngle, 0, 0, 0);
|
||||
vec3_zero(gMarioSpawnInfo->startPos);
|
||||
vec3_zero(gMarioSpawnInfo->startAngle);
|
||||
|
||||
gMarioSpawnInfo->activeAreaIndex = -1;
|
||||
gMarioSpawnInfo->areaIndex = 0;
|
||||
|
||||
+25
-24
@@ -598,7 +598,7 @@ void mtxf_rotate_xy(Mtx *mtx, s32 angle) {
|
||||
*/
|
||||
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, register Mat4 camMtx) {
|
||||
register s32 i;
|
||||
register f32 *temp = (f32 *)dest;
|
||||
register f32 *temp1 = (f32 *)dest;
|
||||
register f32 *temp2 = (f32 *)camMtx;
|
||||
f32 y[3];
|
||||
register f32 *x = y;
|
||||
@@ -608,12 +608,12 @@ void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, register Mat4 camMtx) {
|
||||
*x = (temp3[12] - temp2[12]);
|
||||
temp2++;
|
||||
temp3++;
|
||||
x = ((u32)x)+4;
|
||||
x = (f32 *)(((u32)x) + 4);
|
||||
}
|
||||
temp2 -=3;;
|
||||
for (i = 0; i < 3; i++) {
|
||||
*temp = x[-3] * temp2[0] + x[-2] * temp2[1] + x[-1] * temp2[2];
|
||||
temp++;
|
||||
*temp1 = x[-3] * temp2[0] + x[-2] * temp2[1] + x[-1] * temp2[2];
|
||||
temp1++;
|
||||
temp2 += 4;
|
||||
}
|
||||
}
|
||||
@@ -756,6 +756,25 @@ void vec3s_set_dist_and_angle(Vec3s from, Vec3s to, s16 dist, Angle32 pitch, Ang
|
||||
to[2] = (from[2] + (dcos * coss(yaw )));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to approach_s32, but converts to s16 and allows for overflow between 32767 and -32768
|
||||
*/
|
||||
s32 approach_angle(s32 current, s32 target, s32 inc) {
|
||||
s32 dist = (s16)(target - current);
|
||||
if (dist < 0) {
|
||||
dist += inc;
|
||||
if (dist > 0) dist = 0;
|
||||
} else if (dist > 0) {
|
||||
dist -= inc;
|
||||
if (dist < 0) dist = 0;
|
||||
}
|
||||
return (target - dist);
|
||||
}
|
||||
Bool32 approach_angle_bool(s16 *current, s32 target, s32 inc) {
|
||||
*current = approach_angle(*current, target, inc);
|
||||
return (*current != target);
|
||||
}
|
||||
|
||||
s32 approach_s16(s32 current, s32 target, s32 inc, s32 dec) {
|
||||
s16 dist = (target - current);
|
||||
if (dist >= 0) { // target >= current
|
||||
@@ -765,10 +784,9 @@ s32 approach_s16(s32 current, s32 target, s32 inc, s32 dec) {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
Bool32 approach_s16_bool(s16 *current, s32 target, s32 inc, s32 dec) {
|
||||
*current = approach_s16(*current, target, inc, dec);
|
||||
return !(*current == target);
|
||||
return (*current != target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -784,10 +802,9 @@ s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec) {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
Bool32 approach_s32_bool(s32 *current, s32 target, s32 inc, s32 dec) {
|
||||
*current = approach_s32(*current, target, inc, dec);
|
||||
return !(*current == target);
|
||||
return (*current != target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,7 +820,6 @@ f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
Bool32 approach_f32_bool(f32 *current, f32 target, f32 inc, f32 dec) {
|
||||
*current = approach_f32(*current, target, inc, dec);
|
||||
return !(*current == target);
|
||||
@@ -826,21 +842,6 @@ s32 approach_f32_signed(f32 *current, f32 target, f32 inc) {
|
||||
return reachedTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to approach_s32, but converts to s16 and allows for overflow between 32767 and -32768
|
||||
*/
|
||||
s32 approach_angle(s32 current, s32 target, s32 inc) {
|
||||
s32 dist = (s16)(target - current);
|
||||
if (dist < 0) {
|
||||
dist += inc;
|
||||
if (dist > 0) dist = 0;
|
||||
} else if (dist > 0) {
|
||||
dist -= inc;
|
||||
if (dist < 0) dist = 0;
|
||||
}
|
||||
return (target - dist);
|
||||
}
|
||||
|
||||
/**
|
||||
* Approaches an f32 value by taking the difference between the target and current value
|
||||
* and adding a fraction of that to the current value.
|
||||
|
||||
@@ -486,9 +486,11 @@ void vec3f_get_dist_and_angle( Vec3f from, Vec3f to, f32 *dist,
|
||||
void vec3s_set_dist_and_angle( Vec3s from, Vec3s to, s16 dist, Angle32 pitch, Angle32 yaw);
|
||||
void vec3f_set_dist_and_angle( Vec3f from, Vec3f to, f32 dist, Angle32 pitch, Angle32 yaw);
|
||||
|
||||
s32 approach_angle(s32 current, s32 target, s32 inc);
|
||||
s32 approach_s16(s32 current, s32 target, s32 inc, s32 dec);
|
||||
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec);
|
||||
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);
|
||||
Bool32 approach_angle_bool(s16 *current, s32 target, s32 inc);
|
||||
Bool32 approach_s16_bool(s16 *current, s32 target, s32 inc, s32 dec);
|
||||
Bool32 approach_s32_bool(s32 *current, s32 target, s32 inc, s32 dec);
|
||||
Bool32 approach_f32_bool(f32 *current, f32 target, f32 inc, f32 dec);
|
||||
@@ -499,7 +501,6 @@ Bool32 approach_f32_bool(f32 *current, f32 target, f32 inc, f32 dec);
|
||||
#define approach_s32_symmetric_bool(current, target, inc) approach_s32_bool((current), (target), (inc), (inc))
|
||||
#define approach_f32_symmetric_bool(current, target, inc) approach_f32_bool((current), (target), (inc), (inc))
|
||||
s32 approach_f32_signed(f32 *current, f32 target, f32 inc);
|
||||
s32 approach_angle(s32 current, s32 target, s32 inc);
|
||||
s32 approach_f32_asymptotic_bool(f32 *current, f32 target, f32 multiplier);
|
||||
f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier);
|
||||
s32 approach_s16_asymptotic_bool(s16 *current, s16 target, s16 divisor);
|
||||
|
||||
Reference in new issue
Block a user