revert some redundant struct changes

This commit is contained in:
Fazana
2022-04-28 15:51:08 +01:00
parent 0f000cc71b
commit 08c9e784f8
4 changed files with 92 additions and 95 deletions
+40 -48
View File
@@ -1213,54 +1213,46 @@ typedef struct ObjectTransform {
/* Size: 0x44 bytes */
typedef struct ObjectSegment {
/* 0x0000 */ ObjectTransform trans;
union {
struct {
/* 0x0018 */ s16 upper;
/* 0x0020 */ s16 lower;
} half;
/* 0x0018 */ f32 word;
} unk18;
/* 0x001C */ f32 x_velocity;
/* 0x0020 */ f32 y_velocity;
/* 0x0024 */ f32 z_velocity;
/* 0x0028 */ f32 unk28;
union {
struct {
/* 0x002C */ s16 upper;
/* 0x002E */ s16 lower;
} half;
/* 0x002C */ f32 word;
} unk2C;
/* 0x0030 */ f32 unk30;
union {
/* 0x0034 */ f32 unk34;
/* 0x0034 */ s16 levelSegmentIndex;
struct h {
/* 0x0034 */ s16 h0;
/* 0x0036 */ s16 h1;
} h;
} unk34_a;
union {
struct {
/* 0x0038 */ u8 upper;
/* 0x0039 */ u8 lower;
} half;
/* 0x0038 */ s16 word;
} unk38;
/* 0x003A */ s8 unk3A;
/* 0x003B */ s8 unk3B;
union {
/* 0x003C */ Object_3C* unk3C;
/* 0x003C */ f32 unk3C_f;
struct {
/* 0x003C */ u8 b0;
/* 0x003D */ u8 b1;
/* 0x003E */ u8 b2;
/* 0x003F */ u8 b3;
} byte;
} unk3C_a;
/* 0x0040 */ ObjectHeader *header;
/* 0x0000 */ ObjectTransform trans;
/* 0x0018 */ s16 unk18;
/* 0x001A */ s16 unk1A;
/* 0x001C */ f32 x_velocity;
/* 0x0020 */ f32 y_velocity;
/* 0x0024 */ f32 z_velocity;
/* 0x0028 */ f32 unk28;
union {
struct {
/* 0x002C */ s16 upper;
/* 0x002E */ s16 lower;
} half;
/* 0x002C */ f32 word;
} unk2C;
/* 0x0030 */ f32 unk30;
union {
/* 0x0034 */ f32 unk34;
/* 0x0034 */ s16 levelSegmentIndex;
} unk34_a;
union {
struct {
/* 0x0038 */ u8 upper;
/* 0x0039 */ u8 lower;
} half;
/* 0x0038 */ s16 word;
} unk38;
/* 0x003A */ s8 unk3A;
/* 0x003B */ s8 unk3B;
union {
/* 0x003C */ Object_3C* unk3C;
/* 0x003C */ f32 unk3C_f;
} unk3C_a;
/* 0x0040 */ ObjectHeader *header;
} ObjectSegment;
/* Size: 0x0630 bytes */
+22 -22
View File
@@ -276,7 +276,7 @@ void obj_loop_fireball_octoweapon(Object *obj, s32 speed) {
obj->segment.trans.y_position = sp4C[0];
}
}
obj->segment.unk18.half.upper += speed * 10;
obj->segment.unk18 += speed * 10;
obj64 = obj->unk64;
obj4C = obj->unk4C;
obj4C_obj = (Object*)obj4C->unk0; // This should be a0, not v1!
@@ -445,7 +445,7 @@ void obj_init_torch_mist(Object *obj, LevelObjectEntry_Torch_Mist *entry) {
}
void obj_loop_torch_mist(Object *obj, s32 speed) {
obj->segment.unk18.half.upper += obj->unk78 * speed;
obj->segment.unk18 += obj->unk78 * speed;
}
void obj_init_effectbox(UNUSED Object *obj, UNUSED LevelObjectEntry_EffectBox *entry) {
@@ -897,7 +897,7 @@ void obj_loop_unknown58(Object *obj, s32 speed) {
Object_60 *obj60;
obj->segment.unk3B = 0;
obj->segment.unk18.half.upper = 0x28;
obj->segment.unk18 = 0x28;
if (func_8001139C() == 0) {
obj->unk78 += speed;
}
@@ -1002,9 +1002,9 @@ void obj_loop_lavaspurt(Object *obj, s32 speed) {
obj->segment.trans.unk6 |= 0x4000;
} else {
obj->segment.trans.unk6 &= ~0x4000;
obj->segment.unk18.half.upper += speed * 4;
if (obj->segment.unk18.half.upper >= 256) {
obj->segment.unk18.half.upper = 0;
obj->segment.unk18 += speed * 4;
if (obj->segment.unk18 >= 256) {
obj->segment.unk18 = 0;
obj->unk78 = get_random_number_from_range(0, 30) + obj->unk7C.word;
}
}
@@ -1029,7 +1029,7 @@ void obj_loop_posarrow(Object *obj, UNUSED s32 speed) {
obj->segment.trans.unk6 &= ~0x4000;
someObj64->unk150 = obj;
}
obj->segment.unk18.half.upper = obj->unk78 * 127;
obj->segment.unk18 = obj->unk78 * 127;
}
}
@@ -1399,12 +1399,12 @@ void obj_loop_smoke(Object *obj, s32 speed) {
temp_f2 *= 1.2;
}
obj->segment.trans.x_position += obj->segment.x_velocity * temp_f2;
obj->segment.unk18.half.upper += speed * 16;
obj->segment.unk18 += speed * 16;
obj->segment.trans.y_position += obj->segment.y_velocity * temp_f2;
obj->segment.trans.z_position += obj->segment.z_velocity * temp_f2;
if (obj->segment.unk18.half.upper >= 256) {
if (obj->segment.unk18 >= 256) {
gParticlePtrList_addObject(obj);
obj->segment.unk18.half.upper = 255;
obj->segment.unk18 = 255;
}
}
@@ -1412,10 +1412,10 @@ void obj_init_unknown25(UNUSED Object *obj, UNUSED LevelObjectEntry_Unknown25 *e
}
void obj_loop_unknown25(Object *obj, s32 speed) {
obj->segment.unk18.half.upper += speed * 8;
if (obj->segment.unk18.half.upper >= 256) {
obj->segment.unk18 += speed * 8;
if (obj->segment.unk18 >= 256) {
gParticlePtrList_addObject(obj);
obj->segment.unk18.half.upper = 255;
obj->segment.unk18 = 255;
}
}
@@ -1429,17 +1429,17 @@ void obj_loop_wardensmoke(Object *obj, s32 speed) {
if (osTvType == TV_TYPE_PAL) {
temp_f2 *= 1.2;
}
obj->segment.unk18.half.upper += speed * 4;
obj->segment.unk18 += speed * 4;
obj->segment.trans.y_position += temp_f2 * 0.25;
if (obj->segment.unk18.half.upper >= 256) {
if (obj->segment.unk18 >= 256) {
gParticlePtrList_addObject(obj);
obj->segment.unk18.half.upper = 255;
obj->segment.unk18 = 255;
}
}
void obj_init_bombexplosion(Object *obj, LevelObjectEntry_BombExplosion *entry) {
LevelObjectEntry_BombExplosion *entry2;
obj->segment.unk18.half.upper = 0;
obj->segment.unk18 = 0;
obj->segment.trans.scale = 0.5f;
obj->segment.unk3A = get_random_number_from_range(0, obj->segment.header->numberOfModelIds - 1);
entry2 = entry; // Needed for a match.
@@ -1581,7 +1581,7 @@ void obj_loop_dino_whale(Object *obj, s32 speed) {
} else {
obj->unk78 = 0;
}
sp2C = obj->segment.unk18.half.upper;
sp2C = obj->segment.unk18;
func_8001F460(obj, speed, obj);
func_800113CC(obj, 0, sp2C, 0xAC, 0xAD);
if (obj->unk4C->unk13 < 0xFF) {
@@ -2041,7 +2041,7 @@ void obj_loop_ainode(UNUSED Object *obj, UNUSED s32 speed) {
}
void obj_init_treasuresucker(Object *obj, LevelObjectEntry_TreasureSucker *entry) {
obj->segment.unk18.half.upper = 0x78;
obj->segment.unk18 = 0x78;
obj->unk78 = (entry->unk8 - 1) & 3;
}
@@ -2053,7 +2053,7 @@ void obj_init_flycoin(UNUSED Object *obj, UNUSED LevelObjectEntry_FlyCoin *entry
GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_flycoin.s")
void obj_init_bananacreator(Object *obj, UNUSED LevelObjectEntry_BananaCreator *entry) {
obj->segment.unk18.half.upper = 100;
obj->segment.unk18 = 100;
}
void obj_loop_bananacreator(Object *obj, s32 speed) {
@@ -2410,7 +2410,7 @@ void obj_loop_buoy_pirateship(Object *obj, s32 speed) {
if (obj->unk64 != NULL) {
obj->segment.trans.y_position = func_800BEEB4(obj->unk64);
}
obj->segment.unk18.half.upper += speed * 8;
obj->segment.unk18 += speed * 8;
}
void obj_init_log(Object *obj, LevelObjectEntry_Log *entry, UNUSED s32 arg2) {
@@ -2738,6 +2738,6 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_levelname.s")
void obj_loop_wizghosts(Object *obj, s32 speed) {
func_8001F460(obj, speed, obj);
obj->segment.unk18.half.upper = (obj->segment.unk18.half.upper + (speed * 8)) & 0xFF;
obj->segment.unk18 = (obj->segment.unk18 + (speed * 8)) & 0xFF;
}
+1 -1
View File
@@ -545,7 +545,7 @@ void func_800AF6E4(Object *obj, s32 arg1) {
obj6C = &obj->unk6C[arg1];
obj6C->unk4 &= 0x7FFF;
obj->segment.unk18.half.lower--;
obj->segment.unk1A--;
}
GLOBAL_ASM("asm/non_matchings/particles/func_800AF714.s")
+29 -24
View File
@@ -388,7 +388,7 @@ void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *planeObj64) {
if (phi_v0 >= 0x4A) {
phi_v0 = 0x49;
}
temp_v1 = phi_v0 - planeObj->segment.unk18.half.upper;
temp_v1 = phi_v0 - planeObj->segment.unk18;
phi_v0 = 0;
if (temp_v1 > 0) {
phi_v0 = arg0 * 3;
@@ -402,7 +402,7 @@ void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *planeObj64) {
phi_v0 = temp_v1;
}
}
planeObj->segment.unk18.half.upper += phi_v0;
planeObj->segment.unk18 += phi_v0;
}
}
@@ -467,7 +467,7 @@ void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_Racer *obj64) {
if ((func_8002341C() != 0) && (obj64->unk1D6 == 0xA)) {
obj->unk4C->unk14 = 0;
}
sp26 = obj->segment.unk18.half.upper;
sp26 = obj->segment.unk18;
obj64->unk1D6 = 0xA;
func_80049794(arg0, arg1, obj, obj64);
obj64->unk1D6 = obj64->unk1D7;
@@ -482,12 +482,16 @@ void func_8004D95C(s32 arg0, s32 arg1, Object *obj, Object_Racer *obj64) {
obj64->unk154->segment.trans.x_rotation = obj->segment.trans.x_rotation;
obj64->unk154->segment.trans.z_rotation = obj->segment.trans.z_rotation;
obj->segment.unk3B = 0;
obj->segment.unk18.half.upper = sp26 + arg0;
obj->segment.unk18 = sp26 + arg0;
func_80061C0C(obj);
}
}
}
/**
* Initialise the basic properties of each racer object. If it's tied to a human player,
* will also initialise a camera object.
*/
void obj_init_racer(Object* obj, LevelObjectEntry_CharacterFlag* arg1) {
Object_Racer* tempObj;
s32 player;
@@ -578,6 +582,7 @@ void obj_init_racer(Object* obj, LevelObjectEntry_CharacterFlag* arg1) {
tempObj->unk1C6 = 100;
D_8011D580 = 0;
// This needs to be on one line to match.
for (i = 0; i < 4; i++) { D_8011D58C[i] = 0; }
if (tempObj);
if (tempObj);
@@ -625,7 +630,7 @@ void func_80050754(Object *obj, Object_Racer *obj64, f32 arg2) {
Object *someObj;
obj->segment.unk3B = 0;
obj->segment.unk18.half.upper = 0x28;
obj->segment.unk18 = 0x28;
someObj = obj64->unk148;
xDiff = someObj->segment.trans.x_position - obj->segment.trans.x_position;
yDiff = someObj->segment.trans.y_position - obj->segment.trans.y_position;
@@ -818,62 +823,62 @@ void func_80052988(Object *arg0, Object_Racer *arg1, s32 action, s32 arg3, s32 d
//render_printf("set0\n");
} else if (arg0->segment.unk3B == 0) {
if (arg6 & 1) {
if (arg0->segment.unk18.half.upper >= 41) {
arg0->segment.unk18.half.upper -= arg7 * 4;
if (arg0->segment.unk18.half.upper < 41) {
if (arg0->segment.unk18 >= 41) {
arg0->segment.unk18 -= arg7 * 4;
if (arg0->segment.unk18 < 41) {
arg0->segment.unk3B = action;
arg0->segment.unk18.half.upper = arg3;
arg0->segment.unk18 = arg3;
}
//render_printf("set1\n");
} else {
arg0->segment.unk18.half.upper += arg7 * 4;
if (arg0->segment.unk18.half.upper >= 40) {
arg0->segment.unk18 += arg7 * 4;
if (arg0->segment.unk18 >= 40) {
arg0->segment.unk3B = action;
arg0->segment.unk18.half.upper = arg3;
arg0->segment.unk18 = arg3;
}
//render_printf("set2\n");
}
} else { // Set active flag, whether it's from just crashing, or beginning to honk.
arg0->segment.unk3B = action;
arg0->segment.unk18.half.upper = arg3;
arg0->segment.unk18 = arg3;
arg1->unk1F3 &= ~0x80;
}
} else if (arg0->segment.unk3B == action) {
if (arg6 & 2) {
if (arg1->unk1F3 & 0x80) { // Stop honking or reversing.
arg0->segment.unk18.half.upper -= arg5;
if (arg0->segment.unk18.half.upper <= 0) {
arg0->segment.unk18 -= arg5;
if (arg0->segment.unk18 <= 0) {
arg0->segment.unk3B = 0;
arg1->unk1F2 = 0;
arg0->segment.unk18.half.upper = 40;
arg0->segment.unk18 = 40;
arg1->unk1F3 = 0;
}
} else { // Actively reversing or honking or boosting, possibly a velocity modifier, have found it's also set when recovering from getting hit by a rocket or spike trap
arg0->segment.unk18.half.upper += arg5;
arg0->segment.unk18 += arg5;
// Keeps the timer below the duration value, while actively held.
if (arg0->segment.unk18.half.upper >= duration) {
arg0->segment.unk18.half.upper = duration - 1;
if (arg0->segment.unk18 >= duration) {
arg0->segment.unk18 = duration - 1;
if ((arg6 & 4) == 0) {
arg1->unk1F3 |= 0x80;
}
}
}
} else { // Crash recoil
arg0->segment.unk18.half.upper += arg5;
if (arg0->segment.unk18.half.upper >= duration) {
arg0->segment.unk18 += arg5;
if (arg0->segment.unk18 >= duration) {
arg0->segment.unk3B = 0;
arg1->unk1F2 = 0;
arg0->segment.unk18.half.upper = 40;
arg0->segment.unk18 = 40;
arg1->unk1F3 = 0;
}
}
} else { // Haven't seen this trigger yet.
arg0->segment.unk18.half.upper = arg3;
arg0->segment.unk18 = arg3;
arg0->segment.unk3B = action;
}
/*render_printf("D_8011D55C %d\n", D_8011D55C);
render_printf("action %d\n", action);
render_printf("unk18 %d\n", arg0->segment.unk18.half.upper);
render_printf("unk18 %d\n", arg0->segment.unk18);
render_printf("unk3B %d\n", arg0->segment.unk3B);
render_printf("arg6 %d\n", arg6);
render_printf("arg7 %d\n", arg7);*/