mirror of https://github.com/zeldaret/tmc.git
Improve mask.c, update to latest Entity struct
Also ran format.sh which changed various files
This commit is contained in:
parent
d13da4af82
commit
31f1937534
|
@ -1360,7 +1360,7 @@ gUnk_08122794:: @ 08122794
|
|||
gUnk_0812279C:: @ 0812279C
|
||||
.incbin "baserom.gba", 0x12279C, 0x0000008
|
||||
|
||||
gUnk_081227A4:: @ 081227A4
|
||||
MaskActionFuncs:: @ 081227A4
|
||||
.incbin "baserom.gba", 0x1227A4, 0x0000010
|
||||
|
||||
gUnk_081227B4:: @ 081227B4
|
||||
|
|
|
@ -411,4 +411,4 @@ void BladeBrothers_Fusion(Entity* this) {
|
|||
this->frames.all &= 0xfe;
|
||||
sub_08068BEC(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,4 @@ void nullsub_143(Entity* this){}
|
|||
void sub_0802A91C(Entity *this)
|
||||
{
|
||||
this->currentHealth = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,4 +130,4 @@ void ClearGlobalFlag(u32 flag) {
|
|||
|
||||
void ClearRoomFlag(u32 flag) {
|
||||
ClearBit(&gRoomFlags, flag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -579,4 +579,4 @@ void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
|
|||
sub_0808727C
|
||||
};
|
||||
|
||||
//clang-format on
|
||||
//clang-format on
|
||||
|
|
|
@ -35,4 +35,4 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
|
|||
JarEmpty,
|
||||
JarEmpty,
|
||||
JarEmpty,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -131,4 +131,4 @@ void sub_08021EF0(Entity *this)
|
|||
this->field_0x78 = gUnk_080CB6D6[Random() & 0xf];
|
||||
this->itemCooldown = 0x3c;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
|
69
src/mask.c
69
src/mask.c
|
@ -3,39 +3,44 @@
|
|||
#include "room.h"
|
||||
#include "random.h"
|
||||
|
||||
#define COORD_TO_TILE(entity) ((((entity->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3fU) | (((entity->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3fU) << 6)
|
||||
|
||||
extern void (*gUnk_081227A4[])(Entity *);
|
||||
extern void DeleteThisEntity();
|
||||
extern u16 gUnk_030010A0[];
|
||||
extern bool32 CheckFlags(u16);
|
||||
extern void ClearFlag(u16);
|
||||
extern s16 sub_080001DA(u16, u32);
|
||||
extern void SetTile(u32, u16, u32);
|
||||
extern u16 sub_080002E0(u16, u32);
|
||||
extern void sub_08000148(u16, u16, u32);
|
||||
extern Entity gLinkEntity;
|
||||
extern u16 gUnk_030010A0[];
|
||||
|
||||
extern void (*MaskActionFuncs[])(Entity *);
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
|
||||
extern bool32 CheckFlags(u16);
|
||||
extern void SetFlag(u16);
|
||||
extern void ClearFlag(u16);
|
||||
|
||||
extern void SetTile(u32, u16, u32);
|
||||
|
||||
extern void CreateFx(Entity *, u16, u16);
|
||||
|
||||
extern void sub_08000148(u16, u16, u32);
|
||||
extern s16 sub_080001DA(u16, u32);
|
||||
extern u16 sub_080002E0(u16, u32);
|
||||
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_080044EC(Entity *, u16);
|
||||
extern void CreateFx(Entity *, u16, u16);
|
||||
extern void sub_0805457C(Entity *, s32);
|
||||
extern void SetFlag(u16);
|
||||
|
||||
|
||||
void Mask(Entity *this) {
|
||||
gUnk_081227A4[this->action](this);
|
||||
MaskActionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080929A4(Entity *this) {
|
||||
if (this->entityType.parameter2 & 0xC0) {
|
||||
if (this->entityType.parameter & 0xC0) {
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
s32 field_0x0a;
|
||||
switch (this->entityType.parameter2 & 0xC0) {
|
||||
|
||||
switch (this->entityType.parameter & 0xC0) {
|
||||
case 0x40:
|
||||
field_0x0a = gUnk_030010A0[0x5];
|
||||
|
||||
switch (field_0x0a) {
|
||||
default:
|
||||
break;
|
||||
case 0x44D ... 0x44F:
|
||||
case 0x182:
|
||||
DeleteThisEntity();
|
||||
|
@ -57,10 +62,10 @@ void sub_080929A4(Entity *this) {
|
|||
|
||||
this->field_0x78 = ((Random() & 7) << 10) | 0x2000;
|
||||
|
||||
this->field_0xf = this->parameter3 >> 1;
|
||||
this->parameter3 = 0;
|
||||
this->field_0xf = this->actionDelay >> 1;
|
||||
this->actionDelay = 0;
|
||||
|
||||
this->animationList = this->entityType.parameter2 & 0x3f;
|
||||
this->frameIndex = this->entityType.parameter & 0x3f;
|
||||
|
||||
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
|
||||
this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1);
|
||||
|
@ -70,7 +75,9 @@ void sub_080929A4(Entity *this) {
|
|||
SetTile(0x4022, this->field_0x7c.HALF.HI, 1);
|
||||
}
|
||||
|
||||
// Probably related to knocking it down
|
||||
void sub_08092A94(Entity *this) {
|
||||
// Check for the first frame of bonking animation
|
||||
if (gLinkEntity.action != 6) {
|
||||
return;
|
||||
}
|
||||
|
@ -79,6 +86,7 @@ void sub_08092A94(Entity *this) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if link is close enough to the mask
|
||||
if (this->y.HALF.HI + 40 < gLinkEntity.y.HALF.HI) {
|
||||
return;
|
||||
}
|
||||
|
@ -87,21 +95,26 @@ void sub_08092A94(Entity *this) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Presumably, make the mask fall
|
||||
SetTile((u16)this->field_0x7c.HALF.LO, this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
sub_08000148(this->itemCooldown, this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
this->action = 2;
|
||||
|
||||
this->height.HALF.HI -= 0x20;
|
||||
this->y.HALF.HI += 0x20;
|
||||
|
||||
this->spriteOrder.b3 = 2;
|
||||
}
|
||||
|
||||
// Probably falling down
|
||||
void sub_08092B0C(Entity *this) {
|
||||
if (this->parameter3 == 1) {
|
||||
if (this->actionDelay == 1) {
|
||||
this->action = 3;
|
||||
this->parameter3 = 0;
|
||||
switch (this->entityType.parameter2 & 0xC0)
|
||||
|
||||
this->actionDelay = 0;
|
||||
switch (this->entityType.parameter & 0xC0)
|
||||
{
|
||||
case 0x80:
|
||||
sub_08004488(0x72);
|
||||
|
@ -110,18 +123,20 @@ void sub_08092B0C(Entity *this) {
|
|||
break;
|
||||
|
||||
}
|
||||
|
||||
CreateFx(this, 5, 0);
|
||||
|
||||
sub_0805457C(this, 3);
|
||||
}
|
||||
else {
|
||||
sub_080044EC(this, this->field_0x78);
|
||||
|
||||
if (this->height.HALF.HI == 0) {
|
||||
this->parameter3++;
|
||||
this->actionDelay++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08092B6C(Entity *this) {
|
||||
void Mask_Delete(Entity *this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,4 +135,4 @@ void (*const gNPCFunctions[][3])(Entity* ent) = {
|
|||
{ DeleteEntity, NULL, NULL }
|
||||
};
|
||||
//clang-format on
|
||||
const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 };
|
||||
const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 };
|
||||
|
|
|
@ -198,4 +198,4 @@ void (*const gObjectFunctions[])(Entity*) = {
|
|||
EnemyItem,
|
||||
ObjectC1,
|
||||
};
|
||||
//clang-format on
|
||||
//clang-format on
|
||||
|
|
|
@ -53,4 +53,4 @@ void ResolveEntityOnTop(Entity *param_1,Entity *param_2)
|
|||
void sub_0806FAD8(Entity *param_1,Entity *param_2)
|
||||
{
|
||||
param_2->ticks.b0 = gUnk_08114F80[param_1->ticks.b0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,4 +52,4 @@ void sub_0806A3D8(Entity *this)
|
|||
uVar1 = StartCutscene(this,&gUnk_08012F0C);
|
||||
*(u32 *)&this->cutsceneBeh = (u32)uVar1;
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,4 +65,4 @@ void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2)
|
|||
DoFade(0xc, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,4 +74,4 @@ void sub_0806A26C(Entity *this)
|
|||
{
|
||||
asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\"");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -327,4 +327,4 @@ const s16 gCosineTable[] = {
|
|||
Q_8_8(0.99609375), // sin(317*(π/128))
|
||||
Q_8_8(0.99609375), // sin(318*(π/128))
|
||||
Q_8_8(0.99609375), // sin(319*(π/128))
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,4 +22,4 @@ void WindTribeFlag(Entity *this)
|
|||
if (this->frameDuration == 0xff) {
|
||||
this->frameDuration = (Random() & 0xf) + 0x10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,4 +38,4 @@ void Windcrest_Unlock(Entity *this)
|
|||
PlaySFX(0x72);
|
||||
gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter + 0x18);
|
||||
CreateFx(this, 0x46, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue