- Fixes Seedot and Lotad House to give measurements based on the unit system and decimal seperator chosen by the developer. (#4193)
- Created `ConvertMonHeightToString` and `ConvertMonWeightToString` for developers to use
This commit is contained in:
parent
c21ab741f7
commit
cc22fef6c8
4 changed files with 46 additions and 21 deletions
|
@ -116,7 +116,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_PleaseShowMeBigSeedot:
|
||||||
.string "P-p-please, show me!$"
|
.string "P-p-please, show me!$"
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_GoshMightBeBiggerThanLotad:
|
SootopolisCity_LotadAndSeedotHouse_Text_GoshMightBeBiggerThanLotad:
|
||||||
.string "{STR_VAR_2} inches!\n"
|
.string "{STR_VAR_2}!\n"
|
||||||
.string "Oh, my gosh, this is a big one!\p"
|
.string "Oh, my gosh, this is a big one!\p"
|
||||||
.string "It might even beat the big LOTAD\n"
|
.string "It might even beat the big LOTAD\n"
|
||||||
.string "my younger brother saw!\p"
|
.string "my younger brother saw!\p"
|
||||||
|
@ -132,7 +132,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_BagCrammedFull1:
|
||||||
.string "Your BAG is crammed full.$"
|
.string "Your BAG is crammed full.$"
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_SeenBiggerSeedot:
|
SootopolisCity_LotadAndSeedotHouse_Text_SeenBiggerSeedot:
|
||||||
.string "{STR_VAR_2} inches, is it?\p"
|
.string "{STR_VAR_2}, is it?\p"
|
||||||
.string "Hmm… I've seen a bigger SEEDOT\n"
|
.string "Hmm… I've seen a bigger SEEDOT\n"
|
||||||
.string "than this one.$"
|
.string "than this one.$"
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_DontHaveBigSeedot:
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_BiggestSeedotInHistory:
|
SootopolisCity_LotadAndSeedotHouse_Text_BiggestSeedotInHistory:
|
||||||
.string "The biggest SEEDOT in history!\n"
|
.string "The biggest SEEDOT in history!\n"
|
||||||
.string "{STR_VAR_2}'s {STR_VAR_3}-inch giant!\p"
|
.string "{STR_VAR_2}'s {STR_VAR_3} giant!\p"
|
||||||
.string "A SEEDOT bigger than a LOTAD\n"
|
.string "A SEEDOT bigger than a LOTAD\n"
|
||||||
.string "always wanted!$"
|
.string "always wanted!$"
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_PleaseShowMeBigLotad:
|
||||||
.string "P-p-please show me!$"
|
.string "P-p-please show me!$"
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_WowMightBeBiggerThanSeedot:
|
SootopolisCity_LotadAndSeedotHouse_Text_WowMightBeBiggerThanSeedot:
|
||||||
.string "{STR_VAR_2} inches!\n"
|
.string "{STR_VAR_2}!\n"
|
||||||
.string "Wow, that is big!\p"
|
.string "Wow, that is big!\p"
|
||||||
.string "It might be even bigger than the huge\n"
|
.string "It might be even bigger than the huge\n"
|
||||||
.string "SEEDOT my big brother saw.\p"
|
.string "SEEDOT my big brother saw.\p"
|
||||||
|
@ -180,7 +180,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_BagCrammedFull2:
|
||||||
.string "Your BAG is crammed full.$"
|
.string "Your BAG is crammed full.$"
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_SeenBiggerLotad:
|
SootopolisCity_LotadAndSeedotHouse_Text_SeenBiggerLotad:
|
||||||
.string "{STR_VAR_2} inches?\p"
|
.string "{STR_VAR_2}?\p"
|
||||||
.string "Hmm… I've seen a bigger LOTAD\n"
|
.string "Hmm… I've seen a bigger LOTAD\n"
|
||||||
.string "than this one here.$"
|
.string "than this one here.$"
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ SootopolisCity_LotadAndSeedotHouse_Text_DontHaveBigLotad:
|
||||||
|
|
||||||
SootopolisCity_LotadAndSeedotHouse_Text_BiggestLotadInHistory:
|
SootopolisCity_LotadAndSeedotHouse_Text_BiggestLotadInHistory:
|
||||||
.string "The biggest LOTAD in history!\n"
|
.string "The biggest LOTAD in history!\n"
|
||||||
.string "{STR_VAR_2}'s {STR_VAR_3}-inch colossus!\p"
|
.string "{STR_VAR_2}'s {STR_VAR_3} colossus!\p"
|
||||||
.string "A LOTAD bigger than a SEEDOT\n"
|
.string "A LOTAD bigger than a SEEDOT\n"
|
||||||
.string "always wanted!$"
|
.string "always wanted!$"
|
||||||
|
|
||||||
|
|
|
@ -30,5 +30,7 @@ void ResetPokedexScrollPositions(void);
|
||||||
bool16 HasAllMons(void);
|
bool16 HasAllMons(void);
|
||||||
void CB2_OpenPokedex(void);
|
void CB2_OpenPokedex(void);
|
||||||
void PrintMonMeasurements(u16 species, u32 owned);
|
void PrintMonMeasurements(u16 species, u32 owned);
|
||||||
|
u8* ConvertMonHeightToString(u32 height);
|
||||||
|
u8* ConvertMonWeightToString(u32 weight);
|
||||||
|
|
||||||
#endif // GUARD_POKEDEX_H
|
#endif // GUARD_POKEDEX_H
|
||||||
|
|
|
@ -286,7 +286,7 @@ static u8* ConvertMonHeightToImperialString(u32 height);
|
||||||
static u8* ConvertMonHeightToMetricString(u32 height);
|
static u8* ConvertMonHeightToMetricString(u32 height);
|
||||||
static u8* ConvertMonWeightToImperialString(u32 weight);
|
static u8* ConvertMonWeightToImperialString(u32 weight);
|
||||||
static u8* ConvertMonWeightToMetricString(u32 weight);
|
static u8* ConvertMonWeightToMetricString(u32 weight);
|
||||||
static u8* ConvertMeasurementToMetricString(u16 num, u32* index);
|
static u8* ConvertMeasurementToMetricString(u32 num, u32* index);
|
||||||
static void ResetOtherVideoRegisters(u16);
|
static void ResetOtherVideoRegisters(u16);
|
||||||
static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8);
|
static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8);
|
||||||
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top);
|
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top);
|
||||||
|
@ -4289,15 +4289,20 @@ static void PrintOwnedMonHeight(u16 species)
|
||||||
u32 x = GetMeasurementTextPositions(DEX_MEASUREMENT_X);
|
u32 x = GetMeasurementTextPositions(DEX_MEASUREMENT_X);
|
||||||
u32 yTop = GetMeasurementTextPositions(DEX_Y_TOP);
|
u32 yTop = GetMeasurementTextPositions(DEX_Y_TOP);
|
||||||
|
|
||||||
if (UNITS == UNITS_IMPERIAL)
|
heightString = ConvertMonHeightToString(height);
|
||||||
heightString = ConvertMonHeightToImperialString(height);
|
|
||||||
else
|
|
||||||
heightString = ConvertMonHeightToMetricString(height);
|
|
||||||
|
|
||||||
PrintInfoScreenText(heightString, x, yTop);
|
PrintInfoScreenText(heightString, x, yTop);
|
||||||
Free(heightString);
|
Free(heightString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u8* ConvertMonHeightToString(u32 height)
|
||||||
|
{
|
||||||
|
if (UNITS == UNITS_IMPERIAL)
|
||||||
|
return ConvertMonHeightToImperialString(height);
|
||||||
|
else
|
||||||
|
return ConvertMonHeightToMetricString(height);
|
||||||
|
}
|
||||||
|
|
||||||
static void PrintOwnedMonWeight(u16 species)
|
static void PrintOwnedMonWeight(u16 species)
|
||||||
{
|
{
|
||||||
u32 weight = GetSpeciesWeight(species);
|
u32 weight = GetSpeciesWeight(species);
|
||||||
|
@ -4305,15 +4310,20 @@ static void PrintOwnedMonWeight(u16 species)
|
||||||
u32 x = GetMeasurementTextPositions(DEX_MEASUREMENT_X);
|
u32 x = GetMeasurementTextPositions(DEX_MEASUREMENT_X);
|
||||||
u32 yBottom = GetMeasurementTextPositions(DEX_Y_BOTTOM);
|
u32 yBottom = GetMeasurementTextPositions(DEX_Y_BOTTOM);
|
||||||
|
|
||||||
if (UNITS == UNITS_IMPERIAL)
|
weightString = ConvertMonWeightToString(weight);
|
||||||
weightString = ConvertMonWeightToImperialString(weight);
|
|
||||||
else
|
|
||||||
weightString = ConvertMonWeightToMetricString(weight);
|
|
||||||
|
|
||||||
PrintInfoScreenText(weightString, x, yBottom);
|
PrintInfoScreenText(weightString, x, yBottom);
|
||||||
Free(weightString);
|
Free(weightString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u8* ConvertMonWeightToString(u32 weight)
|
||||||
|
{
|
||||||
|
if (UNITS == UNITS_IMPERIAL)
|
||||||
|
return ConvertMonWeightToImperialString(weight);
|
||||||
|
else
|
||||||
|
return ConvertMonWeightToMetricString(weight);
|
||||||
|
}
|
||||||
|
|
||||||
static u8* ConvertMonHeightToImperialString(u32 height)
|
static u8* ConvertMonHeightToImperialString(u32 height)
|
||||||
{
|
{
|
||||||
u8* heightString = Alloc(WEIGHT_HEIGHT_STR_MEM);
|
u8* heightString = Alloc(WEIGHT_HEIGHT_STR_MEM);
|
||||||
|
@ -4425,7 +4435,7 @@ static u8* ConvertMonWeightToMetricString(u32 weight)
|
||||||
return weightString;
|
return weightString;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8* ConvertMeasurementToMetricString(u16 num, u32* index)
|
static u8* ConvertMeasurementToMetricString(u32 num, u32* index)
|
||||||
{
|
{
|
||||||
u8* string = Alloc(WEIGHT_HEIGHT_STR_MEM);
|
u8* string = Alloc(WEIGHT_HEIGHT_STR_MEM);
|
||||||
bool32 outputted = FALSE;
|
bool32 outputted = FALSE;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
#define DEFAULT_MAX_SIZE 0x8000 // was 0x8100 in Ruby/Sapphire
|
#define DEFAULT_MAX_SIZE 0x8000 // was 0x8100 in Ruby/Sapphire
|
||||||
|
static u8* ReturnHeightStringNoWhitespace(u32 size);
|
||||||
|
|
||||||
struct UnknownStruct
|
struct UnknownStruct
|
||||||
{
|
{
|
||||||
|
@ -93,12 +94,24 @@ static u32 GetMonSize(u16 species, u16 b)
|
||||||
|
|
||||||
static void FormatMonSizeRecord(u8 *string, u32 size)
|
static void FormatMonSizeRecord(u8 *string, u32 size)
|
||||||
{
|
{
|
||||||
//Convert size from centimeters to inches
|
size = (f64)(size / 100);
|
||||||
size = (f64)(size * 10) / (CM_PER_INCH * 10);
|
StringCopy(string,ReturnHeightStringNoWhitespace(size));
|
||||||
|
}
|
||||||
|
|
||||||
string = ConvertIntToDecimalStringN(string, size / 10, STR_CONV_MODE_LEFT_ALIGN, 8);
|
static u8* ReturnHeightStringNoWhitespace(u32 size)
|
||||||
string = StringAppend(string, gText_DecimalPoint);
|
{
|
||||||
ConvertIntToDecimalStringN(string, size % 10, STR_CONV_MODE_LEFT_ALIGN, 1);
|
u8* heightStr = ConvertMonHeightToString(size);
|
||||||
|
u32 length = StringLength(heightStr);
|
||||||
|
u32 i = 0, j = 0;
|
||||||
|
|
||||||
|
while (i < length && !(heightStr[i] >= CHAR_0 && heightStr[i] <= CHAR_9))
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while (i < length)
|
||||||
|
heightStr[j++] = heightStr[i++];
|
||||||
|
|
||||||
|
heightStr[j] = EOS;
|
||||||
|
return heightStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 CompareMonSize(u16 species, u16 *sizeRecord)
|
static u8 CompareMonSize(u16 species, u16 *sizeRecord)
|
||||||
|
|
Loading…
Reference in a new issue