Merge pull request #16 from 21aslade/master

mask.c OK
This commit is contained in:
notyouraveragehooman
2020-06-19 22:36:16 -07:00
committed by GitHub
20 changed files with 160 additions and 273 deletions
+1 -1
View File
@@ -411,4 +411,4 @@ void BladeBrothers_Fusion(Entity* this) {
this->frames.all &= 0xfe;
sub_08068BEC(this, 0);
}
}
}
+1 -1
View File
@@ -84,4 +84,4 @@ void nullsub_143(Entity* this){}
void sub_0802A91C(Entity *this)
{
this->currentHealth = 0;
}
}
+1 -1
View File
@@ -130,4 +130,4 @@ void ClearGlobalFlag(u32 flag) {
void ClearRoomFlag(u32 flag) {
ClearBit(&gRoomFlags, flag);
}
}
+1 -1
View File
@@ -579,4 +579,4 @@ void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
sub_0808727C
};
//clang-format on
//clang-format on
+1 -1
View File
@@ -35,4 +35,4 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
JarEmpty,
JarEmpty,
JarEmpty,
};
};
+1 -1
View File
@@ -131,4 +131,4 @@ void sub_08021EF0(Entity *this)
this->field_0x78 = gUnk_080CB6D6[Random() & 0xf];
this->itemCooldown = 0x3c;
InitializeAnimation(this, 0);
}
}
+142
View File
@@ -0,0 +1,142 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "random.h"
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 sub_0805457C(Entity *, s32);
void Mask(Entity *this) {
MaskActionFuncs[this->action](this);
}
void sub_080929A4(Entity *this) {
if (this->entityType.parameter & 0xC0) {
if (CheckFlags(this->field_0x86)) {
s32 field_0x0a;
switch (this->entityType.parameter & 0xC0) {
case 0x40:
field_0x0a = gUnk_030010A0[0x5];
switch (field_0x0a) {
case 0x44D ... 0x44F:
case 0x182:
DeleteThisEntity();
goto switchEnd;
}
ClearFlag(this->field_0x86);
break;
case 0x80:
DeleteThisEntity();
break;
}
switchEnd:
}
}
this->action = 1;
this->field_0x20 = 0x18000;
this->field_0x78 = ((Random() & 7) << 10) | 0x2000;
this->field_0xf = this->actionDelay >> 1;
this->actionDelay = 0;
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);
this->itemCooldown = sub_080002E0(this->field_0x7c.HALF.HI, 1);
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;
}
if (gLinkEntity.animationState != 0) {
return;
}
// Check if link is close enough to the mask
if (this->y.HALF.HI + 40 < gLinkEntity.y.HALF.HI) {
return;
}
if (this->x.HALF.HI - gLinkEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gLinkEntity.x.HALF.HI <= -this->field_0xf) {
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->actionDelay == 1) {
this->action = 3;
this->actionDelay = 0;
switch (this->entityType.parameter & 0xC0)
{
case 0x80:
sub_08004488(0x72);
case 0x40:
SetFlag(this->field_0x86);
break;
}
CreateFx(this, 5, 0);
sub_0805457C(this, 3);
}
else {
sub_080044EC(this, this->field_0x78);
if (this->height.HALF.HI == 0) {
this->actionDelay++;
}
}
}
void Mask_Delete(Entity *this) {
DeleteThisEntity();
}
+1 -1
View File
@@ -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 };
+1 -1
View File
@@ -198,4 +198,4 @@ void (*const gObjectFunctions[])(Entity*) = {
EnemyItem,
ObjectC1,
};
//clang-format on
//clang-format on
+1 -1
View File
@@ -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];
}
}
+1 -1
View File
@@ -52,4 +52,4 @@ void sub_0806A3D8(Entity *this)
uVar1 = StartCutscene(this,&gUnk_08012F0C);
*(u32 *)&this->cutsceneBeh = (u32)uVar1;
sub_0807DD94(this, 0);
}
}
+1 -1
View File
@@ -65,4 +65,4 @@ void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2)
DoFade(0xc, 4);
break;
}
}
}
+1 -1
View File
@@ -74,4 +74,4 @@ void sub_0806A26C(Entity *this)
{
asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\"");
}
#endif
#endif
+1 -1
View File
@@ -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))
};
};
+1 -1
View File
@@ -22,4 +22,4 @@ void WindTribeFlag(Entity *this)
if (this->frameDuration == 0xff) {
this->frameDuration = (Random() & 0xf) + 0x10;
}
}
}
+1 -1
View File
@@ -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);
}
}