mirror of https://github.com/zeldaret/tmc.git
Merge pull request #214 from octorock/code_080A7C00
Decompile code_080A7C00
This commit is contained in:
commit
ce2a41c7af
|
@ -47,7 +47,7 @@ _0804B168: .4byte gRoomVars
|
|||
thumb_func_start sub_0804B16C
|
||||
sub_0804B16C: @ 0x0804B16C
|
||||
push {r4, lr}
|
||||
ldr r4, _0804B1A4 @ =gUnk_02017660
|
||||
ldr r4, _0804B1A4 @ =gSmallChests
|
||||
_0804B170:
|
||||
ldrh r0, [r4, #4]
|
||||
cmp r0, #0
|
||||
|
@ -75,7 +75,7 @@ _0804B198:
|
|||
blo _0804B170
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_0804B1A4: .4byte gUnk_02017660
|
||||
_0804B1A4: .4byte gSmallChests
|
||||
_0804B1A8: .4byte gPaletteBuffer
|
||||
|
||||
thumb_func_start LoadRoomTileEntities
|
||||
|
@ -202,7 +202,7 @@ sub_0804B290: @ 0x0804B290
|
|||
sub_0804B29C: @ 0x0804B29C
|
||||
push {r4, lr}
|
||||
adds r2, r0, #0
|
||||
ldr r4, _0804B2EC @ =gUnk_02017660
|
||||
ldr r4, _0804B2EC @ =gSmallChests
|
||||
movs r1, #0
|
||||
_0804B2A4:
|
||||
ldrh r0, [r4, #4]
|
||||
|
@ -237,7 +237,7 @@ _0804B2A4:
|
|||
bl sub_0806F704
|
||||
b _0804B2FC
|
||||
.align 2, 0
|
||||
_0804B2EC: .4byte gUnk_02017660
|
||||
_0804B2EC: .4byte gSmallChests
|
||||
_0804B2F0: .4byte gRoomControls
|
||||
_0804B2F4:
|
||||
adds r1, #1
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start CreateItemEntity
|
||||
CreateItemEntity: @ 0x080A7C00
|
||||
push {r4, lr}
|
||||
bl GiveItemWithCutscene
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A7C16
|
||||
ldrb r1, [r4, #0xa]
|
||||
movs r2, #0
|
||||
bl sub_080A276C
|
||||
str r0, [r4, #0x50]
|
||||
_080A7C16:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_080A7C18
|
||||
sub_080A7C18: @ 0x080A7C18
|
||||
push {lr}
|
||||
bl GiveItemWithCutscene
|
||||
adds r2, r0, #0
|
||||
cmp r2, #0
|
||||
beq _080A7C32
|
||||
ldr r0, _080A7C34 @ =gPlayerEntity
|
||||
str r0, [r2, #0x50]
|
||||
ldrb r1, [r2, #0xa]
|
||||
adds r0, r2, #0
|
||||
movs r2, #0
|
||||
bl sub_08078AF0
|
||||
_080A7C32:
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_080A7C34: .4byte gPlayerEntity
|
||||
|
||||
thumb_func_start GiveItemWithCutscene
|
||||
GiveItemWithCutscene: @ 0x080A7C38
|
||||
push {r4, r5, r6, r7, lr}
|
||||
adds r5, r0, #0
|
||||
adds r6, r1, #0
|
||||
adds r7, r2, #0
|
||||
cmp r5, #0x3f
|
||||
bne _080A7C52
|
||||
ldr r0, _080A7C78 @ =gSave
|
||||
adds r0, #0xbb
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #0
|
||||
beq _080A7C52
|
||||
movs r5, #0x57
|
||||
movs r6, #0
|
||||
_080A7C52:
|
||||
bl sub_0805E744
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A7C72
|
||||
strb r5, [r4, #0xa]
|
||||
strb r6, [r4, #0xb]
|
||||
strb r7, [r4, #0xe]
|
||||
movs r0, #0xb
|
||||
strb r0, [r4, #9]
|
||||
movs r0, #6
|
||||
strb r0, [r4, #8]
|
||||
adds r0, r4, #0
|
||||
movs r1, #6
|
||||
bl AppendEntityToList
|
||||
_080A7C72:
|
||||
adds r0, r4, #0
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_080A7C78: .4byte gSave
|
||||
|
||||
thumb_func_start sub_080A7C7C
|
||||
sub_080A7C7C: @ 0x080A7C7C
|
||||
push {lr}
|
||||
ldr r0, _080A7C88 @ =gUnk_02017660
|
||||
movs r1, #0x40
|
||||
bl MemClear
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_080A7C88: .4byte gUnk_02017660
|
||||
|
||||
thumb_func_start sub_080A7C8C
|
||||
sub_080A7C8C: @ 0x080A7C8C
|
||||
push {r4, r5, r6, lr}
|
||||
adds r5, r0, #0
|
||||
adds r6, r1, #0
|
||||
ldr r4, _080A7C9C @ =gUnk_02017660
|
||||
movs r2, #0
|
||||
movs r1, #0
|
||||
b _080A7CA8
|
||||
.align 2, 0
|
||||
_080A7C9C: .4byte gUnk_02017660
|
||||
_080A7CA0:
|
||||
adds r1, #1
|
||||
adds r4, #8
|
||||
cmp r1, #7
|
||||
bhi _080A7CB0
|
||||
_080A7CA8:
|
||||
ldrh r0, [r4, #4]
|
||||
cmp r0, r5
|
||||
bne _080A7CA0
|
||||
movs r2, #1
|
||||
_080A7CB0:
|
||||
lsrs r1, r6, #1
|
||||
ldrb r0, [r4, #6]
|
||||
lsls r0, r0, #0x1f
|
||||
lsrs r0, r0, #0x1f
|
||||
cmp r1, r0
|
||||
bne _080A7CF4
|
||||
cmp r2, #0
|
||||
beq _080A7CD2
|
||||
ldrb r0, [r4, #1]
|
||||
bl SetLocalFlag
|
||||
ldrb r0, [r4, #2]
|
||||
ldrb r1, [r4, #3]
|
||||
movs r2, #0
|
||||
bl CreateItemEntity
|
||||
b _080A7CDC
|
||||
_080A7CD2:
|
||||
movs r0, #0x60
|
||||
movs r1, #0
|
||||
movs r2, #0
|
||||
bl CreateItemEntity
|
||||
_080A7CDC:
|
||||
movs r0, #0x74
|
||||
adds r1, r5, #0
|
||||
adds r2, r6, #0
|
||||
bl sub_0807B7D8
|
||||
movs r0, #0
|
||||
movs r1, #0x78
|
||||
bl RequestPriorityDuration
|
||||
ldr r0, _080A7CF8 @ =0x0000011B
|
||||
bl SoundReq
|
||||
_080A7CF4:
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_080A7CF8: .4byte 0x0000011B
|
||||
|
||||
thumb_func_start sub_080A7CFC
|
||||
sub_080A7CFC: @ 0x080A7CFC
|
||||
push {r4, r5, r6, lr}
|
||||
adds r5, r0, #0
|
||||
movs r4, #0xc0
|
||||
lsls r4, r4, #3
|
||||
movs r6, #0
|
||||
movs r0, #3
|
||||
bl GetCurrentRoomProperty
|
||||
adds r1, r0, #0
|
||||
cmp r1, #0
|
||||
beq _080A7D38
|
||||
_080A7D12:
|
||||
ldrh r0, [r1, #4]
|
||||
cmp r0, r5
|
||||
bne _080A7D30
|
||||
ldrb r0, [r1]
|
||||
cmp r0, #5
|
||||
beq _080A7D24
|
||||
cmp r0, #6
|
||||
beq _080A7D2A
|
||||
b _080A7D38
|
||||
_080A7D24:
|
||||
movs r6, #0
|
||||
ldrh r4, [r1, #6]
|
||||
b _080A7D38
|
||||
_080A7D2A:
|
||||
movs r6, #1
|
||||
ldrh r4, [r1, #6]
|
||||
b _080A7D38
|
||||
_080A7D30:
|
||||
adds r1, #8
|
||||
ldrh r0, [r1, #4]
|
||||
cmp r0, #0
|
||||
bne _080A7D12
|
||||
_080A7D38:
|
||||
adds r0, r4, #0
|
||||
adds r1, r6, #0
|
||||
bl sub_080A7D44
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_080A7D44
|
||||
sub_080A7D44: @ 0x080A7D44
|
||||
push {lr}
|
||||
cmp r1, #0
|
||||
beq _080A7D52
|
||||
movs r1, #0
|
||||
bl sub_08078AA8
|
||||
b _080A7D56
|
||||
_080A7D52:
|
||||
bl MessageFromTarget
|
||||
_080A7D56:
|
||||
pop {pc}
|
|
@ -699,7 +699,7 @@ _08097346:
|
|||
sub_08097348: @ 0x08097348
|
||||
push {lr}
|
||||
adds r3, r0, #0
|
||||
ldr r1, _08097360 @ =gUnk_02017660
|
||||
ldr r1, _08097360 @ =gSmallChests
|
||||
movs r2, #0
|
||||
_08097350:
|
||||
ldrh r0, [r1, #4]
|
||||
|
@ -709,7 +709,7 @@ _08097350:
|
|||
bl CheckLocalFlag
|
||||
b _0809736E
|
||||
.align 2, 0
|
||||
_08097360: .4byte gUnk_02017660
|
||||
_08097360: .4byte gSmallChests
|
||||
_08097364:
|
||||
adds r2, #1
|
||||
adds r1, #8
|
||||
|
|
|
@ -29,7 +29,7 @@ extern Entity* CreateDeathFx(Entity*, u32, u32);
|
|||
extern void UpdateAnimationVariableFrames(Entity*, u32);
|
||||
extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32);
|
||||
extern bool32 LoadFixedGFX(Entity*, u32);
|
||||
extern Entity* CreateItemEntity(u32, u32, u32);
|
||||
extern void CreateItemEntity(u32, u32, u32);
|
||||
extern u32 ProcessMovement(Entity*);
|
||||
extern void MenuFadeIn(u32, u32);
|
||||
extern void LoadResourceAsync(const void*, u32, u32);
|
||||
|
|
|
@ -157,4 +157,30 @@ typedef struct {
|
|||
void* unk8;
|
||||
} WStruct;
|
||||
|
||||
typedef struct {
|
||||
u8 type;
|
||||
u8 unk_0x1;
|
||||
u8 unk_0x2;
|
||||
u8 unk_0x3;
|
||||
u16 tilePos;
|
||||
u16 unk_0x6;
|
||||
} TileEntityData;
|
||||
|
||||
typedef enum {
|
||||
NONE,
|
||||
ROOM_VISIT_MARKER,
|
||||
SMALL_CHEST,
|
||||
BIG_CHEST,
|
||||
BOMBABLE_WALL,
|
||||
SIGN,
|
||||
TILE_ENTITY_6,
|
||||
MUSIC_SETTER,
|
||||
TILE_ENTITY_8,
|
||||
DARKNESS,
|
||||
DESTRUCTIBLE_TILE,
|
||||
GRASS_DROP_CHANGER,
|
||||
TILE_ENTITY_C,
|
||||
TILE_ENTITY_D
|
||||
} TileEntityType;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,7 +65,7 @@ SECTIONS {
|
|||
. = 0x00012654; gMetatilesTop = .;
|
||||
. = 0x00016654; gUnk_02016654 = .;
|
||||
. = 0x00017654; gCurrentRoomProperties = .;
|
||||
. = 0x00017660; gUnk_02017660 = .;
|
||||
. = 0x00017660; gSmallChests = .;
|
||||
. = 0x000176A0; gPaletteBuffer = .;
|
||||
. = 0x000176E0; gUnk_020176E0 = .;
|
||||
. = 0x00017700; gUnk_02017700 = .;
|
||||
|
@ -919,7 +919,7 @@ SECTIONS {
|
|||
src/sub_080A554C.o(.text);
|
||||
asm/code_080A5574.o(.text);
|
||||
src/playerItem/playerItemSword.o(.text);
|
||||
asm/code_080A7C00.o(.text);
|
||||
src/code_080A7C00.o(.text);
|
||||
src/projectileInit.o(.text);
|
||||
src/projectile/darkNutSwordSlash.o(.text);
|
||||
src/projectile/rockProjectile.o(.text);
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
#include "global.h"
|
||||
#include "utils.h"
|
||||
#include "textbox.h"
|
||||
#include "save.h"
|
||||
#include "audio.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
|
||||
extern Entity* GiveItemWithCutscene();
|
||||
extern Entity* sub_080A276C(Entity*, u32, u32);
|
||||
extern void sub_08078AF0(Entity*, u32, u32);
|
||||
extern Entity* sub_0805E744(void);
|
||||
|
||||
extern TileEntityData gSmallChests[8];
|
||||
|
||||
void sub_080A7D44(u32, bool32);
|
||||
|
||||
void CreateItemEntity(u32 type, u32 type2, u32 actionDelay) {
|
||||
Entity* entity = GiveItemWithCutscene(type, type2, actionDelay);
|
||||
if (entity != NULL) {
|
||||
Entity* new_entity = sub_080A276C(entity, entity->type, 0);
|
||||
entity->parent = new_entity;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A7C18(u32 type, u32 type2, u32 actionDelay) {
|
||||
Entity* entity = GiveItemWithCutscene(type, type2, actionDelay);
|
||||
if (entity != NULL) {
|
||||
entity->parent = &gPlayerEntity;
|
||||
sub_08078AF0(entity, entity->type, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Entity* GiveItemWithCutscene(s32 type, u32 type2, u32 actionDelay) {
|
||||
Entity* entity;
|
||||
|
||||
if ((type == 0x3f) && (gSave.stats.filler3[0] != 0)) {
|
||||
type = 0x57;
|
||||
type2 = 0;
|
||||
}
|
||||
entity = sub_0805E744();
|
||||
if (entity != NULL) {
|
||||
entity->type = type;
|
||||
entity->type2 = type2;
|
||||
entity->actionDelay = actionDelay;
|
||||
entity->id = OBJECT_B;
|
||||
entity->kind = OBJECT;
|
||||
AppendEntityToList(entity, 6);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
void ClearSmallChests(void) {
|
||||
MemClear(&gSmallChests, sizeof(gSmallChests));
|
||||
}
|
||||
|
||||
void sub_080A7C8C(u32 tilePos, u32 param_2) {
|
||||
TileEntityData* data = gSmallChests;
|
||||
bool32 found = FALSE;
|
||||
u32 index;
|
||||
for (index = 0; index < 8; data++) {
|
||||
if (data->tilePos == tilePos) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (param_2 >> 1 == ((u32)(*((u8*)&data->unk_0x6) << 0x1f) >> 0x1f)) {
|
||||
if (found) {
|
||||
SetLocalFlag(data->unk_0x1);
|
||||
CreateItemEntity(data->unk_0x2, data->unk_0x3, 0);
|
||||
} else {
|
||||
CreateItemEntity(0x60, 0, 0);
|
||||
}
|
||||
sub_0807B7D8(0x74, tilePos, param_2);
|
||||
RequestPriorityDuration(NULL, 0x78);
|
||||
SoundReq(SFX_11B);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A7CFC(u32 tilePos) {
|
||||
u32 messageId = 0x600;
|
||||
bool32 isTileEntity6 = FALSE;
|
||||
TileEntityData* data = (TileEntityData*)GetCurrentRoomProperty(3);
|
||||
if (data != NULL) {
|
||||
do {
|
||||
if (data->tilePos == tilePos) {
|
||||
switch (data->type) {
|
||||
case SIGN:
|
||||
isTileEntity6 = FALSE;
|
||||
messageId = data->unk_0x6; // message id
|
||||
break;
|
||||
case TILE_ENTITY_6:
|
||||
isTileEntity6 = TRUE;
|
||||
messageId = data->unk_0x6;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
data += 1;
|
||||
} while (data->tilePos != 0);
|
||||
}
|
||||
sub_080A7D44(messageId, isTileEntity6);
|
||||
}
|
||||
|
||||
void sub_080A7D44(u32 messageId, bool32 isTileEntity6) {
|
||||
if (isTileEntity6) {
|
||||
// TILE_ENTITY_6
|
||||
sub_08078AA8(messageId, 0);
|
||||
} else {
|
||||
// Read sign text
|
||||
MessageFromTarget(messageId);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ extern u8 gUnk_081091E4[];
|
|||
|
||||
extern void sub_080186EC();
|
||||
extern void sub_0804B16C();
|
||||
extern void sub_080A7C7C(void);
|
||||
extern void ClearSmallChests(void);
|
||||
extern Entity* GetEmptyEntityByKind(u32 kind);
|
||||
|
||||
void RegisterRoomEntity(Entity*, EntityData*);
|
||||
|
@ -115,7 +115,7 @@ void sub_0804AF0C(Entity* ent, EntityData* dat) {
|
|||
|
||||
void sub_0804AF90(void) {
|
||||
sub_0804AFB0(gArea.pCurrentRoomInfo->properties);
|
||||
sub_080A7C7C();
|
||||
ClearSmallChests();
|
||||
}
|
||||
|
||||
void sub_0804AFB0(void** properties) {
|
||||
|
|
Loading…
Reference in New Issue