update script syntax

This commit is contained in:
Alex Bates 2020-12-24 11:15:05 +00:00
parent e3f570fd1a
commit 94ca7f82c0
20 changed files with 501 additions and 493 deletions

View File

@ -24,4 +24,7 @@
"python.analysis.extraPaths": [
"./tools"
],
"[c]": {
"editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", // no $, for scripts
},
}

View File

@ -5,7 +5,7 @@
typedef s32 MessageID;
#define MESSAGE_ID(section, index) ((section << 0x10) + index)
#define MESSAGE_ID(section, index) (((section << 0x10) + index))
#define MessageID_TATTLE_KMR_03 MESSAGE_ID(0x19, 0x3B)
#define MessageID_TATTLE_KMR_12 MESSAGE_ID(0x19, 0x40)

View File

@ -99,17 +99,17 @@ typedef enum ScriptOpcode {
ScriptOpcode_DEBUG_PRINT = 0x5B, ///< Args: expression
} ScriptOpcode;
#define SI_VAR(v) (v - 30000000)
#define SI_MAP_VAR(v) (v - 50000000)
#define SI_FLAG(v) (v - 70000000)
#define SI_MAP_FLAG(v) (v - 90000000)
#define SI_AREA_FLAG(v) (v - 110000000)
#define SI_SAVE_FLAG(v) (v - 130000000)
#define SI_AREA_VAR(v) (v - 150000000)
#define SI_SAVE_VAR(v) (v - 170000000)
#define SI_ARRAY(v) (v - 190000000)
#define SI_ARRAY_FLAG(v) (v - 210000000)
#define SI_FIXED(v) ((v * 1024.0f) + -230000000) // See float_to_fixed_var
#define SI_VAR(v) ((v - 30000000))
#define SI_MAP_VAR(v) ((v - 50000000))
#define SI_FLAG(v) ((v - 70000000))
#define SI_MAP_FLAG(v) ((v - 90000000))
#define SI_AREA_FLAG(v) ((v - 110000000))
#define SI_SAVE_FLAG(v) ((v - 130000000))
#define SI_AREA_VAR(v) ((v - 150000000))
#define SI_SAVE_VAR(v) ((v - 170000000))
#define SI_ARRAY(v) ((v - 190000000))
#define SI_ARRAY_FLAG(v) ((v - 210000000))
#define SI_FIXED(v) (((v * 1024.0f) + -230000000)) // See float_to_fixed_var
/* Return type of si_execute_next_command */
#define SI_CONTINUE 0 /* Continue to next command */

View File

@ -11,9 +11,9 @@
#define UNK_ARGS
typedef s32 FormationID;
#define FORMATION_ID(section, stage, index) ((section << 16) + (stage << 8) + index)
#define FORMATION_ID(section, stage, index) (((section << 16) + (stage << 8) + index))
typedef s32 NpcAnimID;
#define NPC_ANIM(sprite, palette, anim) ((_NPC_SPRITE_##sprite << 16) + (_NPC_PALETTE_##sprite##_##palette << 8) + _NPC_ANIM_##sprite##_##anim)
#define NPC_ANIM(sprite, palette, anim) (((_NPC_SPRITE_##sprite << 16) + (_NPC_PALETTE_##sprite##_##palette << 8) + _NPC_ANIM_##sprite##_##anim))
#endif

View File

@ -66,5 +66,5 @@ MapConfig M(config) = {
};
Script M(Script_802406C0) = SCRIPT({
SetMusicTrack(0, 17, 0, 8)
SetMusicTrack(0, 17, 0, 8);
});

View File

@ -20,32 +20,32 @@ Script M(ExitWalk_802406F0) = EXIT_WALK_SCRIPT(60, 0, "kmr_04", 0);
Script M(ExitWalk_8024074C) = EXIT_WALK_SCRIPT(60, 1, "kmr_05", 0);
Script M(Script_802407A8) = SCRIPT({
bind M(ExitWalk_802406F0) to 0x80000 3
bind M(ExitWalk_8024074C) to 0x80000 5
bind M(ExitWalk_802406F0) to 0x80000 3;
bind M(ExitWalk_8024074C) to 0x80000 5;
});
Script M(Main) = SCRIPT({
SI_SAVE_VAR(425) = 30
SetSpriteShading(-1)
SetCamPerspective(0, 3, 25, 16, 4096)
SetCamBGColor(0, 0, 0, 0)
SetCamEnabled(0, 1)
SetCamLeadPlayer(0, 0)
SI_AREA_FLAG(8) = 0
MakeNpcs(0, M(npcGroupList_80241450))
ClearDefeatedEnemies()
await M(MakeEntities)
await M(Script_802422B8)
spawn M(Script_802406C0)
GetEntryID(SI_VAR(0))
if SI_VAR(0) != 2 {
SI_VAR(0) = M(Script_802407A8)
spawn EnterWalk
SI_SAVE_VAR(425) = 30;
SetSpriteShading(-1);
SetCamPerspective(0, 3, 25, 16, 4096);
SetCamBGColor(0, 0, 0, 0);
SetCamEnabled(0, 1);
SetCamLeadPlayer(0, 0);
SI_AREA_FLAG(8) = 0;
MakeNpcs(0, M(npcGroupList_80241450));
ClearDefeatedEnemies();
await M(MakeEntities);
await M(Script_802422B8);
spawn M(Script_802406C0);
GetEntryID(SI_VAR(0));
if (SI_VAR(0) != 2) {
SI_VAR(0) = M(Script_802407A8);
spawn EnterWalk;
} else {
spawn M(Script_802407A8)
spawn M(Script_80242340)
spawn M(Script_802407A8);
spawn M(Script_80242340);
}
sleep 1
sleep 1;
});
s32 padding[] = {0, 0};
@ -58,31 +58,31 @@ s32 M(npcSettings_80240950)[] = {
Script M(Script_8024097C) = SCRIPT({
1:
if SI_AREA_FLAG(8) == 1 {
if (SI_AREA_FLAG(8) == 1) {
100:
AwaitPlayerLeave(294, 123, 170)
EnableNpcAI(0, 0)
DisablePlayerInput(1)
SetNpcSpeed(0, 4.0)
SetNpcAnimation(0, 0x9D0003)
func_802401B0_8C8140()
GetAngleToPlayer(0, SI_VAR(2))
AwaitPlayerLeave(294, 123, 170);
EnableNpcAI(0, 0);
DisablePlayerInput(1);
SetNpcSpeed(0, 4.0);
SetNpcAnimation(0, 0x9D0003);
func_802401B0_8C8140();
GetAngleToPlayer(0, SI_VAR(2));
loop SI_VAR(1) {
GetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9))
AddVectorPolar(SI_VAR(7), SI_VAR(9), 4.0, SI_VAR(2))
SetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9))
sleep 1
GetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9));
AddVectorPolar(SI_VAR(7), SI_VAR(9), 4.0, SI_VAR(2));
SetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9));
sleep 1;
}
PlayerFaceNpc(0, 3)
SetPlayerSpeed(3.0)
PlayerMoveTo(243, 243, 0)
SetNpcVar(0, 0, 1)
EnableNpcAI(0, 1)
DisablePlayerInput(0)
goto 100
PlayerFaceNpc(0, 3);
SetPlayerSpeed(3.0);
PlayerMoveTo(243, 243, 0);
SetNpcVar(0, 0, 1);
EnableNpcAI(0, 1);
DisablePlayerInput(0);
goto 100;
}
sleep 1
goto 1
sleep 1;
goto 1;
});
Script M(NpcAI_80240B50) = SCRIPT({
@ -90,107 +90,107 @@ Script M(NpcAI_80240B50) = SCRIPT({
match SI_SAVE_VAR(0) {
== 0xFFFFFF86 {
89:
UnkPositionFunc(0xFFFFFF8A, 86, 0xFFFFFFBA, 0xFFFFFFF1)
sleep 1
if SI_VAR(0) == 0 {
goto 89
UnkPositionFunc(0xFFFFFF8A, 86, 0xFFFFFFBA, 0xFFFFFFF1);
sleep 1;
if (SI_VAR(0) == 0) {
goto 89;
}
DisablePlayerInput(1)
SetNpcAux(0, 0)
PlaySoundAtNpc(0, 610, 0)
ShowEmote(0, 0, 45, 15, 1, 0, 0, 0, 0)
sleep 15
NpcFacePlayer(-1, 5)
sleep 10
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A6)
UseSettingsFrom(0, 0xFFFFFF24, 20, 0xFFFFFFB8)
SetPanTarget(0, 0xFFFFFFEC, 0, 68)
SetCamPitch(0, 15.0, -8.5)
SetCamDistance(0, 275)
SetCamSpeed(0, 1.5)
PanToTarget(0, 0, 1)
DisablePlayerInput(1);
SetNpcAux(0, 0);
PlaySoundAtNpc(0, 610, 0);
ShowEmote(0, 0, 45, 15, 1, 0, 0, 0, 0);
sleep 15;
NpcFacePlayer(-1, 5);
sleep 10;
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A6);
UseSettingsFrom(0, 0xFFFFFF24, 20, 0xFFFFFFB8);
SetPanTarget(0, 0xFFFFFFEC, 0, 68);
SetCamPitch(0, 15.0, -8.5);
SetCamDistance(0, 275);
SetCamSpeed(0, 1.5);
PanToTarget(0, 0, 1);
spawn {
sleep 20
SetPlayerSpeed(2.0)
PlayerMoveTo(0xFFFFFFDA, 68, 0)
sleep 20;
SetPlayerSpeed(2.0);
PlayerMoveTo(0xFFFFFFDA, 68, 0);
}
GetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9))
SetNpcSpeed(0, 4.0)
SetNpcAnimation(0, 0x9D0003)
NpcMoveTo(0, 0, 70, 0)
SetNpcAnimation(0, 0x9D0001)
InterpNpcYaw(0, 276, 20)
sleep 30
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A7)
sleep 5
SetPlayerAnimation(0x80007)
sleep 30
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A8)
func_80240000_8C7F90(0, 5)
SI_SAVE_VAR(0) = 0xFFFFFF87
UseSettingsFrom(0, 0xFFFFFF24, 20, 0xFFFFFFB8)
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetCamSpeed(0, 3.0)
PanToTarget(0, 0, 1)
WaitForCam(0, 1.0)
PanToTarget(0, 0, 0)
EnablePartnerAI()
DisablePlayerInput(0)
sleep 1
GetNpcPos(0, SI_VAR(7), SI_VAR(8), SI_VAR(9));
SetNpcSpeed(0, 4.0);
SetNpcAnimation(0, 0x9D0003);
NpcMoveTo(0, 0, 70, 0);
SetNpcAnimation(0, 0x9D0001);
InterpNpcYaw(0, 276, 20);
sleep 30;
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A7);
sleep 5;
SetPlayerAnimation(0x80007);
sleep 30;
SpeakToPlayer(0, 0x9D0008, 0x9D0001, 0, 0xB00A8);
func_80240000_8C7F90(0, 5);
SI_SAVE_VAR(0) = 0xFFFFFF87;
UseSettingsFrom(0, 0xFFFFFF24, 20, 0xFFFFFFB8);
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetCamSpeed(0, 3.0);
PanToTarget(0, 0, 1);
WaitForCam(0, 1.0);
PanToTarget(0, 0, 0);
EnablePartnerAI();
DisablePlayerInput(0);
sleep 1;
}
}
});
Script M(Hit_80240F64) = SCRIPT({
SetNpcAnimation(-1, 0x9D0007)
sleep 10
SetNpcAnimation(-1, 0x9D0001)
SI_MAP_VAR(0) += 1
if SI_MAP_VAR(0) < 3 {
GetOwnerEncounterTrigger(SI_VAR(0))
SetNpcAnimation(-1, 0x9D0007);
sleep 10;
SetNpcAnimation(-1, 0x9D0001);
SI_MAP_VAR(0) += 1;
if (SI_MAP_VAR(0) < 3) {
GetOwnerEncounterTrigger(SI_VAR(0));
match SI_VAR(0) {
== 2 {
SetNpcVar(0, 0, 1)
if SI_AREA_FLAG(6) == 1 {
SetNpcVar(0, 0, 1);
if (SI_AREA_FLAG(6) == 1) {
} else {
SI_AREA_FLAG(6) = 1
SI_AREA_FLAG(7) = 0
SI_AREA_FLAG(6) = 1;
SI_AREA_FLAG(7) = 0;
}
}
== 4 {
SetNpcVar(0, 0, 1)
if SI_AREA_FLAG(7) == 1 {
SetNpcVar(0, 0, 1);
if (SI_AREA_FLAG(7) == 1) {
} else {
SI_AREA_FLAG(6) = 0
SI_AREA_FLAG(7) = 1
SI_AREA_FLAG(6) = 0;
SI_AREA_FLAG(7) = 1;
}
}
}
sleep 10
SetNpcAnimation(-1, 0x9D0003)
sleep 10;
SetNpcAnimation(-1, 0x9D0003);
} else {
sleep 10
GetNpcPos(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetNpcPos(0xFFFFFFFC, SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetNpcFlagBits(0xFFFFFFFC, 512, 1)
SetNpcPos(0, 0, 0xFFFFFC18, 0)
SetNpcFlagBits(0, 256, 0)
EnablePartnerAI()
SetNpcAux(-1, M(Script_8024097C))
BindNpcAI(-1, M(NpcAI_80240B50))
sleep 10;
GetNpcPos(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetNpcPos(0xFFFFFFFC, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetNpcFlagBits(0xFFFFFFFC, 512, 1);
SetNpcPos(0, 0, 0xFFFFFC18, 0);
SetNpcFlagBits(0, 256, 0);
EnablePartnerAI();
SetNpcAux(-1, M(Script_8024097C));
BindNpcAI(-1, M(NpcAI_80240B50));
}
});
Script M(Init_802411A8) = SCRIPT({
BindNpcIdle(-1, M(NpcAI_80240B50))
BindNpcAux(-1, M(Script_8024097C))
BindNpcHit(-1, M(Hit_80240F64))
BindNpcIdle(-1, M(NpcAI_80240B50));
BindNpcAux(-1, M(Script_8024097C));
BindNpcHit(-1, M(Hit_80240F64));
match SI_SAVE_VAR(0) {
>= 0xFFFFFF87 {
SetNpcFlagBits(-1, 512, 0)
SetNpcFlagBits(-1, 8, 1)
SetNpcPos(-1, 0, 0xFFFFFC18, 0)
SetNpcFlagBits(-1, 512, 0);
SetNpcFlagBits(-1, 8, 1);
SetNpcPos(-1, 0, 0xFFFFFC18, 0);
}
}
});
@ -221,47 +221,47 @@ s32 M(npcGroupList_80241450)[] = {
s32 padding2[] = {0, 0};
Script M(Script_80241470) = SCRIPT({
ModifyColliderFlags(0, 9, 0x7FFFFE00)
SI_SAVE_VAR(0) = 0xFFFFFF8B
ModifyColliderFlags(0, 9, 0x7FFFFE00);
SI_SAVE_VAR(0) = 0xFFFFFF8B;
});
Script M(Script_802414A8) = SCRIPT({
SI_SAVE_FLAG(54) = 1
SI_SAVE_FLAG(54) = 1;
});
Script M(Script_802414C8) = SCRIPT({
0:
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetCamTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
sleep 1
goto 0
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetCamTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 1;
goto 0;
});
Script M(MakeEntities) = SCRIPT({
if SI_SAVE_VAR(0) < 0xFFFFFF8B {
MakeEntity(0x802EA10C, 45, 0, 70, 15, 0x80000000)
AssignScript(M(Script_80241470))
if (SI_SAVE_VAR(0) < 0xFFFFFF8B) {
MakeEntity(0x802EA10C, 45, 0, 70, 15, 0x80000000);
AssignScript(M(Script_80241470));
} else {
ModifyColliderFlags(0, 9, 0x7FFFFE00)
ModifyColliderFlags(0, 9, 0x7FFFFE00);
}
if SI_SAVE_FLAG(54) == 0 {
MakeEntity(0x802EA19C, 230, 0, 310, 15, 0x80000000)
AssignScript(M(Script_802414A8))
if (SI_SAVE_FLAG(54) == 0) {
MakeEntity(0x802EA19C, 230, 0, 310, 15, 0x80000000);
AssignScript(M(Script_802414A8));
}
MakeEntity(0x802EA588, 230, 60, 310, 15, 151, 0x80000000)
AssignBlockFlag(SI_SAVE_FLAG(52))
MakeEntity(0x802EA0C4, 230, 50, 0xFFFFFF60, 15, 0x80000000)
MakeEntity(0x802EA0C4, 165, 0, 380, 20, 0x80000000)
MakeEntity(0x802EA564, 0xFFFFFF56, 0, 370, 43, 343, 0x80000000)
AssignBlockFlag(SI_SAVE_FLAG(50))
MakeEntity(0x802EAA54, 345, 75, 0xFFFFFF06, 0, 100, 0x80000000)
MakeItemEntity(343, 345, 205, 0xFFFFFF06, 17, SI_SAVE_FLAG(56))
MakeItemEntity(343, 345, 230, 0xFFFFFF06, 17, SI_SAVE_FLAG(57))
MakeItemEntity(343, 345, 255, 0xFFFFFF06, 17, SI_SAVE_FLAG(58))
MakeItemEntity(343, 345, 280, 0xFFFFFF06, 17, SI_SAVE_FLAG(59))
MakeItemEntity(128, 229, 250, 0xFFFFFF64, 17, SI_SAVE_FLAG(49))
MakeEntity(0x802EAB04, 300, 0, 150, 0, 18, 0x80000000)
AssignPanelFlag(SI_SAVE_FLAG(88))
MakeEntity(0x802EA7E0, 130, 60, 0, 0, 0x80000000)
MakeEntity(0x802EA588, 230, 60, 310, 15, 151, 0x80000000);
AssignBlockFlag(SI_SAVE_FLAG(52));
MakeEntity(0x802EA0C4, 230, 50, 0xFFFFFF60, 15, 0x80000000);
MakeEntity(0x802EA0C4, 165, 0, 380, 20, 0x80000000);
MakeEntity(0x802EA564, 0xFFFFFF56, 0, 370, 43, 343, 0x80000000);
AssignBlockFlag(SI_SAVE_FLAG(50));
MakeEntity(0x802EAA54, 345, 75, 0xFFFFFF06, 0, 100, 0x80000000);
MakeItemEntity(343, 345, 205, 0xFFFFFF06, 17, SI_SAVE_FLAG(56));
MakeItemEntity(343, 345, 230, 0xFFFFFF06, 17, SI_SAVE_FLAG(57));
MakeItemEntity(343, 345, 255, 0xFFFFFF06, 17, SI_SAVE_FLAG(58));
MakeItemEntity(343, 345, 280, 0xFFFFFF06, 17, SI_SAVE_FLAG(59));
MakeItemEntity(128, 229, 250, 0xFFFFFF64, 17, SI_SAVE_FLAG(49));
MakeEntity(0x802EAB04, 300, 0, 150, 0, 18, 0x80000000);
AssignPanelFlag(SI_SAVE_FLAG(88));
MakeEntity(0x802EA7E0, 130, 60, 0, 0, 0x80000000);
});

View File

@ -204,20 +204,20 @@ s32 M(treeEffectVectors_Tree1)[] = {
};
Script M(Tree1_Callback) = SCRIPT({
if SI_SAVE_FLAG(53) == 1 {
return
if (SI_SAVE_FLAG(53) == 1) {
return;
}
if SI_MAP_FLAG(10) == 1 {
return
if (SI_MAP_FLAG(10) == 1) {
return;
}
sleep 10
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
if SI_VAR(0) < 0xFFFFFFE2 {
MakeItemEntity(138, 0xFFFFFFE9, 100, 35, 13, SI_SAVE_FLAG(53))
sleep 10;
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
if (SI_VAR(0) < 0xFFFFFFE2) {
MakeItemEntity(138, 0xFFFFFFE9, 100, 35, 13, SI_SAVE_FLAG(53));
} else {
MakeItemEntity(138, 0xFFFFFFAB, 100, 16, 13, SI_SAVE_FLAG(53))
MakeItemEntity(138, 0xFFFFFFAB, 100, 16, 13, SI_SAVE_FLAG(53));
}
SI_MAP_FLAG(10) = 1
SI_MAP_FLAG(10) = 1;
});
s32 M(shakeTreeEvent_Tree1)[] = {
@ -229,10 +229,10 @@ s32 M(triggerCoord_802422A8)[] = {
};
Script M(Script_802422B8) = SCRIPT({
SI_VAR(0) = M(searchBushEvent_Bush1)
bind M(SearchBush_802417F0) to TriggerFlag_WALL_INTERACT 53
SI_VAR(0) = M(shakeTreeEvent_Tree1)
bind M(ShakeTree_80241B50) to TriggerFlag_WALL_HAMMER 52
bind M(ShakeTree_80241B50) to TriggerFlag_BOMB M(triggerCoord_802422A8)
SI_VAR(0) = M(searchBushEvent_Bush1);
bind M(SearchBush_802417F0) to TriggerFlag_WALL_INTERACT 53;
SI_VAR(0) = M(shakeTreeEvent_Tree1);
bind M(ShakeTree_80241B50) to TriggerFlag_WALL_HAMMER 52;
bind M(ShakeTree_80241B50) to TriggerFlag_BOMB M(triggerCoord_802422A8);
});

View File

@ -1,86 +1,86 @@
#include "kmr_03.h"
Script M(Script_80242340) = SCRIPT({
UseSettingsFrom(0, 0xFFFFFEF2, 20, 0xFFFFFFB0)
SetPanTarget(0, 0xFFFFFEF2, 20, 0xFFFFFFB0)
SetCamDistance(0, 700.0)
SetCamSpeed(0, 90.0)
PanToTarget(0, 0, 1)
if SI_SAVE_VAR(0) >= 0xFFFFFF89 {
SetPlayerPos(0, 0xFFFFFC18, 0)
DisablePlayerInput(1)
SetPlayerPos(0xFFFFFF20, 20, 0xFFFFFFB0)
SetNpcPos(0xFFFFFFFC, 0xFFFFFF20, 20, 0xFFFFFFB0)
sleep 20
SetCamSpeed(0, 3.0)
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
UseSettingsFrom(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
PanToTarget(0, 0, 1)
WaitForCam(0, 1.0)
PanToTarget(0, 0, 0)
DisablePlayerInput(0)
return
UseSettingsFrom(0, 0xFFFFFEF2, 20, 0xFFFFFFB0);
SetPanTarget(0, 0xFFFFFEF2, 20, 0xFFFFFFB0);
SetCamDistance(0, 700.0);
SetCamSpeed(0, 90.0);
PanToTarget(0, 0, 1);
if (SI_SAVE_VAR(0) >= 0xFFFFFF89) {
SetPlayerPos(0, 0xFFFFFC18, 0);
DisablePlayerInput(1);
SetPlayerPos(0xFFFFFF20, 20, 0xFFFFFFB0);
SetNpcPos(0xFFFFFFFC, 0xFFFFFF20, 20, 0xFFFFFFB0);
sleep 20;
SetCamSpeed(0, 3.0);
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
UseSettingsFrom(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PanToTarget(0, 0, 1);
WaitForCam(0, 1.0);
PanToTarget(0, 0, 0);
DisablePlayerInput(0);
return;
}
DisablePlayerInput(1)
DisablePlayerPhysics(1)
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetPlayerPos(SI_VAR(0), 0xFFFFFC18, SI_VAR(2))
sleep 30
SetCamDistance(0, 220)
SetCamSpeed(0, 1.0)
PanToTarget(0, 0, 1)
WaitForCam(0, 1.0)
DisablePlayerInput(1);
DisablePlayerPhysics(1);
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPlayerPos(SI_VAR(0), 0xFFFFFC18, SI_VAR(2));
sleep 30;
SetCamDistance(0, 220);
SetCamSpeed(0, 1.0);
PanToTarget(0, 0, 1);
WaitForCam(0, 1.0);
spawn {
sleep 18
PlaySoundAtPlayer(373, 0)
sleep 30
PlaySoundAtPlayer(374, 0)
sleep 28
PlaySoundAtPlayer(373, 0)
sleep 18;
PlaySoundAtPlayer(373, 0);
sleep 30;
PlaySoundAtPlayer(374, 0);
sleep 28;
PlaySoundAtPlayer(373, 0);
}
HidePlayerShadow(1)
SetPlayerAnimation(0x10002)
SetPlayerPos(0xFFFFFF20, 120, 0xFFFFFFB0)
InterpPlayerYaw(90, 0)
0:
sleep 1
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
SI_VAR(1) += 0xFFFFFFFE
SetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
if SI_VAR(1) > 86 {
goto 0
HidePlayerShadow(1);
SetPlayerAnimation(0x10002);
SetPlayerPos(0xFFFFFF20, 120, 0xFFFFFFB0);
InterpPlayerYaw(90, 0);
0: // TODO: this is a do..while
sleep 1;
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 0xFFFFFFFE;
SetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
if (SI_VAR(1) > 86) {
goto 0;
}
SetPlayerPos(0xFFFFFECA, 20, 0xFFFFFFB0)
SetPlayerPos(0xFFFFFECA, 20, 0xFFFFFFB0);
spawn {
sleep 20
SetPanTarget(0, 0xFFFFFECA, 20, 0xFFFFFFB0)
SetCamSpeed(0, 0.2001953125)
PanToTarget(0, 0, 1)
sleep 20;
SetPanTarget(0, 0xFFFFFECA, 20, 0xFFFFFFB0);
SetCamSpeed(0, 0.2001953125);
PanToTarget(0, 0, 1);
}
0x802D286C(0x2800)
0x802D2520(0x10002, 5, 5, 1, 1, 0)
sleep 100
WaitForCam(0, 1.0)
0x802D2520(0x10002, 0, 0, 0, 0, 0)
HidePlayerShadow(0)
SetPlayerAnimation(0x10006)
sleep 10
SetPlayerAnimation(0x10007)
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetPlayerJumpscale(1.0)
PlayerJump(SI_VAR(0), SI_VAR(1), SI_VAR(2), 10)
SetPlayerAnimation(0x10002)
0x802D286C(0x2800);
0x802D2520(0x10002, 5, 5, 1, 1, 0);
sleep 100;
WaitForCam(0, 1.0);
0x802D2520(0x10002, 0, 0, 0, 0, 0);
HidePlayerShadow(0);
SetPlayerAnimation(0x10006);
sleep 10;
SetPlayerAnimation(0x10007);
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPlayerJumpscale(1.0);
PlayerJump(SI_VAR(0), SI_VAR(1), SI_VAR(2), 10);
SetPlayerAnimation(0x10002);
spawn {
SetCamSpeed(0, 3.0)
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2))
UseSettingsFrom(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2))
PanToTarget(0, 0, 1)
WaitForCam(0, 1.0)
PanToTarget(0, 0, 0)
SetCamSpeed(0, 3.0);
GetPlayerPos(SI_VAR(0), SI_VAR(1), SI_VAR(2));
UseSettingsFrom(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetPanTarget(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PanToTarget(0, 0, 1);
WaitForCam(0, 1.0);
PanToTarget(0, 0, 0);
}
sleep 30
DisablePlayerPhysics(0)
DisablePlayerInput(0)
sleep 30;
DisablePlayerPhysics(0);
DisablePlayerInput(0);
});

View File

@ -5,23 +5,23 @@ Script M(ExitWest) = EXIT_WALK_SCRIPT(60, 0, "kmr_07", 1);
Script M(ExitEast) = EXIT_WALK_SCRIPT(60, 1, "kmr_11", 0);
Script M(BindExits) = SCRIPT({
bind M(ExitWest) to TriggerFlag_FLOOR_ABOVE 0 // deili1
bind M(ExitEast) to TriggerFlag_FLOOR_ABOVE 3 // deili2
bind M(ExitWest) to TriggerFlag_FLOOR_ABOVE 0; // deili1
bind M(ExitEast) to TriggerFlag_FLOOR_ABOVE 3; // deili2
});
Script M(Main) = SCRIPT({
SI_SAVE_VAR(425) = 31
SetSpriteShading(-1)
SetCamPerspective(0, 3, 25, 16, 4096)
SetCamBGColor(0, 0, 0, 0)
SetCamEnabled(0, 1)
MakeNpcs(0, M(npcGroupList))
await M(MakeEntities)
spawn M(PlayMusic)
SI_VAR(0) = M(BindExits)
spawn EnterWalk
sleep 1
bind M(ReadWestSign) to TriggerFlag_WALL_INTERACT 10
SI_SAVE_VAR(425) = 31;
SetSpriteShading(-1);
SetCamPerspective(0, 3, 25, 16, 4096);
SetCamBGColor(0, 0, 0, 0);
SetCamEnabled(0, 1);
MakeNpcs(0, M(npcGroupList));
await M(MakeEntities);
spawn M(PlayMusic);
SI_VAR(0) = M(BindExits);
spawn EnterWalk;
sleep 1;
bind M(ReadWestSign) to TriggerFlag_WALL_INTERACT 10;
});
NpcAISettings M(goombaAISettings) = {
@ -40,7 +40,7 @@ NpcAISettings M(goombaAISettings) = {
};
Script M(GoombaAI) = SCRIPT({
DoBasicAI(M(goombaAISettings))
DoBasicAI(M(goombaAISettings));
});
NpcSettings M(goombaNpcSettings) = {
@ -54,90 +54,90 @@ NpcSettings M(goombaNpcSettings) = {
/// @bug Never returns
Script M(ReadWestSign) = SCRIPT({
group 0
group 0;
// "Eat a Mushroom to regain your energy!"
suspend group 1
DisablePlayerInput(TRUE)
ShowMessageAtScreenPos(MessageID_SIGN_MUSHROOM_GOOMBA_TRAP, 160, 40)
resume group 1
suspend group 1;
DisablePlayerInput(TRUE);
ShowMessageAtScreenPos(MessageID_SIGN_MUSHROOM_GOOMBA_TRAP, 160, 40);
resume group 1;
SI_FLAG(0) = FALSE
GetGoomba()
if SI_VAR(0) != FALSE {
GetNpcVar(NpcId_GOOMBA, 0, SI_VAR(0))
if SI_VAR(0) == FALSE {
SI_FLAG(0) = FALSE;
GetGoomba();
if (SI_VAR(0) != FALSE) {
GetNpcVar(NpcId_GOOMBA, 0, SI_VAR(0));
if (SI_VAR(0) == FALSE) {
// Trigger Goomba to peel off
SetNpcVar(NpcId_GOOMBA, 0, TRUE)
SI_FLAG(0) = TRUE
sleep 10
SetNpcVar(NpcId_GOOMBA, 0, TRUE);
SI_FLAG(0) = TRUE;
sleep 10;
}
}
DisablePlayerInput(FALSE)
if SI_FLAG(0) == TRUE {
unbind
DisablePlayerInput(FALSE);
if (SI_FLAG(0) == TRUE) {
unbind;
}
break
return
break;
return;
});
Script M(GoombaIdle) = SCRIPT({
sleep 1
sleep 1;
SetSelfVar(0, FALSE)
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, fake_mushroom)) // TODO: work out why palette 0 is used here
EnableNpcShadow(NpcId_SELF, FALSE)
SetSelfEnemyFlagBits(0x00000020, TRUE)
SetSelfVar(0, FALSE);
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, fake_mushroom)); // TODO: work out why palette 0 is used here
EnableNpcShadow(NpcId_SELF, FALSE);
SetSelfEnemyFlagBits(0x00000020, TRUE);
// Wait until read_sign sets NPC var 0
loop {
GetSelfVar(0, SI_VAR(0))
sleep 1
} until SI_VAR(0) == FALSE
GetSelfVar(0, SI_VAR(0));
sleep 1;
} until (SI_VAR(0) == FALSE)
// Peel and jump off the sign
SetNpcFlagBits(NpcId_SELF, 0x00240000, TRUE)
sleep 3
SI_VAR(0) = 0.0
SetNpcFlagBits(NpcId_SELF, 0x00240000, TRUE);
sleep 3;
SI_VAR(0) = 0.0;
loop 9 {
SI_VAR(0) += 10.0
SetNpcRotation(NpcId_SELF, 0, SI_VAR(0), 0)
sleep 1
SI_VAR(0) += 10.0;
SetNpcRotation(NpcId_SELF, 0, SI_VAR(0), 0);
sleep 1;
}
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, still))
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, still));
loop 9 {
SI_VAR(0) += 10.0
SetNpcRotation(NpcId_SELF, 0, SI_VAR(0), 0)
sleep 1
SI_VAR(0) += 10.0;
SetNpcRotation(NpcId_SELF, 0, SI_VAR(0), 0);
sleep 1;
}
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, dizzy))
sleep 20
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, idle))
PlaySoundAtNpc(NpcId_SELF, 248, 0)
func_802CFE2C(NpcId_SELF, 8192)
func_802CFD30(NpcId_SELF, 5, 6, 1, 1, 0)
sleep 12
sleep 5
PlaySoundAtNpc(NpcId_SELF, 812, 0)
EnableNpcShadow(NpcId_SELF, TRUE)
SetNpcJumpscale(NpcId_SELF, 0.6005859375)
NpcJump0(NpcId_SELF, -35, 0, 30, 23)
func_802CFD30(NpcId_SELF, 0, 0, 0, 0, 0)
InterpNpcYaw(NpcId_SELF, 90, 0)
SetNpcFlagBits(NpcId_SELF, 0x00240000, FALSE)
SetSelfEnemyFlagBits(0x00000020, FALSE)
SetSelfEnemyFlagBits(0x40000000, TRUE)
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, dizzy));
sleep 20;
SetNpcAnimation(NpcId_SELF, NPC_ANIM(goomba, normal, idle));
PlaySoundAtNpc(NpcId_SELF, 248, 0);
func_802CFE2C(NpcId_SELF, 8192);
func_802CFD30(NpcId_SELF, 5, 6, 1, 1, 0);
sleep 12;
sleep 5;
PlaySoundAtNpc(NpcId_SELF, 812, 0);
EnableNpcShadow(NpcId_SELF, TRUE);
SetNpcJumpscale(NpcId_SELF, 0.6005859375);
NpcJump0(NpcId_SELF, -35, 0, 30, 23);
func_802CFD30(NpcId_SELF, 0, 0, 0, 0, 0);
InterpNpcYaw(NpcId_SELF, 90, 0);
SetNpcFlagBits(NpcId_SELF, 0x00240000, FALSE);
SetSelfEnemyFlagBits(0x00000020, FALSE);
SetSelfEnemyFlagBits(0x40000000, TRUE);
// We're done jumping off; the player can read the sign again
bind M(ReadWestSign) to TriggerFlag_WALL_INTERACT 10
bind M(ReadWestSign) to TriggerFlag_WALL_INTERACT 10;
// Behave like a normal enemy from now o
BindNpcAI(NpcId_SELF, M(GoombaAI))
// Behave like a normal enemy from now on
BindNpcAI(NpcId_SELF, M(GoombaAI));
});
Script M(GoombaInit) = SCRIPT({
BindNpcIdle(NpcId_SELF, M(GoombaIdle))
BindNpcIdle(NpcId_SELF, M(GoombaIdle));
});
StaticNpc M(goombaNpc) = {
@ -192,21 +192,21 @@ NpcGroupList M(npcGroupList) = {
};
Script M(ReadEastSign) = SCRIPT({
func_800441F0($a)
if $a == 1 {
return
func_800441F0($a);
if ($a == 1) {
return;
}
group 0
group 0;
func_802D5830(1)
DisablePlayerInput(1)
ShowMessageAtScreenPos(MessageID_SIGN_GOOMBA_KINGS_FORTRESS_AHEAD, 160, 40)
DisablePlayerInput(0)
func_802D5830(0)
func_802D5830(1);
DisablePlayerInput(1);
ShowMessageAtScreenPos(MessageID_SIGN_GOOMBA_KINGS_FORTRESS_AHEAD, 160, 40);
DisablePlayerInput(0);
func_802D5830(0);
});
Script M(MakeEntities) = SCRIPT({
MakeEntity(0x802EAFDC, 436, 0, -42, 0, 0x80000000)
AssignScript(M(ReadEastSign))
MakeEntity(0x802EAFDC, 436, 0, -42, 0, 0x80000000);
AssignScript(M(ReadEastSign));
});

View File

@ -14,7 +14,7 @@ MapConfig M(config) = {
};
Script M(PlayMusic) = SCRIPT({
SetMusicTrack(0, Song_PLEASANT_PATH, 0, 8)
SetMusicTrack(0, Song_PLEASANT_PATH, 0, 8);
});
ApiStatus GetGoomba(ScriptInstance* script, s32 isInitialCall) {

View File

@ -21,40 +21,40 @@ MapConfig M(config) = {
};
Script M(ExitWalk_802400E0) = SCRIPT({
group 27
UseExitHeading(60, 1)
spawn ExitWalk
GotoMap("sbk_01", 0)
sleep 100
group 27;
UseExitHeading(60, 1);
spawn ExitWalk;
GotoMap("sbk_01", 0);
sleep 100;
});
Script M(ExitWalk_8024013C) = SCRIPT({
group 27
UseExitHeading(60, 3)
spawn ExitWalk
GotoMap("sbk_10", 2)
sleep 100
group 27;
UseExitHeading(60, 3);
spawn ExitWalk;
GotoMap("sbk_10", 2);
sleep 100;
});
Script M(Script_80240198) = SCRIPT({
bind M(ExitWalk_802400E0) to 524288 3
bind M(ExitWalk_8024013C) to 524288 6
bind M(ExitWalk_802400E0) to 524288 3;
bind M(ExitWalk_8024013C) to 524288 6;
});
Script M(Main) = SCRIPT({
SI_SAVE_VAR(425) = 10
SetSpriteShading(-1)
if SI_SAVE_VAR(0) == 0xFFFFFFC1 {
DisablePulseStone(0)
SI_SAVE_VAR(425) = 10;
SetSpriteShading(-1);
if (SI_SAVE_VAR(0) == 0xFFFFFFC1) {
DisablePulseStone(0);
}
SetCamPerspective(0, 3, 25, 16, 4096)
SetCamBGColor(0, 0, 0, 0)
SetCamEnabled(0, 1)
SetCamLeadPlayer(0, 0)
MakeNpcs(0, M(npcGroupList_80240768))
await M(MakeEntities)
SpawnSunEffect()
SetMusicTrack(0, 23, 0, 8)
SI_VAR(0) = M(Script_80240198)
spawn EnterWalk
SetCamPerspective(0, 3, 25, 16, 4096);
SetCamBGColor(0, 0, 0, 0);
SetCamEnabled(0, 1);
SetCamLeadPlayer(0, 0);
MakeNpcs(0, M(npcGroupList_80240768));
await M(MakeEntities);
SpawnSunEffect();
SetMusicTrack(0, 23, 0, 8);
SI_VAR(0) = M(Script_80240198);
spawn EnterWalk;
});

View File

@ -8,8 +8,8 @@ s32 M(aISettings_80240300)[] = {
};
Script M(NpcAI_80240330) = SCRIPT({
SetNpcB5_3()
DoBasicAI(M(aISettings_80240300))
SetNpcB5_3();
DoBasicAI(M(aISettings_80240300));
});
s32 M(npcSettings_8024035C)[] = {
@ -63,8 +63,8 @@ s32 M(npcGroupList_80240768)[] = {
static s32 padding = 0;
Script M(MakeEntities) = SCRIPT({
MakeEntity(0x802EA564, 0xFFFFFF1A, 0, 155, 0, 152, 0x80000000)
AssignBlockFlag(SI_SAVE_FLAG(797))
MakeEntity(0x802EA564, 160, 0, 205, 0, 343, 0x80000000)
AssignBlockFlag(SI_SAVE_FLAG(798))
MakeEntity(0x802EA564, 0xFFFFFF1A, 0, 155, 0, 152, 0x80000000);
AssignBlockFlag(SI_SAVE_FLAG(797));
MakeEntity(0x802EA564, 160, 0, 205, 0, 343, 0x80000000);
AssignBlockFlag(SI_SAVE_FLAG(798));
});

View File

@ -21,48 +21,48 @@ MapConfig M(config) = {
};
Script M(ExitWalk_802400E0) = SCRIPT({
group 27
UseExitHeading(60, 0)
spawn ExitWalk
GotoMap("sbk_00", 1)
sleep 100
group 27;
UseExitHeading(60, 0);
spawn ExitWalk;
GotoMap("sbk_00", 1);
sleep 100;
});
Script M(ExitWalk_8024013C) = SCRIPT({
group 27
UseExitHeading(60, 1)
spawn ExitWalk
GotoMap("sbk_02", 0)
sleep 100
group 27;
UseExitHeading(60, 1);
spawn ExitWalk;
GotoMap("sbk_02", 0);
sleep 100;
});
Script M(ExitWalk_80240198) = SCRIPT({
group 27
UseExitHeading(60, 3)
spawn ExitWalk
GotoMap("sbk_11", 2)
sleep 100
group 27;
UseExitHeading(60, 3);
spawn ExitWalk;
GotoMap("sbk_11", 2);
sleep 100;
});
Script M(Script_802401F4) = SCRIPT({
bind M(ExitWalk_802400E0) to 524288 7
bind M(ExitWalk_8024013C) to 524288 3
bind M(ExitWalk_80240198) to 524288 5
bind M(ExitWalk_802400E0) to 524288 7;
bind M(ExitWalk_8024013C) to 524288 3;
bind M(ExitWalk_80240198) to 524288 5;
});
Script M(Main) = SCRIPT({
SI_SAVE_VAR(425) = 10
SetSpriteShading(-1)
if SI_SAVE_VAR(0) == 0xFFFFFFC1 {
DisablePulseStone(0)
SI_SAVE_VAR(425) = 10;
SetSpriteShading(-1);
if (SI_SAVE_VAR(0) == 0xFFFFFFC1) {
DisablePulseStone(0);
}
SetCamPerspective(0, 3, 25, 16, 4096)
SetCamBGColor(0, 0, 0, 0)
SetCamEnabled(0, 1)
SetCamLeadPlayer(0, 0)
MakeNpcs(0, M(npcGroupList_802407D8))
SpawnSunEffect()
SetMusicTrack(0, 23, 0, 8)
SI_VAR(0) = M(Script_802401F4)
spawn EnterWalk
SetCamPerspective(0, 3, 25, 16, 4096);
SetCamBGColor(0, 0, 0, 0);
SetCamEnabled(0, 1);
SetCamLeadPlayer(0, 0);
MakeNpcs(0, M(npcGroupList_802407D8));
SpawnSunEffect();
SetMusicTrack(0, 23, 0, 8);
SI_VAR(0) = M(Script_802401F4);
spawn EnterWalk;
});

View File

@ -8,8 +8,8 @@ s32 M(aISettings_80240370)[] = {
};
Script M(NpcAI_802403A0) = SCRIPT({
SetNpcB5_3()
DoBasicAI(M(aISettings_80240370))
SetNpcB5_3();
DoBasicAI(M(aISettings_80240370));
});
s32 M(npcSettings_802403CC)[] = {

View File

@ -45,17 +45,17 @@ ApiStatus GoombariaPutAway(ScriptInstance* script, s32 isInitialCall) {
}
Script world_goombaria_take_out = SCRIPT({
GoombariaTakeOut()
GoombariaTakeOut();
});
Script world_goombaria_update = SCRIPT({
GoombariaUpdate()
GoombariaUpdate();
});
Script world_goombaria_use_ability = SCRIPT({
GoombariaUseAbility()
GoombariaUseAbility();
});
Script world_goombaria_put_away = SCRIPT({
GoombariaPutAway()
GoombariaPutAway();
});

View File

@ -92,36 +92,36 @@ s32 func_802BD5D8_data[] = {
};
Script world_goombario_take_out = SCRIPT({
func_802BD188()
func_802BD188();
});
s32 unk_802BDD88 = 0x802BDF40;
Script world_goombario_update = SCRIPT({
func_802BD1D0()
func_802BD1D0();
});
Script world_goombario_use_ability = SCRIPT({
func_802BD5D8() // returns tattle message id on SI_VAR(0), and something else on SI_VAR(1)
func_802BD5D8(); // returns tattle message id on SI_VAR(0), and something else on SI_VAR(1)
if SI_VAR(0) == -1 {
return
if (SI_VAR(0) == -1) {
return;
}
if SI_VAR(0) == 0 {
func_802BDB30()
return
if (SI_VAR(0) == 0) {
func_802BDB30();
return;
}
if SI_VAR(1) == 0 {
SpeakToPlayer(NpcId_PARTNER, NPC_ANIM(world_goombario, normal, talk), NPC_ANIM(world_goombario, normal, idle), 0, SI_VAR(0))
if (SI_VAR(1) == 0) {
SpeakToPlayer(NpcId_PARTNER, NPC_ANIM(world_goombario, normal, talk), NPC_ANIM(world_goombario, normal, idle), 0, SI_VAR(0));
}
sleep 1
sleep 1;
func_802BDB30()
func_802BDB30();
});
Script world_goombario_put_away = SCRIPT({
func_802BDB84()
func_802BDB84();
});

View File

@ -33,19 +33,19 @@ ApiStatus GoompaPutAway(ScriptInstance* script, s32 isInitialCall) {
}
Script world_goompa_take_out = SCRIPT({
GoompaTakeOut()
GoompaTakeOut();
});
s32 unk = 0x802BD600;
Script world_goompa_update = SCRIPT({
func_802BD14C()
func_802BD14C();
});
Script world_goompa_use_ability = SCRIPT({
GoompaUseAbility()
GoompaUseAbility();
});
Script world_goompa_put_away = SCRIPT({
GoompaPutAway()
GoompaPutAway();
});

View File

@ -45,17 +45,17 @@ ApiStatus TwinkPutAway(ScriptInstance* script, s32 isInitialCall) {
}
Script world_twink_take_out = SCRIPT({
TwinkTakeOut()
TwinkTakeOut();
});
Script world_twink_update = SCRIPT({
TwinkUpdate()
TwinkUpdate();
});
Script world_twink_use_ability = SCRIPT({
TwinkUseAbility()
TwinkUseAbility();
});
Script world_twink_put_away = SCRIPT({
TwinkPutAway()
TwinkPutAway();
});

View File

@ -5,7 +5,7 @@ from lark import Lark, exceptions, Tree, Transformer, Visitor, v_args, Token
from lark.visitors import Discard
import traceback
DEBUG_OUTPUT = None
DEBUG_OUTPUT = None # "debug.i"
def eprint(*args, **kwargs):
print(*args, file=stderr, **kwargs)
@ -31,16 +31,15 @@ def pairs(seq):
script_parser = Lark(r"""
block: "{" NEWLINE* (_block STMT_SEP*)? "}"
block: "{" (_block SEMICOLON*)? "}"
_block: stmt STMT_SEP _block
| stmt
_block: stmt SEMICOLON _block
| stmt_no_semi SEMICOLON? _block
| stmt SEMICOLON
| stmt_no_semi
?stmt: call
| label ":" [stmt] -> label_decl
| "goto" label -> label_goto
| if_stmt
| match_stmt
| "return" -> return_stmt
| "break" -> break_stmt
| "sleep" expr -> sleep_stmt
@ -58,6 +57,10 @@ script_parser = Lark(r"""
| suspend_stmt
| resume_stmt
| kill_stmt
?stmt_no_semi: label ":" -> label_decl
| if_stmt
| match_stmt
| loop_stmt
| loop_until_stmt
| ["await"] block -> block_stmt
@ -66,7 +69,7 @@ script_parser = Lark(r"""
call: (c_identifier | HEX_INT) "(" [expr ("," expr)* [","]] ")"
if_stmt: "if" expr cond_op expr block ["else" block]
if_stmt: "if" "(" expr cond_op expr ")" block ["else" block]
?cond_op: "==" -> cond_op_eq
| "!=" -> cond_op_ne
@ -76,9 +79,9 @@ script_parser = Lark(r"""
| "<=" -> cond_op_le
| "?" -> cond_op_flag
match_stmt: "match" expr "{" NEWLINE* (match_cases STMT_SEP*)? "}"
match_const_stmt: "matchc" expr "{" NEWLINE* (match_cases STMT_SEP*)? "}"
match_cases: match_case STMT_SEP* match_cases
match_stmt: "match" expr "{" (match_cases SEMICOLON*)? "}"
match_const_stmt: "matchc" expr "{" (match_cases SEMICOLON*)? "}"
match_cases: match_case SEMICOLON* match_cases
| match_case
?match_case: "else" block -> case_else
| cond_op expr ["," multi_case] block -> case_op
@ -97,7 +100,7 @@ script_parser = Lark(r"""
bind_set_stmt: lhs "=" "bind" expr "to" expr expr
loop_stmt: "loop" [expr] block
loop_until_stmt: "loop" block "until" expr cond_op expr
loop_until_stmt: "loop" block "until" "(" expr cond_op expr ")"
?expr: c_const_expr
| ESCAPED_STRING
@ -123,11 +126,11 @@ script_parser = Lark(r"""
c_identifier: CNAME
c_const_expr: c_const_expr_internal
c_const_expr: "(" c_const_expr_internal ")"
c_const_expr_internal: "(" (c_const_expr_internal | NOT_PARENS)+ ")"
NOT_PARENS: /[^()]+/
STMT_SEP: (NEWLINE+ | ";")
SEMICOLON: ";"
label: /[a-zA-Z0-9_]+/
@ -146,6 +149,7 @@ script_parser = Lark(r"""
%import common.WS_INLINE
%import common.NEWLINE
%ignore WS_INLINE
%ignore NEWLINE
""", start="block", propagate_positions=True)#, parser="lalr", cache=True)
@ -382,7 +386,7 @@ class Compile(Transformer):
if len(tree.children) == 1:
return [tree.children[0]]
else:
return [tree.children[0], *tree.children[2]]
return [tree.children[0], *tree.children[1]]
def case_else(self, tree):
return [Cmd("ScriptOpcode_ELSE"), *tree.children[0]]
@ -746,7 +750,7 @@ if __name__ == "__main__":
macro_name = "" # captures recent UPPER_CASE identifier
prev_char = ""
while True:
while not error:
char = stdin.read(1)
if len(char) == 0:
@ -845,6 +849,7 @@ if __name__ == "__main__":
prev_char = char
if error:
write("{ 1 / 0 };")
exit(1)
else:
exit(0)

View File

@ -445,9 +445,9 @@ class ScriptDSLDisassembler(ScriptDisassembler):
self.write_line("});")
self.done = True
elif opcode == 0x02: self.write_line(f"return")
elif opcode == 0x02: self.write_line(f"return;")
elif opcode == 0x03: self.write_line(f"{self.var(argv[0])}:")
elif opcode == 0x04: self.write_line(f"goto {self.var(argv[0])}")
elif opcode == 0x04: self.write_line(f"goto {self.var(argv[0])};")
elif opcode == 0x05:
if argv[0] == 0:
self.write_line("loop {")
@ -457,29 +457,29 @@ class ScriptDSLDisassembler(ScriptDisassembler):
elif opcode == 0x06:
self.indent -= 1
self.write_line("}")
elif opcode == 0x07: self.write_line(f"break")
elif opcode == 0x08: self.write_line(f"sleep {self.var(argv[0])}")
elif opcode == 0x09: self.write_line(f"sleep {self.var(argv[0])} secs")
elif opcode == 0x07: self.write_line(f"break;")
elif opcode == 0x08: self.write_line(f"sleep {self.var(argv[0])};")
elif opcode == 0x09: self.write_line(f"sleep {self.var(argv[0])} secs;")
elif opcode == 0x0A:
self.write_line(f"if {self.var(argv[0])} == {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} == {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x0B:
self.write_line(f"if {self.var(argv[0])} != {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} != {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x0C:
self.write_line(f"if {self.var(argv[0])} < {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} < {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x0D:
self.write_line(f"if {self.var(argv[0])} > {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} > {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x0E:
self.write_line(f"if {self.var(argv[0])} <= {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} <= {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x0F:
self.write_line(f"if {self.var(argv[0])} >= {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} >= {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x10:
self.write_line(f"if {self.var(argv[0])} ? {self.var(argv[1])} {{")
self.write_line(f"if ({self.var(argv[0])} ? {self.var(argv[1])}) {{")
self.indent += 1
elif opcode == 0x12:
self.indent -= 1
@ -552,68 +552,68 @@ class ScriptDSLDisassembler(ScriptDisassembler):
self.indent -= 1
self.write_line("}")
elif opcode == 0x24: self.write_line(f"{self.var(argv[0])} = {self.var(argv[1])}")
elif opcode == 0x25: self.write_line(f"{self.var(argv[0])} =c 0x{argv[1]:X}")
elif opcode == 0x24: self.write_line(f"{self.var(argv[0])} = {self.var(argv[1])};")
elif opcode == 0x25: self.write_line(f"{self.var(argv[0])} =c 0x{argv[1]:X};")
elif opcode == 0x26:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} = {lhs}")
self.write_line(f"{self.var(argv[0])} = {lhs};")
else:
self.write_line(f"{self.var(argv[0])} =f {lhs}")
elif opcode == 0x27: self.write_line(f"{self.var(argv[0])} += {self.var(argv[1])}")
elif opcode == 0x28: self.write_line(f"{self.var(argv[0])} -= {self.var(argv[1])}")
elif opcode == 0x29: self.write_line(f"{self.var(argv[0])} *= {self.var(argv[1])}")
elif opcode == 0x2A: self.write_line(f"{self.var(argv[0])} /= {self.var(argv[1])}")
elif opcode == 0x2B: self.write_line(f"{self.var(argv[0])} %= {self.var(argv[1])}")
self.write_line(f"{self.var(argv[0])} =f {lhs};")
elif opcode == 0x27: self.write_line(f"{self.var(argv[0])} += {self.var(argv[1])};")
elif opcode == 0x28: self.write_line(f"{self.var(argv[0])} -= {self.var(argv[1])};")
elif opcode == 0x29: self.write_line(f"{self.var(argv[0])} *= {self.var(argv[1])};")
elif opcode == 0x2A: self.write_line(f"{self.var(argv[0])} /= {self.var(argv[1])};")
elif opcode == 0x2B: self.write_line(f"{self.var(argv[0])} %= {self.var(argv[1])};")
elif opcode == 0x2C:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} += {lhs}")
self.write_line(f"{self.var(argv[0])} += {lhs};")
else:
self.write_line(f"{self.var(argv[0])} +=f {lhs}")
self.write_line(f"{self.var(argv[0])} +=f {lhs};")
elif opcode == 0x2D:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} -= {lhs}")
self.write_line(f"{self.var(argv[0])} -= {lhs};")
else:
self.write_line(f"{self.var(argv[0])} -=f {lhs}")
self.write_line(f"{self.var(argv[0])} -=f {lhs};")
elif opcode == 0x2E:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} *= {lhs}")
self.write_line(f"{self.var(argv[0])} *= {lhs};")
else:
self.write_line(f"{self.var(argv[0])} *=f {lhs}")
self.write_line(f"{self.var(argv[0])} *=f {lhs};")
elif opcode == 0x2F:
lhs = self.var(argv[1])
if self.is_float(lhs):
self.write_line(f"{self.var(argv[0])} /= {lhs}")
self.write_line(f"{self.var(argv[0])} /= {lhs};")
else:
self.write_line(f"{self.var(argv[0])} /=f {lhs}")
elif opcode == 0x3F: self.write_line(f"{self.var(argv[0])} &= {self.var(argv[1])}")
elif opcode == 0x40: self.write_line(f"{self.var(argv[0])} |= {self.var(argv[1])}")
elif opcode == 0x41: self.write_line(f"{self.var(argv[0])} &=c {argv[1]:X}")
elif opcode == 0x42: self.write_line(f"{self.var(argv[0])} |=c {argv[1]:X}")
self.write_line(f"{self.var(argv[0])} /=f {lhs};")
elif opcode == 0x3F: self.write_line(f"{self.var(argv[0])} &= {self.var(argv[1])};")
elif opcode == 0x40: self.write_line(f"{self.var(argv[0])} |= {self.var(argv[1])};")
elif opcode == 0x41: self.write_line(f"{self.var(argv[0])} &=c {argv[1]:X};")
elif opcode == 0x42: self.write_line(f"{self.var(argv[0])} |=c {argv[1]:X};")
elif opcode == 0x43:
argv_str = ", ".join(self.var(arg) for arg in argv[1:])
self.write_line(f"{self.addr_ref(argv[0])}({argv_str})")
elif opcode == 0x44: self.write_line(f"spawn {self.addr_ref(argv[0])}")
elif opcode == 0x45: self.write_line(f"{self.var(argv[1])} = spawn ({self.addr_ref(argv[0])}")
elif opcode == 0x46: self.write_line(f"await {self.addr_ref(argv[0])}")
elif opcode == 0x44: self.write_line(f"spawn {self.addr_ref(argv[0])};")
elif opcode == 0x45: self.write_line(f"{self.var(argv[1])} = spawn {self.addr_ref(argv[0])};")
elif opcode == 0x46: self.write_line(f"await {self.addr_ref(argv[0])};")
elif opcode == 0x47:
assert argv[3] == 1
if argv[4] != 0:
self.write_line(f"{self.var(argv[4])} = bind {self.addr_ref(argv[0])} to {self.trigger(argv[1])} {self.var(argv[2])}")
self.write_line(f"{self.var(argv[4])} = bind {self.addr_ref(argv[0])} to {self.trigger(argv[1])} {self.var(argv[2])};")
else:
self.write_line(f"bind {self.addr_ref(argv[0])} to {self.trigger(argv[1])} {self.var(argv[2])}")
elif opcode == 0x48: self.write_line(f"unbind")
elif opcode == 0x49: self.write_line(f"kill {self.var(argv[0])}")
elif opcode == 0x4D: self.write_line(f"group {self.var(argv[0])}")
elif opcode == 0x4F: self.write_line(f"suspend group {self.var(argv[0])}")
elif opcode == 0x50: self.write_line(f"resume group {self.var(argv[0])}")
elif opcode == 0x51: self.write_line(f"suspend others {self.var(argv[0])}")
elif opcode == 0x52: self.write_line(f"resume others {self.var(argv[0])}")
elif opcode == 0x53: self.write_line(f"suspend {self.var(argv[0])}")
elif opcode == 0x54: self.write_line(f"resume {self.var(argv[0])}")
self.write_line(f"bind {self.addr_ref(argv[0])} to {self.trigger(argv[1])} {self.var(argv[2])};")
elif opcode == 0x48: self.write_line(f"unbind;")
elif opcode == 0x49: self.write_line(f"kill {self.var(argv[0])};")
elif opcode == 0x4D: self.write_line(f"group {self.var(argv[0])};")
elif opcode == 0x4F: self.write_line(f"suspend group {self.var(argv[0])};")
elif opcode == 0x50: self.write_line(f"resume group {self.var(argv[0])};")
elif opcode == 0x51: self.write_line(f"suspend others {self.var(argv[0])};")
elif opcode == 0x52: self.write_line(f"resume others {self.var(argv[0])};")
elif opcode == 0x53: self.write_line(f"suspend {self.var(argv[0])};")
elif opcode == 0x54: self.write_line(f"resume {self.var(argv[0])};")
elif opcode == 0x56:
self.write_line("spawn {")
self.indent += 1