summaryrefslogtreecommitdiff
path: root/Nickname-your-Pokémon-from-the-party-menu.md
blob: bbb54518ea51ff6a42eb58613eb9f6dc149b3f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
###### In Pokémon Let's Go, Pikachu/Eevee, you can nickname your Pokémon from the party menu. Let's implement that feature into pokeemerald!



In **[include/strings.h](https://github.com/pret/pokeemerald/blob/master/include/strings.h)**:

```diff
  extern const u8 gText_Speed[];
  extern const u8 gText_Dash[];
  extern const u8 gText_Plus[];
+ extern const u8 gText_Nickname[];

  //pokedex text
  extern const u8 gText_CryOf[];
```
In **[src/data/party_menu.h](https://github.com/pret/pokeemerald/blob/master/src/data/party_menu.h)**:

```diff
enum
{
    MENU_SUMMARY,
+   MENU_NICKNAME,
    MENU_SWITCH,
    MENU_CANCEL1,
    MENU_ITEM,
```

```diff
} static const sCursorOptions[] =
{
    [MENU_SUMMARY] = {gText_Summary5, CursorCb_Summary},
+   [MENU_NICKNAME] = {gText_Nickname, CursorCb_Nickname},
    [MENU_SWITCH] = {gText_Switch2, CursorCb_Switch},
    [MENU_CANCEL1] = {gText_Cancel2, CursorCb_Cancel1},
    [MENU_ITEM] = {gText_Item, CursorCb_Item},
```

In **[src/party_menu.c](https://github.com/pret/pokeemerald/blob/master/src/party_menu.c)**:

```diff
  static void BlitBitmapToPartyWindow_LeftColumn(u8, u8, u8, u8, u8, u8);
  static void BlitBitmapToPartyWindow_RightColumn(u8, u8, u8, u8, u8, u8);
  static void CursorCb_Summary(u8);
+ static void CursorCb_Nickname(u8);
  static void CursorCb_Switch(u8);
  static void CursorCb_Cancel1(u8);
  static void CursorCb_Item(u8);
```
```diff
sPartyMenuInternal->numActions = 0;
    AppendToList(sPartyMenuInternal->actions, &sPartyMenuInternal->numActions, MENU_SUMMARY);
+   AppendToList(sPartyMenuInternal->actions, &sPartyMenuInternal->numActions, MENU_NICKNAME);

    // Add field moves to action list
    for (i = 0; i < MAX_MON_MOVES; i++)
```
```diff
     Task_ClosePartyMenu(taskId);
}

+ void ChangePokemonNickname(void);
+ static void CursorCb_Nickname(u8 taskId)
+ {
+     PlaySE(SE_SELECT);
+     gSpecialVar_0x8004 = gPartyMenu.slotId;
+     sPartyMenuInternal->exitCallback = ChangePokemonNickname;
+     Task_ClosePartyMenu(taskId);
+ }
+    
static void CB2_ShowPokemonSummaryScreen(void)
{
    if (gPartyMenu.menuType == PARTY_MENU_TYPE_IN_BATTLE)
```

In **[src/party_menu.c](https://github.com/pret/pokeemerald/blob/master/src/party_menu.c)**:

Around Line 125:

```diff
- u8 actions[8];
+ u8 actions [9];
```

Finally, in [src/strings.c](https://github.com/pret/pokeemerald/blob/master/src/strings.c):

```diff
const u8 gText_PokeBalls[] = _("POKé BALLS");
const u8 gText_Berry[] = _("BERRY");
const u8 gText_Berries[] = _("BERRIES");
+ const u8 gText_Nickname[] = _("NICKNAME");
+     
```


## Optional additions:

Technically, you could stop here. But there are a few changes you can make to this feature that will make it better:

# Make it exit to the party screen

This is a pretty simple change, and it makes the experience way better.

In [src/party_menu.c](https://github.com/pret/pokeemerald/blob/master/src/party_menu.c):

```diff
 #include "constants/party_menu.h"
 #include "constants/rgb.h"
 #include "constants/songs.h"
+#include "naming_screen.h"

 
 #define PARTY_PAL_SELECTED     (1 << 0)
 #define PARTY_PAL_FAINTED      (1 << 1)
```
```diff
     Task_ClosePartyMenu(taskId);
 }
 
-void ChangePokemonNickname(void);
+static void ChangePokemonNicknamePartyScreen_CB(void)
+{
+    SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
+    CB2_ReturnToPartyMenuFromSummaryScreen();
+}
+
+static void ChangePokemonNicknamePartyScreen(void)
+{
+    GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
+    GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
+    DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL), GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL), ChangePokemonNicknamePartyScreen_CB);
+}
+
 static void CursorCb_Nickname(u8 taskId)
 {
     PlaySE(SE_SELECT);
     gSpecialVar_0x8004 = gPartyMenu.slotId;
-    sPartyMenuInternal->exitCallback = ChangePokemonNickname;
+    sPartyMenuInternal->exitCallback = ChangePokemonNicknamePartyScreen;
     Task_ClosePartyMenu(taskId);
 }
```