summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2020-06-15 13:57:09 -0700
committertheo3 <arisstephenson2@gmail.com>2020-06-15 13:57:09 -0700
commitf3f7b518cbb96f95ce3e111ea13d4a9f8ca9682e (patch)
tree298363f6ad282453cd43fe713de27e3261778339 /src
parenta99313e537ac4298eed0b27472f5fae66d98e857 (diff)
bladeBrothers.c OK
Diffstat (limited to 'src')
-rw-r--r--src/bladeBrothers.c118
-rw-r--r--src/flags.c15
-rw-r--r--src/getProgressFlag.c7
3 files changed, 133 insertions, 7 deletions
diff --git a/src/bladeBrothers.c b/src/bladeBrothers.c
index db07d9b1..dcc807b5 100644
--- a/src/bladeBrothers.c
+++ b/src/bladeBrothers.c
@@ -1,11 +1,17 @@
#include "global.h"
#include "entity.h"
+#include "link.h"
typedef struct {
/*0x00*/ u8 filler[0x2C];
/*0x2C*/ u8 unk;
} struct_030010A0;
+typedef struct {
+ u8 filler[0xa8];
+ Stats stats;
+} struct_02002A40;
+
extern void sub_0806ED78(Entity*);
extern void sub_08068BEC(Entity*, u32);
extern void sub_08078778(Entity*);
@@ -25,6 +31,13 @@ extern void InitAnimationForceUpdate(Entity*, u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 UpdateFuseInteraction();
+extern void ForceEquipItem(u8, u8);
+extern void sub_0805ED14(u32*);
+extern Entity* CreateFx(Entity*, u32, u32);
+extern void PositionRelative(Entity*, Entity*, u32, u32);
+extern void PlaySFX(u32);
+extern u32 GetInventoryValue(u32);
+extern void sub_080A7C18(u32, u32, u32);
extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*);
@@ -32,6 +45,11 @@ extern void (*gUnk_081115D0[])(Entity*);
extern struct_030010A0 gUnk_030010A0;
extern u16 gUnk_081115DC[];
extern Entity gLinkEntity;
+extern u8 gUnk_08111618[];
+extern u32* gUnk_081115EC[];
+extern struct_02002A40 gUnk_02002A40;
+extern u8 gUnk_08111623[];
+extern u8 gUnk_0811162B[];
void sub_080689C0(Entity* this) {
@@ -140,3 +158,103 @@ void sub_08068B70(Entity* this) {
this->action = 1;
}
}
+
+void sub_08068B84(Entity* this) {
+ u8 p;
+
+ if (gUnk_08111618) {}
+ if (p = this->parameter3, gUnk_08111618[p]) {
+ ForceEquipItem(gUnk_08111618[this->parameter3], 0);
+ }
+ sub_0805ED14(gUnk_081115EC[this->parameter3]);
+}
+
+void sub_08068BB4(Entity* this) {
+ u32 item = gUnk_02002A40.stats.itemOnA;
+
+ this->field_0x69 = item;
+ item = gUnk_02002A40.stats.itemOnB;
+ *(&this->field_0x69 + 1) = item;
+}
+
+void sub_08068BD0(Entity* this) {
+ ForceEquipItem(this->field_0x69, 0);
+ ForceEquipItem(*(u8*)(&this->field_0x69 + 1), 1);
+}
+
+void sub_08068BEC(Entity* this, u32 unused) {
+ Entity* target;
+
+ target = CreateFx(this, 0x44, 0);
+ if (target) {
+ target->ticks.b0 = 1;
+ PositionRelative(this, target, 0, -0x100000);
+ PlaySFX(0xfa);
+ }
+}
+
+void sub_08068C28(Entity* this) {
+ u8 bVar1;
+ u32 uVar2;
+
+ this->parameter3 = gUnk_08111623[(this->entityType).parameter1];
+ if ((this->entityType).parameter1 == 1) {
+ if (GetInventoryValue(0x48)) { // spin attack
+ if (!GetInventoryValue(0x4b)) { // rock breaker
+ this->parameter3 = 1;
+ } else {
+ if (!GetInventoryValue(0x4a)) { // dash attack
+ this->parameter3 = 2;
+ } else {
+ this->parameter3 = 3;
+ }
+ }
+ }
+ }
+}
+
+void sub_08068C6C(Entity *this)
+{
+ sub_080A7C18(gUnk_0811162B[this->parameter3] & 0xffffff7f,0,0);
+}
+
+void sub_08068C8C(Entity *param_1,Entity *param_2)
+{
+ u8* arr = gUnk_0811162B + 0xd;
+
+ *(u32*)&param_2->animationState = *(u32*)(arr + param_1->parameter3 * 4);
+}
+
+void sub_08068CA0(Entity *param_1,Entity *param_2)
+{
+ u8 bVar1;
+ u32 uVar2;
+
+ bVar1 = (param_1->entityType).parameter1;
+ if (bVar1 == 1) {
+ *(u32 *)&param_2->animationState = bVar1;
+ uVar2 = GetInventoryValue(0x48); //spin attack
+ if (uVar2 == 0) {
+ *(u32 *)&param_2->animationState = 0;
+ }
+ uVar2 = GetInventoryValue(0x4b); //rock breaker
+ if (uVar2 == 0) {
+ *(u32 *)&param_2->animationState = 0;
+ }
+ uVar2 = GetInventoryValue(0x4a); //dash attack
+ if (uVar2 == 0) {
+ *(u32 *)&param_2->animationState = 0;
+ }
+ uVar2 = GetInventoryValue(0x4e); //down thrust
+ if (uVar2 != 0) {
+ return;
+ }
+ }
+ else {
+ uVar2 = GetInventoryValue(gUnk_0811162B[param_1->parameter3] & -0x81);
+ if (uVar2 != 0) {
+ uVar2 = 1;
+ }
+ }
+ *(u32*)&param_2->animationState = uVar2;
+} \ No newline at end of file
diff --git a/src/flags.c b/src/flags.c
new file mode 100644
index 00000000..2c8534db
--- /dev/null
+++ b/src/flags.c
@@ -0,0 +1,15 @@
+#include "global.h"
+#include "room.h"
+#include "flags.h"
+
+u32 extern CheckLocalFlagByOffset(u32, u32);
+extern u32 ReadBit(u32*, u32);
+
+u32 CheckGlobalFlag(u32 index) {
+ return CheckLocalFlagByOffset(0, index);
+}
+
+u32 CheckRoomFlag(u32 index)
+{
+ return ReadBit(&gRoomVars.roomFlags, index);
+} \ No newline at end of file
diff --git a/src/getProgressFlag.c b/src/getProgressFlag.c
deleted file mode 100644
index c2907340..00000000
--- a/src/getProgressFlag.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "global.h"
-
-u32 extern CheckLocalFlagByOffset(u32, u32);
-
-u32 CheckGlobalFlag(u32 index) {
- return CheckLocalFlagByOffset(0, index);
-}