mirror of https://github.com/pret/pokeemerald.git
Page:
Add Description Submenu
Pages
Ability Switcher via special
Add A PokeVial Item
Add Ability to Avoid Battle Damage in Debug Menu
Add Ability to Swap Bikes Whenever
Add Choice Specs Scarf hold item effects
Add Description Submenu
Add Difficulty Mode
Add In‐Cart Rumble
Add Nuzlocke Challenge
Add PC Access in PokeNav
Add Physical Special Split
Add Sleep Mode
Add Thief Ball
Add a EV IV Stat Editor UI
Add a debug menu
Adding Multi region Support
Adding Support for Connectivity with Other Hacks Whilst Maintaining Connectivity with Vanilla
Adding Time Based Encounters
Adding Walking Animations to All NPCs
Adding a New Trainer Class
Adding a New Trainer Front Picture
Adding a Pokémon Type & Disabling the Mystery Type
Adding new event object or overworld sprites
All Trees Permanently Get Cut
Allow All Pokemon to Evolve Without Trading
Allow Both Latios and Latias Appear.
Allow Feebas to be caught on any Valid Fishing Spot in Route 119 rather than only Three
Allow Jumping Over Ledges with Acro Bike
Allow Move Relearner to Teach Moves that Pre Evolutions Know
Allow Running From Trainer Battles
Allow running indoors
Amulet Coin Effects If Anyone In Party is Holding It
Automatically make the keyboard switch to lowercase after the first character
Better White Out Money Calculation
Button Press to Skip Copyright Screen
Chain Fishing
Change Enemy Trainer Parties Depending on Difficulty
Change Someone's PC to Lanette's PC from the Start of the Game
Change Starter Pokémon
Change Time Based Evolution Times
Change initial PC items
Changing the Battle Music Depending on the Opponent
Colored stats by nature in summary screen
Converting to FR Tilesets
Custom Battle Mugshots
Custom Border Dimensions
Debugging using gdb (Windows, WSL2, Visual Studio Code mGBA)
Debugging using printf
Disable Bag Use In Battle
Disable Catching Pokemon
Disable Pokémon animation on Birch's intro Pokémon
Disabling Union Room check when entering Pokémon Centers
Dynamic Trade Names
Dynamic overworld palette system
Enable the Reset RTC Feature
Enable trade with FRLG without beating the game
Expanding The Metatile Count
Extra save space with three lines of code
Faster HP Drain
Feature Branches
Fish Will Now Always Get on Hook
Fix AI's Switch In Battle
Fix Snow Weather
Fixing the aspect ratio of the Pokémon logo on the title screen
Forcing Battle Animations for Major Battles
Full Screen Start Menu by Archie and Mudskip
Gen 6 Exp Share
Gen 6 style Exp. Share Alternative Option
Get Match Calls Only If Caller Wants a Rematch
Get Rid of Battery Run Dry Error Message
Get Rid of Pokemon Disobeying You
Holding Select Allows For A Second Register Item
Home
How the Game Works
How to Support Savefile Backwards Compatibility
How to add a new Pokémon species
How to add a new ability
How to add a new region map
How to create a new regular trainer battle
How to delete a map
Implement Missing Text Function RESET_FONT
Implementing Catch EXP
Implementing ipatix's High Quality Audio Mixer
Implementing the “textcolor” script command from FRLG and give object events their own text colour
Improve Partner Battle Code
Improve the Loading of Battle Terrain
Improving the WaitForVBlank function
Increase money limit
Infinite TM usage
Instead of Asking to Stop learning a New Move, You'll be Asked to Continue Learning
Item Automatically Goes to PC if Bag is Full
Keep the Camera from Making Waves
LGPE Style Bonus Premier Balls
Learn moves upon evolution
List Menu Text Coloring
Make Cleanse Tag Avoid All Wild Encounters and Usable If Held By Anyone in Your Party; Make PokeDoll Do the Same for Trainers Seeing You
Make Daycare Faster at Leveling Pokémon
Make Key Items That Cannot Be Used In The Field Not Show A Use or Register Option
Make L Button Be Turbo A When L=A Option Is Set
Make Ledge Jumps Check Collision
Make Move Relearner Teach Egg Moves With A Flag
Make Multiple Secret Bases
Make Norman's Slaking Have Ability Intimidate
Make Pokemon Not Heal When Going into PC
Make Pokemon that Require a Fateful Encounter to be Legal to Always Be Set to Legal
Make space for EWRAM Data for Summary screen
Make the Bag Able to Hold 120 Items Instead of 30
Make the Person in the Intro Match the the Save File
Map Based Trainer Battle Music
Move Item
Multipage Options Menu
Name Rater Allows Traded Pokemon to be Renamed
New Birch's Briefcase With Fully Custom Starters by Archie and Mudskip
New Custom Menu Border Themes (Basic)
New Main Menu UI With Mugshot by Archie and Mudskip
New Options Plus ‐ Multipage Options Menu with Faster Text, HP‐EXP Bar Speeds and Metric
Nickname your Pokémon from the party menu
Not showing dex entries until getting the Pokédex
Omnidirectional Jump
Optimization ‐ Remove Expensive and Redundant `BuildColorMaps()` Function
Option to Skip Copyright and Intro
Overview: Items and their Effects
Overview: The Party Menu
Overview∶ The Game Loop
Overview∶ The Task System
Per Shop\Mart Item Prices
Plural Giveitem
Pokecenters Disregard Eggs
Prompt for reusing Repels
Push B in wild battle moves to Run
Push B to Toggle Running Shoes
Pushing B When Asked To Stop Learning Move Will Cancel Teaching The Move
Quickly Run from a Battle by Holding Right While the Wild Pokémon's Name Appears
Raise Odds of Catching a Pokemon by Pressing B When the Ball Shakes
Random Info, Tips, and Tricks
Reflections
Remove 'Select' Sound From Specific Map Events
Remove Warp Fadescreen
Remove badge boosts
Remove the backup save file
Remove the extra save confirmation
Remove the functionally redundant move grammar tables
Repeated Field Medicine Use
Reuse filler save space for Variables and Flags
Revert Brendan May Sprites to Ruby Sapphire
Set Metatile IDs From Another Map
Set Up Item Balls on a Map Without Needing New Scripts
Shifting to Pokémon Already in Battle Exits the Shift Menu
Shiny Creation With a Flag
Shop Items By Badge Count
Show IVs EVs in Summary Screen
Show Species That You're Switching For in the Party Menu
Show Type Effectiveness In Battle Using Pre Existing Function and Disable in Option Menu
Show a throbber animation while the game is saving
Shuckle makes Berry Juice
Something doesn't work I need help etc.
Spawn Invisible Player
Speedy Nurse Joy
Spinda Second Frame Spot Addition
Stair Warps
Supplementary Scripting Macros
Surfing Dismount Ground Effects
Temporarily Replace Player or Enemy Party Pokemon
The Basics of Scripting
Toggle Trainer Sight
Trainer Backsprite Editing
Trainer Class Based Poké Balls
Trainer Scripts
Trainers No Longer Spin to Face You Right As You Pass Them
Trigger Map Scripts By Flag
Triple layer metatiles
Tutorials
Tweaking the count of health beeps
Uniquely Shuffle Array
Update Sitrus Berry's effect to Gen 4 standard
Use HMs Without Any Pokemon in your Party Knowing Them
Useful Modding Tools
Useful Scripting Specials
Why You Should (Almost) Always Be Using 32‐Bit Variables in Your Code
Why should I use this over binary hacking
11
Add Description Submenu
voloved edited this page 2023-10-20 15:45:29 -04:00
By devolov
Goal: When pushing START
in battle, show the move's stats and description in a sub-menu.
Most of the credit goes to TheXaman's tx_ui_battle_typing system. I just pulled the small parts that I needed to make it easy to see what the move's description and effects are.
-------------------------- include/constants/battle.h --------------------------
index 4dfa31cec8..b1ac50303e 100644
@@ -361,8 +361,12 @@
#define B_WIN_VS_MULTI_PLAYER_4 20
#define B_WIN_VS_OUTCOME_DRAW 21
#define B_WIN_VS_OUTCOME_LEFT 22
#define B_WIN_VS_OUTCOME_RIGHT 23
+#define B_WIN_MOVE_DESCRIPTION 24
// The following are duplicate id values for windows that Battle Arena uses differently.
#define ARENA_WIN_PLAYER_NAME 15
#define ARENA_WIN_VS 16
------------------------------- src/battle_bg.c -------------------------------
index f24bb5d28a..9f76f1e0ff 100644
@@ -376,35 +376,44 @@ static const struct WindowTemplate sStandardBattleWindowTemplates[] =
[B_WIN_VS_OUTCOME_RIGHT] = {
.bg = 0,
.tilemapLeft = 19,
.tilemapTop = 2,
.width = 7,
.height = 2,
.paletteNum = 0,
.baseBlock = 0x00b0,
},
+ [B_WIN_MOVE_DESCRIPTION] = {
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 47,
+ .width = 18,
+ .height = 6,
+ .paletteNum = 5,
+ .baseBlock = 0x0350,
+ },
DUMMY_WIN_TEMPLATE
};
@@ -376,35 +376,44 @@ static const struct WindowTemplate sBattleArenaWindowTemplates[] =
[ARENA_WIN_JUDGMENT_TEXT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 26,
.height = 4,
.paletteNum = 7,
.baseBlock = 0x0090,
},
+ [B_WIN_MOVE_DESCRIPTION] = {
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 47,
+ .width = 18,
+ .height = 6,
+ .paletteNum = 5,
+ .baseBlock = 0x0350,
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sBattleArenaWindowTemplates[] =
------------------------ src/battle_controller_player.c ------------------------
index 6bf2b9d0cb..1d0317c010 100644
@@ -36,8 +36,10 @@
#include "constants/party_menu.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "constants/rgb.h"
+#include "menu.h"
+#include "pokemon_summary_screen.h"
static void PlayerHandleGetMonData(void);
static void PlayerHandleSetMonData(void);
static void PlayerHandleSetRawMonData(void);
@@ -104,8 +106,9 @@ static void MoveSelectionDestroyCursorAt(u8);
static void MoveSelectionDisplayPpNumber(void);
static void MoveSelectionDisplayPpString(void);
static void MoveSelectionDisplayMoveTypeDoubles(u8 targetId, u8 targetIdPrev);
static void MoveSelectionDisplayMoveType(void);
+static void MoveSelectionDisplayMoveDescription(void);
static void MoveSelectionDisplayMoveNames(void);
static void HandleMoveSwitching(void);
static void SwitchIn_HandleSoundAndEnd(void);
static void WaitForMonSelection(void);
@@ -185,8 +188,12 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_ENDLINKBATTLE] = PlayerHandleEndLinkBattle,
[CONTROLLER_TERMINATOR_NOP] = PlayerCmdEnd
};
+static EWRAM_DATA bool8 sDescriptionSubmenu = 0;
+
static const u8 sTargetIdentities[MAX_BATTLERS_COUNT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT};
// unknown unused data
static const u8 sUnused[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58};
@@ -497,9 +504,23 @@ static void HandleInputChooseMove(void)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
- if (JOY_NEW(A_BUTTON))
+ if (JOY_NEW(A_BUTTON) && !sDescriptionSubmenu)
{
u8 moveTarget;
PlaySE(SE_SELECT);
@@ -591,9 +578,9 @@ static void HandleInputChooseMove(void)
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget;
}
}
- else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
+ else if ((JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) && !sDescriptionSubmenu)
{
PlaySE(SE_SELECT);
BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0xFFFF);
PlayerBufferExecCompleted();
@@ -607,8 +594,10 @@ static void HandleInputChooseMove(void)
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
+ if (sDescriptionSubmenu)
+ MoveSelectionDisplayMoveDescription();
}
}
else if (JOY_NEW(DPAD_RIGHT))
{
@@ -620,8 +609,10 @@ static void HandleInputChooseMove(void)
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
+ if (sDescriptionSubmenu)
+ MoveSelectionDisplayMoveDescription();
}
}
else if (JOY_NEW(DPAD_UP))
{
@@ -632,8 +623,10 @@ static void HandleInputChooseMove(void)
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
+ if (sDescriptionSubmenu)
+ MoveSelectionDisplayMoveDescription();
}
}
else if (JOY_NEW(DPAD_DOWN))
{
@@ -645,11 +638,13 @@ static void HandleInputChooseMove(void)
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
+ if (sDescriptionSubmenu)
+ MoveSelectionDisplayMoveDescription();
}
}
- else if (JOY_NEW(SELECT_BUTTON))
+ else if (JOY_NEW(SELECT_BUTTON) && !sDescriptionSubmenu)
{
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
{
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 29);
@@ -633,8 +654,13 @@ static void HandleInputChooseMove(void)
BattlePutTextOnWindow(gText_BattleSwitchWhich, B_WIN_SWITCH_PROMPT);
gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitching;
}
}
+ if (sDescriptionSubmenu)
+ {
+ if (JOY_NEW(START_BUTTON) || JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
+ {
+ sDescriptionSubmenu = FALSE;
+ FillWindowPixelBuffer(B_WIN_MOVE_DESCRIPTION, PIXEL_FILL(0));
+ ClearStdWindowAndFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
+ CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_GFX);
+ PlaySE(SE_SELECT);
+ MoveSelectionDisplayPpNumber();
+ MoveSelectionDisplayMoveType();
+ }
+ }
+ else if (JOY_NEW(START_BUTTON)) //AdditionalBattleInfo
+ {
+ sDescriptionSubmenu = TRUE;
+ MoveSelectionDisplayMoveDescription();
+ }
}
static u32 HandleMoveInputUnused(void)
{
@@ -1574,8 +1600,54 @@ static void MoveSelectionDisplayPpNumber(void)
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_PP_REMAINING);
}
+static void MoveSelectionDisplayMoveDescription(void)
+{
+ struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
+ u16 move = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]];
+ u16 pwr = gBattleMoves[move].power;
+ u16 acc = gBattleMoves[move].accuracy;
+ s16 pri = gBattleMoves[move].priority;
+ u8 pwr_num[3], acc_num[3], pri_num[3], i;
+ u8 pwr_desc[7] = _("PWR: ");
+ u8 acc_desc[7] = _("ACC: ");
+ u8 pri_desc[7] = _("PRI: ");
+ u8 pwr_start[] = _("{CLEAR_TO 0x03}");
+ u8 acc_start[] = _("{CLEAR_TO 0x38}");
+ u8 pri_start[] = _("{CLEAR_TO 0x6D}");
+ LoadMessageBoxAndBorderGfx();
+ DrawStdWindowFrame(B_WIN_MOVE_DESCRIPTION, FALSE);
+ if (pwr < 2)
+ StringCopy(pwr_num, gText_BattleSwitchWhich5);
+ else
+ ConvertIntToDecimalStringN(pwr_num, pwr, STR_CONV_MODE_LEFT_ALIGN, 3);
+ if (acc < 2)
+ StringCopy(acc_num, gText_BattleSwitchWhich5);
+ else
+ ConvertIntToDecimalStringN(acc_num, acc, STR_CONV_MODE_LEFT_ALIGN, 3);
+ ConvertIntToDecimalStringN(pri_num, pri, STR_CONV_MODE_LEFT_ALIGN, 2);
+ StringCopy(gDisplayedStringBattle, pwr_start);
+ StringAppend(gDisplayedStringBattle, pwr_desc);
+ StringAppend(gDisplayedStringBattle, pwr_num);
+ StringAppend(gDisplayedStringBattle, acc_start);
+ StringAppend(gDisplayedStringBattle, acc_desc);
+ StringAppend(gDisplayedStringBattle, acc_num);
+ StringAppend(gDisplayedStringBattle, pri_start);
+ StringAppend(gDisplayedStringBattle, pri_desc);
+ StringAppend(gDisplayedStringBattle, pri_num);
+ StringAppend(gDisplayedStringBattle, gText_NewLine);
+ StringAppend(gDisplayedStringBattle, gMoveDescriptionPointers[move -1]);
+ BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_DESCRIPTION);
+ CopyWindowToVram(B_WIN_MOVE_DESCRIPTION, COPYWIN_FULL);
+}
+
static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum)
{
u16 src[2];
src[0] = baseTileNum + 1;
----------------------------- src/battle_message.c -----------------------------
index 0835dda70c..4949575d00 100644
@@ -1784,9 +1784,9 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_GREEN,
},
+ [B_WIN_MOVE_DESCRIPTION] = {
+ .fillValue = PIXEL_FILL(0xE),
+ .fontId = FONT_NARROW,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .speed = 0,
+ .fgColor = TEXT_DYNAMIC_COLOR_4,
+ .bgColor = TEXT_DYNAMIC_COLOR_5,
+ .shadowColor = TEXT_DYNAMIC_COLOR_6,
+ },
};
static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
{
@@ -1784,9 +1784,9 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.fgColor = TEXT_COLOR_DARK_GRAY,
.bgColor = TEXT_COLOR_WHITE,
.shadowColor = TEXT_COLOR_LIGHT_GRAY,
},
+ [B_WIN_MOVE_DESCRIPTION] = {
+ .fillValue = PIXEL_FILL(0xE),
+ .fontId = FONT_NARROW,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .speed = 0,
+ .fgColor = TEXT_DYNAMIC_COLOR_4,
+ .bgColor = TEXT_DYNAMIC_COLOR_5,
+ .shadowColor = TEXT_DYNAMIC_COLOR_6,
+ },
};
Add this logic into string_util.c
to allow for negative numbers to be shown when displaying the move's priority.
----------------------------- gflib/string_util.c -----------------------------
index 8d969d1bf..88fd34164 100644
u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n)
{
enum { WAITING_FOR_NONZERO_DIGIT, WRITING_DIGITS, WRITING_SPACES } state;
s32 powerOfTen;
s32 largestPowerOfTen = sPowersOfTen[n - 1];
+ bool8 addNegSign = FALSE;
+ if (value < 0)
+ {
+ addNegSign = TRUE;
+ value = abs(value);
+ }
state = WAITING_FOR_NONZERO_DIGIT;
if (mode == STR_CONV_MODE_RIGHT_ALIGN)
state = WRITING_SPACES;
if (mode == STR_CONV_MODE_LEADING_ZEROS)
state = WRITING_DIGITS;
for (powerOfTen = largestPowerOfTen; powerOfTen > 0; powerOfTen /= 10)
{
u8 c;
u16 digit = value / powerOfTen;
s32 temp = value - (powerOfTen * digit);
if (state == WRITING_DIGITS)
{
u8 *out = dest++;
+ if (addNegSign)
+ {
+ addNegSign = FALSE;
+ *out = CHAR_HYPHEN;
+ out = dest++;
+ }
if (digit <= 9)
c = sDigits[digit];
else
c = CHAR_QUESTION_MARK;
*out = c;
}
else if (digit != 0 || powerOfTen == 1)
{
u8 *out;
state = WRITING_DIGITS;
out = dest++;
+ if (addNegSign)
+ {
+ addNegSign = FALSE;
+ *out = CHAR_HYPHEN;
+ out = dest++;
+ }
if (digit <= 9)
c = sDigits[digit];
else
c = CHAR_QUESTION_MARK;
*out = c;
}
else if (state == WRITING_SPACES)
{
*dest++ = CHAR_SPACER;
}
value = temp;
}
*dest = EOS;
return dest;
}
If you're using make
and not make modern
, you'll need to add the battle_controller_player.o
to sym_ewram.txt
to add sDescriptionSubmenu
into EWRAM
.
----------------------------- sym_ewarm.txt -----------------------------
.include "src/pokenav.o"
.include "src/pokenav_list.o"
.include "src/menu_specialized.o"
.include "src/faraway_island.o"
.include "src/trainer_hill.o"
.include "src/rayquaza_scene.o"
+ .include "src/battle_controller_player.o"