merge changes

This commit is contained in:
Henny022p
2021-03-28 13:26:33 +02:00
787 changed files with 82999 additions and 62161 deletions
+1 -1
View File
@@ -339,7 +339,7 @@ void ObjectUpdate(Entity* this) {
DrawEntity(this);
}
void sub_08017508(Entity* this) {
void ManagerUpdate(Entity* this) {
if (!sub_0805E3B0(this))
gManagerFunctions[this->id](this);
}
+6 -121
View File
@@ -1,127 +1,12 @@
#include "global.h"
#include "entity.h"
#include "item.h"
#include "audio.h"
// TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table?
void (*const gItemFunctions[])(ItemBehavior*, u32) = {
DebugItem, Sword, Sword, Sword, Sword, Sword, Sword, Bomb,
Bomb, Bow, Bow, sub_08075D14, sub_08075D14, Shield, Shield, Lantern,
Lantern, GustJar, PacciCane, MoleMitts, RocsCape, sub_08076800, DebugItem, Ocarina,
DebugItem, DebugItem, DebugItem, TryPickupObject, JarEmpty, JarEmpty, JarEmpty, JarEmpty,
ItemDebug, ItemSword, ItemSword, ItemSword, ItemSword, ItemSword, ItemSword,
ItemBomb, ItemBomb, ItemBow, ItemBow, ItemBoomerang, ItemBoomerang, ItemShield,
ItemShield, ItemLantern, ItemLantern, ItemGustJar, ItemPacciCane, ItemMoleMitts, ItemRocsCape,
ItemPegasusBoots, ItemDebug, ItemOcarina, ItemDebug, ItemDebug, ItemDebug, ItemTryPickupObject,
ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty,
};
extern void sub_08077E78(ItemBehavior*, u32);
extern void sub_08078F60(void);
extern void sub_08077D38(ItemBehavior*, u32);
extern void sub_0805E544(void);
extern void UpdateItemAnim(ItemBehavior*);
extern void CreateBird(void);
extern void UnfreezeTime(void);
extern void sub_0806F948(Entity*);
extern void sub_08077BB8(ItemBehavior*);
extern void CreatePlayerBomb(ItemBehavior*, u32);
extern u32 sub_08077EFC();
extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
extern void (*const gUnk_0811BDF4[])(ItemBehavior* beh, u32);
#if 0
void Ocarina(ItemBehavior* beh, u32 inputFlags) {
gOcarinaStates[beh->stateID](beh, inputFlags);
gPlayerEntity.field_0x7a++;
}
void OcarinaUse(ItemBehavior *beh, u32 arg1)
{
u32 bVar1;
if (gPlayerState.playerAction == 0x18) {
PlayerChangeState(beh, arg1);
}
else {
beh->field_0x5[4] = beh->field_0x5[4] | 0xf;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.b.flipX = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.field_0x7a = 2;
gPlayerState.flags.all |= 0x10000000;
gPlayerState.field_0x27[0] = 0xff;
gUnk_02034490[0] = 1;
bVar1 = (8 >> arg1);
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;
sub_08078F60();
sub_08077D38(beh, arg1);
SoundReq(SFX_216);
sub_0805E544();
}
}
#endif
void PacciCane(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE0[beh->stateID](beh, arg1);
}
void sub_08076C98(ItemBehavior* beh, u32 arg1) {
beh->field_0x5[4] |= 0xf;
sub_08077D38(beh, arg1);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(beh);
}
void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
if ((beh->field_0x5[9] & 0x80) != 0) {
sub_08077E78(beh, arg1);
} else {
if ((beh->field_0x5[9] & 0x40) != 0) {
CreatePlayerBomb(beh, 0x12);
}
UpdateItemAnim(beh);
}
}
void Shield(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE8[beh->stateID](beh, arg1);
}
void sub_08076D04(ItemBehavior* beh, u32 arg1) {
gPlayerState.field_0x3[0] = 0x81;
beh->field_0x5[4] = 2;
sub_0806F948(&gPlayerEntity);
sub_08077D38(beh, arg1);
sub_08077BB8(beh);
}
void sub_08076D34(ItemBehavior* beh, u32 arg1) {
if (sub_08077EFC() != 0) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
if (beh->field_0x5[9] != 0) {
beh->stateID++;
beh->field_0xf = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
SoundReq(SFX_15D);
}
} else {
gPlayerState.field_0x3[0] = 0;
sub_08077E78(beh, arg1);
}
}
void sub_08076D94(ItemBehavior* beh, u32 arg1) {
if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
} else {
gPlayerState.field_0x3[0] = 0;
sub_08077E78(beh, arg1);
}
}
void GustJar(ItemBehavior* beh, u32 arg1) {
gPlayerState.field_0xa8 = 3;
gUnk_0811BDF4[beh->stateID](beh, arg1);
}
+10
View File
@@ -0,0 +1,10 @@
#include "global.h"
#include "entity.h"
#include "item.h"
extern void (*const gUnk_0811BDF4[])(ItemBehavior* beh, u32);
void ItemGustJar(ItemBehavior* beh, u32 arg1) {
gPlayerState.field_0xa8 = 3;
gUnk_0811BDF4[beh->stateID](beh, arg1);
}
+39
View File
@@ -0,0 +1,39 @@
#include "item.h"
extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
extern void sub_08078F60(void);
extern void sub_0805E544(void);
#if 0
void Ocarina(ItemBehavior* beh, u32 inputFlags) {
gOcarinaStates[beh->stateID](beh, inputFlags);
gPlayerEntity.field_0x7a++;
}
void OcarinaUse(ItemBehavior *beh, u32 arg1)
{
u32 bVar1;
if (gPlayerState.playerAction == 0x18) {
PlayerChangeState(beh, arg1);
}
else {
beh->field_0x5[4] = beh->field_0x5[4] | 0xf;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.b.flipX = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.field_0x7a = 2;
gPlayerState.flags.all |= 0x10000000;
gPlayerState.field_0x27[0] = 0xff;
gUnk_02034490[0] = 1;
bVar1 = (8 >> arg1);
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;
sub_08078F60();
sub_08077D38(beh, arg1);
SoundReq(0x216);
sub_0805E544();
}
}
#endif
+35
View File
@@ -0,0 +1,35 @@
#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);
extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
void ItemPacciCane(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE0[beh->stateID](beh, arg1);
}
void sub_08076C98(ItemBehavior* beh, u32 arg1) {
beh->field_0x5[4] |= 0xf;
sub_08077D38(beh, arg1);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(beh);
}
void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
if ((beh->field_0x5[9] & 0x80) != 0) {
sub_08077E78(beh, arg1);
} else {
if ((beh->field_0x5[9] & 0x40) != 0) {
CreatePlayerBomb(beh, 0x12);
}
UpdateItemAnim(beh);
}
}
+52
View File
@@ -0,0 +1,52 @@
#include "global.h"
#include "entity.h"
#include "item.h"
// TODO include correct headers?
extern void sub_08077E78(ItemBehavior*, u32);
extern void SoundReq(u32);
extern void UpdateItemAnim(ItemBehavior*);
extern u32 sub_08077EFC();
extern void sub_08077BB8(ItemBehavior*);
extern void sub_08077D38(ItemBehavior*, u32);
extern void sub_0806F948(Entity*);
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
void ItemShield(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE8[beh->stateID](beh, arg1);
}
void sub_08076D04(ItemBehavior* beh, u32 arg1) {
gPlayerState.field_0x3[0] = 0x81;
beh->field_0x5[4] = 2;
sub_0806F948(&gPlayerEntity);
sub_08077D38(beh, arg1);
sub_08077BB8(beh);
}
void sub_08076D34(ItemBehavior* beh, u32 arg1) {
if (sub_08077EFC() != 0) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
if (beh->field_0x5[9] != 0) {
beh->stateID++;
beh->field_0xf = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
SoundReq(0x15d);
}
} else {
gPlayerState.field_0x3[0] = 0;
sub_08077E78(beh, arg1);
}
}
void sub_08076D94(ItemBehavior* beh, u32 arg1) {
if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
} else {
gPlayerState.field_0x3[0] = 0;
sub_08077E78(beh, arg1);
}
}
+2 -2
View File
@@ -279,10 +279,10 @@ u16 sub_08056300(u16* arr) {
return 0xff;
}
void NulledItem() {
void PlayerItemNulled2() {
DeleteThisEntity();
}
void sub_08056330() {
void PlayerItemNulled() {
DeleteThisEntity();
}
+5 -5
View File
@@ -25,11 +25,11 @@ void sub_0805786C(Manager* this) {
if (gUnk_03004030.unk_00 == 0) {
gUnk_03004030.unk_0a = 0xFF;
roomID = gRoomControls.roomID;
tmp = gUnk_08107DC0[gRoomControls.areaID];
tmp = diggingCaveEntrances[gRoomControls.areaID];
tmp = sub_08057AA8(tmp, roomID);
if (tmp != 0) {
roomID = tmp->target_roomID;
tmp = gUnk_08107DC0[tmp->target_areaID];
tmp = diggingCaveEntrances[tmp->target_areaID];
tmp = sub_08057AA8(tmp, roomID);
if (tmp != 0) {
gUnk_03004030.unk_00 = tmp;
@@ -37,7 +37,7 @@ void sub_0805786C(Manager* this) {
}
}
roomID = gRoomControls.roomID;
tmp = gUnk_08107DC0[gRoomControls.areaID];
tmp = diggingCaveEntrances[gRoomControls.areaID];
uVar = 0x81 << 7;
for (tmp = sub_08057AA8(tmp, roomID); tmp != 0; tmp = sub_08057AA8(tmp, roomID)) {
SetTile(uVar, tmp->unk_00 + 0x3F, 1);
@@ -55,8 +55,8 @@ void sub_08057920(Manager* this) {
DiggingCaveEntrance* tmp;
u8 roomID;
roomID = gRoomControls.roomID;
for (tmp = gUnk_08107DC0[gRoomControls.areaID]; (tmp = sub_08057AA8(tmp, roomID)) != 0 && !sub_0805795C(this, tmp);
tmp++)
for (tmp = diggingCaveEntrances[gRoomControls.areaID];
(tmp = sub_08057AA8(tmp, roomID)) != 0 && !sub_0805795C(this, tmp); tmp++)
;
}
+2 -2
View File
@@ -23,7 +23,7 @@ typedef struct {
static void sub_080868EC(Entity* entity, unk_80868EC* arg1);
static bool32 sub_080867CC(u32);
static void sub_0808681C(Entity*);
void sub_0808681C(Entity*);
static u8 sub_08086954(Entity*);
extern u32 sub_080562CC(u32, u32, u32, u32);
@@ -91,7 +91,7 @@ void sub_080867E4(Entity* this) {
sub_0808681C(this);
}
static void sub_0808681C(Entity* this) {
void sub_0808681C(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
+4 -4
View File
@@ -7,8 +7,8 @@
#include "structures.h"
static void sub_0808F2B0(Entity*);
static void sub_0808F14C(Entity*);
static void sub_0808F244(Entity*);
void sub_0808F14C(Entity*);
void sub_0808F244(Entity*);
extern void sub_0806FCF4(Entity*, u32, u32, u32);
extern void sub_0808F5EC(Entity*);
@@ -55,7 +55,7 @@ void sub_0808F0D0(Entity* this) {
sub_0808F14C(this);
}
static void sub_0808F14C(Entity* this) {
void sub_0808F14C(Entity* this) {
sub_0808F2B0(this);
if (sub_08003FC4(this, 0x2000) == 0) {
this->action++;
@@ -101,7 +101,7 @@ void sub_0808F1F8(Entity* this) {
sub_0808F244(this);
}
static void sub_0808F244(Entity* this) {
void sub_0808F244(Entity* this) {
this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw;
this->y.HALF.HI = this->parent->y.HALF.HI + 3;
+4 -4
View File
@@ -5,9 +5,9 @@
#include "player.h"
#include "room.h"
static void sub_08082824(Entity*);
void sub_08082824(Entity*);
static void sub_08082850(Entity*, Entity*);
static void sub_08082608(Entity*);
void sub_08082608(Entity*);
extern void (*const gUnk_0811F090[])(Entity*);
extern void (*const gUnk_0811F0A8[])(Entity*);
@@ -162,7 +162,7 @@ void sub_080825F0(Entity* this) {
}
}
static void sub_08082608(Entity* this) {
void sub_08082608(Entity* this) {
this->action = 1;
this->subAction = 0;
}
@@ -248,7 +248,7 @@ void sub_08082818(Entity* this) {
sub_08082850(this, NULL);
}
static void sub_08082824(Entity* this) {
void sub_08082824(Entity* this) {
if (this->field_0x20 < 0) {
this->spriteSettings.b.flipY = 1;
}
+8 -8
View File
@@ -534,7 +534,7 @@ static void PlayerUsePortal(Entity* this) {
}
}
static void PortalJumpOnUpdate(Entity* this) {
void PortalJumpOnUpdate(Entity* this) {
u16 x;
u16 y;
@@ -570,7 +570,7 @@ static void PortalJumpOnUpdate(Entity* this) {
}
}
static void PortalStandUpdate(Entity* this) {
void PortalStandUpdate(Entity* this) {
switch (gArea.curPortalType) {
case 4:
case 5:
@@ -610,7 +610,7 @@ static void PortalStandUpdate(Entity* this) {
sub_08079938();
}
static void PortalActivateInit(Entity* this) {
void PortalActivateInit(Entity* this) {
gRoomControls.cameraTarget = NULL;
gUnk_02034490[0] = 1;
this->subAction = 3;
@@ -621,7 +621,7 @@ static void PortalActivateInit(Entity* this) {
sub_0805E544();
}
static void PortalActivateUpdate(Entity* this) {
void PortalActivateUpdate(Entity* this) {
if (this->field_0xf)
return;
@@ -631,7 +631,7 @@ static void PortalActivateUpdate(Entity* this) {
this->subAction = 4;
}
static void PortalShrinkInit(Entity* this) {
void PortalShrinkInit(Entity* this) {
this->subAction = 5;
this->spritePriority.b1 = 0;
this->field_0xf = 0;
@@ -645,9 +645,9 @@ static void PortalShrinkInit(Entity* this) {
}
// horrible
ASM_FUNC("asm/non_matching/player/sub_08071634.s", static void PortalShrinkUpdate(Entity* this))
ASM_FUNC("asm/non_matching/player/sub_08071634.s", void PortalShrinkUpdate(Entity* this))
static void PortalEnterUpdate(Entity* this) {
void PortalEnterUpdate(Entity* this) {
if (this->actionDelay == 0) {
if (sub_08003FC4(this, 0x2000))
return;
@@ -669,7 +669,7 @@ static void PortalEnterUpdate(Entity* this) {
this->actionDelay--;
}
static void PortalUnknownUpdate(Entity* this) {
void PortalUnknownUpdate(Entity* this) {
if (gFadeControl.active)
return;
+46 -24
View File
@@ -1,30 +1,52 @@
#include "global.h"
#include "functions.h"
extern void sub_080A7544();
extern void sub_0801B188();
extern void sub_0801B45C();
extern void sub_08018FCC();
extern void sub_080A2D74();
extern void sub_08054A40();
extern void sub_08056330();
extern void sub_080ADA30();
extern void sub_080704BC();
extern void sub_0801B898();
extern void CellOverwriteSet();
extern void SwordSpin();
extern void SwordBeam();
extern void sub_080ACBCC();
extern void Item11();
extern void sub_080700E8();
extern void sub_080ACF14();
extern void Item14();
extern void sub_080A306C();
extern void NulledItem();
extern void PlayerItemSword();
extern void PlayerItemBomb();
extern void PlayerItem3();
extern void PlayerItemBow();
extern void PlayerItemShield();
extern void PlayerItemLantern();
extern void PlayerItemNulled();
extern void PlayerItemGustJar();
extern void PlayerItemPacciCane();
extern void PlayerItemC();
extern void PlayerItemCellOverwriteSet();
extern void PlayerItemSwordSpin();
extern void PlayerItemSwordBeam();
extern void PlayerItem10();
extern void PlayerItem11();
extern void PlayerItem12();
extern void PlayerItem13();
extern void PlayerItem14();
extern void PlayerItem15();
extern void PlayerItemNulled2();
void (*const gPlayerItemFunctions[])() = {
DeleteEntity, sub_080A7544, sub_0801B188, sub_0801B45C, sub_08018FCC, sub_080A2D74, sub_08054A40,
sub_08056330, sub_080ADA30, sub_080704BC, DeleteEntity, DeleteEntity, sub_0801B898, CellOverwriteSet,
SwordSpin, SwordBeam, sub_080ACBCC, Item11, sub_080700E8, sub_080ACF14, Item14,
sub_080A306C, SwordBeam, NulledItem, CellOverwriteSet
DeleteEntity,
PlayerItemSword,
PlayerItemBomb,
PlayerItem3,
PlayerItemBow,
PlayerItemShield,
PlayerItemLantern,
PlayerItemNulled,
PlayerItemGustJar,
PlayerItemPacciCane,
DeleteEntity,
DeleteEntity,
PlayerItemC,
PlayerItemCellOverwriteSet,
PlayerItemSwordSpin,
PlayerItemSwordBeam,
PlayerItem10,
PlayerItem11,
PlayerItem12,
PlayerItem13,
PlayerItem14,
PlayerItem15,
PlayerItemSwordBeam,
PlayerItemNulled2,
PlayerItemCellOverwriteSet
};
@@ -13,7 +13,7 @@ extern Hitbox gUnk_080B3E18;
extern u8 gUnk_080B3DE0[];
extern Hitbox* gUnk_080B3DE8[];
void Item11(Entity* this) {
void PlayerItem11(Entity* this) {
if (this->currentHealth) {
this->iframes = 0;
gUnk_080B3DD0[this->action](this);
@@ -10,7 +10,7 @@ extern u8 gUnk_08003E44;
void sub_0805FC74(Entity*);
void Item14(Entity* this) {
void PlayerItem14(Entity* this) {
gUnk_08109AC8[this->action](this);
}
@@ -3,6 +3,6 @@
extern void (*const gUnk_080B3E30[])(Entity*);
void sub_08018FCC(Entity* this) {
void PlayerItemBow(Entity* this) {
gUnk_080B3E30[(this->action)](this);
}