rotation offset

This commit is contained in:
Fazana
2022-05-01 19:45:00 +01:00
parent d28382b328
commit 28c900b3d3
3 changed files with 31 additions and 32 deletions
+5 -5
View File
@@ -889,13 +889,13 @@ typedef struct Object_Racer {
/* 0x154 */ struct Object *unk154;
/* 0x158 */ s32 unk158;
/* 0x15C */ s32 unk15C;
/* 0x160 */ s16 unk160;
/* 0x162 */ s16 unk162;
/* 0x164 */ s16 unk164;
/* 0x166 */ s16 unk166;
/* 0x160 */ s16 x_rotation_offset;
/* 0x162 */ s16 y_rotation_offset;
/* 0x164 */ s16 z_rotation_offset;
/* 0x166 */ s16 unk166; // I don't know exactly what these are, but this one in particular seems to cause a Y position offset.
/* 0x168 */ s16 unk168;
/* 0x16A */ s16 unk16A;
/* 0x166 */ s16 unk16C;
/* 0x166 */ s16 unk16C; // As for these, they seem to affect the turning direction of the racer's head.
/* 0x16E */ s16 unk16E;
/* 0x170 */ s16 unk170;
/* 0x172 */ u8 balloon_type;
+8 -8
View File
@@ -990,15 +990,15 @@ void func_80012E28(Object *this) {
if (this->behaviorId == 1) {
sp_20 = &this->unk64->racer;
this->segment.trans.y_rotation += sp_20->unk160;
this->segment.trans.x_rotation += sp_20->unk162;
this->segment.trans.z_rotation += sp_20->unk164;
this->segment.trans.y_rotation += sp_20->x_rotation_offset;
this->segment.trans.x_rotation += sp_20->y_rotation_offset;
this->segment.trans.z_rotation += sp_20->z_rotation_offset;
sp_1c = 0.0f;
if (sp_20->unk1D7 < 5) {
sp_1c = func_800707F8(sp_20->unk164);
sp_1c = func_800707F8(sp_20->z_rotation_offset);
tmp_f2 = sp_1c;
tmp_f0 = func_800707F8(sp_20->unk162 - sp_20->unk166) * tmp_f2;
tmp_f0 = func_800707F8(sp_20->y_rotation_offset - sp_20->unk166) * tmp_f2;
tmp_f0 = (tmp_f0 < 0.0f) ? 0.0f : tmp_f0 * tmp_f0;
@@ -1014,9 +1014,9 @@ void func_80012E28(Object *this) {
void func_80012F30(Object *arg0) {
if (arg0->behaviorId == 1) {
Object_Racer *object_64 = &arg0->unk64->racer;
arg0->segment.trans.y_rotation -= object_64->unk160;
arg0->segment.trans.x_rotation -= object_64->unk162;
arg0->segment.trans.z_rotation -= object_64->unk164;
arg0->segment.trans.y_rotation -= object_64->x_rotation_offset;
arg0->segment.trans.x_rotation -= object_64->y_rotation_offset;
arg0->segment.trans.z_rotation -= object_64->z_rotation_offset;
arg0->segment.trans.y_position -= D_8011ADD0;
}
}
+18 -19
View File
@@ -425,30 +425,30 @@ void func_8004C140(Object *obj, Object_Racer *obj64) {
if (temp != 4) {
func_800576E0(obj, obj64, 2);
}
obj64->unk18C = 0x168;
obj64->unk18C = 360;
if (obj64->unk1C9 == 8) {
obj64->unk1C9 = 0;
}
if (obj64->unk1D6 < 5) {
func_800570B8(obj, 0x1C2, 8, 0x81);
func_800570B8(obj, 450, 8, 129);
switch (obj64->unk187) {
case 1:
case 2:
if (phi_v1 != 0) {
obj64->spinout_timer = 0x28;
obj64->spinout_timer = 40;
} else {
obj64->spinout_timer = 0x3C;
obj64->spinout_timer = 60;
}
break;
case 3:
if (phi_v1 != 0) {
obj64->spinout_timer = 0x28;
obj64->spinout_timer = 40;
} else {
obj64->spinout_timer = 0x3C;
obj64->spinout_timer = 60;
}
break;
case 6:
obj64->unk204 = 0x78;
obj64->unk204 = 120;
obj->segment.x_velocity *= 0.7;
obj->segment.z_velocity *= 0.7;
break;
@@ -654,18 +654,17 @@ void func_80050754(Object *obj, Object_Racer *obj64, f32 arg2) {
#else
GLOBAL_ASM("asm/non_matchings/racer/func_80050754.s")
#endif
/**
* Applies visual rotational offets to vehicles.
* Examples include planes when on the ground, or when crashing, or hovercraft when braking.
*/
void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 roll, s16 pitch, s16 yaw) {
void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 xRotation, s16 yRotation, s16 zRotation) {
s32 diff;
s32 tempAngle;
if (!obj->unk1F1) {
tempAngle = roll - (obj->unk160 & 0xFFFF);
obj->unk166 = pitch;
tempAngle = xRotation - (obj->x_rotation_offset & 0xFFFF);
obj->unk166 = yRotation;
if (tempAngle > 0x8000) {
tempAngle += 0xFFFF0001;
}
@@ -677,15 +676,15 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 roll, s16 pit
if (diff < tempAngle) {
tempAngle = diff;
}
obj->unk160 += tempAngle;
obj->x_rotation_offset += tempAngle;
} else if (tempAngle < 0) {
diff = -(max * 0x600);
if (tempAngle < diff) {
tempAngle = diff;
}
obj->unk160 += tempAngle;
obj->x_rotation_offset += tempAngle;
}
tempAngle = pitch - (obj->unk162 & 0xFFFF);
tempAngle = yRotation - (obj->y_rotation_offset & 0xFFFF);
if (tempAngle > 0x8000) {
tempAngle = tempAngle + 0xFFFF0001;
}
@@ -697,15 +696,15 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 roll, s16 pit
if (diff < tempAngle) {
tempAngle = diff;
}
obj->unk162 += tempAngle;
obj->y_rotation_offset += tempAngle;
} else if (tempAngle < 0) {
diff = -(max * 0x600);
if (tempAngle < diff) {
tempAngle = diff;
}
obj->unk162 += tempAngle;
obj->y_rotation_offset += tempAngle;
}
tempAngle = yaw - (obj->unk164 & 0xFFFF);
tempAngle = zRotation - (obj->z_rotation_offset & 0xFFFF);
if (tempAngle > 0x8000) {
tempAngle = tempAngle + 0xFFFF0001;
}
@@ -717,7 +716,7 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 roll, s16 pit
if (diff < tempAngle) {
tempAngle = diff;
}
obj->unk164 += tempAngle;
obj->z_rotation_offset += tempAngle;
return;
}
if (tempAngle < 0) {
@@ -725,7 +724,7 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 roll, s16 pit
if (tempAngle < diff) {
tempAngle = diff;
}
obj->unk164 += tempAngle;
obj->z_rotation_offset += tempAngle;
}
}
}