summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCatobat <69204835+Catobat@users.noreply.github.com>2023-01-08 15:01:18 +0100
committerCatobat <69204835+Catobat@users.noreply.github.com>2023-01-08 15:01:18 +0100
commit4ab73f8eb752722a682d5a610e2e8d2836e4bf38 (patch)
tree12717c09505853f2a0a3a80075546810902f9199 /src
parent1d2d1cd786915571c93f4ac2426729584550f8f9 (diff)
Name some more functions in common.c
Diffstat (limited to 'src')
-rw-r--r--src/common.c25
-rw-r--r--src/menu/kinstoneMenu.c8
-rw-r--r--src/menu/pauseMenuScreen6.c2
-rw-r--r--src/npc/cucco.c2
-rw-r--r--src/npc/din.c2
-rw-r--r--src/npc/farore.c2
-rw-r--r--src/npc/hurdyGurdyMan.c2
-rw-r--r--src/npc/nayru.c2
-rw-r--r--src/npc/percy.c2
-rw-r--r--src/npc/tingleSiblings.c2
-rw-r--r--src/npcUtils.c4
-rw-r--r--src/object/object37.c4
-rw-r--r--src/script.c2
13 files changed, 29 insertions, 30 deletions
diff --git a/src/common.c b/src/common.c
index 45a413e1..a205833b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -746,7 +746,7 @@ void sub_0801E64C(s32 param_1, s32 param_2, s32 param_3, s32 param_4, s32 param_
}
}
-void sub_0801E6C8(u32 kinstoneId) {
+void NotifyFusersOnFusionDone(u32 kinstoneId) {
u32 tmp;
u32 index;
if (kinstoneId - 1 < 100) {
@@ -755,7 +755,7 @@ void sub_0801E6C8(u32 kinstoneId) {
gSave.fuserOffers[index] = 0xf1;
}
}
- tmp = sub_08002632(gFuseInfo.ent);
+ tmp = GetFuserId(gFuseInfo.ent);
if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == 0xf1)) {
gSave.fuserOffers[tmp] = 0xf2;
}
@@ -818,11 +818,11 @@ u32 CheckKinstoneFused(u32 kinstoneId) {
return ReadBit(&gSave.fusedKinstones, kinstoneId);
}
-bool32 sub_0801E810(u32 kinstoneId) {
+bool32 CheckFusionMapMarkerDisabled(u32 kinstoneId) {
if (kinstoneId > 100 || kinstoneId < 1) {
return FALSE;
}
- return ReadBit(&gSave.unk24E, kinstoneId);
+ return ReadBit(&gSave.fusionUnmarked, kinstoneId);
}
void SortKinstoneBag(void) {
@@ -903,7 +903,7 @@ s32 GetIndexInKinstoneBag(u32 kinstoneId) {
void sub_0801E8D4(void) {
u32 kinstoneId;
for (kinstoneId = 10; kinstoneId <= 100; ++kinstoneId) {
- if (CheckKinstoneFused(kinstoneId) && !sub_0801E810(kinstoneId)) {
+ if (CheckKinstoneFused(kinstoneId) && !CheckFusionMapMarkerDisabled(kinstoneId)) {
u32 worldEventId = gKinstoneWorldEvents[kinstoneId].worldEventId;
const WorldEvent* s = &gWorldEvents[worldEventId];
#if !defined EU && !defined JP
@@ -961,7 +961,7 @@ void sub_0801E8D4(void) {
#else
if (sub_0807CB24(tmp, s->flag)) {
#endif
- WriteBit(&gSave.unk24E, kinstoneId);
+ WriteBit(&gSave.fusionUnmarked, kinstoneId);
}
}
}
@@ -977,7 +977,7 @@ u32 sub_0801E99C(Entity* entity) {
u8* fuserFusionData;
s32 randomMood;
u32 fuserStability;
- fuserId = sub_08002632(entity);
+ fuserId = GetFuserId(entity);
fuserData = gUnk_08001DCC[fuserId];
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) {
return 0;
@@ -999,7 +999,7 @@ u32 sub_0801E99C(Entity* entity) {
offeredFusion = fuserFusionData[5];
}
if (offeredFusion == 0xFF) { // random shared fusion
- offeredFusion = sub_0801EA74(fuserData);
+ offeredFusion = GetRandomSharedFusion(fuserData);
}
if (offeredFusion == 0x00) { // end of fusion list
offeredFusion = 0xF3; // mark this fuser as done
@@ -1187,17 +1187,16 @@ const u32 gUnk_080CA06C[] = { 139808, 139808, 140320, 140832, 141344, 141856, 14
150560, 151584, 152608, 153632, 154656, 155680, 156704, 157728, 158752, 159776, 160800 };
#endif
-// TODO maybe KinstoneFlag?
-const u8 gUnk_080CA11C[] = {
- 24, 45, 53, 54, 55, 57, 60, 68, 70, 71, 78, 80, 83, 85, 86, 88, 95, 96, 0, 0,
+const u8 SharedFusions[] = {
+ 0x18, 0x2D, 0x35, 0x36, 0x37, 0x39, 0x3C, 0x44, 0x46, 0x47, 0x4E, 0x50, 0x53, 0x55, 0x56, 0x58, 0x5F, 0x60, 0, 0,
};
// Get a random kinstone
-u32 sub_0801EA74(u8* fuserData) {
+u32 GetRandomSharedFusion(u8* fuserData) {
s32 r = (s32)Random() % 18;
u32 i;
for (i = 0; i < 18; ++i) {
- u32 kinstoneId = gUnk_080CA11C[r];
+ u32 kinstoneId = SharedFusions[r];
if (!CheckKinstoneFused(kinstoneId))
return kinstoneId;
r = (r + 1) % 18;
diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c
index e30c3adf..d81e9573 100644
--- a/src/menu/kinstoneMenu.c
+++ b/src/menu/kinstoneMenu.c
@@ -27,7 +27,7 @@ extern u32 sub_08000E44(u32);
extern void sub_080A3B74(void);
extern u32 sub_080A3B48(void);
extern void sub_0805ECEC(u32, u32, u32, u32);
-extern void sub_0801E6C8(u32);
+extern void NotifyFusersOnFusionDone(u32);
extern void RemoveKinstoneFromBag(u32);
extern WStruct* sub_0805F2C8(void);
extern void sub_0805F300(WStruct*);
@@ -608,7 +608,7 @@ u32 sub_080A4418(u32 param_1, u32 param_2) {
void KinstoneMenu_080A4468(void) {
gUnk_03003DF0.unk_2 = 0;
gUnk_03003DF0.unk_4[3] = 0;
- sub_0801E6C8(gFuseInfo.kinstoneId);
+ NotifyFusersOnFusionDone(gFuseInfo.kinstoneId);
RemoveKinstoneFromBag(gKinstoneMenu.unk2a);
}
@@ -625,9 +625,9 @@ u32 KinstoneMenu_080A4494(void) {
psVar1->unk1 = 0;
sub_080A44E0(psVar1, gSave.name, 0x80);
#if NON_MATCHING
- ret = sub_080A44E0(psVar1, sub_08002632(gFuseInfo.ent) >> 0x20, 0xa0);
+ ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.ent) >> 0x20, 0xa0);
#else
- sub_08002632(gFuseInfo.ent);
+ GetFuserId(gFuseInfo.ent);
asm("" : "=r"(r1));
ret = sub_080A44E0(psVar1, r1, 0xa0);
#endif
diff --git a/src/menu/pauseMenuScreen6.c b/src/menu/pauseMenuScreen6.c
index 4bfcd17a..a7fa969c 100644
--- a/src/menu/pauseMenuScreen6.c
+++ b/src/menu/pauseMenuScreen6.c
@@ -205,7 +205,7 @@ void sub_080A68D4(void) {
}
for (i = 10; i <= 100; i++) {
- if (CheckKinstoneFused(i) && !sub_0801E810(i)) {
+ if (CheckKinstoneFused(i) && !CheckFusionMapMarkerDisabled(i)) {
uVar4 = gKinstoneWorldEvents[i].unk7;
ptr = &gWorldEvents[gKinstoneWorldEvents[i].worldEventId];
sub_080A698C(ptr->_c, ptr->_e, DRAW_DIRECT_SPRITE_INDEX, uVar4 + 100);
diff --git a/src/npc/cucco.c b/src/npc/cucco.c
index 9944978e..de157e63 100644
--- a/src/npc/cucco.c
+++ b/src/npc/cucco.c
@@ -112,7 +112,7 @@ void sub_0806E65C(Entity* this) {
void Cucco_ShowMessage(Entity* this) {
u32 val = 0;
- u32 index = sub_08002632(this);
+ u32 index = GetFuserId(this);
if (gSave.fuserOffers[index] == 0xf3) {
val = 1;
}
diff --git a/src/npc/din.c b/src/npc/din.c
index 19f23540..ab9d6940 100644
--- a/src/npc/din.c
+++ b/src/npc/din.c
@@ -31,7 +31,7 @@ void Din(Entity* this) {
void sub_08064828(Entity* this) {
u32 tmp = sub_0801E99C(this);
- if ((gSave.fuserProgress[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
+ if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
diff --git a/src/npc/farore.c b/src/npc/farore.c
index cbd09a5a..f45aeb17 100644
--- a/src/npc/farore.c
+++ b/src/npc/farore.c
@@ -31,7 +31,7 @@ void Farore(Entity* this) {
void sub_08064A28(Entity* this) {
u32 tmp = sub_0801E99C(this);
- if ((gSave.fuserProgress[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
+ if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c
index 4decaced..04c91d9d 100644
--- a/src/npc/hurdyGurdyMan.c
+++ b/src/npc/hurdyGurdyMan.c
@@ -26,7 +26,7 @@ void HurdyGurdyMan(Entity* this) {
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
- index = sub_08002632(this);
+ index = GetFuserId(this);
pointerToArray = gUnk_08001A7C[index];
if (this->field_0x68.HALF.LO == 0x32) {
pointerToArray = pointerToArray + 3;
diff --git a/src/npc/nayru.c b/src/npc/nayru.c
index 23ab5de6..89d8bbac 100644
--- a/src/npc/nayru.c
+++ b/src/npc/nayru.c
@@ -31,7 +31,7 @@ void Nayru(Entity* this) {
void sub_08064928(Entity* this) {
u32 tmp = sub_0801E99C(this);
- if ((gSave.fuserProgress[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
+ if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
diff --git a/src/npc/percy.c b/src/npc/percy.c
index acb65a57..d04f61d5 100644
--- a/src/npc/percy.c
+++ b/src/npc/percy.c
@@ -71,7 +71,7 @@ void sub_0806B41C(Entity* this) {
this->action = 2;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
- idx = sub_08002632(this);
+ idx = GetFuserId(this);
tmp = gUnk_08001A7C[idx];
if (this->field_0x68.HALF.LO == 33)
tmp += 3;
diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c
index 36819425..0bf334c9 100644
--- a/src/npc/tingleSiblings.c
+++ b/src/npc/tingleSiblings.c
@@ -134,7 +134,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
roomFlag = gUnk_0810FC50[this->type];
if (CheckRoomFlag(roomFlag) == 0) {
- bVar2 = gSave.fuserProgress[sub_08002632(this)];
+ bVar2 = gSave.fuserProgress[GetFuserId(this)];
if (bVar2 >= 2) {
uVar5 = 3;
} else {
diff --git a/src/npcUtils.c b/src/npcUtils.c
index c66537f3..cea167ae 100644
--- a/src/npcUtils.c
+++ b/src/npcUtils.c
@@ -327,7 +327,7 @@ void CollideFollowers(void) {
}
void sub_0806F118(Entity* ent) {
- u32 idx = sub_08002632(ent);
+ u32 idx = GetFuserId(ent);
NPCData* data = gUnk_08001A7C[idx];
sub_0801DFB4(ent, data->textIndex, data->_2, data->_4);
gPlayerState.controlMode = CONTROL_DISABLED;
@@ -353,7 +353,7 @@ u32 UpdateFuseInteraction(Entity* ent) {
}
void sub_0806F188(Entity* ent) {
- u32 idx = sub_08002632(ent);
+ u32 idx = GetFuserId(ent);
if (idx != 0)
gSave.fuserOffers[idx] = 0xF3;
}
diff --git a/src/object/object37.c b/src/object/object37.c
index 11f54176..800f0fa0 100644
--- a/src/object/object37.c
+++ b/src/object/object37.c
@@ -44,14 +44,14 @@ void Object37_Init(Object37Entity* this) {
void Object37_Action1(Object37Entity* this) {
Entity* item;
- if ((gSave.unk24E[0] != 0) && (this->unk70 != *this->unk78)) {
+ if ((gSave.fusionUnmarked[0] != 0) && (this->unk70 != *this->unk78)) {
item = CreateGroundItem(super, ITEM_RUPEE100, 0);
if (item != 0) {
item->direction = gPlayerEntity.animationState << 2;
item->speed = 0x80;
item->zVelocity = Q_16_16(2.0);
}
- gSave.unk24E[0] = 1;
+ gSave.fusionUnmarked[0] = 1;
DeleteThisEntity();
}
}
diff --git a/src/script.c b/src/script.c
index 27bea866..1f14de5f 100644
--- a/src/script.c
+++ b/src/script.c
@@ -1822,7 +1822,7 @@ void sub_0807F634(Entity* entity, ScriptExecutionContext* context) {
}
void sub_0807F650(Entity* entity, ScriptExecutionContext* context) {
- u32 p = sub_08002632(entity);
+ u32 p = GetFuserId(entity);
sub_0801DFB4(entity, gUnk_08001A7C[p][0], gUnk_08001A7C[p][1], gUnk_08001A7C[p][2]);
gPlayerState.controlMode = CONTROL_DISABLED;
}