CreateWirelessStatusIndicatorSprite

This commit is contained in:
PikalaxALT 2017-12-03 22:01:06 -05:00
parent d5bc329de7
commit 8b5d6fe5d9
15 changed files with 125 additions and 171 deletions

View File

@ -643,7 +643,7 @@ _080D7C04:
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080D7C56:
pop {r4-r6}
pop {r0}

View File

@ -2128,9 +2128,9 @@ sub_80F6AE8: @ 80F6AE8
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldr r4, =gSprites
ldr r0, =gUnknown_02022B10
ldr r0, =gWirelessStatusIndicatorSpriteId
ldrb r1, [r0]
lsls r0, r1, 4
adds r0, r1

View File

@ -7,98 +7,11 @@
@ file boundary?
thumb_func_start sub_800DFB4
sub_800DFB4: @ 800DFB4
push {r4,r5,lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r1, 24
lsrs r2, r1, 24
cmp r3, 0
bne _0800DFCA
cmp r2, 0
bne _0800DFCA
movs r3, 0xE7
movs r2, 0x8
_0800DFCA:
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x1
bne _0800E024
ldr r0, =gUnknown_082ED5F0
adds r1, r3, 0
movs r3, 0
bl CreateSprite
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
ldr r0, =gSprites
lsls r4, r5, 4
adds r4, r5
lsls r4, 2
adds r4, r0
ldr r0, =0x00001234
strh r0, [r4, 0x3C]
ldr r0, =gUnknown_082ED5E0
ldrh r0, [r0, 0x6]
bl GetSpriteTileStartByTag
strh r0, [r4, 0x3A]
adds r4, 0x3E
ldrb r0, [r4]
movs r1, 0x4
orrs r0, r1
strb r0, [r4]
ldr r0, =gUnknown_02022B10
strb r5, [r0]
b _0800E06A
.pool
_0800E024:
ldr r0, =gUnknown_082ED5F0
adds r1, r3, 0
movs r3, 0
bl CreateSprite
ldr r4, =gUnknown_02022B10
strb r0, [r4]
ldr r5, =gSprites
ldrb r1, [r4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r5
ldr r1, =0x00001234
strh r1, [r0, 0x3C]
ldr r0, =gUnknown_082ED5E0
ldrh r0, [r0, 0x6]
bl GetSpriteTileStartByTag
ldrb r2, [r4]
lsls r1, r2, 4
adds r1, r2
lsls r1, 2
adds r1, r5
strh r0, [r1, 0x3A]
ldrb r1, [r4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r5
adds r0, 0x3E
ldrb r1, [r0]
movs r2, 0x4
orrs r1, r2
strb r1, [r0]
_0800E06A:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_800DFB4
thumb_func_start sub_800E084
sub_800E084: @ 800E084
push {r4,lr}
ldr r4, =gSprites
ldr r3, =gUnknown_02022B10
ldr r3, =gWirelessStatusIndicatorSpriteId
ldrb r1, [r3]
lsls r0, r1, 4
adds r0, r1
@ -139,7 +52,7 @@ _0800E0CA:
thumb_func_start sub_800E0E8
sub_800E0E8: @ 800E0E8
push {r4,lr}
ldr r4, =gUnknown_082ED5E0
ldr r4, =sWirelessStatusIndicatorSpriteSheet
ldrh r0, [r4, 0x6]
bl GetSpriteTileStartByTag
lsls r0, 16
@ -149,9 +62,9 @@ sub_800E0E8: @ 800E0E8
adds r0, r4, 0
bl LoadCompressedObjectPic
_0800E100:
ldr r0, =gUnknown_082ED5E8
ldr r0, =sWirelessStatusIndicatorSpritePalette
bl LoadSpritePalette
ldr r1, =gUnknown_02022B10
ldr r1, =gWirelessStatusIndicatorSpriteId
movs r0, 0xFF
strb r0, [r1]
pop {r4}
@ -215,7 +128,7 @@ sub_800E174: @ 800E174
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r1, =gUnknown_02022B10
ldr r1, =gWirelessStatusIndicatorSpriteId
ldrb r0, [r1]
cmp r0, 0xFF
bne _0800E184
@ -377,7 +290,7 @@ _0800E2B2:
movs r1, 0x84
lsls r1, 3
adds r0, r4, r1
ldr r1, =gUnknown_082ED570
ldr r1, =sWirelessStatusIndicatorOamData
ldr r2, [r1, 0x4]
ldr r1, [r1]
str r1, [r0]

View File

@ -3775,7 +3775,7 @@ _080864E0:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08086506
.pool
_080864FC:
@ -4063,7 +4063,7 @@ _0808676C:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08086792
.pool
_08086788:

View File

@ -764,7 +764,7 @@ _08012BF6:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
movs r0, 0x5
strb r0, [r6, 0x19]
ldrb r1, [r6, 0x13]
@ -2540,7 +2540,7 @@ sub_8013BD8: @ 8013BD8
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldrb r0, [r4, 0xE]
bl sub_81AE70C
ldr r0, =gStringVar1
@ -4319,7 +4319,7 @@ _08014C82:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldr r1, [r5]
ldrb r0, [r5, 0x13]
lsls r0, 5
@ -4816,7 +4816,7 @@ _080150D6:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldrb r0, [r7, 0xE]
bl sub_81AE70C
ldr r0, =gStringVar1
@ -5188,7 +5188,7 @@ _08015452:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldr r0, [r5]
adds r4, r0, 0
adds r4, 0x10
@ -22061,7 +22061,7 @@ _0801DEC8:
bl sub_800E0E8
movs r0, 0xE8
movs r1, 0x96
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_0801DF04:
add sp, 0x4
pop {r4-r6}
@ -28419,7 +28419,7 @@ _08021278:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
adds r0, r5, 0
bl sub_8022730
ldr r0, =gSpriteCoordOffsetY
@ -35628,7 +35628,7 @@ _08024C5A:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08024D20
.pool
_08024C80:
@ -47465,7 +47465,7 @@ _0802AD0C:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldr r1, [r4]
b _0802ADC0
.pool

View File

@ -1100,7 +1100,7 @@ sub_80F90DC: @ 80F90DC
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080F90FE:
pop {r0}
bx r0

View File

@ -563,7 +563,7 @@ _0807765C:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08077B46
.pool
_08077680:
@ -1189,7 +1189,7 @@ _08077C3C:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_08077C50:
ldr r1, =gMain
movs r3, 0x87
@ -7514,7 +7514,7 @@ _0807B0F0:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_0807B110:
ldr r0, =sub_807EA2C
bl SetMainCallback2

View File

@ -198,7 +198,7 @@ _080C2836:
bl sub_800E0E8
movs r0, 0xE6
movs r1, 0x96
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080C2852:
movs r6, 0x1
negs r6, r6

View File

@ -3,52 +3,6 @@
.section .rodata
.align 2
gUnknown_082ED570:: @ 82ED570
.byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00
.align 2
gUnknown_082ED578:: @ 82ED578
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x0005, 0x0010, 0x000a
.2byte 0x000c, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000
.align 2
gUnknown_082ED594:: @ 82ED594
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x000a, 0x0008, 0x0005
.2byte 0xfffe, 0x0000
.align 2
gUnknown_082ED5A8:: @ 82ED5A8
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000
.align 2
gUnknown_082ED5B4:: @ 82ED5B4
.2byte 0x0004, 0x000a, 0x0014, 0x000a, 0xfffe, 0x0000
.align 2
gUnknown_082ED5C0:: @ 82ED5C0
.2byte 0x0018, 0x000a, 0x0004, 0x000a, 0xfffe, 0x0000
.align 2
gUnknown_082ED5CC:: @ 82ED5CC
.4byte gUnknown_082ED578
.4byte gUnknown_082ED594
.4byte gUnknown_082ED5A8
.4byte gUnknown_082ED5B4
.4byte gUnknown_082ED5C0
.align 2
gUnknown_082ED5E0:: @ 82ED5E0
obj_tiles gWirelessLinkIconPic, 0x0380, 0xD431
.align 2
gUnknown_082ED5E8:: @ 82ED5E8
obj_pal gWirelessLinkIconPalette, 0xD432
.align 2
gUnknown_082ED5F0:: @ 82ED5F0
spr_template 0xD431, 0xD432, gUnknown_082ED570, gUnknown_082ED5CC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_082ED608:: @ 82ED608
.byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00

View File

@ -234,7 +234,7 @@ u8 GetLinkPlayerCount(void);
bool32 InUnionRoom(void);
void sub_800E0E8(void);
bool8 sub_800A520(void);
void sub_800DFB4(u8, u8);
void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_800ADF8(void);
void sub_800B488(void);
void sub_800A620(void);

View File

@ -736,7 +736,7 @@ static void CB2_HandleStartBattle(void)
gBattleCommunication[MULTIUSE_STATE] = 2;
}
if (gWirelessCommType)
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else
@ -938,7 +938,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
}
if (gWirelessCommType)
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else
@ -1325,7 +1325,7 @@ static void CB2_HandleStartMultiBattle(void)
gBattleCommunication[MULTIUSE_STATE]++;
}
if (gWirelessCommType)
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else

View File

@ -956,7 +956,7 @@ static void sub_807FAC8(void)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
SetVBlankCallback(VBlankCB0_BerryBlender);
sBerryBlenderData->mainState++;
@ -1162,7 +1162,7 @@ static void sub_8080018(void)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
sBerryBlenderData->mainState++;
break;

View File

@ -405,7 +405,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
if (gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
BlendPalettes(-1,0x10, 0);
gMain.state++;

View File

@ -20,7 +20,7 @@ ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8];
IWRAM_DATA u8 gUnknown_03000D80[16];
IWRAM_DATA u16 gUnknown_03000D90[8];
EWRAM_DATA u8 gUnknown_02022B10 = 0;
EWRAM_DATA u8 gWirelessStatusIndicatorSpriteId = 0;
EWRAM_DATA ALIGNED(4) struct UnkLinkRfuStruct_02022B14 gUnknown_02022B14 = {};
EWRAM_DATA ALIGNED(2) u8 gUnknown_02022B22[8] = {};
EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {};
@ -49,7 +49,7 @@ bool32 sub_8010454(u16 a0);
const u16 gWirelessLinkIconPalette[] = INCBIN_U16("graphics/interface/wireless_link_icon.gbapal");
const u8 gWirelessLinkIconPic[] = INCBIN_U8("graphics/interface/wireless_link_icon.4bpp.lz");
const u8 gUnknown_082ED370[] = {
const u8 sWireless_ASCIItoRSETable[] = {
0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
@ -83,7 +83,7 @@ const u8 gUnknown_082ED370[] = {
0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c,
0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94
};
const u8 gUnknown_082ED470[] = {
const u8 sWireless_RSEtoASCIITable[] = {
0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c,
0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c,
@ -117,6 +117,67 @@ const u8 gUnknown_082ED470[] = {
0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00
};
const struct OamData sWirelessStatusIndicatorOamData = {
.size = 1
};
static const union AnimCmd sWirelessStatusIndicatorAnim0[] = {
// 3 bars
ANIMCMD_FRAME( 4, 5),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME(16, 10),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_JUMP(0)
};
static const union AnimCmd sWirelessStatusIndicatorAnim1[] = {
// 2 bars
ANIMCMD_FRAME( 4, 5),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_FRAME(12, 10),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_JUMP(0)
};
static const union AnimCmd sWirelessStatusIndicatorAnim2[] = {
// 1 bar
ANIMCMD_FRAME(4, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_JUMP(0)
};
static const union AnimCmd sWirelessStatusIndicatorAnim3[] = {
// searching
ANIMCMD_FRAME( 4, 10),
ANIMCMD_FRAME(20, 10),
ANIMCMD_JUMP(0)
};
static const union AnimCmd sWirelessStatusIndicatorAnim4[] = {
// error
ANIMCMD_FRAME(24, 10),
ANIMCMD_FRAME( 4, 10),
ANIMCMD_JUMP(0)
};
static const union AnimCmd *const sWirelessStatusIndicatorAnims[] = {
sWirelessStatusIndicatorAnim0,
sWirelessStatusIndicatorAnim1,
sWirelessStatusIndicatorAnim2,
sWirelessStatusIndicatorAnim3,
sWirelessStatusIndicatorAnim4
};
const struct SpriteSheet sWirelessStatusIndicatorSpriteSheet = {
gWirelessLinkIconPic, 0x0380, 0xD431
};
const struct SpritePalette sWirelessStatusIndicatorSpritePalette = {
gWirelessLinkIconPalette, 0xD432
};
static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
0xD431,
0xD432,
&sWirelessStatusIndicatorOamData,
sWirelessStatusIndicatorAnims,
NULL,
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
};
// .text
@ -1810,7 +1871,7 @@ void PkmnStrToASCII(u8 *q1, const u8 *q2)
for (i = 0; q2[i] != EOS; i++)
{
q1[i] = gUnknown_082ED470[q2[i]];
q1[i] = sWireless_RSEtoASCIITable[q2[i]];
}
q1[i] = 0;
}
@ -1821,7 +1882,7 @@ void ASCIIToPkmnStr(u8 *q1, const u8 *q2)
for (i = 0; q2[i] != 0; i++)
{
q1[i] = gUnknown_082ED370[q2[i]];
q1[i] = sWireless_ASCIItoRSETable[q2[i]];
}
q1[i] = EOS;
}
@ -2013,3 +2074,29 @@ void sub_800DF90(void *buff1, void *buff2)
memcpy(buff1, &gUnknown_02022B14, 13);
memcpy(buff2, gUnknown_02022B22, 8);
}
void CreateWirelessStatusIndicatorSprite(u8 x, u8 y)
{
u8 sprId;
if (x == 0 && y == 0)
{
x = 0xE7;
y = 0x08;
}
if (gUnknown_03007890->unk_00 == 1)
{
sprId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0);
gSprites[sprId].data7 = 0x1234;
gSprites[sprId].data6 = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
gSprites[sprId].invisible = TRUE;
gWirelessStatusIndicatorSpriteId = sprId;
}
else
{
gWirelessStatusIndicatorSpriteId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0);
gSprites[gWirelessStatusIndicatorSpriteId].data7 = 0x1234;
gSprites[gWirelessStatusIndicatorSpriteId].data6 = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
gSprites[gWirelessStatusIndicatorSpriteId].invisible = TRUE;
}
}

View File

@ -180,7 +180,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
break;