Remove LOH, LOB and LOBU hacks

This commit is contained in:
Luciano Ciccariello 2023-04-05 19:29:00 +01:00
parent 2aa856a9ab
commit b68b7b55f3
24 changed files with 115 additions and 117 deletions

View File

@ -10,8 +10,6 @@
#define STRCPY(dst, src) __builtin_memcpy(dst, src, sizeof(src))
#define LOH(x) (*(s16*)&(x))
#define LOB(x) (*(s8*)&(x))
#define LOBU(x) (*(u8*)&(x))
#if defined(HACKS) && !defined(PERMUTER)
// The following hacks are required to get a matching decompilation. If removed
// they will still logically match the original function.

View File

@ -535,7 +535,7 @@ void func_800F7244(void) {
}
}
#ifndef NON_MATCHING
#ifndef NON_EQUIVALENT
INCLUDE_ASM("asm/us/dra/nonmatchings/5298C", func_800F72BC);
#else
extern s32 D_80137948;
@ -1121,11 +1121,11 @@ void func_800FAF44(s32 arg0) {
var_a1++;
}
D_80137688 = D_8013768C = LOH(g_MenuNavigation.scrollEquipHand);
D_80137688 = D_8013768C = g_MenuNavigation.scrollEquipHand;
return;
}
D_80137688 = D_8013768C =
LOH(((s32*)g_MenuNavigation.scrollEquipAccessories)[D_801375D4]);
((s32*)g_MenuNavigation.scrollEquipAccessories)[D_801375D4];
for (i = 0; i < 90; i++) {
if (D_800A7734[i].unk00 == D_801375D4) {

View File

@ -854,18 +854,18 @@ s32 func_80125A30(s32 baseY, s32 baseX) {
y = baseY + g_CurrentEntity->posY.i.hi;
CheckCollision(x, y, &res1, 0);
colRes1 = LOH(res1.unk0) & 0xF801;
CheckCollision(x, (s16)(y - 1 + LOH(res1.unk18)), &res2, 0);
y = baseY + (g_CurrentEntity->posY.i.hi + LOH(res1.unk18));
colRes1 = res1.unk0 & 0xF801;
CheckCollision(x, (s16)(y - 1 + res1.unk18), &res2, 0);
y = baseY + (g_CurrentEntity->posY.i.hi + res1.unk18);
if ((colRes1 & 0x8801) == 1 || (colRes1 & 0x8801) == 0x0801) {
colRes2 = LOH(res2.unk0) & 0xF001;
if (!(LOH(res2.unk0) & 1)) {
colRes2 = res2.unk0 & 0xF001;
if (!((s16)res2.unk0 & 1)) {
g_CurrentEntity->posY.i.hi = y;
return 1;
}
if ((res2.unk0 & 0x8001) == 0x8001) {
g_CurrentEntity->posY.i.hi = y + (s16)(LOH(res2.unk18) - 1);
g_CurrentEntity->posY.i.hi = y + (s16)(res2.unk18 - 1);
return colRes2;
}
} else if ((colRes1 & 0x8001) == 0x8001) {
@ -886,9 +886,9 @@ s32 func_80125B6C(s16 arg0, s16 arg1) {
CheckCollision(g_CurrentEntity->posX.i.hi + arg1,
g_CurrentEntity->posY.i.hi + arg0, &res, 0);
if (g_CurrentEntity->accelerationX > 0) {
var_a1 = LOH(res.unk14);
var_a1 = res.unk14;
} else {
var_a1 = LOH(res.unk1C);
var_a1 = res.unk1C;
}
if (res.unk0 & 2) {

View File

@ -113,12 +113,12 @@ void func_8015C178(void) {
if (D_8007342A < 0) {
D_80072F66 = 0;
func_8015CD98(0);
} else if ((*(u16*)&PLAYER.animFrameIdx >= 0x12) &&
} else if ((PLAYER.animFrameIdx >= 0x12) &&
!(D_80072F20.pl_vram_flag & 1)) {
D_80072F66 = 0;
func_8015CF08();
} else {
if (!(D_8003C8C4 & 3) && (*(u16*)&PLAYER.animFrameIdx < 0x12) &&
if (!(D_8003C8C4 & 3) && (PLAYER.animFrameIdx < 0x12) &&
(D_80072F20.pl_vram_flag & 1)) {
func_801606BC(g_CurrentEntity, 0x20018, 0);
}

View File

@ -350,7 +350,7 @@ void func_801623E0(Entity* entity) {
poly->y2 = entity->posY.i.hi + entity->unk7E.modeU16;
poly->x3 = entity->posX.i.hi + entity->unk7C.s;
poly->y3 = entity->posY.i.hi + entity->unk7E.modeU16;
poly->clut = (*(s16*)&g_blinkTimer & 1) + 0x13E;
poly->clut = (LOH(g_blinkTimer) & 1) + 0x13E;
}
/**
@ -811,9 +811,9 @@ s32 func_8016840C(s16 x, s16 y) {
g_api.CheckCollision(g_CurrentEntity->posX.i.hi + y,
g_CurrentEntity->posY.i.hi + x, &res, 0);
if (g_CurrentEntity->accelerationX > 0) {
temp = LOH(res.unk14);
temp = res.unk14;
} else {
temp = LOH(res.unk1C);
temp = res.unk1C;
}
if (!(res.unk0 & 2)) {
return 0;

View File

@ -77,7 +77,7 @@ bool func_80171434(s16 x, s16 y, s16* outX, s16* outY) {
break;
case 1:
*outX = x;
*outY = curY + LOH(D_80174AD8.unk10);
*outY = curY + D_80174AD8.unk10;
return 1;
default:
return 0;

View File

@ -46,7 +46,7 @@ INCLUDE_ASM("asm/us/st/cen/nonmatchings/D600", func_8018E6C4);
INCLUDE_ASM("asm/us/st/cen/nonmatchings/D600", EntityUnkId16);
void func_8018F890(s16 arg0) {
s16 temp_v0 = arg0 - *(s16*)&g_CurrentRoom.height;
s16 temp_v0 = arg0 - g_CurrentRoom.height;
if (temp_v0 > 1) {
g_CurrentRoom.height++;
@ -448,9 +448,9 @@ void func_801951C0(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}

View File

@ -806,9 +806,9 @@ void func_8019B304(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -897,7 +897,7 @@ void func_8019B8DC(u16 arg0) {
return;
}
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
return;
}

View File

@ -50,8 +50,8 @@ void EntityEquipItemDrop(Entity* self) {
return;
}
if (*(s16*)&self->unk94 != 0) {
temp_a0 = *(s16*)&self->unk94;
if (LOH(self->unk94) != 0) {
temp_a0 = LOH(self->unk94);
temp_a0--;
D_8003BF9C[temp_a0 >> 3] |= 1 << (temp_a0 & 7);
}
@ -342,7 +342,7 @@ bool func_8019E9F4(Unkstruct6* arg0) {
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;

View File

@ -80,7 +80,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
} else {
@ -90,7 +90,7 @@ void EntityPrizeDrop(Entity* self) {
return;
}
if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -172,7 +172,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -431,7 +431,7 @@ bool func_80195E68(Unkstruct6* unk) {
posY += unk->y;
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;
if (g_CurrentEntity->accelerationY > -0x10000) {

View File

@ -815,9 +815,9 @@ void func_80192EF8(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -911,7 +911,7 @@ void func_801934D0(u16 arg0) {
}
g_CurrentEntity->posY.i.hi =
(u16)g_CurrentEntity->posY.i.hi + LOH(res.unk18);
(u16)g_CurrentEntity->posY.i.hi + res.unk18;
return;
}

View File

@ -782,7 +782,7 @@ void EntityFallingRock2(Entity* self) {
DestroyEntity(self);
return;
}
self->posY.i.hi = self->posY.i.hi + *(u16*)&collider.unk18;
self->posY.i.hi = self->posY.i.hi + collider.unk18;
temp_a0 = -self->accelerationY;
self->accelerationY = -self->accelerationY;
if (temp_a0 < 0) {

View File

@ -906,9 +906,9 @@ void func_801C5BC0(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -997,7 +997,7 @@ void func_801C6198(u16 arg0) {
return;
}
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
return;
}

View File

@ -69,7 +69,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
} else {
@ -77,7 +77,7 @@ void EntityPrizeDrop(Entity* self) {
}
func_801C5BC0(D_801824E8, 2);
} else if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -161,7 +161,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -320,8 +320,8 @@ void EntityEquipItemDrop(Entity* self) {
return;
}
if (*(s16*)&self->unk94 != 0) {
temp_a0 = *(s16*)&self->unk94;
if (LOH(self->unk94) != 0) {
temp_a0 = LOH(self->unk94);
temp_a0--;
D_8003BF9C[temp_a0 >> 3] |= 1 << (temp_a0 & 7);
}
@ -391,7 +391,7 @@ void EntityEquipItemDrop(Entity* self) {
if ((collider.unk0 & 5) && (self->accelerationY > 0)) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += *(u16*)&collider.unk18;
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 240;
self->step++;
} else {
@ -616,7 +616,7 @@ bool func_801C92B0(Unkstruct6* unk) {
posY += unk->y;
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;
if (g_CurrentEntity->accelerationY > -0x10000) {
@ -989,9 +989,9 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
poly->v1 = poly->v0 = 0;
poly->u2 = poly->u0;
poly->u3 = poly->u1;
*(s16*)&((POLY_GT4*)poly->tag)->r2 = 0x40;
*(s16*)&((POLY_GT4*)poly->tag)->b2 = 0x40;
*(s16*)&((POLY_GT4*)poly->tag)->u1 = 0;
LOH(((POLY_GT4*)poly->tag)->r2) = 0x40;
LOH(((POLY_GT4*)poly->tag)->b2) = 0x40;
LOH(((POLY_GT4*)poly->tag)->u1) = 0;
((POLY_GT4*)poly->tag)->b3 = 0x60;
((POLY_GT4*)poly->tag)->x1 = (u16)entity->posX.i.hi;
((POLY_GT4*)poly->tag)->y0 = (u16)entity->posY.i.hi;
@ -1004,7 +1004,7 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
poly = *(s32*)&entity->unk7C.s;
func_801D6880(poly);
((POLY_GT4*)poly->tag)->b3 += 252;
*(s16*)&((POLY_GT4*)poly->tag)->u1 -= 128;
LOH(((POLY_GT4*)poly->tag)->u1) -= 128;
if (((POLY_GT4*)poly->tag)->b3 < 16) {
poly->pad3 = 8;
}
@ -1082,7 +1082,7 @@ void EntityUnkId3D(Entity* self) {
self->unk1C = 0x1A0;
self->unk19 |= 3;
self->unk84.S8.unk1 = 0x11;
self->unk84.S8.unk0 = *(s8*)&self->subId;
self->unk84.S8.unk0 = self->subId;
self->unk19 |= 8;
break;

View File

@ -1543,9 +1543,9 @@ void func_801BD430(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}

View File

@ -73,7 +73,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
@ -82,7 +82,7 @@ void EntityPrizeDrop(Entity* self) {
}
func_801BD430(D_80181E74, 2);
} else if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -166,7 +166,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -324,8 +324,8 @@ void EntityEquipItemDrop(Entity* self) {
return;
}
if (*(s16*)&self->unk94 != 0) {
temp_a0 = *(s16*)&self->unk94;
if (LOH(self->unk94) != 0) {
temp_a0 = LOH(self->unk94);
temp_a0--;
D_8003BF9C[temp_a0 >> 3] |= 1 << (temp_a0 & 7);
}
@ -777,9 +777,9 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
poly->v1 = poly->v0 = 0;
poly->u2 = poly->u0;
poly->u3 = poly->u1;
*(s16*)&((POLY_GT4*)poly->tag)->r2 = 0x40;
*(s16*)&((POLY_GT4*)poly->tag)->b2 = 0x40;
*(s16*)&((POLY_GT4*)poly->tag)->u1 = 0;
LOH(((POLY_GT4*)poly->tag)->r2) = 0x40;
LOH(((POLY_GT4*)poly->tag)->b2) = 0x40;
LOH(((POLY_GT4*)poly->tag)->u1) = 0;
((POLY_GT4*)poly->tag)->b3 = 0x60;
((POLY_GT4*)poly->tag)->x1 = (u16)entity->posX.i.hi;
((POLY_GT4*)poly->tag)->y0 = (u16)entity->posY.i.hi;
@ -792,7 +792,7 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
poly = *(s32*)&entity->unk7C.s;
func_801D1F38(poly);
((POLY_GT4*)poly->tag)->b3 += 252;
*(s16*)&((POLY_GT4*)poly->tag)->u1 -= 128;
LOH(((POLY_GT4*)poly->tag)->u1) -= 128;
if (((POLY_GT4*)poly->tag)->b3 < 16) {
poly->pad3 = 8;
}
@ -844,7 +844,7 @@ void func_801C7E18(Entity* self) {
self->unk1C = 0x1A0;
self->unk19 |= 3;
self->unk84.S8.unk1 = 0x11;
self->unk84.S8.unk0 = *(s8*)&self->subId; // wtf
self->unk84.S8.unk0 = self->subId;
self->unk19 |= 8;
break;

View File

@ -127,7 +127,7 @@ void func_801B19A0(Entity* self) {
g_api.CheckCollision(self->posX.i.hi, self->posY.i.hi + 6, &collider,
0);
if (collider.unk0 & 1) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
if (self->subId == 0) {
func_801C29B0(0x644);
for (i = 0; i < 2; i++) {
@ -363,7 +363,7 @@ void EntityMoveableBox(Entity* self) {
if (var_v0 < 24) {
var_s1 = 2;
}
if ((self->unk84.unk == 0) && (*(s16*)&D_801CB736[var_s1] != 0)) {
if ((self->unk84.unk == 0) && ((s16)D_801CB736[var_s1] != 0)) {
var_s1 = 0;
self->posX.val -= self->accelerationX;
}
@ -1419,7 +1419,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -1427,7 +1427,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -1457,7 +1457,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -1465,7 +1465,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -1914,9 +1914,9 @@ void func_801BD848(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -2003,7 +2003,7 @@ void func_801BDE20(u16 arg0) {
if (res.unk0 & 4) {
g_CurrentEntity->posY.val += 0x2000;
} else {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
}
} else {
if (!(res.unk0 & 5)) {

View File

@ -71,7 +71,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
} else {
@ -79,7 +79,7 @@ void EntityPrizeDrop(Entity* self) {
}
func_801BD848(D_80181D9C, 2);
} else if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -163,7 +163,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -325,8 +325,8 @@ void EntityEquipItemDrop(Entity* self) {
return;
}
if (*(s16*)&self->unk94 != 0) {
temp_a0 = *(s16*)&self->unk94;
if (LOH(self->unk94) != 0) {
temp_a0 = LOH(self->unk94);
temp_a0--;
D_8003BF9C[temp_a0 >> 3] |= 1 << (temp_a0 & 7);
}
@ -396,7 +396,7 @@ void EntityEquipItemDrop(Entity* self) {
if ((collider.unk0 & 5) && (self->accelerationY > 0)) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += *(u16*)&collider.unk18;
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 240;
self->step++;
} else {
@ -626,7 +626,7 @@ bool func_801C0F38(Unkstruct6* unk) {
posY += unk->y;
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;
if (g_CurrentEntity->accelerationY > -0x10000) {

View File

@ -46,12 +46,12 @@ void func_801AC084(s32 arg0, s32 ypos) {
Primitive* prim = &g_PrimBuf[D_801BAF18[arg0].unk0];
s32 i;
for (i = 0; i < 8; i++) {
prim->x0 = LOH(D_80180068[i]) + 0x68;
prim->y0 = LOH(D_80180088[i]) + 0x58 + ypos;
prim->u0 = LOBU(D_801800A8[i]);
prim->v0 = LOBU(D_801800C8[i]);
prim->u1 = LOBU(D_801800E8[i]);
prim->v1 = LOBU(D_80180108[i]);
prim->x0 = D_80180068[i] + 0x68;
prim->y0 = D_80180088[i] + 0x58 + ypos;
prim->u0 = D_801800A8[i];
prim->v0 = D_801800C8[i];
prim->u1 = D_801800E8[i];
prim->v1 = D_80180108[i];
prim->tpage = 0xC;
prim->clut = 0x200;
prim->priority = 0x11;

View File

@ -375,7 +375,7 @@ void func_801B60D4(void) {
D_801D6B24 = 0;
D_801BD030 = 0;
g_EntityArray[8].subId = *(u16*)&D_800978B4 - 1;
g_EntityArray[8].subId = D_800978B4 - 1;
g_api.func_800EA5E4(0x16);
g_api.func_800EA5E4(0);
g_api.func_800EA5E4(0x8005);

View File

@ -775,7 +775,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -783,7 +783,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -813,7 +813,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -821,7 +821,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -1264,9 +1264,9 @@ void func_801B5A98(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -1311,11 +1311,11 @@ void func_801B5EC8(void) {
entity = g_CurrentEntity;
if (entity->accelerationY >= 0) {
temp_v1 = *(s16*)&entity->unk88 + entity->unk84.unk;
temp_v1 = entity->unk88.S16.unk0 + entity->unk84.unk;
entity->unk84.unk = temp_v1;
entity->accelerationX = temp_v1;
if (temp_v1 == 0x10000 || temp_v1 == -0x10000) {
*(s16*)&entity->unk88 = -*(s16*)&entity->unk88;
entity->unk88.S16.unk0 = -entity->unk88.S16.unk0;
}
entity = g_CurrentEntity;
}
@ -1355,7 +1355,7 @@ void func_801B5F4C(u16 arg0) {
return;
}
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
return;
}

View File

@ -72,7 +72,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
} else {
@ -82,7 +82,7 @@ void EntityPrizeDrop(Entity* self) {
return;
}
if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -160,7 +160,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -387,7 +387,7 @@ bool func_801B8338(Unkstruct6* unk) {
posY += unk->y;
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;
if (g_CurrentEntity->accelerationY > -0x10000) {

View File

@ -1947,7 +1947,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -1955,7 +1955,7 @@ void CreateEntityWhenInVerticalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -1985,7 +1985,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
switch (layoutObj->objectId & 0xE000) {
case 0x0:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
if (entity->objectId == 0) {
CreateEntityFromLayout(entity, layoutObj);
}
@ -1993,7 +1993,7 @@ void CreateEntityWhenInHorizontalRange(LayoutObject* layoutObj) {
case 0x8000:
break;
case 0xA000:
entity = &D_800762D8[LOBU(layoutObj->objectRoomIndex)];
entity = &D_800762D8[(u8)layoutObj->objectRoomIndex];
CreateEntityFromLayout(entity, layoutObj);
break;
}
@ -2052,7 +2052,7 @@ void func_8018A424(s16 arg0) {
s32 expected;
if (D_80193ABC) {
func_8018A380(arg0 - LOH(D_8009790C));
func_8018A380(arg0 - D_8009790C);
D_80193ABC = 0;
}
@ -2080,7 +2080,7 @@ void func_8018A520(s16 arg0) {
}
if (D_80193ABC == 0) {
func_8018A3CC(arg0 - LOH(D_8009790C));
func_8018A3CC(arg0 - D_8009790C);
D_80193ABC = 1;
}
@ -2592,9 +2592,9 @@ void func_8018C55C(u16* hitSensors, s16 sensorCount) {
g_api.CheckCollision(x, y, &collider, 0);
if (collider.unk0 & 2 && (!(collider.unk0 & 0x8000) || i != 0)) {
if (accelerationX < 0) {
g_CurrentEntity->posX.i.hi += LOH(collider.unk1C);
g_CurrentEntity->posX.i.hi += collider.unk1C;
} else {
g_CurrentEntity->posX.i.hi += LOH(collider.unk14);
g_CurrentEntity->posX.i.hi += collider.unk14;
}
return;
}
@ -2639,11 +2639,11 @@ void func_8018CAB0(void) {
entity = g_CurrentEntity;
if (entity->accelerationY >= 0) {
temp_v1 = *(s16*)&entity->unk88 + entity->unk84.unk;
temp_v1 = entity->unk88.S16.unk0 + entity->unk84.unk;
entity->unk84.unk = temp_v1;
entity->accelerationX = temp_v1;
if (temp_v1 == 0x10000 || temp_v1 == -0x10000) {
*(s16*)&entity->unk88 = -*(s16*)&entity->unk88;
entity->unk88.S16.unk0 = -entity->unk88.S16.unk0;
}
entity = g_CurrentEntity;
}
@ -2683,7 +2683,7 @@ void func_8018CB34(u16 arg0) {
return;
}
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
return;
}

View File

@ -79,7 +79,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0xF0;
self->step++;
} else {
@ -87,7 +87,7 @@ void EntityPrizeDrop(Entity* self) {
}
func_8018C55C(D_80180EB8, 2);
} else if (collider.unk0 & 5) {
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 0x60;
self->step++;
} else {
@ -171,7 +171,7 @@ void EntityPrizeDrop(Entity* self) {
if (collider.unk0 & 5 && self->accelerationY > 0) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += LOH(collider.unk18);
self->posY.i.hi += collider.unk18;
self->unk2E++;
} else {
FallEntity();
@ -335,8 +335,8 @@ void EntityEquipItemDrop(Entity* self) {
return;
}
if (*(s16*)&self->unk94 != 0) {
temp_a0 = *(s16*)&self->unk94;
if (LOH(self->unk94) != 0) {
temp_a0 = LOH(self->unk94);
temp_a0--;
D_8003BF9C[temp_a0 >> 3] |= 1 << (temp_a0 & 7);
}
@ -406,7 +406,7 @@ void EntityEquipItemDrop(Entity* self) {
if ((collider.unk0 & 5) && (self->accelerationY > 0)) {
self->accelerationX = 0;
self->accelerationY = 0;
self->posY.i.hi += *(u16*)&collider.unk18;
self->posY.i.hi += collider.unk18;
self->unk80.modeS8.unk0 = 240;
self->step++;
} else {
@ -664,7 +664,7 @@ bool func_8018FC4C(Unkstruct6* unk) {
posY += unk->y;
g_api.CheckCollision(posX, posY, &res, 0);
if (res.unk0 & 1) {
g_CurrentEntity->posY.i.hi += LOH(res.unk18);
g_CurrentEntity->posY.i.hi += res.unk18;
g_CurrentEntity->accelerationY =
-g_CurrentEntity->accelerationY / 2;
if (g_CurrentEntity->accelerationY > -0x10000) {