mirror of
https://github.com/zeldaret/tmc
synced 2026-08-25 15:46:39 -04:00
Merge branch 'master' into gyorg
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#include "global.h"
|
||||
#include "structures.h"
|
||||
#include "main.h"
|
||||
#include "room.h"
|
||||
#include "screen.h"
|
||||
|
||||
extern u32 gFrameObjLists[];
|
||||
|
||||
extern void gUnk_03006164(void);
|
||||
extern void gUnk_0300659C(OAMCommand*, void*);
|
||||
extern void gUnk_03006580(OAMCommand*, u32, u32);
|
||||
|
||||
// regalloc
|
||||
NONMATCH("asm/non_matching/vram/sub_080AD8F0.inc", void* sub_080AD8F0(u32 sprite, u32 frame)) {
|
||||
u32 x = gFrameObjLists[sprite];
|
||||
u8* y = (u8*)&gFrameObjLists[frame];
|
||||
u32 tmp = *(u32*)&y[x];
|
||||
|
||||
return (u8*)gFrameObjLists + tmp;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void FlushSprites(void) {
|
||||
gOAMControls.updated = 0;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/vram/sub_080AD918.inc", void CopyOAM(void)) {
|
||||
s32 rem;
|
||||
u16* d;
|
||||
|
||||
if (gMain.ticks.HALF.LO == 0) {
|
||||
gOAMControls.unk[0x20].unk0 = gMain.ticks.HALF.LO;
|
||||
gOAMControls.unk[0x48].unk4 = gMain.ticks.HALF.LO;
|
||||
gOAMControls.unk[0x71].unk0 = gMain.ticks.HALF.LO;
|
||||
gOAMControls.unk[0x99].unk4 = gMain.ticks.HALF.LO;
|
||||
} else {
|
||||
gMain.ticks.HALF.LO--;
|
||||
}
|
||||
|
||||
rem = 0x80 - gOAMControls.updated;
|
||||
for (d = (u16*)&gOAMControls.oam[0x80 + gOAMControls.updated]; rem > 0; rem--) {
|
||||
*d = 0x2A0;
|
||||
(u8*)d += 6;
|
||||
}
|
||||
if (gOAMControls.unk[0].unk7) {
|
||||
gOAMControls.unk[0].unk7 = 0;
|
||||
ObjAffineSet((struct ObjAffineSrcData*)gOAMControls.unk, &gOAMControls.oam[0].affineParam, 32, 8);
|
||||
}
|
||||
gOAMControls.field_0x0 = 1;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void DrawEntities(void) {
|
||||
void (*fn)(void);
|
||||
|
||||
gOAMControls._0[6] = gRoomTransition.field_0x2c[3] ? 15 : 0;
|
||||
gOAMControls._4 = gRoomControls.aff_x + gRoomControls.scroll_x;
|
||||
gOAMControls._6 = gRoomControls.aff_y + gRoomControls.scroll_y;
|
||||
gOAMControls.field_0x1++;
|
||||
fn = &gUnk_03006164;
|
||||
fn();
|
||||
}
|
||||
|
||||
void sub_080ADA04(OAMCommand* cmd, void* dst) {
|
||||
void (*fn)(OAMCommand*, void*) = gUnk_0300659C;
|
||||
fn(cmd, dst);
|
||||
}
|
||||
|
||||
void DrawDirect(u32 a1, u32 a2) {
|
||||
void (*fn)(OAMCommand*, u32, u32) = gUnk_03006580;
|
||||
fn(&gOamCmd, a1, a2);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 filler2[32];
|
||||
u16 unk66;
|
||||
} struct_0300110C;
|
||||
|
||||
extern struct_0300110C gUnk_0300110C;
|
||||
|
||||
void sub_080300AC(void) {
|
||||
MemClear(&gUnk_0300110C.unk0, 0x44);
|
||||
gUnk_0300110C.unk66 = 0xff;
|
||||
}
|
||||
|
||||
void sub_080300C4(void) {
|
||||
if (gScreenTransition.field_0xae == 0xff) {
|
||||
gScreenTransition.field_0xac = 0;
|
||||
MemClear(gScreenTransition.field_0x6c, sizeof gScreenTransition.field_0x6c);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
extern u32* gUnk_020354B0;
|
||||
extern u32 gUnk_02024050;
|
||||
extern u32 gRoomMemory;
|
||||
|
||||
extern void MemFill32(u32, void*, u32);
|
||||
|
||||
void sub_08049CD4() {
|
||||
MemFill32(0xFFFFFFFF, &gUnk_02024050, 0x40);
|
||||
gUnk_020354B0 = &gUnk_02024050;
|
||||
void ClearRoomMemory(void) {
|
||||
MemFill32(0xFFFFFFFF, &gRoomMemory, 0x40);
|
||||
gUnk_020354B0 = &gRoomMemory;
|
||||
}
|
||||
|
||||
void sub_08049CF4(u8* arg0) {
|
||||
|
||||
+22
-25
@@ -3,25 +3,23 @@
|
||||
#include "room.h"
|
||||
#include "menu.h"
|
||||
#include "area.h"
|
||||
#include "utils.h"
|
||||
#include "structures.h"
|
||||
#include "common.h"
|
||||
#include "save.h"
|
||||
#include "item.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
u8 filler[7];
|
||||
} struct_080FD5B4;
|
||||
|
||||
extern SaveFile gSave;
|
||||
extern struct_080FD5B4 gUnk_080FD5B4[];
|
||||
extern ScreenTransition gScreenTransition;
|
||||
|
||||
extern u8 gUnk_0200AF13;
|
||||
extern u8 gUnk_0200AF14;
|
||||
extern u32 gUnk_080015BC;
|
||||
extern u8 gUnk_080FE1C6[];
|
||||
extern u32 gUnk_02034398;
|
||||
extern void (*const gUnk_080FE2A0[])();
|
||||
extern void (*const gUnk_080FE2A0[])(void);
|
||||
|
||||
void ForceEquipItem(u32, u8);
|
||||
extern void sub_0807CAA0(u32, u32);
|
||||
@@ -44,13 +42,13 @@ u32 IsItemEquipped(u32 itemID) {
|
||||
return itemSlot;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) {
|
||||
// reg-alloc
|
||||
void PutItemOnSlot(u32 itemID) {
|
||||
u32 itemSlot;
|
||||
if (itemID < 0x47) {
|
||||
register u32 itemID2 asm("r5") = itemID;
|
||||
if (itemID2 < 0x47) {
|
||||
sub_0807CAA0(0, 1);
|
||||
}
|
||||
if (itemID - 1 < 0x1f) {
|
||||
if (itemID2 - 1 < 0x1f) {
|
||||
itemSlot = 2;
|
||||
if (gSave.stats.itemOnA == 0) {
|
||||
itemSlot = 0;
|
||||
@@ -58,7 +56,7 @@ NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) {
|
||||
itemSlot = 1;
|
||||
}
|
||||
if (itemSlot == 2) {
|
||||
u8 temp = gUnk_080FD5B4[itemID].unk;
|
||||
u8 temp = gUnk_080FD5B4[itemID2].unk;
|
||||
if (temp == gUnk_080FD5B4[gSave.stats.itemOnA].unk) {
|
||||
itemSlot = 0;
|
||||
} else {
|
||||
@@ -70,10 +68,9 @@ NONMATCH("asm/non_matching/PutItemOnSlot.inc", void PutItemOnSlot(u32 itemID)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
ForceEquipItem(itemID, itemSlot);
|
||||
ForceEquipItem(itemID2, itemSlot);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
ASM_FUNC("asm/non_matching/ForceEquipItem.inc", void ForceEquipItem(u32 itemID, u8 itemSlot))
|
||||
|
||||
@@ -97,20 +94,20 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
|
||||
return bottleIndex;
|
||||
}
|
||||
|
||||
u32 ItemIsSword(u32 arg0) {
|
||||
switch (arg0) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
return 1;
|
||||
bool32 ItemIsSword(u32 item) {
|
||||
switch (item) {
|
||||
case ITEM_SMITH_SWORD:
|
||||
case ITEM_GREEN_SWORD:
|
||||
case ITEM_RED_SWORD:
|
||||
case ITEM_BLUE_SWORD:
|
||||
case ITEM_FOURSWORD:
|
||||
return TRUE;
|
||||
default:
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
u32 ItemIsShield(u32 id) {
|
||||
bool32 ItemIsShield(u32 id) {
|
||||
switch (id) {
|
||||
case 13:
|
||||
case 14:
|
||||
@@ -120,7 +117,7 @@ u32 ItemIsShield(u32 id) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 ItemIsBottle(u32 id) {
|
||||
bool32 ItemIsBottle(u32 id) {
|
||||
switch (id) {
|
||||
case 28:
|
||||
case 29:
|
||||
@@ -152,7 +149,7 @@ NONMATCH("asm/non_matching/sub_08054524.inc", void sub_08054524(void)) {
|
||||
|
||||
bVar1 = gArea.locationIndex;
|
||||
if (gArea.locationIndex == 0) {
|
||||
bVar1 = gScreenTransition.player_status.field_0x24[0xa];
|
||||
bVar1 = gRoomTransition.player_status.field_0x24[0xa];
|
||||
}
|
||||
if (bVar1 > 0x16) {
|
||||
bVar1 = 0;
|
||||
@@ -266,7 +263,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
|
||||
}
|
||||
*/
|
||||
|
||||
void sub_08054870(void) {
|
||||
void Subtask_WorldEvent(void) {
|
||||
#if !(defined(DEMO_USA) || defined(DEMO_JP))
|
||||
gUnk_080FE2A0[gMenu.menuType]();
|
||||
#endif
|
||||
|
||||
+6
-21
@@ -1,25 +1,10 @@
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
u16 unk4;
|
||||
u8 unk6;
|
||||
u8 unk7;
|
||||
} VStruct;
|
||||
|
||||
typedef struct {
|
||||
u8 _0[0x20];
|
||||
struct OamData oam[0x80];
|
||||
VStruct unk[0x100];
|
||||
} UStruct;
|
||||
|
||||
extern UStruct gUnk_03000000;
|
||||
#include "structures.h"
|
||||
|
||||
bool32 sub_0805EC04(Entity* this) {
|
||||
u32 i = 1;
|
||||
UStruct* temp = &gUnk_03000000;
|
||||
OAMControls* temp = &gOAMControls;
|
||||
u32 j = 1;
|
||||
for (; i < 0x20; i++) {
|
||||
if (temp->unk[i].unk6 == 0) {
|
||||
@@ -34,13 +19,13 @@ bool32 sub_0805EC04(Entity* this) {
|
||||
|
||||
void sub_0805EC60(Entity* this) {
|
||||
u8 temp;
|
||||
UStruct* temp2;
|
||||
OAMControls* temp2;
|
||||
|
||||
if (this->spriteRendering.b0 != 0) {
|
||||
this->spriteRendering.b0 = 0;
|
||||
temp = this->spriteOrientation.b1;
|
||||
this->spriteOrientation.b1 = 0;
|
||||
temp2 = &gUnk_03000000;
|
||||
temp2 = &gOAMControls;
|
||||
temp2->unk[temp].unk6 = 0;
|
||||
}
|
||||
}
|
||||
@@ -50,9 +35,9 @@ ASM_FUNC("asm/non_matching/sub_0805EC9C.inc", bool32 sub_0805EC9C(Entity* ent, u
|
||||
void sub_0805ECEC(int param_1, u32 param_2, u32 param_3, u32 param_4) {
|
||||
u16* temp;
|
||||
|
||||
gUnk_03000000.unk[0].unk7 = 1;
|
||||
gOAMControls.unk[0].unk7 = 1;
|
||||
|
||||
temp = &gUnk_03000000.unk[param_1].unk0;
|
||||
temp = &gOAMControls.unk[param_1].unk0;
|
||||
temp[0] = param_2;
|
||||
temp[1] = param_3;
|
||||
temp[2] = param_4;
|
||||
|
||||
+4
-5
@@ -10,7 +10,6 @@ typedef struct {
|
||||
u8 field_0x1;
|
||||
} UnkItemStruct;
|
||||
|
||||
Entity* sub_08077C94(ItemBehavior*, u32);
|
||||
void* sub_08077C54(UnkItemStruct* unk);
|
||||
Entity* CreatePlayerBomb(ItemBehavior*, u32);
|
||||
extern Entity* sub_0805E744();
|
||||
@@ -183,7 +182,7 @@ void sub_08077E78(ItemBehavior* arg0, u32 bits) {
|
||||
u32 sub_08077EC8(ItemBehavior* beh) {
|
||||
Unk_struct* arg0 = (Unk_struct*)beh; // @nocheckin
|
||||
|
||||
if ((gPlayerState.field_0x1a[1] & 8) != 0) {
|
||||
if ((gPlayerState.sword_state & 8) != 0) {
|
||||
sub_08077DF4(beh, 0x170);
|
||||
arg0->unk[7] = 0x28;
|
||||
arg0->unk[4] = 7;
|
||||
@@ -195,11 +194,11 @@ u32 sub_08077EC8(ItemBehavior* beh) {
|
||||
}
|
||||
|
||||
bool32 sub_08077EFC(ItemBehavior* arg0) {
|
||||
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO);
|
||||
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90);
|
||||
}
|
||||
|
||||
bool32 sub_08077F10(ItemBehavior* arg0) {
|
||||
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI);
|
||||
return sub_08077F24(arg0, (u16)gPlayerState.field_0x92);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sub_08077F24.inc", bool32 sub_08077F24(ItemBehavior* beh, u32 arg1))
|
||||
@@ -226,7 +225,7 @@ void sub_08077F84(void) {
|
||||
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
|
||||
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
|
||||
sub_0807AA80(&gPlayerEntity);
|
||||
gPlayerState.jumpStatus |= 8;
|
||||
gPlayerState.jump_status |= 8;
|
||||
obj = CreateObject(OBJECT_44, 0, 0);
|
||||
if (obj != NULL) {
|
||||
obj->x = gPlayerEntity.x;
|
||||
|
||||
+1
-8
@@ -1,14 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk[4];
|
||||
u32 unk2;
|
||||
u32 unk4;
|
||||
} Unk_struct;
|
||||
|
||||
extern Unk_struct gUnk_03003DF0[];
|
||||
#include "kinstone.h"
|
||||
|
||||
void sub_08078778(Entity* ent) {
|
||||
sub_0807887C(ent, 1, 0);
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "object.h"
|
||||
#include "effects.h"
|
||||
|
||||
void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = CreateObject(SPECIAL_FX, 2, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff;
|
||||
pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff;
|
||||
pEVar1->collisionLayer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A29FC(Entity* parent) {
|
||||
CreateFx(parent, FX_DASH, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A08(Entity* parent) {
|
||||
CreateFx(parent, FX_6, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A14(Entity* parent) {
|
||||
CreateFx(parent, FX_WATER_SPLASH, 0);
|
||||
}
|
||||
|
||||
Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->actionDelay = 5;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
|
||||
Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
|
||||
if (ent != NULL) {
|
||||
ent->actionDelay = 5;
|
||||
*(u32*)(&ent->field_0x86) = param_4;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity* sub_080A2A64(Entity* parent) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = CreateFx(parent, FX_SPARKLE2, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->spritePriority.b0 = 7;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
+61
-57
@@ -3,10 +3,11 @@
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "save.h"
|
||||
#include "utils.h"
|
||||
#include "common.h"
|
||||
#include "functions.h"
|
||||
#include "enemy.h"
|
||||
#include "effects.h"
|
||||
#include "object.h"
|
||||
#include "game.h"
|
||||
|
||||
extern u8 gCollidableCount;
|
||||
extern u8 gUnk_080B3740[];
|
||||
@@ -30,7 +31,7 @@ extern ColSettings gCollisionMtx[173 * 34];
|
||||
|
||||
extern void gDoCollision(void);
|
||||
u32 sub_08081420(Entity*);
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
s32 sub_08018308(Entity*, Entity*, u32, ColSettings*);
|
||||
void sub_08079D84(void);
|
||||
void sub_080180BC(Entity*, Entity*);
|
||||
@@ -59,7 +60,7 @@ void CollisionMain(void) {
|
||||
if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority)
|
||||
prio = gPriorityHandler.ent_priority;
|
||||
|
||||
// if any min priority is set, dont do collision
|
||||
// if any priority is set, dont do collision
|
||||
if (prio)
|
||||
return;
|
||||
|
||||
@@ -83,19 +84,19 @@ void RegisterPlayerHitbox(void) {
|
||||
gUnk_03003C70[0].node = &gPlayerEntity;
|
||||
}
|
||||
|
||||
// Loop declaration seems wrong
|
||||
NONMATCH("asm/non_matching/arm_proxy/sub_0801766C.inc", u32 sub_0801766C(Entity* this)) {
|
||||
u32 sub_0801766C(Entity* this) {
|
||||
u32 uVar1;
|
||||
LinkedList2* puVar3;
|
||||
LinkedList2* puVar2;
|
||||
LinkedList2* pLVar2;
|
||||
LinkedList2* i;
|
||||
LinkedList2* end;
|
||||
u8* pbVar4;
|
||||
|
||||
if (this->spritePriority.b2 != 0) {
|
||||
return 1;
|
||||
} else {
|
||||
for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) {
|
||||
for (i = gUnk_03003C70, end = gUnk_03003C70 + 16; end > i; ++i) {
|
||||
if (i->node == NULL) {
|
||||
i->node = this;
|
||||
i->flags = 0;
|
||||
@@ -124,19 +125,18 @@ NONMATCH("asm/non_matching/arm_proxy/sub_0801766C.inc", u32 sub_0801766C(Entity*
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
// same loop issue
|
||||
NONMATCH("asm/non_matching/arm_proxy/sub_080176E4.inc", u32 sub_080176E4(Entity* this)) {
|
||||
u32 sub_080176E4(Entity* this) {
|
||||
u32 uVar1;
|
||||
LinkedList2* j;
|
||||
LinkedList2* i;
|
||||
LinkedList2* end;
|
||||
u8* pbVar4;
|
||||
|
||||
if (this->spritePriority.b2 != 0) {
|
||||
return 1;
|
||||
} else {
|
||||
for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) {
|
||||
for (i = gUnk_03003C70, end = gUnk_03003C70 + 16; end > i; ++i) {
|
||||
if (i->node == NULL) {
|
||||
i->node = this;
|
||||
i->flags = 1;
|
||||
@@ -153,12 +153,15 @@ NONMATCH("asm/non_matching/arm_proxy/sub_080176E4.inc", u32 sub_080176E4(Entity*
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
// you guessed it
|
||||
// Several issues:
|
||||
// 1. b2 mask value is set before the loop even begins
|
||||
// 2. data is allocated mid function
|
||||
// 3. regalloc
|
||||
NONMATCH("asm/non_matching/arm_proxy/sub_08017744.inc", void sub_08017744(Entity* this)) {
|
||||
LinkedList2* i;
|
||||
for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) {
|
||||
LinkedList2* end;
|
||||
for (i = gUnk_03003C70, end = gUnk_03003C70 + 16; end > i; ++i) {
|
||||
if (i->node == this) {
|
||||
if (this->spritePriority.b2 != 0) {
|
||||
this->spritePriority.b2 = 0;
|
||||
@@ -179,17 +182,17 @@ NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Enti
|
||||
u32 this_d;
|
||||
u32 depth;
|
||||
|
||||
if ((that->collisionLayer & this->collisionLayer) != 0) {
|
||||
if ((this->collisionLayer & that->collisionLayer) != 0) {
|
||||
Hitbox* bb_this = this->hitbox;
|
||||
Hitbox* bb_that = that->hitbox;
|
||||
u32 this_w = bb_this->width;
|
||||
u32 that_w = bb_that->width;
|
||||
if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <=
|
||||
(this_w + that_w) * 2) {
|
||||
u32 sumw = this_w + that_w;
|
||||
if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + sumw <= (sumw)*2) {
|
||||
u32 this_h = bb_this->height;
|
||||
u32 that_h = bb_that->height;
|
||||
if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <=
|
||||
(this_h + that_h) * 2) {
|
||||
u32 sumh = this_h + that_h;
|
||||
if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + sumh <= (sumh)*2) {
|
||||
if ((this->field_0x3c & 0x10) != 0)
|
||||
this_d = ((Hitbox3D*)bb_this)->depth;
|
||||
else
|
||||
@@ -232,7 +235,7 @@ s32 sub_08017874(Entity* a, Entity* b) {
|
||||
if (newDmg <= 0)
|
||||
newDmg = 1;
|
||||
v5 = ModHealth(-newDmg);
|
||||
sub_0800449C(a, 122);
|
||||
SoundReqClipped(a, 122);
|
||||
} else {
|
||||
v6 = b->damage;
|
||||
if (b->kind == 8) {
|
||||
@@ -248,9 +251,9 @@ s32 sub_08017874(Entity* a, Entity* b) {
|
||||
v5 = a->health - v6;
|
||||
if (a->kind == 3) {
|
||||
if ((a->field_0x6c.HALF.HI & 1) != 0)
|
||||
sub_0800449C(a, 295);
|
||||
SoundReqClipped(a, 295);
|
||||
else
|
||||
sub_0800449C(a, 254);
|
||||
SoundReqClipped(a, 254);
|
||||
}
|
||||
}
|
||||
if (v5 <= 0) {
|
||||
@@ -302,7 +305,7 @@ void sub_080179EC(Entity* a1, Entity* a2) {
|
||||
Entity* sub_08017A90(Entity* a1, Entity* parent) {
|
||||
Entity* e;
|
||||
|
||||
e = (Entity*)CreateObject(153, 0, 0);
|
||||
e = (Entity*)CreateObject(OBJECT_99, 0, 0);
|
||||
if (e != NULL) {
|
||||
e->animationState = (a1->direction >> 3) & 3;
|
||||
e->spriteOffsetX = a1->x.HALF.HI - parent->x.HALF.HI;
|
||||
@@ -314,7 +317,6 @@ Entity* sub_08017A90(Entity* a1, Entity* parent) {
|
||||
}
|
||||
|
||||
typedef s32 (*CollisionHandler)(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
|
||||
s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
|
||||
s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
|
||||
s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
|
||||
s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
|
||||
@@ -389,11 +391,11 @@ s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
}
|
||||
|
||||
s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
if ((gPlayerState.flags & (0x1 | 0x80 | 0x400 | 0x1000)) == 0) {
|
||||
Entity* e = CreateObject(66, 1, 0);
|
||||
if ((gPlayerState.flags & (PL_BUSY | PL_MINISH | PL_BURNING | 0x1000)) == 0) {
|
||||
Entity* e = CreateObject(OBJECT_42, 1, 0);
|
||||
if (e != NULL) {
|
||||
e->child = org;
|
||||
gPlayerState.flags |= 0x400;
|
||||
gPlayerState.flags |= PL_BURNING;
|
||||
org->animationState = (direction ^ 0x10) >> 2;
|
||||
}
|
||||
}
|
||||
@@ -408,12 +410,12 @@ s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
}
|
||||
|
||||
s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
if ((gPlayerState.flags & (0x1 | 0x80 | 0x800 | 0x1000)) == 0 && gPlayerState.playerAction == 0) {
|
||||
if ((gPlayerState.flags & (PL_BUSY | PL_MINISH | PL_FROZEN | 0x1000)) == 0 && gPlayerState.queued_action == 0) {
|
||||
if (org->action == 1 || org->action == 24) {
|
||||
tgt->damage = 4;
|
||||
org->health = sub_08017874(org, tgt);
|
||||
gPlayerState.flags = 0x800;
|
||||
gPlayerState.playerAction = 13;
|
||||
gPlayerState.flags = PL_FROZEN;
|
||||
gPlayerState.queued_action = PLAYER_FROZEN;
|
||||
}
|
||||
}
|
||||
org->knockbackDuration = 12;
|
||||
@@ -424,9 +426,9 @@ s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
return 1;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/collision/sub_08017CBC.inc",
|
||||
s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)) {
|
||||
if (((-(((direction ^ 0x10) - 0xc) & 0x1f) + tgt->direction) & 0x1f) < 0x19) {
|
||||
s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
direction = ((direction ^ 0x10) - 0xc) & 0x1f;
|
||||
if (((-direction + tgt->direction) & 0x1f) < 0x19) {
|
||||
org->iframes = -12;
|
||||
tgt->iframes = -12;
|
||||
sub_08017940(org, tgt);
|
||||
@@ -440,10 +442,9 @@ NONMATCH("asm/non_matching/collision/sub_08017CBC.inc",
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
gPlayerState.field_0x1a[0] = 1;
|
||||
gPlayerState.mobility = 1;
|
||||
org->field_0x7a.HWORD = 600;
|
||||
org->knockbackDuration = 12;
|
||||
org->iframes = 16;
|
||||
@@ -533,15 +534,15 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
if (org == &gPlayerEntity) {
|
||||
if (sub_08079F8C() &&
|
||||
#ifdef EU
|
||||
(gPlayerState.flags & 0x81) == 0 &&
|
||||
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
|
||||
#else
|
||||
(gPlayerState.flags & PL_MINISH) == 0 &&
|
||||
#endif
|
||||
!gPlayerState.swimState) {
|
||||
gPlayerState.field_0x1a[0] |= 0x80u;
|
||||
gPlayerState.field_0xa |= 0x80u;
|
||||
gPlayerState.flags |= 0x10u;
|
||||
gPlayerState.jumpStatus = 0;
|
||||
!gPlayerState.swim_state) {
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.flags |= PL_CAPTURED;
|
||||
gPlayerState.jump_status = 0;
|
||||
if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) {
|
||||
org->z.HALF.HI = 0;
|
||||
PositionRelative(org, tgt, 0, 0x10000);
|
||||
@@ -565,19 +566,22 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// inverted branch
|
||||
NONMATCH("asm/non_matching/collision/sub_0801802C.inc",
|
||||
s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)) {
|
||||
s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
int kind;
|
||||
ColSettings* p;
|
||||
u32 x;
|
||||
|
||||
kind = org->kind;
|
||||
if (kind == 1) {
|
||||
if (sub_08079F8C() && (((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1Fu) <= 0xA)
|
||||
goto _0801807A;
|
||||
if (sub_08079F8C()) {
|
||||
if (((((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F)) > 0xA) {
|
||||
goto _08018090;
|
||||
} else {
|
||||
goto _0801807A;
|
||||
}
|
||||
}
|
||||
} else if (kind == 8) {
|
||||
if ((((org->direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1Fu) <= 0xA) {
|
||||
if ((((org->direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F) <= 0xA) {
|
||||
org->health = 0;
|
||||
_0801807A:
|
||||
sub_080180BC(org, tgt);
|
||||
@@ -587,10 +591,10 @@ NONMATCH("asm/non_matching/collision/sub_0801802C.inc",
|
||||
org->health = 0;
|
||||
return 0;
|
||||
}
|
||||
_08018090:
|
||||
x = 0x11aa;
|
||||
return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080180BC(Entity* org, Entity* tgt) {
|
||||
if (org->iframes == 0)
|
||||
@@ -622,18 +626,18 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
if (tgt->field_0x43 == 0) {
|
||||
if (org == &gPlayerEntity) {
|
||||
if (((sub_08079F8C() != 0) &&
|
||||
if (sub_08079F8C() &&
|
||||
#ifdef EU
|
||||
((gPlayerState.flags & 0x81) == 0)) &&
|
||||
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
|
||||
#else
|
||||
((gPlayerState.flags & 0x40080) == 0)) &&
|
||||
(gPlayerState.flags & (PL_MINISH | PL_ROLLING)) == 0 &&
|
||||
#endif
|
||||
(gPlayerState.swimState == 0)) {
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.swim_state == 0) {
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.flags |= 0x100;
|
||||
gPlayerState.jumpStatus = 0;
|
||||
gPlayerEntity.flags &= ~0x80;
|
||||
gPlayerState.flags |= PL_DISABLE_ITEMS;
|
||||
gPlayerState.jump_status = 0;
|
||||
COLLISION_OFF(&gPlayerEntity);
|
||||
gPlayerEntity.spriteRendering.b3 = tgt->spriteRendering.b3;
|
||||
gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY;
|
||||
gPlayerEntity.iframes = 0xff;
|
||||
@@ -749,7 +753,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
|
||||
}
|
||||
} else if (org->id == 3) {
|
||||
if (settings->_9) {
|
||||
sub_0800449C(tgt, 254);
|
||||
SoundReqClipped(tgt, 254);
|
||||
}
|
||||
} else if (org->id == 5) {
|
||||
gPlayerEntity.iframes = 0x80;
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "common.h"
|
||||
#include "color.h"
|
||||
|
||||
void LoadObjPaletteAtIndex(u32 a1, u32 a2);
|
||||
|
||||
static void sub_0801CFD0(u32 a1);
|
||||
|
||||
void ResetPaletteTable(u32 a1) {
|
||||
u32 i;
|
||||
|
||||
MemClear(gPaletteList, 0x40);
|
||||
for (i = 0; i < 6; ++i) {
|
||||
sub_0801CFD0(i);
|
||||
}
|
||||
sub_0801D000(a1);
|
||||
}
|
||||
|
||||
void sub_0801CFD0(u32 a1) {
|
||||
Palette* p = &gPaletteList[a1];
|
||||
p->_0 = ((s8)p->_0 & ~0xf) | 4;
|
||||
p->_0 = (p->_0 & 0xf) | 0x10;
|
||||
p->_1 = 0x80;
|
||||
p->_2 = 0xFFFF;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/sub_0801D000.inc", void sub_0801D000(u32 a1));
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", void LoadObjPalette(Entity* entity, u32 a2));
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/FindPalette.inc", s32 FindPalette(u32 a1));
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/FindFreeObjPalette.inc", u32 FindFreeObjPalette(u32 a1));
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/SetEntityObjPalette.inc", void SetEntityObjPalette(Entity* entity, u32 palette));
|
||||
|
||||
void UnloadOBJPalette(Entity* entity) {
|
||||
u8* p = &entity->spriteAnimation[1];
|
||||
u32 idx = *p;
|
||||
*p = 0;
|
||||
sub_0801D244(idx);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/sub_0801D244.inc", void sub_0801D244(u32 a1));
|
||||
|
||||
void sub_0801D28C(Entity* entity, u32 palette) {
|
||||
u32 c = entity->spriteAnimation[1];
|
||||
Palette* list = gPaletteList;
|
||||
Palette* p = &list[c];
|
||||
u32 lo = (u32)(p->_0 << 0x1C) >> 0x1C;
|
||||
|
||||
if (lo == 3) {
|
||||
p->_2 = palette;
|
||||
LoadObjPaletteAtIndex(palette, c);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeObjPalette(Entity* entity, u32 a2) {
|
||||
UnloadOBJPalette(entity);
|
||||
LoadObjPalette(entity, a2);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/LoadObjPaletteAtIndex.inc", void LoadObjPaletteAtIndex(u32 a1, u32 a2));
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/CleanUpObjPalettes.inc", void CleanUpObjPalettes(void));
|
||||
|
||||
u32 sub_0801D458(u32 a1) {
|
||||
u32 i;
|
||||
for (i = a1; i < 16; i++) {
|
||||
s32 tmp = ((u32)gPaletteList[i]._0 << 28) >> 28;
|
||||
switch (tmp) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 4:
|
||||
continue;
|
||||
default:
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/color/sub_0801D48C.inc", void sub_0801D48C(u32 a1, u32 a2));
|
||||
+681
@@ -0,0 +1,681 @@
|
||||
#include "global.h"
|
||||
#include "asm.h"
|
||||
#include "common.h"
|
||||
#include "structures.h"
|
||||
#include "screen.h"
|
||||
#include "main.h"
|
||||
#include "area.h"
|
||||
#include "room.h"
|
||||
#include "fileselect.h"
|
||||
#include "game.h"
|
||||
#include "flags.h"
|
||||
#include "kinstone.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
|
||||
typedef struct {
|
||||
u8 _0;
|
||||
u8 _1;
|
||||
u8 _2;
|
||||
u8 _3;
|
||||
} DungeonLayout;
|
||||
|
||||
extern u8 gUnk_03003DE0;
|
||||
extern u8 gzHeap[0x1000];
|
||||
extern u8 gUnk_0201AEE0[0x2000];
|
||||
extern u8 gUnk_080CA11C[];
|
||||
|
||||
extern void (*gUnk_080C9CAC[])(void);
|
||||
|
||||
static void StoreKeyInput(Input* input, u32 keyInput);
|
||||
void ClearOAM(void);
|
||||
void ResetScreenRegs(void);
|
||||
void sub_0801E0E0(u32);
|
||||
void sub_0801E24C(u32, u32);
|
||||
void sub_0801E290(u32, u32, u32);
|
||||
s32 sub_0801E8B0(u32);
|
||||
|
||||
extern u32 sub_0807CB24(u32, u32);
|
||||
|
||||
typedef struct {
|
||||
u16 paletteId;
|
||||
u8 destPaletteNum;
|
||||
u8 numPalettes;
|
||||
} PaletteGroup;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
int raw;
|
||||
struct {
|
||||
u8 filler0[0x3];
|
||||
u8 unk3;
|
||||
} bytes;
|
||||
} unk0;
|
||||
u32 dest;
|
||||
u32 unk8;
|
||||
} GfxItem;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[0xA00];
|
||||
} struct_02017AA0;
|
||||
extern struct_02017AA0 gUnk_02017AA0[];
|
||||
extern u8 gUnk_03003DE4;
|
||||
|
||||
typedef struct {
|
||||
u8 _0[4];
|
||||
u8 evt_type;
|
||||
u8 _5[3];
|
||||
} struct_080C9CBC;
|
||||
extern struct_080C9CBC gUnk_080C9CBC[];
|
||||
|
||||
typedef struct {
|
||||
u8 evt_type;
|
||||
u8 entity_idx;
|
||||
u8 _2[6];
|
||||
u16 x;
|
||||
u16 y;
|
||||
u8 _c[4];
|
||||
u8 _10;
|
||||
u8 _11;
|
||||
u16 flag;
|
||||
} struct_080FE320;
|
||||
extern struct_080FE320 gUnk_080FE320[];
|
||||
|
||||
extern const PaletteGroup* gPaletteGroups[];
|
||||
extern const u8 gGlobalGfxAndPalettes[];
|
||||
extern u32 gUsedPalettes;
|
||||
extern u16 gPaletteBuffer[];
|
||||
extern const GfxItem* gGfxGroups[];
|
||||
|
||||
u32 DecToHex(u32 value) {
|
||||
u32 result;
|
||||
register u32 r1 asm("r1");
|
||||
|
||||
if (value >= 100000000) {
|
||||
return 0x99999999;
|
||||
}
|
||||
|
||||
result = Div(value, 10000000) * 0x10000000;
|
||||
result += Div(r1, 1000000) * 0x1000000;
|
||||
result += Div(r1, 100000) * 0x100000;
|
||||
result += Div(r1, 10000) * 0x10000;
|
||||
result += Div(r1, 1000) * 0x1000;
|
||||
result += Div(r1, 100) * 0x100;
|
||||
result += Div(r1, 10) * 0x10;
|
||||
return result + r1;
|
||||
}
|
||||
|
||||
u32 ReadBit(void* src, u32 bit) {
|
||||
return (*((u8*)src + bit / 8) >> (bit % 8)) & 1;
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/common/WriteBit.inc", u32 WriteBit(void* src, u32 bit)) {
|
||||
u8* b;
|
||||
u32 mask;
|
||||
u32 orig;
|
||||
|
||||
b = (u8*)(bit / 8 + (u32)src);
|
||||
mask = 1 << (bit % 8);
|
||||
orig = *b;
|
||||
*b |= mask;
|
||||
orig &= mask;
|
||||
return orig;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/common/ClearBit.inc", u32 ClearBit(void* src, u32 bit)) {
|
||||
u8* b;
|
||||
u32 mask;
|
||||
u32 orig;
|
||||
|
||||
b = (u8*)(bit / 8 + (u32)src);
|
||||
mask = 1 << (bit % 8);
|
||||
orig = *b;
|
||||
*b &= ~mask;
|
||||
orig &= mask;
|
||||
return orig;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void MemFill16(u32 value, void* dest, u32 size) {
|
||||
DmaFill16(3, value, dest, size);
|
||||
}
|
||||
|
||||
void MemFill32(u32 value, void* dest, u32 size) {
|
||||
DmaFill32(3, value, dest, size);
|
||||
}
|
||||
|
||||
void MemClear(void* dest, u32 size) {
|
||||
u32 zero = 0;
|
||||
|
||||
// alignment check
|
||||
switch (((uintptr_t)dest | size) % 4) {
|
||||
case 0:
|
||||
MemFill32(0, dest, size);
|
||||
break;
|
||||
case 2:
|
||||
MemFill16(0, dest, size);
|
||||
break;
|
||||
default:
|
||||
do {
|
||||
*(u8*)dest = zero;
|
||||
dest++;
|
||||
size--;
|
||||
} while (size != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void MemCopy(const void* src, void* dest, u32 size) {
|
||||
switch (((uintptr_t)src | (uintptr_t)dest | size) % 4) {
|
||||
case 0:
|
||||
DmaCopy32(3, src, dest, size);
|
||||
break;
|
||||
case 2:
|
||||
DmaCopy16(3, src, dest, size);
|
||||
break;
|
||||
default:
|
||||
do {
|
||||
*(u8*)dest = *(u8*)src;
|
||||
src++;
|
||||
dest++;
|
||||
} while (--size);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadKeyInput(void) {
|
||||
u32 keyInput = ~REG_KEYINPUT & KEYS_MASK;
|
||||
StoreKeyInput(&gInput, keyInput);
|
||||
}
|
||||
|
||||
static void StoreKeyInput(Input* input, u32 keyInput) {
|
||||
u32 heldKeys = input->heldKeys;
|
||||
u32 difference = keyInput & ~heldKeys;
|
||||
input->newKeys = difference;
|
||||
if (keyInput == heldKeys) {
|
||||
if (--input->unk7 == 0) {
|
||||
input->unk7 = 4;
|
||||
input->unk4 = keyInput;
|
||||
} else {
|
||||
input->unk4 = 0;
|
||||
}
|
||||
} else {
|
||||
input->unk7 = 20;
|
||||
input->unk4 = difference;
|
||||
}
|
||||
input->heldKeys = keyInput;
|
||||
}
|
||||
|
||||
void LoadPaletteGroup(u32 group) {
|
||||
const PaletteGroup* paletteGroup = gPaletteGroups[group];
|
||||
while (1) {
|
||||
u32 destPaletteNum = paletteGroup->destPaletteNum;
|
||||
u32 numPalettes = paletteGroup->numPalettes & 0xF;
|
||||
if (numPalettes == 0) {
|
||||
numPalettes = 16;
|
||||
}
|
||||
LoadPalettes(&gGlobalGfxAndPalettes[paletteGroup->paletteId * 32], destPaletteNum, numPalettes);
|
||||
if ((paletteGroup->numPalettes & 0x80) == 0) {
|
||||
break;
|
||||
}
|
||||
paletteGroup++;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadPalettes(const u8* src, s32 destPaletteNum, s32 numPalettes) {
|
||||
u16* dest;
|
||||
u32 size = numPalettes * 32;
|
||||
u32 usedPalettesMask = 1 << destPaletteNum;
|
||||
while (--numPalettes > 0) {
|
||||
usedPalettesMask |= (usedPalettesMask << 1);
|
||||
}
|
||||
gUsedPalettes |= usedPalettesMask;
|
||||
dest = &gPaletteBuffer[destPaletteNum * 16];
|
||||
DmaCopy32(3, src, dest, size);
|
||||
}
|
||||
|
||||
void SetColor(u32 colorIndex, u32 color) {
|
||||
gPaletteBuffer[colorIndex] = color;
|
||||
gUsedPalettes |= 1 << (colorIndex / 16);
|
||||
}
|
||||
|
||||
void SetFillColor(u32 color, u32 disable_layers) {
|
||||
if (disable_layers) {
|
||||
gScreen.lcd.displayControlMask = ~(DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON);
|
||||
} else {
|
||||
gScreen.lcd.displayControlMask = ~0;
|
||||
}
|
||||
SetColor(0, color);
|
||||
}
|
||||
|
||||
void LoadGfxGroup(u32 group) {
|
||||
u32 terminator;
|
||||
u32 dmaCtrl;
|
||||
int gfxOffset;
|
||||
const u8* src;
|
||||
u32 dest;
|
||||
int size;
|
||||
const GfxItem* gfxItem = gGfxGroups[group];
|
||||
while (1) {
|
||||
u32 loadGfx = FALSE;
|
||||
u32 ctrl = gfxItem->unk0.bytes.unk3;
|
||||
ctrl &= 0xF;
|
||||
switch (ctrl) {
|
||||
case 0x7:
|
||||
loadGfx = TRUE;
|
||||
break;
|
||||
case 0xD:
|
||||
return;
|
||||
case 0xE:
|
||||
if (gSaveHeader->language != 0 && gSaveHeader->language != 1) {
|
||||
loadGfx = TRUE;
|
||||
}
|
||||
break;
|
||||
case 0xF:
|
||||
if (gSaveHeader->language != 0) {
|
||||
loadGfx = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (ctrl == gSaveHeader->language) {
|
||||
loadGfx = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadGfx) {
|
||||
gfxOffset = gfxItem->unk0.raw & 0xFFFFFF;
|
||||
src = &gGlobalGfxAndPalettes[gfxOffset];
|
||||
dest = gfxItem->dest;
|
||||
size = gfxItem->unk8;
|
||||
dmaCtrl = 0x80000000;
|
||||
if (size < 0) {
|
||||
if (dest >= VRAM) {
|
||||
LZ77UnCompVram(src, (void*)dest);
|
||||
} else {
|
||||
LZ77UnCompWram(src, (void*)dest);
|
||||
}
|
||||
} else {
|
||||
DmaSet(3, src, dest, dmaCtrl | ((u32)size >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
terminator = gfxItem->unk0.bytes.unk3;
|
||||
terminator &= 0x80;
|
||||
gfxItem++;
|
||||
if (!terminator) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc
|
||||
NONMATCH("asm/non_matching/common/sub_0801D898.inc", void sub_0801D898(void* dest, void* src, u32 word, u32 size)) {
|
||||
u32 v6;
|
||||
u32 i;
|
||||
|
||||
if (size & 0x8000)
|
||||
v6 = 0x40;
|
||||
else
|
||||
v6 = 0x20;
|
||||
|
||||
i = size & ~0x8000;
|
||||
do {
|
||||
DmaSet(3, src, dest, word | 0x80000000) src += word * 2;
|
||||
dest += v6 * 2;
|
||||
} while (--i);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/zMalloc.inc", void* zMalloc(u32 size));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/zFree.inc", void zFree(void* ptr));
|
||||
|
||||
void zMallocInit(void) {
|
||||
MemClear(gzHeap, sizeof(gzHeap));
|
||||
}
|
||||
|
||||
void DispReset(bool32 refresh) {
|
||||
gMain.interruptFlag = 1;
|
||||
gUnk_03003DE0 = 0;
|
||||
gFadeControl.active = 0;
|
||||
gScreen._6d = 0;
|
||||
gScreen._6c = 0;
|
||||
DmaStop(0);
|
||||
REG_DISPCNT = 0;
|
||||
ClearOAM();
|
||||
ResetScreenRegs();
|
||||
MemClear((void*)0x600C000, 0x20);
|
||||
MemClear(gBG0Buffer, 0x800);
|
||||
gScreen.bg0.updated = refresh;
|
||||
}
|
||||
|
||||
void ClearOAM(void) {
|
||||
u8* d = (u8*)gOAMControls.oam;
|
||||
u8* mem = (u8*)0x07000000;
|
||||
u32 i;
|
||||
for (i = 128; i != 0; --i) {
|
||||
*(u16*)d = 0x2A0;
|
||||
d += 8;
|
||||
*(u16*)mem = 0x2A0;
|
||||
mem += 8;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetScreenRegs(void) {
|
||||
MemClear(&gScreen, sizeof(gScreen));
|
||||
gScreen.bg0.tilemap = &gBG0Buffer;
|
||||
gScreen.bg0.control = 0x1F0C;
|
||||
gScreen.bg1.tilemap = &gBG1Buffer;
|
||||
gScreen.bg1.control = 0x1C01;
|
||||
gScreen.bg2.tilemap = &gBG2Buffer;
|
||||
gScreen.bg2.control = 0x1D02;
|
||||
gScreen.bg3.tilemap = &gBG3Buffer;
|
||||
gScreen.bg3.control = 0x1E03;
|
||||
gScreen.lcd.displayControl = 0x140;
|
||||
gScreen.lcd.displayControlMask = 0xffff;
|
||||
}
|
||||
|
||||
u32 sub_0801DB94(void) {
|
||||
return gRoomTransition.player_status.dungeon_map_y >> 11;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/DrawDungeonMap.inc", void DrawDungeonMap(u32 floor, struct_02019EE0* data, u32 size));
|
||||
|
||||
void sub_0801DD58(u32 area, u32 room) {
|
||||
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
|
||||
gArea.pCurrentRoomInfo->map_x = hdr->map_x;
|
||||
gArea.pCurrentRoomInfo->map_y = hdr->map_y;
|
||||
}
|
||||
|
||||
void LoadDungeonMap(void) {
|
||||
LoadResourceAsync(gUnk_0201AEE0, 0x6006000, sizeof(gUnk_0201AEE0));
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/DrawDungeonFeatures.inc", void DrawDungeonFeatures(u32 room, void* data, u32 size));
|
||||
|
||||
u32 sub_0801DF10(DungeonLayout* lyt) {
|
||||
u32 offset;
|
||||
|
||||
if (lyt->_3 == 1)
|
||||
offset = 0x300;
|
||||
else
|
||||
offset = GetFlagBankOffset(lyt->_0);
|
||||
return offset;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801DF28.inc", void sub_0801DF28(u32 a1, u32 a2, u32 a3));
|
||||
|
||||
u32 sub_0801DF60(u32 a1, u8* p) {
|
||||
return (p[a1 >> 2] >> (2 * (~a1 & 3))) & 3;
|
||||
}
|
||||
|
||||
u32 sub_0801DF78(u32 a1, u32 a2) {
|
||||
switch (a1) {
|
||||
case 0:
|
||||
case 1:
|
||||
default:
|
||||
return a1;
|
||||
case 2:
|
||||
return a2;
|
||||
case 3:
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0801DF90(u8* a1, u32 a2) {
|
||||
if (a1 == NULL)
|
||||
return 0;
|
||||
|
||||
for (; *a1 != 0; a1 += 8) {
|
||||
if (*a1 == 1)
|
||||
return CheckLocalFlagByBank(a2, a1[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0801DFB4(Entity* entity, u32 a2, u32 a3, u32 a4) {
|
||||
MemClear(&gFuseInfo, sizeof(gFuseInfo));
|
||||
gFuseInfo._6 = a2;
|
||||
gFuseInfo._8 = a3;
|
||||
gFuseInfo._a = a4;
|
||||
gFuseInfo.ent = entity;
|
||||
gFuseInfo._3 = gUnk_03003DF0[0].unk[2];
|
||||
if (entity != NULL) {
|
||||
gFuseInfo._4 = entity->updatePriority;
|
||||
entity->updatePriority = 2;
|
||||
}
|
||||
gFuseInfo._0 = 0;
|
||||
}
|
||||
|
||||
u32 sub_0801E00C(void) {
|
||||
gUnk_080C9CAC[gFuseInfo.action]();
|
||||
return gFuseInfo._0;
|
||||
}
|
||||
|
||||
void sub_0801E02C(void) {
|
||||
sub_0801E0E0(gFuseInfo._6);
|
||||
gFuseInfo._0 = 3;
|
||||
gFuseInfo.action = 1;
|
||||
}
|
||||
|
||||
void sub_0801E044(void) {
|
||||
if ((gMessage.doTextBox & 0x7F) == 0) {
|
||||
MenuFadeIn(4, 0);
|
||||
gFuseInfo._0 = 4;
|
||||
gFuseInfo.action = 2;
|
||||
SoundReq(0x6b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801E074(void) {
|
||||
u32 tmp;
|
||||
switch (gFuseInfo._0) {
|
||||
case 5:
|
||||
tmp = gFuseInfo._8;
|
||||
break;
|
||||
case 6:
|
||||
tmp = gFuseInfo._a;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
sub_0801E0E0(tmp);
|
||||
gFuseInfo.action = 3;
|
||||
}
|
||||
|
||||
void sub_0801E0A0(void) {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
if (gFuseInfo.ent != NULL) {
|
||||
gFuseInfo.ent->updatePriority = gFuseInfo._4;
|
||||
}
|
||||
gFuseInfo._0 = gFuseInfo._0 == 6 ? 2 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801E0E0(u32 idx) {
|
||||
if (idx != 0) {
|
||||
if (gFuseInfo.ent != NULL) {
|
||||
MessageNoOverlap(idx, gFuseInfo.ent);
|
||||
} else {
|
||||
MessageFromTarget(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801E104(void) {
|
||||
gScreen.lcd.displayControl &= ~0x6000;
|
||||
gScreen._6c = 0;
|
||||
}
|
||||
|
||||
void sub_0801E120(void) {
|
||||
gScreen.lcd.displayControl |= 0x2000;
|
||||
gScreen.controls.windowInsideControl = 0x3F37;
|
||||
gScreen.controls.windowOutsideControl = 0x3F;
|
||||
gScreen.controls.window0HorizontalDimensions = 0;
|
||||
gScreen.controls.window0VerticalDimensions = 160;
|
||||
}
|
||||
|
||||
void sub_0801E154(u32 a1) {
|
||||
sub_0801E24C(a1, 0);
|
||||
}
|
||||
|
||||
void sub_0801E160(u32 a1, u32 a2, u32 a3) {
|
||||
MemClear(&gUnk_02017AA0[gUnk_03003DE4], sizeof(gUnk_02017AA0[gUnk_03003DE4]));
|
||||
sub_0801E290(a1, a2, a3);
|
||||
sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4], 0x4000040, 0xA2600001);
|
||||
}
|
||||
|
||||
void sub_0801E1B8(u32 a1, u32 a2) {
|
||||
gScreen.lcd.displayControl |= 0x2000;
|
||||
gScreen.controls.windowInsideControl = a1;
|
||||
gScreen.controls.windowOutsideControl = a2;
|
||||
gScreen.controls.window0HorizontalDimensions = 0;
|
||||
gScreen.controls.window0VerticalDimensions = 160;
|
||||
}
|
||||
|
||||
void sub_0801E1EC(u32 a1, u32 a2, u32 a3) {
|
||||
MemClear(&gUnk_02017AA0[gUnk_03003DE4], sizeof(gUnk_02017AA0[gUnk_03003DE4]));
|
||||
sub_0801E24C(a3, 0);
|
||||
sub_0801E290(a1, a2, a3);
|
||||
sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4], 0x4000040, 0xA2600001);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E24C.inc", void sub_0801E24C(u32 a1, u32 a2));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E290.inc", void sub_0801E290(u32 a1, u32 a2, u32 a3));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E31C.inc", void sub_0801E31C(u32 a1, u32 a2, u32 a3, u32 a4));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E49C.inc", void sub_0801E49C(u32 a1, u32 a2, u32 a3, u32 a4));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E64C.inc", void sub_0801E64C(u32 a1, u32 a2, u32 a3, u32 a4, u32 a5));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E6C8.inc", void sub_0801E6C8(u32 a1));
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E738.inc", void sub_0801E738(u32 a1));
|
||||
|
||||
void sub_0801E798(u32 a1) {
|
||||
s32 idx = sub_0801E8B0(a1);
|
||||
if (idx >= 0) {
|
||||
s32 next = gSave.unk12B[idx] - 1;
|
||||
if (next <= 0) {
|
||||
gSave.unk118[idx] = 0;
|
||||
next = 0;
|
||||
}
|
||||
gSave.unk12B[idx] = next;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0801E7D0(u32 a1) {
|
||||
s32 tmp = sub_0801E8B0(a1);
|
||||
if (tmp < 0) {
|
||||
return 0;
|
||||
}
|
||||
return gSave.unk12B[tmp];
|
||||
}
|
||||
|
||||
u32 CheckKinstoneFused(u32 idx) {
|
||||
if (idx > 100 || idx < 1) {
|
||||
return 0;
|
||||
}
|
||||
return ReadBit(&gSave.unk241, idx);
|
||||
}
|
||||
|
||||
u32 sub_0801E810(u32 idx) {
|
||||
if (idx > 100 || idx < 1) {
|
||||
return 0;
|
||||
}
|
||||
return ReadBit(&gSave.unk24E, idx);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E82C.inc", void sub_0801E82C(void));
|
||||
|
||||
s32 sub_0801E8B0(u32 idx) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 18; ++i) {
|
||||
if (idx == gSave.unk118[i])
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void sub_0801E8D4(void) {
|
||||
u32 i;
|
||||
for (i = 10; i <= 100; ++i) {
|
||||
if (CheckKinstoneFused(i) && !sub_0801E810(i)) {
|
||||
u32 evt_type = gUnk_080C9CBC[i].evt_type;
|
||||
struct_080FE320* s = &gUnk_080FE320[evt_type];
|
||||
#if !defined EU && !defined JP
|
||||
u32 flag = s->flag;
|
||||
#endif
|
||||
u32 tmp;
|
||||
switch (s->_10) {
|
||||
case 0:
|
||||
tmp = 0;
|
||||
break;
|
||||
case 1:
|
||||
tmp = s->_11;
|
||||
break;
|
||||
case 2:
|
||||
tmp = 0xf;
|
||||
break;
|
||||
case 3:
|
||||
tmp = 0x10;
|
||||
break;
|
||||
case 4:
|
||||
tmp = 0x11;
|
||||
break;
|
||||
#if !defined EU && !defined JP
|
||||
case 5:
|
||||
tmp = 4;
|
||||
flag = 0x83;
|
||||
break;
|
||||
case 6:
|
||||
tmp = 4;
|
||||
flag = 0x84;
|
||||
break;
|
||||
case 7:
|
||||
tmp = 4;
|
||||
flag = 0x87;
|
||||
break;
|
||||
case 8:
|
||||
tmp = 4;
|
||||
flag = 0x88;
|
||||
break;
|
||||
case 9:
|
||||
tmp = 4;
|
||||
flag = 0x8b;
|
||||
break;
|
||||
#ifndef DEMO_JP
|
||||
case 10:
|
||||
tmp = 5;
|
||||
flag = 0x88;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#if !defined EU && !defined JP
|
||||
if (sub_0807CB24(tmp, flag)) {
|
||||
#else
|
||||
if (sub_0807CB24(tmp, s->flag)) {
|
||||
#endif
|
||||
WriteBit(&gSave.unk24E, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/common/sub_0801E99C.inc", u32 sub_0801E99C(u32 a1));
|
||||
|
||||
u32 sub_0801EA74(void) {
|
||||
s32 r = (s32)Random() % 18;
|
||||
u32 i;
|
||||
for (i = 0; i < 18; ++i) {
|
||||
u32 n = gUnk_080CA11C[r];
|
||||
if (!CheckKinstoneFused(n))
|
||||
return n;
|
||||
r = (r + 1) % 18;
|
||||
}
|
||||
return 0xF2;
|
||||
}
|
||||
+33
-12
@@ -1,11 +1,9 @@
|
||||
#include "asm.h"
|
||||
#include "area.h"
|
||||
#include "player.h"
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "coord.h"
|
||||
#include "utils.h"
|
||||
#include "audio.h"
|
||||
#include "common.h"
|
||||
#include "sound.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -163,7 +161,7 @@ void sub_0806F62C(Entity* ent, u32 a, u32 b) {
|
||||
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[(u8)b + 64], a), 256) << 8;
|
||||
}
|
||||
|
||||
void sub_0806F69C(Entity* ent) {
|
||||
void LinearMoveUpdate(Entity* ent) {
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), 256) << 8;
|
||||
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), 256) << 8;
|
||||
@@ -171,14 +169,14 @@ void sub_0806F69C(Entity* ent) {
|
||||
}
|
||||
|
||||
void sub_0806F704(Entity* ent, u32 a2) {
|
||||
ent->x.HALF.HI = (((16 * a2) & 0x3F0) | 8) + gRoomControls.roomOriginX;
|
||||
ent->y.HALF.HI = (((a2 >> 2) & 0x3F0) | 8) + gRoomControls.roomOriginY;
|
||||
ent->x.HALF.HI = (((16 * a2) & 0x3F0) | 8) + gRoomControls.origin_x;
|
||||
ent->y.HALF.HI = (((a2 >> 2) & 0x3F0) | 8) + gRoomControls.origin_y;
|
||||
}
|
||||
|
||||
u32 sub_0806F730(Entity* ent) {
|
||||
u32 tmp = 0x3F;
|
||||
u32 x = ent->x.HALF.HI + ent->hitbox->offset_x - gRoomControls.roomOriginX;
|
||||
u32 y = ent->y.HALF.HI + ent->hitbox->offset_y - gRoomControls.roomOriginY;
|
||||
u32 x = ent->x.HALF.HI + ent->hitbox->offset_x - gRoomControls.origin_x;
|
||||
u32 y = ent->y.HALF.HI + ent->hitbox->offset_y - gRoomControls.origin_y;
|
||||
switch (ent->animationState) {
|
||||
case 0:
|
||||
y -= ent->hitbox->unk2[3];
|
||||
@@ -196,7 +194,12 @@ u32 sub_0806F730(Entity* ent) {
|
||||
return ((x >> 4) & tmp) + (((y >> 4) & tmp) << 6);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sub_0806F798.inc", u32 sub_0806F798(Entity* ent));
|
||||
u32 sub_0806F798(Entity* ent) {
|
||||
u32 hitboxX = ent->x.HALF.HI + ent->hitbox->offset_x - gRoomControls.origin_x;
|
||||
u32 hitboxY = ent->y.HALF.HI + ent->hitbox->offset_y - gRoomControls.origin_y;
|
||||
u32 mask = 0x3f;
|
||||
return (mask & (hitboxX >> 4)) + ((mask & (hitboxY >> 4)) << 6);
|
||||
}
|
||||
|
||||
u32 sub_0806F7D0(Entity* ent) {
|
||||
return gUnk_02025EB0._2004[sub_0806F730(ent)];
|
||||
@@ -211,7 +214,9 @@ u32 sub_0806F804(u32 x, u32 y) {
|
||||
return gUnk_02025EB0._4[idx];
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sub_0806F824.inc", void sub_0806F824(Entity* a, Entity* b, u32 x, u32 y));
|
||||
void sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
|
||||
sub_080045D4(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
|
||||
}
|
||||
|
||||
u32 sub_0806F854(Entity* ent, s32 x, s32 y) {
|
||||
if (ent->z.WORD == 0 || (ent->collisionLayer & 2))
|
||||
@@ -255,7 +260,23 @@ u32 sub_0806F948(Entity* ent) {
|
||||
return ent->animationState;
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/sub_0806F998.inc", u32 sub_0806F998(Entity* ent));
|
||||
NONMATCH("asm/non_matching/sub_0806F998.inc", u32 sub_0806F998(Entity* ent)) {
|
||||
u8 state = ent->animationState;
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
u8 tmp = ((ent->direction & 0x1c) >> 2);
|
||||
if ((tmp & 0x1) == 0 || ((tmp - state + 1) & 0x4)) {
|
||||
u8 dir = ent->direction;
|
||||
state = ent->animationState = (dir >> 2) & 0x7e;
|
||||
if (ent->animationState <= 4) {
|
||||
ent->spriteSettings.flipX = 0;
|
||||
} else {
|
||||
ent->spriteSettings.flipX = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
s16 FixedMul(s16 r0, s16 r1) {
|
||||
s32 temp = r0 * r1;
|
||||
|
||||
+9
-2
@@ -1,5 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
|
||||
void sub_0804AA30(Entity* entity, void (*fntable[])()) {
|
||||
u32 idx;
|
||||
entity->bitfield &= ~0x80;
|
||||
idx = GetNextFunction(entity);
|
||||
entity->bitfield |= 0x80;
|
||||
fntable[idx](entity);
|
||||
}
|
||||
|
||||
Entity* CreateEnemy(u32 subtype, u32 form) {
|
||||
Entity* enemy;
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
/**
|
||||
* @file debug.c
|
||||
* @ingroup Tasks
|
||||
*
|
||||
* @brief Debug task
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "audio.h"
|
||||
#include "utils.h"
|
||||
#include "sound.h"
|
||||
#include "common.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "menu.h"
|
||||
#include "screen.h"
|
||||
#include "structures.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "game.h"
|
||||
|
||||
extern void (*const gUnk_08109A30[])();
|
||||
extern void (*const gUnk_08109A30[])(void);
|
||||
|
||||
void HandleDebugTextScreen() {
|
||||
gUnk_08109A30[gMain.funcIndex]();
|
||||
void DebugTask(void) {
|
||||
gUnk_08109A30[gMain.state]();
|
||||
}
|
||||
|
||||
void sub_0805FA04(void) {
|
||||
@@ -28,12 +35,12 @@ void sub_0805FA04(void) {
|
||||
MessageInitialize();
|
||||
MemClear((void*)&gUnk_02032EC0, sizeof(UI));
|
||||
MemClear((void*)&gMenu, sizeof(Menu));
|
||||
gMenu.unk16 = gSaveHeader->gameLanguage;
|
||||
sub_08053320();
|
||||
gMenu.unk16 = gSaveHeader->language;
|
||||
LoadGfxGroups();
|
||||
SetColor(0, 0x1144);
|
||||
gMain.funcIndex = 1;
|
||||
gMain.state = 1;
|
||||
InitSoundPlayingInfo();
|
||||
sub_08050008();
|
||||
ResetFadeMask();
|
||||
}
|
||||
|
||||
void sub_0805FA98(void) {
|
||||
@@ -57,7 +64,7 @@ void sub_0805FA98(void) {
|
||||
}
|
||||
break;
|
||||
case R_BUTTON:
|
||||
gSaveHeader->gameLanguage = gMenu.unk16;
|
||||
gSaveHeader->language = gMenu.unk16;
|
||||
MessageFromTarget(gMenu.unk14 * 0x100 + gMenu.unk15);
|
||||
break;
|
||||
case B_BUTTON:
|
||||
@@ -91,6 +98,6 @@ void sub_0805FA98(void) {
|
||||
gScreen.bg3.updated = 1;
|
||||
}
|
||||
|
||||
void sub_0805FBC4() {
|
||||
InitScreen(0);
|
||||
void sub_0805FBC4(void) {
|
||||
SetTask(TASK_TITLE);
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
/**
|
||||
* @file demo.c
|
||||
* @ingroup Tasks
|
||||
*
|
||||
* @brief Demo task
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "common.h"
|
||||
#include "message.h"
|
||||
#include "fileselect.h"
|
||||
#include "screen.h"
|
||||
#include "game.h"
|
||||
|
||||
extern void (*const demoFunctions[])(void);
|
||||
void sub_080A30AC(void);
|
||||
|
||||
extern u8 gUnk_02000004;
|
||||
void sub_080A3198(u32, u32);
|
||||
|
||||
extern u8 gUnk_02017760[];
|
||||
extern u8 gUnk_08A05751[];
|
||||
|
||||
// sprite_table
|
||||
extern void gUnk_089FD1B4;
|
||||
extern void gUnk_089FD2F4;
|
||||
|
||||
extern u16 gUnk_08127CC8[4];
|
||||
extern void* gUnk_08127C98;
|
||||
extern u8 gUnk_08A068BF[129];
|
||||
|
||||
void DemoTask(void) {
|
||||
FlushSprites();
|
||||
demoFunctions[gMain.state]();
|
||||
sub_080A30AC();
|
||||
CopyOAM();
|
||||
}
|
||||
|
||||
void sub_080A2E40(void) {
|
||||
DispReset(1);
|
||||
InitSoundPlayingInfo();
|
||||
MemClear((void*)VRAM, 0x80);
|
||||
MessageInitialize();
|
||||
EraseAllEntities();
|
||||
ResetPalettes();
|
||||
ResetPaletteTable(0);
|
||||
MemClear(&gUnk_02032EC0, sizeof gUnk_02032EC0);
|
||||
MemClear(&gChooseFileState, sizeof gChooseFileState);
|
||||
MemClear(&gBG0Buffer, sizeof gBG0Buffer);
|
||||
LoadGfxGroups();
|
||||
LoadPaletteGroup(0xb5);
|
||||
LoadGfxGroup(0x56);
|
||||
MemCopy(&gUnk_089FD1B4, &gUnk_02017760[0], 0x100);
|
||||
MemCopy(&gUnk_089FD1B4, &gUnk_02017760[0x200], 0x100);
|
||||
MemCopy(&gUnk_089FD2F4, (void*)0x6000000, 0x8000);
|
||||
MemCopy(&gUnk_089FD2F4, (void*)0x6010000, 0x8000);
|
||||
MemCopy(&gUnk_08A05751, &gBG1Buffer, 0x800);
|
||||
MemCopy(&gUnk_08A05751[0x800], &gBG2Buffer, 0x800);
|
||||
gScreen.lcd.displayControl = 0x1f00;
|
||||
gScreen.bg1.control = 0x1c81;
|
||||
gScreen.bg2.control = 0x1d82;
|
||||
gScreen.bg3.control = 0x1e0b;
|
||||
gScreen.bg1.updated = 1;
|
||||
gScreen.bg2.updated = 1;
|
||||
gScreen.bg3.updated = 1;
|
||||
gScreen.controls.layerFXControl = 0x1044;
|
||||
gScreen.controls.alphaBlend = 0xb04;
|
||||
{
|
||||
// TODO write to 0x2000004
|
||||
u32 addr = (0x80 << 0x12);
|
||||
*(u8*)(addr + 4) = 0;
|
||||
}
|
||||
sub_080A3198(0, 0);
|
||||
gMain.state = 1;
|
||||
SoundReq(BGM_FILE_SELECT);
|
||||
SetFade(4, 8);
|
||||
}
|
||||
|
||||
void sub_080A2F8C(void) {
|
||||
if (gFadeControl.active == 0) {
|
||||
switch (gMain.substate) {
|
||||
case 0:
|
||||
gMain.substate = 1;
|
||||
{
|
||||
// TODO write to 0x2000005
|
||||
u32 addr = (0x80 << 0x12);
|
||||
*(u8*)(addr + 5) = 1;
|
||||
*(u8*)(addr + 6) = 1;
|
||||
}
|
||||
gMain.state = 2;
|
||||
SetFade(5, 8);
|
||||
break;
|
||||
case 1:
|
||||
SetTask(TASK_GAME);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The condition on the left dpad is very convuluted for some reason (instead oj just an equality check).
|
||||
// This causes the entire function heirarchy to change on a whim and I couldn't quite figure out
|
||||
// the correct conditions/code to make it like the original function.
|
||||
NONMATCH("asm/non_matching/demoScreen/sub_080A2FD0.inc", void sub_080A2FD0(void)) {
|
||||
s32 tmp;
|
||||
u32 tmp2;
|
||||
u32 val;
|
||||
s32 tmp3;
|
||||
u32 unk_0x0;
|
||||
u32 tmp4;
|
||||
s32 tmp5;
|
||||
u32 keys;
|
||||
|
||||
if (gFadeControl.active == 0) {
|
||||
val = 0;
|
||||
keys = gInput.heldKeys;
|
||||
switch (keys) {
|
||||
case DPAD_RIGHT: {
|
||||
if (gChooseFileState.unk_0x0 == 0) {
|
||||
val = 1;
|
||||
gChooseFileState.unk_0x20 = 4;
|
||||
SoundReq(SFX_TEXTBOX_CHOICE);
|
||||
}
|
||||
}
|
||||
case DPAD_LEFT: {
|
||||
if (gChooseFileState.unk_0x0 == 0) {
|
||||
val = -1;
|
||||
gChooseFileState.unk_0x20 = 0xfc;
|
||||
SoundReq(SFX_TEXTBOX_CHOICE);
|
||||
}
|
||||
}
|
||||
case START_BUTTON:
|
||||
case A_BUTTON: {
|
||||
if (gChooseFileState.unk_0x0 == 0) {
|
||||
gMain.task = 2;
|
||||
gMain.state = gChooseFileState.unk_0x0;
|
||||
SoundReq(SFX_TEXTBOX_SELECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
tmp = gSaveHeader->saveFileId;
|
||||
tmp2 = val + 3;
|
||||
tmp += tmp2;
|
||||
gSaveHeader->saveFileId = tmp % 3;
|
||||
|
||||
tmp3 = gChooseFileState.unk_0x10;
|
||||
|
||||
tmp = gSaveHeader->saveFileId;
|
||||
tmp *= 0x68;
|
||||
|
||||
if (tmp != tmp3) {
|
||||
tmp5 = gChooseFileState.unk_0x20;
|
||||
tmp5 += tmp3;
|
||||
gChooseFileState.unk_0x10 = (tmp5 + (0x9c << 1)) % (0x9c << 1);
|
||||
unk_0x0 = 1;
|
||||
} else {
|
||||
unk_0x0 = 0;
|
||||
}
|
||||
|
||||
gChooseFileState.unk_0x0 = unk_0x0;
|
||||
sub_080A3198(gSaveHeader->saveFileId, 0);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/demoScreen/sub_080A30AC.inc", void sub_080A30AC(void)) {
|
||||
u32 unk_0x10;
|
||||
u8* ptr;
|
||||
u8* currentPtr;
|
||||
u32 offset;
|
||||
u32 xoffset;
|
||||
gOamCmd._4 = 0x2000;
|
||||
gOamCmd._6 = 0;
|
||||
gOamCmd._8 = 0xc00;
|
||||
gOamCmd.y = 0x40;
|
||||
unk_0x10 = gChooseFileState.unk_0x10;
|
||||
gOamCmd.x = 0xFFFFFED8 - unk_0x10;
|
||||
offset = *(u32*)gUnk_08A068BF;
|
||||
ptr = gUnk_08A068BF - 0xc;
|
||||
sub_080ADA04(&gOamCmd, ptr + offset);
|
||||
// FIX: original assembly uses r1 for xoffset for no apparent reason. Could not make it compile to do the same.
|
||||
// Maybe the original code was some sort of loop unrolling.
|
||||
xoffset = -0xc0;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 4));
|
||||
xoffset = -0x58;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 8));
|
||||
xoffset = 0x10;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(gUnk_08A068BF));
|
||||
xoffset = 0x78;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 4));
|
||||
xoffset = 0xe0;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 8));
|
||||
xoffset = 0xa4 << 1;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(gUnk_08A068BF));
|
||||
xoffset = 0xd8 << 1;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 4));
|
||||
xoffset = 0x86 << 2;
|
||||
gOamCmd.x = xoffset - unk_0x10;
|
||||
sub_080ADA04(&gOamCmd, ptr + *(u32*)(ptr + 8));
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080A3198(u32 param_1, u32 param_2) {
|
||||
u16 r4 = gUnk_08127CC8[param_1];
|
||||
|
||||
if (gChooseFileState.unk_0x12 != r4) {
|
||||
gChooseFileState.unk_0x12 = r4;
|
||||
MemClear(gUnk_08127C98 - 0x1e, 0x180);
|
||||
|
||||
if (r4 != 0) {
|
||||
sub_0805F46C(r4, &gUnk_08127C98);
|
||||
}
|
||||
|
||||
gScreen.bg0.updated = 1;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "textbox.h"
|
||||
#include "fileScreen.h"
|
||||
#include "screen.h"
|
||||
|
||||
extern void (*const demoFunctions[])(void);
|
||||
void sub_080A30AC();
|
||||
|
||||
extern u8 gUnk_02000004;
|
||||
void sub_080A3198(u32, u32);
|
||||
|
||||
extern u8 gUnk_02017760[];
|
||||
extern u8 gUnk_08A05751[];
|
||||
|
||||
// sprite_table
|
||||
extern void gUnk_089FD1B4;
|
||||
extern void gUnk_089FD2F4;
|
||||
|
||||
extern u8 gUnk_02000006;
|
||||
|
||||
void HandleChooseDemoScreen(void) {
|
||||
FlushSprites();
|
||||
demoFunctions[gMain.funcIndex]();
|
||||
sub_080A30AC();
|
||||
sub_080AD918();
|
||||
}
|
||||
|
||||
void sub_080A2E40(void) {
|
||||
DispReset(1);
|
||||
InitSoundPlayingInfo();
|
||||
MemClear((void*)VRAM, 0x80);
|
||||
MessageInitialize();
|
||||
EraseAllEntities();
|
||||
ResetPalettes();
|
||||
sub_0801CFA8(0);
|
||||
MemClear(&gUnk_02032EC0, sizeof gUnk_02032EC0);
|
||||
MemClear(&gChooseFileState, sizeof gChooseFileState);
|
||||
MemClear(&gBG0Buffer, sizeof gBG0Buffer);
|
||||
sub_08053320();
|
||||
LoadPaletteGroup(0xb5);
|
||||
LoadGfxGroup(0x56);
|
||||
MemCopy(&gUnk_089FD1B4, &gUnk_02017760[0], 0x100);
|
||||
MemCopy(&gUnk_089FD1B4, &gUnk_02017760[0x200], 0x100);
|
||||
MemCopy(&gUnk_089FD2F4, (void*)0x6000000, 0x8000);
|
||||
MemCopy(&gUnk_089FD2F4, (void*)0x6010000, 0x8000);
|
||||
MemCopy(&gUnk_08A05751, &gBG1Buffer, 0x800);
|
||||
MemCopy(&gUnk_08A05751[0x800], &gBG2Buffer, 0x800);
|
||||
gScreen.lcd.displayControl = 0x1f00;
|
||||
gScreen.bg1.control = 0x1c81;
|
||||
gScreen.bg2.control = 0x1d82;
|
||||
gScreen.bg3.control = 0x1e0b;
|
||||
gScreen.bg1.updated = 1;
|
||||
gScreen.bg2.updated = 1;
|
||||
gScreen.bg3.updated = 1;
|
||||
gScreen.controls.layerFXControl = 0x1044;
|
||||
gScreen.controls.alphaBlend = 0xb04;
|
||||
{
|
||||
// TODO write to 0x2000004
|
||||
u32 addr = (0x80 << 0x12);
|
||||
*(u8*)(addr + 4) = 0;
|
||||
}
|
||||
sub_080A3198(0, 0);
|
||||
gMain.funcIndex = 1;
|
||||
SoundReq(BGM_FILE_SELECT);
|
||||
DoFade(4, 8);
|
||||
}
|
||||
|
||||
void sub_080A2F8C(void) {
|
||||
if (gFadeControl.active == 0) {
|
||||
switch (gMain.transition) {
|
||||
case 0:
|
||||
gMain.transition = 1;
|
||||
{
|
||||
// TODO write to 0x2000005
|
||||
u32 addr = (0x80 << 0x12);
|
||||
*(u8*)(addr + 5) = 1;
|
||||
*(u8*)(addr + 6) = 1;
|
||||
}
|
||||
gMain.funcIndex = 2;
|
||||
DoFade(5, 8);
|
||||
break;
|
||||
case 1:
|
||||
InitScreen(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/demoScreen/sub_080A2FD0.inc", void sub_080A2FD0(void))
|
||||
|
||||
ASM_FUNC("asm/non_matching/demoScreen/sub_080A30AC.inc", void sub_080A30AC(void))
|
||||
|
||||
ASM_FUNC("asm/non_matching/demoScreen/sub_080A3198.inc", void sub_080A3198(u32 param_1, u32 param_2))
|
||||
+5
-6
@@ -1,4 +1,3 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "definitions.h"
|
||||
@@ -420,11 +419,11 @@ const EnemyDefinition gEnemyDefinition_46[] = {
|
||||
{ 72, 384, &gUnk_080FD258, SPRITE_BOWMOBLIN_1, { 1, 1, 1, 2 }, 8, 256, 138, 139 },
|
||||
};
|
||||
|
||||
extern void sub_08049E18();
|
||||
extern void sub_08049E4C();
|
||||
extern void sub_08049E80();
|
||||
extern void sub_08049EB0();
|
||||
void (*const gUnk_080D3BE8[])() = {
|
||||
extern Entity* sub_08049E18(void);
|
||||
extern Entity* sub_08049E4C(void);
|
||||
extern Entity* sub_08049E80(void);
|
||||
extern Entity* sub_08049EB0(void);
|
||||
Entity* (*const gUnk_080D3BE8[])(void) = {
|
||||
sub_08049E18,
|
||||
sub_08049E4C,
|
||||
sub_08049E80,
|
||||
|
||||
+13
-7
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file acroBandits.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Acro Bandits enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -12,7 +19,6 @@ extern void sub_08032338(Entity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gEntCount;
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CE56C[])(Entity*);
|
||||
extern void (*const gUnk_080CE584[])(Entity*);
|
||||
@@ -108,7 +114,7 @@ void sub_080318DC(Entity* this) {
|
||||
|
||||
void sub_08031A60(Entity* this) {
|
||||
if (this->iframes > 0)
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
|
||||
sub_08001324(this);
|
||||
}
|
||||
@@ -351,7 +357,7 @@ void sub_08031EE8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08031F54(Entity* this) {
|
||||
sub_08003FC4(this, gUnk_080CE5F0[this->type2]);
|
||||
GravityUpdate(this, gUnk_080CE5F0[this->type2]);
|
||||
if (this->type2 * -0xe <= this->z.HALF.HI) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 20;
|
||||
@@ -411,12 +417,12 @@ void sub_08032008(Entity* this) {
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
} else {
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI)
|
||||
this->field_0x76.HALF.HI = 0;
|
||||
}
|
||||
@@ -426,7 +432,7 @@ void sub_08032008(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08032148(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2000))
|
||||
if (GravityUpdate(this, 0x2000))
|
||||
return;
|
||||
|
||||
sub_08032290(this);
|
||||
@@ -481,7 +487,7 @@ void sub_08032204(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08032248(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (GravityUpdate(this, 0x1800) == 0) {
|
||||
if (this->frame & 0x80) {
|
||||
((Entity*)this->field_0x7c.WORD)->actionDelay--;
|
||||
|
||||
|
||||
+15
-8
@@ -1,9 +1,16 @@
|
||||
/**
|
||||
* @file beetle.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Beetle enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 PlayerInRange(Entity*, u32, u32);
|
||||
|
||||
u32 sub_08021D00();
|
||||
u32 sub_08021D00(Entity*);
|
||||
void sub_08021D44(Entity* this, u32 direction);
|
||||
|
||||
extern void (*const gUnk_080CB590[])(Entity*);
|
||||
@@ -133,7 +140,7 @@ void sub_08021984(Entity* this) {
|
||||
EnqueueSFX(0x12d);
|
||||
}
|
||||
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (GravityUpdate(this, 0x1800) == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 16;
|
||||
this->field_0xf = 1;
|
||||
@@ -200,7 +207,7 @@ void sub_08021AD8(Entity* this) {
|
||||
EnqueueSFX(0x7c);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (!sub_08003FC4(this, 0x1800))
|
||||
if (!GravityUpdate(this, 0x1800))
|
||||
this->frameDuration = 1;
|
||||
}
|
||||
|
||||
@@ -213,7 +220,7 @@ void sub_08021AD8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08021B64(Entity* this) {
|
||||
if (gPlayerState.flags & 4) {
|
||||
if (gPlayerState.flags & PL_DROWNING) {
|
||||
this->action = 3;
|
||||
this->z.WORD = 0;
|
||||
InitializeAnimation(this, 2);
|
||||
@@ -230,7 +237,7 @@ void sub_08021B64(Entity* this) {
|
||||
this->actionDelay = (u8)iVar4;
|
||||
}
|
||||
|
||||
if (gPlayerState.flags & 0x110)
|
||||
if (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED))
|
||||
iVar4 = 0;
|
||||
|
||||
if (iVar4 == 0) {
|
||||
@@ -244,8 +251,8 @@ void sub_08021B64(Entity* this) {
|
||||
}
|
||||
InitializeAnimation(this, 5);
|
||||
} else {
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.field_0x80 -= 0x50;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.speed_modifier -= 0x50;
|
||||
gPlayerState.field_0xaa++;
|
||||
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
|
||||
this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1];
|
||||
@@ -259,7 +266,7 @@ void sub_08021C58(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0)
|
||||
if (GravityUpdate(this, 0x1800) == 0)
|
||||
this->frameDuration = 1;
|
||||
}
|
||||
|
||||
|
||||
+10
-4
@@ -1,10 +1,16 @@
|
||||
#include "global.h"
|
||||
#include "audio.h"
|
||||
/**
|
||||
* @file bladeTrap.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Blade Trap enemy
|
||||
*/
|
||||
|
||||
#include "sound.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_080A2CC0();
|
||||
extern void sub_080A2CC0(Entity*, void*, void*);
|
||||
|
||||
void BladeTrap(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
@@ -13,7 +19,7 @@ void BladeTrap(Entity* this) {
|
||||
sub_080A2CC0(this, &this->child, &this->field_0x74);
|
||||
}
|
||||
if (!(this->direction & 0x80)) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
|
||||
if (!(--this->field_0x74.HWORD)) {
|
||||
|
||||
+8
-1
@@ -1,5 +1,12 @@
|
||||
/**
|
||||
* @file bobomb.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Bobomb enemy
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
#include "audio.h"
|
||||
#include "sound.h"
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
+27
-21
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @file bombPeahat.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Bomb Peahat enemy
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
@@ -137,19 +143,19 @@ void sub_0802A9A8(Entity* this) {
|
||||
sub_0802ACDC(this, 8);
|
||||
}
|
||||
} else {
|
||||
if (gRoomControls.unk2 != 0) {
|
||||
if (gRoomControls.reload_flags != 0) {
|
||||
return;
|
||||
}
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x82.HWORD = 1;
|
||||
if (this->field_0x80.HALF.LO) {
|
||||
this->x.HALF.HI = gRoomControls.roomScrollX - 0x10;
|
||||
this->x.HALF.HI = gRoomControls.scroll_x - 0x10;
|
||||
this->direction = 8;
|
||||
} else {
|
||||
this->x.HALF.HI = gRoomControls.roomScrollX + 0x100;
|
||||
this->x.HALF.HI = gRoomControls.scroll_x + 0x100;
|
||||
this->direction = 0x18;
|
||||
}
|
||||
this->y.HALF.HI = gRoomControls.roomScrollY + 0x40;
|
||||
this->y.HALF.HI = gRoomControls.scroll_y + 0x40;
|
||||
this->actionDelay = 0x80;
|
||||
sub_0802ADDC(this);
|
||||
}
|
||||
@@ -280,7 +286,7 @@ ASM_FUNC("asm/non_matching/eu/sub_0802AC40.inc", void sub_0802AC40(Entity* this)
|
||||
#else
|
||||
void sub_0802AC40(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->field_0x7a.HALF.LO) {
|
||||
if (sub_0802B234(this) == 0) {
|
||||
this->field_0x7a.HALF.LO = 0;
|
||||
@@ -312,9 +318,9 @@ void sub_0802AC40(Entity* this) {
|
||||
void sub_0802ACDC(Entity* this, u32 param_2) {
|
||||
u32 x;
|
||||
if (this->field_0x80.HALF.LO) {
|
||||
x = sub_080045B4(this, gRoomControls.roomScrollX + 0x20, gRoomControls.roomScrollY + 0x60);
|
||||
x = sub_080045B4(this, gRoomControls.scroll_x + 0x20, gRoomControls.scroll_y + 0x60);
|
||||
} else {
|
||||
x = sub_080045B4(this, gRoomControls.roomScrollX + 0xd0, gRoomControls.roomScrollY + 0x60);
|
||||
x = sub_080045B4(this, gRoomControls.scroll_x + 0xd0, gRoomControls.scroll_y + 0x60);
|
||||
}
|
||||
sub_08004596(this, x);
|
||||
this->field_0xf = param_2;
|
||||
@@ -334,13 +340,13 @@ void sub_0802AD1C(Entity* this, u32 param_2) {
|
||||
|
||||
void sub_0802AD54(Entity* this) {
|
||||
if (this->field_0x82.HWORD != 0) {
|
||||
if (gRoomControls.unk2 != 0) {
|
||||
if (gRoomControls.reload_flags != 0) {
|
||||
this->spriteSettings.draw = 0;
|
||||
DeleteEntity(this);
|
||||
return;
|
||||
}
|
||||
if (gRoomControls.roomOriginY > this->y.HALF.HI ||
|
||||
(gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y > this->y.HALF.HI ||
|
||||
(gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) {
|
||||
this->spriteSettings.draw = 0;
|
||||
} else {
|
||||
this->spriteSettings.draw = 1;
|
||||
@@ -474,28 +480,28 @@ void sub_0802AF9C(Entity* this) {
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/bombPeahat/sub_0802AFC8.inc", void sub_0802AFC8(Entity* this)) {
|
||||
u32 field_0xf = this->field_0xf;
|
||||
u32 flag = 8;
|
||||
if (this->field_0xf < 0x29) {
|
||||
u32 tmp;
|
||||
|
||||
if (field_0xf < 0x29) {
|
||||
u32 tmp, tmp2;
|
||||
flag = 4;
|
||||
if (this->field_0x82.HWORD & 0x8000) {
|
||||
this->field_0x82.HWORD -= 0x10;
|
||||
} else {
|
||||
this->field_0x82.HWORD += 0x10;
|
||||
}
|
||||
if (0x7f < (this->field_0x82.HWORD & 0xf0) - 1) {
|
||||
tmp2 = this->field_0x82.HWORD;
|
||||
tmp = tmp2 & 0xf0;
|
||||
if (tmp == 0 || tmp > 0x80) {
|
||||
this->field_0x82.HWORD ^= 0x8000;
|
||||
}
|
||||
|
||||
tmp = 0x130 - (this->field_0x82.HWORD & 0xf0);
|
||||
sub_0805EC9C(this, tmp, tmp, 0);
|
||||
}
|
||||
|
||||
if (this->field_0xf & flag) {
|
||||
this->palette.b.b0 = 0;
|
||||
} else {
|
||||
this->palette.b.b0 = this->palette.b.b4;
|
||||
} else {
|
||||
this->palette.b.b0 = 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
@@ -505,8 +511,8 @@ void sub_0802B048(Entity* this) {
|
||||
u32 action;
|
||||
|
||||
if (this->field_0x7a.HALF.HI) {
|
||||
if (gRoomControls.roomOriginY > this->y.HALF.HI ||
|
||||
(gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y > this->y.HALF.HI ||
|
||||
(gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) {
|
||||
COLLISION_OFF(this);
|
||||
} else {
|
||||
COLLISION_ON(this);
|
||||
|
||||
+367
-13
@@ -1,37 +1,391 @@
|
||||
/**
|
||||
* @file bowMoblin.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Bow Moblin enemy
|
||||
*/
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0803C5F0(Entity*);
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 filler[0x12];
|
||||
u8 unk_0x7a;
|
||||
u8 unk_0x7b;
|
||||
u8 filter[0x4];
|
||||
u8 unk_0x80;
|
||||
u8 unk_0x81;
|
||||
u8 unk_0x82;
|
||||
u8 unk_0x83;
|
||||
} BowMoblinEntity;
|
||||
|
||||
extern void (*const gUnk_080CFF78[])(Entity*);
|
||||
extern void (*const gUnk_080CFF90[])(Entity*);
|
||||
void sub_0803C5F0(BowMoblinEntity*);
|
||||
void sub_0803C690(BowMoblinEntity*);
|
||||
void sub_0803C4B0(BowMoblinEntity*);
|
||||
void sub_0803C5C4(BowMoblinEntity*);
|
||||
void sub_0803C624(BowMoblinEntity*);
|
||||
void sub_0803C6DC(BowMoblinEntity*);
|
||||
void sub_0803C714(BowMoblinEntity*);
|
||||
void sub_0803C634(BowMoblinEntity*);
|
||||
u32 sub_0803C6F8(BowMoblinEntity*);
|
||||
u32 sub_0803C568(BowMoblinEntity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
extern u32 sub_0806FC80(Entity*, Entity*, s32);
|
||||
void sub_0803C664(BowMoblinEntity*);
|
||||
|
||||
extern void (*const gUnk_080CFF78[])(BowMoblinEntity*);
|
||||
extern void (*const gUnk_080CFF90[])(BowMoblinEntity*);
|
||||
|
||||
extern const s8 gUnk_080CFFC4[8];
|
||||
extern const s8 gUnk_080CFFA4[8];
|
||||
extern const s8 gUnk_080CFFAC[16];
|
||||
extern const u16 gUnk_080CFFBC[4];
|
||||
|
||||
void BowMoblin(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CFF78);
|
||||
EnemyFunctionHandler(this, (EntityActionArray)gUnk_080CFF78);
|
||||
SetChildOffset(this, 0, 1, -0x18);
|
||||
}
|
||||
|
||||
void sub_0803C180(Entity* this) {
|
||||
gUnk_080CFF90[this->action](this);
|
||||
void sub_0803C180(BowMoblinEntity* this) {
|
||||
gUnk_080CFF90[super->action](this);
|
||||
}
|
||||
|
||||
void sub_0803C198(Entity* this) {
|
||||
void sub_0803C198(BowMoblinEntity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
if (super->field_0x43 != 0) {
|
||||
sub_0804A9FC(super, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CFF78);
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
sub_0804AA30(super, (EntityActionArray)gUnk_080CFF78);
|
||||
if ((super->bitfield & 0x80) != 0) {
|
||||
sub_0803C5F0(this);
|
||||
pEVar1 = this->child;
|
||||
pEVar1 = super->child;
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->field_0xf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_168(Entity* this) {
|
||||
void nullsub_168(BowMoblinEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0803C1E0(BowMoblinEntity* this) {
|
||||
sub_0804A720(super);
|
||||
|
||||
super->action = 1;
|
||||
this->unk_0x7b = 0;
|
||||
this->unk_0x80 = 0;
|
||||
this->unk_0x83 = 0;
|
||||
this->unk_0x81 = 0;
|
||||
this->unk_0x7a = 0;
|
||||
this->unk_0x82 = 1;
|
||||
|
||||
if (super->actionDelay) {
|
||||
super->animationState = super->type2 << 1;
|
||||
super->actionDelay = 0x1e;
|
||||
super->speed = 0x80;
|
||||
super->direction = super->type2 << 3;
|
||||
sub_0803C690(this);
|
||||
} else {
|
||||
super->animationState = 0x10;
|
||||
sub_0803C4B0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803C234(BowMoblinEntity* this) {
|
||||
u8 mask;
|
||||
if (this->unk_0x81) {
|
||||
this->unk_0x81--;
|
||||
}
|
||||
mask = 0xff;
|
||||
if (((--super->actionDelay) & mask) == 0) {
|
||||
u8 tmp = ++this->unk_0x80;
|
||||
|
||||
if ((tmp) > 0xf) {
|
||||
sub_0803C5C4(this);
|
||||
} else if (((this->unk_0x80 & 0x3) == 0) && (Random() & 0x10)) {
|
||||
sub_0803C624(this);
|
||||
} else {
|
||||
sub_0803C4B0(this);
|
||||
}
|
||||
|
||||
} else if (sub_0803C6F8(this)) {
|
||||
sub_0800417E(super, super->collisions);
|
||||
super->animationState = ((super->direction + 4) & 0x18) >> 2;
|
||||
this->unk_0x83++;
|
||||
sub_0803C690(this);
|
||||
} else if (sub_0803C568(this)) {
|
||||
sub_0803C5F0(this);
|
||||
}
|
||||
|
||||
sub_0803C6DC(this);
|
||||
}
|
||||
|
||||
void sub_0803C2DC(BowMoblinEntity* this) {
|
||||
u32 res;
|
||||
u32 actionDelay = --super->actionDelay;
|
||||
if (actionDelay == 0) {
|
||||
super->action = 3;
|
||||
this->unk_0x82 = actionDelay;
|
||||
this->unk_0x80 = actionDelay;
|
||||
super->animationState = 0x10;
|
||||
sub_0803C4B0(this);
|
||||
} else if (res = sub_0803C568(this), res) {
|
||||
this->unk_0x7b |= 0x1;
|
||||
}
|
||||
|
||||
if (super->field_0xf > 0xb) {
|
||||
if (this->unk_0x7b != 0) {
|
||||
sub_0803C5F0(this);
|
||||
}
|
||||
} else {
|
||||
super->field_0xf++;
|
||||
}
|
||||
|
||||
sub_0803C6DC(this);
|
||||
}
|
||||
|
||||
void sub_0803C344(BowMoblinEntity* this) {
|
||||
if (--super->actionDelay == 0) {
|
||||
switch (this->unk_0x82) {
|
||||
case 3: {
|
||||
super->action = 4;
|
||||
super->speed = 0x80;
|
||||
super->direction = sub_08049F84(super, 1);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
super->action = 4;
|
||||
super->speed = 0x80;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
u32 tmp;
|
||||
super->action = 2;
|
||||
super->speed = 0;
|
||||
tmp = Random() & 0x7;
|
||||
super->actionDelay = (tmp << 1) + tmp + 0x40;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
super->direction = (super->direction + 0x10) & 0x18;
|
||||
}
|
||||
case 0:
|
||||
case 1:
|
||||
default: {
|
||||
u32 tmp;
|
||||
super->action = 1;
|
||||
this->unk_0x82 = 1;
|
||||
super->speed = 0x80;
|
||||
tmp = (Random() & 0x7);
|
||||
super->actionDelay = (tmp << 1) + tmp + 0x22;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
super->field_0xf = 0;
|
||||
super->animationState = ((super->direction + 4) & 0x18) >> 2;
|
||||
sub_0803C690(this);
|
||||
}
|
||||
sub_0803C6DC(this);
|
||||
}
|
||||
|
||||
void sub_0803C400(BowMoblinEntity* this) {
|
||||
if (super->field_0xf) {
|
||||
u8 mask;
|
||||
super->field_0xf--;
|
||||
mask = 0xff;
|
||||
if ((super->field_0xf & mask) == 0) {
|
||||
if (this->unk_0x82 == 3) {
|
||||
this->unk_0x7a++;
|
||||
if ((this->unk_0x7a & mask) <= 2) {
|
||||
if (Random() & 0xc0) {
|
||||
super->actionDelay = 0;
|
||||
sub_0803C690(this);
|
||||
sub_0803C6DC(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
sub_0803C634(this);
|
||||
}
|
||||
} else {
|
||||
Entity* projectile;
|
||||
switch (++super->actionDelay) {
|
||||
case 1:
|
||||
super->direction = super->animationState << 2;
|
||||
projectile = CreateProjectileWithParent(super, 0xd, super->animationState >> 1);
|
||||
if (projectile) {
|
||||
super->child = projectile;
|
||||
projectile->direction = (super->direction + 4) & 0x18;
|
||||
projectile->parent = super;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
super->actionDelay = 0;
|
||||
super->field_0xf = 0x20;
|
||||
break;
|
||||
}
|
||||
|
||||
sub_0803C6DC(this);
|
||||
if (super->child) {
|
||||
sub_0803C714(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803C4B0(BowMoblinEntity* this) {
|
||||
u32 dir;
|
||||
super->field_0xf = 0;
|
||||
if (this->unk_0x82 == 1) {
|
||||
super->actionDelay = gUnk_080CFFA4[Random() & 7];
|
||||
super->speed = 0x80;
|
||||
if (sub_08049FA0(super)) {
|
||||
dir = Random();
|
||||
dir &= 6;
|
||||
super->direction = dir << 2;
|
||||
} else {
|
||||
dir = sub_08049EE4(super);
|
||||
if (this->unk_0x83 == 0) {
|
||||
dir += gUnk_080CFFAC[Random() & 0xf];
|
||||
} else {
|
||||
dir += gUnk_080CFFAC[Random() & 0x7];
|
||||
super->actionDelay += 0x10;
|
||||
this->unk_0x83--;
|
||||
}
|
||||
dir = (super->direction = (dir + 4) & 0x18) >> 2;
|
||||
}
|
||||
} else {
|
||||
super->actionDelay = 0xc;
|
||||
super->speed = super->field_0xf;
|
||||
dir = super->direction >> 2;
|
||||
}
|
||||
if (dir != super->animationState) {
|
||||
super->animationState = dir;
|
||||
sub_0803C690(this);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0803C568(BowMoblinEntity* this) {
|
||||
if (this->unk_0x81 == 0) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
if (ent) {
|
||||
if (this->unk_0x82 == 2) {
|
||||
if (sub_0806FC80(super, ent, 0x30)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (sub_0806FC80(super, ent, 0x40)) {
|
||||
u32 direction = (GetFacingDirection(super, ent) + 4) & 0x18;
|
||||
direction = direction >> 2;
|
||||
if (direction == super->animationState) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0803C5C4(BowMoblinEntity* this) {
|
||||
u32 state = ((super->direction + 4) & 0x18) >> 2;
|
||||
super->animationState = state;
|
||||
super->direction = state << 2;
|
||||
this->unk_0x83 >>= 1;
|
||||
sub_0803C664(this);
|
||||
this->unk_0x82 = 2;
|
||||
}
|
||||
|
||||
void sub_0803C5F0(BowMoblinEntity* this) {
|
||||
super->direction = sub_08049F84(super, 1);
|
||||
super->animationState = ((super->direction + 4) & 0x18) >> 2;
|
||||
this->unk_0x83 = 0;
|
||||
this->unk_0x7a = 0;
|
||||
sub_0803C664(this);
|
||||
this->unk_0x82 = 3;
|
||||
}
|
||||
|
||||
void sub_0803C624(BowMoblinEntity* this) {
|
||||
sub_0803C664(this);
|
||||
this->unk_0x82 = 5;
|
||||
}
|
||||
|
||||
void sub_0803C634(BowMoblinEntity* this) {
|
||||
super->animationState = ((super->direction + 4) & 0x18) >> 2;
|
||||
super->direction = super->animationState << 2;
|
||||
this->unk_0x83 = 0;
|
||||
sub_0803C664(this);
|
||||
super->actionDelay <<= 1;
|
||||
this->unk_0x82 = 4;
|
||||
}
|
||||
|
||||
void sub_0803C664(BowMoblinEntity* this) {
|
||||
super->action = 3;
|
||||
super->actionDelay = 0x20;
|
||||
super->field_0xf = 0;
|
||||
this->unk_0x80 = 0;
|
||||
this->unk_0x7b = 0;
|
||||
super->speed = 0;
|
||||
this->unk_0x82 = 0;
|
||||
sub_0803C690(this);
|
||||
}
|
||||
|
||||
void sub_0803C690(BowMoblinEntity* this) {
|
||||
u32 tmp = super->animationState >> 1;
|
||||
switch (this->unk_0x82) {
|
||||
case 1:
|
||||
case 4: {
|
||||
tmp += 0x4;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case 5: {
|
||||
tmp += 0x8;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
tmp += 0xc;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InitializeAnimation(super, tmp);
|
||||
}
|
||||
|
||||
void sub_0803C6DC(BowMoblinEntity* this) {
|
||||
u8 tmp = this->unk_0x82;
|
||||
if (tmp == 0) {
|
||||
super->speed = tmp;
|
||||
}
|
||||
|
||||
ProcessMovement(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
u32 sub_0803C6F8(BowMoblinEntity* this) {
|
||||
u32 tmp = (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]);
|
||||
u32 tmp2 = -tmp;
|
||||
return (tmp2 | tmp) >> 0x1f;
|
||||
}
|
||||
|
||||
void sub_0803C714(BowMoblinEntity* this) {
|
||||
Entity* child = super->child;
|
||||
const s8* tmp;
|
||||
u32 offsetX;
|
||||
u32 offsetY;
|
||||
tmp = &gUnk_080CFFC4[super->animationState];
|
||||
// TODO fix array access
|
||||
offsetX = tmp[0] << 0x10;
|
||||
offsetY = tmp[1] << 0x10;
|
||||
|
||||
PositionRelative(super, child, offsetX, offsetY);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
/**
|
||||
* @file businessScrub.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Business Scrub enemy
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
#include "enemy.h"
|
||||
#include "audio.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "save.h"
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "game.h"
|
||||
#include "item.h"
|
||||
|
||||
extern void LoadObjPalette(Entity*, u32);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
extern bool32 sub_08056338(void);
|
||||
extern void UnloadOBJPalette(Entity*);
|
||||
|
||||
+7
-1
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @file chaser.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Chaser enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
|
||||
+24
-14
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* @file chuchu.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Chuchu enemy
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void sub_08001318(Entity*);
|
||||
@@ -134,7 +139,7 @@ void sub_0801EFD8(Entity* this) {
|
||||
sub_0801FB68(this);
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -146,7 +151,7 @@ void sub_0801F02C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0801F048(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->type == 0) {
|
||||
sub_0804A7D4(this);
|
||||
@@ -218,7 +223,7 @@ void sub_0801F1B0(Entity* this) {
|
||||
EnqueueSFX(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
if (GravityUpdate(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
@@ -278,7 +283,7 @@ void sub_0801F2CC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0801F2F8(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
sub_0801F340(this);
|
||||
@@ -333,9 +338,6 @@ void sub_0801F3AC(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EU
|
||||
ASM_FUNC("asm/non_matching/eu/sub_0801F428.inc", void sub_0801F428(Entity* this))
|
||||
#else
|
||||
void sub_0801F428(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
@@ -347,12 +349,20 @@ void sub_0801F428(Entity* this) {
|
||||
|
||||
this->action = 3;
|
||||
this->field_0xf = 30;
|
||||
|
||||
#ifdef EU
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
#endif
|
||||
|
||||
COLLISION_ON(this);
|
||||
this->spritePriority.b1 = 3;
|
||||
|
||||
#ifndef EU
|
||||
this->spriteSettings.draw = 1;
|
||||
#endif
|
||||
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0801F48C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
@@ -409,7 +419,7 @@ void sub_0801F584(Entity* this) {
|
||||
EnqueueSFX(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
if (GravityUpdate(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
|
||||
} else {
|
||||
@@ -471,7 +481,7 @@ void sub_0801F6CC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0801F6F8(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
this->action = 4;
|
||||
@@ -586,7 +596,7 @@ void sub_0801F940(Entity* this) {
|
||||
EnqueueSFX(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
if (GravityUpdate(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
@@ -646,7 +656,7 @@ void sub_0801FA78(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0801FAAC(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
sub_0801FB14(this);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/**
|
||||
* @file chuchuBoss.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Chuchu Boss enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08027870(Entity*);
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "global.h"
|
||||
#include "common.h"
|
||||
#include "functions.h"
|
||||
|
||||
void ClearArmosData(void) {
|
||||
MemClear(&gRoomTransition.armos_data, sizeof(gRoomTransition.armos_data));
|
||||
gRoomTransition.armos_data.field_0xae = 0xff;
|
||||
}
|
||||
|
||||
void sub_080300C4(void) {
|
||||
if (gRoomTransition.armos_data.field_0xae == 0xff) {
|
||||
gRoomTransition.armos_data.field_0xac = 0;
|
||||
MemClear(&gRoomTransition.armos_data.data, sizeof(gRoomTransition.armos_data.data));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file cuccoChickAggr.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Cucco Chick Aggr enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -52,7 +59,7 @@ void sub_08022988(Entity* this) {
|
||||
}
|
||||
|
||||
ProcessMovement(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (GravityUpdate(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
@@ -64,7 +71,7 @@ void sub_08022988(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080229F8(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2800) == 0) {
|
||||
if (GravityUpdate(this, 0x2800) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 6;
|
||||
@@ -88,7 +95,7 @@ void sub_08022A40(Entity* this) {
|
||||
}
|
||||
|
||||
ProcessMovement(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (GravityUpdate(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
|
||||
+24
-17
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file darkNut.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Dark Nut enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -6,23 +13,23 @@ typedef struct {
|
||||
u8 field_0x1;
|
||||
} PACKED stuct_080CAB14;
|
||||
|
||||
void sub_08021218();
|
||||
void sub_08021588();
|
||||
void sub_080213D0();
|
||||
void sub_08021390();
|
||||
void sub_0802159C();
|
||||
void sub_0804AA1C();
|
||||
void sub_080213F0();
|
||||
u32 sub_080214FC();
|
||||
void sub_08021540();
|
||||
void sub_08021600();
|
||||
void sub_080213B0();
|
||||
u32 PlayerInRange();
|
||||
u32 sub_0802169C();
|
||||
void sub_0802124C();
|
||||
void sub_08021644();
|
||||
void sub_08021414();
|
||||
void sub_08021400();
|
||||
void sub_08021218(Entity*, u32, u32);
|
||||
void sub_08021588(Entity*);
|
||||
void sub_080213D0(Entity*, u32);
|
||||
void sub_08021390(Entity*);
|
||||
void sub_0802159C(Entity*);
|
||||
void sub_0804AA1C(Entity*);
|
||||
void sub_080213F0(Entity*);
|
||||
u32 sub_080214FC(Entity*);
|
||||
void sub_08021540(Entity*);
|
||||
void sub_08021600(Entity*);
|
||||
void sub_080213B0(Entity*);
|
||||
u32 PlayerInRange(Entity*, u32, u32);
|
||||
u32 sub_0802169C(Entity*, Entity*);
|
||||
void sub_0802124C(Entity*);
|
||||
void sub_08021644(Entity*);
|
||||
void sub_08021414(Entity*);
|
||||
void sub_08021400(Entity*);
|
||||
u32 sub_08021274(u32, u32);
|
||||
u32 sub_08021664(Entity*, Entity*);
|
||||
u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
+10
-5
@@ -1,12 +1,17 @@
|
||||
#include "audio.h"
|
||||
/**
|
||||
* @file doorMimic.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Door Mimic enemy
|
||||
*/
|
||||
|
||||
#include "sound.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern s16 sub_080001DA(u32, u32); // ?
|
||||
extern void sub_08049CF4();
|
||||
void sub_080221C0();
|
||||
extern void sub_08049CF4(Entity*);
|
||||
void sub_080221C0(Entity*);
|
||||
|
||||
typedef struct {
|
||||
s8 h;
|
||||
|
||||
+8
-1
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file enemy4D.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief enemy 4D
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
@@ -29,7 +36,7 @@ void sub_0803EB34(Entity* this) {
|
||||
CreateDeathFx(this, 0xff, 0x57);
|
||||
}
|
||||
|
||||
void nullsub_21() {
|
||||
void nullsub_21(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0803EB44(Entity* this) {
|
||||
|
||||
+7
-1
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @file enemyE.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief enemy E
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08023000(Entity*, int);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file fallingBoulder.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Falling Boulder enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -61,7 +68,7 @@ void sub_0802C318(Entity* this) {
|
||||
|
||||
NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(Entity* this)) {
|
||||
if ((u16)this->field_0x7c.HALF.LO == 0) {
|
||||
u32 tmp = gRoomControls.roomOriginY;
|
||||
u32 tmp = gRoomControls.origin_y;
|
||||
if (&gPlayerEntity == NULL)
|
||||
return;
|
||||
if (tmp - gPlayerEntity.y.HALF.HI <= 0x38) {
|
||||
@@ -106,11 +113,11 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
|
||||
}
|
||||
}
|
||||
|
||||
y = gRoomControls.roomOriginY + gRoomControls.height - this->y.HALF.HI;
|
||||
y = gRoomControls.origin_y + gRoomControls.height - this->y.HALF.HI;
|
||||
if (y >= 5) {
|
||||
sub_080AEFB4(this);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->z.HALF.HI - y > 0x38) {
|
||||
sub_0802C62C(this);
|
||||
this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file fireballGuy.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Fireball Guy enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -13,8 +20,6 @@ extern void (*const gUnk_080D1800[])(Entity*);
|
||||
extern u8 gUnk_080D180C[4]; // Entity count per form
|
||||
extern PosOffset gUnk_080D1810[4];
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void FireballGuy(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080D17E8);
|
||||
}
|
||||
@@ -49,7 +54,7 @@ void sub_080453E8(Entity* this) {
|
||||
void sub_08045430(Entity* this) {
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0)
|
||||
if (GravityUpdate(this, 0x1800) == 0)
|
||||
sub_08045524(this);
|
||||
}
|
||||
|
||||
|
||||
+39
-34
@@ -1,27 +1,35 @@
|
||||
/**
|
||||
* @file gibdo.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Gibdo enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
// Gibudo
|
||||
void sub_08037794();
|
||||
void sub_08037B10();
|
||||
void sub_0803797C();
|
||||
void sub_080379BC();
|
||||
void sub_08037C0C();
|
||||
u32 sub_08037810();
|
||||
void sub_080377B0();
|
||||
u32 sub_080378B0();
|
||||
u32 sub_08037914();
|
||||
u32 sub_080379EC();
|
||||
void sub_08037A58();
|
||||
void sub_08037ACC();
|
||||
void sub_08037B48();
|
||||
void sub_08037A14();
|
||||
void sub_08037794(Entity*);
|
||||
void sub_08037B10(Entity*);
|
||||
void sub_0803797C(Entity*);
|
||||
void sub_080379BC(Entity*);
|
||||
void sub_08037C0C(Entity*, Entity*);
|
||||
u32 sub_08037810(Entity*);
|
||||
void sub_080377B0(Entity*);
|
||||
u32 sub_080378B0(Entity*);
|
||||
u32 sub_08037914(Entity*);
|
||||
u32 sub_080379EC(Entity*);
|
||||
void sub_08037A58(Entity*);
|
||||
void sub_08037ACC(Entity*);
|
||||
void sub_08037B48(Entity*);
|
||||
void sub_08037A14(Entity*);
|
||||
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
|
||||
extern void (*const gGibdo[6])(Entity*);
|
||||
extern void (*const gUnk_080CF2AC[9])(Entity*);
|
||||
@@ -75,7 +83,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void nullsub_162() {
|
||||
void nullsub_162(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08037558(Entity* this) {
|
||||
@@ -155,27 +163,25 @@ void sub_08037690(Entity* this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Non-matching
|
||||
NONMATCH("asm/non_matching/gibdo/sub_080376D0.inc", void sub_080376D0(Entity* this)) {
|
||||
|
||||
void sub_080376D0(Entity* this) {
|
||||
u8* x;
|
||||
if (sub_080379EC(this) == 0) {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
|
||||
gPlayerState.mobility = gPlayerState.mobility | 0x80;
|
||||
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
|
||||
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
x = &this->frame;
|
||||
if ((*x & 0x1) != 0) {
|
||||
if (!(--this->field_0x7c.BYTES.byte0)) {
|
||||
if ((this->frame & 0x1) != 0) {
|
||||
if (--this->field_0x7c.BYTES.byte0 == 0) {
|
||||
sub_08037A58(this);
|
||||
} else {
|
||||
this->frame ^= 1;
|
||||
sub_08037B10(this);
|
||||
}
|
||||
} else {
|
||||
*x = *x ^ 1;
|
||||
sub_08037B10(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_0803773C(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -347,8 +353,8 @@ void sub_08037A58(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08037ACC(Entity* this) {
|
||||
gPlayerState.flags &= 0xFFFFFEFF;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
|
||||
COLLISION_ON(&gPlayerEntity);
|
||||
gPlayerEntity.iframes = 0x1e;
|
||||
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
|
||||
gPlayerEntity.knockbackDuration = 4;
|
||||
@@ -359,18 +365,18 @@ void sub_08037B10(Entity* this) {
|
||||
u32 h;
|
||||
gPlayerEntity.iframes = 0xc;
|
||||
h = ModHealth(-8);
|
||||
sub_0800449C(&gPlayerEntity, 0x7a);
|
||||
SoundReqClipped(&gPlayerEntity, 0x7a);
|
||||
if (h == 0) {
|
||||
sub_08037A58(this);
|
||||
this->field_0x76.HALF.LO = 0xf0;
|
||||
}
|
||||
}
|
||||
NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* this)) {
|
||||
void sub_08037B48(Entity* this) {
|
||||
Entity* E;
|
||||
E = CreateObject(OBJECT_2A, 3, 0);
|
||||
if (E != 0) {
|
||||
E->type2 = this->actionDelay;
|
||||
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
|
||||
E->spritePriority.b0 = 3;
|
||||
E->spriteOffsetX = 0;
|
||||
E->spriteOffsetY = 0xfc;
|
||||
E->parent = this;
|
||||
@@ -379,7 +385,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
|
||||
E = CreateObject(OBJECT_2A, 3, 0);
|
||||
if (E != 0) {
|
||||
E->type2 = this->actionDelay;
|
||||
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
|
||||
E->spritePriority.b0 = 3;
|
||||
E->spriteOffsetX = 0xfd;
|
||||
E->spriteOffsetY = 0xf8;
|
||||
E->parent = this;
|
||||
@@ -388,14 +394,13 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
|
||||
E = CreateObject(OBJECT_2A, 3, 0);
|
||||
if (E != 0) {
|
||||
E->type2 = this->actionDelay;
|
||||
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
|
||||
E->spritePriority.b0 = 3;
|
||||
E->spriteOffsetX = 0x5;
|
||||
E->spriteOffsetY = 0xf5;
|
||||
E->parent = this;
|
||||
}
|
||||
this->child = E;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* this, Entity* that)) {
|
||||
if (this->field_0x80.HWORD != 0) {
|
||||
|
||||
+13
-13
@@ -19,7 +19,7 @@ void (*const gUnk_080D1E6C[])(GyorgChildEntity*) = {
|
||||
};
|
||||
|
||||
void GyorgChild(Entity* this) {
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
this->flags &= ~0x80;
|
||||
this->health = 0;
|
||||
this->collisionLayer = 2;
|
||||
@@ -106,7 +106,7 @@ void sub_080486F4(GyorgChildEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0804877C(GyorgChildEntity* this) {
|
||||
sub_0806F69C(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (super->actionDelay != 0) {
|
||||
if ((--super->actionDelay & 0xF) == 0) {
|
||||
super->direction += this->unk_7b;
|
||||
@@ -115,22 +115,22 @@ void sub_0804877C(GyorgChildEntity* this) {
|
||||
}
|
||||
switch (super->animationState >> 1) {
|
||||
case 0:
|
||||
if (super->y.HALF.HI > gRoomControls.roomScrollY - 0x18) {
|
||||
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x18) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (super->x.HALF.HI < gRoomControls.roomScrollX + 0x108) {
|
||||
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x108) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (super->y.HALF.HI < gRoomControls.roomScrollY + 0xb8) {
|
||||
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xb8) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (super->x.HALF.HI > gRoomControls.roomScrollX - 0x18) {
|
||||
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x18) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -157,11 +157,11 @@ void sub_0804882C(GyorgChildEntity* this) {
|
||||
case 0:
|
||||
case 2:
|
||||
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk_74;
|
||||
super->y.HALF.HI = gRoomControls.roomScrollY + this->unk_76;
|
||||
super->y.HALF.HI = gRoomControls.scroll_y + this->unk_76;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
super->x.HALF.HI = gRoomControls.roomScrollX + this->unk_74;
|
||||
super->x.HALF.HI = gRoomControls.scroll_x + this->unk_74;
|
||||
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk_76;
|
||||
break;
|
||||
}
|
||||
@@ -172,26 +172,26 @@ void sub_0804882C(GyorgChildEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08048904(GyorgChildEntity* this) {
|
||||
sub_0806F69C(super);
|
||||
LinearMoveUpdate(super);
|
||||
GetNextFrame(super);
|
||||
switch (super->animationState >> 1) {
|
||||
case 0:
|
||||
if (super->y.HALF.HI > gRoomControls.roomScrollY - 0x28) {
|
||||
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x28) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (super->x.HALF.HI < gRoomControls.roomScrollX + 0x118) {
|
||||
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x118) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (super->y.HALF.HI < gRoomControls.roomScrollY + 0xc8) {
|
||||
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xc8) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (super->x.HALF.HI > gRoomControls.roomScrollX - 0x28) {
|
||||
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x28) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "utils.h"
|
||||
#include "audio.h"
|
||||
#include "sound.h"
|
||||
#include "asm.h"
|
||||
#include "functions.h"
|
||||
#include "enemy/gyorg.h"
|
||||
@@ -270,8 +269,8 @@ END_NONMATCH
|
||||
|
||||
void sub_080465C8(void) {
|
||||
s32 x, y;
|
||||
x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3;
|
||||
y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 3;
|
||||
x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3;
|
||||
y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3;
|
||||
if (gUnk_02019EE0[(y << 7) + x]) {
|
||||
gPlayerState.field_0x14 = 1;
|
||||
}
|
||||
@@ -284,8 +283,8 @@ void sub_0804660C(GyorgFemaleEntity* this, u32 unk1) {
|
||||
const u16* p;
|
||||
super->animationState = unk1;
|
||||
p = &gUnk_080D1A84[unk1 >> 5];
|
||||
super->x.HALF.HI = p[0] + gRoomControls.roomOriginX;
|
||||
super->y.HALF.HI = p[1] + gRoomControls.roomOriginY;
|
||||
super->x.HALF.HI = p[0] + gRoomControls.origin_x;
|
||||
super->y.HALF.HI = p[1] + gRoomControls.origin_y;
|
||||
}
|
||||
|
||||
// todo: correct type
|
||||
@@ -408,7 +407,7 @@ void sub_080466A8(GyorgFemaleEntity* this) {
|
||||
this->unk_78 = 0xFF;
|
||||
SoundReq(SFX_BOSS_HIT);
|
||||
if (super->health != 0) {
|
||||
sub_08080964(8, 0);
|
||||
InitScreenShake(8, 0);
|
||||
if (++this->unk_82 <= 0xC) {
|
||||
super->health--;
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ void sub_08048D20(GyorgFemaleEyeEntity* this) {
|
||||
if (tmp2 != super->animationState) {
|
||||
super->animationState = tmp2;
|
||||
tmp = &gUnk_080D1F90[super->type + (tmp2 << 3)];
|
||||
super->x.HALF.HI = tmp->x + gRoomControls.roomOriginX;
|
||||
super->y.HALF.HI = tmp->y + gRoomControls.roomOriginY;
|
||||
super->x.HALF.HI = tmp->x + gRoomControls.origin_x;
|
||||
super->y.HALF.HI = tmp->y + gRoomControls.origin_y;
|
||||
InitializeAnimation(super, gUnk_080D2010[super->type + (tmp2 << 3)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ void GyorgFemaleMouth(Entity* this) {
|
||||
tmp = this->parent->animationState >> 5;
|
||||
if (tmp != this->animationState) {
|
||||
this->animationState = tmp;
|
||||
this->x.HALF.HI = gUnk_080D28CC[tmp] + gRoomControls.roomOriginX;
|
||||
this->y.HALF.HI = gUnk_080D28CC[tmp + 1] + gRoomControls.roomOriginY;
|
||||
this->x.HALF.HI = gUnk_080D28CC[tmp] + gRoomControls.origin_x;
|
||||
this->y.HALF.HI = gUnk_080D28CC[tmp + 1] + gRoomControls.origin_y;
|
||||
InitializeAnimation(this, tmp >> 1);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
|
||||
+51
-44
@@ -1,8 +1,15 @@
|
||||
/**
|
||||
* @file gyorgMale.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Gyorg Male enemy
|
||||
*/
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "fileScreen.h"
|
||||
#include "fileselect.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "enemy/gyorg.h"
|
||||
@@ -104,7 +111,7 @@ void GyorgMale(GyorgMaleEntity* this) {
|
||||
super->animationState = -(this->unk_78 >> 8);
|
||||
sub_08048004(this);
|
||||
this->unk_7d = super->spriteSettings.draw;
|
||||
if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.roomScrollY + 0x30) > 0x100u) {
|
||||
if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.scroll_y + 0x30) > 0x100u) {
|
||||
super->spriteSettings.draw = 0;
|
||||
}
|
||||
this->unk_84 = gPlayerEntity.x.HALF.HI;
|
||||
@@ -168,7 +175,7 @@ void sub_08046930(GyorgMaleEntity* this) {
|
||||
|
||||
void sub_0804696C(GyorgMaleEntity* this) {
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginY + 0x130 > super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x130 > super->y.HALF.HI) {
|
||||
super->subAction = 2;
|
||||
super->direction = 0x80;
|
||||
super->speed = 0x100;
|
||||
@@ -180,9 +187,9 @@ void sub_0804696C(GyorgMaleEntity* this) {
|
||||
}
|
||||
if (super->actionDelay) {
|
||||
#ifdef EU
|
||||
if (gRoomControls.roomOriginY + 0x210 > super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x210 > super->y.HALF.HI) {
|
||||
#else
|
||||
if (gRoomControls.roomOriginY + 0x258 > super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x258 > super->y.HALF.HI) {
|
||||
#endif
|
||||
super->actionDelay = 0;
|
||||
SoundReq(SFX_APPARATE);
|
||||
@@ -192,7 +199,7 @@ void sub_0804696C(GyorgMaleEntity* this) {
|
||||
|
||||
void sub_080469CC(GyorgMaleEntity* this) {
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginY + 0x210 < super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x210 < super->y.HALF.HI) {
|
||||
super->subAction = 3;
|
||||
super->direction = 0x90;
|
||||
}
|
||||
@@ -200,7 +207,7 @@ void sub_080469CC(GyorgMaleEntity* this) {
|
||||
|
||||
void sub_080469F4(GyorgMaleEntity* this) {
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginY + 0x290 < super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x290 < super->y.HALF.HI) {
|
||||
super->subAction = 4;
|
||||
super->spriteOrientation.flipY = 2;
|
||||
super->spriteRendering.b3 = 2;
|
||||
@@ -217,7 +224,7 @@ void sub_08046A30(GyorgMaleEntity* this) {
|
||||
|
||||
void sub_08046A54(GyorgMaleEntity* this) {
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginX + 0x380 < super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x380 < super->x.HALF.HI) {
|
||||
super->subAction = 6;
|
||||
}
|
||||
}
|
||||
@@ -275,8 +282,8 @@ void sub_08046B8C(GyorgMaleEntity* this) {
|
||||
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
|
||||
super->subAction = 3;
|
||||
this->unk_76 = super->direction << 8;
|
||||
this->unk_80 = gRoomControls.roomOriginX + 0x200;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x210;
|
||||
this->unk_80 = gRoomControls.origin_x + 0x200;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x210;
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
@@ -337,8 +344,8 @@ void sub_08046D44(GyorgMaleEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->speed = 0x200;
|
||||
tmp = gUnk_080D1B60 + (((Entity*)super->myHeap)->next->animationState >> 5);
|
||||
this->unk_80 = tmp[0] + gRoomControls.roomOriginX;
|
||||
this->unk_82 = tmp[1] + gRoomControls.roomOriginY;
|
||||
this->unk_80 = tmp[0] + gRoomControls.origin_x;
|
||||
this->unk_82 = tmp[1] + gRoomControls.origin_y;
|
||||
this->unk_76 = super->direction << 8;
|
||||
sub_08047D88(this);
|
||||
}
|
||||
@@ -446,8 +453,8 @@ void sub_08046FE8(GyorgMaleEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->speed = 0x1c0;
|
||||
this->unk_7e = 0x1e;
|
||||
this->unk_80 = gRoomControls.roomOriginX + 0x290;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x190;
|
||||
this->unk_80 = gRoomControls.origin_x + 0x290;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x190;
|
||||
sub_08047D88(this);
|
||||
}
|
||||
|
||||
@@ -505,7 +512,7 @@ void sub_0804717C(GyorgMaleEntity* this) {
|
||||
super->speed += 8;
|
||||
}
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
if (gRoomControls.roomOriginX + 0x200 > super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x200 > super->x.HALF.HI) {
|
||||
super->subAction = 5;
|
||||
}
|
||||
}
|
||||
@@ -518,7 +525,7 @@ void sub_080471C8(GyorgMaleEntity* this) {
|
||||
super->direction++;
|
||||
}
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
if (gRoomControls.roomOriginY + 0x190 <= super->y.HALF.HI)
|
||||
if (gRoomControls.origin_y + 0x190 <= super->y.HALF.HI)
|
||||
return;
|
||||
if (this->unk_74 > 0x100) {
|
||||
if (Random() & 1) {
|
||||
@@ -558,7 +565,7 @@ void sub_080472BC(GyorgMaleEntity* this) {
|
||||
super->speed += 8;
|
||||
}
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
if (gRoomControls.roomOriginX + 0x2B0 >= super->x.HALF.HI)
|
||||
if (gRoomControls.origin_x + 0x2B0 >= super->x.HALF.HI)
|
||||
return;
|
||||
super->subAction = 9;
|
||||
this->unk_76 = super->direction << 8;
|
||||
@@ -597,8 +604,8 @@ void sub_0804736C(GyorgMaleEntity* this) {
|
||||
void sub_080473B8(GyorgMaleEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->speed = 0x120;
|
||||
this->unk_80 = gRoomControls.roomOriginX + 0x200;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x1D0;
|
||||
this->unk_80 = gRoomControls.origin_x + 0x200;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x1D0;
|
||||
sub_08047D88(this);
|
||||
}
|
||||
|
||||
@@ -651,9 +658,9 @@ void sub_08047484(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08047508(GyorgMaleEntity* this) {
|
||||
if (gRoomControls.roomOriginX + 0x1A0 < super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x1A0 < super->x.HALF.HI) {
|
||||
if (super->direction == 0) {
|
||||
if (gRoomControls.roomOriginY + 0x208 >= super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x208 >= super->y.HALF.HI) {
|
||||
this->unk_74 = -this->unk_74;
|
||||
this->unk_76 += this->unk_74;
|
||||
super->direction = this->unk_76 >> 8;
|
||||
@@ -679,7 +686,7 @@ void sub_08047508(GyorgMaleEntity* this) {
|
||||
}
|
||||
}
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginX + 0x280 < super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x280 < super->x.HALF.HI) {
|
||||
super->subAction = 4;
|
||||
super->speed = 0x200;
|
||||
super->animationState = super->direction;
|
||||
@@ -706,9 +713,9 @@ void sub_080475F4(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0804763C(GyorgMaleEntity* this) {
|
||||
if (gRoomControls.roomOriginX + 0x1F0 > super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x1F0 > super->x.HALF.HI) {
|
||||
if (super->direction == 0) {
|
||||
if (gRoomControls.roomOriginY + 0x208 >= super->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x208 >= super->y.HALF.HI) {
|
||||
this->unk_74 = -this->unk_74;
|
||||
this->unk_76 += this->unk_74;
|
||||
super->direction = this->unk_76 >> 8;
|
||||
@@ -734,7 +741,7 @@ void sub_0804763C(GyorgMaleEntity* this) {
|
||||
}
|
||||
}
|
||||
sub_08047E48(this);
|
||||
if (gRoomControls.roomOriginX + 0x180 > super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x180 > super->x.HALF.HI) {
|
||||
super->subAction = 6;
|
||||
super->speed = 0x200;
|
||||
super->animationState = super->direction;
|
||||
@@ -771,13 +778,13 @@ void sub_08047778(GyorgMaleEntity* this) {
|
||||
void sub_08047798(GyorgMaleEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->speed = 0x80;
|
||||
if (super->x.HALF.HI - gRoomControls.roomOriginX < 0x1F8) {
|
||||
if (super->x.HALF.HI - gRoomControls.origin_x < 0x1F8) {
|
||||
this->unk_80 = 0xa8;
|
||||
} else {
|
||||
this->unk_80 = 0x348;
|
||||
}
|
||||
this->unk_80 += gRoomControls.roomOriginX;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x348;
|
||||
this->unk_80 += gRoomControls.origin_x;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x348;
|
||||
sub_08047D88(this);
|
||||
}
|
||||
|
||||
@@ -797,7 +804,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
|
||||
super->direction = super->animationState;
|
||||
return;
|
||||
}
|
||||
if (!sub_0806FCB8(super, gRoomControls.roomOriginX + 0x200, gRoomControls.roomOriginY + 0x210, 0x100)) {
|
||||
if (!sub_0806FCB8(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
|
||||
super->spriteOrientation.flipY = 3;
|
||||
super->spriteRendering.b3 = 3;
|
||||
}
|
||||
@@ -807,7 +814,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
|
||||
this->unk_74 = gUnk_080D1BF0[Random() & 1];
|
||||
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 1) {
|
||||
((GyorgHeap*)super->myHeap)->female->unk_79 =
|
||||
gRoomControls.roomOriginX + 0x200 > super->x.HALF.HI ? 0x81 : 0x83;
|
||||
gRoomControls.origin_x + 0x200 > super->x.HALF.HI ? 0x81 : 0x83;
|
||||
} else {
|
||||
((GyorgHeap*)super->myHeap)->female->unk_79 = 0x80;
|
||||
}
|
||||
@@ -868,25 +875,25 @@ void sub_08047978(GyorgMaleEntity* this) {
|
||||
super->subAction = 4;
|
||||
if (super->type == 0) {
|
||||
if ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6) == 1) {
|
||||
this->unk_80 = gRoomControls.roomOriginX + 0x1C0;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x250;
|
||||
this->unk_80 = gRoomControls.origin_x + 0x1C0;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x250;
|
||||
} else {
|
||||
this->unk_80 = gRoomControls.roomOriginX + 0x240;
|
||||
this->unk_82 = gRoomControls.roomOriginY + 0x250;
|
||||
this->unk_80 = gRoomControls.origin_x + 0x240;
|
||||
this->unk_82 = gRoomControls.origin_y + 0x250;
|
||||
}
|
||||
} else {
|
||||
if (gRoomControls.roomOriginX + 0x200 < super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x200 < super->x.HALF.HI) {
|
||||
this->unk_80 = 0x190;
|
||||
} else {
|
||||
this->unk_80 = 0x270;
|
||||
}
|
||||
this->unk_80 += gRoomControls.roomOriginX;
|
||||
if (gRoomControls.roomOriginY + 0x210 < super->y.HALF.HI) {
|
||||
this->unk_80 += gRoomControls.origin_x;
|
||||
if (gRoomControls.origin_y + 0x210 < super->y.HALF.HI) {
|
||||
this->unk_82 = 0x1A0;
|
||||
} else {
|
||||
this->unk_82 = 0x280;
|
||||
}
|
||||
this->unk_82 += gRoomControls.roomOriginY;
|
||||
this->unk_82 += gRoomControls.origin_y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,7 +928,7 @@ void sub_08047BA4(GyorgMaleEntity* this) {
|
||||
super->subAction = 1;
|
||||
super->actionDelay = 0x78;
|
||||
super->field_0xf = 0;
|
||||
if (gRoomControls.roomOriginX + 0x200 < super->x.HALF.HI) {
|
||||
if (gRoomControls.origin_x + 0x200 < super->x.HALF.HI) {
|
||||
this->unk_76 = 0x78;
|
||||
} else {
|
||||
this->unk_76 = 0x88;
|
||||
@@ -953,7 +960,7 @@ void sub_08047BF0(GyorgMaleEntity* this) {
|
||||
super->direction = this->unk_76;
|
||||
super->speed = 0x140;
|
||||
sub_08047E48(this);
|
||||
if (super->y.HALF.HI > gRoomControls.roomOriginY + 0x270) {
|
||||
if (super->y.HALF.HI > gRoomControls.origin_y + 0x270) {
|
||||
super->subAction = 2;
|
||||
this->unk_7e = 0xAA;
|
||||
SoundReq(SFX_12D);
|
||||
@@ -1124,8 +1131,8 @@ void sub_08048004(GyorgMaleEntity* this) {
|
||||
if (this->unk_7c & 1) {
|
||||
u32 b = super->spriteRendering.b3;
|
||||
if (b == 3) {
|
||||
s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3);
|
||||
s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 3);
|
||||
s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3);
|
||||
s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3);
|
||||
u16* tmp = (u16*)&gUnk_02019EE0;
|
||||
if (tmp[(posY << 7) + posX]) {
|
||||
if (!(this->unk_7c & 2)) {
|
||||
@@ -1176,6 +1183,6 @@ const u16 gUnk_080D1C60[8] = { 0x200, 0x150, 0x290, 0x210, 0x200, 0x2D0, 0x170,
|
||||
void sub_08048178(GyorgMaleEntity* this, u32 unk1) {
|
||||
const u16* tmp = ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6 & 1) ? gUnk_080D1C60 + unk1
|
||||
: gUnk_080D1C50 + unk1);
|
||||
this->unk_80 = *tmp + gRoomControls.roomOriginX;
|
||||
this->unk_82 = *(tmp + 1) + gRoomControls.roomOriginY;
|
||||
this->unk_80 = *tmp + gRoomControls.origin_x;
|
||||
this->unk_82 = *(tmp + 1) + gRoomControls.origin_y;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/**
|
||||
* @file hangingSeed.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Hanging Seed enemy
|
||||
*/
|
||||
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern void (*const gHangingSeedFunctions[])(Entity*);
|
||||
extern void (*const gUnk_080CB588[])(Entity*);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file helmasaur.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Helmasaur enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -186,7 +193,7 @@ void sub_0802BE18(Entity* this) {
|
||||
void sub_0802BE48(Entity* this) {
|
||||
if (!sub_080AEFE0(this)) {
|
||||
sub_0802C218(this);
|
||||
sub_08080964(8, 0);
|
||||
InitScreenShake(8, 0);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
sub_0802C1CC(this);
|
||||
@@ -227,7 +234,7 @@ void sub_0802BEEC(Entity* this) {
|
||||
this->direction = this->animationState << 3;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
}
|
||||
} else if (!sub_08003FC4(this, 0x1c00)) {
|
||||
} else if (!GravityUpdate(this, 0x1c00)) {
|
||||
this->action = 8;
|
||||
this->actionDelay = 30;
|
||||
this->speed = 0x120;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file keaton.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief keaton enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file keese.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Keese enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
+8
-1
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file lakitu.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Lakitu enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
@@ -224,7 +231,7 @@ void Lakitu_LightningDelay(Entity* this) {
|
||||
}
|
||||
|
||||
void Lakitu_Cloudless(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) {
|
||||
if (GravityUpdate(this, 0x1800) == 0 && this->animIndex <= 19) {
|
||||
InitAnimationForceUpdate(this, this->animationState + 20);
|
||||
|
||||
this->spritePriority.b1 = 0;
|
||||
|
||||
+11
-3
@@ -1,9 +1,17 @@
|
||||
/**
|
||||
* @file lakituCloud.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Lakitu Cloud enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "enemy.h"
|
||||
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
|
||||
@@ -11,7 +19,7 @@ extern void (*const gUnk_080D0418[6])(Entity*);
|
||||
extern void (*const gUnk_080D0430[3])(Entity*);
|
||||
extern void (*const gUnk_080D043C[3])(Entity*);
|
||||
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
extern void sub_0803CE14(Entity*);
|
||||
extern void sub_0803CE3C(Entity*);
|
||||
extern void sub_08079D84(void);
|
||||
@@ -56,7 +64,7 @@ void sub_0803CD40(Entity* this) {
|
||||
|
||||
ModHealth(-2);
|
||||
|
||||
sub_0800449C(&gPlayerEntity, 122);
|
||||
SoundReqClipped(&gPlayerEntity, 122);
|
||||
sub_08079D84();
|
||||
|
||||
sub_0803CE3C(this);
|
||||
@@ -85,7 +93,7 @@ void sub_0803CDA8(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if ((this->direction & 0x80) == 0) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
|
||||
if (--this->field_0x74.HWORD << 0x10 == 0) {
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file leever.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Leever enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
+11
-3
@@ -1,8 +1,16 @@
|
||||
/**
|
||||
* @file likeLike.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Like Like enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "save.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
|
||||
extern bool32 ItemIsShield(u32);
|
||||
|
||||
@@ -184,7 +192,7 @@ void sub_0802805C(Entity* this) {
|
||||
sub_0802810C(this);
|
||||
} else {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
|
||||
|
||||
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
|
||||
@@ -203,7 +211,7 @@ void sub_0802805C(Entity* this) {
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags &= 0xffffffef;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/**
|
||||
* @file madderpillar.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Madderpillar enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u8 gEntCount;
|
||||
extern Hitbox gUnk_080FD298;
|
||||
extern Hitbox gUnk_080FD2A0;
|
||||
|
||||
|
||||
+38
-32
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file mazaalBracelet.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mazaal Bracelet enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -20,7 +27,7 @@ void sub_0803B798(void);
|
||||
void sub_0803BA8C(Entity*, u32);
|
||||
|
||||
void sub_0803B724(Entity*);
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
|
||||
void sub_0803A170(Entity*);
|
||||
void sub_0803A188(Entity*);
|
||||
@@ -85,7 +92,6 @@ void sub_0803B978(Entity*);
|
||||
void sub_0803BA6C(Entity*);
|
||||
void sub_0803BA80(Entity*);
|
||||
|
||||
extern u8 gEntCount;
|
||||
// these are not with the rest of this files constant data
|
||||
extern Hitbox gUnk_080FD35C;
|
||||
extern Hitbox gUnk_080FD364;
|
||||
@@ -197,7 +203,7 @@ void sub_0803A274(Entity* this) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
PositionRelative(this->parent, this, -0x100000, 0x200000);
|
||||
}
|
||||
if (gScreenTransition.field_0x38 != 0) {
|
||||
if (gRoomTransition.field_0x38 != 0) {
|
||||
this->action = 3;
|
||||
COLLISION_ON(this);
|
||||
this->spriteSettings.draw = 1;
|
||||
@@ -242,7 +248,7 @@ void sub_0803A364(Entity* this) {
|
||||
break;
|
||||
case 5:
|
||||
if (sub_0803B4E4(this) == 0) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
return;
|
||||
}
|
||||
this->type2 = 0;
|
||||
@@ -325,7 +331,7 @@ void sub_0803A548(Entity* this) {
|
||||
index = ((this->parent->field_0xf >> 4) + 3);
|
||||
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
|
||||
if (sub_0803B4E4(this) == 0) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +345,7 @@ void sub_0803A58C(Entity* this) {
|
||||
if (sub_0803B4E4(this) != 0) {
|
||||
sub_0803B59C(this);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +414,7 @@ void sub_0803A6E8(Entity* this) {
|
||||
this->actionDelay = 10;
|
||||
} else {
|
||||
sub_0803B63C(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
y = this->parent->y.HALF.HI + 8;
|
||||
if (y > this->y.HALF.HI) {
|
||||
this->y.HALF.HI = y;
|
||||
@@ -434,7 +440,7 @@ void sub_0803A740(Entity* this) {
|
||||
this->actionDelay = 10;
|
||||
this->parent->field_0x7c.BYTES.byte1 |= 0x40;
|
||||
sub_0803B8E8(this, 0x13);
|
||||
sub_08080964(10, 0);
|
||||
InitScreenShake(10, 0);
|
||||
SoundReq(SFX_158);
|
||||
}
|
||||
}
|
||||
@@ -468,7 +474,7 @@ void sub_0803A7CC(Entity* this) {
|
||||
this->action = 0xd;
|
||||
InitAnimationForceUpdate(this->child, 6);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +533,7 @@ void sub_0803A90C(Entity* this) {
|
||||
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
|
||||
GetNextFrame(this);
|
||||
sub_0803B55C(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->actionDelay--;
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 0x11;
|
||||
@@ -550,7 +556,7 @@ void sub_0803A978(Entity* this) {
|
||||
if ((++this->actionDelay & 3) == 0) {
|
||||
sub_08004596(this, 0x10);
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->direction == 0x10) {
|
||||
this->action = 0x12;
|
||||
this->actionDelay = 3;
|
||||
@@ -574,7 +580,7 @@ void sub_0803AA00(Entity* this) {
|
||||
if ((++this->actionDelay & 3) == 0) {
|
||||
sub_08004596(this, direction);
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if ((this->direction == direction) || (this->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) {
|
||||
this->action = 0x13;
|
||||
this->spriteSettings.draw = 0;
|
||||
@@ -594,7 +600,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
|
||||
index = ((this->parent->field_0xf >> 4) + 3);
|
||||
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
|
||||
if (sub_0803B870(this) == 0) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (sub_0803B6F4(this) != 0) {
|
||||
this->action = 0x14;
|
||||
this->speed = 0x40;
|
||||
@@ -616,7 +622,7 @@ void sub_0803AB10(Entity* this) {
|
||||
ptr = gUnk_080CED6C;
|
||||
index = ((this->parent->field_0xf >> 4) + 3);
|
||||
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
sub_0803B55C(this);
|
||||
if ((this->child->frame & 0x80) != 0) {
|
||||
this->action = 0x15;
|
||||
@@ -667,7 +673,7 @@ void sub_0803AC1C(Entity* this) {
|
||||
if (sub_0803B4E4(this)) {
|
||||
sub_0803B59C(this);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,7 +691,7 @@ void sub_0803AC60(Entity* this) {
|
||||
this->subAction = 0;
|
||||
this->actionDelay = 0x1e;
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = this->actionDelay - 1;
|
||||
@@ -713,7 +719,7 @@ void sub_0803ACC0(Entity* this) {
|
||||
this->z.HALF.HI = 0;
|
||||
this->actionDelay = 0xc;
|
||||
this->subAction = 3;
|
||||
sub_08080964(8, 0);
|
||||
InitScreenShake(8, 0);
|
||||
SoundReq(SFX_158);
|
||||
sub_0803B804(this);
|
||||
}
|
||||
@@ -735,7 +741,7 @@ void sub_0803ACC0(Entity* this) {
|
||||
this->z.HALF.HI = 0;
|
||||
this->action = 0x1a;
|
||||
this->actionDelay = 0x3c;
|
||||
sub_08080964(0x1e, 0);
|
||||
InitScreenShake(0x1e, 0);
|
||||
SoundReq(SFX_158);
|
||||
sub_0803B804(this);
|
||||
return;
|
||||
@@ -788,7 +794,7 @@ void sub_0803AE48(Entity* this) {
|
||||
InitializeAnimation(this, 4);
|
||||
} else {
|
||||
if (sub_0803B4E4(this) == 0) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,7 +865,7 @@ void sub_0803AFE0(Entity* this) {
|
||||
this->actionDelay = 0xf0;
|
||||
*(u8*)&this->cutsceneBeh = 3;
|
||||
this->z.HALF.HI = 0;
|
||||
sub_08080964(0xa0, 0);
|
||||
InitScreenShake(0xa0, 0);
|
||||
SoundReq(SFX_158);
|
||||
}
|
||||
}
|
||||
@@ -927,11 +933,11 @@ void sub_0803B100(Entity* this) {
|
||||
|
||||
void sub_0803B144(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this->child);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (GravityUpdate(this, 0x2000) == 0) {
|
||||
this->action = 0x2a;
|
||||
InitializeAnimation(this, 0x16);
|
||||
sub_0803B8E8(this, 0x14);
|
||||
sub_08080964(8, 0);
|
||||
InitScreenShake(8, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,7 +1055,7 @@ void sub_0803B398(Entity* this) {
|
||||
InitializeAnimation(this, 4);
|
||||
InitAnimationForceUpdate(this->child, 0);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1211,19 +1217,19 @@ void sub_0803B724(Entity* param_1) {
|
||||
pEVar1->type2 = 1;
|
||||
random_value = Random();
|
||||
temp = gUnk_080CFD1B[param_1->type];
|
||||
pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.roomOriginX;
|
||||
pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.roomOriginY;
|
||||
pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.origin_x;
|
||||
pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.origin_y;
|
||||
pEVar1->parent = param_1;
|
||||
sub_08016A30(pEVar1);
|
||||
ResolveCollisionLayer(pEVar1);
|
||||
param_1->field_0xf++;
|
||||
param_1->cutsceneBeh.HALF.LO--;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803B798(void) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags &= 0xffef;
|
||||
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.zVelocity = 0x18000;
|
||||
gPlayerEntity.z.HALF.HI = -10;
|
||||
@@ -1238,12 +1244,12 @@ void sub_0803B798(void) {
|
||||
void sub_0803B804(Entity* this) {
|
||||
gPlayerEntity.iframes = 30;
|
||||
ModHealth(-4);
|
||||
sub_0800449C(&gPlayerEntity, 0x7a);
|
||||
SoundReqClipped(&gPlayerEntity, 0x7a);
|
||||
}
|
||||
|
||||
void sub_0803B824(Entity* this) {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
|
||||
gPlayerState.mobility = gPlayerState.mobility | 0x80;
|
||||
sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1);
|
||||
gPlayerEntity.spriteOffsetY = -6;
|
||||
gPlayerEntity.spritePriority.b1 = 0;
|
||||
@@ -1253,7 +1259,7 @@ u32 sub_0803B870(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
entity = this->child;
|
||||
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & 0x10) != 0) {
|
||||
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) {
|
||||
this->action = 0x18;
|
||||
this->actionDelay = 0x44;
|
||||
this->spriteSettings.draw = 0;
|
||||
@@ -1283,7 +1289,7 @@ void sub_0803B8F8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0803B910(Entity* this) {
|
||||
if (gScreenTransition.field_0x38 != 0) {
|
||||
if (gRoomTransition.field_0x38 != 0) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.draw = 1;
|
||||
*(u8*)&this->field_0x74 = 0;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
#include "global.h"
|
||||
/**
|
||||
* @file mazaalHand.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mazaal Hand enemy
|
||||
*/
|
||||
|
||||
#include "entity.h"
|
||||
|
||||
void sub_08035194(Entity*);
|
||||
|
||||
+25
-20
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file mazaalHead.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mazaal Head enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -5,8 +12,6 @@
|
||||
|
||||
extern void UnloadOBJPalette(Entity*);
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void sub_0803499C(Entity*);
|
||||
void sub_08034420(Entity*);
|
||||
void sub_08034830(Entity*);
|
||||
@@ -121,7 +126,7 @@ void sub_08033F3C(Entity* this) {
|
||||
Entity* pEVar2;
|
||||
|
||||
if (gEntCount < 0x43) {
|
||||
if (gScreenTransition.field_0x38 != 0) {
|
||||
if (gRoomTransition.field_0x38 != 0) {
|
||||
sub_08034420(this);
|
||||
this->field_0x80.HALF.HI = 1;
|
||||
} else {
|
||||
@@ -135,7 +140,7 @@ void sub_08033F3C(Entity* this) {
|
||||
pEVar1->parent = this;
|
||||
pEVar2 = CreateObject(OBJECT_7E, 0, 0);
|
||||
pEVar2->parent = this;
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
this->action = 0xd;
|
||||
this->subAction = 0;
|
||||
this->actionDelay = 0xfc;
|
||||
@@ -217,10 +222,10 @@ void sub_08033FFC(Entity* this) {
|
||||
break;
|
||||
default:
|
||||
if (((*(Entity**)&this->field_0x74)->flags & 0x80) != 0) {
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
sub_08034420(this);
|
||||
gPlayerState.controlMode = 1;
|
||||
sub_080791D0();
|
||||
ResetPlayerAnimationAndAction();
|
||||
SoundReq(BGM_BOSS_THEME);
|
||||
}
|
||||
}
|
||||
@@ -229,8 +234,8 @@ void sub_08033FFC(Entity* this) {
|
||||
void sub_0803414C(Entity* this) {
|
||||
u32 x, y;
|
||||
|
||||
x = gRoomControls.roomOriginX + 0xb8;
|
||||
y = gRoomControls.roomOriginY + 0x48;
|
||||
x = gRoomControls.origin_x + 0xb8;
|
||||
y = gRoomControls.origin_y + 0x48;
|
||||
|
||||
if (this->x.HALF.HI - x + 1 < 3 && this->y.HALF.HI - y + 1 < 3) {
|
||||
if (sub_080349D8(this)) {
|
||||
@@ -243,7 +248,7 @@ void sub_0803414C(Entity* this) {
|
||||
}
|
||||
} else {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,12 +320,12 @@ void sub_080342C8(Entity* this) {
|
||||
this->spriteOffsetX = gUnk_080CECEC[this->actionDelay >> 1 & 7];
|
||||
} else {
|
||||
this->spriteOffsetX = 0;
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (GravityUpdate(this, 0x2000) == 0) {
|
||||
this->action = 0xc;
|
||||
this->field_0x7c.HALF.HI = 0x708;
|
||||
this->field_0x7c.BYTES.byte1 = 0;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
sub_08080964(0x1e, 0);
|
||||
InitScreenShake(0x1e, 0);
|
||||
SoundReq(SFX_1A1);
|
||||
}
|
||||
}
|
||||
@@ -379,10 +384,10 @@ void sub_0803442C(Entity* this, u32 unk) {
|
||||
|
||||
void sub_0803443C(Entity* this) {
|
||||
this->field_0x7c.BYTES.byte1 = 0;
|
||||
if (gScreenTransition.field_0x39 < 0x1f) {
|
||||
if (gRoomTransition.field_0x39 < 0x1f) {
|
||||
sub_080344BC(this);
|
||||
} else {
|
||||
if (gScreenTransition.field_0x39 < 0x3d) {
|
||||
if (gRoomTransition.field_0x39 < 0x3d) {
|
||||
sub_08034498(this);
|
||||
} else {
|
||||
sub_08034474(this);
|
||||
@@ -546,7 +551,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803473C.inc", void sub_0803473C(Entity* t
|
||||
}
|
||||
playerX = gPlayerEntity.x.HALF.HI + 0x60;
|
||||
}
|
||||
roomX = gRoomControls.roomOriginX;
|
||||
roomX = gRoomControls.origin_x;
|
||||
if (playerX - 4 > this->x.HALF.HI) {
|
||||
if (roomX + 0xe0 < this->x.HALF.HI) {
|
||||
return;
|
||||
@@ -562,14 +567,14 @@ NONMATCH("asm/non_matching/mazaal/sub_0803473C.inc", void sub_0803473C(Entity* t
|
||||
direction = 0x18;
|
||||
}
|
||||
this->direction = direction;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/mazaal/sub_080347B4.inc", void sub_080347B4(Entity* this)) {
|
||||
u32 direction;
|
||||
u32 playerX = gPlayerEntity.x.HALF.HI;
|
||||
u32 roomX = gRoomControls.roomOriginX;
|
||||
u32 roomX = gRoomControls.origin_x;
|
||||
if (playerX - 4 > this->x.HALF.HI) {
|
||||
if (roomX + 0xe0 < this->x.HALF.HI) {
|
||||
return;
|
||||
@@ -585,7 +590,7 @@ NONMATCH("asm/non_matching/mazaal/sub_080347B4.inc", void sub_080347B4(Entity* t
|
||||
direction = 0x18;
|
||||
}
|
||||
this->direction = direction;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
@@ -812,9 +817,9 @@ void sub_08034BC8(Entity* this) {
|
||||
|
||||
void sub_08034C00(Entity* this) {
|
||||
if (((gPlayerState.flags & PL_MINISH) != 0) &&
|
||||
CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.roomOriginX,
|
||||
this->y.HALF.HI - gRoomControls.roomOriginY + 0xd, 3, 3) != 0) {
|
||||
if (gScreenTransition.field_0x39 >= 0x3d) {
|
||||
CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.origin_x, this->y.HALF.HI - gRoomControls.origin_y + 0xd, 3,
|
||||
3) != 0) {
|
||||
if (gRoomTransition.field_0x39 >= 0x3d) {
|
||||
DoExitTransition((ScreenTransitionData*)&gUnk_080CED88);
|
||||
} else {
|
||||
DoExitTransition((ScreenTransitionData*)&gUnk_080CED9C);
|
||||
|
||||
+24
-17
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file mazaalMacro.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mazaal Macro enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "script.h"
|
||||
#include "structures.h"
|
||||
@@ -94,8 +101,8 @@ void sub_08034D4C(Entity* this) {
|
||||
if (--this->field_0x78.HWORD == 0) {
|
||||
if ((this->field_0xf < 8) && (entity = CreateEnemy(VAATI_PROJECTILE, 0), entity != (Entity*)0x0)) {
|
||||
entity->direction = (s32)Random() % 5 + 0xc;
|
||||
entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.roomOriginX;
|
||||
entity->y.HALF.HI = gRoomControls.roomOriginY + 8;
|
||||
entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.origin_x;
|
||||
entity->y.HALF.HI = gRoomControls.origin_y + 8;
|
||||
entity->collisionLayer = 3;
|
||||
entity->parent = this;
|
||||
UpdateSpriteForCollisionLayer(entity);
|
||||
@@ -108,7 +115,7 @@ void sub_08034D4C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08034DC8(Entity* this) {
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
CreateFx(this, FX_GIANT_EXPLOSION4, 0);
|
||||
sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
|
||||
DeleteThisEntity();
|
||||
@@ -136,7 +143,7 @@ void sub_08034E68(Entity* this) {
|
||||
this->spriteSettings.draw = 0;
|
||||
sub_08035120(this);
|
||||
}
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
if (sub_08079F8C() != 0) {
|
||||
this->action = 3;
|
||||
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
|
||||
@@ -167,8 +174,8 @@ void sub_08034EE4(Entity* this) {
|
||||
randomValue = Random();
|
||||
entity = CreateFx(this, gUnk_080CEEC8[randomValue & 3], 0);
|
||||
if (entity != NULL) {
|
||||
entity->x.HALF.HI = (((randomValue >> 2) & 0x77) << 1) + 1 + gRoomControls.roomScrollX;
|
||||
entity->y.HALF.HI = ((randomValue >> 9) & 0x7e) + 1 + gRoomControls.roomScrollY;
|
||||
entity->x.HALF.HI = (((randomValue >> 2) & 0x77) << 1) + 1 + gRoomControls.scroll_x;
|
||||
entity->y.HALF.HI = ((randomValue >> 9) & 0x7e) + 1 + gRoomControls.scroll_y;
|
||||
entity->collisionLayer = 2;
|
||||
UpdateSpriteForCollisionLayer(entity);
|
||||
}
|
||||
@@ -182,10 +189,10 @@ void sub_08034F58(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08034F70(Entity* this) {
|
||||
this->health = gScreenTransition.field_0x39;
|
||||
if (gScreenTransition.field_0x39 >= 0x3d) {
|
||||
this->health = gRoomTransition.field_0x39;
|
||||
if (gRoomTransition.field_0x39 >= 0x3d) {
|
||||
this->type2 = 0;
|
||||
} else if (gScreenTransition.field_0x39 >= 0x1f) {
|
||||
} else if (gRoomTransition.field_0x39 >= 0x1f) {
|
||||
this->type2 = 1;
|
||||
} else {
|
||||
this->type2 = 2;
|
||||
@@ -195,19 +202,19 @@ void sub_08034F70(Entity* this) {
|
||||
void sub_08034FA0(Entity* this) {
|
||||
if (0 < this->iframes) {
|
||||
this->child->iframes = this->iframes;
|
||||
sub_08080964(0xc, 1);
|
||||
InitScreenShake(0xc, 1);
|
||||
}
|
||||
switch (this->type2) {
|
||||
case 0:
|
||||
if (this->health < 0x3c) {
|
||||
gScreenTransition.field_0x39 = 0x3c;
|
||||
gRoomTransition.field_0x39 = 0x3c;
|
||||
sub_08035050(this);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->health < 0x1e) {
|
||||
gScreenTransition.field_0x39 = 0x1e;
|
||||
gRoomTransition.field_0x39 = 0x1e;
|
||||
sub_08035050(this);
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +225,7 @@ void sub_08034FA0(Entity* this) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
gScreenTransition.field_0x39 = this->health;
|
||||
gRoomTransition.field_0x39 = this->health;
|
||||
}
|
||||
|
||||
void sub_08035050(Entity* this) {
|
||||
@@ -247,16 +254,16 @@ u32 sub_08035084(Entity* this) {
|
||||
}
|
||||
do {
|
||||
vulnPillar = (s32)Random() % 6;
|
||||
} while (vulnPillar == gScreenTransition.field_0x38 >> 4);
|
||||
gScreenTransition.field_0x38 = (gScreenTransition.field_0x38 & 0xf) | (vulnPillar << 4);
|
||||
} while (vulnPillar == gRoomTransition.field_0x38 >> 4);
|
||||
gRoomTransition.field_0x38 = (gRoomTransition.field_0x38 & 0xf) | (vulnPillar << 4);
|
||||
for (i = 0, coords = gUnk_080CEECC; i < 6; i++, coords += 2) {
|
||||
if (i == vulnPillar) {
|
||||
entity = this;
|
||||
} else {
|
||||
entity = CreateEnemy(MAZAAL_MACRO, 1);
|
||||
}
|
||||
entity->x.HALF.HI = gRoomControls.roomOriginX + *coords;
|
||||
entity->y.HALF.HI = gRoomControls.roomOriginY + *(coords + 1);
|
||||
entity->x.HALF.HI = gRoomControls.origin_x + *coords;
|
||||
entity->y.HALF.HI = gRoomControls.origin_y + *(coords + 1);
|
||||
entity->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(entity);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file miniFireballGuy.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mini Fireball Guy enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -43,7 +50,7 @@ void sub_08045618(Entity* this) {
|
||||
void sub_08045654(Entity* this) {
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (GravityUpdate(this, 0x1800) == 0) {
|
||||
sub_08045678(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
/**
|
||||
* @file miniSlime.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Mini Slime enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08045374(Entity*);
|
||||
|
||||
extern void sub_080452E4();
|
||||
extern void sub_080452E4(Entity*);
|
||||
extern void ReplaceMonitoredEntity(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_080D17C0[])(Entity*);
|
||||
|
||||
+7
-1
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file moldorm.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Moldorm enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -9,7 +16,6 @@ extern void (*const gUnk_080CBBA0[])(Entity*);
|
||||
extern void (*const gUnk_080CBBB4[])(Entity*);
|
||||
extern void (*const gUnk_080CBBBC[])(Entity*);
|
||||
|
||||
extern u8 gEntCount;
|
||||
extern const s8 gUnk_080CBBC4[];
|
||||
|
||||
void Moldorm(Entity* this) {
|
||||
|
||||
+13
-7
@@ -1,7 +1,14 @@
|
||||
/**
|
||||
* @file moldworm.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Moldworm enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
extern bool32 sub_08023A38(u32);
|
||||
extern void sub_08023990(Entity*, u32, u32);
|
||||
extern void sub_08023A88(Entity*, u32);
|
||||
@@ -14,7 +21,6 @@ void sub_0802390C(Entity*);
|
||||
void sub_080239F0(Entity*);
|
||||
bool32 sub_08023B38(Entity*);
|
||||
|
||||
extern u8 gEntCount;
|
||||
extern const u8 gUnk_080B37A0[];
|
||||
|
||||
extern void (*const gUnk_080CBC38[])(Entity*);
|
||||
@@ -84,7 +90,7 @@ void sub_080230E4(Entity* this) {
|
||||
gPlayerEntity.zVelocity = 0x18000;
|
||||
gPlayerEntity.direction = 0xff;
|
||||
gPlayerEntity.iframes = -0x14;
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.flags &= 0xfff7ffff;
|
||||
}
|
||||
|
||||
@@ -218,7 +224,7 @@ void sub_08023398(Entity* this) {
|
||||
this->field_0x7c.BYTES.byte0--;
|
||||
}
|
||||
|
||||
if ((gScreenTransition.frameCount & 7) == 0) {
|
||||
if ((gRoomTransition.frameCount & 7) == 0) {
|
||||
u32 uVar4;
|
||||
|
||||
sub_08004596(this, sub_08049F84(this, 1));
|
||||
@@ -263,7 +269,7 @@ void sub_0802351C(Entity* this) {
|
||||
if (this->field_0x7c.BYTES.byte3 == 0) {
|
||||
if (this->type2 == 0) {
|
||||
gPlayerEntity.animationState = this->animationState & 7;
|
||||
gPlayerState.flags |= 0x80000;
|
||||
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
|
||||
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
|
||||
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
|
||||
}
|
||||
@@ -398,14 +404,14 @@ void sub_08023894(Entity* this) {
|
||||
this->parent->field_0x7c.BYTES.byte3 = 1;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
if (this->parent->type2 == 0) {
|
||||
gPlayerState.flags |= 0x200000;
|
||||
gPlayerState.flags |= PL_MOLDWORM_RELEASED;
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
|
||||
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this));
|
||||
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
|
||||
gPlayerEntity.iframes = 12;
|
||||
ModHealth(-0x10);
|
||||
sub_0800449C(&gPlayerEntity, 0x7a);
|
||||
SoundReqClipped(&gPlayerEntity, 0x7a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -1,11 +1,18 @@
|
||||
/**
|
||||
* @file octorok.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Octorok enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
void Octorok_Pause();
|
||||
bool32 Octorok_FacesPlayer();
|
||||
void Octorok_Turn();
|
||||
void Octorok_Pause(Entity*);
|
||||
bool32 Octorok_FacesPlayer(Entity*);
|
||||
void Octorok_Turn(Entity*);
|
||||
|
||||
extern void (*const gOctorok[6])(Entity*);
|
||||
extern void (*const gOctorokActions[4])(Entity*);
|
||||
|
||||
+47
-41
@@ -1,9 +1,15 @@
|
||||
/**
|
||||
* @file octorokBoss.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Octorok boss enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "projectile.h"
|
||||
#include "structures.h"
|
||||
#include "overworld.h"
|
||||
#include "game.h"
|
||||
|
||||
extern void sub_08078AC0(u32, u32, u32);
|
||||
extern u32 GetRandomByWeight(const u8*);
|
||||
@@ -36,25 +42,25 @@ this->field_0x7c.BYTES.byte0 Boss Phase
|
||||
3: frozen 2
|
||||
4: unfrozen -> death
|
||||
*/
|
||||
#define IS_FROZEN(this) (this->field_0x7c.BYTES.byte0 & 1)
|
||||
#define GET_BOSS_PHASE(this) (this->field_0x7c.BYTES.byte0)
|
||||
#define IS_FROZEN(this) ((this)->field_0x7c.BYTES.byte0 & 1)
|
||||
#define GET_BOSS_PHASE(this) ((this)->field_0x7c.BYTES.byte0)
|
||||
/*
|
||||
this->field_0x78.HALF.HI reused timer
|
||||
*/
|
||||
#define GET_TIMER(this) this->field_0x78.HALF.HI
|
||||
#define GET_TIMER(this) ((this)->field_0x78.HALF.HI)
|
||||
/*
|
||||
this->field_0x78.HALF.LO turns until the next attack
|
||||
*/
|
||||
#define GET_ATTACK_WAIT_TURNS(this) this->field_0x78.HALF.LO
|
||||
#define GET_ATTACK_WAIT_TURNS(this) ((this)->field_0x78.HALF.LO)
|
||||
/*
|
||||
this->field_0x7a.HALF.HI angle of legs
|
||||
*/
|
||||
#define GET_ANGLE(this) this->field_0x7a.HWORD
|
||||
#define GET_ANGLE_HI(this) this->field_0x7a.HALF.HI
|
||||
#define GET_ANGLE(this) ((this)->field_0x7a.HWORD)
|
||||
#define GET_ANGLE_HI(this) ((this)->field_0x7a.HALF.HI)
|
||||
/*
|
||||
this->field_0x82.HWORD angular speed
|
||||
*/
|
||||
#define GET_ANGULAR_VEL(this) this->field_0x82.HWORD
|
||||
#define GET_ANGULAR_VEL(this) ((this)->field_0x82.HWORD)
|
||||
|
||||
enum OctorokBossPart { WHOLE, LEG_BR, LEG_FR, LEG_FL, LEG_BL, MOUTH, TAIL_END, TAIL };
|
||||
enum OctorokBossAction {
|
||||
@@ -168,7 +174,7 @@ Hit SubActions
|
||||
void OctorokBoss_Hit(Entity* this) {
|
||||
if (GET_BOSS_PHASE(this) == 0) {
|
||||
if (this->subAction != 3) {
|
||||
gRoomControls.cameraTarget = GET_HELPER(this)->tailObjects[0];
|
||||
gRoomControls.camera_target = GET_HELPER(this)->tailObjects[0];
|
||||
GET_HELPER(this)->field_0x7 = 0x5a;
|
||||
sub_08078B48();
|
||||
}
|
||||
@@ -220,17 +226,17 @@ void OctorokBoss_Hit_SubAction1(Entity* this) {
|
||||
GET_HELPER(this)->tailObjects[0]->field_0x7c.BYTES.byte1--;
|
||||
}
|
||||
// Move to the center of the screen before freezing
|
||||
diffX = 0x108 + gRoomControls.roomOriginX - this->x.HALF.HI + 0x4;
|
||||
diffY = gRoomControls.roomOriginY - this->y.HALF.HI + 0x8c;
|
||||
diffX = 0x108 + gRoomControls.origin_x - this->x.HALF.HI + 0x4;
|
||||
diffY = gRoomControls.origin_y - this->y.HALF.HI + 0x8c;
|
||||
if (diffX > 8 || diffY > 8) {
|
||||
GET_HELPER(this)->field_0x2 = 1;
|
||||
#if defined(JP) || defined(DEMO_JP) || defined(EU)
|
||||
this->direction = ((s32)sub_080045DA((((gRoomControls.roomOriginX + 0x108) << 0x10) - this->x.WORD),
|
||||
(((gRoomControls.roomOriginY + 0x88) << 0x10) - this->y.WORD))) >>
|
||||
this->direction = ((s32)sub_080045DA((((gRoomControls.origin_x + 0x108) << 0x10) - this->x.WORD),
|
||||
(((gRoomControls.origin_y + 0x88) << 0x10) - this->y.WORD))) >>
|
||||
3;
|
||||
#else
|
||||
this->direction = ((s32)sub_080045DA(gRoomControls.roomOriginX + 0x108 - this->x.HALF.HI,
|
||||
gRoomControls.roomOriginY + 0x88 - this->y.HALF.HI)) >>
|
||||
this->direction = ((s32)sub_080045DA(gRoomControls.origin_x + 0x108 - this->x.HALF.HI,
|
||||
gRoomControls.origin_y + 0x88 - this->y.HALF.HI)) >>
|
||||
3;
|
||||
#endif
|
||||
this->speed = 0x100;
|
||||
@@ -254,7 +260,7 @@ void OctorokBoss_Hit_SubAction1(Entity* this) {
|
||||
Entity* tail = GET_HELPER(this)->tailObjects[i - 1];
|
||||
tail->spriteSettings.draw |= 1;
|
||||
}
|
||||
if ((gScreenTransition.frameCount & 2) != 0) {
|
||||
if ((gRoomTransition.frameCount & 2) != 0) {
|
||||
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 6, 0);
|
||||
}
|
||||
GET_TIMER(this)--;
|
||||
@@ -286,7 +292,7 @@ void OctorokBoss_Hit_SubAction2(Entity* this) {
|
||||
} else {
|
||||
this->subAction = 3;
|
||||
GET_TIMER(this) = 0x96;
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +312,7 @@ void OctorokBoss_Hit_SubAction4(Entity* this) {
|
||||
this->subAction = 5;
|
||||
object = CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 9, 0);
|
||||
if (object != NULL) {
|
||||
gRoomControls.cameraTarget = object;
|
||||
gRoomControls.camera_target = object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,11 +347,11 @@ void OctorokBoss_Hit_SubAction6(Entity* this) {
|
||||
tmp = FixedDiv(tmp, 0x100);
|
||||
this->spriteOffsetY = -((tmp << 0x10) >> 8) >> 0x10;
|
||||
if (GET_TIMER(this) == 0) {
|
||||
if ((gScreenTransition.frameCount & 0xfU) == 0) {
|
||||
if ((gRoomTransition.frameCount & 0xfU) == 0) {
|
||||
// Explosion in the center
|
||||
CreateFx(this, 0x48, 0);
|
||||
CreateFx(this, FX_GIANT_EXPLOSION3, 0);
|
||||
// Explosion at the front right leg
|
||||
CreateFx(GET_HELPER(this)->legObjects[0], 0x48, 0);
|
||||
CreateFx(GET_HELPER(this)->legObjects[0], FX_GIANT_EXPLOSION3, 0);
|
||||
}
|
||||
if (++this->field_0x82.HALF.LO == 0x79) {
|
||||
GET_HELPER(this)->mouthObject->health = 1;
|
||||
@@ -449,7 +455,7 @@ ASM_FUNC("asm/non_matching/octorokBoss/OctorokBoss_Init.inc", void OctorokBoss_I
|
||||
gPlayerEntity.spriteSettings.draw = 0;
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI - 0xa0;
|
||||
gRoomControls.cameraTarget = this;
|
||||
gRoomControls.camera_target = this;
|
||||
break;
|
||||
|
||||
case LEG_BR:
|
||||
@@ -534,7 +540,7 @@ void OctorokBoss_Intro_SubAction2(Entity* this) {
|
||||
this->subAction = 3;
|
||||
GET_TIMER(this) = 0x3c;
|
||||
gPlayerEntity.spriteSettings.draw |= 1;
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
gRoomControls.unk5 = 1;
|
||||
}
|
||||
}
|
||||
@@ -715,7 +721,7 @@ void OctorokBoss_Action1(Entity* this) {
|
||||
sub_08036F60(this);
|
||||
if (GET_HELPER(this)->fallingStonesTimer != 0) {
|
||||
GET_HELPER(this)->fallingStonesTimer--;
|
||||
if ((gScreenTransition.frameCount & 3) == 0) {
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
// Falling stones
|
||||
CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
}
|
||||
@@ -811,7 +817,7 @@ void OctorokBoss_Action1_ChargeAttack(Entity* this) {
|
||||
this->knockbackDirection = this->direction ^ 0x10;
|
||||
GET_HELPER(this)->fallingStonesTimer += 0x3c;
|
||||
OctorokBoss_SetAttackTimer(this);
|
||||
sub_08080964(0x3c, 0);
|
||||
InitScreenShake(0x3c, 0);
|
||||
SoundReq(SFX_158);
|
||||
SoundReq(SFX_14C);
|
||||
}
|
||||
@@ -893,7 +899,7 @@ void OctorokBoss_Action1_Attack_Type2_2(Entity* this) {
|
||||
}
|
||||
|
||||
void OctorokBoss_Action1_Attack_Type2_3(Entity* this) {
|
||||
if ((gScreenTransition.frameCount & 2) != 0) {
|
||||
if ((gRoomTransition.frameCount & 2) != 0) {
|
||||
GET_HELPER(this)->mouthObject->field_0x76.HWORD -= 8;
|
||||
} else {
|
||||
GET_HELPER(this)->mouthObject->field_0x76.HWORD += 8;
|
||||
@@ -932,25 +938,25 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
|
||||
}
|
||||
if (tmp < 0x10) {
|
||||
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
|
||||
if ((gPlayerState.flags & 0x800) == 0) {
|
||||
if ((gPlayerEntity.flags & 0x80) != 0) {
|
||||
if ((gPlayerState.flags & PL_FROZEN) == 0) {
|
||||
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
|
||||
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
|
||||
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
|
||||
this->field_0x80.HALF.LO = 1;
|
||||
GET_TIMER(this) = 2;
|
||||
GET_HELPER(this)->targetAngle =
|
||||
sub_080045DA((gRoomControls.roomOriginX + 0x108) * 0x10000 - this->x.WORD,
|
||||
(gRoomControls.roomOriginY + 0x88) * 0x10000 - this->y.WORD);
|
||||
sub_080045DA((gRoomControls.origin_x + 0x108) * 0x10000 - this->x.WORD,
|
||||
(gRoomControls.origin_y + 0x88) * 0x10000 - this->y.WORD);
|
||||
GET_HELPER(this)->targetAngle = (u8) - (GET_HELPER(this)->targetAngle + 0x80);
|
||||
SoundReq(SFX_ED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gPlayerState.flags &= 0xfffff7ff;
|
||||
gPlayerState.flags &= ~PL_FROZEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((gScreenTransition.frameCount & 3) == 0) {
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 2, 0);
|
||||
}
|
||||
} else {
|
||||
@@ -982,7 +988,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
|
||||
OctorokBoss_SetAttackTimer(this);
|
||||
} else {
|
||||
GET_TIMER(this)--;
|
||||
if ((gPlayerState.flags == 0x800) && (GET_TIMER(this) == 0x3c)) {
|
||||
if ((gPlayerState.flags == PL_FROZEN) && (GET_TIMER(this) == 0x3c)) {
|
||||
tmp = sub_080045DA(gPlayerEntity.x.WORD - this->x.WORD, gPlayerEntity.y.WORD - this->y.WORD);
|
||||
if ((u8)((tmp - ((u8)-GET_ANGLE_HI(this) ^ 0x80))) > 0x80) {
|
||||
GET_HELPER(this)->targetAngle = GET_ANGLE_HI(this) + 0x30;
|
||||
@@ -1013,8 +1019,8 @@ void OctorokBoss_ExecuteAttackSmoke(Entity* this) {
|
||||
} else {
|
||||
GET_TIMER(this)++;
|
||||
ChangeLightLevel(-1);
|
||||
if ((gScreenTransition.frameCount & 3) == 0) {
|
||||
if ((gScreenTransition.frameCount & 7) == 0) {
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
if ((gRoomTransition.frameCount & 7) == 0) {
|
||||
SoundReq(SFX_124);
|
||||
}
|
||||
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 3, 0);
|
||||
@@ -1028,7 +1034,7 @@ void OctorokBoss_ExecuteAttackFreeze(Entity* this) {
|
||||
OctorokBoss_SetAttackTimer(this);
|
||||
} else {
|
||||
GET_TIMER(this)--;
|
||||
if ((gScreenTransition.frameCount & 3) == 0) {
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
this->child = CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 2);
|
||||
if (this->child != NULL) {
|
||||
this->child->parent = this;
|
||||
@@ -1042,7 +1048,7 @@ void OctorokBoss_Burning(Entity* this) {
|
||||
OctorokBoss_Burning_SubActions[this->subAction](this);
|
||||
if (GET_HELPER(this)->fallingStonesTimer != 0) {
|
||||
GET_HELPER(this)->fallingStonesTimer--;
|
||||
if ((gScreenTransition.frameCount & 7) == 0) {
|
||||
if ((gRoomTransition.frameCount & 7) == 0) {
|
||||
// Falling stones
|
||||
CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
}
|
||||
@@ -1077,14 +1083,14 @@ void OctorokBoss_Burning_SubAction1(Entity* this) {
|
||||
this->field_0x46 = 0x200;
|
||||
this->knockbackDirection = this->direction ^ 0x10;
|
||||
GET_HELPER(this)->fallingStonesTimer += 0x1e;
|
||||
sub_08080964(0x1e, 0);
|
||||
InitScreenShake(0x1e, 0);
|
||||
SoundReq(SFX_158);
|
||||
SoundReq(SFX_14C);
|
||||
}
|
||||
if (GET_TIMER(this)-- == 0) {
|
||||
this->health = 0;
|
||||
}
|
||||
if ((gScreenTransition.frameCount & 0x1f) == 0) {
|
||||
if ((gRoomTransition.frameCount & 0x1f) == 0) {
|
||||
SoundReq(SFX_159);
|
||||
}
|
||||
}
|
||||
@@ -1411,7 +1417,7 @@ void sub_08036F60(Entity* this) {
|
||||
}
|
||||
|
||||
void OctorokBoss_StepSound(Entity* this, u32 frameMask) {
|
||||
if ((gScreenTransition.frameCount & frameMask) == 0) {
|
||||
if ((gRoomTransition.frameCount & frameMask) == 0) {
|
||||
if (IS_FROZEN(this) == FALSE) {
|
||||
SoundReq(SFX_163);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CF46C[])(Entity*);
|
||||
extern void (*const gUnk_080CF484[])(Entity*);
|
||||
extern s8 gUnk_080CF490[];
|
||||
extern u8 gUnk_080CF498[];
|
||||
|
||||
extern u16* GetLayerByIndex(u32);
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_08037E14(Entity* this);
|
||||
bool32 sub_08037E90(Entity* this);
|
||||
|
||||
void OctorokGolden(Entity* this) {
|
||||
u32 index;
|
||||
if (sub_080012DC(this)) {
|
||||
//! @bug index (r4) is uninitialized
|
||||
gUnk_080012C8[index](this);
|
||||
} else {
|
||||
gUnk_080CF46C[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037C84(Entity* this) {
|
||||
gUnk_080CF484[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08037C9C(Entity* this) {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
|
||||
sub_0804AA30(this, gUnk_080CF46C);
|
||||
}
|
||||
|
||||
void sub_08037CC0(Entity* this) {
|
||||
if ((this->field_0x3a & 0x2) == 0) {
|
||||
SetGlobalFlag(this->type2);
|
||||
}
|
||||
|
||||
CreateDeathFx(this, 0xff, 0x58);
|
||||
}
|
||||
|
||||
void sub_08037CE4(Entity* this) {
|
||||
if (CheckGlobalFlag(this->type2)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->animationState = 0xff;
|
||||
sub_08037E14(this);
|
||||
}
|
||||
|
||||
void sub_08037D0C(Entity* this) {
|
||||
if (this->field_0xf) {
|
||||
this->field_0xf--;
|
||||
} else if (sub_08037E90(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
if (ProcessMovement(this) == 0) {
|
||||
sub_08037E14(this);
|
||||
} else if (--this->actionDelay == 0) {
|
||||
sub_08037E14(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037D54(Entity* this) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
|
||||
if (this->frame & 0x1) {
|
||||
this->frame ^= 2;
|
||||
|
||||
if (this->frame & 0x2) {
|
||||
Entity* proj = CreateProjectileWithParent(this, 1, 0);
|
||||
if (proj) {
|
||||
s8* ptr;
|
||||
s32 dir;
|
||||
proj->direction = this->direction;
|
||||
ptr = gUnk_080CF490 + (this->direction >> 2);
|
||||
proj->x.HALF.HI += *ptr;
|
||||
proj->y.HALF.HI += *(ptr + 1);
|
||||
proj->z.HALF.HI = 0xfffd;
|
||||
EnqueueSFX(SFX_124);
|
||||
}
|
||||
}
|
||||
} else if (this->frame & 0x80) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->field_0xf = 0x3c;
|
||||
this->animationState |= 0xff;
|
||||
sub_08037E14(this);
|
||||
} else {
|
||||
u32 dir = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->direction = (dir + 4) & 0x18;
|
||||
this->animationState = this->direction >> 3;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037E14(Entity* this) {
|
||||
u32 dir;
|
||||
u16* pLayer;
|
||||
s8* ptr;
|
||||
s32 x, y;
|
||||
this->actionDelay = 0x8;
|
||||
dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18;
|
||||
pLayer = GetLayerByIndex(this->collisionLayer) + 0x1002;
|
||||
ptr = gUnk_080CF498 + (dir >> 2);
|
||||
x = this->x.HALF.HI + *ptr;
|
||||
y = this->y.HALF.HI + *(ptr + 1);
|
||||
if (sub_080AE4CC((Entity*)pLayer, x, y, 0)) {
|
||||
this->direction = Random() & 0x18;
|
||||
} else {
|
||||
this->direction = dir;
|
||||
}
|
||||
|
||||
dir = this->direction >> 3;
|
||||
if ((dir) != this->animationState) {
|
||||
this->animationState = dir;
|
||||
InitializeAnimation(this, dir);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_08037E90(Entity* this) {
|
||||
u32 dir = sub_0804A044(this, &gPlayerEntity, 8);
|
||||
if (dir != 0xff) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 3;
|
||||
this->direction = dir;
|
||||
this->animationState = dir >> 3;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+11
-4
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file peahat.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Peahat enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -195,7 +202,7 @@ void Peahat_ChargeTarget(Entity* this) {
|
||||
if (this->actionDelay & 1)
|
||||
this->speed += 4;
|
||||
|
||||
if ((gScreenTransition.frameCount & 3) == 0)
|
||||
if ((gRoomTransition.frameCount & 3) == 0)
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
@@ -238,7 +245,7 @@ void Peahat_Stunned(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
break;
|
||||
case PeahatAnimation_SlicedPropeller:
|
||||
sub_08003FC4(this, 0x1c00);
|
||||
GravityUpdate(this, 0x1c00);
|
||||
if (this->z.HALF.HI == 0) {
|
||||
this->action = 7;
|
||||
this->actionDelay = 150;
|
||||
@@ -316,7 +323,7 @@ void Peahat_Takeoff(Entity* this) {
|
||||
} else if (this->frame & 1) {
|
||||
sub_0800442E(this);
|
||||
} else {
|
||||
sub_08003FC4(this, 0x1c00);
|
||||
GravityUpdate(this, 0x1c00);
|
||||
ProcessMovement(this);
|
||||
}
|
||||
}
|
||||
@@ -343,7 +350,7 @@ void PeahatPropeller_Fly(Entity* this) {
|
||||
this->spriteSettings.draw ^= 1;
|
||||
|
||||
this->z.WORD -= 0xc000;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0xf = 40;
|
||||
this->direction = (Random() & 0x10) + 8;
|
||||
|
||||
+29
-26
@@ -1,15 +1,21 @@
|
||||
/**
|
||||
* @file pesto.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Pesto enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "overworld.h"
|
||||
#include "game.h"
|
||||
#include "functions.h"
|
||||
#include "save.h"
|
||||
|
||||
extern u32 sub_080002E0(u16, u32);
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern void SoundReqClipped(Entity*, u32);
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
extern u32 PlayerInRange(Entity*, u32, u32);
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern Entity* FindNextDuplicateID(Entity* ent, int listIndex);
|
||||
|
||||
void sub_080249F4(Entity*);
|
||||
void sub_08024940(Entity*);
|
||||
@@ -149,7 +155,7 @@ void sub_080240B8(Entity* this) {
|
||||
}
|
||||
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
if (CheckIsDungeon())
|
||||
if (AreaIsDungeon())
|
||||
this->spriteOrientation.flipY = 1;
|
||||
|
||||
this->field_0x80.HALF.HI = Random() & 0x40;
|
||||
@@ -393,10 +399,10 @@ void sub_080244E8(Entity* this) {
|
||||
sub_080249DC(this);
|
||||
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
|
||||
gPlayerEntity.flags &= 0x7f;
|
||||
gPlayerState.flags |= 0x100;
|
||||
gPlayerState.flags |= PL_DISABLE_ITEMS;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
if (gPlayerState.swimState != 0) {
|
||||
gPlayerState.swimState = 0;
|
||||
if (gPlayerState.swim_state != 0) {
|
||||
gPlayerState.swim_state = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -535,7 +541,7 @@ void sub_08024940(Entity* this) {
|
||||
this->z.HALF.HI += 2;
|
||||
}
|
||||
|
||||
if (this->type2 != 0 || CheckIsDungeon()) {
|
||||
if (this->type2 != 0 || AreaIsDungeon()) {
|
||||
if (!sub_08049FA0(this)) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
sub_080249F4(this);
|
||||
@@ -558,14 +564,14 @@ void sub_080249DC(Entity* this) {
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/pesto/sub_080249F4.inc", void sub_080249F4(Entity* this)) {
|
||||
u8 direction = ((this->direction + 2) & 0x1c) >> 2;
|
||||
void sub_080249F4(Entity* this) {
|
||||
u32 direction = ((this->direction + 2) & 0x1f);
|
||||
direction >>= 2;
|
||||
if (direction != this->animationState) {
|
||||
this->animationState = direction;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08024A14(Entity* this, u32 param_2, u32 param_3) {
|
||||
u8 unk = FALSE;
|
||||
@@ -637,7 +643,7 @@ bool32 sub_08024B38(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
if (gPlayerState.hurtBlinkSpeed != 0) {
|
||||
if (gPlayerState.swimState == 1) {
|
||||
if (gPlayerState.swim_state == 1) {
|
||||
if (gPlayerState.hurtBlinkSpeed > 3) {
|
||||
gPlayerState.hurtBlinkSpeed -= 3;
|
||||
} else {
|
||||
@@ -784,16 +790,15 @@ u32 sub_08024E34(void) {
|
||||
return gUnk_080CBF20[idx];
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* this)) {
|
||||
void sub_08024E4C(Entity* this) {
|
||||
if (this->field_0x82.HALF.HI == 3) {
|
||||
this->field_0xf++;
|
||||
this->field_0xf &= 0xff;
|
||||
this->field_0xf &= 0x1f;
|
||||
|
||||
this->field_0xf = ++this->field_0xf & 0x1f;
|
||||
if (sub_0807953C()) {
|
||||
this->cutsceneBeh.HALF.LO += 1 + (Random() & 1);
|
||||
u32 r = Random();
|
||||
this->cutsceneBeh.HALF.LO++;
|
||||
r &= 1;
|
||||
this->cutsceneBeh.HALF.LO += r;
|
||||
}
|
||||
|
||||
if (gSave.stats.health == 0 || this->field_0x86.HALF.HI == 4) {
|
||||
this->cutsceneBeh.HALF.LO = 0x30;
|
||||
this->field_0x86.HALF.HI = 0;
|
||||
@@ -805,11 +810,10 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th
|
||||
sub_08024A14(this, 0, 8);
|
||||
} else {
|
||||
Entity* player = &gPlayerEntity;
|
||||
|
||||
ResetPlayer();
|
||||
gPlayerState.flags |= 0x100;
|
||||
gPlayerState.flags |= PL_DISABLE_ITEMS;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.playerAction = 0xe;
|
||||
gPlayerState.queued_action = PLAYER_0807204C;
|
||||
gPlayerState.field_0x38 = 0x14;
|
||||
gPlayerState.field_0x39 = 1;
|
||||
*(u8*)&gPlayerState.field_0x3a = 0;
|
||||
@@ -821,19 +825,18 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th
|
||||
this->field_0x86.HALF.HI++;
|
||||
player->iframes = 8;
|
||||
ModHealth(-2);
|
||||
sub_0800449C(player, 0x7a);
|
||||
SoundReqClipped(player, 0x7a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08024F50(Entity* this) {
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags &= 0xfffffeff;
|
||||
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
|
||||
CopyPosition(this, &gPlayerEntity);
|
||||
gPlayerEntity.action = 1;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
COLLISION_ON(&gPlayerEntity);
|
||||
gPlayerEntity.iframes = -0x3c;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
gPlayerEntity.speed = 0;
|
||||
|
||||
+34
-24
@@ -1,10 +1,17 @@
|
||||
/**
|
||||
* @file puffstool.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Puffstool enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_080002E0(u32, u32);
|
||||
extern u32 sub_080002C8(u16, u8);
|
||||
extern u16 sub_080002D4(u32, u32, u32);
|
||||
extern u8 sub_080002D4(u32, u32, u32);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
@@ -104,7 +111,7 @@ void sub_0802511C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802514C(Entity* this) {
|
||||
sub_08003FC4(this, 0x2000);
|
||||
GravityUpdate(this, 0x2000);
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CBFEC[this->subAction](this);
|
||||
} else {
|
||||
@@ -209,7 +216,7 @@ void sub_0802538C(Entity* this) {
|
||||
if (this->frame == 0) {
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
sub_08003FC4(this, 0x2000);
|
||||
GravityUpdate(this, 0x2000);
|
||||
if (this->zVelocity < 0x2000) {
|
||||
this->action = 4;
|
||||
InitializeAnimation(this, 2);
|
||||
@@ -220,7 +227,7 @@ void sub_0802538C(Entity* this) {
|
||||
|
||||
void sub_080253D4(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (!sub_08003FC4(this, 0x2000)) {
|
||||
if (!GravityUpdate(this, 0x2000)) {
|
||||
if (this->field_0xf == 0) {
|
||||
this->action = 5;
|
||||
InitializeAnimation(this, 3);
|
||||
@@ -256,7 +263,7 @@ void sub_0802544C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802547C(Entity* this) {
|
||||
sub_08003FC4(this, 0x2000);
|
||||
GravityUpdate(this, 0x2000);
|
||||
GetNextFrame(this);
|
||||
if ((this->actionDelay & 7) == 0) {
|
||||
sub_08025BD4(this);
|
||||
@@ -268,7 +275,7 @@ void sub_0802547C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080254B4(Entity* this) {
|
||||
sub_08003FC4(this, 0x2000);
|
||||
GravityUpdate(this, 0x2000);
|
||||
if (this->frame & 0x80) {
|
||||
if (this->z.HALF.HI == 0) {
|
||||
if (this->cutsceneBeh.HWORD == 0) {
|
||||
@@ -386,8 +393,8 @@ void sub_080256B4(Entity* this) {
|
||||
|
||||
bool32 sub_0802571C(Entity* this) {
|
||||
RoomControls* ctrl = &gRoomControls;
|
||||
u16 xDiff = (this->x.HALF.HI - ctrl->roomOriginX + 8) & -0x10;
|
||||
u16 yDiff = (this->y.HALF.HI - ctrl->roomOriginY + 8) & -0x10;
|
||||
u16 xDiff = (this->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
|
||||
u16 yDiff = (this->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
|
||||
u16 unk = this->field_0x7a.HALF.LO;
|
||||
u16 i;
|
||||
|
||||
@@ -396,8 +403,8 @@ bool32 sub_0802571C(Entity* this) {
|
||||
u16 sVar4 = yDiff + gUnk_080CC020[unk + 1];
|
||||
|
||||
if (sub_080257EC(this, sVar3, sVar4)) {
|
||||
this->field_0x7c.HALF.LO = sVar3 + ctrl->roomOriginX;
|
||||
this->field_0x7c.HALF.HI = sVar4 + ctrl->roomOriginY;
|
||||
this->field_0x7c.HALF.LO = sVar3 + ctrl->origin_x;
|
||||
this->field_0x7c.HALF.HI = sVar4 + ctrl->origin_y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -465,22 +472,25 @@ bool32 sub_080258C4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc
|
||||
NONMATCH("asm/non_matching/puffstool/sub_0802594C.inc", bool32 sub_0802594C(Entity* this, u32 param_2)) {
|
||||
s16 xDiff;
|
||||
s16 yDiff;
|
||||
const s8* unk = gUnk_080CC090[param_2];
|
||||
u32 uVar1 = this->collisionLayer;
|
||||
RoomControls* ctrl = &gRoomControls;
|
||||
u16 xDiff = (this->x.HALF.HI - ctrl->roomOriginX + 8) & -0x10;
|
||||
u16 yDiff = (this->y.HALF.HI - ctrl->roomOriginY + 8) & -0x10;
|
||||
xDiff = (this->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
|
||||
yDiff = (this->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
|
||||
do {
|
||||
u16 iVar9 = xDiff + unk[0];
|
||||
u16 iVar11 = yDiff + unk[1];
|
||||
u32 bVar4 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x00, uVar1);
|
||||
u32 bVar5 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x00, uVar1);
|
||||
u32 bVar6 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x10, uVar1);
|
||||
u32 bVar7 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x10, uVar1);
|
||||
s16 iVar9 = xDiff + unk[0];
|
||||
s16 iVar11 = yDiff + unk[1];
|
||||
u8 bVar4 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x00, uVar1);
|
||||
u8 bVar5 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x00, uVar1);
|
||||
u8 bVar6 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x10, uVar1);
|
||||
u8 bVar7 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x10, uVar1);
|
||||
if ((bVar6 | bVar4 | bVar5 | bVar7) == 0) {
|
||||
this->field_0x7c.HALF.LO = ctrl->roomOriginX + iVar9;
|
||||
this->field_0x7c.HALF.HI = ctrl->roomOriginY + iVar11;
|
||||
this->field_0x7c.HALF.LO = ctrl->origin_x + iVar9;
|
||||
this->field_0x7c.HALF.HI = ctrl->origin_y + iVar11;
|
||||
return TRUE;
|
||||
}
|
||||
unk += 2;
|
||||
@@ -492,8 +502,8 @@ END_NONMATCH
|
||||
|
||||
void sub_08025A54(Entity* this) {
|
||||
u32 layer = this->collisionLayer;
|
||||
s16 x = this->x.HALF.HI - gRoomControls.roomOriginX;
|
||||
s16 y = this->y.HALF.HI - gRoomControls.roomOriginY;
|
||||
s16 x = this->x.HALF.HI - gRoomControls.origin_x;
|
||||
s16 y = this->y.HALF.HI - gRoomControls.origin_y;
|
||||
|
||||
const s8* offset = gUnk_080CC0A0;
|
||||
u32 i = 0;
|
||||
@@ -532,8 +542,8 @@ void sub_08025AE8(Entity* this) {
|
||||
void sub_08025B18(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
s32 x = this->x.HALF.HI - gRoomControls.roomOriginX;
|
||||
s32 y = this->y.HALF.HI - gRoomControls.roomOriginY;
|
||||
s32 x = this->x.HALF.HI - gRoomControls.origin_x;
|
||||
s32 y = this->y.HALF.HI - gRoomControls.origin_y;
|
||||
u32 layer = this->collisionLayer;
|
||||
|
||||
const s8* offset = gUnk_080CC0A8;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file rockChuchu.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Rock Chuchu enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
+11
-4
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file rollobite.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Rollobite enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -14,9 +21,9 @@ void sub_08020A7C(Entity*);
|
||||
bool32 Rollobite_TryToHoleUp(Entity*);
|
||||
bool32 Rollobite_IsRolledUp(Entity*);
|
||||
|
||||
extern void sub_080AE58C();
|
||||
extern void sub_080AE7E8();
|
||||
extern void sub_08078930();
|
||||
extern void sub_080AE58C(Entity*, u32, u32);
|
||||
extern void sub_080AE7E8(Entity*, u32, u32, u32);
|
||||
extern void sub_08078930(Entity*);
|
||||
|
||||
void Rollobite(Entity* this) {
|
||||
EnemyFunctionHandler(this, gRollobiteFunctions);
|
||||
@@ -206,7 +213,7 @@ void Rollobite_Unroll(Entity* this) {
|
||||
}
|
||||
|
||||
void Rollobite_LinedUp(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1c00) == 0) {
|
||||
if (GravityUpdate(this, 0x1c00) == 0) {
|
||||
this->action = 7;
|
||||
this->spritePriority.b0 = 7;
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file rope.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Rope enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -5,10 +12,10 @@ extern void (*const gRope[6])(Entity*);
|
||||
extern void (*const gUnk_080CE460[4])(Entity*);
|
||||
extern void (*const gUnk_080CE470[3])(Entity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u32 sub_0804A044();
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_08031600();
|
||||
u32 sub_0803163C();
|
||||
void sub_08031600(Entity*);
|
||||
u32 sub_0803163C(Entity*);
|
||||
|
||||
void Rope(Entity* this) {
|
||||
EnemyFunctionHandler(this, gRope);
|
||||
@@ -83,7 +90,7 @@ void sub_08031480(Entity* this) {
|
||||
SoundReq(SFX_12D);
|
||||
}
|
||||
} else {
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (GravityUpdate(this, 0x1800) == 0) {
|
||||
this->action = 2;
|
||||
this->field_0xf = 0xf;
|
||||
this->spriteSettings.draw = 1;
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
/**
|
||||
* @file ropeGolden.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Golden Rope enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "sprite.h"
|
||||
#include "functions.h"
|
||||
#include "enemy.h"
|
||||
|
||||
@@ -9,8 +15,6 @@ extern void (*const gUnk_080CF4C8[6])(Entity*);
|
||||
extern void (*const gUnk_080CF4E0[4])(Entity*);
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void SetGlobalFlag(u32);
|
||||
extern u32 CheckGlobalFlag(u32);
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_080383AC(Entity*);
|
||||
|
||||
+13
-8
@@ -1,13 +1,18 @@
|
||||
/**
|
||||
* @file rupeeLike.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Rupee Like enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "asm.h"
|
||||
#include "audio.h"
|
||||
#include "sound.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
#include "save.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "save.h"
|
||||
|
||||
extern void sub_080293DC(Entity*);
|
||||
extern void sub_080296D8(Entity*);
|
||||
@@ -80,7 +85,7 @@ void sub_080293B4(Entity* this) {
|
||||
CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->type]);
|
||||
}
|
||||
|
||||
void nullsub_141() {
|
||||
void nullsub_141(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080293DC(Entity* this) {
|
||||
@@ -165,7 +170,7 @@ void sub_0802953C(Entity* this) {
|
||||
sub_080296D8(this);
|
||||
} else {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
|
||||
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
|
||||
gPlayerEntity.spriteOffsetX = pbVar3[0];
|
||||
@@ -232,8 +237,8 @@ void sub_080296C8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080296D8(Entity* this) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.flags &= 0xffffffef;
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.flags &= ~PL_CAPTURED;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.zVelocity = 0x18000;
|
||||
gPlayerEntity.iframes = 0xa6;
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/**
|
||||
* @file sensorBladeTrap.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Sensor Blade Trap enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_0804A024(Entity*, u32, u32);
|
||||
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
|
||||
|
||||
+10
-5
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file slime.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Slime enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -16,8 +23,6 @@ extern void (*const gUnk_080D16A4[])(Entity*);
|
||||
extern u8 gUnk_080D16D0[4]; // Entity count per form
|
||||
extern PosOffset gUnk_080D16D4[4];
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void Slime(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080D16A4);
|
||||
SetChildOffset(this, 0, 1, -12);
|
||||
@@ -39,7 +44,7 @@ void sub_08044F88(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_171() {
|
||||
void nullsub_171(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08044FC8(Entity* this) {
|
||||
@@ -129,10 +134,10 @@ void sub_08045178(Entity* this, Entity* child, int h, int v) {
|
||||
return;
|
||||
|
||||
x = child->x.HALF.HI + h;
|
||||
if (0 <= x && x < (gRoomControls.roomOriginX + gRoomControls.width))
|
||||
if (0 <= x && x < (gRoomControls.origin_x + gRoomControls.width))
|
||||
child->x.HALF.HI = x;
|
||||
|
||||
y = child->y.HALF.HI + v;
|
||||
if (0 <= y && y < (gRoomControls.roomOriginY + gRoomControls.height))
|
||||
if (0 <= y && y < (gRoomControls.origin_y + gRoomControls.height))
|
||||
child->y.HALF.HI = y;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file sluggula.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Sluggula enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -117,7 +124,7 @@ void sub_08023CE0(Entity* this) {
|
||||
EnqueueSFX(0x12d);
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
} else if (!sub_08003FC4(this, 0x1800)) {
|
||||
} else if (!GravityUpdate(this, 0x1800)) {
|
||||
this->action = 3;
|
||||
this->spriteSettings.draw = 1;
|
||||
EnqueueSFX(0x84);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file smallPesto.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Small Pesto enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -21,7 +28,7 @@ void sub_08031680(Entity* this) {
|
||||
gUnk_080CE548[this->action](this);
|
||||
}
|
||||
|
||||
void nullsub_152() {
|
||||
void nullsub_152(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0803169C(Entity* this) {
|
||||
@@ -94,7 +101,7 @@ void sub_08031770(Entity* this) {
|
||||
|
||||
void sub_080317B4(Entity* this) {
|
||||
this->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* @file spark.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Spark enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern void (*const gUnk_080CD234[])(Entity*);
|
||||
extern void (*const gUnk_080CD24C[])(Entity*);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file spearMoblin.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Spear Moblin enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file spikedBeetle.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Spiked Beetle enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -173,7 +180,7 @@ void sub_0802B8E0(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802B948(Entity* this) {
|
||||
if (!sub_08003FC4(this, 0x1800)) {
|
||||
if (!GravityUpdate(this, 0x1800)) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file spinyChuchu.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Spiny Chuchu enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -86,7 +93,7 @@ void sub_080225A0(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080225BC(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
if (this->frame & 1) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
@@ -125,7 +132,7 @@ void sub_08022654(Entity* this) {
|
||||
InitializeAnimation(this, 0);
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
if (sub_08003FC4(this, 0x1800))
|
||||
if (GravityUpdate(this, 0x1800))
|
||||
return;
|
||||
|
||||
this->subAction = 2;
|
||||
@@ -204,7 +211,7 @@ void sub_080227AC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802281C(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GravityUpdate(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 0x80) {
|
||||
this->action = 2;
|
||||
@@ -218,7 +225,7 @@ void sub_08022854(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (GravityUpdate(this, 0x1800) == 0) {
|
||||
this->action = 7;
|
||||
this->hitType = 0x5c;
|
||||
InitializeAnimation(this, 5);
|
||||
|
||||
+11
-2
@@ -1,6 +1,15 @@
|
||||
/**
|
||||
* @file tektite.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Tektite enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
static void sub_0802F45C(Entity* this);
|
||||
|
||||
extern void (*const gUnk_080CDED0[])(Entity*);
|
||||
extern void (*const gUnk_080CDEE8[])(Entity*);
|
||||
|
||||
@@ -56,7 +65,7 @@ void nullsub_16(Entity* this) {
|
||||
void sub_0802F1F0(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->z.HALF.HI != 0) {
|
||||
sub_08003FC4(this, this->field_0x80.HWORD);
|
||||
GravityUpdate(this, this->field_0x80.HWORD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +184,7 @@ void sub_0802F3F4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F45C(Entity* this) {
|
||||
static void sub_0802F45C(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file tektiteGolden.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Golden Tektite enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -55,7 +62,7 @@ void sub_08037F58(Entity* this) {
|
||||
void sub_08037F84(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->z.HALF.HI != 0) {
|
||||
sub_08003FC4(this, 0x3000);
|
||||
GravityUpdate(this, 0x3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* @file treeItem.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Tree Item enemy
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
static bool32 ShouldSpawnTreeItem(Entity*);
|
||||
|
||||
|
||||
+60
-54
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file vaatiArm.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Arm enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -163,7 +170,6 @@ const u16 gUnk_080D140E[] = { -0x6000, -0x5000, -0x4000 };
|
||||
const u8 gUnk_080D1414[] = { 0, 0xc, 0xe, 0x10, 0x1c };
|
||||
const u8 gUnk_080D1419[] = { 0, 0xa, 0xa, 0xa, 0x1c };
|
||||
|
||||
extern u8 gEntCount;
|
||||
extern const Hitbox gUnk_080FD450;
|
||||
extern const Hitbox gUnk_080FD538;
|
||||
|
||||
@@ -190,11 +196,11 @@ void sub_080425B4(Entity* this) {
|
||||
if (sub_080437DC(this)) {
|
||||
this->field_0x7c.BYTES.byte0 = 0;
|
||||
this->field_0x7c.BYTES.byte1 = 0;
|
||||
if ((gScreenTransition.field_0x38 & 1) != 0) {
|
||||
if (gScreenTransition.field_0x3c == this->type2) {
|
||||
if ((gRoomTransition.field_0x38 & 1) != 0) {
|
||||
if (gRoomTransition.field_0x3c == this->type2) {
|
||||
sub_08043EB8(this);
|
||||
sub_08043ABC(this);
|
||||
if ((gScreenTransition.field_0x39 >> (this->type2 + 2) & 1U) != 0) {
|
||||
if ((gRoomTransition.field_0x39 >> (this->type2 + 2) & 1U) != 0) {
|
||||
this->action = 7;
|
||||
this->subAction = 4;
|
||||
} else {
|
||||
@@ -208,7 +214,7 @@ void sub_080425B4(Entity* this) {
|
||||
}
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->subAction = gScreenTransition.field_0x38 & 1;
|
||||
this->subAction = gRoomTransition.field_0x38 & 1;
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1280[this->type2];
|
||||
sub_08042654(this);
|
||||
}
|
||||
@@ -529,28 +535,27 @@ void sub_08042C34(Entity* this) {
|
||||
temp = &gUnk_080D12F8[random];
|
||||
x = gPlayerEntity.x.HALF.HI + *temp;
|
||||
y = gPlayerEntity.y.HALF.HI + *(temp + 1);
|
||||
if ((gRoomControls.roomOriginX + 0x20) > x) {
|
||||
x = gRoomControls.roomOriginX + 0x20;
|
||||
if ((gRoomControls.origin_x + 0x20) > x) {
|
||||
x = gRoomControls.origin_x + 0x20;
|
||||
}
|
||||
if (gRoomControls.roomOriginX + gRoomControls.width + -0x20 < x) {
|
||||
x = gRoomControls.roomOriginX + gRoomControls.width + -0x20;
|
||||
if (gRoomControls.origin_x + gRoomControls.width + -0x20 < x) {
|
||||
x = gRoomControls.origin_x + gRoomControls.width + -0x20;
|
||||
}
|
||||
if ((gRoomControls.roomOriginY + 0x20) > y) {
|
||||
y = gRoomControls.roomOriginY + 0x20;
|
||||
if ((gRoomControls.origin_y + 0x20) > y) {
|
||||
y = gRoomControls.origin_y + 0x20;
|
||||
}
|
||||
#if defined EU || defined JP || defined DEMO_JP
|
||||
if (gRoomControls.roomOriginY + gRoomControls.height + -0x20 < y) {
|
||||
y = gRoomControls.roomOriginY + gRoomControls.height + -0x20;
|
||||
if (gRoomControls.origin_y + gRoomControls.height + -0x20 < y) {
|
||||
y = gRoomControls.origin_y + gRoomControls.height + -0x20;
|
||||
}
|
||||
#else
|
||||
if (gRoomControls.roomOriginY + gRoomControls.height + -0x40 < y) {
|
||||
y = gRoomControls.roomOriginY + gRoomControls.height + -0x40;
|
||||
if (gRoomControls.origin_y + gRoomControls.height + -0x40 < y) {
|
||||
y = gRoomControls.origin_y + gRoomControls.height + -0x40;
|
||||
}
|
||||
#endif
|
||||
if (((u32)((x - gRoomControls.roomOriginX) - 0x90) < 0x41) &&
|
||||
((u32)((y - gRoomControls.roomOriginY) - 8) < 0x41)) {
|
||||
x = gRoomControls.roomOriginX + 0xb0;
|
||||
y = gRoomControls.roomOriginY + 0x40;
|
||||
if (((u32)((x - gRoomControls.origin_x) - 0x90) < 0x41) && ((u32)((y - gRoomControls.origin_y) - 8) < 0x41)) {
|
||||
x = gRoomControls.origin_x + 0xb0;
|
||||
y = gRoomControls.origin_y + 0x40;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
|
||||
@@ -637,8 +642,8 @@ void sub_08042E30(Entity* this) {
|
||||
this->actionDelay = (Random() & 0x38) + 0x28;
|
||||
this->speed = 0x200;
|
||||
this->direction = pVVar9->unk00.HALF.HI >> 3;
|
||||
uVar6 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gRoomControls.roomOriginX + 0x110,
|
||||
gRoomControls.roomOriginY + 0x60);
|
||||
uVar6 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gRoomControls.origin_x + 0x110,
|
||||
gRoomControls.origin_y + 0x60);
|
||||
this->field_0x78.HALF.HI = (gUnk_080D1304[Random() & 7] + uVar6) & 0x1f;
|
||||
}
|
||||
pVVar9->unk00.HWORD += pVVar9->unk08;
|
||||
@@ -939,8 +944,10 @@ void sub_08043440(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* this)) {
|
||||
void sub_08043490(Entity* this) {
|
||||
Entity* entity;
|
||||
Entity* entity2;
|
||||
Entity* entity3;
|
||||
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
|
||||
if (entity->z.HALF.HI < -4) {
|
||||
@@ -956,21 +963,20 @@ NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* th
|
||||
entity->field_0x3c = entity->field_0x3c & 0xef;
|
||||
entity->hitType = 0x3a;
|
||||
entity->hitbox = (Hitbox*)&gUnk_080FD450;
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
|
||||
entity->flags = entity->flags | 0x80;
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
|
||||
entity->flags = entity->flags & 0x7f;
|
||||
entity2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
|
||||
entity2->flags = entity2->flags | 0x80;
|
||||
entity3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
|
||||
entity3->flags = entity3->flags & 0x7f;
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08043520(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
|
||||
sub_08003FC4(entity, 0x1a00);
|
||||
GravityUpdate(entity, 0x1a00);
|
||||
if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
|
||||
entity->z.HALF.HI = -6;
|
||||
this->subAction = 3;
|
||||
@@ -1080,15 +1086,15 @@ NONMATCH("asm/non_matching/vaati/sub_08043770.inc", void sub_08043770(Entity* th
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
entity = ((VaatiArm_HeapStruct*)this->myHeap)->parent;
|
||||
if ((gScreenTransition.field_0x39 & 0xc) == 0) {
|
||||
if ((gRoomTransition.field_0x39 & 0xc) == 0) {
|
||||
entity->subAction = 2;
|
||||
}
|
||||
if (this->type2 == 0) {
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->parent = NULL;
|
||||
gScreenTransition.field_0x39 &= 0xfe;
|
||||
gRoomTransition.field_0x39 &= 0xfe;
|
||||
} else {
|
||||
*(u32*)((VaatiArm_HeapStruct*)this->myHeap)->s1 = 0;
|
||||
gScreenTransition.field_0x39 &= 0xfd;
|
||||
gRoomTransition.field_0x39 &= 0xfd;
|
||||
}
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->myHeap = NULL;
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->health = 0;
|
||||
@@ -1292,7 +1298,7 @@ u32 sub_08043C98(Entity* this) {
|
||||
Entity* e2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
|
||||
if ((e1->bitfield == 0x9d) || (e2->bitfield == 0x9d)) {
|
||||
sub_08043D08(this);
|
||||
gScreenTransition.field_0x38 |= 2;
|
||||
gRoomTransition.field_0x38 |= 2;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -1346,33 +1352,33 @@ void sub_08043DB0(Entity* this) {
|
||||
|
||||
if (((gPlayerState.flags & PL_MINISH) != 0)) {
|
||||
pEVar3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
|
||||
if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.roomOriginX,
|
||||
pEVar3->y.HALF.HI - gRoomControls.roomOriginY + 2, 3, 3)) {
|
||||
if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.origin_x,
|
||||
pEVar3->y.HALF.HI - gRoomControls.origin_y + 2, 3, 3)) {
|
||||
DoExitTransition((ScreenTransitionData*)&gUnk_080D13EC);
|
||||
if ((gScreenTransition.field_0x39 & 3) != 3) {
|
||||
gScreenTransition.player_status.room_next = 1;
|
||||
if ((gRoomTransition.field_0x39 & 3) != 3) {
|
||||
gRoomTransition.player_status.room_next = 1;
|
||||
}
|
||||
cVar1 = this->field_0x7a.HWORD;
|
||||
gScreenTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
|
||||
gScreenTransition.field_0x3c = this->type2;
|
||||
gRoomTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
|
||||
gRoomTransition.field_0x3c = this->type2;
|
||||
pEVar2 = ((VaatiArm_HeapStruct*)this->myHeap)->parent;
|
||||
gScreenTransition.hurtType = pEVar2->x.HALF.HI;
|
||||
gScreenTransition.field_0x42 = pEVar2->y.HALF.HI;
|
||||
gRoomTransition.hurtType = pEVar2->x.HALF.HI;
|
||||
gRoomTransition.field_0x42 = pEVar2->y.HALF.HI;
|
||||
pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent;
|
||||
if (pEVar4 != NULL) {
|
||||
gScreenTransition.field_0x44 = pEVar4->x.HALF.HI;
|
||||
gScreenTransition.field_0x46 = pEVar4->y.HALF.HI;
|
||||
gRoomTransition.field_0x44 = pEVar4->x.HALF.HI;
|
||||
gRoomTransition.field_0x46 = pEVar4->y.HALF.HI;
|
||||
} else {
|
||||
gScreenTransition.field_0x44 = gRoomControls.roomOriginX + 0x110;
|
||||
gScreenTransition.field_0x46 = gRoomControls.roomOriginY + 0x60;
|
||||
gRoomTransition.field_0x44 = gRoomControls.origin_x + 0x110;
|
||||
gRoomTransition.field_0x46 = gRoomControls.origin_y + 0x60;
|
||||
}
|
||||
pEVar4 = (Entity*)(*(int*)((VaatiArm_HeapStruct*)pEVar2->myHeap)->s1);
|
||||
if (pEVar4 != NULL) {
|
||||
gScreenTransition.field_0x48 = pEVar4->x.HALF.HI;
|
||||
gScreenTransition.field_0x4a = pEVar4->y.HALF.HI;
|
||||
gRoomTransition.field_0x48 = pEVar4->x.HALF.HI;
|
||||
gRoomTransition.field_0x4a = pEVar4->y.HALF.HI;
|
||||
} else {
|
||||
gScreenTransition.field_0x48 = gRoomControls.roomOriginX + 0x110;
|
||||
gScreenTransition.field_0x4a = gRoomControls.roomOriginY + 0x60;
|
||||
gRoomTransition.field_0x48 = gRoomControls.origin_x + 0x110;
|
||||
gRoomTransition.field_0x4a = gRoomControls.origin_y + 0x60;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1400,8 +1406,8 @@ void sub_08043EB8(Entity* this) {
|
||||
pEVar4->flags = pEVar4->flags | 0x80;
|
||||
pEVar4->spriteSettings.draw = 1;
|
||||
pEVar4->spritePriority.b0 = 4;
|
||||
pEVar4->x.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x44 : gScreenTransition.field_0x48;
|
||||
pEVar4->y.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x46 : gScreenTransition.field_0x4a;
|
||||
pEVar4->x.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48;
|
||||
pEVar4->y.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x46 : gRoomTransition.field_0x4a;
|
||||
pEVar4->z.HALF.HI = 0;
|
||||
pEVar4->field_0x3c = pEVar4->field_0x3c & 0xef;
|
||||
pEVar4->hitType = 0x3a;
|
||||
@@ -1443,8 +1449,8 @@ void sub_08044078(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
if (this->type != 3 ||
|
||||
!(((gScreenTransition.field_0x38 & 1) == 0 ||
|
||||
(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 != gScreenTransition.field_0x3c)))) {
|
||||
!(((gRoomTransition.field_0x38 & 1) == 0 ||
|
||||
(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 != gRoomTransition.field_0x3c)))) {
|
||||
InitializeAnimation(this, 0x12);
|
||||
} else {
|
||||
InitializeAnimation(this, 0x11);
|
||||
@@ -1456,8 +1462,8 @@ void sub_08044078(Entity* this) {
|
||||
void sub_080440CC(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
if ((gScreenTransition.field_0x38 & 1) != 0 &&
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == gScreenTransition.field_0x3c) {
|
||||
if ((gRoomTransition.field_0x38 & 1) != 0 &&
|
||||
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == gRoomTransition.field_0x3c) {
|
||||
InitializeAnimation(this, 0x13);
|
||||
} else {
|
||||
InitializeAnimation(this, 0x11);
|
||||
|
||||
+23
-18
@@ -1,9 +1,14 @@
|
||||
/**
|
||||
* @file vaatiBall.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Ball enemy
|
||||
*/
|
||||
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "screen.h"
|
||||
#include "object.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -112,7 +117,7 @@ void sub_0804474C(Entity* this) {
|
||||
this->direction++;
|
||||
this->direction &= 0x1f;
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +148,7 @@ void sub_080447E0(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
extern void sub_08044DEC();
|
||||
extern void sub_08044DEC(Entity*);
|
||||
|
||||
void sub_08044868(Entity* this) {
|
||||
Entity* vaati = this->parent;
|
||||
@@ -164,7 +169,7 @@ void sub_08044868(Entity* this) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->x.HALF.HI = vaati->x.HALF.HI;
|
||||
@@ -200,7 +205,7 @@ void sub_08044868(Entity* this) {
|
||||
case 2:
|
||||
if (this->actionDelay)
|
||||
if (--this->actionDelay < 0x11)
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
break;
|
||||
case 3: {
|
||||
u8 draw;
|
||||
@@ -229,7 +234,7 @@ void sub_080449F8(Entity* this) {
|
||||
|
||||
switch (vaati->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (--this->actionDelay)
|
||||
break;
|
||||
|
||||
@@ -254,17 +259,17 @@ void sub_080449F8(Entity* this) {
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
case 3:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
case 4:
|
||||
sub_0806F69C(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
}
|
||||
@@ -305,7 +310,7 @@ void sub_08044B04(Entity* this) {
|
||||
|
||||
switch (vaati->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (--this->actionDelay == 0) {
|
||||
@@ -420,7 +425,7 @@ void sub_08044B04(Entity* this) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (--this->actionDelay == 0)
|
||||
this->field_0x74.HALF.LO++;
|
||||
break;
|
||||
@@ -472,11 +477,11 @@ void sub_08044E74(Entity* this, u32 state) {
|
||||
this->direction &= 0x1f;
|
||||
PositionRelative(this->parent, this, 0, -0x100000);
|
||||
this->speed = 12288;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->direction += 0x8;
|
||||
this->direction &= 0x1f;
|
||||
this->speed = 1280;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 8) & 0x1f;
|
||||
@@ -486,18 +491,18 @@ void sub_08044E74(Entity* this, u32 state) {
|
||||
switch (this->actionDelay) {
|
||||
case 3 ... 4:
|
||||
do {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
} while (this->actionDelay-- != 3);
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (this->actionDelay == 2) {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file vaatiEyesMacro.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Eyes Macro enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -43,8 +50,6 @@ const u8 gUnk_080CDE70[] = {
|
||||
const s8 gUnk_080CDE90[] = { -2, -3, -4, -5, -6, -5, -4, -3 };
|
||||
const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 };
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void VaatiEyesMacro(Entity* this) {
|
||||
vaatiEyesMacroFunctions[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
@@ -60,12 +65,12 @@ void VaatiEyesMacroFunction0(Entity* this) {
|
||||
void VaatiEyesMacroFunction1(Entity* this) {
|
||||
if (this->type == 0) {
|
||||
if (this->health == 0) {
|
||||
gScreenTransition.field_0x39 &= ~(1 << (gScreenTransition.field_0x3c + 2));
|
||||
gRoomTransition.field_0x39 &= ~(1 << (gRoomTransition.field_0x3c + 2));
|
||||
}
|
||||
if (gRoomControls.roomID == 0) {
|
||||
gScreenTransition.field_0x3a = this->health;
|
||||
if (gRoomControls.room == 0) {
|
||||
gRoomTransition.field_0x3a = this->health;
|
||||
} else {
|
||||
gScreenTransition.field_0x3b = this->health;
|
||||
gRoomTransition.field_0x3b = this->health;
|
||||
}
|
||||
if (this->field_0x78.HALF.HI != this->health) {
|
||||
EnqueueSFX(SFX_17A);
|
||||
@@ -104,10 +109,10 @@ void VaatiEyesMacroFunction0Type0Action0(Entity* this) {
|
||||
enemy = CreateEnemy(VAATI_EYES_MACRO, 2);
|
||||
enemy->parent = this;
|
||||
this->action = 1;
|
||||
if (gRoomControls.roomID == 0) {
|
||||
this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3a;
|
||||
if (gRoomControls.room == 0) {
|
||||
this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3a;
|
||||
} else {
|
||||
this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3b;
|
||||
this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3b;
|
||||
}
|
||||
this->field_0x78.HALF.LO = Random();
|
||||
sub_0802EFB8(this);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file vaatiProjectile.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Projectile enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
@@ -71,7 +78,7 @@ void VaatiProjectileFunction1(Entity* this) {
|
||||
entity->flags = entity->flags & 0x7f;
|
||||
}
|
||||
} else {
|
||||
gPlayerState.flags &= 0xfffffeff; // using b.unk8 does not match
|
||||
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
|
||||
entity = &gPlayerEntity;
|
||||
entity->flags = gPlayerEntity.flags | 0x80;
|
||||
}
|
||||
@@ -130,7 +137,7 @@ void VaatiProjectileFunction0Action1(Entity* this) {
|
||||
} else {
|
||||
if (gUnk_020000B0 != NULL) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
@@ -190,9 +197,9 @@ void VaatiProjectileFunction0Action6(Entity* this) {
|
||||
|
||||
void VaatiProjectileFunction0Action7(Entity* this) {
|
||||
sub_0803E444(this);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
sub_0803E4D8(this);
|
||||
if ((gRoomControls.roomOriginY + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
|
||||
if ((gRoomControls.origin_y + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
|
||||
SetInitializationPriority();
|
||||
DoExitTransition((ScreenTransitionData*)&gUnk_0813AB94);
|
||||
}
|
||||
@@ -222,7 +229,7 @@ void VaatiProjectileFunction0Action9(Entity* this) {
|
||||
|
||||
void sub_0803E444(Entity* this) {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
|
||||
gPlayerState.mobility = gPlayerState.mobility | 0x80;
|
||||
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
|
||||
sub_0806FA90(this, this->field_0x4c, 0, -2);
|
||||
gPlayerEntity.spriteOffsetY += 0xe;
|
||||
@@ -239,7 +246,7 @@ void sub_0803E480(Entity* this) {
|
||||
bool32 sub_0803E4A0(Entity* this) {
|
||||
#ifdef EU
|
||||
bool32 ret;
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
if (gRoomTransition.field_0x39 == 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
if (this->parent == NULL) {
|
||||
@@ -250,7 +257,7 @@ bool32 sub_0803E4A0(Entity* this) {
|
||||
return ret;
|
||||
#else
|
||||
bool32 ret;
|
||||
if (gScreenTransition.field_0x39 != 0) {
|
||||
if (gRoomTransition.field_0x39 != 0) {
|
||||
if (this->parent == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/**
|
||||
* @file vaatiRebornEnemy.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Reborn enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern u8 gEntCount;
|
||||
|
||||
void VaatiRebornEnemyType0PreAction(Entity*);
|
||||
void VaatiRebornEnemyType1PreAction(Entity*);
|
||||
@@ -246,8 +252,8 @@ void VaatiRebornEnemyType0Action2(Entity* this) {
|
||||
tmp = this->field_0x80.HALF.HI;
|
||||
this->field_0x80.HALF.HI = tmp % 5;
|
||||
ptr = &gUnk_080D04AC[this->field_0x80.HALF.HI];
|
||||
this->x.HALF.HI = gRoomControls.roomOriginX + ptr->HALF.x + 0x10;
|
||||
this->y.HALF.HI = gRoomControls.roomOriginY + ptr->HALF.y + 0x10;
|
||||
this->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x + 0x10;
|
||||
this->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y + 0x10;
|
||||
}
|
||||
this->spriteSettings.draw = 1;
|
||||
this->actionDelay = 0x20;
|
||||
@@ -654,7 +660,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
|
||||
parent->direction = -1;
|
||||
this->actionDelay = 0;
|
||||
SoundReq(SONG_STOP_BGM);
|
||||
gArea.musicIndex = gArea.pMusicIndex;
|
||||
gArea.bgm = gArea.queued_bgm;
|
||||
return;
|
||||
}
|
||||
this->actionDelay = 1;
|
||||
@@ -662,7 +668,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
|
||||
}
|
||||
if (0 < this->iframes) {
|
||||
SoundReq(0x127);
|
||||
sub_08080964(0xc, 1);
|
||||
InitScreenShake(0xc, 1);
|
||||
if (this->actionDelay == 0)
|
||||
this->actionDelay = 0x48;
|
||||
}
|
||||
@@ -880,15 +886,15 @@ u32 sub_0803E028(Entity* this) {
|
||||
if (this->field_0x76.HALF.HI != 1) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginX + 0x58;
|
||||
tmp = gRoomControls.origin_x + 0x58;
|
||||
if (tmp > gPlayerEntity.x.HALF.HI) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginY + 0x58;
|
||||
tmp = gRoomControls.origin_y + 0x58;
|
||||
if (tmp > gPlayerEntity.x.HALF.HI) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginY + 0xf8;
|
||||
tmp = gRoomControls.origin_y + 0xf8;
|
||||
if (tmp >= gPlayerEntity.x.HALF.HI) {
|
||||
this->field_0x80.HALF.HI += 5;
|
||||
ret = 1;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file vaatiTransfigured.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Transfigured enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -37,7 +44,6 @@ typedef struct {
|
||||
s8 x;
|
||||
s8 y;
|
||||
} PACKED xy;
|
||||
extern u8 gEntCount;
|
||||
|
||||
#ifdef EU
|
||||
const u8 gUnk_080D0ABC[] = { 0xf0, 0xd0, 0xb0 };
|
||||
@@ -266,7 +272,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
|
||||
this->actionDelay = 0xc0;
|
||||
COLLISION_ON(this);
|
||||
SoundReq(SFX_14C);
|
||||
sub_08080964(0x14, 4);
|
||||
InitScreenShake(0x14, 4);
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
@@ -288,7 +294,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
|
||||
if (this->animationState > 2) {
|
||||
this->action = 7;
|
||||
this->actionDelay = 0xe0;
|
||||
sub_0807A108();
|
||||
DeleteClones();
|
||||
SoundReq(SFX_BOSS_HIT);
|
||||
return;
|
||||
}
|
||||
@@ -313,7 +319,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (sub_08003FC4(this, 0x2800) == 0) {
|
||||
if (GravityUpdate(this, 0x2800) == 0) {
|
||||
this->field_0x80.HALF.LO = 5;
|
||||
this->actionDelay = 0x10;
|
||||
COLLISION_ON(this);
|
||||
@@ -321,7 +327,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
|
||||
this->field_0x86.HALF.LO = 0;
|
||||
sub_080408EC(this);
|
||||
SoundReq(SFX_14C);
|
||||
sub_08080964(0x1e, 4);
|
||||
InitScreenShake(0x1e, 4);
|
||||
} else {
|
||||
if (this->field_0xf != 0) {
|
||||
if (--this->field_0xf == 0) {
|
||||
@@ -341,7 +347,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
|
||||
this->field_0x86.HALF.LO = 0;
|
||||
sub_080408EC(this);
|
||||
} else {
|
||||
if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(0x9b, 1, 0xff), pEVar3 != NULL)) {
|
||||
if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(OBJECT_9B, 1, 0xff), pEVar3 != NULL)) {
|
||||
pEVar3->parent = this;
|
||||
CopyPosition(this, pEVar3);
|
||||
pEVar3->x.HALF.HI += (Random() & 0xf) - 7;
|
||||
@@ -379,7 +385,7 @@ void VaatiTransfiguredType0Action4(Entity* this) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sub_08003FC4(this, 0x2800) != 0)
|
||||
if (GravityUpdate(this, 0x2800) != 0)
|
||||
break;
|
||||
this->field_0x80.HALF.LO += 1;
|
||||
switch (this->cutsceneBeh.HALF.LO) {
|
||||
@@ -399,7 +405,7 @@ void VaatiTransfiguredType0Action4(Entity* this) {
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
SoundReq(SFX_14C);
|
||||
sub_08080964(0x1e, 4);
|
||||
InitScreenShake(0x1e, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (--this->actionDelay == 0) {
|
||||
@@ -857,8 +863,8 @@ void sub_080406A0(Entity* this) {
|
||||
uVar5 = this->field_0x86.HALF.LO;
|
||||
{
|
||||
u32 tmp;
|
||||
uVar6 = gRoomControls.roomOriginX + gUnk_080D0B58[tmp = uVar5 * 2];
|
||||
uVar4 = gRoomControls.roomOriginY + gUnk_080D0B58[tmp + 1];
|
||||
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
|
||||
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
|
||||
}
|
||||
if (sub_0806FCB8(this, uVar6, uVar4, 0x1c)) {
|
||||
if (uVar5 != 0) {
|
||||
@@ -868,8 +874,8 @@ void sub_080406A0(Entity* this) {
|
||||
}
|
||||
{
|
||||
u32 tmp;
|
||||
uVar6 = gRoomControls.roomOriginX + gUnk_080D0B58[tmp = uVar5 * 2];
|
||||
uVar4 = gRoomControls.roomOriginY + gUnk_080D0B58[tmp + 1];
|
||||
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
|
||||
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
|
||||
}
|
||||
}
|
||||
uVar3 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, uVar6, uVar4);
|
||||
@@ -892,8 +898,8 @@ void sub_08040770(Entity* this) {
|
||||
u32 tmp5, tmp6;
|
||||
{
|
||||
u32 index;
|
||||
tmp5 = gRoomControls.roomOriginX + gUnk_080D0B64[index = tmp2 * 2];
|
||||
tmp6 = gRoomControls.roomOriginY + gUnk_080D0B64[index + 1];
|
||||
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[index = tmp2 * 2];
|
||||
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[index + 1];
|
||||
}
|
||||
if (sub_0806FCB8(this, tmp5, tmp6, 0x1c)) {
|
||||
if (this->animationState != 2) {
|
||||
@@ -955,8 +961,8 @@ void sub_08040770(Entity* this) {
|
||||
}
|
||||
{
|
||||
u32 tmp3;
|
||||
tmp5 = gRoomControls.roomOriginX + gUnk_080D0B64[tmp3 = tmp2 * 2],
|
||||
tmp6 = gRoomControls.roomOriginY + gUnk_080D0B64[tmp3 + 1];
|
||||
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[tmp3 = tmp2 * 2],
|
||||
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[tmp3 + 1];
|
||||
}
|
||||
}
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, tmp5, tmp6);
|
||||
@@ -1069,7 +1075,7 @@ void sub_080409B0(Entity* this) {
|
||||
}
|
||||
} else {
|
||||
if (((this->bitfield & 0x80) != 0) && (0 < this->iframes)) {
|
||||
sub_08080964(0xc, 1);
|
||||
InitScreenShake(0xc, 1);
|
||||
SoundReq(SFX_BOSS_HIT);
|
||||
}
|
||||
if ((this->bitfield == 0x8a) && (gPlayerState.field_0xa0[0] == 5)) {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/**
|
||||
* @file vaatiTransfiguredEye.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Transfigured Eye enemy
|
||||
*/
|
||||
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "audio.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "coord.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
+38
-35
@@ -1,13 +1,17 @@
|
||||
/**
|
||||
* @file vaatiWrath.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Wrath enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "object.h"
|
||||
#include "textbox.h"
|
||||
#include "structures.h"
|
||||
#include "message.h"
|
||||
#include "functions.h"
|
||||
#include "save.h"
|
||||
#include "screen.h"
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void VaatiWrathType0PreAction(Entity*);
|
||||
u32 sub_08041FCC(Entity*);
|
||||
void sub_08042004(Entity*);
|
||||
@@ -120,20 +124,20 @@ void VaatiWrathType0(Entity* this) {
|
||||
void VaatiWrathType0Action0(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
bVar1 = gScreenTransition.field_0x38 & 1;
|
||||
bVar1 = gRoomTransition.field_0x38 & 1;
|
||||
if (bVar1 != 0) {
|
||||
if (sub_08041FCC(this) == 0) {
|
||||
return;
|
||||
}
|
||||
if ((gScreenTransition.field_0x39 & 0xc) == 0) {
|
||||
if ((gRoomTransition.field_0x39 & 0xc) == 0) {
|
||||
this->action = 5;
|
||||
this->subAction = 1;
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x3c;
|
||||
}
|
||||
this->x.HALF.HI = gScreenTransition.hurtType;
|
||||
this->y.HALF.HI = gScreenTransition.field_0x42;
|
||||
this->x.HALF.HI = gRoomTransition.hurtType;
|
||||
this->y.HALF.HI = gRoomTransition.field_0x42;
|
||||
sub_08042004(this);
|
||||
} else {
|
||||
if (sub_08041ED4(this) == 0) {
|
||||
@@ -144,7 +148,7 @@ void VaatiWrathType0Action0(Entity* this) {
|
||||
this->actionDelay = 120;
|
||||
this->spritePriority.b1 = 0;
|
||||
this->z.HALF.HI = 0xffb0;
|
||||
gRoomControls.cameraTarget = this;
|
||||
gRoomControls.camera_target = this;
|
||||
sub_080809D4();
|
||||
}
|
||||
this->spriteSettings.draw = 1;
|
||||
@@ -212,8 +216,8 @@ void VaatiWrathType0Action1(Entity* this) {
|
||||
sub_08042004(this);
|
||||
this->subAction = 6;
|
||||
this->actionDelay = 0x1e;
|
||||
gScreenTransition.field_0x38 |= 1;
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomTransition.field_0x38 |= 1;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
gPlayerState.controlMode = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -246,7 +250,7 @@ void VaatiWrathType0Action3(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ProcessMovement(this);
|
||||
|
||||
roomY = gRoomControls.roomOriginY;
|
||||
roomY = gRoomControls.origin_y;
|
||||
bound = roomY + 0x90;
|
||||
thisY = this->y.HALF.HI;
|
||||
if ((bound < thisY)) {
|
||||
@@ -322,12 +326,12 @@ void VaatiWrathType0Action5(Entity* this) {
|
||||
} else {
|
||||
if (this->field_0x78.HALF.HI == 0) {
|
||||
if (this->subAction == 2) {
|
||||
if ((gScreenTransition.field_0x39 & 3) == 0) {
|
||||
if ((gRoomTransition.field_0x39 & 3) == 0) {
|
||||
object = CreateObject(OBJECT_B5, 0, 0);
|
||||
if (object != NULL) {
|
||||
object->parent = this;
|
||||
((VaatiWrathHeapStruct*)this->myHeap)->object5b = object;
|
||||
gRoomControls.cameraTarget = object;
|
||||
gRoomControls.camera_target = object;
|
||||
this->action = 6;
|
||||
this->actionDelay = 0x1e;
|
||||
((VaatiWrathHeapStruct*)this->myHeap)->type1->subAction = 1;
|
||||
@@ -377,10 +381,10 @@ void VaatiWrathType0Action7(Entity* this) {
|
||||
sub_08042214(this);
|
||||
sub_08042004(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (gRoomControls.roomOriginY + 0x48 != this->y.HALF.HI) {
|
||||
if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) {
|
||||
this->speed = 0x100;
|
||||
this->direction = ((gRoomControls.roomOriginY + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
|
||||
sub_0806F69C(this);
|
||||
this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
|
||||
LinearMoveUpdate(this);
|
||||
} else {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08042050(this);
|
||||
@@ -391,9 +395,8 @@ void VaatiWrathType0Action7(Entity* this) {
|
||||
void VaatiWrathType0Action8(Entity* this) {
|
||||
sub_08042004(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0806F69C(this);
|
||||
if (((gRoomControls.roomOriginX + 0x20) > this->x.HALF.HI) ||
|
||||
((gRoomControls.roomOriginX + 0x140) < this->x.HALF.HI)) {
|
||||
LinearMoveUpdate(this);
|
||||
if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) {
|
||||
if (0x3f < this->speed) {
|
||||
this->direction ^= 0x10;
|
||||
}
|
||||
@@ -466,16 +469,16 @@ void VaatiWrathType0ActionA(Entity* this) {
|
||||
void VaatiWrathType0ActionB(Entity* this) {
|
||||
switch (this->subAction) {
|
||||
case 0:
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1);
|
||||
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (GravityUpdate(this, 0x2000) == 0) {
|
||||
this->subAction = 1;
|
||||
this->actionDelay = 0xf0;
|
||||
this->health = 8;
|
||||
this->hitType = 0x38;
|
||||
sub_08080964(0x14, 0);
|
||||
InitScreenShake(0x14, 0);
|
||||
InitAnimationForceUpdate(this, 6);
|
||||
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x16);
|
||||
}
|
||||
@@ -527,8 +530,8 @@ void VaatiWrathType0ActionC(Entity* this) {
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
if (gRoomControls.roomOriginY + 0x48 == this->y.HALF.HI) {
|
||||
LinearMoveUpdate(this);
|
||||
if (gRoomControls.origin_y + 0x48 == this->y.HALF.HI) {
|
||||
this->subAction = 2;
|
||||
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x11);
|
||||
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x19);
|
||||
@@ -586,7 +589,7 @@ void sub_08041BE8(Entity* this) {
|
||||
DeleteEntity(entity);
|
||||
((VaatiWrathHeapStruct*)this->myHeap)->object5b = NULL;
|
||||
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomControls.camera_target = &gPlayerEntity;
|
||||
#endif
|
||||
entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0];
|
||||
entity->myHeap = NULL;
|
||||
@@ -663,7 +666,7 @@ void sub_08041D84(Entity* this) {
|
||||
ChangeObjPalette(this->child, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
|
||||
}
|
||||
if (this->field_0xf == 0xe6) {
|
||||
DoFade(7, 4);
|
||||
SetFade(7, 4);
|
||||
}
|
||||
} else {
|
||||
this->subAction = 4;
|
||||
@@ -709,7 +712,7 @@ void sub_08041E78(Entity* this) {
|
||||
fx->x.HALF.HI += *temp++;
|
||||
fx->y.HALF.HI += *temp;
|
||||
fx->spritePriority.b0 = 3;
|
||||
sub_08080964(4, 0);
|
||||
InitScreenShake(4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -769,7 +772,7 @@ u32 sub_08041F74(Entity* this, u32 unk1) {
|
||||
}
|
||||
heap = ((VaatiWrathHeapStruct*)this->myHeap);
|
||||
arm = NULL;
|
||||
if ((gScreenTransition.field_0x39 >> unk1 & 1U) != 0) {
|
||||
if ((gRoomTransition.field_0x39 >> unk1 & 1U) != 0) {
|
||||
arm = CreateEnemy(VAATI_ARM, 0);
|
||||
arm->type2 = unk1;
|
||||
arm->parent = this;
|
||||
@@ -833,7 +836,7 @@ u32 sub_0804207C(Entity* this) {
|
||||
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
|
||||
} else {
|
||||
if (gPlayerEntity.y.HALF.HI < 0x40) {
|
||||
tmp = gRoomControls.roomOriginY + 0x18;
|
||||
tmp = gRoomControls.origin_y + 0x18;
|
||||
|
||||
} else {
|
||||
tmp = gPlayerEntity.y.HALF.HI - 0x28;
|
||||
@@ -888,7 +891,7 @@ void sub_080421AC(Entity* this) {
|
||||
this->field_0x7c.HALF_U.HI--;
|
||||
} else {
|
||||
if (this->field_0x78.HALF.HI == 0) {
|
||||
if (((Random() & 1) != 0) && ((gScreenTransition.field_0x39 & 0xc) != 0)) {
|
||||
if (((Random() & 1) != 0) && ((gRoomTransition.field_0x39 & 0xc) != 0)) {
|
||||
sub_08042264(this);
|
||||
this->field_0x78.HALF.HI = 1;
|
||||
return;
|
||||
@@ -994,9 +997,9 @@ void sub_0804235C(Entity* this) {
|
||||
#if defined USA || defined DEMO_USA || defined DEMO_JP
|
||||
void VaatiWrathType0PreAction(Entity* this) {
|
||||
int temp;
|
||||
if ((gScreenTransition.field_0x38 & 2) == 0) {
|
||||
if (gSave.unk48C[3] != 0) {
|
||||
gSave.unk48C[3]--;
|
||||
if ((gRoomTransition.field_0x38 & 2) == 0) {
|
||||
if (gSave.timers[3] != 0) {
|
||||
gSave.timers[3]--;
|
||||
} else {
|
||||
temp = gPlayerState.framestate_last;
|
||||
if (temp < 2) {
|
||||
@@ -1005,7 +1008,7 @@ void VaatiWrathType0PreAction(Entity* this) {
|
||||
if (gPlayerEntity.field_0x7a.HWORD == 0) {
|
||||
if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) {
|
||||
CreateEzloHint(0xb70, 0);
|
||||
gScreenTransition.field_0x38 |= 2;
|
||||
gRoomTransition.field_0x38 |= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/**
|
||||
* @file vaatiWrathEye.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Vaati Wrath Eye enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_080485D8(Entity*);
|
||||
@@ -36,7 +42,7 @@ void VaatiWrathEye(Entity* this) {
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction0(Entity* this) {
|
||||
if ((gScreenTransition.field_0x38 & 1) != 0) {
|
||||
if ((gRoomTransition.field_0x38 & 1) != 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
} else {
|
||||
@@ -58,7 +64,7 @@ void VaatiWrathEyeAction1(Entity* this) {
|
||||
|
||||
void VaatiWrathEyeAction2(Entity* this) {
|
||||
sub_080485D8(this);
|
||||
if ((gScreenTransition.field_0x39 & 3) == 0) {
|
||||
if ((gRoomTransition.field_0x39 & 3) == 0) {
|
||||
this->action = 3;
|
||||
COLLISION_ON(this);
|
||||
this->speed = 0x80;
|
||||
@@ -82,7 +88,7 @@ void VaatiWrathEyeAction3(Entity* this) {
|
||||
y = parent->y.HALF.HI + ptr[1];
|
||||
direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
|
||||
this->direction = direction;
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->z.HALF.HI = this->parent->z.HALF.HI;
|
||||
if ((this->x.HALF.HI == x) && (this->y.HALF.HI == y)) {
|
||||
this->action = 4;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file wallMaster.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Wall Master enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
@@ -134,7 +141,7 @@ void sub_0802A69C(Entity* this) {
|
||||
|
||||
sub_0802A7D0(this);
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerEntity.x.HALF.HI = this->field_0x7c.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->field_0x80.HWORD;
|
||||
gPlayerEntity.z.HALF.HI = this->field_0x82.HWORD;
|
||||
@@ -168,7 +175,7 @@ void sub_0802A734(Entity* this) {
|
||||
} else {
|
||||
this->z.WORD -= 0x20000;
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-6
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file wallMaster2.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Wall Master 2 enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
@@ -92,7 +99,7 @@ void sub_0802CD54(Entity* this) {
|
||||
this->actionDelay = 60;
|
||||
sub_0802CF64(this);
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
|
||||
void sub_0802CDE8(Entity* this) {
|
||||
@@ -101,7 +108,7 @@ void sub_0802CDE8(Entity* this) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
sub_0802CF8C(this);
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->actionDelay = 60;
|
||||
@@ -116,11 +123,11 @@ void sub_0802CE68(Entity* this) {
|
||||
u8 frames;
|
||||
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.flags |= 0x100;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
gPlayerState.flags |= PL_DISABLE_ITEMS;
|
||||
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
|
||||
this->direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
sub_0802CFD8(this);
|
||||
GetNextFrame(this);
|
||||
@@ -145,7 +152,7 @@ void sub_0802CEF4(Entity* this) {
|
||||
this->spriteSettings.shadow = 1;
|
||||
}
|
||||
gPlayerState.field_0xa |= 0x80;
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.mobility |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-7
@@ -1,8 +1,14 @@
|
||||
/**
|
||||
* @file waterDrop.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Water Drop enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "screen.h"
|
||||
#include "object.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_0802A39C(Entity*);
|
||||
void sub_0802A334(Entity*);
|
||||
@@ -34,12 +40,12 @@ void sub_0802A250(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802A2B4(Entity* this) {
|
||||
if (!sub_08003FC4(this, 0x2800)) {
|
||||
if (!GravityUpdate(this, 0x2800)) {
|
||||
this->action = 2;
|
||||
this->spritePriority.b0 = 7;
|
||||
EnqueueSFX(0x84);
|
||||
} else {
|
||||
sub_0806F69C(this);
|
||||
LinearMoveUpdate(this);
|
||||
}
|
||||
|
||||
sub_0802A39C(this);
|
||||
@@ -60,8 +66,8 @@ void sub_0802A2FC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802A334(Entity* this) {
|
||||
u32 x = (this->x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3;
|
||||
u32 y = (this->y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset) >> 3;
|
||||
u32 x = (this->x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
|
||||
u32 y = (this->y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset) >> 3;
|
||||
if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) {
|
||||
this->collisionLayer = 2;
|
||||
} else {
|
||||
@@ -71,8 +77,8 @@ void sub_0802A334(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802A39C(Entity* this) {
|
||||
u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3;
|
||||
u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset - 10) >> 3;
|
||||
u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
|
||||
u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3;
|
||||
if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) {
|
||||
COLLISION_OFF(this);
|
||||
} else {
|
||||
|
||||
+11
-2
@@ -1,8 +1,17 @@
|
||||
/**
|
||||
* @file wisp.c
|
||||
* @ingroup Enemies
|
||||
*
|
||||
* @brief Wisp enemy
|
||||
*/
|
||||
|
||||
#include "enemy.h"
|
||||
#include "save.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
static void sub_08033744(Entity* this);
|
||||
|
||||
extern void (*const gUnk_080CEB74[])(Entity*);
|
||||
extern void (*const gUnk_080CEB8C[])(Entity*);
|
||||
extern void (*const gUnk_080CEB98[])(Entity*);
|
||||
@@ -32,7 +41,7 @@ void sub_08033564(Entity* this) {
|
||||
this->spriteSettings.draw = FALSE;
|
||||
COLLISION_OFF(this);
|
||||
this->field_0x7c.HALF.LO = 0x27c;
|
||||
gPlayerState.flags |= 0x4000;
|
||||
gPlayerState.flags |= PL_DRUGGED;
|
||||
gSave.stats.effect = this->type + 1;
|
||||
gSave.stats.effectTimer = 600;
|
||||
if (this->type == 0) {
|
||||
@@ -120,7 +129,7 @@ void sub_080336DC(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033744(Entity* this) {
|
||||
static void sub_08033744(Entity* this) {
|
||||
u32 temp;
|
||||
u32 rand = (u32)Random() % 256;
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
#include "entity.h"
|
||||
#include "definitions.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
|
||||
extern EnemyDefinition gEnemyDefinitions[];
|
||||
|
||||
@@ -46,7 +47,7 @@ bool32 EnemyInit(Entity* this) {
|
||||
if ((this->field_0x6c.HALF.HI & 0x20) != 0) {
|
||||
u32 uVar4 = gUnk_080D3E74[this->id >> 3] >> ((this->id & 7) << 1) & 3;
|
||||
if (uVar4 != 0) {
|
||||
Entity* object = CreateObject(0xa9, uVar4 - 1, 0);
|
||||
Entity* object = CreateObject(OBJECT_A9, uVar4 - 1, 0);
|
||||
if (object != NULL) {
|
||||
object->actionDelay = this->flags;
|
||||
object->field_0xf = this->spriteSettings.draw;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "area.h"
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "common.h"
|
||||
#include "screen.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
@@ -12,14 +12,14 @@ typedef struct {
|
||||
u32 unk;
|
||||
} struct_02018EB0;
|
||||
|
||||
extern void (*const gUnk_080D4120[])();
|
||||
extern void (*const gUnk_080D412C[])();
|
||||
extern void (*const gUnk_080D4120[])(void);
|
||||
extern void (*const gUnk_080D412C[])(void);
|
||||
|
||||
extern struct_02018EB0 gUnk_02018EB0;
|
||||
|
||||
u32 sub_0804AA84(void) {
|
||||
u32 IsEnterPortal(void) {
|
||||
if (gArea.playShrinkSeq) {
|
||||
gMain.transition = 4;
|
||||
gMain.substate = 4;
|
||||
gArea.filler[8] = 0;
|
||||
gArea.filler[9] = 0;
|
||||
*(u16*)&gArea.filler[10] = 0;
|
||||
@@ -32,7 +32,7 @@ u32 sub_0804AA84(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804AAB8(void) {
|
||||
void GameMain_MinishPortal(void) {
|
||||
gUnk_080D4120[gArea.filler[8]]();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ void sub_0804AB04(void) {
|
||||
UpdateEntities();
|
||||
if (gArea.field_0x10 != 0) {
|
||||
FlushSprites();
|
||||
sub_080AD9B0();
|
||||
sub_080AD918();
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,6 @@ void sub_0804AB24(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804AB54(void) {
|
||||
void Subtask_PortalCutscene(void) {
|
||||
gUnk_080D412C[gArea.filler[8]]();
|
||||
}
|
||||
+93
-56
@@ -1,11 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "common.h"
|
||||
#include "functions.h"
|
||||
#include "entity.h"
|
||||
#include "area.h"
|
||||
#include "room.h"
|
||||
#include "script.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
extern u8 gUnk_081091F8[];
|
||||
@@ -18,23 +15,19 @@ void sub_0805EE88(void);
|
||||
void ClearAllDeletedEntities(void);
|
||||
void DeleteAllEntities(void);
|
||||
void sub_0805E98C(void);
|
||||
extern void sub_080AE068();
|
||||
extern void UnloadOBJPalette();
|
||||
extern void sub_0806FE84();
|
||||
extern void sub_080788E0();
|
||||
extern void sub_08078954();
|
||||
extern void sub_0805EC60();
|
||||
extern void sub_0806FE84(Entity*);
|
||||
extern void sub_08078954(Entity*);
|
||||
extern void sub_08017744(Entity*);
|
||||
extern void UnloadHitbox();
|
||||
extern void sub_0804AA1C();
|
||||
extern void UnloadHitbox(Entity*);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
|
||||
extern void _ClearAndUpdateEntities();
|
||||
void ClearDeletedEntity(Entity*);
|
||||
extern void _ClearAndUpdateEntities(void);
|
||||
extern void UpdateEntities_arm(u32);
|
||||
|
||||
void SetPriorityTimer(u32);
|
||||
static void UpdatePriorityTimer(void);
|
||||
static void ReleaseTransitionManager();
|
||||
static void UnlinkEntity();
|
||||
static void ReleaseTransitionManager(void*);
|
||||
static void UnlinkEntity(Entity*);
|
||||
|
||||
typedef struct {
|
||||
void* table;
|
||||
@@ -48,7 +41,7 @@ void sub_0805E248(void) {
|
||||
s32 v0;
|
||||
|
||||
v0 = gUnk_03004030.unk_00->unk_06;
|
||||
if (gRoomControls.areaID == AREA_VEIL_FALLS || gRoomControls.areaID == AREA_VEIL_FALLS_DIG_CAVE) {
|
||||
if (gRoomControls.area == AREA_VEIL_FALLS || gRoomControls.area == AREA_VEIL_FALLS_DIG_CAVE) {
|
||||
SetTileType(636, v0 - 65, 1);
|
||||
SetTileType(643, v0 - 65, 2);
|
||||
SetTileType(637, v0 - 64, 1);
|
||||
@@ -73,7 +66,7 @@ void sub_0805E248(void) {
|
||||
}
|
||||
|
||||
void sub_0805E374(Entity* e) {
|
||||
u8 r3 = gScreenTransition.player_status.field_0x24[8];
|
||||
u8 r3 = gRoomTransition.player_status.field_0x24[8];
|
||||
u8* array = gUnk_081091F8;
|
||||
|
||||
if (r3 != 2) {
|
||||
@@ -87,10 +80,10 @@ void SetDefaultPriority(Entity* ent, u32 prio) {
|
||||
ent->updatePriority = prio;
|
||||
}
|
||||
|
||||
bool32 CheckDontUpdate(Entity* this) {
|
||||
bool32 EntityIsDeleted(Entity* this) {
|
||||
u32 value;
|
||||
|
||||
if (this->flags & ENT_ASLEEP)
|
||||
if (this->flags & ENT_DELETED)
|
||||
return TRUE;
|
||||
if (this->action == 0)
|
||||
return FALSE;
|
||||
@@ -113,7 +106,7 @@ bool32 AnyPrioritySet(void) {
|
||||
return prio != PRIO_MIN;
|
||||
}
|
||||
|
||||
static void UpdatePriority() {
|
||||
static void UpdatePriority(void) {
|
||||
UpdatePriorityTimer();
|
||||
if (gPriorityHandler.queued_priority) {
|
||||
gPriorityHandler.ent_priority = gPriorityHandler.queued_priority;
|
||||
@@ -182,7 +175,7 @@ void SetPlayerEventPriority(void) {
|
||||
gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT;
|
||||
}
|
||||
|
||||
void ResetPlayerEventPriority() {
|
||||
void ResetPlayerEventPriority(void) {
|
||||
gPriorityHandler.sys_priority = PRIO_MIN;
|
||||
gPlayerEntity.updatePriority = PRIO_PLAYER;
|
||||
}
|
||||
@@ -192,19 +185,19 @@ void RevokePriority(Entity* e) {
|
||||
ResetEntityPriority();
|
||||
}
|
||||
|
||||
void SetRoomReloadPriority() {
|
||||
void SetRoomReloadPriority(void) {
|
||||
gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT;
|
||||
}
|
||||
|
||||
void SetInitializationPriority() {
|
||||
void SetInitializationPriority(void) {
|
||||
gPriorityHandler.sys_priority = PRIO_HIGHEST;
|
||||
}
|
||||
|
||||
void ResetSystemPriority() {
|
||||
void ResetSystemPriority(void) {
|
||||
gPriorityHandler.sys_priority = PRIO_MIN;
|
||||
}
|
||||
|
||||
void UpdateEntities() {
|
||||
void UpdateEntities(void) {
|
||||
void (*f)(u32);
|
||||
|
||||
gRoomVars.filler1[0] = gRoomVars.field_0x4;
|
||||
@@ -219,15 +212,14 @@ void UpdateEntities() {
|
||||
sub_0805EE88();
|
||||
}
|
||||
|
||||
void UpdateManagers() {
|
||||
void UpdateManagers(void) {
|
||||
void (*f)(u32);
|
||||
f = UpdateEntities_arm;
|
||||
f(1);
|
||||
ClearAllDeletedEntities();
|
||||
}
|
||||
|
||||
void EraseAllEntities() {
|
||||
extern u8 gUnk_03000000[];
|
||||
void EraseAllEntities(void) {
|
||||
DeleteAllEntities();
|
||||
MemClear(&gPriorityHandler, 12);
|
||||
MemClear(&gPlayerEntity, 10880);
|
||||
@@ -235,12 +227,73 @@ void EraseAllEntities() {
|
||||
sub_0805E98C();
|
||||
gEntCount = 0;
|
||||
gManagerCount = 0;
|
||||
gUnk_03000000[0x427] = 1;
|
||||
gUnk_03000000[0x426] = 1;
|
||||
gUnk_03000000[0x42e] = 1;
|
||||
gOAMControls.unk[0].unk7 = 1;
|
||||
gOAMControls.unk[0].unk6 = 1;
|
||||
gOAMControls.unk[1].unk6 = 1;
|
||||
}
|
||||
|
||||
ASM_FUNC("./asm/getEmptyEntity.s", Entity* GetEmptyEntity());
|
||||
extern Entity gUnk_030015A0[0x48];
|
||||
extern Entity gUnk_03003BE0;
|
||||
|
||||
NONMATCH("./asm/getEmptyEntity.s", Entity* GetEmptyEntity()) {
|
||||
u8 flags_ip;
|
||||
Entity* ptr;
|
||||
Entity* end;
|
||||
Entity* rv;
|
||||
Entity* currentEnt;
|
||||
LinkedList* nextList;
|
||||
|
||||
LinkedList* listPtr;
|
||||
LinkedList* endListPtr;
|
||||
|
||||
if (gEntCount <= 0x46) {
|
||||
ptr = gUnk_030015A0;
|
||||
end = ptr + ARRAY_COUNT(gUnk_030015A0);
|
||||
|
||||
do {
|
||||
if (ptr->prev == 0) {
|
||||
return ptr;
|
||||
}
|
||||
} while (++ptr < end);
|
||||
}
|
||||
|
||||
ptr = &gPlayerEntity;
|
||||
|
||||
do {
|
||||
if ((s32)ptr->prev < 0 && (ptr->flags & 0xc) && ptr != gUpdateContext.current_entity) {
|
||||
ClearDeletedEntity(ptr);
|
||||
return ptr;
|
||||
}
|
||||
} while (++ptr < &gUnk_03003BE0);
|
||||
|
||||
flags_ip = 0;
|
||||
rv = NULL;
|
||||
listPtr = gEntityLists;
|
||||
endListPtr = listPtr + ARRAY_COUNT(gEntityLists);
|
||||
|
||||
do {
|
||||
currentEnt = listPtr->first;
|
||||
nextList = listPtr + 1;
|
||||
while ((u32)currentEnt != (u32)listPtr) {
|
||||
if (currentEnt->kind != MANAGER && flags_ip < (currentEnt->flags & 0x1c) &&
|
||||
gUpdateContext.current_entity != currentEnt) {
|
||||
flags_ip = currentEnt->flags & 0x1c;
|
||||
rv = currentEnt;
|
||||
}
|
||||
currentEnt = currentEnt->next;
|
||||
}
|
||||
|
||||
listPtr = nextList;
|
||||
} while (listPtr < endListPtr);
|
||||
|
||||
if (rv) {
|
||||
DeleteEntity(rv);
|
||||
ClearDeletedEntity(rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
extern Entity gUnk_030011E8[7];
|
||||
|
||||
@@ -256,8 +309,6 @@ Entity* sub_0805E744(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Manager* GetEmptyManager(void);
|
||||
|
||||
typedef void* (*Getter)(void);
|
||||
|
||||
void* GetEmptyEntityByKind(u32 kind) {
|
||||
@@ -277,8 +328,6 @@ void DeleteThisEntity(void) {
|
||||
f();
|
||||
}
|
||||
|
||||
void DeleteManager(void*);
|
||||
|
||||
typedef void (*Deleter)(void*);
|
||||
|
||||
void DeleteEntityAny(Entity* ent) {
|
||||
@@ -320,9 +369,6 @@ void DeleteEntity(Entity* ent) {
|
||||
}
|
||||
}
|
||||
|
||||
extern Entity gPlayerEntity;
|
||||
void ClearDeletedEntity(Entity*);
|
||||
|
||||
void ClearAllDeletedEntities(void) {
|
||||
Entity* ent = &gPlayerEntity;
|
||||
do {
|
||||
@@ -333,8 +379,6 @@ void ClearAllDeletedEntities(void) {
|
||||
} while (ent++, ent < (&gPlayerEntity + 80));
|
||||
}
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void ClearDeletedEntity(Entity* ent) {
|
||||
DmaClear32(3, ent, sizeof(Entity));
|
||||
gEntCount--;
|
||||
@@ -357,8 +401,6 @@ void DeleteAllEntities(void) {
|
||||
}
|
||||
}
|
||||
|
||||
extern Manager gUnk_02033290;
|
||||
|
||||
typedef struct Temp {
|
||||
void* prev;
|
||||
void* next;
|
||||
@@ -376,15 +418,13 @@ Manager* GetEmptyManager(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern u8 gManagerCount;
|
||||
|
||||
void DeleteManager(void* ent) {
|
||||
Manager* manager = (Manager*)ent;
|
||||
if (!manager->next)
|
||||
return;
|
||||
|
||||
ReleaseTransitionManager(manager);
|
||||
UnlinkEntity(manager);
|
||||
UnlinkEntity((Entity*)manager);
|
||||
MemClear(manager, sizeof(Temp));
|
||||
gManagerCount--;
|
||||
}
|
||||
@@ -399,7 +439,6 @@ void ReleaseTransitionManager(void* mgr) {
|
||||
}
|
||||
|
||||
extern Entity gUnk_020369F0;
|
||||
void sub_0805E98C(void);
|
||||
|
||||
void sub_0805E958(void) {
|
||||
MemCopy(&gEntityLists, &gUnk_020369F0, 0x48);
|
||||
@@ -419,16 +458,16 @@ void sub_0805E98C(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805E9A8(void) {
|
||||
void RecycleEntities(void) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (i = list->first; (u32)i != (u32)list; i = i->next) {
|
||||
i->flags &= ~2;
|
||||
if ((i->flags & 0x20) == 0) {
|
||||
i->flags |= 0x10;
|
||||
i->flags &= ~ENT_SCRIPTED;
|
||||
if ((i->flags & ENT_PERSIST) == 0) {
|
||||
i->flags |= ENT_DELETED;
|
||||
}
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
@@ -443,14 +482,12 @@ void DeleteSleepingEntities(void) {
|
||||
do {
|
||||
for (ent = list->first; (u32)ent != (u32)list; ent = next) {
|
||||
next = ent->next;
|
||||
if (ent->flags & ENT_ASLEEP)
|
||||
if (ent->flags & ENT_DELETED)
|
||||
DeleteEntityAny(ent);
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
}
|
||||
|
||||
extern void sub_0805E374(Entity*);
|
||||
|
||||
void AppendEntityToList(Entity* entity, u32 listIndex) {
|
||||
LinkedList* list;
|
||||
|
||||
|
||||
+58
-65
@@ -1,15 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
#include "utils.h"
|
||||
#include "fade.h"
|
||||
|
||||
typedef struct {
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
u8 spritesOffset;
|
||||
} struct_03000000;
|
||||
extern struct_03000000 gUnk_03000000;
|
||||
#include "common.h"
|
||||
|
||||
static u32 sub_080501C0(FadeControl* ctl);
|
||||
static u32 sub_08050230(FadeControl* ctl);
|
||||
@@ -23,8 +16,8 @@ extern u16 gUnk_080FC3C4[];
|
||||
extern u32 gMakeFadeBuff256;
|
||||
typedef void (*fptrMakeFadeBuff256)(u8*, u8*, u16, u8);
|
||||
|
||||
void SetBrightness(u32 arg0) {
|
||||
gSaveHeader->brightnessPref = arg0;
|
||||
void SetBrightness(u32 brightness) {
|
||||
gSaveHeader->brightness = brightness;
|
||||
gUsedPalettes = 0xffffffff;
|
||||
}
|
||||
|
||||
@@ -55,82 +48,82 @@ void InitFade(void) {
|
||||
gFadeControl.mask = 0xffffffff;
|
||||
}
|
||||
|
||||
void sub_08050008(void) {
|
||||
void ResetFadeMask(void) {
|
||||
MemClear(&gUnk_020354C0, sizeof(gUnk_020354C0));
|
||||
gFadeControl.mask = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
static void sub_08050024(void) {
|
||||
sub_0801E104();
|
||||
DoFade(5, 256);
|
||||
SetFade(5, 256);
|
||||
}
|
||||
|
||||
void sub_08050038(u32 arg0) {
|
||||
if ((gFadeControl.fadeType & 1) != 0) {
|
||||
gFadeControl.field_0xe = arg0;
|
||||
void SetFadeProgress(u32 arg0) {
|
||||
if ((gFadeControl.type & 1) != 0) {
|
||||
gFadeControl.sustain = arg0;
|
||||
} else {
|
||||
gFadeControl.fadeDuration = arg0;
|
||||
gFadeControl.progress = arg0;
|
||||
}
|
||||
}
|
||||
|
||||
void DoFade(u32 type, u32 speed) {
|
||||
gFadeControl.fadeSpeed = speed;
|
||||
gFadeControl.fadeType = type;
|
||||
void SetFade(u32 type, u32 speed) {
|
||||
gFadeControl.speed = speed;
|
||||
gFadeControl.type = type;
|
||||
gFadeControl.active = 1;
|
||||
gFadeControl.fadeDuration = 0x100;
|
||||
gFadeControl.field_0xe = 0;
|
||||
if (gFadeControl.fadeType & 2) {
|
||||
gFadeControl.field_0x2 = 0xf8;
|
||||
gFadeControl.progress = 0x100;
|
||||
gFadeControl.sustain = 0;
|
||||
if (gFadeControl.type & 2) {
|
||||
gFadeControl.color = 0xf8;
|
||||
} else {
|
||||
gFadeControl.field_0x2 = 0;
|
||||
gFadeControl.color = 0;
|
||||
}
|
||||
if (type & 8) {
|
||||
gUnk_03000000.spritesOffset = 1;
|
||||
gOAMControls.spritesOffset = 1;
|
||||
gScreen.bg1.control |= BGCNT_MOSAIC;
|
||||
gScreen.bg2.control |= BGCNT_MOSAIC;
|
||||
gScreen.bg3.control |= BGCNT_MOSAIC;
|
||||
}
|
||||
if (type & 0x10) {
|
||||
sub_0801E1B8(gFadeControl.field_0x16, gFadeControl.field_0x18);
|
||||
sub_0801E1EC(gFadeControl.field_0x12, gFadeControl.field_0x14, gFadeControl.field_0x10);
|
||||
sub_0801E1B8(gFadeControl.win_inside_cnt, gFadeControl.win_outside_cnt);
|
||||
sub_0801E1EC(gFadeControl.iris_x, gFadeControl.iris_y, gFadeControl.iris_size);
|
||||
if ((type & 1) == 0) {
|
||||
gFadeControl.fadeType &= ~4;
|
||||
sub_08050008();
|
||||
gFadeControl.type &= ~4;
|
||||
ResetFadeMask();
|
||||
gUsedPalettes = 0xffffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080500F4(u32 arg0) {
|
||||
gFadeControl.fadeSpeed = arg0;
|
||||
gFadeControl.fadeType ^= 1;
|
||||
void SetFadeInverted(u32 speed) {
|
||||
gFadeControl.speed = speed;
|
||||
gFadeControl.type ^= 1;
|
||||
gFadeControl.active = 1;
|
||||
gFadeControl.fadeDuration = 256;
|
||||
gFadeControl.progress = 256;
|
||||
}
|
||||
|
||||
void sub_08050110(u32 param_1, u32 param_2, u32 fadeType, u32 fadeSpeed) {
|
||||
if ((fadeType & 1) != 0) {
|
||||
gFadeControl.field_0x10 = 0x96;
|
||||
void SetFadeIris(u32 x, u32 y, u32 type, u32 speed) {
|
||||
if ((type & 1) != 0) {
|
||||
gFadeControl.iris_size = 0x96;
|
||||
} else {
|
||||
gFadeControl.field_0x10 = 0;
|
||||
gFadeControl.iris_size = 0;
|
||||
}
|
||||
gFadeControl.field_0x12 = param_1;
|
||||
gFadeControl.field_0x14 = param_2;
|
||||
gFadeControl.field_0x16 = 0x3f3f;
|
||||
gFadeControl.field_0x18 = 0;
|
||||
DoFade(fadeType, fadeSpeed);
|
||||
gFadeControl.iris_x = x;
|
||||
gFadeControl.iris_y = y;
|
||||
gFadeControl.win_inside_cnt = 0x3f3f;
|
||||
gFadeControl.win_outside_cnt = 0;
|
||||
SetFade(type, speed);
|
||||
}
|
||||
|
||||
void FadeMain(void) {
|
||||
FadeControl* ctl = &gFadeControl;
|
||||
u32 flags = ctl->fadeType & 0x1C;
|
||||
u32 flags = ctl->type & 0x1C;
|
||||
u32 active = 0;
|
||||
u32 bit;
|
||||
|
||||
if (ctl->active) {
|
||||
ctl->fadeDuration -= ctl->fadeSpeed;
|
||||
if ((s16)ctl->fadeDuration <= (s16)ctl->field_0xe)
|
||||
ctl->fadeDuration = ctl->field_0xe;
|
||||
ctl->progress -= ctl->speed;
|
||||
if ((s16)ctl->progress <= (s16)ctl->sustain)
|
||||
ctl->progress = ctl->sustain;
|
||||
while (flags) {
|
||||
bit = (~flags + 1) & flags;
|
||||
flags ^= bit;
|
||||
@@ -156,10 +149,10 @@ static u32 sub_080501C0(FadeControl* ctl) {
|
||||
struct_020354C0* v3;
|
||||
u32 i;
|
||||
|
||||
if (ctl->fadeType & 1) {
|
||||
v1 = 256 - (s16)ctl->fadeDuration;
|
||||
if (ctl->type & 1) {
|
||||
v1 = 256 - (s16)ctl->progress;
|
||||
} else {
|
||||
v1 = (s16)ctl->fadeDuration;
|
||||
v1 = (s16)ctl->progress;
|
||||
}
|
||||
v2 = gFadeControl.mask;
|
||||
v3 = gUnk_020354C0;
|
||||
@@ -171,25 +164,25 @@ static u32 sub_080501C0(FadeControl* ctl) {
|
||||
v3->unk0 = 0;
|
||||
v3->unk2 = 0;
|
||||
}
|
||||
v3->unk1 = ctl->field_0x2;
|
||||
v3->unk1 = ctl->color;
|
||||
v2 >>= 1;
|
||||
}
|
||||
gUsedPalettes = 0xffffffff;
|
||||
|
||||
return !!((s16)ctl->field_0xe ^ (s16)ctl->fadeDuration);
|
||||
return !!((s16)ctl->sustain ^ (s16)ctl->progress);
|
||||
}
|
||||
|
||||
static u32 sub_08050230(FadeControl* ctl) {
|
||||
u32 type = ctl->fadeType;
|
||||
u32 idx = ((s16)ctl->fadeDuration >> 4) & 0xF;
|
||||
u32 type = ctl->type;
|
||||
u32 idx = ((s16)ctl->progress >> 4) & 0xF;
|
||||
if (type & 1)
|
||||
idx = 0xF - idx;
|
||||
gScreen.controls.mosaicSize = gUnk_080FC3C4[idx];
|
||||
if (ctl->fadeDuration != 0)
|
||||
if (ctl->progress != 0)
|
||||
return 1;
|
||||
|
||||
// fade is finished
|
||||
gUnk_03000000.spritesOffset = 0;
|
||||
gOAMControls.spritesOffset = 0;
|
||||
if ((type & 1) == 0) {
|
||||
// reset registers if fading in
|
||||
gScreen.bg0.control &= ~BGCNT_MOSAIC;
|
||||
@@ -201,18 +194,18 @@ static u32 sub_08050230(FadeControl* ctl) {
|
||||
}
|
||||
|
||||
static u32 sub_080502A4(FadeControl* ctl) {
|
||||
if (ctl->fadeType & 1) {
|
||||
s32 delta = (u16)gFadeControl.field_0x10 - gFadeControl.fadeSpeed;
|
||||
gFadeControl.field_0x10 -= gFadeControl.fadeSpeed;
|
||||
if (ctl->type & 1) {
|
||||
s32 delta = (u16)gFadeControl.iris_size - gFadeControl.speed;
|
||||
gFadeControl.iris_size -= gFadeControl.speed;
|
||||
if (delta << 16 <= 0)
|
||||
gFadeControl.field_0x10 = 0;
|
||||
sub_0801E1EC(gFadeControl.field_0x12, gFadeControl.field_0x14, gFadeControl.field_0x10);
|
||||
if (!gFadeControl.field_0x10)
|
||||
gFadeControl.iris_size = 0;
|
||||
sub_0801E1EC(gFadeControl.iris_x, gFadeControl.iris_y, gFadeControl.iris_size);
|
||||
if (!gFadeControl.iris_size)
|
||||
return 0;
|
||||
} else {
|
||||
gFadeControl.field_0x10 += gFadeControl.fadeSpeed;
|
||||
sub_0801E1EC(gFadeControl.field_0x12, gFadeControl.field_0x14, gFadeControl.field_0x10);
|
||||
if (gFadeControl.field_0x10 > 150) {
|
||||
gFadeControl.iris_size += gFadeControl.speed;
|
||||
sub_0801E1EC(gFadeControl.iris_x, gFadeControl.iris_y, gFadeControl.iris_size);
|
||||
if (gFadeControl.iris_size > 150) {
|
||||
sub_0801E104();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
#include "fileScreen.h"
|
||||
/**
|
||||
* @file fileselect.c
|
||||
* @ingroup Tasks
|
||||
*
|
||||
* @brief File select task
|
||||
*/
|
||||
|
||||
#include "fileselect.h"
|
||||
#include "main.h"
|
||||
#include "player.h"
|
||||
#include "utils.h"
|
||||
#include "common.h"
|
||||
#include "screen.h"
|
||||
#include "menu.h"
|
||||
#include "textbox.h"
|
||||
#include "message.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
#include "subtask.h"
|
||||
|
||||
// copy, erase, start
|
||||
#define NUM_FILE_OPERATIONS 3
|
||||
@@ -37,7 +44,7 @@ typedef enum {
|
||||
static void HandleFileScreenEnter(void);
|
||||
static void HandleFileScreenActive(void);
|
||||
static void HandleFileScreenExit(void);
|
||||
static void (*const sScreenHandlers[])(void) = {
|
||||
static void (*const sTaskHandlers[])(void) = {
|
||||
HandleFileScreenEnter,
|
||||
HandleFileScreenActive,
|
||||
HandleFileScreenExit,
|
||||
@@ -93,7 +100,7 @@ static void sub_08050624(u32);
|
||||
static void sub_0805066C(void);
|
||||
static void HideButtonR(void);
|
||||
static void ShowButtonR(void);
|
||||
void sub_08051458();
|
||||
void sub_08051458(void);
|
||||
|
||||
void CreateDialogBox(u32 arg0, u32 arg1) {
|
||||
u32 sfx;
|
||||
@@ -130,21 +137,21 @@ void SetFileSelectState(FileSelectState mode) {
|
||||
}
|
||||
|
||||
void LoadOptionsFromSave(u32 idx) {
|
||||
u8 messageSpeed;
|
||||
u8 brightnessPref;
|
||||
u8 msg_speed;
|
||||
u8 brightness;
|
||||
|
||||
if (idx >= NUM_SAVE_SLOTS) {
|
||||
// these apply to the language selection screen
|
||||
messageSpeed = 1;
|
||||
brightnessPref = 1;
|
||||
msg_speed = 1;
|
||||
brightness = 1;
|
||||
} else {
|
||||
SaveFile* saveFile = &gUnk_02019EE0.saves[idx];
|
||||
messageSpeed = saveFile->messageSpeed;
|
||||
brightnessPref = saveFile->brightnessPref;
|
||||
msg_speed = saveFile->msg_speed;
|
||||
brightness = saveFile->brightness;
|
||||
}
|
||||
|
||||
gSaveHeader->messageSpeed = messageSpeed;
|
||||
gSaveHeader->brightnessPref = brightnessPref;
|
||||
gSaveHeader->msg_speed = msg_speed;
|
||||
gSaveHeader->brightness = brightness;
|
||||
gUsedPalettes = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
@@ -156,9 +163,9 @@ void SetActiveSave(u32 idx) {
|
||||
LoadOptionsFromSave(idx);
|
||||
}
|
||||
|
||||
void HandleChooseFileScreen(void) {
|
||||
void FileSelectTask(void) {
|
||||
FlushSprites();
|
||||
sScreenHandlers[gMain.funcIndex]();
|
||||
sTaskHandlers[gMain.state]();
|
||||
if (gUnk_02032EC0.lastState != gUnk_02032EC0.state) {
|
||||
gUnk_02032EC0.lastState = gUnk_02032EC0.state;
|
||||
gScreen.bg0.xOffset = 0;
|
||||
@@ -177,11 +184,11 @@ void HandleChooseFileScreen(void) {
|
||||
UpdateEntities();
|
||||
sub_0805066C();
|
||||
sub_0801C1D4();
|
||||
sub_0801C208();
|
||||
sub_080AD9B0();
|
||||
sub_080AD918();
|
||||
if (gUnk_02019EE0.unk3 != gSaveHeader->gameLanguage) {
|
||||
gUnk_02019EE0.unk3 = gSaveHeader->gameLanguage;
|
||||
DrawOAMCmd();
|
||||
DrawEntities();
|
||||
CopyOAM();
|
||||
if (gUnk_02019EE0.unk3 != gSaveHeader->language) {
|
||||
gUnk_02019EE0.unk3 = gSaveHeader->language;
|
||||
sub_080503A8(0x6);
|
||||
sub_080503A8(0xF);
|
||||
}
|
||||
@@ -195,13 +202,13 @@ static void HandleFileScreenEnter(void) {
|
||||
MemClear((void*)VRAM, 0x80); // clear palettes
|
||||
MessageInitialize();
|
||||
EraseAllEntities();
|
||||
sub_08080668();
|
||||
ClearTilemaps();
|
||||
ResetPalettes();
|
||||
sub_0801CFA8(0);
|
||||
ResetPaletteTable(0);
|
||||
MemClear(&gUnk_0200AF00, sizeof(gUnk_0200AF00));
|
||||
MemClear(&gUnk_02019EE0, sizeof(gUnk_02019EE0));
|
||||
gUnk_02019EE0.unk3 = 7;
|
||||
gUnk_02019EE0.unk6 = gSaveHeader->gameLanguage > LANGUAGE_EN ? 3 : 0;
|
||||
gUnk_02019EE0.unk6 = gSaveHeader->language > LANGUAGE_EN ? 3 : 0;
|
||||
MemClear(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
|
||||
gUnk_02032EC0.lastState = 8;
|
||||
SetFileSelectState(STATE_NONE);
|
||||
@@ -223,9 +230,9 @@ static void HandleFileScreenEnter(void) {
|
||||
gScreen.controls.layerFXControl = BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_BLEND;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(15, 10);
|
||||
gGFXSlots.unk0 = 1;
|
||||
gMain.funcIndex = 1;
|
||||
gMain.state = 1;
|
||||
SoundReq(BGM_FILE_SELECT);
|
||||
DoFade(4, 8);
|
||||
SetFade(4, 8);
|
||||
}
|
||||
|
||||
static void HandleFileScreenActive(void) {
|
||||
@@ -233,7 +240,7 @@ static void HandleFileScreenActive(void) {
|
||||
|
||||
static void HandleFileScreenExit(void) {
|
||||
if (!gFadeControl.active) {
|
||||
InitScreen(SCREEN_GAMEPLAY);
|
||||
SetTask(TASK_GAME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +295,7 @@ void sub_0805070C(void) {
|
||||
u32 i;
|
||||
int j;
|
||||
struct_02036540* var0;
|
||||
char* playerName;
|
||||
char* name;
|
||||
|
||||
var0 = sub_0805F2C8();
|
||||
if (var0) {
|
||||
@@ -300,9 +307,9 @@ void sub_0805070C(void) {
|
||||
for (i = 0; i < NUM_SAVE_SLOTS; i++) {
|
||||
var0->unk6 = 0;
|
||||
MemClear(var0->unk8, 0x200);
|
||||
playerName = &gUnk_02019EE0.saves[i].playerName[0];
|
||||
name = &gUnk_02019EE0.saves[i].name[0];
|
||||
for (j = 0; j < FILENAME_LENGTH; j++) {
|
||||
sub_0805F7DC(playerName[j], var0);
|
||||
sub_0805F7DC(name[j], var0);
|
||||
}
|
||||
// i is a struct of size 0x200
|
||||
MemCopy(var0->unk8, (void*)(OBJ_VRAM0 + 0x4000 + i * 0x200), 0x200);
|
||||
@@ -419,7 +426,7 @@ void sub_08050940(void) {
|
||||
keys &= ~(DPAD_UP | DPAD_DOWN);
|
||||
}
|
||||
|
||||
num_rows = gSaveHeader->gameLanguage > 1 ? NUM_SAVE_SLOTS + 1 : NUM_SAVE_SLOTS;
|
||||
num_rows = gSaveHeader->language > 1 ? NUM_SAVE_SLOTS + 1 : NUM_SAVE_SLOTS;
|
||||
mode = gUnk_02032EC0.lastState;
|
||||
switch (keys) {
|
||||
case DPAD_UP:
|
||||
@@ -482,36 +489,36 @@ void sub_08050A64(u32 idx) {
|
||||
gOamCmd.x = 0xA2;
|
||||
gOamCmd.y = 0x36;
|
||||
#ifdef EU
|
||||
sub_080ADA14(0x144, 0x24);
|
||||
DrawDirect(0x144, 0x24);
|
||||
#else
|
||||
sub_080ADA14(0x145, 0x24);
|
||||
DrawDirect(0x145, 0x24);
|
||||
#endif
|
||||
}
|
||||
if (GetInventoryValue(0x41)) {
|
||||
gOamCmd.x = 0x96;
|
||||
gOamCmd.y = 0x3D;
|
||||
#ifdef EU
|
||||
sub_080ADA14(0x144, 0x22);
|
||||
DrawDirect(0x144, 0x22);
|
||||
#else
|
||||
sub_080ADA14(0x145, 0x22);
|
||||
DrawDirect(0x145, 0x22);
|
||||
#endif
|
||||
}
|
||||
if (GetInventoryValue(0x42)) {
|
||||
gOamCmd.x = 0xAE;
|
||||
gOamCmd.y = 0x3D;
|
||||
#ifdef EU
|
||||
sub_080ADA14(0x144, 0x23);
|
||||
DrawDirect(0x144, 0x23);
|
||||
#else
|
||||
sub_080ADA14(0x145, 0x23);
|
||||
DrawDirect(0x145, 0x23);
|
||||
#endif
|
||||
}
|
||||
if (GetInventoryValue(0x43)) {
|
||||
gOamCmd.x = 0xA2;
|
||||
gOamCmd.y = 0x44;
|
||||
#ifdef EU
|
||||
sub_080ADA14(0x144, 0x21);
|
||||
DrawDirect(0x144, 0x21);
|
||||
#else
|
||||
sub_080ADA14(0x145, 0x21);
|
||||
DrawDirect(0x145, 0x21);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -678,7 +685,7 @@ void HandleFileLanguageSelect(void) {
|
||||
void sub_08050DB8(void) {
|
||||
MemClear(&gBG2Buffer, sizeof(gBG2Buffer));
|
||||
sub_080503A8(0xc);
|
||||
gMenu.field_0x4 = gSaveHeader->gameLanguage;
|
||||
gMenu.field_0x4 = gSaveHeader->language;
|
||||
sub_080A7114(1);
|
||||
}
|
||||
|
||||
@@ -688,7 +695,7 @@ void sub_08050DE4(void) {
|
||||
if (gUnk_02019EE0.isTransitioning)
|
||||
return;
|
||||
|
||||
row_idx = gSaveHeader->gameLanguage;
|
||||
row_idx = gSaveHeader->language;
|
||||
switch (gInput.newKeys) {
|
||||
case DPAD_UP:
|
||||
row_idx--;
|
||||
@@ -708,7 +715,7 @@ void sub_08050DE4(void) {
|
||||
break;
|
||||
case B_BUTTON:
|
||||
row_idx = gMenu.field_0x4;
|
||||
gSaveHeader->gameLanguage = gMenu.field_0x4;
|
||||
gSaveHeader->language = gMenu.field_0x4;
|
||||
SoundReq(SFX_MENU_CANCEL);
|
||||
SetFileSelectState(STATE_NONE);
|
||||
break;
|
||||
@@ -721,8 +728,8 @@ void sub_08050DE4(void) {
|
||||
if (row_idx > 6) {
|
||||
row_idx = 6;
|
||||
}
|
||||
if (gSaveHeader->gameLanguage != row_idx) {
|
||||
gSaveHeader->gameLanguage = row_idx;
|
||||
if (gSaveHeader->language != row_idx) {
|
||||
gSaveHeader->language = row_idx;
|
||||
SoundReq(SFX_TEXTBOX_CHOICE);
|
||||
}
|
||||
}
|
||||
@@ -740,8 +747,8 @@ void sub_08050EB8(void) {
|
||||
SaveFile* save;
|
||||
sub_080503A8(0xe);
|
||||
save = &gUnk_02019EE0.saves[gUnk_02019EE0.unk6];
|
||||
gUnk_02019EE0.unk4 = save->messageSpeed;
|
||||
gUnk_02019EE0.unk5 = save->brightnessPref;
|
||||
gUnk_02019EE0.unk4 = save->msg_speed;
|
||||
gUnk_02019EE0.unk5 = save->brightness;
|
||||
gMenu.column_idx = 0;
|
||||
gMenu.transitionTimer = 0xff;
|
||||
sub_080A7114(1);
|
||||
@@ -756,9 +763,9 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)
|
||||
if (gUnk_02019EE0.isTransitioning)
|
||||
return;
|
||||
|
||||
p_option = &gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightnessPref;
|
||||
p_option = &gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightness;
|
||||
if (gMenu.column_idx == 0) {
|
||||
p_option = &gUnk_02019EE0.saves[gUnk_02019EE0.unk6].messageSpeed;
|
||||
p_option = &gUnk_02019EE0.saves[gUnk_02019EE0.unk6].msg_speed;
|
||||
}
|
||||
|
||||
mode = 0;
|
||||
@@ -784,7 +791,7 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)
|
||||
case A_BUTTON:
|
||||
case START_BUTTON:
|
||||
mode = 2;
|
||||
if (*(u16*)&gUnk_02019EE0.unk4 != *(u16*)&gUnk_02019EE0.saves[gUnk_02019EE0.unk6].messageSpeed)
|
||||
if (*(u16*)&gUnk_02019EE0.unk4 != *(u16*)&gUnk_02019EE0.saves[gUnk_02019EE0.unk6].msg_speed)
|
||||
mode = 3;
|
||||
break;
|
||||
case B_BUTTON:
|
||||
@@ -794,8 +801,8 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)
|
||||
|
||||
switch (mode) {
|
||||
case 3:
|
||||
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].messageSpeed = gUnk_02019EE0.unk4;
|
||||
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightnessPref = gUnk_02019EE0.unk5;
|
||||
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].msg_speed = gUnk_02019EE0.unk4;
|
||||
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightness = gUnk_02019EE0.unk5;
|
||||
SoundReq(SFX_MENU_CANCEL);
|
||||
sub_080A7114(mode);
|
||||
SetActiveSave(gUnk_02019EE0.unk6);
|
||||
@@ -868,7 +875,7 @@ NONMATCH("asm/non_matching/fileScreen/sub_080610B8.inc", void sub_080610B8(void)
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08051358(void) {
|
||||
gMenu.field_0x12 = gSaveHeader->gameLanguage == 0 ? 4 : 3;
|
||||
gMenu.field_0x12 = gSaveHeader->language == 0 ? 4 : 3;
|
||||
|
||||
if (gMenu.focusCoords[0] != 0x0b || gMenu.focusCoords[1] != 0x5) {
|
||||
gMenu.focusCoords[1] = 0x5;
|
||||
@@ -922,7 +929,7 @@ void sub_0805144C(void) {
|
||||
|
||||
void sub_08051458(void) {
|
||||
sub_080503A8(gMenu.column_idx + 9);
|
||||
MemCopy(&gUnk_02001B40, &gUnk_02022030, 0x400);
|
||||
MemCopy(gBG3Buffer + 0x80, &gUnk_02022030, 0x400);
|
||||
}
|
||||
|
||||
u32 sub_080514BC(u32);
|
||||
@@ -949,7 +956,7 @@ void sub_08051480(u32 c) {
|
||||
}
|
||||
|
||||
gMenu.unk13 = idx + 1;
|
||||
gSave.playerName[idx] = c;
|
||||
gSave.name[idx] = c;
|
||||
sub_08051574(SFX_6B);
|
||||
}
|
||||
|
||||
@@ -957,7 +964,7 @@ u32 sub_080514BC(u32 a1) {
|
||||
u32 c;
|
||||
u32 idx;
|
||||
|
||||
if (gSaveHeader->gameLanguage != 0)
|
||||
if (gSaveHeader->language != 0)
|
||||
return 1;
|
||||
|
||||
switch (a1) {
|
||||
@@ -973,7 +980,7 @@ u32 sub_080514BC(u32 a1) {
|
||||
if (idx == 0)
|
||||
return 0;
|
||||
|
||||
c = gSave.playerName[idx - 1];
|
||||
c = gSave.name[idx - 1];
|
||||
if (c - 0xa4 < 0x29) {
|
||||
switch (a1) {
|
||||
case 0x0:
|
||||
@@ -1117,17 +1124,18 @@ NONMATCH("asm/non_matching/fileScreen/sub_08051738.inc", void sub_08051738(void)
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/fileScreen/sub_080517B4.inc", s32 sub_080517B4(s32 a1)) {
|
||||
s32 sub_080517B4(s32 a1) {
|
||||
u32 i = gUnk_02019EE0.unk7;
|
||||
if (a1 != 0) {
|
||||
for (; i < 5; i += a1) {
|
||||
if ((&gMenu.selectMtx)[i] != 0 && (&gMenu.selectMtx)[i] != 4)
|
||||
for (i = i + a1; i < 5; i += a1) {
|
||||
if ((&gMenu.focusCoords[0])[i] != 0 && (&gMenu.focusCoords[0])[i] != 4)
|
||||
return i;
|
||||
}
|
||||
|
||||
i = gUnk_02019EE0.unk7;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080517EC(void) {
|
||||
u32 temp;
|
||||
@@ -1201,10 +1209,10 @@ void sub_080518E4(void) {
|
||||
void HandleFileStart(void) {
|
||||
if (gMenu.menuType == 0) {
|
||||
gMenu.menuType = 1;
|
||||
gSaveHeader->messageSpeed = gSave.messageSpeed;
|
||||
gSaveHeader->brightnessPref = gSave.brightnessPref;
|
||||
gMain.funcIndex = 2;
|
||||
DoFade(5, 8);
|
||||
gSaveHeader->msg_speed = gSave.msg_speed;
|
||||
gSaveHeader->brightness = gSave.brightness;
|
||||
gMain.state = 2;
|
||||
SetFade(5, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,8 +1222,8 @@ void sub_0805194C(u32 save_idx) {
|
||||
gUnk_02019EE0.saveStatus[save_idx] = 0;
|
||||
save = &gUnk_02019EE0.saves[save_idx];
|
||||
MemClear(save, sizeof(*save));
|
||||
save->messageSpeed = 1;
|
||||
save->brightnessPref = 1;
|
||||
save->msg_speed = 1;
|
||||
save->brightness = 1;
|
||||
save->stats.health = 24;
|
||||
save->stats.maxHealth = 24;
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "flags.h"
|
||||
|
||||
const char* const globalFlagNames[] = {
|
||||
"BEGIN",
|
||||
"LV0_CLEAR",
|
||||
|
||||
+18
-19
@@ -13,13 +13,13 @@ u32 CheckLocalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
u32 CheckFlags(u32 flags) {
|
||||
s32 type;
|
||||
s32 index;
|
||||
s32 length;
|
||||
u32 type;
|
||||
u32 index;
|
||||
u32 length;
|
||||
index = flags & 0x3ff;
|
||||
length = (((flags & (0xf0) << 0x6) >> 0xa) + 1);
|
||||
type = (flags & 0xc000) >> 0xe;
|
||||
switch ((u32)type) {
|
||||
switch (type) {
|
||||
case 2:
|
||||
return CheckRoomFlags(index, length);
|
||||
case 0:
|
||||
@@ -36,12 +36,11 @@ u32 CheckGlobalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
u32 CheckRoomFlag(u32 flag) {
|
||||
return ReadBit(&gRoomVars.roomFlags, flag);
|
||||
return ReadBit(&gRoomVars.flags, flag);
|
||||
}
|
||||
|
||||
u32 CheckLocalFlagsByBank(u32 flag, u32 offset, u32 length) {
|
||||
|
||||
return CheckBits(&gGlobalFlags, flag + offset, length);
|
||||
u32 CheckLocalFlagsByBank(u32 offset, u32 flag, u32 length) {
|
||||
return CheckBits(&gGlobalFlags, offset + flag, length);
|
||||
}
|
||||
|
||||
u32 CheckLocalFlags(u32 flag, u32 length) {
|
||||
@@ -53,7 +52,7 @@ u32 CheckGlobalFlags(u32 flag, u32 length) {
|
||||
}
|
||||
|
||||
u32 CheckRoomFlags(u32 flag, u32 length) {
|
||||
return CheckBits(&gRoomVars.roomFlags, flag, length);
|
||||
return CheckBits(&gRoomVars.flags, flag, length);
|
||||
}
|
||||
|
||||
void SetLocalFlagByBank(u32 offset, u32 flag) {
|
||||
@@ -67,13 +66,13 @@ void SetLocalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
void SetFlag(u32 flag) {
|
||||
s32 uVar1;
|
||||
s32 index;
|
||||
u32 type;
|
||||
u32 index;
|
||||
|
||||
if (flag != 0) {
|
||||
index = flag & 0x3ff;
|
||||
uVar1 = (flag & 0xc000) >> 0xe;
|
||||
switch ((u32)uVar1) {
|
||||
type = (flag & 0xc000) >> 0xe;
|
||||
switch (type) {
|
||||
case 2:
|
||||
SetRoomFlag(index);
|
||||
return;
|
||||
@@ -92,7 +91,7 @@ void SetGlobalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
void SetRoomFlag(u32 flag) {
|
||||
WriteBit(&gRoomFlags, flag);
|
||||
WriteBit(&gRoomVars.flags, flag);
|
||||
}
|
||||
|
||||
void ClearLocalFlagByBank(u32 offset, u32 flag) {
|
||||
@@ -104,12 +103,12 @@ void ClearLocalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
void ClearFlag(u32 flag) {
|
||||
s32 uVar1;
|
||||
s32 index;
|
||||
u32 type;
|
||||
u32 index;
|
||||
|
||||
index = flag & 0x3ff;
|
||||
uVar1 = (flag & 0xc000) >> 0xe;
|
||||
switch ((u32)uVar1) {
|
||||
type = (flag & 0xc000) >> 0xe;
|
||||
switch (type) {
|
||||
case 2:
|
||||
ClearRoomFlag(index);
|
||||
return;
|
||||
@@ -127,5 +126,5 @@ void ClearGlobalFlag(u32 flag) {
|
||||
}
|
||||
|
||||
void ClearRoomFlag(u32 flag) {
|
||||
ClearBit(&gRoomFlags, flag);
|
||||
ClearBit(&gRoomVars.flags, flag);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user