mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
Source file part of map script renaming
This commit is contained in:
parent
a589d4a630
commit
5f7a971313
@ -8,6 +8,7 @@
|
|||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
#include "constants/heal_locations.h"
|
#include "constants/heal_locations.h"
|
||||||
#include "constants/layouts.h"
|
#include "constants/layouts.h"
|
||||||
|
#include "constants/map_scripts.h"
|
||||||
#include "constants/maps.h"
|
#include "constants/maps.h"
|
||||||
#include "constants/moves.h"
|
#include "constants/moves.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "constants/event_objects.h"
|
#include "constants/event_objects.h"
|
||||||
#include "constants/flags.h"
|
#include "constants/flags.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
|
#include "constants/map_scripts.h"
|
||||||
#include "constants/maps.h"
|
#include "constants/maps.h"
|
||||||
#include "constants/secret_bases.h"
|
#include "constants/secret_bases.h"
|
||||||
#include "constants/vars.h"
|
#include "constants/vars.h"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "constants/flags.h"
|
#include "constants/flags.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
|
#include "constants/map_scripts.h"
|
||||||
#include "constants/moves.h"
|
#include "constants/moves.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
#include "constants/species.h"
|
#include "constants/species.h"
|
||||||
|
12
include/constants/map_scripts.h
Normal file
12
include/constants/map_scripts.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef GUARD_CONSTANTS_MAP_SCRIPTS_H
|
||||||
|
#define GUARD_CONSTANTS_MAP_SCRIPTS_H
|
||||||
|
|
||||||
|
#define MAP_SCRIPT_ON_LOAD 1
|
||||||
|
#define MAP_SCRIPT_ON_FRAME_TABLE 2
|
||||||
|
#define MAP_SCRIPT_ON_TRANSITION 3
|
||||||
|
#define MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE 4
|
||||||
|
#define MAP_SCRIPT_ON_RESUME 5
|
||||||
|
#define MAP_SCRIPT_ON_DIVE_WARP 6
|
||||||
|
#define MAP_SCRIPT_ON_RETURN_TO_FIELD 7
|
||||||
|
|
||||||
|
#endif // GUARD_CONSTANTS_MAP_SCRIPTS_H
|
@ -68,7 +68,7 @@ void SetContinueGameWarpToDynamicWarp(int unused);
|
|||||||
const struct MapConnection *GetMapConnection(u8 dir);
|
const struct MapConnection *GetMapConnection(u8 dir);
|
||||||
bool8 SetDiveWarpEmerge(u16 x, u16 y);
|
bool8 SetDiveWarpEmerge(u16 x, u16 y);
|
||||||
bool8 SetDiveWarpDive(u16 x, u16 y);
|
bool8 SetDiveWarpDive(u16 x, u16 y);
|
||||||
void mliX_load_map(u8 mapGroup, u8 mapNum);
|
void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum);
|
||||||
void ResetInitialPlayerAvatarState(void);
|
void ResetInitialPlayerAvatarState(void);
|
||||||
void StoreInitialPlayerAvatarState(void);
|
void StoreInitialPlayerAvatarState(void);
|
||||||
bool32 Overworld_IsBikingAllowed(void);
|
bool32 Overworld_IsBikingAllowed(void);
|
||||||
|
@ -43,16 +43,16 @@ void ScriptContext1_SetupScript(const u8 *ptr);
|
|||||||
void ScriptContext1_Stop(void);
|
void ScriptContext1_Stop(void);
|
||||||
void EnableBothScriptContexts(void);
|
void EnableBothScriptContexts(void);
|
||||||
void ScriptContext2_RunNewScript(const u8 *ptr);
|
void ScriptContext2_RunNewScript(const u8 *ptr);
|
||||||
u8 *mapheader_get_tagged_pointer(u8 tag);
|
u8 *MapHeaderGetScriptTable(u8 tag);
|
||||||
void mapheader_run_script_by_tag(u8 tag);
|
void MapHeaderRunScriptType(u8 tag);
|
||||||
u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag);
|
u8 *MapHeaderCheckScriptTable(u8 tag);
|
||||||
void mapheader_run_script_with_tag_x1(void);
|
void RunOnLoadMapScript(void);
|
||||||
void mapheader_run_script_with_tag_x3(void);
|
void RunOnTransitionMapScript(void);
|
||||||
void mapheader_run_script_with_tag_x5(void);
|
void RunOnResumeMapScript(void);
|
||||||
void mapheader_run_script_with_tag_x7(void);
|
void RunOnReturnToFieldMapScript(void);
|
||||||
void mapheader_run_script_with_tag_x6(void);
|
void RunOnDiveWarpMapScript(void);
|
||||||
bool8 mapheader_run_first_tag2_script_list_match(void);
|
bool8 TryRunOnFrameMapScript(void);
|
||||||
void mapheader_run_first_tag4_script_list_match(void);
|
void TryRunOnWarpIntoMapScript(void);
|
||||||
u32 CalculateRamScriptChecksum(void);
|
u32 CalculateRamScriptChecksum(void);
|
||||||
void ClearRamScript(void);
|
void ClearRamScript(void);
|
||||||
bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
|
bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
|
||||||
|
@ -1590,7 +1590,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
|||||||
layoutMap += mapLayout->width;
|
layoutMap += mapLayout->width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapheader_run_script_with_tag_x1();
|
RunOnLoadMapScript();
|
||||||
free(floorLayoutOffsets);
|
free(floorLayoutOffsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
if (CheckForTrainersWantingBattle() == TRUE)
|
if (CheckForTrainersWantingBattle() == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (mapheader_run_first_tag2_script_list_match() == 1)
|
if (TryRunOnFrameMapScript() == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (input->pressedBButton && TrySetupDiveEmergeScript() == TRUE)
|
if (input->pressedBButton && TrySetupDiveEmergeScript() == TRUE)
|
||||||
|
@ -53,7 +53,7 @@ void InitMap(void)
|
|||||||
{
|
{
|
||||||
InitMapLayoutData(&gMapHeader);
|
InitMapLayoutData(&gMapHeader);
|
||||||
sub_80E8EE0(gMapHeader.events);
|
sub_80E8EE0(gMapHeader.events);
|
||||||
mapheader_run_script_with_tag_x1();
|
RunOnLoadMapScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitMapFromSavedGame(void)
|
void InitMapFromSavedGame(void)
|
||||||
@ -62,7 +62,7 @@ void InitMapFromSavedGame(void)
|
|||||||
sub_80E9238(0);
|
sub_80E9238(0);
|
||||||
sub_80E8EE0(gMapHeader.events);
|
sub_80E8EE0(gMapHeader.events);
|
||||||
LoadSavedMapView();
|
LoadSavedMapView();
|
||||||
mapheader_run_script_with_tag_x1();
|
RunOnLoadMapScript();
|
||||||
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
|
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ bool8 CameraMove(int x, int y)
|
|||||||
old_y = gSaveBlock1Ptr->pos.y;
|
old_y = gSaveBlock1Ptr->pos.y;
|
||||||
connection = sub_8088950(direction, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
|
connection = sub_8088950(direction, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
|
||||||
sub_80887F8(connection, direction, x, y);
|
sub_80887F8(connection, direction, x, y);
|
||||||
mliX_load_map(connection->mapGroup, connection->mapNum);
|
LoadMapFromCameraTransition(connection->mapGroup, connection->mapNum);
|
||||||
gCamera.active = TRUE;
|
gCamera.active = TRUE;
|
||||||
gCamera.x = old_x - gSaveBlock1Ptr->pos.x;
|
gCamera.x = old_x - gSaveBlock1Ptr->pos.x;
|
||||||
gCamera.y = old_y - gSaveBlock1Ptr->pos.y;
|
gCamera.y = old_y - gSaveBlock1Ptr->pos.y;
|
||||||
|
@ -761,7 +761,7 @@ static bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapheader_run_script_with_tag_x6();
|
RunOnDiveWarpMapScript();
|
||||||
if (IsDummyWarp(&gFixedDiveWarp))
|
if (IsDummyWarp(&gFixedDiveWarp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
SetWarpDestinationToDiveWarp();
|
SetWarpDestinationToDiveWarp();
|
||||||
@ -779,7 +779,7 @@ bool8 SetDiveWarpDive(u16 x, u16 y)
|
|||||||
return SetDiveWarp(CONNECTION_DIVE, x, y);
|
return SetDiveWarp(CONNECTION_DIVE, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mliX_load_map(u8 mapGroup, u8 mapNum)
|
void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
|
||||||
{
|
{
|
||||||
s32 paletteIndex;
|
s32 paletteIndex;
|
||||||
|
|
||||||
@ -800,7 +800,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
|
|||||||
ChooseAmbientCrySpecies();
|
ChooseAmbientCrySpecies();
|
||||||
SetDefaultFlashLevel();
|
SetDefaultFlashLevel();
|
||||||
Overworld_ClearSavedMusic();
|
Overworld_ClearSavedMusic();
|
||||||
mapheader_run_script_with_tag_x3();
|
RunOnTransitionMapScript();
|
||||||
InitMap();
|
InitMap();
|
||||||
copy_map_tileset2_to_vram_2(gMapHeader.mapLayout);
|
copy_map_tileset2_to_vram_2(gMapHeader.mapLayout);
|
||||||
apply_map_tileset2_palette(gMapHeader.mapLayout);
|
apply_map_tileset2_palette(gMapHeader.mapLayout);
|
||||||
@ -813,7 +813,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
|
|||||||
RoamerMove();
|
RoamerMove();
|
||||||
DoCurrentWeather();
|
DoCurrentWeather();
|
||||||
ResetFieldTasksArgs();
|
ResetFieldTasksArgs();
|
||||||
mapheader_run_script_with_tag_x5();
|
RunOnResumeMapScript();
|
||||||
|
|
||||||
if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER || gMapHeader.regionMapSectionId != sLastMapSectionId)
|
if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER || gMapHeader.regionMapSectionId != sLastMapSectionId)
|
||||||
ShowMapNamePopup();
|
ShowMapNamePopup();
|
||||||
@ -852,7 +852,7 @@ static void mli0_load_map(u32 a1)
|
|||||||
FlagClear(FLAG_SYS_USE_FLASH);
|
FlagClear(FLAG_SYS_USE_FLASH);
|
||||||
SetDefaultFlashLevel();
|
SetDefaultFlashLevel();
|
||||||
Overworld_ClearSavedMusic();
|
Overworld_ClearSavedMusic();
|
||||||
mapheader_run_script_with_tag_x3();
|
RunOnTransitionMapScript();
|
||||||
UpdateLocationHistoryForRoamer();
|
UpdateLocationHistoryForRoamer();
|
||||||
RoamerMoveToOtherLocationSet();
|
RoamerMoveToOtherLocationSet();
|
||||||
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
|
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
|
||||||
@ -2126,7 +2126,7 @@ static void sub_8086988(u32 a1)
|
|||||||
sub_80AEE84();
|
sub_80AEE84();
|
||||||
if (!a1)
|
if (!a1)
|
||||||
SetUpFieldTasks();
|
SetUpFieldTasks();
|
||||||
mapheader_run_script_with_tag_x5();
|
RunOnResumeMapScript();
|
||||||
TryStartMirageTowerPulseBlendEffect();
|
TryStartMirageTowerPulseBlendEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,7 +2136,7 @@ static void sub_80869DC(void)
|
|||||||
gTotalCameraPixelOffsetY = 0;
|
gTotalCameraPixelOffsetY = 0;
|
||||||
ResetEventObjects();
|
ResetEventObjects();
|
||||||
TrySpawnEventObjects(0, 0);
|
TrySpawnEventObjects(0, 0);
|
||||||
mapheader_run_first_tag4_script_list_match();
|
TryRunOnWarpIntoMapScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mli4_mapscripts_and_other(void)
|
static void mli4_mapscripts_and_other(void)
|
||||||
@ -2153,14 +2153,14 @@ static void mli4_mapscripts_and_other(void)
|
|||||||
SetPlayerAvatarTransitionFlags(player->transitionFlags);
|
SetPlayerAvatarTransitionFlags(player->transitionFlags);
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
TrySpawnEventObjects(0, 0);
|
TrySpawnEventObjects(0, 0);
|
||||||
mapheader_run_first_tag4_script_list_match();
|
TryRunOnWarpIntoMapScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086A68(void)
|
static void sub_8086A68(void)
|
||||||
{
|
{
|
||||||
sub_808E16C(0, 0);
|
sub_808E16C(0, 0);
|
||||||
RotatingGate_InitPuzzleAndGraphics();
|
RotatingGate_InitPuzzleAndGraphics();
|
||||||
mapheader_run_script_with_tag_x7();
|
RunOnReturnToFieldMapScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086A80(void)
|
static void sub_8086A80(void)
|
||||||
|
42
src/script.c
42
src/script.c
@ -241,7 +241,7 @@ void ScriptContext2_RunNewScript(const u8 *ptr)
|
|||||||
while (RunScriptCommand(&sScriptContext2) == TRUE);
|
while (RunScriptCommand(&sScriptContext2) == TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *mapheader_get_tagged_pointer(u8 tag)
|
u8 *MapHeaderGetScriptTable(u8 tag)
|
||||||
{
|
{
|
||||||
const u8 *mapScripts = gMapHeader.mapScripts;
|
const u8 *mapScripts = gMapHeader.mapScripts;
|
||||||
|
|
||||||
@ -261,16 +261,16 @@ u8 *mapheader_get_tagged_pointer(u8 tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_by_tag(u8 tag)
|
void MapHeaderRunScriptType(u8 tag)
|
||||||
{
|
{
|
||||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
ScriptContext2_RunNewScript(ptr);
|
ScriptContext2_RunNewScript(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
|
u8 *MapHeaderCheckScriptTable(u8 tag)
|
||||||
{
|
{
|
||||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||||
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -291,45 +291,45 @@ u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_with_tag_x1(void)
|
void RunOnLoadMapScript(void)
|
||||||
{
|
{
|
||||||
mapheader_run_script_by_tag(1);
|
MapHeaderRunScriptType(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_with_tag_x3(void)
|
void RunOnTransitionMapScript(void)
|
||||||
{
|
{
|
||||||
mapheader_run_script_by_tag(3);
|
MapHeaderRunScriptType(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_with_tag_x5(void)
|
void RunOnResumeMapScript(void)
|
||||||
{
|
{
|
||||||
mapheader_run_script_by_tag(5);
|
MapHeaderRunScriptType(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_with_tag_x7(void)
|
void RunOnReturnToFieldMapScript(void)
|
||||||
{
|
{
|
||||||
mapheader_run_script_by_tag(7);
|
MapHeaderRunScriptType(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_script_with_tag_x6(void)
|
void RunOnDiveWarpMapScript(void)
|
||||||
{
|
{
|
||||||
mapheader_run_script_by_tag(6);
|
MapHeaderRunScriptType(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 mapheader_run_first_tag2_script_list_match(void)
|
bool8 TryRunOnFrameMapScript(void)
|
||||||
{
|
{
|
||||||
u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(2);
|
u8 *ptr = MapHeaderCheckScriptTable(2);
|
||||||
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return 0;
|
return FALSE;
|
||||||
|
|
||||||
ScriptContext1_SetupScript(ptr);
|
ScriptContext1_SetupScript(ptr);
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mapheader_run_first_tag4_script_list_match(void)
|
void TryRunOnWarpIntoMapScript(void)
|
||||||
{
|
{
|
||||||
u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(4);
|
u8 *ptr = MapHeaderCheckScriptTable(4);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
ScriptContext2_RunNewScript(ptr);
|
ScriptContext2_RunNewScript(ptr);
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ void sub_81D5FB4(u16 *mapArg)
|
|||||||
dst += 31;
|
dst += 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapheader_run_script_with_tag_x1();
|
RunOnLoadMapScript();
|
||||||
FreeDataStruct();
|
FreeDataStruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user