Match sub_08038304 and sub_08046518

This commit is contained in:
Tal Hayon
2023-01-04 21:04:57 +02:00
parent 9016bc861e
commit 07edb4e487
4 changed files with 62 additions and 200 deletions
+19 -19
View File
@@ -240,30 +240,30 @@ void sub_080464C0(GyorgFemaleEntity* this) {
gUpdateVisibleTiles = 1;
}
NONMATCH("asm/non_matching/gyorg_female/sub_08046518.inc", void sub_08046518(void)) {
u32 r5;
u16* stack1;
u8* stack2;
u8* r6;
#define sub_08046518_offset 0x658
void sub_08046518(void) {
u16* ptr = gMapTop.metatileTypes;
u16* sl = &gMapTop.mapData[sub_08046518_offset];
u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset];
u8* stack2 = &gMapTop.unkData3[sub_08046518_offset];
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
u32 i;
u16* sl;
sl = &gMapTop.metatileTypes[0xFFFFBCB0];
stack1 = &gMapTop.metatileTypes[0xFFFFECB0];
stack2 = (u8*)&gMapTop.metatileTypes[0x00006658];
r6 = (u8*)&gMapTop.metatileTypes[0xFFFFD658];
for (i = 0; i < 0x10; i++) {
for (i = 0x10; i != 0; i--) {
u32 j;
for (j = 0x10; j != 0; j--) {
u16 new_var;
stack1[j] = sl[j];
new_var = ptr[sl[j]];
stack2[j] = gUnk_080B37A0[new_var];
r6[j] = gUnk_080B3E80[new_var];
}
sl += 0x40;
stack1 += 0x40;
for (r5 = 0; r5 < 0x10; r5++) {
stack1[r5] = sl[r5];
stack2[r5] = gUnk_080B37A0[gMapTop.metatileTypes[sl[r5]]];
r6[r5] = gUnk_080B3E80[gMapTop.metatileTypes[sl[r5]]];
}
stack2 = stack2 + 0x40;
r6 = r6 + 0x40;
stack2 += 0x40;
r6 += 0x40;
}
}
END_NONMATCH
void sub_080465C8(void) {
s32 x, y;
+43 -1
View File
@@ -96,7 +96,49 @@ void sub_080382EC(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/ropeGolden/sub_08038304.inc", void sub_08038304(Entity* this))
void sub_08038304(Entity* this) {
u32 cVar2;
s32 tmp;
u32 tmp3;
u32 h;
UpdateAnimationVariableFrames(this, 2);
if (!ProcessMovement0(this)) {
if (this->field_0x78.HALF.LO == this->direction) {
#ifdef EU
this->subtimer = 30;
#else
this->subtimer = 90;
#endif
sub_080383AC(this);
} else {
this->direction = this->field_0x78.HALF.LO;
}
} else {
tmp = 10;
if ((u8)((++this->timer) % tmp) == 0) {
this->timer = 0;
if (this->field_0x78.HALF.LO == this->direction) {
cVar2 = ((Random() & 2) - 1) << 27;
cVar2 = cVar2 >> 24;
h = this->field_0x78.HALF.HI;
tmp3 = (u8)cVar2 << 24;
if (tmp3 >> 24 == h) {
if (h == this->field_0x7a.HALF.LO) {
cVar2 = -tmp3 >> 24;
}
}
this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI;
this->field_0x78.HALF.HI = cVar2;
this->direction = (this->direction + cVar2) & 0x18;
} else {
this->direction = this->field_0x78.HALF.LO;
}
this->animationState = this->direction >> 3;
InitializeAnimation(this, this->animationState + 4);
}
}
}
void sub_080383AC(Entity* this) {
u32 v;