-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fly from Pokenav #5679
base: upcoming
Are you sure you want to change the base?
Fly from Pokenav #5679
Changes from 1 commit
0f71be0
2616150
c1c6904
f9f99ba
558b07a
6ccc803
eac320f
1556540
e0ba3a3
991aeff
9c1eed3
d34544a
642849d
6bef85d
a82e70c
da6fddb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,17 +1,21 @@ | ||||||||
#include "global.h" | ||||||||
#include "bg.h" | ||||||||
#include "field_effect.h" | ||||||||
#include "gpu_regs.h" | ||||||||
#include "international_string_util.h" | ||||||||
#include "main.h" | ||||||||
#include "malloc.h" | ||||||||
#include "menu.h" | ||||||||
#include "overworld.h" | ||||||||
#include "palette.h" | ||||||||
#include "region_map.h" | ||||||||
#include "sound.h" | ||||||||
#include "strings.h" | ||||||||
#include "text.h" | ||||||||
#include "text_window.h" | ||||||||
#include "window.h" | ||||||||
#include "constants/rgb.h" | ||||||||
#include "constants/songs.h" | ||||||||
|
||||||||
/* | ||||||||
* This is the type of map shown when interacting with the metatiles for | ||||||||
|
@@ -45,6 +49,12 @@ static void VBCB_FieldUpdateRegionMap(void); | |||||||
static void MCB2_FieldUpdateRegionMap(void); | ||||||||
static void FieldUpdateRegionMap(void); | ||||||||
static void PrintRegionMapSecName(void); | ||||||||
static void PrintTitleWindowText(void); | ||||||||
|
||||||||
static const u8* const FlyPromptText = COMPOUND_STRING("{R_BUTTON}FLY"); | ||||||||
|
||||||||
u8 hoennOffset; | ||||||||
u8 flyOffset; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this outside of a function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i figured it'd be better to set them when the FieldUpdateRegionMap() is called rather than every time the PrintTitleWindowText() function is called to speed up text display There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass them as arguments into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, the function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good to know! i thought it was a big loop inside |
||||||||
|
||||||||
static const struct BgTemplate sFieldRegionMapBgTemplates[] = { | ||||||||
{ | ||||||||
|
@@ -66,7 +76,7 @@ static const struct BgTemplate sFieldRegionMapBgTemplates[] = { | |||||||
} | ||||||||
}; | ||||||||
|
||||||||
static const struct WindowTemplate sFieldRegionMapWindowTemplates[] = | ||||||||
const struct WindowTemplate sFieldRegionMapWindowTemplates[] = | ||||||||
{ | ||||||||
[WIN_MAPSEC_NAME] = { | ||||||||
.bg = 0, | ||||||||
|
@@ -139,7 +149,8 @@ static void MCB2_FieldUpdateRegionMap(void) | |||||||
|
||||||||
static void FieldUpdateRegionMap(void) | ||||||||
{ | ||||||||
u8 offset; | ||||||||
hoennOffset = GetStringCenterAlignXOffset(FONT_NORMAL, gText_Hoenn, 0x38); | ||||||||
flyOffset = GetStringCenterAlignXOffset(FONT_NORMAL, FlyPromptText, 0x38); | ||||||||
|
||||||||
switch (sFieldRegionMapHandler->state) | ||||||||
{ | ||||||||
|
@@ -151,8 +162,8 @@ static void FieldUpdateRegionMap(void) | |||||||
break; | ||||||||
case 1: | ||||||||
DrawStdFrameWithCustomTileAndPalette(WIN_TITLE, FALSE, 0x27, 0xd); | ||||||||
offset = GetStringCenterAlignXOffset(FONT_NORMAL, gText_Hoenn, 0x38); | ||||||||
AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, gText_Hoenn, offset, 1, 0, NULL); | ||||||||
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(1)); | ||||||||
PrintTitleWindowText(); | ||||||||
ScheduleBgCopyTilemapToVram(0); | ||||||||
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 0x27, 0xd); | ||||||||
PrintRegionMapSecName(); | ||||||||
|
@@ -176,11 +187,21 @@ static void FieldUpdateRegionMap(void) | |||||||
{ | ||||||||
case MAP_INPUT_MOVE_END: | ||||||||
PrintRegionMapSecName(); | ||||||||
PrintTitleWindowText(); | ||||||||
break; | ||||||||
case MAP_INPUT_A_BUTTON: | ||||||||
case MAP_INPUT_B_BUTTON: | ||||||||
sFieldRegionMapHandler->state++; | ||||||||
break; | ||||||||
case MAP_INPUT_R_BUTTON: | ||||||||
if (sFieldRegionMapHandler->regionMap.mapSecType == MAPSECTYPE_CITY_CANFLY && | ||||||||
OW_FLAG_POKE_RIDER && Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) | ||||||||
{ | ||||||||
PlaySE(SE_SELECT); | ||||||||
SetFlyDestination(&sFieldRegionMapHandler->regionMap); | ||||||||
gSkipShowMonAnim = TRUE; | ||||||||
ReturnToFieldFromFlyMapSelect(); | ||||||||
} | ||||||||
} | ||||||||
break; | ||||||||
case 5: | ||||||||
|
@@ -213,3 +234,20 @@ static void PrintRegionMapSecName(void) | |||||||
CopyWindowToVram(WIN_MAPSEC_NAME, COPYWIN_FULL); | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
static void PrintTitleWindowText(void) | ||||||||
{ | ||||||||
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(1)); | ||||||||
|
||||||||
if (sFieldRegionMapHandler->regionMap.mapSecType == MAPSECTYPE_CITY_CANFLY && | ||||||||
OW_FLAG_POKE_RIDER && Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) | ||||||||
{ | ||||||||
AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, FlyPromptText, flyOffset, 1, 0, NULL); | ||||||||
ScheduleBgCopyTilemapToVram(WIN_TITLE); | ||||||||
} | ||||||||
else | ||||||||
{ | ||||||||
AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, gText_Hoenn, hoennOffset, 1, 0, NULL); | ||||||||
CopyWindowToVram(WIN_TITLE, COPYWIN_FULL); | ||||||||
} | ||||||||
} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be just a normal text string. We don't use compound strings like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually straight from the strings used in the pokenav helpbar, though there it's an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use Compound Strings for non duplicate strings, so single use strings. If you want this to use multiply times it should be a normal string so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically a single use string- should it stay a compound string then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use it twice right?
The reason we use compound strings is because they make code more readable and additionally save a little bit of space so in your case it should be moved where it is needed in the first place. Though iirc we've decided to keep using normal strings for function arguments so you would need to convert it either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, i see, yeah it's used once in the file, but twice in the function. fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm in this case should it be defined in the
PrintTitleWindowText
func? since it's only used there?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!