Merge remote-tracking branch 'upstream/master' into tilemap-docs

This commit is contained in:
octorock
2023-05-31 23:51:20 +02:00
254 changed files with 4013 additions and 4939 deletions
+25 -24
View File
@@ -204,7 +204,8 @@ u32 UpdatePlayerCollision(void) {
ptr1 = &gUnk_080B4490[index * 2];
if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]), gPlayerEntity.collisionLayer) ==
0xff) {
if ((((gPlayerState.flags & 0x10002) != 0) || ((gPlayerState.sword_state & 0x10) != 0)) ||
if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) ||
((gPlayerState.sword_state & 0x10) != 0)) ||
((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
(((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) ||
@@ -234,19 +235,19 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
layer->mapData[position] = 0x4001 + (gPlayerEntity.animationState >> 1);
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xc0;
} else {
gPlayerState.pushedObject = 0xa0;
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
return 1;
case 0x28:
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
return 0;
}
gPlayerEntity.action = gPlayerEntity.action;
@@ -286,7 +287,7 @@ u32 UpdatePlayerCollision(void) {
layer->mapData[position] = 0x401c + (gPlayerEntity.animationState >> 1);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -304,13 +305,13 @@ u32 UpdatePlayerCollision(void) {
case 0x3a:
case 0x5b:
case 0x4051:
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
return 0;
}
if (gPlayerEntity.animationState != 0) {
return 0;
}
gHUD.unk_2d = 4;
gHUD.rActionInteractTile = R_ACTION_READ;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
return 0;
}
@@ -321,10 +322,10 @@ u32 UpdatePlayerCollision(void) {
if ((animationState1 & 0xff) != 0) {
return 0;
}
if ((gPlayerState.flags & 0x4080) != 0) {
if ((gPlayerState.flags & (PL_DRUGGED | PL_MINISH)) != 0) {
return 0;
}
gHUD.unk_2d = 6;
gHUD.rActionInteractTile = R_ACTION_OPEN;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
return 0;
}
@@ -332,10 +333,10 @@ u32 UpdatePlayerCollision(void) {
OpenSmallChest(position, gPlayerEntity.collisionLayer);
return 2;
case 0x71:
if (HasDungeonMap() == 0) {
if (HasDungeonSmallKey() == 0) {
return 0;
}
gHUD.unk_2d = 6;
gHUD.rActionInteractTile = R_ACTION_OPEN;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
return 0;
}
@@ -344,7 +345,7 @@ u32 UpdatePlayerCollision(void) {
return 2;
case 0x3d:
case 0x4040 ... 0x4048:
if ((gPlayerState.flags & 0x4000) != 0) {
if ((gPlayerState.flags & PL_DRUGGED) != 0) {
return 0;
}
if (sub_08079778() == 0) {
@@ -365,7 +366,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gPlayerState.jump_status = 0x81;
gPlayerState.flags |= 0x20;
gPlayerState.flags |= PL_USE_PORTAL;
gPlayerState.queued_action = PLAYER_USEPORTAL;
gPlayerEntity.zVelocity = 0x20000;
COLLISION_OFF(&gPlayerEntity);
@@ -381,7 +382,7 @@ u32 UpdatePlayerCollision(void) {
}
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -393,7 +394,7 @@ u32 UpdatePlayerCollision(void) {
layer->mapData[position] = 0x405b + (gPlayerEntity.animationState >> 1);
gPlayerState.pushedObject = 0x98;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -405,7 +406,7 @@ u32 UpdatePlayerCollision(void) {
layer->mapData[position] = 0x4037 + (gPlayerEntity.animationState >> 1);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -423,7 +424,7 @@ u32 UpdatePlayerCollision(void) {
layer->mapData[position] = 0x403f;
gPlayerState.pushedObject = 0x82;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -464,7 +465,7 @@ u32 UpdatePlayerCollision(void) {
pushedBlock->collisionLayer = gPlayerEntity.collisionLayer;
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = pushedBlock->direction;
@@ -472,13 +473,13 @@ u32 UpdatePlayerCollision(void) {
case 0x402b ... 0x402d:
if (sub_0801A370(layer, position) != 0) {
layer->mapData[position] = 0x4030 + ((gPlayerEntity.animationState & 4) >> 2);
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xa0;
} else {
gPlayerState.pushedObject = 0x90;
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -491,13 +492,13 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
layer->mapData[position] = 0x404b + (gPlayerEntity.animationState >> 1);
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xc0;
} else {
gPlayerState.pushedObject = 0xa0;
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -563,7 +564,7 @@ u32 UpdatePlayerCollision(void) {
SetTile(0x4074, position, gPlayerEntity.collisionLayer);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
@@ -831,7 +832,7 @@ bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3) {
object->collisionLayer = this->collisionLayer;
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
this->x.HALF.LO = 0;
this->y.HALF.LO = 0;
this->direction = param_3;
+3 -2
View File
@@ -43,7 +43,7 @@ Entity* sub_08049E4C(void) {
}
Entity* sub_08049E80(void) {
if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & 0x80)) {
if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) {
return NULL;
}
gUnk_020000B0 = &gPlayerEntity;
@@ -51,7 +51,8 @@ Entity* sub_08049E80(void) {
}
Entity* sub_08049EB0(void) {
if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & 0x80190)) {
if ((gPlayerState.field_0x3c == 0) &&
!(gPlayerState.flags & (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
}
+202 -58
View File
@@ -7,6 +7,7 @@
#include "functions.h"
#include "game.h"
#include "global.h"
#include "item.h"
#include "kinstone.h"
#include "main.h"
#include "message.h"
@@ -30,7 +31,7 @@ void ResetScreenRegs(void);
void MessageFromFusionTarget(u32);
void sub_0801E24C(s32, s32);
void sub_0801E290(u32, u32, u32);
s32 sub_0801E8B0(u32);
s32 GetIndexInKinstoneBag(u32);
extern u32 sub_0807CB24(u32, u32);
@@ -65,7 +66,7 @@ extern const GfxItem* gGfxGroups[];
extern const u32 gUnk_080C9460[];
void sub_0801E82C(void);
void SortKinstoneBag(void);
extern void* GetRoomProperty(u32, u32, u32);
@@ -79,6 +80,24 @@ u32 sub_0801DF60(u32 a1, u8* p);
u32 sub_0801DF78(u32 a1, u32 a2);
void DrawMapPixel(u32 x, u32 y, s32 color);
extern void* GetRoomProperty(u32, u32, u32);
enum DungeonMapObjectTypes {
DMO_TYPE_NONE,
DMO_TYPE_PLAYER,
DMO_TYPE_CHEST,
DMO_TYPE_ENTRY,
DMO_TYPE_BOSS,
};
typedef struct {
u8 type; /**< @see DungeonMapObjectTypes */
u8 x;
u8 y;
} PACKED DungeonMapObject;
// More like PrepareTileEntitesForDungeonMap or so
u32 DecToHex(u32 value) {
u32 result;
FORCE_REGISTER(u32 r1, r1);
@@ -415,7 +434,75 @@ u32 sub_0801DB94(void) {
return gRoomTransition.player_status.dungeon_map_y >> 11;
}
ASM_FUNC("asm/non_matching/common/DrawDungeonMap.inc", void DrawDungeonMap(u32 floor, void* data, u32 size));
void DrawDungeonMap(u32 floor, DungeonMapObject* specialData, u32 size) {
DungeonLayout* floorMapData;
TileEntity* tileEntity;
u32 flagBankOffset;
RoomHeader* roomHeader;
s32 tmp1;
s32 tmp3;
MemClear(specialData, size);
specialData->type = DMO_TYPE_PLAYER;
specialData->x = (gRoomTransition.player_status.dungeon_map_x >> 4) & 0x7f;
specialData->y = (gRoomTransition.player_status.dungeon_map_y >> 4) & 0x7f;
specialData++;
floorMapData = (DungeonLayout*)gDungeonLayouts[gArea.dungeon_idx][floor];
while (floorMapData->area != 0) {
tileEntity = (TileEntity*)GetRoomProperty(floorMapData->area, floorMapData->room, 3);
if (tileEntity == NULL) {
floorMapData++;
} else {
flagBankOffset = sub_0801DF10(floorMapData);
if (HasDungeonCompass()) {
while (tileEntity->type != 0) {
switch (tileEntity->type) {
case SMALL_CHEST:
case BIG_CHEST:
if (!CheckLocalFlagByBank(flagBankOffset, tileEntity->localFlag)) {
roomHeader = gAreaRoomHeaders[floorMapData->area] + floorMapData->room;
specialData->type = DMO_TYPE_CHEST;
if (tileEntity->type == SMALL_CHEST) {
specialData->x =
((((tileEntity->tilePos << 4 & 0x3f0) | 8) + (roomHeader->map_x % 0x800)) >> 4);
specialData->y =
((((tileEntity->tilePos >> 2 & 0x3f0) | 8) + (roomHeader->map_y % 0x800)) >> 4);
} else {
specialData->x = (((roomHeader->map_x % 0x800) + tileEntity->tilePos) >> 4);
specialData->y = (((roomHeader->map_y % 0x800) + (*(u16*)&tileEntity->_6)) >> 4);
}
specialData++;
}
break;
}
tileEntity++;
}
}
if ((HasDungeonCompass() && ((floorMapData->unk_2 & 2) != 0)) &&
(!CheckGlobalFlag(gArea.dungeon_idx + 1))) {
roomHeader = gAreaRoomHeaders[floorMapData->area] + floorMapData->room;
specialData->type = DMO_TYPE_BOSS;
tmp1 = ((roomHeader->pixel_width / 2) + roomHeader->map_x) / 16;
if (tmp1 < 0) {
tmp1 = tmp1 + 0x7f;
}
specialData->x = tmp1 + (tmp1 / 128) * -128;
tmp3 = ((roomHeader->pixel_height / 2) + roomHeader->map_y) / 16;
specialData->y = tmp3 + (tmp3 / 128) * -128;
specialData++;
}
if (floorMapData->area == gRoomTransition.player_status.dungeon_area &&
floorMapData->room == gRoomTransition.player_status.dungeon_room) {
specialData->type = DMO_TYPE_ENTRY;
// TODO rename dungeon_x and dungeon_y to dungeonEntryX/Y?
specialData->x = ((u16)gRoomTransition.player_status.dungeon_x >> 4) & 0x7f;
specialData->y = ((u16)gRoomTransition.player_status.dungeon_y >> 4) & 0x7f;
specialData++;
}
floorMapData++;
}
}
}
void sub_0801DD58(u32 area, u32 room) {
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
@@ -460,7 +547,7 @@ void DrawDungeonFeatures(u32 floor, void* data, u32 size) {
if (layout->area == gUI.roomControls.area && layout->room == gUI.roomControls.room) {
features = 8;
} else {
if (HasDungeonSmallKey()) {
if (HasDungeonMap()) {
features = 2;
}
if (IsRoomVisited(tileEntity, bankOffset)) {
@@ -549,7 +636,7 @@ void sub_0801DFB4(Entity* entity, u32 textIndex, u32 a3, u32 a4) {
gFuseInfo._8 = a3;
gFuseInfo._a = a4;
gFuseInfo.ent = entity;
gFuseInfo.kinstoneId = gUnk_03003DF0.unk_2;
gFuseInfo.kinstoneId = gPossibleInteraction.kinstoneId;
if (entity != NULL) {
gFuseInfo.prevUpdatePriority = entity->updatePriority;
entity->updatePriority = 2;
@@ -756,102 +843,102 @@ void sub_0801E64C(s32 param_1, s32 param_2, s32 param_3, s32 param_4, s32 param_
}
}
void sub_0801E6C8(u32 kinstoneId) {
void NotifyFusersOnFusionDone(KinstoneId kinstoneId) {
u32 tmp;
u32 index;
if (kinstoneId - 1 < 100) {
for (index = 0; index < 0x80; index++) {
if (kinstoneId == gSave.unk1C1[index]) {
gSave.unk1C1[index] = 0xf1;
if (kinstoneId == gSave.fuserOffers[index]) {
gSave.fuserOffers[index] = KINSTONE_NEEDS_REPLACEMENT;
}
}
tmp = sub_08002632(gFuseInfo.ent);
if ((tmp - 1 < 0x7f) && (gSave.unk1C1[tmp] == 0xf1)) {
gSave.unk1C1[tmp] = 0xf2;
tmp = GetFuserId(gFuseInfo.ent);
if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == KINSTONE_NEEDS_REPLACEMENT)) {
gSave.fuserOffers[tmp] = KINSTONE_JUST_FUSED;
}
for (index = 0; index < 0x20; index++) {
if (kinstoneId == gUnk_03003DF0.array[index].unk_3) {
gUnk_03003DF0.array[index].unk_3 = 0xf1;
if (kinstoneId == gPossibleInteraction.candidates[index].kinstoneId) {
gPossibleInteraction.candidates[index].kinstoneId = KINSTONE_NEEDS_REPLACEMENT;
}
}
}
}
void sub_0801E738(u32 param_1) {
void AddKinstoneToBag(KinstoneId kinstoneId) {
s32 index;
s32 tmp;
sub_0801E82C();
if (param_1 - 0x65 < 0x11) {
index = sub_0801E8B0(param_1);
SortKinstoneBag(); // sometimes called just for this function
if (kinstoneId - 0x65 < 0x11) {
index = GetIndexInKinstoneBag(kinstoneId);
if (index < 0) {
index = 0;
while (gSave.unk118[index] != 0) {
while (gSave.kinstoneTypes[index] != KINSTONE_NONE) {
index++;
}
}
if ((u32)index < 0x12) {
gSave.unk118[index] = param_1;
tmp = gSave.unk12B[index] + 1;
gSave.kinstoneTypes[index] = kinstoneId;
tmp = gSave.kinstoneAmounts[index] + 1;
if (tmp > 99) {
tmp = 99;
}
gSave.unk12B[index] = tmp;
gSave.kinstoneAmounts[index] = tmp;
}
}
}
void sub_0801E798(u32 a1) {
s32 idx = sub_0801E8B0(a1);
void RemoveKinstoneFromBag(KinstoneId kinstoneId) {
s32 idx = GetIndexInKinstoneBag(kinstoneId);
if (idx >= 0) {
s32 next = gSave.unk12B[idx] - 1;
s32 next = gSave.kinstoneAmounts[idx] - 1;
if (next <= 0) {
gSave.unk118[idx] = 0;
gSave.kinstoneTypes[idx] = KINSTONE_NONE;
next = 0;
}
gSave.unk12B[idx] = next;
gSave.kinstoneAmounts[idx] = next;
}
}
u32 sub_0801E7D0(u32 a1) {
s32 tmp = sub_0801E8B0(a1);
if (tmp < 0) {
u32 GetAmountInKinstoneBag(KinstoneId kinstoneId) {
s32 index = GetIndexInKinstoneBag(kinstoneId);
if (index < 0) {
return 0;
}
return gSave.unk12B[tmp];
return gSave.kinstoneAmounts[index];
}
u32 CheckKinstoneFused(u32 kinstoneId) {
if (kinstoneId > 100 || kinstoneId < 1) {
u32 CheckKinstoneFused(KinstoneId kinstoneId) {
if (kinstoneId - 1 >= 100) {
return 0;
}
return ReadBit(&gSave.fusedKinstones, kinstoneId);
}
bool32 sub_0801E810(u32 kinstoneId) {
if (kinstoneId > 100 || kinstoneId < 1) {
bool32 CheckFusionMapMarkerDisabled(KinstoneId kinstoneId) {
if (kinstoneId - 1 >= 100) {
return FALSE;
}
return ReadBit(&gSave.unk24E, kinstoneId);
return ReadBit(&gSave.fusionUnmarked, kinstoneId);
}
void sub_0801E82C(void) {
void SortKinstoneBag(void) {
#ifdef NON_MATCHING
u32 r5;
for (r5 = 0; r5 < 0x13; r5++) {
if (gSave.unk12B[r5] == 0) {
gSave.unk118[r5] = gSave.unk12B[r5];
if (gSave.kinstoneAmounts[r5] == 0) {
gSave.kinstoneTypes[r5] = gSave.kinstoneAmounts[r5];
}
}
gSave.unk118[0x12] = 0;
gSave.unk12B[0x12] = 0;
gSave.kinstoneTypes[0x12] = 0;
gSave.kinstoneAmounts[0x12] = 0;
for (r5 = 0; r5 < 0x12; r5++) {
if ((gSave.unk118[r5] - 0x65) > 0x10) {
MemCopy(&gSave.unk118[r5 + 1], &gSave.unk118[r5], 0x12 - r5);
MemCopy(&gSave.unk12B[r5 + 1], &gSave.unk12B[r5], 0x12 - r5);
if ((gSave.kinstoneTypes[r5] - 0x65) > 0x10) {
MemCopy(&gSave.kinstoneTypes[r5 + 1], &gSave.kinstoneTypes[r5], 0x12 - r5);
MemCopy(&gSave.kinstoneAmounts[r5 + 1], &gSave.kinstoneAmounts[r5], 0x12 - r5);
}
}
#else
@@ -862,7 +949,7 @@ void sub_0801E82C(void) {
new_var = 4;
r1 = &gSave.inventory[34];
r5 = 0;
r2 = gSave.unk118;
r2 = gSave.kinstoneTypes;
code0_0:
r0 = r2[0x13];
r3 = &r1[4];
@@ -899,21 +986,21 @@ code0_2:
#endif
}
s32 sub_0801E8B0(u32 idx) {
s32 GetIndexInKinstoneBag(KinstoneId kinstoneId) {
u32 i;
for (i = 0; i < 18; ++i) {
if (idx == gSave.unk118[i])
for (i = 0; i < 0x12; ++i) {
if (kinstoneId == gSave.kinstoneTypes[i])
return i;
}
return -1;
}
// Check conditions, something with kinstones
void sub_0801E8D4(void) {
// For example if a chest from a fusion is opened, hide the chest marker
void UpdateVisibleFusionMapMarkers(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
@@ -971,13 +1058,71 @@ void sub_0801E8D4(void) {
#else
if (sub_0807CB24(tmp, s->flag)) {
#endif
WriteBit(&gSave.unk24E, kinstoneId);
WriteBit(&gSave.fusionUnmarked, kinstoneId);
}
}
}
}
ASM_FUNC("asm/non_matching/common/sub_0801E99C.inc", u32 sub_0801E99C(u32 a1));
extern u8* gUnk_08001DCC[];
KinstoneId GetFusionToOffer(Entity* entity) {
u8* fuserData;
u32 fuserId;
u32 offeredFusion;
u32 fuserProgress;
u8* fuserFusionData;
s32 randomMood;
u32 fuserStability;
fuserId = GetFuserId(entity);
fuserData = gUnk_08001DCC[fuserId];
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) {
return KINSTONE_NONE;
}
offeredFusion = gSave.fuserOffers[fuserId];
fuserProgress = gSave.fuserProgress[fuserId];
fuserFusionData = (u8*)(fuserProgress + (u32)fuserData);
while (TRUE) { // loop through fusions for this fuser
switch (offeredFusion) {
case KINSTONE_NEEDS_REPLACEMENT: // offered fusion completed with someone else
case KINSTONE_NONE: // no fusion offered yet
offeredFusion = fuserFusionData[5];
if (offeredFusion == KINSTONE_NONE || offeredFusion == KINSTONE_RANDOM ||
CheckKinstoneFused(offeredFusion) == 0) {
break;
}
case KINSTONE_JUST_FUSED: // previous fusion completed
fuserFusionData++;
fuserProgress++;
offeredFusion = fuserFusionData[5];
}
if (offeredFusion == KINSTONE_RANDOM) { // random shared fusion
offeredFusion = GetRandomSharedFusion(fuserData);
}
if (offeredFusion == KINSTONE_NONE) { // end of fusion list
offeredFusion = KINSTONE_FUSER_DONE; // mark this fuser as done
break;
}
if (offeredFusion == KINSTONE_JUST_FUSED) { // previous fusion completed
continue;
}
if (CheckKinstoneFused(offeredFusion) == 0) {
break;
}
offeredFusion = KINSTONE_NEEDS_REPLACEMENT; // already completed, try next fusion in the list
}
gSave.fuserOffers[fuserId] = offeredFusion;
gSave.fuserProgress[fuserId] = fuserProgress;
randomMood = Random();
fuserStability = fuserData[1];
if (fuserStability <= randomMood % 100) {
return KINSTONE_NONE; // fickleness
}
if (offeredFusion - 1 > 99) {
offeredFusion = KINSTONE_NONE;
}
return offeredFusion;
}
const u16 gUnk_080C93E0[] = { 3, 9, 16, 22, 28, 35, 41, 48, 54, 61, 67, 74, 81, 88, 95, 102, 110, 117, 125, 133, 141, 149, 158, 167, 176, 185, 195, 205, 215, 226, 238, 250, 262, 276, 290, 304, 320, 336, 354, 373, 394, 415, 439, 465, 493, 525, 559, 597, 640, 689, 744, 808, 883, 971, 1078, 1209, 1375, 1591, 1885, 2308, 2973, 4167, 6950, 20860 };
@@ -1224,20 +1369,19 @@ 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(void) {
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;
}
return 0xF2;
return KINSTONE_JUST_FUSED;
}
+2 -4
View File
@@ -30,8 +30,6 @@ extern u8 gUnk_08A05751[];
// sprite_table
extern void gUnk_089FD1B4;
extern void gUnk_089FD2F4;
extern u16 gUnk_0203508E[];
extern u16 gUnk_0203510E[];
extern u8 gUnk_08A068BF[129];
@@ -190,8 +188,8 @@ void sub_080A30AC(void) {
void sub_080A3198(u32 param_1, u32 param_2) {
static const Font gUnk_08127C98[] = {
{ gUnk_0203508E, BG_TILE_ADDR(0x1a0), gTextGfxBuffer, 0, 0x1080, 0xd0, 1, 0, 0, 1, 9, 0, 0, 1, 1 },
{ gUnk_0203510E, BG_TILE_ADDR(0x1a0), gTextGfxBuffer, 0, 0x80, 0xd0, 1, 0, 0, 1, 9, 0, 0, 1, 1 },
{ &gBG0Buffer[0x1ef], BG_TILE_ADDR(0x1a0), gTextGfxBuffer, 0, 0x1080, 0xd0, 1, 0, 0, 1, 9, 0, 0, 1, 1 },
{ &gBG0Buffer[0x22f], BG_TILE_ADDR(0x1a0), gTextGfxBuffer, 0, 0x80, 0xd0, 1, 0, 0, 1, 9, 0, 0, 1, 1 },
};
static const u16 gUnk_08127CC8[4] = {
TEXT_INDEX(TEXT_WINDCRESTS, 0x1c),
+122 -122
View File
@@ -12,9 +12,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -30,9 +30,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -48,9 +48,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -66,9 +66,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -84,9 +84,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = 5,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -102,9 +102,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -120,9 +120,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 1,
.arrows = 1,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -138,9 +138,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -156,9 +156,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneRed = 15,
.kinstoneGreen = 15,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -174,9 +174,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = 50,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -192,9 +192,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 100,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -210,9 +210,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = 10,
.kinstoneGreen = 2,
.kinstoneRed = 2,
.kinstoneBlue = 3,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -228,9 +228,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -246,9 +246,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 1,
.arrows = 1,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -264,9 +264,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 20,
.arrows = -999,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -282,9 +282,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -300,9 +300,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 2,
.kinstoneRed = 2,
.kinstoneBlue = 5,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -318,9 +318,9 @@ const Droptable gEnemyDroptables[] = {
.bombs = 9,
.arrows = 9,
.mysteriousShells = 40,
.kinstoneGreen = 9,
.kinstoneRed = 9,
.kinstoneBlue = 12,
.kinstoneRed = 16,
.kinstoneGreen = 16,
.none2 = 9,
.none3 = 0,
.none4 = 0,
@@ -339,9 +339,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 10,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -357,9 +357,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 200,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -375,9 +375,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 35,
.arrows = 4,
.mysteriousShells = 4,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 3,
.kinstoneGreen = 3,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -393,9 +393,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 7,
.arrows = 25,
.mysteriousShells = 3,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 9,
.kinstoneGreen = 9,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -411,9 +411,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 23,
.mysteriousShells = 2,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 28,
.kinstoneGreen = 28,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -429,9 +429,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 6,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 11,
.kinstoneGreen = 11,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -447,9 +447,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 33,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 6,
.kinstoneGreen = 6,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -465,9 +465,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 4,
.arrows = 4,
.mysteriousShells = 3,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 6,
.kinstoneGreen = 6,
.none2 = 20,
.none3 = 0,
.none4 = 0,
@@ -483,9 +483,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 1,
.arrows = 1,
.mysteriousShells = 1,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 6,
.kinstoneGreen = 6,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -501,9 +501,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 18,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 5,
.kinstoneGreen = 5,
.none2 = 15,
.none3 = 0,
.none4 = 0,
@@ -523,9 +523,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 1,
.arrows = 1,
.mysteriousShells = 40,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 5,
.kinstoneGreen = 5,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -541,9 +541,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 19,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 15,
.kinstoneGreen = 15,
.none2 = 28,
.none3 = 0,
.none4 = 0,
@@ -559,9 +559,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 9,
.kinstoneGreen = 9,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -577,9 +577,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 1,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 15,
.kinstoneGreen = 15,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -595,9 +595,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 25,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 4,
.kinstoneGreen = 4,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -613,9 +613,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 20,
.arrows = 0,
.mysteriousShells = 15,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -631,9 +631,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = -999,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -649,9 +649,9 @@ const Droptable gAreaDroptables[] = {
.bombs = -999,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -667,9 +667,9 @@ const Droptable gAreaDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -687,9 +687,9 @@ const Droptable gObjectDroptables[] = {
.bombs = -100,
.arrows = -100,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -705,9 +705,9 @@ const Droptable gObjectDroptables[] = {
.bombs = 1,
.arrows = 1,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 1,
.none3 = 0,
.none4 = 0,
@@ -723,9 +723,9 @@ const Droptable gObjectDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 140,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 20,
.none3 = 0,
.none4 = 0,
@@ -741,9 +741,9 @@ const Droptable gObjectDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -759,9 +759,9 @@ const Droptable gObjectDroptables[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -777,9 +777,9 @@ const Droptable gObjectDroptables[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -796,9 +796,9 @@ const Droptable gObjectDroptables[] = {
.bombs = -999,
.arrows = 250,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -815,9 +815,9 @@ const Droptable gObjectDroptables[] = {
.bombs = -10,
.arrows = -10,
.mysteriousShells = 12,
.kinstoneGreen = 1,
.kinstoneRed = 1,
.kinstoneBlue = 2,
.kinstoneRed = 10,
.kinstoneGreen = 10,
.none2 = 30,
.none3 = 0,
.none4 = 0,
@@ -833,9 +833,9 @@ const Droptable gObjectDroptables[] = {
.bombs = -10,
.arrows = -10,
.mysteriousShells = 24,
.kinstoneGreen = 2,
.kinstoneRed = 2,
.kinstoneBlue = 4,
.kinstoneRed = 20,
.kinstoneGreen = 20,
.none2 = 10,
.none3 = 0,
.none4 = 0,
@@ -854,9 +854,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -872,9 +872,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -890,9 +890,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -908,9 +908,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -927,9 +927,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 20,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -945,9 +945,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 20,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -964,9 +964,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -982,9 +982,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -1000,9 +1000,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = -999,
.arrows = -999,
.mysteriousShells = -999,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -1018,9 +1018,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 250,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -1036,9 +1036,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 125,
.arrows = 125,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -1054,9 +1054,9 @@ const Droptable gUnk_0800191C[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 20,
.kinstoneRed = 20,
.kinstoneBlue = 40,
.kinstoneRed = 190,
.kinstoneGreen = 190,
.none2 = -999,
.none3 = 0,
.none4 = 0,
@@ -1077,9 +1077,9 @@ const Droptable gDroptableModifiers[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -1096,9 +1096,9 @@ const Droptable gDroptableModifiers[] = {
.bombs = 2,
.arrows = 2,
.mysteriousShells = -999,
.kinstoneGreen = 0,
.kinstoneBlue = 0,
.kinstoneRed = 0,
.kinstoneBlue = 0,
.kinstoneGreen = 0,
.none2 = 0,
.none3 = 0,
.none4 = 0,
@@ -1115,9 +1115,9 @@ const Droptable gDroptableModifiers[] = {
.bombs = 0,
.arrows = 0,
.mysteriousShells = 0,
.kinstoneGreen = -999,
.kinstoneBlue = -999,
.kinstoneRed = -999,
.kinstoneBlue = -999,
.kinstoneGreen = -999,
.none2 = 0,
.none3 = 0,
.none4 = 0,
+1 -1
View File
@@ -422,7 +422,7 @@ bool32 sub_0803086C(ArmosEntity* this) {
FORCE_REGISTER(u32 r2, r2);
if (this->unk_7c != NULL) {
if ((gPlayerState.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
centerX = super->x.HALF_U.HI - gRoomControls.origin_x;
centerY = super->y.HALF_U.HI - gRoomControls.origin_y;
// TODO for some reason the 0x3f of COORD_TO_TILE(super) needs to be forced to r2 here.
+6 -15
View File
@@ -13,6 +13,7 @@
#include "functions.h"
#include "game.h"
#include "item.h"
#include "kinstone.h"
void sub_08028E9C(Entity*);
void sub_08028EDC(Entity*);
@@ -28,7 +29,7 @@ void sub_0802922C(Entity*);
void sub_0802925C(Entity*);
extern const struct SalesOffering gUnk_080CC954[];
extern const u8 gUnk_080CC9C0[];
extern const u8 kinstoneTypes[];
extern void (*const BusinessScrub_Functions[])(Entity*);
extern void (*const gUnk_080CC9E0[])(Entity*);
extern const u8 gUnk_080CCA04[];
@@ -257,8 +258,8 @@ void sub_08028CE8(Entity* this) {
switch (offer->field_0x0 >> 2) {
case 0:
subtype = offer->field_0x9;
if (subtype == 0xff) {
subtype = gUnk_080CC9C0[Random() & 7];
if (subtype == KINSTONE_RANDOM) {
subtype = kinstoneTypes[Random() & 7];
}
CreateItemEntity(offer->offeredItem, subtype, 0);
@@ -547,7 +548,7 @@ void sub_0802922C(Entity* this) {
}
void sub_0802925C(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
AddInteractableWhenBigFuser(this, GetFusionToOffer(this));
}
void sub_08029270(Entity* this) {
@@ -577,17 +578,7 @@ const struct SalesOffering gUnk_080CC954[] = {
#endif
};
const u8 gUnk_080CC9C0[] = {
0x6e,
0x6f,
0x70,
0x71,
0x72,
0x73,
0x74,
0x75,
};
const u8 kinstoneTypes[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 };
void (*const BusinessScrub_Functions[])(Entity*) = {
BusinessScrub_OnTick,
+19 -19
View File
@@ -239,30 +239,30 @@ void sub_080464C0(GyorgFemaleEntity* this) {
gUpdateVisibleTiles = 1;
}
NONMATCH("asm/non_matching/gyorg_female/sub_08046518.inc", void sub_08046518(void)) {
u32 r5;
u16* stack1;
u8* stack2;
u8* r6;
#define sub_08046518_offset 0x658
void sub_08046518(void) {
u16* ptr = gMapTop.metatileTypes;
u16* sl = &gMapTop.mapData[sub_08046518_offset];
u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset];
u8* stack2 = &gMapTop.unkData3[sub_08046518_offset];
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
u32 i;
u16* sl;
sl = &gMapTop.metatileTypes[0xFFFFBCB0];
stack1 = &gMapTop.metatileTypes[0xFFFFECB0];
stack2 = (u8*)&gMapTop.metatileTypes[0x00006658];
r6 = (u8*)&gMapTop.metatileTypes[0xFFFFD658];
for (i = 0; i < 0x10; i++) {
for (i = 0x10; i != 0; i--) {
u32 j;
for (j = 0x10; j != 0; j--) {
u16 new_var;
stack1[j] = sl[j];
new_var = ptr[sl[j]];
stack2[j] = gUnk_080B37A0[new_var];
r6[j] = gUnk_080B3E80[new_var];
}
sl += 0x40;
stack1 += 0x40;
for (r5 = 0; r5 < 0x10; r5++) {
stack1[r5] = sl[r5];
stack2[r5] = gUnk_080B37A0[gMapTop.metatileTypes[sl[r5]]];
r6[r5] = gUnk_080B3E80[gMapTop.metatileTypes[sl[r5]]];
}
stack2 = stack2 + 0x40;
r6 = r6 + 0x40;
stack2 += 0x40;
r6 += 0x40;
}
}
END_NONMATCH
void sub_080465C8(void) {
s32 x, y;
+43 -1
View File
@@ -96,7 +96,49 @@ void sub_080382EC(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/ropeGolden/sub_08038304.inc", void sub_08038304(Entity* this))
void sub_08038304(Entity* this) {
u32 cVar2;
s32 tmp;
u32 tmp3;
u32 h;
UpdateAnimationVariableFrames(this, 2);
if (!ProcessMovement0(this)) {
if (this->field_0x78.HALF.LO == this->direction) {
#ifdef EU
this->subtimer = 30;
#else
this->subtimer = 90;
#endif
sub_080383AC(this);
} else {
this->direction = this->field_0x78.HALF.LO;
}
} else {
tmp = 10;
if ((u8)((++this->timer) % tmp) == 0) {
this->timer = 0;
if (this->field_0x78.HALF.LO == this->direction) {
cVar2 = ((Random() & 2) - 1) << 27;
cVar2 = cVar2 >> 24;
h = this->field_0x78.HALF.HI;
tmp3 = (u8)cVar2 << 24;
if (tmp3 >> 24 == h) {
if (h == this->field_0x7a.HALF.LO) {
cVar2 = -tmp3 >> 24;
}
}
this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI;
this->field_0x78.HALF.HI = cVar2;
this->direction = (this->direction + cVar2) & 0x18;
} else {
this->direction = this->field_0x78.HALF.LO;
}
this->animationState = this->direction >> 3;
InitializeAnimation(this, this->animationState + 4);
}
}
}
void sub_080383AC(Entity* this) {
u32 v;
+1 -1
View File
@@ -351,7 +351,7 @@ void DeleteEntity(Entity* ent) {
UnloadGFXSlots(ent);
UnloadOBJPalette(ent);
UnloadOBJPalette2(ent);
sub_080788E0(ent);
RemoveInteractableObject(ent);
FreeCarryEntity(ent);
sub_0805EC60(ent);
sub_08017744(ent);
+2 -3
View File
@@ -210,9 +210,8 @@ const struct_080FC3E4 gUnk_080FC3E4[] = {
{ 0, 0xffff, 0, 1 },
};
extern u16 gUnk_02034E4E[];
const Font gUnk_080FC844 = {
gUnk_02034E4E, BG_TILE_ADDR(0x198), gTextGfxBuffer, 0, 96, 224, 1, 1, 0, 1, 3, 0, 0, 1, 0
&gBG0Buffer[0xcf], BG_TILE_ADDR(0x198), gTextGfxBuffer, 0, 96, 224, 1, 1, 0, 1, 3, 0, 0, 1, 0
};
const u16 gUnk_080FC85C[][3] = {
@@ -1359,7 +1358,7 @@ void sub_0805144C(void) {
void sub_08051458(void) {
sub_080503A8(gMenu.column_idx + 9);
MemCopy(gBG3Buffer + 0x80, &gUnk_02022030, 0x400);
MemCopy(&gBG3Buffer[0x80], &gBG1Buffer[0x80], 0x400);
}
u32 sub_080514BC(u32);
+17 -13
View File
@@ -10,24 +10,28 @@
// 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[] = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
ITEM_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_GREEN, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_RED,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
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,
};
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,
};
const u8 gUnk_080FE1DD[] = {
110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111, 112, 111, 110, 110, 110, 111, 112, 112, 110, 111,
111, 112, 110, 110, 112, 111, 112, 111, 110, 111, 110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111,
112, 111, 110, 112, 110, 111, 112, 112, 110, 111, 111, 112, 110, 110, 112, 111, 112, 111, 110, 0, 113, 114,
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114,
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114,
113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 113, 114, 115, 116, 117, 117,
115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 115, 115, 116, 117, 117, 115, 116, 116, 117, 115, 115,
117, 116, 117, 116, 115, 116, 115, 116, 117, 117, 115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 117,
115, 116, 117, 117, 115, 116, 116, 117, 115, 115, 117, 116, 117, 116, 115, 0, 0, 0, 0,
const u8 gUnk_080FE1DD[3][0x40] = {
{ 0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x6E,
0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x6F,
0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x70,
0x6E, 0x6F, 0x70, 0x70, 0x6E, 0x6F, 0x6F, 0x70, 0x6E, 0x6E, 0x70, 0x6F, 0x70, 0x6F, 0x6E, 0x00 },
{ 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72,
0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72, 0x71, 0x72 },
{ 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_Update(void);
+7 -9
View File
@@ -109,7 +109,7 @@ void InitializePlayer(void) {
Entity* pl;
sub_080784C8();
ResetPossibleInteraction();
MemClear(&gActiveItems, sizeof(gActiveItems));
MemClear(&gPlayerState, sizeof(gPlayerState));
MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof(gPlayerState.path_memory));
@@ -223,8 +223,8 @@ void ModRupees(s32 delta) {
if (newRupeeCount < 0) {
newRupeeCount = 0;
} else {
if (newRupeeCount > (u16)gWalletSizes[s->walletType * 2]) {
newRupeeCount = (u16)gWalletSizes[s->walletType * 2];
if (newRupeeCount > gWalletSizes[s->walletType].size) {
newRupeeCount = gWalletSizes[s->walletType].size;
}
}
s->rupees = newRupeeCount;
@@ -244,7 +244,7 @@ bool32 AreaHasKeys(void) {
return (gArea.areaMetadata >> 1) & 1;
}
bool32 HasDungeonMap(void) {
bool32 HasDungeonSmallKey(void) {
u32 tmp;
if (AreaHasKeys())
@@ -252,7 +252,7 @@ bool32 HasDungeonMap(void) {
return tmp ? 1 : 0;
}
bool32 HasDungeonCompass(void) {
bool32 HasDungeonBigKey(void) {
u32 tmp;
if (AreaHasKeys())
@@ -260,15 +260,13 @@ bool32 HasDungeonCompass(void) {
return tmp ? 1 : 0;
}
bool32 HasDungeonBigKey(void) {
bool32 HasDungeonCompass(void) {
if (!AreaHasKeys())
return 0;
return (gSave.dungeonItems[gArea.dungeon_idx] >> 1) & 1;
}
bool32 HasDungeonSmallKey(void) {
u32 tmp;
bool32 HasDungeonMap(void) {
if (!AreaHasKeys())
return 0;
return gSave.dungeonItems[gArea.dungeon_idx] & 1;
+6 -6
View File
@@ -225,9 +225,9 @@ void PlayerUpdate(Entity* this) {
static void HandlePlayerLife(Entity* this) {
u32 temp;
gHUD.unk_2f = 0;
gHUD.unk_2d = 0;
gHUD.unk_2e = 0;
gHUD.rActionPlayerState = R_ACTION_NONE;
gHUD.rActionInteractTile = R_ACTION_NONE;
gHUD.rActionGrabbing = R_ACTION_NONE;
if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0))
SoundReq(SFX_86);
@@ -240,7 +240,7 @@ static void HandlePlayerLife(Entity* this) {
if (sub_08079B24() == 0)
sub_08079708(this);
gUnk_03003DF0.unk_0 = 0;
gPossibleInteraction.isUpdated = 0;
if (gPlayerState.field_0x27[0] != 0)
gPlayerState.field_0x27[0]--;
@@ -323,9 +323,9 @@ static void sub_080171F0(void) {
sub_080028E0(&gPlayerEntity);
if (gPlayerState.flags & PL_CLONING)
gHUD.unk_2f = 1;
gHUD.rActionPlayerState = R_ACTION_CANCEL;
sub_08078180();
DetermineRButtonInteraction();
gPlayerState.field_0x7 &= ~0x80;
gPlayerState.field_0xa &= 0xf;
gPlayerState.keepFacing &= ~0x80;
+1 -1
View File
@@ -127,7 +127,7 @@ void sub_080754B8(ItemBehavior* this, u32 index) {
}
if ((this->playerFrame & 0x80) != 0) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
if (((gPlayerState.flags & PL_MINISH) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
sub_080759B8(this, index);
} else {
sub_08075580(this, index);
+1 -1
View File
@@ -95,7 +95,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) {
carried->subAction = 5;
gPlayerState.framestate = PL_STATE_THROW;
sub_080762C4(this, carried, 2, index);
gHUD.unk_2e = 8;
gHUD.rActionGrabbing = R_ACTION_GRAB;
SoundReq(SFX_102);
break;
case 1:
+15 -10
View File
@@ -12,7 +12,12 @@
#include "enemy.h"
#include "message.h"
const s16 gWalletSizes[] = { 100, -4000, 300, -3996, 500, -3992, 999, -3988 };
const Wallet gWalletSizes[] = {
{ 100, 0xf060 },
{ 300, 0xf064 },
{ 500, 0xf068 },
{ 999, 0xf06c },
};
const u8 gBombBagSizes[] = {
10,
30,
@@ -109,7 +114,7 @@ u32 GiveItem(Item item, u32 param_2) {
gSave.dungeonItems[gArea.dungeon_idx] |= metaData->unk2;
break;
case 0xd:
sub_0801E738(0x72);
AddKinstoneToBag(0x72);
break;
case 0x12:
if (item == ITEM_BOOMERANG) {
@@ -169,7 +174,7 @@ u32 GiveItem(Item item, u32 param_2) {
SoundReq(SFX_103);
break;
case 0x0f:
sub_0801E738(param_2);
AddKinstoneToBag(param_2);
break;
case 0x10:
gSave.stats.walletType++;
@@ -403,9 +408,9 @@ extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
ITEM_BOMBS5, ITEM_ARROWS5, ITEM_SHELLS, ITEM_KINSTONE_GREEN, ITEM_KINSTONE_BLUE, ITEM_KINSTONE_RED,
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
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,
}*/;
int r0, r1, rand, summOdds, item;
@@ -503,7 +508,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
return ITEM_NONE;
}
extern u8 gUnk_080FE1DD[];
extern u8 gUnk_080FE1DD[3][0x40];
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
u32 adjustedParam = itemParameter;
Entity* itemEntity;
@@ -534,7 +539,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
break;
}
case ITEM_KINSTONE:
case ITEM_KINSTONE_GREEN ... ITEM_KINSTONE_RED: {
case ITEM_KINSTONE_RED ... ITEM_KINSTONE_GREEN: {
u32 rand;
if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) {
@@ -545,9 +550,9 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
}
if (itemId != ITEM_KINSTONE) {
adjustedParam = itemId - ITEM_KINSTONE_GREEN;
adjustedParam = itemId - ITEM_KINSTONE_RED;
rand = (Random() & 0x3f);
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)];
adjustedParam = gUnk_080FE1DD[adjustedParam][rand];
if (adjustedParam == 0) {
itemId = ITEM_NONE;
} else {
+1 -1
View File
@@ -110,7 +110,7 @@ const struct_gUnk_080B3D20 gUnk_080B3D20[] = {
{ CHECK_ITEM, ITEM_BLUE_SWORD, 4, 1 },
{ LOCAL_BANK_3, LV4_HAKA_08_CAP_0, 4, 2 },
{ LOCAL_BANK_3, OUBO_KAKERA, 4, 3 },
{ CHECK_KINSTONE, KINSTONE_9, 4, 4 },
{ CHECK_KINSTONE, KINSTONE_SOURCE_FLOW, 4, 4 },
{ LOCAL_BANK_0, TATSUMAKI, 4, 5 },
{ LOCAL_BANK_2, SORA_YAKATA_ENTER, 4, 6 },
{ LOCAL_BANK_2, SORA_CHIEF_TALK, 4, 7 },
+2 -4
View File
@@ -13,8 +13,6 @@
#include "message.h"
#include "screen.h"
extern u8 gUnk_02034DF0[0x2F2];
const u16 gUnk_08108DE8[] = { 0, 0x70b, 0x70c, 0x70d, 0x70e, 0x70f, 0x710, 0x711, 0x712, 0x713, 0x714,
0x715, 0x716, 0x717, 0x718, 0x719, 0x71a, 0x71b, 0x71c, 0x71d, 0x71e, 0x71f,
0x726, 0x720, 0x720, 0x721, 0x722, 0x723, 0x725, 0x727, 0x724, 0x728 };
@@ -67,7 +65,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) {
}
void sub_0805E1D8(EnterRoomTextboxManager* this) {
MemClear(&gUnk_02034DF0, 0x80);
MemClear(&gBG0Buffer[0xa0], 0x80);
gScreen.bg0.updated = 1;
DeleteThisEntity();
}
@@ -80,7 +78,7 @@ void sub_0805E1F8(u32 unk0, bool32 isDungeon) {
u8 unk_06[3];
} PACKED tmp;
const Font* font;
MemClear(&gUnk_02034DF0, 0x80);
MemClear(&gBG0Buffer[0xa0], 0x80);
MemCopy(gUnk_08108E60, &tmp, sizeof(tmp));
tmp.unk_04 = unk0 >> 8;
tmp.unk_05 = unk0;
+5 -4
View File
@@ -8,16 +8,17 @@
#include "asm.h"
#include "flags.h"
#include "object.h"
#include "item.h"
typedef struct {
u16 minType;
u16 maxType;
u16 numTypes;
u16 x;
u16 y;
} GoronShopSpawnData;
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 },
{ 0x73, 0x3, 0x230, 0x210 } };
s32 uVar2;
@@ -54,12 +55,12 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) {
this->itemActive[2] = 0;
this->itemActive[1] = 0;
this->itemActive[0] = 0;
spawnData = gUnk_08108D5C;
spawnData = shopSpawnData;
count = 0;
for (count = 0; count < 3;) {
if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) {
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) {
object->timer = 1;
object->subtimer = count;
+17 -17
View File
@@ -27,8 +27,8 @@ 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 sub_0801E798(u32);
extern void NotifyFusersOnFusionDone(u32);
extern void RemoveKinstoneFromBag(u32);
extern WStruct* sub_0805F2C8(void);
extern void sub_0805F300(WStruct*);
extern u32 sub_0805F76C(u8*, WStruct*);
@@ -86,7 +86,7 @@ const ScreenTransitionData gUnk_08128024[] = {
u32 sub_080A3B48(void) {
u32 index;
for (index = 0; index <= 0x12; index++) {
if (gSave.unk12B[index] == 0) {
if (gSave.kinstoneAmounts[index] == 0) {
break;
}
}
@@ -151,7 +151,7 @@ void KinstoneMenu_Type0(void) {
gScreen.bg3.updated = 1;
KinstoneMenu_080A4528();
sub_080A4398();
sub_0801E738(0);
AddKinstoneToBag(KINSTONE_NONE);
sub_080A70AC((void*)gUnk_081280DC);
SetMenuType(1);
SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8);
@@ -206,7 +206,7 @@ void KinstoneMenu_Type1(void) {
case A_BUTTON:
if (gMenu.column_idx == 2) {
tmp3 = gGenericMenu.unk10.i / 0x10000;
gGenericMenu.unk2a = gSave.unk118[tmp3];
gGenericMenu.unk2a = gSave.kinstoneTypes[tmp3];
SetMenuType(3);
}
break;
@@ -265,8 +265,8 @@ void KinstoneMenu_Type3_Overlay0(void) {
}
void KinstoneMenu_Type3_Overlay1(void) {
u32 temp = gKinstoneWorldEvents[gKinstoneMenu.unk2a].unk5;
if (temp != gKinstoneWorldEvents[gFuseInfo.kinstoneId].unk5) {
u32 temp = gKinstoneWorldEvents[gKinstoneMenu.unk2a].shape;
if (temp != gKinstoneWorldEvents[gFuseInfo.kinstoneId].shape) {
SoundReq(SFX_ITEM_SHIELD_BOUNCE);
SetMenuType(4);
} 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;
iVar2 = gKinstoneMenu.unk10.WORD / 0x10000 + i;
if (iVar2 >= 0) {
uVar3 = gSave.unk12B[iVar2];
uVar3 = gSave.kinstoneAmounts[iVar2];
if (i == 0) {
switch (gMenu.column_idx) {
case 3:
@@ -460,7 +460,7 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void K
}
}
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];
if (param_2 == 0xff) {
uVar1 = ptr->unk2;
uVar1 = ptr->gfxOffsetFull;
} else {
uVar1 = ptr->unk1;
uVar1 = ptr->gfxOffsetPiece;
}
iVar4 = sub_080A43A8(uVar1);
if ((param_2 != 0) && (param_2 != 0xff)) {
@@ -606,10 +606,10 @@ 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);
sub_0801E798(gKinstoneMenu.unk2a);
gPossibleInteraction.kinstoneId = KINSTONE_NONE;
gPossibleInteraction.currentObject->kinstoneId = KINSTONE_NONE;
NotifyFusersOnFusionDone(gFuseInfo.kinstoneId);
RemoveKinstoneFromBag(gKinstoneMenu.unk2a);
}
u32 KinstoneMenu_080A4494(void) {
@@ -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
+11 -10
View File
@@ -11,6 +11,7 @@
#include "game.h"
#include "item.h"
#include "itemMetaData.h"
#include "kinstone.h"
#include "main.h"
#include "menu.h"
#include "message.h"
@@ -58,14 +59,14 @@ void Subtask_PauseMenu(void) {
extern u8 gUnk_02034492[];
void sub_0801E8D4(void);
void UpdateVisibleFusionMapMarkers(void);
s32 sub_080A50A0(s32);
void PauseMenu_Variant0(void) {
const OverworldLocation* location;
int r0, r1;
sub_0801E8D4();
UpdateVisibleFusionMapMarkers();
sub_080A4D34();
r1 = 4;
do {
@@ -663,7 +664,7 @@ void sub_080A5594(void) {
iVar5 = 0;
if (GetInventoryValue(ITEM_KINSTONE_BAG) != 0) {
for (i = 0; i < 0x13; i++) {
iVar5 += gSave.unk12B[i];
iVar5 += gSave.kinstoneAmounts[i];
}
if (iVar5 >= 0x50) {
@@ -1151,17 +1152,17 @@ void DrawDungeonMapActually(void) {
DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks & 0x20) != 0 ? 0x78 : 0x79);
gOamCmd.y = 0x7e;
gOamCmd._8 = 0x4380;
if (HasDungeonSmallKey()) {
if (HasDungeonMap()) {
gOamCmd.x = 0x18;
frameIndex = gSpriteAnimations_322[0x50]->index;
DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex);
}
if (HasDungeonCompass()) {
if (HasDungeonBigKey()) {
gOamCmd.x = 0x2e;
frameIndex = gSpriteAnimations_322[0x52]->index;
DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex);
}
if (HasDungeonBigKey()) {
if (HasDungeonCompass()) {
gOamCmd.x = 0x45;
gOamCmd._8 = 0x380;
frameIndex = gSpriteAnimations_322[0x51]->index;
@@ -1280,7 +1281,7 @@ void PauseMenu_Screen_7(void) {
void sub_080A6024(void) {
sub_080A70AC((KeyButtonLayout*)&gUnk_08128D60);
sub_0801E738(0);
AddKinstoneToBag(KINSTONE_NONE);
sub_080A4398();
SetMenuType(1);
}
@@ -1298,11 +1299,11 @@ void sub_080A6044(void) {
gOamCmd._6 = 0;
uVar4 = 0;
uVar2 = 0;
uVar1 = gSave.unk118[0];
uVar1 = gSave.kinstoneTypes[0];
while (uVar1 != 0) {
gOamCmd.x = (uVar4 & 3) * 0x30 + 0x2b;
gOamCmd.y = (uVar4 >> 2) * 0x24 + 0x34;
uVar3 = gSave.unk12B[uVar2];
uVar3 = gSave.kinstoneAmounts[uVar2];
gMenu.column_idx = 0;
sub_080A42E0(uVar1, uVar3);
uVar4++;
@@ -1313,7 +1314,7 @@ void sub_080A6044(void) {
if (0x11 < uVar2) {
return;
}
uVar1 = gSave.unk118[uVar2];
uVar1 = gSave.kinstoneTypes[uVar2];
}
}
}
+2 -2
View File
@@ -205,8 +205,8 @@ void sub_080A68D4(void) {
}
for (i = 10; i <= 100; i++) {
if (CheckKinstoneFused(i) && !sub_0801E810(i)) {
uVar4 = gKinstoneWorldEvents[i].unk7;
if (CheckKinstoneFused(i) && !CheckFusionMapMarkerDisabled(i)) {
uVar4 = gKinstoneWorldEvents[i].mapMarkerIcon;
ptr = &gWorldEvents[gKinstoneWorldEvents[i].worldEventId];
sub_080A698C(ptr->_c, ptr->_e, DRAW_DIRECT_SPRITE_INDEX, uVar4 + 100);
}
+3 -3
View File
@@ -28,9 +28,9 @@ void Anju(Entity* this) {
}
}
void sub_0806C354(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Anju_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Anju_Fusion(Entity* this) {
+20 -23
View File
@@ -9,22 +9,17 @@
#include "item.h"
typedef struct {
s8 unk_00;
u8 unk_01;
u8 unk_02;
u8 unk_03;
s8 unk_04;
s8 unk_05;
s8 unk_06;
s8 unk_07;
} gUnk_0810C89C_struct;
Rect customHitbox;
s8 interactDirections;
u8 unused[3];
} InteractCollisionData;
void sub_080632E0(Entity* this);
void sub_08063314(Entity* this);
void sub_0806336C(Entity* this);
void sub_08063390(Entity* this);
static const u8 gUnk_0810C88C[] = {
static const u8 gBeedleItems[] = {
ITEM_NONE,
ITEM_BOTTLE_PICOLYTE_BLUE,
ITEM_BOTTLE_PICOLYTE_GREEN,
@@ -32,10 +27,10 @@ static const u8 gUnk_0810C88C[] = {
ITEM_BOTTLE_PICOLYTE_ORANGE,
ITEM_BOTTLE_PICOLYTE_YELLOW,
ITEM_BOTTLE_PICOLYTE_WHITE,
ITEM_NONE,
0,
};
static const Hitbox gUnk_0810C894 = { 0, 0, { 0, 0, 0, 0 }, 16, 6 };
static const gUnk_0810C89C_struct gUnk_0810C89C[] = {
static const InteractCollisionData gBeedleCollisionData[] = {
{ 0, 0, 6, 6, 0, 0, 0, 0 }, { -24, 0, 6, 6, 0, 0, 0, 0 }, { -24, 16, 6, 6, 0, 0, 0, 0 },
{ -24, 32, 6, 6, 0, 0, 0, 0 }, { 24, 0, 6, 6, 0, 0, 0, 0 }, { 24, 16, 6, 6, 0, 0, 0, 0 },
{ 24, 32, 6, 6, 0, 0, 0, 0 },
@@ -72,7 +67,7 @@ void sub_080632C8(Entity* this) {
void sub_080632E0(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810C8D4)) {
InitializeAnimation(this, 0);
sub_08078778(this);
AddInteractableWhenBigObject(this);
this->spriteSettings.draw = 1;
this->action = 1;
}
@@ -103,7 +98,7 @@ void sub_08063390(Entity* this) {
if (this->frame & ANIM_DONE) {
this->action = 1;
InitializeAnimation(this, GetAnimationState(this));
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
sub_0806ED78(this);
}
@@ -136,7 +131,7 @@ void sub_08063410(Entity* this) {
this->type2 = 0;
}
sub_0807DD64(this);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
if (this->type != 0) {
sub_0806346C(this);
@@ -146,8 +141,10 @@ void sub_08063410(Entity* this) {
GetNextFrame(this);
}
// figures out with which of the 7 objects the player interacts with
// based on the player's position and facing direction
void sub_0806346C(Entity* this) {
static const u8 gUnk_0810C8F0[][6][4] = {
static const u8 gUnk_0810C8F0[5][6][4] = {
{
{ 1, 1, 1, 1 },
{ 1, 1, 1, 1 },
@@ -216,20 +213,20 @@ void sub_0806346C(Entity* this) {
bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.animationState >> 1];
if (bVar1 != this->type2) {
const gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1];
sub_08078850(this, 1, temp->unk_04, temp);
const InteractCollisionData* data = &gBeedleCollisionData[bVar1];
SetInteractableObjectCollision(this, 1, data->interactDirections, data);
this->type2 = bVar1;
}
}
void sub_080634E4(Entity* this, ScriptExecutionContext* context) {
void Beedle_GetObjectType(Entity* this, ScriptExecutionContext* context) {
context->intVariable = this->type2;
}
void sub_080634EC(Entity* this) {
gRoomVars.shopItemType = gUnk_0810C88C[this->type2];
void Beedle_ConfirmBuyItem(Entity* this) {
gRoomVars.shopItemType = gBeedleItems[this->type2];
}
void sub_08063504(Entity* this, ScriptExecutionContext* context) {
context->condition = !!GetBottleContaining(gUnk_0810C88C[this->type2]);
void Beedle_IsBottleInInventory(Entity* this, ScriptExecutionContext* context) {
context->condition = !!GetBottleContaining(gBeedleItems[this->type2]);
}
+3 -3
View File
@@ -235,7 +235,7 @@ void sub_08068A1C(Entity* this) {
bVar1 = 3;
} else {
sub_08078778(this);
AddInteractableWhenBigObject(this);
offset = 2;
bVar1 = 1;
}
@@ -291,8 +291,8 @@ void sub_08068ADC(Entity* this) {
void sub_08068AFC(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
+4 -4
View File
@@ -30,7 +30,7 @@ void sub_0806355C(Entity* this) {
this->action = this->action + 1;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 4);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
void sub_08063584(Entity* this) {
@@ -114,9 +114,9 @@ void sub_080636D8(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810CAAC[gSave.global_progress]);
}
void sub_080636F4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Brocco_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Brocco_Fusion(Entity* this) {
+3 -3
View File
@@ -91,9 +91,9 @@ void sub_08067304(Entity* this) {
ShowNPCDialogue(this, &dialog);
}
void sub_08067314(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Carpenter_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Carpenter_Fusion(Entity* this) {
+5 -5
View File
@@ -129,7 +129,7 @@ void sub_080677EC(Entity* this) {
this->spriteSettings.flipX = 0;
}
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
this->hitbox = (Hitbox*)&gUnk_08110EF0;
uVar2 = sub_0805ACC0(this);
if (uVar2 == 0) {
@@ -281,7 +281,7 @@ void sub_08067AAC(Entity* this) {
this->spriteSettings.flipX = this->direction >> 4 ^ 1;
sub_08067DCC(this, 3);
sub_08078850(this, 0, gUnk_0811110C[2], gUnk_0811110F);
SetInteractableObjectCollision(this, 0, gUnk_0811110C[2], gUnk_0811110F);
}
void sub_08067B08(Entity* this) {
@@ -293,7 +293,7 @@ void sub_08067B08(Entity* this) {
void sub_08067B34(Entity* this) {
sub_08067DCC(this, 0);
this->frameDuration = (Random() & 0x30) + 0xb4;
sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F);
SetInteractableObjectCollision(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F);
}
void sub_08067B70(Entity* this) {
@@ -350,9 +350,9 @@ void sub_08067C44(Entity* this) {
if (uVar5 != this->field_0x68.HALF.HI) {
if (uVar5 == 0) {
sub_08078778(this);
AddInteractableWhenBigObject(this);
} else {
sub_080787A8(this, this->field_0x68.HALF.LO);
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
}
}
+3 -3
View File
@@ -50,7 +50,7 @@ void sub_08068FC0(Entity* ent) {
*(u16*)&ent->field_0x68 = var1;
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);
}
@@ -209,9 +209,9 @@ void sub_0806920C(Entity* ent) {
if (var1 != ent->field_0x6c.HALF.HI) {
if (var1 == 0) {
sub_08078778(ent);
AddInteractableWhenBigObject(ent);
} else {
sub_080787A8(ent, ent->field_0x6c.HALF.LO);
AddInteractableAsMinishFuser(ent, ent->field_0x6c.HALF.LO);
}
}
+6 -5
View File
@@ -1,5 +1,6 @@
#include "npc.h"
#include "functions.h"
#include "kinstone.h"
void (*const Cucco_Actions[])(Entity*);
const u16 Cucco_Sounds[];
@@ -15,8 +16,8 @@ void Cucco(Entity* this) {
void Cucco_Init(Entity* this) {
this->action++;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_080787A8(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE);
this->subAction = 0;
sub_0806E4EC(this);
@@ -112,8 +113,8 @@ void sub_0806E65C(Entity* this) {
void Cucco_ShowMessage(Entity* this) {
u32 val = 0;
u32 index = sub_08002632(this);
if (gSave.unk1C1[index] == 0xf3) {
u32 index = GetFuserId(this);
if (gSave.fuserOffers[index] == KINSTONE_FUSER_DONE) {
val = 1;
}
@@ -135,4 +136,4 @@ void (*const Cucco_Actions[])(Entity*) = {
};
const u16 Cucco_Sounds[] = { SFX_VO_CUCCO1, SFX_VO_CUCCO2, SFX_VO_CUCCO3, SFX_VO_CUCCO4 };
const u16 Cucco_Messages[] = { TEXT_INDEX(TEXT_MINISH, 0Xb4), TEXT_INDEX(TEXT_MINISH, 0xb5) };
const u16 Cucco_Messages[] = { TEXT_INDEX(TEXT_MINISH, 0xb4), TEXT_INDEX(TEXT_MINISH, 0xb5) };
+2 -2
View File
@@ -23,8 +23,8 @@ void CuccoChick(Entity* this) {
void CuccoChick_Init(Entity* this) {
this->action++;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_080787A8(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE);
this->subAction = 0;
sub_0806E764(this);
+3 -3
View File
@@ -33,9 +33,9 @@ void Dampe(Entity* this) {
}
}
void sub_0806BE3C(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Dampe_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Dampe_Fusion(Entity* this) {
+6 -5
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "kinstone.h"
void Din(Entity* this) {
switch (this->action) {
@@ -29,12 +30,12 @@ void Din(Entity* this) {
}
}
void sub_08064828(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
void Din_MakeInteractable(Entity* this) {
u32 kinstoneId = GetFusionToOffer(this);
if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
kinstoneId = KINSTONE_NONE;
}
sub_08078784(this, tmp);
AddInteractableWhenBigFuser(this, kinstoneId);
}
void Din_Fusion(Entity* this) {
+4 -4
View File
@@ -206,7 +206,7 @@ void sub_08069B44(Entity* this) {
this->timer = 30;
this->animationState = 2;
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);
InitAnimationForceUpdate(this, 10);
if ((this->flags & ENT_SCRIPTED) != 0) {
@@ -351,7 +351,7 @@ void sub_08069E50(Entity* this) {
if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) {
this->action = 7;
InitAnimationForceUpdate(this, 0x29);
sub_080788E0(this);
RemoveInteractableObject(this);
EnqueueSFX(SFX_VO_DOG);
EnqueueSFX(SFX_TASK_COMPLETE);
}
@@ -432,9 +432,9 @@ void sub_08069FE8(Entity* this) {
if (tmp != this->field_0x6a.HALF.LO) {
if (tmp == 0) {
sub_08078778(this);
AddInteractableWhenBigObject(this);
} else {
sub_080787A8(this, this->field_0x74.HALF.LO);
AddInteractableAsMinishFuser(this, this->field_0x74.HALF.LO);
}
}
this->field_0x6a.HALF.LO = tmp;
+2 -7
View File
@@ -77,11 +77,6 @@ void sub_0806C038(Entity* this) {
}
void sub_0806C09C(Entity* this) {
static const u8 gUnk_081133B4[] = {
0,
6,
8,
12,
};
sub_08078850(this, 1, 0, &gUnk_081133B4);
static const Rect gUnk_081133B4 = { 0, 6, 8, 12 };
SetInteractableObjectCollision(this, 1, 0, &gUnk_081133B4);
}
+3 -3
View File
@@ -27,7 +27,7 @@ void sub_080659B8(Entity* this) {
this->spriteSettings.draw = 1;
this->animationState = 6;
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);
}
@@ -73,9 +73,9 @@ void sub_08065A64(Entity* this) {
if (uVar2 != this->field_0x68.HALF.HI) {
if (uVar2 == 0) {
sub_08078778(this);
AddInteractableWhenBigObject(this);
} else {
sub_080787A8(this, this->field_0x68.HALF.LO);
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
}
}
this->field_0x68.HALF.HI = uVar2;
+6 -6
View File
@@ -53,14 +53,14 @@ void sub_0806BCB8(Entity* this) {
this->animationState = this->timer;
}
void sub_0806BCC0(Entity* this) {
void Farmers_MarkEenieFuserDoner(Entity* this) {
if (this->type == 0) {
sub_0806F188(this);
MarkFuserDone(this);
}
}
void sub_0806BCD4(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
void Farmers_MakeInteractable(Entity* this) {
AddInteractableWhenBigFuser(this, GetFusionToOffer(this));
}
void sub_0806BCE8(Entity* this) {
@@ -69,12 +69,12 @@ void sub_0806BCE8(Entity* this) {
DIALOG_KINSTONE,
DIALOG_CHECK_FLAG,
1,
{ TEXT_INDEX(TEXT_FARMERS, 0X7), TEXT_INDEX(TEXT_FARMERS, 0x2) } },
{ TEXT_INDEX(TEXT_FARMERS, 0x7), TEXT_INDEX(TEXT_FARMERS, 0x2) } },
{ 0x29,
DIALOG_KINSTONE,
DIALOG_CHECK_FLAG,
1,
{ TEXT_INDEX(TEXT_FARMERS, 0X11), TEXT_INDEX(TEXT_FARMERS, 0xd) } },
{ TEXT_INDEX(TEXT_FARMERS, 0x11), TEXT_INDEX(TEXT_FARMERS, 0xd) } },
};
ShowNPCDialogue(this, &gUnk_08113158[this->type]);
}
+6 -5
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "kinstone.h"
void Farore(Entity* this) {
switch (this->action) {
@@ -29,12 +30,12 @@ void Farore(Entity* this) {
}
}
void sub_08064A28(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
void Farore_MakeInteractable(Entity* this) {
u32 kinstoneId = GetFusionToOffer(this);
if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
kinstoneId = KINSTONE_NONE;
}
sub_08078784(this, tmp);
AddInteractableWhenBigFuser(this, kinstoneId);
}
void Farore_Fusion(Entity* this) {
+2 -2
View File
@@ -21,8 +21,8 @@ void sub_0805FE10(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
+3 -3
View File
@@ -534,9 +534,9 @@ void ForestMinish(Entity* this) {
}
}
void sub_08060090(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void ForestMinish_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void ForestMinish_Head(Entity* this) {
+2 -2
View File
@@ -8,8 +8,8 @@ void Gentari(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
break;
case 1:
+4 -4
View File
@@ -110,9 +110,9 @@ void sub_08065CCC(Entity* this) {
gScreen.controls.alphaBlend = 0x10;
}
void sub_08065D00(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void GhostBrothers_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void sub_08065D18(Entity* this) {
@@ -219,7 +219,7 @@ void sub_08065EDC(Entity* this) {
*(u16**)&this->field_0x6c = (++puVar3);
} else {
this->action++;
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
}
}
+2 -2
View File
@@ -9,8 +9,8 @@ void Gina(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
break;
case 1:
+1 -1
View File
@@ -70,7 +70,7 @@ void sub_080697C4(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08111C3C)) {
this->action = 1;
InitializeAnimation(this, 2);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
}
+5 -5
View File
@@ -30,7 +30,7 @@ void Goron(Entity* this) {
}
void sub_08069310(Entity* this) {
sub_08078778(this);
AddInteractableWhenBigObject(this);
this->action = 1;
InitAnimationForceUpdate(this, 2);
}
@@ -105,7 +105,7 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
}
u32 sub_08069480(Entity* this) {
return (u8)sub_0801E99C(this);
return (u8)GetFusionToOffer(this);
}
void sub_0806948C(Entity* this, ScriptExecutionContext* context) {
@@ -113,12 +113,12 @@ void sub_0806948C(Entity* this, ScriptExecutionContext* context) {
gActiveScriptInfo.flags |= 1;
}
void sub_080694B0(Entity* this) {
void Goron_MakeInteractable(Entity* this) {
u32 kinstone = (u8)sub_08069480(this);
if (CheckKinstoneFused(kinstone)) {
sub_08078778(this);
AddInteractableWhenBigObject(this);
} else {
sub_08078784(this, kinstone);
AddInteractableWhenBigFuser(this, kinstone);
}
}
+4 -3
View File
@@ -5,6 +5,7 @@
#include "flags.h"
#include "save.h"
#include "npc.h"
#include "item.h"
static u32 GoronMerchant_GetSalePrice(Entity*);
@@ -13,7 +14,7 @@ extern void (*const gUnk_08111B98[])(Entity*);
static const u16 sKinstonePrices[];
extern u32 sub_0801E7D0(u32);
extern u32 GetAmountInKinstoneBag(u32);
void GoronMerchant(Entity* this) {
if ((this->flags & ENT_SCRIPTED) != 0) {
@@ -132,9 +133,9 @@ static u32 GoronMerchant_GetSalePrice(Entity* this) {
void GoronMerchant_TryToBuyKinstone(Entity* this, ScriptExecutionContext* context) {
s32 salePrice = GoronMerchant_GetSalePrice(this);
if (salePrice <= gSave.stats.rupees) {
if (sub_0801E7D0(gRoomVars.shopItemType2) < 99) {
if (GetAmountInKinstoneBag(gRoomVars.shopItemType2) < 99) {
ModRupees(-salePrice);
InitItemGetSequence(0x5c, gRoomVars.shopItemType2, 0);
InitItemGetSequence(ITEM_KINSTONE, gRoomVars.shopItemType2, 0);
gRoomVars.shopItemType = 0;
gRoomVars.shopItemType2 = 0;
context->condition = 1;
+5 -5
View File
@@ -42,8 +42,8 @@ void sub_0806CAF4(Entity* this) {
SortEntityAbove(this, npc);
}
sub_0807DD64(this);
sub_08078778(this);
sub_08078850(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84);
AddInteractableWhenBigObject(this);
SetInteractableObjectCollision(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84);
}
ExecuteScriptForEntity(this, NULL);
HandleEntity0x82Actions(this);
@@ -154,9 +154,9 @@ void sub_0806CD4C(Entity* this) {
ChangeObjPalette(this, 0x110);
}
void sub_0806CD58(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Gregal_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Gregal_Fusion(Entity* this) {
+1 -1
View File
@@ -294,7 +294,7 @@ void sub_08063D44(Entity* this) {
ent->subtimer = 60;
break;
case 4 ... 5:
sub_08078778(this);
AddInteractableWhenBigObject(this);
break;
}
this->action++;
+4 -4
View File
@@ -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;
@@ -100,9 +100,9 @@ void sub_0806E418(Entity* this) {
ShowNPCDialogue(this, &dialogs[tmp]);
}
void sub_0806E440(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void HurdyGurdyMan_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void HurdyGurdyMan_Fusion(Entity* this) {
+186 -39
View File
@@ -76,6 +76,7 @@ void sub_080620F4(Entity*);
void sub_08062130(Entity*);
void sub_08062194(Entity*);
void (*const gUnk_0810BE0C[])(Entity*) = { sub_080620F4, sub_08062130, sub_08062194 };
extern s32 sub_080041E8(s32 x1, s32 y1, s32 x2, s32 y2);
void sub_08062194(Entity*);
const Dialog gUnk_0810BE10[] = {
@@ -182,16 +183,21 @@ void sub_080622F4(Entity*);
void sub_0806265C(Entity*, ScriptExecutionContext*);
void sub_0806252C(Entity*);
typedef struct {
u16 unk_0; /* u16 */
u16 unk_2; /* u16 */
u16 unk_4; /* u16 */
u8 unk_6;
u8 unk_7;
typedef union {
struct {
s16 x;
s16 y;
s16 z;
u8 framestate;
u8 animationState : 6;
u8 collisionLayer : 2;
} FIELDS;
u64 DWORD;
} KidHeapItem;
#define KID_HEAP_COUNT 0x14
typedef KidHeapItem KidHeap[KID_HEAP_COUNT];
#define KID_HEAP ((KidHeapItem*)this->myHeap)
void Kid(Entity* this) {
if ((this->flags & ENT_SCRIPTED) != 0) {
@@ -207,7 +213,7 @@ void sub_080620F4(Entity* this) {
this->field_0x68.HALF.LO = 0;
this->action = 1;
InitAnimationForceUpdate(this, 2);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
}
@@ -306,57 +312,198 @@ void sub_080621AC(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/kid/sub_080622F4.inc", void sub_080622F4(Entity* this))
#define KID_HEAP_SHIFT_RIGHT \
heapPtr = KID_HEAP; \
heapPtr += (KID_HEAP_COUNT - 2); \
for (i = 0; i < (KID_HEAP_COUNT - 1); i++) { \
heapPtr[1] = heapPtr[0]; \
heapPtr--; \
}
void sub_080622F4(Entity* this) {
s32 dx;
s32 dy;
s32 dist;
s32 i;
u32 animIndex; // used as 2nd param of InitAnimationForceUpdate
u32 animIndexTmp;
KidHeapItem* heapPtr;
KidHeapItem item;
// Prepended heap item is initialized from player's current state.
item.FIELDS.x = gPlayerEntity.x.HALF_U.HI;
item.FIELDS.y = gPlayerEntity.y.HALF_U.HI;
item.FIELDS.z = gPlayerEntity.z.HALF_U.HI;
item.FIELDS.framestate = gPlayerState.framestate;
item.FIELDS.animationState = gPlayerEntity.animationState;
item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer;
heapPtr = this->myHeap;
if (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16) {
dx = this->x.HALF.HI - gPlayerEntity.x.HALF.HI;
dy = this->y.HALF.HI - gPlayerEntity.y.HALF.HI;
if (dx < 0)
dx = -dx;
if (dy < 0)
dy = -dy;
if (dx > 120 || dy > 80) {
this->field_0x68.HALF.LO = 0;
return;
}
sub_0806252C(this);
}
animIndex = 0;
if (item.DWORD != heapPtr->DWORD) {
KID_HEAP_SHIFT_RIGHT;
heapPtr = KID_HEAP;
heapPtr[0] = item;
animIndex = 0x4;
if ((s8)this->field_0x68.HALF.HI > 0) {
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
}
} else {
heapPtr += KID_HEAP_COUNT - 1;
if (heapPtr->FIELDS.z < 0) {
KID_HEAP_SHIFT_RIGHT;
animIndex = 0x4;
} else {
dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x,
(u16)heapPtr->FIELDS.y);
dist = ((u32)dist) >> 0x4;
if (dist > 0x18) {
KID_HEAP_SHIFT_RIGHT;
animIndex = 0x4;
}
}
}
heapPtr = KID_HEAP;
heapPtr += +KID_HEAP_COUNT - 1;
this->x.HALF.HI = heapPtr->FIELDS.x;
this->y.HALF.HI = heapPtr->FIELDS.y;
this->z.HALF.HI = heapPtr->FIELDS.z;
this->animationState = heapPtr->FIELDS.animationState;
this->collisionLayer = heapPtr->FIELDS.collisionLayer;
if (((s8)this->field_0x68.HALF.HI) > 0) {
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
}
animIndexTmp = animIndex;
animIndex += this->animationState >> 1;
if (this->type == OBJECT) {
animIndex += 0x10;
}
if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) {
InitAnimationForceUpdate(this, animIndex);
this->field_0x68.HALF.HI = 0x1e;
} else {
UpdateAnimationSingleFrame(this);
}
sub_0800451C(this);
return;
}
void sub_08062500(Entity* this) {
this->myHeap = zMalloc(sizeof(KidHeap));
if (this->myHeap != NULL) {
this->field_0x68.HALF.LO = 1;
sub_080788E0(this);
RemoveInteractableObject(this);
this->hitbox = NULL;
sub_0806252C(this);
}
}
NONMATCH("asm/non_matching/kid/sub_0806252C.inc", void sub_0806252C(Entity* this)) {
void sub_0806252C(Entity* this) {
s16 sVar1;
s16 sVar2;
u16 uVar3;
u8 uVar4;
s16 r0;
s16 sVar5;
s16 sVar6;
u8 bVar7;
KidHeapItem* heapObj;
KidHeapItem* item;
s32 loopVar;
s32 iVar10;
s32 iVar11;
FORCE_REGISTER(u32 r5, r5);
FORCE_REGISTER(u32 r6, r6);
FORCE_REGISTER(u32 r0, r0);
FORCE_REGISTER(u32 r1, r1);
FORCE_REGISTER(u32 r2, r2);
u32 r3;
FORCE_REGISTER(s32 r8, r8);
s32 y;
s32 r10;
FORCE_REGISTER(s32 x, r12);
uVar4 = gPlayerState.framestate;
uVar3 = gPlayerEntity.z.HALF.HI;
sVar2 = gPlayerEntity.y.HALF.HI;
sVar1 = gPlayerEntity.x.HALF.HI;
r0 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI;
sVar5 = FixedDiv(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, KID_HEAP_COUNT);
sVar6 = FixedDiv(r0, KID_HEAP_COUNT);
heapObj = (KidHeapItem*)this->myHeap;
iVar10 = 0;
iVar11 = 0;
r1 = gPlayerEntity.x.HALF_U.HI;
r3 = 0xffff0000;
r0 = r3;
r0 &= r5;
r0 |= r1;
for (loopVar = KID_HEAP_COUNT - 1; loopVar > -1; loopVar--) {
heapObj->unk_0 = sVar1 - (s16)((u32)iVar11 >> 8);
heapObj->unk_2 = sVar2 - (s16)((u32)iVar10 >> 8);
heapObj->unk_4 = uVar3;
heapObj->unk_6 = uVar4;
bVar7 = this->animationState & 0x3f;
heapObj->unk_7 = (heapObj->unk_7 & 0xc0) | bVar7;
heapObj->unk_7 = bVar7 | this->collisionLayer << 6;
heapObj = heapObj + 1;
iVar10 = iVar10 + sVar6;
iVar11 = iVar11 + sVar5;
r1 = gPlayerEntity.y.HALF_U.HI;
r1 <<= 0x10;
r2 = 0x0000ffff;
r0 &= r2;
r0 |= r1;
r5 = r0;
r0 = gPlayerEntity.z.HALF_U.HI;
r3 &= r6;
r3 |= r0;
r0 = gPlayerState.framestate;
r0 <<= 0x10;
r2 = 0xff00ffff;
r2 &= r3;
r2 |= r0;
r1 = gPlayerEntity.animationState;
r0 = 0x3f;
r1 &= r0;
r1 <<= 0x18;
r0 = 0xc0ffffff;
r0 &= r2;
r0 |= r1;
r1 = gPlayerEntity.collisionLayer;
r1 <<= 0x1e;
r2 = 0x3fffffff;
r0 &= r2;
r0 |= r1;
r6 = r0;
r10 = r0 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI;
r8 = r0 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI;
r10 = FixedDiv(r10, KID_HEAP_COUNT);
r8 = FixedDiv(r8, KID_HEAP_COUNT);
item = (KidHeapItem*)this->myHeap;
y = 0;
x = 0;
for (loopVar = KID_HEAP_COUNT - 1; loopVar >= 0; loopVar--) {
item->FIELDS.x = r5 - (x >> 8);
item->FIELDS.y = (r5 >> 0x10) - (y >> 8);
item->FIELDS.z = r6;
item->FIELDS.framestate = r6 >> 0x10;
item->FIELDS.animationState = this->animationState & 0x3f;
item->FIELDS.collisionLayer = this->collisionLayer;
item++;
y = y + r8;
x = x + r10;
}
}
END_NONMATCH
void sub_08062634(Entity* this) {
u32 a = this->type2;
@@ -554,9 +701,9 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) {
}
}
void sub_08062A48(Entity* this, ScriptExecutionContext* context) {
this->field_0x6a.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x6a.HALF.LO);
void Kid_MakeInteractable(Entity* this, ScriptExecutionContext* context) {
this->field_0x6a.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x6a.HALF.LO);
}
void Kid_Fusion(Entity* this) {
+5 -5
View File
@@ -39,8 +39,8 @@ void KingDaltus(Entity* this) {
void sub_08066654(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
InitAnimationForceUpdate(this, 2);
}
@@ -72,7 +72,7 @@ void sub_080666DC(Entity* this) {
void sub_080666E4(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this);
}
@@ -86,8 +86,8 @@ void sub_08066718(Entity* this) {
}
}
void sub_0806672C(Entity* this) {
sub_08078784(this, this->field_0x68.HALF.LO);
void KingDaltus_MakeInteractable(Entity* this) {
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void sub_0806673C(Entity* this) {
+2 -2
View File
@@ -9,8 +9,8 @@ void Librari(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
this->animationState = this->timer;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
SetDefaultPriority(this, PRIO_MESSAGE);
sub_0807DD50(this);
break;
+2 -2
View File
@@ -43,8 +43,8 @@ void sub_08065888(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->animationState = 4;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
+3 -3
View File
@@ -92,9 +92,9 @@ void sub_0806C4DC(Entity* this) {
ShowNPCDialogue(this, &dialogs[gSave.global_progress]);
}
void sub_0806C4F8(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Mama_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Mama_Fusion(Entity* this) {
+5 -10
View File
@@ -11,7 +11,7 @@ void MayorHagen(Entity* this) {
case 0:
this->action = 1;
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);
sub_0807DD50(this);
break;
@@ -37,15 +37,10 @@ void MayorHagen(Entity* this) {
}
}
void sub_0806CE5C(Entity* this) {
static const u8 gUnk_08113F44[] = {
0,
8,
8,
16,
};
sub_08078784(this, sub_0801E99C(this));
sub_08078850(this, 1, 0, gUnk_08113F44);
void MayorHagen_MakeInteractable(Entity* this) {
static const Rect gUnk_08113F44 = { 0, 8, 8, 16 };
AddInteractableWhenBigFuser(this, GetFusionToOffer(this));
SetInteractableObjectCollision(this, 1, 0, &gUnk_08113F44);
}
void sub_0806CE80(Entity* this) {
+4 -4
View File
@@ -29,7 +29,7 @@ void sub_08068708(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08111520)) {
this->action = 1;
InitializeAnimation(this, 0);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
}
@@ -100,9 +100,9 @@ void sub_08068780(Entity* this) {
}
}
void sub_08068884(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Melari_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Melari_Head(Entity* this) {
+4 -4
View File
@@ -27,7 +27,7 @@ void sub_080667E4(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 2);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
void sub_08066808(Entity* this) {
@@ -60,7 +60,7 @@ void sub_08066864(Entity* this) {
case 0:
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this);
break;
case 1:
@@ -81,8 +81,8 @@ void sub_08066864(Entity* this) {
}
}
void sub_080668F0(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
void MinisterPotho_MakeInteractable(Entity* this) {
AddInteractableWhenBigFuser(this, GetFusionToOffer(this));
}
void sub_08066904(Entity* this) {
+4 -4
View File
@@ -57,7 +57,7 @@ void MountainMinish(Entity* this) {
void sub_08067E60(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08111358)) {
this->action = 1;
sub_08078778(this);
AddInteractableWhenBigObject(this);
InitializeAnimation(this, 2);
}
}
@@ -179,9 +179,9 @@ void sub_08067EF0(Entity* this) {
}
}
void sub_08068104(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void MountainMinish_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void sub_0806811C(Entity* this) {
+3 -3
View File
@@ -82,9 +82,9 @@ void sub_080670E4(Entity* this) {
ShowNPCDialogue(this, &dialogs[gSave.global_progress]);
}
void sub_08067100(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Mutoh_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Mutoh_Fusion(Entity* this) {
+6 -5
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "kinstone.h"
void Nayru(Entity* this) {
switch (this->action) {
@@ -29,12 +30,12 @@ void Nayru(Entity* this) {
}
}
void sub_08064928(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.global_progress < 7)) {
tmp = 0;
void Nayru_MakeInteractable(Entity* this) {
u32 kinstoneId = GetFusionToOffer(this);
if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) {
kinstoneId = KINSTONE_NONE;
}
sub_08078784(this, tmp);
AddInteractableWhenBigFuser(this, kinstoneId);
}
void Nayru_Fusion(Entity* this) {
+2 -2
View File
@@ -38,7 +38,7 @@ void sub_080662F8(Entity* this) {
this->parent = &gPlayerEntity;
this->cutsceneBeh.HWORD = 0;
sub_08066490(this, this->parent);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
void sub_08066358(Entity* this) {
@@ -56,7 +56,7 @@ void sub_08066358(Entity* this) {
this->speed = 0x80;
this->cutsceneBeh.HWORD = 1;
gPauseMenuOptions.disabled = 1;
sub_080788E0(this);
RemoveInteractableObject(this);
}
} else {
sub_08066490(this, this->parent);
+1 -1
View File
@@ -18,7 +18,7 @@ static void sub_080669B8(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 2);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
static void sub_080669DC(Entity* this) {
+44 -48
View File
@@ -4,6 +4,7 @@
#include "game.h"
#include "hitbox.h"
#include "item.h"
#include "kinstone.h"
#include "npc.h"
#include "object.h"
#include "save.h"
@@ -11,15 +12,16 @@
#include "sound.h"
typedef struct {
u32 unk_00;
s8 unk_04;
} gUnk_0810C89C_struct;
Rect customHitbox;
u8 interactDirections;
u8 unused[3];
} InteractCollisionData;
extern void script_MinishVillageObjectLeftStoneOpening; // Cutscene data type?
extern void script_MinishVillageObjectRightStoneOpening; // Cutscene data type?
const Hitbox gUnk_08114154;
const u8 gUnk_0811415C[];
const InteractCollisionData gNpc4ECollisionData[];
const ScreenTransitionData* const gNpc4ETransitions[];
const u8 gNpc4ETransitionTypes[];
const u16 gUnk_081141F4[];
@@ -41,66 +43,61 @@ void NPC4E(Entity* this) {
}
}
void sub_0806DA04(Entity* this, ScriptExecutionContext* context) {
// TODO gUnk_0811415C should be a gUnk_0810C89C_struct[], but then a lot of bytes everywhere are wrong?
gUnk_0810C89C_struct* a = (gUnk_0810C89C_struct*)&(
(gUnk_0810C89C_struct*)gUnk_0811415C)[context->intVariable]; // cast necessary to no longer make it a const* ?
sub_08078850(this, 1, (u8)a->unk_04, a);
void NPC4E_ChangeInteractableHitbox(Entity* this, ScriptExecutionContext* context) {
const InteractCollisionData* data = &gNpc4ECollisionData[context->intVariable];
SetInteractableObjectCollision(this, 1, data->interactDirections, data);
}
void NPC4E_DoScreenTransition(Entity* this, ScriptExecutionContext* context) {
sub_0808091C(gNpc4ETransitions[context->intVariable], gNpc4ETransitionTypes[context->intVariable]);
}
// Returns the kinstone id?
u8 sub_0806DA3C(Entity* this) {
u8 NPC4E_GetKinstoneId(Entity* this) {
u32 result;
switch (this->type) {
default:
result = 0;
result = KINSTONE_NONE;
break;
case 1:
result = 1;
result = KINSTONE_MYSTERIOUS_CLOUD_TOP_RIGHT;
break;
case 2:
result = 2;
result = KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_LEFT;
break;
case 3:
result = 3;
result = KINSTONE_MYSTERIOUS_CLOUD_TOP_LEFT;
break;
case 4:
result = 4;
result = KINSTONE_MYSTERIOUS_CLOUD_MIDDLE;
break;
case 5:
result = 5;
result = KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_RIGHT;
break;
case 11:
result = 9;
result = KINSTONE_SOURCE_FLOW;
break;
case 6:
case 7:
case 8:
case 9:
case 10:
result = sub_0801E99C(this);
result = GetFusionToOffer(this);
break;
}
return result;
}
// Check whether a kinstone fusion is possible and store the result somewhere in param_2?
void sub_0806DAAC(Entity* this, ScriptExecutionContext* context) {
context->condition = CheckKinstoneFused(sub_0806DA3C(this));
void NPC4E_IsKinstoneFused(Entity* this, ScriptExecutionContext* context) {
context->condition = CheckKinstoneFused(NPC4E_GetKinstoneId(this));
gActiveScriptInfo.flags |= 1;
}
// maybe actually execute the kinstone fusion?
void sub_0806DAD0(Entity* this) {
sub_08078790(this, sub_0806DA3C(this));
void NPC4E_MakeFuserInteractable(Entity* this) {
AddInteractableFuser(this, NPC4E_GetKinstoneId(this));
}
void sub_0806DAE8(Entity* this) {
void NPC4E_SetPinwheelFlag(Entity* this) {
switch (this->type - 1) {
case 0:
SetLocalFlag(KUMOUE_02_AWASE_01);
@@ -122,7 +119,7 @@ void sub_0806DAE8(Entity* this) {
SoundReq(SFX_TASK_COMPLETE);
}
void sub_0806DB44(Entity* this, ScriptExecutionContext* context) {
void NPC4E_IsEveryPinwheelActivated(Entity* this, ScriptExecutionContext* context) {
context->condition = 0;
if (CheckLocalFlag(KUMOUE_02_AWASE_01) && CheckLocalFlag(KUMOUE_02_AWASE_02) &&
@@ -148,29 +145,29 @@ void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
}
}
u32 sub_0806DBF4(u32 param_1) {
switch (param_1) {
case 1:
case 2:
case 3:
case 4:
case 6:
param_1 = ITEM_SMITH_SWORD;
Item NPC4E_GetItemWithSwordUpgraded(Item itemId) {
switch (itemId) {
case ITEM_SMITH_SWORD:
case ITEM_GREEN_SWORD:
case ITEM_RED_SWORD:
case ITEM_BLUE_SWORD:
case ITEM_FOURSWORD:
itemId = ITEM_SMITH_SWORD;
if (GetInventoryValue(ITEM_GREEN_SWORD) != 0) {
param_1 = ITEM_GREEN_SWORD;
itemId = ITEM_GREEN_SWORD;
}
if (GetInventoryValue(ITEM_RED_SWORD) != 0) {
param_1 = ITEM_RED_SWORD;
itemId = ITEM_RED_SWORD;
}
if (GetInventoryValue(ITEM_BLUE_SWORD) != 0) {
param_1 = ITEM_BLUE_SWORD;
itemId = ITEM_BLUE_SWORD;
}
if (GetInventoryValue(ITEM_FOURSWORD) != 0) {
param_1 = ITEM_FOURSWORD;
itemId = ITEM_FOURSWORD;
}
break;
}
return param_1;
return itemId;
}
void NPC4E_SaveEquippedItems(Entity* this) {
@@ -179,8 +176,8 @@ void NPC4E_SaveEquippedItems(Entity* this) {
}
void NPC4E_RestoreEquippedItems(Entity* this) {
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.LO), EQUIP_SLOT_A);
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.HI), EQUIP_SLOT_B);
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.LO), EQUIP_SLOT_A);
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.HI), EQUIP_SLOT_B);
}
void sub_0806DC7C(void) {
@@ -234,13 +231,12 @@ void NPC4E_Fusion(Entity* this) {
const Hitbox gUnk_08114154 = { 0, -8, 0, 0, 0, 0, 24, 8 };
const u8 gUnk_0811415C[] = { //
0x00, 0x00, 0x08, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x08, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x08, 0x0e, 0x00, 0x00, 0x00,
const InteractCollisionData gNpc4ECollisionData[] = { //
{ 0, 0, 8, 8, 0x0E, 0, 0, 0 }, { 0, 0, 26, 8, 0x0E, 0, 0, 0 }, { 0, 0, 16, 4, 0x0E, 0, 0, 0 },
{ 0, 0, 10, 10, 0x00, 0, 0, 0 }, { 0, 0, 10, 10, 0x00, 0, 0, 0 }, { 0, 0, 6, 4, 0x0E, 0, 0, 0 },
{ 0, 8, 16, 4, 0x0E, 0, 0, 0 }, { 0, -8, 24, 8, 0x0E, 0, 0, 0 },
#ifndef EU
0x00, 0x00, 0x58, 0x08, 0x0e, 0x00, 0x00, 0x00
{ 0, 0, 88, 8, 0x0E, 0, 0, 0 }
#endif
};
+1 -1
View File
@@ -875,7 +875,7 @@ void sub_08061ACC(Entity* this) {
this->subAction = 0xff;
this->timer = 0;
this->followerFlag = this->followerFlag & 0xfe;
sub_08078778(this);
AddInteractableWhenBigObject(this);
sub_08061AFC(this);
}
+1 -1
View File
@@ -22,7 +22,7 @@ void sub_08062AF0(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
InitializeAnimation(this, 0);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
void sub_08062B14(Entity* this) {
+5 -5
View File
@@ -41,7 +41,7 @@ void sub_0806B3CC(Entity* this) {
}
this->action = 1;
InitializeAnimation(this, 0);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
GetNextFrame(this);
if (this->interactType != 0) {
@@ -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;
@@ -161,9 +161,9 @@ void sub_0806B540(Entity* this) {
gActiveScriptInfo.commandSize = 0;
}
void sub_0806B60C(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Percy_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Percy_Fusion(Entity* this) {
+3 -3
View File
@@ -26,7 +26,7 @@ void PicolyteBottle_Action1(PicolyteBottleEntity* this);
void PicolyteBottle_Action2(PicolyteBottleEntity* this);
void nullsub_111(PicolyteBottleEntity* this);
extern void sub_08078828(Entity*);
extern void AddInteractableChest(Entity*);
void PicolyteBottle(Entity* this) {
static void (*const PicolyteBottle_Actions[])(PicolyteBottleEntity*) = {
@@ -97,7 +97,7 @@ void PicolyteBottle_Action2(PicolyteBottleEntity* this) {
super->child = obj;
CopyPosition(super, obj);
}
sub_080788E0(super);
RemoveInteractableObject(super);
sub_0807B7D8(0x74, this->unk76, 2);
}
}
@@ -149,7 +149,7 @@ void sub_0806E0DC(PicolyteBottleEntity* this) {
DeleteEntity(super->child);
super->child = NULL;
}
sub_08078828(super);
AddInteractableChest(super);
sub_0807B7D8(0x73, this->unk76, 2);
} else {
super->action = 3;
+4 -4
View File
@@ -32,7 +32,7 @@ void sub_08063A98(Entity* this) {
this->action++;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 4);
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
void sub_08063AC0(Entity* this) {
@@ -150,9 +150,9 @@ void sub_08063C90(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810CE04[gSave.global_progress]);
}
void sub_08063CAC(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Pina_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Pina_Fusion(Entity* this) {
+6 -6
View File
@@ -41,10 +41,10 @@ void RemoveAllBakedGoods(void) {
bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
u32 tmp;
u32 tmp2;
u32 kinstoneId;
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 gUnk_0810C43D[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 };
static const u8 chancesPerType[] = { 0x10, 0x10, 0x10, 0x20, 0x20, 0x30, 0x30, 0x30 };
static const u8 kinstoneTypes[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 };
//! @bug: tmp is uninitialized, in practice player must have an item here
if (GetInventoryValue(ITEM_BRIOCHE) != 0) {
@@ -67,9 +67,9 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
context->condition = FALSE;
return FALSE;
} else {
tmp = GetRandomByWeight(gUnk_0810C435);
tmp2 = gUnk_0810C43D[tmp];
InitItemGetSequence(ITEM_KINSTONE, tmp2, 1);
tmp = GetRandomByWeight(chancesPerType);
kinstoneId = kinstoneTypes[tmp];
InitItemGetSequence(ITEM_KINSTONE, kinstoneId, 1);
MessageNoOverlap(TEXT_INDEX(TEXT_BAKERY, 0x5), this);
context->condition = TRUE;
return TRUE;
+8 -8
View File
@@ -8,7 +8,7 @@
extern void sub_08060528(Entity*);
extern void sub_080604DC(Entity*);
extern void sub_080606D8(Entity*);
extern void sub_080606C0(Entity*);
extern void Postman_MakeInteractable(Entity*);
const Coords gUnk_0810A66C[] = {
{ .HALF = { 0x0, 0x0 } }, { .HALF = { 0x48, 0xa8 } }, { .HALF = { 0x0, 0xf0 } },
@@ -234,7 +234,7 @@ void sub_08060528(Entity* this) {
this->field_0x68.HALF.HI = 0;
this->field_0x6a.HWORD = 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);
break;
case 1:
@@ -274,7 +274,7 @@ void sub_08060528(Entity* this) {
this->field_0x6a.HWORD = 0;
this->zVelocity = Q_16_16(2.0);
this->field_0x6c.HALF.HI = 1;
sub_080788E0(this);
RemoveInteractableObject(this);
EnqueueSFX(SFX_PLY_JUMP);
} else {
this->field_0x6a.HWORD--;
@@ -283,7 +283,7 @@ void sub_08060528(Entity* this) {
GravityUpdate(this, Q_8_8(24.0));
if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) {
this->field_0x6c.HALF.HI = 0;
sub_080606C0(this);
Postman_MakeInteractable(this);
}
if (this->z.WORD >= 0 &&
((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) {
@@ -292,9 +292,9 @@ void sub_08060528(Entity* this) {
sub_0800451C(this);
}
void sub_080606C0(Entity* this) {
this->field_0x6c.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x6c.HALF.LO);
void Postman_MakeInteractable(Entity* this) {
this->field_0x6c.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x6c.HALF.LO);
}
void sub_080606D8(Entity* this) {
@@ -336,7 +336,7 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) {
}
this->field_0x68.HALF.HI++;
this->collisionLayer = 1;
sub_080606C0(this);
Postman_MakeInteractable(this);
pbVar10 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO];
pbVar10 += (s8)this->field_0x68.HALF.HI;
do {
+4 -4
View File
@@ -328,10 +328,10 @@ void sub_0806A914(Entity* this) {
}
}
void sub_0806A93C(Entity* this) {
static const u8 gUnk_0811229C[] = { 0, 6, 10, 16 };
sub_08078778(this);
sub_08078850(this, 0, 0, &gUnk_0811229C);
void Rem_MakeInteractable(Entity* this) {
static const Rect gUnk_0811229C = { 0, 6, 10, 16 };
AddInteractableWhenBigObject(this);
SetInteractableObjectCollision(this, 0, 0, &gUnk_0811229C);
}
void sub_0806A958(Entity* this) {
+3 -3
View File
@@ -235,9 +235,9 @@ void SittingPerson_Head(Entity* this) {
sub_0807000C(this);
}
void sub_080639D0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void SittingPerson_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void SittingPerson_Fusion(Entity* this) {
+2 -2
View File
@@ -9,12 +9,12 @@
void SmallTownMinish(Entity* this) {
static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 };
static const u8 gUnk_08114304[] = { -2, 1, 6, 6 };
static const Rect gUnk_08114304 = { -2, 1, 6, 6 };
if (this->action == 0) {
this->action++;
this->hitbox = (Hitbox*)&gUnk_081142FC;
sub_0807DD50(this);
sub_08078850(this, 1, 0, gUnk_08114304);
SetInteractableObjectCollision(this, 1, 0, &gUnk_08114304);
} else {
sub_0807DD94(this, NULL);
}
+7 -12
View File
@@ -73,7 +73,7 @@ void Smith_Head(Entity* this) {
void sub_080660EC(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08110354)) {
this->action = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
InitAnimationForceUpdate(this, 2);
}
}
@@ -109,7 +109,7 @@ void sub_08066178(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_08110354)) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this);
}
}
@@ -205,18 +205,13 @@ void sub_08066258(void) {
SoundReq(hammerSounds[Random() & 7]);
}
void sub_08066274(Entity* this) {
static const u8 gUnk_081103E0[] = {
0,
6,
8,
12,
};
sub_08078850(this, 1, 0, &gUnk_081103E0);
void Smith_ChangeInteractableHitbox(Entity* this) {
static const Rect gUnk_081103E0 = { 0, 6, 8, 12 };
SetInteractableObjectCollision(this, 1, 0, &gUnk_081103E0);
}
void sub_08066288(Entity* this) {
sub_08078784(this, this->field_0x68.HALF.LO);
void Smith_MakeInteractable(Entity* this) {
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Smith_Fusion(Entity* this) {
+1 -1
View File
@@ -35,7 +35,7 @@ void sub_08062BD4(Entity* ent) {
ent->action = 1;
ent->spriteSettings.draw = 1;
InitializeAnimation(ent, 0);
sub_08078778(ent);
AddInteractableWhenBigObject(ent);
}
void sub_08062BF8(Entity* ent) {
+3 -3
View File
@@ -9,7 +9,7 @@
#include "game.h"
#ifndef EU
static const u8 gUnk_0810FDA0[] = { 0, 8, 10, 16 };
static const Rect gUnk_0810FDA0 = { 0, 8, 10, 16 };
#endif
extern u16 script_StockwellBuy[];
@@ -48,9 +48,9 @@ void sub_08065080(Entity* this) {
this->spriteSettings.draw = 1;
SetDefaultPriority(this, PRIO_MESSAGE);
InitializeAnimation(this, 4);
sub_08078778(this);
AddInteractableWhenBigObject(this);
#ifndef EU
sub_08078850(this, 0, 0, &gUnk_0810FDA0);
SetInteractableObjectCollision(this, 0, 0, &gUnk_0810FDA0);
#endif
context = StartCutscene(this, &script_Stockwell);
*(ScriptExecutionContext**)&this->cutsceneBeh = context;
+5 -5
View File
@@ -28,7 +28,7 @@ extern const u16 gUnk_0810FA54[];
// };
extern u32 gUnk_0810FA5A; // TODO second parameter of sub_0806EE04
void sub_08064CC0(Entity* this);
void Sturgeon_MakeInteractable(Entity* this);
void sub_08064C9C(Entity* this);
void sub_08064CD8(Entity* this);
@@ -68,7 +68,7 @@ void sub_08064B44(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810FA38)) {
InitializeAnimation(this, 2);
sub_0806EE04(this, &gUnk_0810FA5A, 0);
sub_08064CC0(this);
Sturgeon_MakeInteractable(this);
this->action = 1;
this->subAction = 0;
this->spriteSettings.draw = 1;
@@ -140,9 +140,9 @@ void sub_08064C9C(Entity* this) {
}
}
void sub_08064CC0(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Sturgeon_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void sub_08064CD8(Entity* this) {
+3 -3
View File
@@ -37,7 +37,7 @@ void Talon(Entity* this) {
void sub_08065570(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810FEB0)) {
InitializeAnimation(this, 0);
sub_08078778(this);
AddInteractableWhenBigObject(this);
this->action = 1;
this->subtimer = 1;
this->animationState = 2;
@@ -78,8 +78,8 @@ void sub_08065608(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810FEB0)) {
this->action = 1;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
}
+3 -3
View File
@@ -42,9 +42,9 @@ void Teachers(Entity* this) {
}
}
void sub_0806C674(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
void Teachers_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void Teachers_Head(Entity* this) {
+5 -5
View File
@@ -68,7 +68,7 @@ void sub_08064DE4(Entity* this) {
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
sub_0801E99C(this);
GetFusionToOffer(this);
}
break;
}
@@ -83,8 +83,8 @@ void sub_08064DE4(Entity* this) {
}
}
void sub_08064EA4(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
void TingleSiblings_MakeInteractable(Entity* this) {
this->field_0x68.HALF.LO = GetFusionToOffer(this);
switch (this->type) {
case 0:
if ((CheckKinstoneFused(KINSTONE_59) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) {
@@ -99,7 +99,7 @@ void sub_08064EA4(Entity* this) {
default:
break;
}
sub_08078784(this, this->field_0x68.HALF.LO);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void sub_08064EE8(Entity* this) {
@@ -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.unk141[sub_08002632(this)];
bVar2 = gSave.fuserProgress[GetFuserId(this)];
if (bVar2 >= 2) {
uVar5 = 3;
} else {
+10 -10
View File
@@ -129,13 +129,13 @@ static const SpriteLoadData gUnk_08112674[][4] = {
{ 0x0, 0x0, 0x0 },
},
};
static const u8 gUnk_081126D4[][4] = {
{ 0x0, 0x8, 0x8, 0x10 },
{ 0xf8, 0xfe, 0x10, 0x8 },
{ 0x0, 0x8, 0x8, 0x10 },
{ 0x8, 0xfe, 0x10, 0x8 },
static const Rect gUnk_081126D4[4] = {
{ 0, 8, 8, 16 },
{ -8, -2, 16, 8 },
{ 0, 8, 8, 16 },
{ 8, -2, 16, 8 },
};
static const u8 gUnk_081126E4[4] = { 14, 13, 11, 7 };
static const u8 gUnk_081126E4[4] = { 0x0e, 0x0d, 0x0b, 0x07 };
void TownMinish(Entity* this) {
static void (*const scriptedActionFuncs[])(Entity*) = {
@@ -208,7 +208,7 @@ void sub_0806ACC4(Entity* this) {
this->animationState = delay * 2;
this->timer = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD50(this);
InitializeAnimation(this, (this->animationState / 2) + 8);
break;
@@ -228,7 +228,7 @@ void sub_0806ACC4(Entity* this) {
}
if (this->type == 1) {
u8 idx = gPlayerEntity.animationState >> 1;
sub_08078850(this, 1, gUnk_081126E4[idx], gUnk_081126D4[idx]);
SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]);
}
}
break;
@@ -250,8 +250,8 @@ void sub_0806ACC4(Entity* this) {
}
}
void sub_0806ADFC(Entity* this) {
sub_08078784(this, this->field_0x68.HALF.LO);
void TownMinish_MakeInteractable(Entity* this) {
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void TownMinish_Head(Entity* this) {
+7 -7
View File
@@ -15,8 +15,8 @@ extern void sub_08062048(Entity*);
extern struct_0810B680 gUnk_0810B680[];
extern SpriteLoadData* gUnk_0810B6EC[];
extern u32 gUnk_0810B740[]; // TODO fourth parameter of sub_08078850
extern u8 gUnk_0810B748[]; // TODO third parameter of sub_08078850
extern u32 gUnk_0810B740[]; // TODO fourth parameter of SetInteractableObjectCollision
extern u8 gUnk_0810B748[]; // TODO third parameter of SetInteractableObjectCollision
extern u16 gUnk_0810B74A[];
extern void (*const gUnk_0810B774[])(Entity*);
extern void (*const gUnk_0810B77C[])(Entity*);
@@ -104,7 +104,7 @@ void sub_08061CEC(Entity* this) {
this->field_0x6a.HWORD = (uVar2 >> 0x10);
}
*(u16*)&this->field_0x6c = uVar2;
this->field_0x68.HALF.LO = sub_0801E99C(this);
this->field_0x68.HALF.LO = GetFusionToOffer(this);
sub_0807DD64(this);
sub_08061D64(this);
}
@@ -150,11 +150,11 @@ void sub_08061E50(Entity* this) {
}
}
void sub_08061E70(Entity* this) {
void Townsperson_MakeInteractable(Entity* this) {
if (this->id == 6) {
sub_08078784(this, this->field_0x68.HALF.LO);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
} else {
sub_08078778(this);
AddInteractableWhenBigObject(this);
}
}
@@ -236,7 +236,7 @@ void sub_08061FB0(Entity* this) {
void sub_08061FB8(Entity* this, ScriptExecutionContext* context) {
u8* temp = gUnk_0810B748;
sub_08078850(this, 1, temp[context->intVariable], &gUnk_0810B740[context->intVariable]);
SetInteractableObjectCollision(this, 1, temp[context->intVariable], &gUnk_0810B740[context->intVariable]);
}
void sub_08061FD8(Entity* this) {
+3 -3
View File
@@ -78,12 +78,12 @@ void sub_0806C85C(Entity* this) {
}
}
void sub_0806C870(Entity* this) {
void WindTribespeople_MakeInteractable(Entity* this) {
u8 bVar1;
bVar1 = sub_0801E99C(this);
bVar1 = GetFusionToOffer(this);
this->field_0x68.HALF.LO = bVar1;
sub_08078784(this, this->field_0x68.HALF.LO);
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
}
void WindTribespeople_Head(Entity* this) {
+239 -6
View File
@@ -1,7 +1,36 @@
#include "global.h"
#include "common.h"
#include "entity.h"
#include "functions.h"
#include "common.h"
extern s32 sub_080041E8(s32 x1, s32 y1, s32 x2, s32 y2);
typedef union {
struct {
u16 x;
u16 y;
u16 z;
u8 framestate;
u8 animationState : 6;
u8 collisionLayer : 2;
} FIELDS;
u64 DWORD;
} ZeldaFollowerItem;
#define ZELDA_FOLLOWER_HEAP_LEN 20
#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)this->myHeap)
#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)this->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1))
#define ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr) \
do { \
int i; \
heapPtr = ((ZeldaFollowerItem*)this->myHeap); \
heapPtr += (ZELDA_FOLLOWER_HEAP_LEN - 2); \
for (i = 0; i < (ZELDA_FOLLOWER_HEAP_LEN - 1); i++) { \
heapPtr[1] = heapPtr[0]; \
heapPtr--; \
} \
} while (0)
void sub_08068318(Entity*);
void sub_0806854C(Entity*, u32*);
@@ -25,19 +54,223 @@ void ZeldaFollower(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/zeldaFollower/sub_08068318.inc", void sub_08068318(Entity* this))
void sub_08068318(Entity* this) {
s32 dist;
s16 z;
u32 animIndex;
u32 animIndexTmp;
ZeldaFollowerItem* heapPtr;
ZeldaFollowerItem item;
item.FIELDS.x = gPlayerEntity.x.HALF_U.HI;
item.FIELDS.y = gPlayerEntity.y.HALF_U.HI;
item.FIELDS.z = gPlayerEntity.z.HALF_U.HI;
item.FIELDS.framestate = gPlayerState.framestate;
item.FIELDS.animationState = gPlayerEntity.animationState;
item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer;
heapPtr = this->myHeap;
if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) ||
(heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) {
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
this->spriteSettings.draw = 1;
sub_08068578(this);
}
animIndex = 0;
if (item.DWORD != heapPtr->DWORD || item.FIELDS.framestate == 0x16 || item.FIELDS.framestate == 0xa) {
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
heapPtr = ZELDA_FOLLOWER_HEAP;
heapPtr[0] = item;
animIndex = 0x4;
if ((s8)this->field_0x68.HALF.HI > 0) {
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
}
} else {
heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1;
z = heapPtr->FIELDS.z;
if (z < 0) {
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
animIndex = 0x4;
} else {
dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x,
(u16)heapPtr->FIELDS.y);
dist = ((u32)dist) >> 0x4;
if (dist > 0x18) {
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
animIndex = 0x4;
}
}
}
heapPtr = ZELDA_FOLLOWER_HEAP;
heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1;
this->x.HALF.HI = heapPtr->FIELDS.x;
this->y.HALF.HI = heapPtr->FIELDS.y;
this->z.HALF.HI = heapPtr->FIELDS.z;
this->animationState = heapPtr->FIELDS.animationState;
this->collisionLayer = heapPtr->FIELDS.collisionLayer;
if (heapPtr->FIELDS.framestate == 0x16 || heapPtr->FIELDS.framestate == 0xa) {
this->spriteSettings.draw = 0;
}
if (((s8)this->field_0x68.HALF.HI) > 0) {
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
}
animIndexTmp = animIndex;
animIndex += this->animationState >> 1;
if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) {
InitAnimationForceUpdate(this, animIndex);
this->field_0x68.HALF.HI = 0x1e;
} else {
UpdateAnimationSingleFrame(this);
}
sub_0800451C(this);
if (this->z.HALF.HI < 0) {
sub_0806F854(this, 0x0, -0xc);
}
}
void sub_0806854C(Entity* this, u32* none) {
this->myHeap = zMalloc(0xa0);
this->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN]));
if (this->myHeap != NULL) {
this->field_0x68.HALF.LO = 1;
sub_080788E0(this);
RemoveInteractableObject(this);
this->hitbox = NULL;
sub_08068578(this);
}
}
ASM_FUNC("asm/non_matching/zeldaFollower/sub_08068578.inc", void sub_08068578(Entity* this))
void sub_08068578(Entity* this) {
ZeldaFollowerItem* item;
s32 index;
#ifdef REWRITE_CODE
u32 r0;
u32 r1;
u32 r2;
u32 r3;
u32 r5;
u32 r6;
u32 r8;
s32 y;
u32 r10;
s32 x;
#else
register u32 r5 asm("r5");
register u32 r6 asm("r6");
register u32 r0 asm("r0");
register u32 r1 asm("r1");
register u32 r2 asm("r2");
register u32 r3 asm("r3");
register s32 r8 asm("r8");
register s32 y asm("r9");
register s32 r10 asm("r10");
register s32 x asm("r12");
#endif
// first u32 (r5)
#ifdef REWRITE_CODE
r0 = gPlayerEntity.x.HALF_U.HI | (r5 & 0xffff0000);
r5 = (gPlayerEntity.y.HALF_U.HI << 0x10) | (r0 & 0x0000ffff);
#else
r1 = gPlayerEntity.x.HALF_U.HI;
r3 = 0xffff0000;
r0 = r3;
r0 &= r5;
r0 |= r1;
r1 = gPlayerEntity.y.HALF_U.HI;
r1 <<= 0x10;
r2 = 0xffff;
r0 &= r2;
r0 |= r1;
r5 = r0;
#endif
// second u32 (r6)
#ifdef REWRITE_CODE
r3 = gPlayerEntity.z.HALF_U.HI | (r6 & 0xffff0000);
r2 = (gPlayerState.framestate << 0x10) | (r3 & 0xff00ffff);
r0 = ((gPlayerEntity.animationState & 0x3f) << 0x18) | (r2 & 0xc0ffffff);
r6 = (gPlayerEntity.collisionLayer << 0x1e) | (r0 & 0x3fffffff);
#else
r0 = gPlayerEntity.z.HALF_U.HI;
r3 &= r6;
r3 |= r0;
r0 = gPlayerState.framestate;
r0 <<= 0x10;
r2 = 0xff00ffff;
r2 &= r3;
r2 |= r0;
r1 = gPlayerEntity.animationState;
r0 = 0x3f;
r1 &= r0;
r1 <<= 0x18;
r0 = 0xc0ffffff;
r0 &= r2;
r0 |= r1;
// gPlayerEntity is now at r1
r1 = gPlayerEntity.collisionLayer;
r1 <<= 0x1e;
r2 = 0x3fffffff;
r0 &= r2;
r0 |= r1;
r6 = r0;
#endif
#ifdef REWRITE_CODE
r10 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI;
#else
r1 = gPlayerEntity.x.HALF.HI;
r0 = this->x.HALF.HI;
r0 = r1 - r0;
r10 = r0;
#endif
#ifdef REWRITE_CODE
r8 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI;
#else
r1 = gPlayerEntity.y.HALF.HI;
r0 = this->y.HALF.HI;
r0 = r1 - r0;
r8 = r0;
#endif
r10 = FixedDiv(r10, 0x14);
r8 = FixedDiv(r8, 0x14);
item = this->myHeap;
y = 0;
x = 0;
// Down here the u32 are suddendly accessed correctly as u16 and bitfields?
// How are the results of above u32 calculations used?
for (index = 0x13; index >= 0; index--) {
item->FIELDS.x = r5 - (x >> 8);
item->FIELDS.y = (r5 >> 0x10) - (y >> 8);
item->FIELDS.z = r6;
item->FIELDS.framestate = r6 >> 0x10;
item->FIELDS.animationState = this->animationState & 0x3f;
item->FIELDS.collisionLayer = this->collisionLayer;
item++;
y = y + r8;
x = x + r10;
}
}
void ZeldaFollower_Hide(Entity* zelda, Entity* follower) {
follower->field_0x68.HALF.LO = 0;
+4 -4
View File
@@ -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;
@@ -352,10 +352,10 @@ u32 UpdateFuseInteraction(Entity* ent) {
return ret;
}
void sub_0806F188(Entity* ent) {
u32 idx = sub_08002632(ent);
void MarkFuserDone(Entity* ent) {
u32 idx = GetFuserId(ent);
if (idx != 0)
gSave.unk1C1[idx] = 0xF3;
gSave.fuserOffers[idx] = KINSTONE_FUSER_DONE;
}
void ShowNPCDialogue(Entity* ent, const Dialog* dia) {
+4 -4
View File
@@ -27,7 +27,7 @@ typedef struct {
} BossDoorEntity;
extern bool32 gUnk_02036BB8;
extern const u8 gUnk_0811F740[];
extern const u8 gLockedDoorInteractDirections[];
void sub_0808C500(BossDoorEntity*);
void sub_0808C4BC(BossDoorEntity*);
@@ -69,8 +69,8 @@ void BossDoor_Init(BossDoorEntity* this) {
super->action = 1;
super->spriteSettings.draw = 1;
sub_0808C500(this);
sub_08078800(super);
sub_08078850(super, 0, gUnk_0811F740[this->unk_76], 0);
AddInteractableBossDoor(super);
SetInteractableObjectCollision(super, 0, gLockedDoorInteractDirections[this->unk_76], NULL);
break;
case 1:
super->action = 4;
@@ -87,7 +87,7 @@ void BossDoor_Init(BossDoorEntity* this) {
void BossDoor_Action1(BossDoorEntity* this) {
if (super->interactType != 0) {
super->action = 2;
sub_080788E0(super);
RemoveInteractableObject(super);
SetFlag(this->unk_86);
}
}
+18 -16
View File
@@ -53,16 +53,17 @@ void CameraTarget(Entity* this) {
case 0:
case 1:
case 2:
if ((gMessage.doTextBox & 0x7f) != 0) {
default:
if (gUnk_03003DF0.unk_4[3] == 50) {
if (CheckKinstoneFused(KINSTONE_32) == 0) {
uVar2 = 0;
break;
}
}
uVar2 = 1;
if ((gMessage.doTextBox & 0x7f) == 0) {
break;
}
default:
if (gPossibleInteraction.currentObject->kinstoneId == KINSTONE_32) {
if (CheckKinstoneFused(KINSTONE_32) == 0) {
uVar2 = 0;
break;
}
}
uVar2 = 1;
break;
}
@@ -102,9 +103,10 @@ void CameraTarget_Action1(Entity* this) {
if (this->timer) {
this->timer--;
} else {
if ((*(Entity**)(gUnk_03003DF0.unk_4 + 8) != NULL) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) {
this->child = *(Entity**)(gUnk_03003DF0.unk_4 + 8);
this->interactType = gUnk_03003DF0.unk_3;
if ((gPossibleInteraction.currentObject->entity != NULL) &&
((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) {
this->child = gPossibleInteraction.currentObject->entity;
this->interactType = gPossibleInteraction.currentIndex;
sub_08083A40(this);
}
}
@@ -118,8 +120,8 @@ void CameraTarget_Action2(Entity* this) {
u32 temp2;
const KinstoneWorldEvent* ptr;
if ((this->type != 1) &&
(((u8)(gUnk_03003DF0.unk_4[3] - 1) >= 100 || (this->child != *(Entity**)(gUnk_03003DF0.unk_4 + 8))))) {
if ((this->type != 1) && (((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) >= 100 ||
(this->child != gPossibleInteraction.currentObject->entity)))) {
sub_080838DC(this);
} else {
this->x = this->child->x;
@@ -128,12 +130,12 @@ void CameraTarget_Action2(Entity* this) {
if (this->frame == 1) {
this->frame = 0;
if (this->type == 0) {
bVar2 = gUnk_03003DF0.unk_4[3];
bVar2 = gPossibleInteraction.currentObject->kinstoneId;
} else {
bVar2 = this->type2;
}
ptr = gKinstoneWorldEvents + bVar2;
bVar1 = ptr->unk6;
bVar1 = ptr->bubbleIcon;
bVar3 = bVar1 & 1;
this->palette.b.b0 = bVar3;
temp = gUnk_0811F744[bVar1] < 0;
+3 -3
View File
@@ -26,7 +26,7 @@ extern const Hitbox gUnk_0811F8A8;
extern const Hitbox gUnk_0811F8B0;
void sub_080842D8(ChestSpawnerEntity*);
void sub_08078828(ChestSpawnerEntity*);
void AddInteractableChest(ChestSpawnerEntity*);
void sub_08083E20(ChestSpawnerEntity*);
void sub_08084074(u32);
void sub_080840A8(s32, s32);
@@ -76,7 +76,7 @@ void sub_08083E20(ChestSpawnerEntity* this) {
super->spriteSettings.draw = 1;
super->spriteRendering.alphaBlend = 0;
sub_080842D8(this);
sub_08078828(this);
AddInteractableChest(this);
}
void ChestSpawner_Type2Init(ChestSpawnerEntity* this) {
super->hitbox = (Hitbox*)&gUnk_0811F8B0;
@@ -153,7 +153,7 @@ void ChestSpawner_Type2Action3(ChestSpawnerEntity* this) {
if (super->interactType != 0) {
super->action = 4;
super->subtimer = 30;
sub_080788E0(super);
RemoveInteractableObject(super);
RequestPriorityDuration(super, 60);
SoundReq(SFX_CHEST_OPEN);
}
+3 -3
View File
@@ -172,9 +172,9 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8;
this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8;
if (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) {
gHUD.unk_2f = 3;
gHUD.rActionPlayerState = R_ACTION_THROW;
} else {
gHUD.unk_2f = 0;
gHUD.rActionPlayerState = R_ACTION_NONE;
}
PositionRelative(&gPlayerEntity, super, 0, 0x10000);
if (GetTileUnderEntity(super) == 0x19) {
@@ -184,7 +184,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
return;
}
if (gHUD.unk_2f != 3) {
if (gHUD.rActionPlayerState != R_ACTION_THROW) {
return;
}
gPlayerState.heldObject = 0;
+85 -71
View File
@@ -13,23 +13,28 @@
#include "npc.h"
#include "object.h"
#include "script.h"
#include "item.h"
typedef struct {
Entity base;
s16 unk68;
s16 unk6a;
s16 unk6c;
s16 timer;
s16 currentCuccos;
s16 targetCuccos;
u16 unk6e;
u8 unk70[0x18];
u8 returnedCuccoTypes[0x18];
} CuccoMinigameEntity;
typedef Entity* CuccoMinigameHeap[10];
u32 sub_080A1514();
u32 CuccoMinigame_GetLevel();
const u16 gUnk_08124C20[] = {
25, 0x2, 25, 0x3, 30, 0x4, 45, 0x5, 50, 0x5, 45, 0x5, 50, 0x6, 60, 0x7, 55, 0x2, 55, 0x3,
};
typedef struct {
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] = {
{ 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 }
};
static const u8 gUnk_08124EA0[] = { 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x0A, 0x01, 0x00, 0x3F, 0x14, 0x01, 0x00, 0x3F, 0x14,
0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x3F, 0x1E, 0x01, 0x00, 0x5C, 0x6E, 0x01, 0x00,
0x5C, 0x6F, 0x01, 0x00, 0x5C, 0x70, 0x01, 0x00, 0x63, 0x00, 0x01, 0x00 };
typedef struct {
u8 item;
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 };
@@ -78,17 +92,17 @@ void CuccoMinigame(CuccoMinigameEntity* this) {
int index;
u32 val;
u8* puVar2;
const u16* ptr;
const CuccoMinigameGoal* ptr;
if (super->action == 0) {
super->action++;
ptr = gUnk_08124C20 + sub_080A1514() * 2;
this->unk68 = ptr[0] * 0x3c;
this->unk6a = 0;
this->unk6c = ptr[1];
ptr = &goalData[CuccoMinigame_GetLevel()];
this->timer = ptr->time * 60;
this->currentCuccos = 0;
this->targetCuccos = ptr->numCuccos;
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;
}
sub_0807DD64(super);
@@ -110,7 +124,7 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMi
sVar6 = 0;
entArray = ((Entity**)super->myHeap);
ptr = this->unk70;
ptr = this->returnedCuccoTypes;
iVar1 = (gRoomControls.origin_x + 0x360);
iVar4 = (gRoomControls.origin_y + 0x350);
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;
if (--this->unk68 < 1) {
if (--this->timer < 1) {
SoundReq(SFX_CUCCO_MINIGAME_BELL);
sub_08050384();
} else {
@@ -163,7 +177,7 @@ void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) {
s8* pcVar2;
int index;
pcVar2 = this->unk70;
pcVar2 = this->returnedCuccoTypes;
puVar1 = super->myHeap;
for (index = 9; index >= 0; index--, pcVar2++, puVar1++) {
@@ -174,8 +188,8 @@ void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) {
}
}
void sub_080A13B4(CuccoMinigameEntity* this, ScriptExecutionContext* context) {
if (this->unk6a >= this->unk6c) {
void CuccoMinigame_Results(CuccoMinigameEntity* this, ScriptExecutionContext* context) {
if (this->currentCuccos >= this->targetCuccos) {
MessageFromTarget(TEXT_INDEX(TEXT_ANJU, 0xc));
context->condition = 1;
} else {
@@ -184,115 +198,115 @@ void sub_080A13B4(CuccoMinigameEntity* this, ScriptExecutionContext* context) {
}
}
void sub_080A13E8(CuccoMinigameEntity* this) {
bool32 bVar2;
const u8* ptr = &gUnk_08124EA0[sub_080A1514() * 4];
void CuccoMinigame_WinItem(CuccoMinigameEntity* this) {
bool32 skipItem;
const CuccoMinigamePrizeData* prize = &prizeData[CuccoMinigame_GetLevel()];
bVar2 = 0;
switch (ptr[0]) {
case 0x3f:
skipItem = 0;
switch (prize->item) {
case ITEM_SHELLS:
if (gSave.stats.hasAllFigurines) {
bVar2 = 1;
skipItem = 1;
}
break;
case 0x5c:
case ITEM_KINSTONE:
if (gSave.didAllFusions) {
bVar2 = 1;
skipItem = 1;
}
break;
case 0x63:
case ITEM_HEART_PIECE:
if (!CheckGlobalFlag(ANJU_HEART)) {
SetGlobalFlag(ANJU_HEART);
break;
}
bVar2 = 1;
skipItem = 1;
break;
}
if (!bVar2) {
InitItemGetSequence(ptr[0], ptr[1], 0);
if (!skipItem) {
InitItemGetSequence(prize->item, prize->subtype, 0);
} else {
this->unk6e = 2;
}
}
void sub_080A1460(CuccoMinigameEntity* this) {
s8* pcVar1;
int iVar2;
void CuccoMinigame_WinRupees(CuccoMinigameEntity* this) {
s8* cuccoTypes;
int index;
s32 rupees;
const u8* ptr;
const u8* rupeeValues;
sub_080A1514();
pcVar1 = this->unk70;
CuccoMinigame_GetLevel(); // Rupees previously dependent on level?
cuccoTypes = this->returnedCuccoTypes;
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
// ptr[*pcVar1] translates to add r0,r3,r0 but should be add r0,r3
u32 temp = *pcVar1;
temp += (int)ptr;
// rupeeValues[*cuccoTypes] translates to add r0,r3,r0 but should be add r0,r3
u32 temp = *cuccoTypes;
temp += (int)rupeeValues;
rupees += *(u8*)temp;
pcVar1++;
cuccoTypes++;
}
ModRupees(rupees);
MessageNoOverlap(TEXT_INDEX(TEXT_ANJU, 0x7), super);
gMessage.rupees = (u16)rupees;
}
void sub_080A14A8(void) {
int iVar1;
void CuccoMinigame_AdvanceLevel(void) {
int level;
iVar1 = sub_080A1514();
iVar1++;
if (iVar1 > 9) {
iVar1 = 9;
level = CuccoMinigame_GetLevel();
level++;
if (level > 9) {
level = 9;
}
if (iVar1 & 1) {
if (level & 1) {
SetGlobalFlag(ANJU_LV_BIT0);
} else {
ClearGlobalFlag(ANJU_LV_BIT0);
}
if (iVar1 & 2) {
if (level & 2) {
SetGlobalFlag(ANJU_LV_BIT1);
} else {
ClearGlobalFlag(ANJU_LV_BIT1);
}
if (iVar1 & 4) {
if (level & 4) {
SetGlobalFlag(ANJU_LV_BIT2);
} else {
ClearGlobalFlag(ANJU_LV_BIT2);
}
if (iVar1 & 8) {
if (level & 8) {
SetGlobalFlag(ANJU_LV_BIT3);
} else {
ClearGlobalFlag(ANJU_LV_BIT3);
}
}
u32 sub_080A1514(void) {
u32 rv = 0;
u32 CuccoMinigame_GetLevel(void) {
u32 level = 0;
if (CheckGlobalFlag(ANJU_LV_BIT0)) {
rv = 1;
level = 1;
}
if (CheckGlobalFlag(ANJU_LV_BIT1)) {
rv |= 2;
level |= 2;
}
if (CheckGlobalFlag(ANJU_LV_BIT2)) {
rv |= 4;
level |= 4;
}
if (CheckGlobalFlag(ANJU_LV_BIT3)) {
rv |= 8;
level |= 8;
}
return rv;
return level;
}
void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
@@ -311,7 +325,7 @@ void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) {
} else {
*(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh =
(ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable);
pCuccoMinigameDef = pCuccoMinigame_MinigameCuccoDefs[sub_080A1514()];
pCuccoMinigameDef = pCuccoMinigame_MinigameCuccoDefs[CuccoMinigame_GetLevel()];
ppEVar5 = (Entity**)pEnt->myHeap;
room = &gRoomControls;
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;
const u16* ptr;
const CuccoMinigameGoal* ptr;
messageIndex = TEXT_INDEX(TEXT_ANJU, 0x2);
if (CheckRoomFlag(1)) {
@@ -343,9 +357,9 @@ void sub_080A1608(void) {
MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0;
ptr = &gUnk_08124C20[sub_080A1514() * 2];
gMessage.rupees = ptr[0];
gMessage.field_0x14 = ptr[1];
ptr = &goalData[CuccoMinigame_GetLevel()];
gMessage.rupees = ptr->time;
gMessage.field_0x14 = ptr->numCuccos;
}
void sub_080A1648(void) {
+6 -6
View File
@@ -22,7 +22,7 @@ extern u16 gUnk_08122B1E[];
extern Coords8 gUnk_08122B2E[]; // TODO struct xy
typedef struct {
Hitbox hit;
u8 _8[4]; // TODO fourth param of sub_08078850
u8 _8[4]; // TODO fourth param of SetInteractableObjectCollision
u8 _c;
} HitboxCfg;
extern HitboxCfg gUnk_08122B3C[];
@@ -395,13 +395,13 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) {
super->action = 1;
super->frameIndex = 0;
super->spritePriority.b0 = 7;
sub_080787B4(super);
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
super->interactType = 0;
super->action = 2;
sub_080788E0(super);
RemoveInteractableObject(super);
gPlayerState.queued_action = PLAYER_EMPTYBOTTLE;
gPlayerState.field_0x38 = 54;
#ifndef EU
@@ -449,13 +449,13 @@ void sub_08095088(CutsceneMiscObjectEntity* this) {
DeleteThisEntity();
super->action = 1;
super->spritePriority.b0 = 7;
sub_080787B4(super);
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
super->interactType = 0;
super->action = 2;
sub_080788E0(super);
RemoveInteractableObject(super);
CreateEzloHint(TEXT_INDEX(TEXT_BELARI, 0x1F), 0);
}
break;
@@ -1322,6 +1322,6 @@ void sub_080962E8(CutsceneMiscObjectEntity* this) {
void sub_080962F8(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) {
HitboxCfg* cfg = &gUnk_08122B3C[ctx->intVariable];
sub_08078850(super, 1, cfg->_c, cfg->_8);
SetInteractableObjectCollision(super, 1, cfg->_c, cfg->_8);
super->hitbox = &cfg->hit;
}
+3 -3
View File
@@ -79,7 +79,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) {
case 0:
if (CheckLocalFlag(SHOP07_TANA)) {
this->unk_7a = 1;
sub_080787B4(super);
AddInteractableCheckableObject(super);
} else {
this->unk_7a = 0;
}
@@ -123,7 +123,7 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) {
switch (this->unk_7a) {
case 0:
this->unk_7a = 1;
sub_080787B4(super);
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
@@ -142,7 +142,7 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) {
default:
if (CheckRoomFlag(2) == 0) {
this->unk_7a = 1;
sub_080787B4(super);
AddInteractableCheckableObject(super);
}
break;
}
+10 -4
View File
@@ -421,10 +421,17 @@ void sub_0809CB70(FrozenOctorokEntity* this, s32 angle, s32 radius) {
super->z.WORD = super->parent->z.WORD;
}
NONMATCH("asm/non_matching/frozenOctorok/sub_0809CBE4.inc", void sub_0809CBE4(FrozenOctorokEntity* this)) {
this->unk_79 += super->subtimer;
void sub_0809CBE4(FrozenOctorokEntity* this) {
u16 tmp1;
FORCE_REGISTER(u8 tmp4, r4);
u8* tmp3 = &this->unk_79;
tmp1 = super->subtimer;
tmp4 = *tmp3;
tmp1 += tmp4;
this->unk_79 = tmp1;
if ((s8)super->subtimer < 0) {
if (super->timer < -this->unk_79) {
u8 tmp_r0 = super->timer;
if (tmp1 << 0x18 < -tmp_r0 << 0x18) {
super->subtimer = -super->subtimer;
SoundReq(SFX_19E);
}
@@ -433,7 +440,6 @@ NONMATCH("asm/non_matching/frozenOctorok/sub_0809CBE4.inc", void sub_0809CBE4(Fr
SoundReq(SFX_19E);
}
}
END_NONMATCH
void FrozenOctorok_ChangeObjPaletteOfChildren(FrozenOctorokEntity* this, u32 palette) {
u32 index;
+15 -15
View File
@@ -27,14 +27,14 @@ typedef struct {
// not match.
} ModifiedParentEntity;
extern u32 sub_080787D8(Entity*);
extern u32 AddInteractableShopItem(Entity*);
extern void* sub_080784E4(void);
void ItemForSale_Init(ItemForSaleEntity*);
void ItemForSale_Action1(ItemForSaleEntity*);
void ItemForSale_Action2(ItemForSaleEntity*);
void ItemForSale_Action3(ItemForSaleEntity*);
void sub_08081A5C(ItemForSaleEntity*);
void ItemForSale_MakeInteractable(ItemForSaleEntity*);
void sub_080819B4(ItemForSaleEntity*);
void sub_08081AB0(void);
@@ -71,7 +71,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) {
SetDefaultPriority(super, 6);
#endif
super->child = super;
sub_08081A5C(this);
ItemForSale_MakeInteractable(this);
switch (super->timer) {
case 0:
super->hitbox = (Hitbox*)&gUnk_080FD328;
@@ -85,7 +85,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) {
void ItemForSale_Action1(ItemForSaleEntity* this) {
if (super->subAction != 0) {
super->action = 2;
gHUD.unk_2f = 2;
gHUD.rActionPlayerState = 2;
} else {
if (super->type == 0x36) {
if (super->interactType != 0) {
@@ -102,7 +102,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
ResetActiveItems();
gPlayerState.heldObject = 4;
gNewPlayerEntity.unk_74 = super;
gHUD.unk_2f = 2;
gHUD.rActionPlayerState = R_ACTION_DROP;
MessageClose();
}
}
@@ -112,15 +112,15 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
void ItemForSale_Action2(ItemForSaleEntity* this) {
void* ptr;
gHUD.unk_2f = 2;
gHUD.rActionPlayerState = R_ACTION_DROP;
super->spriteSettings.draw = gPlayerEntity.spriteSettings.draw;
if ((gPlayerState.heldObject == 0) || (super != gNewPlayerEntity.unk_74)) {
sub_080819B4(this);
} else {
ptr = sub_080784E4();
if (((*(int*)(ptr + 8) == 0) ||
((*(u8*)(ptr + 1) != 1 || (gHUD.unk_2f = 7, (gPlayerState.playerInput.newInput &
(PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) &&
if (((*(int*)(ptr + 8) == 0) || ((*(u8*)(ptr + 1) != 1 || (gHUD.rActionPlayerState = R_ACTION_SPEAK,
(gPlayerState.playerInput.newInput &
(PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) &&
((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) {
sub_080819B4(this);
}
@@ -142,8 +142,8 @@ void sub_080819B4(ItemForSaleEntity* this) {
gNewPlayerEntity.unk_74 = 0;
ptr = &gHUD;
gRoomVars.shopItemType = 0;
ptr->unk_2c = 0;
ptr->unk_2f = 0;
ptr->rActionInteractObject = R_ACTION_NONE;
ptr->rActionPlayerState = R_ACTION_NONE;
gRoomVars.shopItemType2 = 0;
super->x.HALF.HI = this->unk_80 + gRoomControls.origin_x;
super->y.HALF.HI = this->unk_82 + gRoomControls.origin_y;
@@ -154,13 +154,13 @@ void sub_080819B4(ItemForSaleEntity* this) {
super->collisionLayer = 1;
super->spritePriority.b0 = 4;
UpdateSpriteForCollisionLayer(super);
sub_08081A5C(this);
ItemForSale_MakeInteractable(this);
}
void sub_08081A5C(ItemForSaleEntity* this) {
u32 tmp = sub_080787D8(super);
void ItemForSale_MakeInteractable(ItemForSaleEntity* this) {
u32 tmp = AddInteractableShopItem(super);
if (super->timer == 1) {
gUnk_03003DF0.array[tmp].unk_2 = 0;
gPossibleInteraction.candidates[tmp].interactDirections = 0;
}
}
+2 -2
View File
@@ -117,7 +117,7 @@ void sub_080855E8(LilypadLargeEntity* this) {
super->flags |= 0x20;
if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) {
gPlayerState.flags |= 2;
gPlayerState.flags |= PL_FLAGS2;
if (gPlayerEntity.z.WORD == 0) {
if (gPlayerState.swim_state != 0) {
gPlayerEntity.collisionFlags &= 0xfb;
@@ -258,7 +258,7 @@ void sub_080855E8(LilypadLargeEntity* this) {
this->unk_85 = 0;
}
if ((gPlayerState.flags & 2) != 0) {
if ((gPlayerState.flags & PL_FLAGS2) != 0) {
sub_08085F1C(this);
}
+4 -3
View File
@@ -81,7 +81,7 @@ const struct_0811F730 gUnk_0811F730[] = {
{ { 8, 8 }, { 8, -8 } },
};
const u8 gUnk_0811F740[] = {
const u8 gLockedDoorInteractDirections[] = {
0xBE,
0x7D,
0xEB,
@@ -133,8 +133,9 @@ void LockedDoor_Init(Entity* this) {
this->action = 5;
} else {
this->action = 8;
sub_080787CC(this);
sub_08078850(this, 0, gUnk_0811F740[this->field_0x7c.BYTES.byte2], 0);
AddInteractableSmallKeyLock(this);
SetInteractableObjectCollision(this, 0, gLockedDoorInteractDirections[this->field_0x7c.BYTES.byte2],
NULL);
}
} else {
DeleteThisEntity();
+2 -2
View File
@@ -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();
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ void ObjectA(Entity* this) {
}
DeleteThisEntity();
} else {
sub_080787CC(this);
AddInteractableSmallKeyLock(this);
}
} else if (this->interactType != 0) {
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
+1 -1
View File
@@ -132,7 +132,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) {
if (sub_080896B0()) {
gPlayerState.queued_action = PLAYER_PULL;
gPlayerState.field_0x38 = 0x20;
gPlayerState.flags |= 1;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
super->direction = (gPlayerEntity.animationState ^ 4) << 2;

Some files were not shown because too many files have changed in this diff Show More