mirror of
https://github.com/zeldaret/tmc
synced 2026-05-28 08:25:51 -04:00
merge
This commit is contained in:
+60
-9
@@ -1,25 +1,76 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
|
||||
extern u32* gUnk_020354B0;
|
||||
extern u32 gRoomMemory;
|
||||
#include "room.h"
|
||||
|
||||
extern void MemFill32(u32, void*, u32);
|
||||
|
||||
void sub_08049DCC(RoomMemory*);
|
||||
RoomMemory* sub_08049D88(void);
|
||||
|
||||
void ClearRoomMemory(void) {
|
||||
MemFill32(0xFFFFFFFF, &gRoomMemory, 0x40);
|
||||
gUnk_020354B0 = &gRoomMemory;
|
||||
MemFill32(0xFFFFFFFF, gRoomMemory, 0x40);
|
||||
gUnk_020354B0 = gRoomMemory;
|
||||
}
|
||||
|
||||
void sub_08049CF4(u8* arg0) {
|
||||
u8 field_0x6c = *(arg0 + 0x6c);
|
||||
void sub_08049CF4(GenericEntity* ent) {
|
||||
u8 field_0x6c = ent->field_0x6c.HALF.LO;
|
||||
if (field_0x6c & 0x80) {
|
||||
*(gUnk_020354B0 + 1) |= 1 << (field_0x6c & 0x1f);
|
||||
gUnk_020354B0->unk_04 |= 1 << (field_0x6c & 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08049D1C(u32 arg0) {
|
||||
u32 bitmask = *(gUnk_020354B0 + 1) >> arg0;
|
||||
u32 bitmask = gUnk_020354B0->unk_04 >> arg0;
|
||||
u32 output = 1;
|
||||
output &= ~bitmask;
|
||||
return output;
|
||||
}
|
||||
|
||||
void UpdateRoomTracker(void) {
|
||||
gUnk_020354B0 = gRoomMemory;
|
||||
|
||||
do {
|
||||
if (gUnk_020354B0->area == gRoomControls.area && gUnk_020354B0->room == gRoomControls.room) {
|
||||
sub_08049DCC(gUnk_020354B0);
|
||||
return;
|
||||
}
|
||||
gUnk_020354B0++;
|
||||
|
||||
} while (gUnk_020354B0 < gRoomMemory + 8);
|
||||
gUnk_020354B0 = sub_08049D88();
|
||||
}
|
||||
|
||||
RoomMemory* sub_08049D88(void) {
|
||||
RoomMemory* rm = gRoomMemory;
|
||||
RoomMemory* r1 = rm + 1;
|
||||
|
||||
do {
|
||||
if (r1->unk_02 > rm->unk_02) {
|
||||
rm = r1;
|
||||
}
|
||||
r1++;
|
||||
} while (r1 < gRoomMemory + 8);
|
||||
|
||||
rm->area = gRoomControls.area;
|
||||
rm->room = gRoomControls.room;
|
||||
|
||||
rm->unk_02 = 0xFFFF;
|
||||
rm->unk_04 = 0;
|
||||
|
||||
sub_08049DCC(rm);
|
||||
|
||||
return rm;
|
||||
}
|
||||
|
||||
void sub_08049DCC(RoomMemory* rm) {
|
||||
RoomMemory* r1 = gRoomMemory;
|
||||
|
||||
do {
|
||||
if (r1->unk_02 < rm->unk_02) {
|
||||
r1->unk_02++;
|
||||
}
|
||||
r1++;
|
||||
} while (r1 < gRoomMemory + 8);
|
||||
|
||||
rm->unk_02 = 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern Entity* (*const gUnk_080D3BE8[])(void);
|
||||
|
||||
extern void ReplaceMonitoredEntity(Entity*, Entity*);
|
||||
|
||||
Entity* sub_08049DF4(u32 arg0) {
|
||||
if (gUnk_020000B0 != NULL) {
|
||||
return gUnk_020000B0;
|
||||
}
|
||||
return gUnk_080D3BE8[arg0]();
|
||||
}
|
||||
|
||||
Entity* sub_08049E18(void) {
|
||||
if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189b75)) {
|
||||
gUnk_020000B0 = &gPlayerEntity;
|
||||
return &gPlayerEntity;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Entity* sub_08049E4C(void) {
|
||||
if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189bf5)) {
|
||||
gUnk_020000B0 = &gPlayerEntity;
|
||||
return &gPlayerEntity;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Entity* sub_08049E80(void) {
|
||||
if ((gPlayerState.field_0x3c[0] != 0) || !(gPlayerState.flags & 0x80)) {
|
||||
return NULL;
|
||||
}
|
||||
gUnk_020000B0 = &gPlayerEntity;
|
||||
return &gPlayerEntity;
|
||||
}
|
||||
|
||||
Entity* sub_08049EB0(void) {
|
||||
if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x80190)) {
|
||||
gUnk_020000B0 = &gPlayerEntity;
|
||||
return &gPlayerEntity;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 sub_08049EE4(Entity* ent) {
|
||||
GenericEntity* genEnt = (GenericEntity*)ent;
|
||||
u16 tempLO = genEnt->field_0x70.HALF.LO + 4 * genEnt->field_0x6e.HALF.LO;
|
||||
u16 tempHI = genEnt->field_0x70.HALF.HI + 4 * genEnt->field_0x6e.HALF.HI;
|
||||
|
||||
return CalculateDirectionTo(genEnt->base.x.HALF.HI, genEnt->base.y.HALF.HI, tempLO, tempHI);
|
||||
}
|
||||
|
||||
bool32 sub_08049F1C(Entity* entA, Entity* entB, s32 maxDist) {
|
||||
if ((entA->collisionLayer & entB->collisionLayer) != 0) {
|
||||
s32 xDiff = entB->x.HALF.HI - entA->x.HALF.HI;
|
||||
s32 yDiff = entB->y.HALF.HI - entA->y.HALF.HI;
|
||||
s32 maxDistSq = maxDist * maxDist;
|
||||
s32 distSq = xDiff * xDiff + yDiff * yDiff;
|
||||
|
||||
if (maxDistSq >= distSq) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 PlayerInRange(Entity* ent, u32 arg1, s32 maxDist) {
|
||||
Entity* tempEnt = sub_08049DF4(arg1);
|
||||
if (tempEnt == NULL) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return sub_08049F1C(ent, tempEnt, maxDist);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08049F84(Entity* ent, s32 arg2) {
|
||||
Entity* target = sub_08049DF4(arg2);
|
||||
|
||||
if (target == NULL) {
|
||||
return 0xFF;
|
||||
} else {
|
||||
return GetFacingDirection(ent, target);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_08049FA0(Entity* ent) {
|
||||
GenericEntity* genEnt = (GenericEntity*)ent;
|
||||
u32 temp = 8 * genEnt->field_0x6e.HALF.LO;
|
||||
|
||||
if (temp >= genEnt->base.x.HALF.HI - genEnt->field_0x70.HALF_U.LO) {
|
||||
temp = 8 * genEnt->field_0x6e.HALF.HI;
|
||||
if (temp >= genEnt->base.y.HALF.HI - genEnt->field_0x70.HALF_U.HI) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 sub_08049FDC(Entity* ent, u32 arg1) {
|
||||
u32 temp;
|
||||
GenericEntity* genEnt = (GenericEntity*)ent;
|
||||
GenericEntity* tempEnt = (GenericEntity*)sub_08049DF4(arg1);
|
||||
|
||||
if (tempEnt != NULL) {
|
||||
temp = 8 * genEnt->field_0x6e.HALF.LO;
|
||||
if (temp >= tempEnt->base.x.HALF.HI - genEnt->field_0x70.HALF_U.LO) {
|
||||
temp = 8 * genEnt->field_0x6e.HALF.HI;
|
||||
if (temp >= tempEnt->base.y.HALF.HI - genEnt->field_0x70.HALF_U.HI) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 sub_0804A024(Entity* ent, u32 arg1, u32 arg2) {
|
||||
Entity* tempEnt = sub_08049DF4(arg1);
|
||||
if (tempEnt == NULL) {
|
||||
return 0xFF;
|
||||
} else {
|
||||
return sub_0804A044(ent, tempEnt, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0804A168(Entity*, Entity*, LayerStruct*);
|
||||
u32 sub_0804A318(Entity*, Entity*, LayerStruct*);
|
||||
|
||||
u32 sub_0804A044(Entity* entA, Entity* entB, u32 arg2) {
|
||||
LayerStruct* layer;
|
||||
s32 ret;
|
||||
s32 yDiff;
|
||||
s32 xDiff;
|
||||
s32 flags;
|
||||
|
||||
if ((entB->collisionLayer & entA->collisionLayer) != 0) {
|
||||
flags = 0;
|
||||
xDiff = entB->x.HALF.HI + entB->hitbox->offset_x - entA->x.HALF.HI - entA->hitbox->offset_x;
|
||||
|
||||
if (arg2 >= xDiff + (arg2 >> 1)) {
|
||||
flags |= 1;
|
||||
}
|
||||
if (arg2 << 1 >= xDiff + arg2) {
|
||||
flags |= 2;
|
||||
}
|
||||
|
||||
yDiff = entB->y.HALF.HI + entB->hitbox->offset_y - entA->y.HALF.HI - entA->hitbox->offset_y;
|
||||
if (arg2 >= yDiff + (arg2 >> 1)) {
|
||||
flags |= 4;
|
||||
}
|
||||
if (arg2 << 1 >= yDiff + arg2) {
|
||||
flags |= 8;
|
||||
}
|
||||
|
||||
//! @bug flags & 5 can never equal 0xA
|
||||
if (flags && ((flags & 5) != 0xA)) {
|
||||
layer = GetLayerByIndex(entA->collisionLayer);
|
||||
if (xDiff < 0) {
|
||||
xDiff = -xDiff;
|
||||
}
|
||||
if (yDiff < 0) {
|
||||
yDiff = -yDiff;
|
||||
}
|
||||
if (xDiff < yDiff) {
|
||||
if (flags & 1) {
|
||||
ret = sub_0804A168(entA, entB, layer);
|
||||
if (ret != 0xFF) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (!(flags & 4)) {
|
||||
return 0xFF;
|
||||
}
|
||||
ret = sub_0804A318(entA, entB, layer);
|
||||
} else {
|
||||
if (flags & 4) {
|
||||
ret = sub_0804A318(entA, entB, layer);
|
||||
if (ret != 0xFF) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (!(flags & 1)) {
|
||||
return 0xFF;
|
||||
}
|
||||
ret = sub_0804A168(entA, entB, layer);
|
||||
}
|
||||
if (ret != 0xFF) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
bool32 sub_0804A4BC(u8* arg0, u8* arg1, s32 arg2, u32 arg3);
|
||||
|
||||
u32 sub_0804A168(Entity* entA, Entity* entB, LayerStruct* layer) {
|
||||
u32 uVar2;
|
||||
u32 uVar3;
|
||||
u32 tile1;
|
||||
u32 tile2;
|
||||
|
||||
if (entB->y.HALF.HI > entA->y.HALF.HI) {
|
||||
uVar2 = entA->x.HALF.HI - 4;
|
||||
uVar3 = ((uVar2 & 0xF) < 8) ? 10 : 5;
|
||||
tile1 = TILE(uVar2, entA->y.HALF.HI + 10);
|
||||
tile2 = TILE(uVar2, entB->y.HALF.HI);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 0x40, uVar3)) {
|
||||
uVar2 = entA->x.HALF.HI + 4;
|
||||
uVar3 ^= 0xF;
|
||||
tile1 = TILE(uVar2, entA->y.HALF.HI + 10);
|
||||
tile2 = TILE(uVar2, entB->y.HALF.HI);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 0x40, uVar3)) {
|
||||
return 0x10;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uVar2 = entA->x.HALF.HI - 4;
|
||||
uVar3 = ((uVar2 & 0xF) < 8) ? 10 : 5;
|
||||
tile1 = TILE(uVar2, entA->y.HALF.HI - 10);
|
||||
tile2 = TILE(uVar2, entB->y.HALF.HI);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -0x40, uVar3)) {
|
||||
uVar2 = entA->x.HALF.HI + 4;
|
||||
uVar3 ^= 0xF;
|
||||
tile1 = TILE(uVar2, entA->y.HALF.HI - 10);
|
||||
tile2 = TILE(uVar2, entB->y.HALF.HI);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -0x40, uVar3)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
u32 sub_0804A318(Entity* entA, Entity* entB, LayerStruct* layer) {
|
||||
u32 uVar2;
|
||||
u32 uVar3;
|
||||
u32 tile1;
|
||||
u32 tile2;
|
||||
|
||||
if (entB->x.HALF.HI > entA->x.HALF.HI) {
|
||||
uVar2 = entA->y.HALF.HI - 4;
|
||||
uVar3 = ((uVar2 & 0xF) < 8) ? 0xC : 3;
|
||||
tile1 = TILE(entA->x.HALF.HI + 10, uVar2);
|
||||
tile2 = TILE(entB->x.HALF.HI, uVar2);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 1, uVar3)) {
|
||||
uVar2 = entA->y.HALF.HI + 4;
|
||||
uVar3 ^= 0xF;
|
||||
tile1 = TILE(entA->x.HALF.HI + 10, uVar2);
|
||||
tile2 = TILE(entB->x.HALF.HI, uVar2);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 1, uVar3)) {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uVar2 = entA->y.HALF.HI - 4;
|
||||
uVar3 = ((uVar2 & 0xF) < 8) ? 0xC : 3;
|
||||
tile1 = TILE(entA->x.HALF.HI - 10, uVar2);
|
||||
tile2 = TILE(entB->x.HALF.HI, uVar2);
|
||||
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -1, uVar3)) {
|
||||
uVar2 = entA->y.HALF.HI + 4;
|
||||
uVar3 ^= 0xF;
|
||||
tile1 = TILE(entA->x.HALF.HI - 10, uVar2);
|
||||
tile2 = TILE(entB->x.HALF.HI, uVar2);
|
||||
if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -1, uVar3)) {
|
||||
return 0x18;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
bool32 sub_0804A4BC(u8* arg0, u8* arg1, s32 arg2, u32 arg3) {
|
||||
while (arg0 != arg1) {
|
||||
u8 r0 = *arg0;
|
||||
|
||||
if (r0 != 0) {
|
||||
if (r0 > 0xF) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
r0 &= arg3;
|
||||
if (r0 != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
arg0 += arg2;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_0804A4E4(Entity* entA, Entity* entB) {
|
||||
GenericEntity* r5 = (GenericEntity*)entA;
|
||||
GenericEntity* r6 = (GenericEntity*)entB;
|
||||
|
||||
r6->field_0x6c.HALF.HI = (r5->field_0x6c.HALF.HI & 0x40) | 4;
|
||||
r6->field_0x6c.HALF.LO = r5->field_0x6c.HALF.LO;
|
||||
r6->field_0x70.HALF.LO = r5->field_0x70.HALF.LO;
|
||||
r6->field_0x70.HALF.HI = r5->field_0x70.HALF.HI;
|
||||
r6->field_0x6e.HALF.LO = r5->field_0x6e.HALF.LO;
|
||||
r6->field_0x6e.HALF.HI = r5->field_0x6e.HALF.HI;
|
||||
|
||||
CopyPositionAndSpriteOffset(&r5->base, &r6->base);
|
||||
|
||||
if (r5->field_0x6c.HALF.HI & 0x40) {
|
||||
ReplaceMonitoredEntity(&r5->base, &r6->base);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -61,7 +61,7 @@ void CollisionMain(void) {
|
||||
prio = gPriorityHandler.ent_priority;
|
||||
|
||||
// if any priority is set, dont do collision
|
||||
if (prio)
|
||||
if (prio != 0)
|
||||
return;
|
||||
|
||||
doCollision = &ram_CollideAll;
|
||||
|
||||
+18
-16
@@ -1,6 +1,8 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "area.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "coord.h"
|
||||
#include "common.h"
|
||||
#include "sound.h"
|
||||
@@ -38,7 +40,7 @@ void sub_0806F38C(void) {
|
||||
u32 sub_0806F39C(Entity* ent) {
|
||||
s32 dist;
|
||||
|
||||
if (gPlayerEntity.animationState & 2) {
|
||||
if (gNewPlayerEntity.base.animationState & 2) {
|
||||
dist = ent->x.HALF.HI - gPlayerEntity.x.HALF.HI;
|
||||
} else {
|
||||
dist = ent->y.HALF.HI - gPlayerEntity.y.HALF.HI;
|
||||
@@ -55,7 +57,7 @@ u32 sub_0806F39C(Entity* ent) {
|
||||
}
|
||||
|
||||
bool32 sub_0806F3E4(Entity* ent) {
|
||||
Entity tmp_ent;
|
||||
GenericEntity tmp_ent;
|
||||
s8* p;
|
||||
|
||||
if ((gPlayerState.field_0x1c & 0x7F) != 1)
|
||||
@@ -74,15 +76,15 @@ bool32 sub_0806F3E4(Entity* ent) {
|
||||
if (ent->knockbackSpeed > 0x500)
|
||||
ent->knockbackSpeed = 0x500;
|
||||
p = &gUnk_08126EE4[gPlayerEntity.animationState & 0xE];
|
||||
tmp_ent.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI;
|
||||
tmp_ent.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI;
|
||||
LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent));
|
||||
if (sub_0800419C(&tmp_ent, ent, 4, 4)) {
|
||||
tmp_ent.base.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI;
|
||||
tmp_ent.base.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI;
|
||||
LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent.base));
|
||||
if (sub_0800419C(&tmp_ent.base, ent, 4, 4)) {
|
||||
u32 state = ent->field_0x1c & 0xF;
|
||||
if (state == 2) {
|
||||
Entity* item;
|
||||
ent->subAction = 3;
|
||||
(Entity*)gPlayerEntity.field_0x70.WORD = ent;
|
||||
gNewPlayerEntity.unk_70 = ent;
|
||||
gPlayerState.field_0x1c = 7;
|
||||
item = CreatePlayerItem(0x11, 0, 0, 0);
|
||||
if (item != NULL) {
|
||||
@@ -116,7 +118,7 @@ void sub_0806F4E8(Entity* ent) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0806F520(Entity* ent) {
|
||||
bool32 sub_0806F520(Entity* ent) {
|
||||
if (ent->bitfield == 0x93)
|
||||
return 1;
|
||||
ent->field_0x3a &= ~4;
|
||||
@@ -336,38 +338,38 @@ void SortEntityBelow(Entity* above_ent, Entity* below_ent) {
|
||||
below_ent->spritePriority.b0 = gSpriteSortBelowTable[above_ent->spritePriority.b0];
|
||||
}
|
||||
|
||||
void sub_0806FB00(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
|
||||
void sub_0806FB00(GenericEntity* ent, u32 param_1, u32 param_2, u32 param_3) {
|
||||
if (param_3 == 0) {
|
||||
param_3 = 1;
|
||||
}
|
||||
|
||||
ent->field_0x7c.BYTES.byte2 = 0;
|
||||
ent->field_0x7c.BYTES.byte3 = param_3;
|
||||
ent->field_0x80.HWORD = ent->x.HALF.HI;
|
||||
ent->field_0x82.HWORD = ent->y.HALF.HI;
|
||||
ent->field_0x80.HWORD = ent->base.x.HALF.HI;
|
||||
ent->field_0x82.HWORD = ent->base.y.HALF.HI;
|
||||
ent->cutsceneBeh.HWORD = param_1;
|
||||
ent->field_0x86.HWORD = param_2;
|
||||
}
|
||||
|
||||
bool32 sub_0806FB38(Entity* ent) {
|
||||
bool32 sub_0806FB38(GenericEntity* ent) {
|
||||
s32 val;
|
||||
u32 rv;
|
||||
if (ent->field_0x7c.BYTES.byte2 < ent->field_0x7c.BYTES.byte3) {
|
||||
ent->field_0x7c.BYTES.byte2++;
|
||||
ent->x.HALF.HI =
|
||||
ent->base.x.HALF.HI =
|
||||
((((((s16)ent->cutsceneBeh.HWORD - (s16)ent->field_0x80.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
|
||||
ent->field_0x7c.BYTES.byte3) >>
|
||||
8) +
|
||||
ent->field_0x80.HWORD;
|
||||
ent->y.HALF.HI =
|
||||
ent->base.y.HALF.HI =
|
||||
(((((((s16)ent->field_0x86.HWORD - (s16)ent->field_0x82.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
|
||||
ent->field_0x7c.BYTES.byte3) >>
|
||||
8)) +
|
||||
ent->field_0x82.HWORD;
|
||||
rv = 0;
|
||||
} else {
|
||||
ent->x.HALF.HI = ent->cutsceneBeh.HWORD;
|
||||
ent->y.HALF.HI = ent->field_0x86.HWORD;
|
||||
ent->base.x.HALF.HI = ent->cutsceneBeh.HWORD;
|
||||
ent->base.y.HALF.HI = ent->field_0x86.HWORD;
|
||||
rv = 1;
|
||||
}
|
||||
return rv;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -216,7 +216,7 @@ void sub_080A3198(u32 param_1, u32 param_2) {
|
||||
MemClear(gUnk_08127C98 - 0x1e, 0x180);
|
||||
|
||||
if (r4 != 0) {
|
||||
sub_0805F46C(r4, &gUnk_08127C98);
|
||||
sub_0805F46C(r4, (Font*)&gUnk_08127C98); // TODO
|
||||
}
|
||||
|
||||
gScreen.bg0.updated = 1;
|
||||
|
||||
+102
-60
@@ -10,15 +10,39 @@
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const AcroBandit_Functions[])(Entity*);
|
||||
extern void (*const gUnk_080CE584[])(Entity*);
|
||||
extern void (*const gUnk_080CE58C[])(Entity*);
|
||||
extern void (*const gUnk_080CE5C8[])(Entity*);
|
||||
extern u8 gUnk_080CE5B0[8];
|
||||
extern u8 gUnk_080CE5B8[8];
|
||||
extern s8 gUnk_080CE5C0[8];
|
||||
extern u16 gUnk_080CE5F0[5];
|
||||
extern u8 gUnk_080CE5FA[20]; // Directions
|
||||
|
||||
void AcroBandit_OnTick(Entity* this);
|
||||
void AcroBandit_OnCollision(Entity* this);
|
||||
void AcroBandit_OnKnockback(Entity* this);
|
||||
void GenericDeath(Entity* this);
|
||||
void GenericConfused(Entity* this);
|
||||
void AcroBandit_OnGrabbed(Entity* this);
|
||||
void AcroBandit_Type0(Entity* this);
|
||||
void AcroBandit_Type1(Entity* this);
|
||||
void AcroBandit_Type0Action0(Entity* this);
|
||||
void AcroBandit_Type0Action1(Entity* this);
|
||||
void AcroBandit_Type0Action2(Entity* this);
|
||||
void AcroBandit_Type0Action3(Entity* this);
|
||||
void AcroBandit_Type0Action4(Entity* this);
|
||||
void AcroBandit_Type0Action5(Entity* this);
|
||||
void AcroBandit_Type0Action6(Entity* this);
|
||||
void AcroBandit_Type0Action7(Entity* this);
|
||||
void AcroBandit_Type0Action8(Entity* this);
|
||||
void AcroBandit_Type1Init(Entity* this);
|
||||
void AcroBandit_Type1Action1(Entity* this);
|
||||
void AcroBandit_Type1Action2(Entity* this);
|
||||
void AcroBandit_Type1Action3(Entity* this);
|
||||
void AcroBandit_Type1Action4(Entity* this);
|
||||
void AcroBandit_Type1Action5(Entity* this);
|
||||
void AcroBandit_Type1Action6(Entity* this);
|
||||
void AcroBandit_Type1Action7(Entity* this);
|
||||
void AcroBandit_Type1Action8(Entity* this);
|
||||
void AcroBandit_Type1Action9(Entity* this);
|
||||
|
||||
static void (*const AcroBandit_Functions[])(Entity*) = {
|
||||
AcroBandit_OnTick, AcroBandit_OnCollision, AcroBandit_OnKnockback,
|
||||
GenericDeath, GenericConfused, AcroBandit_OnGrabbed,
|
||||
};
|
||||
|
||||
void AcroBandit(Entity* this) {
|
||||
s32 index;
|
||||
@@ -37,7 +61,11 @@ void AcroBandit(Entity* this) {
|
||||
}
|
||||
|
||||
void AcroBandit_OnTick(Entity* this) {
|
||||
gUnk_080CE584[this->type](this);
|
||||
static void (*const typeFuncs[])(Entity*) = {
|
||||
AcroBandit_Type0,
|
||||
AcroBandit_Type1,
|
||||
};
|
||||
typeFuncs[this->type](this);
|
||||
}
|
||||
|
||||
void AcroBandit_OnCollision(Entity* this) {
|
||||
@@ -47,7 +75,7 @@ void AcroBandit_OnCollision(Entity* this) {
|
||||
if (this->type == 1) {
|
||||
if (this->action < 7 && this->knockbackDuration != 0) {
|
||||
brother = this->child;
|
||||
if (brother) {
|
||||
if (brother != NULL) {
|
||||
brother->parent = this->parent;
|
||||
do {
|
||||
brother->action = 5;
|
||||
@@ -56,10 +84,10 @@ void AcroBandit_OnCollision(Entity* this) {
|
||||
brother->iframes = -12;
|
||||
} while (brother = brother->child, brother != NULL);
|
||||
}
|
||||
if (this->parent) {
|
||||
if (this->parent != NULL) {
|
||||
this->parent->child = this->child;
|
||||
} else {
|
||||
if (this->child)
|
||||
if (this->child != NULL)
|
||||
this->parent = this;
|
||||
}
|
||||
|
||||
@@ -109,25 +137,27 @@ void AcroBandit_OnKnockback(Entity* this) {
|
||||
GenericKnockback(this);
|
||||
}
|
||||
|
||||
void AcroBandit_OnGrabbed(void) {
|
||||
/* ... */
|
||||
void AcroBandit_OnGrabbed(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08031A88(Entity* this) {
|
||||
gUnk_080CE58C[this->action](this);
|
||||
void AcroBandit_Type0(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
AcroBandit_Type0Action0, AcroBandit_Type0Action1, AcroBandit_Type0Action2,
|
||||
AcroBandit_Type0Action3, AcroBandit_Type0Action4, AcroBandit_Type0Action5,
|
||||
AcroBandit_Type0Action6, AcroBandit_Type0Action7, AcroBandit_Type0Action8,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031AA0(Entity* this) {
|
||||
void AcroBandit_Type0Action0(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = '\x01';
|
||||
this->action = 1;
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
this->field_0x78.HALF.HI = Random();
|
||||
}
|
||||
|
||||
void sub_08031AC8(Entity* this)
|
||||
|
||||
{
|
||||
void AcroBandit_Type0Action1(Entity* this) {
|
||||
u32 rand;
|
||||
s32 x, y;
|
||||
|
||||
@@ -149,7 +179,9 @@ void sub_08031AC8(Entity* this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B48(Entity* this) {
|
||||
void AcroBandit_Type0Action2(Entity* this) {
|
||||
static const u8 actionDelays[] = { 2, 2, 2, 3, 3, 3, 3, 4 };
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
this->frame = 0;
|
||||
@@ -157,13 +189,13 @@ void sub_08031B48(Entity* this) {
|
||||
} else {
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->action = 0x3;
|
||||
this->actionDelay = gUnk_080CE5B0[Random() & 7];
|
||||
this->actionDelay = actionDelays[Random() & 7];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B98(Entity* this) {
|
||||
void AcroBandit_Type0Action3(Entity* this) {
|
||||
if (sub_08031E04(this)) {
|
||||
this->action = 5;
|
||||
if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) {
|
||||
@@ -186,21 +218,22 @@ void sub_08031B98(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031C1C(Entity* this) {
|
||||
void AcroBandit_Type0Action4(Entity* this) {
|
||||
static const u8 actionDelays[] = { 60, 60, 90, 120, 120, 120, 120, 150 };
|
||||
GetNextFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->action = '\x01';
|
||||
this->actionDelay = gUnk_080CE5B8[Random() & 7];
|
||||
this->action = 1;
|
||||
this->actionDelay = actionDelays[Random() & 7];
|
||||
this->spriteSettings.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031C58(Entity* this) {
|
||||
void AcroBandit_Type0Action5(Entity* this) {
|
||||
Entity *a, *b;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
if (gEntCount < 0x43) {
|
||||
if (gEntCount < MAX_ENTITIES - 4) {
|
||||
u32 tmp = Random();
|
||||
tmp &= 3;
|
||||
|
||||
@@ -252,7 +285,7 @@ void sub_08031C58(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031D70(Entity* this) {
|
||||
void AcroBandit_Type0Action6(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 7;
|
||||
@@ -262,7 +295,7 @@ void sub_08031D70(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DA0(Entity* this) {
|
||||
void AcroBandit_Type0Action7(Entity* this) {
|
||||
if ((this->actionDelay & 0xf) == 0) {
|
||||
if (this->actionDelay == 0x50) {
|
||||
DeleteEntity(this);
|
||||
@@ -273,7 +306,7 @@ void sub_08031DA0(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DC4(Entity* this) {
|
||||
void AcroBandit_Type0Action8(Entity* this) {
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xb4;
|
||||
@@ -286,13 +319,14 @@ void sub_08031DC4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
bool32 sub_08031E04(Entity* this) {
|
||||
static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 };
|
||||
Entity* ent;
|
||||
s8* tmp;
|
||||
const s8* tmp;
|
||||
|
||||
ent = sub_08049DF4(1);
|
||||
if (ent == NULL)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
tmp = &gUnk_080CE5C0[this->frame & 6];
|
||||
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
|
||||
@@ -308,11 +342,16 @@ void sub_08031E48(Entity* this, Entity* child) {
|
||||
child->field_0x7c.WORD = (s32)this;
|
||||
}
|
||||
|
||||
void sub_08031E90(Entity* this) {
|
||||
gUnk_080CE5C8[this->action](this);
|
||||
void AcroBandit_Type1(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
AcroBandit_Type1Init, AcroBandit_Type1Action1, AcroBandit_Type1Action2, AcroBandit_Type1Action3,
|
||||
AcroBandit_Type1Action4, AcroBandit_Type1Action5, AcroBandit_Type1Action6, AcroBandit_Type1Action7,
|
||||
AcroBandit_Type1Action8, AcroBandit_Type1Action9,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031EA8(Entity* this) {
|
||||
void AcroBandit_Type1Init(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b1 = 1;
|
||||
this->zVelocity = Q_16_16(4.0);
|
||||
@@ -321,7 +360,7 @@ void sub_08031EA8(Entity* this) {
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
void sub_08031EE8(Entity* this) {
|
||||
void AcroBandit_Type1Action1(Entity* this) {
|
||||
int draw;
|
||||
|
||||
this->z.WORD -= this->zVelocity;
|
||||
@@ -346,8 +385,10 @@ void sub_08031EE8(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031F54(Entity* this) {
|
||||
GravityUpdate(this, gUnk_080CE5F0[this->type2]);
|
||||
void AcroBandit_Type1Action2(Entity* this) {
|
||||
static const u16 banditGravity[] = { 0x1600, 0x1300, 0x1000, 0xD00, 0xB00 };
|
||||
|
||||
GravityUpdate(this, banditGravity[this->type2]);
|
||||
if (this->type2 * -0xe <= this->z.HALF.HI) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 20;
|
||||
@@ -358,13 +399,13 @@ void sub_08031F54(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031FB0(Entity* this) {
|
||||
void AcroBandit_Type1Action3(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) && (this->parent || --this->actionDelay == 0)) {
|
||||
if ((this->frame & ANIM_DONE) && ((this->parent != NULL) || (--this->actionDelay == 0))) {
|
||||
this->action = 4;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
*(u8*)&this->field_0x76 = 0;
|
||||
if (this->child) {
|
||||
if (this->child != NULL) {
|
||||
InitializeAnimation(this, 9);
|
||||
} else {
|
||||
InitializeAnimation(this, 8);
|
||||
@@ -372,12 +413,12 @@ void sub_08031FB0(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032008(Entity* this) {
|
||||
void AcroBandit_Type1Action4(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if (sub_080322A4(this) == 0) {
|
||||
if (!sub_080322A4(this)) {
|
||||
parent = this->parent;
|
||||
if (parent == 0) {
|
||||
if (parent == NULL) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if ((++this->field_0x78.HALF.HI & 7) == 0) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
@@ -421,20 +462,22 @@ void sub_08032008(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032148(Entity* this) {
|
||||
void AcroBandit_Type1Action5(Entity* this) {
|
||||
if (GravityUpdate(this, 0x2000))
|
||||
return;
|
||||
|
||||
sub_08032290(this);
|
||||
}
|
||||
|
||||
void sub_08032160(Entity* this) {
|
||||
void AcroBandit_Type1Action6(Entity* this) {
|
||||
static const u8 fallDirections[] = { 0x8, 0x1c, 0x11, 0x2, 0x15, 0xc, 0x0, 0x15, 0x6, 0x19,
|
||||
0x10, 0x4, 0x19, 0xa, 0x1d, 0x14, 0x8, 0x1d, 0xe, 0x1 };
|
||||
Entity* tmp;
|
||||
u32 dir;
|
||||
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 7;
|
||||
dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->type2];
|
||||
dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2];
|
||||
this->direction = dir;
|
||||
if (dir >= 0x10) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
@@ -456,14 +499,14 @@ void sub_08032160(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080321E8(Entity* this) {
|
||||
void AcroBandit_Type1Action7(Entity* this) {
|
||||
ProcessMovement2(this);
|
||||
|
||||
if (sub_080044EC(this, 0x2000) == 0)
|
||||
this->action = 8;
|
||||
}
|
||||
|
||||
void sub_08032204(Entity* this) {
|
||||
void AcroBandit_Type1Action8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
this->frame = 0;
|
||||
@@ -476,7 +519,7 @@ void sub_08032204(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032248(Entity* this) {
|
||||
void AcroBandit_Type1Action9(Entity* this) {
|
||||
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
|
||||
if (this->frame & ANIM_DONE) {
|
||||
((Entity*)this->field_0x7c.WORD)->actionDelay--;
|
||||
@@ -497,30 +540,29 @@ void sub_08032290(Entity* this) {
|
||||
InitializeAnimation(this, 11);
|
||||
}
|
||||
|
||||
u32 sub_080322A4(Entity* this) {
|
||||
bool32 sub_080322A4(Entity* this) {
|
||||
if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) {
|
||||
if (this->z.HALF.HI) {
|
||||
this->action = 5;
|
||||
this->z.HALF.HI = this->child->z.HALF.HI + 8;
|
||||
InitializeAnimation(this, 11);
|
||||
return 1;
|
||||
return TRUE;
|
||||
} else {
|
||||
sub_08032290(this);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_080322E8(Entity* this) {
|
||||
u8 tmp;
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
if (--this->field_0x78.HALF.LO == 0) {
|
||||
u32 flipX = this->spriteSettings.flipX;
|
||||
this->spriteSettings.flipX = flipX ^ 1;
|
||||
}
|
||||
} else {
|
||||
tmp = this->direction;
|
||||
u8 tmp = this->direction;
|
||||
if (tmp & 0xF) {
|
||||
tmp >>= 4;
|
||||
tmp ^= 1;
|
||||
|
||||
+2
-2
@@ -306,12 +306,12 @@ bool32 sub_08030650(ArmosEntity* this) {
|
||||
return 1;
|
||||
}
|
||||
} else if (this->unk_80 != 2) {
|
||||
if ((sub_08049FDC(super, 1) == 0) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) {
|
||||
if (!sub_08049FDC(super, 1) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
if (sub_08049FDC(super, 1) == 0) {
|
||||
if (!sub_08049FDC(super, 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (gUnk_020000B0->x.HALF.HI >= (s32)(gRoomControls.origin_x + 0xa8)) {
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ void Beetle_OnDeath(Entity* this) {
|
||||
GenericDeath(this);
|
||||
} else {
|
||||
Entity* ent = this->parent;
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->field_0xf--;
|
||||
this->parent = NULL;
|
||||
}
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
#include "collision.h"
|
||||
#include "sound.h"
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
@@ -160,7 +161,7 @@ void sub_0802C91C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
ProcessMovement0(this);
|
||||
if (this->field_0x82.HALF.LO) {
|
||||
if (this->collisions) {
|
||||
if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
InitializeAnimation(this, (this->direction >> 4) | 2);
|
||||
}
|
||||
@@ -173,7 +174,7 @@ void sub_0802C91C(Entity* this) {
|
||||
sub_0802CC18(this);
|
||||
}
|
||||
} else {
|
||||
if (this->collisions) {
|
||||
if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
InitializeAnimation(this, this->direction >> 4);
|
||||
}
|
||||
@@ -289,7 +290,7 @@ void sub_0802CBC4(Entity* this) {
|
||||
FreeCarryEntity(this);
|
||||
|
||||
ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->collisionLayer = this->collisionLayer;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-13
@@ -92,7 +92,6 @@ void sub_0802A8FC(Entity* this) {
|
||||
}
|
||||
|
||||
void nullsub_143(Entity* this) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_0802A91C(Entity* this) {
|
||||
@@ -167,7 +166,7 @@ void sub_0802AA40(Entity* this) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
Entity* ent = this->child;
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
if (ent->next == NULL) {
|
||||
this->child = NULL;
|
||||
} else {
|
||||
@@ -212,7 +211,7 @@ void sub_0802AAC0(Entity* this) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
} else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) {
|
||||
} else if ((ent->actionDelay == 0) && (ent->field_0xf <= 0x50)) {
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
}
|
||||
#endif
|
||||
@@ -304,7 +303,7 @@ void sub_0802AC40(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->field_0x7a.HALF.LO) {
|
||||
if (sub_0802B234(this) == 0) {
|
||||
if (!sub_0802B234(this)) {
|
||||
this->field_0x7a.HALF.LO = 0;
|
||||
this->spritePriority.b1 = 0;
|
||||
#ifndef EU
|
||||
@@ -349,7 +348,7 @@ void sub_0802ACDC(Entity* this, u32 param_2) {
|
||||
|
||||
void sub_0802AD1C(Entity* this, u32 param_2) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
u32 y = ent->y.HALF.HI - 0x18;
|
||||
u32 x = ent->x.HALF.HI;
|
||||
sub_08004596(this, sub_080045B4(this, x, y));
|
||||
@@ -416,7 +415,7 @@ void sub_0802AE24(Entity* this) {
|
||||
#ifdef EU
|
||||
void sub_0802AE68(Entity* this) {
|
||||
Entity* ent = this->parent;
|
||||
if (ent == 0) {
|
||||
if (ent == NULL) {
|
||||
this->action = 3;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x80.HALF.LO = 1;
|
||||
@@ -441,7 +440,7 @@ void sub_0802AE68(Entity* this) {
|
||||
#else
|
||||
void sub_0802AE68(Entity* this) {
|
||||
Entity* ent = sub_0802B250(this);
|
||||
if (ent == 0) {
|
||||
if (ent == NULL) {
|
||||
this->action = 3;
|
||||
this->field_0x80.HALF.LO = 1;
|
||||
sub_0802B264(this);
|
||||
@@ -559,7 +558,7 @@ void sub_0802B048(Entity* this) {
|
||||
}
|
||||
|
||||
ent = this->parent;
|
||||
if (ent && this->action == 1) {
|
||||
if ((ent != NULL) && this->action == 1) {
|
||||
this->spriteRendering.b3 = ent->spriteRendering.b3;
|
||||
this->spritePriority.b0 = ent->spritePriority.b0;
|
||||
this->spriteOrientation.flipY = ent->spriteOrientation.flipY;
|
||||
@@ -588,7 +587,7 @@ void sub_0802B048(Entity* this) {
|
||||
COLLISION_ON(this);
|
||||
this->field_0x7a.HALF.HI = 0;
|
||||
FreeCarryEntity(this);
|
||||
if (this->parent->next) {
|
||||
if (this->parent->next != NULL) {
|
||||
this->parent->field_0x80.HALF.HI = 0;
|
||||
}
|
||||
ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
|
||||
@@ -622,7 +621,7 @@ void sub_0802B1BC(Entity* this) {
|
||||
}
|
||||
|
||||
ent = this->parent;
|
||||
if (ent == 0) {
|
||||
if (ent == NULL) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.draw = 1;
|
||||
}
|
||||
@@ -651,7 +650,7 @@ void sub_0802B1BC(Entity* this) {
|
||||
}
|
||||
|
||||
ent = sub_0802B250(this);
|
||||
if (ent == 0) {
|
||||
if (ent == NULL) {
|
||||
this->action = 2;
|
||||
sub_0802B264(this);
|
||||
} else {
|
||||
@@ -668,7 +667,7 @@ void sub_0802B1BC(Entity* this) {
|
||||
void sub_0802B204(Entity* this) {
|
||||
if (sub_080044EC(this, 0x2800) == 1) {
|
||||
Entity* ent = CreateEnemy(BOBOMB, 1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
CopyPosition(this, ent);
|
||||
ent->parent = this->parent;
|
||||
}
|
||||
@@ -686,7 +685,7 @@ bool32 sub_0802B234(Entity* this) {
|
||||
#ifndef EU
|
||||
Entity* sub_0802B250(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
if (parent && parent->next == NULL) {
|
||||
if ((parent != NULL) && (parent->next == NULL)) {
|
||||
parent = NULL;
|
||||
}
|
||||
return parent;
|
||||
|
||||
@@ -44,7 +44,7 @@ void Bombarossa_OnCollision(BombarossaEntity* this) {
|
||||
switch (super->bitfield & 0x7f) {
|
||||
default:
|
||||
ent = CreateObject(OBJECT_20, 0, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
CopyPosition(super, ent);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
|
||||
@@ -230,7 +230,7 @@ void sub_0803C400(BowMoblinEntity* this) {
|
||||
}
|
||||
|
||||
sub_0803C6DC(this);
|
||||
if (super->child) {
|
||||
if (super->child != NULL) {
|
||||
sub_0803C714(this);
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ void sub_0803C4B0(BowMoblinEntity* this) {
|
||||
u32 sub_0803C568(BowMoblinEntity* this) {
|
||||
if (this->unk_0x81 == 0) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
if (this->unk_0x82 == 2) {
|
||||
if (sub_0806FC80(super, ent, 0x30)) {
|
||||
return 1;
|
||||
|
||||
@@ -384,7 +384,7 @@ void sub_08028F0C(Entity* this) {
|
||||
SetPlayerControl(1);
|
||||
}
|
||||
MessageFromTarget(dialog);
|
||||
gMessage.field_0x10 = offer->price;
|
||||
gMessage.rupees = offer->price;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) {
|
||||
super->flags &= ~ENT_COLLIDE;
|
||||
sub_08046030(this, 4);
|
||||
ent = CreateFx(super, FX_BUSH, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->z.HALF.HI -= 8;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
|
||||
sub_0804604C(this);
|
||||
if (super->frame & 1) {
|
||||
ent = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = super;
|
||||
ent->direction = super->direction;
|
||||
super->frame &= 0xfe;
|
||||
@@ -186,7 +186,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) {
|
||||
super->subAction = 0;
|
||||
sub_08046030(this, 0);
|
||||
ent = Create0x68FX(super, FX_STARS);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->spritePriority.b0 = 3;
|
||||
ent->z.HALF.HI -= 0xc;
|
||||
SetDefaultPriority(ent, PRIO_MESSAGE);
|
||||
@@ -299,7 +299,7 @@ void sub_08046078(BusinessScrubPrologueEntity* this) {
|
||||
for (index = 0; index <= 4; index++) {
|
||||
ent = CreateFx(super, FX_DEATH, 0x40);
|
||||
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI = gRoomControls.origin_x + *ptr;
|
||||
ptr++;
|
||||
ent->y.HALF.HI = gRoomControls.origin_y + *ptr;
|
||||
@@ -315,12 +315,12 @@ void sub_08046078(BusinessScrubPrologueEntity* this) {
|
||||
RestorePrevTileEntity(0x7a7, 1);
|
||||
|
||||
ent = CreateFx(super, FX_BIG_EXPLOSION2, 0x40);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
CopyPosition(super, ent);
|
||||
EnqueueSFX(SFX_184);
|
||||
}
|
||||
|
||||
if (super->child) {
|
||||
if (super->child != NULL) {
|
||||
super->child->action = 0xff;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ void Chuchu_OnCollision(Entity* this) {
|
||||
}
|
||||
|
||||
void Chuchu_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520(this) == 0 && this->confusedTime) {
|
||||
if (!sub_0806F520(this) && this->confusedTime) {
|
||||
Create0x68FX(this, FX_STARS);
|
||||
InitializeAnimation(this, 6);
|
||||
} else {
|
||||
@@ -552,7 +552,7 @@ void sub_0801F884(Entity* this) {
|
||||
this->field_0xf--;
|
||||
} else {
|
||||
Entity* ent = Create0x68FX(this, FX_LIGHTNING_STRIKE);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->type2 = 64;
|
||||
this->action = 4;
|
||||
this->hitType = 165;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "coord.h"
|
||||
@@ -259,7 +260,7 @@ void sub_080387F0(CloudPiranhaEntity* this) {
|
||||
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
|
||||
super->direction = (super->direction + 0x10) & 0x1f;
|
||||
} else {
|
||||
if (super->collisions != 0) {
|
||||
if (super->collisions != COL_NONE) {
|
||||
sub_0800417E(super, super->collisions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void sub_080391B4(CuccoAggrEntity* this) {
|
||||
if (this->unk_7a) {
|
||||
if ((this->unk_7b++ & 0x1f) == 0) {
|
||||
Entity* ent = CreateEnemy(CUCCO_AGGR, 2);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
u32 rand = (Random() & 0x17);
|
||||
const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand];
|
||||
ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x;
|
||||
@@ -321,7 +321,7 @@ void sub_08039218(CuccoAggrEntity* this) {
|
||||
void CuccoAggr_CreateFx(CuccoAggrEntity* this) {
|
||||
Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0);
|
||||
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX];
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -312,7 +312,7 @@ void sub_080210E4(Entity* this) {
|
||||
|
||||
this->frame &= ~1;
|
||||
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 2);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
this->child = ent;
|
||||
}
|
||||
@@ -558,7 +558,7 @@ void sub_08021540(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08021588(Entity* this) {
|
||||
if (this->child) {
|
||||
if (this->child != NULL) {
|
||||
this->child->parent = NULL;
|
||||
this->child = NULL;
|
||||
}
|
||||
@@ -571,7 +571,7 @@ void sub_0802159C(Entity* this) {
|
||||
this->frame = 0;
|
||||
this->hitType = 0x51;
|
||||
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 3);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
this->child = ent;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ void sub_08021600(Entity* this) {
|
||||
this->frame = 0;
|
||||
this->hitType = 0x51;
|
||||
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 4);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
this->child = ent;
|
||||
}
|
||||
@@ -610,8 +610,6 @@ void sub_08021644(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
|
||||
u32 sub_08021664(Entity* this, Entity* ent) {
|
||||
switch (this->animationState) {
|
||||
case 0:
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ void sub_08040D30(Enemy50Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08040D90(Enemy50Entity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Enemy50_SubActions[super->subAction](this);
|
||||
} else {
|
||||
sub_08041128(this);
|
||||
|
||||
@@ -97,7 +97,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
|
||||
s32 i;
|
||||
for (i = 1; i > -1; i--) {
|
||||
Entity* ent = CreateFx(this, FX_ROCK2, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI += 12;
|
||||
ent->x.HALF.HI -= diff;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void sub_08045454(Entity* this) {
|
||||
}
|
||||
|
||||
ent = CreateFx(this, FX_DEATH, 0);
|
||||
if (ent)
|
||||
if (ent != NULL)
|
||||
CopyPosition(this, ent);
|
||||
|
||||
DeleteEntity(this);
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
* @file flyingPot.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Flying pot enemy
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "functions.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern Hitbox gUnk_080FD34C;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Entity base;
|
||||
/* 0x68 */ u8 filler[0xC];
|
||||
/* 0x74 */ u16 tileIndex;
|
||||
} FlyingPotEntity;
|
||||
|
||||
enum FlyingPotActions {
|
||||
/* 0 */ FLYING_POT_ACTION_0,
|
||||
/* 1 */ FLYING_POT_ACTION_1,
|
||||
/* 2 */ FLYING_POT_ACTION_2,
|
||||
/* 3 */ FLYING_POT_ACTION_3,
|
||||
/* 4 */ FLYING_POT_ACTION_4,
|
||||
/* 5 */ FLYING_POT_ACTION_5,
|
||||
/* 6 */ FLYING_POT_ACTION_6,
|
||||
};
|
||||
|
||||
enum FlyingPotSubActions {
|
||||
/* 0 */ FLYING_POT_SUBACTION_0,
|
||||
/* 1 */ FLYING_POT_SUBACTION_1,
|
||||
/* 2 */ FLYING_POT_SUBACTION_2,
|
||||
/* 3 */ FLYING_POT_SUBACTION_3,
|
||||
/* 4 */ FLYING_POT_SUBACTION_DO_NOTHING,
|
||||
/* 5 */ FLYING_POT_SUBACTION_5,
|
||||
};
|
||||
|
||||
// Functions
|
||||
void FlyingPot_OnTick(FlyingPotEntity*); // 0803708C
|
||||
void FlyingPot_OnCollision(FlyingPotEntity*); // 080370A4
|
||||
void FlyingPot_OnGrabbed(FlyingPotEntity*); // 0803712C
|
||||
|
||||
// Subactions
|
||||
void FlyingPot_SubAction0(FlyingPotEntity*); // 08037144
|
||||
void FlyingPot_SubAction1(FlyingPotEntity*); // 0803715C
|
||||
void FlyingPot_SubAction2(FlyingPotEntity*); // 0803718C
|
||||
void FlyingPot_SubAction3(FlyingPotEntity*); // 080371F8
|
||||
void FlyingPot_SubActionDoNothing(FlyingPotEntity*);
|
||||
void FlyingPot_SubAction5(FlyingPotEntity*); // 08037218
|
||||
|
||||
// Actions
|
||||
void FlyingPot_Init(FlyingPotEntity*); // ? // 08037220
|
||||
void FlyingPot_Action1(FlyingPotEntity*); // 08037280
|
||||
void FlyingPot_Action2(FlyingPotEntity*); // 080372E8
|
||||
void FlyingPot_Action3(FlyingPotEntity*); // 0803737C
|
||||
void FlyingPot_Action4(FlyingPotEntity*); // 080373B0
|
||||
void FlyingPot_Action5(FlyingPotEntity*); // 080373C8
|
||||
void FlyingPot_Action6(FlyingPotEntity*); // 080373E0
|
||||
|
||||
void sub_08037408(FlyingPotEntity*);
|
||||
void sub_08037418(FlyingPotEntity*);
|
||||
|
||||
void (*const FlyingPot_Functions[])(Entity*) = {
|
||||
(EntityActionPtr)FlyingPot_OnTick,
|
||||
(EntityActionPtr)FlyingPot_OnCollision,
|
||||
GenericKnockback,
|
||||
GenericDeath,
|
||||
GenericConfused,
|
||||
(EntityActionPtr)FlyingPot_OnGrabbed,
|
||||
};
|
||||
|
||||
void FlyingPot(Entity* thisx) {
|
||||
s32 index = sub_080012DC(thisx);
|
||||
|
||||
if (index != 0) {
|
||||
gUnk_080012C8[index](thisx);
|
||||
} else {
|
||||
FlyingPot_Functions[GetNextFunction(thisx)](thisx);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_OnTick(FlyingPotEntity* this) {
|
||||
static void (*const FlyingPot_Actions[])(FlyingPotEntity*) = {
|
||||
FlyingPot_Init, FlyingPot_Action1, FlyingPot_Action2, FlyingPot_Action3,
|
||||
FlyingPot_Action4, FlyingPot_Action5, FlyingPot_Action6,
|
||||
};
|
||||
|
||||
FlyingPot_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void FlyingPot_OnCollision(FlyingPotEntity* this) {
|
||||
sub_08037418(this);
|
||||
|
||||
if (super->bitfield == 0x9D) {
|
||||
super->action = FLYING_POT_ACTION_6;
|
||||
COLLISION_OFF(super);
|
||||
super->zVelocity = 0x2A000;
|
||||
super->spritePriority.b1 = 1;
|
||||
|
||||
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
} else if (super->z.HALF.HI != 0) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, FlyingPot_Functions);
|
||||
}
|
||||
|
||||
void FlyingPot_OnGrabbed(FlyingPotEntity* this) {
|
||||
static void (*const FlyingPot_SubActions[])(FlyingPotEntity*) = {
|
||||
FlyingPot_SubAction0, FlyingPot_SubAction1, FlyingPot_SubAction2,
|
||||
FlyingPot_SubAction3, FlyingPot_SubActionDoNothing, FlyingPot_SubAction5,
|
||||
};
|
||||
|
||||
FlyingPot_SubActions[super->subAction](this);
|
||||
}
|
||||
|
||||
void FlyingPot_SubAction0(FlyingPotEntity* this) {
|
||||
sub_08037418(this);
|
||||
|
||||
super->subAction = FLYING_POT_SUBACTION_1;
|
||||
super->actionDelay = 0;
|
||||
super->field_0x1d = 0x30;
|
||||
}
|
||||
|
||||
void FlyingPot_SubAction1(FlyingPotEntity* this) {
|
||||
sub_08037418(this);
|
||||
|
||||
if (sub_0806F520(super)) {
|
||||
sub_0806F4E8(super);
|
||||
} else {
|
||||
super->spriteOffsetX = 0;
|
||||
|
||||
if (super->z.HALF.HI != 0) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_SubAction2(FlyingPotEntity* this) {
|
||||
if (super->actionDelay == 0) {
|
||||
sub_08037418(this);
|
||||
super->actionDelay = 1;
|
||||
COLLISION_OFF(super);
|
||||
super->spriteOffsetX = 0;
|
||||
|
||||
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
}
|
||||
|
||||
if (sub_0806F520(super)) {
|
||||
sub_0806F3E4(super);
|
||||
} else {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_SubAction3(FlyingPotEntity* this) {
|
||||
if (!(gPlayerState.field_0x1c & 0xF)) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_SubActionDoNothing(FlyingPotEntity* this) {
|
||||
}
|
||||
|
||||
void FlyingPot_SubAction5(FlyingPotEntity* this) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
|
||||
void FlyingPot_Init(FlyingPotEntity* this) {
|
||||
u32 tile;
|
||||
|
||||
super->action = FLYING_POT_ACTION_1;
|
||||
super->field_0x1c = 2;
|
||||
super->y.HALF.HI += 3;
|
||||
|
||||
tile = TILE(super->x.HALF.HI, super->y.HALF.HI);
|
||||
this->tileIndex = GetTileIndex(tile, super->collisionLayer);
|
||||
SetTile(0x4000, tile, super->collisionLayer);
|
||||
InitializeAnimation(super, 5);
|
||||
}
|
||||
|
||||
void FlyingPot_Action1(FlyingPotEntity* this) {
|
||||
sub_08037418(this);
|
||||
|
||||
if (GetTileTypeByEntity(super) != 0x4000) {
|
||||
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
sub_08037408(this);
|
||||
}
|
||||
|
||||
if (PlayerInRange(super, 1, 0x40)) {
|
||||
super->action = FLYING_POT_ACTION_2;
|
||||
super->actionDelay = 30;
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_Action2(FlyingPotEntity* this) {
|
||||
static const u8 offsets[] = { -1, 1, 1, -1 };
|
||||
|
||||
sub_08037418(this);
|
||||
|
||||
super->spriteOffsetX += offsets[super->actionDelay & 3];
|
||||
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = FLYING_POT_ACTION_3;
|
||||
super->spritePriority.b1 = 1;
|
||||
super->spriteOffsetX = 0;
|
||||
super->hitType = 0xA0;
|
||||
super->flags2 = 0xF;
|
||||
super->hitbox = &gUnk_080FD34C;
|
||||
|
||||
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_Action3(FlyingPotEntity* this) {
|
||||
super->z.WORD -= 0x10000;
|
||||
|
||||
if (super->z.HALF.HI <= -6) {
|
||||
super->action = FLYING_POT_ACTION_4;
|
||||
super->actionDelay = 10;
|
||||
super->direction = GetFacingDirection(super, &gPlayerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_Action4(FlyingPotEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = FLYING_POT_ACTION_5;
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_Action5(FlyingPotEntity* this) {
|
||||
ProcessMovement2(super);
|
||||
|
||||
if (super->collisions != COL_NONE) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
|
||||
void FlyingPot_Action6(FlyingPotEntity* this) {
|
||||
if (super->zVelocity < 0) {
|
||||
super->spriteSettings.flipY = 1;
|
||||
}
|
||||
|
||||
if (!GravityUpdate(super, 0x2000)) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037408(FlyingPotEntity* this) {
|
||||
CreateFx(super, FX_POT_SHATTER, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_08037418(FlyingPotEntity* this) {
|
||||
u32 tile = COORD_TO_TILE(super);
|
||||
|
||||
if (GetTileIndex(tile, super->collisionLayer) == 0x4067) {
|
||||
SetTile(this->tileIndex, tile, super->collisionLayer);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
@@ -140,7 +141,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
|
||||
super->actionDelay = 0x1e;
|
||||
} else {
|
||||
ent = CreateEnemy(STALFOS, super->type - 2);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->type2 = 1;
|
||||
CopyPosition(super, ent);
|
||||
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
|
||||
@@ -159,7 +160,7 @@ void sub_08039ECC(FlyingSkullEntity* this) {
|
||||
void sub_08039EE4(FlyingSkullEntity* this) {
|
||||
super->subAction = 1;
|
||||
COLLISION_OFF(super);
|
||||
super->collisions = 0;
|
||||
super->collisions = COL_NONE;
|
||||
super->hitbox = (Hitbox*)&gUnk_080FD340;
|
||||
gPlayerEntity.animationState;
|
||||
this->unk_0x76 = gPlayerEntity.animationState;
|
||||
@@ -175,7 +176,7 @@ void sub_08039F4C(FlyingSkullEntity* this) {
|
||||
|
||||
void sub_08039F78(FlyingSkullEntity* this) {
|
||||
super->spritePriority.b1 = 1;
|
||||
if (super->z.HALF.HI == 0 || super->collisions) {
|
||||
if (super->z.HALF.HI == 0 || (super->collisions != COL_NONE)) {
|
||||
sub_0803A0E0(this);
|
||||
}
|
||||
}
|
||||
@@ -222,7 +223,7 @@ void sub_0803A09C(FlyingSkullEntity* this) {
|
||||
GetNextFrame(super);
|
||||
ProcessMovement2(super);
|
||||
|
||||
if (super->collisions) {
|
||||
if (super->collisions != COL_NONE) {
|
||||
sub_0803A0E0(this);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ void Ghini_OnConfused(GhiniEntity* this) {
|
||||
}
|
||||
|
||||
void Ghini_OnGrabbed(GhiniEntity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Ghini_SubActions[super->subAction](this);
|
||||
} else {
|
||||
sub_0803F51C(this);
|
||||
|
||||
@@ -42,9 +42,6 @@ void sub_08037ACC(GibdoEntity*);
|
||||
void Gibdo_CreateObjects(GibdoEntity*);
|
||||
void sub_08037A14(GibdoEntity*);
|
||||
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void (*const Gibdo_Functions[6])(Entity*);
|
||||
void (*const gUnk_080CF2AC[9])(GibdoEntity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
+5
-5
@@ -283,7 +283,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
|
||||
do {
|
||||
ent = CreateEnemy(GLEEROK, 1);
|
||||
super->child = ent;
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->type2 = uvar1 + 1;
|
||||
super->child->collisionLayer = super->collisionLayer;
|
||||
super->child->x.HALF.HI = super->x.HALF.HI;
|
||||
@@ -301,7 +301,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
|
||||
|
||||
ent = CreateEnemy(GLEEROK, 2);
|
||||
super->child = ent;
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
super->child->collisionLayer = super->collisionLayer;
|
||||
super->child->x.HALF.HI = super->x.HALF.HI;
|
||||
super->child->y.HALF.HI = super->y.HALF.HI + ((uvar1 + 1) * 12);
|
||||
@@ -760,7 +760,7 @@ void sub_0802DCE0(GleerokEntity* this) {
|
||||
if (this->unk_84->ent2->field_0xf == 0) {
|
||||
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0);
|
||||
|
||||
if (super->child) {
|
||||
if (super->child != NULL) {
|
||||
super->child->direction = this->unk_84->filler[0x15];
|
||||
super->child->type2 = this->unk_84->ent2->frame & 0xf;
|
||||
super->child->parent = this->unk_84->ent2;
|
||||
@@ -827,7 +827,7 @@ void sub_0802DDD8(GleerokEntity* this) {
|
||||
|
||||
if (this->unk_84->ent2->field_0xf == 1) {
|
||||
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2);
|
||||
if (super->child) {
|
||||
if (super->child != NULL) {
|
||||
super->child->direction = this->unk_84->filler[0x15];
|
||||
super->child->type2 = this->unk_84->ent2->frame & 0xf;
|
||||
super->child->parent = this->unk_84->ent2;
|
||||
@@ -1094,7 +1094,7 @@ void sub_0802E300(GleerokEntity* this) {
|
||||
InitializeAnimation(super, 0x4d);
|
||||
ent = CreateEnemy(GLEEROK, 5);
|
||||
super->child = ent;
|
||||
if (super->child) {
|
||||
if (super->child != NULL) {
|
||||
super->child->parent = super;
|
||||
heap->ent = super->child;
|
||||
((GleerokEntity*)super->child)->unk_84 = heap;
|
||||
|
||||
@@ -56,7 +56,7 @@ void GyorgChild_OnGrabbed(GyorgChildEntity* this) {
|
||||
GyorgChild_OnGrabbed_Action1,
|
||||
GyorgChild_OnGrabbed_Action3,
|
||||
};
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
GyorgChild_OnGrabbed_Actions[super->subAction](this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void sub_0802BCA8(Entity* this) {
|
||||
this->field_0x3a = this->field_0x3a & 0xfb;
|
||||
this->field_0x1c = 0x12;
|
||||
ent = CreateEnemy(HELMASAUR, 1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->animationState = this->animationState;
|
||||
CopyPosition(this, ent);
|
||||
}
|
||||
@@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) {
|
||||
this->field_0x78.HALF.LO--;
|
||||
if ((this->field_0x78.HALF.LO & 7) == 0) {
|
||||
Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, 0, Q_16_16(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void LakituCloud_OnKnockback(Entity* this) {
|
||||
}
|
||||
|
||||
void LakituCloud_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520(this) == 0) {
|
||||
if (!sub_0806F520(this)) {
|
||||
if (this->subAction == 2) {
|
||||
sub_0803CE3C(this);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void sub_08034E68(Entity* this) {
|
||||
sub_08035120(this);
|
||||
}
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
if (sub_08079F8C() != 0) {
|
||||
if (sub_08079F8C()) {
|
||||
this->action = 3;
|
||||
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
|
||||
*(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext;
|
||||
|
||||
@@ -34,7 +34,7 @@ void MiniSlime_OnCollision(Entity* this) {
|
||||
|
||||
void MiniSlime_OnDeath(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
if (this != parent && parent) {
|
||||
if ((this != parent) && (parent != NULL)) {
|
||||
this->field_0x6c.HALF.LO &= 0x7f;
|
||||
this->parent->child = this->child;
|
||||
this->child->parent = this->parent;
|
||||
|
||||
+3
-2
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "collision.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08022EAC(Entity*);
|
||||
@@ -103,7 +104,7 @@ void sub_08022D40(Entity* this) {
|
||||
sub_08022F14(this);
|
||||
ProcessMovement0(this);
|
||||
|
||||
if (this->collisions) {
|
||||
if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
|
||||
this->frameIndex = this->animationState;
|
||||
@@ -112,7 +113,7 @@ void sub_08022D40(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022D90(Entity* this) {
|
||||
if (this->parent->next) {
|
||||
if (this->parent->next != NULL) {
|
||||
Entity* parent;
|
||||
|
||||
gUnk_080CBBBC[this->action](this);
|
||||
|
||||
@@ -42,7 +42,7 @@ NONMATCH("asm/non_matching/moldworm/Moldworm.inc", void Moldworm(Entity* this))
|
||||
this->field_0x7c.BYTES.byte1 = this->field_0x7c.BYTES.byte0;
|
||||
EnemyFunctionHandler(this, Moldworm_Functions);
|
||||
} else {
|
||||
if (this->parent->next) {
|
||||
if (this->parent->next != NULL) {
|
||||
if (this->type != 8) {
|
||||
sub_080235BC(this);
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ void sub_08023AB0(Entity*);
|
||||
void sub_08023398(Entity* this) {
|
||||
this->field_0x7c.BYTES.byte0++;
|
||||
|
||||
if (this->field_0x7c.BYTES.byte3 && sub_08049FDC(this, 1) == 0) {
|
||||
if (this->field_0x7c.BYTES.byte3 && !sub_08049FDC(this, 1)) {
|
||||
this->field_0x78.HWORD = 1;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ void sub_080234D8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802351C(Entity* this) {
|
||||
if (this->actionDelay != 0 && (this->type2 == 1 || gPlayerEntity.frameIndex == 0xff)) {
|
||||
if ((this->actionDelay != 0) && ((this->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) {
|
||||
this->actionDelay = 0;
|
||||
this->child->action = 3;
|
||||
this->child->field_0xf = this->field_0x80.HALF.LO;
|
||||
@@ -377,8 +377,8 @@ void sub_0802376C(Entity* this) {
|
||||
void sub_080237D8(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
|
||||
if (parent->animIndex == 0x17 && this->actionDelay != 0 && this->x.HALF.HI == parent->x.HALF.HI &&
|
||||
this->y.HALF.HI == parent->y.HALF.HI) {
|
||||
if ((parent->animIndex == 0x17) && (this->actionDelay != 0) && (this->x.HALF.HI == parent->x.HALF.HI) &&
|
||||
(this->y.HALF.HI == parent->y.HALF.HI)) {
|
||||
this->action = 1;
|
||||
COLLISION_OFF(this);
|
||||
this->spriteSettings.draw = 0;
|
||||
@@ -501,7 +501,7 @@ void sub_08023AB0(Entity* this) {
|
||||
if (this->field_0x7a.HALF.HI == 8) {
|
||||
if (this->field_0x7c.BYTES.byte2) {
|
||||
this->field_0x7c.BYTES.byte2--;
|
||||
} else if (!sub_08023B38(this) || 0x1d >= this->field_0x78.HWORD) {
|
||||
} else if (!sub_08023B38(this) || (this->field_0x78.HWORD <= 0x1D)) {
|
||||
this->hitType = 0x85;
|
||||
this->field_0x7a.HALF.HI = 0;
|
||||
this->field_0x7c.BYTES.byte2 = 30;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -63,11 +64,11 @@ void sub_08032CAC(MulldozerEntity* this) {
|
||||
case 2:
|
||||
case 3:
|
||||
super->action = 6;
|
||||
super->actionDelay = super->type != 0 ? 0x5a : 200;
|
||||
super->actionDelay = (super->type != 0) ? 0x5a : 200;
|
||||
super->field_0xf = 2;
|
||||
this->unk_80 = 3;
|
||||
super->direction = super->knockbackDirection;
|
||||
super->direction = (super->direction + ((Random() & 0x40) != 0 ? 4 : 0x1c));
|
||||
super->direction += ((Random() & 0x40) != 0) ? 4 : 0x1c;
|
||||
super->direction &= 0x1f;
|
||||
super->speed = 0;
|
||||
break;
|
||||
@@ -102,7 +103,7 @@ void Mulldozer_Action1(MulldozerEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
sub_080330C0(this);
|
||||
} else {
|
||||
if (sub_08033364(this) != 0) {
|
||||
if (sub_08033364(this)) {
|
||||
sub_08033100(this);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +201,7 @@ void sub_08032F48(MulldozerEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08032F64(MulldozerEntity* this) {
|
||||
if (super->collisions != 0) {
|
||||
if (super->collisions != COL_NONE) {
|
||||
sub_0800417E(super, super->collisions);
|
||||
super->animationState = super->direction >> 2;
|
||||
sub_08032F24(this);
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ void Octorok_ShootNut(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
Entity* ent = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
const s8* off;
|
||||
ent->direction = this->direction;
|
||||
off = &gOctorokNutOffset[this->direction / 4];
|
||||
|
||||
+15
-13
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy/octorokBoss.h"
|
||||
#include "collision.h"
|
||||
#include "functions.h"
|
||||
#include "game.h"
|
||||
#include "object.h"
|
||||
@@ -494,7 +495,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) {
|
||||
sub_08036914(super, angle, radius);
|
||||
this->angle.HALF.HI = -((OctorokBossEntity*)super->parent)->angle.HALF.HI;
|
||||
}
|
||||
if (IS_FROZEN((OctorokBossEntity*)super->parent) == 0) {
|
||||
if (!IS_FROZEN((OctorokBossEntity*)super->parent)) {
|
||||
super->spriteSettings.draw |= 1;
|
||||
}
|
||||
break;
|
||||
@@ -639,14 +640,15 @@ void OctorokBoss_Action1_ChargeAttack(OctorokBossEntity* this) {
|
||||
|
||||
if (this->timer == 0) {
|
||||
ProcessMovement0(super);
|
||||
knockbackCondition = 0;
|
||||
knockbackCondition = FALSE;
|
||||
if ((super->direction != 0) && (super->direction != 0x10)) {
|
||||
knockbackCondition = ((u32)super->collisions & 0xee00) != 0;
|
||||
knockbackCondition = ((super->collisions & (COL_EAST_ANY | COL_WEST_ANY)) != COL_NONE);
|
||||
}
|
||||
if (((super->direction != 0x18) && (super->direction != 8)) && ((super->collisions & 0xee) != 0)) {
|
||||
knockbackCondition = 1;
|
||||
if (((super->direction != 0x18) && (super->direction != 8)) &&
|
||||
(super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY))) {
|
||||
knockbackCondition = TRUE;
|
||||
}
|
||||
if (knockbackCondition != 0) {
|
||||
if (knockbackCondition) {
|
||||
super->knockbackDuration = 0x20;
|
||||
super->knockbackSpeed = 0x200;
|
||||
super->knockbackDirection = super->direction ^ 0x10;
|
||||
@@ -911,7 +913,7 @@ void OctorokBoss_Burning(OctorokBossEntity* this) {
|
||||
void OctorokBoss_Burning_SubAction0(OctorokBossEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->speed = 0x200;
|
||||
super->collisions = 0;
|
||||
super->collisions = COL_NONE;
|
||||
super->direction = (u8)(-this->angle.HALF.HI ^ 0x80U) >> 3;
|
||||
this->timer = 0x78;
|
||||
this->angularSpeed.HWORD = 0x180;
|
||||
@@ -922,13 +924,13 @@ void OctorokBoss_Burning_SubAction0(OctorokBossEntity* this) {
|
||||
|
||||
void OctorokBoss_Burning_SubAction1(OctorokBossEntity* this) {
|
||||
ProcessMovement0(super);
|
||||
if (super->collisions != 0) {
|
||||
if (super->collisions != COL_NONE) {
|
||||
super->subAction = 2;
|
||||
this->heap->targetAngle = this->angle.HALF.HI;
|
||||
if ((super->collisions & 0xee00) != 0) {
|
||||
if ((super->collisions & (COL_EAST_ANY | COL_WEST_ANY)) != COL_NONE) {
|
||||
this->heap->targetAngle = -this->heap->targetAngle;
|
||||
}
|
||||
if ((super->collisions & 0xee) != 0) {
|
||||
if ((super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) {
|
||||
this->heap->targetAngle = -this->heap->targetAngle ^ 0x80;
|
||||
}
|
||||
super->knockbackDuration = 0x18;
|
||||
@@ -951,10 +953,10 @@ void OctorokBoss_Burning_SubAction2(OctorokBossEntity* this) {
|
||||
if ((u32)(this->heap->targetAngle - this->angle.HALF.HI + 7) < 0xf) {
|
||||
super->subAction = 1;
|
||||
super->direction = ((u8) - this->angle.HALF.HI ^ 0x80) >> 3;
|
||||
super->collisions = 0;
|
||||
super->collisions = COL_NONE;
|
||||
ProcessMovement0(super);
|
||||
} else {
|
||||
if ((u8)(this->heap->targetAngle - this->angle.HALF.HI) >= 0x81) {
|
||||
if ((u8)(this->heap->targetAngle - this->angle.HALF.HI) > 0x80) {
|
||||
this->angle.HWORD -= this->angularSpeed.HWORD;
|
||||
} else {
|
||||
this->angle.HWORD += this->angularSpeed.HWORD;
|
||||
@@ -1161,7 +1163,7 @@ void OctorokBoss_StartRegularAttack(OctorokBossEntity* this) {
|
||||
super->subAction = ACTION1_SUBACTION2;
|
||||
super->speed = 0x200;
|
||||
this->timer = 0x3c;
|
||||
super->collisions = 0;
|
||||
super->collisions = COL_NONE;
|
||||
this->heap->unk_0 = 4;
|
||||
SoundReq(SFX_159);
|
||||
return;
|
||||
|
||||
@@ -8,9 +8,6 @@ extern void (*const gUnk_080012C8[])(Entity*);
|
||||
const s8 gUnk_080CF490[];
|
||||
const u8 gUnk_080CF498[];
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_08037E14(Entity* this);
|
||||
bool32 sub_08037E90(Entity* this);
|
||||
|
||||
|
||||
+1
-4
@@ -19,9 +19,6 @@ extern const s8 gUnk_080CA5D4[];
|
||||
void sub_080205F8(Entity*);
|
||||
void sub_08020604(Entity*);
|
||||
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
enum {
|
||||
@@ -57,7 +54,7 @@ void Peahat_OnCollision(Entity* this) {
|
||||
if (this->field_0x82.HALF.LO) {
|
||||
if (this->bitfield == 0x94) {
|
||||
Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
CopyPosition(this, ent);
|
||||
ent->z.HALF.HI -= 8;
|
||||
}
|
||||
|
||||
+7
-6
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "collision.h"
|
||||
#include "object.h"
|
||||
#include "game.h"
|
||||
#include "functions.h"
|
||||
@@ -170,7 +171,7 @@ void sub_080240B8(Entity* this) {
|
||||
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
this->child = ent;
|
||||
ent->parent = this;
|
||||
ent->y.HALF.HI += 0x10;
|
||||
@@ -413,7 +414,7 @@ void sub_080244E8(Entity* this) {
|
||||
this->field_0x78.HWORD -= 0xe;
|
||||
|
||||
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
ent->z.HALF.HI += 0xe;
|
||||
ent->child = this->child;
|
||||
@@ -436,7 +437,7 @@ void sub_080244E8(Entity* this) {
|
||||
this->field_0x78.HWORD -= 0xe;
|
||||
|
||||
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
ent->z.HALF.HI += 0xe;
|
||||
this->child = ent;
|
||||
@@ -525,7 +526,7 @@ void sub_080244E8(Entity* this) {
|
||||
void sub_08024940(Entity* this) {
|
||||
u32 random = Random() & 0x70;
|
||||
|
||||
if (this->collisions != 0) {
|
||||
if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
sub_080249F4(this);
|
||||
}
|
||||
@@ -661,7 +662,7 @@ bool32 sub_08024B38(Entity* this) {
|
||||
}
|
||||
|
||||
ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
do {
|
||||
if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) {
|
||||
iVar4 = 1;
|
||||
@@ -678,7 +679,7 @@ bool32 sub_08024B38(Entity* this) {
|
||||
}
|
||||
|
||||
ent = FindEntityByID(OBJECT, POT, 6);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
do {
|
||||
if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) {
|
||||
iVar4 = 1;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "collision.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -156,7 +157,7 @@ void sub_08025230(Entity* this) {
|
||||
this->direction = sub_08025C60(this);
|
||||
}
|
||||
|
||||
if (this->collisions != 0) {
|
||||
if (this->collisions != COL_NONE) {
|
||||
if (--this->field_0xf == 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
}
|
||||
@@ -528,12 +529,12 @@ void sub_08025AE8(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateFx(this, FX_BROWN_SMOKE, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->y.WORD--;
|
||||
}
|
||||
|
||||
ent = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->y.WORD++;
|
||||
}
|
||||
}
|
||||
@@ -552,7 +553,7 @@ void sub_08025B18(Entity* this) {
|
||||
sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer);
|
||||
|
||||
ent = CreateObject(OBJECT_21, 2, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1]));
|
||||
ent->x.HALF.HI &= -0x10;
|
||||
ent->x.HALF.HI += 8;
|
||||
@@ -566,7 +567,7 @@ void sub_08025B18(Entity* this) {
|
||||
void sub_08025BD4(Entity* this) {
|
||||
if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) {
|
||||
Entity* ent = CreateObject(OBJECT_21, 0, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]),
|
||||
Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1]));
|
||||
ent->z.HALF.HI = -10;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
|
||||
extern void (*const RockChuchu_Functions[])(Entity*);
|
||||
extern void (*const gUnk_080CB960[])(Entity*);
|
||||
|
||||
@@ -47,7 +45,7 @@ void RockChuchu_OnCollision(Entity* this) {
|
||||
case 0x1c:
|
||||
CreateFx(this, FX_ROCK, 0);
|
||||
ent = CreateEnemy(CHUCHU, 1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->type2 = 1;
|
||||
#ifndef EU
|
||||
ent->iframes = -8;
|
||||
@@ -102,7 +100,7 @@ void sub_080223E4(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
ent = this->child;
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->bitfield = 0x94;
|
||||
ent->iframes = 0x10;
|
||||
#ifndef EU
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ extern void (*const Rope_Functions[6])(Entity*);
|
||||
extern void (*const gUnk_080CE460[4])(Entity*);
|
||||
extern void (*const gUnk_080CE470[3])(Entity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_08031600(Entity*);
|
||||
u32 sub_0803163C(Entity*);
|
||||
@@ -39,7 +38,7 @@ void Rope_OnCollision(Entity* this) {
|
||||
}
|
||||
|
||||
void Rope_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CE470[this->subAction](this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const RopeGolden_Functions[6])(Entity*);
|
||||
extern void (*const gUnk_080CF4E0[4])(Entity*);
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_080383AC(Entity*);
|
||||
void sub_080383E4(Entity*);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
@@ -63,7 +64,7 @@ void ScissorsBeetle_OnGrabbed(ScissorsBeetleEntity* this) {
|
||||
|
||||
void ScissorsBeetle_Init(ScissorsBeetleEntity* this) {
|
||||
Entity* ent = CreateProjectile(MANDIBLES_PROJECTILE);
|
||||
if (!ent)
|
||||
if (ent == NULL)
|
||||
return;
|
||||
|
||||
sub_0804A720(super);
|
||||
@@ -92,7 +93,7 @@ void sub_080389E8(ScissorsBeetleEntity* this) {
|
||||
sub_08038C2C((ScissorsBeetleEntity*)child);
|
||||
} else if (super->actionDelay) {
|
||||
super->actionDelay--;
|
||||
} else if (super->collisions) {
|
||||
} else if (super->collisions != COL_NONE) {
|
||||
super->actionDelay = 0xc;
|
||||
if ((child->animationState & 1) == 0) {
|
||||
child->animationState += Random() & 0x20 ? 1 : 7;
|
||||
|
||||
+1
-3
@@ -15,8 +15,6 @@ typedef struct {
|
||||
void sub_08044FF8(Entity*);
|
||||
void sub_08045178(Entity*, Entity*, int, int);
|
||||
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_080D16BC[])(Entity*);
|
||||
extern void (*const Slime_Functions[])(Entity*);
|
||||
extern u8 gUnk_080D16D0[4]; // Entity count per form
|
||||
@@ -116,7 +114,7 @@ void sub_080450A8(Entity* this) {
|
||||
}
|
||||
|
||||
ent = CreateFx(this, FX_DEATH, 0);
|
||||
if (ent)
|
||||
if (ent != NULL)
|
||||
CopyPosition(this, ent);
|
||||
|
||||
DeleteEntity(this);
|
||||
|
||||
@@ -8,13 +8,9 @@
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
bool32 PlayerInRange(Entity*, u32, u32);
|
||||
|
||||
void sub_08023E10(Entity*);
|
||||
void sub_08023E54(Entity*);
|
||||
void sub_08023E9C(Entity*);
|
||||
void sub_0804A4E4(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
|
||||
@@ -136,7 +132,7 @@ void sub_08023CE0(Entity* this) {
|
||||
if (this->frame) {
|
||||
if (this->frame & ANIM_DONE) {
|
||||
Entity* ent = CreateEnemy(SLUGGULA, 1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
sub_0804A4E4(this, ent);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
@@ -167,7 +163,7 @@ void sub_08023E54(Entity* this) {
|
||||
if (this->field_0xf++ > 27) {
|
||||
this->field_0xf = 0;
|
||||
ent = CreateEnemy(SLUGGULA, 2);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
const s8* ptr = &gUnk_080CBDF7[this->animationState * 2];
|
||||
PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
|
||||
}
|
||||
@@ -178,7 +174,7 @@ extern Entity* gUnk_020000B0;
|
||||
|
||||
void sub_08023E9C(Entity* this) {
|
||||
u32 uVar3 = Random();
|
||||
if (sub_08049FA0(this) == 0 && (uVar3 & 1)) {
|
||||
if (!sub_08049FA0(this) && (uVar3 & 1)) {
|
||||
this->direction = DirectionRoundUp(sub_08049EE4(this));
|
||||
} else if (sub_08049FDC(this, 1) && (uVar3 & 6)) {
|
||||
u32 uVar3 = GetFacingDirection(this, gUnk_020000B0) - this->direction;
|
||||
|
||||
+16
-16
@@ -5,6 +5,7 @@
|
||||
* @brief Spark enemy
|
||||
*/
|
||||
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -30,7 +31,7 @@ void Spark_OnCollision(Entity* this) {
|
||||
this->spriteSettings.draw = 0;
|
||||
this->action = 2;
|
||||
ent = CreateFx(this, FX_DEATH, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
this->child = ent;
|
||||
this->actionDelay = 14;
|
||||
CopyPosition(this, ent);
|
||||
@@ -40,7 +41,6 @@ void Spark_OnCollision(Entity* this) {
|
||||
}
|
||||
|
||||
void Spark_OnGrabbed(Entity* this) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_0802B33C(Entity* this) {
|
||||
@@ -57,7 +57,7 @@ void sub_0802B35C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
ProcessMovement0(this);
|
||||
is_head = this->type == 0;
|
||||
if (this->collisions == 0) {
|
||||
if (this->collisions == COL_NONE) {
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0xf = 0x78;
|
||||
|
||||
@@ -68,49 +68,49 @@ void sub_0802B35C(Entity* this) {
|
||||
this->field_0xf = 0x78;
|
||||
switch (DirectionRound(this->direction)) {
|
||||
case DirectionNorth:
|
||||
if (this->collisions & 0xe) {
|
||||
if ((this->collisions & COL_NORTH_ANY) != COL_NONE) {
|
||||
this->direction = is_head ? DirectionWest : DirectionEast;
|
||||
} else {
|
||||
if ((this->collisions & 0xe000) == 0x4000 && is_head) {
|
||||
if (((this->collisions & COL_EAST_ANY) == COL_EAST_NORTH) && is_head) {
|
||||
this->direction = DirectionEast;
|
||||
}
|
||||
if ((this->collisions & 0xe00) == 0x400 && !is_head) {
|
||||
if (((this->collisions & COL_WEST_ANY) == COL_WEST_NORTH) && !is_head) {
|
||||
this->direction = DirectionWest;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DirectionSouth:
|
||||
if (this->collisions & 0xe0) {
|
||||
if ((this->collisions & COL_SOUTH_ANY) != COL_NONE) {
|
||||
this->direction = is_head ? DirectionEast : DirectionWest;
|
||||
} else {
|
||||
if ((this->collisions & 0xe000) == 0x2000 && !is_head) {
|
||||
if (((this->collisions & COL_EAST_ANY) == COL_EAST_SOUTH) && !is_head) {
|
||||
this->direction = DirectionEast;
|
||||
}
|
||||
if ((this->collisions & 0xe00) == 0x200 && is_head) {
|
||||
if (((this->collisions & COL_WEST_ANY) == COL_WEST_SOUTH) && is_head) {
|
||||
this->direction = DirectionWest;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DirectionWest:
|
||||
if (this->collisions & 0xe00) {
|
||||
if ((this->collisions & COL_WEST_ANY) != COL_NONE) {
|
||||
this->direction = is_head ? DirectionSouth : DirectionNorth;
|
||||
} else {
|
||||
if ((this->collisions & 0xe) == 4 && is_head) {
|
||||
if (((this->collisions & COL_NORTH_ANY) == COL_NORTH_EAST) && is_head) {
|
||||
this->direction = DirectionNorth;
|
||||
}
|
||||
if ((this->collisions & 0xe0) == 0x40 && !is_head) {
|
||||
if (((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_EAST) && !is_head) {
|
||||
this->direction = DirectionSouth;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DirectionEast:
|
||||
if (this->collisions & 0xe000) {
|
||||
if ((this->collisions & COL_EAST_ANY) != COL_NONE) {
|
||||
this->direction = is_head ? DirectionNorth : DirectionSouth;
|
||||
} else {
|
||||
if ((this->collisions & 0xe) == 2 && !is_head) {
|
||||
if (((this->collisions & COL_NORTH_ANY) == COL_NORTH_WEST) && !is_head) {
|
||||
this->direction = DirectionNorth;
|
||||
}
|
||||
if ((this->collisions & 0xe0) == 0x20 && is_head) {
|
||||
if (((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_WEST) && is_head) {
|
||||
this->direction = DirectionSouth;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void sub_0802B35C(Entity* this) {
|
||||
void sub_0802B4A8(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->y.HALF.HI -= 4;
|
||||
}
|
||||
DeleteEntity(this);
|
||||
|
||||
@@ -380,7 +380,7 @@ bool32 sub_080288A4(Entity* this) {
|
||||
|
||||
void sub_080288C0(Entity* this) {
|
||||
Entity* ent = this->child;
|
||||
if (ent && (ent->bitfield & 0x80)) {
|
||||
if ((ent != NULL) && (ent->bitfield & 0x80)) {
|
||||
this->knockbackDirection = ent->knockbackDirection;
|
||||
this->iframes = -ent->iframes;
|
||||
this->knockbackSpeed = ent->knockbackSpeed;
|
||||
|
||||
@@ -9,11 +9,6 @@
|
||||
#include "functions.h"
|
||||
#include "hitbox.h"
|
||||
|
||||
extern void sub_08001318(Entity*);
|
||||
extern u32 PlayerInRange(Entity*, u32, u32);
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
|
||||
u32 sub_080228CC(Entity*);
|
||||
u32 sub_080228F0(Entity*);
|
||||
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -123,7 +124,7 @@ void sub_08039418(StalfosEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08039438(StalfosEntity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Stalfos_SubActions[super->subAction](this);
|
||||
}
|
||||
}
|
||||
@@ -366,7 +367,7 @@ void sub_0803992C(StalfosEntity* this) {
|
||||
super->direction = super->animationState << 3;
|
||||
this->unk_78 = (u16)gUnk_080CF900[Random() & 0xf];
|
||||
CalculateEntityTileCollisions(super, super->direction, 0);
|
||||
if ((gUnk_080CF910[super->animationState] & super->collisions) != 0) {
|
||||
if ((gUnk_080CF910[super->animationState] & super->collisions) != COL_NONE) {
|
||||
InitAnimationForceUpdate(super, super->animationState);
|
||||
} else {
|
||||
InitAnimationForceUpdate(super, super->animationState + 4);
|
||||
|
||||
+3
-3
@@ -74,7 +74,7 @@ void Takkuri_OnCollision(TakkuriEntity* this) {
|
||||
void Takkuri_OnGrabbed(TakkuriEntity* this) {
|
||||
gUnk_080CFF6C[super->subAction](this);
|
||||
GetNextFrame(super);
|
||||
if (sub_0806F520(super) == 0) {
|
||||
if (!sub_0806F520(super)) {
|
||||
super->action = 2;
|
||||
super->subAction = 0;
|
||||
this->unk_0x84 = 2;
|
||||
@@ -132,7 +132,7 @@ void sub_0803BD08(TakkuriEntity* this) {
|
||||
sub_0803BEE8(this);
|
||||
GetNextFrame(super);
|
||||
ent = sub_08049DF4(1);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
if (EntityInRectRadius(super, gUnk_020000B0, 0x88, 0x50)) {
|
||||
if (gUnk_020000B0->y.HALF.HI > super->y.HALF.HI + 8) {
|
||||
super->action = 2;
|
||||
@@ -306,7 +306,7 @@ void sub_0803C0AC(Entity* this) {
|
||||
u32 index, rupeeType, rupees;
|
||||
Entity* ent;
|
||||
ent = sub_08049DF4(1);
|
||||
if (!ent)
|
||||
if (ent == NULL)
|
||||
return;
|
||||
|
||||
rupees = gSave.stats.rupees;
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
* @brief Tektite enemy
|
||||
*/
|
||||
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -135,7 +136,7 @@ void sub_0802F300(Entity* this) {
|
||||
this->field_0xf = 0;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
} else if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* @brief Golden Tektite enemy
|
||||
*/
|
||||
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -114,7 +115,7 @@ void sub_08038048(Entity* this) {
|
||||
this->actionDelay = 0x14;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
} else if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
|
||||
@@ -561,7 +561,7 @@ void VaatiWrathType0ActionD(Entity* this) {
|
||||
void sub_08041BE8(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (sub_08079F8C() != 0) {
|
||||
if (sub_08079F8C()) {
|
||||
this->subAction = 1;
|
||||
this->actionDelay = 120;
|
||||
this->updatePriority = PRIO_NO_BLOCK;
|
||||
|
||||
@@ -34,7 +34,7 @@ void sub_0802A250(Entity* this) {
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
|
||||
ent = CreateObject(OBJECT_66, 0, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -5,6 +5,7 @@
|
||||
* @brief Wisp enemy
|
||||
*/
|
||||
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "save.h"
|
||||
#include "object.h"
|
||||
@@ -69,7 +70,7 @@ void Wisp_OnCollision(Entity* this) {
|
||||
}
|
||||
|
||||
void Wisp_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520() != 0) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CEB98[this->subAction](this);
|
||||
}
|
||||
}
|
||||
@@ -102,7 +103,7 @@ void sub_08033674(Entity* this) {
|
||||
void sub_080336A8(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08033744(this);
|
||||
} else if (this->collisions != 0) {
|
||||
} else if (this->collisions != COL_NONE) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
}
|
||||
ProcessMovement0(this);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "collision.h"
|
||||
#include "enemy.h"
|
||||
#include "enemy/wizzrobe.h"
|
||||
#include "functions.h"
|
||||
@@ -262,7 +263,7 @@ void sub_0802F9C8(WizzrobeEntity* this) {
|
||||
} else {
|
||||
if (super->type2 != 0) {
|
||||
ProcessMovement0(super);
|
||||
if (super->collisions != 0) {
|
||||
if (super->collisions != COL_NONE) {
|
||||
super->flags &= 0x7f;
|
||||
this->timer1 = 0x28;
|
||||
}
|
||||
|
||||
+2
-2
@@ -339,7 +339,7 @@ void DeleteEntityAny(Entity* ent) {
|
||||
}
|
||||
|
||||
void DeleteEntity(Entity* ent) {
|
||||
if (ent->next) {
|
||||
if (ent->next != NULL) {
|
||||
UnloadGFXSlots(ent);
|
||||
UnloadOBJPalette(ent);
|
||||
UnloadOBJPalette2(ent);
|
||||
@@ -418,7 +418,7 @@ Manager* GetEmptyManager(void) {
|
||||
|
||||
void DeleteManager(void* ent) {
|
||||
Manager* manager = (Manager*)ent;
|
||||
if (!manager->next)
|
||||
if (manager->next == NULL)
|
||||
return;
|
||||
|
||||
ReleaseTransitionManager(manager);
|
||||
|
||||
+4
-4
@@ -106,12 +106,12 @@ void sub_08051458(void);
|
||||
|
||||
void CreateDialogBox(u32 arg0, u32 arg1) {
|
||||
u32 sfx;
|
||||
struct_080FC844 var0;
|
||||
Font var0;
|
||||
|
||||
sub_08050384();
|
||||
MemCopy(&gUnk_080FC844, &var0, sizeof(gUnk_080FC844));
|
||||
sub_08056FEC(arg1, gUnk_020227E8);
|
||||
var0.unk10 |= gUnk_080FC85C[arg0][0] << 0xC;
|
||||
var0.gfx_src |= gUnk_080FC85C[arg0][0] << 0xC;
|
||||
sub_0805F46C(gUnk_080FC85C[arg0][1], &var0);
|
||||
sfx = gUnk_080FC85C[arg0][2];
|
||||
if (sfx) {
|
||||
@@ -296,7 +296,7 @@ static void sub_0805066C(void) {
|
||||
void sub_0805070C(void) {
|
||||
u32 i;
|
||||
int j;
|
||||
struct_02036540* var0;
|
||||
WStruct* var0;
|
||||
char* name;
|
||||
|
||||
var0 = sub_0805F2C8();
|
||||
@@ -322,7 +322,7 @@ void sub_0805070C(void) {
|
||||
|
||||
void sub_08050790(void) {
|
||||
u32 i, j;
|
||||
struct_02036540* var0;
|
||||
WStruct* var0;
|
||||
u32 var1;
|
||||
|
||||
var0 = sub_0805F2C8();
|
||||
|
||||
+4
-22
@@ -30,6 +30,8 @@
|
||||
#include "subtask.h"
|
||||
#include "itemMetaData.h"
|
||||
#include "player.h"
|
||||
#include "transitions.h"
|
||||
#include "roomid.h"
|
||||
|
||||
// Game task
|
||||
|
||||
@@ -82,10 +84,8 @@ extern void** gAreaTilesets[];
|
||||
extern void** gAreaRoomMaps[];
|
||||
extern void* gAreaMetatiles[];
|
||||
extern void* gUnk_080B755C[];
|
||||
extern void** gExitLists[];
|
||||
extern void** gAreaTable[];
|
||||
|
||||
extern void CreateDialogBox(u32, u32);
|
||||
extern void FinalizeSave(void);
|
||||
extern void ClearArmosData(void);
|
||||
extern void ClearRoomMemory(void);
|
||||
@@ -168,24 +168,6 @@ typedef struct {
|
||||
} struct_08127F94;
|
||||
extern struct_08127F94 gUnk_08127F94[];
|
||||
|
||||
typedef struct {
|
||||
u16* dest;
|
||||
void* gfx_dest;
|
||||
void* buffer_loc;
|
||||
u32 _c;
|
||||
u16 gfx_src;
|
||||
u8 width;
|
||||
u8 right_align : 1;
|
||||
u8 sm_border : 1;
|
||||
u8 unused : 1;
|
||||
u8 draw_border : 1;
|
||||
u8 border_type : 4;
|
||||
u8 fill_type;
|
||||
u8 _15;
|
||||
u8 _16;
|
||||
u8 stylized;
|
||||
} Font;
|
||||
|
||||
typedef struct {
|
||||
u8 dest_off[8];
|
||||
u8 _8;
|
||||
@@ -195,7 +177,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
u8 area;
|
||||
u8 room;
|
||||
RoomID room : 8;
|
||||
u8 _2;
|
||||
u8 _3;
|
||||
u16 x;
|
||||
@@ -1438,7 +1420,7 @@ static void InitRoomResInfo(RoomResInfo* info, RoomHeader* r_hdr, u32 area, u32
|
||||
info->map = *(gAreaRoomMaps[area] + room);
|
||||
info->metatiles = gAreaMetatiles[area];
|
||||
info->bg_anim = gUnk_080B755C[area];
|
||||
info->exits = *(gExitLists[area] + room);
|
||||
info->exits = gExitLists[area][room];
|
||||
if (gAreaTable[area] != NULL) {
|
||||
info->properties = *(gAreaTable[area] + room);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void Manager4_Main(Manager* this) {
|
||||
gUnk_08107C70[this->action](this);
|
||||
}
|
||||
|
||||
extern void sub_080805F8(void);
|
||||
extern void UpdateIsDiggingCave(void);
|
||||
|
||||
extern DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance*, int);
|
||||
|
||||
@@ -21,8 +21,8 @@ void sub_0805786C(Manager* this) {
|
||||
u8 room;
|
||||
u8 area;
|
||||
u16 uVar = 0x81 << 7;
|
||||
sub_080805F8();
|
||||
if (gUnk_03004030.unk_08 != 0) {
|
||||
UpdateIsDiggingCave();
|
||||
if (gUnk_03004030.isDiggingCave != 0) {
|
||||
if (gUnk_03004030.unk_00 == 0) {
|
||||
gUnk_03004030.unk_0a = 0xFF;
|
||||
room = gRoomControls.room;
|
||||
@@ -66,7 +66,7 @@ void sub_08057A18(Manager*, DiggingCaveEntrance*);
|
||||
u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
|
||||
u16 offsetX, offsetY, offsetX2, offsetY2;
|
||||
u32 tmp, tmp2;
|
||||
if (gUnk_03004030.unk_08) {
|
||||
if (gUnk_03004030.isDiggingCave) {
|
||||
offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
|
||||
offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
|
||||
offsetX2 = (entr->unk_00 & 0x3F) * 16 + 8;
|
||||
@@ -105,10 +105,10 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
|
||||
gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->unk_00 & 0xFC0) >> 2);
|
||||
|
||||
#ifndef EU
|
||||
tmp = gUnk_03004030.unk_08;
|
||||
tmp = gUnk_03004030.isDiggingCave;
|
||||
if (!tmp) {
|
||||
if ((entr->target_room | 0x80) != gUnk_03004030.unk_0b) {
|
||||
gUnk_02034480.unk_00 = gUnk_03004030.unk_08;
|
||||
gUnk_02034480.unk_00 = gUnk_03004030.isDiggingCave;
|
||||
}
|
||||
gUnk_03004030.unk_0b = entr->target_room | 0x80;
|
||||
}
|
||||
|
||||
+23
-14
@@ -62,8 +62,9 @@ void ManagerB_WaitForFlag(ManagerB* this) {
|
||||
|
||||
void ManagerB_WaitForDone(ManagerB* this) {
|
||||
// check if all helpers are done
|
||||
if (this->manager.unk_0e)
|
||||
if (this->manager.unk_0e) {
|
||||
return;
|
||||
}
|
||||
// set the completion flag for the fight
|
||||
SetFlag(this->unk_3e);
|
||||
// restore music (if it was set, which apparently is only possible if there's a flag the fight waited for)
|
||||
@@ -87,25 +88,28 @@ void ManagerB_LoadFight(Manager* this) {
|
||||
EntityData* prop;
|
||||
Entity* ent;
|
||||
u32 counter;
|
||||
|
||||
this->action = 2;
|
||||
this->unk_0e = 0;
|
||||
counter = 0;
|
||||
// Create a helper to keep track of the created entities.
|
||||
monitor = CreateHelper(this);
|
||||
if (!monitor)
|
||||
if (monitor == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
prop = (EntityData*)GetCurrentRoomProperty(this->unk_0b);
|
||||
if (prop) {
|
||||
while (*((u8*)prop) != 0xFF) {
|
||||
if (prop != NULL) {
|
||||
while (prop->kind != 0xFF) {
|
||||
ent = LoadRoomEntity(prop++);
|
||||
if (ent && (ent->kind == ENEMY)) {
|
||||
if ((ent != NULL) && (ent->kind == ENEMY)) {
|
||||
ent->field_0x6c.HALF.HI |= 0x40;
|
||||
ManagerBHelper_Monitor(monitor, ent, counter++);
|
||||
}
|
||||
if (counter >= 7) {
|
||||
counter = 0;
|
||||
monitor = CreateHelper(this);
|
||||
if (!monitor)
|
||||
if (monitor == NULL)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -139,27 +143,31 @@ void ManagerBHelper_Monitor(ManagerBHelper* this, Entity* ent, u32 index) {
|
||||
// case volumeMasterTarget is 1: The manager is a helper
|
||||
|
||||
void ManagerBHelper_Main(Manager* this) {
|
||||
u8 i, anyRemaining;
|
||||
u8 i;
|
||||
bool32 anyRemaining;
|
||||
Entity* current;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK);
|
||||
}
|
||||
// go through and check all monitored enemies.
|
||||
anyRemaining = 0;
|
||||
anyRemaining = FALSE;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((current = ((ManagerBHelper*)this)->enemies[i])) {
|
||||
if (!current->next) {
|
||||
current = ((ManagerBHelper*)this)->enemies[i];
|
||||
if (current != NULL) {
|
||||
if (current->next == NULL) {
|
||||
((ManagerBHelper*)this)->enemies[i] = 0;
|
||||
} else {
|
||||
anyRemaining = 1;
|
||||
anyRemaining = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!anyRemaining) {
|
||||
// inform the parent that we're done
|
||||
if (((ManagerB*)this->parent)->manager.unk_0e) {
|
||||
((ManagerB*)this->parent)->manager.unk_0e--;
|
||||
ManagerB* parent = (ManagerB*)this->parent;
|
||||
if (parent->manager.unk_0e != 0) {
|
||||
parent->manager.unk_0e--;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
@@ -174,8 +182,9 @@ void ReplaceMonitoredEntity(Entity* old, Entity* new) {
|
||||
u32 i;
|
||||
for (current = (ManagerBHelper*)end->next; (Manager*)current != end;
|
||||
current = (ManagerBHelper*)current->manager.next) {
|
||||
if (current->manager.type != 0x9 || current->manager.subtype != 0xB)
|
||||
if (current->manager.type != 0x9 || current->manager.subtype != 0xB) {
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (old == current->enemies[i]) {
|
||||
current->enemies[i] = new;
|
||||
|
||||
+13
-16
@@ -15,16 +15,6 @@
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x1];
|
||||
u8 unk1;
|
||||
u8 charColor;
|
||||
u8 bgColor;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8* unk8;
|
||||
} struct_02036540;
|
||||
|
||||
extern u32 sub_08000E44(u32);
|
||||
extern void sub_080A3B74(void);
|
||||
extern s32 sub_080A3B48(void);
|
||||
@@ -32,9 +22,9 @@ extern void sub_0805ECEC(u32, u32, u32, u32);
|
||||
extern void sub_0801C2F0(u32, u32);
|
||||
extern void sub_0801E6C8(u32);
|
||||
extern void sub_0801E798(u32);
|
||||
extern struct_02036540* sub_0805F2C8(void);
|
||||
extern void sub_0805F300(struct_02036540*);
|
||||
extern u32 sub_0805F76C(u8*, struct_02036540*);
|
||||
extern WStruct* sub_0805F2C8(void);
|
||||
extern void sub_0805F300(WStruct*);
|
||||
extern u32 sub_0805F76C(u8*, WStruct*);
|
||||
|
||||
typedef struct {
|
||||
void* sourceAddress;
|
||||
@@ -55,7 +45,7 @@ extern const u8 gGlobalGfxAndPalettes[];
|
||||
extern u8 gTextGfxBuffer[];
|
||||
extern u8 gUnk_02002AC0[];
|
||||
|
||||
u32 sub_080A44E0(struct_02036540*, u8*, u32);
|
||||
u32 sub_080A44E0(WStruct*, u8*, u32);
|
||||
u32 sub_080A4418(u32, u32);
|
||||
u32 sub_080A43DC(u32);
|
||||
u32 sub_080A43A8(u32);
|
||||
@@ -74,6 +64,13 @@ Subtask KinstoneMenu_Type2;
|
||||
Subtask KinstoneMenu_Type3;
|
||||
Subtask KinstoneMenu_Type4;
|
||||
Subtask KinstoneMenu_Type5;
|
||||
|
||||
ASM_FUNC("asm/non_matching/menu/kinstone_menu/sub_080A3B48.inc", s32 sub_080A3B48(void))
|
||||
|
||||
void sub_080A3B74(void) {
|
||||
gKinstoneMenu.unk2f = 0;
|
||||
}
|
||||
|
||||
void Subtask_KinstoneMenu(void) {
|
||||
static Subtask* const kinstoneMenuTypes[] = {
|
||||
KinstoneMenu_Type0, KinstoneMenu_Type1, KinstoneMenu_Type2,
|
||||
@@ -594,7 +591,7 @@ void KinstoneMenu_080A4468(void) {
|
||||
}
|
||||
|
||||
u32 KinstoneMenu_080A4494(void) {
|
||||
struct_02036540* psVar1;
|
||||
WStruct* psVar1;
|
||||
u8* r1;
|
||||
u32 ret;
|
||||
|
||||
@@ -617,7 +614,7 @@ u32 KinstoneMenu_080A4494(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 sub_080A44E0(struct_02036540* param_1, u8* param_2, u32 param_3) {
|
||||
u32 sub_080A44E0(WStruct* param_1, u8* param_2, u32 param_3) {
|
||||
u32 uVar1;
|
||||
u32 size;
|
||||
|
||||
|
||||
+12
-12
@@ -31,17 +31,17 @@ enum {
|
||||
};
|
||||
|
||||
extern void WriteBit(u32*, u32);
|
||||
extern void sub_0805EF40(Token* tok, const u8*);
|
||||
extern bool32 sub_0805EF40(Token* tok, const u8*);
|
||||
extern void RecoverUI(u32 bottomPt, u32 topPt);
|
||||
extern void RefreshUI(void);
|
||||
extern void sub_0805F918(u32, u32, u32);
|
||||
extern void sub_0805F918(u32, u32, void*);
|
||||
extern u32 DecToHex(u32, u8*, u32);
|
||||
|
||||
u32 sub_08056FEC(u32, u8*);
|
||||
u32 GetCharacter(Token* tok);
|
||||
extern void sub_0805EEB4(Token* tok, u32 textIdx);
|
||||
u16 sub_0805F7DC(u32, u8*);
|
||||
u32 GetFontStrWith(u8*, u32);
|
||||
u32 sub_0805F7DC(u32, WStruct*);
|
||||
u32 GetFontStrWith(Token*, u32);
|
||||
|
||||
static void StatusUpdate(u32 status);
|
||||
|
||||
@@ -270,7 +270,7 @@ END_NONMATCH
|
||||
if (gTextRender.renderStatus == RENDER_INIT) {
|
||||
gTextRender.renderStatus = RENDER_UPDATE;
|
||||
gTextRender._98.bytes.b1 = 1;
|
||||
sub_08056F88(gTextRender.message.unk3, gTextRender._50.unk3);
|
||||
sub_08056F88(gTextRender.message.unk3, gTextRender._50.bgColor);
|
||||
SoundReq(SFX_TEXTBOX_OPEN);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ static u32 MsgUpdate(void) {
|
||||
}
|
||||
|
||||
static void TextDispInit(TextRender* this) {
|
||||
if ((gTextRender.curToken.flags & 1) == 0) {
|
||||
if (gTextRender.curToken.unk00 == 0) {
|
||||
if (gTextRender._98.bytes.b1 == 0) {
|
||||
StatusUpdate(MSG_DIE);
|
||||
}
|
||||
@@ -398,7 +398,7 @@ NONMATCH("asm/non_matching/textbox/RunTextCommand.inc", /*static*/ u16 RunTextCo
|
||||
StatusUpdate(MSG_CLOSE);
|
||||
break;
|
||||
case 4:
|
||||
this->_50.unk6 += (this->_50.unk4 - this->_50.unk6 - GetFontStrWith(&this->curToken.flags, 0)) / 2;
|
||||
this->_50.unk6 += (this->_50.unk4 - this->_50.unk6 - GetFontStrWith(&this->curToken, 0)) / 2;
|
||||
break;
|
||||
case 5:
|
||||
gMessage.unk = this->curToken.param;
|
||||
@@ -427,7 +427,7 @@ NONMATCH("asm/non_matching/textbox/RunTextCommand.inc", /*static*/ u16 RunTextCo
|
||||
break;
|
||||
case 9:
|
||||
gTextRender.message.unk3 = this->curToken.param;
|
||||
sub_08056F88(this->curToken.param, this->_50.unk3);
|
||||
sub_08056F88(this->curToken.param, this->_50.bgColor);
|
||||
break;
|
||||
case 10:
|
||||
this->message.textWindowPosY = this->curToken.param;
|
||||
@@ -488,14 +488,14 @@ NONMATCH("asm/non_matching/textbox/RunTextCommand.inc", /*static*/ u16 RunTextCo
|
||||
PaletteChange(this, palette);
|
||||
}
|
||||
}
|
||||
return sub_0805F7DC(chr, &this->_50.unk0);
|
||||
return sub_0805F7DC(chr, &this->_50);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
/*static*/ void PaletteChange(TextRender* this, u32 id) {
|
||||
u32 temp = id % 8;
|
||||
this->_8f = temp;
|
||||
this->_50.unk2 = temp;
|
||||
this->_50.charColor = temp;
|
||||
}
|
||||
|
||||
const u8 gUnk_08107C0F[] = { 0x8, 0x1e, 0x4, 0x12, 0x0 };
|
||||
@@ -813,12 +813,12 @@ void sub_08056F88(u32 unk_1, u32 unk_2) {
|
||||
uVar1 = unk_1 << 4 | unk_2;
|
||||
if (gTextRender._9c != uVar1) {
|
||||
gTextRender._9c = uVar1;
|
||||
sub_0805F918(unk_1, unk_2, 0x0600CF60);
|
||||
sub_0805F918(unk_1, unk_2, (void*)0x0600CF60);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08056FBC(TextRender* ctb) {
|
||||
sub_08056FEC(ctb->message.field_0x10, &ctb->_66[0x2]);
|
||||
sub_08056FEC(ctb->message.rupees, &ctb->_66[0x2]);
|
||||
sub_08056FEC(ctb->message.field_0x14, &ctb->_66[0xa]);
|
||||
sub_08056FEC(ctb->message.field_0x18, &ctb->_77[0x1]);
|
||||
sub_08056FEC(ctb->message.field_0x1c, &ctb->_77[0x9]);
|
||||
|
||||
+78
-104
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "area.h"
|
||||
@@ -6,38 +7,9 @@
|
||||
#include "asm.h"
|
||||
#include "item.h"
|
||||
#include "coord.h"
|
||||
#include "transitions.h"
|
||||
#include "functions.h"
|
||||
|
||||
/** Collisions. */
|
||||
typedef enum {
|
||||
COL_NONE = 0x0,
|
||||
COL_NORTH_WEST = 0x2,
|
||||
COL_NORTH_EAST = 0x4,
|
||||
COL_NORTH_FULL = 0x6,
|
||||
COL_NORTH_ANY = 0xe,
|
||||
COL_SOUTH_WEST = 0x20,
|
||||
COL_SOUTH_EAST = 0x40,
|
||||
COL_SOUTH_FULL = 0x60,
|
||||
COL_SOUTH_ANY = 0xe0,
|
||||
COL_WEST_SOUTH = 0x200,
|
||||
COL_WEST_NORTH = 0x400,
|
||||
COL_WEST_FULL = 0x600,
|
||||
COL_WEST_ANY = 0xe00,
|
||||
COL_EAST_SOUTH = 0x2000,
|
||||
COL_EAST_NORTH = 0x4000,
|
||||
COL_EAST_FULL = 0x6000,
|
||||
COL_EAST_ANY = 0xe000,
|
||||
} Collisions;
|
||||
|
||||
extern u8 gExitList_RoyalValley_ForestMaze[];
|
||||
extern u8 gUnk_08135190[];
|
||||
extern u8 gUnk_08134FBC[];
|
||||
extern u8 gUnk_08135048[];
|
||||
extern u8 gUnk_0813A76C[];
|
||||
|
||||
bool32 IsTileCollision(const u8*, s32, s32, u32);
|
||||
void CalculateEntityTileCollisions(Entity*, u32, u32);
|
||||
bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
|
||||
bool32 sub_080AF0C8(Entity*);
|
||||
|
||||
/** The type of the movement/collision? that is done. */
|
||||
@@ -117,7 +89,8 @@ bool32 TileCollisionFunction2(s32 x, s32 y) {
|
||||
0b1111111111111110,
|
||||
0b1111111111111111,
|
||||
*/
|
||||
32768, 49152, 57344, 61440, 63488, 64512, 65024, 65280, 65408, 65472, 65504, 65520, 65528, 65532, 65534, 65535,
|
||||
0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00,
|
||||
0xFF80, 0xFFC0, 0xFFE0, 0xFFF0, 0xFFF8, 0xFFFC, 0xFFFE, 0xFFFF,
|
||||
};
|
||||
|
||||
return gUnk_08133918[y & 0xf] >> (x & 0xf) & 1;
|
||||
@@ -127,24 +100,24 @@ bool32 TileCollisionFunction2(s32 x, s32 y) {
|
||||
bool32 TileCollisionFunction3(s32 x, s32 y) {
|
||||
static const u16 gUnk_08133938[] = {
|
||||
/*
|
||||
0b1,
|
||||
0b11,
|
||||
0b111,
|
||||
0b1111,
|
||||
0b11111,
|
||||
0b111111,
|
||||
0b1111111,
|
||||
0b11111111,
|
||||
0b111111111,
|
||||
0b1111111111,
|
||||
0b11111111111,
|
||||
0b111111111111,
|
||||
0b1111111111111,
|
||||
0b11111111111111,
|
||||
0b111111111111111,
|
||||
0b0000000000000001,
|
||||
0b0000000000000011,
|
||||
0b0000000000000111,
|
||||
0b0000000000001111,
|
||||
0b0000000000011111,
|
||||
0b0000000000111111,
|
||||
0b0000000001111111,
|
||||
0b0000000011111111,
|
||||
0b0000000111111111,
|
||||
0b0000001111111111,
|
||||
0b0000011111111111,
|
||||
0b0000111111111111,
|
||||
0b0001111111111111,
|
||||
0b0011111111111111,
|
||||
0b0111111111111111,
|
||||
0b1111111111111111,
|
||||
*/
|
||||
1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535,
|
||||
0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
|
||||
};
|
||||
return gUnk_08133938[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -170,7 +143,8 @@ bool32 TileCollisionFunction4(s32 x, s32 y) {
|
||||
0b1100000000000000,
|
||||
0b1000000000000000,
|
||||
*/
|
||||
65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768,
|
||||
0xFFFF, 0xFFFE, 0xFFFC, 0xFFF8, 0xFFF0, 0xFFE0, 0xFFC0, 0xFF80,
|
||||
0xFF00, 0xFE00, 0xFC00, 0xF800, 0xF000, 0xE000, 0xC000, 0x8000,
|
||||
};
|
||||
return gUnk_08133958[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -180,23 +154,23 @@ bool32 TileCollisionFunction5(s32 x, s32 y) {
|
||||
static const u16 gUnk_08133978[] = {
|
||||
/*
|
||||
0b1111111111111111,
|
||||
0b111111111111111,
|
||||
0b11111111111111,
|
||||
0b1111111111111,
|
||||
0b111111111111,
|
||||
0b11111111111,
|
||||
0b1111111111,
|
||||
0b111111111,
|
||||
0b11111111,
|
||||
0b1111111,
|
||||
0b111111,
|
||||
0b11111,
|
||||
0b1111,
|
||||
0b111,
|
||||
0b11,
|
||||
0b1,
|
||||
0b0111111111111111,
|
||||
0b0011111111111111,
|
||||
0b0001111111111111,
|
||||
0b0000111111111111,
|
||||
0b0000011111111111,
|
||||
0b0000001111111111,
|
||||
0b0000000111111111,
|
||||
0b0000000011111111,
|
||||
0b0000000001111111,
|
||||
0b0000000000111111,
|
||||
0b0000000000011111,
|
||||
0b0000000000001111,
|
||||
0b0000000000000111,
|
||||
0b0000000000000011,
|
||||
0b0000000000000001,
|
||||
*/
|
||||
65535, 32767, 16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1,
|
||||
0xFFFF, 0x7FFF, 0x3FFF, 0x1FFF, 0xFFF, 0x7FF, 0x3FF, 0x1FF, 0xFF, 0x7F, 0x3F, 0x1F, 0xF, 0x7, 0x3, 0x1,
|
||||
};
|
||||
return gUnk_08133978[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -215,14 +189,14 @@ bool32 TileCollisionFunction6(s32 x, s32 y) {
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
*/
|
||||
65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 0, 0, 0, 0, 0, 0,
|
||||
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
};
|
||||
|
||||
return gUnk_08133998[y & 0xf] >> (x & 0xf) & 1;
|
||||
@@ -232,12 +206,12 @@ bool32 TileCollisionFunction6(s32 x, s32 y) {
|
||||
bool32 TileCollisionFunction7(s32 x, s32 y) {
|
||||
static const u16 gUnk_081339B8[] = {
|
||||
/*
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
@@ -249,7 +223,7 @@ bool32 TileCollisionFunction7(s32 x, s32 y) {
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
*/
|
||||
0, 0, 0, 0, 0, 0, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
};
|
||||
return gUnk_081339B8[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -275,7 +249,8 @@ bool32 TileCollisionFunction8(s32 x, s32 y) {
|
||||
0b1111111111000000,
|
||||
0b1111111111000000,
|
||||
*/
|
||||
65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472, 65472,
|
||||
0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0,
|
||||
0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0,
|
||||
};
|
||||
return gUnk_081339D8[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -284,24 +259,24 @@ bool32 TileCollisionFunction8(s32 x, s32 y) {
|
||||
bool32 TileCollisionFunction9(s32 x, s32 y) {
|
||||
static const u16 gUnk_081339F8[] = {
|
||||
/*
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b[000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
0b0000001111111111,
|
||||
*/
|
||||
1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
|
||||
0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF,
|
||||
};
|
||||
return gUnk_081339F8[y & 0xf] >> (x & 0xf) & 1;
|
||||
}
|
||||
@@ -2269,28 +2244,27 @@ void ProcessMovementInternal2(Entity* this, u32 direction, u32 speed) {
|
||||
void sub_080AF250(s32 param_1) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
if (param_1 != 0) {
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08135190;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08135190;
|
||||
} else {
|
||||
(gArea.pCurrentRoomInfo)->exits = gExitList_RoyalValley_ForestMaze;
|
||||
gArea.pCurrentRoomInfo->exits = gExitList_RoyalValley_ForestMaze;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AF284(void) {
|
||||
if (CheckPlayerInRegion(0x78, gRoomControls.height - 0x50, 0x78, 0x50)) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08135048;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08135048;
|
||||
} else {
|
||||
if (GetInventoryValue(ITEM_FOURSWORD) == 0) {
|
||||
return;
|
||||
if (GetInventoryValue(ITEM_FOURSWORD) != 0) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_08134FBC;
|
||||
}
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_08134FBC;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AF2E4(void) {
|
||||
if (GetInventoryValue(ITEM_FOURSWORD)) {
|
||||
gArea.pCurrentRoomInfo = GetCurrentRoomInfo();
|
||||
(gArea.pCurrentRoomInfo)->exits = gUnk_0813A76C;
|
||||
gArea.pCurrentRoomInfo->exits = gUnk_0813A76C;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void sub_080675D4(Entity* this) {
|
||||
|
||||
for (i = 0; i < 9; i++, gUnk++) {
|
||||
Entity* ent = CreateFx(this, FX_DEATH, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI += gUnk->x;
|
||||
ent->y.HALF.HI += gUnk->y;
|
||||
ent->z.HALF.HI = subAction;
|
||||
@@ -140,7 +140,7 @@ void sub_080675D4(Entity* this) {
|
||||
gUnk = gUnk_08110E8A;
|
||||
for (i = 0; i < 4; i++, gUnk++) {
|
||||
Entity* ent = CreateFx(this, FX_ROCK, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI = gUnk->x + ent->x.HALF.HI;
|
||||
ent->y.HALF.HI = gUnk->y + ent->y.HALF.HI;
|
||||
ent->z.HALF.HI = subAction;
|
||||
|
||||
+5
-4
@@ -1,4 +1,5 @@
|
||||
#include "entity.h"
|
||||
#include "collision.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "item.h"
|
||||
@@ -143,17 +144,17 @@ void sub_08069D54(Entity* this) {
|
||||
|
||||
if (this->x.HALF.HI < this->field_0x6e.HWORD) {
|
||||
this->x.HALF.HI = this->field_0x6e.HWORD + 1;
|
||||
collisions = 0xe00;
|
||||
collisions = COL_WEST_ANY;
|
||||
} else if (this->x.HALF.HI > this->field_0x6c.HWORD) {
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD - 1;
|
||||
collisions = 0xe000;
|
||||
collisions = COL_EAST_ANY;
|
||||
}
|
||||
if (this->y.HALF.HI < this->field_0x70.HALF_U.LO) {
|
||||
this->y.HALF.HI = this->field_0x70.HALF_U.LO + 1;
|
||||
collisions = 0xe;
|
||||
collisions = COL_NORTH_ANY;
|
||||
} else if (this->y.HALF.HI > this->field_0x70.HALF_U.HI) {
|
||||
this->y.HALF.HI = this->field_0x70.HALF_U.HI - 1;
|
||||
collisions = 0xe0;
|
||||
collisions = COL_SOUTH_ANY;
|
||||
}
|
||||
sub_0800417E(this, collisions);
|
||||
sub_08069F6C(this);
|
||||
|
||||
@@ -77,7 +77,7 @@ void sub_08069654(Entity* this) {
|
||||
|
||||
void sub_08069660(Entity* this) {
|
||||
MessageNoOverlap(0x2c1c, this);
|
||||
gMessage.field_0x10 = (u16)GoronMerchant_GetSalePrice(this);
|
||||
gMessage.rupees = (u16)GoronMerchant_GetSalePrice(this);
|
||||
}
|
||||
|
||||
void sub_08069684(void) {
|
||||
|
||||
+43
-44
@@ -270,15 +270,18 @@ void sub_080627E8(Entity* this, ScriptExecutionContext* context) {
|
||||
RestorePrevTileEntity(0x64d, 1);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/kid/Kid_Head.inc", void Kid_Head(Entity* this)) {
|
||||
s32 iVar1;
|
||||
void Kid_Head(Entity* this) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
u32 uVar3;
|
||||
u32 uVar4;
|
||||
u32 uVar5;
|
||||
u8* ptr;
|
||||
|
||||
iVar1 = (u32)this->type * 4;
|
||||
uVar3 = ((u8)this->frame & 0x1f) + (u32)gUnk_0810C0A0[iVar1];
|
||||
uVar4 = (this->frameIndex & 0x1f) + (u32)gUnk_0810C0A0[iVar1 + 1];
|
||||
uVar1 = this->type * 4;
|
||||
ptr = &gUnk_0810C0A0[uVar1];
|
||||
uVar3 = ((u8)this->frame & 0x1f) + ptr[0];
|
||||
uVar4 = (this->frameIndex & 0x1f) + ptr[1];
|
||||
switch (this->type) {
|
||||
case 0:
|
||||
case 1:
|
||||
@@ -290,19 +293,20 @@ NONMATCH("asm/non_matching/kid/Kid_Head.inc", void Kid_Head(Entity* this)) {
|
||||
if (uVar2 != 0) {
|
||||
uVar2 = uVar2 + 0x50;
|
||||
}
|
||||
uVar2--;
|
||||
SetExtraSpriteFrame(this, 0, uVar3);
|
||||
SetExtraSpriteFrame(this, 1, uVar4);
|
||||
SetExtraSpriteFrame(this, 2, uVar2 - 1);
|
||||
SetExtraSpriteFrame(this, 2, uVar2);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
SetSpriteSubEntryOffsetData2(this, 1, 2);
|
||||
sub_0807000C(this);
|
||||
break;
|
||||
case 6:
|
||||
uVar2 = this->frameSpriteSettings & 0xf;
|
||||
uVar5 = this->frameSpriteSettings & 0xf;
|
||||
if ((this->frameSpriteSettings & 0xf) != 0) {
|
||||
uVar2 = uVar2 + 0x93;
|
||||
uVar5 = uVar5 + 0x93;
|
||||
}
|
||||
SetExtraSpriteFrame(this, 0, uVar2 - 1);
|
||||
SetExtraSpriteFrame(this, 0, uVar5 - 1);
|
||||
SetExtraSpriteFrame(this, 1, uVar3);
|
||||
SetExtraSpriteFrame(this, 2, uVar4);
|
||||
SetSpriteSubEntryOffsetData1(this, 2, 1);
|
||||
@@ -320,10 +324,9 @@ NONMATCH("asm/non_matching/kid/Kid_Head.inc", void Kid_Head(Entity* this)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/kid/sub_08062948.inc", void sub_08062948(Entity* this, ScriptExecutionContext* context)) {
|
||||
u8 bVar1;
|
||||
void sub_08062948(Entity* this, ScriptExecutionContext* context) {
|
||||
s32 bVar1;
|
||||
u16 uVar2;
|
||||
u32 uVar3;
|
||||
s32 iVar4;
|
||||
@@ -332,64 +335,60 @@ NONMATCH("asm/non_matching/kid/sub_08062948.inc", void sub_08062948(Entity* this
|
||||
context->unk_18 += 1;
|
||||
context->unk_12 = (Random() & 0x3f) + 0x20;
|
||||
uVar3 = Random() & 0x18;
|
||||
bVar1 = this->direction;
|
||||
if (bVar1 != 8) {
|
||||
if (bVar1 >= 9) {
|
||||
if (bVar1 == 0x10) {
|
||||
if (uVar3 == 0) {
|
||||
uVar3 = 0x18;
|
||||
}
|
||||
} else {
|
||||
if ((bVar1 == 0x18) && (uVar3 == 8)) {
|
||||
uVar3 = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((bVar1 == 0) && (uVar3 == 0x10)) {
|
||||
switch (this->direction) {
|
||||
case 0:
|
||||
if (uVar3 == 0x10) {
|
||||
uVar3 = 8;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (uVar3 == 0x18) {
|
||||
uVar3 = 0x10;
|
||||
}
|
||||
break;
|
||||
case 0x8:
|
||||
if (uVar3 == 0x18) {
|
||||
uVar3 = 0x10;
|
||||
}
|
||||
break;
|
||||
case 0x10:
|
||||
if (uVar3 == 0) {
|
||||
uVar3 = 0x18;
|
||||
}
|
||||
break;
|
||||
case 0x18:
|
||||
if ((uVar3 == 8)) {
|
||||
uVar3 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this->direction = (u8)uVar3;
|
||||
uVar3 = sub_0806F5B0(uVar3);
|
||||
this->animationState = (u8)uVar3;
|
||||
this->animationState = sub_0806F5B0(uVar3);
|
||||
this->speed = 0x80;
|
||||
}
|
||||
uVar3 = (this->animationState >> 1) + 4;
|
||||
if (uVar3 != this->animIndex) {
|
||||
InitializeAnimation(this, uVar3);
|
||||
this->field_0x80.HALF.LO = (u16)this->animIndex;
|
||||
this->field_0x80.HWORD = (u16)this->animIndex;
|
||||
}
|
||||
ProcessMovement0(this);
|
||||
iVar4 = this->x.HALF.HI - this->field_0x6c.HALF.LO;
|
||||
iVar4 = this->x.HALF.HI - (s16)this->field_0x6c.HWORD;
|
||||
if (0x10 < iVar4) {
|
||||
this->x.HALF.HI = this->field_0x6c.HALF.LO + 0x10;
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->x.HALF.HI = this->field_0x6c.HALF.LO + -0x10;
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
iVar4 = this->y.HALF.HI - this->field_0x6e.HALF.LO;
|
||||
iVar4 = this->y.HALF.HI - (s16)this->field_0x6e.HWORD;
|
||||
if (0x10 < iVar4) {
|
||||
this->y.HALF.HI = this->field_0x6e.HALF.LO + 0x10;
|
||||
this->y.HALF.HI = this->field_0x6e.HWORD + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->y.HALF.HI = this->field_0x6e.HALF.LO + -0x10;
|
||||
this->y.HALF.HI = this->field_0x6e.HWORD - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
uVar2 = context->unk_12 - 1;
|
||||
context->unk_12 = uVar2;
|
||||
if (uVar2 != 0) {
|
||||
if (--context->unk_12 != 0) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08062A48(Entity* this, ScriptExecutionContext* context) {
|
||||
this->field_0x6a.HALF.LO = sub_0801E99C(this);
|
||||
|
||||
@@ -12,7 +12,7 @@ void sub_0806EABC(Entity* this);
|
||||
void sub_0806EABC(Entity* this, u32 param);
|
||||
#endif
|
||||
|
||||
extern u32 gUnk_081146B8;
|
||||
extern Font gUnk_081146B8;
|
||||
extern s8 gUnk_081145E4[];
|
||||
|
||||
void Phonograph(Entity* this) {
|
||||
|
||||
@@ -175,7 +175,7 @@ void sub_0806E140(PicolyteBottleEntity* this, ScriptExecutionContext* context) {
|
||||
MessageFromTarget(0x421b);
|
||||
} else {
|
||||
MessageFromTarget(0x4218);
|
||||
gMessage.field_0x10 = this->unk76;
|
||||
gMessage.rupees = this->unk76;
|
||||
}
|
||||
} else {
|
||||
context->condition = 0;
|
||||
@@ -201,7 +201,7 @@ void sub_0806E1FC(PicolyteBottleEntity* this) {
|
||||
void sub_0806E20C(void) {
|
||||
if (gRoomTransition.field_0x6 != 0) {
|
||||
MessageFromTarget(0x421f);
|
||||
gMessage.field_0x10 = gRoomTransition.field_0x6;
|
||||
gMessage.rupees = gRoomTransition.field_0x6;
|
||||
} else {
|
||||
MessageFromTarget(0x4220);
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ void sub_080650CC(Entity* this) {
|
||||
MessageNoOverlap(confirmMsgId, this);
|
||||
|
||||
//! @bug itemPrice (r8) is not initialized if gRoomVars.shopItemType == 0
|
||||
gMessage.field_0x10 = (u16)itemPrice;
|
||||
gMessage.rupees = (u16)itemPrice;
|
||||
} else if ((this->frame & 0x40)) {
|
||||
InitializeAnimation(this, gUnk_0810FDB8[Random() & 0xf]);
|
||||
} else {
|
||||
|
||||
@@ -117,7 +117,7 @@ void sub_08064EE8(Entity* this) {
|
||||
}
|
||||
|
||||
fxEnt = CreateFx(this, confettiFx, 0);
|
||||
if (fxEnt && bVar1 == 2) {
|
||||
if ((fxEnt != NULL) && (bVar1 == 2)) {
|
||||
fxEnt->spriteSettings.flipX = 1;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
MessageNoOverlap(TingleSiblings_MessageIndices[this->type][uVar5], this);
|
||||
if (iVar4 > 0) {
|
||||
gMessage.field_0x10 = (u16)iVar4;
|
||||
gMessage.rupees = (u16)iVar4;
|
||||
}
|
||||
|
||||
if (CheckRoomFlag(roomFlag) == 0) {
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ u32 sub_0806EE20(Entity* ent) {
|
||||
u32 v3;
|
||||
|
||||
if (!ent->interactType) {
|
||||
if (ent->child)
|
||||
if (ent->child != NULL)
|
||||
return gUnk_08114EFC[ent->field_0x16](ent);
|
||||
} else {
|
||||
ent->knockbackSpeed = 8;
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ void (*const gObjectFunctions[])(Entity*) = {
|
||||
[OBJECT_B6] = ObjectB6,
|
||||
[WELL] = Well,
|
||||
[WIND_TRIBE_TELEPORTER] = WindTribeTeleporter,
|
||||
[OBJECT_B9] = ObjectB9,
|
||||
[CUCCO_MINIGAME] = ObjectB9,
|
||||
[GYORG_BOSS_OBJECT] = GyorgBossObject,
|
||||
[WINDCREST] = Windcrest,
|
||||
[LIT_AREA] = LitArea,
|
||||
|
||||
@@ -22,7 +22,7 @@ void sub_0809CC74(Entity* this) {
|
||||
/* Create steam clouds */
|
||||
for (i = 0; i < 3; i++) {
|
||||
ent = CreateObject(BAKER_OVEN, 1, i);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void sub_08088BE0(BigBarrelEntity* this) {
|
||||
if (CheckLocalFlag(0x15) == 0) {
|
||||
sub_08088C78(this, 2, 0, 0xffffff88);
|
||||
ent = sub_08088C78(this, 4, 0x15, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI = gRoomControls.origin_x + 0x48;
|
||||
ent->y.HALF.HI = gRoomControls.origin_y + 200;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void sub_08088BE0(BigBarrelEntity* this) {
|
||||
if (CheckLocalFlag(0x16) == 0) {
|
||||
sub_08088C78(this, 2, 1, 0x78);
|
||||
ent = sub_08088C78(this, 4, 0x16, 0);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI = gRoomControls.origin_x + 0x188;
|
||||
ent->y.HALF.HI = gRoomControls.origin_y + 200;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ void sub_08088E74(BigBarrelEntity* this) {
|
||||
} else {
|
||||
if ((gRoomTransition.frameCount & 7U) == 0) {
|
||||
ent = CreateObjectWithParent(super, OBJECT_2A, 0, 0x1e);
|
||||
if (ent) {
|
||||
if (ent != NULL) {
|
||||
ent->updatePriority = 3;
|
||||
ent->spriteRendering.b3 = 0;
|
||||
ent->spritePriority.b0 = 0;
|
||||
|
||||
+281
-24
@@ -2,22 +2,45 @@
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "message.h"
|
||||
#include "game.h"
|
||||
|
||||
extern void (*const gUnk_08123EC0[])(Entity*);
|
||||
extern void (*const gUnk_08123EEC[])(Entity*);
|
||||
extern void (*const gUnk_08123EF4[])(Entity*);
|
||||
extern void (*const gUnk_08123EFC[])(Entity*);
|
||||
extern void (*const gUnk_08123F04[])(Entity*);
|
||||
extern u16 script_EzloTalkOcarina[];
|
||||
|
||||
void Bird_Type0(Entity*);
|
||||
void Bird_Type1(Entity*);
|
||||
void Bird_Type2(Entity*);
|
||||
void Bird_Type3(Entity*);
|
||||
void Bird_Type8(Entity*);
|
||||
void Bird_Type9(Entity*);
|
||||
void Bird_Type10(Entity*);
|
||||
void Bird_Type0_Init(Entity*);
|
||||
void Bird_Type0_Action1(Entity*);
|
||||
void Bird_Type1_Init(Entity*);
|
||||
void Bird_Type1_Action1(Entity*);
|
||||
void Bird_Type1_Action1_Subaction0(Entity*);
|
||||
void Bird_Type1_Action1_Subaction1(Entity*);
|
||||
void Bird_Type2_Init(Entity*);
|
||||
void Bird_Type2_Action1(Entity*);
|
||||
|
||||
void Bird(Entity* this) {
|
||||
gUnk_08123EC0[this->type](this);
|
||||
static void (*const typeFuncs[])(Entity*) = {
|
||||
Bird_Type0, Bird_Type1, Bird_Type2, Bird_Type3, Bird_Type3, Bird_Type3,
|
||||
Bird_Type3, Bird_Type3, Bird_Type8, Bird_Type9, Bird_Type10,
|
||||
};
|
||||
typeFuncs[this->type](this);
|
||||
}
|
||||
|
||||
void sub_0809CF3C(Entity* this) {
|
||||
gUnk_08123EEC[this->action](this);
|
||||
void Bird_Type0(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
Bird_Type0_Init,
|
||||
Bird_Type0_Action1,
|
||||
};
|
||||
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809CF54(Entity* this) {
|
||||
void Bird_Type0_Init(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
this->action++;
|
||||
@@ -42,8 +65,7 @@ void sub_0809CF54(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CFEC(Entity* this) {
|
||||
|
||||
void Bird_Type0_Action1(Entity* this) {
|
||||
LinearMoveUpdate(this);
|
||||
GravityUpdate(this, *(s16*)&this->field_0x68.HWORD);
|
||||
if (this->actionDelay != 0) {
|
||||
@@ -56,22 +78,30 @@ void sub_0809CFEC(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0809D030(Entity* this) {
|
||||
gUnk_08123EF4[this->action](this);
|
||||
void Bird_Type1(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
Bird_Type1_Init,
|
||||
Bird_Type1_Action1,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809D048(Entity* this) {
|
||||
void Bird_Type1_Init(Entity* this) {
|
||||
this->action++;
|
||||
this->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
InitAnimationForceUpdate(this, 0x17);
|
||||
}
|
||||
|
||||
void sub_0809D06C(Entity* this) {
|
||||
gUnk_08123EFC[this->subAction](this);
|
||||
void Bird_Type1_Action1(Entity* this) {
|
||||
static void (*const subActionFuncs[])(Entity*) = {
|
||||
Bird_Type1_Action1_Subaction0,
|
||||
Bird_Type1_Action1_Subaction1,
|
||||
};
|
||||
subActionFuncs[this->subAction](this);
|
||||
}
|
||||
|
||||
void sub_0809D084(Entity* this) {
|
||||
void Bird_Type1_Action1_Subaction0(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (this->parent != NULL) {
|
||||
@@ -85,7 +115,7 @@ void sub_0809D084(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809D0AC(Entity* this) {
|
||||
void Bird_Type1_Action1_Subaction1(Entity* this) {
|
||||
Entity* fx;
|
||||
|
||||
if (sub_080044EC(this, 0x1800) < 2) {
|
||||
@@ -102,28 +132,32 @@ void sub_0809D0AC(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809D0F4(Entity* this) {
|
||||
gUnk_08123F04[this->action](this);
|
||||
void Bird_Type2(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
Bird_Type2_Init,
|
||||
Bird_Type2_Action1,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809D10C(Entity* this) {
|
||||
void Bird_Type2_Init(Entity* this) {
|
||||
this->action++;
|
||||
this->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
InitAnimationForceUpdate(this, 0x17);
|
||||
}
|
||||
|
||||
void sub_0809D130(Entity* this) {
|
||||
void Bird_Type2_Action1(Entity* this) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
sub_0800445C(this);
|
||||
} else if (IsCollidingPlayer(this) != 0) {
|
||||
CreateItemEntity(0x17, 0, 0);
|
||||
CreateItemEntity(ITEM_OCARINA, 0, 0);
|
||||
gSave.windcrests |= 0x10000000;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809D178(Entity* this) {
|
||||
void Bird_Type3(Entity* this) {
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
@@ -131,6 +165,7 @@ void sub_0809D178(Entity* this) {
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
this->frame = 0x80;
|
||||
}
|
||||
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
InitializeAnimation(this, Random() & 3);
|
||||
this->frameDuration = (Random() & 0xf) + 0x10;
|
||||
@@ -142,3 +177,225 @@ void sub_0809D178(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Bird_Type8(Entity* this) {
|
||||
Entity* pEVar5;
|
||||
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (this->actionDelay != 0) {
|
||||
this->frameIndex = 0xff;
|
||||
this->actionDelay--;
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
this->zVelocity = 0;
|
||||
this->z.WORD = Q_16_16(-20.0);
|
||||
this->speed = 0x180;
|
||||
this->direction = 8;
|
||||
this->collisionLayer = 1;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteRendering.b3 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->x.HALF.HI = gRoomControls.scroll_x;
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
this->child = NULL;
|
||||
SetDefaultPriority(this, 6);
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
SoundReq(0x123);
|
||||
break;
|
||||
case 1:
|
||||
this->collisionLayer = gPlayerEntity.collisionLayer;
|
||||
this->speed += 8;
|
||||
if (this->speed > 0x300) {
|
||||
this->speed = 0x300;
|
||||
}
|
||||
|
||||
if ((gPlayerEntity.flags & 0x80) != 0 && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != 28 &&
|
||||
gPlayerEntity.action != 6 && gPlayerEntity.action != 9 && gPlayerState.framestate != 24 &&
|
||||
gPlayerState.framestate != 11 && gPlayerState.framestate != 8 && sub_08079F8C() &&
|
||||
(EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) {
|
||||
s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8;
|
||||
if ((u16)z < 0x20 && gPlayerEntity.health != 0) {
|
||||
pEVar5 = CreateObject(0x95, 10, 0);
|
||||
if (pEVar5 != NULL) {
|
||||
this->child = pEVar5;
|
||||
this->action = 2;
|
||||
this->actionDelay = 8;
|
||||
this->speed = 0x300;
|
||||
this->field_0x68.HWORD = 0xe000;
|
||||
sub_08079184();
|
||||
sub_08078B48();
|
||||
ResetPlayerAnimationAndAction();
|
||||
sub_08077B20();
|
||||
gPlayerState.swim_state = 0;
|
||||
gPlayerState.jump_status = 0;
|
||||
gPlayerEntity.flags &= 0x7f;
|
||||
gPlayerEntity.spriteSettings.draw = 0;
|
||||
gPriorityHandler.sys_priority = 6;
|
||||
gUnk_02034490.unk0 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sub_08078B48();
|
||||
gPlayerEntity.spriteSettings.draw = 0;
|
||||
break;
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
GravityUpdate(this, (s16)this->field_0x68.HWORD);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
pEVar5 = this->child;
|
||||
if (pEVar5 != NULL) {
|
||||
if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI - 8) {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
|
||||
if (this->actionDelay == 0) {
|
||||
PositionRelative(this, pEVar5, 0xfff80000, 0);
|
||||
pEVar5->z.HALF.HI += 0x18;
|
||||
pEVar5->spritePriority.b0 = this->spritePriority.b0;
|
||||
pEVar5->spriteRendering.b3 = this->spriteRendering.b3;
|
||||
pEVar5->spriteOrientation.flipY = this->spriteOrientation.flipY;
|
||||
} else {
|
||||
this->actionDelay--;
|
||||
CopyPosition(&gPlayerEntity, pEVar5);
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckOnScreen(this) == 0) {
|
||||
if (this->action == 2) {
|
||||
gSave.windcrests |= 0x10000000;
|
||||
MenuFadeIn(9, 0);
|
||||
}
|
||||
pEVar5 = this->child;
|
||||
if (pEVar5 != NULL) {
|
||||
DeleteEntityAny(pEVar5);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void Bird_Type9(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
Entity* child;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->zVelocity = -0x28000;
|
||||
this->z.WORD = 0xffb4c000;
|
||||
this->field_0x68.HWORD = 0xf000;
|
||||
this->speed = 0x300;
|
||||
this->direction = 8;
|
||||
this->collisionLayer = 1;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteRendering.b3 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
;
|
||||
SetDefaultPriority(this, 6);
|
||||
this->x.HALF.HI = gRoomControls.scroll_x;
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
SoundReq(SFX_123);
|
||||
this->spritePriority.b1 = 2;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
sub_08078B48();
|
||||
} else if (this->action == 1) {
|
||||
gPlayerEntity.spriteSettings.draw = 0;
|
||||
child = this->child;
|
||||
if (child != NULL) {
|
||||
PositionRelative(this, child, Q_16_16(-8), 0);
|
||||
child->z.HALF.HI += 0x18;
|
||||
child->spritePriority.b0 = this->spritePriority.b0;
|
||||
child->spriteRendering.b3 = this->spriteRendering.b3;
|
||||
child->spriteOrientation.flipY = this->spriteOrientation.flipY;
|
||||
}
|
||||
sub_08078B48();
|
||||
if (gRoomControls.scroll_x + 0x78 < this->x.HALF.HI) {
|
||||
this->action++;
|
||||
this->spritePriority.b1 = 1;
|
||||
if (child != NULL) {
|
||||
child->action++;
|
||||
}
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
gPlayerEntity.spriteSettings.draw = 1;
|
||||
ResetPlayerAnimationAndAction();
|
||||
ResetPlayerEventPriority();
|
||||
gUnk_02034490.unk0 = 0;
|
||||
if (!CheckGlobalFlag(WARP_1ST)) {
|
||||
pEVar1 = CreateObject(OBJECT_69, 0, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
*(ScriptExecutionContext**)&pEVar1->cutsceneBeh = StartCutscene(pEVar1, script_EzloTalkOcarina);
|
||||
SetGlobalFlag(WARP_1ST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
GravityUpdate(this, (short)this->field_0x68.HWORD);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (!CheckOnScreen(this)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void Bird_Type10(Entity* this) {
|
||||
this->palette.b.b0 = gPlayerEntity.palette.b.b0;
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->collisionLayer = 1;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteRendering.b3 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
SetDefaultPriority(this, 6);
|
||||
InitAnimationForceUpdate(this, 0xe0);
|
||||
case 1:
|
||||
UpdateAnimationSingleFrame(this);
|
||||
break;
|
||||
case 2:
|
||||
this->action = 3;
|
||||
break;
|
||||
case 3:
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateBird(void) {
|
||||
Entity* birdEnt;
|
||||
|
||||
#ifndef EU
|
||||
if (AreaAllowsWarp()) {
|
||||
#else
|
||||
if (AreaIsOverworld()) {
|
||||
#endif
|
||||
if (!FindEntity(OBJECT, BIRD, 6, 8, 0)) {
|
||||
birdEnt = CreateObject(BIRD, 8, 0);
|
||||
if (birdEnt != NULL) {
|
||||
birdEnt->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809D738(void) {
|
||||
Entity* pEVar1;
|
||||
Entity* pEVar2;
|
||||
|
||||
pEVar1 = CreateObject(BIRD, 9, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
gRoomControls.camera_target = NULL;
|
||||
SetDefaultPriority(pEVar1, 6);
|
||||
SetPlayerEventPriority();
|
||||
pEVar2 = CreateObject(BIRD, 10, 0);
|
||||
if (pEVar2 != NULL) {
|
||||
pEVar1->child = pEVar2;
|
||||
}
|
||||
gUnk_02034490.unk0 = 1;
|
||||
} else {
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
}
|
||||
|
||||
+21
-25
@@ -15,11 +15,9 @@ void Book(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0809B3C4(Entity* this) {
|
||||
u32 obtained;
|
||||
|
||||
obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
|
||||
u32 obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
|
||||
if (this->type2 != 3) {
|
||||
if (obtained) {
|
||||
if (obtained != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
@@ -42,7 +40,7 @@ void sub_0809B3C4(Entity* this) {
|
||||
}
|
||||
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
InitAnimationForceUpdate(this, this->type + 0x39);
|
||||
InitAnimationForceUpdate(this, this->type + ITEM_QST_BOOK1);
|
||||
|
||||
switch (this->type2) {
|
||||
case 0:
|
||||
@@ -55,22 +53,23 @@ void sub_0809B3C4(Entity* this) {
|
||||
case 1: {
|
||||
u32 scroll;
|
||||
u32 height;
|
||||
|
||||
this->action = 3;
|
||||
scroll = (u16)gRoomControls.scroll_y - 0x10;
|
||||
height = (u16)this->y.HALF.HI - scroll;
|
||||
this->z.HALF.HI -= height;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
this->action = 4;
|
||||
return;
|
||||
break;
|
||||
case 3:
|
||||
this->action = 5;
|
||||
this->subAction = 0;
|
||||
this->spritePriority.b0 = 3;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,10 +88,10 @@ void sub_0809B4A8(Entity* this) {
|
||||
|
||||
this->action = 2;
|
||||
this->actionDelay = 30;
|
||||
this->speed = 64;
|
||||
this->direction = 16;
|
||||
this->speed = 0x40;
|
||||
this->direction = 0x10;
|
||||
|
||||
gPlayerState.pushedObject = 0x9e;
|
||||
gPlayerState.pushedObject = TREE_THORNS;
|
||||
gPlayerState.queued_action = PLAYER_PUSH;
|
||||
gPlayerState.flags |= PL_BUSY;
|
||||
|
||||
@@ -101,7 +100,7 @@ void sub_0809B4A8(Entity* this) {
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
EnqueueSFX(SFX_10F);
|
||||
} else {
|
||||
this->actionDelay = 0x16;
|
||||
this->actionDelay = 22;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,12 +108,12 @@ void sub_0809B524(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 3;
|
||||
this->y.HALF.HI += 32;
|
||||
this->z.HALF.HI -= 32;
|
||||
this->y.HALF.HI += 0x20;
|
||||
this->z.HALF.HI -= 0x20;
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->actionDelay = 22;
|
||||
this->field_0x80.HALF.LO = 24;
|
||||
this->field_0x80.HALF.LO = 0x18;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ void sub_0809B56C(Entity* this) {
|
||||
SetFlag(this->field_0x86.HWORD);
|
||||
|
||||
fx = CreateFx(this, FX_DEATH, 0);
|
||||
if (fx) {
|
||||
if (fx != NULL) {
|
||||
SortEntityAbove(this, fx);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +142,7 @@ void sub_0809B5B4(Entity* this) {
|
||||
if (gPlayerState.flags & PL_MINISH) {
|
||||
sub_0800445C(this);
|
||||
} else if (IsCollidingPlayer(this)) {
|
||||
CreateItemEntity(this->type + 0x39, 0, 0);
|
||||
CreateItemEntity(this->type + ITEM_QST_BOOK1, 0, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -152,9 +151,8 @@ void sub_0809B5EC(Entity* this) {
|
||||
if (this->spriteSettings.draw == 1) {
|
||||
switch (this->subAction) {
|
||||
case 0: {
|
||||
Entity* parent;
|
||||
parent = FindEntityByID(NPC, STURGEON, 7);
|
||||
if (!parent) {
|
||||
Entity* parent = FindEntityByID(NPC, STURGEON, 7);
|
||||
if (parent == NULL) {
|
||||
return;
|
||||
}
|
||||
if (parent->x.HALF.HI < this->x.HALF.HI) {
|
||||
@@ -170,7 +168,7 @@ void sub_0809B5EC(Entity* this) {
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (!this->parent || !this->parent->next) {
|
||||
if ((this->parent == NULL) || (this->parent->next == NULL)) {
|
||||
DeleteThisEntity();
|
||||
return;
|
||||
}
|
||||
@@ -206,9 +204,8 @@ void sub_0809B5EC(Entity* this) {
|
||||
}
|
||||
|
||||
u32 sub_0809B688(Entity* this) {
|
||||
u32 ret;
|
||||
u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
|
||||
|
||||
ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
|
||||
if (ret == 1 && gPlayerState.field_0xd != 16) {
|
||||
ret = 0;
|
||||
}
|
||||
@@ -217,8 +214,7 @@ u32 sub_0809B688(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0809B6B0(Entity* parent, Entity* this) {
|
||||
s32 offset;
|
||||
offset = (s32)gUnk_08123D94[parent->animationState >> 1] << 16;
|
||||
s32 offset = (s32)gUnk_08123D94[parent->animationState >> 1] << 16;
|
||||
|
||||
PositionRelative(parent, this, 0, offset);
|
||||
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
|
||||
if (this->actionDelay == 0)
|
||||
return 1;
|
||||
if (--this->actionDelay > 6) {
|
||||
if (this->child)
|
||||
if (this->child != NULL)
|
||||
this->child->spriteOffsetY = -4;
|
||||
} else {
|
||||
if (this->actionDelay == 6) {
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "script.h"
|
||||
#include "npc.h"
|
||||
#include "fileselect.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "enemy.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
s16 unk68;
|
||||
s16 unk6a;
|
||||
s16 unk6c;
|
||||
u16 unk6e;
|
||||
u8 unk70[0x18];
|
||||
} ObjectB9Entity;
|
||||
|
||||
typedef Entity* ObjectB9Heap[10];
|
||||
|
||||
u32 sub_080A1514();
|
||||
|
||||
const u16 gUnk_08124C20[] = {
|
||||
25, 0x2, 25, 0x3, 30, 0x4, 45, 0x5, 50, 0x5, 45, 0x5, 50, 0x6, 60, 0x7, 55, 0x2, 55, 0x3,
|
||||
};
|
||||
|
||||
static const u16 pObjectB9_MinigameCuccoDefs[][30] = {
|
||||
{ 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
|
||||
0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
|
||||
0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
|
||||
{ 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
|
||||
0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
|
||||
0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
|
||||
{ 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
|
||||
0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
|
||||
0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
|
||||
{
|
||||
0x0002, 0x02F6, 0x0346, 0x0001, 0x0266, 0x033C, 0x0001, 0x0319, 0x0296, 0x0001,
|
||||
0x0284, 0x0284, 0x0002, 0x0216, 0x0284, 0x0001, 0x0142, 0x0330, 0x0002, 0x0179,
|
||||
0x039F, 0x0001, 0x03A6, 0x0280, 0x0001, 0x039A, 0x015D, 0x0001, 0x031E, 0x01E5,
|
||||
},
|
||||
{ 0x0001, 0x0296, 0x0314, 0x0001, 0x02E6, 0x0231, 0x0001, 0x0254, 0x0290, 0x0001,
|
||||
0x01F8, 0x0325, 0x0001, 0x0185, 0x0367, 0x0001, 0x0320, 0x01D6, 0x0002, 0x01F8,
|
||||
0x0287, 0x0002, 0x029D, 0x01B1, 0x0002, 0x01F9, 0x022D, 0x0002, 0x0114, 0x0321 },
|
||||
{ 0x0002, 0x02F6, 0x0346, 0x0001, 0x0266, 0x033C, 0x0001, 0x0319, 0x0296, 0x0001,
|
||||
0x0284, 0x0284, 0x0002, 0x0216, 0x0284, 0x0001, 0x0142, 0x0330, 0x0002, 0x0179,
|
||||
0x039F, 0x0002, 0x022D, 0x01CB, 0x0001, 0x039A, 0x015D, 0x0001, 0x031E, 0x01E5 },
|
||||
{ 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
|
||||
0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
|
||||
0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
|
||||
{ 0x0001, 0x02E9, 0x0318, 0x0002, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
|
||||
0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321,
|
||||
0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0002, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC },
|
||||
{ 0x0001, 0x004D, 0x00F3, 0x0001, 0x011A, 0x0247, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
|
||||
{ 0x0001, 0x0051, 0x0328, 0x0002, 0x0114, 0x0321, 0x0002, 0x0332, 0x0248, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }
|
||||
};
|
||||
|
||||
static const u8 gUnk_08124EA0[] = { 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x14, 0x01, 0x00, 0x3F, 0x14,
|
||||
0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x5C, 0x6E, 0x01, 0x00,
|
||||
0x5C, 0x6F, 0x01, 0x00, 0x5C, 0x70, 0x01, 0x00, 0x63, 0x00, 0x01, 0x00 };
|
||||
|
||||
static const u16 CuccoMinigame_Sounds[] = { SFX_VO_CUCCO5, SFX_VO_CUCCO_CALL };
|
||||
|
||||
static const u8 CuccoMinigameRupees[] = { 0, 10, 50, 0 };
|
||||
|
||||
void ObjectB9(ObjectB9Entity* this) {
|
||||
int index;
|
||||
u32 val;
|
||||
u8* puVar2;
|
||||
const u16* ptr;
|
||||
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
ptr = gUnk_08124C20 + sub_080A1514() * 2;
|
||||
this->unk68 = ptr[0] * 0x3c;
|
||||
this->unk6a = 0;
|
||||
this->unk6c = ptr[1];
|
||||
this->unk6e = 1;
|
||||
|
||||
for (puVar2 = this->unk70, val = 0, index = 9; index >= 0; index--) {
|
||||
*puVar2++ = val;
|
||||
}
|
||||
sub_0807DD64(super);
|
||||
sub_0806EC20(super);
|
||||
}
|
||||
sub_0807DD94(super, 0);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(ObjectB9Entity* this)) {
|
||||
s32 iVar1;
|
||||
int iVar2;
|
||||
s32 iVar4;
|
||||
s32 sVar6;
|
||||
int iVar7;
|
||||
s8* ptr;
|
||||
s32 val;
|
||||
Entity* pEnt;
|
||||
Entity** entArray;
|
||||
|
||||
sVar6 = 0;
|
||||
entArray = ((Entity**)super->myHeap);
|
||||
ptr = this->unk70;
|
||||
iVar1 = (gRoomControls.origin_x + 0x360);
|
||||
iVar4 = (gRoomControls.origin_y + 0x350);
|
||||
iVar1 = (iVar1 << 16) >> 16;
|
||||
iVar4 = (iVar4 << 16) >> 16;
|
||||
val = -1;
|
||||
|
||||
for (iVar7 = 0; iVar7 < 9; iVar7++) {
|
||||
pEnt = entArray[iVar7];
|
||||
if (((s8*)ptr)[iVar7] == 0) {
|
||||
if (pEnt->next != NULL && pEnt != NULL) {
|
||||
if ((iVar1 <= pEnt->x.HALF.HI) && (iVar4 <= pEnt->y.HALF.HI)) {
|
||||
ptr[iVar7] = pEnt->type + 1;
|
||||
pEnt->type2 = 1;
|
||||
sVar6++;
|
||||
SoundReq(CuccoMinigame_Sounds[pEnt->type]);
|
||||
}
|
||||
} else {
|
||||
((s8*)ptr)[iVar7] = val;
|
||||
}
|
||||
} else if (0 < (s8)ptr[iVar7]) {
|
||||
sVar6++;
|
||||
if (pEnt->next != NULL && pEnt != NULL) {
|
||||
iVar2 = iVar1 + 4;
|
||||
if (iVar2 > pEnt->x.HALF.HI) {
|
||||
pEnt->x.HALF.HI = iVar2;
|
||||
}
|
||||
iVar2 = iVar4 + 4;
|
||||
if (iVar2 > pEnt->y.HALF.HI) {
|
||||
pEnt->y.HALF.HI = iVar2;
|
||||
}
|
||||
} else {
|
||||
((s8*)ptr)[iVar7] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->unk6a = sVar6;
|
||||
gPlayerState.field_0x27[0] = 0xff;
|
||||
if (--this->unk68 < 1) {
|
||||
SoundReq(SFX_CUCCO_MINIGAME_BELL);
|
||||
sub_08050384();
|
||||
} else {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void CuccoMinigame_Cleanup(ObjectB9Entity* this) {
|
||||
Entity** puVar1;
|
||||
s8* pcVar2;
|
||||
int index;
|
||||
|
||||
pcVar2 = this->unk70;
|
||||
puVar1 = super->myHeap;
|
||||
|
||||
for (index = 9; index >= 0; index--, pcVar2++, puVar1++) {
|
||||
Entity* pEnt = *puVar1;
|
||||
if (*pcVar2 >= 0 && pEnt != NULL) {
|
||||
DeleteEntityAny(pEnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A13B4(ObjectB9Entity* this, ScriptExecutionContext* context) {
|
||||
if (this->unk6a >= this->unk6c) {
|
||||
MessageFromTarget(0x300c);
|
||||
context->condition = 1;
|
||||
} else {
|
||||
MessageFromTarget(0x3005);
|
||||
context->condition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A13E8(ObjectB9Entity* this) {
|
||||
bool32 bVar2;
|
||||
const u8* ptr = &gUnk_08124EA0[sub_080A1514() * 4];
|
||||
|
||||
bVar2 = 0;
|
||||
switch (ptr[0]) {
|
||||
case 0x3f:
|
||||
if (gSave.stats.hasAllFigurines) {
|
||||
bVar2 = 1;
|
||||
}
|
||||
break;
|
||||
case 0x5c:
|
||||
if (gSave.didAllFusions) {
|
||||
bVar2 = 1;
|
||||
}
|
||||
break;
|
||||
case 0x63:
|
||||
if (!CheckGlobalFlag(0x4f)) {
|
||||
SetGlobalFlag(0x4f);
|
||||
break;
|
||||
}
|
||||
bVar2 = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bVar2) {
|
||||
sub_080A7C18(ptr[0], ptr[1], 0);
|
||||
} else {
|
||||
this->unk6e = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A1460(ObjectB9Entity* this) {
|
||||
s8* pcVar1;
|
||||
int iVar2;
|
||||
s32 rupees;
|
||||
const u8* ptr;
|
||||
|
||||
sub_080A1514();
|
||||
pcVar1 = this->unk70;
|
||||
rupees = 0;
|
||||
ptr = CuccoMinigameRupees;
|
||||
|
||||
for (iVar2 = 9; iVar2 >= 0; iVar2--) {
|
||||
// Weird register addition
|
||||
// ptr[*pcVar1] translates to add r0,r3,r0 but should be add r0,r3
|
||||
u32 temp = *pcVar1;
|
||||
temp += (int)ptr;
|
||||
rupees += *(u8*)temp;
|
||||
pcVar1++;
|
||||
}
|
||||
ModRupees(rupees);
|
||||
MessageNoOverlap(0x3007, super);
|
||||
gMessage.rupees = (u16)rupees;
|
||||
}
|
||||
|
||||
void sub_080A14A8(void) {
|
||||
int iVar1;
|
||||
|
||||
iVar1 = sub_080A1514();
|
||||
iVar1++;
|
||||
if (iVar1 > 9) {
|
||||
iVar1 = 9;
|
||||
}
|
||||
|
||||
if (iVar1 & 1) {
|
||||
SetGlobalFlag(0x4b);
|
||||
} else {
|
||||
ClearGlobalFlag(0x4b);
|
||||
}
|
||||
|
||||
if (iVar1 & 2) {
|
||||
SetGlobalFlag(0x4c);
|
||||
} else {
|
||||
ClearGlobalFlag(0x4c);
|
||||
}
|
||||
|
||||
if (iVar1 & 4) {
|
||||
SetGlobalFlag(0x4d);
|
||||
} else {
|
||||
ClearGlobalFlag(0x4d);
|
||||
}
|
||||
|
||||
if (iVar1 & 8) {
|
||||
SetGlobalFlag(0x4e);
|
||||
} else {
|
||||
ClearGlobalFlag(0x4e);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080A1514(void) {
|
||||
u32 rv = 0;
|
||||
|
||||
if (CheckGlobalFlag(0x4b)) {
|
||||
rv = 1;
|
||||
}
|
||||
|
||||
if (CheckGlobalFlag(0x4c)) {
|
||||
rv |= 2;
|
||||
}
|
||||
|
||||
if (CheckGlobalFlag(0x4d)) {
|
||||
rv |= 4;
|
||||
}
|
||||
|
||||
if (CheckGlobalFlag(0x4e)) {
|
||||
rv |= 8;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
|
||||
Entity* pEnt;
|
||||
const short* pCuccoMinigameDef;
|
||||
int index;
|
||||
Entity** ppEVar5;
|
||||
RoomControls* room;
|
||||
|
||||
context->condition = 0;
|
||||
pEnt = CreateObject(CUCCO_MINIGAME, 0, 0);
|
||||
if (pEnt != NULL) {
|
||||
pEnt->myHeap = (u32*)zMalloc(sizeof(ObjectB9Heap));
|
||||
if (pEnt->myHeap == NULL) {
|
||||
DeleteEntityAny(pEnt);
|
||||
} else {
|
||||
*(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh =
|
||||
(ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable);
|
||||
pCuccoMinigameDef = pObjectB9_MinigameCuccoDefs[sub_080A1514()];
|
||||
ppEVar5 = (Entity**)pEnt->myHeap;
|
||||
room = &gRoomControls;
|
||||
for (index = 9; index >= 0; index--, pCuccoMinigameDef += 3) {
|
||||
if (pCuccoMinigameDef[0] < 1) {
|
||||
pEnt = NULL;
|
||||
} else {
|
||||
pEnt = (Entity*)CreateEnemy(CUCCO_AGGR, pCuccoMinigameDef[0] - 1);
|
||||
if (pEnt != NULL) {
|
||||
pEnt->x.HALF.HI = room->origin_x + pCuccoMinigameDef[1];
|
||||
pEnt->y.HALF.HI = room->origin_y + pCuccoMinigameDef[2];
|
||||
pEnt->collisionLayer = 1;
|
||||
}
|
||||
}
|
||||
*ppEVar5++ = pEnt;
|
||||
}
|
||||
context->condition = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A1608(void) {
|
||||
u16 messageIndex;
|
||||
const u16* ptr;
|
||||
|
||||
messageIndex = 0x3002;
|
||||
if (CheckRoomFlag(1)) {
|
||||
messageIndex = 0x3006;
|
||||
}
|
||||
MessageFromTarget(messageIndex);
|
||||
gMessage.textWindowPosX = 1;
|
||||
gMessage.textWindowPosY = 0;
|
||||
ptr = &gUnk_08124C20[sub_080A1514() * 2];
|
||||
gMessage.rupees = ptr[0];
|
||||
gMessage.field_0x14 = ptr[1];
|
||||
}
|
||||
|
||||
void sub_080A1648(void) {
|
||||
SetTileType(0x407f, 0xd36, 1);
|
||||
SetTileType(0x407f, 0xd37, 1);
|
||||
SetTileType(0x407f, 0xd38, 1);
|
||||
SetTileType(0x407e, 0xd75, 1);
|
||||
SetTileType(0x407e, 0xe75, 1);
|
||||
}
|
||||
|
||||
void sub_080A169C(void) {
|
||||
sub_0807BA8C(0xd36, 1);
|
||||
sub_0807BA8C(0xd37, 1);
|
||||
sub_0807BA8C(0xd38, 1);
|
||||
sub_0807BA8C(0xd75, 1);
|
||||
sub_0807BA8C(0xe75, 1);
|
||||
}
|
||||
@@ -303,7 +303,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
|
||||
gMessage.textWindowPosX = 1;
|
||||
gMessage.textWindowPosY = 0xc;
|
||||
#endif
|
||||
gMessage.field_0x10 = this->unk_81;
|
||||
gMessage.rupees = this->unk_81;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -417,9 +417,9 @@ void sub_080882A8(FigurineDeviceEntity* this) {
|
||||
sub_08057044(this->unk_83, &gUnk_020227E8[1], 0x202020);
|
||||
ptr = (u8*)0x02000000;
|
||||
if (ptr[7] == 0) {
|
||||
sub_0805F46C((u32)gUnk_08120AE4[super->type2], &gUnk_08120AB4);
|
||||
sub_0805F46C((u32)gUnk_08120AE4[super->type2], (Font*)&gUnk_08120AB4); // TODO convert data
|
||||
} else {
|
||||
sub_0805F46C((u32)gUnk_08120AE4[super->type2], &gUnk_08120ACC);
|
||||
sub_0805F46C((u32)gUnk_08120AE4[super->type2], (Font*)&gUnk_08120ACC); // TODO convert data
|
||||
}
|
||||
gScreen.bg0.updated = 1;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ void sub_08088478(void) {
|
||||
gMessage.textWindowPosX = 1;
|
||||
gMessage.textWindowPosY = 0xc;
|
||||
if (set0x10) {
|
||||
gMessage.field_0x10 = 5;
|
||||
gMessage.rupees = 5;
|
||||
}
|
||||
#ifndef EU
|
||||
gPlayerEntity.animationState = 6;
|
||||
|
||||
@@ -252,7 +252,7 @@ void sub_0808EABC(Entity* this) {
|
||||
|
||||
void sub_0808EB74(Entity* this) {
|
||||
Entity* entity = sub_0808EC80(gMapDataBottomSpecial.unk6);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
this->x.WORD = entity->x.WORD;
|
||||
this->y.WORD = entity->y.WORD;
|
||||
this->spriteRendering.b3 = entity->spriteRendering.b3;
|
||||
@@ -305,7 +305,7 @@ void sub_0808EBB8(Entity* this) {
|
||||
// Fall through
|
||||
default:
|
||||
entity = sub_0808EC80(var0);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
SortEntityBelow(entity, this);
|
||||
this->spriteRendering.b3 = entity->spriteRendering.b3;
|
||||
x = entity->x.HALF.HI;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "projectile.h"
|
||||
#include "projectile/winder.h"
|
||||
|
||||
void FireballChain(Entity* thisx) {
|
||||
WinderEntity* newSegment;
|
||||
Entity* parent;
|
||||
Entity* child;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
if (gEntCount > 0x42) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
u16* tmp;
|
||||
|
||||
newSegment = (WinderEntity*)CreateProjectile(WINDER);
|
||||
if (i == 0) {
|
||||
child = parent = &newSegment->base;
|
||||
}
|
||||
|
||||
newSegment->base.type = i;
|
||||
newSegment->base.parent = parent;
|
||||
newSegment->base.child = child;
|
||||
CopyPosition(thisx, &newSegment->base);
|
||||
|
||||
for (j = 0, tmp = newSegment->positions; j < WINDER_NUM_SEGMENTS; j++) {
|
||||
*tmp++ = thisx->x.HALF.HI;
|
||||
*tmp++ = thisx->y.HALF.HI;
|
||||
}
|
||||
|
||||
child = &newSegment->base;
|
||||
}
|
||||
|
||||
DeleteThisEntity();
|
||||
}
|
||||
@@ -33,12 +33,11 @@ void sub_080860D8(FloatingPlatformEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0808611C(FloatingPlatformEntity* this) {
|
||||
int iVar2;
|
||||
bool32 iVar2 = sub_08086168(this);
|
||||
|
||||
iVar2 = sub_08086168(this);
|
||||
if (super->actionDelay != 0 && super->parent->actionDelay == 0) {
|
||||
|
||||
if (iVar2 != 0) {
|
||||
if (iVar2) {
|
||||
super->parent->actionDelay++;
|
||||
}
|
||||
|
||||
@@ -46,7 +45,7 @@ void sub_0808611C(FloatingPlatformEntity* this) {
|
||||
} else if (super->actionDelay == 0) {
|
||||
sub_080A2BE4(super, iVar2);
|
||||
} else {
|
||||
sub_080A2BE4(super, 0);
|
||||
sub_080A2BE4(super, FALSE);
|
||||
}
|
||||
|
||||
if (--this->unk70 == 0) {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
extern const ScreenTransitionData gUnk_0813ABD0;
|
||||
|
||||
extern u32 sub_08079F8C(void);
|
||||
struct GyorgChildSpawns {
|
||||
s16 offsetX;
|
||||
s16 offsetY;
|
||||
|
||||
@@ -53,7 +53,7 @@ void sub_080866D8(Entity* this) {
|
||||
if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
|
||||
CheckRegionOnScreen(prop->unk0, prop->unk2, 32, 32)) {
|
||||
entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
entity->field_0x6c.HALF.LO = i;
|
||||
entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16;
|
||||
entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32;
|
||||
@@ -157,7 +157,7 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
|
||||
void sub_0808692C(Entity* this) {
|
||||
this->flags &= ~ENT_SCRIPTED;
|
||||
this->type2 = 2;
|
||||
this->action = this->frameIndex == 0 ? 1 : 2;
|
||||
this->action = (this->frameIndex == 0) ? 1 : 2;
|
||||
this->subAction = 0;
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
|
||||
+10
-10
@@ -4,7 +4,7 @@
|
||||
extern u16 gUnk_08123318[];
|
||||
|
||||
static void sub_08097B24(Entity* this);
|
||||
static u32 sub_08097ADC(Entity* this);
|
||||
static bool32 sub_08097ADC(Entity* this);
|
||||
|
||||
void LilypadSmall(Entity* this) {
|
||||
u32 rand;
|
||||
@@ -29,19 +29,19 @@ void LilypadSmall(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
static u32 sub_08097ADC(Entity* this) {
|
||||
if ((gPlayerState.flags & PL_MINISH) == 0) {
|
||||
return 0;
|
||||
static bool32 sub_08097ADC(Entity* this) {
|
||||
if (!(gPlayerState.flags & PL_MINISH)) {
|
||||
return FALSE;
|
||||
} else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) {
|
||||
return 0;
|
||||
} else if (sub_08079F8C() == 0) {
|
||||
return 0;
|
||||
return FALSE;
|
||||
} else if (!sub_08079F8C()) {
|
||||
return FALSE;
|
||||
} else {
|
||||
gPlayerState.field_0x14 = 1;
|
||||
if (gPlayerEntity.z.HALF.HI != 0) {
|
||||
return 0;
|
||||
return FALSE;
|
||||
} else {
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ static void sub_08097B24(Entity* this) {
|
||||
u16* temp3;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 0x5a;
|
||||
this->actionDelay = 90;
|
||||
this->frameIndex = (this->frameIndex + 1) & 3;
|
||||
}
|
||||
temp3 = gUnk_08123318;
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "room.h"
|
||||
#include "screen.h"
|
||||
#include "sound.h"
|
||||
|
||||
extern u16 script_Object89Mazaal[];
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Entity base;
|
||||
/* 0x68 */ u8 unk_68[0x1C];
|
||||
/* 0x84 */ ScriptExecutionContext* cutsceneBeh;
|
||||
} MazaalBossObjectEntity;
|
||||
|
||||
enum MazaalBossObjectActions {
|
||||
/* 0 */ MAZAAL_BOSS_OBJECT_ACTION_0,
|
||||
/* 1 */ MAZAAL_BOSS_OBJECT_ACTION_1,
|
||||
/* 2 */ MAZAAL_BOSS_OBJECT_ACTION_2,
|
||||
/* 3 */ MAZAAL_BOSS_OBJECT_ACTION_3,
|
||||
/* 4 */ MAZAAL_BOSS_OBJECT_ACTION_4,
|
||||
/* 5 */ MAZAAL_BOSS_OBJECT_ACTION_5,
|
||||
/* 6 */ MAZAAL_BOSS_OBJECT_ACTION_6,
|
||||
/* 7 */ MAZAAL_BOSS_OBJECT_ACTION_7,
|
||||
/* 8 */ MAZAAL_BOSS_OBJECT_ACTION_8,
|
||||
};
|
||||
|
||||
void MazaalBossObject_Action0(MazaalBossObjectEntity* this); // 0809AB04
|
||||
void MazaalBossObject_Action1(MazaalBossObjectEntity* this); // 0809ABA4
|
||||
void MazaalBossObject_Action2(MazaalBossObjectEntity* this); // 0809ABB0
|
||||
void MazaalBossObject_Action3(MazaalBossObjectEntity* this); // 0809ABD4
|
||||
void MazaalBossObject_Action4(MazaalBossObjectEntity* this); // 0809ABF4
|
||||
void MazaalBossObject_Action5(MazaalBossObjectEntity* this); // 0809AC3C
|
||||
void MazaalBossObject_Action6(MazaalBossObjectEntity* this); // 0809ACA0
|
||||
void MazaalBossObject_Action7(MazaalBossObjectEntity* this); // 0809ACCC
|
||||
void MazaalBossObject_Action8(MazaalBossObjectEntity* this); // 0809ACE8
|
||||
void sub_0809AD68(MazaalBossObjectEntity* this); // 0809AD68
|
||||
void sub_0809AD8C(MazaalBossObjectEntity* this); // 0809AD8C
|
||||
|
||||
void MazaalBossObject(Entity* thisx) {
|
||||
static void (*const MazaalBossObject_Actions[])(MazaalBossObjectEntity*) = {
|
||||
MazaalBossObject_Action0, MazaalBossObject_Action1, MazaalBossObject_Action2,
|
||||
MazaalBossObject_Action3, MazaalBossObject_Action4, MazaalBossObject_Action5,
|
||||
MazaalBossObject_Action6, MazaalBossObject_Action7, MazaalBossObject_Action8,
|
||||
};
|
||||
|
||||
MazaalBossObject_Actions[thisx->action]((MazaalBossObjectEntity*)thisx);
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action0(MazaalBossObjectEntity* this) {
|
||||
Entity* mazaalHead;
|
||||
|
||||
if (CheckFlags(0x31)) {
|
||||
sub_0809AD68(this);
|
||||
sub_0809AD8C(this);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
mazaalHead = CreateEnemy(MAZAAL_HEAD, 0);
|
||||
if (mazaalHead == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CopyPosition(super, mazaalHead);
|
||||
super->child = mazaalHead;
|
||||
|
||||
if (gRoomTransition.field_0x38 != 0) {
|
||||
if (gRoomTransition.field_0x39 != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_7;
|
||||
super->spriteSettings.draw = 0;
|
||||
gRoomControls.camera_target = super;
|
||||
sub_080809D4();
|
||||
} else {
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_1;
|
||||
super->actionDelay = 30;
|
||||
super->frameIndex = gRoomTransition.field_0x38;
|
||||
super->spritePriority.b0 = 7;
|
||||
super->spriteOffsetY = 0x20;
|
||||
|
||||
this->cutsceneBeh = StartCutscene(super, script_Object89Mazaal);
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action1(MazaalBossObjectEntity* this) {
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action2(MazaalBossObjectEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_3;
|
||||
super->actionDelay = 120;
|
||||
gRoomControls.camera_target = super->child;
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action3(MazaalBossObjectEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_4;
|
||||
super->actionDelay = 90;
|
||||
super->child->subAction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action4(MazaalBossObjectEntity* this) {
|
||||
if (super->child->subAction > 2) {
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_5;
|
||||
super->actionDelay = 8;
|
||||
super->field_0xf = 0;
|
||||
super->spriteRendering.alphaBlend = BLDALPHA_BLEND(1, 0);
|
||||
|
||||
gScreen.controls.layerFXControl =
|
||||
BLDCNT_TGT2_BG3 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG0 | BLDCNT_EFFECT_BLEND;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(0x10, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action5(MazaalBossObjectEntity* this) {
|
||||
u32 tmp;
|
||||
|
||||
if (--super->actionDelay == 0) {
|
||||
super->actionDelay = 8;
|
||||
|
||||
tmp = ++super->field_0xf;
|
||||
tmp &= 0xFF;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND((0x10 - tmp) & 0xFF, tmp);
|
||||
|
||||
if (super->field_0xf > 15) {
|
||||
super->spriteRendering.alphaBlend = BLDALPHA_BLEND(4, 0);
|
||||
gScreen.controls.layerFXControl = 0;
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_6;
|
||||
super->actionDelay = 15;
|
||||
super->spriteSettings.draw = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action6(MazaalBossObjectEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
super->child->subAction = 6;
|
||||
gRoomTransition.field_0x38 = 0xF1;
|
||||
|
||||
DeleteEntity(super);
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action7(MazaalBossObjectEntity* this) {
|
||||
if (super->child->actionDelay == 1) {
|
||||
super->action = MAZAAL_BOSS_OBJECT_ACTION_8;
|
||||
super->subAction = 0;
|
||||
super->actionDelay = 180;
|
||||
}
|
||||
}
|
||||
|
||||
void MazaalBossObject_Action8(MazaalBossObjectEntity* this) {
|
||||
switch (super->subAction) {
|
||||
default:
|
||||
if (--super->actionDelay == 0) {
|
||||
super->actionDelay = 90;
|
||||
super->subAction = 1;
|
||||
SoundReq(SFX_SECRET_BIG);
|
||||
SetFlag(0x31);
|
||||
sub_0809AD8C(this);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--super->actionDelay == 0) {
|
||||
super->actionDelay = 120;
|
||||
super->subAction = 2;
|
||||
sub_0809AD68(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--super->actionDelay == 0) {
|
||||
gRoomControls.camera_target = &gNewPlayerEntity.base;
|
||||
gPlayerState.controlMode = CONTROL_1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809AD68(MazaalBossObjectEntity* this) {
|
||||
LoadRoomEntityList(GetCurrentRoomProperty(super->type));
|
||||
if (GetInventoryValue(ITEM_OCARINA) != 0) {
|
||||
LoadRoomEntityList(GetCurrentRoomProperty(super->type2));
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809AD8C(MazaalBossObjectEntity* this) {
|
||||
Entity* archway = CreateObject(ARCHWAY, 0x22, 0);
|
||||
|
||||
if (archway != NULL) {
|
||||
archway->x.HALF.HI = gRoomControls.origin_x + 0xB8;
|
||||
archway->y.HALF.HI = gRoomControls.origin_y + 8;
|
||||
}
|
||||
}
|
||||
+220
-89
@@ -1,67 +1,82 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "hitbox.h"
|
||||
|
||||
extern u32 sub_08091DDC(Entity*);
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 filler[0x1C];
|
||||
struct_030010EC* minecartData;
|
||||
} MinecartEntity;
|
||||
|
||||
extern u32 sub_08007DD6(u32, u32);
|
||||
extern void sub_08017744(Entity*);
|
||||
extern void sub_08091C0C(Entity*);
|
||||
|
||||
extern void (*const gUnk_081223A8[])(Entity*);
|
||||
u32 sub_08091DDC(MinecartEntity*);
|
||||
void sub_080916EC(MinecartEntity*);
|
||||
void sub_080917DC(MinecartEntity*);
|
||||
void sub_080918A4(MinecartEntity*);
|
||||
void sub_080919AC(MinecartEntity*);
|
||||
void sub_08091C0C(MinecartEntity*);
|
||||
void sub_08091C98(MinecartEntity*);
|
||||
void sub_08091CC8(MinecartEntity*);
|
||||
void sub_08091D90(MinecartEntity*);
|
||||
|
||||
extern const s8 gUnk_081223C8[];
|
||||
extern const u32 gUnk_081223D8[];
|
||||
|
||||
void Minecart(Entity* this) {
|
||||
gUnk_081223A8[this->action](this);
|
||||
static void (*const actionFuncs[])(MinecartEntity*) = {
|
||||
sub_080916EC, sub_080917DC, sub_080918A4, sub_080919AC, sub_08091C0C, sub_08091C98, sub_08091CC8, sub_08091D90,
|
||||
};
|
||||
actionFuncs[this->action]((MinecartEntity*)this);
|
||||
this->bitfield = 0;
|
||||
}
|
||||
|
||||
void sub_080916EC(Entity* this) {
|
||||
struct_030010EC* unk = &gRoomTransition.minecart_data[this->actionDelay];
|
||||
void sub_080916EC(MinecartEntity* this) {
|
||||
struct_030010EC* unk = &gRoomTransition.minecart_data[super->actionDelay];
|
||||
|
||||
*(struct_030010EC**)&this->cutsceneBeh.HWORD = unk;
|
||||
if ((gRoomControls.room != unk->field_0x4) || (gPlayerState.flags & PL_IN_MINECART) != 0) {
|
||||
this->minecartData = unk;
|
||||
if ((gRoomControls.room != unk->room) || (gPlayerState.flags & PL_IN_MINECART) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->x.HALF.HI = gRoomControls.origin_x + ((unk->field_0x0 & 0x3f) << 4) + 8;
|
||||
this->y.HALF.HI = gRoomControls.origin_y + ((unk->field_0x0 & 0xfc << 4) >> 2) + 8;
|
||||
this->animationState = unk->field_0x5;
|
||||
this->type2 = unk->field_0x6;
|
||||
this->action = 1;
|
||||
this->hitbox = (Hitbox*)&gUnk_080FD310;
|
||||
COLLISION_ON(this);
|
||||
this->hitType = 1;
|
||||
this->field_0x3c = 0x47;
|
||||
this->hurtType = 0x44;
|
||||
this->flags2 = 0x80;
|
||||
this->direction = DirectionFromAnimationState(this->animationState);
|
||||
this->speed = 0x700;
|
||||
this->spritePriority.b1 = 3;
|
||||
InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState);
|
||||
SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer);
|
||||
super->x.HALF.HI = gRoomControls.origin_x + ((unk->tilePos & 0x3f) << 4) + 8;
|
||||
super->y.HALF.HI = gRoomControls.origin_y + ((unk->tilePos & 0xfc << 4) >> 2) + 8;
|
||||
super->animationState = unk->animationState;
|
||||
super->type2 = unk->field_0x6;
|
||||
super->action = 1;
|
||||
super->hitbox = (Hitbox*)&gUnk_080FD310;
|
||||
COLLISION_ON(super);
|
||||
super->hitType = 1;
|
||||
super->field_0x3c = 0x47;
|
||||
super->hurtType = 0x44;
|
||||
super->flags2 = 0x80;
|
||||
super->direction = DirectionFromAnimationState(super->animationState);
|
||||
super->speed = 0x700;
|
||||
super->spritePriority.b1 = 3;
|
||||
InitAnimationForceUpdate(super, super->type2 + 4 + super->animationState);
|
||||
SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080917DC(Entity* this) {
|
||||
if ((this->bitfield & 0x7f) == 0x1d) {
|
||||
this->zVelocity = Q_16_16(2.625);
|
||||
this->action = 7;
|
||||
InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState);
|
||||
void sub_080917DC(MinecartEntity* this) {
|
||||
if ((super->bitfield & 0x7f) == 0x1d) {
|
||||
super->zVelocity = Q_16_16(2.625);
|
||||
super->action = 7;
|
||||
InitAnimationForceUpdate(super, super->type2 + 4 + super->animationState);
|
||||
SoundReq(SFX_13B);
|
||||
} else {
|
||||
if (sub_0800445C(this) != 0) {
|
||||
if (sub_0800445C(super) != 0) {
|
||||
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.field_0x1c ||
|
||||
gPlayerState.heldObject || gPlayerState.jump_status)) {
|
||||
this->actionDelay++;
|
||||
super->actionDelay++;
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
super->actionDelay = 0;
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
super->actionDelay = 0;
|
||||
}
|
||||
if (this->type2 == 0) {
|
||||
if (this->actionDelay > 8) {
|
||||
this->action++;
|
||||
if (super->type2 == 0) {
|
||||
if (super->actionDelay > 8) {
|
||||
super->action++;
|
||||
gPlayerState.jump_status = 0x81;
|
||||
gPlayerState.flags |= PL_ENTER_MINECART;
|
||||
gPlayerEntity.zVelocity = Q_16_16(2.0);
|
||||
@@ -72,100 +87,102 @@ void sub_080917DC(Entity* this) {
|
||||
SoundReq(SFX_PLY_JUMP);
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
super->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080918A4(Entity* this) {
|
||||
if (EntityInRectRadius(this, &gPlayerEntity, 2, 2) != 0) {
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
|
||||
void sub_080918A4(MinecartEntity* this) {
|
||||
if (EntityInRectRadius(super, &gPlayerEntity, 2, 2) != 0) {
|
||||
gPlayerEntity.x.HALF.HI = super->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = super->y.HALF.HI;
|
||||
if (gPlayerEntity.z.HALF.HI > -0x10) {
|
||||
if (gPlayerEntity.zVelocity >= 0) {
|
||||
return;
|
||||
}
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
gPlayerEntity.animationState = super->animationState << 1;
|
||||
gPlayerState.flags = (gPlayerState.flags ^ PL_ENTER_MINECART) | PL_IN_MINECART;
|
||||
this->action++;
|
||||
this->field_0xf = 1;
|
||||
this->flags |= ENT_PERSIST;
|
||||
this->hitType = 0x97;
|
||||
this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
this->hurtType = 0x18;
|
||||
this->damage = 8;
|
||||
sub_0801766C(this);
|
||||
RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer);
|
||||
super->action++;
|
||||
super->field_0xf = 1;
|
||||
super->flags |= ENT_PERSIST;
|
||||
super->hitType = 0x97;
|
||||
super->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
super->hurtType = 0x18;
|
||||
super->damage = 8;
|
||||
sub_0801766C(super);
|
||||
RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer);
|
||||
SoundReq(SFX_137);
|
||||
}
|
||||
} else {
|
||||
gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this);
|
||||
gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, super);
|
||||
}
|
||||
if (gPlayerEntity.zVelocity < 0) {
|
||||
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
|
||||
gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080919AC(Entity* this) {
|
||||
void sub_080919AC(MinecartEntity* this) {
|
||||
static const s8 gUnk_081223C8[] = { 0, -7, 7, 0, 0, 7, -7, 0 };
|
||||
|
||||
u32 iVar2;
|
||||
u32 uVar3;
|
||||
|
||||
gRoomControls.unk5 = 7;
|
||||
if ((gPlayerState.flags & PL_IN_MINECART) == 0) {
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((gPlayerEntity.frame & 0xf) == 0) {
|
||||
COLLISION_OFF(this);
|
||||
CopyPosition(this, &gPlayerEntity);
|
||||
COLLISION_OFF(super);
|
||||
CopyPosition(super, &gPlayerEntity);
|
||||
if ((gPlayerEntity.frame & 0xf0) == 0x10) {
|
||||
this->spriteOffsetY = 1;
|
||||
super->spriteOffsetY = 1;
|
||||
} else {
|
||||
this->spriteOffsetY = 0;
|
||||
super->spriteOffsetY = 0;
|
||||
}
|
||||
} else {
|
||||
COLLISION_ON(this);
|
||||
COLLISION_ON(super);
|
||||
gPlayerEntity.speed = 0;
|
||||
LinearMoveUpdate(this);
|
||||
CopyPosition(this, &gPlayerEntity);
|
||||
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
|
||||
LinearMoveUpdate(super);
|
||||
CopyPosition(super, &gPlayerEntity);
|
||||
gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1;
|
||||
if (!sub_08091DDC(this)) {
|
||||
if ((gRoomTransition.frameCount & 0xf) == 0) {
|
||||
SoundReq(SFX_138);
|
||||
}
|
||||
|
||||
if (--this->field_0xf == 0xff) {
|
||||
if (--super->field_0xf == 0xff) {
|
||||
SoundReq(SFX_PLY_VO7);
|
||||
this->field_0xf = 0x3c;
|
||||
super->field_0xf = 0x3c;
|
||||
}
|
||||
|
||||
uVar3 = GetRelativeCollisionTile(this, gUnk_081223C8[this->animationState * 2],
|
||||
gUnk_081223C8[this->animationState * 2 + 1]);
|
||||
iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]);
|
||||
uVar3 = GetRelativeCollisionTile(super, gUnk_081223C8[super->animationState * 2],
|
||||
gUnk_081223C8[super->animationState * 2 + 1]);
|
||||
iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[super->animationState]);
|
||||
if (iVar2 == 0) {
|
||||
this->direction = DirectionTurnAround(this->direction);
|
||||
this->animationState = AnimationStateFlip90(this->animationState);
|
||||
super->direction = DirectionTurnAround(super->direction);
|
||||
super->animationState = AnimationStateFlip90(super->animationState);
|
||||
} else {
|
||||
switch (uVar3) {
|
||||
case 0x64:
|
||||
this->flags &= ~ENT_PERSIST;
|
||||
this->hitType = 1;
|
||||
this->field_0x3c = 0x47;
|
||||
this->hurtType = 0x44;
|
||||
this->flags2 = 0x80;
|
||||
this->action = 6;
|
||||
sub_08017744(this);
|
||||
super->flags &= ~ENT_PERSIST;
|
||||
super->hitType = 1;
|
||||
super->field_0x3c = 0x47;
|
||||
super->hurtType = 0x44;
|
||||
super->flags2 = 0x80;
|
||||
super->action = 6;
|
||||
sub_08017744(super);
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART;
|
||||
gPlayerEntity.zVelocity = Q_16_16(2.0);
|
||||
gPlayerEntity.speed = 0x200;
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
gPlayerEntity.direction = this->direction;
|
||||
gPlayerEntity.animationState = super->animationState << 1;
|
||||
gPlayerEntity.direction = super->direction;
|
||||
gPlayerEntity.flags |= PL_MINISH;
|
||||
sub_08004168(this);
|
||||
InitAnimationForceUpdate(this, this->animationState + 0xc);
|
||||
sub_08004168(super);
|
||||
InitAnimationForceUpdate(super, super->animationState + 0xc);
|
||||
SoundReq(SFX_PLY_VO4);
|
||||
SoundReq(SFX_139);
|
||||
return;
|
||||
@@ -177,21 +194,135 @@ void sub_080919AC(Entity* this) {
|
||||
case 0x6d:
|
||||
case 0x6e:
|
||||
case 0x6f:
|
||||
if (uVar3 == GetTileUnderEntity(this)) {
|
||||
if (uVar3 == GetTileUnderEntity(super)) {
|
||||
sub_08091C0C(this);
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
gPlayerEntity.animationState = super->animationState << 1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
if (this->animIndex == this->animationState) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
gPlayerEntity.animationState = super->animationState << 1;
|
||||
if (super->animIndex == super->animationState) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
InitAnimationForceUpdate(super, super->animationState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08091C0C(MinecartEntity* this) {
|
||||
sub_08004168(super);
|
||||
CopyPosition(super, &gPlayerEntity);
|
||||
switch (GetTileUnderEntity(super)) {
|
||||
case 0x67:
|
||||
if (super->direction == DirectionWest) {
|
||||
super->direction = DirectionNorth;
|
||||
super->animationState = 0;
|
||||
} else {
|
||||
super->direction = DirectionEast;
|
||||
super->animationState = 1;
|
||||
}
|
||||
break;
|
||||
case 0x68:
|
||||
if (super->direction == DirectionEast) {
|
||||
super->direction = DirectionSouth;
|
||||
super->animationState = 2;
|
||||
} else {
|
||||
super->direction = DirectionWest;
|
||||
super->animationState = 3;
|
||||
}
|
||||
break;
|
||||
case 0x69:
|
||||
if (super->direction == DirectionEast) {
|
||||
super->direction = DirectionNorth;
|
||||
super->animationState = 0;
|
||||
} else {
|
||||
super->direction = DirectionWest;
|
||||
super->animationState = 3;
|
||||
}
|
||||
break;
|
||||
case 0x6a:
|
||||
if (super->direction == DirectionWest) {
|
||||
super->direction = DirectionSouth;
|
||||
super->animationState = 2;
|
||||
} else {
|
||||
super->direction = DirectionEast;
|
||||
super->animationState = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super->action = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
super->action = 3;
|
||||
gPlayerEntity.animationState = super->animationState << 1;
|
||||
}
|
||||
|
||||
void sub_08091C98(MinecartEntity* this) {
|
||||
LinearMoveUpdate(super);
|
||||
CopyPosition(super, &gPlayerEntity);
|
||||
if (gRoomControls.reload_flags == 0) {
|
||||
super->action = 3;
|
||||
super->speed = 0x700;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08091CC8(MinecartEntity* this) {
|
||||
struct_030010EC* minecartData;
|
||||
|
||||
if (gPlayerState.jump_status == 0) {
|
||||
super->action = 1;
|
||||
super->direction = DirectionTurnAround(super->direction);
|
||||
super->animationState ^= 2;
|
||||
gPlayerState.flags ^= PL_ENTER_MINECART;
|
||||
minecartData = this->minecartData;
|
||||
minecartData->tilePos = COORD_TO_TILE(super);
|
||||
minecartData->room = gRoomControls.room;
|
||||
minecartData->animationState = super->animationState;
|
||||
InitAnimationForceUpdate(super, super->animationState + 0x10);
|
||||
SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08091D90(MinecartEntity* this) {
|
||||
if (super->zVelocity < 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
if (((super->frame & 0x7f) == 0) && GravityUpdate(super, 0x2000) == 0) {
|
||||
super->type2 ^= 4;
|
||||
super->action = 1;
|
||||
this->minecartData->field_0x6 = super->type2;
|
||||
SoundReq(SFX_13C);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_08091DDC(MinecartEntity* this) {
|
||||
static const s8 gUnk_081223D0[] = { 0, -8, 8, 0, 0, 8, -8, 0 };
|
||||
if ((sub_080B1AF0(super, gUnk_081223D0[super->animationState * 2], gUnk_081223D0[super->animationState * 2 + 1]) ==
|
||||
0xff) &&
|
||||
(sub_0807BD14(&gPlayerEntity, super->animationState))) {
|
||||
super->updatePriority = 6;
|
||||
super->action = 5;
|
||||
switch (super->direction) {
|
||||
case 0:
|
||||
case 8:
|
||||
case 0x10:
|
||||
case 0x18:
|
||||
super->speed = 0xa0;
|
||||
break;
|
||||
}
|
||||
gPlayerEntity.direction = super->direction;
|
||||
gRoomControls.camera_target = super;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ void sub_0808F3DC(Entity* this) {
|
||||
|
||||
if (this->type == 5 && (this->frame & 1)) {
|
||||
Entity* entity = CreateObjectWithParent(this->child, 0x49, 8, 0);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
entity->parent = this->parent;
|
||||
entity->child = this->parent->parent;
|
||||
}
|
||||
@@ -262,19 +262,19 @@ void sub_0808F554(Entity* this) {
|
||||
|
||||
void sub_0808F5EC(Entity* this) {
|
||||
Entity* entity = CreateObjectWithParent(this->child, 0x49, 5, 0);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
entity->parent = this;
|
||||
entity->child = this->child;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->child, 0x49, 6, 0);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
entity->parent = this;
|
||||
entity->child = this->child;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->child, 0x49, 7, 0);
|
||||
if (entity) {
|
||||
if (entity != NULL) {
|
||||
entity->parent = this;
|
||||
entity->child = this->child;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "asm.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
#include "item.h"
|
||||
#include "flags.h"
|
||||
#include "effects.h"
|
||||
|
||||
typedef struct _struct_gUnk_08123FB0 {
|
||||
void (*const funcEnt)(Entity*);
|
||||
bool32 (*const func)(Entity*, const struct _struct_gUnk_08123FB0*);
|
||||
s8 unk08;
|
||||
s8 unk09;
|
||||
u8 unk0a;
|
||||
u8 unk0b;
|
||||
u8 unk0c;
|
||||
u8 type;
|
||||
u8 unk0e;
|
||||
u8 unk0f;
|
||||
s32 zVelocity;
|
||||
u32 unk14;
|
||||
s16 speed;
|
||||
s16 y;
|
||||
u16 flag;
|
||||
u8 actionDelay;
|
||||
u8 unk1f;
|
||||
} struct_gUnk_08123FB0;
|
||||
|
||||
static_assert(sizeof(struct_gUnk_08123FB0) == 0x20);
|
||||
|
||||
void sub_0809D91C(Entity*);
|
||||
bool32 sub_0809D93C(Entity*, const struct_gUnk_08123FB0*);
|
||||
void Object96_Init(Entity*, const struct_gUnk_08123FB0*);
|
||||
void Object96_Action1(Entity*, const struct_gUnk_08123FB0*);
|
||||
void Object96_Action2(Entity*, const struct_gUnk_08123FB0*);
|
||||
void Object96_Action3(Entity*, const struct_gUnk_08123FB0*);
|
||||
|
||||
static const struct_gUnk_08123FB0 gUnk_08123FB0[] = {
|
||||
{ sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1,
|
||||
0x0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x63, 0x63, 0x10, 0, 0x1800, 0, 0x18,
|
||||
#if defined(JP) || defined(DEMO_JP) || defined(EU)
|
||||
0xCD,
|
||||
#else
|
||||
0xd0,
|
||||
#endif
|
||||
0, 0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, 0x10000, 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, 0x10000, 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 },
|
||||
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, 0x10000, 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
|
||||
{ NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 },
|
||||
};
|
||||
|
||||
void Object96(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*, const struct_gUnk_08123FB0*) = {
|
||||
Object96_Init,
|
||||
Object96_Action1,
|
||||
Object96_Action2,
|
||||
Object96_Action3,
|
||||
};
|
||||
actionFuncs[this->action](this, &gUnk_08123FB0[this->type]);
|
||||
}
|
||||
|
||||
void Object96_Init(Entity* this, const struct_gUnk_08123FB0* param_2) {
|
||||
u32 type;
|
||||
u32 dir;
|
||||
|
||||
this->action++;
|
||||
this->collisionLayer = 2;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->zVelocity = param_2->zVelocity;
|
||||
this->direction = param_2->unk0f;
|
||||
this->speed = param_2->speed;
|
||||
this->y.HALF.HI -= param_2->y;
|
||||
this->z.WORD = 0;
|
||||
this->actionDelay = param_2->actionDelay;
|
||||
if ((this->direction & 0x80)) {
|
||||
dir = this->direction;
|
||||
if (dir == 0x81) {
|
||||
this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10;
|
||||
}
|
||||
}
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
type = this->type;
|
||||
sub_08080CB4(this);
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
void Object96_Action1(Entity* this, const struct_gUnk_08123FB0* param_2) {
|
||||
u32 type;
|
||||
s32 iVar3;
|
||||
|
||||
iVar3 = 1;
|
||||
if (param_2->func != NULL) {
|
||||
iVar3 = param_2->func(this, param_2);
|
||||
}
|
||||
if (iVar3 != 0) {
|
||||
this->action++;
|
||||
this->y.HALF.HI += param_2->y;
|
||||
this->z.HALF.HI -= param_2->y;
|
||||
}
|
||||
type = this->type;
|
||||
this->type = param_2->type;
|
||||
sub_08080CB4(this);
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
void Object96_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) {
|
||||
u8 type;
|
||||
|
||||
LinearMoveUpdate(this);
|
||||
if (sub_080044EC(this, param_2->unk14) < 2) {
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
this->zVelocity = param_2->unk14 << 3;
|
||||
} else {
|
||||
this->action++;
|
||||
this->collisionLayer = gPlayerEntity.collisionLayer;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
if (param_2->funcEnt != NULL) {
|
||||
param_2->funcEnt(this);
|
||||
}
|
||||
}
|
||||
SoundReq(SFX_RUPEE_BOUNCE);
|
||||
}
|
||||
type = this->type;
|
||||
this->type = param_2->type;
|
||||
sub_08080CB4(this);
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
void Object96_Action3(Entity* this, const struct_gUnk_08123FB0* param_2) {
|
||||
u8 type;
|
||||
|
||||
if (gPlayerState.flags & 0x80) {
|
||||
sub_0800445C(this);
|
||||
} else {
|
||||
if (IsCollidingPlayer(this)) {
|
||||
CreateItemEntity(param_2->type, this->type2, 0);
|
||||
if (param_2->flag) {
|
||||
SetFlag(param_2->flag);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
type = this->type;
|
||||
this->type = param_2->type;
|
||||
sub_08080CB4(this);
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
void sub_0809D91C(Entity* this) {
|
||||
Entity* fxEnt;
|
||||
|
||||
fxEnt = CreateFx(this, FX_DASH, 0);
|
||||
if (fxEnt != NULL) {
|
||||
SortEntityBelow(this, fxEnt);
|
||||
}
|
||||
SoundReq(SFX_SECRET);
|
||||
}
|
||||
|
||||
bool32 sub_0809D93C(Entity* this, const struct_gUnk_08123FB0* param_2) {
|
||||
u32 uVar1;
|
||||
|
||||
if (gPlayerEntity.action == 6 && ((param_2->unk0c >> gPlayerEntity.animationState & 1) != 0)) {
|
||||
uVar1 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI) + param_2->unk08 + param_2->unk0a;
|
||||
if (param_2->unk0a * 2 <= (u16)uVar1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uVar1 = (gPlayerEntity.y.HALF.HI - (this->y.HALF.HI + param_2->y)) + param_2->unk09 + param_2->unk0b;
|
||||
if (param_2->unk0b * 2 > (u16)uVar1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "projectile.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 filler[0xC];
|
||||
u16 unk74;
|
||||
u16 unk76;
|
||||
u8 filler2[0x6];
|
||||
u8 unk7e;
|
||||
} Object98Entity;
|
||||
|
||||
void sub_0809E360(Object98Entity*);
|
||||
void sub_0809E3E4(Object98Entity*);
|
||||
|
||||
void Object98(Entity* this) {
|
||||
static void (*const actionFuncs[])(Object98Entity*) = {
|
||||
sub_0809E360,
|
||||
sub_0809E3E4,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((Object98Entity*)this);
|
||||
}
|
||||
|
||||
void sub_0809E360(Object98Entity* this) {
|
||||
u32 bVar1;
|
||||
Entity* projEnt;
|
||||
u32 index;
|
||||
|
||||
if (8 < super->actionDelay) {
|
||||
super->actionDelay = 8;
|
||||
}
|
||||
|
||||
if (0x48 - super->actionDelay > gEntCount) {
|
||||
for (index = 0; index < super->actionDelay; index++) {
|
||||
projEnt = CreateProjectile(GURUGURU_BAR_PROJECTILE);
|
||||
projEnt->actionDelay = 14 + 12 * index;
|
||||
projEnt->parent = super;
|
||||
}
|
||||
|
||||
super->action = 1;
|
||||
bVar1 = this->unk7e;
|
||||
this->unk76 = bVar1 << 8;
|
||||
super->animationState = bVar1 << 6;
|
||||
SetDefaultPriority(super, 0);
|
||||
if (super->type != 0) {
|
||||
super->child = (Entity*)GetCurrentRoomProperty(super->type);
|
||||
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809E3E4(Object98Entity* this) {
|
||||
this->unk76 += super->type2;
|
||||
super->animationState = this->unk76 >> 2;
|
||||
if (super->type != 0) {
|
||||
if ((super->direction & 0x80) == 0) {
|
||||
LinearMoveUpdate(super);
|
||||
}
|
||||
|
||||
if (--this->unk74 == 0) {
|
||||
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "entity.h"
|
||||
#include "coord.h"
|
||||
|
||||
void Object99(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->field_0x76.HALF.LO = parent->animationState;
|
||||
this->field_0x74.HALF.LO = this->spriteOffsetX;
|
||||
this->field_0x74.HALF.HI = this->spriteOffsetY;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
|
||||
if (parent->animationState != this->field_0x76.HALF.LO) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->spriteSettings.draw = parent->spriteSettings.draw;
|
||||
CopyPositionAndSpriteOffset(parent, this);
|
||||
this->spriteOffsetX += this->field_0x74.HALF.LO;
|
||||
this->spriteOffsetY += this->field_0x74.HALF.HI;
|
||||
if (this->animationState != 2) {
|
||||
this->y.HALF.HI++;
|
||||
this->spriteOffsetY--;
|
||||
} else {
|
||||
this->y.HALF.HI--;
|
||||
this->spriteOffsetY++;
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "hitbox.h"
|
||||
#include "effects.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 filler[0x1E];
|
||||
u16 objFlags;
|
||||
} ObjectA6Entity;
|
||||
|
||||
void sub_0809F920(ObjectA6Entity*);
|
||||
void sub_0809F964(ObjectA6Entity*);
|
||||
|
||||
void ObjectA6(Entity* this) {
|
||||
static void (*const actionFuncs[])(ObjectA6Entity*) = {
|
||||
sub_0809F920,
|
||||
sub_0809F964,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((ObjectA6Entity*)this);
|
||||
}
|
||||
|
||||
void sub_0809F920(ObjectA6Entity* this) {
|
||||
if (CheckFlags(this->objFlags)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
super->action = 1;
|
||||
COLLISION_ON(super);
|
||||
super->field_0x3c = 7;
|
||||
super->hurtType = 0x48;
|
||||
super->hitType = 1;
|
||||
super->flags2 = 2;
|
||||
super->hitbox = (Hitbox*)&gHitbox_0;
|
||||
}
|
||||
|
||||
void sub_0809F964(ObjectA6Entity* this) {
|
||||
Entity* fxEnt;
|
||||
|
||||
if (super->bitfield == 0xa1) {
|
||||
fxEnt = CreateFx(super, FX_MAGIC_STORM, 0);
|
||||
if (fxEnt != NULL) {
|
||||
fxEnt->spritePriority.b0 = 3;
|
||||
fxEnt->spriteOffsetY = -5;
|
||||
}
|
||||
SetFlag(this->objFlags);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
|
||||
void sub_0809FEF8(Entity*);
|
||||
void sub_0809FF28(Entity*);
|
||||
|
||||
void ObjectA9(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_0809FEF8,
|
||||
sub_0809FF28,
|
||||
DeleteEntity,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((Entity*)this);
|
||||
}
|
||||
|
||||
void sub_0809FEF8(Entity* this) {
|
||||
static const u8 typeAnimationStates[] = { 0x2, 0x0, 0x43, 0x0 };
|
||||
static const u16 typeSounds[] = { SFX_124, SFX_197, SFX_11D, SFX_NONE };
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, typeAnimationStates[this->type]);
|
||||
SoundReq(typeSounds[this->type]);
|
||||
}
|
||||
|
||||
void sub_0809FF28(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
this->action = 2;
|
||||
pEVar1 = this->parent;
|
||||
pEVar1->flags = this->actionDelay;
|
||||
pEVar1->spriteSettings.draw = this->field_0xf;
|
||||
((GenericEntity*)pEVar1)->field_0x6c.HALF.HI &= 0xef;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "asm.h"
|
||||
#include "player.h"
|
||||
#include "coord.h"
|
||||
|
||||
extern void sub_0805B390(u32);
|
||||
|
||||
void ObjectAB_Init(Entity*);
|
||||
void ObjectAB_Action1(Entity*);
|
||||
void ObjectAB_Action2(Entity*);
|
||||
void sub_080A0190(Entity*);
|
||||
|
||||
void ObjectAB(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
ObjectAB_Init,
|
||||
ObjectAB_Action1,
|
||||
ObjectAB_Action2,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((Entity*)this);
|
||||
}
|
||||
|
||||
void ObjectAB_Init(Entity* this) {
|
||||
this->action++;
|
||||
this->collisionLayer = 1;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->subAction = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void ObjectAB_Action1(Entity* this) {
|
||||
if (CheckRoomFlag(0)) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
this->action++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectAB_Action2(Entity* this) {
|
||||
if (CheckRoomFlag(1)) {
|
||||
sub_080A0190(this);
|
||||
RequestPriorityDuration(this, 0x1e);
|
||||
if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10)) {
|
||||
sub_0805B390(0x37);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A0190(Entity* this) {
|
||||
this->subAction = 1;
|
||||
CopyPosition(this, &gPlayerEntity);
|
||||
gPlayerState.queued_action = 3;
|
||||
gPlayerState.field_0x38 = 0;
|
||||
gPlayerState.flags |= PL_PIT_IS_EXIT;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
|
||||
void sub_080A04A4(Entity*);
|
||||
void sub_080A04E0(Entity*);
|
||||
void sub_080A04E8();
|
||||
|
||||
void ObjectAD(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_080A04A4,
|
||||
sub_080A04E0,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((Entity*)this);
|
||||
}
|
||||
|
||||
void sub_080A04A4(Entity* this) {
|
||||
this->action = 1;
|
||||
this->frameIndex = 4;
|
||||
this->actionDelay = 0;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->z.WORD = 0;
|
||||
this->spriteRendering.alphaBlend = 1;
|
||||
sub_080A04E8();
|
||||
}
|
||||
|
||||
void sub_080A04E0(Entity* this) {
|
||||
sub_080A04E8();
|
||||
}
|
||||
|
||||
void sub_080A04E8(Entity* this) {
|
||||
int iVar2;
|
||||
u32 uVar3;
|
||||
|
||||
iVar2 = (this->parent->z.HALF.HI < 0 ? -this->parent->z.HALF.HI : this->parent->z.HALF.HI) + 0x100;
|
||||
SetAffineInfo(this, iVar2, iVar2, 0);
|
||||
iVar2 = ((0x1c0 - iVar2) * 10) / iVar2;
|
||||
if (this->parent->type == 0x41) {
|
||||
uVar3 = iVar2 * 2;
|
||||
if (0xc < uVar3) {
|
||||
uVar3 = 0xc;
|
||||
}
|
||||
iVar2 = (0x10 - iVar2) * 0x100;
|
||||
iVar2 |= uVar3;
|
||||
iVar2 &= 0xffff;
|
||||
} else {
|
||||
iVar2 |= (0x10 - iVar2) * 0x100;
|
||||
iVar2 &= 0xffff;
|
||||
}
|
||||
gScreen.controls.alphaBlend = iVar2;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void ObjectB_Action2(ObjectBEntity* this) {
|
||||
break;
|
||||
}
|
||||
MessageFromTarget(messageIndex);
|
||||
gMessage.field_0x10 = super->type2;
|
||||
gMessage.rupees = super->type2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user