Merge pull request #597 from Catobat/kinstone-stuff

Kinstone stuff
This commit is contained in:
notyourav 2023-02-27 14:37:31 -08:00 committed by GitHub
commit 355f145f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 307 additions and 296 deletions

View File

@ -792,8 +792,8 @@ gUnk_0800232E:: @ 0800232E
gUnk_08002342:: @ 08002342 gUnk_08002342:: @ 08002342
.incbin "code_080011C4/gUnk_08002342.bin" .incbin "code_080011C4/gUnk_08002342.bin"
non_word_aligned_thumb_func_start sub_08002632 non_word_aligned_thumb_func_start GetFuserId
sub_08002632: @ 0x08002632 GetFuserId: @ 0x08002632
push {r4, r5, r6, r7, lr} push {r4, r5, r6, r7, lr}
ldr r4, _0800269C @ =gUnk_0800232E ldr r4, _0800269C @ =gUnk_0800232E
ldrb r3, [r0, #8] ldrb r3, [r0, #8]

View File

@ -16,7 +16,7 @@ script_0801015A:
WaitUntilTextboxCloses WaitUntilTextboxCloses
CheckTextboxResult CheckTextboxResult
JumpIfNot script_080101A6 JumpIfNot script_080101A6
Call sub_080A1608 Call CuccoMinigame_TellObjective
WaitUntilTextboxCloses WaitUntilTextboxCloses
EnablePlayerControl EnablePlayerControl
CallWithArg CuccoMinigame_Init, script_080101AC CallWithArg CuccoMinigame_Init, script_080101AC
@ -25,7 +25,7 @@ script_0801015A:
SetRoomFlag 0x0001 SetRoomFlag 0x0001
Jump script_0801015A Jump script_0801015A
script_0801019E: script_0801019E:
Call sub_080A1608 Call CuccoMinigame_TellObjective
WaitUntilTextboxCloses WaitUntilTextboxCloses
script_080101A6: script_080101A6:
EnablePlayerControl EnablePlayerControl
@ -60,14 +60,14 @@ script_080101AC:
SetFade4 SetFade4
WaitForFadeFinish WaitForFadeFinish
PlayBGM PlayBGM
Call sub_080A13B4 Call CuccoMinigame_Results
WaitUntilTextboxCloses WaitUntilTextboxCloses
JumpIfNot script_08010240 JumpIfNot script_08010240
Call sub_080A13E8 Call CuccoMinigame_WinItem
WaitPlayerGetItem WaitPlayerGetItem
Call sub_080A1460 Call CuccoMinigame_WinRupees
WaitUntilTextboxCloses WaitUntilTextboxCloses
Call sub_080A14A8 Call CuccoMinigame_AdvanceLevel
script_08010240: script_08010240:
Call EnablePauseMenu Call EnablePauseMenu
EnablePlayerControl EnablePlayerControl

View File

@ -17,7 +17,7 @@ extern void LoadResourceAsync(const void*, u32, u32);
extern void GenericConfused(struct Entity_*); extern void GenericConfused(struct Entity_*);
extern void sub_08001290(struct Entity_*, u32); extern void sub_08001290(struct Entity_*, u32);
extern void GenericKnockback(struct Entity_*); extern void GenericKnockback(struct Entity_*);
extern u32 sub_08002632(struct Entity_*); extern u32 GetFuserId(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_*, u32); extern u32 GravityUpdate(struct Entity_*, u32);
extern u32 CheckOnScreen(struct Entity_*); extern u32 CheckOnScreen(struct Entity_*);

View File

@ -119,12 +119,12 @@ u32 CheckKinstoneFused(u32);
void sub_0801E1EC(u32, u32, u32); void sub_0801E1EC(u32, u32, u32);
void sub_0801DD58(u32, u32); void sub_0801DD58(u32, u32);
void sub_0801E1B8(u32, u32); void sub_0801E1B8(u32, u32);
void sub_0801E738(u32); void AddKinstoneToBag(u32);
void sub_0801DFB4(struct Entity_*, u32, u32, u32); void sub_0801DFB4(struct Entity_*, u32, u32, u32);
u32 sub_0801E00C(void); u32 sub_0801E00C(void);
bool32 sub_0801E810(u32); bool32 CheckFusionMapMarkerDisabled(u32);
u32 sub_0801DB94(void); u32 sub_0801DB94(void);
u32 sub_0801EA74(u8*); u32 GetRandomSharedFusion(u8*);
typedef struct { typedef struct {
u8 unk_0; u8 unk_0;

View File

@ -147,9 +147,9 @@ typedef enum {
ITEM_SKILL_LONG_SPIN, ITEM_SKILL_LONG_SPIN,
// these are not actually item ids but special values used by item drops for example // these are not actually item ids but special values used by item drops for example
ITEM_KINSTONE_GREEN = 0xfc, ITEM_KINSTONE_RED = 0xfc,
ITEM_KINSTONE_BLUE, ITEM_KINSTONE_BLUE,
ITEM_KINSTONE_RED, ITEM_KINSTONE_GREEN,
ITEM_ENEMY_BEETLE ITEM_ENEMY_BEETLE
} Item; } Item;

View File

@ -23,13 +23,13 @@ extern FuseInfo gFuseInfo;
typedef struct { typedef struct {
u8 objPalette; u8 objPalette;
u8 unk1; u8 gfxOffsetPiece;
u8 unk2; u8 gfxOffsetFull;
u8 subtask; // SUBTASK_WORLDEVENT or 0 u8 subtask; // SUBTASK_WORLDEVENT or 0
u8 worldEventId; u8 worldEventId;
u8 unk5; u8 shape;
u8 unk6; u8 bubbleIcon;
u8 unk7; // TODO flag if it shows a map hint? u8 mapMarkerIcon; // 0 for no map marker
} KinstoneWorldEvent; } KinstoneWorldEvent;
// Indexed by kinstoneId // Indexed by kinstoneId
extern const KinstoneWorldEvent gKinstoneWorldEvents[]; extern const KinstoneWorldEvent gKinstoneWorldEvents[];
@ -209,7 +209,7 @@ typedef struct {
u16 y; /**< Y position of the actual event. */ u16 y; /**< Y position of the actual event. */
u16 _c; // see sub_080A6A80, related to _0 and _2 of gUnk_08127F94 u16 _c; // see sub_080A6A80, related to _0 and _2 of gUnk_08127F94
u16 _e; // see sub_080A6A80, related to _1 and _3 of gUnk_08127F94 u16 _e; // see sub_080A6A80, related to _1 and _3 of gUnk_08127F94
u8 condition; // TODO some sort of flag determining what type the bank&flag are? see sub_0801E8D4 u8 condition; // TODO some sort of flag determining what type the bank&flag are? see UpdateVisibleFusionMapMarkers
u8 bank; /**< @see LocalBanks */ u8 bank; /**< @see LocalBanks */
u16 flag; u16 flag;
} WorldEvent; } WorldEvent;

View File

@ -86,7 +86,7 @@ void CollideFollowers(void);
// TODO move? // TODO move?
void sub_08078784(Entity* ent, u32 arg1); void sub_08078784(Entity* ent, u32 arg1);
u32 sub_0806F5A4(u32); u32 sub_0806F5A4(u32);
u32 sub_0801E99C(Entity*); u32 GetFusionToOffer(Entity*);
void sub_08078778(Entity*); void sub_08078778(Entity*);
void sub_0807000C(Entity*); void sub_0807000C(Entity*);
void sub_080787A8(Entity*, u32); void sub_080787A8(Entity*, u32);

View File

@ -58,12 +58,14 @@ typedef struct {
/*0x0F2*/ u8 inventory[36]; /*0x0F2*/ u8 inventory[36];
/*0x116*/ u8 didAllFusions; /*0x116*/ u8 didAllFusions;
/*0x117*/ u8 fusedKinstoneCount; /*0x117*/ u8 fusedKinstoneCount;
/*0x118*/ u8 unk118[0x13]; // TODO also related to kinstones /*0x118*/ u8 kinstoneTypes[0x13]; // 0x65-0x75 for each kinstone type present in kinstone bag
/*0x12B*/ u8 unk12B[0x16]; // TODO also related to kinstones /*0x12B*/ u8 kinstoneAmounts[0x13]; // amount of each kinstone type above
/*0x141*/ u8 unk141[128]; // TODO sub_08064F28 and also the goddesses, indexed by sub_08002632 /*0x13E*/ u8 filler13E[3];
/*0x1C1*/ u8 unk1C1[128]; // TODO also related to kinstones, see sub_0801E6C8 0x80 available kinstone fusions? /*0x141*/ u8 fuserProgress[128]; // indexed by fuser id, incremented after fusion
/*0x1C1*/ u8 fuserOffers[128]; // available kinstone fusion for each fuser
/*0x241*/ u8 fusedKinstones[13]; /**< Bitfield for fused kinstones. @see CheckKinstoneFused */ /*0x241*/ u8 fusedKinstones[13]; /**< Bitfield for fused kinstones. @see CheckKinstoneFused */
/*0x24E*/ u8 unk24E[14]; // TODO something else with kinstones @see sub_0801E810 /*0x24E*/ u8 fusionUnmarked[13]; /**< Bitfield for disabled fusion map markers. @see CheckFusionMapMarkerDisabled */
/*0x25B*/ u8 filler25B;
/*0x25C*/ u8 flags[0x200]; /**< Flags. */ /*0x25C*/ u8 flags[0x200]; /**< Flags. */
/*0x45C*/ u8 dungeonKeys[0x10]; // TODO Indexed by dungeon id, keys per dungeon /*0x45C*/ u8 dungeonKeys[0x10]; // TODO Indexed by dungeon id, keys per dungeon
/*0x46C*/ u8 dungeonItems[0x10]; // TODO items in the dungeon. 4: compass, 2: big key, 1: small key /*0x46C*/ u8 dungeonItems[0x10]; // TODO items in the dungeon. 4: compass, 2: big key, 1: small key

View File

@ -36,7 +36,7 @@ void ResetScreenRegs(void);
void MessageFromFusionTarget(u32); void MessageFromFusionTarget(u32);
void sub_0801E24C(s32, s32); void sub_0801E24C(s32, s32);
void sub_0801E290(u32, u32, u32); void sub_0801E290(u32, u32, u32);
s32 sub_0801E8B0(u32); s32 GetIndexInKinstoneBag(u32);
extern u32 sub_0807CB24(u32, u32); extern u32 sub_0807CB24(u32, u32);
@ -71,7 +71,7 @@ extern const GfxItem* gGfxGroups[];
extern const u32 gUnk_080C9460[]; extern const u32 gUnk_080C9460[];
void sub_0801E82C(void); void SortKinstoneBag(void);
extern void* GetRoomProperty(u32, u32, u32); extern void* GetRoomProperty(u32, u32, u32);
@ -831,18 +831,18 @@ 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 tmp;
u32 index; u32 index;
if (kinstoneId - 1 < 100) { if (kinstoneId - 1 < 100) {
for (index = 0; index < 0x80; index++) { for (index = 0; index < 0x80; index++) {
if (kinstoneId == gSave.unk1C1[index]) { if (kinstoneId == gSave.fuserOffers[index]) {
gSave.unk1C1[index] = 0xf1; gSave.fuserOffers[index] = 0xf1;
} }
} }
tmp = sub_08002632(gFuseInfo.ent); tmp = GetFuserId(gFuseInfo.ent);
if ((tmp - 1 < 0x7f) && (gSave.unk1C1[tmp] == 0xf1)) { if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == 0xf1)) {
gSave.unk1C1[tmp] = 0xf2; gSave.fuserOffers[tmp] = 0xf2;
} }
for (index = 0; index < 0x20; index++) { for (index = 0; index < 0x20; index++) {
if (kinstoneId == gUnk_03003DF0.array[index].unk_3) { if (kinstoneId == gUnk_03003DF0.array[index].unk_3) {
@ -852,48 +852,48 @@ void sub_0801E6C8(u32 kinstoneId) {
} }
} }
void sub_0801E738(u32 param_1) { void AddKinstoneToBag(u32 kinstoneId) {
s32 index; s32 index;
s32 tmp; s32 tmp;
sub_0801E82C(); SortKinstoneBag(); // sometimes called just for this function
if (param_1 - 0x65 < 0x11) { if (kinstoneId - 0x65 < 0x11) {
index = sub_0801E8B0(param_1); index = GetIndexInKinstoneBag(kinstoneId);
if (index < 0) { if (index < 0) {
index = 0; index = 0;
while (gSave.unk118[index] != 0) { while (gSave.kinstoneTypes[index] != 0) {
index++; index++;
} }
} }
if ((u32)index < 0x12) { if ((u32)index < 0x12) {
gSave.unk118[index] = param_1; gSave.kinstoneTypes[index] = kinstoneId;
tmp = gSave.unk12B[index] + 1; tmp = gSave.kinstoneAmounts[index] + 1;
if (tmp > 99) { if (tmp > 99) {
tmp = 99; tmp = 99;
} }
gSave.unk12B[index] = tmp; gSave.kinstoneAmounts[index] = tmp;
} }
} }
} }
void sub_0801E798(u32 a1) { void RemoveKinstoneFromBag(u32 kinstoneId) {
s32 idx = sub_0801E8B0(a1); s32 idx = GetIndexInKinstoneBag(kinstoneId);
if (idx >= 0) { if (idx >= 0) {
s32 next = gSave.unk12B[idx] - 1; s32 next = gSave.kinstoneAmounts[idx] - 1;
if (next <= 0) { if (next <= 0) {
gSave.unk118[idx] = 0; gSave.kinstoneTypes[idx] = 0;
next = 0; next = 0;
} }
gSave.unk12B[idx] = next; gSave.kinstoneAmounts[idx] = next;
} }
} }
u32 sub_0801E7D0(u32 a1) { u32 GetAmountInKinstoneBag(u32 kinstoneId) {
s32 tmp = sub_0801E8B0(a1); s32 index = GetIndexInKinstoneBag(kinstoneId);
if (tmp < 0) { if (index < 0) {
return 0; return 0;
} }
return gSave.unk12B[tmp]; return gSave.kinstoneAmounts[index];
} }
u32 CheckKinstoneFused(u32 kinstoneId) { u32 CheckKinstoneFused(u32 kinstoneId) {
@ -903,30 +903,30 @@ u32 CheckKinstoneFused(u32 kinstoneId) {
return ReadBit(&gSave.fusedKinstones, kinstoneId); return ReadBit(&gSave.fusedKinstones, kinstoneId);
} }
bool32 sub_0801E810(u32 kinstoneId) { bool32 CheckFusionMapMarkerDisabled(u32 kinstoneId) {
if (kinstoneId > 100 || kinstoneId < 1) { if (kinstoneId > 100 || kinstoneId < 1) {
return FALSE; return FALSE;
} }
return ReadBit(&gSave.unk24E, kinstoneId); return ReadBit(&gSave.fusionUnmarked, kinstoneId);
} }
void sub_0801E82C(void) { void SortKinstoneBag(void) {
#ifdef NON_MATCHING #ifdef NON_MATCHING
u32 r5; u32 r5;
for (r5 = 0; r5 < 0x13; r5++) { for (r5 = 0; r5 < 0x13; r5++) {
if (gSave.unk12B[r5] == 0) { if (gSave.kinstoneAmounts[r5] == 0) {
gSave.unk118[r5] = gSave.unk12B[r5]; gSave.kinstoneTypes[r5] = gSave.kinstoneAmounts[r5];
} }
} }
gSave.unk118[0x12] = 0; gSave.kinstoneTypes[0x12] = 0;
gSave.unk12B[0x12] = 0; gSave.kinstoneAmounts[0x12] = 0;
for (r5 = 0; r5 < 0x12; r5++) { for (r5 = 0; r5 < 0x12; r5++) {
if ((gSave.unk118[r5] - 0x65) > 0x10) { if ((gSave.kinstoneTypes[r5] - 0x65) > 0x10) {
MemCopy(&gSave.unk118[r5 + 1], &gSave.unk118[r5], 0x12 - r5); MemCopy(&gSave.kinstoneTypes[r5 + 1], &gSave.kinstoneTypes[r5], 0x12 - r5);
MemCopy(&gSave.unk12B[r5 + 1], &gSave.unk12B[r5], 0x12 - r5); MemCopy(&gSave.kinstoneAmounts[r5 + 1], &gSave.kinstoneAmounts[r5], 0x12 - r5);
} }
} }
#else #else
@ -937,7 +937,7 @@ void sub_0801E82C(void) {
new_var = 4; new_var = 4;
r1 = &gSave.inventory[34]; r1 = &gSave.inventory[34];
r5 = 0; r5 = 0;
r2 = gSave.unk118; r2 = gSave.kinstoneTypes;
code0_0: code0_0:
r0 = r2[0x13]; r0 = r2[0x13];
r3 = &r1[4]; r3 = &r1[4];
@ -974,21 +974,21 @@ code0_2:
#endif #endif
} }
s32 sub_0801E8B0(u32 idx) { s32 GetIndexInKinstoneBag(u32 kinstoneId) {
u32 i; u32 i;
for (i = 0; i < 18; ++i) { for (i = 0; i < 0x12; ++i) {
if (idx == gSave.unk118[i]) if (kinstoneId == gSave.kinstoneTypes[i])
return i; return i;
} }
return -1; return -1;
} }
// Check conditions, something with kinstones // For example if a chest from a fusion is opened, hide the chest marker
void sub_0801E8D4(void) { void UpdateVisibleFusionMapMarkers(void) {
u32 kinstoneId; u32 kinstoneId;
for (kinstoneId = 10; kinstoneId <= 100; ++kinstoneId) { for (kinstoneId = 10; kinstoneId <= 100; ++kinstoneId) {
if (CheckKinstoneFused(kinstoneId) && !sub_0801E810(kinstoneId)) { if (CheckKinstoneFused(kinstoneId) && !CheckFusionMapMarkerDisabled(kinstoneId)) {
u32 worldEventId = gKinstoneWorldEvents[kinstoneId].worldEventId; u32 worldEventId = gKinstoneWorldEvents[kinstoneId].worldEventId;
const WorldEvent* s = &gWorldEvents[worldEventId]; const WorldEvent* s = &gWorldEvents[worldEventId];
#if !defined EU && !defined JP #if !defined EU && !defined JP
@ -1046,7 +1046,7 @@ void sub_0801E8D4(void) {
#else #else
if (sub_0807CB24(tmp, s->flag)) { if (sub_0807CB24(tmp, s->flag)) {
#endif #endif
WriteBit(&gSave.unk24E, kinstoneId); WriteBit(&gSave.fusionUnmarked, kinstoneId);
} }
} }
} }
@ -1054,7 +1054,7 @@ void sub_0801E8D4(void) {
extern u8* gUnk_08001DCC[]; extern u8* gUnk_08001DCC[];
u32 sub_0801E99C(Entity* entity) { u32 GetFusionToOffer(Entity* entity) {
u8* fuserData; u8* fuserData;
u32 fuserId; u32 fuserId;
u32 offeredFusion; u32 offeredFusion;
@ -1062,13 +1062,13 @@ u32 sub_0801E99C(Entity* entity) {
u8* fuserFusionData; u8* fuserFusionData;
s32 randomMood; s32 randomMood;
u32 fuserStability; u32 fuserStability;
fuserId = sub_08002632(entity); fuserId = GetFuserId(entity);
fuserData = gUnk_08001DCC[fuserId]; fuserData = gUnk_08001DCC[fuserId];
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) { if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) {
return 0; return 0;
} }
offeredFusion = gSave.unk1C1[fuserId]; offeredFusion = gSave.fuserOffers[fuserId];
fuserProgress = gSave.unk141[fuserId]; fuserProgress = gSave.fuserProgress[fuserId];
fuserFusionData = (u8*)(fuserProgress + (u32)fuserData); fuserFusionData = (u8*)(fuserProgress + (u32)fuserData);
while (TRUE) { // loop through fusions for this fuser while (TRUE) { // loop through fusions for this fuser
switch (offeredFusion) { switch (offeredFusion) {
@ -1084,7 +1084,7 @@ u32 sub_0801E99C(Entity* entity) {
offeredFusion = fuserFusionData[5]; offeredFusion = fuserFusionData[5];
} }
if (offeredFusion == 0xFF) { // random shared fusion if (offeredFusion == 0xFF) { // random shared fusion
offeredFusion = sub_0801EA74(fuserData); offeredFusion = GetRandomSharedFusion(fuserData);
} }
if (offeredFusion == 0x00) { // end of fusion list if (offeredFusion == 0x00) { // end of fusion list
offeredFusion = 0xF3; // mark this fuser as done offeredFusion = 0xF3; // mark this fuser as done
@ -1098,8 +1098,8 @@ u32 sub_0801E99C(Entity* entity) {
} }
offeredFusion = 0xF1; // already completed, try next fusion in the list offeredFusion = 0xF1; // already completed, try next fusion in the list
} }
gSave.unk1C1[fuserId] = offeredFusion; gSave.fuserOffers[fuserId] = offeredFusion;
gSave.unk141[fuserId] = fuserProgress; gSave.fuserProgress[fuserId] = fuserProgress;
randomMood = Random(); randomMood = Random();
fuserStability = fuserData[1]; fuserStability = fuserData[1];
if (fuserStability <= randomMood % 100) { if (fuserStability <= randomMood % 100) {
@ -1272,17 +1272,16 @@ const u32 gUnk_080CA06C[] = { 139808, 139808, 140320, 140832, 141344, 141856, 14
150560, 151584, 152608, 153632, 154656, 155680, 156704, 157728, 158752, 159776, 160800 }; 150560, 151584, 152608, 153632, 154656, 155680, 156704, 157728, 158752, 159776, 160800 };
#endif #endif
// TODO maybe KinstoneFlag? const u8 SharedFusions[] = {
const u8 gUnk_080CA11C[] = { 0x18, 0x2D, 0x35, 0x36, 0x37, 0x39, 0x3C, 0x44, 0x46, 0x47, 0x4E, 0x50, 0x53, 0x55, 0x56, 0x58, 0x5F, 0x60, 0, 0,
24, 45, 53, 54, 55, 57, 60, 68, 70, 71, 78, 80, 83, 85, 86, 88, 95, 96, 0, 0,
}; };
// Get a random kinstone // Get a random kinstone
u32 sub_0801EA74(u8* fuserData) { u32 GetRandomSharedFusion(u8* fuserData) {
s32 r = (s32)Random() % 18; s32 r = (s32)Random() % 18;
u32 i; u32 i;
for (i = 0; i < 18; ++i) { for (i = 0; i < 18; ++i) {
u32 kinstoneId = gUnk_080CA11C[r]; u32 kinstoneId = SharedFusions[r];
if (!CheckKinstoneFused(kinstoneId)) if (!CheckKinstoneFused(kinstoneId))
return kinstoneId; return kinstoneId;
r = (r + 1) % 18; r = (r + 1) % 18;

View File

@ -28,7 +28,7 @@ void sub_0802922C(Entity*);
void sub_0802925C(Entity*); void sub_0802925C(Entity*);
extern const struct SalesOffering gUnk_080CC954[]; extern const struct SalesOffering gUnk_080CC954[];
extern const u8 gUnk_080CC9C0[]; extern const u8 kinstoneTypes[];
extern void (*const BusinessScrub_Functions[])(Entity*); extern void (*const BusinessScrub_Functions[])(Entity*);
extern void (*const gUnk_080CC9E0[])(Entity*); extern void (*const gUnk_080CC9E0[])(Entity*);
extern const u8 gUnk_080CCA04[]; extern const u8 gUnk_080CCA04[];
@ -258,7 +258,7 @@ void sub_08028CE8(Entity* this) {
case 0: case 0:
subtype = offer->field_0x9; subtype = offer->field_0x9;
if (subtype == 0xff) { if (subtype == 0xff) {
subtype = gUnk_080CC9C0[Random() & 7]; subtype = kinstoneTypes[Random() & 7];
} }
CreateItemEntity(offer->offeredItem, subtype, 0); CreateItemEntity(offer->offeredItem, subtype, 0);
@ -547,7 +547,7 @@ void sub_0802922C(Entity* this) {
} }
void sub_0802925C(Entity* this) { void sub_0802925C(Entity* this) {
sub_08078784(this, sub_0801E99C(this)); sub_08078784(this, GetFusionToOffer(this));
} }
void sub_08029270(Entity* this) { void sub_08029270(Entity* this) {
@ -577,17 +577,7 @@ const struct SalesOffering gUnk_080CC954[] = {
#endif #endif
}; };
const u8 gUnk_080CC9C0[] = { const u8 kinstoneTypes[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 };
0x6e,
0x6f,
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
};
void (*const BusinessScrub_Functions[])(Entity*) = { void (*const BusinessScrub_Functions[])(Entity*) = {
BusinessScrub_OnTick, BusinessScrub_OnTick,

View File

@ -10,24 +10,28 @@
// extern const u8 gUnk_080FE1B4[]; // extern const u8 gUnk_080FE1B4[];
// const u8 gUnk_080FE1B4[] = {0, 84, 85, 86, 95, 96, 93, 94, 63, 252, 253, 254, 255, 0, 0, 0,0,}; // const u8 gUnk_080FE1B4[] = {0, 84, 85, 86, 95, 96, 93, 94, 63, 252, 253, 254, 255, 0, 0, 0,0,};
const u8 gUnk_080FE1B4[] = { const u8 gUnk_080FE1B4[] = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY, 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_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_RED, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_GREEN,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
}; };
const u8 gUnk_080FE1C6[] = { const u8 gUnk_080FE1C6[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10, 10, 11, 12, 13, 14, 15, 8, 15, 1, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10, 10, 11, 12, 13, 14, 15, 8, 15, 1, 8,
}; };
const u8 gUnk_080FE1DD[] = { const u8 gUnk_080FE1DD[3][0x40] = {
110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111, 112, 111, 110, 110, 110, 111, 112, 112, 110, 111, { 0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x6E,
111, 112, 110, 110, 112, 111, 112, 111, 110, 111, 110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111, 0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x6F,
112, 111, 110, 112, 110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111, 112, 111, 110, 0, 113, 114, 0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x70,
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x00 },
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, { 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 115, 116, 117, 117, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 115, 115, 116, 117, 117, 115, 116, 116, 117, 115, 115, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
117, 116, 117, 116, 115, 116, 115, 116, 117, 117, 115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 117, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72 },
115, 116, 117, 117, 115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 0, 0, 0, 0, { 0x73, 0x74, 0x75, 0x75, 0x73, 0x74, 0x74, 0x75, 0x73, 0x73, 0x75, 0x74, 0x75, 0x74, 0x73, 0x73,
0x73, 0x74, 0x75, 0x75, 0x73, 0x74, 0x74, 0x75, 0x73, 0x73, 0x75, 0x74, 0x75, 0x74, 0x73, 0x74,
0x73, 0x74, 0x75, 0x75, 0x73, 0x74, 0x74, 0x75, 0x73, 0x73, 0x75, 0x74, 0x75, 0x74, 0x73, 0x75,
0x73, 0x74, 0x75, 0x75, 0x73, 0x74, 0x74, 0x75, 0x73, 0x73, 0x75, 0x74, 0x75, 0x74, 0x73, 0x00 },
}; };
const u8 gPadding[3] = { 0, 0, 0 };
void Subtask_WorldEvent_Init(void); void Subtask_WorldEvent_Init(void);
void Subtask_WorldEvent_Update(void); void Subtask_WorldEvent_Update(void);

View File

@ -114,7 +114,7 @@ u32 GiveItem(Item item, u32 param_2) {
gSave.dungeonItems[gArea.dungeon_idx] |= metaData->unk2; gSave.dungeonItems[gArea.dungeon_idx] |= metaData->unk2;
break; break;
case 0xd: case 0xd:
sub_0801E738(0x72); AddKinstoneToBag(0x72);
break; break;
case 0x12: case 0x12:
if (item == ITEM_BOOMERANG) { if (item == ITEM_BOOMERANG) {
@ -174,7 +174,7 @@ u32 GiveItem(Item item, u32 param_2) {
SoundReq(SFX_103); SoundReq(SFX_103);
break; break;
case 0x0f: case 0x0f:
sub_0801E738(param_2); AddKinstoneToBag(param_2);
break; break;
case 0x10: case 0x10:
gSave.stats.walletType++; gSave.stats.walletType++;
@ -408,9 +408,9 @@ extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter); u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = { extern const u8 gUnk_080FE1B4[] /* = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY, 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_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_RED, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_GREEN,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
}*/; }*/;
int r0, r1, rand, summOdds, item; int r0, r1, rand, summOdds, item;
@ -508,7 +508,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
return ITEM_NONE; return ITEM_NONE;
} }
extern u8 gUnk_080FE1DD[]; extern u8 gUnk_080FE1DD[3][0x40];
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) { u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
u32 adjustedParam = itemParameter; u32 adjustedParam = itemParameter;
Entity* itemEntity; Entity* itemEntity;
@ -539,7 +539,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
break; break;
} }
case ITEM_KINSTONE: case ITEM_KINSTONE:
case ITEM_KINSTONE_GREEN ... ITEM_KINSTONE_RED: { case ITEM_KINSTONE_RED ... ITEM_KINSTONE_GREEN: {
u32 rand; u32 rand;
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) { if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
@ -550,9 +550,9 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
} }
if (itemId != ITEM_KINSTONE) { if (itemId != ITEM_KINSTONE) {
adjustedParam = itemId - ITEM_KINSTONE_GREEN; adjustedParam = itemId - ITEM_KINSTONE_RED;
rand = (Random() & 0x3f); rand = (Random() & 0x3f);
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)]; adjustedParam = gUnk_080FE1DD[adjustedParam][rand];
if (adjustedParam == 0) { if (adjustedParam == 0) {
itemId = ITEM_NONE; itemId = ITEM_NONE;
} else { } else {

View File

@ -8,16 +8,17 @@
#include "asm.h" #include "asm.h"
#include "flags.h" #include "flags.h"
#include "object.h" #include "object.h"
#include "item.h"
typedef struct { typedef struct {
u16 minType; u16 minType;
u16 maxType; u16 numTypes;
u16 x; u16 x;
u16 y; u16 y;
} GoronShopSpawnData; } GoronShopSpawnData;
void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) {
static const GoronShopSpawnData gUnk_08108D5C[3] = { { 0x6e, 0x3, 0x210, 0x210 }, static const GoronShopSpawnData shopSpawnData[3] = { { 0x6e, 0x3, 0x210, 0x210 },
{ 0x71, 0x2, 0x220, 0x210 }, { 0x71, 0x2, 0x220, 0x210 },
{ 0x73, 0x3, 0x230, 0x210 } }; { 0x73, 0x3, 0x230, 0x210 } };
s32 uVar2; s32 uVar2;
@ -54,12 +55,12 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) {
this->itemActive[2] = 0; this->itemActive[2] = 0;
this->itemActive[1] = 0; this->itemActive[1] = 0;
this->itemActive[0] = 0; this->itemActive[0] = 0;
spawnData = gUnk_08108D5C; spawnData = shopSpawnData;
count = 0; count = 0;
for (count = 0; count < 3;) { for (count = 0; count < 3;) {
if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) { if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) {
Entity* object = Entity* object =
CreateObject(SHOP_ITEM, 0x5c, ((s32)Random() % spawnData->maxType) + spawnData->minType); CreateObject(SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType);
if (object != NULL) { if (object != NULL) {
object->timer = 1; object->timer = 1;
object->subtimer = count; object->subtimer = count;

View File

@ -27,8 +27,8 @@ extern u32 sub_08000E44(u32);
extern void sub_080A3B74(void); extern void sub_080A3B74(void);
extern u32 sub_080A3B48(void); extern u32 sub_080A3B48(void);
extern void sub_0805ECEC(u32, u32, u32, u32); extern void sub_0805ECEC(u32, u32, u32, u32);
extern void sub_0801E6C8(u32); extern void NotifyFusersOnFusionDone(u32);
extern void sub_0801E798(u32); extern void RemoveKinstoneFromBag(u32);
extern WStruct* sub_0805F2C8(void); extern WStruct* sub_0805F2C8(void);
extern void sub_0805F300(WStruct*); extern void sub_0805F300(WStruct*);
extern u32 sub_0805F76C(u8*, WStruct*); extern u32 sub_0805F76C(u8*, WStruct*);
@ -86,7 +86,7 @@ const ScreenTransitionData gUnk_08128024[] = {
u32 sub_080A3B48(void) { u32 sub_080A3B48(void) {
u32 index; u32 index;
for (index = 0; index <= 0x12; index++) { for (index = 0; index <= 0x12; index++) {
if (gSave.unk12B[index] == 0) { if (gSave.kinstoneAmounts[index] == 0) {
break; break;
} }
} }
@ -151,7 +151,7 @@ void KinstoneMenu_Type0(void) {
gScreen.bg3.updated = 1; gScreen.bg3.updated = 1;
KinstoneMenu_080A4528(); KinstoneMenu_080A4528();
sub_080A4398(); sub_080A4398();
sub_0801E738(0); AddKinstoneToBag(0);
sub_080A70AC((void*)gUnk_081280DC); sub_080A70AC((void*)gUnk_081280DC);
SetMenuType(1); SetMenuType(1);
SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8);
@ -206,7 +206,7 @@ void KinstoneMenu_Type1(void) {
case A_BUTTON: case A_BUTTON:
if (gMenu.column_idx == 2) { if (gMenu.column_idx == 2) {
tmp3 = gGenericMenu.unk10.i / 0x10000; tmp3 = gGenericMenu.unk10.i / 0x10000;
gGenericMenu.unk2a = gSave.unk118[tmp3]; gGenericMenu.unk2a = gSave.kinstoneTypes[tmp3];
SetMenuType(3); SetMenuType(3);
} }
break; break;
@ -265,8 +265,8 @@ void KinstoneMenu_Type3_Overlay0(void) {
} }
void KinstoneMenu_Type3_Overlay1(void) { void KinstoneMenu_Type3_Overlay1(void) {
u32 temp = gKinstoneWorldEvents[gKinstoneMenu.unk2a].unk5; u32 temp = gKinstoneWorldEvents[gKinstoneMenu.unk2a].shape;
if (temp != gKinstoneWorldEvents[gFuseInfo.kinstoneId].unk5) { if (temp != gKinstoneWorldEvents[gFuseInfo.kinstoneId].shape) {
SoundReq(SFX_ITEM_SHIELD_BOUNCE); SoundReq(SFX_ITEM_SHIELD_BOUNCE);
SetMenuType(4); SetMenuType(4);
} else { } else {
@ -448,7 +448,7 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void K
gOamCmd.x = ((gSineTable[(uVar1 + 0x40) & 0xff] * 0x42) / 0x100) - 0x10; gOamCmd.x = ((gSineTable[(uVar1 + 0x40) & 0xff] * 0x42) / 0x100) - 0x10;
iVar2 = gKinstoneMenu.unk10.WORD / 0x10000 + i; iVar2 = gKinstoneMenu.unk10.WORD / 0x10000 + i;
if (iVar2 >= 0) { if (iVar2 >= 0) {
uVar3 = gSave.unk12B[iVar2]; uVar3 = gSave.kinstoneAmounts[iVar2];
if (i == 0) { if (i == 0) {
switch (gMenu.column_idx) { switch (gMenu.column_idx) {
case 3: case 3:
@ -460,7 +460,7 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void K
} }
} }
if (0 < uVar3) { if (0 < uVar3) {
sub_080A42E0(gSave.unk118[iVar2], uVar3); sub_080A42E0(gSave.kinstoneTypes[iVar2], uVar3);
} }
} }
} }
@ -517,9 +517,9 @@ void sub_080A42E0(u32 kinstoneId, u32 param_2) {
const KinstoneWorldEvent* ptr = &gKinstoneWorldEvents[kinstoneId]; const KinstoneWorldEvent* ptr = &gKinstoneWorldEvents[kinstoneId];
if (param_2 == 0xff) { if (param_2 == 0xff) {
uVar1 = ptr->unk2; uVar1 = ptr->gfxOffsetFull;
} else { } else {
uVar1 = ptr->unk1; uVar1 = ptr->gfxOffsetPiece;
} }
iVar4 = sub_080A43A8(uVar1); iVar4 = sub_080A43A8(uVar1);
if ((param_2 != 0) && (param_2 != 0xff)) { if ((param_2 != 0) && (param_2 != 0xff)) {
@ -608,8 +608,8 @@ u32 sub_080A4418(u32 param_1, u32 param_2) {
void KinstoneMenu_080A4468(void) { void KinstoneMenu_080A4468(void) {
gUnk_03003DF0.unk_2 = 0; gUnk_03003DF0.unk_2 = 0;
gUnk_03003DF0.unk_4[3] = 0; gUnk_03003DF0.unk_4[3] = 0;
sub_0801E6C8(gFuseInfo.kinstoneId); NotifyFusersOnFusionDone(gFuseInfo.kinstoneId);
sub_0801E798(gKinstoneMenu.unk2a); RemoveKinstoneFromBag(gKinstoneMenu.unk2a);
} }
u32 KinstoneMenu_080A4494(void) { u32 KinstoneMenu_080A4494(void) {
@ -625,9 +625,9 @@ u32 KinstoneMenu_080A4494(void) {
psVar1->unk1 = 0; psVar1->unk1 = 0;
sub_080A44E0(psVar1, gSave.name, 0x80); sub_080A44E0(psVar1, gSave.name, 0x80);
#if NON_MATCHING #if NON_MATCHING
ret = sub_080A44E0(psVar1, sub_08002632(gFuseInfo.ent) >> 0x20, 0xa0); ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.ent) >> 0x20, 0xa0);
#else #else
sub_08002632(gFuseInfo.ent); GetFuserId(gFuseInfo.ent);
asm("" : "=r"(r1)); asm("" : "=r"(r1));
ret = sub_080A44E0(psVar1, r1, 0xa0); ret = sub_080A44E0(psVar1, r1, 0xa0);
#endif #endif

View File

@ -59,14 +59,14 @@ void Subtask_PauseMenu(void) {
struct_08127F94* sub_080A6A80(u32, u32); struct_08127F94* sub_080A6A80(u32, u32);
extern u8 gUnk_02034492[]; extern u8 gUnk_02034492[];
void sub_0801E8D4(void); void UpdateVisibleFusionMapMarkers(void);
s32 sub_080A50A0(s32); s32 sub_080A50A0(s32);
void PauseMenu_Variant0(void) { void PauseMenu_Variant0(void) {
struct_08127F94* ptr; struct_08127F94* ptr;
int r0, r1; int r0, r1;
sub_0801E8D4(); UpdateVisibleFusionMapMarkers();
sub_080A4D34(); sub_080A4D34();
r1 = 4; r1 = 4;
do { do {
@ -665,7 +665,7 @@ void sub_080A5594(void) {
iVar5 = 0; iVar5 = 0;
if (GetInventoryValue(ITEM_KINSTONE_BAG) != 0) { if (GetInventoryValue(ITEM_KINSTONE_BAG) != 0) {
for (i = 0; i < 0x13; i++) { for (i = 0; i < 0x13; i++) {
iVar5 += gSave.unk12B[i]; iVar5 += gSave.kinstoneAmounts[i];
} }
if (iVar5 >= 0x50) { if (iVar5 >= 0x50) {
@ -1281,7 +1281,7 @@ void PauseMenu_Screen_7(void) {
void sub_080A6024(void) { void sub_080A6024(void) {
sub_080A70AC((KeyButtonLayout*)&gUnk_08128D60); sub_080A70AC((KeyButtonLayout*)&gUnk_08128D60);
sub_0801E738(0); AddKinstoneToBag(0);
sub_080A4398(); sub_080A4398();
SetMenuType(1); SetMenuType(1);
} }
@ -1299,11 +1299,11 @@ void sub_080A6044(void) {
gOamCmd._6 = 0; gOamCmd._6 = 0;
uVar4 = 0; uVar4 = 0;
uVar2 = 0; uVar2 = 0;
uVar1 = gSave.unk118[0]; uVar1 = gSave.kinstoneTypes[0];
while (uVar1 != 0) { while (uVar1 != 0) {
gOamCmd.x = (uVar4 & 3) * 0x30 + 0x2b; gOamCmd.x = (uVar4 & 3) * 0x30 + 0x2b;
gOamCmd.y = (uVar4 >> 2) * 0x24 + 0x34; gOamCmd.y = (uVar4 >> 2) * 0x24 + 0x34;
uVar3 = gSave.unk12B[uVar2]; uVar3 = gSave.kinstoneAmounts[uVar2];
gMenu.column_idx = 0; gMenu.column_idx = 0;
sub_080A42E0(uVar1, uVar3); sub_080A42E0(uVar1, uVar3);
uVar4++; uVar4++;
@ -1314,7 +1314,7 @@ void sub_080A6044(void) {
if (0x11 < uVar2) { if (0x11 < uVar2) {
return; return;
} }
uVar1 = gSave.unk118[uVar2]; uVar1 = gSave.kinstoneTypes[uVar2];
} }
} }
} }

View File

@ -205,8 +205,8 @@ void sub_080A68D4(void) {
} }
for (i = 10; i <= 100; i++) { for (i = 10; i <= 100; i++) {
if (CheckKinstoneFused(i) && !sub_0801E810(i)) { if (CheckKinstoneFused(i) && !CheckFusionMapMarkerDisabled(i)) {
uVar4 = gKinstoneWorldEvents[i].unk7; uVar4 = gKinstoneWorldEvents[i].mapMarkerIcon;
ptr = &gWorldEvents[gKinstoneWorldEvents[i].worldEventId]; ptr = &gWorldEvents[gKinstoneWorldEvents[i].worldEventId];
sub_080A698C(ptr->_c, ptr->_e, DRAW_DIRECT_SPRITE_INDEX, uVar4 + 100); sub_080A698C(ptr->_c, ptr->_e, DRAW_DIRECT_SPRITE_INDEX, uVar4 + 100);
} }

View File

@ -29,7 +29,7 @@ void Anju(Entity* this) {
} }
void sub_0806C354(Entity* this) { void sub_0806C354(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -291,7 +291,7 @@ void sub_08068ADC(Entity* this) {
void sub_08068AFC(Entity* this) { void sub_08068AFC(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
} }

View File

@ -115,7 +115,7 @@ void sub_080636D8(Entity* this) {
} }
void sub_080636F4(Entity* this) { void sub_080636F4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -92,7 +92,7 @@ void sub_08067304(Entity* this) {
} }
void sub_08067314(Entity* this) { void sub_08067314(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -129,7 +129,7 @@ void sub_080677EC(Entity* this) {
this->spriteSettings.flipX = 0; this->spriteSettings.flipX = 0;
} }
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
this->hitbox = (Hitbox*)&gUnk_08110EF0; this->hitbox = (Hitbox*)&gUnk_08110EF0;
uVar2 = sub_0805ACC0(this); uVar2 = sub_0805ACC0(this);
if (uVar2 == 0) { if (uVar2 == 0) {

View File

@ -50,7 +50,7 @@ void sub_08068FC0(Entity* ent) {
*(u16*)&ent->field_0x68 = var1; *(u16*)&ent->field_0x68 = var1;
ent->field_0x6a.HWORD = r2; ent->field_0x6a.HWORD = r2;
} }
ent->field_0x6c.HALF.LO = sub_0801E99C(ent); ent->field_0x6c.HALF.LO = GetFusionToOffer(ent);
InitAnimationForceUpdate(ent, ent->animationState + 4); InitAnimationForceUpdate(ent, ent->animationState + 4);
} }

View File

@ -15,7 +15,7 @@ void Cucco(Entity* this) {
void Cucco_Init(Entity* this) { void Cucco_Init(Entity* this) {
this->action++; this->action++;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_080787A8(this, this->field_0x68.HALF.LO); sub_080787A8(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
this->subAction = 0; this->subAction = 0;
@ -112,8 +112,8 @@ void sub_0806E65C(Entity* this) {
void Cucco_ShowMessage(Entity* this) { void Cucco_ShowMessage(Entity* this) {
u32 val = 0; u32 val = 0;
u32 index = sub_08002632(this); u32 index = GetFuserId(this);
if (gSave.unk1C1[index] == 0xf3) { if (gSave.fuserOffers[index] == 0xf3) {
val = 1; val = 1;
} }

View File

@ -23,7 +23,7 @@ void CuccoChick(Entity* this) {
void CuccoChick_Init(Entity* this) { void CuccoChick_Init(Entity* this) {
this->action++; this->action++;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_080787A8(this, this->field_0x68.HALF.LO); sub_080787A8(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
this->subAction = 0; this->subAction = 0;

View File

@ -34,7 +34,7 @@ void Dampe(Entity* this) {
} }
void sub_0806BE3C(Entity* this) { void sub_0806BE3C(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -30,8 +30,8 @@ void Din(Entity* this) {
} }
void sub_08064828(Entity* this) { void sub_08064828(Entity* this) {
u32 tmp = sub_0801E99C(this); u32 tmp = GetFusionToOffer(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) { if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0; tmp = 0;
} }
sub_08078784(this, tmp); sub_08078784(this, tmp);

View File

@ -206,7 +206,7 @@ void sub_08069B44(Entity* this) {
this->timer = 30; this->timer = 30;
this->animationState = 2; this->animationState = 2;
this->field_0x6a.HALF.LO = 0xff; this->field_0x6a.HALF.LO = 0xff;
this->field_0x74.HALF.LO = sub_0801E99C(this); this->field_0x74.HALF.LO = GetFusionToOffer(this);
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
InitAnimationForceUpdate(this, 10); InitAnimationForceUpdate(this, 10);
if ((this->flags & ENT_SCRIPTED) != 0) { if ((this->flags & ENT_SCRIPTED) != 0) {

View File

@ -27,7 +27,7 @@ void sub_080659B8(Entity* this) {
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->animationState = 6; this->animationState = 6;
this->field_0x68.HALF.HI = -1; this->field_0x68.HALF.HI = -1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
InitAnimationForceUpdate(this, this->animationState / 2); InitAnimationForceUpdate(this, this->animationState / 2);
} }

View File

@ -60,7 +60,7 @@ void sub_0806BCC0(Entity* this) {
} }
void sub_0806BCD4(Entity* this) { void sub_0806BCD4(Entity* this) {
sub_08078784(this, sub_0801E99C(this)); sub_08078784(this, GetFusionToOffer(this));
} }
void sub_0806BCE8(Entity* this) { void sub_0806BCE8(Entity* this) {

View File

@ -30,8 +30,8 @@ void Farore(Entity* this) {
} }
void sub_08064A28(Entity* this) { void sub_08064A28(Entity* this) {
u32 tmp = sub_0801E99C(this); u32 tmp = GetFusionToOffer(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) { if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0; tmp = 0;
} }
sub_08078784(this, tmp); sub_08078784(this, tmp);

View File

@ -21,7 +21,7 @@ void sub_0805FE10(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = TRUE; this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
} }

View File

@ -535,7 +535,7 @@ void ForestMinish(Entity* this) {
} }
void sub_08060090(Entity* this) { void sub_08060090(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -8,7 +8,7 @@ void Gentari(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = TRUE; this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
break; break;

View File

@ -111,7 +111,7 @@ void sub_08065CCC(Entity* this) {
} }
void sub_08065D00(Entity* this) { void sub_08065D00(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -9,7 +9,7 @@ void Gina(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
break; break;

View File

@ -105,7 +105,7 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
} }
u32 sub_08069480(Entity* this) { u32 sub_08069480(Entity* this) {
return (u8)sub_0801E99C(this); return (u8)GetFusionToOffer(this);
} }
void sub_0806948C(Entity* this, ScriptExecutionContext* context) { void sub_0806948C(Entity* this, ScriptExecutionContext* context) {

View File

@ -5,6 +5,7 @@
#include "flags.h" #include "flags.h"
#include "save.h" #include "save.h"
#include "npc.h" #include "npc.h"
#include "item.h"
static u32 GoronMerchant_GetSalePrice(Entity*); static u32 GoronMerchant_GetSalePrice(Entity*);
@ -13,7 +14,7 @@ extern void (*const gUnk_08111B98[])(Entity*);
static const u16 sKinstonePrices[]; static const u16 sKinstonePrices[];
extern u32 sub_0801E7D0(u32); extern u32 GetAmountInKinstoneBag(u32);
void GoronMerchant(Entity* this) { void GoronMerchant(Entity* this) {
if ((this->flags & ENT_SCRIPTED) != 0) { if ((this->flags & ENT_SCRIPTED) != 0) {
@ -132,9 +133,9 @@ static u32 GoronMerchant_GetSalePrice(Entity* this) {
void GoronMerchant_TryToBuyKinstone(Entity* this, ScriptExecutionContext* context) { void GoronMerchant_TryToBuyKinstone(Entity* this, ScriptExecutionContext* context) {
s32 salePrice = GoronMerchant_GetSalePrice(this); s32 salePrice = GoronMerchant_GetSalePrice(this);
if (salePrice <= gSave.stats.rupees) { if (salePrice <= gSave.stats.rupees) {
if (sub_0801E7D0(gRoomVars.shopItemType2) < 99) { if (GetAmountInKinstoneBag(gRoomVars.shopItemType2) < 99) {
ModRupees(-salePrice); ModRupees(-salePrice);
InitItemGetSequence(0x5c, gRoomVars.shopItemType2, 0); InitItemGetSequence(ITEM_KINSTONE, gRoomVars.shopItemType2, 0);
gRoomVars.shopItemType = 0; gRoomVars.shopItemType = 0;
gRoomVars.shopItemType2 = 0; gRoomVars.shopItemType2 = 0;
context->condition = 1; context->condition = 1;

View File

@ -155,7 +155,7 @@ void sub_0806CD4C(Entity* this) {
} }
void sub_0806CD58(Entity* this) { void sub_0806CD58(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -26,7 +26,7 @@ void HurdyGurdyMan(Entity* this) {
this->interactType = 0; this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex; this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
index = sub_08002632(this); index = GetFuserId(this);
pointerToArray = gUnk_08001A7C[index]; pointerToArray = gUnk_08001A7C[index];
if (this->field_0x68.HALF.LO == 0x32) { if (this->field_0x68.HALF.LO == 0x32) {
pointerToArray = pointerToArray + 3; pointerToArray = pointerToArray + 3;
@ -101,7 +101,7 @@ void sub_0806E418(Entity* this) {
} }
void sub_0806E440(Entity* this) { void sub_0806E440(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -597,7 +597,7 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) {
} }
void sub_08062A48(Entity* this, ScriptExecutionContext* context) { void sub_08062A48(Entity* this, ScriptExecutionContext* context) {
this->field_0x6a.HALF.LO = sub_0801E99C(this); this->field_0x6a.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x6a.HALF.LO); sub_08078784(this, this->field_0x6a.HALF.LO);
} }

View File

@ -39,7 +39,7 @@ void KingDaltus(Entity* this) {
void sub_08066654(Entity* this) { void sub_08066654(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
InitAnimationForceUpdate(this, 2); InitAnimationForceUpdate(this, 2);
} }
@ -72,7 +72,7 @@ void sub_080666DC(Entity* this) {
void sub_080666E4(Entity* this) { void sub_080666E4(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this); sub_0807DD50(this);
} }

View File

@ -9,7 +9,7 @@ void Librari(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = TRUE; this->spriteSettings.draw = TRUE;
this->animationState = this->timer; this->animationState = this->timer;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
sub_0807DD50(this); sub_0807DD50(this);

View File

@ -43,7 +43,7 @@ void sub_08065888(Entity* this) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->animationState = 4; this->animationState = 4;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
} }

View File

@ -93,7 +93,7 @@ void sub_0806C4DC(Entity* this) {
} }
void sub_0806C4F8(Entity* this) { void sub_0806C4F8(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -11,7 +11,7 @@ void MayorHagen(Entity* this) {
case 0: case 0:
this->action = 1; this->action = 1;
this->field_0x68.HALF.HI = 0; this->field_0x68.HALF.HI = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
SetDefaultPriority(this, PRIO_MESSAGE); SetDefaultPriority(this, PRIO_MESSAGE);
sub_0807DD50(this); sub_0807DD50(this);
break; break;
@ -44,7 +44,7 @@ void sub_0806CE5C(Entity* this) {
8, 8,
16, 16,
}; };
sub_08078784(this, sub_0801E99C(this)); sub_08078784(this, GetFusionToOffer(this));
sub_08078850(this, 1, 0, gUnk_08113F44); sub_08078850(this, 1, 0, gUnk_08113F44);
} }

View File

@ -101,7 +101,7 @@ void sub_08068780(Entity* this) {
} }
void sub_08068884(Entity* this) { void sub_08068884(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -60,7 +60,7 @@ void sub_08066864(Entity* this) {
case 0: case 0:
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this); sub_0807DD50(this);
break; break;
case 1: case 1:
@ -82,7 +82,7 @@ void sub_08066864(Entity* this) {
} }
void sub_080668F0(Entity* this) { void sub_080668F0(Entity* this) {
sub_08078784(this, sub_0801E99C(this)); sub_08078784(this, GetFusionToOffer(this));
} }
void sub_08066904(Entity* this) { void sub_08066904(Entity* this) {

View File

@ -180,7 +180,7 @@ void sub_08067EF0(Entity* this) {
} }
void sub_08068104(Entity* this) { void sub_08068104(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -83,7 +83,7 @@ void sub_080670E4(Entity* this) {
} }
void sub_08067100(Entity* this) { void sub_08067100(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -30,8 +30,8 @@ void Nayru(Entity* this) {
} }
void sub_08064928(Entity* this) { void sub_08064928(Entity* this) {
u32 tmp = sub_0801E99C(this); u32 tmp = GetFusionToOffer(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) { if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0; tmp = 0;
} }
sub_08078784(this, tmp); sub_08078784(this, tmp);

View File

@ -83,7 +83,7 @@ u8 sub_0806DA3C(Entity* this) {
case 8: case 8:
case 9: case 9:
case 10: case 10:
result = sub_0801E99C(this); result = GetFusionToOffer(this);
break; break;
} }
return result; return result;

View File

@ -71,7 +71,7 @@ void sub_0806B41C(Entity* this) {
this->action = 2; this->action = 2;
this->interactType = 0; this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
idx = sub_08002632(this); idx = GetFuserId(this);
tmp = gUnk_08001A7C[idx]; tmp = gUnk_08001A7C[idx];
if (this->field_0x68.HALF.LO == 33) if (this->field_0x68.HALF.LO == 33)
tmp += 3; tmp += 3;
@ -162,7 +162,7 @@ void sub_0806B540(Entity* this) {
} }
void sub_0806B60C(Entity* this) { void sub_0806B60C(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -151,7 +151,7 @@ void sub_08063C90(Entity* this) {
} }
void sub_08063CAC(Entity* this) { void sub_08063CAC(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -41,10 +41,10 @@ void RemoveAllBakedGoods(void) {
bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) { bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
u32 tmp; u32 tmp;
u32 tmp2; u32 kinstoneId;
static const u8 chanceForPrize[] = { 0x20, 0x40, 0x60, 0x80, 0xFF }; static const u8 chanceForPrize[] = { 0x20, 0x40, 0x60, 0x80, 0xFF };
static const u8 gUnk_0810C435[] = { 0x10, 0x10, 0x10, 0x20, 0x20, 0x30, 0x30, 0x30 }; static const u8 chancesPerType[] = { 0x10, 0x10, 0x10, 0x20, 0x20, 0x30, 0x30, 0x30 };
static const u8 gUnk_0810C43D[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 }; static const u8 kinstoneTypes[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 };
//! @bug: tmp is uninitialized, in practice player must have an item here //! @bug: tmp is uninitialized, in practice player must have an item here
if (GetInventoryValue(ITEM_BRIOCHE) != 0) { if (GetInventoryValue(ITEM_BRIOCHE) != 0) {
@ -67,9 +67,9 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
context->condition = FALSE; context->condition = FALSE;
return FALSE; return FALSE;
} else { } else {
tmp = GetRandomByWeight(gUnk_0810C435); tmp = GetRandomByWeight(chancesPerType);
tmp2 = gUnk_0810C43D[tmp]; kinstoneId = kinstoneTypes[tmp];
InitItemGetSequence(ITEM_KINSTONE, tmp2, 1); InitItemGetSequence(ITEM_KINSTONE, kinstoneId, 1);
MessageNoOverlap(TEXT_INDEX(TEXT_BAKERY, 0x5), this); MessageNoOverlap(TEXT_INDEX(TEXT_BAKERY, 0x5), this);
context->condition = TRUE; context->condition = TRUE;
return TRUE; return TRUE;

View File

@ -234,7 +234,7 @@ void sub_08060528(Entity* this) {
this->field_0x68.HALF.HI = 0; this->field_0x68.HALF.HI = 0;
this->field_0x6a.HWORD = 0; this->field_0x6a.HWORD = 0;
this->field_0x6c.HALF.HI = 0; this->field_0x6c.HALF.HI = 0;
this->field_0x6c.HALF.LO = sub_0801E99C(this); this->field_0x6c.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this); sub_0807DD50(this);
break; break;
case 1: case 1:
@ -293,7 +293,7 @@ void sub_08060528(Entity* this) {
} }
void sub_080606C0(Entity* this) { void sub_080606C0(Entity* this) {
this->field_0x6c.HALF.LO = sub_0801E99C(this); this->field_0x6c.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x6c.HALF.LO); sub_08078784(this, this->field_0x6c.HALF.LO);
} }

View File

@ -236,7 +236,7 @@ void SittingPerson_Head(Entity* this) {
} }
void sub_080639D0(Entity* this) { void sub_080639D0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -73,7 +73,7 @@ void Smith_Head(Entity* this) {
void sub_080660EC(Entity* this) { void sub_080660EC(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08110354)) { if (LoadExtraSpriteData(this, gUnk_08110354)) {
this->action = 1; this->action = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
InitAnimationForceUpdate(this, 2); InitAnimationForceUpdate(this, 2);
} }
} }
@ -109,7 +109,7 @@ void sub_08066178(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08110354)) { if (LoadExtraSpriteData(this, gUnk_08110354)) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this); sub_0807DD50(this);
} }
} }

View File

@ -141,7 +141,7 @@ void sub_08064C9C(Entity* this) {
} }
void sub_08064CC0(Entity* this) { void sub_08064CC0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -78,7 +78,7 @@ void sub_08065608(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810FEB0)) { if (LoadExtraSpriteData(this, gUnk_0810FEB0)) {
this->action = 1; this->action = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this); sub_0807DD50(this);
} }

View File

@ -43,7 +43,7 @@ void Teachers(Entity* this) {
} }
void sub_0806C674(Entity* this) { void sub_0806C674(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -68,7 +68,7 @@ void sub_08064DE4(Entity* this) {
case 2: case 2:
if (UpdateFuseInteraction(this)) { if (UpdateFuseInteraction(this)) {
this->action = 1; this->action = 1;
sub_0801E99C(this); GetFusionToOffer(this);
} }
break; break;
} }
@ -84,7 +84,7 @@ void sub_08064DE4(Entity* this) {
} }
void sub_08064EA4(Entity* this) { void sub_08064EA4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
switch (this->type) { switch (this->type) {
case 0: case 0:
if ((CheckKinstoneFused(KINSTONE_59) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) { if ((CheckKinstoneFused(KINSTONE_59) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) {
@ -134,7 +134,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
context->condition = 0; context->condition = 0;
roomFlag = gUnk_0810FC50[this->type]; roomFlag = gUnk_0810FC50[this->type];
if (CheckRoomFlag(roomFlag) == 0) { if (CheckRoomFlag(roomFlag) == 0) {
bVar2 = gSave.unk141[sub_08002632(this)]; bVar2 = gSave.fuserProgress[GetFuserId(this)];
if (bVar2 >= 2) { if (bVar2 >= 2) {
uVar5 = 3; uVar5 = 3;
} else { } else {

View File

@ -208,7 +208,7 @@ void sub_0806ACC4(Entity* this) {
this->animationState = delay * 2; this->animationState = delay * 2;
this->timer = 0; this->timer = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this); sub_0807DD50(this);
InitializeAnimation(this, (this->animationState / 2) + 8); InitializeAnimation(this, (this->animationState / 2) + 8);
break; break;

View File

@ -104,7 +104,7 @@ void sub_08061CEC(Entity* this) {
this->field_0x6a.HWORD = (uVar2 >> 0x10); this->field_0x6a.HWORD = (uVar2 >> 0x10);
} }
*(u16*)&this->field_0x6c = uVar2; *(u16*)&this->field_0x6c = uVar2;
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD64(this); sub_0807DD64(this);
sub_08061D64(this); sub_08061D64(this);
} }

View File

@ -81,7 +81,7 @@ void sub_0806C85C(Entity* this) {
void sub_0806C870(Entity* this) { void sub_0806C870(Entity* this) {
u8 bVar1; u8 bVar1;
bVar1 = sub_0801E99C(this); bVar1 = GetFusionToOffer(this);
this->field_0x68.HALF.LO = bVar1; this->field_0x68.HALF.LO = bVar1;
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }

View File

@ -327,7 +327,7 @@ void CollideFollowers(void) {
} }
void sub_0806F118(Entity* ent) { void sub_0806F118(Entity* ent) {
u32 idx = sub_08002632(ent); u32 idx = GetFuserId(ent);
NPCData* data = gUnk_08001A7C[idx]; NPCData* data = gUnk_08001A7C[idx];
sub_0801DFB4(ent, data->textIndex, data->_2, data->_4); sub_0801DFB4(ent, data->textIndex, data->_2, data->_4);
gPlayerState.controlMode = CONTROL_DISABLED; gPlayerState.controlMode = CONTROL_DISABLED;
@ -353,9 +353,9 @@ u32 UpdateFuseInteraction(Entity* ent) {
} }
void sub_0806F188(Entity* ent) { void sub_0806F188(Entity* ent) {
u32 idx = sub_08002632(ent); u32 idx = GetFuserId(ent);
if (idx != 0) if (idx != 0)
gSave.unk1C1[idx] = 0xF3; gSave.fuserOffers[idx] = 0xF3;
} }
void ShowNPCDialogue(Entity* ent, const Dialog* dia) { void ShowNPCDialogue(Entity* ent, const Dialog* dia) {

View File

@ -133,7 +133,7 @@ void CameraTarget_Action2(Entity* this) {
bVar2 = this->type2; bVar2 = this->type2;
} }
ptr = gKinstoneWorldEvents + bVar2; ptr = gKinstoneWorldEvents + bVar2;
bVar1 = ptr->unk6; bVar1 = ptr->bubbleIcon;
bVar3 = bVar1 & 1; bVar3 = bVar1 & 1;
this->palette.b.b0 = bVar3; this->palette.b.b0 = bVar3;
temp = gUnk_0811F744[bVar1] < 0; temp = gUnk_0811F744[bVar1] < 0;

View File

@ -13,23 +13,28 @@
#include "npc.h" #include "npc.h"
#include "object.h" #include "object.h"
#include "script.h" #include "script.h"
#include "item.h"
typedef struct { typedef struct {
Entity base; Entity base;
s16 unk68; s16 timer;
s16 unk6a; s16 currentCuccos;
s16 unk6c; s16 targetCuccos;
u16 unk6e; u16 unk6e;
u8 unk70[0x18]; u8 returnedCuccoTypes[0x18];
} CuccoMinigameEntity; } CuccoMinigameEntity;
typedef Entity* CuccoMinigameHeap[10]; typedef Entity* CuccoMinigameHeap[10];
u32 sub_080A1514(); u32 CuccoMinigame_GetLevel();
const u16 gUnk_08124C20[] = { typedef struct {
25, 0x2, 25, 0x3, 30, 0x4, 45, 0x5, 50, 0x5, 45, 0x5, 50, 0x6, 60, 0x7, 55, 0x2, 55, 0x3, u16 time;
}; u16 numCuccos;
} CuccoMinigameGoal;
const CuccoMinigameGoal goalData[10] = { { 25, 2 }, { 25, 3 }, { 30, 4 }, { 45, 5 }, { 50, 5 },
{ 45, 5 }, { 50, 6 }, { 60, 7 }, { 55, 2 }, { 55, 3 } };
static const u16 pCuccoMinigame_MinigameCuccoDefs[][30] = { static const u16 pCuccoMinigame_MinigameCuccoDefs[][30] = {
{ 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001, { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001,
@ -66,9 +71,18 @@ static const u16 pCuccoMinigame_MinigameCuccoDefs[][30] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 } 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }
}; };
static const u8 gUnk_08124EA0[] = { 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x14, 0x01, 0x00, 0x3F, 0x14, typedef struct {
0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x5C, 0x6E, 0x01, 0x00, u8 item;
0x5C, 0x6F, 0x01, 0x00, 0x5C, 0x70, 0x01, 0x00, 0x63, 0x00, 0x01, 0x00 }; u8 subtype;
u8 unk2;
u8 unk3;
} CuccoMinigamePrizeData;
static const CuccoMinigamePrizeData prizeData[10] = { { ITEM_SHELLS, 10, 1, 0 }, { ITEM_SHELLS, 10, 1, 0 },
{ ITEM_SHELLS, 20, 1, 0 }, { ITEM_SHELLS, 20, 1, 0 },
{ ITEM_SHELLS, 30, 1, 0 }, { ITEM_SHELLS, 30, 1, 0 },
{ ITEM_KINSTONE, 0x6E, 1, 0 }, { ITEM_KINSTONE, 0x6F, 1, 0 },
{ ITEM_KINSTONE, 0x70, 1, 0 }, { ITEM_HEART_PIECE, 0, 1, 0 } };
static const u16 CuccoMinigame_Sounds[] = { SFX_VO_CUCCO5, SFX_VO_CUCCO_CALL }; static const u16 CuccoMinigame_Sounds[] = { SFX_VO_CUCCO5, SFX_VO_CUCCO_CALL };
@ -78,17 +92,17 @@ void CuccoMinigame(CuccoMinigameEntity* this) {
int index; int index;
u32 val; u32 val;
u8* puVar2; u8* puVar2;
const u16* ptr; const CuccoMinigameGoal* ptr;
if (super->action == 0) { if (super->action == 0) {
super->action++; super->action++;
ptr = gUnk_08124C20 + sub_080A1514() * 2; ptr = &goalData[CuccoMinigame_GetLevel()];
this->unk68 = ptr[0] * 0x3c; this->timer = ptr->time * 60;
this->unk6a = 0; this->currentCuccos = 0;
this->unk6c = ptr[1]; this->targetCuccos = ptr->numCuccos;
this->unk6e = 1; this->unk6e = 1;
for (puVar2 = this->unk70, val = 0, index = 9; index >= 0; index--) { for (puVar2 = this->returnedCuccoTypes, val = 0, index = 9; index >= 0; index--) {
*puVar2++ = val; *puVar2++ = val;
} }
sub_0807DD64(super); sub_0807DD64(super);
@ -110,7 +124,7 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMi
sVar6 = 0; sVar6 = 0;
entArray = ((Entity**)super->myHeap); entArray = ((Entity**)super->myHeap);
ptr = this->unk70; ptr = this->returnedCuccoTypes;
iVar1 = (gRoomControls.origin_x + 0x360); iVar1 = (gRoomControls.origin_x + 0x360);
iVar4 = (gRoomControls.origin_y + 0x350); iVar4 = (gRoomControls.origin_y + 0x350);
iVar1 = (iVar1 << 16) >> 16; iVar1 = (iVar1 << 16) >> 16;
@ -147,9 +161,9 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMi
} }
} }
this->unk6a = sVar6; this->currentCuccos = sVar6;
gPlayerState.field_0x27[0] = 0xff; gPlayerState.field_0x27[0] = 0xff;
if (--this->unk68 < 1) { if (--this->timer < 1) {
SoundReq(SFX_CUCCO_MINIGAME_BELL); SoundReq(SFX_CUCCO_MINIGAME_BELL);
sub_08050384(); sub_08050384();
} else { } else {
@ -163,7 +177,7 @@ void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) {
s8* pcVar2; s8* pcVar2;
int index; int index;
pcVar2 = this->unk70; pcVar2 = this->returnedCuccoTypes;
puVar1 = super->myHeap; puVar1 = super->myHeap;
for (index = 9; index >= 0; index--, pcVar2++, puVar1++) { for (index = 9; index >= 0; index--, pcVar2++, puVar1++) {
@ -174,8 +188,8 @@ void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) {
} }
} }
void sub_080A13B4(CuccoMinigameEntity* this, ScriptExecutionContext* context) { void CuccoMinigame_Results(CuccoMinigameEntity* this, ScriptExecutionContext* context) {
if (this->unk6a >= this->unk6c) { if (this->currentCuccos >= this->targetCuccos) {
MessageFromTarget(TEXT_INDEX(TEXT_ANJU, 0xc)); MessageFromTarget(TEXT_INDEX(TEXT_ANJU, 0xc));
context->condition = 1; context->condition = 1;
} else { } else {
@ -184,115 +198,115 @@ void sub_080A13B4(CuccoMinigameEntity* this, ScriptExecutionContext* context) {
} }
} }
void sub_080A13E8(CuccoMinigameEntity* this) { void CuccoMinigame_WinItem(CuccoMinigameEntity* this) {
bool32 bVar2; bool32 skipItem;
const u8* ptr = &gUnk_08124EA0[sub_080A1514() * 4]; const CuccoMinigamePrizeData* prize = &prizeData[CuccoMinigame_GetLevel()];
bVar2 = 0; skipItem = 0;
switch (ptr[0]) { switch (prize->item) {
case 0x3f: case ITEM_SHELLS:
if (gSave.stats.hasAllFigurines) { if (gSave.stats.hasAllFigurines) {
bVar2 = 1; skipItem = 1;
} }
break; break;
case 0x5c: case ITEM_KINSTONE:
if (gSave.didAllFusions) { if (gSave.didAllFusions) {
bVar2 = 1; skipItem = 1;
} }
break; break;
case 0x63: case ITEM_HEART_PIECE:
if (!CheckGlobalFlag(ANJU_HEART)) { if (!CheckGlobalFlag(ANJU_HEART)) {
SetGlobalFlag(ANJU_HEART); SetGlobalFlag(ANJU_HEART);
break; break;
} }
bVar2 = 1; skipItem = 1;
break; break;
} }
if (!bVar2) { if (!skipItem) {
InitItemGetSequence(ptr[0], ptr[1], 0); InitItemGetSequence(prize->item, prize->subtype, 0);
} else { } else {
this->unk6e = 2; this->unk6e = 2;
} }
} }
void sub_080A1460(CuccoMinigameEntity* this) { void CuccoMinigame_WinRupees(CuccoMinigameEntity* this) {
s8* pcVar1; s8* cuccoTypes;
int iVar2; int index;
s32 rupees; s32 rupees;
const u8* ptr; const u8* rupeeValues;
sub_080A1514(); CuccoMinigame_GetLevel(); // Rupees previously dependent on level?
pcVar1 = this->unk70; cuccoTypes = this->returnedCuccoTypes;
rupees = 0; rupees = 0;
ptr = CuccoMinigameRupees; rupeeValues = CuccoMinigameRupees;
for (iVar2 = 9; iVar2 >= 0; iVar2--) { for (index = 9; index >= 0; index--) { // Only first 10 count?
// Weird register addition // Weird register addition
// ptr[*pcVar1] translates to add r0,r3,r0 but should be add r0,r3 // rupeeValues[*cuccoTypes] translates to add r0,r3,r0 but should be add r0,r3
u32 temp = *pcVar1; u32 temp = *cuccoTypes;
temp += (int)ptr; temp += (int)rupeeValues;
rupees += *(u8*)temp; rupees += *(u8*)temp;
pcVar1++; cuccoTypes++;
} }
ModRupees(rupees); ModRupees(rupees);
MessageNoOverlap(TEXT_INDEX(TEXT_ANJU, 0x7), super); MessageNoOverlap(TEXT_INDEX(TEXT_ANJU, 0x7), super);
gMessage.rupees = (u16)rupees; gMessage.rupees = (u16)rupees;
} }
void sub_080A14A8(void) { void CuccoMinigame_AdvanceLevel(void) {
int iVar1; int level;
iVar1 = sub_080A1514(); level = CuccoMinigame_GetLevel();
iVar1++; level++;
if (iVar1 > 9) { if (level > 9) {
iVar1 = 9; level = 9;
} }
if (iVar1 & 1) { if (level & 1) {
SetGlobalFlag(ANJU_LV_BIT0); SetGlobalFlag(ANJU_LV_BIT0);
} else { } else {
ClearGlobalFlag(ANJU_LV_BIT0); ClearGlobalFlag(ANJU_LV_BIT0);
} }
if (iVar1 & 2) { if (level & 2) {
SetGlobalFlag(ANJU_LV_BIT1); SetGlobalFlag(ANJU_LV_BIT1);
} else { } else {
ClearGlobalFlag(ANJU_LV_BIT1); ClearGlobalFlag(ANJU_LV_BIT1);
} }
if (iVar1 & 4) { if (level & 4) {
SetGlobalFlag(ANJU_LV_BIT2); SetGlobalFlag(ANJU_LV_BIT2);
} else { } else {
ClearGlobalFlag(ANJU_LV_BIT2); ClearGlobalFlag(ANJU_LV_BIT2);
} }
if (iVar1 & 8) { if (level & 8) {
SetGlobalFlag(ANJU_LV_BIT3); SetGlobalFlag(ANJU_LV_BIT3);
} else { } else {
ClearGlobalFlag(ANJU_LV_BIT3); ClearGlobalFlag(ANJU_LV_BIT3);
} }
} }
u32 sub_080A1514(void) { u32 CuccoMinigame_GetLevel(void) {
u32 rv = 0; u32 level = 0;
if (CheckGlobalFlag(ANJU_LV_BIT0)) { if (CheckGlobalFlag(ANJU_LV_BIT0)) {
rv = 1; level = 1;
} }
if (CheckGlobalFlag(ANJU_LV_BIT1)) { if (CheckGlobalFlag(ANJU_LV_BIT1)) {
rv |= 2; level |= 2;
} }
if (CheckGlobalFlag(ANJU_LV_BIT2)) { if (CheckGlobalFlag(ANJU_LV_BIT2)) {
rv |= 4; level |= 4;
} }
if (CheckGlobalFlag(ANJU_LV_BIT3)) { if (CheckGlobalFlag(ANJU_LV_BIT3)) {
rv |= 8; level |= 8;
} }
return rv; return level;
} }
void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) { void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
@ -311,7 +325,7 @@ void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
} else { } else {
*(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh = *(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh =
(ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable); (ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable);
pCuccoMinigameDef = pCuccoMinigame_MinigameCuccoDefs[sub_080A1514()]; pCuccoMinigameDef = pCuccoMinigame_MinigameCuccoDefs[CuccoMinigame_GetLevel()];
ppEVar5 = (Entity**)pEnt->myHeap; ppEVar5 = (Entity**)pEnt->myHeap;
room = &gRoomControls; room = &gRoomControls;
for (index = 9; index >= 0; index--, pCuccoMinigameDef += 3) { for (index = 9; index >= 0; index--, pCuccoMinigameDef += 3) {
@ -332,9 +346,9 @@ void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
} }
} }
void sub_080A1608(void) { void CuccoMinigame_TellObjective(void) {
u16 messageIndex; u16 messageIndex;
const u16* ptr; const CuccoMinigameGoal* ptr;
messageIndex = TEXT_INDEX(TEXT_ANJU, 0x2); messageIndex = TEXT_INDEX(TEXT_ANJU, 0x2);
if (CheckRoomFlag(1)) { if (CheckRoomFlag(1)) {
@ -343,9 +357,9 @@ void sub_080A1608(void) {
MessageFromTarget(messageIndex); MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1; gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0; gMessage.textWindowPosY = 0;
ptr = &gUnk_08124C20[sub_080A1514() * 2]; ptr = &goalData[CuccoMinigame_GetLevel()];
gMessage.rupees = ptr[0]; gMessage.rupees = ptr->time;
gMessage.field_0x14 = ptr[1]; gMessage.field_0x14 = ptr->numCuccos;
} }
void sub_080A1648(void) { void sub_080A1648(void) {

View File

@ -44,14 +44,14 @@ void Object37_Init(Object37Entity* this) {
void Object37_Action1(Object37Entity* this) { void Object37_Action1(Object37Entity* this) {
Entity* item; 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); item = CreateGroundItem(super, ITEM_RUPEE100, 0);
if (item != 0) { if (item != 0) {
item->direction = gPlayerEntity.animationState << 2; item->direction = gPlayerEntity.animationState << 2;
item->speed = 0x80; item->speed = 0x80;
item->zVelocity = Q_16_16(2.0); item->zVelocity = Q_16_16(2.0);
} }
gSave.unk24E[0] = 1; gSave.fusionUnmarked[0] = 1;
DeleteThisEntity(); DeleteThisEntity();
} }
} }

View File

@ -1089,8 +1089,8 @@ bool32 sub_080782C0(void) {
} }
} }
if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) {
sub_0801E738(0); AddKinstoneToBag(0);
if (gSave.unk12B[0] != 0) { if (gSave.kinstoneAmounts[0] != 0) {
gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3]; gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3];
*(u8*)(*(int*)(gUnk_03003DF0.unk_4 + 8) + 0x39) = 2; *(u8*)(*(int*)(gUnk_03003DF0.unk_4 + 8) + 0x39) = 2;
gPlayerState.queued_action = PLAYER_08070E9C; gPlayerState.queued_action = PLAYER_08070E9C;

View File

@ -1822,7 +1822,7 @@ void sub_0807F634(Entity* entity, ScriptExecutionContext* context) {
} }
void sub_0807F650(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]); sub_0801DFB4(entity, gUnk_08001A7C[p][0], gUnk_08001A7C[p][1], gUnk_08001A7C[p][2]);
gPlayerState.controlMode = CONTROL_DISABLED; gPlayerState.controlMode = CONTROL_DISABLED;
} }

View File

@ -38,7 +38,7 @@ void sub_080A6B04(void) {
sub_080A4DB8(6); sub_080A4DB8(6);
ptr = &gKinstoneWorldEvents[gFuseInfo.kinstoneId]; ptr = &gKinstoneWorldEvents[gFuseInfo.kinstoneId];
ptr2 = &gWorldEvents[ptr->worldEventId]; ptr2 = &gWorldEvents[ptr->worldEventId];
bVar1 = ptr->unk7; bVar1 = ptr->mapMarkerIcon;
uVar3 = ptr2->_c; uVar3 = ptr2->_c;
uVar4 = ptr2->_e; uVar4 = ptr2->_e;
uVar2 = sub_080A6A80(uVar3, uVar4)->_4; uVar2 = sub_080A6A80(uVar3, uVar4)->_4;

View File

@ -58,7 +58,7 @@ void Subtask_WorldEvent_Update(void) {
void Subtask_WorldEvent_End(void) { void Subtask_WorldEvent_End(void) {
MessageInitialize(); MessageInitialize();
sub_0806F38C(); sub_0806F38C();
if (gKinstoneWorldEvents[gFuseInfo.kinstoneId].unk7 != 0) { if (gKinstoneWorldEvents[gFuseInfo.kinstoneId].mapMarkerIcon != 0) {
// Show the map hint. // Show the map hint.
MenuFadeIn(SUBTASK_LOCALMAPHINT, gUI.field_0x3); MenuFadeIn(SUBTASK_LOCALMAPHINT, gUI.field_0x3);
} else { } else {