diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/fieldmap.h | 37 | ||||
-rw-r--r-- | include/global.h | 33 | ||||
-rw-r--r-- | include/script.h | 43 |
3 files changed, 113 insertions, 0 deletions
diff --git a/include/fieldmap.h b/include/fieldmap.h new file mode 100644 index 000000000..1abef38da --- /dev/null +++ b/include/fieldmap.h @@ -0,0 +1,37 @@ +#ifndef GUARD_FIELDMAP_H +#define GUARD_FIELDMAP_H + +typedef void (*TilesetCB)(void); + +struct Tileset +{ + bool8 isCompressed; + bool8 isSecondary; + void *tiles; + void *palettes; + void *metatiles; + void *metatileAttributes; + TilesetCB callback; +}; + +struct MapData +{ + u32 width; + u32 height; + void *border; + void *map; + struct Tileset *primaryTileset; + struct Tileset *secondaryTileset; +}; + +struct MapHeader +{ + struct MapData *mapData; + void *events; + u8 *mapScripts; + // TODO: rest of struct +}; + +extern struct MapHeader gMapHeader; + +#endif // GUARD_FIELDMAP_H diff --git a/include/global.h b/include/global.h index e7e828aec..6fb9e2604 100644 --- a/include/global.h +++ b/include/global.h @@ -72,6 +72,39 @@ struct SecretBaseRecord u8 partyEVs[6]; }; +struct WarpData +{ + s8 mapGroup; + s8 mapNum; + u8 warpId; + s16 x, y; +}; + +struct RamScriptData +{ + u8 magic; + u8 mapGroup; + u8 mapNum; + u8 objectId; + u8 script[995]; +}; + +struct RamScript +{ + u32 checksum; + struct RamScriptData data; +}; + +struct SaveBlock1 +{ + struct Coords16 pos; + struct WarpData location; + u8 filler[0x3684]; + struct RamScript ramScript; +}; + +extern struct SaveBlock1 gSaveBlock1; + struct Time { s16 days; diff --git a/include/script.h b/include/script.h new file mode 100644 index 000000000..d38d176f1 --- /dev/null +++ b/include/script.h @@ -0,0 +1,43 @@ +#ifndef GUARD_SCRIPT_H +#define GUARD_SCRIPT_H + +struct ScriptContext; + +typedef bool8 (*ScrCmdFunc)(struct ScriptContext *); + +struct ScriptContext +{ + u8 stackDepth; + u8 mode; + u8 comparisonResult; + u8 (*nativePtr)(void); + u8 *scriptPtr; + u8 *stack[20]; + ScrCmdFunc *cmdTable; + ScrCmdFunc *cmdTableEnd; + u32 data[4]; +}; + +void script_env_init(struct ScriptContext *ctx, void *cmdTable, void *cmdTableEnd); +u8 script_setup_bytecode_script(struct ScriptContext *ctx, void *ptr); +void script_setup_asm_script(struct ScriptContext *ctx, void *ptr); +void script_stop(struct ScriptContext *ctx); +u8 sub_80653EC(struct ScriptContext *ctx); +u8 script_stack_push(struct ScriptContext *ctx, u8 *ptr); +u8 *script_stack_pop(struct ScriptContext *ctx); +void script_jump(struct ScriptContext *ctx, u8 *ptr); +void script_call(struct ScriptContext *ctx, u8 *ptr); +void script_return(struct ScriptContext *ctx); +u16 script_read_halfword(struct ScriptContext *ctx); +u32 script_read_word(struct ScriptContext *ctx); +void script_env_2_enable(void); +void script_env_2_disable(void); +bool8 script_env_2_is_enabled(void); +void script_env_1_init(void); +bool8 script_env_2_run_current_script(void); +void script_env_1_execute_new_script(u8 *ptr); +void sub_80655F0(void); +void script_env_2_enable_and_set_ctx_running(); +void script_env_2_execute_new_script(u8 *ptr); + +#endif // GUARD_SCRIPT_H |