This commit is contained in:
theo3
2022-03-27 00:19:10 -07:00
212 changed files with 13172 additions and 18396 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
#include "object.h"
@@ -66,7 +67,7 @@ void ArrowProjectile_Action1(Entity* this) {
}
void ArrowProjectile_Action2(Entity* this) {
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
this->action = 3;
COLLISION_OFF(this);
this->actionDelay = 0x20;
+4 -3
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -25,15 +26,15 @@ void sub_080A81C4(Entity* this) {
void BoneProjectile_Init(Entity* this) {
this->action = 1;
this->actionDelay = 0x3c;
this->z.HALF.HI = 0xfffe;
this->actionDelay = 60;
this->z.HALF.HI = -2;
InitializeAnimation(this, 0);
}
void BoneProjectile_Action1(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
if (this->collisions == 0) {
if (this->collisions == COL_NONE) {
if (IsProjectileOffScreen(this)) {
DeleteEntity(this);
} else {
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -49,7 +50,7 @@ void CannonballProjectile_Action1(Entity* this) {
void CannonballProjectile_Action2(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
if ((sub_080AB634(this) == 0) && (this->collisions != 0)) {
if ((sub_080AB634(this) == 0) && (this->collisions != COL_NONE)) {
CreateFx(this, FX_DEATH, 0);
DeleteThisEntity();
}
+1 -1
View File
@@ -91,7 +91,7 @@ void DekuSeedProjectile_Action2(Entity* this) {
COLLISION_ON(this);
}
} else {
sub_0800417E(this, (u32)this->collisions);
sub_0800417E(this, this->collisions);
sub_08016AD2(this);
InitializeAnimation(this, 0x19);
sub_080A86A0(this);
+1 -1
View File
@@ -24,7 +24,7 @@ void nullsub_539(Entity* this) {
}
void sub_080A9CF0(Entity* this) {
if (sub_0806F520() == 0) {
if (!sub_0806F520(this)) {
CreateFx(this, FX_DEATH, 0);
DeleteThisEntity();
}
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -32,7 +33,7 @@ void LakituLightning_Init(Entity* this) {
void LakituLightning_Action1(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
if ((this->collisions != 0) || (--this->actionDelay == 0)) {
if ((this->collisions != COL_NONE) || (--this->actionDelay == 0)) {
CreateFx(this, FX_BLUE_EFC, 0);
DeleteThisEntity();
}
+21 -21
View File
@@ -9,16 +9,23 @@ typedef struct {
u8 height;
} HitboxChange;
extern void (*const MoblinSpear_Functions[])(Entity*);
extern void (*const MoblinSpear_Actions[])(Entity*);
extern const HitboxChange gUnk_0812966C[];
void MoblinSpear_OnTick(Entity* this);
void sub_080A832C(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_Functions[GetNextFunction(this)](this);
}
void MoblinSpear_OnTick(Entity* this) {
static void (*const MoblinSpear_Actions[])(Entity*) = {
MoblinSpear_Init,
MoblinSpear_Action1,
};
MoblinSpear_Actions[this->action](this);
}
@@ -50,6 +57,16 @@ void MoblinSpear_Init(Entity* this) {
}
void MoblinSpear_Action1(Entity* this) {
static const HitboxChange gUnk_0812966C[] = {
{ 6, 11, 2, 4 }, { -12, 2, 3, 3 }, { -13, -15, 1, 2 }, { 5, 12, 1, 3 }, { 7, 10, 1, 2 },
{ 8, 9, 1, 3 }, { 7, 10, 1, 2 }, { -22, 1, 4, 2 }, { -12, 1, 3, 2 }, { -6, 2, 4, 2 },
{ -12, 1, 3, 2 }, { -1, -19, 1, 1 }, { -4, -19, 1, 1 }, { -4, -20, 1, 1 }, { -4, -19, 1, 1 },
{ 6, 9, 1, 2 }, { 6, 10, 1, 2 }, { 6, 9, 1, 2 }, { 6, 10, 1, 2 }, { -29, -11, 3, 2 },
{ -29, -9, 3, 2 }, { -29, -11, 3, 2 }, { -29, -9, 3, 2 }, { -5, -25, 1, 2 }, { -5, -24, 1, 2 },
{ -5, -25, 1, 2 }, { -5, -24, 1, 2 }, { 7, 12, 1, 2 }, { 7, 11, 1, 2 }, { -12, 3, 3, 1 },
{ -12, 2, 3, 1 }, { -13, -16, 1, 2 }, { -13, -15, 1, 2 },
};
u8 frames;
Entity* parent;
u32 tmp;
@@ -86,20 +103,3 @@ void MoblinSpear_Action1(Entity* this) {
}
}
}
void (*const MoblinSpear_Functions[])(Entity*) = {
MoblinSpear_OnTick, sub_080A832C, DeleteEntity, DeleteEntity, DeleteEntity,
};
void (*const MoblinSpear_Actions[])(Entity*) = {
MoblinSpear_Init,
MoblinSpear_Action1,
};
const HitboxChange gUnk_0812966C[] = {
{ 6, 11, 2, 4 }, { -12, 2, 3, 3 }, { -13, -15, 1, 2 }, { 5, 12, 1, 3 }, { 7, 10, 1, 2 }, { 8, 9, 1, 3 },
{ 7, 10, 1, 2 }, { -22, 1, 4, 2 }, { -12, 1, 3, 2 }, { -6, 2, 4, 2 }, { -12, 1, 3, 2 }, { -1, -19, 1, 1 },
{ -4, -19, 1, 1 }, { -4, -20, 1, 1 }, { -4, -19, 1, 1 }, { 6, 9, 1, 2 }, { 6, 10, 1, 2 }, { 6, 9, 1, 2 },
{ 6, 10, 1, 2 }, { -29, -11, 3, 2 }, { -29, -9, 3, 2 }, { -29, -11, 3, 2 }, { -29, -9, 3, 2 }, { -5, -25, 1, 2 },
{ -5, -24, 1, 2 }, { -5, -25, 1, 2 }, { -5, -24, 1, 2 }, { 7, 12, 1, 2 }, { 7, 11, 1, 2 }, { -12, 3, 3, 1 },
{ -12, 2, 3, 1 }, { -13, -16, 1, 2 }, { -13, -15, 1, 2 },
};
+4 -3
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
#include "projectile.h"
@@ -114,10 +115,10 @@ void OctorokBossProjectile_Action1(Entity* this) {
this->field_0x78.HWORD--;
LinearMoveAngle(this, this->speed, this->direction);
CalculateEntityTileCollisions(this, this->direction >> 3, 0);
if ((this->collisions & 0xee00) != 0) {
if ((this->collisions & (COL_WEST_ANY | COL_EAST_ANY)) != COL_NONE) {
this->direction = -this->direction;
}
if ((this->collisions & 0xee) != 0) {
if ((this->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) {
this->direction = -this->direction ^ 0x80;
}
if (this->direction == this->field_0xf) {
@@ -151,7 +152,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
GetNextFrame(this);
if (GravityUpdate(this, 0x1800) != 0) {
CalculateEntityTileCollisions(this, this->direction >> 3, 0);
if (this->collisions == 0) {
if (this->collisions == COL_NONE) {
LinearMoveAngle(this, (s32)this->speed, (u32)this->direction);
} else {
OctorokBossProjectile_Action2(this);
+45 -48
View File
@@ -9,51 +9,61 @@ typedef struct {
u8 direction;
} PACKED Struct_0812A074;
extern void (*const SpiderWeb_Functions[])(Entity*);
extern void (*const SpiderWeb_Actions[])(Entity*);
extern const u8 gUnk_0812A03C[];
extern const Hitbox* const gUnk_0812A04C[];
extern void (*const SpiderWeb_SubActions[])(Entity*);
extern const s8 gUnk_0812A064[];
extern const s8 gUnk_0812A06C[];
extern const Struct_0812A074 gUnk_0812A074[];
extern const u16 gUnk_0812A084[];
void SpiderWeb_OnTick(Entity*);
void sub_080AA6C0(Entity*);
void sub_080AAAA8(Entity*);
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(Entity* this) {
static void (*const SpiderWeb_Functions[])(Entity*) = {
SpiderWeb_OnTick, sub_080AA6C0, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA78C,
};
SpiderWeb_Functions[GetNextFunction(this)](this);
}
void SpiderWeb_OnTick(Entity* this) {
static void (*const SpiderWeb_Actions[])(Entity*) = {
SpiderWeb_Init,
SpiderWeb_Action1,
SpiderWeb_Action2,
SpiderWeb_Action3,
};
SpiderWeb_Actions[this->action](this);
}
void sub_080AA6C0(Entity* 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->bitfield == 0x87) {
this->action = 3;
this->actionDelay = 0x5a;
this->actionDelay = 90;
COLLISION_OFF(this);
InitAnimationForceUpdate(this, this->type + 0x10);
object = CreateObject(OBJECT_2A, 3, 0);
if (object != NULL) {
object->type2 = 0x5a;
object->spritePriority.b0 = 3;
object->spriteOffsetX = gUnk_0812A03C[this->type * 4];
object->spriteOffsetY = gUnk_0812A03C[this->type * 4 + 1];
object->spriteOffsetX = typeSpritOffsets[this->type * 4];
object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 1];
object->parent = this;
}
object = CreateObject(OBJECT_2A, 3, 0);
if (object != NULL) {
object->type2 = 0x5a;
object->spritePriority.b0 = 3;
object->spriteOffsetX = gUnk_0812A03C[this->type * 4 + 2];
object->spriteOffsetY = gUnk_0812A03C[this->type * 4 + 3];
object->spriteOffsetX = typeSpritOffsets[this->type * 4 + 2];
object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 3];
object->parent = this;
}
} else {
@@ -79,10 +89,10 @@ void sub_080AA78C(Entity* this) {
this->subAction = 1;
InitAnimationForceUpdate(this, animationState + 8);
}
if (sub_0806F520(this) != 0) {
if (sub_0806F520(this)) {
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x10) != 0) {
this->frame &= 0xef;
this->frame &= ~0x10;
EnqueueSFX(SFX_100);
}
if ((this->frame & ANIM_DONE) != 0) {
@@ -98,13 +108,19 @@ void sub_080AA78C(Entity* this) {
}
void SpiderWeb_Init(Entity* this) {
static const Hitbox* const typeHitboxes[] = {
&gUnk_080FD41C,
&gUnk_080FD424,
&gUnk_080FD42C,
&gUnk_080FD434,
};
if (CheckFlags(this->field_0x86.HWORD) != 0) {
DeleteThisEntity();
}
this->action = 1;
this->field_0x1c = 1;
this->field_0x16 = 1;
this->hitbox = (Hitbox*)gUnk_0812A04C[this->type];
this->hitbox = (Hitbox*)typeHitboxes[this->type];
this->cutsceneBeh.HALF.LO = 0;
InitAnimationForceUpdate(this, this->type);
sub_080AAA68(this);
@@ -118,11 +134,18 @@ void SpiderWeb_Action1(Entity* this) {
}
void SpiderWeb_Action2(Entity* this) {
static void (*const SpiderWeb_SubActions[])(Entity*) = {
SpiderWeb_SubAction0,
SpiderWeb_SubAction1,
};
sub_0806FBB4(this);
SpiderWeb_SubActions[this->subAction - 5](this);
}
void SpiderWeb_SubAction0(Entity* 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 };
u32 tmp;
u16 x;
u16 y;
@@ -169,6 +192,8 @@ void SpiderWeb_Action3(Entity* this) {
}
void sub_080AA9E0(Entity* this) {
static const Struct_0812A074 gUnk_0812A074[] = { { 4, 0 }, { 5, 16 }, { 3, 8 }, { 5, 24 },
{ 3, 16 }, { 5, 0 }, { 3, 24 }, { 5, 8 } };
s32 diff;
const Struct_0812A074* ptr;
@@ -200,7 +225,8 @@ void sub_080AA9E0(Entity* this) {
}
void sub_080AAA68(Entity* this) {
SetTile(gUnk_0812A084[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
static const u16 typeTiles[] = { 16419, 16421, 16422, 16420 };
SetTile(typeTiles[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
}
void sub_080AAAA8(Entity* this) {
@@ -208,32 +234,3 @@ void sub_080AAAA8(Entity* this) {
RestorePrevTileEntity(TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
DeleteThisEntity();
}
void (*const SpiderWeb_Functions[])(Entity*) = {
SpiderWeb_OnTick, sub_080AA6C0, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA78C,
};
void (*const SpiderWeb_Actions[])(Entity*) = {
SpiderWeb_Init,
SpiderWeb_Action1,
SpiderWeb_Action2,
SpiderWeb_Action3,
};
const u8 gUnk_0812A03C[] = {
248, 252, 6, 1, 4, 245, 253, 3, 249, 253, 6, 4, 252, 245, 3, 3,
};
const Hitbox* const gUnk_0812A04C[] = {
&gUnk_080FD41C,
&gUnk_080FD424,
&gUnk_080FD42C,
&gUnk_080FD434,
};
void (*const SpiderWeb_SubActions[])(Entity*) = {
SpiderWeb_SubAction0,
SpiderWeb_SubAction1,
};
const s8 gUnk_0812A064[] = { 0, 17, -15, 4, 0, -11, 15, 4 };
const s8 gUnk_0812A06C[] = { 0, 2, -2, 0, 0, -2, 2, 0 };
const Struct_0812A074 gUnk_0812A074[] = { { 4, 0 }, { 5, 16 }, { 3, 8 }, { 5, 24 },
{ 3, 16 }, { 5, 0 }, { 3, 24 }, { 5, 8 } };
const u16 gUnk_0812A084[] = { 16419, 16421, 16422, 16420 };
+1 -1
View File
@@ -38,7 +38,7 @@ void sub_080A9A34(Entity* this) {
}
void sub_080A9A64(Entity* this) {
if ((this->subAction < 3) && (sub_0806F520(this) == 0)) {
if ((this->subAction < 3) && !sub_0806F520(this)) {
sub_080A9BA8(this);
}
StalfosProjectile_SubActions[this->subAction](this);
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -39,7 +40,7 @@ void TorchTrapProjectile_Action1(Entity* this) {
void TorchTrapProjectile_Action2(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
DeleteThisEntity();
}
if (IsProjectileOffScreen(this)) {
+1 -1
View File
@@ -87,7 +87,7 @@ void sub_080AACE0(Entity* this) {
}
void sub_080AAD70(Entity* this) {
if (sub_0806F520() == 0) {
if (!sub_0806F520(this)) {
this->health = 0;
}
V1DarkMagicProjectile_SubActions[this->subAction](this);
+1 -1
View File
@@ -62,7 +62,7 @@ void sub_080ABBF4(Entity* this) {
}
void sub_080ABC54(Entity* this) {
if (sub_0806F520() == 0) {
if (!sub_0806F520(this)) {
CreateFx(this, FX_DEATH, 0);
DeleteThisEntity();
}
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "player.h"
#include "coord.h"
@@ -96,7 +97,7 @@ void V3ElectricProjectile_Action2(Entity* this) {
this->z.HALF.HI += 3;
}
ProcessMovement3(this);
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
DeleteThisEntity();
}
GetNextFrame(this);
+2 -1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "player.h"
#include "functions.h"
@@ -20,7 +21,7 @@ void V3HandProjectile_OnTick(Entity* this) {
this->z.HALF.HI += 2;
}
ProcessMovement3(this);
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
DeleteThisEntity();
}
GetNextFrame(this);
+7 -6
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -62,7 +63,7 @@ void V3TennisBallProjectile_Action1(Entity* this) {
void V3TennisBallProjectile_Action2(Entity* this) {
ProcessMovement3(this);
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
DeleteThisEntity();
}
GetNextFrame(this);
@@ -78,28 +79,28 @@ bool32 sub_080ACB40(Entity* this) {
Entity* tmp = ((Entity**)(r1_grandparent->myHeap))[7]->child;
if (tmp != this && child == tmp->child) {
return 0;
return FALSE;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[8]->child;
if (tmp != this && child == tmp->child) {
return 0;
return FALSE;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[9]->child;
if (tmp != this && child == tmp->child) {
return 0;
return FALSE;
}
tmp = ((Entity**)(r1_grandparent->myHeap))[10]->child;
if (tmp != this && child == tmp->child) {
return 0;
return FALSE;
}
return 1;
return TRUE;
}
void sub_080ACB90(Entity* this) {
+90 -75
View File
@@ -1,118 +1,133 @@
#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"
extern void (*const Winder_Actions[])(Entity*);
extern s16 gUnk_080B4488[];
static const u8 gUnk_0812A6BC[];
static const u16 gUnk_0812A6C4[];
void sub_080AB9DC(Entity*);
bool32 sub_080AB9FC(Entity* this, u32 param_1);
typedef enum {
/* 0 */ WINDER_TYPE_HEAD,
/* 4 */ WINDER_TYPE_TAIL = 4,
} WinderType;
void Winder(Entity* this) {
Winder_Actions[this->action](this);
sub_080AB9DC(this);
void Winder_Init(WinderEntity* this);
void Winder_Move(WinderEntity* this);
void Winder_SetPositions(WinderEntity*);
bool32 Winder_CheckForRailings(WinderEntity* this, u32 dir);
void Winder(Entity* thisx) {
static void (*const Winder_Actions[])(WinderEntity*) = {
Winder_Init,
Winder_Move,
};
WinderEntity* this = (WinderEntity*)thisx;
Winder_Actions[super->action](this);
Winder_SetPositions(this);
}
void Winder_Init(Entity* this) {
Entity* entity;
u16* puVar3;
s32 index;
void Winder_Init(WinderEntity* this) {
Entity* nextSegment;
u16* posPtr;
s32 i;
this->action += 1;
this->speed = 0x140;
this->z.WORD = 0;
if (this->type == 0) {
this->direction = Random() & 0x18;
this->parent = this;
super->action++;
super->speed = 0x140;
super->z.WORD = 0;
if (super->type == 0) {
super->direction = Random() & 0x18;
super->parent = super;
}
InitializeAnimation(this, 0);
if (this->type < 4) {
entity = CreateProjectile(WINDER);
entity->type = this->type + 1;
entity->parent = this->parent;
entity->child = this;
CopyPosition(this, entity);
InitializeAnimation(super, 0);
if (super->type < WINDER_TYPE_TAIL) {
nextSegment = CreateProjectile(WINDER);
nextSegment->type = super->type + 1;
nextSegment->parent = super->parent;
nextSegment->child = super;
CopyPosition(super, nextSegment);
}
puVar3 = &this->field_0x68.HWORD;
for (index = 7; index >= 0; --index) {
*puVar3 = this->x.HALF.HI;
puVar3 += 1;
*puVar3 = this->y.HALF.HI;
puVar3 += 1;
posPtr = this->positions;
for (i = 0; i < WINDER_NUM_SEGMENTS; i++) {
*posPtr++ = super->x.HALF.HI;
*posPtr++ = super->y.HALF.HI;
}
}
void sub_080AB950(Entity* this) {
if (this->type == 0) {
void Winder_Move(WinderEntity* this) {
static const u8 nextDirections[][2] = {
{ DirectionEast, DirectionWest },
{ DirectionNorth, DirectionSouth },
{ DirectionEast, DirectionWest },
{ DirectionNorth, DirectionSouth },
};
static const u16 collisionChecks[] = { COL_NORTH_ANY, COL_EAST_ANY, COL_SOUTH_ANY, COL_WEST_ANY };
if (super->type == WINDER_TYPE_HEAD) {
u8 dir;
ProcessMovement0(this);
dir = this->direction >> 3;
if (((gUnk_0812A6C4)[dir] & this->collisions) || sub_080AB9FC(this, this->direction)) {
this->direction = gUnk_0812A6BC[(Random() & 0x1) + (dir << 1)];
ProcessMovement0(super);
dir = super->direction >> 3;
if ((collisionChecks[dir] & super->collisions) || Winder_CheckForRailings(this, super->direction)) {
super->direction = nextDirections[dir][Random() & 0x1];
}
} else {
Entity* child;
WinderEntity* child;
if (this->parent == NULL) {
if (super->parent == NULL) {
DeleteThisEntity();
}
if (this->parent->next == NULL) {
if (super->parent->next == NULL) {
DeleteThisEntity();
}
child = this->child;
if (child && child->next) {
this->x.HALF.HI = child->field_0x68.HWORD;
this->y.HALF.HI = child->field_0x6a.HWORD;
child = (WinderEntity*)super->child;
if ((child != NULL) && (child->base.next != NULL)) {
super->x.HALF.HI = child->positions[0];
super->y.HALF.HI = child->positions[1];
} else {
DeleteThisEntity();
}
}
GetNextFrame(this);
GetNextFrame(super);
}
void sub_080AB9DC(Entity* this) {
MemCopy(&this->field_0x6c, &this->field_0x68, 0x1c);
this->cutsceneBeh.HWORD = this->x.HALF.HI;
this->field_0x86.HWORD = this->y.HALF.HI;
void Winder_SetPositions(WinderEntity* this) {
//! @bug Undefined behaviour for source and destination to overlap in a memcpy. In this case it is okay because the
//! copy will always be sequential, incremental and in chunks of <= 4 bytes, so it will copy the contents of
//! positions[0] and positions[1] to positions[2] and positions[3], then that of positions[2] and positions[3] to
//! positions[4] and positions[5], and so on. A safer way to do this would be a manual loop as in Winder_Move.
MemCopy(&this->positions[2], &this->positions[0], sizeof(u16) * (ARRAY_COUNT(this->positions) - 2));
this->positions[2 * (WINDER_NUM_SEGMENTS - 1)] = super->x.HALF.HI;
this->positions[2 * (WINDER_NUM_SEGMENTS - 1) + 1] = super->y.HALF.HI;
}
bool32 sub_080AB9FC(Entity* this, u32 dir) {
bool32 Winder_CheckForRailings(WinderEntity* this, u32 dir) {
u32 tile;
u32 val;
LayerStruct* layer = GetLayerByIndex(this->collisionLayer);
u32 tmp;
val = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) |
((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3f) << 6);
val += gUnk_080B4488[dir >> 3];
tmp = layer->collisionData[val];
if (tmp <= 0x1f) {
return 0;
LayerStruct* layer = GetLayerByIndex(super->collisionLayer);
u32 collisionData;
tile = TILE(super->x.HALF.HI, super->y.HALF.HI);
tile += gUnk_080B4488[dir >> 3];
collisionData = layer->collisionData[tile];
if (collisionData <= 0x1F) {
return FALSE;
}
if (tmp > 0x3f) {
return 0;
if (collisionData > 0x3F) {
return FALSE;
}
return 1;
return TRUE;
}
void (*const Winder_Actions[])(Entity*) = {
Winder_Init,
sub_080AB950,
};
const u8 gUnk_0812A6BC[] = {
8, 24, 0, 16, 8, 24, 0, 16,
};
const u16 gUnk_0812A6C4[] = {
0xe,
0xe000,
0xe0,
0xe00,
};