Merge branch 'master' into gyorg

This commit is contained in:
Ibot02
2022-01-09 20:46:03 +01:00
1301 changed files with 26072 additions and 28415 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "audio.h"
#include "object.h"
extern s32 sub_080AF090(Entity*);
@@ -75,7 +74,7 @@ void ArrowProjectile_Action2(Entity* this) {
this->actionDelay = 0x20;
InitializeAnimation(this, this->animIndex + 2);
EnqueueSFX(0x18a);
sub_0806F69C(this);
LinearMoveUpdate(this);
} else if (--this->actionDelay == 0) {
DeleteThisEntity();
}
@@ -90,7 +89,7 @@ void ArrowProjectile_Action3(Entity* this) {
}
void ArrowProjectile_Action4(Entity* this) {
if (sub_08003FC4(this, 0x2800) == 0) {
if (GravityUpdate(this, 0x2800) == 0) {
CreateDust(this);
DeleteThisEntity();
} else {
+63 -6
View File
@@ -1,11 +1,17 @@
#include "entity.h"
#include "functions.h"
#include "projectile.h"
#include "hitbox.h"
typedef struct {
s8 x;
s8 y;
} PACKED PosOffset;
extern u8 gEntCount;
bool32 sub_080AB12C(Entity* this);
extern void (*const gUnk_0812A494[])(Entity*);
extern const u8 gUnk_0812A4A8[];
extern const PosOffset gUnk_0812A4A8[];
void BallAndChain(Entity* this) {
gUnk_0812A494[this->type](this);
@@ -61,7 +67,58 @@ bool32 sub_080AB12C(Entity* this) {
return TRUE;
}
ASM_FUNC("asm/non_matching/ballAndChain/sub_080AB170.inc", void sub_080AB170(Entity* this))
void sub_080AB170(Entity* this) {
s32 val;
s32 type;
Entity* ent;
Entity* parent = this->parent;
if (parent->next == NULL) {
DeleteThisEntity();
}
if (this->action == 0) {
this->action = 1;
this->spritePriority.b1 = 0;
this->frameIndex = 5;
this->spritePriority.b0 = 3;
this->hitbox = (Hitbox*)&gHitbox_22;
}
ent = parent->parent;
if (this->field_0x7c.BYTES.byte0 != ent->field_0x7c.BYTES.byte0) {
this->flags |= 0x80;
} else {
this->flags &= 0x7f;
}
this->field_0x7c.BYTES.byte0 = ent->field_0x7c.BYTES.byte0;
if ((ent->frame & 0x20) == 0) {
u8 index = ent->frame & 0x1f;
PosOffset* pOffset = (PosOffset*)((s8*)gUnk_0812A4A8 + index);
sub_0806FA90(ent, this, pOffset->x, pOffset->y);
} else {
sub_0806FA90(ent, this, 0, -10);
}
val = (parent->x.HALF.HI - this->x.HALF.HI) * this->type;
if (val < 0) {
val += 3;
}
this->x.HALF.HI += (val >> 2);
val = (parent->y.HALF.HI - this->y.HALF.HI) * this->type;
if (val < 0) {
val += 3;
}
this->y.HALF.HI += (val >> 2);
val = (parent->z.HALF.HI - this->z.HALF.HI) * this->type;
if (val < 0) {
val += 3;
}
this->z.HALF.HI += (val >> 2);
}
void sub_080AB26C(Entity* this) {
if (this->action == 0) {
@@ -82,7 +139,7 @@ void sub_080AB26C(Entity* this) {
void (*const gUnk_0812A494[])(Entity*) = {
sub_080AB074, sub_080AB170, sub_080AB170, sub_080AB170, sub_080AB26C,
};
const u8 gUnk_0812A4A8[] = {
6, 240, 10, 242, 10, 240, 8, 240, 252, 242, 248, 242, 252, 246, 4, 246,
250, 242, 248, 240, 246, 242, 248, 244, 4, 242, 8, 242, 4, 246, 252, 246,
const PosOffset gUnk_0812A4A8[] = {
{ 6, -16 }, { 10, -14 }, { 10, -16 }, { 8, -16 }, { -4, -14 }, { -8, -14 }, { -4, -10 }, { 4, -10 },
{ -6, -14 }, { -8, -16 }, { -10, -14 }, { -8, -12 }, { 4, -14 }, { 8, -14 }, { 4, -10 }, { -4, -10 },
};
+4 -4
View File
@@ -55,7 +55,7 @@ void BoneProjectile_Action1(Entity* this) {
void BoneProjectile_Action2(Entity* this) {
GetNextFrame(this);
sub_080AF090(this);
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
this->action = 3;
COLLISION_OFF(this);
this->speed = 0xe0;
@@ -65,7 +65,7 @@ void BoneProjectile_Action2(Entity* this) {
void BoneProjectile_Action3(Entity* this) {
this->spriteSettings.draw ^= 1;
sub_0806F69C(this);
LinearMoveUpdate(this);
GetNextFrame(this);
if (sub_080044EC(this, 0x1800) == 0) {
DeleteEntity(this);
@@ -74,8 +74,8 @@ void BoneProjectile_Action3(Entity* this) {
void BoneProjectile_Action4(Entity* this) {
GetNextFrame(this);
sub_0806F69C(this);
if (sub_08003FC4(this, 0x1800) == 0) {
LinearMoveUpdate(this);
if (GravityUpdate(this, 0x1800) == 0) {
DeleteEntity(this);
}
}
-2
View File
@@ -1,7 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "effects.h"
extern void CreateItemOnGround(Entity*);
extern s32 sub_080AF090(Entity*);
-2
View File
@@ -1,8 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "audio.h"
#include "flags.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+1 -2
View File
@@ -1,10 +1,9 @@
#include "audio.h"
#include "sound.h"
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "coord.h"
#include "functions.h"
#include "effects.h"
extern void sub_08078954(Entity*);
-1
View File
@@ -2,7 +2,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+5 -8
View File
@@ -3,9 +3,6 @@
#include "enemy.h"
#include "player.h"
#include "functions.h"
#include "asm.h"
#include "audio.h"
#include "effects.h"
extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
@@ -52,7 +49,7 @@ void GleerokProjectile_Init(Entity* this) {
iVar2 = sub_080041DC(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
if (this->type == 1) {
uVar1 = Random() & 0x1ff;
if ((gScreenTransition.frameCount & 1U) == 0) {
if ((gRoomTransition.frameCount & 1U) == 0) {
iVar2 += uVar1;
} else {
iVar2 -= uVar1;
@@ -89,19 +86,19 @@ void GleerokProjectile_Init(Entity* this) {
void GleerokProjectile_Action1(Entity* this) {
if (this->type == 3) {
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
sub_08008790(this, 7);
CreateFx(this, FX_ROCK, 0);
DeleteThisEntity();
}
} else {
GetNextFrame(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
if ((this->type != 2) && (--this->field_0xf == 0xff)) {
this->field_0xf = 0x1e;
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
}
if (sub_08003FC4(this, 0) == 0) {
if (GravityUpdate(this, 0) == 0) {
this->action = 2;
sub_080A90D8(this);
if (this->type == 2) {
@@ -122,7 +119,7 @@ void GleerokProjectile_Action2(Entity* this) {
this->action = 3;
InitializeAnimation(this, 0x55);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
sub_080A90D8(this);
}
} else {
+2 -1
View File
@@ -2,6 +2,7 @@
#include "asm.h"
#include "coord.h"
#include "functions.h"
#include "projectile.h"
extern u32 sub_080644C8(Entity*);
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
@@ -61,7 +62,7 @@ void GuardLineOfSight(Entity* this) {
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
sub_0806F69C(this);
LinearMoveUpdate(this);
if (sub_080AE4CC(&gUnk_02027EB4, this->x.HALF.HI, this->y.HALF.HI, 2) != 0) {
DeleteThisEntity();
}
-1
View File
@@ -1,6 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "coord.h"
void sub_080AABB0(Entity*);
+24 -2
View File
@@ -2,7 +2,6 @@
#include "enemy.h"
#include "coord.h"
#include "player.h"
#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
@@ -20,7 +19,30 @@ void GyorgMaleEnergyProjectile_OnTick(Entity* this) {
GyorgMaleEnergyProjectile_Actions[this->action](this);
}
ASM_FUNC("asm/non_matching/gyorgMaleEnergyProjectile/sub_080AC8DC.inc", void sub_080AC8DC(Entity* this))
void sub_080AC8DC(Entity* this) {
switch ((s8)(this->bitfield & 0x7f)) {
case 0:
case 1:
case 2:
case 3:
case 0x1e:
case 0x1f: {
DeleteThisEntity();
break;
}
default: {
if (this->action != 3) {
this->action = 3;
this->flags &= 0x7f;
this->speed >>= 1;
InitializeAnimation(this, 1);
}
break;
}
}
GyorgMaleEnergyProjectile_OnTick(this);
}
void GyorgMaleEnergyProjectile_Init(Entity* this) {
this->action = 1;
+2 -1
View File
@@ -1,8 +1,9 @@
#include "entity.h"
#include "asm.h"
#include "coord.h"
#include "audio.h"
#include "sound.h"
#include "functions.h"
#include "projectile.h"
extern u8 gEntCount;
extern Hitbox gHitbox_21;
-1
View File
@@ -2,7 +2,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+2 -4
View File
@@ -1,10 +1,8 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "player.h"
#include "effects.h"
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void sub_08079D84(void);
extern void (*const LakituCloudProjectile_Functions[])(Entity*);
@@ -44,7 +42,7 @@ void LakituCloudProjectile_SubAction2(Entity* this) {
if (sub_0806F3E4(this) != 0) {
if (this->hitType == 0xa6) {
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
sub_08079D84();
}
CreateFx(this, FX_DEATH, 0);
-1
View File
@@ -1,6 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "effects.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+4 -6
View File
@@ -2,9 +2,7 @@
#include "enemy.h"
#include "coord.h"
#include "functions.h"
#include "audio.h"
#include "asm.h"
#include "overworld.h"
#include "game.h"
extern Entity* sub_08049DF4(u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
@@ -149,7 +147,7 @@ void MandiblesProjectile_Action3(Entity* this) {
this->direction = uVar1 << 2;
this->animationState = uVar1 << 0x1a >> 0x1a;
this->hitbox = &gHitbox_0;
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
this->spriteOrientation.flipY = 1;
}
sub_080AA3E0(this, 0);
@@ -198,11 +196,11 @@ void MandiblesProjectile_Action4(Entity* this) {
}
}
} else {
if (sub_080040A8(this) == 0) {
if (CheckOnScreen(this) == 0) {
DeleteThisEntity();
}
}
sub_0806F69C(this);
LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
}
+1 -1
View File
@@ -1,5 +1,5 @@
#include "entity.h"
#include "audio.h"
#include "sound.h"
#include "coord.h"
extern void (*const MazaalEnergyBeam_Actions[])(Entity*);
+12 -9
View File
@@ -49,11 +49,16 @@ void MoblinSpear_Init(Entity* this) {
}
}
NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpear_Action1(Entity* this)) {
void MoblinSpear_Action1(Entity* this) {
u8 frames;
Entity* parent;
u32 tmp;
const HitboxChange* a;
// const HitboxChange* a;
// TODO: Copying a members using HitboxChange members addresses them directly using [r2, 0x1]
// while the assembly increases the pointer after every copy.
// Not sure how to make this more readable.
const u8* a;
parent = this->parent;
if (parent == NULL) {
@@ -63,15 +68,14 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea
DeleteThisEntity();
}
frames = parent->frame * 4;
a = &gUnk_0812966C[frames / 4];
this->hitbox->offset_x = a->offsetX;
// TODO offset used to increase a pointer is already increated here?
a = (u8*)&gUnk_0812966C[frames / 4];
this->hitbox->offset_x = *a++;
if (parent->frameSpriteSettings == 0x40) {
this->hitbox->offset_x = -this->hitbox->offset_x;
}
this->hitbox->offset_y = a->offsetY;
this->hitbox->width = a->width;
this->hitbox->height = a->height;
this->hitbox->offset_y = *a++;
this->hitbox->width = *a++;
this->hitbox->height = *a++;
if (parent->field_0x43 != 0) {
if ((this->flags & ENT_COLLIDE) != 0) {
COLLISION_OFF(this);
@@ -82,7 +86,6 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea
}
}
}
END_NONMATCH
void (*const MoblinSpear_Functions[])(Entity*) = {
MoblinSpear_OnTick, sub_080A832C, DeleteEntity, DeleteEntity, DeleteEntity,
+2 -5
View File
@@ -1,9 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "asm.h"
#include "functions.h"
#include "audio.h"
#include "effects.h"
#include "projectile.h"
void OctorokBossProjectile_Action2(Entity*);
@@ -154,7 +151,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
OctorokBossProjectile_Action2(this);
}
GetNextFrame(this);
if (sub_08003FC4(this, 0x1800) != 0) {
if (GravityUpdate(this, 0x1800) != 0) {
sub_080AE58C(this, this->direction >> 3, 0);
if (this->collisions == 0) {
sub_0806F62C(this, (s32)this->speed, (u32)this->direction);
@@ -189,7 +186,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
DeleteThisEntity();
break;
case 3:
if (sub_08003FC4(this, 0x1800) != 0) {
if (GravityUpdate(this, 0x1800) != 0) {
return;
}
CreateFx(this, FX_ROCK, 0);
+2 -3
View File
@@ -2,8 +2,7 @@
#include "enemy.h"
#include "coord.h"
#include "functions.h"
#include "flags.h"
#include "utils.h"
#include "object.h"
extern u32 sub_080002C8(u16, u8);
extern Entity* LoadRoomEntity(EntityData*);
@@ -50,7 +49,7 @@ void sub_080AA464(Entity* this) {
if (this->type == 0) {
sub_080AA544(this);
}
entity = CreateObject(0x21, 3, 0);
entity = CreateObject(OBJECT_21, 3, 0);
if (entity != NULL) {
CopyPosition(this, entity);
}
+2 -2
View File
@@ -54,9 +54,9 @@ void RockProjectile_Action1(Entity* this) {
}
void RockProjectile_Action2(Entity* this) {
sub_0806F69C(this);
LinearMoveUpdate(this);
GetNextFrame(this);
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
DeleteEntity(this);
}
}
+53 -5
View File
@@ -1,12 +1,16 @@
#include "entity.h"
#include "enemy.h"
#include "audio.h"
#include "functions.h"
#include "object.h"
#include "flags.h"
typedef struct {
u8 b0;
u8 direction;
} PACKED Struct_0812A074;
extern void sub_0806FBB4(Entity*);
extern u32 sub_080002D4(s32, s32, u32);
extern void sub_08078930(Entity*);
extern void (*const SpiderWeb_Functions[])(Entity*);
extern void (*const SpiderWeb_Actions[])(Entity*);
@@ -15,7 +19,7 @@ extern const Hitbox* const gUnk_0812A04C[];
extern void (*const SpiderWeb_SubActions[])(Entity*);
extern const s8 gUnk_0812A064[];
extern const s8 gUnk_0812A06C[];
extern const u8 gUnk_0812A074[];
extern const Struct_0812A074 gUnk_0812A074[];
extern const u16 gUnk_0812A084[];
void sub_080AA6C0(Entity*);
@@ -167,7 +171,50 @@ void SpiderWeb_Action3(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/spiderWeb/sub_080AA9E0.inc", void sub_080AA9E0(Entity* this))
NONMATCH("asm/non_matching/spiderWeb/sub_080AA9E0.inc", void sub_080AA9E0(Entity* this)) {
s32 coord1, coord2, diff;
Struct_0812A074* ptr;
SpritePriority* priorityPtr;
SpritePriority prio;
u8 val1, val2;
if (this->type & 0x1) {
coord2 = gPlayerEntity.x.HALF.HI;
coord1 = this->x.HALF.HI;
} else {
coord2 = gPlayerEntity.y.HALF.HI;
coord1 = this->y.HALF.HI;
}
diff = coord2 - coord1;
ptr = (Struct_0812A074*)gUnk_0812A074 + (this->type << 1);
switch (this->type) {
case 3:
case 0: {
if (diff > 4) {
ptr++;
}
break;
}
case 1:
case 2: {
if (diff < -4) {
ptr++;
}
break;
}
}
val1 = ptr->b0;
priorityPtr = (SpritePriority*)&this->spritePriority;
priorityPtr->b0 = val1 & 0x7;
// instruction order problems
// this->spritePriority.b0 = ptr->b0 & 0x7;
this->direction = ptr->direction;
if (val1 == 5) {
sub_08078930(this);
}
}
END_NONMATCH
void sub_080AAA68(Entity* this) {
SetTile(gUnk_0812A084[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
@@ -207,5 +254,6 @@ void (*const SpiderWeb_SubActions[])(Entity*) = {
};
const s8 gUnk_0812A064[] = { 0, 17, -15, 4, 0, -11, 15, 4 };
const s8 gUnk_0812A06C[] = { 0, 2, -2, 0, 0, -2, 2, 0 };
const u8 gUnk_0812A074[] = { 4, 0, 5, 16, 3, 8, 5, 24, 3, 16, 5, 0, 3, 24, 5, 8 };
const Struct_0812A074 gUnk_0812A074[] = { { 4, 0 }, { 5, 16 }, { 3, 8 }, { 5, 24 },
{ 3, 16 }, { 5, 0 }, { 3, 24 }, { 5, 8 } };
const u16 gUnk_0812A084[] = { 16419, 16421, 16422, 16420 };
+83 -8
View File
@@ -1,20 +1,95 @@
#define NENT_DEPRECATED
#include "entity.h"
extern void (*const SpikedRollers_Actions[])(Entity*);
extern const u8 gUnk_0812A6D4[];
typedef struct {
Entity base;
s16 x2;
s16 y2;
s16 unk_0x6c;
u8 fill[0x16];
u16 unk_0x84;
u16 speed2;
} SpikedRollersEntity;
void SpikedRollers(Entity* this) {
SpikedRollers_Actions[this->action](this);
extern s32 sub_080AF090(Entity*);
static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*);
static const u8 gSpikedRollersOffsets[];
void SpikedRollers(SpikedRollersEntity* this) {
SpikedRollers_Actions[super->action](this);
}
ASM_FUNC("asm/non_matching/spikedRollers/sub_080ABA74.inc", void sub_080ABA74(Entity* this))
void sub_080ABA74(SpikedRollersEntity* this) {
s32 val;
super->action++;
super->speed = this->speed2;
this->x2 = super->x.HALF.HI;
this->y2 = super->y.HALF.HI;
this->unk_0x6c = this->unk_0x84;
ASM_FUNC("asm/non_matching/spikedRollers/sub_080ABAE0.inc", void sub_080ABAE0(Entity* this))
if (super->type <= 6) {
super->type2 = 0;
} else {
super->type2 = 1;
}
void (*const SpikedRollers_Actions[])(Entity*) = {
val = gSpikedRollersOffsets[super->type];
if (super->type2 == 0) {
super->direction = 8;
super->y.HALF.HI += val;
} else {
super->direction = 0x10;
super->x.HALF.HI += val;
}
InitializeAnimation(super, super->type);
}
void sub_080ABAE0(SpikedRollersEntity* this) {
s32 diff, unk_0x6c;
sub_080AF090(super);
if (super->type2 == 0) {
diff = super->x.HALF.HI - this->x2;
} else {
diff = super->y.HALF.HI - this->y2;
}
unk_0x6c = this->unk_0x6c;
if (unk_0x6c < 0) {
diff = -diff;
unk_0x6c = -unk_0x6c;
}
if ((u32)(diff << 0x10) > (unk_0x6c << 0x10)) {
super->direction ^= 0x10;
if (super->type2 == 0) {
super->x.HALF.HI = this->x2;
super->spriteSettings.flipX ^= 1;
} else {
super->y.HALF.HI = this->y2;
super->spriteSettings.flipY ^= 1;
}
if (diff > 0) {
if (super->type2 == 0) {
super->x.HALF.HI += this->unk_0x6c;
} else {
super->y.HALF.HI += this->unk_0x6c;
}
}
}
GetNextFrame(super);
}
static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*) = {
sub_080ABA74,
sub_080ABAE0,
};
const u8 gUnk_0812A6D4[] = {
static const u8 gSpikedRollersOffsets[] = {
8, 16, 24, 32, 40, 48, 56, 16, 24, 32, 40, 48, 56, 64,
};
+1 -2
View File
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "effects.h"
extern void (*const StalfosProjectile_Functions[])(Entity*);
extern void (*const StalfosProjectile_Actions[])(Entity*);
@@ -120,7 +119,7 @@ void StalfosProjectile_Action3(Entity* this) {
if (this->zVelocity < 0) {
this->spriteSettings.flipY = 1;
}
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
sub_080A9BA8(this);
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ void TorchTrapProjectile_Action1(Entity* this) {
this->actionDelay -= 1;
} else {
if (sub_080AF090(this) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
} else {
this->action = 2;
}
+39 -9
View File
@@ -2,11 +2,9 @@
#include "enemy.h"
#include "coord.h"
#include "player.h"
#include "audio.h"
#include "functions.h"
#include "asm.h"
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void (*const V1DarkMagicProjectile_Functions[])(Entity*);
extern void (*const V1DarkMagicProjectile_Actions[])(Entity*);
@@ -38,7 +36,7 @@ void sub_080AAC44(Entity* this) {
ResolveEntityOnTop(this->parent, this);
}
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
}
if (gPlayerEntity.health == 0) {
@@ -54,7 +52,39 @@ void sub_080AAC44(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/v1DarkMagicProjectile/sub_080AACE0.inc", void sub_080AACE0(Entity* this))
void sub_080AACE0(Entity* this) {
Entity* parent;
if (this->type && this->type2) {
DeleteThisEntity();
}
if (this->spriteSettings.draw == 1) {
this->spriteSettings.draw = 0;
this->field_0x86.HALF.LO = 1;
CreateFx(this, 2, 0);
}
parent = this->parent;
if (this->type2 == 0) {
u8* ptr = &(parent->field_0x74.HALF.LO);
parent->field_0x74.HALF.LO = 3;
parent->field_0x80.HALF.LO += this->field_0x80.HALF.HI >> 1;
if (parent->field_0x80.HALF.LO > 8) {
parent->field_0x80.HALF.LO = 8;
} else if (parent->field_0x80.HALF.LO == 0) {
parent->field_0x80.HALF.LO = 1;
}
} else {
parent->cutsceneBeh.HALF.LO = 0;
parent->hitType = 0x2b;
}
if (this->field_0x86.HALF.LO == 0) {
CreateFx(this, 2, 0);
}
DeleteThisEntity();
}
void sub_080AAD70(Entity* this) {
if (sub_0806F520() == 0) {
@@ -124,7 +154,7 @@ void V1DarkMagicProjectile_Action1(Entity* this) {
uVar2 = GetFacingDirection(this, &gPlayerEntity);
sub_08004596(this, uVar2);
}
sub_0806F69C(this);
LinearMoveUpdate(this);
break;
case 1:
if ((this->parent == NULL) || (this->parent->next == NULL)) {
@@ -173,7 +203,7 @@ void sub_080AAF74(Entity* this) {
this->actionDelay = 0x1e;
gPlayerEntity.iframes = 8;
ModHealth(-4);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
if (gPlayerEntity.health == 0) {
this->health = 0;
}
@@ -182,11 +212,11 @@ void sub_080AAF74(Entity* this) {
this->action = 1;
this->field_0x80.HALF.LO = 0;
gPlayerEntity.iframes = 0xf0;
gPlayerState.field_0x1a[0] = 0;
gPlayerState.mobility = 0;
this->health = 0;
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
CopyPosition(&gPlayerEntity, this);
this->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4;
+41 -1
View File
@@ -1,5 +1,6 @@
#include "entity.h"
#include "functions.h"
#include "projectile.h"
extern void (*const V1EyeLaser_Actions[])(Entity*);
extern const Hitbox* const gUnk_0812A5F4[];
@@ -8,6 +9,7 @@ extern const Hitbox gUnk_0812A61C;
void sub_080AB758(Entity*);
void sub_080AB888(Entity*);
void sub_080AB844(Entity* this, s32 param_1, s32 param_2);
void V1EyeLaser(Entity* this) {
if (this->parent->spriteSettings.draw == 0) {
@@ -49,7 +51,45 @@ void V1EyeLaser_Action2(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/v1EyeLaser/sub_080AB758.inc", void sub_080AB758(Entity* this))
NONMATCH("asm/non_matching/v1EyeLaser/sub_080AB758.inc", void sub_080AB758(Entity* this)) {
s32 r6 = 6;
u32 r7 = 0;
u32 index = 0;
if (((u32)this->y.HALF.HI) <= (u16)(gRoomControls.origin_y + 0xd4)) {
u32 tmp = 7;
do {
if ((index & tmp) == 7) {
sub_080AB844(this, 4, r6);
r6 += 0x3e;
r7 += 0x3e;
}
index = (index + 1) & tmp;
} while (this->y.HALF.HI + r7 + (index << 3) <= (u16)(gRoomControls.origin_y + 0xd4));
}
index = 0;
if (this->y.HALF.HI + r7 <= (u16)(gRoomControls.origin_y + 0xd4)) {
u32 tmp = 3;
do {
if ((index & tmp) == 3) {
sub_080AB844(this, 3, r6);
r6 += 0x1e;
r7 += 0x1e;
}
index = (index + 1) & tmp;
} while (this->y.HALF.HI + r7 + (index << 3) <= (u16)(gRoomControls.origin_y + 0xd4));
}
if (index & 0x2) {
sub_080AB844(this, 2, r6);
r6 += 0xe;
} else if (index & 0x1) {
sub_080AB844(this, 1, r6);
r6 += 0x6;
}
sub_080AB844(this, 6, r6);
}
END_NONMATCH
void sub_080AB844(Entity* this, s32 param_1, s32 param_2) {
Entity* entity;
+3 -5
View File
@@ -2,8 +2,6 @@
#include "enemy.h"
#include "player.h"
#include "functions.h"
#include "audio.h"
#include "asm.h"
extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
@@ -55,7 +53,7 @@ void V1FireProjectile_Init(Entity* this) {
y = this->y.HALF.HI + data[1];
iVar2 = sub_080041DC(this, x, y);
rnd = Random() & 0x1ff;
if ((gScreenTransition.frameCount & 1U) != 0) {
if ((gRoomTransition.frameCount & 1U) != 0) {
iVar2 += rnd;
if (0x400 < iVar2) {
@@ -75,8 +73,8 @@ void V1FireProjectile_Init(Entity* this) {
void V1FireProjectile_Action1(Entity* this) {
GetNextFrame(this);
sub_0806F69C(this);
if (sub_08003FC4(this, 0) == 0) {
LinearMoveUpdate(this);
if (GravityUpdate(this, 0) == 0) {
this->action = 2;
this->actionDelay = 0xf;
InitializeAnimation(this, 0x54);
+71 -11
View File
@@ -2,9 +2,7 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "asm.h"
#include "audio.h"
#include "effects.h"
#include "object.h"
extern void (*const V2Projectile_Functions[])(Entity*);
extern void (*const gUnk_0812A7EC[])(Entity*);
@@ -12,7 +10,7 @@ extern void (*const gUnk_0812A7F8[])(Entity*);
extern void (*const gUnk_0812A800[])(Entity*);
extern void (*const gUnk_0812A808[])(Entity*);
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void sub_08079D84(void);
extern s32 sub_080AF090(Entity*);
@@ -21,9 +19,52 @@ void V2Projectile(Entity* this) {
V2Projectile_Functions[GetNextFunction(this)](this);
}
ASM_FUNC("asm/non_matching/v2Projectile/sub_080ABBA8.inc", void sub_080ABBA8(Entity* this))
void sub_080ABBA8(Entity* this) {
switch (this->type) {
case 0: {
gUnk_0812A7EC[this->action](this);
break;
}
case 1: {
gUnk_0812A7F8[this->action](this);
break;
}
case 2:
default:
gUnk_0812A800[this->action](this);
}
}
ASM_FUNC("asm/non_matching/v2Projectile/sub_080ABBF4.inc", void sub_080ABBF4(Entity* this))
void sub_080ABBF4(Entity* this) {
if ((this->bitfield & 0x80) == 0)
return;
switch (this->type) {
case 2: {
switch ((this->bitfield & 0x3f)) {
case 0: {
ModHealth(-4);
// fallthrough
}
case 3:
case 0x14: {
CreateDust(this);
DeleteThisEntity();
break;
}
}
break;
}
case 0:
case 1: {
if ((this->bitfield & 0x3f) == 0) {
ModHealth(-2);
DeleteThisEntity();
}
break;
}
}
}
void sub_080ABC54(Entity* this) {
if (sub_0806F520() == 0) {
@@ -43,7 +84,7 @@ void nullsub_542(Entity* this) {
void sub_080ABC90(Entity* this) {
if (sub_0806F3E4(this) != 0) {
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
sub_08079D84();
CreateFx(this, FX_DEATH, 0);
DeleteThisEntity();
@@ -93,10 +134,29 @@ void sub_080ABD70(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/v2Projectile/sub_080ABE04.inc", void sub_080ABE04(Entity* this))
void sub_080ABE04(Entity* this) {
u32 rand = Random() & 0xff;
u32 newX;
this->action = 1;
this->zVelocity = 0xffff0000;
this->z.HALF.HI -= 0xa0;
this->x.HALF.HI = (gRoomControls.origin_x & 0x7ff0) | 0x8;
this->y.HALF.HI = (gRoomControls.origin_y & 0x7ff0) | 0x8;
newX = this->x.HALF.HI;
if (rand & 0x10) {
newX += 0x10;
} else {
newX += 0xc0;
}
this->x.HALF.HI = newX + ((0xe0 & rand) >> 1);
this->y.HALF.HI += ((0xf & rand) << 4);
sub_08004168(this);
InitializeAnimation(this, 0);
SoundReq(SFX_12D);
}
void sub_080ABE88(Entity* this) {
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
CreateFx(this, FX_ROCK, 0);
DeleteThisEntity();
}
@@ -118,10 +178,10 @@ void sub_080ABEA8(Entity* this) {
}
void sub_080ABF04(Entity* this) {
if (sub_080040A8(this) == 0) {
if (CheckOnScreen(this) == 0) {
DeleteThisEntity();
}
sub_0806F69C(this);
LinearMoveUpdate(this);
GetNextFrame(this);
}
+101 -10
View File
@@ -1,6 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "audio.h"
#include "player.h"
#include "coord.h"
#include "functions.h"
@@ -10,9 +9,9 @@ extern s32 IsProjectileOffScreen(Entity*);
extern void (*const V3ElectricProjectile_Functions[])(Entity*);
extern void (*const V3ElectricProjectile_Actions[])(Entity*);
extern const u16 gUnk_0812A97C[];
extern const u8 gUnk_0812A982[];
extern const u8 gUnk_0812A98A[];
static const u16 projectileSpeeds[];
static const u8 gUnk_0812A982[];
static const u8 projectileDirections[];
void V3ElectricProjectile(Entity* this) {
V3ElectricProjectile_Functions[GetNextFunction(this)](this);
@@ -26,7 +25,44 @@ void sub_080ABFE4(Entity* this) {
DeleteThisEntity();
}
ASM_FUNC("asm/non_matching/v3ElectricProjectile/sub_080ABFEC.inc", void sub_080ABFEC(Entity* this))
void sub_080ABFEC(Entity* this) {
Sound sound;
InitializeAnimation(this, this->type + 1);
switch (this->type) {
case 0: {
this->action = 1;
this->actionDelay = 0;
this->field_0xf = 0x7;
this->cutsceneBeh.HALF.HI = 0x18;
this->damage = 0x88;
CopyPositionAndSpriteOffset(this->parent, this);
this->z.HALF.HI -= 0x14;
sound = SFX_149;
break;
}
case 1: {
this->action = 1;
this->flags &= 0x7f;
this->cutsceneBeh.HALF.HI = 0x18;
CopyPositionAndSpriteOffset(this->parent, this);
this->z.HALF.HI -= 0x14;
sound = SFX_149;
break;
}
default: {
this->action = 2;
this->actionDelay = 0;
this->field_0xf = 0xff;
this->speed = projectileSpeeds[this->type2];
this->damage = 0x88;
sound = SFX_193;
break;
}
}
SoundReq(sound);
}
void V3ElectricProjectile_Action1(Entity* this) {
if (this->parent->next == NULL) {
@@ -77,9 +113,64 @@ void V3ElectricProjectile_Action2(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/v3ElectricProjectile/sub_080AC168.inc", void sub_080AC168(Entity* this))
void sub_080AC168(Entity* this) {
u8 actionDelay;
GetNextFrame(this);
this->z.WORD += 0xffff8000;
actionDelay = --this->actionDelay;
if (actionDelay == 0) {
u32 rand;
u32 dir;
this->action = 4;
this->actionDelay = 4;
rand = Random() & 0x7;
this->field_0xf = gUnk_0812A982[rand];
dir = GetFacingDirection(this, &gPlayerEntity);
if (this->parent->cutsceneBeh.HALF.LO == 3) {
dir -= projectileDirections[rand];
this->type2 = 0;
} else if (this->parent->cutsceneBeh.HALF.LO == 2) {
dir -= projectileDirections[rand];
this->type2 = 1;
} else {
dir -= projectileDirections[rand] >> 1;
this->type2 = 2;
}
ASM_FUNC("asm/non_matching/v3ElectricProjectile/sub_080AC200.inc", void sub_080AC200(Entity* this))
this->direction = dir & 0x1f;
}
}
void sub_080AC200(Entity* this) {
Entity* proj;
GetNextFrame(this);
if (--this->actionDelay)
return;
this->actionDelay = 0x10;
proj = CreateProjectile(0x21);
if (proj) {
proj->type = 2;
proj->type2 = this->type2;
proj->direction = this->direction;
proj->parent = this->parent;
CopyPosition(this, proj);
}
if (--this->field_0xf == 0) {
DeleteThisEntity();
}
if (this->parent->cutsceneBeh.HALF.LO == 3) {
this->direction = (this->direction + 3) & 0x1f;
} else if (this->parent->cutsceneBeh.HALF.LO == 2) {
this->direction = (this->direction + 3) & 0x1f;
} else {
this->direction = (this->direction + 2) & 0x1f;
}
}
void (*const V3ElectricProjectile_Functions[])(Entity*) = {
V3ElectricProjectile_OnTick, sub_080ABFE4, DeleteEntity, DeleteEntity, DeleteEntity,
@@ -87,10 +178,10 @@ void (*const V3ElectricProjectile_Functions[])(Entity*) = {
void (*const V3ElectricProjectile_Actions[])(Entity*) = {
sub_080ABFEC, V3ElectricProjectile_Action1, V3ElectricProjectile_Action2, sub_080AC168, sub_080AC200,
};
const u16 gUnk_0812A97C[] = { 352, 480, 480 };
const u8 gUnk_0812A982[] = {
static const u16 projectileSpeeds[] = { 352, 480, 480 };
static const u8 gUnk_0812A982[] = {
5, 6, 7, 8, 5, 6, 7, 6,
};
const u8 gUnk_0812A98A[] = {
static const u8 projectileDirections[] = {
6, 9, 9, 12, 6, 9, 9, 9, 0, 0,
};
-1
View File
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+56 -5
View File
@@ -1,8 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "audio.h"
#include "functions.h"
#include "effects.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
@@ -11,6 +8,7 @@ extern void (*const V3TennisBallProjectile_Functions[])(Entity*);
extern void (*const V3TennisBallProjectile_Actions[])(Entity*);
void sub_080ACB90(Entity*);
bool32 sub_080ACB40(Entity* this);
void V3TennisBallProjectile(Entity* this) {
V3TennisBallProjectile_Functions[GetNextFunction(this)](this);
@@ -20,7 +18,32 @@ void V3TennisBallProjectile_OnTick(Entity* this) {
V3TennisBallProjectile_Actions[this->action](this);
}
ASM_FUNC("asm/non_matching/v3TennisBallProjectile/sub_080ACA68.inc", void sub_080ACA68(Entity* this))
void sub_080ACA68(Entity* this) {
switch (this->bitfield & 0x7f) {
case 0x1a:
case 0xa:
case 0xb:
case 0xc:
case 0x6: {
this->action = 2;
this->flags &= 0x7f;
this->speed += 0x80 * 2;
this->child = this->field_0x4c;
if (sub_080ACB40(this)) {
this->direction = 0;
} else {
this->direction = this->knockbackDirection;
}
SoundReq(SFX_ITEM_SWORD_CHARGE_FINISH);
break;
}
default: {
DeleteThisEntity();
break;
}
}
}
void V3TennisBallProjectile_Init(Entity* this) {
this->action = 1;
@@ -51,7 +74,35 @@ void V3TennisBallProjectile_Action2(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/v3TennisBallProjectile/sub_080ACB40.inc", void sub_080ACB40(Entity* this))
bool32 sub_080ACB40(Entity* this) {
Entity* r1_grandparent = this->parent->parent;
Entity* child = this->child;
Entity* tmp = ((Entity**)(r1_grandparent->myHeap))[7]->child;
if (tmp != this && child == tmp->child) {
return 0;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[8]->child;
if (tmp != this && child == tmp->child) {
return 0;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[9]->child;
if (tmp != this && child == tmp->child) {
return 0;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[10]->child;
if (tmp != this && child == tmp->child) {
return 0;
}
return 1;
}
void sub_080ACB90(Entity* this) {
Entity* parent = this->parent;
-1
View File
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
+62 -7
View File
@@ -1,13 +1,17 @@
#include "entity.h"
#include "asm.h"
#include "functions.h"
#include "utils.h"
#include "common.h"
#include "projectile.h"
extern void (*const Winder_Actions[])(Entity*);
extern const u8 gUnk_0812A6BC[];
extern const u8 gUnk_0812A6C4[];
extern s16 gUnk_080B4488[];
extern u8* GetLayerByIndex(u32);
static const u8 gUnk_0812A6BC[];
static const u16 gUnk_0812A6C4[];
void sub_080AB9DC(Entity*);
bool32 sub_080AB9FC(Entity* this, u32 param_1);
void Winder(Entity* this) {
Winder_Actions[this->action](this);
@@ -44,7 +48,36 @@ void Winder_Init(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/winder/sub_080AB950.inc", void sub_080AB950(Entity* this))
void sub_080AB950(Entity* this) {
if (this->type == 0) {
u8 dir;
ProcessMovement(this);
dir = this->direction >> 3;
if (((gUnk_0812A6C4)[dir] & this->collisions) || sub_080AB9FC(this, this->direction)) {
this->direction = gUnk_0812A6BC[(Random() & 0x1) + (dir << 1)];
}
} else {
Entity* child;
if (this->parent == NULL) {
DeleteThisEntity();
}
if (this->parent->next == NULL) {
DeleteThisEntity();
}
child = this->child;
if (child && child->next) {
this->x.HALF.HI = child->field_0x68.HWORD;
this->y.HALF.HI = child->field_0x6a.HWORD;
} else {
DeleteThisEntity();
}
}
GetNextFrame(this);
}
void sub_080AB9DC(Entity* this) {
MemCopy(&this->field_0x6c, &this->field_0x68, 0x1c);
@@ -52,7 +85,26 @@ void sub_080AB9DC(Entity* this) {
this->field_0x86.HWORD = this->y.HALF.HI;
}
ASM_FUNC("asm/non_matching/winder/sub_080AB9FC.inc", void sub_080AB9FC(Entity* this))
bool32 sub_080AB9FC(Entity* this, u32 dir) {
u32 val;
u8* layer = GetLayerByIndex(this->collisionLayer);
u32 tmp;
val = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) |
((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3f) << 6);
val += gUnk_080B4488[dir >> 3];
layer += 0x2004;
layer += val;
tmp = *layer;
if (tmp <= 0x1f) {
return 0;
}
if (tmp > 0x3f) {
return 0;
}
return 1;
}
void (*const Winder_Actions[])(Entity*) = {
Winder_Init,
@@ -61,6 +113,9 @@ void (*const Winder_Actions[])(Entity*) = {
const u8 gUnk_0812A6BC[] = {
8, 24, 0, 16, 8, 24, 0, 16,
};
const u8 gUnk_0812A6C4[] = {
14, 0, 0, 224, 224, 0, 0, 14,
const u16 gUnk_0812A6C4[] = {
0xe,
0xe000,
0xe0,
0xe00,
};