summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/tv.s48
-rw-r--r--include/global.h4
-rw-r--r--src/secret_base.c6
-rw-r--r--src/tv.c26
4 files changed, 29 insertions, 55 deletions
diff --git a/asm/tv.s b/asm/tv.s
index f758ae4fc..9af66c2da 100644
--- a/asm/tv.s
+++ b/asm/tv.s
@@ -2488,54 +2488,6 @@ _080BF1A8:
bx r0
thumb_func_end sub_80BF154
- thumb_func_start sub_80BF1B4
-sub_80BF1B4: @ 80BF1B4
- push {r4-r7,lr}
- lsls r0, 24
- lsrs r6, r0, 24
- ldr r7, _080BF1F4 @ =gSaveBlock1 + 0x2738
- bl GetPlayerTrainerId
- adds r5, r0, 0
- movs r4, 0x5
-_080BF1C4:
- lsls r0, r4, 3
- adds r0, r4
- lsls r0, 2
- adds r1, r0, r7
- ldrb r0, [r1]
- cmp r0, r6
- bne _080BF1F8
- movs r3, 0xFF
- adds r0, r5, 0
- ands r0, r3
- adds r2, r1, 0
- adds r2, 0x22
- ldrb r2, [r2]
- cmp r0, r2
- bne _080BF1F8
- lsrs r0, r5, 8
- ands r0, r3
- adds r1, 0x23
- ldrb r1, [r1]
- cmp r0, r1
- bne _080BF1F8
- movs r0, 0x1
- b _080BF204
- .align 2, 0
-_080BF1F4: .4byte gSaveBlock1 + 0x2738
-_080BF1F8:
- adds r0, r4, 0x1
- lsls r0, 24
- lsrs r4, r0, 24
- cmp r4, 0x17
- bls _080BF1C4
- movs r0, 0
-_080BF204:
- pop {r4-r7}
- pop {r1}
- bx r1
- thumb_func_end sub_80BF1B4
-
.section .text_80BF544
thumb_func_start sub_80BFF68
diff --git a/include/global.h b/include/global.h
index 4a82972b5..f8e53f72c 100644
--- a/include/global.h
+++ b/include/global.h
@@ -194,7 +194,9 @@ struct EasyChatPair
struct TVShowCommon {
/*0x00*/ u8 var00;
/*0x01*/ u8 var01;
- /*0x02*/ u8 pad02[34];
+ /*0x02*/ u8 pad02[32];
+ /*0x22*/ u8 trainerIdLo;
+ /*0x23*/ u8 trainerIdHi;
};
struct TVShowFanClubLetter {
diff --git a/src/secret_base.c b/src/secret_base.c
index 04f14018c..2769806f6 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -30,9 +30,9 @@ extern const struct
} gUnknown_083D1358[7];
extern const u8 gUnknown_083D1374[4 * 16];
extern void *gUnknown_0300485C;
-extern u8 sub_807D770(void);
-extern u8 gUnknown_083D13EC[12];
-extern u8 sub_80BCCA4(u8);
+extern const u8 sub_807D770(void);
+extern const u8 gUnknown_083D13EC[12];
+extern const u8 sub_80BCCA4(u8);
extern u8 gUnknown_081A2E14[];
diff --git a/src/tv.c b/src/tv.c
index 1e955279e..ab030116c 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -55,6 +55,8 @@ extern void sub_80BEBF4(void);
extern u16 gUnknown_020387E0;
extern u16 gUnknown_020387E2;
+u32 GetPlayerTrainerId(void);
+
void ClearTVShowData(void)
{
u8 showidx;
@@ -348,7 +350,7 @@ void sub_80BE97C(bool8 flag)
}
s8 sub_80BF74C(TVShow tvShow[]);
-u8 sub_80BF1B4(s8);
+bool8 sub_80BF1B4(u8);
void sub_80BE9D4()
{
@@ -456,6 +458,26 @@ asm(".section .text_b");
void sub_80BF6D8(void);
void sub_80BF588(TVShow tvShows[]);
+bool8 sub_80BF1B4(u8 showIdx)
+{
+ TVShow *tvShows;
+ u8 i;
+ u32 trainerId;
+ tvShows = gSaveBlock1.tvShows.shows;
+ trainerId = GetPlayerTrainerId();
+ for (i=5; i<24; i++)
+ {
+ if (tvShows[i].common.var00 == showIdx)
+ {
+ if ((trainerId & 0xFF) == tvShows[i].common.trainerIdLo && ((trainerId >> 8) & 0xFF) == tvShows[i].common.trainerIdHi)
+ {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
void sub_80BF20C(void)
{
u8 i, j;
@@ -844,8 +866,6 @@ void sub_80BFAE0(void)
StringGetEnd10(gStringVar1);
}
-u32 GetPlayerTrainerId(void);
-
void sub_80BFB10(void)
{
if (GetPlayerTrainerId() == GetMonData(&(gPlayerParty[gSpecialVar_0x8004]), MON_DATA_OT_ID, 0))