mirror of https://github.com/zeldaret/tmc.git
Create new entity structs for Projectiles
This commit is contained in:
parent
eb233b05cd
commit
591563f428
|
@ -13,6 +13,14 @@
|
|||
#include "projectile.h"
|
||||
|
||||
bool32 EnemyInit(Entity* this);
|
||||
/**
|
||||
* 0: _OnTick
|
||||
* 1: _OnCollision
|
||||
* 2: _OnKnockback
|
||||
* 3: _OnDeath
|
||||
* 4: _OnConfused
|
||||
* 5: _OnGrabbed
|
||||
*/
|
||||
u32 GetNextFunction(Entity*);
|
||||
void EnemyFunctionHandler(Entity*, EntityActionArray);
|
||||
void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])());
|
||||
|
|
|
@ -16,31 +16,31 @@ void DirtBallProjectile(Entity*);
|
|||
void WindProjectile(Entity*);
|
||||
void FireProjectile(Entity*);
|
||||
void IceProjectile(Entity*);
|
||||
void GleerokProjectile(Entity*);
|
||||
void GleerokProjectile();
|
||||
void KeatonDagger(Entity*);
|
||||
void GuardLineOfSight(Entity*);
|
||||
void ArrowProjectile(Entity*);
|
||||
void MazaalEnergyBeam(Entity*);
|
||||
void OctorokBossProjectile(Entity*);
|
||||
void OctorokBossProjectile();
|
||||
void StalfosProjectile(Entity*);
|
||||
void LakituCloudProjectile(Entity*);
|
||||
void LakituLightning(Entity*);
|
||||
void MandiblesProjectile(Entity*);
|
||||
void RemovableDust(Entity*);
|
||||
void SpiderWeb(Entity*);
|
||||
void MandiblesProjectile();
|
||||
void RemovableDust();
|
||||
void SpiderWeb();
|
||||
void TorchTrapProjectile(Entity*);
|
||||
void GuruguruBarProjectile(Entity*);
|
||||
void V1DarkMagicProjectile(Entity*);
|
||||
void BallAndChain(Entity*);
|
||||
void V1FireProjectile(Entity*);
|
||||
void V1DarkMagicProjectile();
|
||||
void BallAndChain();
|
||||
void V1FireProjectile();
|
||||
void CannonballProjectile(Entity*);
|
||||
void V1EyeLaser(Entity*);
|
||||
void V1EyeLaser();
|
||||
void Winder(Entity*);
|
||||
void SpikedRollers(Entity*);
|
||||
void V2Projectile(Entity*);
|
||||
void V2Projectile();
|
||||
void V3HandProjectile(Entity*);
|
||||
void V3ElectricProjectile(Entity*);
|
||||
void GyorgTail(Entity*);
|
||||
void V3ElectricProjectile();
|
||||
void GyorgTail();
|
||||
void GyorgMaleEnergyProjectile(Entity*);
|
||||
void V3TennisBallProjectile(Entity*);
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#define WINDER_NUM_SEGMENTS 8
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
s16 positions[2 * WINDER_NUM_SEGMENTS];
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s16 positions[2 * WINDER_NUM_SEGMENTS];
|
||||
} WinderEntity;
|
||||
|
||||
#endif // WINDER_H
|
||||
|
|
|
@ -37,9 +37,9 @@ typedef struct {
|
|||
#define DUST_SPRITE_INDEX 0x1eb
|
||||
#endif
|
||||
|
||||
void sub_08044134(DustEntity*);
|
||||
void sub_0804414C(DustEntity*);
|
||||
void sub_0804415C(DustEntity*);
|
||||
void Dust_OnTick(DustEntity*);
|
||||
void Dust_OnCollision(DustEntity*);
|
||||
void Dust_OnGrabbed(DustEntity*);
|
||||
void sub_080441E0(DustEntity*);
|
||||
void sub_080442A0(DustEntity*);
|
||||
void sub_080441CC(DustEntity*);
|
||||
|
@ -56,15 +56,15 @@ extern void* sub_080AD8F0(u32, u32);
|
|||
extern const s8 gUnk_08126EE4[];
|
||||
|
||||
void (*const Dust_Functions[])(Entity*) = {
|
||||
(EntityActionPtr)sub_08044134, (EntityActionPtr)sub_0804414C, GenericKnockback, GenericDeath, GenericConfused,
|
||||
(EntityActionPtr)sub_0804415C,
|
||||
(EntityActionPtr)Dust_OnTick, (EntityActionPtr)Dust_OnCollision, GenericKnockback, GenericDeath, GenericConfused,
|
||||
(EntityActionPtr)Dust_OnGrabbed,
|
||||
};
|
||||
|
||||
void Dust(Entity* this) {
|
||||
Dust_Functions[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08044134(DustEntity* this) {
|
||||
void Dust_OnTick(DustEntity* this) {
|
||||
static void (*const Dust_Actions[])(DustEntity*) = {
|
||||
sub_080441E0,
|
||||
sub_080442A0,
|
||||
|
@ -72,11 +72,11 @@ void sub_08044134(DustEntity* this) {
|
|||
Dust_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_0804414C(DustEntity* this) {
|
||||
void Dust_OnCollision(DustEntity* this) {
|
||||
EnemyFunctionHandlerAfterCollision(super, Dust_Functions);
|
||||
}
|
||||
|
||||
void sub_0804415C(DustEntity* this) {
|
||||
void Dust_OnGrabbed(DustEntity* this) {
|
||||
static void (*const Dust_SubActions[])(DustEntity*) = {
|
||||
sub_080441BC,
|
||||
sub_080441C4,
|
||||
|
|
|
@ -75,7 +75,7 @@ void Enemy50_OnTick(Enemy50Entity* this) {
|
|||
Enemy50_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_08040B9C(Enemy50Entity* this) {
|
||||
void Enemy50_OnCollision(Enemy50Entity* this) {
|
||||
if (super->action == 8 || super->action == 9) {
|
||||
super->animationState = 0xff;
|
||||
InitializeAnimation(super, (super->knockbackDirection >> 4 ^ 1) + 1);
|
||||
|
@ -119,7 +119,7 @@ _08040C9C:
|
|||
EnemyFunctionHandlerAfterCollision(super, Enemy50_Functions);
|
||||
}
|
||||
|
||||
void sub_08040CAC(Enemy50Entity* this) {
|
||||
void Enemy50_OnKnockback(Enemy50Entity* this) {
|
||||
GetNextFrame(super);
|
||||
GenericKnockback2(super);
|
||||
if (super->type == 0) {
|
||||
|
@ -137,7 +137,7 @@ void sub_08040CAC(Enemy50Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08040D30(Enemy50Entity* this) {
|
||||
void Enemy50_OnConfused(Enemy50Entity* this) {
|
||||
if (super->animIndex != 7 && super->animIndex != 8) {
|
||||
InitializeAnimation(super, super->animationState + 7);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void sub_08040D30(Enemy50Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08040D90(Enemy50Entity* this) {
|
||||
void Enemy50_OnGrabbed(Enemy50Entity* this) {
|
||||
if (sub_0806F520(super)) {
|
||||
Enemy50_SubActions[super->subAction](this);
|
||||
} else {
|
||||
|
@ -436,7 +436,8 @@ bool32 sub_08041300(Enemy50Entity* this) {
|
|||
#endif
|
||||
|
||||
void (*const Enemy50_Functions[])(Enemy50Entity*) = {
|
||||
Enemy50_OnTick, sub_08040B9C, sub_08040CAC, (void (*)(Enemy50Entity*))GenericDeath, sub_08040D30, sub_08040D90,
|
||||
Enemy50_OnTick, Enemy50_OnCollision, Enemy50_OnKnockback, (void (*)(Enemy50Entity*))GenericDeath,
|
||||
Enemy50_OnConfused, Enemy50_OnGrabbed,
|
||||
};
|
||||
void (*const Enemy50_Actions[])(Enemy50Entity*) = {
|
||||
Enemy50_Init, Enemy50_Action1, Enemy50_Action2, Enemy50_Action3, Enemy50_Action4, Enemy50_Action5,
|
||||
|
|
|
@ -53,7 +53,7 @@ void Mulldozer_OnInit(MulldozerEntity* this) {
|
|||
Mulldozer_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_08032CAC(MulldozerEntity* this) {
|
||||
void Mulldozer_OnCollision(MulldozerEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, 0x1c);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void sub_08032CAC(MulldozerEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08032D3C(MulldozerEntity* this) {
|
||||
void Mulldozer_OnKnockback(MulldozerEntity* this) {
|
||||
if (--super->subtimer == 0) {
|
||||
super->subtimer = 2;
|
||||
super->animationState = (super->animationState + 1) & 7;
|
||||
|
@ -90,7 +90,7 @@ void sub_08032D3C(MulldozerEntity* this) {
|
|||
GenericKnockback(super);
|
||||
}
|
||||
|
||||
void nullsub_157(MulldozerEntity* this) {
|
||||
void Mulldozer_OnGrabbed(MulldozerEntity* this) {
|
||||
}
|
||||
|
||||
void Mulldozer_Init(MulldozerEntity* this) {
|
||||
|
@ -465,11 +465,11 @@ bool32 sub_08033364(MulldozerEntity* this) {
|
|||
|
||||
void (*const Mulldozer_Functions[])(MulldozerEntity*) = {
|
||||
Mulldozer_OnInit,
|
||||
sub_08032CAC,
|
||||
sub_08032D3C,
|
||||
Mulldozer_OnCollision,
|
||||
Mulldozer_OnKnockback,
|
||||
(void (*)(MulldozerEntity*))GenericDeath,
|
||||
(void (*)(MulldozerEntity*))GenericConfused,
|
||||
nullsub_157,
|
||||
Mulldozer_OnGrabbed,
|
||||
};
|
||||
void (*const Mulldozer_Actions[])(MulldozerEntity*) = {
|
||||
Mulldozer_Init, Mulldozer_Action1, Mulldozer_Action2, Mulldozer_Action3,
|
||||
|
|
|
@ -73,7 +73,7 @@ void Stalfos_OnTick(StalfosEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_0803933C(StalfosEntity* this) {
|
||||
void Stalfos_OnCollision(StalfosEntity* this) {
|
||||
Entity* r0;
|
||||
Entity* r1;
|
||||
u32 r2;
|
||||
|
@ -120,7 +120,7 @@ void sub_0803933C(StalfosEntity* this) {
|
|||
EnemyFunctionHandlerAfterCollision(super, Stalfos_Functions);
|
||||
}
|
||||
|
||||
void sub_08039418(StalfosEntity* this) {
|
||||
void Stalfos_OnDeath(StalfosEntity* this) {
|
||||
if (super->type == 0) {
|
||||
CreateDeathFx(super, 0xf3, 0);
|
||||
} else {
|
||||
|
@ -128,7 +128,7 @@ void sub_08039418(StalfosEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08039438(StalfosEntity* this) {
|
||||
void Stalfos_OnGrabbed(StalfosEntity* this) {
|
||||
if (sub_0806F520(super)) {
|
||||
Stalfos_SubActions[super->subAction](this);
|
||||
}
|
||||
|
@ -475,11 +475,11 @@ found:
|
|||
|
||||
void (*const Stalfos_Functions[])(StalfosEntity*) = {
|
||||
Stalfos_OnTick,
|
||||
sub_0803933C,
|
||||
Stalfos_OnCollision,
|
||||
(void (*)(StalfosEntity*))GenericKnockback,
|
||||
sub_08039418,
|
||||
Stalfos_OnDeath,
|
||||
(void (*)(StalfosEntity*))GenericConfused,
|
||||
sub_08039438,
|
||||
Stalfos_OnGrabbed,
|
||||
};
|
||||
void (*const Stalfos_Actions[])(StalfosEntity*) = {
|
||||
Stalfos_Init, Stalfos_Action1, Stalfos_Action2, Stalfos_Action3, Stalfos_Action4, Stalfos_Action5,
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file arrowProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Arrow Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
|
||||
extern void (*const gArrowProjectile[])(Entity*);
|
||||
extern void (*const gArrowProjectileActions[])(Entity*);
|
||||
extern void (*const ArrowProjectile_Functions[])(Entity*);
|
||||
extern void (*const ArrowProjectile_Actions[])(Entity*);
|
||||
|
||||
typedef struct {
|
||||
u8 flipX;
|
||||
|
@ -20,14 +27,14 @@ void sub_080A9488(Entity*);
|
|||
void sub_080A94C0(Entity*, u32);
|
||||
|
||||
void ArrowProjectile(Entity* this) {
|
||||
gArrowProjectile[GetNextFunction(this)](this);
|
||||
ArrowProjectile_Functions[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void ArrowProjectile_OnTick(Entity* this) {
|
||||
gArrowProjectileActions[this->action](this);
|
||||
ArrowProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A9334(Entity* this) {
|
||||
void ArrowProjectile_OnCollision(Entity* this) {
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
if ((this->contactFlags & 0x3f) != 0) {
|
||||
ModHealth(-2);
|
||||
|
@ -119,10 +126,10 @@ void sub_080A94C0(Entity* this, u32 animationState) {
|
|||
InitializeAnimation(this, this->animIndex);
|
||||
}
|
||||
|
||||
void (*const gArrowProjectile[])(Entity*) = {
|
||||
ArrowProjectile_OnTick, sub_080A9334, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const ArrowProjectile_Functions[])(Entity*) = {
|
||||
ArrowProjectile_OnTick, ArrowProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const gArrowProjectileActions[])(Entity*) = {
|
||||
void (*const ArrowProjectile_Actions[])(Entity*) = {
|
||||
ArrowProjectile_Init, ArrowProjectile_Action1, ArrowProjectile_Action2,
|
||||
ArrowProjectile_Action3, ArrowProjectile_Action4,
|
||||
};
|
||||
|
|
|
@ -1,7 +1,24 @@
|
|||
/**
|
||||
* @file ballAndChain.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Ball and Chain Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
#include "hitbox.h"
|
||||
#include "projectile.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[19];
|
||||
/*0x7b*/ u8 unk_7b;
|
||||
/*0x7c*/ u8 unk_7c;
|
||||
/*0x7d*/ u8 unused2;
|
||||
/*0x7e*/ u8 unk_7e;
|
||||
/*0x7f*/ s8 unk_7f;
|
||||
} BallAndChainEntity;
|
||||
|
||||
typedef struct {
|
||||
s8 x;
|
||||
|
@ -10,41 +27,41 @@ typedef struct {
|
|||
|
||||
bool32 sub_080AB12C(Entity* this);
|
||||
|
||||
extern void (*const gUnk_0812A494[])(Entity*);
|
||||
extern void (*const gUnk_0812A494[])(BallAndChainEntity*);
|
||||
extern const PosOffset gUnk_0812A4A8[];
|
||||
|
||||
void BallAndChain(Entity* this) {
|
||||
gUnk_0812A494[this->type](this);
|
||||
void BallAndChain(BallAndChainEntity* this) {
|
||||
gUnk_0812A494[super->type](this);
|
||||
}
|
||||
|
||||
void sub_080AB074(Entity* this) {
|
||||
Entity* parent;
|
||||
void sub_080AB074(BallAndChainEntity* this) {
|
||||
BallAndChainEntity* parent;
|
||||
const s16* tmp;
|
||||
u32 factor;
|
||||
|
||||
parent = this->parent;
|
||||
if (parent->next == NULL) {
|
||||
parent = (BallAndChainEntity*)super->parent;
|
||||
if (parent->base.next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->action == 0) {
|
||||
if (sub_080AB12C(this) == FALSE) {
|
||||
if (super->action == 0) {
|
||||
if (sub_080AB12C(super) == FALSE) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
this->frameIndex = 0;
|
||||
this->spritePriority.b0 = 3;
|
||||
super->action = 1;
|
||||
super->frameIndex = 0;
|
||||
super->spritePriority.b0 = 3;
|
||||
}
|
||||
sub_0806FA90(this->parent, this, 0, -10 + -(s8)parent->field_0x7c.BYTES.byte3);
|
||||
sub_0806FA90(super->parent, super, 0, -10 + -parent->unk_7f);
|
||||
|
||||
this->x.WORD += gSineTable[parent->field_0x7c.BYTES.byte0] * (parent->field_0x7c.BYTES.byte2 << 8);
|
||||
this->y.WORD -= gSineTable[parent->field_0x7c.BYTES.byte0 + 0x40] * (parent->field_0x7c.BYTES.byte2 << 8);
|
||||
super->x.WORD += gSineTable[parent->unk_7c] * (parent->unk_7e << 8);
|
||||
super->y.WORD -= gSineTable[parent->unk_7c + 0x40] * (parent->unk_7e << 8);
|
||||
|
||||
this->z.HALF.HI += (s8)parent->field_0x7c.BYTES.byte3;
|
||||
if (parent->field_0x7a.HALF.HI != 0) {
|
||||
parent = CreateProjectile(BALL_AND_CHAIN);
|
||||
super->z.HALF.HI += parent->unk_7f;
|
||||
if (parent->unk_7b != 0) {
|
||||
parent = (BallAndChainEntity*)CreateProjectile(BALL_AND_CHAIN);
|
||||
if (parent != NULL) {
|
||||
parent->type = 4;
|
||||
CopyPositionAndSpriteOffset(this, parent);
|
||||
parent->base.type = 4;
|
||||
CopyPositionAndSpriteOffset(super, &parent->base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,76 +84,76 @@ bool32 sub_080AB12C(Entity* this) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_080AB170(Entity* this) {
|
||||
void sub_080AB170(BallAndChainEntity* this) {
|
||||
s32 val;
|
||||
s32 type;
|
||||
Entity* ent;
|
||||
Entity* parent = this->parent;
|
||||
BallAndChainEntity* ent;
|
||||
Entity* parent = super->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;
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->spritePriority.b1 = 0;
|
||||
super->frameIndex = 5;
|
||||
super->spritePriority.b0 = 3;
|
||||
super->hitbox = (Hitbox*)&gHitbox_22;
|
||||
}
|
||||
|
||||
ent = parent->parent;
|
||||
if (this->field_0x7c.BYTES.byte0 != ent->field_0x7c.BYTES.byte0) {
|
||||
this->flags |= ENT_COLLIDE;
|
||||
ent = (BallAndChainEntity*)parent->parent;
|
||||
if (this->unk_7c != ent->unk_7c) {
|
||||
super->flags |= ENT_COLLIDE;
|
||||
} else {
|
||||
this->flags &= ~ENT_COLLIDE;
|
||||
super->flags &= ~ENT_COLLIDE;
|
||||
}
|
||||
|
||||
this->field_0x7c.BYTES.byte0 = ent->field_0x7c.BYTES.byte0;
|
||||
this->unk_7c = ent->unk_7c;
|
||||
|
||||
if ((ent->frame & 0x20) == 0) {
|
||||
u8 index = ent->frame & 0x1f;
|
||||
if ((ent->base.frame & 0x20) == 0) {
|
||||
u8 index = ent->base.frame & 0x1f;
|
||||
PosOffset* pOffset = (PosOffset*)((s8*)gUnk_0812A4A8 + index);
|
||||
sub_0806FA90(ent, this, pOffset->x, pOffset->y);
|
||||
sub_0806FA90(&ent->base, super, pOffset->x, pOffset->y);
|
||||
} else {
|
||||
sub_0806FA90(ent, this, 0, -10);
|
||||
sub_0806FA90(&ent->base, super, 0, -10);
|
||||
}
|
||||
|
||||
val = (parent->x.HALF.HI - this->x.HALF.HI) * this->type;
|
||||
val = (parent->x.HALF.HI - super->x.HALF.HI) * super->type;
|
||||
if (val < 0) {
|
||||
val += 3;
|
||||
}
|
||||
this->x.HALF.HI += (val >> 2);
|
||||
super->x.HALF.HI += (val >> 2);
|
||||
|
||||
val = (parent->y.HALF.HI - this->y.HALF.HI) * this->type;
|
||||
val = (parent->y.HALF.HI - super->y.HALF.HI) * super->type;
|
||||
if (val < 0) {
|
||||
val += 3;
|
||||
}
|
||||
this->y.HALF.HI += (val >> 2);
|
||||
super->y.HALF.HI += (val >> 2);
|
||||
|
||||
val = (parent->z.HALF.HI - this->z.HALF.HI) * this->type;
|
||||
val = (parent->z.HALF.HI - super->z.HALF.HI) * super->type;
|
||||
if (val < 0) {
|
||||
val += 3;
|
||||
}
|
||||
this->z.HALF.HI += (val >> 2);
|
||||
super->z.HALF.HI += (val >> 2);
|
||||
}
|
||||
|
||||
void sub_080AB26C(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->timer = 5;
|
||||
this->frameIndex = 0;
|
||||
void sub_080AB26C(BallAndChainEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->timer = 5;
|
||||
super->frameIndex = 0;
|
||||
#ifndef EU
|
||||
this->spritePriority.b1 = 0;
|
||||
super->spritePriority.b1 = 0;
|
||||
#endif
|
||||
}
|
||||
if (--this->timer == 0) {
|
||||
if (--super->timer == 0) {
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
this->frameIndex++;
|
||||
super->frameIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
void (*const gUnk_0812A494[])(Entity*) = {
|
||||
void (*const gUnk_0812A494[])(BallAndChainEntity*) = {
|
||||
sub_080AB074, sub_080AB170, sub_080AB170, sub_080AB170, sub_080AB26C,
|
||||
};
|
||||
const PosOffset gUnk_0812A4A8[] = {
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file boneProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Bone Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const BoneProjectile_Functions[])(Entity*);
|
||||
|
@ -16,7 +23,7 @@ void BoneProjectile_OnTick(Entity* this) {
|
|||
BoneProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A81C4(Entity* this) {
|
||||
void BoneProjectile_OnCollision(Entity* this) {
|
||||
if (this->contactFlags == 0x80) {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
|
@ -86,7 +93,7 @@ void sub_080A82D8(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const BoneProjectile_Functions[])(Entity*) = {
|
||||
BoneProjectile_OnTick, sub_080A81C4, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
BoneProjectile_OnTick, BoneProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const BoneProjectile_Actions[])(Entity*) = {
|
||||
BoneProjectile_Init, BoneProjectile_Action1, BoneProjectile_Action2, BoneProjectile_Action3, BoneProjectile_Action4,
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file cannonballProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Cannonball Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const CannonballProjectile_Functions[])(Entity*);
|
||||
|
@ -17,7 +24,7 @@ void CannonballProjectile_OnTick(Entity* this) {
|
|||
CannonballProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080AB544(Entity* this) {
|
||||
void CannonballProjectile_OnCollision(Entity* this) {
|
||||
u32 tmp;
|
||||
|
||||
if (this->iframes < -4) {
|
||||
|
@ -90,7 +97,7 @@ bool32 sub_080AB634(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const CannonballProjectile_Functions[])(Entity*) = {
|
||||
CannonballProjectile_OnTick, sub_080AB544, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
CannonballProjectile_OnTick, CannonballProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const CannonballProjectile_Actions[])(Entity*) = {
|
||||
CannonballProjectile_Init,
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
/**
|
||||
* @file darkNutSwordSlash.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Dark Nut Sword Slash Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
|
||||
extern const u8 DarkNutSwordSlash_hitTypes[];
|
||||
extern void (*const DarkNutSwordSlash_UpdatesForType[])(Entity*);
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
/**
|
||||
* @file dekuSeedProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Deku Seed Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const DekuSeedProjectile_Functions[])(Entity*);
|
||||
extern void (*const DekuSeedProjectile_Actions[])(Entity*);
|
||||
|
@ -17,7 +24,7 @@ void DekuSeedProjectile_OnTick(Entity* this) {
|
|||
DekuSeedProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A8470(Entity* this) {
|
||||
void DekuSeedProjectile_OnCollision(Entity* this) {
|
||||
if (this->contactFlags == 0x80) {
|
||||
if (this->hitType == 0x68) {
|
||||
EnqueueSFX(SFX_86);
|
||||
|
@ -140,7 +147,7 @@ void sub_080A86A0(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const DekuSeedProjectile_Functions[])(Entity*) = {
|
||||
DekuSeedProjectile_OnTick, sub_080A8470, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
DekuSeedProjectile_OnTick, DekuSeedProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const DekuSeedProjectile_Actions[])(Entity*) = {
|
||||
DekuSeedProjectile_Init, DekuSeedProjectile_Action1, DekuSeedProjectile_Action2,
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
#include "sound.h"
|
||||
#include "entity.h"
|
||||
/**
|
||||
* @file dirtBallProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Dirt Ball Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "physics.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[27];
|
||||
/*0x83*/ u8 unk_83;
|
||||
} DirtBallProjectileEntity;
|
||||
|
||||
extern void (*const DirtBallProjectile_Functions[])(Entity*);
|
||||
extern void (*const DirtBallProjectile_Actions[])(Entity*);
|
||||
|
@ -25,7 +38,7 @@ void DirtBallProjectile_OnTick(Entity* this) {
|
|||
DirtBallProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A881C(Entity* this) {
|
||||
void DirtBallProjectile_OnCollision(Entity* this) {
|
||||
this->knockbackSpeed = 0;
|
||||
if (this->type == 0) {
|
||||
this->parent->child = NULL;
|
||||
|
@ -37,7 +50,7 @@ void sub_080A881C(Entity* this) {
|
|||
} else {
|
||||
if (this->action < 2) {
|
||||
this->action = 2;
|
||||
this->parent->field_0x82.HALF.HI = 0xc0;
|
||||
((DirtBallProjectileEntity*)this->parent)->unk_83 = 0xc0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +101,7 @@ void DirtBallProjectile_Action1(Entity* this) {
|
|||
entity->subtimer++;
|
||||
}
|
||||
if ((this->child->subtimer < 0x20) && ((this->child->subtimer & 3) == 3)) {
|
||||
parent->field_0x82.HALF.HI = 0xc0;
|
||||
((DirtBallProjectileEntity*)parent)->unk_83 = 0xc0;
|
||||
this->action = 2;
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +110,7 @@ void DirtBallProjectile_Action1(Entity* this) {
|
|||
this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0);
|
||||
if (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe) != 0) {
|
||||
this->action = 2;
|
||||
parent->field_0x82.HALF.HI = 0xc0;
|
||||
((DirtBallProjectileEntity*)parent)->unk_83 = 0xc0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -165,7 +178,7 @@ void DirtBallProjectile_Action3(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const DirtBallProjectile_Functions[])(Entity*) = {
|
||||
DirtBallProjectile_OnTick, sub_080A881C, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
DirtBallProjectile_OnTick, DirtBallProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const DirtBallProjectile_Actions[])(Entity*) = {
|
||||
DirtBallProjectile_Init,
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
|
||||
#include "entity.h"
|
||||
/**
|
||||
* @file fireProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Fire Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const FireProjectile_Actions[])(Entity*);
|
||||
|
|
|
@ -1,50 +1,62 @@
|
|||
|
||||
#include "entity.h"
|
||||
/**
|
||||
* @file gleerokProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Gleerok Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*const GleerokProjectile_Functions[])(Entity*);
|
||||
extern void (*const GleerokProjectile_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[12];
|
||||
/*0x74*/ u16 unk_74;
|
||||
} GleerokProjectileEntity;
|
||||
|
||||
extern void (*const GleerokProjectile_Functions[])(GleerokProjectileEntity*);
|
||||
extern void (*const GleerokProjectile_Actions[])(GleerokProjectileEntity*);
|
||||
extern const s8 gUnk_08129978[];
|
||||
extern const s8 gUnk_08129980[];
|
||||
extern const s8 gUnk_08129988[];
|
||||
|
||||
void sub_080A90D8(Entity*);
|
||||
void sub_080A90D8(GleerokProjectileEntity*);
|
||||
|
||||
void GleerokProjectile(Entity* this) {
|
||||
GleerokProjectile_Functions[GetNextFunction(this)](this);
|
||||
void GleerokProjectile(GleerokProjectileEntity* this) {
|
||||
GleerokProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void GleerokProjectile_OnTick(Entity* this) {
|
||||
if (((this->type != 3) && ((this->contactFlags & 0x80) != 0)) && ((this->contactFlags & 0x7f) != 0x1e)) {
|
||||
this->action = 3;
|
||||
COLLISION_OFF(this);
|
||||
InitializeAnimation(this, 0x53);
|
||||
void GleerokProjectile_OnTick(GleerokProjectileEntity* this) {
|
||||
if (((super->type != 3) && ((super->contactFlags & 0x80) != 0)) && ((super->contactFlags & 0x7f) != 0x1e)) {
|
||||
super->action = 3;
|
||||
COLLISION_OFF(super);
|
||||
InitializeAnimation(super, 0x53);
|
||||
}
|
||||
GleerokProjectile_Actions[this->action](this);
|
||||
GleerokProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void GleerokProjectile_Init(Entity* this) {
|
||||
void GleerokProjectile_Init(GleerokProjectileEntity* this) {
|
||||
u32 uVar1;
|
||||
s32 iVar2;
|
||||
|
||||
this->action = 1;
|
||||
this->zVelocity = Q_16_16(-1.0);
|
||||
if (this->type != 3) {
|
||||
CopyPosition(this->parent, this);
|
||||
LinearMoveDirection(this, 0x1000, this->direction);
|
||||
this->z.WORD = this->parent->y.WORD - this->child->y.WORD;
|
||||
this->y.WORD -= this->z.WORD;
|
||||
InitializeAnimation(this, 0x51);
|
||||
super->action = 1;
|
||||
super->zVelocity = Q_16_16(-1.0);
|
||||
if (super->type != 3) {
|
||||
CopyPosition(super->parent, super);
|
||||
LinearMoveDirection(super, 0x1000, super->direction);
|
||||
super->z.WORD = super->parent->y.WORD - super->child->y.WORD;
|
||||
super->y.WORD -= super->z.WORD;
|
||||
InitializeAnimation(super, 0x51);
|
||||
SoundReq(SFX_1B5);
|
||||
}
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
case 1:
|
||||
iVar2 = sub_080041DC(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
if (this->type == 1) {
|
||||
iVar2 = sub_080041DC(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
if (super->type == 1) {
|
||||
uVar1 = Random() & 0x1ff;
|
||||
if ((gRoomTransition.frameCount & 1U) == 0) {
|
||||
iVar2 += uVar1;
|
||||
|
@ -57,100 +69,104 @@ void GleerokProjectile_Init(Entity* this) {
|
|||
} else if (0x400 < iVar2) {
|
||||
iVar2 = 0x400;
|
||||
}
|
||||
this->zVelocity = this->z.WORD / (iVar2 << 8) << 0xd;
|
||||
this->subtimer = 30;
|
||||
super->zVelocity = super->z.WORD / (iVar2 << 8) << 0xd;
|
||||
super->subtimer = 30;
|
||||
break;
|
||||
case 2:
|
||||
this->zVelocity = (this->z.WORD / 0x18000) << 0xc;
|
||||
super->zVelocity = (super->z.WORD / 0x18000) << 0xc;
|
||||
break;
|
||||
case 3:
|
||||
this->z.WORD = Q_16_16(-160.0);
|
||||
super->z.WORD = Q_16_16(-160.0);
|
||||
uVar1 = (Random() & 3) * 2;
|
||||
this->x.HALF.HI = gUnk_08129978[uVar1] + this->x.HALF.HI;
|
||||
this->y.HALF.HI = gUnk_08129978[uVar1 + 1] + this->y.HALF.HI;
|
||||
super->x.HALF.HI = gUnk_08129978[uVar1] + super->x.HALF.HI;
|
||||
super->y.HALF.HI = gUnk_08129978[uVar1 + 1] + super->y.HALF.HI;
|
||||
if ((uVar1 & 2) != 0) {
|
||||
this->x.HALF.HI += gUnk_08129988[Random() & 0xf];
|
||||
this->y.HALF.HI += gUnk_08129980[Random() & 7];
|
||||
super->x.HALF.HI += gUnk_08129988[Random() & 0xf];
|
||||
super->y.HALF.HI += gUnk_08129980[Random() & 7];
|
||||
} else {
|
||||
this->x.HALF.HI += gUnk_08129980[Random() & 7];
|
||||
this->y.HALF.HI += gUnk_08129988[Random() & 0xf];
|
||||
super->x.HALF.HI += gUnk_08129980[Random() & 7];
|
||||
super->y.HALF.HI += gUnk_08129988[Random() & 0xf];
|
||||
}
|
||||
sub_08004168(this);
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08004168(super);
|
||||
InitializeAnimation(super, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GleerokProjectile_Action1(Entity* this) {
|
||||
if (this->type == 3) {
|
||||
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
|
||||
sub_08008790(this, 7);
|
||||
CreateFx(this, FX_ROCK, 0);
|
||||
void GleerokProjectile_Action1(GleerokProjectileEntity* this) {
|
||||
if (super->type == 3) {
|
||||
if (GravityUpdate(super, Q_8_8(24.0)) == 0) {
|
||||
sub_08008790(super, 7);
|
||||
CreateFx(super, FX_ROCK, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
if ((this->type != 2) && (this->subtimer-- == 0)) {
|
||||
this->subtimer = 30;
|
||||
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if ((super->type != 2) && (super->subtimer-- == 0)) {
|
||||
super->subtimer = 30;
|
||||
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
|
||||
}
|
||||
if (GravityUpdate(this, 0) == 0) {
|
||||
this->action = 2;
|
||||
if (GravityUpdate(super, 0) == 0) {
|
||||
super->action = 2;
|
||||
sub_080A90D8(this);
|
||||
if (this->type == 2) {
|
||||
this->timer = 15;
|
||||
InitializeAnimation(this, 0x54);
|
||||
if (super->type == 2) {
|
||||
super->timer = 15;
|
||||
InitializeAnimation(super, 0x54);
|
||||
} else {
|
||||
InitializeAnimation(this, 0x52);
|
||||
InitializeAnimation(super, 0x52);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GleerokProjectile_Action2(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->type == 2) {
|
||||
if (this->timer-- == 0) {
|
||||
COLLISION_OFF(this);
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, 0x55);
|
||||
void GleerokProjectile_Action2(GleerokProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if (super->type == 2) {
|
||||
if (super->timer-- == 0) {
|
||||
COLLISION_OFF(super);
|
||||
super->action = 3;
|
||||
InitializeAnimation(super, 0x55);
|
||||
} else {
|
||||
LinearMoveUpdate(this);
|
||||
LinearMoveUpdate(super);
|
||||
sub_080A90D8(this);
|
||||
}
|
||||
} else {
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->action = 3;
|
||||
COLLISION_OFF(this);
|
||||
InitializeAnimation(this, 0x53);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->action = 3;
|
||||
COLLISION_OFF(super);
|
||||
InitializeAnimation(super, 0x53);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GleerokProjectile_Action3(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
void GleerokProjectile_Action3(GleerokProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A90D8(Entity* this) {
|
||||
void sub_080A90D8(GleerokProjectileEntity* this) {
|
||||
u32 tmp;
|
||||
|
||||
if (this->field_0x74.HWORD != TILE(this->x.HALF.HI, this->y.HALF.HI)) {
|
||||
this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
tmp = GetTileTypeByEntity(this);
|
||||
if (this->unk_74 != TILE(super->x.HALF.HI, super->y.HALF.HI)) {
|
||||
this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
tmp = GetTileTypeByEntity(super);
|
||||
if ((tmp == 0x13) || (tmp == 0x34)) {
|
||||
sub_0807B7D8(0x34c, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
sub_0807B7D8(0x34c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void (*const GleerokProjectile_Functions[])(Entity*) = {
|
||||
GleerokProjectile_OnTick, GleerokProjectile_OnTick, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const GleerokProjectile_Functions[])(GleerokProjectileEntity*) = {
|
||||
GleerokProjectile_OnTick,
|
||||
GleerokProjectile_OnTick,
|
||||
(void (*)(GleerokProjectileEntity*))DeleteEntity,
|
||||
(void (*)(GleerokProjectileEntity*))DeleteEntity,
|
||||
(void (*)(GleerokProjectileEntity*))DeleteEntity,
|
||||
};
|
||||
void (*const GleerokProjectile_Actions[])(Entity*) = {
|
||||
void (*const GleerokProjectile_Actions[])(GleerokProjectileEntity*) = {
|
||||
GleerokProjectile_Init,
|
||||
GleerokProjectile_Action1,
|
||||
GleerokProjectile_Action2,
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file guardLineOfSightProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Guard Line of Sight Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "physics.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
#include "hitbox.h"
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "hitbox.h"
|
||||
#include "physics.h"
|
||||
#include "projectile.h"
|
||||
|
||||
extern u32 sub_080644C8(Entity*);
|
||||
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
|
||||
/**
|
||||
* @file guruguruBarProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Guruguru Bar Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "physics.h"
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file gyorgMaleEnergyProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Gyorg Male Energy Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const GyorgMaleEnergyProjectile_Functions[])(Entity*);
|
||||
extern void (*const GyorgMaleEnergyProjectile_Actions[])(Entity*);
|
||||
|
@ -17,7 +24,7 @@ void GyorgMaleEnergyProjectile_OnTick(Entity* this) {
|
|||
GyorgMaleEnergyProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080AC8DC(Entity* this) {
|
||||
void GyorgMaleEnergyProjectile_OnCollision(Entity* this) {
|
||||
switch ((s8)(this->contactFlags & 0x7f)) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
@ -92,7 +99,7 @@ void GyorgMaleEnergyProjectile_Action3(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const GyorgMaleEnergyProjectile_Functions[])(Entity*) = {
|
||||
GyorgMaleEnergyProjectile_OnTick, sub_080AC8DC, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
GyorgMaleEnergyProjectile_OnTick, GyorgMaleEnergyProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const GyorgMaleEnergyProjectile_Actions[])(Entity*) = {
|
||||
GyorgMaleEnergyProjectile_Init,
|
||||
|
|
|
@ -1,241 +1,255 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file gyorgTail.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Gyorg Tail Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "physics.h"
|
||||
#include "sound.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
#include "hitbox.h"
|
||||
#include "physics.h"
|
||||
#include "projectile.h"
|
||||
#include "sound.h"
|
||||
|
||||
bool32 sub_080AC5E4(Entity*);
|
||||
void sub_080AC388(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[10];
|
||||
/*0x72*/ u16 unk_72;
|
||||
/*0x74*/ u8 unused2[5];
|
||||
/*0x79*/ u8 unk_79;
|
||||
/*0x7a*/ s16 unk_7a;
|
||||
/*0x7c*/ u16 unk_7c;
|
||||
} GyorgTailEntity;
|
||||
|
||||
bool32 sub_080AC5E4(GyorgTailEntity*);
|
||||
void GyorgTail_Action1(GyorgTailEntity*);
|
||||
void sub_080AC6F0(Entity*);
|
||||
void sub_080AC760(Entity*);
|
||||
void sub_080AC7C4(Entity*);
|
||||
void sub_080AC328(Entity*);
|
||||
void sub_080AC510(Entity*);
|
||||
void sub_080AC560(Entity*);
|
||||
void sub_080AC884(Entity*);
|
||||
void sub_080AC480(Entity*);
|
||||
void GyorgTail_Init(Entity*);
|
||||
void sub_080AC7C4(GyorgTailEntity*);
|
||||
void sub_080AC328(GyorgTailEntity*);
|
||||
void sub_080AC510(GyorgTailEntity*);
|
||||
void sub_080AC560(GyorgTailEntity*);
|
||||
void sub_080AC884(GyorgTailEntity*);
|
||||
void GyorgTail_Action2(GyorgTailEntity*);
|
||||
void GyorgTail_Init(GyorgTailEntity*);
|
||||
|
||||
void GyorgTail(Entity* this) {
|
||||
static void (*const gUnk_0812A994[])(Entity*) = {
|
||||
void GyorgTail(GyorgTailEntity* this) {
|
||||
static void (*const gUnk_0812A994[])(GyorgTailEntity*) = {
|
||||
sub_080AC328, sub_080AC510, sub_080AC510, sub_080AC510, sub_080AC560,
|
||||
};
|
||||
Entity* parent;
|
||||
GyorgTailEntity* parent;
|
||||
|
||||
if (this->parent->next == NULL) {
|
||||
if (super->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
gUnk_0812A994[this->type2](this);
|
||||
if (this->type == 0) {
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 1;
|
||||
gUnk_0812A994[super->type2](this);
|
||||
if (super->type == 0) {
|
||||
super->spriteOrientation.flipY = 3;
|
||||
super->spriteRendering.b3 = 3;
|
||||
super->spritePriority.b0 = 1;
|
||||
} else {
|
||||
parent = this->parent;
|
||||
this->spriteOrientation.flipY = parent->spriteOrientation.flipY;
|
||||
this->spriteRendering.b3 = parent->spriteRendering.b3;
|
||||
this->spritePriority.b0 = parent->spritePriority.b0 - 2;
|
||||
parent = (GyorgTailEntity*)super->parent;
|
||||
super->spriteOrientation.flipY = parent->base.spriteOrientation.flipY;
|
||||
super->spriteRendering.b3 = parent->base.spriteRendering.b3;
|
||||
super->spritePriority.b0 = parent->base.spritePriority.b0 - 2;
|
||||
|
||||
if ((parent->spriteRendering.b3 == 3) && (parent->field_0x7c.BYTES.byte0 == 0)) {
|
||||
COLLISION_OFF(this);
|
||||
if ((parent->base.spriteRendering.b3 == 3) && (*(u8*)&parent->unk_7c == 0)) {
|
||||
COLLISION_OFF(super);
|
||||
} else {
|
||||
COLLISION_ON(this);
|
||||
COLLISION_ON(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC328(Entity* this) {
|
||||
static void (*const GyorgTail_Actions[])(Entity*) = {
|
||||
void sub_080AC328(GyorgTailEntity* this) {
|
||||
static void (*const GyorgTail_Actions[])(GyorgTailEntity*) = {
|
||||
GyorgTail_Init,
|
||||
sub_080AC388,
|
||||
sub_080AC480,
|
||||
GyorgTail_Action1,
|
||||
GyorgTail_Action2,
|
||||
};
|
||||
GyorgTail_Actions[this->action](this);
|
||||
GyorgTail_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void GyorgTail_Init(Entity* this) {
|
||||
void GyorgTail_Init(GyorgTailEntity* this) {
|
||||
static const s16 gUnk_0812A9B4[] = { -64, 64 };
|
||||
if (sub_080AC5E4(this) != 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = 0xc;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x7a.HWORD = gUnk_0812A9B4[Random() & 1];
|
||||
this->collisionLayer = 2;
|
||||
sub_080AC388(this);
|
||||
super->action = 1;
|
||||
super->frameIndex = 0xc;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->unk_7a = gUnk_0812A9B4[Random() & 1];
|
||||
super->collisionLayer = 2;
|
||||
GyorgTail_Action1(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC388(Entity* this) {
|
||||
void GyorgTail_Action1(GyorgTailEntity* this) {
|
||||
static const u8 gUnk_0812A9B8[] = { 24, 20 };
|
||||
Entity* pEVar2;
|
||||
int iVar3;
|
||||
u32 uVar5;
|
||||
|
||||
uVar5 = gUnk_0812A9B8[this->type];
|
||||
pEVar2 = this->parent;
|
||||
iVar3 = (pEVar2->animationState ^ 0x80) - (this->field_0x7c.HALF_U.LO >> 8);
|
||||
if ((short)this->field_0x7a.HWORD < 0) {
|
||||
uVar5 = gUnk_0812A9B8[super->type];
|
||||
pEVar2 = super->parent;
|
||||
iVar3 = (pEVar2->animationState ^ 0x80) - (this->unk_7c >> 8);
|
||||
if ((short)this->unk_7a < 0) {
|
||||
if (((iVar3 - uVar5) & 0xff) <= 0x7f) {
|
||||
s32 tmp = -(short)this->field_0x7a.HWORD;
|
||||
this->field_0x7a.HWORD = tmp;
|
||||
this->field_0x7c.HALF_U.LO = (short)((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8);
|
||||
s32 tmp = -(short)this->unk_7a;
|
||||
this->unk_7a = tmp;
|
||||
this->unk_7c = (short)((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8);
|
||||
sub_080AC884(this);
|
||||
} else {
|
||||
this->field_0x7c.HALF_U.LO = this->field_0x7c.HALF_U.LO + this->field_0x7a.HWORD;
|
||||
this->unk_7c = this->unk_7c + this->unk_7a;
|
||||
if (((iVar3 + uVar5) & 0xff) >= 0x81) {
|
||||
this->field_0x7c.HALF_U.LO = ((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8) | 0x80;
|
||||
this->unk_7c = ((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8) | 0x80;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (((iVar3 + uVar5) & 0xff) >= 0x81) {
|
||||
s32 tmp = -(short)this->field_0x7a.HWORD;
|
||||
this->field_0x7a.HWORD = tmp;
|
||||
this->field_0x7c.HALF_U.LO = (short)((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8);
|
||||
s32 tmp = -(short)this->unk_7a;
|
||||
this->unk_7a = tmp;
|
||||
this->unk_7c = (short)((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8);
|
||||
sub_080AC884(this);
|
||||
} else {
|
||||
this->field_0x7c.HALF_U.LO = this->field_0x7c.HALF_U.LO + this->field_0x7a.HWORD;
|
||||
this->unk_7c = this->unk_7c + this->unk_7a;
|
||||
if (0x7e >= ((iVar3 - uVar5) & 0xff) - 1) {
|
||||
this->field_0x7c.HALF_U.LO = ((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8) | 0x80;
|
||||
this->unk_7c = ((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8) | 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->direction = this->field_0x7c.HALF_U.LO >> 8;
|
||||
sub_080AC6F0(this);
|
||||
sub_080AC760(this);
|
||||
super->direction = this->unk_7c >> 8;
|
||||
sub_080AC6F0(super);
|
||||
sub_080AC760(super);
|
||||
sub_080AC7C4(this);
|
||||
}
|
||||
|
||||
void sub_080AC480(Entity* this) {
|
||||
if (this->timer != 0) {
|
||||
if (this->parent->health == 0) {
|
||||
this->action = 1;
|
||||
this->hitType = 0x1d;
|
||||
void GyorgTail_Action2(GyorgTailEntity* this) {
|
||||
if (super->timer != 0) {
|
||||
if (super->parent->health == 0) {
|
||||
super->action = 1;
|
||||
super->hitType = 0x1d;
|
||||
} else {
|
||||
if (--this->timer == 0) {
|
||||
this->hitType = 0x1c;
|
||||
if (--super->timer == 0) {
|
||||
super->hitType = 0x1c;
|
||||
SoundReq(SFX_116);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (--this->subtimer == 0) {
|
||||
this->action = 1;
|
||||
this->hitType = 0x1d;
|
||||
if (--super->subtimer == 0) {
|
||||
super->action = 1;
|
||||
super->hitType = 0x1d;
|
||||
}
|
||||
this->field_0x7c.HALF_U.LO += ((s16)this->field_0x7a.HWORD >= 1) ? 0x300 : -0x300;
|
||||
this->direction = this->field_0x7c.HALF.LO >> 8;
|
||||
sub_080AC6F0(this);
|
||||
sub_080AC760(this);
|
||||
this->unk_7c += ((s16)this->unk_7a >= 1) ? 0x300 : -0x300;
|
||||
super->direction = this->unk_7c >> 8;
|
||||
sub_080AC6F0(super);
|
||||
sub_080AC760(super);
|
||||
sub_080AC7C4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC510(Entity* this) {
|
||||
void sub_080AC510(GyorgTailEntity* this) {
|
||||
static const u8 gUnk_0812A9BA[] = { 24, 25, 25, 24, 24, 24 };
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = gUnk_0812A9BA[this->type * 3 + this->type2 - 1];
|
||||
this->spriteSettings.draw = 1;
|
||||
this->collisionLayer = 2;
|
||||
if (*(u16*)&this->type == 0x300) {
|
||||
this->hitbox = (Hitbox*)&gHitbox_21;
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->frameIndex = gUnk_0812A9BA[super->type * 3 + super->type2 - 1];
|
||||
super->spriteSettings.draw = 1;
|
||||
super->collisionLayer = 2;
|
||||
if (*(u16*)&super->type == 0x300) {
|
||||
super->hitbox = (Hitbox*)&gHitbox_21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC560(Entity* this) {
|
||||
void sub_080AC560(GyorgTailEntity* this) {
|
||||
s32 factor;
|
||||
Entity* entity;
|
||||
|
||||
entity = this->child;
|
||||
entity = super->child;
|
||||
if (entity->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->collisionLayer = 2;
|
||||
if (this->type == 0) {
|
||||
this->hitbox = (Hitbox*)&gHitbox_1;
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->collisionLayer = 2;
|
||||
if (super->type == 0) {
|
||||
super->hitbox = (Hitbox*)&gHitbox_1;
|
||||
} else {
|
||||
this->hitbox = (Hitbox*)&gHitbox_20;
|
||||
super->hitbox = (Hitbox*)&gHitbox_20;
|
||||
}
|
||||
this->frameIndex = 0xff;
|
||||
this->spriteSettings.draw = 1;
|
||||
super->frameIndex = 0xff;
|
||||
super->spriteSettings.draw = 1;
|
||||
}
|
||||
factor = this->field_0x78.HALF.HI << 8;
|
||||
this->x.WORD = entity->x.WORD + gSineTable[entity->direction] * factor;
|
||||
this->y.WORD = entity->y.WORD - gSineTable[entity->direction + 0x40] * factor;
|
||||
factor = this->unk_79 << 8;
|
||||
super->x.WORD = entity->x.WORD + gSineTable[entity->direction] * factor;
|
||||
super->y.WORD = entity->y.WORD - gSineTable[entity->direction + 0x40] * factor;
|
||||
}
|
||||
|
||||
bool32 sub_080AC5E4(Entity* this) {
|
||||
// TODO regalloc
|
||||
Entity* entity;
|
||||
Entity* new_var2;
|
||||
Entity* entity2;
|
||||
Entity* entity3;
|
||||
Entity* entity4;
|
||||
bool32 sub_080AC5E4(GyorgTailEntity* this) {
|
||||
GyorgTailEntity* entity;
|
||||
GyorgTailEntity* entity2;
|
||||
GyorgTailEntity* entity3;
|
||||
|
||||
if (this->type == 0) {
|
||||
if (super->type == 0) {
|
||||
if (gEntCount > 0x43) {
|
||||
return FALSE;
|
||||
}
|
||||
this->field_0x78.HALF.HI = 0x11;
|
||||
entity = CreateProjectile(GYORG_TAIL);
|
||||
entity->type = this->type;
|
||||
entity->type2 = 1;
|
||||
entity->parent = this->parent;
|
||||
entity->field_0x78.HALF.HI = 0x12;
|
||||
this->child = entity;
|
||||
this->unk_79 = 0x11;
|
||||
entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity->base.type = super->type;
|
||||
entity->base.type2 = 1;
|
||||
entity->base.parent = super->parent;
|
||||
entity->unk_79 = 0x12;
|
||||
super->child = &entity->base;
|
||||
|
||||
entity2 = CreateProjectile(GYORG_TAIL);
|
||||
entity2->type = this->type;
|
||||
entity2->type2 = 2;
|
||||
entity2->parent = this->parent;
|
||||
entity2->field_0x78.HALF.HI = 0x14;
|
||||
entity->child = entity2;
|
||||
entity2 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity2->base.type = super->type;
|
||||
entity2->base.type2 = 2;
|
||||
entity2->base.parent = super->parent;
|
||||
entity2->unk_79 = 0x14;
|
||||
entity->base.child = &entity2->base;
|
||||
|
||||
entity3 = CreateProjectile(GYORG_TAIL);
|
||||
entity3->type = this->type;
|
||||
entity3->type2 = 3;
|
||||
entity3->parent = this->parent;
|
||||
entity3->child = NULL;
|
||||
entity3->field_0x78.HALF.HI = 0;
|
||||
entity2->child = entity3;
|
||||
entity3 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity3->base.type = super->type;
|
||||
entity3->base.type2 = 3;
|
||||
entity3->base.parent = super->parent;
|
||||
entity3->base.child = NULL;
|
||||
entity3->unk_79 = 0;
|
||||
entity2->base.child = &entity3->base;
|
||||
|
||||
entity = CreateProjectile(GYORG_TAIL);
|
||||
entity->type = this->type;
|
||||
entity->type2 = 4;
|
||||
entity->parent = this->parent;
|
||||
entity->child = this;
|
||||
entity->field_0x78.HALF.HI = 0x14;
|
||||
entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity->base.type = super->type;
|
||||
entity->base.type2 = 4;
|
||||
entity->base.parent = super->parent;
|
||||
entity->base.child = super;
|
||||
entity->unk_79 = 0x14;
|
||||
} else {
|
||||
if (gEntCount > 0x44) {
|
||||
return FALSE;
|
||||
}
|
||||
this->field_0x78.HALF.HI = 0xf;
|
||||
entity = CreateProjectile(GYORG_TAIL);
|
||||
entity->type = this->type;
|
||||
entity->type2 = 1;
|
||||
entity->parent = this->parent;
|
||||
entity->field_0x78.HALF.HI = 0x10;
|
||||
this->child = entity;
|
||||
this->unk_79 = 0xf;
|
||||
entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity->base.type = super->type;
|
||||
entity->base.type2 = 1;
|
||||
entity->base.parent = super->parent;
|
||||
entity->unk_79 = 0x10;
|
||||
super->child = &entity->base;
|
||||
|
||||
entity2 = CreateProjectile(GYORG_TAIL);
|
||||
entity2->type = this->type;
|
||||
entity2->type2 = 2;
|
||||
entity2->parent = this->parent;
|
||||
entity2->child = NULL;
|
||||
entity2->field_0x78.HALF.HI = 0x20;
|
||||
entity->child = entity2;
|
||||
entity2 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity2->base.type = super->type;
|
||||
entity2->base.type2 = 2;
|
||||
entity2->base.parent = super->parent;
|
||||
entity2->base.child = NULL;
|
||||
entity2->unk_79 = 0x20;
|
||||
entity->base.child = &entity2->base;
|
||||
|
||||
entity = CreateProjectile(GYORG_TAIL);
|
||||
entity->type = this->type;
|
||||
entity->type2 = 4;
|
||||
entity->parent = this->parent;
|
||||
entity->child = this;
|
||||
entity->field_0x78.HALF.HI = 0x10;
|
||||
entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL);
|
||||
entity->base.type = super->type;
|
||||
entity->base.type2 = 4;
|
||||
entity->base.parent = super->parent;
|
||||
entity->base.child = super;
|
||||
entity->unk_79 = 0x10;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -322,10 +336,10 @@ void sub_080AC760(Entity* param_1) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080AC7C4(Entity* this) {
|
||||
Entity* entity1;
|
||||
Entity* entity2;
|
||||
Entity* entity3;
|
||||
void sub_080AC7C4(GyorgTailEntity* this) {
|
||||
GyorgTailEntity* entity1;
|
||||
GyorgTailEntity* entity2;
|
||||
GyorgTailEntity* entity3;
|
||||
s32 tmp;
|
||||
s32 tmp2;
|
||||
s32 tmp3;
|
||||
|
@ -334,36 +348,36 @@ void sub_080AC7C4(Entity* this) {
|
|||
s32 tmp6;
|
||||
s32 r6;
|
||||
|
||||
entity1 = this->child;
|
||||
entity2 = entity1->child;
|
||||
entity3 = entity2->child;
|
||||
entity1 = (GyorgTailEntity*)super->child;
|
||||
entity2 = (GyorgTailEntity*)entity1->base.child;
|
||||
entity3 = (GyorgTailEntity*)entity2->base.child;
|
||||
if (entity3 != NULL) {
|
||||
CopyPosition(this->parent, entity3);
|
||||
CopyPosition(super->parent, &entity3->base);
|
||||
} else {
|
||||
entity3 = this->parent;
|
||||
entity3 = (GyorgTailEntity*)super->parent;
|
||||
}
|
||||
tmp = entity2->field_0x78.HALF.HI << 8;
|
||||
tmp2 = gSineTable[entity2->direction];
|
||||
tmp = entity2->unk_79 << 8;
|
||||
tmp2 = gSineTable[entity2->base.direction];
|
||||
r6 = tmp2 * tmp;
|
||||
tmp2 = gSineTable[entity2->direction + 0x40] * tmp;
|
||||
PositionRelative(entity3, entity2, r6, -tmp2);
|
||||
tmp3 = entity1->field_0x78.HALF.HI << 8;
|
||||
tmp4 = gSineTable[entity1->direction];
|
||||
tmp2 = gSineTable[entity2->base.direction + 0x40] * tmp;
|
||||
PositionRelative(&entity3->base, &entity2->base, r6, -tmp2);
|
||||
tmp3 = entity1->unk_79 << 8;
|
||||
tmp4 = gSineTable[entity1->base.direction];
|
||||
r6 = tmp4 * tmp3;
|
||||
tmp4 = gSineTable[entity1->direction + 0x40] * tmp3;
|
||||
PositionRelative(entity2, entity1, r6, -tmp4);
|
||||
tmp5 = this->field_0x78.HALF.HI << 8;
|
||||
tmp6 = gSineTable[this->direction];
|
||||
tmp4 = gSineTable[entity1->base.direction + 0x40] * tmp3;
|
||||
PositionRelative(&entity2->base, &entity1->base, r6, -tmp4);
|
||||
tmp5 = this->unk_79 << 8;
|
||||
tmp6 = gSineTable[super->direction];
|
||||
r6 = tmp6 * tmp5;
|
||||
tmp6 = gSineTable[this->direction + 0x40] * tmp5;
|
||||
PositionRelative(entity1, this, r6, -tmp6);
|
||||
tmp6 = gSineTable[super->direction + 0x40] * tmp5;
|
||||
PositionRelative(&entity1->base, super, r6, -tmp6);
|
||||
}
|
||||
|
||||
void sub_080AC884(Entity* this) {
|
||||
if (this->parent->field_0x70.HALF_U.HI != 0) {
|
||||
this->parent->field_0x70.HALF_U.HI = 0;
|
||||
this->action = 2;
|
||||
this->timer = 60;
|
||||
this->subtimer = 86;
|
||||
void sub_080AC884(GyorgTailEntity* this) {
|
||||
if (((GyorgTailEntity*)super->parent)->unk_72 != 0) {
|
||||
((GyorgTailEntity*)super->parent)->unk_72 = 0;
|
||||
super->action = 2;
|
||||
super->timer = 60;
|
||||
super->subtimer = 86;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
|
||||
#include "entity.h"
|
||||
/**
|
||||
* @file iceProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Ice Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const IceProjectile_Actions[])(Entity*);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/**
|
||||
* @file keatonDagger.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Keaton Dagger Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "physics.h"
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file lakituCloudProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Lakitu Cloud Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
|
@ -20,10 +27,10 @@ void LakituCloudProjectile_OnTick(Entity* this) {
|
|||
LakituCloudProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void nullsub_539(Entity* this) {
|
||||
void LakituCloudProjectile_OnCollision(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080A9CF0(Entity* this) {
|
||||
void LakituCloudProjectile_OnGrabbed(Entity* this) {
|
||||
if (!sub_0806F520(this)) {
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
DeleteThisEntity();
|
||||
|
@ -63,7 +70,8 @@ void LakituCloudProjectile_Action1(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const LakituCloudProjectile_Functions[])(Entity*) = {
|
||||
LakituCloudProjectile_OnTick, nullsub_539, DeleteEntity, DeleteEntity, DeleteEntity, sub_080A9CF0,
|
||||
LakituCloudProjectile_OnTick, LakituCloudProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
LakituCloudProjectile_OnGrabbed,
|
||||
};
|
||||
void (*const LakituCloudProjectile_Actions[])(Entity*) = {
|
||||
LakituCloudProjectile_Init,
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file lakituLightning.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Lakitu Lightning Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const LakituLightning_Functions[])(Entity*);
|
||||
|
@ -16,7 +23,7 @@ void LakituLightning_OnTick(Entity* this) {
|
|||
LakituLightning_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A9DD8(Entity* this) {
|
||||
void LakituLightning_OnCollision(Entity* this) {
|
||||
if ((this->health == 0) || (this->contactFlags == 0x80)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
@ -43,7 +50,7 @@ void LakituLightning_Action1(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const LakituLightning_Functions[])(Entity*) = {
|
||||
LakituLightning_OnTick, sub_080A9DD8, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
LakituLightning_OnTick, LakituLightning_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const LakituLightning_Actions[])(Entity*) = {
|
||||
LakituLightning_Init,
|
||||
|
|
|
@ -1,118 +1,134 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file mandiblesProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Mandibles Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "physics.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "game.h"
|
||||
#include "hitbox.h"
|
||||
#include "physics.h"
|
||||
|
||||
extern void (*const MandiblesProjectile_Functions[])(Entity*);
|
||||
extern void (*const MandiblesProjectile_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[16];
|
||||
/*0x78*/ u16 unk_78;
|
||||
/*0x7a*/ u8 unused2[6];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u8 unk_82;
|
||||
} MandiblesProjectileEntity;
|
||||
|
||||
extern void (*const MandiblesProjectile_Functions[])(MandiblesProjectileEntity*);
|
||||
extern void (*const MandiblesProjectile_Actions[])(MandiblesProjectileEntity*);
|
||||
extern const u8 gUnk_08129CA4[];
|
||||
extern const Hitbox* const gUnk_08129CF4[];
|
||||
extern const u8 gUnk_08129CAC[];
|
||||
extern const s8 gUnk_08129D14[];
|
||||
|
||||
void sub_080AA1D8(Entity*);
|
||||
void sub_080AA270(Entity*);
|
||||
void sub_080AA270(MandiblesProjectileEntity*);
|
||||
bool32 sub_080AA2E0(Entity*);
|
||||
void sub_080AA320(Entity*);
|
||||
void sub_080AA3E0(Entity*, u32);
|
||||
void sub_080AA320(MandiblesProjectileEntity*);
|
||||
void sub_080AA3E0(MandiblesProjectileEntity*, u32);
|
||||
bool32 sub_080AA374(Entity*);
|
||||
|
||||
void MandiblesProjectile(Entity* this) {
|
||||
Entity* entity = this->child;
|
||||
void MandiblesProjectile(MandiblesProjectileEntity* this) {
|
||||
Entity* entity = super->child;
|
||||
if (entity == NULL) {
|
||||
entity = this->parent;
|
||||
entity = super->parent;
|
||||
}
|
||||
if ((entity->confusedTime == 0) && ((this->flags & ENT_COLLIDE) == 0)) {
|
||||
COLLISION_ON(this);
|
||||
if ((entity->confusedTime == 0) && ((super->flags & ENT_COLLIDE) == 0)) {
|
||||
COLLISION_ON(super);
|
||||
}
|
||||
MandiblesProjectile_Functions[GetNextFunction(this)](this);
|
||||
MandiblesProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void MandiblesProjectile_OnTick(Entity* this) {
|
||||
if (this->action < 3) {
|
||||
sub_080AA1D8(this);
|
||||
void MandiblesProjectile_OnTick(MandiblesProjectileEntity* this) {
|
||||
if (super->action < 3) {
|
||||
sub_080AA1D8(super);
|
||||
}
|
||||
MandiblesProjectile_Actions[this->action](this);
|
||||
MandiblesProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080A9EBC(Entity* this) {
|
||||
void MandiblesProjectile_OnCollision(MandiblesProjectileEntity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
switch (this->action) {
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
switch (super->action) {
|
||||
case 4:
|
||||
this->subtimer = 0;
|
||||
super->subtimer = 0;
|
||||
ModHealth(-2);
|
||||
ProcessMovement3(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ProcessMovement3(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
break;
|
||||
case 3:
|
||||
if (this->confusedTime != 0) {
|
||||
this->field_0x82.HALF.LO = 2;
|
||||
this->animationState = 0xff;
|
||||
if (super->confusedTime != 0) {
|
||||
this->unk_82 = 2;
|
||||
super->animationState = 0xff;
|
||||
sub_080AA270(this);
|
||||
this->subtimer = 32;
|
||||
super->subtimer = 32;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent = this->parent;
|
||||
parent->iframes = this->iframes;
|
||||
parent->knockbackDirection = this->knockbackDirection;
|
||||
parent->knockbackDuration = this->knockbackDuration;
|
||||
if (this->action == 1) {
|
||||
parent = super->parent;
|
||||
parent->iframes = super->iframes;
|
||||
parent->knockbackDirection = super->knockbackDirection;
|
||||
parent->knockbackDuration = super->knockbackDuration;
|
||||
if (super->action == 1) {
|
||||
sub_080AA320(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->knockbackDuration = 0;
|
||||
super->knockbackDuration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MandiblesProjectile_Init(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x80.HWORD = 0;
|
||||
this->animationState = 0xff;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->spritePriority.b0 = 4;
|
||||
SortEntityBelow(this, this->parent);
|
||||
void MandiblesProjectile_Init(MandiblesProjectileEntity* this) {
|
||||
super->action = 1;
|
||||
this->unk_80 = 0;
|
||||
super->animationState = 0xff;
|
||||
this->unk_82 = 0;
|
||||
super->spritePriority.b0 = 4;
|
||||
SortEntityBelow(super, super->parent);
|
||||
sub_080AA270(this);
|
||||
}
|
||||
|
||||
void MandiblesProjectile_Action1(Entity* this) {
|
||||
if (this->field_0x80.HWORD != 0) {
|
||||
this->field_0x80.HWORD--;
|
||||
void MandiblesProjectile_Action1(MandiblesProjectileEntity* this) {
|
||||
if (this->unk_80 != 0) {
|
||||
this->unk_80--;
|
||||
} else {
|
||||
if (--this->subtimer == 0) {
|
||||
if (--super->subtimer == 0) {
|
||||
sub_080AA270(this);
|
||||
} else {
|
||||
if (sub_080AA2E0(this) != 0) {
|
||||
if (sub_080AA2E0(super) != 0) {
|
||||
sub_080AA320(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void MandiblesProjectile_Action2(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & 0x40) != 0) {
|
||||
this->frame &= ~0x40;
|
||||
void MandiblesProjectile_Action2(MandiblesProjectileEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((super->frame & 0x40) != 0) {
|
||||
super->frame &= ~0x40;
|
||||
EnqueueSFX(SFX_15D);
|
||||
}
|
||||
this->field_0x78.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
if (GetTileType(this->field_0x78.HWORD, this->collisionLayer) == 0x4000) {
|
||||
SetTile(0x4005, this->field_0x78.HWORD, this->collisionLayer);
|
||||
this->unk_78 = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
if (GetTileType(this->unk_78, super->collisionLayer) == 0x4000) {
|
||||
SetTile(0x4005, this->unk_78, super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void MandiblesProjectile_Action3(Entity* this) {
|
||||
void MandiblesProjectile_Action3(MandiblesProjectileEntity* this) {
|
||||
u32 uVar1;
|
||||
s8* tmp;
|
||||
Entity* entity;
|
||||
|
||||
entity = this->child;
|
||||
entity = super->child;
|
||||
if (entity == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
@ -121,30 +137,30 @@ void MandiblesProjectile_Action3(Entity* this) {
|
|||
} else {
|
||||
tmp = GetSpriteSubEntryOffsetDataPointer((u16)entity->spriteIndex, entity->frameIndex);
|
||||
if ((entity->animationState & 4) != 0) {
|
||||
PositionRelative(entity, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1]));
|
||||
PositionRelative(entity, super, Q_16_16(-tmp[0]), Q_16_16(tmp[1]));
|
||||
} else {
|
||||
PositionRelative(entity, this, Q_16_16(tmp[0]), Q_16_16(tmp[1]));
|
||||
PositionRelative(entity, super, Q_16_16(tmp[0]), Q_16_16(tmp[1]));
|
||||
}
|
||||
}
|
||||
if (entity->confusedTime == 0) {
|
||||
if (this->subtimer != 0) {
|
||||
this->subtimer--;
|
||||
if (super->subtimer != 0) {
|
||||
super->subtimer--;
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->action = 4;
|
||||
this->field_0x82.HALF.LO = 3;
|
||||
this->subtimer = 64;
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->action = 4;
|
||||
this->unk_82 = 3;
|
||||
super->subtimer = 64;
|
||||
uVar1 = entity->animationState;
|
||||
this->direction = uVar1 << 2;
|
||||
this->animationState = uVar1 << 0x1a >> 0x1a;
|
||||
super->direction = uVar1 << 2;
|
||||
super->animationState = uVar1 << 0x1a >> 0x1a;
|
||||
#ifdef EU
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->hitbox = (Hitbox*)&gHitbox_0;
|
||||
super->spriteOrientation.flipY = 1;
|
||||
super->hitbox = (Hitbox*)&gHitbox_0;
|
||||
#else
|
||||
this->hitbox = (Hitbox*)&gHitbox_0;
|
||||
super->hitbox = (Hitbox*)&gHitbox_0;
|
||||
if (AreaIsDungeon() != 0) {
|
||||
this->spriteOrientation.flipY = 1;
|
||||
super->spriteOrientation.flipY = 1;
|
||||
}
|
||||
#endif
|
||||
sub_080AA3E0(this, 0);
|
||||
|
@ -153,51 +169,51 @@ void MandiblesProjectile_Action3(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void MandiblesProjectile_Action4(Entity* this) {
|
||||
void MandiblesProjectile_Action4(MandiblesProjectileEntity* this) {
|
||||
s32 iVar1;
|
||||
u32 uVar2;
|
||||
Entity* entity;
|
||||
MandiblesProjectileEntity* entity;
|
||||
|
||||
entity = this->child;
|
||||
entity = (MandiblesProjectileEntity*)super->child;
|
||||
if (entity != NULL) {
|
||||
if (entity->next == NULL) {
|
||||
this->child = NULL;
|
||||
if (entity->base.next == NULL) {
|
||||
super->child = NULL;
|
||||
}
|
||||
if (this->subtimer != 0) {
|
||||
this->subtimer--;
|
||||
if (super->subtimer != 0) {
|
||||
super->subtimer--;
|
||||
} else {
|
||||
if (sub_080AA374(this) != 0) {
|
||||
if (entity->health == 0) {
|
||||
if (sub_080AA374(super) != 0) {
|
||||
if (entity->base.health == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
EnqueueSFX(SFX_F2);
|
||||
this->action = 1;
|
||||
this->animationState = 0xff;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->timer = 0;
|
||||
this->field_0x80.HWORD = 0x20;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
this->parent = this->child;
|
||||
this->child = NULL;
|
||||
super->action = 1;
|
||||
super->animationState = 0xff;
|
||||
this->unk_82 = 0;
|
||||
super->timer = 0;
|
||||
this->unk_80 = 0x20;
|
||||
super->spriteOrientation.flipY = 2;
|
||||
super->parent = super->child;
|
||||
super->child = NULL;
|
||||
sub_080AA270(this);
|
||||
entity = this->parent;
|
||||
entity->action = 1;
|
||||
entity->direction = entity->animationState << 2;
|
||||
entity->speed = 0;
|
||||
entity->field_0x82.HALF.LO = 1;
|
||||
entity->timer = 0;
|
||||
entity->subtimer = 120;
|
||||
entity->field_0x80.HWORD = 0x20;
|
||||
entity = (MandiblesProjectileEntity*)super->parent;
|
||||
entity->base.action = 1;
|
||||
entity->base.direction = entity->base.animationState << 2;
|
||||
entity->base.speed = 0;
|
||||
entity->unk_82 = 1;
|
||||
entity->base.timer = 0;
|
||||
entity->base.subtimer = 120;
|
||||
entity->unk_80 = 0x20;
|
||||
sub_080AA3E0(entity, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CheckOnScreen(this) == 0) {
|
||||
if (CheckOnScreen(super) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
LinearMoveUpdate(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_080AA1D8(Entity* this) {
|
||||
|
@ -231,21 +247,21 @@ void sub_080AA1D8(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080AA270(Entity* this) {
|
||||
void sub_080AA270(MandiblesProjectileEntity* this) {
|
||||
u32 animationState;
|
||||
Entity* parent;
|
||||
parent = this->parent;
|
||||
this->subtimer = gUnk_08129CA4[Random() & 7];
|
||||
parent = super->parent;
|
||||
super->subtimer = gUnk_08129CA4[Random() & 7];
|
||||
animationState = parent->animationState;
|
||||
if (this->animationState == 0xff) {
|
||||
this->animationState = animationState;
|
||||
this->hitbox = (Hitbox*)gUnk_08129CF4[animationState];
|
||||
if (super->animationState == 0xff) {
|
||||
super->animationState = animationState;
|
||||
super->hitbox = (Hitbox*)gUnk_08129CF4[animationState];
|
||||
sub_080AA3E0(this, 0);
|
||||
} else {
|
||||
animationState = (gUnk_08129CAC[Random() & 7] + animationState) & 7;
|
||||
if (animationState != this->animationState) {
|
||||
this->animationState = animationState;
|
||||
this->hitbox = (Hitbox*)gUnk_08129CF4[animationState];
|
||||
if (animationState != super->animationState) {
|
||||
super->animationState = animationState;
|
||||
super->hitbox = (Hitbox*)gUnk_08129CF4[animationState];
|
||||
sub_080AA3E0(this, 0);
|
||||
}
|
||||
}
|
||||
|
@ -271,25 +287,25 @@ bool32 sub_080AA2E0(Entity* this) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_080AA320(Entity* this) {
|
||||
void sub_080AA320(MandiblesProjectileEntity* this) {
|
||||
u32 uVar2;
|
||||
Entity* parent;
|
||||
MandiblesProjectileEntity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
this->action = 2;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
this->subtimer = 0;
|
||||
parent->action = 2;
|
||||
parent->subtimer = 48;
|
||||
parent->field_0x80.HWORD = 0x50;
|
||||
parent->speed = 0;
|
||||
parent->direction = sub_08049F84(parent, 0);
|
||||
parent = (MandiblesProjectileEntity*)super->parent;
|
||||
super->action = 2;
|
||||
this->unk_82 = 1;
|
||||
super->subtimer = 0;
|
||||
parent->base.action = 2;
|
||||
parent->base.subtimer = 48;
|
||||
parent->unk_80 = 0x50;
|
||||
parent->base.speed = 0;
|
||||
parent->base.direction = sub_08049F84(&parent->base, 0);
|
||||
// TODO regalloc
|
||||
uVar2 = Direction8Round(parent->direction + 4);
|
||||
this->animationState = uVar2 >> 2;
|
||||
parent->animationState = DirectionRound(uVar2) >> 2;
|
||||
uVar2 = Direction8Round(parent->base.direction + 4);
|
||||
super->animationState = uVar2 >> 2;
|
||||
parent->base.animationState = DirectionRound(uVar2) >> 2;
|
||||
sub_080AA3E0(parent, 1);
|
||||
sub_080AA1D8(this);
|
||||
sub_080AA1D8(super);
|
||||
}
|
||||
|
||||
bool32 sub_080AA374(Entity* this) {
|
||||
|
@ -312,20 +328,24 @@ bool32 sub_080AA374(Entity* this) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void sub_080AA3E0(Entity* this, u32 param) {
|
||||
void sub_080AA3E0(MandiblesProjectileEntity* this, u32 param) {
|
||||
u32 tmp;
|
||||
|
||||
tmp = this->animationState | this->field_0x82.HALF.LO << 3;
|
||||
tmp = super->animationState | this->unk_82 << 3;
|
||||
if (param != 0) {
|
||||
tmp >>= 1;
|
||||
}
|
||||
InitAnimationForceUpdate(this, tmp);
|
||||
InitAnimationForceUpdate(super, tmp);
|
||||
}
|
||||
|
||||
void (*const MandiblesProjectile_Functions[])(Entity*) = {
|
||||
MandiblesProjectile_OnTick, sub_080A9EBC, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const MandiblesProjectile_Functions[])(MandiblesProjectileEntity*) = {
|
||||
MandiblesProjectile_OnTick,
|
||||
MandiblesProjectile_OnCollision,
|
||||
(void (*)(MandiblesProjectileEntity*))DeleteEntity,
|
||||
(void (*)(MandiblesProjectileEntity*))DeleteEntity,
|
||||
(void (*)(MandiblesProjectileEntity*))DeleteEntity,
|
||||
};
|
||||
void (*const MandiblesProjectile_Actions[])(Entity*) = {
|
||||
void (*const MandiblesProjectile_Actions[])(MandiblesProjectileEntity*) = {
|
||||
MandiblesProjectile_Init, MandiblesProjectile_Action1, MandiblesProjectile_Action2,
|
||||
MandiblesProjectile_Action3, MandiblesProjectile_Action4,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
/**
|
||||
* @file mazaalEnergyBeam.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Mazaal Energy Beam Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
#include "physics.h"
|
||||
#include "sound.h"
|
||||
|
||||
extern void (*const MazaalEnergyBeam_Actions[])(Entity*);
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file moblinSpear.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Moblin Spear Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "physics.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -10,13 +17,13 @@ typedef struct {
|
|||
} HitboxChange;
|
||||
|
||||
void MoblinSpear_OnTick(Entity* this);
|
||||
void sub_080A832C(Entity* this);
|
||||
void MoblinSpear_OnCollision(Entity* this);
|
||||
void MoblinSpear_Init(Entity* this);
|
||||
void MoblinSpear_Action1(Entity* this);
|
||||
|
||||
void MoblinSpear(Entity* this) {
|
||||
static void (*const MoblinSpear_Functions[])(Entity*) = {
|
||||
MoblinSpear_OnTick, sub_080A832C, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
MoblinSpear_OnTick, MoblinSpear_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
MoblinSpear_Functions[GetNextFunction(this)](this);
|
||||
}
|
||||
|
@ -29,7 +36,7 @@ void MoblinSpear_OnTick(Entity* this) {
|
|||
MoblinSpear_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A832C(Entity* this) {
|
||||
void MoblinSpear_OnCollision(Entity* this) {
|
||||
u8 tmp;
|
||||
|
||||
if (this->contactFlags == 0x80) {
|
||||
|
|
|
@ -1,13 +1,28 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file octorockBossProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Octorock Boss Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
|
||||
void OctorokBossProjectile_Action2(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[16];
|
||||
/*0x78*/ u16 unk_78;
|
||||
/*0x7a*/ u16 unk_7a;
|
||||
/*0x7c*/ u8 unk_7c;
|
||||
} OctorokBossProjectileEntity;
|
||||
|
||||
extern void (*const OctorokBossProjectile_Functions[])(Entity*);
|
||||
extern void (*const OctorokBossProjectile_Actions[])(Entity*);
|
||||
void OctorokBossProjectile_Action2(OctorokBossProjectileEntity*);
|
||||
|
||||
extern void (*const OctorokBossProjectile_Functions[])(OctorokBossProjectileEntity*);
|
||||
extern void (*const OctorokBossProjectile_Actions[])(OctorokBossProjectileEntity*);
|
||||
extern const u8 gUnk_08129ADC[];
|
||||
|
||||
enum OctorokBossProjectileType {
|
||||
|
@ -17,192 +32,196 @@ enum OctorokBossProjectileType {
|
|||
TYPE3 // falling stones
|
||||
};
|
||||
|
||||
void OctorokBossProjectile(Entity* this) {
|
||||
OctorokBossProjectile_Functions[GetNextFunction(this)](this);
|
||||
void OctorokBossProjectile(OctorokBossProjectileEntity* this) {
|
||||
OctorokBossProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void OctorokBossProjectile_OnTick(Entity* this) {
|
||||
OctorokBossProjectile_Actions[this->action](this);
|
||||
void OctorokBossProjectile_OnTick(OctorokBossProjectileEntity* this) {
|
||||
OctorokBossProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void OctorokBossProjectile_Init(Entity* this) {
|
||||
void OctorokBossProjectile_Init(OctorokBossProjectileEntity* this) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
LinearMoveAngle(this, 0x4800, this->direction);
|
||||
this->speed = 0x200;
|
||||
this->timer = 0;
|
||||
this->subtimer = this->direction;
|
||||
this->field_0x78.HWORD = 300;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
LinearMoveAngle(super, 0x4800, super->direction);
|
||||
super->speed = 0x200;
|
||||
super->timer = 0;
|
||||
super->subtimer = super->direction;
|
||||
this->unk_78 = 300;
|
||||
InitAnimationForceUpdate(super, 0);
|
||||
break;
|
||||
case 1:
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 6;
|
||||
this->speed = (Random() & 0x1ff) + 0x200;
|
||||
this->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5);
|
||||
super->spriteRendering.b3 = 3;
|
||||
super->spritePriority.b0 = 6;
|
||||
super->speed = (Random() & 0x1ff) + 0x200;
|
||||
super->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5);
|
||||
uVar1 = (((u8)Random() & 7) - 4);
|
||||
this->direction -= uVar1;
|
||||
*(u32*)&this->field_0x78 = 600;
|
||||
LinearMoveAngle(this, this->speed, this->direction);
|
||||
InitializeAnimation(this, 4);
|
||||
super->direction -= uVar1;
|
||||
*(u32*)&this->unk_78 = 600;
|
||||
LinearMoveAngle(super, super->speed, super->direction);
|
||||
InitializeAnimation(super, 4);
|
||||
break;
|
||||
case 2:
|
||||
if ((Random() & 1) != 0) {
|
||||
this->direction = (Random() & 7) + this->direction;
|
||||
super->direction = (Random() & 7) + super->direction;
|
||||
} else {
|
||||
this->direction = this->direction - (Random() & 7);
|
||||
super->direction = super->direction - (Random() & 7);
|
||||
}
|
||||
this->speed = 0x200;
|
||||
this->timer = 48;
|
||||
LinearMoveAngle(this, 0x5000, this->direction);
|
||||
InitializeAnimation(this, 5);
|
||||
super->speed = 0x200;
|
||||
super->timer = 48;
|
||||
LinearMoveAngle(super, 0x5000, super->direction);
|
||||
InitializeAnimation(super, 5);
|
||||
break;
|
||||
case 3:
|
||||
CopyPosition(&gPlayerEntity, this);
|
||||
this->z.WORD = Q_16_16(-160.0);
|
||||
this->x.HALF.HI += 0x60;
|
||||
this->y.HALF.HI += 0x40;
|
||||
this->x.HALF.HI -= (s32)Random() % 0xc0;
|
||||
CopyPosition(&gPlayerEntity, super);
|
||||
super->z.WORD = Q_16_16(-160.0);
|
||||
super->x.HALF.HI += 0x60;
|
||||
super->y.HALF.HI += 0x40;
|
||||
super->x.HALF.HI -= (s32)Random() % 0xc0;
|
||||
uVar2 = Random() & 0x7f;
|
||||
this->y.HALF.HI -= uVar2;
|
||||
InitializeAnimation(this, 0);
|
||||
super->y.HALF.HI -= uVar2;
|
||||
InitializeAnimation(super, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
SoundReq(SFX_1B5);
|
||||
}
|
||||
|
||||
void OctorokBossProjectile_Action1(Entity* this) {
|
||||
void OctorokBossProjectile_Action1(OctorokBossProjectileEntity* this) {
|
||||
u32 index;
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
if (this->parent->action == 2) {
|
||||
if (super->parent->action == 2) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((this->type2 == 0) && ((this->contactFlags & 0x80) != 0)) {
|
||||
if ((this->contactFlags & 0x7f) == 0) {
|
||||
if ((super->type2 == 0) && ((super->contactFlags & 0x80) != 0)) {
|
||||
if ((super->contactFlags & 0x7f) == 0) {
|
||||
OctorokBossProjectile_Action2(this);
|
||||
}
|
||||
this->direction = this->knockbackDirection << 3;
|
||||
this->speed = 0x400;
|
||||
this->type2 = 1;
|
||||
this->timer = 0;
|
||||
COLLISION_OFF(this);
|
||||
super->direction = super->knockbackDirection << 3;
|
||||
super->speed = 0x400;
|
||||
super->type2 = 1;
|
||||
super->timer = 0;
|
||||
COLLISION_OFF(super);
|
||||
}
|
||||
if (sub_0806FC80(this, this->parent, 0x40) != 0) {
|
||||
if (this->type2 == 0) {
|
||||
this->direction ^= 0x80;
|
||||
this->speed = 0x400;
|
||||
if (sub_0806FC80(super, super->parent, 0x40) != 0) {
|
||||
if (super->type2 == 0) {
|
||||
super->direction ^= 0x80;
|
||||
super->speed = 0x400;
|
||||
} else {
|
||||
this->parent->health--;
|
||||
this->parent->iframes = 0x1e;
|
||||
if (this->parent->field_0x7c.BYTES.byte0 != 0) {
|
||||
this->parent->knockbackDuration = 0x18;
|
||||
this->parent->knockbackSpeed = 0x200;
|
||||
this->parent->knockbackDirection = this->direction >> 3;
|
||||
super->parent->health--;
|
||||
super->parent->iframes = 0x1e;
|
||||
if (((OctorokBossProjectileEntity*)super->parent)->unk_7c != 0) {
|
||||
super->parent->knockbackDuration = 0x18;
|
||||
super->parent->knockbackSpeed = 0x200;
|
||||
super->parent->knockbackDirection = super->direction >> 3;
|
||||
}
|
||||
SoundReq(SFX_BOSS_HIT);
|
||||
OctorokBossProjectile_Action2(this);
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
this->field_0x78.HWORD--;
|
||||
LinearMoveAngle(this, this->speed, this->direction);
|
||||
CalculateEntityTileCollisions(this, this->direction >> 3, 0);
|
||||
if ((this->collisions & (COL_WEST_ANY | COL_EAST_ANY)) != COL_NONE) {
|
||||
this->direction = -this->direction;
|
||||
UpdateAnimationSingleFrame(super);
|
||||
this->unk_78--;
|
||||
LinearMoveAngle(super, super->speed, super->direction);
|
||||
CalculateEntityTileCollisions(super, super->direction >> 3, 0);
|
||||
if ((super->collisions & (COL_WEST_ANY | COL_EAST_ANY)) != COL_NONE) {
|
||||
super->direction = -super->direction;
|
||||
}
|
||||
if ((this->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) {
|
||||
this->direction = -this->direction ^ 0x80;
|
||||
if ((super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) {
|
||||
super->direction = -super->direction ^ 0x80;
|
||||
}
|
||||
if (this->direction == this->subtimer) {
|
||||
if (super->direction == super->subtimer) {
|
||||
return;
|
||||
}
|
||||
SoundReq(SFX_164);
|
||||
if (this->field_0x78.HWORD == 0) {
|
||||
this->timer = 4;
|
||||
if (this->unk_78 == 0) {
|
||||
super->timer = 4;
|
||||
} else {
|
||||
this->timer++;
|
||||
super->timer++;
|
||||
}
|
||||
|
||||
this->subtimer = this->direction;
|
||||
if (this->timer < 2) {
|
||||
super->subtimer = super->direction;
|
||||
if (super->timer < 2) {
|
||||
return;
|
||||
}
|
||||
for (index = 0; index < 3; ++index) {
|
||||
this->child = CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 1);
|
||||
if (this->child != NULL) {
|
||||
this->child->parent = this->parent;
|
||||
this->child->direction = this->direction + gUnk_08129ADC[index];
|
||||
CopyPosition(this, this->child);
|
||||
super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 1);
|
||||
if (super->child != NULL) {
|
||||
super->child->parent = super->parent;
|
||||
super->child->direction = super->direction + gUnk_08129ADC[index];
|
||||
CopyPosition(super, super->child);
|
||||
}
|
||||
}
|
||||
OctorokBossProjectile_Action2(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->parent->action == 2) {
|
||||
if (super->parent->action == 2) {
|
||||
OctorokBossProjectile_Action2(this);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (GravityUpdate(this, Q_8_8(24.0)) != 0) {
|
||||
CalculateEntityTileCollisions(this, this->direction >> 3, 0);
|
||||
if (this->collisions == COL_NONE) {
|
||||
LinearMoveAngle(this, (s32)this->speed, (u32)this->direction);
|
||||
GetNextFrame(super);
|
||||
if (GravityUpdate(super, Q_8_8(24.0)) != 0) {
|
||||
CalculateEntityTileCollisions(super, super->direction >> 3, 0);
|
||||
if (super->collisions == COL_NONE) {
|
||||
LinearMoveAngle(super, (s32)super->speed, (u32)super->direction);
|
||||
} else {
|
||||
OctorokBossProjectile_Action2(this);
|
||||
}
|
||||
}
|
||||
if (*(u32*)&this->field_0x78 < 0x1e) {
|
||||
if ((*(u32*)&this->field_0x78 & 7) != 0) {
|
||||
this->spriteSettings.draw = 1;
|
||||
if (*(u32*)&this->unk_78 < 0x1e) {
|
||||
if ((*(u32*)&this->unk_78 & 7) != 0) {
|
||||
super->spriteSettings.draw = 1;
|
||||
} else {
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
}
|
||||
}
|
||||
if (--*(u32*)&this->field_0x78 == -1) {
|
||||
if (--*(u32*)&this->unk_78 == -1) {
|
||||
OctorokBossProjectile_Action2(this);
|
||||
}
|
||||
if ((this->contactFlags & 0x80) == 0) {
|
||||
if ((super->contactFlags & 0x80) == 0) {
|
||||
return;
|
||||
}
|
||||
OctorokBossProjectile_Action2(this);
|
||||
break;
|
||||
case 2:
|
||||
GetNextFrame(this);
|
||||
if (this->timer-- != 0) {
|
||||
LinearMoveAngle(this, this->speed, this->direction);
|
||||
GetNextFrame(super);
|
||||
if (super->timer-- != 0) {
|
||||
LinearMoveAngle(super, super->speed, super->direction);
|
||||
return;
|
||||
}
|
||||
if (this->child != NULL) {
|
||||
this->child->timer = 1;
|
||||
if (super->child != NULL) {
|
||||
super->child->timer = 1;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
case 3:
|
||||
if (GravityUpdate(this, Q_8_8(24.0)) != 0) {
|
||||
if (GravityUpdate(super, Q_8_8(24.0)) != 0) {
|
||||
return;
|
||||
}
|
||||
CreateFx(this, FX_ROCK, 0);
|
||||
CreateFx(super, FX_ROCK, 0);
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OctorokBossProjectile_Action2(Entity* this) {
|
||||
CreateFx(this, FX_ROCK, 0);
|
||||
void OctorokBossProjectile_Action2(OctorokBossProjectileEntity* this) {
|
||||
CreateFx(super, FX_ROCK, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void (*const OctorokBossProjectile_Functions[])(Entity*) = {
|
||||
OctorokBossProjectile_OnTick, OctorokBossProjectile_OnTick, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const OctorokBossProjectile_Functions[])(OctorokBossProjectileEntity*) = {
|
||||
OctorokBossProjectile_OnTick,
|
||||
OctorokBossProjectile_OnTick,
|
||||
(void (*)(OctorokBossProjectileEntity*))DeleteEntity,
|
||||
(void (*)(OctorokBossProjectileEntity*))DeleteEntity,
|
||||
(void (*)(OctorokBossProjectileEntity*))DeleteEntity,
|
||||
};
|
||||
void (*const OctorokBossProjectile_Actions[])(Entity*) = {
|
||||
void (*const OctorokBossProjectile_Actions[])(OctorokBossProjectileEntity*) = {
|
||||
OctorokBossProjectile_Init,
|
||||
OctorokBossProjectile_Action1,
|
||||
OctorokBossProjectile_Action2,
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file projectile5.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Projectile 5
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "physics.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[27];
|
||||
/*0x83*/ u8 unk_83;
|
||||
} Projectile5Entity;
|
||||
|
||||
extern u32 sub_080B1B44(u32, u32);
|
||||
|
||||
|
@ -19,14 +32,14 @@ void Projectile5_OnTick(Entity* this) {
|
|||
Projectile5_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A86F0(Entity* this) {
|
||||
void Projectile5_OnCollision(Entity* this) {
|
||||
u8* pbVar2;
|
||||
|
||||
if (this->parent == NULL) {
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
pbVar2 = &this->parent->field_0x82.HALF.HI;
|
||||
if ((this->parent->field_0x82.HALF.HI & 0x3f) == 3) {
|
||||
pbVar2 = &((Projectile5Entity*)this->parent)->unk_83;
|
||||
if ((((Projectile5Entity*)this->parent)->unk_83 & 0x3f) == 3) {
|
||||
if (gPlayerState.hurtBlinkSpeed != 0) {
|
||||
if (sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer) == 0) {
|
||||
if (this->contactFlags == 0x80) {
|
||||
|
@ -48,22 +61,22 @@ void Projectile5_Init(Entity* this) {
|
|||
}
|
||||
|
||||
void Projectile5_Action1(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
Projectile5Entity* parent = (Projectile5Entity*)this->parent;
|
||||
if (parent == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (parent->next == NULL) {
|
||||
if (parent->base.next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((parent->field_0x82.HALF.HI & 0x7f) != 3) {
|
||||
if ((parent->unk_83 & 0x7f) != 3) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
CopyPosition(parent, this);
|
||||
CopyPosition(&parent->base, this);
|
||||
this->z.HALF.HI += 2;
|
||||
}
|
||||
|
||||
void (*const Projectile5_Functions[])(Entity*) = {
|
||||
Projectile5_OnTick, sub_080A86F0, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
Projectile5_OnTick, Projectile5_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const Projectile5_Actions[])(Entity*) = {
|
||||
Projectile5_Init,
|
||||
|
|
|
@ -1,68 +1,82 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file removableDust.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Removable Dust Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "physics.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "physics.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ EntityData* unk_68;
|
||||
/*0x6c*/ u8 unused[26];
|
||||
/*0x86*/ u16 unk_86;
|
||||
} RemovableDustEntity;
|
||||
|
||||
extern u32 sub_080B1AE0(u16, u8);
|
||||
|
||||
extern void (*const RemovableDust_Functions[])(Entity*);
|
||||
extern void (*const RemovableDust_Functions[])(RemovableDustEntity*);
|
||||
extern const u16 gUnk_08129FD0[];
|
||||
extern const u16 gUnk_08129FE4[];
|
||||
extern const s8 gUnk_08129FF8[];
|
||||
extern const u8 gUnk_0812A004[];
|
||||
|
||||
void sub_080AA494(Entity*);
|
||||
void sub_080AA494(RemovableDustEntity*);
|
||||
void sub_080AA534(Entity*);
|
||||
void sub_080AA464(Entity*);
|
||||
void sub_080AA544(Entity*);
|
||||
void sub_080AA654(Entity*, u32);
|
||||
void RemovableDust_OnGrabbed(RemovableDustEntity*);
|
||||
void sub_080AA544(RemovableDustEntity*);
|
||||
void sub_080AA654(RemovableDustEntity*, u32);
|
||||
|
||||
void RemovableDust(Entity* this) {
|
||||
RemovableDust_Functions[GetNextFunction(this)](this);
|
||||
void RemovableDust(RemovableDustEntity* this) {
|
||||
RemovableDust_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void RemovableDust_OnTick(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = this->type;
|
||||
this->gustJarFlags = 1;
|
||||
this->speed = this->field_0x86.HWORD;
|
||||
if (this->type == 0) {
|
||||
void RemovableDust_OnTick(RemovableDustEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->frameIndex = super->type;
|
||||
super->gustJarFlags = 1;
|
||||
super->speed = this->unk_86;
|
||||
if (super->type == 0) {
|
||||
sub_080AA494(this);
|
||||
} else {
|
||||
sub_080AA534(this);
|
||||
sub_080AA534(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AA450(Entity* this) {
|
||||
if (this->contactFlags == 0x96) {
|
||||
sub_080AA464(this);
|
||||
void RemovableDust_OnCollision(RemovableDustEntity* this) {
|
||||
if (super->contactFlags == 0x96) {
|
||||
RemovableDust_OnGrabbed(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AA464(Entity* this) {
|
||||
void RemovableDust_OnGrabbed(RemovableDustEntity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (this->type == 0) {
|
||||
if (super->type == 0) {
|
||||
sub_080AA544(this);
|
||||
}
|
||||
entity = CreateObject(DIRT_PARTICLE, 3, 0);
|
||||
if (entity != NULL) {
|
||||
CopyPosition(this, entity);
|
||||
CopyPosition(super, entity);
|
||||
}
|
||||
DeleteEntity(this);
|
||||
DeleteEntity(super);
|
||||
}
|
||||
|
||||
void sub_080AA494(Entity* this) {
|
||||
void sub_080AA494(RemovableDustEntity* this) {
|
||||
u32 tileType;
|
||||
const u16* iterator;
|
||||
u32 index;
|
||||
|
||||
index = 0;
|
||||
tileType = GetTileTypeByEntity(this);
|
||||
tileType = GetTileTypeByEntity(super);
|
||||
iterator = gUnk_08129FD0;
|
||||
while (*iterator != 0) {
|
||||
if (*(iterator++) == tileType) {
|
||||
|
@ -70,15 +84,15 @@ void sub_080AA494(Entity* this) {
|
|||
}
|
||||
index++;
|
||||
}
|
||||
if (CheckFlags((u16)this->speed) != 0) {
|
||||
if (CheckFlags((u16)super->speed) != 0) {
|
||||
if (index == 4) {
|
||||
sub_080AA654(this, TILE(this->x.HALF.HI, this->y.HALF.HI));
|
||||
sub_080AA654(this, TILE(super->x.HALF.HI, super->y.HALF.HI));
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->type2 = index;
|
||||
this->spritePriority.b0 = 7;
|
||||
SetTile(0x4068, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
super->type2 = index;
|
||||
super->spritePriority.b0 = 7;
|
||||
SetTile(0x4068, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080AA534(Entity* this) {
|
||||
|
@ -86,7 +100,7 @@ void sub_080AA534(Entity* this) {
|
|||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
|
||||
void sub_080AA544(Entity* this) {
|
||||
void sub_080AA544(RemovableDustEntity* this) {
|
||||
u8* pbVar1;
|
||||
s32 iVar2;
|
||||
u32 uVar3;
|
||||
|
@ -95,13 +109,13 @@ void sub_080AA544(Entity* this) {
|
|||
u32 param;
|
||||
const s8* tmp;
|
||||
|
||||
if (this->type2 < 9) {
|
||||
if (super->type2 < 9) {
|
||||
tmp = gUnk_08129FF8;
|
||||
param = TILE(this->x.HALF.HI, this->y.HALF.HI) + tmp[this->type2];
|
||||
param = TILE(super->x.HALF.HI, super->y.HALF.HI) + tmp[super->type2];
|
||||
uVar3 = 0;
|
||||
iVar4 = 0;
|
||||
do {
|
||||
iVar2 = sub_080B1AE0((param - tmp[uVar3]) & 0xffff, this->collisionLayer);
|
||||
iVar2 = sub_080B1AE0((param - tmp[uVar3]) & 0xffff, super->collisionLayer);
|
||||
if (iVar2 == 0x3e) {
|
||||
iVar4++;
|
||||
}
|
||||
|
@ -112,24 +126,24 @@ void sub_080AA544(Entity* this) {
|
|||
uVar3 = 0;
|
||||
puVar5 = gUnk_08129FD0;
|
||||
do {
|
||||
sub_0807B7D8((u32)*puVar5, param - tmp[uVar3], this->collisionLayer);
|
||||
sub_0807B7D8((u32)*puVar5, param - tmp[uVar3], super->collisionLayer);
|
||||
puVar5++;
|
||||
uVar3++;
|
||||
} while (uVar3 < 9);
|
||||
sub_080AA654(this, param);
|
||||
SetFlag((u16)this->speed);
|
||||
SetFlag((u16)super->speed);
|
||||
} else {
|
||||
sub_0807B7D8(gUnk_08129FE4[this->type2], param - tmp[this->type2], this->collisionLayer);
|
||||
sub_0807B7D8(gUnk_08129FE4[super->type2], param - tmp[super->type2], super->collisionLayer);
|
||||
}
|
||||
} else {
|
||||
RestorePrevTileEntity(TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
SetFlag((u16)this->speed);
|
||||
RestorePrevTileEntity(TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
SetFlag((u16)super->speed);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AA654(Entity* this, u32 param) {
|
||||
void sub_080AA654(RemovableDustEntity* this, u32 param) {
|
||||
EntityData* entityData;
|
||||
entityData = (EntityData*)&this->field_0x68;
|
||||
entityData = (EntityData*)&this->unk_68;
|
||||
|
||||
MemCopy(&gUnk_0812A004, entityData, 0x10);
|
||||
|
||||
|
@ -139,8 +153,13 @@ void sub_080AA654(Entity* this, u32 param) {
|
|||
LoadRoomEntity(entityData);
|
||||
}
|
||||
|
||||
void (*const RemovableDust_Functions[])(Entity*) = {
|
||||
RemovableDust_OnTick, sub_080AA450, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA464,
|
||||
void (*const RemovableDust_Functions[])(RemovableDustEntity*) = {
|
||||
RemovableDust_OnTick,
|
||||
RemovableDust_OnCollision,
|
||||
(void (*)(RemovableDustEntity*))DeleteEntity,
|
||||
(void (*)(RemovableDustEntity*))DeleteEntity,
|
||||
(void (*)(RemovableDustEntity*))DeleteEntity,
|
||||
RemovableDust_OnGrabbed,
|
||||
};
|
||||
const u16 gUnk_08129FD0[] = { 387, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 0 };
|
||||
const u16 gUnk_08129FE4[] = { 388, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 0 };
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file rockProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Rock Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const RockProjectile_Functions[])(Entity*);
|
||||
|
@ -15,7 +22,7 @@ void RockProjectile_OnTick(Entity* this) {
|
|||
RockProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A8064(Entity* this) {
|
||||
void RockProjectile_OnCollision(Entity* this) {
|
||||
if (this->contactFlags == 0x80) {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
|
@ -86,7 +93,7 @@ void sub_080A8178(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const RockProjectile_Functions[])(Entity*) = {
|
||||
RockProjectile_OnTick, sub_080A8064, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
RockProjectile_OnTick, RockProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const RockProjectile_Actions[])(Entity*) = {
|
||||
RockProjectile_Init,
|
||||
|
|
|
@ -1,148 +1,168 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file spiderWeb.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Spider Web Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "hitbox.h"
|
||||
#include "object.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[28];
|
||||
/*0x84*/ u8 unk_84;
|
||||
/*0x85*/ u8 unused2;
|
||||
/*0x86*/ u16 unk_86;
|
||||
} SpiderWebEntity;
|
||||
|
||||
typedef struct {
|
||||
u8 b0;
|
||||
u8 direction;
|
||||
} PACKED Struct_0812A074;
|
||||
|
||||
void SpiderWeb_OnTick(Entity*);
|
||||
void sub_080AA6C0(Entity*);
|
||||
void sub_080AAAA8(Entity*);
|
||||
void SpiderWeb_OnTick(SpiderWebEntity*);
|
||||
void SpiderWeb_OnCollision(SpiderWebEntity*);
|
||||
void sub_080AAAA8(SpiderWebEntity*);
|
||||
void sub_080AAA68(Entity*);
|
||||
void sub_080AA9E0(Entity*);
|
||||
void sub_080AA78C(Entity*);
|
||||
void SpiderWeb_Init(Entity*);
|
||||
void SpiderWeb_Action1(Entity*);
|
||||
void SpiderWeb_Action2(Entity*);
|
||||
void SpiderWeb_Action3(Entity*);
|
||||
void SpiderWeb_SubAction0(Entity*);
|
||||
void SpiderWeb_SubAction1(Entity*);
|
||||
void SpiderWeb_OnGrabbed(SpiderWebEntity*);
|
||||
void SpiderWeb_Init(SpiderWebEntity*);
|
||||
void SpiderWeb_Action1(SpiderWebEntity*);
|
||||
void SpiderWeb_Action2(SpiderWebEntity*);
|
||||
void SpiderWeb_Action3(SpiderWebEntity*);
|
||||
void SpiderWeb_SubAction0(SpiderWebEntity*);
|
||||
void SpiderWeb_SubAction1(SpiderWebEntity*);
|
||||
|
||||
void SpiderWeb(Entity* this) {
|
||||
static void (*const SpiderWeb_Functions[])(Entity*) = {
|
||||
SpiderWeb_OnTick, sub_080AA6C0, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA78C,
|
||||
void SpiderWeb(SpiderWebEntity* this) {
|
||||
static void (*const SpiderWeb_Functions[])(SpiderWebEntity*) = {
|
||||
SpiderWeb_OnTick,
|
||||
SpiderWeb_OnCollision,
|
||||
(void (*)(SpiderWebEntity*))DeleteEntity,
|
||||
(void (*)(SpiderWebEntity*))DeleteEntity,
|
||||
(void (*)(SpiderWebEntity*))DeleteEntity,
|
||||
SpiderWeb_OnGrabbed,
|
||||
};
|
||||
SpiderWeb_Functions[GetNextFunction(this)](this);
|
||||
SpiderWeb_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void SpiderWeb_OnTick(Entity* this) {
|
||||
static void (*const SpiderWeb_Actions[])(Entity*) = {
|
||||
void SpiderWeb_OnTick(SpiderWebEntity* this) {
|
||||
static void (*const SpiderWeb_Actions[])(SpiderWebEntity*) = {
|
||||
SpiderWeb_Init,
|
||||
SpiderWeb_Action1,
|
||||
SpiderWeb_Action2,
|
||||
SpiderWeb_Action3,
|
||||
};
|
||||
SpiderWeb_Actions[this->action](this);
|
||||
SpiderWeb_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080AA6C0(Entity* this) {
|
||||
void SpiderWeb_OnCollision(SpiderWebEntity* this) {
|
||||
static const s8 typeSpritOffsets[] = {
|
||||
-8, -4, 6, 1, 4, -11, -3, 3, -7, -3, 6, 4, -4, -11, 3, 3,
|
||||
};
|
||||
Entity* object;
|
||||
|
||||
if (this->contactFlags == 0x87) {
|
||||
this->action = 3;
|
||||
this->timer = 90;
|
||||
COLLISION_OFF(this);
|
||||
InitAnimationForceUpdate(this, this->type + 0x10);
|
||||
if (super->contactFlags == 0x87) {
|
||||
super->action = 3;
|
||||
super->timer = 90;
|
||||
COLLISION_OFF(super);
|
||||
InitAnimationForceUpdate(super, super->type + 0x10);
|
||||
object = CreateObject(FLAME, 3, 0);
|
||||
if (object != NULL) {
|
||||
object->type2 = 0x5a;
|
||||
object->spritePriority.b0 = 3;
|
||||
object->spriteOffsetX = typeSpritOffsets[this->type * 4];
|
||||
object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 1];
|
||||
object->parent = this;
|
||||
object->spriteOffsetX = typeSpritOffsets[super->type * 4];
|
||||
object->spriteOffsetY = typeSpritOffsets[super->type * 4 + 1];
|
||||
object->parent = super;
|
||||
}
|
||||
object = CreateObject(FLAME, 3, 0);
|
||||
if (object != NULL) {
|
||||
object->type2 = 0x5a;
|
||||
object->spritePriority.b0 = 3;
|
||||
object->spriteOffsetX = typeSpritOffsets[this->type * 4 + 2];
|
||||
object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 3];
|
||||
object->parent = this;
|
||||
object->spriteOffsetX = typeSpritOffsets[super->type * 4 + 2];
|
||||
object->spriteOffsetY = typeSpritOffsets[super->type * 4 + 3];
|
||||
object->parent = super;
|
||||
}
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, this->type + 0x10);
|
||||
InitAnimationForceUpdate(super, super->type + 0x10);
|
||||
EnqueueSFX(SFX_101);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AA78C(Entity* this) {
|
||||
void SpiderWeb_OnGrabbed(SpiderWebEntity* this) {
|
||||
u32 animationState;
|
||||
|
||||
if (this->subAction == 0) {
|
||||
if (super->subAction == 0) {
|
||||
animationState = (gPlayerEntity.animationState >> 1);
|
||||
if (animationState != this->type) {
|
||||
this->gustJarState &= ~4;
|
||||
if (AnimationStateFlip90(animationState) != this->type) {
|
||||
if (animationState != super->type) {
|
||||
super->gustJarState &= ~4;
|
||||
if (AnimationStateFlip90(animationState) != super->type) {
|
||||
return;
|
||||
}
|
||||
this->iframes = 0xe2;
|
||||
sub_080AA6C0(this);
|
||||
super->iframes = 0xe2;
|
||||
SpiderWeb_OnCollision(this);
|
||||
return;
|
||||
}
|
||||
this->subAction = 1;
|
||||
InitAnimationForceUpdate(this, animationState + 8);
|
||||
super->subAction = 1;
|
||||
InitAnimationForceUpdate(super, animationState + 8);
|
||||
}
|
||||
if (sub_0806F520(this)) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & 0x10) != 0) {
|
||||
this->frame &= ~0x10;
|
||||
if (sub_0806F520(super)) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((super->frame & 0x10) != 0) {
|
||||
super->frame &= ~0x10;
|
||||
EnqueueSFX(SFX_100);
|
||||
}
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
sub_080AAAA8(this);
|
||||
}
|
||||
} else {
|
||||
if ((this->frame & 1) != 0) {
|
||||
if ((super->frame & 1) != 0) {
|
||||
sub_080AAAA8(this);
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, this->type + 0x10);
|
||||
InitAnimationForceUpdate(super, super->type + 0x10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpiderWeb_Init(Entity* this) {
|
||||
void SpiderWeb_Init(SpiderWebEntity* this) {
|
||||
static const Hitbox* const typeHitboxes[] = {
|
||||
&gUnk_080FD41C,
|
||||
&gUnk_080FD424,
|
||||
&gUnk_080FD42C,
|
||||
&gUnk_080FD434,
|
||||
};
|
||||
if (CheckFlags(this->field_0x86.HWORD) != 0) {
|
||||
if (CheckFlags(this->unk_86) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->gustJarFlags = 1;
|
||||
this->carryFlags = 1;
|
||||
this->hitbox = (Hitbox*)typeHitboxes[this->type];
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
InitAnimationForceUpdate(this, this->type);
|
||||
sub_080AAA68(this);
|
||||
super->action = 1;
|
||||
super->gustJarFlags = 1;
|
||||
super->carryFlags = 1;
|
||||
super->hitbox = (Hitbox*)typeHitboxes[super->type];
|
||||
this->unk_84 = 0;
|
||||
InitAnimationForceUpdate(super, super->type);
|
||||
sub_080AAA68(super);
|
||||
}
|
||||
|
||||
void SpiderWeb_Action1(Entity* this) {
|
||||
if ((this->frame & ANIM_DONE) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void SpiderWeb_Action1(SpiderWebEntity* this) {
|
||||
if ((super->frame & ANIM_DONE) == 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
sub_080AA9E0(this);
|
||||
sub_080AA9E0(super);
|
||||
}
|
||||
|
||||
void SpiderWeb_Action2(Entity* this) {
|
||||
static void (*const SpiderWeb_SubActions[])(Entity*) = {
|
||||
void SpiderWeb_Action2(SpiderWebEntity* this) {
|
||||
static void (*const SpiderWeb_SubActions[])(SpiderWebEntity*) = {
|
||||
SpiderWeb_SubAction0,
|
||||
SpiderWeb_SubAction1,
|
||||
};
|
||||
sub_0806FBB4(this);
|
||||
SpiderWeb_SubActions[this->subAction - 5](this);
|
||||
sub_0806FBB4(super);
|
||||
SpiderWeb_SubActions[super->subAction - 5](this);
|
||||
}
|
||||
|
||||
void SpiderWeb_SubAction0(Entity* this) {
|
||||
void SpiderWeb_SubAction0(SpiderWebEntity* this) {
|
||||
static const s8 gUnk_0812A064[] = { 0, 17, -15, 4, 0, -11, 15, 4 };
|
||||
static const s8 gUnk_0812A06C[] = { 0, 2, -2, 0, 0, -2, 2, 0 };
|
||||
|
||||
|
@ -153,24 +173,24 @@ void SpiderWeb_SubAction0(Entity* this) {
|
|||
|
||||
entity = &gPlayerEntity;
|
||||
|
||||
if (this->cutsceneBeh.HALF.LO == 0) {
|
||||
tmp = this->type;
|
||||
if (this->unk_84 == 0) {
|
||||
tmp = super->type;
|
||||
if (tmp * 2 - entity->animationState == 0) {
|
||||
x = gUnk_0812A064[tmp * 2] + this->x.HALF.HI;
|
||||
y = gUnk_0812A064[tmp * 2 + 1] + this->y.HALF.HI;
|
||||
x = gUnk_0812A064[tmp * 2] + super->x.HALF.HI;
|
||||
y = gUnk_0812A064[tmp * 2 + 1] + super->y.HALF.HI;
|
||||
if (sub_080B1B18(x, y, entity->collisionLayer) == 0) {
|
||||
entity->x.HALF.HI = x;
|
||||
entity->y.HALF.HI = y;
|
||||
}
|
||||
}
|
||||
this->cutsceneBeh.HALF.LO = 1;
|
||||
this->subtimer = 2;
|
||||
InitAnimationForceUpdate(this, this->type + 4);
|
||||
this->unk_84 = 1;
|
||||
super->subtimer = 2;
|
||||
InitAnimationForceUpdate(super, super->type + 4);
|
||||
}
|
||||
if ((entity->animationState >> 1 == this->type) && (gPlayerState.framestate == PL_STATE_PULL) &&
|
||||
((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((this->frame & ANIM_DONE) == 0)) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & 1) != 0) {
|
||||
if ((entity->animationState >> 1 == super->type) && (gPlayerState.framestate == PL_STATE_PULL) &&
|
||||
((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((super->frame & ANIM_DONE) == 0)) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((super->frame & 1) != 0) {
|
||||
entity->x.HALF.HI = gUnk_0812A06C[entity->animationState] + entity->x.HALF.HI;
|
||||
entity->y.HALF.HI = gUnk_0812A06C[entity->animationState + 1] + entity->y.HALF.HI;
|
||||
EnqueueSFX(SFX_100);
|
||||
|
@ -178,15 +198,15 @@ void SpiderWeb_SubAction0(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void SpiderWeb_SubAction1(Entity* this) {
|
||||
this->action = 1;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
InitAnimationForceUpdate(this, this->type + 0xc);
|
||||
void SpiderWeb_SubAction1(SpiderWebEntity* this) {
|
||||
super->action = 1;
|
||||
this->unk_84 = 0;
|
||||
InitAnimationForceUpdate(super, super->type + 0xc);
|
||||
}
|
||||
|
||||
void SpiderWeb_Action3(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->timer == 0) {
|
||||
void SpiderWeb_Action3(SpiderWebEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if (--super->timer == 0) {
|
||||
sub_080AAAA8(this);
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +249,8 @@ void sub_080AAA68(Entity* this) {
|
|||
SetTile(typeTiles[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080AAAA8(Entity* this) {
|
||||
SetFlag(this->field_0x86.HWORD);
|
||||
RestorePrevTileEntity(TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
void sub_080AAAA8(SpiderWebEntity* this) {
|
||||
SetFlag(this->unk_86);
|
||||
RestorePrevTileEntity(TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
/**
|
||||
* @file spikedRollers.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Spiked Rollers Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
s16 x2;
|
||||
s16 y2;
|
||||
s16 unk_0x6c;
|
||||
u8 fill[0x16];
|
||||
u16 unk_0x84;
|
||||
u16 speed2;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s16 x2;
|
||||
/*0x6a*/ s16 y2;
|
||||
/*0x6c*/ s16 unk_0x6c;
|
||||
/*0x6e*/ u8 fill[0x16];
|
||||
/*0x84*/ u16 unk_0x84;
|
||||
/*0x86*/ u16 speed2;
|
||||
} SpikedRollersEntity;
|
||||
|
||||
static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*);
|
||||
|
@ -19,7 +25,7 @@ void SpikedRollers(SpikedRollersEntity* this) {
|
|||
SpikedRollers_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080ABA74(SpikedRollersEntity* this) {
|
||||
void SpikedRollers_Init(SpikedRollersEntity* this) {
|
||||
s32 val;
|
||||
super->action++;
|
||||
super->speed = this->speed2;
|
||||
|
@ -46,7 +52,7 @@ void sub_080ABA74(SpikedRollersEntity* this) {
|
|||
InitializeAnimation(super, super->type);
|
||||
}
|
||||
|
||||
void sub_080ABAE0(SpikedRollersEntity* this) {
|
||||
void SpikedRollers_Action1(SpikedRollersEntity* this) {
|
||||
s32 diff, unk_0x6c;
|
||||
ProcessMovement3(super);
|
||||
|
||||
|
@ -85,8 +91,8 @@ void sub_080ABAE0(SpikedRollersEntity* this) {
|
|||
}
|
||||
|
||||
static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*) = {
|
||||
sub_080ABA74,
|
||||
sub_080ABAE0,
|
||||
SpikedRollers_Init,
|
||||
SpikedRollers_Action1,
|
||||
};
|
||||
|
||||
static const u8 gSpikedRollersOffsets[] = {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file stalfosProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Stalfos Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const StalfosProjectile_Functions[])(Entity*);
|
||||
|
@ -28,7 +35,7 @@ void StalfosProjectile_OnTick(Entity* this) {
|
|||
StalfosProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A9A34(Entity* this) {
|
||||
void StalfosProjectile_OnCollision(Entity* this) {
|
||||
if (this->contactFlags == 0x9d) {
|
||||
this->action = 3;
|
||||
COLLISION_OFF(this);
|
||||
|
@ -37,7 +44,7 @@ void sub_080A9A34(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080A9A64(Entity* this) {
|
||||
void StalfosProjectile_OnGrabbed(Entity* this) {
|
||||
if ((this->subAction < 3) && !sub_0806F520(this)) {
|
||||
sub_080A9BA8(this);
|
||||
}
|
||||
|
@ -185,7 +192,8 @@ void sub_080A9C50(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const StalfosProjectile_Functions[])(Entity*) = {
|
||||
StalfosProjectile_OnTick, sub_080A9A34, DeleteEntity, DeleteEntity, DeleteEntity, sub_080A9A64,
|
||||
StalfosProjectile_OnTick, StalfosProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
StalfosProjectile_OnGrabbed,
|
||||
};
|
||||
void (*const StalfosProjectile_Actions[])(Entity*) = {
|
||||
StalfosProjectile_Init,
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file torchTrapProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Torch Trap Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const TorchTrapProjectile_Functions[])(Entity*);
|
||||
|
@ -14,7 +21,7 @@ void TorchTrapProjectile_OnTick(Entity* this) {
|
|||
TorchTrapProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080AAB1C(Entity* this) {
|
||||
void TorchTrapProjectile_OnCollision(Entity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
@ -49,7 +56,7 @@ void TorchTrapProjectile_Action2(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const TorchTrapProjectile_Functions[])(Entity*) = {
|
||||
TorchTrapProjectile_OnTick, sub_080AAB1C, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
TorchTrapProjectile_OnTick, TorchTrapProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
void (*const TorchTrapProjectile_Actions[])(Entity*) = {
|
||||
TorchTrapProjectile_Init,
|
||||
|
|
|
@ -1,96 +1,115 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file v1DarkMagicProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V1 Dark Magic Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[12];
|
||||
/*0x74*/ u8 unk_74;
|
||||
/*0x75*/ u8 unused2[11];
|
||||
/*0x80*/ u8 unk_80;
|
||||
/*0x81*/ u8 unk_81;
|
||||
/*0x92*/ u8 unused3[2];
|
||||
/*0x84*/ u16 unk_84;
|
||||
/*0x86*/ u8 unk_86;
|
||||
} V1DarkMagicProjectileEntity;
|
||||
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
|
||||
extern void (*const V1DarkMagicProjectile_Functions[])(Entity*);
|
||||
extern void (*const V1DarkMagicProjectile_Actions[])(Entity*);
|
||||
extern void (*const V1DarkMagicProjectile_Functions[])(V1DarkMagicProjectileEntity*);
|
||||
extern void (*const V1DarkMagicProjectile_Actions[])(V1DarkMagicProjectileEntity*);
|
||||
extern void (*const V1DarkMagicProjectile_SubActions[])(Entity*);
|
||||
|
||||
void sub_080AAF74(Entity*);
|
||||
void sub_080AAF74(V1DarkMagicProjectileEntity*);
|
||||
void sub_080AB034(Entity*);
|
||||
|
||||
void V1DarkMagicProjectile(Entity* this) {
|
||||
V1DarkMagicProjectile_Functions[GetNextFunction(this)](this);
|
||||
void V1DarkMagicProjectile(V1DarkMagicProjectileEntity* this) {
|
||||
V1DarkMagicProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_OnTick(Entity* this) {
|
||||
V1DarkMagicProjectile_Actions[this->action](this);
|
||||
if ((this->type2 == 0) && (--this->cutsceneBeh.HWORD == 0)) {
|
||||
this->health = 0;
|
||||
void V1DarkMagicProjectile_OnTick(V1DarkMagicProjectileEntity* this) {
|
||||
V1DarkMagicProjectile_Actions[super->action](this);
|
||||
if ((super->type2 == 0) && (--this->unk_84 == 0)) {
|
||||
super->health = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AAC44(Entity* this) {
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
if (this->type2 == 0) {
|
||||
if ((this->contactFlags & 0x3f) == 0) {
|
||||
this->action = 2;
|
||||
COLLISION_OFF(this);
|
||||
if (this->type == 0) {
|
||||
SortEntityAbove(&gPlayerEntity, this);
|
||||
void V1DarkMagicProjectile_OnCollision(V1DarkMagicProjectileEntity* this) {
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if (super->type2 == 0) {
|
||||
if ((super->contactFlags & 0x3f) == 0) {
|
||||
super->action = 2;
|
||||
COLLISION_OFF(super);
|
||||
if (super->type == 0) {
|
||||
SortEntityAbove(&gPlayerEntity, super);
|
||||
} else {
|
||||
SortEntityAbove(this->parent, this);
|
||||
SortEntityAbove(super->parent, super);
|
||||
}
|
||||
ResetActiveItems();
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
}
|
||||
if (gPlayerEntity.health == 0) {
|
||||
this->health = 0;
|
||||
super->health = 0;
|
||||
}
|
||||
} else {
|
||||
SoundReq(SFX_ITEM_GLOVES_KNOCKBACK);
|
||||
CopyPosition(this->parent, this);
|
||||
CopyPosition(super->parent, super);
|
||||
}
|
||||
}
|
||||
if (this->knockbackDuration != 0) {
|
||||
this->knockbackDuration = 0;
|
||||
if (super->knockbackDuration != 0) {
|
||||
super->knockbackDuration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AACE0(Entity* this) {
|
||||
Entity* parent;
|
||||
if (this->type && this->type2) {
|
||||
void V1DarkMagicProjectile_OnDeath(V1DarkMagicProjectileEntity* this) {
|
||||
V1DarkMagicProjectileEntity* parent;
|
||||
if (super->type && super->type2) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (this->spriteSettings.draw == 1) {
|
||||
this->spriteSettings.draw = 0;
|
||||
this->field_0x86.HALF.LO = 1;
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
if (super->spriteSettings.draw == 1) {
|
||||
super->spriteSettings.draw = 0;
|
||||
this->unk_86 = 1;
|
||||
CreateFx(super, FX_DEATH, 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;
|
||||
parent = (V1DarkMagicProjectileEntity*)super->parent;
|
||||
if (super->type2 == 0) {
|
||||
u8* ptr = &(parent->unk_74);
|
||||
parent->unk_74 = 3;
|
||||
parent->unk_80 += this->unk_81 >> 1;
|
||||
if (parent->unk_80 > 8) {
|
||||
parent->unk_80 = 8;
|
||||
} else if (parent->unk_80 == 0) {
|
||||
parent->unk_80 = 1;
|
||||
}
|
||||
} else {
|
||||
parent->cutsceneBeh.HALF.LO = 0;
|
||||
parent->hitType = 0x2b;
|
||||
*(u8*)&parent->unk_84 = 0;
|
||||
parent->base.hitType = 0x2b;
|
||||
}
|
||||
|
||||
if (this->field_0x86.HALF.LO == 0) {
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
if (this->unk_86 == 0) {
|
||||
CreateFx(super, FX_DEATH, 0);
|
||||
}
|
||||
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_080AAD70(Entity* this) {
|
||||
if (!sub_0806F520(this)) {
|
||||
this->health = 0;
|
||||
void V1DarkMagicProjectile_OnGrabbed(V1DarkMagicProjectileEntity* this) {
|
||||
if (!sub_0806F520(super)) {
|
||||
super->health = 0;
|
||||
}
|
||||
V1DarkMagicProjectile_SubActions[this->subAction](this);
|
||||
V1DarkMagicProjectile_SubActions[super->subAction](super);
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_SubAction0(Entity* this) {
|
||||
|
@ -106,120 +125,120 @@ void V1DarkMagicProjectile_SubAction2(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_Init(Entity* this) {
|
||||
void V1DarkMagicProjectile_Init(V1DarkMagicProjectileEntity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (this->type2 == 0) {
|
||||
this->action = 1;
|
||||
if (super->type2 == 0) {
|
||||
super->action = 1;
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->hitType = 0x2c;
|
||||
SortEntityAbove(this->parent, this);
|
||||
super->action = 3;
|
||||
super->hitType = 0x2c;
|
||||
SortEntityAbove(super->parent, super);
|
||||
}
|
||||
if (this->type == 0) {
|
||||
this->timer = 0;
|
||||
this->subtimer = 4;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
this->health = 0x10;
|
||||
this->z.HALF.HI += 4;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->field_0x86.HALF.LO = 0;
|
||||
this->cutsceneBeh.HWORD = 300;
|
||||
if (super->type == 0) {
|
||||
super->timer = 0;
|
||||
super->subtimer = 4;
|
||||
this->unk_80 = 0;
|
||||
this->unk_81 = 0;
|
||||
super->health = 0x10;
|
||||
super->z.HALF.HI += 4;
|
||||
super->spriteOrientation.flipY = 1;
|
||||
super->spriteRendering.b3 = 1;
|
||||
super->spritePriority.b0 = 4;
|
||||
super->direction = GetFacingDirection(super, &gPlayerEntity);
|
||||
this->unk_86 = 0;
|
||||
this->unk_84 = 300;
|
||||
entity = CreateProjectile(V1_DARK_MAGIC_PROJECTILE);
|
||||
if (entity != NULL) {
|
||||
entity->type = 1;
|
||||
entity->type2 = this->type2;
|
||||
entity->parent = this;
|
||||
entity->type2 = super->type2;
|
||||
entity->parent = super;
|
||||
}
|
||||
} else {
|
||||
SortEntityAbove(this->parent, this);
|
||||
COLLISION_OFF(this);
|
||||
CopyPosition(this->parent, this);
|
||||
SortEntityAbove(super->parent, super);
|
||||
COLLISION_OFF(super);
|
||||
CopyPosition(super->parent, super);
|
||||
}
|
||||
InitializeAnimation(this, this->type);
|
||||
InitializeAnimation(super, super->type);
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_Action1(Entity* this) {
|
||||
void V1DarkMagicProjectile_Action1(V1DarkMagicProjectileEntity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
if (--this->subtimer == 0) {
|
||||
this->subtimer = 4;
|
||||
uVar2 = GetFacingDirection(this, &gPlayerEntity);
|
||||
sub_08004596(this, uVar2);
|
||||
if (--super->subtimer == 0) {
|
||||
super->subtimer = 4;
|
||||
uVar2 = GetFacingDirection(super, &gPlayerEntity);
|
||||
sub_08004596(super, uVar2);
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
LinearMoveUpdate(super);
|
||||
break;
|
||||
case 1:
|
||||
if ((this->parent == NULL) || (this->parent->next == NULL)) {
|
||||
if ((super->parent == NULL) || (super->parent->next == NULL)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
case 2:
|
||||
if (this->parent->spriteSettings.draw == 0) {
|
||||
if (super->parent->spriteSettings.draw == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
CopyPosition(this->parent, this);
|
||||
CopyPosition(super->parent, super);
|
||||
break;
|
||||
}
|
||||
sub_080AB034(this);
|
||||
sub_080AB034(super);
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_Action2(Entity* this) {
|
||||
void V1DarkMagicProjectile_Action2(V1DarkMagicProjectileEntity* this) {
|
||||
sub_080AAF74(this);
|
||||
sub_080AB034(this);
|
||||
sub_080AB034(super);
|
||||
}
|
||||
|
||||
void V1DarkMagicProjectile_Action3(Entity* this) {
|
||||
CopyPosition(this->parent, this);
|
||||
sub_080AB034(this);
|
||||
this->spriteSettings.draw = this->parent->spriteSettings.draw;
|
||||
if (this->type != 0) {
|
||||
this->health = this->parent->health;
|
||||
void V1DarkMagicProjectile_Action3(V1DarkMagicProjectileEntity* this) {
|
||||
CopyPosition(super->parent, super);
|
||||
sub_080AB034(super);
|
||||
super->spriteSettings.draw = super->parent->spriteSettings.draw;
|
||||
if (super->type != 0) {
|
||||
super->health = super->parent->health;
|
||||
}
|
||||
#ifndef EU
|
||||
if (this->parent->action == 2) {
|
||||
if ((this->flags & ENT_COLLIDE) != 0) {
|
||||
COLLISION_OFF(this);
|
||||
if (super->parent->action == 2) {
|
||||
if ((super->flags & ENT_COLLIDE) != 0) {
|
||||
COLLISION_OFF(super);
|
||||
}
|
||||
} else {
|
||||
if ((this->flags & ENT_COLLIDE) == 0) {
|
||||
COLLISION_ON(this);
|
||||
if ((super->flags & ENT_COLLIDE) == 0) {
|
||||
COLLISION_ON(super);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void sub_080AAF74(Entity* this) {
|
||||
void sub_080AAF74(V1DarkMagicProjectileEntity* this) {
|
||||
if (sub_0807953C() != 0) {
|
||||
this->field_0x80.HALF.LO += (Random() & 1) + 1;
|
||||
this->unk_80 += (Random() & 1) + 1;
|
||||
}
|
||||
if (++this->timer == 0x3c) {
|
||||
this->timer = 30;
|
||||
if (++super->timer == 0x3c) {
|
||||
super->timer = 30;
|
||||
gPlayerEntity.iframes = 8;
|
||||
ModHealth(-4);
|
||||
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
|
||||
if (gPlayerEntity.health == 0) {
|
||||
this->health = 0;
|
||||
super->health = 0;
|
||||
}
|
||||
}
|
||||
if (!((this->field_0x80.HALF.LO < 0x31) && (this->field_0x80.HALF.HI != 0x10))) {
|
||||
this->action = 1;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
if (!((this->unk_80 < 0x31) && (this->unk_81 != 0x10))) {
|
||||
super->action = 1;
|
||||
this->unk_80 = 0;
|
||||
gPlayerEntity.iframes = 0xf0;
|
||||
gPlayerState.mobility = 0;
|
||||
this->health = 0;
|
||||
super->health = 0;
|
||||
} else {
|
||||
ResetActiveItems();
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
CopyPosition(&gPlayerEntity, this);
|
||||
this->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4;
|
||||
CopyPosition(&gPlayerEntity, super);
|
||||
super->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,10 +254,15 @@ void sub_080AB034(Entity* this) {
|
|||
ChangeObjPalette(this, tmp);
|
||||
}
|
||||
|
||||
void (*const V1DarkMagicProjectile_Functions[])(Entity*) = {
|
||||
V1DarkMagicProjectile_OnTick, sub_080AAC44, DeleteEntity, sub_080AACE0, DeleteEntity, sub_080AAD70,
|
||||
void (*const V1DarkMagicProjectile_Functions[])(V1DarkMagicProjectileEntity*) = {
|
||||
V1DarkMagicProjectile_OnTick,
|
||||
V1DarkMagicProjectile_OnCollision,
|
||||
(void (*)(V1DarkMagicProjectileEntity*))DeleteEntity,
|
||||
V1DarkMagicProjectile_OnDeath,
|
||||
(void (*)(V1DarkMagicProjectileEntity*))DeleteEntity,
|
||||
V1DarkMagicProjectile_OnGrabbed,
|
||||
};
|
||||
void (*const V1DarkMagicProjectile_Actions[])(Entity*) = {
|
||||
void (*const V1DarkMagicProjectile_Actions[])(V1DarkMagicProjectileEntity*) = {
|
||||
V1DarkMagicProjectile_Init,
|
||||
V1DarkMagicProjectile_Action1,
|
||||
V1DarkMagicProjectile_Action2,
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
/**
|
||||
* @file v1EyeLaser.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V1 Eye Laser Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
|
||||
extern void (*const V1EyeLaser_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[12];
|
||||
/*0x74*/ u32 unk_74;
|
||||
} V1EyeLaserEntity;
|
||||
|
||||
extern void (*const V1EyeLaser_Actions[])(V1EyeLaserEntity*);
|
||||
extern const Hitbox* const gUnk_0812A5F4[];
|
||||
extern const Hitbox gUnk_0812A614;
|
||||
extern const Hitbox gUnk_0812A61C;
|
||||
|
@ -11,42 +24,42 @@ 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) {
|
||||
void V1EyeLaser(V1EyeLaserEntity* this) {
|
||||
if (super->parent->spriteSettings.draw == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
V1EyeLaser_Actions[this->action](this);
|
||||
V1EyeLaser_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void V1EyeLaser_Init(Entity* this) {
|
||||
*(u32*)&this->field_0x74 = this->parent->x.WORD;
|
||||
if (this->type == 0) {
|
||||
this->action = 1;
|
||||
COLLISION_OFF(this);
|
||||
this->hitbox = (Hitbox*)&gUnk_0812A614;
|
||||
InitializeAnimation(this, 0);
|
||||
void V1EyeLaser_Init(V1EyeLaserEntity* this) {
|
||||
this->unk_74 = super->parent->x.WORD;
|
||||
if (super->type == 0) {
|
||||
super->action = 1;
|
||||
COLLISION_OFF(super);
|
||||
super->hitbox = (Hitbox*)&gUnk_0812A614;
|
||||
InitializeAnimation(super, 0);
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->subtimer = 4;
|
||||
InitializeAnimation(this, this->timer);
|
||||
super->action = 2;
|
||||
super->subtimer = 4;
|
||||
InitializeAnimation(super, super->timer);
|
||||
}
|
||||
}
|
||||
|
||||
void V1EyeLaser_Action1(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
sub_080AB758(this);
|
||||
void V1EyeLaser_Action1(V1EyeLaserEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->action = 2;
|
||||
InitializeAnimation(super, 1);
|
||||
sub_080AB758(super);
|
||||
}
|
||||
}
|
||||
|
||||
void V1EyeLaser_Action2(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
this->x.WORD += (this->parent->x.WORD - *(u32*)&this->field_0x74);
|
||||
*(u32*)&this->field_0x74 = this->parent->x.WORD;
|
||||
sub_080AB888(this);
|
||||
if (this->parent->subtimer == 0) {
|
||||
void V1EyeLaser_Action2(V1EyeLaserEntity* this) {
|
||||
GetNextFrame(super);
|
||||
super->x.WORD += (super->parent->x.WORD - this->unk_74);
|
||||
this->unk_74 = super->parent->x.WORD;
|
||||
sub_080AB888(super);
|
||||
if (super->parent->subtimer == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +141,7 @@ void sub_080AB888(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void (*const V1EyeLaser_Actions[])(Entity*) = {
|
||||
void (*const V1EyeLaser_Actions[])(V1EyeLaserEntity*) = {
|
||||
V1EyeLaser_Init,
|
||||
V1EyeLaser_Action1,
|
||||
V1EyeLaser_Action2,
|
||||
|
|
|
@ -1,54 +1,67 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file v1FireProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V1 Fire Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*const V1FireProjectile_Functions[])(Entity*);
|
||||
extern void (*const V1FireProjectile_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[14];
|
||||
/*0x76*/ u16 unk_76;
|
||||
} V1FireProjectileEntity;
|
||||
|
||||
extern void (*const V1FireProjectile_Functions[])(V1FireProjectileEntity*);
|
||||
extern void (*const V1FireProjectile_Actions[])(V1FireProjectileEntity*);
|
||||
extern const s8 gUnk_0812A4EC[];
|
||||
|
||||
void sub_080AB4A4(Entity*);
|
||||
void sub_080AB4A4(V1FireProjectileEntity*);
|
||||
s8* sub_080AB4F8(Entity*);
|
||||
|
||||
void V1FireProjectile(Entity* this) {
|
||||
V1FireProjectile_Functions[GetNextFunction(this)](this);
|
||||
void V1FireProjectile(V1FireProjectileEntity* this) {
|
||||
V1FireProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void V1FireProjectile_OnTick(Entity* this) {
|
||||
V1FireProjectile_Actions[this->action](this);
|
||||
void V1FireProjectile_OnTick(V1FireProjectileEntity* this) {
|
||||
V1FireProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080AB2DC(Entity* this) {
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
this->action = 3;
|
||||
COLLISION_OFF(this);
|
||||
InitializeAnimation(this, 0x53);
|
||||
if ((this->contactFlags & 0x7f) == 0) {
|
||||
void V1FireProjectile_OnCollision(V1FireProjectileEntity* this) {
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
super->action = 3;
|
||||
COLLISION_OFF(super);
|
||||
InitializeAnimation(super, 0x53);
|
||||
if ((super->contactFlags & 0x7f) == 0) {
|
||||
ModHealth(-4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void V1FireProjectile_Init(Entity* this) {
|
||||
void V1FireProjectile_Init(V1FireProjectileEntity* this) {
|
||||
s32 iVar2;
|
||||
u32 rnd;
|
||||
u32 x;
|
||||
u32 y;
|
||||
s8* data;
|
||||
|
||||
this->action = 1;
|
||||
this->zVelocity = Q_16_16(-1.0);
|
||||
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
CopyPosition(this->parent, this);
|
||||
LinearMoveDirection(this, 0x1000, this->direction);
|
||||
this->spritePriority.b0 = 1;
|
||||
this->z = this->parent->z;
|
||||
InitializeAnimation(this, 0x51);
|
||||
super->action = 1;
|
||||
super->zVelocity = Q_16_16(-1.0);
|
||||
this->unk_76 = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
CopyPosition(super->parent, super);
|
||||
LinearMoveDirection(super, 0x1000, super->direction);
|
||||
super->spritePriority.b0 = 1;
|
||||
super->z = super->parent->z;
|
||||
InitializeAnimation(super, 0x51);
|
||||
SoundReq(SFX_1B5);
|
||||
data = sub_080AB4F8(this);
|
||||
x = this->x.HALF.HI + data[0];
|
||||
y = this->y.HALF.HI + data[1];
|
||||
iVar2 = sub_080041DC(this, x, y);
|
||||
data = sub_080AB4F8(super);
|
||||
x = super->x.HALF.HI + data[0];
|
||||
y = super->y.HALF.HI + data[1];
|
||||
iVar2 = sub_080041DC(super, x, y);
|
||||
rnd = Random() & 0x1ff;
|
||||
if ((gRoomTransition.frameCount & 1U) != 0) {
|
||||
|
||||
|
@ -63,54 +76,54 @@ void V1FireProjectile_Init(Entity* this) {
|
|||
iVar2 = 0x20;
|
||||
}
|
||||
}
|
||||
this->zVelocity = (this->z.WORD / (iVar2 << 8)) << 0xd;
|
||||
super->zVelocity = (super->z.WORD / (iVar2 << 8)) << 0xd;
|
||||
|
||||
this->direction = sub_080045B4(this, x, y);
|
||||
super->direction = sub_080045B4(super, x, y);
|
||||
}
|
||||
|
||||
void V1FireProjectile_Action1(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (GravityUpdate(this, 0) == 0) {
|
||||
this->action = 2;
|
||||
this->timer = 15;
|
||||
InitializeAnimation(this, 0x54);
|
||||
void V1FireProjectile_Action1(V1FireProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (GravityUpdate(super, 0) == 0) {
|
||||
super->action = 2;
|
||||
super->timer = 15;
|
||||
InitializeAnimation(super, 0x54);
|
||||
sub_080AB4A4(this);
|
||||
} else {
|
||||
if (++this->timer > 0xe0) {
|
||||
if (++super->timer > 0xe0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void V1FireProjectile_Action2(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->action = 3;
|
||||
COLLISION_OFF(this);
|
||||
InitializeAnimation(this, 0x53);
|
||||
void V1FireProjectile_Action2(V1FireProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->action = 3;
|
||||
COLLISION_OFF(super);
|
||||
InitializeAnimation(super, 0x53);
|
||||
}
|
||||
}
|
||||
|
||||
void V1FireProjectile_Action3(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
void V1FireProjectile_Action3(V1FireProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AB4A4(Entity* this) {
|
||||
void sub_080AB4A4(V1FireProjectileEntity* this) {
|
||||
u32 tmp;
|
||||
u16 tile;
|
||||
|
||||
tmp = this->field_0x76.HWORD;
|
||||
tile = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
tmp = this->unk_76;
|
||||
tile = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
if (tmp != tile) {
|
||||
this->field_0x76.HWORD = tile;
|
||||
switch (GetTileTypeByEntity(this)) {
|
||||
this->unk_76 = tile;
|
||||
switch (GetTileTypeByEntity(super)) {
|
||||
case 0x13:
|
||||
case 0x34:
|
||||
sub_0807B7D8(0x34c, this->field_0x76.HWORD, this->collisionLayer);
|
||||
sub_0807B7D8(0x34c, this->unk_76, super->collisionLayer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -120,10 +133,14 @@ s8* sub_080AB4F8(Entity* this) {
|
|||
return (s8*)&gUnk_0812A4EC[this->type << 5 | this->subtimer << 1];
|
||||
}
|
||||
|
||||
void (*const V1FireProjectile_Functions[])(Entity*) = {
|
||||
V1FireProjectile_OnTick, sub_080AB2DC, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const V1FireProjectile_Functions[])(V1FireProjectileEntity*) = {
|
||||
V1FireProjectile_OnTick,
|
||||
V1FireProjectile_OnCollision,
|
||||
(void (*)(V1FireProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V1FireProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V1FireProjectileEntity*))DeleteEntity,
|
||||
};
|
||||
void (*const V1FireProjectile_Actions[])(Entity*) = {
|
||||
void (*const V1FireProjectile_Actions[])(V1FireProjectileEntity*) = {
|
||||
V1FireProjectile_Init,
|
||||
V1FireProjectile_Action1,
|
||||
V1FireProjectile_Action2,
|
||||
|
|
|
@ -1,49 +1,62 @@
|
|||
|
||||
#include "entity.h"
|
||||
/**
|
||||
* @file v2Projectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V2 Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
|
||||
extern void (*const V2Projectile_Functions[])(Entity*);
|
||||
extern void (*const gUnk_0812A7EC[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[12];
|
||||
/*0x74*/ u16 unk_74;
|
||||
/*0x76*/ u16 unk_76;
|
||||
} V2ProjectileEntity;
|
||||
|
||||
extern void (*const V2Projectile_Functions[])(V2ProjectileEntity*);
|
||||
extern void (*const gUnk_0812A7EC[])(V2ProjectileEntity*);
|
||||
extern void (*const gUnk_0812A7F8[])(Entity*);
|
||||
extern void (*const gUnk_0812A800[])(Entity*);
|
||||
extern void (*const gUnk_0812A808[])(Entity*);
|
||||
|
||||
void V2Projectile(Entity* this) {
|
||||
V2Projectile_Functions[GetNextFunction(this)](this);
|
||||
void V2Projectile(V2ProjectileEntity* this) {
|
||||
V2Projectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void sub_080ABBA8(Entity* this) {
|
||||
switch (this->type) {
|
||||
void V2Projectile_OnTick(V2ProjectileEntity* this) {
|
||||
switch (super->type) {
|
||||
case 0: {
|
||||
gUnk_0812A7EC[this->action](this);
|
||||
gUnk_0812A7EC[super->action](this);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
gUnk_0812A7F8[this->action](this);
|
||||
gUnk_0812A7F8[super->action](super);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
default:
|
||||
gUnk_0812A800[this->action](this);
|
||||
gUnk_0812A800[super->action](super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080ABBF4(Entity* this) {
|
||||
if ((this->contactFlags & 0x80) == 0)
|
||||
void V2Projectile_OnCollision(V2ProjectileEntity* this) {
|
||||
if ((super->contactFlags & 0x80) == 0)
|
||||
return;
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 2: {
|
||||
switch ((this->contactFlags & 0x3f)) {
|
||||
switch ((super->contactFlags & 0x3f)) {
|
||||
case 0: {
|
||||
ModHealth(-4);
|
||||
// fallthrough
|
||||
}
|
||||
case 3:
|
||||
case 0x14: {
|
||||
CreateDust(this);
|
||||
CreateDust(super);
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
|
@ -52,7 +65,7 @@ void sub_080ABBF4(Entity* this) {
|
|||
}
|
||||
case 0:
|
||||
case 1: {
|
||||
if ((this->contactFlags & 0x3f) == 0) {
|
||||
if ((super->contactFlags & 0x3f) == 0) {
|
||||
ModHealth(-2);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
@ -61,12 +74,12 @@ void sub_080ABBF4(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080ABC54(Entity* this) {
|
||||
if (!sub_0806F520(this)) {
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
void V2Projectile_OnGrabbed(V2ProjectileEntity* this) {
|
||||
if (!sub_0806F520(super)) {
|
||||
CreateFx(super, FX_DEATH, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
gUnk_0812A808[this->subAction](this);
|
||||
gUnk_0812A808[super->subAction](super);
|
||||
}
|
||||
|
||||
void sub_080ABC84(Entity* this) {
|
||||
|
@ -86,45 +99,45 @@ void sub_080ABC90(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080ABCC4(Entity* this) {
|
||||
this->action = 1;
|
||||
this->timer = (Random() & 0x3f) + 48;
|
||||
this->subtimer = 0;
|
||||
this->direction = Random() & 0x1f;
|
||||
this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
this->field_0x76.HWORD = GetTileType(this->field_0x74.HWORD, 2);
|
||||
this->spritePriority.b0 = 2;
|
||||
InitializeAnimation(this, 0);
|
||||
void sub_080ABCC4(V2ProjectileEntity* this) {
|
||||
super->action = 1;
|
||||
super->timer = (Random() & 0x3f) + 48;
|
||||
super->subtimer = 0;
|
||||
super->direction = Random() & 0x1f;
|
||||
this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
this->unk_76 = GetTileType(this->unk_74, 2);
|
||||
super->spritePriority.b0 = 2;
|
||||
InitializeAnimation(super, 0);
|
||||
SoundReq(SFX_14B);
|
||||
}
|
||||
|
||||
void sub_080ABD44(Entity* this) {
|
||||
if (--this->timer == 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
void sub_080ABD44(V2ProjectileEntity* this) {
|
||||
if (--super->timer == 0) {
|
||||
super->action = 2;
|
||||
InitializeAnimation(super, 1);
|
||||
}
|
||||
ProcessMovement3(this);
|
||||
GetNextFrame(this);
|
||||
ProcessMovement3(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_080ABD70(Entity* this) {
|
||||
void sub_080ABD70(V2ProjectileEntity* this) {
|
||||
u32 tmp;
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & 0x10) != 0) {
|
||||
this->frame &= 0xef;
|
||||
this->speed = 0;
|
||||
this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
|
||||
this->field_0x76.HWORD = GetTileType(this->field_0x74.HWORD, 2);
|
||||
tmp = this->field_0x76.HWORD;
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & 0x10) != 0) {
|
||||
super->frame &= 0xef;
|
||||
super->speed = 0;
|
||||
this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
this->unk_76 = GetTileType(this->unk_74, 2);
|
||||
tmp = this->unk_76;
|
||||
if (tmp != 0x13) {
|
||||
if (tmp == 0x315) {
|
||||
SetTileType(0x6e, this->field_0x74.HWORD, 2);
|
||||
SetTileType(0x6e, this->unk_74, 2);
|
||||
}
|
||||
} else {
|
||||
SetTileType(0x6d, this->field_0x74.HWORD, 2);
|
||||
SetTileType(0x6d, this->unk_74, 2);
|
||||
}
|
||||
}
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
@ -180,10 +193,15 @@ void sub_080ABF04(Entity* this) {
|
|||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void (*const V2Projectile_Functions[])(Entity*) = {
|
||||
sub_080ABBA8, sub_080ABBF4, DeleteEntity, DeleteEntity, DeleteEntity, sub_080ABC54,
|
||||
void (*const V2Projectile_Functions[])(V2ProjectileEntity*) = {
|
||||
V2Projectile_OnTick,
|
||||
V2Projectile_OnCollision,
|
||||
(void (*)(V2ProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V2ProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V2ProjectileEntity*))DeleteEntity,
|
||||
V2Projectile_OnGrabbed,
|
||||
};
|
||||
void (*const gUnk_0812A7EC[])(Entity*) = {
|
||||
void (*const gUnk_0812A7EC[])(V2ProjectileEntity*) = {
|
||||
sub_080ABCC4,
|
||||
sub_080ABD44,
|
||||
sub_080ABD70,
|
||||
|
|
|
@ -1,59 +1,73 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file v3ElectricProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V3 Electric Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "physics.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*const V3ElectricProjectile_Functions[])(Entity*);
|
||||
extern void (*const V3ElectricProjectile_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[28];
|
||||
/*0x84*/ u8 unk_84;
|
||||
/*0x85*/ u8 unk_85;
|
||||
} V3ElectricProjectileEntity;
|
||||
|
||||
extern void (*const V3ElectricProjectile_Functions[])(V3ElectricProjectileEntity*);
|
||||
extern void (*const V3ElectricProjectile_Actions[])(V3ElectricProjectileEntity*);
|
||||
static const u16 projectileSpeeds[];
|
||||
static const u8 gUnk_0812A982[];
|
||||
static const u8 projectileDirections[];
|
||||
|
||||
void V3ElectricProjectile(Entity* this) {
|
||||
V3ElectricProjectile_Functions[GetNextFunction(this)](this);
|
||||
void V3ElectricProjectile(V3ElectricProjectileEntity* this) {
|
||||
V3ElectricProjectile_Functions[GetNextFunction(super)](this);
|
||||
}
|
||||
|
||||
void V3ElectricProjectile_OnTick(Entity* this) {
|
||||
V3ElectricProjectile_Actions[this->action](this);
|
||||
void V3ElectricProjectile_OnTick(V3ElectricProjectileEntity* this) {
|
||||
V3ElectricProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080ABFE4(Entity* this) {
|
||||
void V3ElectricProjectile_OnCollision(V3ElectricProjectileEntity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_080ABFEC(Entity* this) {
|
||||
void V3ElectricProjectile_Init(V3ElectricProjectileEntity* this) {
|
||||
Sound sound;
|
||||
InitializeAnimation(this, this->type + 1);
|
||||
InitializeAnimation(super, super->type + 1);
|
||||
|
||||
switch (this->type) {
|
||||
switch (super->type) {
|
||||
case 0: {
|
||||
this->action = 1;
|
||||
this->timer = 0;
|
||||
this->subtimer = 7;
|
||||
this->cutsceneBeh.HALF.HI = 0x18;
|
||||
this->damage = 0x88;
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->z.HALF.HI -= 0x14;
|
||||
super->action = 1;
|
||||
super->timer = 0;
|
||||
super->subtimer = 7;
|
||||
this->unk_85 = 0x18;
|
||||
super->damage = 0x88;
|
||||
CopyPositionAndSpriteOffset(super->parent, super);
|
||||
super->z.HALF.HI -= 0x14;
|
||||
sound = SFX_149;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
this->action = 1;
|
||||
this->flags &= ~ENT_COLLIDE;
|
||||
this->cutsceneBeh.HALF.HI = 0x18;
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->z.HALF.HI -= 0x14;
|
||||
super->action = 1;
|
||||
super->flags &= ~ENT_COLLIDE;
|
||||
this->unk_85 = 0x18;
|
||||
CopyPositionAndSpriteOffset(super->parent, super);
|
||||
super->z.HALF.HI -= 0x14;
|
||||
sound = SFX_149;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this->action = 2;
|
||||
this->timer = 0;
|
||||
this->subtimer = 255;
|
||||
this->speed = projectileSpeeds[this->type2];
|
||||
this->damage = 0x88;
|
||||
super->action = 2;
|
||||
super->timer = 0;
|
||||
super->subtimer = 255;
|
||||
super->speed = projectileSpeeds[super->type2];
|
||||
super->damage = 0x88;
|
||||
sound = SFX_193;
|
||||
break;
|
||||
}
|
||||
|
@ -62,119 +76,124 @@ void sub_080ABFEC(Entity* this) {
|
|||
SoundReq(sound);
|
||||
}
|
||||
|
||||
void V3ElectricProjectile_Action1(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
void V3ElectricProjectile_Action1(V3ElectricProjectileEntity* this) {
|
||||
if (super->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->z.HALF.HI -= 0x14;
|
||||
if (this->cutsceneBeh.HALF.HI != 0) {
|
||||
if (((--this->cutsceneBeh.HALF.HI) & 7) == 0) {
|
||||
CopyPositionAndSpriteOffset(super->parent, super);
|
||||
super->z.HALF.HI -= 0x14;
|
||||
if (this->unk_85 != 0) {
|
||||
if (((--this->unk_85) & 7) == 0) {
|
||||
SoundReq(SFX_149);
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & 1) != 0) {
|
||||
if (this->type == 0) {
|
||||
this->action = 2;
|
||||
this->direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->speed = 0x180;
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & 1) != 0) {
|
||||
if (super->type == 0) {
|
||||
super->action = 2;
|
||||
super->direction = GetFacingDirection(super, &gPlayerEntity);
|
||||
super->speed = 0x180;
|
||||
SoundReq(SFX_193);
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->timer = 16;
|
||||
super->action = 3;
|
||||
super->timer = 16;
|
||||
}
|
||||
this->z.HALF.HI -= 0x28;
|
||||
super->z.HALF.HI -= 0x28;
|
||||
}
|
||||
}
|
||||
|
||||
void V3ElectricProjectile_Action2(Entity* this) {
|
||||
void V3ElectricProjectile_Action2(V3ElectricProjectileEntity* this) {
|
||||
u8 bVar1;
|
||||
s32 iVar2;
|
||||
u32 uVar3;
|
||||
|
||||
if (this->z.HALF.HI < -6) {
|
||||
this->z.HALF.HI += 3;
|
||||
if (super->z.HALF.HI < -6) {
|
||||
super->z.HALF.HI += 3;
|
||||
}
|
||||
ProcessMovement3(this);
|
||||
if (this->collisions != COL_NONE) {
|
||||
ProcessMovement3(super);
|
||||
if (super->collisions != COL_NONE) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (IsProjectileOffScreen(this)) {
|
||||
GetNextFrame(super);
|
||||
if (IsProjectileOffScreen(super)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->timer < 0x1e) {
|
||||
if (((++this->timer) & this->subtimer) == 0) {
|
||||
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
|
||||
if (super->timer < 0x1e) {
|
||||
if (((++super->timer) & super->subtimer) == 0) {
|
||||
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC168(Entity* this) {
|
||||
void V3ElectricProjectile_Action3(V3ElectricProjectileEntity* this) {
|
||||
u8 timer;
|
||||
GetNextFrame(this);
|
||||
this->z.WORD -= Q_16_16(0.5);
|
||||
timer = --this->timer;
|
||||
GetNextFrame(super);
|
||||
super->z.WORD -= Q_16_16(0.5);
|
||||
timer = --super->timer;
|
||||
if (timer == 0) {
|
||||
u32 rand;
|
||||
u32 dir;
|
||||
this->action = 4;
|
||||
this->timer = 4;
|
||||
super->action = 4;
|
||||
super->timer = 4;
|
||||
rand = Random() & 0x7;
|
||||
this->subtimer = gUnk_0812A982[rand];
|
||||
dir = GetFacingDirection(this, &gPlayerEntity);
|
||||
if (this->parent->cutsceneBeh.HALF.LO == 3) {
|
||||
super->subtimer = gUnk_0812A982[rand];
|
||||
dir = GetFacingDirection(super, &gPlayerEntity);
|
||||
if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 3) {
|
||||
dir -= projectileDirections[rand];
|
||||
this->type2 = 0;
|
||||
} else if (this->parent->cutsceneBeh.HALF.LO == 2) {
|
||||
super->type2 = 0;
|
||||
} else if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 2) {
|
||||
dir -= projectileDirections[rand];
|
||||
this->type2 = 1;
|
||||
super->type2 = 1;
|
||||
} else {
|
||||
dir -= projectileDirections[rand] >> 1;
|
||||
this->type2 = 2;
|
||||
super->type2 = 2;
|
||||
}
|
||||
|
||||
this->direction = dir & 0x1f;
|
||||
super->direction = dir & 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AC200(Entity* this) {
|
||||
void V3ElectricProjectile_Action4(V3ElectricProjectileEntity* this) {
|
||||
Entity* proj;
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
|
||||
if (--this->timer)
|
||||
if (--super->timer)
|
||||
return;
|
||||
|
||||
this->timer = 16;
|
||||
super->timer = 16;
|
||||
proj = CreateProjectile(V3_ELECTRIC_PROJECTILE);
|
||||
|
||||
if (proj) {
|
||||
proj->type = 2;
|
||||
proj->type2 = this->type2;
|
||||
proj->direction = this->direction;
|
||||
proj->parent = this->parent;
|
||||
CopyPosition(this, proj);
|
||||
proj->type2 = super->type2;
|
||||
proj->direction = super->direction;
|
||||
proj->parent = super->parent;
|
||||
CopyPosition(super, proj);
|
||||
}
|
||||
|
||||
if (--this->subtimer == 0) {
|
||||
if (--super->subtimer == 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;
|
||||
if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 3) {
|
||||
super->direction = (super->direction + 3) & 0x1f;
|
||||
} else if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 2) {
|
||||
super->direction = (super->direction + 3) & 0x1f;
|
||||
} else {
|
||||
this->direction = (this->direction + 2) & 0x1f;
|
||||
super->direction = (super->direction + 2) & 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
void (*const V3ElectricProjectile_Functions[])(Entity*) = {
|
||||
V3ElectricProjectile_OnTick, sub_080ABFE4, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
void (*const V3ElectricProjectile_Functions[])(V3ElectricProjectileEntity*) = {
|
||||
V3ElectricProjectile_OnTick,
|
||||
V3ElectricProjectile_OnCollision,
|
||||
(void (*)(V3ElectricProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V3ElectricProjectileEntity*))DeleteEntity,
|
||||
(void (*)(V3ElectricProjectileEntity*))DeleteEntity,
|
||||
};
|
||||
void (*const V3ElectricProjectile_Actions[])(Entity*) = {
|
||||
sub_080ABFEC, V3ElectricProjectile_Action1, V3ElectricProjectile_Action2, sub_080AC168, sub_080AC200,
|
||||
void (*const V3ElectricProjectile_Actions[])(V3ElectricProjectileEntity*) = {
|
||||
V3ElectricProjectile_Init, V3ElectricProjectile_Action1, V3ElectricProjectile_Action2,
|
||||
V3ElectricProjectile_Action3, V3ElectricProjectile_Action4,
|
||||
};
|
||||
static const u16 projectileSpeeds[] = { 352, 480, 480 };
|
||||
static const u8 gUnk_0812A982[] = {
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file v3HandProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V3 Hand Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*const V3HandProjectile_Functions[])(Entity*);
|
||||
|
||||
|
@ -30,10 +37,10 @@ void V3HandProjectile_OnTick(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080ABFA8(Entity* this) {
|
||||
void V3HandProjectile_OnCollision(Entity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void (*const V3HandProjectile_Functions[])(Entity*) = {
|
||||
V3HandProjectile_OnTick, sub_080ABFA8, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
V3HandProjectile_OnTick, V3HandProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file v3TennisBallProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief V3 Tennis Ball Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const V3TennisBallProjectile_Functions[])(Entity*);
|
||||
|
@ -17,7 +24,7 @@ void V3TennisBallProjectile_OnTick(Entity* this) {
|
|||
V3TennisBallProjectile_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080ACA68(Entity* this) {
|
||||
void V3TennisBallProjectile_OnCollision(Entity* this) {
|
||||
switch (this->contactFlags & 0x7f) {
|
||||
case 0x1a:
|
||||
case 0xa:
|
||||
|
@ -114,7 +121,7 @@ void sub_080ACB90(Entity* this) {
|
|||
}
|
||||
|
||||
void (*const V3TennisBallProjectile_Functions[])(Entity*) = {
|
||||
V3TennisBallProjectile_OnTick, sub_080ACA68, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
V3TennisBallProjectile_OnTick, V3TennisBallProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
|
||||
V3TennisBallProjectile_OnTick,
|
||||
};
|
||||
void (*const V3TennisBallProjectile_Actions[])(Entity*) = {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
#include "entity.h"
|
||||
/**
|
||||
* @file windProjectile.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Wind Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const WindProjectile_Actions[])(Entity*);
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
/**
|
||||
* @file winder.c
|
||||
* @ingroup Projectiles
|
||||
*
|
||||
* @brief Winder Projectile
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "asm.h"
|
||||
#include "functions.h"
|
||||
#include "common.h"
|
||||
#include "projectile.h"
|
||||
#include "projectile/winder.h"
|
||||
#include "asm.h"
|
||||
#include "collision.h"
|
||||
#include "common.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
|
||||
extern s16 gUnk_080B4488[];
|
||||
|
||||
|
|
Loading…
Reference in New Issue