mirror of
https://github.com/zeldaret/tmc
synced 2026-09-08 11:45:46 -04:00
Merge pull request #568 from hatal175/sub_08022E40
Match some functions
This commit is contained in:
+7
-10
@@ -146,12 +146,9 @@ void sub_08022DE8(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
// this definition is only here, so clang-tidy does not mess gUnk_080CBBBC up.
|
||||
extern void sub_08022E40(Entity* this);
|
||||
|
||||
NONMATCH("asm/non_matching/moldorm/sub_08022E40.inc", void sub_08022E40(Entity* this)) {
|
||||
void sub_08022E40(Entity* this) {
|
||||
u32 bVar1;
|
||||
u32 bVar2;
|
||||
u32 animationState;
|
||||
u32 tmp;
|
||||
u32 tmp2;
|
||||
u8* ptr;
|
||||
@@ -159,21 +156,21 @@ NONMATCH("asm/non_matching/moldorm/sub_08022E40.inc", void sub_08022E40(Entity*
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
tmp2 = (this->parent->field_0x78.HALF.HI + 1) & 7;
|
||||
bVar1 = ((u8*)&this->field_0x7c)[tmp2];
|
||||
ptr = (u8*)&this->field_0x7c + tmp2;
|
||||
bVar1 = *ptr;
|
||||
tmp = (bVar1 & 0xf) - 8;
|
||||
bVar1 >>= 4;
|
||||
this->x.HALF.HI = ((short)((tmp * 0x100)) >> 8) + this->x.HALF.HI;
|
||||
bVar1 -= 8;
|
||||
this->y.HALF.HI = bVar1 + this->y.HALF.HI;
|
||||
bVar2 = (u8)(*(u32*)&this->cutsceneBeh >> (((this->parent->field_0x78.HALF.HI + 1) & 7) << 2)) & 7;
|
||||
this->animationState = bVar2;
|
||||
animationState = (u8)(*(u32*)&this->cutsceneBeh >> (((this->parent->field_0x78.HALF.HI + 1) & 7) << 2)) & 7;
|
||||
this->animationState = animationState;
|
||||
if (this->type == 3) {
|
||||
this->frameIndex = bVar2 + 10;
|
||||
this->frameIndex = animationState + 10;
|
||||
} else {
|
||||
sub_08022EAC(this);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08022EAC(Entity* this) {
|
||||
int iVar1;
|
||||
|
||||
+39
-2
@@ -1201,9 +1201,46 @@ static void sub_08043ABC(Entity* this) {
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--;
|
||||
}
|
||||
|
||||
static ASM_FUNC("asm/non_matching/vaati/sub_08043B08.inc", void sub_08043B08(Entity* this))
|
||||
void sub_08043B08(Entity* this) {
|
||||
VaatiArm_HeapStruct1* hs1;
|
||||
VaatiArm_HeapStruct1* hs2;
|
||||
u32 bVar1;
|
||||
s32 uVar6;
|
||||
|
||||
static void sub_08043B7C(Entity* this) {
|
||||
hs1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[this->type - 1];
|
||||
hs2 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[this->type];
|
||||
bVar1 = gUnk_080D13B2[this->type];
|
||||
if (((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == 0) {
|
||||
uVar6 = (s8)((hs1->unk00.HALF.HI - hs2->unk00.HALF.HI));
|
||||
if (bVar1 < uVar6) {
|
||||
if (uVar6 <= 0) {
|
||||
hs2->unk00.HALF.HI = hs1->unk00.HALF.HI;
|
||||
} else {
|
||||
hs2->unk00.HALF.HI = hs1->unk00.HALF.HI - bVar1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uVar6 = (s8)(hs2->unk00.HALF.HI - hs1->unk00.HALF.HI);
|
||||
if (bVar1 < uVar6) {
|
||||
if (uVar6 < 0) {
|
||||
hs2->unk00.HALF.HI = hs1->unk00.HALF.HI;
|
||||
} else {
|
||||
hs2->unk00.HALF.HI = hs1->unk00.HALF.HI + bVar1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uVar6 = hs1->unk04.HALF.HI - hs2->unk04.HALF.HI;
|
||||
if ((bVar1 << 1) < uVar6 + bVar1) {
|
||||
if (uVar6 > 0) {
|
||||
hs2->unk04.HALF.HI = hs1->unk04.HALF.HI - bVar1;
|
||||
} else {
|
||||
hs2->unk04.HALF.HI = hs1->unk04.HALF.HI + bVar1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08043B7C(Entity* this) {
|
||||
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]);
|
||||
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]);
|
||||
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]);
|
||||
|
||||
+15
-17
@@ -142,50 +142,49 @@ const u8 gUnk_081280EE[] = {
|
||||
0x5u, 0x7u, 0xau, 0xeu, 0x13u, 0x1au,
|
||||
};
|
||||
|
||||
NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc", void KinstoneMenu_Type1(void)) {
|
||||
s32 tmp1, tmp2, tmp3, tmp4, tmp5;
|
||||
u8* ptr;
|
||||
void KinstoneMenu_Type1(void) {
|
||||
s32 tmp1, tmp2, tmp3, tmp4;
|
||||
GenericMenu* menu;
|
||||
if (gFadeControl.active) {
|
||||
return;
|
||||
}
|
||||
menu = &gGenericMenu;
|
||||
menu->base.column_idx = 2;
|
||||
tmp2 = menu->unk28 * 0x10000;
|
||||
tmp2 = menu->unk28 << 0x10;
|
||||
tmp1 = tmp2 - menu->unk10.i;
|
||||
if ((tmp1 < 0 ? -tmp1 : tmp1) <= 0x1ffdu) {
|
||||
menu->unk10.i = tmp2;
|
||||
} else {
|
||||
menu->base.column_idx = 1;
|
||||
tmp2 = sub_08000E44(tmp1);
|
||||
tmp1 = tmp1 / 0x20000;
|
||||
if (tmp1 < 0)
|
||||
tmp1 = -tmp1;
|
||||
if (tmp1 > 5) {
|
||||
tmp1 = 5;
|
||||
tmp3 = tmp1 / 0x20000;
|
||||
if (tmp3 < 0)
|
||||
tmp3 = -tmp3;
|
||||
if (tmp3 > 5) {
|
||||
tmp3 = 5;
|
||||
}
|
||||
menu->unk10.i += gUnk_081280EE[tmp1] * 0x666 * tmp2;
|
||||
menu->unk10.i += gUnk_081280EE[tmp3] * 0x666 * tmp2;
|
||||
}
|
||||
if (menu->unk29 != menu->unk10.i / 0x10000) {
|
||||
menu->unk29 = menu->unk10.i / 0x10000;
|
||||
SoundReq(SFX_TEXTBOX_CHOICE);
|
||||
}
|
||||
if ((gInput.newKeys & 0x20a) != 0) {
|
||||
if ((gInput.newKeys & (L_BUTTON | START_BUTTON | B_BUTTON)) != 0) {
|
||||
SetMenuType(2);
|
||||
SoundReq(SFX_MENU_CANCEL);
|
||||
return;
|
||||
}
|
||||
tmp3 = menu->unk28;
|
||||
switch (gInput.unk4) {
|
||||
case 0x20:
|
||||
case 0x40:
|
||||
case DPAD_LEFT:
|
||||
case DPAD_UP:
|
||||
tmp3--;
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x80:
|
||||
case DPAD_RIGHT:
|
||||
case DPAD_DOWN:
|
||||
tmp3++;
|
||||
break;
|
||||
case 1:
|
||||
case A_BUTTON:
|
||||
if (gMenu.column_idx == 2) {
|
||||
tmp3 = gGenericMenu.unk10.i / 0x10000;
|
||||
gGenericMenu.unk2a = gSave.unk118[tmp3];
|
||||
@@ -207,7 +206,6 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc", void Kins
|
||||
menu->unk28 = tmp3;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void KinstoneMenu_Type2(void) {
|
||||
const struct_080C9CBC* ptr;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#define NENT_DEPRECATED
|
||||
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
@@ -6,131 +7,135 @@
|
||||
#include "collision.h"
|
||||
#include "playeritem.h"
|
||||
|
||||
extern void (*const gUnk_081271D4[])(Entity*);
|
||||
extern u8 gUnk_081271DC[];
|
||||
void sub_080A2E00(Entity* this);
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
u8 unk_69[3];
|
||||
u32 bounceTimer;
|
||||
u32 unk_70;
|
||||
u32 unk_74;
|
||||
u32 unk_78;
|
||||
u8* unk_7c;
|
||||
} PlayerItemShieldEntity;
|
||||
|
||||
void PlayerItemShield(Entity* this) {
|
||||
if (*(int*)&this->field_0x6c != 0) {
|
||||
*(int*)&this->field_0x6c += -1;
|
||||
extern void (*const gUnk_081271D4[])(PlayerItemShieldEntity*);
|
||||
extern u8 gUnk_081271DC[];
|
||||
void sub_080A2E00(PlayerItemShieldEntity* this);
|
||||
|
||||
void PlayerItemShield(PlayerItemShieldEntity* this) {
|
||||
if (this->bounceTimer != 0) {
|
||||
this->bounceTimer--;
|
||||
}
|
||||
gUnk_081271D4[this->action](this);
|
||||
gUnk_081271D4[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080A2D98(Entity* this) {
|
||||
gPlayerState.item = this;
|
||||
this->action = 1;
|
||||
this->updatePriority = 6;
|
||||
this->frameIndex = 0xff;
|
||||
if (this->field_0x68.HALF.LO == 14) {
|
||||
this->field_0x70.WORD = 0x27;
|
||||
*(u32*)&this->field_0x78 = gUnk_081271DC[1];
|
||||
*(u32*)&this->field_0x74 = 0;
|
||||
*(u8**)&this->field_0x7c = gUnk_081271DC;
|
||||
void sub_080A2D98(PlayerItemShieldEntity* this) {
|
||||
gPlayerState.item = super;
|
||||
super->action = 1;
|
||||
super->updatePriority = 6;
|
||||
super->frameIndex = 0xff;
|
||||
if (this->unk_68 == 14) {
|
||||
this->unk_70 = 0x27;
|
||||
this->unk_78 = gUnk_081271DC[1];
|
||||
this->unk_74 = 0;
|
||||
this->unk_7c = gUnk_081271DC;
|
||||
} else {
|
||||
this->field_0x70.WORD = 0;
|
||||
this->unk_70 = 0;
|
||||
}
|
||||
this->animationState = gPlayerEntity.animationState & 0xe;
|
||||
sub_08079BD8(this);
|
||||
LoadSwapGFX(this, 1, 3);
|
||||
super->animationState = gPlayerEntity.animationState & 0xe;
|
||||
sub_08079BD8(super);
|
||||
LoadSwapGFX(super, 1, 3);
|
||||
sub_080A2E00(this);
|
||||
}
|
||||
|
||||
extern Hitbox* gUnk_08127240[];
|
||||
extern u8 gUnk_08127220[];
|
||||
|
||||
NONMATCH("asm/non_matching/playerItemShield/sub_080A2E00.inc", void sub_080A2E00(Entity* this)) {
|
||||
Entity* pEVar1;
|
||||
u8* iVar2;
|
||||
void sub_080A2E00(PlayerItemShieldEntity* this) {
|
||||
Entity* playerItem;
|
||||
u8* pbVar3;
|
||||
u8 uVar4;
|
||||
int iVar5;
|
||||
u32 tmp;
|
||||
u32 tmp2;
|
||||
|
||||
if ((gPlayerEntity.iframes == 0) || ((u8)gPlayerEntity.iframes == 0x81)) {
|
||||
gPlayerEntity.iframes = this->iframes;
|
||||
gPlayerEntity.knockbackDirection = this->knockbackDirection;
|
||||
gPlayerEntity.knockbackDuration = this->knockbackDuration;
|
||||
this->knockbackDuration = 0;
|
||||
this->iframes = 0;
|
||||
gPlayerEntity.iframes = super->iframes;
|
||||
gPlayerEntity.knockbackDirection = super->knockbackDirection;
|
||||
gPlayerEntity.knockbackDuration = super->knockbackDuration;
|
||||
super->knockbackDuration = 0;
|
||||
super->iframes = 0;
|
||||
}
|
||||
|
||||
uVar4 = gPlayerState.shield_status;
|
||||
if ((uVar4 != 0) && (this == gPlayerState.item)) {
|
||||
if ((uVar4 & 0x80) != 0) {
|
||||
this->hitbox = gUnk_08127240[this->animationState >> 1];
|
||||
this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
|
||||
this->flags = this->flags | 0x80;
|
||||
gPlayerState.shield_status = uVar4 & 0x7f;
|
||||
sub_080176E4(this);
|
||||
if ((gPlayerState.shield_status != 0) && (super == gPlayerState.item)) {
|
||||
if ((gPlayerState.shield_status & 0x80) != 0) {
|
||||
super->hitbox = gUnk_08127240[super->animationState >> 1];
|
||||
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
|
||||
COLLISION_ON(super);
|
||||
gPlayerState.shield_status &= ~0x80;
|
||||
sub_080176E4(super);
|
||||
} else {
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
if ((((this->contactFlags & 0x7f) == 0x42) && (*(char*)&this->field_0x68 == 0xe)) &&
|
||||
((uVar4 & 0x40) == 0)) {
|
||||
pEVar1 = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 0, 0, *(char*)&this->field_0x68);
|
||||
this->child = pEVar1;
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->subtimer = 1;
|
||||
this->child->direction = this->knockbackDirection ^ 0x10;
|
||||
this->child->parent = this;
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if ((((super->contactFlags & 0x7f) == 0x42) && this->unk_68 == 0xe) &&
|
||||
((gPlayerState.shield_status & 0x40) == 0)) {
|
||||
playerItem = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 0, 0, this->unk_68);
|
||||
super->child = playerItem;
|
||||
if (playerItem != NULL) {
|
||||
playerItem->subtimer = 1;
|
||||
super->child->direction = DirectionTurnAround(super->knockbackDirection);
|
||||
super->child->parent = super;
|
||||
}
|
||||
*(u32*)&this->field_0x78 = gUnk_08127220[1];
|
||||
*(u32*)&this->field_0x74 = uVar4 & 0x40;
|
||||
*(u8**)&this->field_0x7c = gUnk_08127220;
|
||||
this->unk_78 = gUnk_08127220[1];
|
||||
this->unk_74 = 0;
|
||||
this->unk_7c = gUnk_08127220;
|
||||
gPlayerState.shield_status |= 0x40;
|
||||
}
|
||||
if (*(int*)&this->field_0x6c == 0) {
|
||||
SoundReq(0x118);
|
||||
*(u32*)&this->field_0x6c = 8;
|
||||
if (this->bounceTimer == 0) {
|
||||
SoundReq(SFX_ITEM_SHIELD_BOUNCE);
|
||||
this->bounceTimer = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gPlayerState.shield_status = 0;
|
||||
if (gPlayerState.item == this) {
|
||||
if (gPlayerState.item == super) {
|
||||
gPlayerState.item = NULL;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (((gPlayerEntity.spriteIndex == 1U) || (gPlayerEntity.spriteIndex == 4U)) &&
|
||||
if (((gPlayerEntity.spriteIndex == 1u) || (gPlayerEntity.spriteIndex == 4u)) &&
|
||||
((u8)(gPlayerEntity.frameIndex - 0x25) < 0x3f)) {
|
||||
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
|
||||
this->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY;
|
||||
if ((gPlayerEntity.frameIndex - 0x25 + this->field_0x70.WORD != (u32)this->frameIndex) &&
|
||||
((this->frameIndex = gPlayerEntity.frameIndex - 0x25 + this->field_0x70.WORD,
|
||||
*(char*)&this->field_0x68 != 0xe || ((gPlayerEntity.frame & 0x7f) == 0)))) {
|
||||
sub_080042D0(this, this->frameIndex, (u16)this->spriteIndex);
|
||||
super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
|
||||
super->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY;
|
||||
if ((gPlayerEntity.frameIndex - 0x25 + this->unk_70 != super->frameIndex) &&
|
||||
((super->frameIndex = gPlayerEntity.frameIndex - 0x25 + this->unk_70,
|
||||
this->unk_68 != 0xe || ((gPlayerEntity.frame & 0x7f) == 0)))) {
|
||||
sub_080042D0(super, super->frameIndex, super->spriteIndex);
|
||||
}
|
||||
if (((*(char*)&this->field_0x68 == 0xe) && ((gPlayerEntity.frame & 0x7f) != 0))) {
|
||||
(*(int*)&this->field_0x78)--;
|
||||
if ((*(int*)&this->field_0x78) == 0) {
|
||||
(*(int*)&this->field_0x74)++;
|
||||
iVar5 = (*(int*)&this->field_0x74) * 4;
|
||||
iVar2 = *(u8**)&this->field_0x7c;
|
||||
if (iVar2[iVar5] == 0xff) {
|
||||
if (((this->unk_68 == 0xe) && ((gPlayerEntity.frame & 0x7f) != 0))) {
|
||||
if (--this->unk_78 == 0) {
|
||||
this->unk_74++;
|
||||
tmp2 = this->unk_74 * 4;
|
||||
pbVar3 = &this->unk_7c[tmp2];
|
||||
if (pbVar3[0] == 0xff) {
|
||||
if ((gPlayerState.shield_status & 0x40) != 0) {
|
||||
*(u8**)&this->field_0x7c = gUnk_081271DC;
|
||||
gPlayerState.shield_status = gPlayerState.shield_status & 0xbf;
|
||||
this->unk_7c = gUnk_081271DC;
|
||||
gPlayerState.shield_status &= ~0x40;
|
||||
}
|
||||
*(u32*)&this->field_0x74 = 0;
|
||||
iVar2 = *(u8**)&this->field_0x7c;
|
||||
this->unk_74 = 0;
|
||||
}
|
||||
pbVar3 = &iVar2[*(int*)&this->field_0x74 * 4];
|
||||
*(u32*)&this->field_0x78 = pbVar3[1];
|
||||
pbVar3 = &this->unk_7c[this->unk_74 * 4];
|
||||
this->unk_78 = pbVar3[1];
|
||||
if ((gPlayerState.shield_status & 0x40) != 0) {
|
||||
u32 temp = (gPlayerEntity.frame & 0x7f) + 8;
|
||||
sub_080042D0(this, temp + *pbVar3, (u16)this->spriteIndex);
|
||||
sub_080042D0(super, temp + pbVar3[0], super->spriteIndex);
|
||||
} else {
|
||||
sub_080042D0(this, (gPlayerEntity.frame & 0x7f) + *pbVar3, (u16)this->spriteIndex);
|
||||
sub_080042D0(super, (gPlayerEntity.frame & 0x7f) + pbVar3[0], super->spriteIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
this->frame = gPlayerEntity.frame;
|
||||
this->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
|
||||
sub_08078E84(this, &gPlayerEntity);
|
||||
super->frame = gPlayerEntity.frame;
|
||||
super->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
|
||||
sub_08078E84(super, &gPlayerEntity);
|
||||
} else {
|
||||
this->frameIndex = 0xff;
|
||||
super->frameIndex = 0xff;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
Reference in New Issue
Block a user