Merge pull request #421 from octorock/playerUtils

Merge playerUtils
This commit is contained in:
notyourav
2022-03-02 15:56:31 -08:00
committed by GitHub
271 changed files with 18871 additions and 23256 deletions
-403
View File
@@ -1,403 +0,0 @@
#include "global.h"
#include "player.h"
#include "room.h"
#include "menu.h"
#include "area.h"
#include "common.h"
#include "save.h"
#include "item.h"
#include "object.h"
#include "enemy.h"
#include "droptables.h"
#include "itemMetaData.h"
extern u8 gUnk_0200AF13;
extern u8 gUnk_0200AF14;
extern u8 gUnk_080FE1C6[];
/*{
0u,
0x1u,
0x2u,
0x3u,
0x4u,
0x5u,
0x6u,
0x7u,
0x8u,
0x9u,
0x8u,
0x9u,
0xau,
0xau,
0xbu,
0xcu,
0xdu,
0xeu,
0xfu,
0x8u,
0xfu,
0x1u,
0x8u,
};
*/
extern void (*const gUnk_080FE2A0[])(void);
void ForceEquipItem(u32, u32);
extern void sub_0807CAA0(u32, u32);
/*
Returns the slot the item is equipped in.
0: A
1: B
2: Not equipped
*/
extern u8 gUnk_080FE1DD[];
u32 IsItemEquipped(u32 itemID) {
u32 itemSlot;
if (itemID == gSave.stats.itemButtons[SLOT_A])
itemSlot = 0;
else if (itemID == gSave.stats.itemButtons[SLOT_B])
itemSlot = 1;
else
itemSlot = 2;
return itemSlot;
}
void PutItemOnSlot(u32 itemID) {
u32 itemSlot;
u32 itemID2 = itemID;
if (itemID2 < 0x47) {
sub_0807CAA0(0, 1);
}
if (itemID2 - 1 < 0x1f) {
itemSlot = 2;
if (gSave.stats.itemButtons[SLOT_A] == 0) {
itemSlot = 0;
} else if (gSave.stats.itemButtons[SLOT_B] == 0) {
itemSlot = 1;
}
if (itemSlot == 2) {
u32 temp = gItemMetaData[itemID2].menuSlot;
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) {
itemSlot = 0;
} else {
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) {
itemSlot = 1;
}
}
if (itemSlot == 2) {
return;
}
}
ForceEquipItem(itemID2, itemSlot);
}
}
void ForceEquipItem(u32 itemID, u32 itemSlot) {
u32 otherItem;
u32 otherItemIndex;
u32 replacedItem;
if ((itemID - 1 < 0x1f) && (itemSlot < 2)) {
otherItemIndex = itemSlot == 0;
replacedItem = gSave.stats.itemButtons[itemSlot];
otherItem = gSave.stats.itemButtons[otherItemIndex];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemID].menuSlot) {
otherItem = replacedItem;
}
gSave.stats.itemButtons[itemSlot] = itemID;
gSave.stats.itemButtons[otherItemIndex] = otherItem;
gUnk_0200AF00.filler0[0x13] = 0x7f;
gUnk_0200AF00.filler0[0x14] = 0x7f;
}
}
u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
if (bottleIndex > 3) {
bottleIndex = 0;
if (gSave.stats.bottles[0] != 0x20) {
do {
bottleIndex++;
if (bottleIndex > 3) {
return bottleIndex;
}
} while (gSave.stats.bottles[bottleIndex] != 0x20);
}
if (bottleIndex > 3) {
return bottleIndex;
}
}
gSave.stats.bottles[bottleIndex] = itemID;
return bottleIndex;
}
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 FALSE;
}
}
bool32 ItemIsShield(u32 id) {
switch (id) {
case 13:
case 14:
return 1;
default:
return 0;
}
}
bool32 ItemIsBottle(u32 id) {
switch (id) {
case 28:
case 29:
case 30:
case 31:
return 1;
default:
return 0;
}
}
u32 GetBottleContaining(u32 id) {
if (id == gSave.stats.bottles[0]) {
return 1;
} else if (id == gSave.stats.bottles[1]) {
return 2;
} else if (id == gSave.stats.bottles[2]) {
return 3;
} else if (id == gSave.stats.bottles[3]) {
return 4;
} else {
return 0;
}
}
void sub_08054524(void) {
u32 bVar1;
bVar1 = gArea.locationIndex;
if (gArea.locationIndex == 0) {
bVar1 = gRoomTransition.player_status.field_0x24[0xa];
}
if (bVar1 > 0x16) {
bVar1 = 0;
}
bVar1 = gUnk_080FE1C6[bVar1];
MemCopy(&gAreaDroptables[bVar1], &gRoomVars.currentAreaDroptable, 0x20);
}
void sub_08054564(void) {
gRoomVars.field_0x2 = 1;
}
void sub_08054570(void) {
gRoomVars.field_0x2 = 0;
}
extern void sub_08000F14(s16*, const s16*, const s16*, const s16*);
extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
ITEM_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_GREEN, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_RED,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
}*/;
int r0, r1, rand, summOdds, item;
u32 r3;
const Droptable *ptr2, *ptr3, *ptr4;
Droptable droptable;
r3 = arg1;
if (gRoomVars.field_0x2 != 1) {
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
ptr4 = NULL;
switch (r3) {
case 1 ... 12:
ptr4 = &gEnemyDroptables[r3];
break;
#ifndef EU
case 24:
case 25:
r0 = gRoomVars.unk2;
ptr4 = &gUnk_0800191C[0];
if (r0) {
ptr4++;
}
break;
#endif
case 16 ... 23:
#ifdef EU
case 24:
#endif
ptr2 = &gObjectDroptables[r3 - 16];
case 15:
ptr4 = &gRoomVars.currentAreaDroptable;
break;
case 0:
default:
break;
}
if (ptr4 != 0) {
if ((r1 = gSave.stats.picolyteType) == 0) {
// nop
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
} else {
#ifdef EU
ptr3 = &gEnemyDroptables[r1 + 9];
#else
ptr3 = &gEnemyDroptables[r1 + 6];
#endif
}
// vector addition, s0 = ptr4 + ptr2 + ptr3
sub_08000F14(droptable.a, ptr4->a, ptr2->a, ptr3->a);
if (gSave.stats.health <= 8) {
droptable.s.hearts += 5;
}
if (gSave.stats.bombCount == 0) {
droptable.s.bombs += 3;
}
if (gSave.stats.arrowCount == 0) {
droptable.s.arrows += 3;
}
if (gSave.stats.rupees <= 10) {
droptable.s.rupee5 += 1;
}
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
r0 = gSave.stats.hasAllFigurines;
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
// don't drop shells anymore
if (r0 != 0) {
ptr2 = &gDroptableModifiers[DROPTABLE_NO_SHELLS];
}
// don't drop kinstones anymore
if (gSave.didAllFusions != 0) {
ptr3 = &gDroptableModifiers[DROPTABLE_NO_KINSTONES];
}
// vector addition, s0 = s0 + ptr2 + ptr3
// resulting values are clamped to be >= 0
// returns sum over s0
summOdds = sub_08000F2C(droptable.a, droptable.a, ptr2->a, ptr3->a);
rand = Random();
item = (rand >> 0x18);
item &= 0xF;
rand = rand % summOdds;
{
u32 r3;
for (r3 = 0, r1 = 0; r3 < 0x10; r3++, item = (item + 1) & 0xF) {
if ((r1 += droptable.a[item]) > rand) {
break;
}
}
}
r1 = gUnk_080FE1B4[item];
if (r1 != ITEM_NONE) {
return CreateItemDrop(arg0, r1, 0);
}
}
}
return ITEM_NONE;
}
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
u32 adjustedParam = itemParameter;
Entity* itemEntity;
switch (itemID) {
case ITEM_ENEMY_BEETLE:
if (!GetInventoryValue(ITEM_SMITH_SWORD)) {
return ITEM_NONE;
}
break;
case ITEM_BOMBS5:
if (!GetInventoryValue(ITEM_BOMBBAG)) {
return ITEM_NONE;
}
break;
case ITEM_ARROWS5:
if (!GetInventoryValue(ITEM_BOW)) {
return ITEM_NONE;
}
break;
case ITEM_SHELLS: {
if (!GetInventoryValue(ITEM_EARTH_ELEMENT)) {
return ITEM_NONE;
}
if (itemParameter == 0) {
adjustedParam = 1;
}
break;
}
case ITEM_KINSTONE:
case ITEM_KINSTONE_GREEN ... ITEM_KINSTONE_RED: {
u32 rand;
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
return ITEM_NONE;
}
if (3 < gRoomVars.filler1[0]) {
return ITEM_NONE;
}
if (itemID != ITEM_KINSTONE) {
adjustedParam = itemID - ITEM_KINSTONE_GREEN;
rand = (Random() & 0x3f);
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)];
if (adjustedParam == 0) {
itemID = ITEM_NONE;
} else {
itemID = ITEM_KINSTONE;
}
}
break;
}
}
if (itemID != ITEM_NONE) {
if (itemID != ITEM_ENEMY_BEETLE) {
itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam);
if (itemEntity != NULL) {
if (arg0 == &gPlayerEntity) {
itemEntity->actionDelay = 1;
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {
itemEntity->direction = arg0->animationState << 3 | 0x80;
itemEntity->speed = 0xc0;
itemEntity->zVelocity = Q_16_16(1.5);
}
}
CopyPosition(arg0, itemEntity);
}
} else {
itemEntity = CreateEnemy(BEETLE, 0);
if (itemEntity != NULL) {
itemEntity->x.HALF.HI = arg0->x.HALF.HI;
itemEntity->y.HALF.HI = arg0->y.HALF.HI;
itemEntity->collisionLayer = arg0->collisionLayer;
UpdateSpriteForCollisionLayer(itemEntity);
}
}
}
return itemID;
}
void Subtask_WorldEvent(void) {
#if !(defined(DEMO_USA) || defined(DEMO_JP))
gUnk_080FE2A0[gMenu.menuType]();
#endif
}
+40
View File
@@ -1,6 +1,8 @@
#include "entity.h"
#include "player.h"
#include "structures.h"
#include "room.h"
#include "common.h"
bool32 sub_0805EC04(Entity* this) {
u32 i = 1;
@@ -48,3 +50,41 @@ void sub_0805ED14(u32 param_1) {
gPlayerState.field_0x98 = 0;
gPlayerState.field_0x9a = 0;
}
ASM_FUNC("asm/non_matching/code_0805EC04/sub_0805ED30.inc", void sub_0805ED30())
u32 sub_0805EE04(u32 param_1) {
u32 result = (s32) - (param_1 & 0x200) >> 0x1f & 0x1000;
if ((param_1 & 0x100) != 0) {
result |= 0x20;
result |= 0x8000;
result |= 0x80;
}
if ((param_1 & 1) != 0) {
result |= 0x8;
result |= 0x41;
}
if ((param_1 & 2) != 0) {
result |= 0x10;
result |= 0x2;
}
if ((param_1 & 0x10) != 0) {
result |= 0x100;
}
if ((param_1 & 0x20) != 0) {
result |= 0x200;
}
if ((param_1 & 0x40) != 0) {
result |= 0x400;
}
if ((param_1 & 0x80) != 0) {
result |= 0x800;
}
return result;
}
void sub_0805EE88(void) {
if ((gRoomTransition.field_0x2c[3] != 0) && ((gRoomTransition.frameCount & 3) == 0)) {
LoadPaletteGroup((((u32)gRoomTransition.frameCount & 0xc) >> 2) + 0x2f);
}
}
-287
View File
@@ -1,287 +0,0 @@
#include "functions.h"
#include "object.h"
#include "save.h"
typedef struct {
u8 unk0[4];
u16 unk4;
u8 unk6[6];
} struct_0811BE48;
typedef struct {
u8 field_0x0;
u8 field_0x1;
} UnkItemStruct;
void* sub_08077C54(UnkItemStruct* unk);
Entity* CreatePlayerBomb(ItemBehavior*, u32);
extern Entity* sub_0805E744();
extern struct_0811BE48 gUnk_0811BE48[];
void sub_08077B98(UnkItemStruct* unk) {
if ((gPlayerState.item == NULL) || (gPlayerState.item->id != 1)) {
gPlayerState.item = sub_08077C54(unk);
}
}
void sub_08077BB8(ItemBehavior* beh) {
UnkItemStruct* unk = (UnkItemStruct*)beh; // @nocheckin
Entity* temp = sub_08077C54(unk);
if (temp != NULL) {
temp->flags = ENT_PERSIST;
}
gPlayerState.item = temp;
}
Entity* sub_08077BD4(ItemBehavior* beh) {
if (sub_08077C94(beh, gUnk_0811BE48[beh->behaviorID].unk0[3]) != 0) {
return NULL;
} else {
return CreatePlayerBomb(beh, gUnk_0811BE48[beh->behaviorID].unk0[3]);
}
}
Entity* sub_08077C0C(ItemBehavior* beh, u32 arg1) {
u8 bVar1;
Entity* pEVar3;
bVar1 = gUnk_0811BE48[arg1].unk0[3];
if (sub_08077C94(beh, bVar1) != 0) {
return NULL;
} else {
return CreatePlayerBomb(beh, bVar1);
}
}
Entity* CreatePlayerBomb(ItemBehavior* beh, u32 subtype) {
Entity* pEVar1;
pEVar1 = CreatePlayerItem(subtype, 0, 0, beh->behaviorID);
if (pEVar1 != NULL) {
*(ItemBehavior**)&pEVar1->parent = beh;
}
return pEVar1;
}
void* sub_08077C54(UnkItemStruct* unk) {
Entity* item;
item = sub_0805E744();
if (item != NULL) {
item->id = gUnk_0811BE48[unk->field_0x1].unk0[3];
item->kind = PLAYER_ITEM;
item->flags = 0xa0;
item->parent = (Entity*)unk;
item->field_0x68.HALF.LO = unk->field_0x1;
AppendEntityToList(item, 2);
}
return item;
}
Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) {
Entity* iVar1;
iVar1 = FindEntityByID(PLAYER_ITEM, gUnk_0811BE48[arg1].unk0[3], 2);
if (iVar1 == NULL) {
return NULL;
}
return iVar1;
}
Entity* CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) {
Entity* ent;
ent = GetEmptyEntity();
if (ent != NULL) {
ent->flags = ENT_COLLIDE;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
ent->field_0x68.HALF.LO = unk;
AppendEntityToList(ent, 2);
}
return ent;
}
Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
Entity* ent;
ent = sub_0805E744();
if (ent != NULL) {
ent->flags = ENT_COLLIDE;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
ent->field_0x68.HALF.LO = unk;
AppendEntityToList(ent, 2);
}
return ent;
}
void sub_08077D38(ItemBehavior* beh, u32 arg2) {
u32 r6;
struct_0811BE48* ptr;
gPlayerState.field_0xa |= 8 >> arg2;
gPlayerState.keepFacing |= 8 >> arg2;
beh->field_0x5[5] = gPlayerEntity.animationState;
if (beh->stateID == 0) {
beh->stateID++;
}
ptr = &gUnk_0811BE48[beh->behaviorID];
if (ptr->unk4) {
if ((gPlayerState.flags & PL_NO_CAP)) {
switch (beh->behaviorID) {
case 0x1b:
r6 = 0x948;
break;
case 1:
r6 = 0x408;
break;
case 0xd:
r6 = 0x40c;
break;
}
sub_08077DF4(beh, r6);
} else {
sub_08077DF4(beh, ptr->unk4);
}
}
beh->field_0xf = ptr->unk6[0];
if (ptr->unk6[1]) {
gPlayerState.field_0x3[1] |= (8 >> arg2) | ((8 >> arg2) << 4);
}
}
typedef struct {
u8 b0 : 4;
u8 b1 : 4;
} PACKED Unk_bitfield;
typedef struct {
u8 unk[16];
} Unk_struct;
void sub_08077DF4(ItemBehavior* beh, u32 arg1) {
Entity* ent = (Entity*)beh; // @nocheckin
*(u16*)&ent->flags = arg1;
if ((arg1 & 0xff) > 0xb8) {
arg1 += ent->type >> 1;
}
gPlayerEntity.spriteIndex = (short)(arg1 >> 8);
InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1);
sub_08077E54(beh);
}
void UpdateItemAnim(ItemBehavior* beh) {
UpdateAnimationSingleFrame(&gPlayerEntity);
sub_08077E54(beh);
}
void sub_08077E3C(ItemBehavior* ent, u32 idx) {
sub_080042BA(&gPlayerEntity, idx);
sub_08077E54(ent);
}
void sub_08077E54(ItemBehavior* beh) {
Entity* ent = (Entity*)beh; // @nocheckin
ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->subAction = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frame;
}
void sub_08077E78(ItemBehavior* arg0, u32 bits) {
u32 not ;
if (bits == 0) {
if (gPlayerState.item != NULL) {
((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6;
gPlayerState.item = NULL;
} else {
gPlayerState.item = NULL;
}
}
not = (8 >> bits);
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not );
not = ~not ;
gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not ;
MemClear(arg0, 0x1c);
}
u32 sub_08077EC8(ItemBehavior* beh) {
Unk_struct* arg0 = (Unk_struct*)beh; // @nocheckin
if ((gPlayerState.sword_state & 8) != 0) {
sub_08077DF4(beh, 0x170);
arg0->unk[7] = 0x28;
arg0->unk[4] = 7;
arg0->unk[15] = 6;
return 1;
} else {
return 0;
}
}
bool32 sub_08077EFC(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90);
}
bool32 sub_08077F10(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x92);
}
bool32 sub_08077F24(ItemBehavior* beh, u32 arg1) {
u32 val;
Stats* stats = &gSave.stats;
u32 id = beh->behaviorID;
if (stats->itemButtons[SLOT_A] == id) {
val = 1;
} else if (stats->itemButtons[SLOT_B] == id) {
val = 2;
} else {
val = 0;
}
return (val & arg1) ? 1 : 0;
}
void sub_08077F50(ItemBehavior* beh, u32 arg1) {
sub_08079184();
sub_08077E78(beh, arg1);
}
u32 sub_08077F64(ItemBehavior* arg0, u32 unk) {
u32 temp;
if (gPlayerState.heldObject == 0) {
sub_08077F50(arg0, unk);
temp = 0;
} else {
temp = 1;
}
return temp;
}
void sub_08077F84(void) {
Entity* obj;
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
sub_0807AA80(&gPlayerEntity);
gPlayerState.jump_status |= 8;
obj = CreateObject(OBJECT_44, 0, 0);
if (obj != NULL) {
obj->x = gPlayerEntity.x;
obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc;
gPlayerEntity.y.HALF.HI -= 0xc;
}
}
}
-77
View File
@@ -1,77 +0,0 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "kinstone.h"
void sub_08078778(Entity* ent) {
sub_0807887C(ent, 1, 0);
}
void sub_08078784(Entity* ent, u32 arg1) {
sub_0807887C(ent, 1, arg1);
}
void sub_08078790(Entity* ent, u32 arg1) {
sub_0807887C(ent, 2, arg1);
}
void sub_0807879C(Entity* ent) {
sub_0807887C(ent, 7, 0);
}
void sub_080787A8(Entity* ent, u32 arg1) {
sub_0807887C(ent, 7, arg1);
}
void sub_080787B4(Entity* ent) {
sub_0807887C(ent, 9, 0);
}
void sub_080787C0(Entity* ent) {
sub_0807887C(ent, 10, 0);
}
void sub_080787CC(Entity* ent) {
sub_0807887C(ent, 5, 0);
}
s32 sub_080787D8(Entity* ent) {
s32 iVar1;
iVar1 = sub_0807887C(ent, 8, 0);
if (iVar1 >= 0) {
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
}
return iVar1;
}
s32 sub_08078800(Entity* ent) {
s32 iVar1;
iVar1 = sub_0807887C(ent, 6, 0);
if (iVar1 >= 0) {
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
}
return iVar1;
}
s32 sub_08078828(Entity* ent) {
s32 iVar1;
iVar1 = sub_0807887C(ent, 3, 0);
if (iVar1 >= 0) {
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
}
return iVar1;
}
void sub_08078850(Entity* arg0, u32 arg1, u32 arg2, void* arg3) {
s32 iVar1;
iVar1 = sub_08078904();
if (iVar1 >= 0) {
gUnk_03003DF0[iVar1].unk[8] = arg1;
gUnk_03003DF0[iVar1].unk[10] = arg2;
*((u32*)&gUnk_03003DF0[iVar1].unk4 + 1) = (u32)arg3;
}
}
+1 -1
View File
@@ -431,7 +431,7 @@ void sub_0801DFB4(Entity* entity, u32 a2, u32 a3, u32 a4) {
gFuseInfo._8 = a3;
gFuseInfo._a = a4;
gFuseInfo.ent = entity;
gFuseInfo._3 = gUnk_03003DF0[0].unk[2];
gFuseInfo._3 = gUnk_03003DF0.unk_2;
if (entity != NULL) {
gFuseInfo._4 = entity->updatePriority;
entity->updatePriority = 2;
+1 -4
View File
@@ -13,14 +13,11 @@ const u8 gSpriteSortBelowTable[];
const u8 gUnk_08114F58[];
const u8 gUnk_08114F38[];
extern u32 gSpritePtrs[];
extern u16 gExtraFrameOffsets[];
extern s8 gUnk_08126EE4[];
extern const u16 gUnk_080046A4[];
extern const u16 gUnk_080047F6[];
void sub_080027EA(Entity*, u32, u32);
u32 sub_0806F58C(Entity*, Entity*);
u32 sub_0806FCA0(Entity*, Entity*);
void UnloadHitbox(Entity*);
@@ -662,7 +659,7 @@ bool32 sub_0807007C(struct_gUnk_020000C0* this, u32 param_2) {
if (ptr1->unk_01 == 0xff)
return 0;
spritePtr = &gSpritePtrs[ptr1->unk_02 * 4];
spritePtr = &((u32*)gSpritePtrs)[ptr1->unk_02 * 4];
ptr2 = (u8*)(spritePtr[1]);
if (ptr2 == 0)
return 0;
+1 -1
View File
@@ -254,7 +254,7 @@ void sub_08031C58(Entity* this) {
void sub_08031D70(Entity* this) {
GetNextFrame(this);
if (--this->actionDelay == '\0') {
if (--this->actionDelay == 0) {
this->action = 7;
COLLISION_OFF(this);
this->actionDelay = 5;
+37
View File
@@ -10,6 +10,8 @@
#include "enemy.h"
#include "functions.h"
#include "hitbox.h"
#include "common.h"
#include "flags.h"
typedef struct {
/*0x00*/ Entity base;
@@ -48,6 +50,41 @@ bool32 sub_080305BC(ArmosEntity*);
void sub_080307D4(ArmosEntity*);
void sub_08030590(ArmosEntity*);
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));
}
}
void sub_080300E8(void) {
if (gRoomTransition.armos_data.field_0xae != 0xff) {
const u16* ptr = &gRoomTransition.armos_data.data[gRoomTransition.armos_data.field_0xae * 2];
gPlayerEntity.x.HALF.HI = ptr[0];
gPlayerEntity.y.HALF.HI = ptr[1] + 0xc;
gRoomTransition.armos_data.field_0xae = 0xff;
}
}
void sub_08030118(u32 param_1) {
if (((s32)(u32)gRoomTransition.armos_data.field_0xac >> (param_1)&1) != 0) {
SetLocalFlagByBank(0x300, param_1 + 0x67);
} else {
ClearLocalFlagByBank(0x300, param_1 + 0x67);
}
}
void sub_08030150(ArmosEntity* this) {
gRoomTransition.armos_data.field_0xac =
(gRoomTransition.armos_data.field_0xac & ~(1 << this->unk_80)) | (this->unk_84 << this->unk_80);
gRoomTransition.armos_data.data[(u32)this->unk_80 * 2] = super->x.HALF.HI;
gRoomTransition.armos_data.data[(u32)this->unk_80 * 2 + 1] = super->y.HALF.HI;
}
void Armos(ArmosEntity* this) {
EnemyFunctionHandler(super, (EntityActionArray)&gUnk_080CE124);
SetChildOffset(super, 0, 1, -0x10);
+21 -21
View File
@@ -39,7 +39,7 @@ struct SalesOffering {
u16 price;
u16 field_0x4;
u16 field_0x6;
u8 field_0x8;
u8 offeredItem; /**< @see Item */
u8 field_0x9;
u16 field_0xa;
};
@@ -261,7 +261,7 @@ void sub_08028CE8(Entity* this) {
subtype = gUnk_080CC9C0[Random() & 7];
}
CreateItemEntity(offer->field_0x8, subtype, 0);
CreateItemEntity(offer->offeredItem, subtype, 0);
this->action = 6;
this->actionDelay = 4;
@@ -272,12 +272,12 @@ void sub_08028CE8(Entity* this) {
#endif
return;
case 1:
CreateItemEntity(offer->field_0x8, offer->field_0x9, 0);
CreateItemEntity(offer->offeredItem, offer->field_0x9, 0);
this->actionDelay = 4;
sub_0802922C(this);
return;
case 2:
CreateItemEntity(offer->field_0x8, offer->field_0x9, 0);
CreateItemEntity(offer->offeredItem, offer->field_0x9, 0);
this->actionDelay = 8;
sub_0802922C(this);
return;
@@ -466,18 +466,18 @@ void sub_080290FC(Entity* this) {
bool32 sub_0802915C(Entity* this) {
const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD;
switch (offer->field_0x8) {
case 0x44:
if (GetInventoryValue(0x44) == 0)
switch (offer->offeredItem) {
case ITEM_GRIP_RING:
if (GetInventoryValue(ITEM_GRIP_RING) == 0)
return TRUE;
break;
case 0x1c:
case ITEM_BOTTLE1:
if (CheckGlobalFlag(AKINDO_BOTTLE_SELL) == 0)
return TRUE;
break;
case 0x5c:
case 0x6c:
case 0x6f:
case ITEM_KINSTONE:
case ITEM_BOMBS10:
case ITEM_ARROWS30:
return TRUE;
}
return FALSE;
@@ -487,13 +487,13 @@ bool32 sub_08029198(const struct SalesOffering* offer) {
u32 tmp;
if ((offer->field_0x0 & 0xfc) != 0xc) {
switch (offer->field_0x8) {
case 0x1c:
switch (offer->offeredItem) {
case ITEM_BOTTLE1:
tmp = CheckGlobalFlag(AKINDO_BOTTLE_SELL);
break;
case 0x9:
case 0x44:
tmp = GetInventoryValue(offer->field_0x8);
case ITEM_BOW:
case ITEM_GRIP_RING:
tmp = GetInventoryValue(offer->offeredItem);
break;
default:
return 0;
@@ -512,12 +512,12 @@ bool32 sub_08029198(const struct SalesOffering* offer) {
bool32 sub_080291DC(Entity* this) {
const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD;
switch (offer->field_0x8) {
case 0x6c:
switch (offer->offeredItem) {
case ITEM_BOMBS10:
if (gBombBagSizes[gSave.stats.bombBagType] <= gSave.stats.bombCount)
return TRUE;
break;
case 0x6f:
case ITEM_ARROWS30:
if (gQuiverSizes[gSave.stats.quiverType] <= gSave.stats.arrowCount)
return TRUE;
break;
@@ -532,8 +532,8 @@ NONMATCH("asm/non_matching/businessScrub/sub_0802922C.inc", void sub_0802922C(En
this->action = 6;
this->field_0x80.HALF.HI = 0;
switch (offer->field_0x8) {
case 0x1c:
switch (offer->offeredItem) {
case ITEM_BOTTLE1:
SetGlobalFlag(AKINDO_BOTTLE_SELL);
break;
}
-15
View File
@@ -1,15 +0,0 @@
#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));
}
}
+12 -10
View File
@@ -233,20 +233,21 @@ END_NONMATCH
void sub_080281A0(Entity* this) {
this->field_0xf = 0x19;
if (sub_080281E0(0xe)) {
this->field_0x80.HALF.LO = 0xe;
if (sub_080281E0(ITEM_MIRROR_SHIELD)) {
this->field_0x80.HALF.LO = ITEM_MIRROR_SHIELD;
MessageFromTarget(0x578);
} else if (sub_080281E0(0xd)) {
this->field_0x80.HALF.LO = 0xd;
} else if (sub_080281E0(ITEM_SHIELD)) {
this->field_0x80.HALF.LO = ITEM_SHIELD;
MessageFromTarget(0x578);
} else {
ModHealth(-1);
}
}
bool32 sub_080281E0(u32 param_1) {
/** Can steal item */
bool32 sub_080281E0(u32 item) {
bool32 ret = FALSE;
if (GetInventoryValue(param_1) == 1) {
if (GetInventoryValue(item) == 1) {
if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
gSave.stats.itemButtons[SLOT_A] = 0;
}
@@ -255,18 +256,19 @@ bool32 sub_080281E0(u32 param_1) {
gSave.stats.itemButtons[SLOT_B] = 0;
}
sub_0807CAA0(param_1, 0);
SetInventoryValue(item, 0);
ret = TRUE;
}
return ret;
}
void sub_08028224(u32 param_1) {
/** Return stolen item */
void sub_08028224(u32 item) {
#ifdef EU
CreateItemEntity(param_1, 0, 1);
CreateItemEntity(item, 0, 1);
#else
sub_080A7C18(param_1, 0, 1);
sub_080A7C18(item, 0, 1);
#endif
MessageFromTarget(0x579);
}
+1 -1
View File
@@ -41,7 +41,7 @@ void RockChuchu_OnCollision(Entity* this) {
case 0x18:
case 0x19:
case 0x1a:
if ((gPlayerState.field_0xac & 8) == 0)
if ((gPlayerState.skills & SKILL_ROCK_BREAKER) == 0)
break;
case 0x16:
case 0x1c:
+1 -1
View File
@@ -252,7 +252,7 @@ NONMATCH("asm/non_matching/spearMoblin/sub_08028604.inc", void sub_08028604(Enti
} else {
u32 iVar3 = sub_08049EE4(this);
u32 uVar1;
if (this->field_0x82.HALF.HI == '\0') {
if (this->field_0x82.HALF.HI == 0) {
uVar1 = gUnk_080CC7C0[Random() & 0xf];
} else {
uVar1 = gUnk_080CC7C0[Random() & 7];
+1 -1
View File
@@ -371,7 +371,7 @@ void sub_08033E1C(SpinyBeetleEntity* this) {
}
void SpinyBeetle_SetHitType(SpinyBeetleEntity* this) {
if ((gPlayerState.field_0xac & 8)) {
if ((gPlayerState.skills & SKILL_ROCK_BREAKER)) {
super->hitType = 0x95;
} else {
super->hitType = 0x63;
+2 -1
View File
@@ -8,6 +8,7 @@
#include "global.h"
#include "enemy.h"
#include "object.h"
#include "item.h"
static bool32 ShouldSpawnTreeItem(Entity*);
@@ -42,7 +43,7 @@ void TreeItem(Entity* this) {
if (this->field_0x68.HALF.LO > FAIRY_INDEX) {
DeleteThisEntity();
}
if (this->field_0x68.HALF.LO < FAIRY_INDEX && GetInventoryValue(0x67 /*KinstoneBag*/) == 0) {
if (this->field_0x68.HALF.LO < FAIRY_INDEX && GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
this->field_0x68.HALF.LO = FAIRY_INDEX;
}
}
+1 -1
View File
@@ -1078,7 +1078,7 @@ void sub_080409B0(Entity* this) {
InitScreenShake(0xc, 1);
SoundReq(SFX_BOSS_HIT);
}
if ((this->bitfield == 0x8a) && (gPlayerState.field_0xa0[0] == 5)) {
if ((this->bitfield == 0x8a) && (gPlayerState.chargeState.action == 5)) {
this->health = 0xc0;
}
}
+5 -4
View File
@@ -14,6 +14,7 @@
#include "object.h"
#include "functions.h"
#include "subtask.h"
#include "item.h"
// copy, erase, start
#define NUM_FILE_OPERATIONS 3
@@ -485,7 +486,7 @@ void sub_08050A64(u32 idx) {
gOamCmd._8 = 0x400;
// Draw the save file's obtained elements.
if (GetInventoryValue(0x40)) {
if (GetInventoryValue(ITEM_EARTH_ELEMENT)) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x36;
#ifdef EU
@@ -494,7 +495,7 @@ void sub_08050A64(u32 idx) {
DrawDirect(0x145, 0x24);
#endif
}
if (GetInventoryValue(0x41)) {
if (GetInventoryValue(ITEM_FIRE_ELEMENT)) {
gOamCmd.x = 0x96;
gOamCmd.y = 0x3D;
#ifdef EU
@@ -503,7 +504,7 @@ void sub_08050A64(u32 idx) {
DrawDirect(0x145, 0x22);
#endif
}
if (GetInventoryValue(0x42)) {
if (GetInventoryValue(ITEM_WATER_ELEMENT)) {
gOamCmd.x = 0xAE;
gOamCmd.y = 0x3D;
#ifdef EU
@@ -512,7 +513,7 @@ void sub_08050A64(u32 idx) {
DrawDirect(0x145, 0x23);
#endif
}
if (GetInventoryValue(0x43)) {
if (GetInventoryValue(ITEM_WIND_ELEMENT)) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x44;
#ifdef EU
+4 -3
View File
@@ -2,6 +2,7 @@
#include "room.h"
#include "flags.h"
#include "area.h"
#include "save.h"
const u16 gLocalFlagBanks[] = {
FLAG_BANK_G, FLAG_BANK_0, FLAG_BANK_1, FLAG_BANK_2, FLAG_BANK_3, FLAG_BANK_4, FLAG_BANK_5,
@@ -40,7 +41,7 @@ u32 CheckRoomFlag(u32 flag) {
}
u32 CheckLocalFlagsByBank(u32 offset, u32 flag, u32 length) {
return CheckBits(&gGlobalFlags, offset + flag, length);
return CheckBits(gSave.flags, offset + flag, length);
}
u32 CheckLocalFlags(u32 flag, u32 length) {
@@ -57,7 +58,7 @@ u32 CheckRoomFlags(u32 flag, u32 length) {
void SetLocalFlagByBank(u32 offset, u32 flag) {
if (flag != 0) {
WriteBit(&gGlobalFlags, offset + flag);
WriteBit(gSave.flags, offset + flag);
}
}
@@ -95,7 +96,7 @@ void SetRoomFlag(u32 flag) {
}
void ClearLocalFlagByBank(u32 offset, u32 flag) {
ClearBit(&gGlobalFlags, offset + flag);
ClearBit(gSave.flags, offset + flag);
}
void ClearLocalFlag(u32 flag) {
+900 -24
View File
@@ -6,24 +6,30 @@
*/
#include "global.h"
#include "asm.h"
#include "sound.h"
#include "screen.h"
#include "entity.h"
#include "player.h"
#include "room.h"
#include "main.h"
#include "flags.h"
#include "save.h"
#include "common.h"
#include "fileselect.h"
#include "menu.h"
#include "functions.h"
#include "area.h"
#include "message.h"
#include "asm.h"
#include "common.h"
#include "droptables.h"
#include "enemy.h"
#include "entity.h"
#include "fileselect.h"
#include "flags.h"
#include "functions.h"
#include "game.h"
#include "item.h"
#include "itemMetaData.h"
#include "main.h"
#include "menu.h"
#include "message.h"
#include "object.h"
#include "player.h"
#include "room.h"
#include "save.h"
#include "screen.h"
#include "sound.h"
#include "subtask.h"
#include "itemMetaData.h"
#include "player.h"
// Game task
@@ -197,6 +203,68 @@ typedef struct {
} CutsceneData;
static const CutsceneData sCutsceneData[];
extern u8 gUnk_0200AF13;
extern u8 gUnk_0200AF14;
extern u8 gUnk_080FE1C6[];
extern void (*const gUnk_080FE2AC[])(void);
/** @see Item */
void ForceEquipItem(u32, u32);
extern void SetInventoryValue(u32, u32);
extern u8 gUnk_080FE1DD[];
extern void (*const gUnk_080FE2A0[])(void);
extern void (*const gUnk_080FCBB4[])(void);
extern const EntityData gUnk_080FCB94[];
void sub_08052004(void);
extern void (*const gUnk_080FCCFC[])(void);
extern void (*const gUnk_080FCD38[])(void);
extern const EntityData gUnk_080FCC54[];
void sub_08051FF0(void);
extern void (*const gUnk_080FCD40[])(void);
extern const EntityData gUnk_080FCBC4[];
void sub_08051F78(void);
extern const EntityData gUnk_080FCC14[];
extern void DeleteAllEntities(void);
extern void (*const gUnk_080FCDD4[])(void);
extern const EntityData gUnk_080FCD84[];
extern void (*const gUnk_080FCEB0[])(void);
extern const EntityData gUnk_080FCDE0[];
extern void (*const gUnk_080FCEEC[])(void);
extern const EntityData gUnk_080FCEBC[];
extern void (*const gUnk_080FCEF8[])(void);
extern void (*const gUnk_080FCFA4[])(void);
extern void* GetRoomProperty(u32, u32, u32);
extern void (*const gUnk_080FD108[])(void);
extern const EntityData* gUnk_080FCFB8[];
extern void (*const gUnk_080FD138[])(void);
extern const u16 gUnk_080FD964[];
void GameTask(void) {
static GameState* const sStates[] = {
GameTask_Transition,
@@ -586,7 +654,7 @@ static void AuxCutscene_Exit(void) {
}
}
void sub_08051F78(u32 a1, u32 a2, u32 a3, u32 a4) {
void sub_08051F78(void) {
u32 idx = gUnk_02032EC0.field_0x3;
const CutsceneData* p = &sCutsceneData[idx];
sub_08051F9C(p->area, p->room, p->x, p->y);
@@ -931,24 +999,24 @@ static void InitializePlayer(void) {
pl->z.HALF.HI = -0xc0;
break;
case PL_SPAWN_STEP_IN:
gPlayerState.field_0x34[4] = 16;
gPlayerState.field_0x38 = 16;
pl->direction = Direction8FromAnimationState(gRoomTransition.player_status.start_anim);
case PL_SPAWN_WALKING:
pl->speed = 224;
break;
case PL_SPAWN_STAIRS_ASCEND:
case PL_SPAWN_STAIRS_DESCEND:
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x34[5] = gRoomTransition.player_status.spawn_type;
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = gRoomTransition.player_status.spawn_type;
break;
case PL_SPAWN_PARACHUTE_FORWARD:
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x38 = 1;
break;
case PL_SPAWN_PARACHUTE_UP:
gPlayerState.field_0x34[4] = 3;
gPlayerState.field_0x38 = 3;
break;
case PL_SPAWN_FAST_TRAVEL:
gPlayerState.field_0x34[4] = 4;
gPlayerState.field_0x38 = 4;
}
pl->kind = PLAYER;
@@ -1716,11 +1784,11 @@ static void ResetTmpFlags(void) {
if (!CheckGlobalFlag(WATERBEAN_PUT))
ClearGlobalFlag(WATERBEAN_OUT);
if (!GetInventoryValue(0x40u))
if (!GetInventoryValue(ITEM_EARTH_ELEMENT))
ClearGlobalFlag(LV1_CLEAR);
if (!GetInventoryValue(0x41u))
if (!GetInventoryValue(ITEM_FIRE_ELEMENT))
ClearGlobalFlag(LV2_CLEAR);
if (!GetInventoryValue(0x42u))
if (!GetInventoryValue(ITEM_WATER_ELEMENT))
ClearGlobalFlag(LV4_CLEAR);
}
@@ -1730,3 +1798,811 @@ static void ClearFlagArray(const u16* p) {
for (i = p; i[0] != 0xFFFF; i += 2)
ClearLocalFlagByBank(i[0], i[1]);
}
void CutsceneMain_Init(void) {
gUnk_080FCBB4[gMenu.overlayType]();
}
void sub_080535AC(void) {
gMenu.overlayType = 1;
gMenu.transitionTimer = 0x78;
gUnk_02032EC0.field_0x6 = 1;
gUpdateVisibleTiles = 1;
gScreen.lcd.displayControl &= 0xfeff;
LoadRoomEntityList((EntityData*)gUnk_080FCB94);
SetFade(6, 8);
}
void sub_080535F4(void) {
if (gFadeControl.active == 0) {
ResetSystemPriority();
gMenu.overlayType = 2;
}
}
void nullsub_481(void) {
}
void sub_08053618(void) {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
sub_08052004();
}
}
void sub_08053634(void) {
gUnk_02032EC0.nextToLoad = 3;
MessageInitialize();
}
void sub_08053648(void) {
Entity* obj = CreateObject(SMOKE, 0, 0);
if (obj != NULL) {
obj->x.HALF.HI = gRoomControls.origin_x + 0x2d0;
obj->y.HALF.HI = gRoomControls.origin_y + 0x148;
}
}
void sub_0805367C(void) {
gMenu.overlayType++;
}
void sub_0805368C(void) {
Entity* entity = FindEntityByID(OBJECT, HOUSE_DOOR_INT, 6);
if (entity != NULL) {
DeleteEntity(entity);
SoundReq(SFX_F0);
}
}
void sub_080536A8(void) {
sub_080A71C4(5, 5, 4, 0x10);
}
void sub_080536B8(void) {
sub_080A71C4(5, 3, 4, 4);
SetFade(5, 0x100);
}
void sub_080536D4(void) {
gUnk_080FCCFC[gMenu.overlayType]();
}
void sub_080536F0(void) {
gUnk_080FCD38[gMenu.overlayType]();
}
void sub_0805370C(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
sub_08051FF0();
LoadRoomEntityList((EntityData*)gUnk_080FCC54);
SetFade(4, 0x10);
}
void sub_0805373C(void) {
gUnk_080FCD40[gMenu.overlayType]();
}
ASM_FUNC("asm/non_matching/game/sub_08053758.inc", void sub_08053758())
ASM_FUNC("asm/non_matching/game/sub_08053800.inc", void sub_08053800())
ASM_FUNC("asm/non_matching/game/sub_08053894.inc", void sub_08053894())
ASM_FUNC("asm/non_matching/game/sub_08053904.inc", void sub_08053904())
void sub_08053974(void) {
if (gFadeControl.active == 0) {
InitFade();
DispReset(1);
SetBGDefaults();
sub_08051F78();
LoadRoomEntityList((EntityData*)&gUnk_080FCBC4);
SetFade(5, 0x100);
gMenu.overlayType++;
}
}
void nullsub_482(void) {
}
void sub_080539BC(void) {
SetBGDefaults();
DeleteAllEntities();
sub_08051F9C(0x22, 0x11, 0, 0);
sub_0804B0B0(0x22, 0x11);
LoadRoomEntityList((EntityData*)&gUnk_080FCC14);
gMenu.overlayType++;
}
void sub_080539F4(void) {
if (gFadeControl.active == 0) {
DispReset(1);
gMenu.overlayType++;
gMenu.transitionTimer = 0x3c;
}
}
void sub_08053A1C(void) {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
gMenu.overlayType++;
gMenu.transitionTimer = 8;
MessageFromTarget(0xf07);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 8;
SetFade(4, 8);
}
}
void sub_08053A5C(void) {
if (((gMessage.doTextBox & 0x7f) == 0) && --gMenu.transitionTimer == 0) {
gMenu.overlayType++;
SetFade(5, 8);
}
}
void sub_08053A90(void) {
if (gFadeControl.active == 0) {
gUnk_02032EC0.nextToLoad = 3;
SetBGDefaults();
}
}
void sub_08053AB0(void) {
gUnk_080FCDD4[gMenu.overlayType]();
}
void sub_08053ACC(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
sub_08051FF0();
LoadRoomEntityList((EntityData*)&gUnk_080FCD84);
SetFade(5, 0x100);
}
void sub_08053B00(void) {
gMenu.overlayType++;
}
void sub_08053B10(void) {
if (CheckRoomFlag(1)) {
gMenu.menuType++;
DispReset(1);
SetFade(4, 0x100);
}
}
void sub_08053B3C(void) {
sub_080A71C4(5, 4, 5, 0x100);
SetFade(5, 0x100);
}
void sub_08053B58(void) {
gUnk_080FCEB0[gMenu.overlayType]();
}
void sub_08053B74(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
LoadRoomEntityList((EntityData*)&gUnk_080FCDE0);
ResetSystemPriority();
ResetEntityPriority();
SetFade(5, 0x100);
}
void sub_08053BAC(void) {
gMenu.overlayType++;
}
void sub_08053BBC(void) {
if (CheckRoomFlag(0)) {
gMenu.menuType++;
DispReset(1);
SetFade(4, 0x100);
}
}
void sub_08053BE8(void) {
sub_080A71C4(5, 2, 5, 0x100);
SetFade(5, 0x100);
}
void sub_08053C04(void) {
gUnk_080FCEEC[gMenu.overlayType]();
}
void sub_08053C20(void) {
gMenu.overlayType = 1;
gMenu.transitionTimer = 0x78;
gUpdateVisibleTiles = 1;
sub_08051FF0();
sub_0805B4D0(4);
LoadRoomEntityList((EntityData*)&gUnk_080FCEBC);
SetFade(4, 0x10);
SoundReq(BGM_FIGHT_THEME2);
}
void nullsub_483(void) {
}
void sub_08053C60(void) {
SetFade(5, 2);
SoundReq(SFX_SUMMON);
SoundReq(SONG_STOP_BGM);
SetTask(3);
}
void sub_08053C84(void) {
gMenu.overlayType = 2;
}
void CutsceneMain_Exit(void) {
gUnk_080FCEF8[gMenu.field_0x3]();
}
void sub_08053CAC(void) {
gUnk_080FCFA4[gMenu.overlayType]();
}
ASM_FUNC("asm/non_matching/game/sub_08053CC8.inc", void sub_08053CC8())
void sub_08053D34(void) {
if (gMenu.field_0xa != 0) {
gMenu.field_0xa = 0;
if (CheckLocalFlagByBank(0x680, 0x3d)) {
SetTileType(0x74, 0xc4, 1);
}
if (CheckLocalFlagByBank(0x680, 0x3e)) {
SetTileType(0x74, 0xcc, 1);
}
}
if (gFadeControl.active == 0) {
gMenu.transitionTimer = 0x78;
gMenu.overlayType++;
}
}
void sub_08053D90(void) {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
gMenu.overlayType++;
SetFadeInverted(0x10);
}
}
void sub_08053DB4(void) {
if (gFadeControl.active == 0) {
u8* ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[4], gMenu.field_0xc[5]);
sub_0807C740();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[6] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[7] + gRoomControls.scroll_y;
LoadRoomEntityList(*(EntityData**)ptr);
LoadRoomEntityList((EntityData*)GetRoomProperty(ptr[4], ptr[5], 1));
LoadRoomEntityList((EntityData*)GetRoomProperty(ptr[4], ptr[5], 2));
gMenu.transitionTimer = 0x78;
gMenu.overlayType++;
SetFadeInverted(0x10);
}
}
void sub_08053E30(void) {
if ((gFadeControl.active == 0) && --gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08053E58(void) {
gUnk_080FD108[gMenu.overlayType]();
}
void sub_08053E74(void) {
const EntityData** ptr = gUnk_080FCFB8;
gMenu.field_0xc = (u8*)ptr;
LoadRoomEntityList((EntityData*)ptr[0]);
gMenu.transitionTimer = 0x78;
gMenu.field_0xa = 0x3c;
gMenu.overlayType++;
gScreen.lcd.displayControl &= 0xfeff;
gUpdateVisibleTiles = 1;
SetMinPriority(1);
SetFade(4, 8);
}
void sub_08053EC4(void) {
EntityData** data;
if ((gFadeControl.active == 0) && (--gMenu.field_0xa == 0)) {
data = (EntityData**)(gMenu.field_0xc + 4);
gMenu.field_0xc += 0xc;
LoadRoomEntityList(*data);
gMenu.overlayType++;
}
}
void sub_08053EFC(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.overlayType++;
SetFadeInverted(8);
}
}
void sub_08053F20(void) {
u8* ptr;
if (gFadeControl.active == 0) {
DeleteAllEntities();
ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[8], gMenu.field_0xc[9]);
sub_0807C740();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[10] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[0xb] + gRoomControls.scroll_y;
LoadRoomEntityList(*(EntityData**)ptr);
gMenu.transitionTimer = 0x78;
gMenu.field_0xa = 0x3c;
gMenu.overlayType++;
SetFadeInverted(8);
}
}
void sub_08053F88(void) {
if ((gFadeControl.active == 0) && --gMenu.transitionTimer == 0) {
gMenu.menuType++;
ResetEntityPriority();
}
}
void CutsceneMain_Update(void) {
gUnk_080FD138[gMenu.field_0x3]();
}
u32 GetSaleItemConfirmMessageID(u32 item) {
const u16* ptr = &gUnk_080FD964[item * 4];
return ptr[2];
}
s32 GetItemPrice(u32 item) {
const u16* ptr = &gUnk_080FD964[item * 4];
return ptr[0];
}
ASM_FUNC("asm/non_matching/game/GiveItem.inc", void GiveItem(u32 a, u32 b))
// TODO Adapt ItemMetaData struct
void sub_08054288(s32 param_1) {
const ItemMetaData* ptr1 = gItemMetaData;
u16* ptr = (u16*)&((ptr1)[param_1]);
MessageFromTarget(ptr[3]);
}
u32 sub_0805429C(s32 param_1) {
const ItemMetaData* ptr1 = gItemMetaData;
u16* ptr = (u16*)&((ptr1)[param_1]);
return ptr[2];
}
u32 sub_080542AC(u32 param_1) {
const ItemMetaData* ptr1 = gItemMetaData;
u8* ptr = (u8*)&((ptr1)[param_1]);
return ptr[3] & 1;
}
void ModShells(s32 shells) {
if (shells == 0) {
shells = 1;
}
shells += gSave.stats.shells;
if (shells < 0) {
shells = 0;
} else if (999 < shells) {
shells = 999;
}
gSave.stats.shells = shells;
}
void ModBombs(s32 bombs) {
s32 bombCount = bombs;
s32 bagSize;
bombCount += gSave.stats.bombCount;
bagSize = gBombBagSizes[gSave.stats.bombBagType];
if (bombCount < 0) {
bombCount = 0;
} else if (bagSize < bombCount) {
bombCount = bagSize;
}
gSave.stats.bombCount = bombCount;
}
void ModArrows(s32 arrows) {
s32 quiverSize;
s32 arrowCount = arrows;
arrowCount += gSave.stats.arrowCount;
quiverSize = gQuiverSizes[gSave.stats.quiverType];
if (arrowCount < 0) {
arrowCount = 0;
} else if (quiverSize < arrowCount) {
arrowCount = quiverSize;
}
gSave.stats.arrowCount = arrowCount;
}
/**
* @brief Returns the slot the item is equipped in.
*
* 0: A
* 1: B
* 2: Not equipped
*/
u32 IsItemEquipped(u32 itemID) {
u32 itemSlot;
if (itemID == gSave.stats.itemButtons[SLOT_A])
itemSlot = 0;
else if (itemID == gSave.stats.itemButtons[SLOT_B])
itemSlot = 1;
else
itemSlot = 2;
return itemSlot;
}
void PutItemOnSlot(u32 itemID) {
u32 itemSlot;
u32 itemID2 = itemID;
if (itemID2 < 0x47) {
SetInventoryValue(0, 1);
}
if (itemID2 - 1 < 0x1f) {
itemSlot = 2;
if (gSave.stats.itemButtons[SLOT_A] == 0) {
itemSlot = 0;
} else if (gSave.stats.itemButtons[SLOT_B] == 0) {
itemSlot = 1;
}
if (itemSlot == 2) {
u32 temp = gItemMetaData[itemID2].menuSlot;
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) {
itemSlot = 0;
} else {
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) {
itemSlot = 1;
}
}
if (itemSlot == 2) {
return;
}
}
ForceEquipItem(itemID2, itemSlot);
}
}
void ForceEquipItem(u32 itemID, u32 itemSlot) {
u32 otherItem;
u32 otherItemIndex;
u32 replacedItem;
if ((itemID - 1 < 0x1f) && (itemSlot < 2)) {
otherItemIndex = itemSlot == 0;
replacedItem = gSave.stats.itemButtons[itemSlot];
otherItem = gSave.stats.itemButtons[otherItemIndex];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemID].menuSlot) {
otherItem = replacedItem;
}
gSave.stats.itemButtons[itemSlot] = itemID;
gSave.stats.itemButtons[otherItemIndex] = otherItem;
gUnk_0200AF00.filler0[0x13] = 0x7f;
gUnk_0200AF00.filler0[0x14] = 0x7f;
}
}
u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
if (bottleIndex > 3) {
bottleIndex = 0;
if (gSave.stats.bottles[0] != 0x20) {
do {
bottleIndex++;
if (bottleIndex > 3) {
return bottleIndex;
}
} while (gSave.stats.bottles[bottleIndex] != 0x20);
}
if (bottleIndex > 3) {
return bottleIndex;
}
}
gSave.stats.bottles[bottleIndex] = itemID;
return bottleIndex;
}
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 FALSE;
}
}
bool32 ItemIsShield(u32 id) {
switch (id) {
case 13:
case 14:
return 1;
default:
return 0;
}
}
bool32 ItemIsBottle(u32 id) {
switch (id) {
case 28:
case 29:
case 30:
case 31:
return 1;
default:
return 0;
}
}
u32 GetBottleContaining(u32 id) {
if (id == gSave.stats.bottles[0]) {
return 1;
} else if (id == gSave.stats.bottles[1]) {
return 2;
} else if (id == gSave.stats.bottles[2]) {
return 3;
} else if (id == gSave.stats.bottles[3]) {
return 4;
} else {
return 0;
}
}
void sub_08054524(void) {
u32 bVar1;
bVar1 = gArea.locationIndex;
if (gArea.locationIndex == 0) {
bVar1 = gRoomTransition.player_status.field_0x24[0xa];
}
if (bVar1 > 0x16) {
bVar1 = 0;
}
bVar1 = gUnk_080FE1C6[bVar1];
MemCopy(&gAreaDroptables[bVar1], &gRoomVars.currentAreaDroptable, 0x20);
}
void sub_08054564(void) {
gRoomVars.field_0x2 = 1;
}
void sub_08054570(void) {
gRoomVars.field_0x2 = 0;
}
extern void sub_08000F14(s16*, const s16*, const s16*, const s16*);
extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
ITEM_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_GREEN, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_RED,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
}*/;
int r0, r1, rand, summOdds, item;
u32 r3;
const Droptable *ptr2, *ptr3, *ptr4;
Droptable droptable;
r3 = arg1;
if (gRoomVars.field_0x2 != 1) {
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
ptr4 = NULL;
switch (r3) {
case 1 ... 12:
ptr4 = &gEnemyDroptables[r3];
break;
#ifndef EU
case 24:
case 25:
r0 = gRoomVars.unk2;
ptr4 = &gUnk_0800191C[0];
if (r0) {
ptr4++;
}
break;
#endif
case 16 ... 23:
#ifdef EU
case 24:
#endif
ptr2 = &gObjectDroptables[r3 - 16];
case 15:
ptr4 = &gRoomVars.currentAreaDroptable;
break;
case 0:
default:
break;
}
if (ptr4 != 0) {
if ((r1 = gSave.stats.picolyteType) == 0) {
// nop
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
} else {
#ifdef EU
ptr3 = &gEnemyDroptables[r1 + 9];
#else
ptr3 = &gEnemyDroptables[r1 + 6];
#endif
}
// vector addition, s0 = ptr4 + ptr2 + ptr3
sub_08000F14(droptable.a, ptr4->a, ptr2->a, ptr3->a);
if (gSave.stats.health <= 8) {
droptable.s.hearts += 5;
}
if (gSave.stats.bombCount == 0) {
droptable.s.bombs += 3;
}
if (gSave.stats.arrowCount == 0) {
droptable.s.arrows += 3;
}
if (gSave.stats.rupees <= 10) {
droptable.s.rupee5 += 1;
}
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
r0 = gSave.stats.hasAllFigurines;
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
// don't drop shells anymore
if (r0 != 0) {
ptr2 = &gDroptableModifiers[DROPTABLE_NO_SHELLS];
}
// don't drop kinstones anymore
if (gSave.didAllFusions != 0) {
ptr3 = &gDroptableModifiers[DROPTABLE_NO_KINSTONES];
}
// vector addition, s0 = s0 + ptr2 + ptr3
// resulting values are clamped to be >= 0
// returns sum over s0
summOdds = sub_08000F2C(droptable.a, droptable.a, ptr2->a, ptr3->a);
rand = Random();
item = (rand >> 0x18);
item &= 0xF;
rand = rand % summOdds;
{
u32 r3;
for (r3 = 0, r1 = 0; r3 < 0x10; r3++, item = (item + 1) & 0xF) {
if ((r1 += droptable.a[item]) > rand) {
break;
}
}
}
r1 = gUnk_080FE1B4[item];
if (r1 != ITEM_NONE) {
return CreateItemDrop(arg0, r1, 0);
}
}
}
return ITEM_NONE;
}
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
u32 adjustedParam = itemParameter;
Entity* itemEntity;
switch (itemID) {
case ITEM_ENEMY_BEETLE:
if (!GetInventoryValue(ITEM_SMITH_SWORD)) {
return ITEM_NONE;
}
break;
case ITEM_BOMBS5:
if (!GetInventoryValue(ITEM_BOMBBAG)) {
return ITEM_NONE;
}
break;
case ITEM_ARROWS5:
if (!GetInventoryValue(ITEM_BOW)) {
return ITEM_NONE;
}
break;
case ITEM_SHELLS: {
if (!GetInventoryValue(ITEM_EARTH_ELEMENT)) {
return ITEM_NONE;
}
if (itemParameter == 0) {
adjustedParam = 1;
}
break;
}
case ITEM_KINSTONE:
case ITEM_KINSTONE_GREEN ... ITEM_KINSTONE_RED: {
u32 rand;
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
return ITEM_NONE;
}
if (3 < gRoomVars.filler1[0]) {
return ITEM_NONE;
}
if (itemID != ITEM_KINSTONE) {
adjustedParam = itemID - ITEM_KINSTONE_GREEN;
rand = (Random() & 0x3f);
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)];
if (adjustedParam == 0) {
itemID = ITEM_NONE;
} else {
itemID = ITEM_KINSTONE;
}
}
break;
}
}
if (itemID != ITEM_NONE) {
if (itemID != ITEM_ENEMY_BEETLE) {
itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam);
if (itemEntity != NULL) {
if (arg0 == &gPlayerEntity) {
itemEntity->actionDelay = 1;
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {
itemEntity->direction = arg0->animationState << 3 | 0x80;
itemEntity->speed = 0xc0;
itemEntity->zVelocity = Q_16_16(1.5);
}
}
CopyPosition(arg0, itemEntity);
}
} else {
itemEntity = CreateEnemy(BEETLE, 0);
if (itemEntity != NULL) {
itemEntity->x.HALF.HI = arg0->x.HALF.HI;
itemEntity->y.HALF.HI = arg0->y.HALF.HI;
itemEntity->collisionLayer = arg0->collisionLayer;
UpdateSpriteForCollisionLayer(itemEntity);
}
}
}
return itemID;
}
void Subtask_WorldEvent(void) {
#if !(defined(DEMO_USA) || defined(DEMO_JP))
gUnk_080FE2A0[gMenu.menuType]();
#endif
}
ASM_FUNC("asm/non_matching/game/sub_0805488C.inc", void sub_0805488C())
void sub_080548E8(void) {
gUnk_080FE2AC[gMenu.field_0x0]();
FlushSprites();
UpdateEntities();
DrawEntities();
CopyOAM();
UpdateScroll();
UpdateBgAnim();
UpdateScrollVram();
}
ASM_FUNC("asm/non_matching/game/sub_08054920.inc", void sub_08054920())
void sub_08054968(void) {
gMenu.menuType = 2;
}
ASM_FUNC("asm/non_matching/game/sub_08054974.inc", void sub_08054974())
ASM_FUNC("asm/non_matching/game/sub_08054A14.inc", void sub_08054A14())
+2 -21
View File
@@ -14,29 +14,10 @@ extern u8 gUnk_03003DE0;
extern u8 gUnk_03000C30;
extern u8 gUpdateVisibleTiles;
extern u8 gUnk_03003DF0[];
extern Entity gUnk_03003BE0;
extern Entity* gPlayerClones[3];
extern u16 gUnk_080B2CD8[];
extern void sub_080ADD70(void);
extern void sub_0801C25C(void);
extern void UpdateDisplayControls(void);
extern void LoadResources(void);
extern void HandlePlayerLife(Entity*);
extern void DoPlayerAction(Entity*);
extern void sub_080171F0(void);
extern void sub_08078FB0(Entity*);
extern void sub_0807A050(void);
extern u32 sub_08079B24(void);
extern void sub_08079708(Entity*);
extern void CreateSparkle(Entity*);
extern void sub_080028E0(Entity*);
extern void sub_08078180(void);
extern void sub_0807B0C8(void);
extern void sub_0807A8D8(Entity*);
extern void sub_08077FEC(u32);
void gIntrMain(void);
struct {
@@ -256,12 +237,12 @@ void HandlePlayerLife(Entity* this) {
gPlayerState.flags &= ~(0x2000000 | PL_FALLING);
if (gPlayerState.flags & PL_BURNING)
ResetPlayer();
if ((gPlayerState.flags & PL_CLONING) && !gPlayerState.field_0xa0[0])
if ((gPlayerState.flags & PL_CLONING) && gPlayerState.chargeState.action == 0)
DeleteClones();
if (sub_08079B24() == 0)
sub_08079708(this);
gUnk_03003DF0[0] = 0;
gUnk_03003DF0.unk_0 = 0;
if (gPlayerState.field_0x27[0] != 0)
gPlayerState.field_0x27[0]--;
+1 -2
View File
@@ -3,12 +3,11 @@
#include "sound.h"
#include "functions.h"
#include "playeritem.h"
#include "functions.h"
extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32);
extern Entity* CreatePlayerBomb();
extern s8 gUnk_0811BDAC[];
extern void ModBombs(s32);
void ItemBomb(ItemBehavior* this, u32 arg1) {
gUnk_0811BD98[this->stateID](this, arg1);
+1 -3
View File
@@ -4,8 +4,6 @@
extern void (*const gUnk_0811BD80[])(ItemBehavior*, u32);
extern void sub_08077E3C(ItemBehavior*, u32);
void ItemBow(ItemBehavior* this, u32 arg1) {
gUnk_0811BD80[this->stateID](this, arg1);
}
@@ -78,7 +76,7 @@ void sub_08075F38(ItemBehavior* this, u32 arg1) {
void sub_08075F84(ItemBehavior* this, u32 arg1) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (GetInventoryValue(0x70) == 1) {
if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) {
sub_08077E3C(this, 5);
} else {
UpdateItemAnim(this);
-2
View File
@@ -4,8 +4,6 @@
#include "functions.h"
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32);
extern u32 sub_0807A894(Entity*);
extern void UpdatePlayerMovement(void);
void ItemGustJar(ItemBehavior* this, u32 arg1) {
gPlayerState.framestate = PL_STATE_GUSTJAR;
+3 -3
View File
@@ -24,9 +24,9 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
itemSlot = IsItemEquipped(this->behaviorID);
if (gPlayerState.heldObject != 0 || gPlayerState.queued_action == PLAYER_ROLL || gPlayerState.jump_status != 0 ||
gPlayerState.item != NULL || (gPlayerState.flags & PL_MINISH) != 0) {
ForceEquipItem(0xf, itemSlot);
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
ForceEquipItem(0xf, itemSlot);
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
sub_08077E78(this, arg1);
} else {
this->field_0x5[4] |= 0x80;
@@ -77,7 +77,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) {
itemSlot = IsItemEquipped(this->behaviorID);
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) {
ForceEquipItem(0xf, itemSlot);
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
sub_08077E78(this, arg1);
SoundReq(SFX_ITEM_LANTERN_OFF);
+1 -8
View File
@@ -1,14 +1,7 @@
#include "global.h"
#include "entity.h"
#include "item.h"
// TODO include correct headers?
extern void UpdateItemAnim(ItemBehavior*);
extern void CreatePlayerBomb(ItemBehavior*, u32);
extern void sub_08077E78(ItemBehavior*, u32);
extern void sub_08077BB8(ItemBehavior*);
extern void sub_0806F948(Entity*);
extern void sub_08077D38(ItemBehavior*, u32);
#include "functions.h"
extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
+3 -4
View File
@@ -9,8 +9,6 @@
void sub_08076964(ItemBehavior*, u32);
void sub_080768F8(ItemBehavior*, u32);
void sub_08076A88(ItemBehavior*, u32);
extern bool32 sub_0807A158();
extern Entity* CreatePlayerBomb(ItemBehavior*, u32);
extern u16 gUnk_0800275C[];
extern u8 gUnk_0811BE38[];
@@ -103,7 +101,8 @@ void sub_08076964(ItemBehavior* this, u32 arg1) {
gPlayerState.dash_state = 0x40;
gPlayerState.field_0xa &= ~(8 >> arg1);
this->stateID++;
if (sub_0807A158() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.field_0xac & 4) != 0) {
if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 &&
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
gPlayerState.field_0xab = 3;
sub_08077DF4(this, 0x298);
bombEntity = CreatePlayerBomb(this, 0xc);
@@ -145,7 +144,7 @@ void sub_08076A88(ItemBehavior* this, u32 arg1) {
uVar2 = gUnk_0800275C[(gPlayerEntity.animationState & 0xe) * 4];
if (uVar2 == (gPlayerEntity.collisions & uVar2)) {
if (this->field_0x5[3] != 0) {
gPlayerEntity.action = 6;
gPlayerEntity.action = PLAYER_BOUNCE;
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerState.field_0x38 = 0;
+1 -9
View File
@@ -2,15 +2,7 @@
#include "entity.h"
#include "item.h"
#include "sound.h"
// TODO include correct headers?
extern void sub_08077E78(ItemBehavior*, u32);
extern void SoundReq(u32);
extern void UpdateItemAnim(ItemBehavior*);
extern u32 sub_08077EFC(ItemBehavior*);
extern void sub_08077BB8(ItemBehavior*);
extern void sub_08077D38(ItemBehavior*, u32);
extern void sub_0806F948(Entity*);
#include "functions.h"
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
+11 -17
View File
@@ -5,19 +5,12 @@
#include "playeritem.h"
extern void (*const gUnk_0811BD44[])(ItemBehavior*, u32);
extern void sub_08077B98(ItemBehavior*);
extern void UpdatePlayerMovement(void);
extern u32 sub_0807B014();
extern Entity* CreatePlayerBomb(ItemBehavior*, u32);
extern bool32 sub_08077F10(ItemBehavior*);
void sub_080759B8(ItemBehavior*, u32);
void sub_080754B8(ItemBehavior*, u32);
void sub_08075898(ItemBehavior*, u32);
void sub_08075580(ItemBehavior*, u32);
extern u32 sub_08077EC8(ItemBehavior*);
void sub_08075694(ItemBehavior* this, u32 arg1);
void ItemSword(ItemBehavior* this, u32 arg1) {
@@ -38,7 +31,7 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
if (gPlayerState.jump_status) {
if ((gPlayerState.jump_status & 7) != 3) {
if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity <= 0x17fff &&
(gPlayerState.field_0xac & 0x40) && gPlayerEntity.z.WORD) {
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) {
gPlayerState.jump_status |= 0x20;
gPlayerState.field_0xab = 7;
gPlayerState.field_0x3[1] |= (8 >> arg1) | ((8 >> arg1) << 4);
@@ -58,13 +51,14 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
}
if (gPlayerState.flags & PL_ROLLING) {
if ((gPlayerState.field_0xac & 2) == 0) {
if ((gPlayerState.skills & SKILL_ROLL_ATTACK) == 0) {
if (gPlayerState.item == NULL)
return;
DeleteEntity(gPlayerState.item);
gPlayerState.item = NULL;
return;
}
// Do the roll attack.
sub_08077D38(this, arg1);
sub_08077B98(this);
@@ -123,7 +117,7 @@ void sub_080754B8(ItemBehavior* this, u32 arg1) {
}
if ((this->field_0x5[9] & 0x80) != 0) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.field_0xac & 1) == 0)) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
sub_080759B8(this, arg1);
} else {
sub_08075580(this, arg1);
@@ -141,8 +135,8 @@ void sub_08075580(ItemBehavior* this, u32 arg1) {
gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0;
this->stateID = 2;
if ((gPlayerState.field_0xac & 0x200) != 0) {
this->field_0x5[2] = 0x28;
if ((gPlayerState.skills & SKILL_FAST_SPIN) != 0) {
this->field_0x5[2] = 0x28; // TODO spin speed?
} else {
this->field_0x5[2] = 0x50;
}
@@ -197,8 +191,8 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
gPlayerEntity.hurtType = 0x1e;
gPlayerState.sword_state |= 0x40;
gPlayerState.sword_state &= 0xdf;
if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags & PL_CLONING) == 0)) {
gPlayerState.field_0xa0[0] = 0x01;
if ((gPlayerState.chargeState.action == 4) && ((gPlayerState.flags & PL_CLONING) == 0)) {
gPlayerState.chargeState.action = 1;
DeleteClones();
}
SoundReq(SFX_PLY_VO2);
@@ -223,7 +217,7 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
gPlayerEntity.speed = 0x180;
if ((this->field_0x5[9] & 0x80) != 0) {
bVar6 = 10;
if ((gPlayerState.field_0xac & 0x800) != 0) {
if ((gPlayerState.skills & SKILL_LONG_SPIN) != 0) {
bVar6 = 0xf;
}
@@ -233,7 +227,7 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
}
} else {
if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
((gPlayerState.field_0xac & 0x100) != 0))) {
((gPlayerState.skills & SKILL_FOURSWORD) != 0))) {
Entity* bombEnt = CreatePlayerBomb(this, 0x14);
if (bombEnt) {
bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80;
@@ -241,7 +235,7 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
}
if ((((gPlayerEntity.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
(((gPlayerState.field_0xac & 0x20) != 0 && (--this->field_0x5[2] != 0)))) {
(((gPlayerState.skills & SKILL_GREAT_SPIN) != 0 && (--this->field_0x5[2] != 0)))) {
gPlayerState.sword_state |= 0x10;
gPlayerState.field_0xab = 6;
this->field_0x5[6] = gPlayerEntity.animationState << 2;
+1 -1
View File
@@ -404,7 +404,7 @@ void sub_080594DC(ManagerF* this) {
this->manager.action = 1;
// fall through
case 1:
if (!GetInventoryValue(6))
if (!GetInventoryValue(ITEM_FOURSWORD))
return;
if (CheckLocalFlagByBank(0x8c0, 0x85))
return;
+2 -2
View File
@@ -587,8 +587,8 @@ u32 sub_080A4418(u32 param_1, u32 param_2) {
}
void KinstoneMenu_080A4468(void) {
gUnk_03003DF0[0].unk[2] = 0;
gUnk_03003DF0[0].unk2[3] = 0;
gUnk_03003DF0.unk_2 = 0;
gUnk_03003DF0.unk_4[3] = 0;
sub_0801E6C8(gFuseInfo._3);
sub_0801E798(gKinstoneMenu.unk2a);
}
+3 -3
View File
@@ -247,14 +247,14 @@ NONMATCH("asm/non_matching/textbox/MsgInit.inc", /*static*/ u32 MsgInit(void)) {
for (i = 0; i < FILENAME_LENGTH; ++i) {
char c = gSave.name[i];
if (c == '\0')
if (c == 0)
break;
*dest++ = c;
}
dest[0] = 2;
dest[1] = 0xf; // White text color
dest[2] = '\0';
dest[2] = 0;
sub_08056FBC(&gTextRender);
gTextRender.curToken._c = &gUnk_08107BE0;
gTextRender._50.unk8 = gTextGfxBuffer;
@@ -477,7 +477,7 @@ NONMATCH("asm/non_matching/textbox/RunTextCommand.inc", /*static*/ u16 RunTextCo
if (gMessage.unk == 0) {
gMessage.unk = 0x80;
}
this->curToken.extended = '\0';
this->curToken.extended = 0;
if (chr >> 8 == 7) {
this->_90 = this->_8f | 0x80;
PaletteChange(this, 0);
+1 -1
View File
@@ -51,7 +51,7 @@ void sub_08063314(Entity* this) {
if (((++this->field_0xf & 0xF) == 0) && (offset = sub_080633C8(this), this->animIndex != offset)) {
InitializeAnimation(this, offset);
}
if (this->interactType != '\0') {
if (this->interactType != 0) {
MessageFromTarget(this->actionDelay + 0xA01);
this->action++;
}
+5 -4
View File
@@ -2,6 +2,7 @@
#include "functions.h"
#include "screen.h"
#include "hitbox.h"
#include "item.h"
extern void (*gUnk_081140D4[])(Entity*);
@@ -315,11 +316,11 @@ void sub_0806D5D4(void) {
u32 itemSlot;
InitBiggoronTimer();
itemSlot = IsItemEquipped(0xd);
itemSlot = IsItemEquipped(ITEM_SHIELD);
if (itemSlot != 2) {
gSave.stats.itemButtons[itemSlot] = 0;
}
sub_0807CAA0(0xd, 0);
SetInventoryValue(ITEM_SHIELD, 0);
}
void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
@@ -327,8 +328,8 @@ void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806D620(void) {
sub_0807CAA0(0xd, 0);
sub_080A7C18(0xe, 0, 0);
SetInventoryValue(ITEM_SHIELD, 0);
sub_080A7C18(ITEM_MIRROR_SHIELD, 0, 0);
}
void sub_0806D638(Entity* this) {
+19 -23
View File
@@ -9,6 +9,7 @@
#include "npc.h"
#include "functions.h"
#include "game.h"
#include "item.h"
extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*);
@@ -123,7 +124,7 @@ void sub_08068b2c(Entity* this) {
if (this->interactType == '\x02') {
this->action = 2;
this->interactType = '\0';
this->interactType = 0;
uVar1 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
InitAnimationForceUpdate(this, uVar1);
sub_0806F118(this);
@@ -175,11 +176,11 @@ static void sub_08068BEC(Entity* this, u32 unused) {
void sub_08068C28(Entity* this) {
this->actionDelay = gUnk_08111623[this->type];
if (this->type == 1) {
if (GetInventoryValue(0x48)) { // spin attack
if (!GetInventoryValue(0x4b)) { // rock breaker
if (GetInventoryValue(ITEM_SKILL_SPIN_ATTACK)) {
if (!GetInventoryValue(ITEM_SKILL_ROCK_BREAKER)) {
this->actionDelay = 1;
} else {
if (!GetInventoryValue(0x4a)) { // dash attack
if (!GetInventoryValue(ITEM_SKILL_DASH_ATTACK)) {
this->actionDelay = 2;
} else {
this->actionDelay = 3;
@@ -205,19 +206,19 @@ void sub_08068CA0(Entity* this, ScriptExecutionContext* context) {
bVar1 = this->type;
if (bVar1 == 1) {
context->condition = bVar1;
uVar2 = GetInventoryValue(0x48); // spin attack
uVar2 = GetInventoryValue(ITEM_SKILL_SPIN_ATTACK);
if (uVar2 == 0) {
context->condition = 0;
}
uVar2 = GetInventoryValue(0x4b); // rock breaker
uVar2 = GetInventoryValue(ITEM_SKILL_ROCK_BREAKER);
if (uVar2 == 0) {
context->condition = 0;
}
uVar2 = GetInventoryValue(0x4a); // dash attack
uVar2 = GetInventoryValue(ITEM_SKILL_DASH_ATTACK);
if (uVar2 == 0) {
context->condition = 0;
}
uVar2 = GetInventoryValue(0x4e); // down thrust
uVar2 = GetInventoryValue(ITEM_SKILL_DOWN_THRUST);
if (uVar2 != 0) {
return;
}
@@ -262,34 +263,28 @@ void sub_08068CFC(Entity* this, ScriptExecutionContext* context) {
return;
goto switchD_08068d12_caseD_0;
case 7:
uVar2 = GetInventoryValue(0x48); // spin attack
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_SPIN_ATTACK) == 0) {
return;
}
uVar2 = GetInventoryValue(0x49); // roll attack
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_ROLL_ATTACK) == 0) {
return;
}
uVar2 = GetInventoryValue(0x4a); // dash attack
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_DASH_ATTACK) == 0) {
return;
}
uVar2 = GetInventoryValue(0x4b); // rock breaker
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_ROCK_BREAKER) == 0) {
return;
}
uVar2 = GetInventoryValue(0x4c); // sword beam
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_SWORD_BEAM) == 0) {
return;
}
uVar2 = GetInventoryValue(0x4e); // down thrust
if (uVar2 == 0) {
if (GetInventoryValue(ITEM_SKILL_DOWN_THRUST) == 0) {
return;
}
itemID = 0x4f; // peril beam
itemID = ITEM_SKILL_PERIL_BEAM;
break;
case 10:
itemID = 0x4d; // great spin
itemID = ITEM_SKILL_GREAT_SPIN;
}
uVar2 = GetInventoryValue(itemID);
LABEL1:
@@ -341,8 +336,9 @@ void sub_08068E78(Entity* this) {
}
void sub_08068E90(Entity* this) {
// Learn a skill.
PlayerState* s = &gPlayerState;
*(u16*)&s->field_0xac = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->field_0xac;
*(u16*)&s->skills = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->skills;
}
void sub_08068EB4(void) {
+2 -1
View File
@@ -2,6 +2,7 @@
#include "entity.h"
#include "player.h"
#include "npc.h"
#include "item.h"
extern SpriteLoadData gUnk_08110CA8[];
@@ -68,7 +69,7 @@ void sub_080672B0(Entity* this, ScriptExecutionContext* context) {
void sub_080672C8(Entity* this) {
u32 dialog = 0;
u32 tmp;
if (GetInventoryValue(0x11) == 0) {
if (GetInventoryValue(ITEM_GUST_JAR) == 0) {
if (CheckGlobalFlag(TABIDACHI)) {
dialog = 1;
}
+3 -2
View File
@@ -5,6 +5,7 @@
#include "flags.h"
#include "message.h"
#include "npc.h"
#include "item.h"
extern u16 gUnk_08113344[];
extern u16 gUnk_0811334A[];
@@ -61,7 +62,7 @@ void sub_0806BE84(Entity* this, ScriptExecutionContext* context) {
context->condition = 1;
}
// Graveyard key
if (GetInventoryValue(0x3C) >= 2) {
if (GetInventoryValue(ITEM_QST_GRAVEYARD_KEY) >= 2) {
msgIndex = 2;
}
MessageNoOverlap(gUnk_08113344[msgIndex], this);
@@ -73,7 +74,7 @@ void sub_0806BEC8(Entity* this, ScriptExecutionContext* context) {
msgIndex = 0;
context->condition = 0;
hasGraveyardKey = GetInventoryValue(0x3C);
hasGraveyardKey = GetInventoryValue(ITEM_QST_GRAVEYARD_KEY);
if (hasGraveyardKey == 1) {
msgIndex = 1;
context->condition = 1;
+6 -4
View File
@@ -1,6 +1,7 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
#include "item.h"
extern void (*gUnk_08111D88[])(Entity*);
void sub_08069FE8(Entity*);
@@ -65,7 +66,8 @@ void sub_08069B44(Entity* this) {
if ((this->flags & ENT_SCRIPTED) != 0) {
sub_0807DD50(this);
}
if (((this->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) && (GetInventoryValue(0x36) != 2)) {
if (((this->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) &&
(GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) {
this->action = 4;
}
#if defined(JP) || defined(EU) || defined(DEMO_JP)
@@ -204,7 +206,7 @@ void sub_08069E50(Entity* this) {
if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) {
InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState);
}
if (GetInventoryValue(0x36) == 2) {
if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) {
this->action = 7;
InitAnimationForceUpdate(this, 0x29);
sub_080788E0(this);
@@ -216,7 +218,7 @@ void sub_08069E50(Entity* this) {
void sub_08069ECC(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
#ifdef EU
if (GetInventoryValue(0x36) != 2) {
if (GetInventoryValue(ITEM_QST_DOGFOOD) != 2) {
this->action = 5;
} else {
this->action = 1;
@@ -340,7 +342,7 @@ void sub_0806A144(Entity* this) {
s32 dialog = 4;
if (gPlayerState.flags & PL_MINISH) {
dialog = 3;
if (GetInventoryValue(0x46) == 0 && CheckGlobalFlag(MIZUKAKI_START)) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0 && CheckGlobalFlag(MIZUKAKI_START)) {
if (CheckLocalFlag(0x85) == 0) {
dialog = 1;
} else {
+5 -3
View File
@@ -1,5 +1,7 @@
#include "npc.h"
#include "functions.h"
#include "item.h"
extern u32 gUnk_081133B4;
void sub_0806BFD8(Entity* this);
@@ -56,8 +58,8 @@ void sub_0806C038(Entity* this) {
if (index != 0) {
index = 0;
}
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(0x3a) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
if (GetInventoryValue(ITEM_QST_BOOK2) == 0) {
index = 6;
if (CheckLocalFlag(LEFT_TALK) == 0) {
index = 5;
@@ -65,7 +67,7 @@ void sub_0806C038(Entity* this) {
}
} else {
index = 7;
if (GetInventoryValue(0x3a) > 1) {
if (GetInventoryValue(ITEM_QST_BOOK2) > 1) {
index = 0;
}
}
+6 -14
View File
@@ -2,10 +2,7 @@
#include "object.h"
#include "functions.h"
#include "playeritem.h"
extern void sub_080600F0(Entity*);
extern void sub_08060158(Entity*);
extern void ModBombs(s32);
#include "item.h"
extern SpriteLoadData gUnk_0810A348;
extern u8* gUnk_08109D18[];
@@ -150,18 +147,15 @@ void sub_08060208(Entity* this) {
void sub_0806021C(Entity* this) {
u32 uVar2 = 0;
// jabber nut
if (GetInventoryValue(0x5B)) {
if (GetInventoryValue(ITEM_JABBERNUT)) {
uVar2 = 1;
}
// earth element
if (GetInventoryValue(0x40)) {
if (GetInventoryValue(ITEM_EARTH_ELEMENT)) {
uVar2 = 2;
}
// mole mitts
if (GetInventoryValue(0x13)) {
if (GetInventoryValue(ITEM_MOLE_MITTS)) {
uVar2 = 3;
}
ShowNPCDialogue(this, gUnk_08109DC8 + this->type2 * 0x4 + uVar2);
@@ -174,8 +168,7 @@ void sub_0806025C(Entity* this) {
void sub_08060270(Entity* this) {
u32 index;
// flippers
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
index = 1;
if (CheckGlobalFlag(MIZUKAKI_START) == 0) {
index = 0;
@@ -194,8 +187,7 @@ void sub_08060270(Entity* this) {
void sub_080602BC(Entity* this) {
u32 index;
// spin attack
if (GetInventoryValue(0x48) != 0) {
if (GetInventoryValue(ITEM_SKILL_SPIN_ATTACK) != 0) {
index = (Random() & 1) + 2;
} else {
if (gSave.stats.bombCount < gBombBagSizes[gSave.stats.bombBagType]) {
+3 -2
View File
@@ -2,6 +2,7 @@
#include "script.h"
#include "functions.h"
#include "npc.h"
#include "item.h"
extern u16 gUnk_081104F8[];
@@ -81,9 +82,9 @@ void sub_0806673C(Entity* this) {
u32 index;
if (CheckGlobalFlag(2) == 0) {
index = 0;
} else if (GetInventoryValue(2) == 0) {
} else if (GetInventoryValue(ITEM_GREEN_SWORD) == 0) {
index = 1;
} else if (GetInventoryValue(3) == 0) {
} else if (GetInventoryValue(ITEM_RED_SWORD) == 0) {
index = 2;
} else {
index = 3;
+2 -2
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "item.h"
extern u16 gUnk_08112D48[];
@@ -37,8 +38,7 @@ void sub_0806B260(Entity* this, ScriptExecutionContext* context) {
u32 index;
context->condition = 0;
// flippers
if (!GetInventoryValue(0x46)) {
if (!GetInventoryValue(ITEM_FLIPPERS)) {
if (CheckGlobalFlag(MIZUKAKI_START)) {
index = 2;
context->condition = 1;
+14 -14
View File
@@ -4,6 +4,7 @@
#include "flags.h"
#include "message.h"
#include "sound.h"
#include "item.h"
extern u16 gUnk_08113078[];
@@ -15,33 +16,32 @@ ASM_FUNC("asm/non_matching/librarians/sub_0806BA34.inc",
void sub_0806BA34(Entity* this, ScriptExecutionContext* context))
void sub_0806BB1C(Entity* this, ScriptExecutionContext* context) {
s32 tmp;
tmp = 0xffffffff;
if (GetInventoryValue(0x39) == 1) {
tmp = 0x39;
} else if (GetInventoryValue(0x3a) == 1) {
tmp = 0x3a;
s32 item = 0xffffffff;
if (GetInventoryValue(ITEM_QST_BOOK1) == 1) {
item = ITEM_QST_BOOK1;
} else if (GetInventoryValue(ITEM_QST_BOOK2) == 1) {
item = ITEM_QST_BOOK2;
} else {
if (GetInventoryValue(0x3b) == 1) {
tmp = 0x3b;
if (GetInventoryValue(ITEM_QST_BOOK3) == 1) {
item = ITEM_QST_BOOK3;
}
if (tmp < 1) {
if (item < 1) {
return;
}
}
if (context->intVariable == 0) {
sub_08095BE0(this, tmp);
sub_08095BE0(this, item);
InitializeAnimation(this, 0xc);
SoundReq(SFX_TASK_COMPLETE);
} else {
sub_0807CAA0(tmp, 2);
SetInventoryValue(item, 2);
}
}
void sub_0806BB7C(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
if ((GetInventoryValue(0x39) == 2) && (GetInventoryValue(0x3a) == 2) && (GetInventoryValue(0x3b) == 2)) {
if ((GetInventoryValue(ITEM_QST_BOOK1) == 2) && (GetInventoryValue(ITEM_QST_BOOK2) == 2) &&
(GetInventoryValue(ITEM_QST_BOOK3) == 2)) {
SetLocalFlag(0x73);
context->condition = 1;
}
@@ -50,7 +50,7 @@ void sub_0806BB7C(Entity* this, ScriptExecutionContext* context) {
void sub_0806BBB0(Entity* this) {
u32 tmp;
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
if (CheckGlobalFlag(0x29)) {
tmp = 1;
} else {
+8 -7
View File
@@ -2,6 +2,7 @@
#include "functions.h"
#include "flags.h"
#include "message.h"
#include "item.h"
extern u16 gUnk_0810C34C[];
@@ -16,25 +17,25 @@ void Marcy(Entity* this) {
void sub_08062D18(Entity* this, ScriptExecutionContext* context) {
u8 tmp = 0;
if ((GetInventoryValue(0x4f) != 0) && (CheckLocalFlag(0x26) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_PERIL_BEAM) != 0) && (CheckLocalFlag(0x26) == 0)) {
tmp = 7;
}
if ((GetInventoryValue(0x4e) != 0) && (CheckLocalFlag(0x25) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_DOWN_THRUST) != 0) && (CheckLocalFlag(0x25) == 0)) {
tmp = 6;
}
if ((GetInventoryValue(0x4d) != 0) && (CheckLocalFlag(0x24) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_GREAT_SPIN) != 0) && (CheckLocalFlag(0x24) == 0)) {
tmp = 5;
}
if ((GetInventoryValue(0x4c) != 0) && (CheckLocalFlag(0x23) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_SWORD_BEAM) != 0) && (CheckLocalFlag(0x23) == 0)) {
tmp = 4;
}
if ((GetInventoryValue(0x4b) != 0) && (CheckLocalFlag(0x22) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_ROCK_BREAKER) != 0) && (CheckLocalFlag(0x22) == 0)) {
tmp = 3;
}
if ((GetInventoryValue(0x4a) != 0) && (CheckLocalFlag(0x21) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_DASH_ATTACK) != 0) && (CheckLocalFlag(0x21) == 0)) {
tmp = 2;
}
if ((GetInventoryValue(0x49) != 0) && (CheckLocalFlag(0x20) == 0)) {
if ((GetInventoryValue(ITEM_SKILL_ROLL_ATTACK) != 0) && (CheckLocalFlag(0x20) == 0)) {
tmp = 1;
}
this->type2 = tmp;
+2 -2
View File
@@ -4,6 +4,7 @@
#include "flags.h"
#include "npc.h"
#include "functions.h"
#include "item.h"
extern u32 gUnk_08113F44;
extern Dialog gUnk_08113F48[];
@@ -50,8 +51,7 @@ void sub_0806CE80(Entity* this) {
u32 v2;
v = gSave.global_progress;
if (v == 5) {
// flippers
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
if (CheckLocalFlag(0x70) != 0) {
v2 = CheckLocalFlag(MIZUKAKI_HINT3_MAYOR);
if (v2 == 0) {
+3 -2
View File
@@ -1,5 +1,6 @@
#include "npc.h"
#include "functions.h"
#include "item.h"
extern void sub_08068780(Entity*);
@@ -134,8 +135,8 @@ void sub_08068910(Entity* this) {
}
void sub_08068964(Entity* this) {
sub_080A7C18(53, 0, 3);
sub_0807CAA0(53, 2);
sub_080A7C18(ITEM_QST_BROKEN_SWORD, 0, 3);
SetInventoryValue(ITEM_QST_BROKEN_SWORD, 2);
}
void Melari_Fusion(Entity* this) {
+3 -2
View File
@@ -2,6 +2,7 @@
#include "flags.h"
#include "message.h"
#include "npc.h"
#include "item.h"
extern void (*const gUnk_08110644[])(Entity*);
void sub_08066864(Entity*);
@@ -83,9 +84,9 @@ void sub_08066904(Entity* this) {
u32 index;
if (CheckGlobalFlag(2) == 0) {
index = 0;
} else if (GetInventoryValue(2) == 0) {
} else if (GetInventoryValue(ITEM_GREEN_SWORD) == 0) {
index = 1;
} else if (GetInventoryValue(3) == 0) {
} else if (GetInventoryValue(ITEM_RED_SWORD) == 0) {
index = 2;
} else {
index = 3;
+3 -2
View File
@@ -4,6 +4,7 @@
#include "message.h"
#include "flags.h"
#include "npc.h"
#include "item.h"
const u8 gUnk_08111284[][0x20] = {
{ 0x8, 0x1, 0x9, 0x1, 0xa, 0x1, 0xb, 0x83, 0xc, 0x83, 0xd, 0x83, 0xe, 0x83, 0xf, 0x80,
@@ -226,10 +227,10 @@ void sub_08068190(Entity* this) {
if (CheckLocalFlag(0x7e)) {
uVar2 = 1;
}
if (GetInventoryValue(0x41) != 0) {
if (GetInventoryValue(ITEM_FIRE_ELEMENT) != 0) {
uVar2 = 2;
}
if (GetInventoryValue(2) != 0) {
if (GetInventoryValue(ITEM_GREEN_SWORD) != 0) {
uVar2 = 3;
}
+2 -1
View File
@@ -4,6 +4,7 @@
#include "flags.h"
#include "message.h"
#include "npc.h"
#include "item.h"
extern SpriteLoadData gUnk_08110C00;
extern u16 gUnk_08110C0C[];
@@ -51,7 +52,7 @@ void sub_080670B4(Entity* this) {
u32 uVar2;
uVar2 = 0;
if (GetInventoryValue(0x11) == 0) {
if (GetInventoryValue(ITEM_GUST_JAR) == 0) {
if (CheckGlobalFlag(TABIDACHI)) {
uVar2 = 1;
}
+12 -11
View File
@@ -8,6 +8,7 @@
#include "npc.h"
#include "game.h"
#include "hitbox.h"
#include "item.h"
typedef struct {
u32 unk_00;
@@ -155,30 +156,30 @@ u32 sub_0806DBF4(u32 param_1) {
case 3:
case 4:
case 6:
param_1 = 1;
if (GetInventoryValue(2) != 0) {
param_1 = 2;
param_1 = ITEM_SMITH_SWORD;
if (GetInventoryValue(ITEM_GREEN_SWORD) != 0) {
param_1 = ITEM_GREEN_SWORD;
}
if (GetInventoryValue(3) != 0) {
param_1 = 3;
if (GetInventoryValue(ITEM_RED_SWORD) != 0) {
param_1 = ITEM_RED_SWORD;
}
if (GetInventoryValue(4) != 0) {
param_1 = 4;
if (GetInventoryValue(ITEM_BLUE_SWORD) != 0) {
param_1 = ITEM_BLUE_SWORD;
}
if (GetInventoryValue(6) != 0) {
param_1 = 6;
if (GetInventoryValue(ITEM_FOURSWORD) != 0) {
param_1 = ITEM_FOURSWORD;
}
break;
}
return param_1;
}
void sub_0806DC3C(Entity* this) {
void NPC4E_SaveEquippedItems(Entity* this) {
this->field_0x68.HALF.LO = gSave.stats.itemButtons[SLOT_A];
this->field_0x68.HALF.HI = gSave.stats.itemButtons[SLOT_B];
}
void sub_0806DC58(Entity* this) {
void NPC4E_RestoreEquippedItems(Entity* this) {
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.LO), 0);
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.HI), 1);
}
+10 -8
View File
@@ -1,5 +1,6 @@
#include "functions.h"
#include "npc.h"
#include "item.h"
extern Hitbox gUnk_0810C428;
@@ -23,11 +24,12 @@ void Pita(Entity* this) {
}
}
/** Reset the players baked goods? */
void sub_08062EB8(void) {
sub_0807CAA0(0x68, 0);
sub_0807CAA0(0x69, 0);
sub_0807CAA0(0x6a, 0);
sub_0807CAA0(0x6b, 0);
SetInventoryValue(ITEM_BRIOCHE, 0);
SetInventoryValue(ITEM_CROISSANT, 0);
SetInventoryValue(ITEM_PIE, 0);
SetInventoryValue(ITEM_CAKE, 0);
}
bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
@@ -35,16 +37,16 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
u32 tmp2;
//! @bug: tmp is uninitialized, in practice player must have an item here
if (GetInventoryValue(0x68) != 0) {
if (GetInventoryValue(ITEM_BRIOCHE) != 0) {
tmp = 0;
}
if (GetInventoryValue(0x69) != 0) {
if (GetInventoryValue(ITEM_CROISSANT) != 0) {
tmp = 1;
}
if (GetInventoryValue(0x6a) != 0) {
if (GetInventoryValue(ITEM_PIE) != 0) {
tmp = 2;
}
if (GetInventoryValue(0x6b) != 0) {
if (GetInventoryValue(ITEM_CAKE) != 0) {
tmp = 3;
}
if (CheckLocalFlag(SHOP03_PAN_1ST) == 0) {
+2 -1
View File
@@ -2,6 +2,7 @@
#include "functions.h"
#include "npc.h"
#include "object.h"
#include "item.h"
extern u16 gUnk_0810FA54[];
@@ -93,7 +94,7 @@ void sub_08064CC0(Entity* this) {
void sub_08064CD8(Entity* this) {
u32 flag;
u32 tmp = 2;
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
if (CheckLocalFlag(0x73)) {
tmp = 1;
} else {
+2 -1
View File
@@ -1,5 +1,6 @@
#include "npc.h"
#include "functions.h"
#include "item.h"
extern void (*gUnk_0810FEC4[])(Entity* this);
extern void (*gUnk_0810FEBC[])(Entity* this);
@@ -102,7 +103,7 @@ void sub_080656D4(Entity* this) {
goto label;
} else {
if (this->interactType != 0) {
if (GetInventoryValue(0x37) != 0) { // keyLonLon
if (GetInventoryValue(ITEM_QST_LONLON_KEY) != 0) {
StartCutscene(this, (u16*)&script_TalonGotKey);
goto label2;
} else {
+4 -3
View File
@@ -2,6 +2,7 @@
#include "entity.h"
#include "npc.h"
#include "functions.h"
#include "item.h"
extern u32 sub_080002C0(u32, u32, u32);
extern void sub_0806ACC4(Entity*);
@@ -250,7 +251,7 @@ void sub_0806B004(Entity* this, ScriptExecutionContext* context) {
if (CheckGlobalFlag(MIZUKAKI_START)) {
if (CheckLocalFlag(0x73)) {
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
idx = 3;
if (CheckLocalFlag(KHOUSE51_00) == 0) {
idx = 2;
@@ -283,7 +284,7 @@ void sub_0806B064(Entity* this) {
void sub_0806B098(Entity* this) {
int idx = 2;
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
idx = 1;
if (CheckGlobalFlag(MIZUKAKI_START)) {
if (!CheckGlobalFlag(MIZUKAKI_HARIFALL)) {
@@ -308,7 +309,7 @@ void sub_0806B0E0(Entity* this) {
void sub_0806B134(Entity* this) {
int idx;
if (GetInventoryValue(0x45)) {
if (GetInventoryValue(ITEM_POWER_BRACELETS)) {
idx = 2;
if (CheckLocalFlag(KHOUSE42_00) == 0) {
idx = 1;
+2 -1
View File
@@ -1,5 +1,6 @@
#include "npc.h"
#include "functions.h"
#include "item.h"
typedef struct {
u8 frame1;
@@ -252,7 +253,7 @@ void sub_0806200C(Entity* this) {
if ((CheckGlobalFlag(MIZUKAKI_START) != 0) && (CheckLocalFlag(0x6b))) {
// hyrule bestiary
if (GetInventoryValue(0x39) == 2) {
if (GetInventoryValue(ITEM_QST_BOOK1) == 2) {
index = 2;
} else {
index = 1;
+1 -1
View File
@@ -50,7 +50,7 @@ void sub_0806C7D4(Entity* this) {
if (this->interactType == '\x02') {
this->action = 3;
this->interactType = '\0';
this->interactType = 0;
sub_0806F118(this);
} else {
sub_0807DD94(this, NULL);
+2 -2
View File
@@ -67,8 +67,8 @@ void sub_08098DC4(Entity* this) {
gPlayerEntity.collisionLayer = 1;
SortEntityAbove(this, &gPlayerEntity);
gPlayerState.queued_action = PLAYER_PARACHUTE;
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x34[5] = this->type2;
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = this->type2;
this->action = 4;
if (this->type2 == 1) {
SetGlobalFlag(TATSUMAKI);
+2 -2
View File
@@ -17,7 +17,7 @@ void Book(Entity* this) {
void sub_0809B3C4(Entity* this) {
u32 obtained;
obtained = GetInventoryValue(this->type + 0x39);
obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
if (this->type2 != 3) {
if (obtained) {
DeleteThisEntity();
@@ -188,7 +188,7 @@ void sub_0809B5EC(Entity* this) {
break;
}
case 0: {
if (GetInventoryValue(this->type + 0x39) == 2) {
if (GetInventoryValue(this->type + ITEM_QST_BOOK1) == 2) {
this->subAction = 1;
}
break;
+1 -1
View File
@@ -65,7 +65,7 @@ void sub_08081BE0(Entity* this) {
if (!sub_08081D28(this)) {
this->action = 4;
this->field_0xf = 1;
if ((gPlayerState.heldObject == 2) || (!(gPlayerState.field_0x34[1] & 0x80))) {
if ((gPlayerState.heldObject == 2) || (!(gPlayerState.field_0x35 & 0x80))) {
this->actionDelay = 0x18;
} else {
this->actionDelay = 0x8;
+1 -1
View File
@@ -13,7 +13,7 @@ extern void (*gUnk_081247AC[])(Entity*);
extern void* gUnk_080DD750;
extern u8 gUnk_081247C0[];
extern u16 gUnk_081247C8[];
extern u32 gUnk_081247D0;
extern u16 gUnk_081247D0;
void Cloud(Entity* this) {
gUnk_08124798[this->type](this);
+1 -1
View File
@@ -40,7 +40,7 @@ typedef struct {
#endif
} FigurineDeviceEntity;
extern void sub_080542C0(s32);
extern void ModShells(s32);
extern u8 gUnk_020227F0;
typedef struct {
u32 unk_0;
+1 -1
View File
@@ -159,7 +159,7 @@ void sub_080819B4(ItemForSaleEntity* this) {
void sub_08081A5C(ItemForSaleEntity* this) {
u32 tmp = sub_080787D8(super);
if (super->actionDelay == 1) {
gUnk_03003DF0[tmp].unk4[2] = 0;
gUnk_03003DF0.array[tmp].unk_2 = 0;
}
}
+2 -2
View File
@@ -51,7 +51,7 @@ void Object43_Init(Object43Entity* this) {
super->actionDelay = 0x28;
} else {
super->spriteSettings.draw = 1;
if ((gPlayerState.field_0xac & 0x200) != 0) {
if ((gPlayerState.skills & SKILL_FAST_SPIN) != 0) {
super->actionDelay = 0x28;
} else {
super->actionDelay = 0x50;
@@ -102,7 +102,7 @@ void Object43_Action1(Object43Entity* this) {
if (super->actionDelay != 0) {
super->actionDelay--;
tmp2 = 3;
if ((super->type2 == 0) && ((gPlayerState.field_0xac & 0x200) == 0)) {
if ((super->type2 == 0) && ((gPlayerState.skills & SKILL_FAST_SPIN) == 0)) {
tmp2 = 7;
}
if ((super->actionDelay & tmp2) == 0) {
+2 -2
View File
@@ -402,7 +402,7 @@ void sub_08094FA8(Object6AEntity* this) {
}
break;
case 2:
if (GetInventoryValue(54) == 2) {
if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) {
super->action = 3;
super->spriteSettings.draw = 1;
}
@@ -437,7 +437,7 @@ void sub_08095088(Object6AEntity* this) {
switch (super->action) {
case 0:
if (GetInventoryValue(91))
if (GetInventoryValue(ITEM_JABBERNUT))
DeleteThisEntity();
super->action = 1;
super->spritePriority.b0 = 7;
+3 -2
View File
@@ -1,4 +1,5 @@
#include "object.h"
#include "item.h"
void sub_08099ECC(Entity*);
extern void sub_0805B390(u32);
@@ -14,7 +15,7 @@ void sub_08099DD0(Entity* this) {
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->subAction = 0;
if (GetInventoryValue(0x46)) {
if (GetInventoryValue(ITEM_FLIPPERS)) {
this->action = 4;
this->frameIndex = 0;
} else {
@@ -68,6 +69,6 @@ void sub_08099ECC(Entity* this) {
this->subAction = 1;
CopyPosition(this, &gPlayerEntity);
gPlayerState.queued_action = PLAYER_FALL;
gPlayerState.field_0x34[4] = 0;
gPlayerState.field_0x38 = 0;
gPlayerState.flags |= PL_FLAGS8000;
}
+1 -1
View File
@@ -107,7 +107,7 @@ void ObjectOnSpinyBeetle_Action1(ObjectOnSpinyBeetleEntity* this) {
case 0x18:
case 0x19:
case 0x1a:
if (super->type == 0 || (gPlayerState.field_0xac & 8) != 0) {
if (super->type == 0 || (gPlayerState.skills & SKILL_ROCK_BREAKER) != 0) {
sub_080989C0(this);
}
break;
-6
View File
@@ -7,12 +7,6 @@
#include "functions.h"
#include "effects.h"
extern void sub_0809E96C(Entity*);
extern void CreateSparkle(Entity*);
extern u32 sub_0809E9A0(void);
extern void sub_0809E918(Entity*);
extern void CreateMinishEntrance(u32 tile);
extern void (*const gUnk_08124354[])(Entity*);
extern s16 gUnk_08124364[];
+5 -6
View File
@@ -271,7 +271,6 @@ extern void sub_08079258(void);
extern void EnablePlayerDraw(Entity*);
extern u32 sub_08079B24(void);
extern void sub_08079708(Entity*);
extern Entity* CreatePlayerBomb(Entity*, u32);
extern u32 sub_0806F854(Entity*, s32, s32);
extern u32 UpdatePlayerCollision(void);
extern void sub_08079744(Entity*);
@@ -1640,7 +1639,7 @@ static void sub_08071DD0(Entity* this) {
}
static void sub_08071E04(Entity* this) {
if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == '\0')) {
if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == 0)) {
UpdateFloorType();
if (gPlayerState.floor_type == SURFACE_PIT) {
gPlayerState.field_0x11 = 7;
@@ -1689,7 +1688,7 @@ static void PlayerEmptyBottleInit(Entity* this) {
Entity* ent;
ResetPlayer();
ent = CreatePlayerBomb(this, 0xe);
ent = CreatePlayerBomb((ItemBehavior*)this, 0xe);
if (ent != NULL) {
ent->field_0x68.HALF.LO = gPlayerState.field_0x38;
this->subAction++;
@@ -1702,7 +1701,7 @@ static void PlayerEmptyBottleInit(Entity* this) {
break;
default:
gPlayerState.animation = 0x610;
sub_0807CAA0(gPlayerState.field_0x38, 2);
SetInventoryValue(gPlayerState.field_0x38, 2);
break;
}
}
@@ -3472,7 +3471,7 @@ void SurfaceAction_14(Entity* this) {
}
void SurfaceAction_CloneTile(Entity* this) {
if (gPlayerState.field_0xa0[0] == 4) {
if (gPlayerState.chargeState.action == 4) {
u32 item, n, i;
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A])) {
item = gSave.stats.itemButtons[SLOT_A];
@@ -3533,7 +3532,7 @@ void SurfaceAction_16(Entity* this) {
}
void SurfaceAction_Ice(Entity* this) {
if (!sub_080741C4() && ((gPlayerState.field_0x34[1] & 0x80) == 0 || this->knockbackDuration != 0)) {
if (!sub_080741C4() && ((gPlayerState.field_0x35 & 0x80) == 0 || this->knockbackDuration != 0)) {
ResetPlayerVelocity();
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
#include "sound.h"
#include "functions.h"
#include "asm.h"
#include "item.h"
void sub_0801B804(Entity*);
Entity* sub_0801B864(Entity*);
@@ -206,7 +207,7 @@ void sub_0801B804(Entity* this) {
u32 itemSlot;
u32 uVar1;
itemSlot = IsItemEquipped(0xc);
itemSlot = IsItemEquipped(ITEM_MAGIC_BOOMERANG);
switch (itemSlot) {
case 0:
uVar1 = 1;
+1 -1
View File
@@ -78,7 +78,7 @@ void sub_0801B938(Entity* this) {
this->hitbox = (Hitbox*)&gUnk_080B7850[this->animationState >> 1];
ptr = &gUnk_080B7848[(this->animationState >> 1) * 2];
sub_08008782(this, -(gPlayerState.field_0xac & 8) != 0, ptr[0], ptr[1]);
sub_08008782(this, -(gPlayerState.skills & SKILL_ROCK_BREAKER) != 0, ptr[0], ptr[1]);
sub_08078E84(this, &gPlayerEntity);
}
+1873
View File
File diff suppressed because it is too large Load Diff
-38
View File
@@ -1,38 +0,0 @@
#include "player.h"
#include "functions.h"
void ResetPlayer() {
u32 index = 0;
ItemBehavior* ptr = gUnk_03000B80;
do {
sub_08077E78(ptr, index);
ptr++;
index++;
} while (index <= 2);
gPlayerState.field_0x3c[1] = 0;
gPlayerState.field_0x1c = 0;
gPlayerState.field_0x1f[2] = 0;
gPlayerState.field_0x0[1] = 0;
gPlayerState.field_0xe = 0;
gPlayerState.dash_state = 0;
gPlayerState.sword_state = 0;
gPlayerState.field_0x3[0] = 0;
gPlayerState.heldObject = 0;
gPlayerState.flags &= ~(PL_ROLLING | PL_SWORD_THRUST);
gPlayerEntity.field_0x70.WORD = 0;
if ((gPlayerState.jump_status & 0xc0) == 0) {
gPlayerState.jump_status = 0;
}
switch (gPlayerState.framestate) {
case 2:
case 3:
case 4: {
gPlayerState.framestate = PL_STATE_IDLE;
break;
}
}
}
+17 -20
View File
@@ -169,7 +169,7 @@ u32 sub_unk3_CrenelMinishPaths_MelarisMine(void) {
void sub_StateChange_CrenelMinishPaths_MelarisMine(void) {
sub_080580B0(0x22);
// white sword
if (GetInventoryValue(0x2))
if (GetInventoryValue(ITEM_GREEN_SWORD))
SetGlobalFlag(WHITE_SWORD_END);
}
@@ -341,8 +341,7 @@ extern EntityData gUnk_080D6558;
extern EntityData gUnk_080D6618;
void sub_StateChange_HouseInteriors1_Library2F(void) {
// flippers
if (GetInventoryValue(0x46) == 0) {
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
LoadRoomEntityList(&gUnk_080D6578);
if (CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK) == 0) {
LoadRoomEntityList(&gUnk_080D6638);
@@ -366,8 +365,7 @@ void sub_StateChange_HouseInteriors1_Library1F(void) {
if (gSave.global_progress > 4) {
LoadRoomEntityList(&gUnk_080D6714);
}
// flippers
if (!GetInventoryValue(0x46) && CheckGlobalFlag(MIZUKAKI_START) && CheckLocalFlag(MIZUKAKI_KOBITO)) {
if (!GetInventoryValue(ITEM_FLIPPERS) && CheckGlobalFlag(MIZUKAKI_START) && CheckLocalFlag(MIZUKAKI_KOBITO)) {
LoadRoomEntityList(&gUnk_additional_9_HouseInteriors1_Library1F);
} else {
LoadRoomEntityList(&gUnk_additional_8_HouseInteriors1_Library1F);
@@ -807,8 +805,7 @@ u32 sub_unk3_GreatFairies_Exit(void) {
extern EntityData gUnk_080D7D34;
void sub_StateChange_GreatFairies_Exit(void) {
// four sword
if (GetInventoryValue(0x6)) {
if (GetInventoryValue(ITEM_FOURSWORD)) {
SetTile(0x4072, 0x14d, 1);
SetTile(0x4072, 0x10c, 1);
SetTile(0x4090, 0x14c, 1);
@@ -942,9 +939,9 @@ extern EntityData gUnk_080D8A34;
extern EntityData gUnk_080D8A04;
extern EntityData gUnk_080D89E4;
extern u32 gUnk_080D8BBC;
extern u32 gUnk_080D8BFA;
extern u32 gUnk_080D8C68;
extern u16 gUnk_080D8BBC;
extern u16 gUnk_080D8BFA;
extern u16 gUnk_080D8C68;
void sub_StateChange_GoronCave_Main(void) {
if (!CheckLocalFlag(GORON_DOUKUTU_APPEAR))
@@ -974,7 +971,7 @@ void sub_StateChange_GoronCave_Main(void) {
}
typedef struct {
u32* a;
u16* a;
u16 x, y;
u16 entCnt;
u16 shakeTime, shakeMag, sfx;
@@ -990,7 +987,7 @@ void sub_0804BF38(Entity* this, ScriptExecutionContext* context) {
u32 xOff;
struct_080D8E54* ptr;
u32 xtile, ytile;
u32* a;
u16* a;
iVar2 = context->intVariable;
ptr = &gUnk_080D8E50[iVar2];
@@ -4822,7 +4819,7 @@ void sub_StateChange_HouseInteriors2_Julietta(void) {
LoadRoomEntityList(&gUnk_080F2570);
break;
}
if (!GetInventoryValue(0x39)) {
if (!GetInventoryValue(ITEM_QST_BOOK1)) {
LoadRoomEntityList(&gUnk_080F25C0);
}
} else {
@@ -5412,7 +5409,7 @@ extern EntityData gUnk_080F5788;
void sub_StateChange_HouseInteriors3_StockwellShop(void) {
LoadRoomEntityList(&gUnk_080F5758);
if (!GetInventoryValue(0x36) && CheckLocalFlagByBank(0x200, 0x8f)) {
if (!GetInventoryValue(ITEM_QST_DOGFOOD) && CheckLocalFlagByBank(0x200, 0x8f)) {
LoadRoomEntityList(&gUnk_080F57E8);
}
if (!CheckLocalFlag(0x55)) {
@@ -5459,7 +5456,7 @@ extern EntityData gUnk_080F5B3C;
void sub_StateChange_HouseInteriors3_RemShoeShop(void) {
#ifndef EU
if (GetInventoryValue(0x38) == 1) {
if (GetInventoryValue(ITEM_QST_MUSHROOM) == 1) {
LoadRoomEntityList(&gUnk_080F5B3C);
}
#endif
@@ -5828,14 +5825,14 @@ extern u32 gUnk_080F7C80;
extern void sub_0804F4E4(void);
u32 sub_unk3_HyruleField_OutsideCastle(void) {
if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(0x11)) {
if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(ITEM_GUST_JAR)) {
gRoomVars.field_0x6c[0] = &gUnk_080F7CD0;
gRoomVars.field_0x6c[7] = sub_0804F5E8;
}
#if defined(JP) || defined(EU) || defined(DEMO_JP)
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(0x3) && !CheckLocalFlag(0x8a)) {
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(ITEM_RED_SWORD) && !CheckLocalFlag(0x8a)) {
#else
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(0x3) && !CheckLocalFlag(0x8c)) {
if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(ITEM_RED_SWORD) && !CheckLocalFlag(0x8c)) {
#endif
gRoomVars.field_0x6c[0] = &gUnk_080F7C80;
gRoomVars.field_0x6c[7] = sub_0804F4E4;
@@ -6087,7 +6084,7 @@ void sub_StateChange_Caves_Boomerang(void) {
} else {
LoadRoomEntityList(&gUnk_080F85F8);
}
if (!GetInventoryValue(0xc)) {
if (!GetInventoryValue(ITEM_MAGIC_BOOMERANG)) {
ClearLocalFlag(8);
}
}
@@ -6682,7 +6679,7 @@ void sub_StateChange_MtCrenel_CaveOfFlamesEntrance(void) {
if ((gSave.windcrests & 0x1000000) == 0) {
LoadRoomEntityList(&gUnk_080FB004);
}
if (GetInventoryValue(0x2)) {
if (GetInventoryValue(ITEM_GREEN_SWORD)) {
SetGlobalFlag(WHITE_SWORD_END);
}
}
+19 -20
View File
@@ -3,12 +3,11 @@
#include "screen.h"
#include "area.h"
#include "game.h"
#include "object.h"
#include "npc.h"
#include "kinstone.h"
#include "functions.h"
#include "item.h"
void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*);
void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script);
@@ -146,7 +145,7 @@ void ScriptCommand_IncreaseMaxHealth(Entity* entity, ScriptExecutionContext* con
void ScriptCommand_GivePlayerItem(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_GiveKinstone(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_GetInventoryValue(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807F078(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_SetInventoryValue(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807F088(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_CameraTargetEntity(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_CameraTargetPlayer(Entity* entity, ScriptExecutionContext* context);
@@ -596,7 +595,7 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) {
ScriptCommand_GivePlayerItem,
ScriptCommand_GiveKinstone,
ScriptCommand_GetInventoryValue,
ScriptCommand_0807F078,
ScriptCommand_SetInventoryValue,
ScriptCommand_0807F088,
ScriptCommand_CameraTargetEntity,
ScriptCommand_CameraTargetPlayer,
@@ -1502,8 +1501,8 @@ void ScriptCommand_GetInventoryValue(Entity* entity, ScriptExecutionContext* con
context->condition = context->intVariable != 0;
}
void ScriptCommand_0807F078(Entity* entity, ScriptExecutionContext* context) {
sub_0807CAA0(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
void ScriptCommand_SetInventoryValue(Entity* entity, ScriptExecutionContext* context) {
SetInventoryValue(context->scriptInstructionPointer[1], context->scriptInstructionPointer[2]);
}
void ScriptCommand_0807F088(Entity* entity, ScriptExecutionContext* context) {
@@ -1615,21 +1614,21 @@ void EquipItem(Entity* entity, ScriptExecutionContext* context) {
slot = context->intVariable >> 0x10;
item &= 0xFFFF;
switch (item) {
case 1:
case 2:
case 3:
case 4:
case 6:
case ITEM_SMITH_SWORD:
case ITEM_GREEN_SWORD:
case ITEM_RED_SWORD:
case ITEM_BLUE_SWORD:
case ITEM_FOURSWORD:
// Pick greatest sword unlocked
item = 1;
if (GetInventoryValue(2))
item = 2;
if (GetInventoryValue(3))
item = 3;
if (GetInventoryValue(4))
item = 4;
if (GetInventoryValue(6))
item = 6;
item = ITEM_SMITH_SWORD;
if (GetInventoryValue(ITEM_GREEN_SWORD))
item = ITEM_GREEN_SWORD;
if (GetInventoryValue(ITEM_RED_SWORD))
item = ITEM_RED_SWORD;
if (GetInventoryValue(ITEM_BLUE_SWORD))
item = ITEM_BLUE_SWORD;
if (GetInventoryValue(ITEM_FOURSWORD))
item = ITEM_FOURSWORD;
break;
}
ForceEquipItem(item, slot);
+150
View File
@@ -4,11 +4,151 @@
#include "functions.h"
#include "game.h"
#include "map.h"
#include "asm.h"
#include "common.h"
#include "fileselect.h"
extern void sub_08080BC4(void);
extern u8 gUpdateVisibleTiles;
extern void (*const gUnk_0811E768[])(RoomControls*);
void sub_0807FC7C(RoomControls*);
void sub_080805F8(void);
extern void (*const gUnk_0811E780[])(RoomControls*);
extern void (*const gUnk_0811E794[])(RoomControls*);
extern u8 gMapDataTopSpecial[];
void UpdateScroll(void) {
gRoomControls.scroll_flags &= 0xfb;
gUnk_0811E768[gRoomControls.unk3](&gRoomControls);
}
void sub_0807FC64(RoomControls* controls) {
controls->unk3 = 1;
controls->reload_flags = 0;
controls->unk5 = 4;
sub_0807FC7C(controls);
sub_080805F8();
}
ASM_FUNC("asm/non_matching/scroll/sub_0807FC7C.inc", void sub_0807FC7C(RoomControls* controls))
void sub_0807FDB0(RoomControls* controls) {
gUnk_0811E780[controls->unk4](controls);
}
void sub_0807FDC8(RoomControls* controls) {
gUpdateVisibleTiles = 1;
UpdateScrollVram();
controls->unk4 = 1;
gUpdateVisibleTiles = 0;
}
void sub_0807FDE4(RoomControls* controls) {
controls->unk4 = 2;
controls->filler2[0] = 0;
gUpdateVisibleTiles = 2;
}
ASM_FUNC("asm/non_matching/scroll/sub_0807FDF8.inc", void sub_0807FDF8())
void sub_0807FEC8(RoomControls* this) {
this->unk3 = 0;
MemFill32(0xffffffff, gPlayerState.path_memory, 0x40);
gPlayerState.startPosX = this->camera_target->x.HALF.HI;
gPlayerState.startPosY = this->camera_target->y.HALF.HI;
}
void sub_0807FEF0(RoomControls* controls) {
extern void (*const gUnk_0811E78C[])(RoomControls*);
gUnk_0811E78C[controls->unk4](controls);
}
void sub_0807FF08(RoomControls* controls) {
controls->unk4 = 1;
controls->filler2[0] = 0;
gUpdateVisibleTiles = 3;
}
void sub_0807FF1C(RoomControls* controls) {
if ((gRoomTransition.frameCount & 1U) == 0) {
gUpdateVisibleTiles = 3;
if (++controls->filler2[0] > 0x13) {
controls->unk3 = 0;
ResetSystemPriority();
}
}
}
void sub_0807FF54(RoomControls* controls) {
gUnk_0811E794[controls->unk4](controls);
}
ASM_FUNC("asm/non_matching/scroll/sub_0807FF6C.inc", void sub_0807FF6C())
ASM_FUNC("asm/non_matching/scroll/sub_0807FFE4.inc", void sub_0807FFE4())
ASM_FUNC("asm/non_matching/scroll/sub_08080040.inc", void sub_08080040())
ASM_FUNC("asm/non_matching/scroll/sub_08080108.inc", void sub_08080108())
void sub_08080198(RoomControls* controls) {
controls->unk4 = 5;
controls->filler2[2] = 0xff;
LoadRoom();
CallRoomProp5And7();
gUpdateVisibleTiles = 0;
sub_080805F8();
}
ASM_FUNC("asm/non_matching/scroll/sub_080801BC.inc", void sub_080801BC())
ASM_FUNC("asm/non_matching/scroll/sub_08080278.inc", void sub_08080278())
ASM_FUNC("asm/non_matching/scroll/sub_08080368.inc", void sub_08080368())
ASM_FUNC("asm/non_matching/scroll/sub_080803D0.inc", void sub_080803D0())
void sub_080805F8(void) {
switch (gRoomControls.area) {
case 0xc:
case 0x0f:
case 0x13:
case 0x14:
case 0x16:
case 0x17:
case 0x19:
gUnk_03004030.unk_08 = 1;
return;
}
gUnk_03004030.unk_08 = 0;
}
void ClearTilemaps(void) {
MemClear(&gRoomControls, 0x38);
MemClear(&gUnk_03004030, 0xc);
gRoomControls.filler3 = 0xffff;
gUnk_03004030.unk_0a = 0xff;
gUnk_02034480.unk_00 = 0;
MemClear(&gUnk_02019EE0, 0x8000);
MemClear(&gMapDataTopSpecial, 0x8000);
}
ASM_FUNC("asm/non_matching/scroll/sub_080806BC.inc", bool32 sub_080806BC(u32 a, u32 b, u32 c, u32 d))
ASM_FUNC("asm/non_matching/scroll/sub_08080734.inc", void sub_08080734())
ASM_FUNC("asm/non_matching/scroll/sub_08080794.inc", void sub_08080794())
ASM_FUNC("asm/non_matching/scroll/sub_08080808.inc", void sub_08080808())
ASM_FUNC("asm/non_matching/scroll/DoExitTransition.inc", void DoExitTransition(const ScreenTransitionData* data))
void sub_080808D8(void) {
gRoomTransition.type = TRANSITION_DEFAULT;
}
@@ -122,3 +262,13 @@ void sub_080809D4(void) {
sub_08080BC4();
gUpdateVisibleTiles = 1;
}
ASM_FUNC("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTransition())
ASM_FUNC("asm/non_matching/scroll/sub_08080B60.inc", void sub_08080B60())
ASM_FUNC("asm/non_matching/scroll/sub_08080BC4.inc", void sub_08080BC4())
ASM_FUNC("asm/non_matching/scroll/sub_08080C80.inc", void sub_08080C80())
ASM_FUNC("asm/non_matching/scroll/sub_08080CB4.inc", void sub_08080CB4(Entity* a))
-53
View File
@@ -1,53 +0,0 @@
#include "asm.h"
#include "room.h"
extern void sub_0807B778(u32, u32);
void sub_0807B7D8(u32 param_1, u32 param_2, u32 param_3) {
if (param_1 == 53) {
sub_08000152(53, param_2, param_3);
sub_0807B778(param_2, param_3);
sub_0807B778(param_2 + 1, param_3);
sub_0807B778(param_2 - 1, param_3);
sub_0807B778(param_2 + 64, param_3);
sub_0807B778(param_2 - 64, param_3);
} else {
SetTileType(param_1, param_2, param_3);
}
}
void sub_0807B820(u32 param_1) {
SetTileType(620, param_1 - 65, 1);
SetTileType(627, param_1 - 65, 2);
SetTileType(621, param_1 - 64, 1);
SetTileType(628, param_1 - 64, 2);
SetTileType(622, param_1 - 63, 1);
SetTileType(629, param_1 - 63, 2);
SetTileType(623, param_1 - 1, 1);
SetTileType(624, param_1, 1);
SetTileType(626, param_1 + 1, 1);
}
void sub_0807B8A8(u32 param_1) {
SetTileType(636, param_1 - 65, 1);
SetTileType(643, param_1 - 65, 2);
SetTileType(637, param_1 - 64, 1);
SetTileType(644, param_1 - 64, 2);
SetTileType(638, param_1 - 63, 1);
SetTileType(645, param_1 - 63, 2);
SetTileType(639, param_1 - 1, 1);
SetTileType(640, param_1, 1);
SetTileType(642, param_1 + 1, 1);
}
void sub_0807B930(int param_1) {
SetTileType(652, param_1 - 65, 1);
SetTileType(659, param_1 - 65, 2);
SetTileType(653, param_1 - 64, 1);
SetTileType(660, param_1 - 64, 2);
SetTileType(654, param_1 - 63, 1);
SetTileType(661, param_1 - 63, 2);
SetTileType(655, param_1 - 1, 1);
SetTileType(656, param_1, 1);
SetTileType(658, param_1 + 1, 1);
}
-77
View File
@@ -1,77 +0,0 @@
#include "global.h"
#include "save.h"
#include "common.h"
extern u16 gMetatilesBottom[];
extern u16 gMetatilesTop[];
extern u8 gMapData;
extern const u8 gUnk_020176E0[];
void sub_0807C960(void* dest, u32 offset) {
void* src;
if (offset != -1) {
src = &gMapData + (offset & 0x7fffffff);
if ((u32)dest >> 0x18 == 6) {
LZ77UnCompVram(src, (void*)dest);
} else {
LZ77UnCompWram(src, (void*)dest);
}
}
}
void sub_0807C998(u32* a1) {
sub_0807C960(gMetatilesBottom, a1[0]);
sub_0807C960(gMetatilesBottom - 0x1000, a1[1]);
sub_0807C960(gMetatilesTop, a1[2]);
sub_0807C960(gMetatilesTop - 0x1000, a1[3]);
}
void sub_0807C9D8(u32* a1) {
u32* v1; // r5@1
v1 = a1;
sub_0807C960((u8*)0x6004000, *a1);
sub_0807C960((u8*)0x6000000, v1[1]);
sub_0807C960((u8*)0x6008000, v1[2]);
sub_0807C960((u8*)gUnk_020176E0, v1[3]);
LoadPalettes(gUnk_020176E0, 2, 13);
}
u32 FinalizeSave(void) {
if (gSave.invalid || gSave.initialized != 1) {
gSave.invalid = 0;
gSave.initialized = 1;
gSave.global_progress = 1;
gSave.stats.health = 24;
gSave.stats.maxHealth = 24;
gSave.saved_status.area_next = 0x22;
gSave.saved_status.room_next = 0x15; // links room
gSave.saved_status.start_anim = 0;
gSave.saved_status.spawn_type = PL_SPAWN_DEFAULT;
gSave.saved_status.layer = 1;
gSave.saved_status.start_pos_x = 0x90;
gSave.saved_status.start_pos_y = 0x38;
}
if (gSave.name[0] == '\0') {
MemCopy(gUnk_0811E470, &gSave.name, FILENAME_LENGTH - 1);
}
#ifdef DEMO_USA
{
const u8* tmp;
MemCopy(demoPointers[gSaveHeader->saveFileId], &gSave, 0x4B4);
if (gSaveHeader->language == 0) {
gSave.name[0] = 0x97;
gSave.name[1] = 0x7F;
gSave.name[2] = 0xDD;
gSave.name[3] = 0;
}
ModHealth(0xA0);
ModRupees(-9999);
tmp = demoUnknown1 + gUnk_02000010.field_0x7 * 3;
gSave.demo_timer = tmp[gSaveHeader->saveFileId] * 3600;
}
#endif
return 1;
}
+864
View File
@@ -0,0 +1,864 @@
#include "global.h"
#include "menu.h"
#include "fade.h"
#include "flags.h"
#include "sound.h"
#include "room.h"
#include "functions.h"
#include "effects.h"
#include "asm.h"
#include "save.h"
#include "kinstone.h"
#include "screen.h"
#include "common.h"
#include "object.h"
#include "message.h"
extern void (*const gUnk_080FEEB8[])(void);
extern void sub_0801876C(u32, u32);
extern u8 gUpdateVisibleTiles;
void sub_08055B70(u32, u32, u32, u32);
extern void sub_08054974(u32, u32);
extern void (*const gUnk_080FEEC8[])(void);
void sub_080553E0(u32);
extern void (*const gUnk_080FEF34[])(void);
extern EntityData gUnk_080FEED4[];
extern void (*const gUnk_080FEF3C[])(void);
extern void sub_0804B0E8(u32, u32);
extern void (*const gUnk_080FF120[])(void);
extern EntityData* gUnk_080FF108[];
extern void (*const gUnk_080FF148[])(void);
extern EntityData gUnk_080FF128[];
extern void (*const gUnk_080FF174[])(void);
extern EntityData gUnk_080FF154[];
extern void (*const gUnk_080FF1CC[])(void);
extern EntityData gUnk_080FF17C[];
extern void (*const gUnk_080FF1F4[])(void);
extern const s16 gUnk_080FF1D4[];
extern const u16 gUnk_080FF204[];
extern void (*const gUnk_080FF228[])(void);
extern void (*const gUnk_080FF238[])(void);
extern void (*const gUnk_080FF254[])(void);
extern void (*const gUnk_080FF284[])(void);
extern const EntityData gUnk_080FF264[];
extern void (*const gUnk_080FF28C[])(void);
extern Entity* LoadRoomEntity(EntityData*);
extern void sub_08054A14(u32);
extern const EntityData gUnk_080FEE48[];
extern void (*const gUnk_080FF2B8[])(void);
extern const EntityData gUnk_080FF298[];
extern void (*const gUnk_080FF300[])(void);
extern const EntityData gUnk_080FF2C0[];
extern void (*const gUnk_080FF328[])(void);
extern const EntityData gUnk_080FF308[];
extern void (*const gUnk_080FF330[])(void);
void sub_08055994(void);
typedef struct {
u8 unk_0[6];
u8 unk_6;
u8 unk_7;
} struct_080FEAC8;
extern struct_080FEAC8 gUnk_080FEAC8[];
extern void (*const gUnk_080FF35C[])(void);
extern const EntityData gUnk_080FF33C[];
extern void (*const gUnk_080FF36C[])(void);
extern const EntityData gUnk_080FED18[];
extern const EntityData gUnk_080FF378[];
extern void (*const gUnk_080FF3F4[])(void);
void sub_08054C04(void) {
gUnk_080FEEB8[gMenu.overlayType]();
}
void sub_08054C20(void) {
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
sub_0801876C(gMenu.field_0x4, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08054C58(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
SetFade(7, 0x10);
gMenu.overlayType++;
}
}
void sub_08054C88(void) {
if (gFadeControl.active == 0) {
sub_08054974(gMenu.field_0x4, 0);
SetFade(6, 0x10);
SoundReq(SFX_SECRET_BIG);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08054CC0(void) {
if ((gFadeControl.active == 0) && (--gMenu.transitionTimer == 0)) {
gMenu.menuType++;
}
}
void sub_08054CE8(void) {
gUnk_080FEEC8[gMenu.overlayType]();
}
void sub_08054D04(void) {
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08054D3C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
sub_0801876C(gMenu.field_0x4, 1);
sub_080553E0(gMenu.field_0x4);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08054D74(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08054D90(void) {
gUnk_080FEF34[gMenu.overlayType]();
}
void sub_08054DAC(void) {
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
LoadRoomEntityList(gUnk_080FEED4);
sub_0805B4D0(2);
sub_0806D0B0(NULL);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void nullsub_484(void) {
}
void sub_08054E00(void) {
gUnk_080FEF3C[gMenu.overlayType]();
}
void sub_08054E1C(void) {
u8* ptr = gMenu.field_0xc;
sub_0804B0B0(ptr[2], ptr[3]);
sub_0804B0E8(ptr[2], ptr[3]);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08054E5C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
gMenu.overlayType++;
gMenu.transitionTimer = 0xb4;
SetFade(6, 0x10);
sub_080553E0(gMenu.field_0x4);
sub_0801876C(gMenu.field_0x4, 1);
}
}
void sub_08054E9C(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08054EB8(Entity* this, ScriptExecutionContext* context) {
Manager24* manager = (Manager24*)GetEmptyManager();
if (manager != NULL) {
(manager->manager).type = 9;
(manager->manager).subtype = 0x24;
manager->x = this->x.HALF.HI - gRoomControls.origin_x;
manager->y = (this->y.HALF.HI - gRoomControls.origin_y) - 0x10;
manager->field_0x35 = 1;
#if defined(EU) || defined(JP) || defined(DEMO_JP)
manager->field_0x3e = 0x77;
#else
manager->field_0x3e = 0x79;
#endif
AppendEntityToList((Entity*)manager, 6);
}
}
void sub_08054EFC(Entity* this) {
Entity* effect;
u32 tmp = COORD_TO_TILE(this) - 0x40;
SetTile(0x4074, tmp, 1);
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
effect = CreateFx(this, FX_BIG_EXPLOSION, 0);
if (effect != NULL) {
effect->y.HALF.HI -= 0x10;
SortEntityBelow(this, effect);
}
SoundReq(SFX_ITEM_BOMB_EXPLODE);
}
void sub_08054F64(Entity* this, ScriptExecutionContext* context) {
u32 tmp = this->type2;
if ((gActiveScriptInfo.syncFlags & tmp) != tmp) {
gActiveScriptInfo.commandSize = 0;
} else {
gActiveScriptInfo.syncFlags &= ~tmp;
gActiveScriptInfo.flags |= 1;
}
}
void sub_08054F90(void) {
gUnk_080FF120[gMenu.overlayType]();
}
void sub_08054FAC(void) {
u8* ptr;
u32 tmp;
ptr = gMenu.field_0xc;
LoadRoomEntityList(gUnk_080FF108[ptr[1]]);
if (ptr[1] != 0) {
tmp = 3;
} else {
tmp = 0;
}
sub_08055B70(gMenu.field_0x4, tmp, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
gMenu.field_0xa = 0;
if (CheckLocalFlagByBank(0x400, 0x77) && (ptr[2] == 0x2f)) {
gMenu.field_0xa = 1;
}
}
void sub_08055014(void) {
if (gMenu.field_0xa != 0) {
gMenu.field_0xa = 0;
SetTileType(0x74, 0x407, 1);
}
}
void sub_08055038(void) {
gUnk_080FF148[gMenu.overlayType]();
}
void sub_08055054(void) {
LoadRoomEntityList(gUnk_080FF128);
sub_08055B70(gMenu.field_0x4, 2, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_0805508C(void) {
}
void sub_08055090(void) {
}
void sub_08055094(void) {
gUnk_080FF174[gMenu.overlayType]();
}
void sub_080550B0(void) {
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
LoadRoomEntityList(gUnk_080FF154);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void nullsub_487(void) {
}
void sub_080550F8(void) {
gUnk_080FF1CC[gMenu.overlayType]();
}
void sub_08055114(void) {
LoadRoomEntityList(gUnk_080FF17C);
if (gSave.global_progress != 9) {
sub_08018C58(0xdb4);
}
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void nullsub_488(void) {
}
void sub_08055168(void) {
gUnk_080FF1F4[gMenu.overlayType]();
}
void sub_08055184(void) {
const s16* ptr = &gUnk_080FF1D4[(gMenu.field_0xc[1] & 0xf) * 3];
LoadGfxGroup(ptr[0]);
gScreen.bg3.xOffset = ptr[1];
gScreen.bg3.yOffset = ptr[2];
gScreen.bg3.control = 0x1e05;
gScreen.controls.layerFXControl = 0x3648;
gScreen.controls.alphaBlend = 0x10;
gScreen.lcd.displayControl |= 0x800;
sub_0801876C(gMenu.field_0x4, 1);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gMenu.storyPanelIndex = 0;
gMenu.transitionTimer = 0x3c;
gMenu.field_0xa = 0;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055224(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
gMenu.overlayType++;
}
}
void sub_0805524C(void) {
if (gMenu.storyPanelIndex == 0) {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
u32 tmp = gMenu.storyPanelIndex;
gMenu.storyPanelIndex = tmp + 1;
SoundReq(SFX_EVAPORATE);
}
} else if ((gRoomTransition.frameCount & 7U) == 0) {
if (gUnk_080FF204[gMenu.field_0xa] != 0xffff) {
gScreen.controls.alphaBlend = gUnk_080FF204[gMenu.field_0xa++];
} else {
gScreen.lcd.displayControl &= 0xf7ff;
gScreen.controls.alphaBlend = 0x1000;
gMenu.transitionTimer = 0x78;
gMenu.overlayType++;
#ifndef EU
SoundReq(SFX_SECRET_BIG);
#endif
}
}
}
void sub_080552E0(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_080552FC(void) {
gUnk_080FF228[gMenu.overlayType]();
}
void sub_08055318(void) {
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
sub_0801876C(gMenu.field_0x4, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055350(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
SetFade(7, 0x10);
gMenu.overlayType++;
}
}
void sub_08055380(void) {
if (gFadeControl.active == 0) {
sub_08054974(gMenu.field_0x4, 0);
SetFade(6, 0x10);
SoundReq(SFX_SECRET_BIG);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_080553B8(void) {
if ((gFadeControl.active == 0) && (--gMenu.transitionTimer == 0)) {
gMenu.menuType++;
}
}
void sub_080553E0(u32 param_1) {
u8* ptr = gMenu.field_0xc;
Entity* effect = CreateObject(SPECIAL_FX, FX_BIG_EXPLOSION2, 0);
if (effect != NULL) {
effect->x.HALF.HI = *(s16*)(ptr + 8) + gRoomControls.origin_x;
effect->y.HALF.HI = *(s16*)(ptr + 10) + gRoomControls.origin_y;
}
}
void sub_08055414(void) {
gUnk_080FF238[gMenu.overlayType]();
}
void sub_08055430(void) {
sub_0804B0E8(gMenu.field_0xc[2], gMenu.field_0xc[3]);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055468(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
SetFade(7, 0x10);
gMenu.overlayType++;
}
}
void sub_08055498(void) {
if (gFadeControl.active == 0) {
sub_0801876C(gMenu.field_0x4, 1);
sub_080553E0(gMenu.field_0x4);
SetFade(6, 0x10);
SoundReq(SFX_SECRET_BIG);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_080554D4(void) {
if ((gFadeControl.active == 0) && --gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_080554FC(void) {
extern void (*const gUnk_080FF248[])(void);
gUnk_080FF248[gMenu.overlayType]();
}
void sub_08055518(void) {
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055548(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
sub_0801876C(gMenu.field_0x4, 1);
sub_080553E0(gMenu.field_0x4);
gMenu.overlayType++;
gMenu.transitionTimer = 0xb4;
}
}
void sub_08055580(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_0805559C(void) {
gUnk_080FF254[gMenu.overlayType]();
}
void sub_080555B8(void) {
u8* ptr = gMenu.field_0xc;
SetLocalFlagByBank(gLocalFlagBanks[gMenu.field_0xc[0x11]], (u32) * (u16*)(gMenu.field_0xc + 0x12));
sub_0804B0E8(ptr[2], ptr[3]);
LoadGfxGroup(0x11);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_0805560C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
gMenu.overlayType++;
}
}
void sub_08055634(void) {
u8* ptr = gMenu.field_0xc;
Entity* obj = CreateObject(BEANSTALK, 0, 0);
if (obj != NULL) {
obj->x.HALF.HI = gRoomControls.origin_x + *(s16*)(ptr + 8);
obj->y.HALF.HI = gRoomControls.origin_y + *(s16*)(ptr + 10);
}
gMenu.overlayType++;
gMenu.transitionTimer = 0x186;
}
void sub_08055674(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055690(void) {
gUnk_080FF284[gMenu.overlayType]();
}
void sub_080556AC(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
LoadRoomEntityList((EntityData*)gUnk_080FF264);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
SetFade(4, 0x10);
}
void nullsub_489(void) {
}
void sub_080556F4(void) {
gUnk_080FF28C[gMenu.overlayType]();
}
void sub_08055710(void) {
Entity* entity;
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
entity = LoadRoomEntity((EntityData*)gUnk_080FEE48);
if (entity != NULL) {
entity->type2 = 2;
entity->field_0x86.HWORD = 0x80ff;
}
sub_08054A14(gMenu.field_0x4);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_0805576C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055798(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_080557B4(void) {
gUnk_080FF2B8[gMenu.overlayType]();
}
void sub_080557D0(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
sub_0804B0B0((u32)gMenu.field_0xc[2], gMenu.field_0xc[3]);
LoadRoomEntityList((EntityData*)gUnk_080FF298);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
SetFade(4, 0x10);
}
void nullsub_490(void) {
}
void sub_08055818(void) {
gUnk_080FF300[gMenu.overlayType]();
}
void sub_08055834(void) {
LoadRoomEntityList((EntityData*)gUnk_080FF2C0);
if (gSave.global_progress != 9) {
sub_08018C58(0xdb4);
}
sub_08055B70(gMenu.field_0x4, 1, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void nullsub_491(void) {
}
void sub_08055888(void) {
gUnk_080FF328[gMenu.overlayType]();
}
void sub_080558A4(void) {
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
LoadRoomEntityList((EntityData*)gUnk_080FF308);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void nullsub_492(void) {
}
void sub_080558EC(void) {
gUnk_080FF330[gMenu.overlayType]();
}
void sub_08055908(void) {
u8* ptr = gMenu.field_0xc;
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
sub_0804B0E8(ptr[2], ptr[3]);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055948(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
sub_08055994();
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055978(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055994(void) {
u32 layer;
struct_080FEAC8* ptr = &gUnk_080FEAC8[gMenu.field_0x4];
if ((ptr->unk_6 & 1) != 0) {
layer = 2;
} else {
layer = 1;
}
SetTileType(0x73, (*(u16*)(gMenu.field_0xc + 8) >> 4 & 0x3f) | (*(u16*)(gMenu.field_0xc + 10) >> 4 & 0x3f) << 6,
layer);
sub_080553E0((u32)gMenu.field_0x4);
SoundReq(SFX_SECRET_BIG);
}
void sub_080559E0(void) {
gUnk_080FF35C[gMenu.overlayType]();
}
void sub_080559FC(void) {
if (gMenu.field_0xc[1] != 0) {
LoadRoomEntityList((EntityData*)gUnk_080FF33C);
}
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055A3C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
SetFade(7, 0x10);
gMenu.overlayType++;
}
}
void sub_08055A6C(void) {
if (gFadeControl.active == 0) {
sub_0801876C(gMenu.field_0x4, 1);
sub_080553E0(gMenu.field_0x4);
SetFade(6, 0x10);
SoundReq(SFX_SECRET_BIG);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055AA8(void) {
if ((gFadeControl.active == 0) && --gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055AD0(void) {
gUnk_080FF36C[gMenu.overlayType]();
}
void sub_08055AEC(void) {
Entity* entity;
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
entity = LoadRoomEntity((EntityData*)&gUnk_080FED18[gMenu.field_0xc[1]]);
if (entity != NULL) {
entity->type2 = 1;
}
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055B38(void) {
if (gFadeControl.active == 0) {
gMenu.transitionTimer = 0x78;
}
}
void sub_08055B54(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055B70(u32 param_1, u32 param_2, u32 param_3, u32 param_4) {
u8* ptr = gMenu.field_0xc;
Entity* entity = LoadRoomEntity((EntityData*)&gUnk_080FF378[param_2]);
if (entity != NULL) {
entity->x.HALF.HI = *(s16*)(ptr + 8) + param_3 + gRoomControls.origin_x;
entity->y.HALF.HI = *(s16*)(ptr + 10) + param_4 + gRoomControls.origin_y;
}
}
void sub_08055BB0(void) {
extern void (*const gUnk_080FF3C8[])(void);
gUnk_080FF3C8[gMenu.overlayType]();
}
void sub_08055BCC(void) {
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
sub_0801876C(gMenu.field_0x4, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055C04(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
SetFade(7, 0x10);
gMenu.overlayType++;
}
}
void sub_08055C34(void) {
u8* ptr;
Entity* entity;
if (gFadeControl.active == 0) {
ptr = gMenu.field_0xc;
sub_080553E0((u32)gMenu.field_0x4);
if ((ptr[1] & 0x80) != 0) {
sub_08054974(gMenu.field_0x4, 0);
} else {
entity = FindEntity(OBJECT, TREE_THORNS, 6, 0, ptr[1] & 0x80);
if (entity != NULL) {
DeleteEntity(entity->child);
DeleteEntity(entity);
}
}
SetFade(6, 0x10);
SoundReq(SFX_SECRET_BIG);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055CB0(void) {
if ((gFadeControl.active == 0) && --gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055CD8(void) {
extern void (*const gUnk_080FF3E8[])(void);
gUnk_080FF3E8[gMenu.overlayType]();
}
void sub_08055CF4(void) {
sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]);
sub_08055B70(gMenu.field_0x4, 0, 0, 0);
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055D2C(void) {
if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) {
sub_0801876C(gMenu.field_0x4, 1);
sub_080553E0(gMenu.field_0x4);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055D64(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
void sub_08055D80(void) {
gUnk_080FF3F4[gMenu.overlayType]();
}
void sub_08055D9C(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
SetFade(4, 0x10);
}
void sub_08055DC0(void) {
if (gFadeControl.active == 0) {
MessageFromTarget(0xa01);
gMenu.overlayType++;
gMenu.transitionTimer = 0x78;
}
}
void sub_08055DEC(void) {
if (--gMenu.transitionTimer == 0) {
gMenu.menuType++;
}
}
+412
View File
@@ -0,0 +1,412 @@
#include "global.h"
#include "menu.h"
#include "game.h"
#include "subtask.h"
#include "save.h"
#include "screen.h"
#include "common.h"
#include "fileselect.h"
#include "flags.h"
#include "functions.h"
#include "main.h"
#include "message.h"
extern void CreateDialogBox(u32, u32);
extern u8 gUnk_08128D38[];
extern u8 gUnk_08128D43[];
void sub_080A5CFC(u32, void*, u32);
void sub_080A6FB4(u32, u32);
extern void DrawDungeonMap(u32 floor, struct_02019EE0* data, u32 size);
extern void LoadDungeonMap(void);
void DrawDungeonFeatures(u32, void*, u32);
extern void (*const gUnk_08128D58[])(void);
extern KeyButtonLayout gUnk_08128D60;
extern void (*const gUnk_08128DB0[])(void);
void sub_080A617C(void);
void sub_080A7040(u32);
extern u8 gUnk_08128DB8[];
extern KeyButtonLayout gUnk_08128DBC;
extern void (*const gUnk_08128DCC[])(void);
void sub_080A6378(void);
extern void (*const gUnk_08128F24[])(void);
void sub_080A6E70(void);
void sub_080A6498(void);
void sub_080A4DB8(u32);
void sub_080A6290(void);
u32 sub_080A6D74(u32);
extern const ScreenTransitionData gUnk_08128024[];
void sub_080A71F4(ScreenTransitionData*);
extern u8 gUnk_02018EB0[];
extern void DeleteAllEntities(void);
extern void sub_0805E974(void);
extern void (*const gUnk_0812901C[])(void);
void sub_080A74F4(void);
extern void DrawUI(void);
extern void UpdateCarriedObject(void);
extern void (*const gSubtasks[])(void);
ASM_FUNC("asm/non_matching/subtask2/sub_080A5594.inc", void sub_080A5594())
ASM_FUNC("asm/non_matching/subtask2/sub_080A56A0.inc", void sub_080A56A0())
ASM_FUNC("asm/non_matching/subtask2/sub_080A57F4.inc", void sub_080A57F4())
void sub_080A5990(void) {
extern void (*const gUnk_08128D14[])(void);
gUnk_08128D14[gMenu.menuType]();
}
void sub_080A59AC(void) {
gMenu.field_0x3 = 0;
SetPopupState(0, 0);
SetMenuType(1);
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A59C8.inc", void sub_080A59C8())
void sub_080A5A54(void) {
switch (HandleSave(0)) {
case SAVE_ERROR:
CreateDialogBox(9, 0);
gMenu.transitionTimer = 0x3c;
// fallthrough
case SAVE_OK:
SetMenuType(3);
break;
case SAVE_BUSY:
break;
}
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A5A90.inc", void sub_080A5A90())
ASM_FUNC("asm/non_matching/subtask2/sub_080A5AD8.inc", void sub_080A5AD8())
ASM_FUNC("asm/non_matching/subtask2/sub_080A5AF4.inc", void sub_080A5AF4())
ASM_FUNC("asm/non_matching/subtask2/sub_080A5B34.inc", void sub_080A5B34())
ASM_FUNC("asm/non_matching/subtask2/sub_080A5BB8.inc", void sub_080A5BB8())
ASM_FUNC("asm/non_matching/subtask2/sub_080A5BF0.inc", void sub_080A5BF0())
void sub_080A5C44(u32 param_1, u32 param_2, u32 param_3) {
s8* ptr;
gMenu.field_0xc = gUnk_08128D38;
sub_080A5CFC(gMenu.field_0x3, &gMenu, param_3);
LoadGfxGroup(0x81);
sub_080A6FB4(gArea.dungeon_idx, 1);
SetMenuType(1);
ptr = &gUnk_08128D43[(u32)gArea.dungeon_idx * 2];
gScreen.bg1.xOffset += ptr[0];
gScreen.bg1.yOffset += ptr[0];
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A5C9C.inc", void sub_080A5C9C())
void sub_080A5CFC(u32 menuType, void* param_2, u32 param_3) {
DrawDungeonFeatures(menuType, param_2, param_3);
LoadDungeonMap();
DrawDungeonMap(menuType, &gUnk_02019EE0, 0x400);
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A5D1C.inc", void sub_080A5D1C())
bool32 sub_080A5F24(void) {
bool32 result = TRUE;
if ((gArea.dungeon_idx == 6) && CheckLocalFlagByBank(0x8c0, 0x7b)) {
result = 0;
}
return result;
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A5F48.inc", void sub_080A5F48())
void sub_080A6008(void) {
gUnk_08128D58[gMenu.menuType]();
}
void sub_080A6024(void) {
sub_080A70AC((KeyButtonLayout*)&gUnk_08128D60);
sub_0801E738(0);
sub_080A4398();
SetMenuType(1);
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A6044.inc", void sub_080A6044())
void sub_080A60E0(void) {
gUnk_08128DB0[gMenu.menuType]();
sub_080A617C();
sub_080A7040(gMenu.field_0x3);
}
void sub_080A6108(void) {
gMenu.field_0xc = (u8*)gUnk_08128DB8;
sub_080A70AC((KeyButtonLayout*)&gUnk_08128DBC);
SetMenuType(1);
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A612C.inc", void sub_080A612C())
ASM_FUNC("asm/non_matching/subtask2/sub_080A617C.inc", void sub_080A617C())
void sub_080A6270(void) {
gUnk_08128DCC[gMenu.menuType]();
sub_080A6378();
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A6290.inc", void sub_080A6290())
ASM_FUNC("asm/non_matching/subtask2/sub_080A62E0.inc", void sub_080A62E0())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6378.inc", void sub_080A6378())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6438.inc", void sub_080A6438())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6498.inc", void sub_080A6498())
ASM_FUNC("asm/non_matching/subtask2/Subtask_MapHint.inc", void Subtask_MapHint())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6534.inc", void sub_080A6534())
ASM_FUNC("asm/non_matching/subtask2/sub_080A65AC.inc", void sub_080A65AC())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6608.inc", void sub_080A6608())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6650.inc", void sub_080A6650())
ASM_FUNC("asm/non_matching/subtask2/sub_080A667C.inc", void sub_080A667C())
ASM_FUNC("asm/non_matching/subtask2/sub_080A66D0.inc", void sub_080A66D0())
ASM_FUNC("asm/non_matching/subtask2/sub_080A67C4.inc", void sub_080A67C4())
ASM_FUNC("asm/non_matching/subtask2/sub_080A68D4.inc", void sub_080A68D4())
ASM_FUNC("asm/non_matching/subtask2/sub_080A698C.inc", void sub_080A698C())
ASM_FUNC("asm/non_matching/subtask2/sub_080A69E0.inc", void sub_080A69E0())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6A80.inc", void sub_080A6A80())
ASM_FUNC("asm/non_matching/subtask2/Subtask_LocalMapHint.inc", void Subtask_LocalMapHint())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6B04.inc", void sub_080A6B04())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6C1C.inc", void sub_080A6C1C())
void Subtask_FastTravel(void) {
FlushSprites();
gUnk_08128F24[gMenu.menuType]();
if (gMenu.field_0x0 != 0) {
sub_080A6E70();
}
sub_080A6498();
CopyOAM();
}
void sub_080A6CA8(void) {
sub_080A4D34();
sub_080A4DB8(0xd);
sub_080A6290();
gMenu.field_0x3 = sub_080A6D74(0);
SetMenuType(1);
SetFade(4, 8);
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A6CD8.inc", void sub_080A6CD8())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6D74.inc", u32 sub_080A6D74(u32 a))
#ifdef EU
ASM_FUNC("asm/non_matching/subtask2/sub_080A6DD0.inc", u32 sub_080A6DD0(void))
#else
void sub_080A6DD0(void) {
u32 tmp;
switch (sub_08056338()) {
case 0:
gMenu.field_0x0 = 2;
tmp = 3;
break;
case 1:
tmp = 1;
break;
default:
return;
}
SetMenuType(tmp);
}
#endif
void sub_080A6DF8(void) {
if (gMenu.field_0x0 == 2) {
SetMenuType(4);
SetFade(5, 8);
} else {
ResetPlayerAnimationAndAction();
sub_080042D0(&gPlayerEntity, (u32)gPlayerEntity.animIndex, gPlayerEntity.spriteIndex);
Subtask_Exit();
gUnk_02034490.unk0 = 0;
SoundReq(SFX_MENU_CANCEL);
}
}
void sub_080A6E44(void) {
if (gFadeControl.active == 0) {
sub_080A71F4((ScreenTransitionData*)&gUnk_08128024[gMenu.field_0x3]);
}
}
ASM_FUNC("asm/non_matching/subtask2/sub_080A6E70.inc", void sub_080A6E70())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6EE0.inc", void sub_080A6EE0())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6F40.inc", void sub_080A6F40())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6F6C.inc", void sub_080A6F6C())
ASM_FUNC("asm/non_matching/subtask2/sub_080A6FB4.inc", void sub_080A6FB4(u32 a, u32 b))
ASM_FUNC("asm/non_matching/subtask2/sub_080A7040.inc", void sub_080A7040(u32 a))
ASM_FUNC("asm/non_matching/subtask2/sub_080A70AC.inc", void sub_080A70AC(const KeyButtonLayout* layout))
void SetMenuType(u32 menuType) {
gMenu.menuType = menuType;
gMenu.overlayType = 0;
gMenu.storyPanelIndex = 0;
}
void ResetUI(void) {
MemClear(&gUnk_02032EC0, 0x3b4);
}
void MenuFadeIn(u32 param_1, u32 param_2) {
if (gUnk_02032EC0.nextToLoad == 0) {
MemClear(&gUnk_02032EC0, 0x3b4);
gUnk_02032EC0.lastState = param_1;
gUnk_02032EC0.field_0x3 = param_2;
gUnk_02032EC0.pauseFadeIn = gMain.substate;
} else {
gUnk_02032EC0.state = param_1;
gUnk_02032EC0.field_0x5 = param_2;
gUnk_02032EC0.nextToLoad = 1;
}
gUnk_02032EC0.field_0x6 = 0;
gUnk_02032EC0.isLoading = 0xffff;
gUnk_02032EC0.fadeInTime = 0x20;
gMain.substate = 7;
SetFade(5, 0x20);
gUnk_02018EB0[0] = 0;
gUnk_02018EB0[1] = 0;
}
void sub_080A71A4(u32 param_1, u32 param_2, u32 param_3) {
if (gUnk_02032EC0.nextToLoad == 0) {
gUnk_02032EC0.fillerC[2] = param_3;
} else {
gUnk_02032EC0.fillerC[3] = param_3;
}
MenuFadeIn(param_1, param_2);
}
void sub_080A71C4(u32 param_1, u32 param_2, u32 param_3, u32 param_4) {
MenuFadeIn(param_1, param_2);
gUnk_02032EC0.isLoading = param_3;
gUnk_02032EC0.fadeInTime = param_4;
}
void Subtask_Exit(void) {
gUnk_02032EC0.nextToLoad = 3;
SetFade(5, 0x20);
}
void sub_080A71F4(ScreenTransitionData* exitTransition) {
if (exitTransition != NULL) {
DoExitTransition(exitTransition);
}
DeleteAllEntities();
sub_0805E974();
DeleteAllEntities();
gMain.state = 1;
gMain.substate = 0;
}
void GameMain_Subtask(void) {
if (gUnk_02032EC0.nextToLoad < 3) {
if (gUnk_02032EC0.state != 0) {
gUnk_02032EC0.field_0x3 = gUnk_02032EC0.field_0x5;
gUnk_02032EC0.lastState = gUnk_02032EC0.state;
gUnk_02032EC0.state = 0;
}
}
gUnk_0812901C[gUnk_02032EC0.nextToLoad]();
}
ASM_FUNC("asm/non_matching/subtask2/Subtask_FadeIn.inc", void Subtask_FadeIn())
void Subtask_Init(void) {
if (gFadeControl.active == 0) {
DeleteAllEntities();
MemClear(&gMenu, 0x30);
MemClear(&gRoomControls, 0x38);
MemClear(gOAMControls.unk, 0x100);
MemClear(&gActiveScriptInfo, 0xc);
gActiveScriptInfo.unk_08 = 8;
DispReset(1);
MessageInitialize();
ResetPalettes();
ResetPaletteTable(0);
gGFXSlots.unk0 = 1;
gUnk_02032EC0.nextToLoad = 2;
gRoomTransition.field_0x2c[4] = 1;
}
}
ASM_FUNC("asm/non_matching/subtask2/Subtask_FadeOut.inc", void Subtask_FadeOut())
void Subtask_Die(void) {
sub_080A74F4();
if (gFadeControl.active == 0) {
gMain.substate = gUnk_02032EC0.pauseFadeIn;
gUnk_02032EC0.nextToLoad = gFadeControl.active;
gUnk_02032EC0.lastState = gFadeControl.active;
ResetSystemPriority();
}
}
void sub_080A74F4(void) {
SetInitializationPriority();
gMain.pad = 0;
FlushSprites();
UpdateEntities();
UpdateManagers();
DrawUI();
DrawOAMCmd();
UpdateCarriedObject();
DrawEntities();
CopyOAM();
}
void Subtask_Update(void) {
gSubtasks[gUnk_02032EC0.lastState]();
}