Path: blob/master/RSDKv5/RSDK/Scene/Legacy/v4/ScriptLegacyv4.hpp
1175 views
1namespace Legacy2{34namespace v45{67#define LEGACY_v4_SCRIPTCODE_COUNT (0x40000)8#define LEGACY_v4_JUMPTABLE_COUNT (0x4000)9#define LEGACY_v4_FUNCTION_COUNT (0x200)1011#define LEGACY_v4_JUMPSTACK_COUNT (0x400)12#define LEGACY_v4_FUNCSTACK_COUNT (0x400)13#define LEGACY_v4_FORSTACK_COUNT (0x400)1415struct ScriptPtr {16int32 scriptCodePtr;17int32 jumpTablePtr;18};1920struct ScriptFunction {21uint8 access;22#if LEGACY_RETRO_USE_COMPILER23char name[0x20];24#endif25ScriptPtr ptr;26};2728struct ObjectScript {29int32 frameCount;30int32 spriteSheetID;31ScriptPtr eventUpdate;32ScriptPtr eventDraw;33ScriptPtr eventStartup;34int32 frameListOffset;35AnimationFile *animFile;36};3738struct ScriptEngine {39int32 operands[0x10];40int32 temp[8];41int32 arrayPosition[9];42int32 checkResult;43};4445enum ScriptSubs { EVENT_MAIN = 0, EVENT_DRAW = 1, EVENT_SETUP = 2 };4647extern ObjectScript objectScriptList[LEGACY_v4_OBJECT_COUNT];48extern ScriptFunction scriptFunctionList[LEGACY_v4_FUNCTION_COUNT];4950extern int32 scriptCode[LEGACY_v4_SCRIPTCODE_COUNT];51extern int32 jumpTable[LEGACY_v4_JUMPTABLE_COUNT];5253extern int32 jumpTableStack[LEGACY_v4_JUMPSTACK_COUNT];54extern int32 functionStack[LEGACY_v4_FUNCSTACK_COUNT];55extern int32 foreachStack[LEGACY_v4_FORSTACK_COUNT];5657extern int32 scriptCodePos;58extern int32 scriptCodeOffset;59extern int32 jumpTablePos;60extern int32 jumpTableOffset;61extern int32 jumpTableStackPos;62extern int32 functionStackPos;63extern int32 foreachStackPos;6465extern ScriptEngine scriptEng;66extern char scriptText[0x4000];6768#if LEGACY_RETRO_USE_COMPILER69extern int32 scriptFunctionCount;70extern char scriptFunctionNames[LEGACY_v4_FUNCTION_COUNT][0x40];7172extern int32 lineID;7374void CheckAliasText(char *text);75void CheckStaticText(char *text);76bool32 CheckTableText(char *text);77void ConvertArithmaticSyntax(char *text);78void ConvertConditionalStatement(char *text);79bool32 ConvertSwitchStatement(char *text);80void ConvertFunctionText(char *text);81void CheckCaseNumber(char *text);82bool32 ReadSwitchCase(char *text);83void ReadTableValues(char *text);84void AppendIntegerToString(char *text, int32 value);85void CopyAliasStr(char *dest, char *text, bool32 arrayIndex);86bool32 CheckOpcodeType(char *text); // Never actually used8788void ParseScriptFile(char *scriptName, int32 scriptID);89#endif90void LoadBytecode(int32 scriptID, bool32 globalCode);9192void ProcessScript(int32 scriptCodeStart, int32 jumpTableStart, uint8 scriptEvent);9394void ClearScriptData();9596} // namespace v49798} // namespace Legacy99100