forked from DizzyEggg/pokeemerald
-
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
Open
khbsd
wants to merge
16
commits into
rh-hideout:upcoming
Choose a base branch
from
khbsd:pokenav-fly-v2
base: upcoming
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+168
−43
Open
Fly from Pokenav #5679
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0f71be0
clean copy from fly-from-pokenav
khbsd 2616150
code comment edited to describe function better
khbsd c1c6904
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd f9f99ba
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd 558b07a
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd 6ccc803
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd eac320f
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd 1556540
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd e0ba3a3
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd 991aeff
addressed hedara's comments
khbsd 9c1eed3
added fly prompt in the town map and cleaned up some formatting in po…
khbsd d34544a
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd 642849d
let OW_FLAG_POKE_RIDER be used as a flag as well as a global toggle (…
khbsd 6bef85d
addressed alex's comments, ty!
khbsd a82e70c
addresses alex's comments
khbsd da6fddb
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
khbsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,17 +1,22 @@ | ||||||||||
#include "global.h" | ||||||||||
#include "bg.h" | ||||||||||
#include "event_data.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 | ||||||||||
|
@@ -44,7 +49,8 @@ static void MCB2_InitRegionMapRegisters(void); | |||||||||
static void VBCB_FieldUpdateRegionMap(void); | ||||||||||
static void MCB2_FieldUpdateRegionMap(void); | ||||||||||
static void FieldUpdateRegionMap(void); | ||||||||||
static void PrintRegionMapSecName(void); | ||||||||||
static void PrintRegionMapSecName(); | ||||||||||
static void PrintTitleWindowText(); | ||||||||||
|
||||||||||
static const struct BgTemplate sFieldRegionMapBgTemplates[] = { | ||||||||||
{ | ||||||||||
|
@@ -139,8 +145,6 @@ static void MCB2_FieldUpdateRegionMap(void) | |||||||||
|
||||||||||
static void FieldUpdateRegionMap(void) | ||||||||||
{ | ||||||||||
u8 offset; | ||||||||||
|
||||||||||
switch (sFieldRegionMapHandler->state) | ||||||||||
{ | ||||||||||
case 0: | ||||||||||
|
@@ -151,8 +155,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 +180,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 && | ||||||||||
FlagGet(OW_FLAG_POKE_RIDER) && Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) | ||||||||||
{ | ||||||||||
PlaySE(SE_SELECT); | ||||||||||
SetFlyDestination(&sFieldRegionMapHandler->regionMap); | ||||||||||
gSkipShowMonAnim = TRUE; | ||||||||||
ReturnToFieldFromFlyMapSelect(); | ||||||||||
} | ||||||||||
} | ||||||||||
break; | ||||||||||
case 5: | ||||||||||
|
@@ -213,3 +227,24 @@ static void PrintRegionMapSecName(void) | |||||||||
CopyWindowToVram(WIN_MAPSEC_NAME, COPYWIN_FULL); | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
static void PrintTitleWindowText(void) | ||||||||||
{ | ||||||||||
static const u8 FlyPromptText[] = _("{R_BUTTON}FLY"); | ||||||||||
u8 hoennOffset = GetStringCenterAlignXOffset(FONT_NORMAL, gText_Hoenn, 0x38); | ||||||||||
u8 flyOffset = GetStringCenterAlignXOffset(FONT_NORMAL, FlyPromptText, 0x38); | ||||||||||
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
|
||||||||||
|
||||||||||
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(1)); | ||||||||||
|
||||||||||
if (sFieldRegionMapHandler->regionMap.mapSecType == MAPSECTYPE_CITY_CANFLY && | ||||||||||
FlagGet(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
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,8 +2,11 @@ | |||||||||
#include "bg.h" | ||||||||||
#include "decompress.h" | ||||||||||
#include "landmark.h" | ||||||||||
#include "event_data.h" | ||||||||||
#include "field_effect.h" | ||||||||||
#include "main.h" | ||||||||||
#include "menu.h" | ||||||||||
#include "overworld.h" | ||||||||||
#include "palette.h" | ||||||||||
#include "pokenav.h" | ||||||||||
#include "region_map.h" | ||||||||||
|
@@ -73,6 +76,7 @@ static u32 LoopedTask_UpdateInfoAfterCursorMove(s32); | |||||||||
static u32 LoopedTask_RegionMapZoomOut(s32); | ||||||||||
static u32 LoopedTask_RegionMapZoomIn(s32); | ||||||||||
static u32 LoopedTask_ExitRegionMap(s32); | ||||||||||
static u32 LoopedTask_TreatAsPokeNavFlyMap(s32); | ||||||||||
|
||||||||||
extern const u16 gRegionMapCityZoomTiles_Pal[]; | ||||||||||
extern const u32 gRegionMapCityZoomText_Gfx[]; | ||||||||||
|
@@ -119,7 +123,8 @@ static const LoopedTask sRegionMapLoopTaskFuncs[] = | |||||||||
[POKENAV_MAP_FUNC_CURSOR_MOVED] = LoopedTask_UpdateInfoAfterCursorMove, | ||||||||||
[POKENAV_MAP_FUNC_ZOOM_OUT] = LoopedTask_RegionMapZoomOut, | ||||||||||
[POKENAV_MAP_FUNC_ZOOM_IN] = LoopedTask_RegionMapZoomIn, | ||||||||||
[POKENAV_MAP_FUNC_EXIT] = LoopedTask_ExitRegionMap | ||||||||||
[POKENAV_MAP_FUNC_EXIT] = LoopedTask_ExitRegionMap, | ||||||||||
[POKENAV_MAP_FUNC_FLY] = LoopedTask_TreatAsPokeNavFlyMap, | ||||||||||
}; | ||||||||||
|
||||||||||
static const struct CompressedSpriteSheet sCityZoomTextSpriteSheet[1] = | ||||||||||
|
@@ -204,6 +209,8 @@ u32 GetRegionMapCallback(void) | |||||||||
|
||||||||||
static u32 HandleRegionMapInput(struct Pokenav_RegionMapMenu *state) | ||||||||||
{ | ||||||||||
struct RegionMap* regionMap = GetSubstructPtr(POKENAV_SUBSTRUCT_REGION_MAP); | ||||||||||
|
||||||||||
switch (DoRegionMapInputCallback()) | ||||||||||
{ | ||||||||||
case MAP_INPUT_MOVE_END: | ||||||||||
|
@@ -215,6 +222,10 @@ static u32 HandleRegionMapInput(struct Pokenav_RegionMapMenu *state) | |||||||||
case MAP_INPUT_B_BUTTON: | ||||||||||
state->callback = GetExitRegionMapMenuId; | ||||||||||
return POKENAV_MAP_FUNC_EXIT; | ||||||||||
case MAP_INPUT_R_BUTTON: | ||||||||||
if (regionMap->mapSecType == MAPSECTYPE_CITY_CANFLY && FlagGet(OW_FLAG_POKE_RIDER) && | ||||||||||
Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) | ||||||||||
Comment on lines
+226
to
+227
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
|
||||||||||
return POKENAV_MAP_FUNC_FLY; | ||||||||||
} | ||||||||||
|
||||||||||
return POKENAV_MAP_FUNC_NONE; | ||||||||||
|
@@ -365,6 +376,7 @@ static u32 LoopedTask_OpenRegionMap(s32 taskState) | |||||||||
else | ||||||||||
menuGfxId = POKENAV_GFX_MAP_MENU_ZOOMED_IN; | ||||||||||
|
||||||||||
UpdateRegionMapHelpBarText(); | ||||||||||
LoadLeftHeaderGfxForIndex(menuGfxId); | ||||||||||
ShowLeftHeaderGfx(menuGfxId, TRUE, TRUE); | ||||||||||
PokenavFadeScreen(POKENAV_FADE_FROM_BLACK); | ||||||||||
|
@@ -385,6 +397,7 @@ static u32 LoopedTask_UpdateInfoAfterCursorMove(s32 taskState) | |||||||||
{ | ||||||||||
case 0: | ||||||||||
UpdateMapSecInfoWindow(state); | ||||||||||
UpdateRegionMapHelpBarText(); | ||||||||||
return LT_INC_AND_PAUSE; | ||||||||||
case 1: | ||||||||||
if (IsDma3ManagerBusyWithBgCopy_(state)) | ||||||||||
|
@@ -408,7 +421,7 @@ static u32 LoopedTask_RegionMapZoomOut(s32 taskState) | |||||||||
if (UpdateRegionMapZoom() || IsChangeBgYForZoomActive()) | ||||||||||
return LT_PAUSE; | ||||||||||
|
||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_OUT); | ||||||||||
UpdateRegionMapHelpBarText(); | ||||||||||
return LT_INC_AND_PAUSE; | ||||||||||
case 2: | ||||||||||
if (WaitForHelpBar()) | ||||||||||
|
@@ -441,7 +454,7 @@ static u32 LoopedTask_RegionMapZoomIn(s32 taskState) | |||||||||
if (UpdateRegionMapZoom() || IsChangeBgYForZoomActive()) | ||||||||||
return LT_PAUSE; | ||||||||||
|
||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_IN); | ||||||||||
UpdateRegionMapHelpBarText(); | ||||||||||
return LT_INC_AND_PAUSE; | ||||||||||
case 3: | ||||||||||
if (WaitForHelpBar()) | ||||||||||
|
@@ -482,6 +495,23 @@ static u32 LoopedTask_ExitRegionMap(s32 taskState) | |||||||||
return LT_FINISH; | ||||||||||
} | ||||||||||
|
||||||||||
static u32 LoopedTask_TreatAsPokeNavFlyMap(s32 taskState) | ||||||||||
{ | ||||||||||
switch (taskState) | ||||||||||
{ | ||||||||||
case 0: | ||||||||||
PlaySE(SE_SELECT); | ||||||||||
struct RegionMap* regionMap = GetSubstructPtr(POKENAV_SUBSTRUCT_REGION_MAP); | ||||||||||
SetFlyDestination(regionMap); | ||||||||||
gSkipShowMonAnim = TRUE; | ||||||||||
ReturnToFieldFromFlyMapSelect(); | ||||||||||
|
||||||||||
return LT_FINISH; | ||||||||||
} | ||||||||||
|
||||||||||
return LT_FINISH; | ||||||||||
} | ||||||||||
|
||||||||||
static void LoadCityZoomViewGfx(void) | ||||||||||
{ | ||||||||||
int i; | ||||||||||
|
@@ -740,3 +770,24 @@ static void SetCityZoomTextInvisibility(bool32 invisible) | |||||||||
for (i = 0; i < (int)ARRAY_COUNT(state->cityZoomTextSprites); i++) | ||||||||||
state->cityZoomTextSprites[i]->invisible = invisible; | ||||||||||
} | ||||||||||
|
||||||||||
void UpdateRegionMapHelpBarText(void) | ||||||||||
{ | ||||||||||
struct RegionMap* regionMap = GetSubstructPtr(POKENAV_SUBSTRUCT_REGION_MAP); | ||||||||||
|
||||||||||
if (regionMap->mapSecType == MAPSECTYPE_CITY_CANFLY && FlagGet(OW_FLAG_POKE_RIDER) && | ||||||||||
Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) | ||||||||||
{ | ||||||||||
if (IsRegionMapZoomed()) | ||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_IN_CANFLY); | ||||||||||
else | ||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_OUT_CANFLY); | ||||||||||
} | ||||||||||
else | ||||||||||
{ | ||||||||||
if (IsRegionMapZoomed()) | ||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_IN); | ||||||||||
else | ||||||||||
PrintHelpBarText(HELPBAR_MAP_ZOOMED_OUT); | ||||||||||
} | ||||||||||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.