mirror of https://github.com/pret/pokeemerald.git
Added ability to see priority if it's a negative number.
parent
c20e8650dd
commit
6813fdbd17
|
@ -214,7 +214,7 @@ index 6bf2b9d0cb..1d0317c010 100644
|
|||
+ u16 move = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]];
|
||||
+ u16 pwr = gBattleMoves[move].power;
|
||||
+ u16 acc = gBattleMoves[move].accuracy;
|
||||
+ u16 pri = gBattleMoves[move].priority;
|
||||
+ 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: ");
|
||||
|
@ -232,7 +232,7 @@ index 6bf2b9d0cb..1d0317c010 100644
|
|||
+ 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, 3);
|
||||
+ ConvertIntToDecimalStringN(pri_num, pri, STR_CONV_MODE_LEFT_ALIGN, 2);
|
||||
+ StringCopy(gDisplayedStringBattle, pwr_start);
|
||||
+ StringAppend(gDisplayedStringBattle, pwr_desc);
|
||||
+ StringAppend(gDisplayedStringBattle, pwr_num);
|
||||
|
@ -299,6 +299,86 @@ index 0835dda70c..4949575d00 100644
|
|||
|
||||
```
|
||||
|
||||
Add this logic into `string_util.c` to allow for negative numbers to be shown when displaying the move's priority.
|
||||
```diff
|
||||
----------------------------- 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`.
|
||||
```diff
|
||||
----------------------------- sym_ewarm.txt -----------------------------
|
||||
|
|
Loading…
Reference in New Issue