Add notes to script.c

This commit is contained in:
octorock 2021-03-04 03:49:25 +01:00
parent cdb6f5a17e
commit 05b2edad40
7 changed files with 424 additions and 238 deletions

View File

@ -3,14 +3,24 @@
#include "global.h"
typedef struct
{
u16 command;
u16 metadata;
} ScriptCommand;
typedef struct {
u16* unk_00;
union {
u16* raw;
ScriptCommand* commands; // list of commands to execute
} unk_00;
u32 unk_04;
u32 unk_08;
u8 unk_0C[0x4]; // unused
u16 unk_10;
u16 unk_12;
u32 unk_14;
u32 compareResult; // result of a compare script command
u8 unk_18;
u8 unk_19;
u8 unk_1A;

View File

@ -119,11 +119,15 @@ typedef struct {
extern struct_02024490 gUnk_02024490;
// Some kind of ScriptInterpreter state?
typedef struct {
u32 unk_00;
u16 unk_04;
u16 operationId;
u8 unk_06;
u8 unk_07;
// bit 0 is reset before each script execution
// execution is continued if bit 0 or bit 1 are true, so bit 1 can be set to execute until someone unsets bit 1
u8 continueScriptExecutionFlags;
u8 unk_08;
} struct_02033280;

View File

@ -172,7 +172,7 @@ void sub_0806DAAC(Entity* this, u32* param_2) {
u32 uVar1;
uVar1 = CheckKinstoneFused(sub_0806DA3C(this));
param_2[5] = uVar1;
gUnk_02033280.unk_07 |= 1;
gUnk_02033280.continueScriptExecutionFlags |= 1;
}
// maybe actually execute the kinstone fusion?

View File

@ -97,9 +97,10 @@ u32 sub_08069480(Entity* this) {
return (sub_0801E99C(this) << 24) >> 24;
}
// TODO param_1 possibly ScriptExecutionContext?
void sub_0806948C(Entity* this, u32* param_1) {
param_1[5] = CheckKinstoneFused((sub_08069480(this) << 24) >> 24);
gUnk_02033280.unk_07 |= 1;
gUnk_02033280.continueScriptExecutionFlags |= 1;
}
void sub_080694B0(Entity* this) {

View File

@ -201,13 +201,13 @@ void sub_080606D8(Entity* this) {
ShowNPCDialogue(this, &gUnk_0810AA30[index]);
}
void sub_08060700(Entity* entity, ScriptExecutionContext* context) {
s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO];
Coords16* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]];
void sub_08060700(Entity* this, ScriptExecutionContext* context) {
s8* var0 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO];
Coords16* coords = &gUnk_0810A66C[var0[(s8)this->field_0x68.HALF.HI]];
u32 x = coords->x + gRoomControls.roomOriginX;
u32 y = coords->y + gRoomControls.roomOriginY;
sub_0807DEDC(entity, context, x, y);
gUnk_02033280.unk_07 |= 1;
sub_0807DEDC(this, context, x, y);
gUnk_02033280.continueScriptExecutionFlags |= 1;
}
void sub_0806075C(Entity* this) {

View File

@ -128,6 +128,7 @@ void sub_08066E68(Entity* ent) {
ent->field_0x80.HWORD = ent->animIndex;
}
// TODO param_2 possibly ScriptExecutionContext?
void sub_08066E80(Entity* ent, u8* param_2) {
switch (param_2[0x18]) {
case 0:
@ -164,7 +165,7 @@ void sub_08066E80(Entity* ent, u8* param_2) {
case 4:
UpdateAnimationSingleFrame(ent);
if (ent->frames.b.f3) {
gUnk_02033280.unk_07 |= 1;
gUnk_02033280.continueScriptExecutionFlags |= 1;
return;
}
}

File diff suppressed because it is too large Load Diff