mirror of
https://github.com/pret/pokeemerald.git
synced 2026-09-14 14:08:19 -05:00
Merge 7c11625f29 into c2dcc629fd
This commit is contained in:
@@ -11,7 +11,7 @@ struct ScriptContext
|
||||
u8 stackDepth;
|
||||
u8 mode;
|
||||
u8 comparisonResult;
|
||||
u8 (*nativePtr)(void);
|
||||
bool8 (*nativePtr)(void);
|
||||
const u8 *scriptPtr;
|
||||
const u8 *stack[20];
|
||||
ScrCmdFunc *cmdTable;
|
||||
@@ -41,9 +41,6 @@ void ScriptContext_SetupScript(const u8 *ptr);
|
||||
void ScriptContext_Stop(void);
|
||||
void ScriptContext_Enable(void);
|
||||
void RunScriptImmediately(const u8 *ptr);
|
||||
u8 *MapHeaderGetScriptTable(u8 tag);
|
||||
void MapHeaderRunScriptType(u8 tag);
|
||||
u8 *MapHeaderCheckScriptTable(u8 tag);
|
||||
void RunOnLoadMapScript(void);
|
||||
void RunOnTransitionMapScript(void);
|
||||
void RunOnResumeMapScript(void);
|
||||
@@ -51,9 +48,8 @@ void RunOnReturnToFieldMapScript(void);
|
||||
void RunOnDiveWarpMapScript(void);
|
||||
bool8 TryRunOnFrameMapScript(void);
|
||||
void TryRunOnWarpIntoMapScript(void);
|
||||
u32 CalculateRamScriptChecksum(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 localId);
|
||||
const u8 *GetRamScript(u8 objectId, const u8 *script);
|
||||
bool32 ValidateSavedRamScript(void);
|
||||
u8 *GetSavedRamScriptIfValid(void);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTable[];
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
|
||||
|
||||
// 0x1 in English FRLG, 0x2 in English RS, 0x4 in German RS
|
||||
#define LANGUAGE_MASK 0x1
|
||||
|
||||
// 0x1 in FireRed, 0x2 in LeafGreen, 0x80 in Ruby, 0x100 in Sapphire
|
||||
#define VERSION_MASK (1 << 9)
|
||||
|
||||
@@ -27,16 +30,14 @@ extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
|
||||
#define mStatus data[2]
|
||||
#define mValid data[3]
|
||||
|
||||
EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0};
|
||||
static EWRAM_DATA struct ScriptContext sMysteryEventScriptContext = {0};
|
||||
|
||||
static bool32 CheckCompatibility(u16 unk0, u32 unk1, u16 unk2, u32 version)
|
||||
{
|
||||
// 0x1 in English FRLG, 0x2 in English RS, 0x4 in German RS
|
||||
if (!(unk0 & 0x1))
|
||||
if (!(unk0 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
// Same as above
|
||||
if (!(unk1 & 0x1))
|
||||
if (!(unk1 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
// 0x1 in FRLG, 0x4 in RS
|
||||
|
||||
16
src/script.c
16
src/script.c
@@ -269,7 +269,7 @@ void RunScriptImmediately(const u8 *ptr)
|
||||
while (RunScriptCommand(&sImmediateScriptContext) == TRUE);
|
||||
}
|
||||
|
||||
u8 *MapHeaderGetScriptTable(u8 tag)
|
||||
static u8 *MapHeaderGetScriptTable(u8 tag)
|
||||
{
|
||||
const u8 *mapScripts = gMapHeader.mapScripts;
|
||||
|
||||
@@ -289,14 +289,14 @@ u8 *MapHeaderGetScriptTable(u8 tag)
|
||||
}
|
||||
}
|
||||
|
||||
void MapHeaderRunScriptType(u8 tag)
|
||||
static void MapHeaderRunScriptType(u8 tag)
|
||||
{
|
||||
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||
if (ptr)
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
u8 *MapHeaderCheckScriptTable(u8 tag)
|
||||
static u8 *MapHeaderCheckScriptTable(u8 tag)
|
||||
{
|
||||
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||
|
||||
@@ -368,7 +368,7 @@ void TryRunOnWarpIntoMapScript(void)
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
u32 CalculateRamScriptChecksum(void)
|
||||
static u32 CalculateRamScriptChecksum(void)
|
||||
{
|
||||
return CalcCRC16WithTable((u8 *)(&gSaveBlock1Ptr->ramScript.data), sizeof(gSaveBlock1Ptr->ramScript.data));
|
||||
}
|
||||
@@ -413,11 +413,9 @@ const u8 *GetRamScript(u8 localId, const u8 *script)
|
||||
ClearRamScript();
|
||||
return script;
|
||||
}
|
||||
else
|
||||
{
|
||||
gRamScriptRetAddr = script;
|
||||
return scriptData->script;
|
||||
}
|
||||
|
||||
gRamScriptRetAddr = script;
|
||||
return scriptData->script;
|
||||
}
|
||||
|
||||
#define NO_OBJECT LOCALID_PLAYER
|
||||
|
||||
Reference in New Issue
Block a user