Merge pull request #340 from GriffinRichards/doc-inconnect

Label in_connection's field in ObjectEventTemplate
This commit is contained in:
PikalaxALT
2020-05-27 07:53:11 -04:00
committed by GitHub
6 changed files with 19 additions and 20 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ struct ObjectEventTemplate
{
/*0x00*/ u8 localId;
/*0x01*/ u8 graphicsId;
/*0x02*/ u8 unk2;
/*0x02*/ u8 inConnection;
/*0x04*/ s16 x;
/*0x06*/ s16 y;
/*0x08*/ u8 elevation;
+1 -1
View File
@@ -9,8 +9,8 @@
#include "graphics.h"
#include "strings.h"
#include "trainer_pokemon_sprites.h"
#include "field_weather.h"
#include "menu.h"
#include "field_weather.h"
#include "constants/species.h"
#include "constants/maps.h"
#include "constants/field_weather.h"
+2 -2
View File
@@ -1335,7 +1335,7 @@ static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template,
s16 y2;
s16 elevation2;
if(template->unk2 == 0xFF)
if(template->inConnection == 0xFF)
{
var = 1;
mapNum = template2->trainerType;
@@ -1904,7 +1904,7 @@ int SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8
y -= 7;
objectEventTemplate.localId = localId;
objectEventTemplate.graphicsId = graphicsId;
objectEventTemplate.unk2 = 0;
objectEventTemplate.inConnection = 0;
objectEventTemplate.x = x;
objectEventTemplate.y = y;
objectEventTemplate.elevation = z;
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "malloc.h"
#include "menu.h"
#include "malloc.h"
+1
View File
@@ -6,6 +6,7 @@
#include "help_system.h"
#include "list_menu.h"
#include "strings.h"
#include "event_data.h"
#include "constants/songs.h"
extern u8 gGlyphInfo[];
+13 -16
View File
@@ -400,30 +400,27 @@ void ApplyNewEncryptionKeyToGameStats(u32 newKey)
// Routines related to object events
static void sub_8054F68(void)
static void LoadObjEventTemplatesFromHeader(void)
{
u8 i, j;
u8 mapGroup;
u8 mapNum;
u8 localId;
const struct MapHeader * linkedMap;
for (i = 0, j = 0; i < gMapHeader.events->objectEventCount; i++)
{
if (gMapHeader.events->objectEvents[i].unk2 == 0xFF)
if (gMapHeader.events->objectEvents[i].inConnection == 0xFF)
{
localId = gMapHeader.events->objectEvents[i].elevation;
mapNum = gMapHeader.events->objectEvents[i].trainerType;
mapGroup = gMapHeader.events->objectEvents[i].trainerRange_berryTreeId;
linkedMap = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
gSaveBlock1Ptr->objectEventTemplates[j] = linkedMap->events->objectEvents[localId - 1];
// load "in_connection" object from the connecting map
u8 localId = gMapHeader.events->objectEvents[i].elevation;
u8 mapNum = gMapHeader.events->objectEvents[i].trainerType;
u8 mapGroup = gMapHeader.events->objectEvents[i].trainerRange_berryTreeId;
const struct MapHeader * connectionMap = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
gSaveBlock1Ptr->objectEventTemplates[j] = connectionMap->events->objectEvents[localId - 1];
gSaveBlock1Ptr->objectEventTemplates[j].localId = gMapHeader.events->objectEvents[i].localId;
gSaveBlock1Ptr->objectEventTemplates[j].x = gMapHeader.events->objectEvents[i].x;
gSaveBlock1Ptr->objectEventTemplates[j].y = gMapHeader.events->objectEvents[i].y;
gSaveBlock1Ptr->objectEventTemplates[j].elevation = localId;
gSaveBlock1Ptr->objectEventTemplates[j].trainerType = mapNum;
gSaveBlock1Ptr->objectEventTemplates[j].trainerRange_berryTreeId = mapGroup;
gSaveBlock1Ptr->objectEventTemplates[j].unk2 = 0xFF;
gSaveBlock1Ptr->objectEventTemplates[j].inConnection = 0xFF;
j++;
}
else
@@ -758,7 +755,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
Overworld_TryMapConnectionMusicTransition();
ApplyCurrentWarp();
LoadCurrentMapData();
sub_8054F68();
LoadObjEventTemplatesFromHeader();
TrySetMapSaveWarpStatus();
ClearTempFieldEventData();
ResetCyclingRoadChallengeData();
@@ -791,7 +788,7 @@ static void mli0_load_map(bool32 a1)
bool8 isOutdoors;
LoadCurrentMapData();
sub_8054F68();
LoadObjEventTemplatesFromHeader();
isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
TrySetMapSaveWarpStatus();
@@ -818,7 +815,7 @@ static void sub_80559A8(void)
bool8 isOutdoors;
LoadCurrentMapData();
sub_8054F68();
LoadObjEventTemplatesFromHeader();
isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
TrySetMapSaveWarpStatus();
SetSav1WeatherFromCurrMapHeader();