mirror of https://github.com/pret/pokeemerald.git
Updated code and formatting
parent
c5d9b7bf85
commit
7b488947a2
|
@ -6,7 +6,7 @@ This feature lets us use any trainer for the elite four mugshot battle intro:
|
|||
|
||||
### First, lets move the mugshot IDs to a constants
|
||||
- Open [include/battle_transition.h](../blob/master/include/battle_transitions.h)
|
||||
- Add `#include "constants/battle_transition.h` to the top
|
||||
- Add `#include "constants/battle_transition.h"` to the top
|
||||
- remove the following:
|
||||
```
|
||||
enum // TRANSITION_MUGSHOT
|
||||
|
@ -52,8 +52,8 @@ Now you can use `MUGSHOT_##` in scripts. This will be relevant later.
|
|||
### Define a new mugshot type
|
||||
At the bottom of `include/battle_transition.h`, replace `B_TRANSITION_COUNT` with:
|
||||
```
|
||||
#define B_TRANSITION_MUGSHOT 42
|
||||
#define B_TRANSITION_COUNT 43
|
||||
B_TRANSITION_MUGSHOT
|
||||
B_TRANSITION_COUNT
|
||||
```
|
||||
|
||||
Now we just need a way to load the appropriate mugshot for this transition type. We'll use a variable that we can set before battles.
|
||||
|
@ -69,25 +69,45 @@ Inside `include/constants/vars.h`, replace an unused variable or add your own: `
|
|||
u8 hasCustomTransition:1;
|
||||
```
|
||||
- Open [src/battle_setup.c](../blob/master/src/battle_setup.c). Find the function `GetTrainerBattleTransition`
|
||||
- Add the following code above Line 816: `if (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR)`
|
||||
```c
|
||||
if (gTrainers[gTrainerBattleOpponent_A].hasCustomTransition)
|
||||
return gTrainers[gTrainerBattleOpponent_A].transition;
|
||||
- Add the following code:
|
||||
```diff
|
||||
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
|
||||
return B_TRANSITION_CHAMPION;
|
||||
|
||||
+ if (gTrainers[gTrainerBattleOpponent_A].hasCustomTransition)
|
||||
+ return gTrainers[gTrainerBattleOpponent_A].transition;
|
||||
+
|
||||
if (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR)
|
||||
{
|
||||
```
|
||||
- In [src/data.c](../blob/master/src/data.c), we need to add `#include "battle_transition.h"` to the top as well.
|
||||
|
||||
### Lets add the actual mugshot loading code
|
||||
- Open [src/battle_transition.c](../blob/master/src/battle_transition.c)
|
||||
- Add `#include "event_data.h"` to the top.
|
||||
- Add `static void Phase2Task_Mugshot(u8 taskId);` in the function declarations. For example, above `static void Phase2Task_Sidney(u8 taskId);`
|
||||
- Add the new transition to `sPhase2_Tasks` by adding `[B_TRANSITION_MUGSHOT] = Phase2Task_Mugshot,` to the array.
|
||||
- Somewhere in the file, add our new function:
|
||||
```c
|
||||
static void Phase2Task_Mugshot(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].tMugshotId = VarGet(VAR_MUGSHOT_ID);
|
||||
Phase2Task_MugShotTransition(taskId);
|
||||
}
|
||||
- Add `static void Task_Mugshot(u8 taskId);` in the function declarations. For example, above `static void Task_Sidney(u8 taskId);`
|
||||
- Add the new transition to `sTasks_Main` by adding `[B_TRANSITION_MUGSHOT] = Task_Mugshot,` to the array.
|
||||
- Add our new function:
|
||||
```diff
|
||||
static void Task_Mugshot(u8 taskId)
|
||||
// Sprite data for trainer sprites in mugshots
|
||||
#define sState data[0]
|
||||
#define sSlideSpeed data[1]
|
||||
#define sSlideAccel data[2]
|
||||
#define sDone data[6]
|
||||
#define sSlideDir data[7]
|
||||
|
||||
+static void Task_Mugshot(u8 taskId)
|
||||
+{
|
||||
+ gTasks[taskId].tMugshotId = VarGet(VAR_MUGSHOT_ID);
|
||||
+ DoMugshotTransition(taskId);
|
||||
+}
|
||||
+
|
||||
static void Task_Sidney(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].tMugshotId = MUGSHOT_SIDNEY;
|
||||
DoMugshotTransition(taskId);
|
||||
}
|
||||
```
|
||||
|
||||
### Add Mugshot Id graphics
|
||||
|
@ -99,44 +119,45 @@ For each mugshot we've added, we need to add an element to the following:
|
|||
|
||||
For example:
|
||||
```diff
|
||||
static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] =
|
||||
static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] =
|
||||
{
|
||||
static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] =
|
||||
static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] =
|
||||
{
|
||||
+ [MUGSHOT_MAY] = TRAINER_PIC_MAY,
|
||||
[MUGSHOT_SIDNEY] = TRAINER_PIC_ELITE_FOUR_SIDNEY,
|
||||
[MUGSHOT_PHOEBE] = TRAINER_PIC_ELITE_FOUR_PHOEBE,
|
||||
[MUGSHOT_GLACIA] = TRAINER_PIC_ELITE_FOUR_GLACIA,
|
||||
[MUGSHOT_DRAKE] = TRAINER_PIC_ELITE_FOUR_DRAKE,
|
||||
[MUGSHOT_CHAMPION] = TRAINER_PIC_CHAMPION_WALLACE,
|
||||
};
|
||||
static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] =
|
||||
{
|
||||
[MUGSHOT_SIDNEY] = TRAINER_PIC_ELITE_FOUR_SIDNEY,
|
||||
[MUGSHOT_PHOEBE] = TRAINER_PIC_ELITE_FOUR_PHOEBE,
|
||||
[MUGSHOT_GLACIA] = TRAINER_PIC_ELITE_FOUR_GLACIA,
|
||||
[MUGSHOT_DRAKE] = TRAINER_PIC_ELITE_FOUR_DRAKE,
|
||||
[MUGSHOT_CHAMPION] = TRAINER_PIC_CHAMPION_WALLACE,
|
||||
};
|
||||
static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] =
|
||||
{
|
||||
+ [MUGSHOT_MAY] = {0x200, 0x200},
|
||||
[MUGSHOT_SIDNEY] = {0x200, 0x200},
|
||||
[MUGSHOT_PHOEBE] = {0x200, 0x200},
|
||||
[MUGSHOT_GLACIA] = {0x1B0, 0x1B0},
|
||||
[MUGSHOT_DRAKE] = {0x1A0, 0x1A0},
|
||||
[MUGSHOT_CHAMPION] = {0x188, 0x188},
|
||||
};
|
||||
static const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] =
|
||||
{
|
||||
[MUGSHOT_SIDNEY] = {0x200, 0x200},
|
||||
[MUGSHOT_PHOEBE] = {0x200, 0x200},
|
||||
[MUGSHOT_GLACIA] = {0x1B0, 0x1B0},
|
||||
[MUGSHOT_DRAKE] = {0x1A0, 0x1A0},
|
||||
[MUGSHOT_CHAMPION] = {0x188, 0x188},
|
||||
};
|
||||
static const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] =
|
||||
{
|
||||
+ [MUGSHOT_MAY] = {0, 0},
|
||||
[MUGSHOT_SIDNEY] = {0, 0},
|
||||
[MUGSHOT_PHOEBE] = {0, 0},
|
||||
[MUGSHOT_GLACIA] = {-4, 4},
|
||||
[MUGSHOT_DRAKE] = {0, 5},
|
||||
[MUGSHOT_CHAMPION] = {-8, 7},
|
||||
};
|
||||
static const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] =
|
||||
{
|
||||
[MUGSHOT_SIDNEY] = {0, 0},
|
||||
[MUGSHOT_PHOEBE] = {0, 0},
|
||||
[MUGSHOT_GLACIA] = {-4, 4},
|
||||
[MUGSHOT_DRAKE] = {0, 5},
|
||||
[MUGSHOT_CHAMPION] = {-8, 7},
|
||||
};
|
||||
static const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] =
|
||||
{
|
||||
+ [MUGSHOT_MAY] = sMugshotPal_Glacia,
|
||||
[MUGSHOT_SIDNEY] = sMugshotPal_Sidney,
|
||||
[MUGSHOT_PHOEBE] = sMugshotPal_Phoebe,
|
||||
[MUGSHOT_GLACIA] = sMugshotPal_Glacia,
|
||||
[MUGSHOT_DRAKE] = sMugshotPal_Drake,
|
||||
[MUGSHOT_CHAMPION] = sMugshotPal_Champion
|
||||
};
|
||||
[MUGSHOT_SIDNEY] = sMugshotPal_Sidney,
|
||||
[MUGSHOT_PHOEBE] = sMugshotPal_Phoebe,
|
||||
[MUGSHOT_GLACIA] = sMugshotPal_Glacia,
|
||||
[MUGSHOT_DRAKE] = sMugshotPal_Drake,
|
||||
[MUGSHOT_CHAMPION] = sMugshotPal_Champion
|
||||
};
|
||||
```
|
||||
In `sOpponentMugshotsPals`, we reuse Glacia's pink background palette, but you can change this as you see fit or create your own custom palette.
|
||||
|
||||
### Change Relevant Trainer Data
|
||||
- Open [src/data/trainers.h](../blob/master/src/data/trainers.h)
|
||||
|
|
Loading…
Reference in New Issue