diff --git a/include/structs.h b/include/structs.h index 8d2723bd..d0b9a54e 100644 --- a/include/structs.h +++ b/include/structs.h @@ -890,8 +890,8 @@ typedef struct Object_Racer { /* 0x154 */ struct Object *unk154; /* 0x158 */ s32 unk158; /* 0x15C */ s32 unk15C; - /* 0x160 */ s16 x_rotation_offset; - /* 0x162 */ s16 y_rotation_offset; + /* 0x160 */ s16 y_rotation_offset; + /* 0x162 */ s16 x_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; diff --git a/src/objects.c b/src/objects.c index 8d086ab1..ba08b5f2 100644 --- a/src/objects.c +++ b/src/objects.c @@ -50,7 +50,7 @@ s32 D_800DC760 = 9; // Currently unknown, might be a different type. Object *D_800DC764 = NULL; // Currently unknown, might be a different type. s32 D_800DC768 = 0; // Currently unknown, might be a different type. -f32 D_800DC76C[15] = { +f32 D_800DC76C[15] = { 1.0f, 0.70711f, 0.70711f, 1.0f, 0.0f, 0.70711f, -0.70711f, 0.0f, -1.0f, -0.70711f, -0.70711f, -1.0f, @@ -768,11 +768,11 @@ s32 func_8000FAC4(Object *obj, s32 arg1) { if ((particleDataEntry[i].upper & 0xFFFF0000) == 0xFFFF0000) { func_800AF1E0(&obj->unk6C[i], (particleDataEntry[i].upper >> 8) & 0xFF, particleDataEntry[i].upper & 0xFF); } else { - func_800AF29C(&obj->unk6C[i], - (particleDataEntry[i].upper >> 0x18) & 0xFF, - (particleDataEntry[i].upper >> 0x10) & 0xFF, - particleDataEntry[i].upper & 0xFFFF, - (particleDataEntry[i].lower >> 0x10) & 0xFFFF, + func_800AF29C(&obj->unk6C[i], + (particleDataEntry[i].upper >> 0x18) & 0xFF, + (particleDataEntry[i].upper >> 0x10) & 0xFF, + particleDataEntry[i].upper & 0xFFFF, + (particleDataEntry[i].lower >> 0x10) & 0xFFFF, particleDataEntry[i].lower & 0xFFFF ); } @@ -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->x_rotation_offset; - this->segment.trans.x_rotation += sp_20->y_rotation_offset; + this->segment.trans.y_rotation += sp_20->y_rotation_offset; + this->segment.trans.x_rotation += sp_20->x_rotation_offset; this->segment.trans.z_rotation += sp_20->z_rotation_offset; sp_1c = 0.0f; if (sp_20->unk1D7 < 5) { sp_1c = sine_s(sp_20->z_rotation_offset); tmp_f2 = sp_1c; - tmp_f0 = sine_s(sp_20->y_rotation_offset - sp_20->unk166) * tmp_f2; + tmp_f0 = sine_s(sp_20->x_rotation_offset - sp_20->unk166) * tmp_f2; tmp_f0 = (tmp_f0 < 0.0f) ? 0.0f : tmp_f0 * tmp_f0; @@ -1014,8 +1014,8 @@ 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->x_rotation_offset; - arg0->segment.trans.x_rotation -= object_64->y_rotation_offset; + arg0->segment.trans.y_rotation -= object_64->y_rotation_offset; + arg0->segment.trans.x_rotation -= object_64->x_rotation_offset; arg0->segment.trans.z_rotation -= object_64->z_rotation_offset; arg0->segment.trans.y_position -= D_8011ADD0; } @@ -1088,7 +1088,7 @@ GLOBAL_ASM("asm/non_matchings/objects/func_80017248.s") unk800179D0 *func_8001790C(u32 *arg0, u32 *arg1) { unk800179D0 *entry; s16 i; - + for(i = 0; i < 16; i++) { entry = &D_8011AFF4[i]; if (entry->unk0 != 0 && entry->unk04 == arg0 && entry->unk08 == arg1) { @@ -1102,7 +1102,7 @@ unk800179D0 *func_8001790C(u32 *arg0, u32 *arg1) { unk800179D0 *func_80017978(s32 arg0, s32 arg1) { unk800179D0 *entry; s16 i; - + for(i = 0; i < 16; i++) { entry = &D_8011AFF4[i]; if (entry->unk0 == 0) { @@ -1505,14 +1505,14 @@ s32 func_8001F3EC(s32 arg0){ if (D_8011AE78 == 0) { return -1; } - + count = 0; for (i = 0; i < D_8011AE78; i++) { if (D_8011AE74[i]->unk7C.word == arg0){ count++; } } - + return count; } diff --git a/src/racer.c b/src/racer.c index e00387a9..e8dd172f 100644 --- a/src/racer.c +++ b/src/racer.c @@ -672,13 +672,13 @@ void func_80050754(Object *obj, Object_Racer *racer, f32 arg2) { * 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 xRotation, s16 yRotation, s16 zRotation) { +void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 yRotation, s16 xRotation, s16 zRotation) { s32 diff; s32 tempAngle; if (!obj->unk1F1) { - tempAngle = xRotation - (obj->x_rotation_offset & 0xFFFF); - obj->unk166 = yRotation; + tempAngle = yRotation - (obj->y_rotation_offset & 0xFFFF); + obj->unk166 = xRotation; if (tempAngle > 0x8000) { tempAngle += 0xFFFF0001; } @@ -690,15 +690,15 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 xRotation, s1 if (diff < tempAngle) { tempAngle = diff; } - obj->x_rotation_offset += tempAngle; + obj->y_rotation_offset += tempAngle; } else if (tempAngle < 0) { diff = -(max * 0x600); if (tempAngle < diff) { tempAngle = diff; } - obj->x_rotation_offset += tempAngle; + obj->y_rotation_offset += tempAngle; } - tempAngle = yRotation - (obj->y_rotation_offset & 0xFFFF); + tempAngle = xRotation - (obj->x_rotation_offset & 0xFFFF); if (tempAngle > 0x8000) { tempAngle = tempAngle + 0xFFFF0001; } @@ -710,13 +710,13 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 xRotation, s1 if (diff < tempAngle) { tempAngle = diff; } - obj->y_rotation_offset += tempAngle; + obj->x_rotation_offset += tempAngle; } else if (tempAngle < 0) { diff = -(max * 0x600); if (tempAngle < diff) { tempAngle = diff; } - obj->y_rotation_offset += tempAngle; + obj->x_rotation_offset += tempAngle; } tempAngle = zRotation - (obj->z_rotation_offset & 0xFFFF); if (tempAngle > 0x8000) { @@ -1072,7 +1072,7 @@ f32 func_80057220(Object* arg0, Object_Racer* arg1) { if (D_8011D540); if ((D_8011D540 > 0) && (D_8011D540 < 30) && (!arg1->unk1F4)) { temp_v1 = D_8011D540 - 14; - if ((gActivePlayerButtonPress & 0x8000) != 0) { + if (gActivePlayerButtonPress & A_BUTTON) { if ((temp_v1 < 0) && (sp28 >= 0)) { temp_v1 = 0; } @@ -1080,7 +1080,7 @@ f32 func_80057220(Object* arg0, Object_Racer* arg1) { temp_v1 = -temp_v1; } - if ((gCurrentCarInput & 0x2000)) { + if ((gCurrentCarInput & Z_TRIG)) { if (temp_v1 < 2) { temp_v1 = 0; } @@ -1121,14 +1121,14 @@ f32 func_80057220(Object* arg0, Object_Racer* arg1) { if (arg1->unk1D3 && !D_8011D540 && sp28 && !arg1->unk1D8) { func_80072348(arg1->playerIndex, 6); } - if ((D_8011D540 < 80) && ((gActivePlayerButtonPress & 0x8000))) { + if ((D_8011D540 < 80) && gActivePlayerButtonPress & A_BUTTON) { arg1->unk1F4 = 1U; } if (D_8011D540 == 0) { if ((arg1->boost_sound & 1) != 0) { arg1->boost_sound = (u8) (arg1->boost_sound & 0xFFFE); - func_800570B8(arg0, 0x162, 8, 0x82); - func_80057048(arg0, 0x21); + func_800570B8(arg0, 354, 8, 130); + func_80057048(arg0, 33); } } if ((arg1->boost_sound & 2) != 0) {