rename Bytecode alias

This commit is contained in:
Alex Bates 2020-08-16 04:23:40 +01:00
parent 5103d1cc7d
commit 0d8814555e
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
7 changed files with 67 additions and 67 deletions

View File

@ -157,7 +157,7 @@ typedef struct Trigger {
/* 0x06 */ s16 panelFlagIndex;
/* 0x08 */ s32 colliderID;
/* 0x0C */ UNK_FUN_PTR(functionHandler);
/* 0x10 */ bytecode* scriptStart;
/* 0x10 */ Bytecode* scriptStart;
/* 0x14 */ struct Script* runningScript;
/* 0x18 */ s32 priority;
/* 0x1C */ s32 scriptVars[3];
@ -175,12 +175,12 @@ typedef struct Enemy {
/* 0x0A */ s16 spawnPos[3];
/* 0x10 */ char unk_10[8];
/* 0x18 */ struct StaticNpcSettings* npcSettings;
/* 0x1C */ bytecode* initBytecode;
/* 0x20 */ bytecode* interactBytecode;
/* 0x24 */ bytecode* aiBytecode;
/* 0x28 */ bytecode* hitBytecode;
/* 0x2C */ bytecode* auxBytecode;
/* 0x30 */ bytecode* defeatBytecode;
/* 0x1C */ Bytecode* initBytecode;
/* 0x20 */ Bytecode* interactBytecode;
/* 0x24 */ Bytecode* aiBytecode;
/* 0x28 */ Bytecode* hitBytecode;
/* 0x2C */ Bytecode* auxBytecode;
/* 0x30 */ Bytecode* defeatBytecode;
/* 0x34 */ struct Script* initScript;
/* 0x38 */ struct Script* interactScript;
/* 0x3C */ struct Script* aiScript;
@ -210,11 +210,11 @@ typedef struct StaticNpcSettings {
/* 0x04 */ s16 height;
/* 0x06 */ s16 radius;
/* 0x08 */ UNK_PTR otherAI;
/* 0x0C */ bytecode* interactScript;
/* 0x10 */ bytecode* aiScript;
/* 0x14 */ bytecode* hitScript;
/* 0x18 */ bytecode* auxScript;
/* 0x1C */ bytecode* defeatScript;
/* 0x0C */ Bytecode* interactScript;
/* 0x10 */ Bytecode* aiScript;
/* 0x14 */ Bytecode* hitScript;
/* 0x18 */ Bytecode* auxScript;
/* 0x1C */ Bytecode* defeatScript;
/* 0x20 */ s32 flags;
/* 0x24 */ char unk_24[4];
/* 0x28 */ s16 level;
@ -230,8 +230,8 @@ typedef struct Script {
/* 0x005 */ u8 blocked; /* 1 = blocking */
/* 0x006 */ s8 loopDepth; /* how many nested loops we are in, >= 8 hangs forever */
/* 0x007 */ s8 switchDepth; /* how many nested switches we are in, max = 8 */
/* 0x008 */ bytecode* ptrNextLine;
/* 0x00C */ bytecode* ptrReadPos;
/* 0x008 */ Bytecode* ptrNextLine;
/* 0x00C */ Bytecode* ptrReadPos;
/* 0x010 */ u8 labelIndices[16];
/* 0x020 */ UNK_PTR labelPositions[16];
/* 0x060 */ s32 deleted; /* set to zero in KillScript when malloc'd */
@ -255,9 +255,9 @@ typedef struct Script {
/* 0x150 */ f32 timeScale;
/* 0x154 */ f32 frameCounter;
/* 0x158 */ char unk_158[4];
/* 0x15C */ bytecode* ptrFirstLine;
/* 0x160 */ bytecode* ptrSavedPosition;
/* 0x164 */ bytecode* ptrCurrentLine;
/* 0x15C */ Bytecode* ptrFirstLine;
/* 0x160 */ Bytecode* ptrSavedPosition;
/* 0x164 */ Bytecode* ptrCurrentLine;
} Script; // size = 0x168
typedef struct Entity {
@ -268,7 +268,7 @@ typedef struct Entity {
/* 0x12 */ char unk_12[4];
/* 0x16 */ s16 shadowIndex;
/* 0x18 */ char unk_18[16];
/* 0x28 */ bytecode* boundScript;
/* 0x28 */ Bytecode* boundScript;
/* 0x2C */ char unk_2C[12];
/* 0x38 */ struct StaticEntityData* static_data;
/* 0x3C */ char unk_3C[4];
@ -312,7 +312,7 @@ typedef struct StaticNpc {
/* 0x004 */ struct StaticNpcSettings* npcSettings;
/* 0x008 */ s32 spawnPos[3];
/* 0x014 */ s32 flags;
/* 0x018 */ bytecode* initScript;
/* 0x018 */ Bytecode* initScript;
/* 0x01C */ char unk_1C[8];
/* 0x024 */ s32 spawnYaw;
/* 0x028 */ s16 itemDrops[25];
@ -998,17 +998,17 @@ typedef struct Partner {
/* 0x08 */ s32 dmaDest;
/* 0x0C */ s32 isFlying;
/* 0x10 */ UNK_FUN_PTR(fpInit);
/* 0x14 */ bytecode* spScriptA;
/* 0x18 */ bytecode* spScriptB;
/* 0x1C */ bytecode* spScriptC;
/* 0x20 */ bytecode* spScriptD;
/* 0x14 */ Bytecode* spScriptA;
/* 0x18 */ Bytecode* spScriptB;
/* 0x1C */ Bytecode* spScriptC;
/* 0x20 */ Bytecode* spScriptD;
/* 0x24 */ s32 idleAnim;
/* 0x28 */ UNK_FUN_PTR(fpFuncA);
/* 0x2C */ UNK_FUN_PTR(fpFuncB);
/* 0x30 */ UNK_FUN_PTR(fpFuncC);
/* 0x34 */ UNK_FUN_PTR(fpFuncD);
/* 0x38 */ UNK_FUN_PTR(fpFuncE);
/* 0x3C */ bytecode* spScriptX;
/* 0x3C */ Bytecode* spScriptX;
} Partner; // size = 0x40
typedef struct FontRasterSet {
@ -1178,10 +1178,10 @@ typedef struct Actor {
/* 0x1BA */ char unk_1BA[2];
/* 0x1BC */ u8 hpFraction; /* used to render HP bar */
/* 0x1BD */ char unk_1BD[3];
/* 0x1C0 */ bytecode* idleCode;
/* 0x1C4 */ bytecode* takeTurnCode;
/* 0x1C8 */ bytecode* onHitCode;
/* 0x1CC */ bytecode* onTurnChangeCode;
/* 0x1C0 */ Bytecode* idleCode;
/* 0x1C4 */ Bytecode* takeTurnCode;
/* 0x1C8 */ Bytecode* onHitCode;
/* 0x1CC */ Bytecode* onTurnChangeCode;
/* 0x1D0 */ struct Script* idleScript;
/* 0x1D4 */ struct Script* takeTurnScript;
/* 0x1D8 */ struct Script* onHitScript;

View File

@ -9,10 +9,10 @@ void osCleanupThread(void);
void clone_model(u16 srcModelID, u16 newModelID);
void update_collider_transform(s16 colliderID);
s32 get_variable(Script* script, bytecode var);
s32 set_variable(Script* script, bytecode var, s32 value);
f32 get_float_variable(Script* script, bytecode var);
f32 set_float_variable(Script* script, bytecode var, f32 value);
s32 get_variable(Script* script, Bytecode var);
s32 set_variable(Script* script, Bytecode var, s32 value);
f32 get_float_variable(Script* script, Bytecode var);
f32 set_float_variable(Script* script, Bytecode var, f32 value);
void set_script_timescale(Script* script, f32 timescale);
f32 sin_deg(f32 x);
f32 cos_deg(f32 x);

View File

@ -8,6 +8,6 @@
#define UNK_FUN_PTR(name) void(*name)(void)
#define UNK_ARGS
typedef s32 bytecode;
typedef s32 Bytecode;
#endif

View File

@ -407,17 +407,17 @@ INCLUDE_ASM(code_e92d0_len_5da0, si_execute_next_command);
INCLUDE_ASM(code_e92d0_len_5da0, si_handle_end);
s32 INCLUDE_ASM(code_e92d0_len_5da0, get_variable, Script* script, bytecode var);
s32 INCLUDE_ASM(code_e92d0_len_5da0, get_variable, Script* script, Bytecode var);
INCLUDE_ASM(code_e92d0_len_5da0, get_variable_index);
INCLUDE_ASM(code_e92d0_len_5da0, get_variable_index_alt);
s32 INCLUDE_ASM(code_e92d0_len_5da0, set_variable, Script* script, bytecode var, s32 value);
s32 INCLUDE_ASM(code_e92d0_len_5da0, set_variable, Script* script, Bytecode var, s32 value);
f32 INCLUDE_ASM(code_e92d0_len_5da0, get_float_variable, Script* script, bytecode var);
f32 INCLUDE_ASM(code_e92d0_len_5da0, get_float_variable, Script* script, Bytecode var);
f32 INCLUDE_ASM(code_e92d0_len_5da0, set_float_variable, Script* script, bytecode var, f32 value);
f32 INCLUDE_ASM(code_e92d0_len_5da0, set_float_variable, Script* script, Bytecode var, f32 value);
INCLUDE_ASM(code_e92d0_len_5da0, si_goto_label);

View File

@ -13,7 +13,7 @@ Npc* resolve_npc(Script* script, NPC npcID) {
INCLUDE_ASM(code_f2470_len_27f0, set_npc_animation);
s32 DeleteNpc(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
Npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
if (npcPtr) {
@ -24,9 +24,9 @@ s32 DeleteNpc(Script* script, s32 initialCall) {
}
s32 GetNpcPointer(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode npcID = get_variable(script, *ptrReadPos++);
bytecode varNPC = *ptrReadPos++;
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode npcID = get_variable(script, *ptrReadPos++);
Bytecode varNPC = *ptrReadPos++;
set_variable(script, varNPC, get_npc_safe(npcID));
return 2;

View File

@ -58,9 +58,9 @@ s32 func_802D0C94(Script* script, s32 initialCall) {
}
s32 SetMessageString(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
bytecode string = get_variable(script, *ptrReadPos++);
bytecode index = get_variable(script, *ptrReadPos++);
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode string = get_variable(script, *ptrReadPos++);
Bytecode index = get_variable(script, *ptrReadPos++);
set_message_string(string, index);
return 2;

View File

@ -32,10 +32,10 @@ s32 UpdateLerp(Script* script, s32 initialCall) {
}
s32 RandInt(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
s32 max = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
Bytecode outVar = *ptrReadPos++;
set_variable(script, outVar, rand_int(max));
@ -43,11 +43,11 @@ s32 RandInt(Script* script, s32 initialCall) {
}
s32 GetAngleBetweenNPCs(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
NPC aID = get_variable(script, *ptrReadPos++);
NPC bID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
Bytecode outVar = *ptrReadPos++;
Npc* a = resolve_npc(script, aID);
Npc* b = resolve_npc(script, bID);
@ -58,10 +58,10 @@ s32 GetAngleBetweenNPCs(Script* script, s32 initialCall) {
s32 GetAngleToNPC(Script* script, s32 initialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
NPC npcID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
Bytecode outVar = *ptrReadPos++;
Npc* npc = resolve_npc(script, npcID);
set_variable(script, outVar, atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z));
@ -71,10 +71,10 @@ s32 GetAngleToNPC(Script* script, s32 initialCall) {
s32 GetAngleToPlayer(Script* script, s32 initialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
NPC npcID = get_variable(script, *ptrReadPos++);
bytecode outVar = *ptrReadPos++;
Bytecode outVar = *ptrReadPos++;
Npc* npc = resolve_npc(script, npcID);
set_variable(script, outVar, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z));
@ -83,7 +83,7 @@ s32 GetAngleToPlayer(Script* script, s32 initialCall) {
}
s32 AwaitPlayerApproach(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
@ -111,7 +111,7 @@ s32 AwaitPlayerApproach(Script* script, s32 initialCall) {
}
s32 IsPlayerWithin(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
@ -119,7 +119,7 @@ s32 IsPlayerWithin(Script* script, s32 initialCall) {
s32* distanceRequired = &script->functionTemp[2];
f32 distance;
bytecode outVar = SI_VAR_0;
Bytecode outVar = SI_VAR_0;
if (initialCall) {
*targetX = get_variable(script, *ptrReadPos++);
@ -142,7 +142,7 @@ s32 IsPlayerWithin(Script* script, s32 initialCall) {
}
s32 AwaitPlayerLeave(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
PlayerStatus* playerStatus = &gPlayerStatus;
s32* targetX = &script->functionTemp[0];
@ -170,12 +170,12 @@ s32 AwaitPlayerLeave(Script* script, s32 initialCall) {
}
s32 AddVectorPolar(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
bytecode xVar = *ptrReadPos++;
Bytecode xVar = *ptrReadPos++;
f32 x = get_float_variable(script, xVar);
bytecode yVar = *ptrReadPos++;
Bytecode yVar = *ptrReadPos++;
f32 y = get_float_variable(script, yVar);
f32 r = get_float_variable(script, *ptrReadPos++);
@ -260,9 +260,9 @@ INCLUDE_ASM(code_f8f60_len_1560, LoadPath);
INCLUDE_ASM(code_f8f60_len_1560, GetNextPathPos);
s32 GetDist2D(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
bytecode outVar = *ptrReadPos++;
Bytecode outVar = *ptrReadPos++;
set_float_variable(script, outVar, dist2D(
get_float_variable(script, *ptrReadPos++),
get_float_variable(script, *ptrReadPos++),
@ -279,7 +279,7 @@ s32 func_802D5830(Script* script, s32 initialCall) {
}
s32 func_802D585C(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
s32 setMode = get_variable(script, *ptrReadPos++);
s32 flags = get_variable(script, *ptrReadPos++);
@ -295,7 +295,7 @@ s32 func_802D585C(Script* script, s32 initialCall) {
}
s32 SetValueByRef(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
s32 dest = get_variable(script, *ptrReadPos++); /* Reference */
s32 src = get_variable(script, *ptrReadPos++);
@ -305,10 +305,10 @@ s32 SetValueByRef(Script* script, s32 initialCall) {
}
s32 GetValueByRef(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
s32 src = get_variable(script, *ptrReadPos++); /* Reference */
bytecode dest = *ptrReadPos++;
Bytecode dest = *ptrReadPos++;
set_variable(script, dest, get_variable(script, src));
@ -345,7 +345,7 @@ s32 SetGameMode(Script* script, s32 initialCall) {
}
s32 ClampAngleInt(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
set_variable(script, *ptrReadPos, clamp_angle(get_variable(script, *ptrReadPos)));
@ -353,7 +353,7 @@ s32 ClampAngleInt(Script* script, s32 initialCall) {
}
s32 ClampAngleFloat(Script* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos;
Bytecode* ptrReadPos = script->ptrReadPos;
set_float_variable(script, *ptrReadPos, clamp_angle(get_float_variable(script, *ptrReadPos)));