@@ -36,7 +36,7 @@ struct BattleBackground
36
36
// .rodata
37
37
static const u16 sUnrefArray [] = {0x0300 , 0x0000 }; //OamData?
38
38
39
- static const struct OamData gUnknown_0831A988 =
39
+ static const struct OamData sVsLetter_V_OamData =
40
40
{
41
41
.y = 0 ,
42
42
.affineMode = 3 ,
@@ -53,7 +53,7 @@ static const struct OamData gUnknown_0831A988 =
53
53
.affineParam = 0 ,
54
54
};
55
55
56
- static const struct OamData gUnknown_0831A990 =
56
+ static const struct OamData sVsLetter_S_OamData =
57
57
{
58
58
.y = 0 ,
59
59
.affineMode = 3 ,
@@ -70,51 +70,53 @@ static const struct OamData gUnknown_0831A990 =
70
70
.affineParam = 0 ,
71
71
};
72
72
73
- static const union AffineAnimCmd gUnknown_0831A998 [] =
73
+ static const union AffineAnimCmd sVsLetterAffineAnimCmds0 [] =
74
74
{
75
75
AFFINEANIMCMD_FRAME (0x0080 , 0x0080 , 0x00 , 0x00 ),
76
76
AFFINEANIMCMD_END ,
77
77
};
78
78
79
- static const union AffineAnimCmd gUnknown_0831A9A8 [] =
79
+ static const union AffineAnimCmd sVsLetterAffineAnimCmds1 [] =
80
80
{
81
81
AFFINEANIMCMD_FRAME (0x0080 , 0x0080 , 0x00 , 0x00 ),
82
82
AFFINEANIMCMD_FRAME (0x0018 , 0x0018 , 0x00 , 0x80 ),
83
83
AFFINEANIMCMD_FRAME (0x0018 , 0x0018 , 0x00 , 0x80 ),
84
84
AFFINEANIMCMD_END ,
85
85
};
86
86
87
- static const union AffineAnimCmd * const gUnknown_0831A9C8 [] =
87
+ static const union AffineAnimCmd * const sVsLetterAffineAnimTable [] =
88
88
{
89
- gUnknown_0831A998 ,
90
- gUnknown_0831A9A8 ,
89
+ sVsLetterAffineAnimCmds0 ,
90
+ sVsLetterAffineAnimCmds1 ,
91
91
};
92
92
93
- static const struct SpriteTemplate gUnknown_0831A9D0 =
93
+ #define TAG_VS_LETTERS 10000
94
+
95
+ static const struct SpriteTemplate sVsLetter_V_SpriteTemplate =
94
96
{
95
- .tileTag = 0x2710 ,
96
- .paletteTag = 0x2710 ,
97
- .oam = & gUnknown_0831A988 ,
97
+ .tileTag = TAG_VS_LETTERS ,
98
+ .paletteTag = TAG_VS_LETTERS ,
99
+ .oam = & sVsLetter_V_OamData ,
98
100
.anims = gDummySpriteAnimTable ,
99
101
.images = NULL ,
100
- .affineAnims = gUnknown_0831A9C8 ,
102
+ .affineAnims = sVsLetterAffineAnimTable ,
101
103
.callback = nullsub_17
102
104
};
103
105
104
- static const struct SpriteTemplate gUnknown_0831A9E8 =
106
+ static const struct SpriteTemplate sVsLetter_S_SpriteTemplate =
105
107
{
106
- .tileTag = 0x2710 ,
107
- .paletteTag = 0x2710 ,
108
- .oam = & gUnknown_0831A990 ,
108
+ .tileTag = TAG_VS_LETTERS ,
109
+ .paletteTag = TAG_VS_LETTERS ,
110
+ .oam = & sVsLetter_S_OamData ,
109
111
.anims = gDummySpriteAnimTable ,
110
112
.images = NULL ,
111
- .affineAnims = gUnknown_0831A9C8 ,
113
+ .affineAnims = sVsLetterAffineAnimTable ,
112
114
.callback = nullsub_17
113
115
};
114
116
115
- static const struct CompressedSpriteSheet gUnknown_0831AA00 =
117
+ static const struct CompressedSpriteSheet sVsLettersSpriteSheet =
116
118
{
117
- gUnknown_08D77B0C , 0x1000 , 0x2710
119
+ gVsLettersGfx , 0x1000 , TAG_VS_LETTERS
118
120
};
119
121
120
122
const struct BgTemplate gBattleBgTemplates [] =
@@ -689,7 +691,6 @@ static const struct BattleBackground gBattleTerrainTable[] =
689
691
},
690
692
};
691
693
692
- // .text
693
694
void BattleInitBgsAndWindows (void )
694
695
{
695
696
ResetBgsAndClearDma3BusyFlags (0 );
@@ -710,7 +711,7 @@ void BattleInitBgsAndWindows(void)
710
711
DeactivateAllTextPrinters ();
711
712
}
712
713
713
- void sub_80356D0 (void )
714
+ void InitBattleBgsVideo (void )
714
715
{
715
716
DisableInterrupts (INTR_FLAG_HBLANK );
716
717
EnableInterrupts (INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL );
@@ -725,10 +726,11 @@ void LoadBattleMenuWindowGfx(void)
725
726
{
726
727
LoadUserWindowBorderGfx (2 , 0x12 , 0x10 );
727
728
LoadUserWindowBorderGfx (2 , 0x22 , 0x10 );
728
- LoadCompressedPalette (gUnknown_08D85600 , 0x50 , 0x20 );
729
+ LoadCompressedPalette (gBattleWindowTextPalette , 0x50 , 0x20 );
729
730
730
731
if (gBattleTypeFlags & BATTLE_TYPE_ARENA )
731
732
{
733
+ // Load graphics for the Battle Arena referee's mid-battle messages.
732
734
Menu_LoadStdPalAt (0x70 );
733
735
LoadMessageBoxGfx (0 , 0x30 , 0x70 );
734
736
gPlttBufferUnfaded [0x76 ] = 0 ;
@@ -837,86 +839,81 @@ void DrawMainBattleBackground(void)
837
839
838
840
void LoadBattleTextboxAndBackground (void )
839
841
{
840
- LZDecompressVram (gBattleTextboxTiles , (void * )(VRAM ));
842
+ LZDecompressVram (gBattleTextboxTiles , (void * )(BG_CHAR_ADDR ( 0 ) ));
841
843
CopyToBgTilemapBuffer (0 , gBattleTextboxTilemap , 0 , 0 );
842
844
CopyBgTilemapBufferToVram (0 );
843
845
LoadCompressedPalette (gBattleTextboxPalette , 0 , 0x40 );
844
846
LoadBattleMenuWindowGfx ();
845
-
846
847
DrawMainBattleBackground ();
847
848
}
848
849
849
- static void sub_8035AE4 (u8 taskId , u8 battlerId , u8 bgId , u8 destX , u8 destY )
850
+ static void DrawLinkBattleParticipantPokeballs (u8 taskId , u8 multiplayerId , u8 bgId , u8 destX , u8 destY )
850
851
{
851
852
s32 i ;
852
- u16 var = 0 ;
853
- u16 src [6 ];
853
+ u16 pokeballStatuses = 0 ;
854
+ u16 tiles [6 ];
854
855
855
856
if (gBattleTypeFlags & BATTLE_TYPE_MULTI )
856
857
{
857
858
if (gTasks [taskId ].data [5 ] != 0 )
858
859
{
859
- switch (battlerId )
860
+ switch (multiplayerId )
860
861
{
861
862
case 0 :
862
- var = 0x3F & gTasks [taskId ].data [3 ];
863
+ pokeballStatuses = 0x3F & gTasks [taskId ].data [3 ];
863
864
break ;
864
865
case 1 :
865
- var = (0xFC0 & gTasks [taskId ].data [4 ]) >> 6 ;
866
+ pokeballStatuses = (0xFC0 & gTasks [taskId ].data [4 ]) >> 6 ;
866
867
break ;
867
868
case 2 :
868
- var = (0xFC0 & gTasks [taskId ].data [3 ]) >> 6 ;
869
+ pokeballStatuses = (0xFC0 & gTasks [taskId ].data [3 ]) >> 6 ;
869
870
break ;
870
871
case 3 :
871
- var = 0x3F & gTasks [taskId ].data [4 ];
872
+ pokeballStatuses = 0x3F & gTasks [taskId ].data [4 ];
872
873
break ;
873
874
}
874
875
}
875
876
else
876
877
{
877
- switch (battlerId )
878
+ switch (multiplayerId )
878
879
{
879
880
case 0 :
880
- var = 0x3F & gTasks [taskId ].data [3 ];
881
+ pokeballStatuses = 0x3F & gTasks [taskId ].data [3 ];
881
882
break ;
882
883
case 1 :
883
- var = 0x3F & gTasks [taskId ].data [4 ];
884
+ pokeballStatuses = 0x3F & gTasks [taskId ].data [4 ];
884
885
break ;
885
886
case 2 :
886
- var = (0xFC0 & gTasks [taskId ].data [3 ]) >> 6 ;
887
+ pokeballStatuses = (0xFC0 & gTasks [taskId ].data [3 ]) >> 6 ;
887
888
break ;
888
889
case 3 :
889
- var = (0xFC0 & gTasks [taskId ].data [4 ]) >> 6 ;
890
+ pokeballStatuses = (0xFC0 & gTasks [taskId ].data [4 ]) >> 6 ;
890
891
break ;
891
892
}
892
893
}
893
894
894
895
for (i = 0 ; i < 3 ; i ++ )
895
- {
896
- src [i ] = ((var & (3 << (i * 2 ))) >> (i * 2 )) + 0x6001 ;
897
- }
896
+ tiles [i ] = ((pokeballStatuses & (3 << (i * 2 ))) >> (i * 2 )) + 0x6001 ;
898
897
899
- CopyToBgTilemapBufferRect_ChangePalette (bgId , src , destX , destY , 3 , 1 , 0x11 );
898
+ CopyToBgTilemapBufferRect_ChangePalette (bgId , tiles , destX , destY , 3 , 1 , 0x11 );
900
899
CopyBgTilemapBufferToVram (bgId );
901
900
}
902
901
else
903
902
{
904
- if (battlerId == gBattleScripting .multiplayerId )
905
- var = gTasks [taskId ].data [3 ];
903
+ if (multiplayerId == gBattleScripting .multiplayerId )
904
+ pokeballStatuses = gTasks [taskId ].data [3 ];
906
905
else
907
- var = gTasks [taskId ].data [4 ];
906
+ pokeballStatuses = gTasks [taskId ].data [4 ];
908
907
909
908
for (i = 0 ; i < 6 ; i ++ )
910
- {
911
- src [i ] = ((var & (3 << (i * 2 ))) >> (i * 2 )) + 0x6001 ;
912
- }
909
+ tiles [i ] = ((pokeballStatuses & (3 << (i * 2 ))) >> (i * 2 )) + 0x6001 ;
913
910
914
- CopyToBgTilemapBufferRect_ChangePalette (bgId , src , destX , destY , 6 , 1 , 0x11 );
911
+ CopyToBgTilemapBufferRect_ChangePalette (bgId , tiles , destX , destY , 6 , 1 , 0x11 );
915
912
CopyBgTilemapBufferToVram (bgId );
916
913
}
917
914
}
918
915
919
- static void sub_8035C4C (void )
916
+ static void DrawLinkBattleVsScreenOutcomeText (void )
920
917
{
921
918
if (gBattleOutcome == B_OUTCOME_DREW )
922
919
{
@@ -997,7 +994,7 @@ static void sub_8035C4C(void)
997
994
}
998
995
}
999
996
1000
- void sub_8035D74 (u8 taskId )
997
+ void InitLinkBattleVsScreen (u8 taskId )
1001
998
{
1002
999
struct LinkPlayer * linkPlayer ;
1003
1000
u8 * name ;
@@ -1017,19 +1014,19 @@ void sub_8035D74(u8 taskId)
1017
1014
{
1018
1015
case 0 :
1019
1016
BattlePutTextOnWindow (name , 0x11 );
1020
- sub_8035AE4 (taskId , linkPlayer -> id , 1 , 2 , 4 );
1017
+ DrawLinkBattleParticipantPokeballs (taskId , linkPlayer -> id , 1 , 2 , 4 );
1021
1018
break ;
1022
1019
case 1 :
1023
1020
BattlePutTextOnWindow (name , 0x12 );
1024
- sub_8035AE4 (taskId , linkPlayer -> id , 2 , 2 , 4 );
1021
+ DrawLinkBattleParticipantPokeballs (taskId , linkPlayer -> id , 2 , 2 , 4 );
1025
1022
break ;
1026
1023
case 2 :
1027
1024
BattlePutTextOnWindow (name , 0x13 );
1028
- sub_8035AE4 (taskId , linkPlayer -> id , 1 , 2 , 8 );
1025
+ DrawLinkBattleParticipantPokeballs (taskId , linkPlayer -> id , 1 , 2 , 8 );
1029
1026
break ;
1030
1027
case 3 :
1031
1028
BattlePutTextOnWindow (name , 0x14 );
1032
- sub_8035AE4 (taskId , linkPlayer -> id , 2 , 2 , 8 );
1029
+ DrawLinkBattleParticipantPokeballs (taskId , linkPlayer -> id , 2 , 2 , 8 );
1033
1030
break ;
1034
1031
}
1035
1032
}
@@ -1049,16 +1046,16 @@ void sub_8035D74(u8 taskId)
1049
1046
name = gLinkPlayers [opponentId ].name ;
1050
1047
BattlePutTextOnWindow (name , 0x10 );
1051
1048
1052
- sub_8035AE4 (taskId , playerId , 1 , 2 , 7 );
1053
- sub_8035AE4 (taskId , opponentId , 2 , 2 , 7 );
1049
+ DrawLinkBattleParticipantPokeballs (taskId , playerId , 1 , 2 , 7 );
1050
+ DrawLinkBattleParticipantPokeballs (taskId , opponentId , 2 , 2 , 7 );
1054
1051
}
1055
1052
gTasks [taskId ].data [0 ]++ ;
1056
1053
break ;
1057
1054
case 1 :
1058
- palId = AllocSpritePalette (0x2710 );
1055
+ palId = AllocSpritePalette (TAG_VS_LETTERS );
1059
1056
gPlttBufferUnfaded [palId * 16 + 0x10F ] = gPlttBufferFaded [palId * 16 + 0x10F ] = 0x7FFF ;
1060
- gBattleStruct -> linkBattleVsSpriteId_V = CreateSprite (& gUnknown_0831A9D0 , 111 , 80 , 0 );
1061
- gBattleStruct -> linkBattleVsSpriteId_S = CreateSprite (& gUnknown_0831A9E8 , 129 , 80 , 0 );
1057
+ gBattleStruct -> linkBattleVsSpriteId_V = CreateSprite (& sVsLetter_V_SpriteTemplate , 111 , 80 , 0 );
1058
+ gBattleStruct -> linkBattleVsSpriteId_S = CreateSprite (& sVsLetter_S_SpriteTemplate , 129 , 80 , 0 );
1062
1059
gSprites [gBattleStruct -> linkBattleVsSpriteId_V ].invisible = TRUE;
1063
1060
gSprites [gBattleStruct -> linkBattleVsSpriteId_S ].invisible = TRUE;
1064
1061
gTasks [taskId ].data [0 ]++ ;
@@ -1087,7 +1084,7 @@ void sub_8035D74(u8 taskId)
1087
1084
else
1088
1085
{
1089
1086
if (gTasks [taskId ].data [5 ] != 0 )
1090
- sub_8035C4C ();
1087
+ DrawLinkBattleVsScreenOutcomeText ();
1091
1088
1092
1089
PlaySE (SE_W231 );
1093
1090
DestroyTask (taskId );
@@ -1110,7 +1107,7 @@ void DrawBattleEntryBackground(void)
1110
1107
if (gBattleTypeFlags & BATTLE_TYPE_LINK )
1111
1108
{
1112
1109
LZDecompressVram (gUnknown_08D778F0 , (void * )(BG_CHAR_ADDR (1 )));
1113
- LZDecompressVram (gUnknown_08D77B0C , (void * )(VRAM + 0x10000 ));
1110
+ LZDecompressVram (gVsLettersGfx , (void * )(VRAM + 0x10000 ));
1114
1111
LoadCompressedPalette (gUnknown_08D77AE4 , 0x60 , 0x20 );
1115
1112
SetBgAttribute (1 , BG_ATTR_SCREENSIZE , 1 );
1116
1113
SetGpuReg (REG_OFFSET_BG1CNT , 0x5C04 );
@@ -1122,7 +1119,7 @@ void DrawBattleEntryBackground(void)
1122
1119
SetGpuReg (REG_OFFSET_WINOUT , 0x36 );
1123
1120
gBattle_BG1_Y = 0xFF5C ;
1124
1121
gBattle_BG2_Y = 0xFF5C ;
1125
- LoadCompressedSpriteSheetUsingHeap (& gUnknown_0831AA00 );
1122
+ LoadCompressedSpriteSheetUsingHeap (& sVsLettersSpriteSheet );
1126
1123
}
1127
1124
else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER ))
1128
1125
{
@@ -1195,7 +1192,7 @@ bool8 LoadChosenBattleElement(u8 caseId)
1195
1192
switch (caseId )
1196
1193
{
1197
1194
case 0 :
1198
- LZDecompressVram (gBattleTextboxTiles , (void * )(VRAM ));
1195
+ LZDecompressVram (gBattleTextboxTiles , (void * )(BG_CHAR_ADDR ( 0 ) ));
1199
1196
break ;
1200
1197
case 1 :
1201
1198
CopyToBgTilemapBuffer (0 , gBattleTextboxTilemap , 0 , 0 );
0 commit comments