Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Rubberduckycooly
GitHub Repository: Rubberduckycooly/RSDKv5-Decompilation
Path: blob/master/RSDKv5/RSDK/Scene/Legacy/v3/ScriptLegacyv3.hpp
1175 views
1
2
namespace Legacy
3
{
4
5
namespace v3
6
{
7
8
#define LEGACY_v3_SCRIPTDATA_COUNT (0x40000)
9
#define LEGACY_v3_JUMPTABLE_COUNT (0x4000)
10
#define LEGACY_v3_FUNCTION_COUNT (0x200)
11
12
#define LEGACY_v3_JUMPSTACK_COUNT (0x400)
13
#define LEGACY_v3_FUNCSTACK_COUNT (0x400)
14
15
struct ScriptPtr {
16
int32 scriptCodePtr;
17
int32 jumpTablePtr;
18
};
19
20
struct ScriptFunction {
21
#if LEGACY_RETRO_USE_COMPILER
22
char name[0x20];
23
#endif
24
ScriptPtr ptr;
25
};
26
27
struct ObjectScript {
28
int32 frameCount;
29
int32 spriteSheetID;
30
ScriptPtr subMain;
31
ScriptPtr subPlayerInteraction;
32
ScriptPtr subDraw;
33
ScriptPtr subStartup;
34
int32 frameListOffset;
35
AnimationFile *animFile;
36
};
37
38
struct ScriptEngine {
39
int32 operands[10];
40
int32 tempValue[8];
41
int32 arrayPosition[3];
42
int32 checkResult;
43
};
44
45
enum ScriptSubs { SUB_MAIN = 0, SUB_PLAYERINTERACTION = 1, SUB_DRAW = 2, SUB_SETUP = 3 };
46
47
extern ObjectScript objectScriptList[LEGACY_v3_OBJECT_COUNT];
48
49
extern ScriptFunction scriptFunctionList[LEGACY_v3_FUNCTION_COUNT];
50
extern int32 scriptFunctionCount;
51
52
extern int32 scriptCode[LEGACY_v3_SCRIPTDATA_COUNT];
53
extern int32 jumpTable[LEGACY_v3_JUMPTABLE_COUNT];
54
55
extern int32 jumpTableStack[LEGACY_v3_JUMPSTACK_COUNT];
56
extern int32 functionStack[LEGACY_v3_FUNCSTACK_COUNT];
57
58
extern int32 scriptCodePos;
59
extern int32 scriptCodeOffset;
60
extern int32 jumpTablePos;
61
extern int32 jumpTableOffset;
62
63
extern int32 jumpTableStackPos;
64
extern int32 functionStackPos;
65
66
extern ScriptEngine scriptEng;
67
extern char scriptText[0x100];
68
69
extern int32 aliasCount;
70
extern int32 lineID;
71
72
#if LEGACY_RETRO_USE_COMPILER
73
74
void CheckAliasText(char *text);
75
void ConvertArithmaticSyntax(char *text);
76
void ConvertIfWhileStatement(char *text);
77
bool32 ConvertSwitchStatement(char *text);
78
void ConvertFunctionText(char *text);
79
void CheckCaseNumber(char *text);
80
bool32 ReadSwitchCase(char *text);
81
void AppendIntegerToString(char *text, int32 value);
82
void CopyAliasStr(char *dest, char *text, bool32 arrayIndex);
83
bool32 CheckOpcodeType(char *text); // Never actually used
84
85
void ParseScriptFile(char *scriptName, int32 scriptID);
86
#endif
87
88
void LoadBytecode(int32 scriptID, bool32 globalCode);
89
90
void ProcessScript(int32 scriptCodeStart, int32 jumpTableStart, uint8 scriptSub);
91
92
void ClearScriptData();
93
94
} // namespace v3
95
96
} // namespace Legacy
97