summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-06-02 15:14:05 -0400
committerscnorton <scnorton@biociphers.org>2017-06-02 15:14:05 -0400
commit1ef73db9299a79bdb3db15140d8ee59ada985aa9 (patch)
tree4554802540f56fdb3ea5535081b3cc64be85db41
parentce6dc3665fd4a90807dae239065610b9a27e9726 (diff)
sub_80FF474
-rwxr-xr-xasm/decoration.s134
-rw-r--r--include/decoration.h8
-rw-r--r--src/decoration.c29
3 files changed, 36 insertions, 135 deletions
diff --git a/asm/decoration.s b/asm/decoration.s
index b28e6b85a..b6e217919 100755
--- a/asm/decoration.s
+++ b/asm/decoration.s
@@ -8,140 +8,6 @@
.equiv ewram_1f000, 0x0201f000
- thumb_func_start sub_80FF474
-sub_80FF474: @ 80FF474
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0x4
- movs r6, 0
- ldr r0, _080FF54C @ =gMapHeader
- mov r8, r0
- ldr r1, _080FF550 @ =gSpecialVar_0x8005
- mov r9, r1
- ldr r2, _080FF554 @ =gSpecialVar_0x8006
- mov r10, r2
- ldr r7, _080FF558 @ =gSaveBlock1
-_080FF490:
- adds r5, r6, 0
- adds r5, 0xAE
- adds r4, r5, 0
- adds r0, r4, 0
- bl FlagGet
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _080FF570
- adds r0, r4, 0
- bl FlagReset
- movs r2, 0
- mov r4, r8
- ldr r0, [r4, 0x4]
- ldrb r6, [r0]
- cmp r2, r6
- bcs _080FF4E0
- ldr r0, [r0, 0x4]
- ldrh r0, [r0, 0x14]
- cmp r0, r5
- beq _080FF4E0
- ldr r0, _080FF54C @ =gMapHeader
- ldr r3, [r0, 0x4]
- ldrb r6, [r3]
- adds r4, r5, 0
-_080FF4C6:
- adds r0, r2, 0x1
- lsls r0, 24
- lsrs r2, r0, 24
- cmp r2, r6
- bcs _080FF4E0
- ldr r0, [r3, 0x4]
- lsls r1, r2, 1
- adds r1, r2
- lsls r1, 3
- adds r1, r0
- ldrh r0, [r1, 0x14]
- cmp r0, r4
- bne _080FF4C6
-_080FF4E0:
- mov r1, r8
- ldr r0, [r1, 0x4]
- ldr r1, [r0, 0x4]
- lsls r4, r2, 1
- adds r4, r2
- lsls r4, 3
- adds r1, r4, r1
- ldr r2, _080FF55C @ =0x00003f20
- adds r0, r2, 0
- ldrb r1, [r1, 0x1]
- adds r0, r1
- ldr r1, _080FF560 @ =gUnknown_02038900
- ldr r1, [r1]
- ldr r1, [r1, 0x1C]
- ldrh r1, [r1]
- bl VarSet
- mov r5, r8
- ldr r0, [r5, 0x4]
- ldr r0, [r0, 0x4]
- adds r4, r0
- ldrb r0, [r4]
- mov r6, r9
- strh r0, [r6]
- ldr r1, _080FF564 @ =gUnknown_020391A4
- ldrh r1, [r1]
- mov r2, r10
- strh r1, [r2]
- ldr r1, _080FF568 @ =gUnknown_020391A6
- ldrh r1, [r1]
- ldr r4, _080FF56C @ =gSpecialVar_0x8007
- strh r1, [r4]
- ldrb r1, [r7, 0x5]
- ldrb r2, [r7, 0x4]
- bl show_sprite
- ldrb r0, [r6]
- ldrb r1, [r7, 0x5]
- ldrb r2, [r7, 0x4]
- mov r5, r10
- movs r6, 0
- ldrsh r3, [r5, r6]
- movs r5, 0
- ldrsh r4, [r4, r5]
- str r4, [sp]
- bl sub_805C0F8
- mov r6, r9
- ldrb r0, [r6]
- ldrb r1, [r7, 0x5]
- ldrb r2, [r7, 0x4]
- bl sub_805C78C
- b _080FF57A
- .align 2, 0
-_080FF54C: .4byte gMapHeader
-_080FF550: .4byte gSpecialVar_0x8005
-_080FF554: .4byte gSpecialVar_0x8006
-_080FF558: .4byte gSaveBlock1
-_080FF55C: .4byte 0x00003f20
-_080FF560: .4byte gUnknown_02038900
-_080FF564: .4byte gUnknown_020391A4
-_080FF568: .4byte gUnknown_020391A6
-_080FF56C: .4byte gSpecialVar_0x8007
-_080FF570:
- adds r0, r6, 0x1
- lsls r0, 24
- lsrs r6, r0, 24
- cmp r6, 0xD
- bls _080FF490
-_080FF57A:
- add sp, 0x4
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- thumb_func_end sub_80FF474
-
thumb_func_start sub_80FF58C
sub_80FF58C: @ 80FF58C
push {lr}
diff --git a/include/decoration.h b/include/decoration.h
index 34de1dc73..6e4137bcc 100644
--- a/include/decoration.h
+++ b/include/decoration.h
@@ -166,6 +166,7 @@ extern u8 ewram[];
#define ewram_1f000 (*(struct DecoPCPointers *)(ewram + 0x1f000))
extern struct Decoration gDecorations[0x77];
+extern struct Decoration *gUnknown_02038900;
extern u8 *(gUnknown_020388D0[]);
extern u8 gUnknown_020388D4;
@@ -177,8 +178,13 @@ extern u8 gUnknown_020388F5;
extern u8 gUnknown_020388F6;
extern u8 gUnknown_020388D6[16];
extern u8 gUnknown_020388E6[12];
-extern const u16 gUnknown_083EC654[3];
+extern u16 gSpecialVar_0x8005;
+extern u16 gSpecialVar_0x8006;
+extern u16 gSpecialVar_0x8007;
+extern u16 gUnknown_020391A4;
+extern u16 gUnknown_020391A6;
+extern const u16 gUnknown_083EC654[3];
extern const struct DecorationInventory gDecorationInventories[];
extern const u8 *gUnknown_083EC5E4[];
extern const u8 *gUnknown_083EC624[];
diff --git a/src/decoration.c b/src/decoration.c
index f2d4c62a3..a1663e31f 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -12,6 +12,7 @@
#include "field_camera.h"
#include "fieldmap.h"
#include "metatile_behavior.h"
+#include "event_data.h"
#include "decoration.h"
extern Script gUnknown_0815F399;
@@ -715,3 +716,31 @@ void sub_80FF394(u16 mapX, u16 mapY, u16 decIdx)
break;
}
}
+
+void sub_80FF474(void)
+{
+ u8 i;
+ u8 j;
+ for (i=0; i<14; i++)
+ {
+ if (FlagGet(i + 0xae) == 1)
+ {
+ FlagReset(i + 0xae);
+ for (j=0; j<gMapHeader.events->mapObjectCount; j++)
+ {
+ if (gMapHeader.events->mapObjects[j].flagId == i + 0xae)
+ {
+ break;
+ }
+ }
+ VarSet(0x3f20 + gMapHeader.events->mapObjects[j].graphicsId, gUnknown_02038900->tiles[0]);
+ gSpecialVar_0x8005 = gMapHeader.events->mapObjects[j].localId;
+ gSpecialVar_0x8006 = gUnknown_020391A4;
+ gSpecialVar_0x8007 = gUnknown_020391A6;
+ show_sprite(gSpecialVar_0x8005, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup);
+ sub_805C0F8(gSpecialVar_0x8005, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007);
+ sub_805C78C(gSpecialVar_0x8005, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup);
+ break;
+ }
+ }
+}