Skip to content

Commit c077927

Browse files
authored
Document scripts for pokedex ratings (#763)
1 parent 27724cc commit c077927

File tree

14 files changed

+273
-261
lines changed

14 files changed

+273
-261
lines changed

asm/macros/scrcmd.inc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,10 +1710,18 @@
17101710
.short 290
17111711
.endm
17121712

1713-
.macro ScrCmd_123 arg0, arg1
1713+
.macro LoadPokedexRating hasNationalDex, destVar
17141714
.short 291
1715-
.byte \arg0
1716-
.short \arg1
1715+
.byte \hasNationalDex
1716+
.short \destVar
1717+
.endm
1718+
1719+
.macro LoadLocalDexRating destVar
1720+
LoadPokedexRating FALSE, \destVar
1721+
.endm
1722+
1723+
.macro LoadNationalDexRating destVar
1724+
LoadPokedexRating TRUE, \destVar
17171725
.endm
17181726

17191727
.macro StartWildBattle species, level

generated/text_banks.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN
381381
TEXT_BANK_UNK_0380
382382
TEXT_BANK_FIELD_MOVES
383383
TEXT_BANK_WIFI_PLAZA_ENTRANCE
384-
TEXT_BANK_UNK_0383
384+
TEXT_BANK_POKEDEX_RATINGS
385385
TEXT_BANK_UNK_0384
386386
TEXT_BANK_UNK_0385
387387
TEXT_BANK_CONTEST_ACCESSORY_NAMES

generated/vars_flags.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ FLAG_UNK_0x010C
270270
FLAG_UNK_0x010D
271271
FLAG_UNK_0x010E
272272
FLAG_UNK_0x010F
273-
FLAG_UNK_0x0110
273+
FLAG_SHOWN_COMPLETE_LOCAL_DEX
274274
FLAG_UNK_0x0111
275275
FLAG_UNK_0x0112
276276
FLAG_UNK_0x0113
@@ -2490,7 +2490,7 @@ FLAG_UNK_0x09B6
24902490
FLAG_UNK_0x09B7
24912491
FLAG_UNK_0x09B8
24922492
FLAG_UNK_0x09B9
2493-
FLAG_UNK_0x09BA
2493+
FLAG_FIRST_ARRIVAL_ETERNA_CITY
24942494
FLAG_UNK_0x09BB
24952495
FLAG_UNK_0x09BC
24962496
FLAG_UNK_0x09BD
@@ -4130,7 +4130,8 @@ VAR_MAP_LOCAL_1C
41304130
VAR_MAP_LOCAL_1D
41314131
VAR_MAP_LOCAL_1E
41324132
VAR_MAP_LOCAL_1F
4133-
VAR_OBJ_GFX_ID_0
4133+
OBJ_GFX_VARS_START
4134+
VAR_OBJ_GFX_ID_0 = OBJ_GFX_VARS_START
41344135
VAR_OBJ_GFX_ID_1
41354136
VAR_OBJ_GFX_ID_2
41364137
VAR_OBJ_GFX_ID_3

include/script_manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ enum ScriptContextType {
9393
#define SCRIPT_ID_OFFSET_SAFARI_GAME 8800
9494
#define SCRIPT_ID_OFFSET_INIT_NEW_GAME 9600
9595
#define SCRIPT_ID_OFFSET_FOLLOWER_PARTNERS 9700
96+
#define SCRIPT_ID_OFFSET_POKEDEX_RATINGS 9950
9697
#define SCRIPT_ID_OFFSET_FIELD_MOVES 10000
9798
#define SCRIPT_ID_OFFSET_TV_BROADCAST 10100
9899
#define SCRIPT_ID_OFFSET_TV_REPORTER_INTERVIEWS 10150

include/unk_0205DFC4.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
u16 GetNumberDigitCount(u32 number);
1010
u16 Item_IsTMHM(u16 item);
11-
u16 sub_0205E078(u16 param0, u16 param1);
12-
u16 sub_0205E0E4(u16 param0, u16 param1);
11+
u16 Pokedex_GetRatingMessageID_Local(u16 pokemonSeen, u16 reachedEternaCity);
12+
u16 Pokedex_GetRatingMessageID_National(u16 pokemonCaught, u16 playerGender);
1313
u16 SaveData_GetFirstNonEggInParty(SaveData *saveData);
1414
BOOL HasAllLegendaryTitansInParty(SaveData *saveData);
1515
void sub_0205E318(FieldTask *param0, MapObject *param1, u16 param2, u16 param3, u16 param4, u16 param5);

res/field/scripts/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ scr_seq_files = files(
416416
'scripts_unk_0408.s',
417417
'scripts_field_moves.s',
418418
'scripts_wifi_plaza_entrance.s',
419-
'scripts_unk_0411.s',
419+
'scripts_pokedex_ratings.s',
420420
'scripts_init_new_game.s',
421421
'scripts_berry_tree_interaction.s',
422422
'scripts_verity_lakefront.s',

res/field/scripts/scripts.order

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ scripts_unk_0407
409409
scripts_unk_0408
410410
scripts_field_moves
411411
scripts_wifi_plaza_entrance
412-
scripts_unk_0411
412+
scripts_pokedex_ratings
413413
scripts_init_new_game
414414
scripts_berry_tree_interaction
415415
scripts_verity_lakefront
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#include "macros/scrcmd.inc"
2+
#include "res/text/bank/pokedex_ratings.h"
3+
4+
5+
ScriptEntry PokedexRatings_CheckRowan @ 0x26DE
6+
ScriptEntry PokedexRatings_CheckPC @ 0x26DF
7+
ScriptEntry PokedexRatings_CheckOak @ 0x26E0
8+
ScriptEntry PokedexRatings_CheckNationalDex @ 0x26E1
9+
ScriptEntryEnd
10+
11+
PokedexRatings_CheckRowan:
12+
BufferPlayerName 0
13+
Message PokedexRatings_Text_RowanShowMeYourPokedex
14+
ShowYesNoMenu VAR_RESULT
15+
GoToIfEq VAR_RESULT, MENU_NO, PokedexRatings_CheckRowanDecline
16+
GoTo PokedexRatings_CheckRowanAccept
17+
End
18+
19+
PokedexRatings_CheckRowanDecline:
20+
Message PokedexRatings_Text_RowanAfraidToShowMe
21+
WaitABXPadPress
22+
CloseMessage
23+
ReleaseAll
24+
ReturnCommonScript
25+
End
26+
27+
PokedexRatings_CheckRowanAccept:
28+
Call PokedexRatings_RateLocalDex
29+
CloseMessage
30+
ReleaseAll
31+
ReturnCommonScript
32+
End
33+
34+
PokedexRatings_CheckOak:
35+
BufferPlayerName 0
36+
GetPlayerGender VAR_RESULT
37+
CallIfEq VAR_RESULT, GENDER_MALE, PokedexRatings_OakPromptMessageMale
38+
CallIfEq VAR_RESULT, GENDER_FEMALE, PokedexRatings_OakPromptMessageFemale
39+
ShowYesNoMenu VAR_RESULT
40+
GoToIfEq VAR_RESULT, MENU_NO, PokedexRatings_CheckOakDecline
41+
GoTo PokedexRatings_CheckNationalDex
42+
End
43+
44+
PokedexRatings_OakPromptMessageMale:
45+
Message PokedexRatings_Text_OakShowMeYourPokedex_Male
46+
Return
47+
48+
PokedexRatings_OakPromptMessageFemale:
49+
Message PokedexRatings_Text_OakShowMeYourPokedex_Female
50+
Return
51+
52+
PokedexRatings_CheckOakDecline:
53+
Message PokedexRatings_Text_OakComeSeeMe
54+
WaitABXPadPress
55+
CloseMessage
56+
ReleaseAll
57+
ReturnCommonScript
58+
End
59+
60+
PokedexRatings_CheckNationalDex:
61+
Call PokedexRatings_RateNationalDex
62+
CloseMessage
63+
ReleaseAll
64+
ReturnCommonScript
65+
End
66+
67+
PokedexRatings_CheckPC:
68+
Call PokedexRatings_CheckPCNationalOrLocal
69+
ReturnCommonScript
70+
End
71+
72+
PokedexRatings_CheckPCNationalOrLocal:
73+
GetNationalDexEnabled VAR_RESULT
74+
GoToIfEq VAR_RESULT, FALSE, PokedexRatings_CheckPCLocalDex
75+
GoToIfEq VAR_RESULT, TRUE, PokedexRatings_CheckPCNationalDex
76+
End
77+
78+
PokedexRatings_CheckPCLocalDex:
79+
Message PokedexRatings_Text_AccessedProfessorRowansPC
80+
GoTo PokedexRatings_RateLocalDex
81+
82+
PokedexRatings_CheckPCNationalDex:
83+
Message PokedexRatings_Text_AccessedProfessorOaksPC
84+
GoTo PokedexRatings_RateNationalDex
85+
86+
PokedexRatings_RateLocalDex:
87+
GoToIfUnset FLAG_FIRST_ARRIVAL_ETERNA_CITY, PokedexRatings_JustRateLocalDex
88+
CheckLocalDexCompleted VAR_RESULT
89+
CallIfEq VAR_RESULT, TRUE, PokedexRatings_LocalDexCompleted
90+
PokedexRatings_JustRateLocalDex:
91+
GetLocalDexSeenCount VAR_0x8004
92+
BufferNumber 0, VAR_0x8004
93+
Message PokedexRatings_Text_PokemonSpottedInSinnoh
94+
LoadLocalDexRating VAR_RESULT
95+
BufferPlayerName 0
96+
MessageVar VAR_RESULT
97+
WaitABPress
98+
Return
99+
100+
PokedexRatings_LocalDexCompleted:
101+
SetFlag FLAG_SHOWN_COMPLETE_LOCAL_DEX
102+
Return
103+
104+
PokedexRatings_RateNationalDex:
105+
GetNationalDexCaughtCount VAR_0x8004
106+
GetPlayerGender VAR_0x8005
107+
BufferNumber 0, VAR_0x8004
108+
Message PokedexRatings_Text_PokemonCaughtSoFar
109+
LoadNationalDexRating VAR_RESULT
110+
BufferPlayerName 0
111+
MessageVar VAR_RESULT
112+
WaitABPress
113+
Return
114+
115+
.balign 4, 0

res/field/scripts/scripts_sandgem_town_pokemon_research_lab.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ _00AF:
5151
_00B7:
5252
GetNationalDexEnabled VAR_RESULT
5353
GoToIfEq VAR_RESULT, 1, _07AE
54-
GoToIfUnset FLAG_UNK_0x09BA, _00E5
54+
GoToIfUnset FLAG_FIRST_ARRIVAL_ETERNA_CITY, _00E5
5555
CheckLocalDexCompleted VAR_RESULT
5656
GoToIfEq VAR_RESULT, 1, _060E
5757
_00E5:
@@ -508,7 +508,7 @@ _05FD:
508508
End
509509

510510
_060E:
511-
GoToIfSet FLAG_UNK_0x0110, _0621
511+
GoToIfSet FLAG_SHOWN_COMPLETE_LOCAL_DEX, _0621
512512
GoTo _0631
513513
End
514514

res/field/scripts/scripts_unk_0411.s

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)