mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
sub_80E933C
This commit is contained in:
parent
09605333c8
commit
9e3bb08e04
@ -5,264 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80E933C
|
||||
sub_80E933C: @ 80E933C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x18
|
||||
bl CurrentMapIsSecretBase
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080E9374
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x0000271c
|
||||
adds r1, r0, r1
|
||||
str r1, [sp, 0x4]
|
||||
ldr r2, =0x00002728
|
||||
adds r2, r0, r2
|
||||
str r2, [sp, 0x8]
|
||||
movs r3, 0xC
|
||||
str r3, [sp, 0x10]
|
||||
b _080E939C
|
||||
.pool
|
||||
_080E9374:
|
||||
ldr r0, =0x00004054
|
||||
bl VarGet
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
ldr r2, =gSaveBlock1Ptr
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 5
|
||||
ldr r4, =0x00001a9c
|
||||
adds r1, r4
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r1, r0, 0
|
||||
adds r1, 0x12
|
||||
str r1, [sp, 0x4]
|
||||
adds r0, 0x22
|
||||
str r0, [sp, 0x8]
|
||||
movs r2, 0x10
|
||||
str r2, [sp, 0x10]
|
||||
_080E939C:
|
||||
movs r6, 0
|
||||
b _080E955A
|
||||
.pool
|
||||
_080E93AC:
|
||||
ldr r4, [sp, 0x4]
|
||||
adds r0, r4, r6
|
||||
ldrb r1, [r0]
|
||||
mov r10, r0
|
||||
adds r0, r6, 0x1
|
||||
str r0, [sp, 0x14]
|
||||
cmp r1, 0
|
||||
bne _080E93BE
|
||||
b _080E9554
|
||||
_080E93BE:
|
||||
mov r1, r10
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 5
|
||||
ldr r2, =gDecorations
|
||||
adds r0, r2
|
||||
ldrb r1, [r0, 0x11]
|
||||
ldrb r0, [r0, 0x13]
|
||||
str r0, [sp, 0xC]
|
||||
cmp r1, 0x4
|
||||
beq _080E93D4
|
||||
b _080E9554
|
||||
_080E93D4:
|
||||
movs r5, 0
|
||||
ldr r0, =gMapHeader
|
||||
ldr r3, [r0, 0x4]
|
||||
ldrb r4, [r3]
|
||||
mov r9, r0
|
||||
cmp r5, r4
|
||||
bcs _080E9412
|
||||
ldr r0, [r3, 0x4]
|
||||
ldrh r2, [r0, 0x14]
|
||||
ldr r1, =gSpecialVar_0x8004
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0xAE
|
||||
adds r7, r1, 0
|
||||
cmp r2, r0
|
||||
beq _080E9412
|
||||
adds r2, r4, 0
|
||||
_080E93F4:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
cmp r5, r2
|
||||
bcs _080E9412
|
||||
ldr r1, [r3, 0x4]
|
||||
lsls r0, r5, 1
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldrh r1, [r0, 0x14]
|
||||
ldrh r0, [r7]
|
||||
adds r0, 0xAE
|
||||
cmp r1, r0
|
||||
bne _080E93F4
|
||||
_080E9412:
|
||||
mov r3, r9
|
||||
ldr r0, [r3, 0x4]
|
||||
ldrb r0, [r0]
|
||||
cmp r5, r0
|
||||
bne _080E941E
|
||||
b _080E9554
|
||||
_080E941E:
|
||||
ldr r4, =gSpecialVar_0x8006
|
||||
mov r8, r4
|
||||
ldr r0, [sp, 0x8]
|
||||
adds r1, r0, r6
|
||||
ldrb r0, [r1]
|
||||
lsrs r0, 4
|
||||
strh r0, [r4]
|
||||
ldr r7, =gSpecialVar_0x8007
|
||||
ldrb r1, [r1]
|
||||
movs r0, 0xF
|
||||
ands r0, r1
|
||||
strh r0, [r7]
|
||||
ldrh r0, [r4]
|
||||
adds r0, 0x7
|
||||
ldrh r1, [r7]
|
||||
adds r1, 0x7
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r0, r4, 0
|
||||
bl MetatileBehavior_IsMB_B5
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
beq _080E9462
|
||||
adds r0, r4, 0
|
||||
bl MetatileBehavior_IsMB_C3
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _080E9554
|
||||
_080E9462:
|
||||
ldr r6, =gScriptResult
|
||||
mov r1, r9
|
||||
ldr r0, [r1, 0x4]
|
||||
ldr r1, [r0, 0x4]
|
||||
lsls r4, r5, 1
|
||||
adds r4, r5
|
||||
lsls r4, 3
|
||||
adds r1, r4, r1
|
||||
ldr r2, =0x00003f20
|
||||
adds r0, r2, 0
|
||||
ldrb r1, [r1, 0x1]
|
||||
adds r0, r1
|
||||
strh r0, [r6]
|
||||
ldrh r0, [r6]
|
||||
mov r3, r10
|
||||
ldrb r1, [r3]
|
||||
lsls r1, 5
|
||||
ldr r2, =gDecorations + 0x1c
|
||||
adds r1, r2
|
||||
ldr r1, [r1]
|
||||
ldrh r1, [r1]
|
||||
bl VarSet
|
||||
mov r3, r9
|
||||
ldr r0, [r3, 0x4]
|
||||
ldr r0, [r0, 0x4]
|
||||
adds r4, r0
|
||||
ldrb r0, [r4]
|
||||
strh r0, [r6]
|
||||
ldr r0, =gSpecialVar_0x8004
|
||||
ldrh r0, [r0]
|
||||
adds r0, 0xAE
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl FlagClear
|
||||
ldrb r0, [r6]
|
||||
ldr r5, =gSaveBlock1Ptr
|
||||
ldr r2, [r5]
|
||||
ldrb r1, [r2, 0x5]
|
||||
ldrb r2, [r2, 0x4]
|
||||
bl show_sprite
|
||||
ldrb r0, [r6]
|
||||
ldr r2, [r5]
|
||||
ldrb r1, [r2, 0x5]
|
||||
ldrb r2, [r2, 0x4]
|
||||
mov r4, r8
|
||||
movs r3, 0
|
||||
ldrsh r4, [r4, r3]
|
||||
mov r8, r4
|
||||
movs r4, 0
|
||||
ldrsh r7, [r7, r4]
|
||||
str r7, [sp]
|
||||
mov r3, r8
|
||||
bl sub_808EBA8
|
||||
ldrb r0, [r6]
|
||||
ldr r2, [r5]
|
||||
ldrb r1, [r2, 0x5]
|
||||
ldrb r2, [r2, 0x4]
|
||||
bl sub_808F254
|
||||
bl CurrentMapIsSecretBase
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _080E954C
|
||||
ldr r0, =0x00004054
|
||||
bl VarGet
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
beq _080E954C
|
||||
ldr r0, [sp, 0xC]
|
||||
cmp r0, 0x6
|
||||
bne _080E9538
|
||||
ldrb r0, [r6]
|
||||
ldr r2, [r5]
|
||||
ldrb r1, [r2, 0x5]
|
||||
ldrb r2, [r2, 0x4]
|
||||
movs r3, 0x6
|
||||
bl sub_808F28C
|
||||
b _080E954C
|
||||
.pool
|
||||
_080E9538:
|
||||
ldr r1, [sp, 0xC]
|
||||
cmp r1, 0x7
|
||||
bne _080E954C
|
||||
ldrb r0, [r6]
|
||||
ldr r2, [r5]
|
||||
ldrb r1, [r2, 0x5]
|
||||
ldrb r2, [r2, 0x4]
|
||||
movs r3, 0x7
|
||||
bl sub_808F28C
|
||||
_080E954C:
|
||||
ldr r1, =gSpecialVar_0x8004
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1]
|
||||
_080E9554:
|
||||
ldr r2, [sp, 0x14]
|
||||
lsls r0, r2, 24
|
||||
lsrs r6, r0, 24
|
||||
_080E955A:
|
||||
ldr r3, [sp, 0x10]
|
||||
cmp r6, r3
|
||||
bcs _080E9562
|
||||
b _080E93AC
|
||||
_080E9562:
|
||||
add sp, 0x18
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E933C
|
||||
|
||||
thumb_func_start sub_80E9578
|
||||
sub_80E9578: @ 80E9578
|
||||
push {r4-r6,lr}
|
||||
|
@ -36,6 +36,7 @@ void npc_load_two_palettes__and_record(u16, u8);
|
||||
void sub_808EBA8(u8, u8, u8, s16, s16);
|
||||
void pal_patch_for_npc(u16, u8);
|
||||
void sub_808E16C(s16, s16);
|
||||
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat);
|
||||
void sub_8092FF0(s16, s16, s16 *, s16 *);
|
||||
u8 FieldObjectDirectionToImageAnimId(u8);
|
||||
void sub_80930E0(s16 *, s16 *, s16, s16);
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef GUARD_VARS_H
|
||||
#define GUARD_VARS_H
|
||||
|
||||
#define VAR_0x3F20 0x3F20
|
||||
|
||||
#define VAR_0x4000 0x4000
|
||||
#define VAR_0x4001 0x4001
|
||||
#define VAR_0x4002 0x4002
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "field_effect_helpers.h"
|
||||
#include "field_camera.h"
|
||||
#include "trainer_see.h"
|
||||
#include "decoration.h"
|
||||
#include "field_map_obj.h"
|
||||
|
||||
#define NUM_FIELD_MAP_OBJECT_TEMPLATES 0x51
|
||||
@ -1755,18 +1756,18 @@ void sub_808F254(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 action)
|
||||
void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat)
|
||||
{
|
||||
u8 mapObjectId;
|
||||
|
||||
if (!TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &mapObjectId))
|
||||
{
|
||||
switch (action)
|
||||
switch (decorCat)
|
||||
{
|
||||
case 6:
|
||||
case DECORCAT_DOLL:
|
||||
sub_808F228(&gMapObjects[mapObjectId], gUnknown_082766A2);
|
||||
break;
|
||||
case 7:
|
||||
case DECORCAT_CUSHION:
|
||||
sub_808F228(&gMapObjects[mapObjectId], gUnknown_082766A6);
|
||||
break;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "field_screen.h"
|
||||
#include "field_weather.h"
|
||||
#include "field_map_obj.h"
|
||||
#include "metatile_behavior.h"
|
||||
#include "map_name_popup.h"
|
||||
#include "text.h"
|
||||
#include "string_util.h"
|
||||
@ -394,3 +395,78 @@ void sub_80E9238(u8 flagIn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80E933C(void)
|
||||
{
|
||||
u8 *roomdecor;
|
||||
u8 *roomdecorpos;
|
||||
u8 decidx;
|
||||
u8 objid;
|
||||
u8 metatile;
|
||||
u8 category;
|
||||
u8 permission;
|
||||
u8 ndecor;
|
||||
u16 curBase;
|
||||
|
||||
objid = 0;
|
||||
if (!CurrentMapIsSecretBase())
|
||||
{
|
||||
roomdecor = gSaveBlock1Ptr->playerRoomDecor;
|
||||
roomdecorpos = gSaveBlock1Ptr->playerRoomDecorPos;
|
||||
ndecor = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
curBase = VarGet(VAR_0x4054);
|
||||
roomdecor = gSaveBlock1Ptr->secretBases[curBase].decorations;
|
||||
roomdecorpos = gSaveBlock1Ptr->secretBases[curBase].decorationPos;
|
||||
ndecor = 16;
|
||||
}
|
||||
for (decidx = 0; decidx < ndecor; decidx ++)
|
||||
{
|
||||
if (roomdecor[decidx] != DECOR_NONE)
|
||||
{
|
||||
permission = gDecorations[roomdecor[decidx]].permission;
|
||||
category = gDecorations[roomdecor[decidx]].category;
|
||||
if (permission == DECORPERM_SOLID_MAT)
|
||||
{
|
||||
for (objid = 0; objid < gMapHeader.events->mapObjectCount; objid ++)
|
||||
{
|
||||
if (gMapHeader.events->mapObjects[objid].flagId == gSpecialVar_0x8004 + 0xAE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (objid == gMapHeader.events->mapObjectCount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
gSpecialVar_0x8006 = roomdecorpos[decidx] >> 4;
|
||||
gSpecialVar_0x8007 = roomdecorpos[decidx] & 0xF;
|
||||
metatile = MapGridGetMetatileBehaviorAt(gSpecialVar_0x8006 + 7, gSpecialVar_0x8007 + 7);
|
||||
if (MetatileBehavior_IsMB_B5(metatile) == TRUE || MetatileBehavior_IsMB_C3(metatile) == TRUE)
|
||||
{
|
||||
gScriptResult = gMapHeader.events->mapObjects[objid].graphicsId + VAR_0x3F20;
|
||||
VarSet(gScriptResult, gDecorations[roomdecor[decidx]].tiles[0]);
|
||||
gScriptResult = gMapHeader.events->mapObjects[objid].localId;
|
||||
FlagClear(gSpecialVar_0x8004 + 0xAE);
|
||||
show_sprite(gScriptResult, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
||||
sub_808EBA8(gScriptResult, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007);
|
||||
sub_808F254(gScriptResult, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
||||
if (CurrentMapIsSecretBase() == TRUE && VarGet(VAR_0x4054) != 0)
|
||||
{
|
||||
if (category == DECORCAT_DOLL)
|
||||
{
|
||||
sub_808F28C(gScriptResult, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, DECORCAT_DOLL);
|
||||
}
|
||||
else if (category == DECORCAT_CUSHION)
|
||||
{
|
||||
sub_808F28C(gScriptResult, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, DECORCAT_CUSHION);
|
||||
}
|
||||
}
|
||||
gSpecialVar_0x8004 ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user