GroundScript improvements

This commit is contained in:
Mateon1 2024-10-28 19:58:00 +01:00
parent ea037dfcb5
commit 31b64b7793
No known key found for this signature in database
GPG Key ID: 6A6067123E4CAF6E
2 changed files with 12 additions and 23 deletions

View File

@ -8,8 +8,8 @@ extern void ResetCurrentScriptFile();
static EWRAM_DATA s16 sUnknown_2039DE0 = {0};
extern const u32 gNullGroundScript;
extern const u32 *gMapScriptTable[]; // 811E2F8
extern const struct GroundScriptHeader gNullGroundScript;
extern const struct GroundScriptHeader *gMapScriptTable[]; // 811E2F8
void sub_80A7714(u32 a0)
{
@ -64,8 +64,7 @@ bool8 ChangeScriptFile(s16 a0)
return FALSE;
}
// TODO review this later
const u32 *GetGroundScript(s16 a0)
const struct GroundScriptHeader *GetGroundScript(s16 a0)
{
if (a0 != -1)
return gMapScriptTable[a0];

View File

@ -1,39 +1,29 @@
#include "global.h"
#include "debug.h"
#include "ground_script.h"
struct unkStruct_80A77D0
{
u32 unk0;
u32 unk4;
u32 unk8;
};
struct unkStruct_203B4B8
{
u32 unk0;
};
EWRAM_DATA_2 struct unkStruct_203B4B8 gCurrentGroundLink = {0};
EWRAM_DATA_2 const struct GroundLink *gCurrentGroundLink = NULL;
extern DebugLocation gUnknown_8118798;
extern struct unkStruct_80A77D0 *GetGroundScript(s16 r0, DebugLocation *r1);
extern const struct GroundScriptHeader *GetGroundScript(s16 r0, DebugLocation *r1);
void sub_80AD868(void)
{
gCurrentGroundLink.unk0 = 0;
gCurrentGroundLink = NULL;
}
void sub_80AD874(void)
{
gCurrentGroundLink.unk0 = 0;
gCurrentGroundLink = NULL;
}
void GroundLink_Select(s16 r0)
{
gCurrentGroundLink.unk0 = GetGroundScript(r0, &gUnknown_8118798)->unk8;
const struct GroundScriptHeader *gs = GetGroundScript(r0, &gUnknown_8118798);
gCurrentGroundLink = gs->links;
}
u32 GetCurrentGroundLink(s16 r0)
const struct GroundLink *GetCurrentGroundLink(s16 r0)
{
u32 a = r0;
return gCurrentGroundLink.unk0 + a * 8;
return &gCurrentGroundLink[a];
}