Skip to content
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

MapNamePopUp Documentation #352

Merged
merged 21 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/field/field_system_sub2_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
#include "struct_decls/struct_02055CBC_decl.h"

#include "overlay005/hblank_system.h"
#include "overlay005/map_name_popup.h"
#include "overlay005/struct_ov5_021D1A94_decl.h"
#include "overlay005/struct_ov5_021D5CB0_decl.h"
#include "overlay005/struct_ov5_021D5EF8_decl.h"
#include "overlay005/struct_ov5_021DD9C8_decl.h"
#include "overlay005/struct_ov5_021EF4F8_decl.h"
#include "overlay025/poketch_system.h"

struct FieldSystem_sub2_t {
BOOL unk_00;
UnkStruct_ov5_021D1A94 *unk_04;
UnkStruct_ov5_021DD9C8 *unk_08;
MapNamePopUp *unk_08;
UnkStruct_ov5_021D5EF8 *unk_0C;
UnkStruct_ov5_021D5CB0 *unk_10;
PoketchSystem *poketchSys;
Expand Down
12 changes: 12 additions & 0 deletions include/map_header_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef POKEPLATINUM_MAP_HEADER_UTIL_H
#define POKEPLATINUM_MAP_HEADER_UTIL_H

#include "generated/map_headers.h"

#include "message.h"
#include "strbuf.h"

u32 MapHeader_LoadString(MessageLoader *msgLoader, u32 entryID, Strbuf *strbuf);
void MapHeader_LoadName(enum MapHeader headerID, u32 heapID, Strbuf *strbuf);

#endif // POKEPLATINUM_MAP_HEADER_UTIL_H
16 changes: 16 additions & 0 deletions include/overlay005/map_name_popup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef POKEPLATINUM_MAP_NAME_POPUP_H
#define POKEPLATINUM_MAP_NAME_POPUP_H

#include "field/field_system_decl.h"

#include "bg_window.h"

typedef struct MapNamePopUp MapNamePopUp;

MapNamePopUp *MapNamePopUp_Create(BgConfig *bgConfig);
void MapNamePopUp_Destroy(MapNamePopUp *mapPopUp);
void MapNamePopUp_Show(MapNamePopUp *mapPopUp, s32 mapLabelTextID, s32 mapLabelWindowID);
void MapNamePopUp_Hide(MapNamePopUp *mapPopUp);
void FieldSystem_RequestLocationName(FieldSystem *fieldSystem);

#endif // POKEPLATINUM_MAP_NAME_POPUP_H
15 changes: 0 additions & 15 deletions include/overlay005/ov5_021DD6FC.h

This file was deleted.

6 changes: 0 additions & 6 deletions include/overlay005/struct_ov5_021DD9C8_decl.h

This file was deleted.

10 changes: 0 additions & 10 deletions include/unk_02071CFC.h

This file was deleted.

4 changes: 2 additions & 2 deletions platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Static main
Object main.nef.p/src_unk_0207160C.c.o
Object main.nef.p/src_unk_02071B10.c.o
Object main.nef.p/src_unk_02071CD0.c.o
Object main.nef.p/src_unk_02071CFC.c.o
Object main.nef.p/src_map_header_util.c.o
Object main.nef.p/src_unk_02071D40.c.o
Object main.nef.p/src_unk_020722AC.c.o
Object main.nef.p/src_unk_02073700.c.o
Expand Down Expand Up @@ -481,7 +481,7 @@ Overlay overlay5
Object main.nef.p/src_overlay005_vs_seeker.c.o
Object main.nef.p/src_overlay005_ov5_021DC018.c.o
Object main.nef.p/src_overlay005_ov5_021DD42C.c.o
Object main.nef.p/src_overlay005_ov5_021DD6FC.c.o
Object main.nef.p/src_overlay005_map_name_popup.c.o
Object main.nef.p/src_overlay005_ov5_021DDAE4.c.o
Object main.nef.p/src_overlay005_encounter_effect.c.o
Object main.nef.p/src_overlay005_ov5_021DF440.c.o
Expand Down
2 changes: 1 addition & 1 deletion src/field_map_change.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "struct_defs/struct_0205EC34.h"

#include "field/field_system.h"
#include "overlay005/ov5_021DD6FC.h"
#include "overlay005/map_name_popup.h"
#include "overlay005/ov5_021E135C.h"
#include "overlay005/save_info_window.h"
#include "overlay005/struct_ov5_021D432C_decl.h"
Expand Down
10 changes: 5 additions & 5 deletions src/field_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "field/field_system_sub2_t.h"
#include "overlay005/field_control.h"
#include "overlay005/fieldmap.h"
#include "overlay005/ov5_021DD6FC.h"
#include "overlay005/map_name_popup.h"
#include "overlay005/ov5_021DFB54.h"
#include "overlay005/ov5_021E1B08.h"
#include "overlay005/ov5_021EA714.h"
Expand Down Expand Up @@ -281,13 +281,13 @@ static void HandleFieldInput(FieldSystem *fieldSystem)
case MAP_LOAD_TYPE_BATTLE_TOWER:
if (processInput) {
if (FieldInput_Process_BattleTower(&fieldInput, fieldSystem) == TRUE) {
ov5_021DDA78(fieldSystem->unk_04->unk_08);
MapNamePopUp_Hide(fieldSystem->unk_04->unk_08);
ov5_021E1BCC(fieldSystem, 4);
ov5_021E0EEC(fieldSystem->playerAvatar);
ov5_021EA714(fieldSystem, 0, 1);
} else {
if (gCoreSys.pressedKeys & PAD_BUTTON_A) {
ov5_021DDA78(fieldSystem->unk_04->unk_08);
MapNamePopUp_Hide(fieldSystem->unk_04->unk_08);
}

BOOL tappedPoketch = FALSE;
Expand All @@ -304,14 +304,14 @@ static void HandleFieldInput(FieldSystem *fieldSystem)
default:
if (processInput) {
if (FieldInput_Process(&fieldInput, fieldSystem) == TRUE) {
ov5_021DDA78(fieldSystem->unk_04->unk_08);
MapNamePopUp_Hide(fieldSystem->unk_04->unk_08);
ov5_021E1BCC(fieldSystem, 4);
sub_0205F56C(fieldSystem->playerAvatar);
ov5_021E0EEC(fieldSystem->playerAvatar);
ov5_021EA714(fieldSystem, 0, 1);
} else {
if (gCoreSys.pressedKeys & PAD_BUTTON_A) {
ov5_021DDA78(fieldSystem->unk_04->unk_08);
MapNamePopUp_Hide(fieldSystem->unk_04->unk_08);
}

BOOL tappedPoketch = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/field_transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "field/field_system.h"
#include "overlay005/encounter_effect.h"
#include "overlay005/ov5_021DD6FC.h"
#include "overlay005/map_name_popup.h"

#include "field_system.h"
#include "field_task.h"
Expand Down
30 changes: 30 additions & 0 deletions src/map_header_util.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "map_header_util.h"

#include <nitro.h>

#include "generated/text_banks.h"

#include "font.h"
#include "map_header.h"
#include "message.h"
#include "strbuf.h"

u32 MapHeader_LoadString(MessageLoader *msgLoader, u32 entryID, Strbuf *strbuf)
{
MessageLoader_GetStrbuf(msgLoader, entryID, strbuf);
u32 width = Font_CalcStrbufWidth(FONT_SYSTEM, strbuf, 0);

return width;
}

void MapHeader_LoadName(enum MapHeader headerID, u32 heapID, Strbuf *strbuf)
{
u32 mapLabelTextID;
MessageLoader *msgLoader;

msgLoader = MessageLoader_Init(MESSAGE_LOADER_NARC_HANDLE, NARC_INDEX_MSGDATA__PL_MSG, TEXT_BANK_LOCATION_NAMES, heapID);
mapLabelTextID = MapHeader_GetMapLabelTextID(headerID);

MapHeader_LoadString(msgLoader, mapLabelTextID, strbuf); // It should be MessageLoader_GetStrbuf()
MessageLoader_Free(msgLoader);
}
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ pokeplatinum_c = files(
'unk_0207160C.c',
'unk_02071B10.c',
'unk_02071CD0.c',
'unk_02071CFC.c',
'map_header_util.c',
'unk_02071D40.c',
'unk_020722AC.c',
'unk_02073700.c',
Expand Down Expand Up @@ -375,7 +375,7 @@ pokeplatinum_c = files(
'overlay005/vs_seeker.c',
'overlay005/ov5_021DC018.c',
'overlay005/ov5_021DD42C.c',
'overlay005/ov5_021DD6FC.c',
'overlay005/map_name_popup.c',
'overlay005/ov5_021DDAE4.c',
'overlay005/encounter_effect.c',
'overlay005/ov5_021DF440.c',
Expand Down
8 changes: 4 additions & 4 deletions src/overlay005/fieldmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "overlay005/const_ov5_021FF744.h"
#include "overlay005/const_ov5_021FF7D0.h"
#include "overlay005/hblank_system.h"
#include "overlay005/map_name_popup.h"
#include "overlay005/ov5_021D1A94.h"
#include "overlay005/ov5_021D37AC.h"
#include "overlay005/ov5_021D521C.h"
Expand All @@ -27,7 +28,6 @@
#include "overlay005/ov5_021D5BC0.h"
#include "overlay005/ov5_021D5CB0.h"
#include "overlay005/ov5_021D5EB8.h"
#include "overlay005/ov5_021DD6FC.h"
#include "overlay005/ov5_021DF440.h"
#include "overlay005/ov5_021E15F4.h"
#include "overlay005/ov5_021E1B08.h"
Expand Down Expand Up @@ -311,7 +311,7 @@ static BOOL FieldMap_Exit(OverlayManager *overlayMan, int *param1)
ov5_021D5BA8(fieldSystem);
ov5_021D5278(&fieldSystem->unk_4C);
ov5_021E1B20(fieldSystem->unk_64);
ov5_021DD9C8(fieldSystem->unk_04->unk_08);
MapNamePopUp_Destroy(fieldSystem->unk_04->unk_08);

if (fieldSystem->unk_04->unk_0C != NULL) {
ov5_021D5EF8(fieldSystem->unk_04->unk_0C);
Expand Down Expand Up @@ -450,7 +450,7 @@ static BOOL FieldMap_ChangeZone(FieldSystem *fieldSystem)
v9--;
}

ov5_021DD9E8(fieldSystem->unk_04->unk_08, v8, v9);
MapNamePopUp_Show(fieldSystem->unk_04->unk_08, v8, v9);
}

return TRUE;
Expand Down Expand Up @@ -909,7 +909,7 @@ static void ov5_021D1968(FieldSystem *fieldSystem)
fieldSystem->unk_04->unk_0C = ov5_021D5EB8(fieldSystem);
}

fieldSystem->unk_04->unk_08 = ov5_021DD98C(fieldSystem->bgConfig);
fieldSystem->unk_04->unk_08 = MapNamePopUp_Create(fieldSystem->bgConfig);
fieldSystem->unk_64 = ov5_021E1B08(4);
fieldSystem->unk_04->unk_10 = ov5_021D5CB0();

Expand Down
Loading