mirror of https://github.com/zeldaret/tmc.git
Reset changes to script.c
This commit is contained in:
parent
461ab77595
commit
1a8fad358a
|
|
@ -3,24 +3,14 @@
|
|||
|
||||
#include "global.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 command;
|
||||
u16 metadata;
|
||||
} ScriptCommand;
|
||||
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
u16* raw;
|
||||
ScriptCommand* commands; // list of commands to execute
|
||||
} unk_00;
|
||||
u16* unk_00;
|
||||
u32 unk_04;
|
||||
u32 unk_08;
|
||||
u8 unk_0C[0x4]; // unused
|
||||
u16 unk_10;
|
||||
u16 unk_12;
|
||||
u32 compareResult; // result of a compare script command
|
||||
u32 unk_14;
|
||||
u8 unk_18;
|
||||
u8 unk_19;
|
||||
u8 unk_1A;
|
||||
|
|
|
|||
|
|
@ -119,15 +119,11 @@ typedef struct {
|
|||
|
||||
extern struct_02024490 gUnk_02024490;
|
||||
|
||||
|
||||
// Some kind of ScriptInterpreter state?
|
||||
typedef struct {
|
||||
u32 unk_00;
|
||||
u16 operationId;
|
||||
u16 unk_04;
|
||||
u8 unk_06;
|
||||
// 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_07;
|
||||
u8 unk_08;
|
||||
} struct_02033280;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ typedef struct {
|
|||
u8 unk_20[2];
|
||||
u16 field_22;
|
||||
} paramStruct;
|
||||
// This is a ScriptExecutionContext TODO
|
||||
|
||||
void sub_0806D8A0(Entity* this, paramStruct* param_2) {
|
||||
s32 xOffset;
|
||||
s32 yOffset;
|
||||
|
|
@ -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.continueScriptExecutionFlags |= 1;
|
||||
gUnk_02033280.unk_07 |= 1;
|
||||
}
|
||||
|
||||
// maybe actually execute the kinstone fusion?
|
||||
|
|
|
|||
|
|
@ -97,10 +97,9 @@ 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.continueScriptExecutionFlags |= 1;
|
||||
gUnk_02033280.unk_07 |= 1;
|
||||
}
|
||||
|
||||
void sub_080694B0(Entity* this) {
|
||||
|
|
|
|||
|
|
@ -201,13 +201,13 @@ void sub_080606D8(Entity* this) {
|
|||
ShowNPCDialogue(this, &gUnk_0810AA30[index]);
|
||||
}
|
||||
|
||||
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]];
|
||||
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]];
|
||||
u32 x = coords->x + gRoomControls.roomOriginX;
|
||||
u32 y = coords->y + gRoomControls.roomOriginY;
|
||||
sub_0807DEDC(this, context, x, y);
|
||||
gUnk_02033280.continueScriptExecutionFlags |= 1;
|
||||
sub_0807DEDC(entity, context, x, y);
|
||||
gUnk_02033280.unk_07 |= 1;
|
||||
}
|
||||
|
||||
void sub_0806075C(Entity* this) {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ 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:
|
||||
|
|
@ -165,7 +164,7 @@ void sub_08066E80(Entity* ent, u8* param_2) {
|
|||
case 4:
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
if (ent->frames.b.f3) {
|
||||
gUnk_02033280.continueScriptExecutionFlags |= 1;
|
||||
gUnk_02033280.unk_07 |= 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
628
src/script.c
628
src/script.c
File diff suppressed because it is too large
Load Diff
|
|
@ -1,40 +0,0 @@
|
|||
// macro helpers
|
||||
#define WORD_TO_SHORTS(word) (unsigned short)word & 0x00ff,(unsigned short)word >> 16,
|
||||
|
||||
// script commands
|
||||
#define START_EXECUTING_SCRIPTS() 0x0401,
|
||||
#define STOP_EXECUTING_SCRIPTS() 0x0402,
|
||||
#define CHECK_KINSTONE_FUSED(id) 0x081d, id,
|
||||
#define JUMP_IF_TRUE(offset) 0x0804, offset,
|
||||
#define sub_0807E6AC(word) 0x0c33, WORD_TO_SHORTS(word)
|
||||
#define sub_0807EF80(param) 0x0879, param,
|
||||
#define sub_0807E680(param) 0x0831, param,
|
||||
#define sub_0807EBC0(param) 0x0867, param,
|
||||
#define sub_0807ECF4(param) 0x0871, param,
|
||||
#define sub_0807E680(param) 0x0831, param,
|
||||
#define sub_0807EF80(param) 0x0879, param,
|
||||
#define sub_0807E5F8(word) 0x0c28, WORD_TO_SHORTS(word)
|
||||
|
||||
|
||||
const unsigned short gUnk_08016030[] = {
|
||||
// clang-format off
|
||||
START_EXECUTING_SCRIPTS()
|
||||
CHECK_KINSTONE_FUSED(9)
|
||||
JUMP_IF_TRUE(0x2a)
|
||||
STOP_EXECUTING_SCRIPTS()
|
||||
sub_0807E6AC(0x00000001)
|
||||
sub_0807EF80(0x0010)
|
||||
sub_0807E680(0x003c)
|
||||
sub_0807EBC0(0x0020)
|
||||
sub_0807ECF4(0x0080)
|
||||
sub_0807E680(0x001e)
|
||||
sub_0807EF80(0x0010)
|
||||
sub_0807E5F8(0x0000008)
|
||||
// clang-format on
|
||||
0xffff,
|
||||
0x0c6a,
|
||||
0xfff0,
|
||||
0x0000,
|
||||
0xffff,
|
||||
0x0000
|
||||
};
|
||||
Loading…
Reference in New Issue