Skip to content

Commit

Permalink
finish heal_location
Browse files Browse the repository at this point in the history
  • Loading branch information
PikalaxALT committed May 16, 2019
1 parent 25aed5d commit 468d5a0
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 185 deletions.
177 changes: 0 additions & 177 deletions asm/heal_location.s

This file was deleted.

7 changes: 0 additions & 7 deletions data/data_835B488.s
Original file line number Diff line number Diff line change
Expand Up @@ -1053,13 +1053,6 @@ gUnknown_83EEB68:: @ 83EEB68

.section .rodata.83EEC98

.align 2
gUnknown_83EEC98:: @ 83EEC98
.incbin "baserom.gba", 0x3EEC98, 0x50

gUnknown_83EECE8:: @ 83EECE8
.incbin "baserom.gba", 0x3EECE8, 0x14

.include "data/text/map_section_names.inc"

gUnknown_83EF23C:: @ 83EF23C
Expand Down
2 changes: 2 additions & 0 deletions include/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extern struct UCoords32 gDirectionToVectors[];
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
extern MainCallback gFieldCallback;

extern struct WarpData gUnknown_2031DBC;

void IncrementGameStat(u8 index);

void Overworld_SetMapObjTemplateCoords(u8, s16, s16);
Expand Down
1 change: 0 additions & 1 deletion ld_script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ SECTIONS {
asm/menu_helpers.o(.text);
asm/script_pokemon_util_80BF8FC.o(.text);
src/heal_location.o(.text);
asm/heal_location.o(.text);
asm/region_map.o(.text);
src/battle_ai_script_commands.o(.text);
asm/rom6.o(.text);
Expand Down
88 changes: 88 additions & 0 deletions src/heal_location.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include "global.h"
#include "heal_location.h"
#include "event_data.h"
#include "constants/vars.h"
#include "constants/maps.h"
#include "constants/spawn_points.h"

void sub_80BFE00(u32 healLocationIdx);

static const struct HealLocation sSpawnPoints[] = {
{MAP_GROUP(PALLET_TOWN), MAP_NUM(PALLET_TOWN), 0x06, 0x08},
{MAP_GROUP(VIRIDIAN_CITY), MAP_NUM(VIRIDIAN_CITY), 0x1a, 0x1b},
Expand All @@ -26,6 +30,33 @@ static const struct HealLocation sSpawnPoints[] = {
{MAP_GROUP(SIX_ISLAND), MAP_NUM(SIX_ISLAND), 0x0b, 0x0c},
};

const u16 gUnknown_83EEC98[][2] = {
{MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_1F), MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_1F)},
{MAP_GROUP(VIRIDIAN_CITY_POKEMON_CENTER_1F), MAP_NUM(VIRIDIAN_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(PEWTER_CITY_POKEMON_CENTER_1F), MAP_NUM(PEWTER_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(CERULEAN_CITY_POKEMON_CENTER_1F), MAP_NUM(CERULEAN_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(LAVENDER_TOWN_POKEMON_CENTER_1F), MAP_NUM(LAVENDER_TOWN_POKEMON_CENTER_1F)},
{MAP_GROUP(VERMILION_CITY_POKEMON_CENTER_1F), MAP_NUM(VERMILION_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(CELADON_CITY_POKEMON_CENTER_1F), MAP_NUM(CELADON_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(FUCHSIA_CITY_POKEMON_CENTER_1F), MAP_NUM(FUCHSIA_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(CINNABAR_ISLAND_POKEMON_CENTER_1F), MAP_NUM(CINNABAR_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(INDIGO_PLATEAU_POKEMON_CENTER_1F), MAP_NUM(INDIGO_PLATEAU_POKEMON_CENTER_1F)},
{MAP_GROUP(SAFFRON_CITY_POKEMON_CENTER_1F), MAP_NUM(SAFFRON_CITY_POKEMON_CENTER_1F)},
{MAP_GROUP(ROUTE4_POKEMON_CENTER_1F), MAP_NUM(ROUTE4_POKEMON_CENTER_1F)},
{MAP_GROUP(ROUTE10_POKEMON_CENTER_1F), MAP_NUM(ROUTE10_POKEMON_CENTER_1F)},
{MAP_GROUP(ONE_ISLAND_POKEMON_CENTER_1F), MAP_NUM(ONE_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(TWO_ISLAND_POKEMON_CENTER_1F), MAP_NUM(TWO_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(THREE_ISLAND_POKEMON_CENTER_1F), MAP_NUM(THREE_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(FOUR_ISLAND_POKEMON_CENTER_1F), MAP_NUM(FOUR_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(FIVE_ISLAND_POKEMON_CENTER_1F), MAP_NUM(FIVE_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(SEVEN_ISLAND_POKEMON_CENTER_1F), MAP_NUM(SEVEN_ISLAND_POKEMON_CENTER_1F)},
{MAP_GROUP(SIX_ISLAND_POKEMON_CENTER_1F), MAP_NUM(SIX_ISLAND_POKEMON_CENTER_1F)}
};

static const u8 gUnknown_83EECE8[] = {
0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};

u32 GetHealLocationIndexFromMapGroupAndNum(u16 mapGroup, u16 mapNum)
{
u32 i;
Expand Down Expand Up @@ -57,3 +88,60 @@ const struct HealLocation * GetHealLocationPointer(u32 idx)
return NULL;
return &sSpawnPoints[idx - 1];
}

void sub_80BFCD0(struct WarpData * warp)
{
u32 healLocationIdx;

if (VarGet(VAR_0x4082) == 1)
{
if (!gSaveBlock1Ptr->unkArray[gSaveBlock1Ptr->unkArrayIdx].unkA_2)
VarSet(VAR_0x4082, 0);
gSpecialVar_LastTalked = 1;
warp->x = 4;
warp->y = 11;
warp->mapGroup = MAP_GROUP(SEVEN_ISLAND_TRAINER_TOWER_LOBBY);
warp->mapNum = MAP_NUM(SEVEN_ISLAND_TRAINER_TOWER_LOBBY);
warp->warpId = 0xFF;
}
else
{
healLocationIdx = GetHealLocationIndexFromMapGroupAndNum(gSaveBlock1Ptr->lastHealLocation.mapGroup, gSaveBlock1Ptr->lastHealLocation.mapNum);
warp->mapGroup = gUnknown_83EEC98[healLocationIdx - 1][0];
warp->mapNum = gUnknown_83EEC98[healLocationIdx - 1][1];
warp->warpId = 0xFF;

if (gUnknown_83EEC98[healLocationIdx - 1][0] == MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_1F) && gUnknown_83EEC98[healLocationIdx - 1][1] == MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_1F))
{
warp->x = 8;
warp->y = 5;
}
else if (gUnknown_83EEC98[healLocationIdx - 1][0] == MAP_GROUP(INDIGO_PLATEAU_POKEMON_CENTER_1F) && gUnknown_83EEC98[healLocationIdx - 1][1] == MAP_NUM(INDIGO_PLATEAU_POKEMON_CENTER_1F))
{
warp->x = 13;
warp->y = 12;
}
else if (gUnknown_83EEC98[healLocationIdx - 1][0] == MAP_GROUP(ONE_ISLAND_POKEMON_CENTER_1F) && gUnknown_83EEC98[healLocationIdx - 1][1] == MAP_NUM(ONE_ISLAND_POKEMON_CENTER_1F))
{
warp->x = 5;
warp->y = 4;
}
else if (gUnknown_83EEC98[healLocationIdx - 1][0] == MAP_GROUP(SEVEN_ISLAND_TRAINER_TOWER_LOBBY) && gUnknown_83EEC98[healLocationIdx - 1][1] == MAP_NUM(SEVEN_ISLAND_TRAINER_TOWER_LOBBY))
{
warp->x = 4;
warp->y = 11;
VarSet(VAR_0x4082, 0);
}
else
{
warp->x = 7;
warp->y = 4;
}
sub_80BFE00(healLocationIdx);
}
}

void sub_80BFE00(u32 healLocationIdx)
{
gSpecialVar_LastTalked = gUnknown_83EECE8[healLocationIdx - 1];
}

0 comments on commit 468d5a0

Please sign in to comment.