mirror of
https://github.com/pret/pokeheartgold.git
synced 2026-05-11 21:34:25 -05:00
75 lines
2.0 KiB
C
75 lines
2.0 KiB
C
#ifndef POKEHEARTGOLD_SCRIPT_H
|
|
#define POKEHEARTGOLD_SCRIPT_H
|
|
|
|
#include "save.h"
|
|
#include "map_events_internal.h"
|
|
// #include "map_matrix.h"
|
|
typedef struct MAPMATRIX MAPMATRIX;
|
|
|
|
#define SCRIPT_MODE_STOPPED 0
|
|
#define SCRIPT_MODE_BYTECODE 1
|
|
#define SCRIPT_MODE_NATIVE 2
|
|
|
|
#define SCRIPT_COMPARISON_RESULT_LESS 0
|
|
#define SCRIPT_COMPARISON_RESULT_EQUAL 1
|
|
#define SCRIPT_COMPARISON_RESULT_GREATER 2
|
|
|
|
#define ScriptReadByte(ctx) *(ctx->script_ptr++)
|
|
|
|
typedef struct UnkSavStruct80_Sub20 {
|
|
int unk0;
|
|
} UnkSavStruct80_Sub20;
|
|
|
|
typedef struct UnkSavStruct80_Sub3C UnkSavStruct80_Sub3C;
|
|
|
|
typedef struct UnkSavStruct80 {
|
|
u8 unk0[0x8];
|
|
void* bg_config;
|
|
SAVEDATA* savedata;
|
|
void* unk10;
|
|
MAP_EVENTS* map_events;
|
|
u8 unk18[0x8];
|
|
UnkSavStruct80_Sub20* unk20;
|
|
u8 unk24[0xC];
|
|
MAPMATRIX* map_matrix;
|
|
u8 unk34[0x8];
|
|
UnkSavStruct80_Sub3C* unk3C;
|
|
u8 unk40[0xE8];
|
|
} UnkSavStruct80; // size: 0x128
|
|
|
|
typedef struct SCRIPTCONTEXT SCRIPTCONTEXT;
|
|
typedef BOOL (*ScrCmdFunc)(SCRIPTCONTEXT* ctx);
|
|
|
|
typedef struct SCRIPTCONTEXT {
|
|
u8 stack_depth;
|
|
u8 mode;
|
|
u8 comparison_result;
|
|
u8 unk3;
|
|
ScrCmdFunc native_ptr;
|
|
const u8* script_ptr;
|
|
const u8* stack[20];
|
|
ScrCmdFunc* cmd_table;
|
|
u32 cmd_count;
|
|
u32 data[4];
|
|
void* unk74;
|
|
void* msg_data;
|
|
u8* unk7C;
|
|
void* unk80;
|
|
} SCRIPTCONTEXT;
|
|
|
|
void InitScriptContext(SCRIPTCONTEXT* ctx, ScrCmdFunc* cmd_table, u32 cmd_count);
|
|
BOOL SetupBytecodeScript(SCRIPTCONTEXT* ctx, const u8* ptr);
|
|
void SetupNativeScript(SCRIPTCONTEXT* ctx, ScrCmdFunc ptr);
|
|
void StopScript(SCRIPTCONTEXT* ctx);
|
|
void sub_0203FD68(SCRIPTCONTEXT* ctx, void* unk);
|
|
BOOL RunScriptCommand(SCRIPTCONTEXT* ctx);
|
|
BOOL ScriptPush(SCRIPTCONTEXT* ctx, const u8* ptr);
|
|
const u8* ScriptPop(SCRIPTCONTEXT* ctx);
|
|
void ScriptJump(SCRIPTCONTEXT* ctx, const u8* ptr);
|
|
void ScriptCall(SCRIPTCONTEXT* ctx, const u8* ptr);
|
|
void ScriptReturn(SCRIPTCONTEXT* ctx);
|
|
u16 ScriptReadHalfword(SCRIPTCONTEXT* ctx);
|
|
u32 ScriptReadWord(SCRIPTCONTEXT* ctx);
|
|
|
|
#endif
|