Document script var usage

This commit is contained in:
Mateon1 2024-09-19 22:47:00 +02:00
parent dcc7bd7115
commit a16ebb40c0
No known key found for this signature in database
GPG Key ID: 6A6067123E4CAF6E
17 changed files with 308 additions and 225 deletions

View File

@ -30,6 +30,95 @@ enum FlagJudgeOperation {
JUDGE_BIT_SET,
};
enum ScriptVarId {
/* 0x00 */ VERSION,
/* 0x01 */ CONDITION,
/* 0x02 */ SCENARIO_SELECT,
/* 0x03 */ SCENARIO_MAIN,
/* 0x04 */ SCENARIO_SUB1,
/* 0x05 */ SCENARIO_SUB2,
/* 0x06 */ SCENARIO_SUB3,
/* 0x07 */ SCENARIO_SUB4,
/* 0x08 */ SCENARIO_SUB5,
/* 0x09 */ SCENARIO_SUB6,
/* 0x0a */ SCENARIO_SUB7,
/* 0x0b */ SCENARIO_SUB8,
/* 0x0c */ SCENARIO_SUB9,
/* 0x0d */ GROUND_ENTER,
/* 0x0e */ GROUND_ENTER_LINK,
/* 0x0f */ GROUND_GETOUT,
/* 0x10 */ GROUND_MAP,
/* 0x11 */ GROUND_PLACE,
/* 0x12 */ DUNGEON_SELECT,
/* 0x13 */ DUNGEON_ENTER,
/* 0x14 */ DUNGEON_ENTER_INDEX,
/* 0x15 */ DUNGEON_ENTER_FREQUENCY,
/* 0x16 */ DUNGEON_RESULT,
/* 0x17 */ SCRIPT_MODE,
/* 0x18 */ START_MODE,
/* 0x19 */ CLEAR_COUNT,
/* 0x1a */ CONDITION_KIND,
/* 0x1b */ WEATHER_KIND,
/* 0x1c */ PLAYER_KIND,
/* 0x1d */ PARTNER1_KIND,
/* 0x1e */ PARTNER2_KIND,
/* 0x1f */ NEW_FRIEND_KIND,
/* 0x20 */ FRIEND_SUM,
/* 0x21 */ UNIT_SUM,
/* 0x22 */ GOLD,
/* 0x23 */ BANK_GOLD,
/* 0x24 */ WARP_LIST,
/* 0x25 */ WARP_LOCK,
/* 0x26 */ PARTNER_TALK_KIND,
/* 0x27 */ BASE_KIND,
/* 0x28 */ BASE_LEVEL,
/* 0x29 */ FLAG_KIND,
/* 0x2a */ FLAG_KIND_CHANGE_REQUEST,
/* 0x2b */ RESCUE_SCENARIO_ORDER_LIST,
/* 0x2c */ RESCUE_SCENARIO_JOB_LIST,
/* 0x2d */ RESCUE_SCENARIO_CONQUEST_LIST,
/* 0x2e */ TRAINING_CONQUEST_LIST,
/* 0x2f */ TRAINING_PRESENT_LIST,
/* 0x30 */ DUNGEON_ENTER_LIST,
/* 0x31 */ DUNGEON_CLEAR_LIST,
/* 0x32 */ POSITION_X,
/* 0x33 */ POSITION_Y,
/* 0x34 */ POSITION_HEIGHT,
/* 0x35 */ POSITION_DIRECTION,
/* 0x36 */ GROUND_LOCAL,
/* 0x37 */ MAP_LOCAL,
/* 0x38 */ MAP_LOCAL_DOOR,
/* 0x39 */ EVENT_LOCAL,
/* 0x3a */ STATION_ITEM_STATIC,
/* 0x3b */ STATION_ITEM_TEMP,
/* 0x3c */ DELIVER_ITEM_STATIC,
/* 0x3d */ DELIVER_ITEM_TEMP,
/* 0x3e */ SHOP_TEMP,
/* 0x3f */ INN_TEMP,
/* 0x40 */ EVENT_S07E01,
/* 0x41 */ EVENT_S08E01,
/* 0x42 */ EVENT_GONBE,
/* 0x43 */ EVENT_ORNAMENT_01,
/* 0x44 */ EVENT_ORNAMENT_02,
/* 0x45 */ EVENT_ORNAMENT_03,
/* 0x46 */ EVENT_ORNAMENT_04,
/* 0x47 */ EVENT_B01P01,
/* 0x48 */ EVENT_T01P01,
/* 0x49 */ EVENT_T01P02,
/* 0x4a */ EVENT_T01P03,
/* 0x4b */ EVENT_M01E09A_2N,
/* 0x4c */ EVENT_M01E09A_8N,
/* 0x4d */ EVENT_M01E10A_1N,
/* 0x4e */ EVENT_M01E10A_3N,
/* 0x4f */ EVENT_M01E10A_5N,
/* 0x50 */ EVENT_M02E01A_2N,
/* 0x51 */ SUM,
/* 0x400 */ LOCAL0 = 0x400,
/* 0x401 */ LOCAL1,
/* 0x402 */ LOCAL2,
/* 0x403 */ LOCAL3,
};
// size: 0x10
struct ScriptVarInfo {
s16 type;
@ -60,10 +149,10 @@ void SetScriptVarValue(u8 *localVarBuf, s32 varId, s32 val);
void SetScriptVarArrayValue(u8 *localVarBuf, s32 varId, u16 idx, s32 val);
s32 GetScriptVarArraySum(u8 *localVarBuf, s16 varId);
void GetScriptVarScenario(s32 varId,u32 *outMain,u32 *outSub);
void ScenarioCalc(s16 varId, s32 param_2, s32 param_3);
bool8 ScriptVarScenarioBefore(s16 param_1, u32 param_2, s32 param_3);
bool8 ScriptVarScenarioEqual(s16 param_1, u32 param_2, s32 param_3);
bool8 ScriptVarScenarioAfter(s16 param_1, u32 param_2, s32 param_3);
void ScenarioCalc(s16 varId, s32 main, s32 sub);
bool8 ScriptVarScenarioBefore(s16 varId, u32 main, s32 sub);
bool8 ScriptVarScenarioEqual(s16 varId, u32 main, s32 sub);
bool8 ScriptVarScenarioAfter(s16 varId, u32 main, s32 sub);
void sub_8001D88(void);
s32 _FlagCalc(s32 param_1, s32 param_2, enum FlagCalcOperation operation);
bool8 _FlagJudge(s32 param_1, s32 param_2, enum FlagJudgeOperation operation);
@ -71,17 +160,15 @@ s32 FlagCalc(s32 r0, s32 r1, enum FlagCalcOperation operation);
void UpdateScriptVarWithImmediate(u8 *localVarBuf, s16 varId, s32 val, enum FlagCalcOperation operation);
void UpdateScriptVarWithVar(u8 *localVarBuf, s16 dstVarId, s16 srcVarId, enum FlagCalcOperation operation);
bool8 FlagJudge(s32 r0, s32 r1, enum FlagJudgeOperation operation);
bool8 JudgeVarWithImmediate(u8 *param_1, s16 param_2, s32 param_3, enum FlagJudgeOperation operation);
bool8 JudgeVarWithVar(u8 *param_1, s16 param_2, s16 param_3, enum FlagJudgeOperation operation);
bool8 sub_80023E4(u32 param_1);
u8 sub_8002658(s16 param_1);
s16 sub_8002694(u8 param_1);
bool8 JudgeVarWithImmediate(u8 *localVarBuf, s16 varId, s32 val, enum FlagJudgeOperation operation);
bool8 JudgeVarWithVar(u8 *localVarBuf, s16 varId1, s16 varId2, enum FlagJudgeOperation operation);
bool8 sub_80023E4(u32 param_1); // some kind of helper for predefined scenario checks
u8 sub_8002658(s16 param_1); // GroundEnter -> value lookup
s16 sub_8002694(u8 param_1); // value -> GroundEnter lookup
bool8 sub_80026CC(s16 r0);
void sub_80026E8(s16 r0, bool8 r1);
bool8 SaveGlobalScriptVars(void *r0);
bool8 RestoreGlobalScriptVars(u8 *r0);
void sub_8002758(s32 r0);
u8 sub_800276C(void);
// .rodata
extern struct ScriptVarInfo gScriptVarInfo[];

View File

@ -60,49 +60,49 @@ void ThoroughlyResetScriptVars(void)
}
}
}
ClearScriptVarArray(NULL,1);
ScenarioCalc(2,0,0);
ScenarioCalc(3,0,0);
ScenarioCalc(4,0,0);
ScenarioCalc(5,0,0);
ScenarioCalc(6,0,0);
ScenarioCalc(7,0,0);
ScenarioCalc(8,0,0);
ScenarioCalc(9,0,0);
ScenarioCalc(10,0,0);
ScenarioCalc(0xb,0,0);
ScenarioCalc(0xc,0,0);
SetScriptVarValue(NULL,0xd,0xa2);
SetScriptVarValue(NULL,0xe,0);
SetScriptVarValue(NULL,0xf,0xa2);
SetScriptVarValue(NULL,0x10,-1);
SetScriptVarValue(NULL,0x11,0x24);
SetScriptVarValue(NULL,0x12,-1);
SetScriptVarValue(NULL,0x13,0);
SetScriptVarValue(NULL,0x14,-1);
SetScriptVarValue(NULL,0x16,0);
SetScriptVarValue(NULL,0x18,0);
SetScriptVarValue(NULL,0x19,0);
SetScriptVarValue(NULL,0x1b,-1);
SetScriptVarValue(NULL,0x1c,0);
SetScriptVarValue(NULL,0x1d,0);
SetScriptVarValue(NULL,0x1e,0);
SetScriptVarValue(NULL,0x1f,0);
ClearScriptVarArray(NULL,0x24);
SetScriptVarValue(NULL,0x25,0);
SetScriptVarValue(NULL,0x26,0);
SetScriptVarValue(NULL,0x27,0);
SetScriptVarValue(NULL,0x28,0);
SetScriptVarValue(NULL,0x29,0);
SetScriptVarValue(NULL,0x2a,0);
ClearScriptVarArray(NULL,0x2b);
ClearScriptVarArray(NULL,0x2c);
ClearScriptVarArray(NULL,0x2d);
ClearScriptVarArray(NULL,0x2e);
ClearScriptVarArray(NULL,0x2f);
ClearScriptVarArray(NULL,0x30);
ClearScriptVarArray(NULL,0x31);
ClearScriptVarArray(NULL,0x41);
ClearScriptVarArray(NULL, CONDITION);
ScenarioCalc(SCENARIO_SELECT,0,0);
ScenarioCalc(SCENARIO_MAIN,0,0);
ScenarioCalc(SCENARIO_SUB1,0,0);
ScenarioCalc(SCENARIO_SUB2,0,0);
ScenarioCalc(SCENARIO_SUB3,0,0);
ScenarioCalc(SCENARIO_SUB4,0,0);
ScenarioCalc(SCENARIO_SUB5,0,0);
ScenarioCalc(SCENARIO_SUB6,0,0);
ScenarioCalc(SCENARIO_SUB7,0,0);
ScenarioCalc(SCENARIO_SUB8,0,0);
ScenarioCalc(SCENARIO_SUB9,0,0);
SetScriptVarValue(NULL,GROUND_ENTER,0xa2);
SetScriptVarValue(NULL,GROUND_ENTER_LINK,0);
SetScriptVarValue(NULL,GROUND_GETOUT,0xa2);
SetScriptVarValue(NULL,GROUND_MAP,-1);
SetScriptVarValue(NULL,GROUND_PLACE,0x24);
SetScriptVarValue(NULL,DUNGEON_SELECT,-1);
SetScriptVarValue(NULL,DUNGEON_ENTER,0);
SetScriptVarValue(NULL,DUNGEON_ENTER_INDEX,-1);
SetScriptVarValue(NULL,DUNGEON_RESULT,0);
SetScriptVarValue(NULL,START_MODE,0);
SetScriptVarValue(NULL,CLEAR_COUNT,0);
SetScriptVarValue(NULL,WEATHER_KIND,-1);
SetScriptVarValue(NULL,PLAYER_KIND,0);
SetScriptVarValue(NULL,PARTNER1_KIND,0);
SetScriptVarValue(NULL,PARTNER2_KIND,0);
SetScriptVarValue(NULL,NEW_FRIEND_KIND,0);
ClearScriptVarArray(NULL,WARP_LIST);
SetScriptVarValue(NULL,WARP_LOCK,0);
SetScriptVarValue(NULL,PARTNER_TALK_KIND,0);
SetScriptVarValue(NULL,BASE_KIND,0);
SetScriptVarValue(NULL,BASE_LEVEL,0);
SetScriptVarValue(NULL,FLAG_KIND,0);
SetScriptVarValue(NULL,FLAG_KIND_CHANGE_REQUEST,0);
ClearScriptVarArray(NULL,RESCUE_SCENARIO_ORDER_LIST);
ClearScriptVarArray(NULL,RESCUE_SCENARIO_JOB_LIST);
ClearScriptVarArray(NULL,RESCUE_SCENARIO_CONQUEST_LIST);
ClearScriptVarArray(NULL,TRAINING_CONQUEST_LIST);
ClearScriptVarArray(NULL,TRAINING_PRESENT_LIST);
ClearScriptVarArray(NULL,DUNGEON_ENTER_LIST);
ClearScriptVarArray(NULL,DUNGEON_CLEAR_LIST);
ClearScriptVarArray(NULL,EVENT_S08E01);
sub_80972F4();
}

View File

@ -86,9 +86,9 @@ void GameLoop(void)
ThoroughlyResetScriptVars();
xxx_script_related_8001334(14);
xxx_script_related_8001334(15);
ClearScriptVarArray(NULL, 57);
ClearScriptVarArray(NULL, EVENT_LOCAL);
xxx_script_related_8001334(16);
if (GetScriptVarValue(NULL, 57) == 0)
if (GetScriptVarValue(NULL, EVENT_LOCAL) == 0)
xxx_script_related_8001334(17);
while (1) {

View File

@ -160,24 +160,24 @@ static void sub_801B874(void)
if (sUnknown_203B234->unk10.id == ITEM_WEAVILE_FIG) {
sUnknown_203B234->fallbackState = 16;
if (GetScriptVarArrayValue(NULL, 71, 1)) {
if (GetScriptVarArrayValue(NULL, EVENT_B01P01, 1)) {
AddToTeamMoney(1000);
sub_801B748(4);
}
else {
SetScriptVarArrayValue(NULL, 71, 1, 1);
SetScriptVarArrayValue(NULL, EVENT_B01P01, 1, 1);
sub_801B748(3);
}
}
else if (sUnknown_203B234->unk10.id == ITEM_MIME_JR_FIG) {
sUnknown_203B234->fallbackState = 16;
if (GetScriptVarArrayValue(NULL, 71, 0)) {
if (GetScriptVarArrayValue(NULL, EVENT_B01P01, 0)) {
AddToTeamMoney(1000);
sub_801B748(4);
}
else {
SetScriptVarArrayValue(NULL, 71, 0, 1);
SetScriptVarArrayValue(NULL, EVENT_B01P01, 0, 1);
sub_801B748(3);
}
}

View File

@ -808,7 +808,7 @@ bool8 sub_80961D8(void)
gUnknown_203B490->unk328 = flag;
}
floor = 0x38;
if(ScriptVarScenarioEqual(0xA, 0x31, 0x1))
if(ScriptVarScenarioEqual(SCENARIO_SUB7, 0x31, 0x1))
{
if(!gUnknown_203B490->PKMNNewsReceived[0x35])
if(!sub_8096E80(0x35)) floor = 0x35;

View File

@ -14,9 +14,9 @@ extern void GeneratePelipperJobs(void);
void sub_80972F4(void)
{
ClearScriptVarArray(NULL, 0x2B);
ClearScriptVarArray(NULL, 0x2C);
ClearScriptVarArray(NULL, 0x2D);
ClearScriptVarArray(NULL, RESCUE_SCENARIO_ORDER_LIST);
ClearScriptVarArray(NULL, RESCUE_SCENARIO_JOB_LIST);
ClearScriptVarArray(NULL, RESCUE_SCENARIO_CONQUEST_LIST);
}
void nullsub_128(void)
@ -33,7 +33,7 @@ s32 sub_8097318(s16 param_1)
iVar1 = 0;
}
else {
iVar1 = GetScriptVarArrayValue(NULL,0x2b,param_1_s32);
iVar1 = GetScriptVarArrayValue(NULL,RESCUE_SCENARIO_ORDER_LIST,param_1_s32);
if (iVar1 != 0) {
iVar1 = 1;
}
@ -41,28 +41,31 @@ s32 sub_8097318(s16 param_1)
return iVar1;
}
void sub_809733C(short param_1,u32 param_2)
void sub_809733C(s16 param_1,u32 param_2)
{
s32 uVar2;
u8 param_2_u8;
u16 uVar2_u16;
uVar2 = param_1;
param_2_u8 = param_2;
if (uVar2 != 0xd) {
uVar2_u16 = uVar2;
if ((((GetScriptVarArrayValue(NULL,0x2c,uVar2_u16) == 0) && (SetScriptVarArrayValue(NULL,0x2b,uVar2_u16,param_2_u8), param_2_u8 != '\0')))){
if (GetScriptVarArrayValue(NULL,RESCUE_SCENARIO_JOB_LIST,uVar2_u16) == 0) {
SetScriptVarArrayValue(NULL,RESCUE_SCENARIO_ORDER_LIST,uVar2_u16,param_2_u8);
if (param_2_u8) {
switch(uVar2)
{
case 0xE:
case 0xF:
case 0x1C:
GeneratePelipperJobs();
break;
case 0xE:
case 0xF:
case 0x1C:
GeneratePelipperJobs();
break;
}
}
}
}
}
bool32 sub_8097384(s16 param_1)
@ -73,7 +76,7 @@ bool32 sub_8097384(s16 param_1)
val = FALSE;
else {
// May not need the & 0xFFFF if the 3rd param is s16
val = GetScriptVarArrayValue(NULL, 44, param_1 & 0xFFFF);
val = GetScriptVarArrayValue(NULL, RESCUE_SCENARIO_JOB_LIST, param_1 & 0xFFFF);
if (val != 0)
val = TRUE;
}
@ -90,12 +93,12 @@ void sub_80973A8(s16 param_1,u32 param_2)
if (param_1_s32 != 0xd) {
if (param_2_u32 != 0) {
sVar1 = sub_80A26B8(param_1);
SetScriptVarArrayValue(NULL,0x2b,param_1_s32,0);
SetScriptVarArrayValue(NULL,RESCUE_SCENARIO_ORDER_LIST,param_1_s32,0);
if (sVar1 != -1) {
SetScriptVarValue(NULL,0x12,sVar1);
SetScriptVarValue(NULL,DUNGEON_SELECT,sVar1);
}
}
SetScriptVarArrayValue(NULL,0x2c,param_1_s32,param_2_u32);
SetScriptVarArrayValue(NULL,RESCUE_SCENARIO_JOB_LIST,param_1_s32,param_2_u32);
}
}
@ -107,7 +110,8 @@ bool32 RescueScenarioConquered(s16 param_1)
val = FALSE;
else {
// May not need the & 0xFFFF if the 3rd param is s16
val = GetScriptVarArrayValue(NULL, 45, param_1 & 0xFFFF);
// But it doesn't work
val = GetScriptVarArrayValue(NULL, RESCUE_SCENARIO_CONQUEST_LIST, param_1 & 0xFFFF);
if (val != 0)
val = TRUE;
}
@ -120,7 +124,7 @@ void sub_8097418(s16 index,bool32 param_2)
int index_s32 = index;
bool8 param_2_u8 = param_2;
if (index_s32 != 0xd) {
if ((param_2_u8) && (SetScriptVarArrayValue(NULL,0x2c,index_s32,0), index_s32 < 0x1f)) {
if ((param_2_u8) && (SetScriptVarArrayValue(NULL,RESCUE_SCENARIO_JOB_LIST,index_s32,0), index_s32 < 0x1f)) {
const MissionText *mt = &gStoryMissionText[index_s32];
if (mt->unk4 != 0xFF) {
sub_8097FA8(mt->unk4);
@ -133,7 +137,7 @@ void sub_8097418(s16 index,bool32 param_2)
}
sub_8097FF8();
}
SetScriptVarArrayValue(NULL,0x2d,index_s32,param_2_u8);
SetScriptVarArrayValue(NULL,RESCUE_SCENARIO_CONQUEST_LIST,index_s32,param_2_u8);
}
}
@ -176,8 +180,8 @@ const u8 *GetCurrentMissionText(s16 index)
void sub_80974E8(void)
{
ClearScriptVarArray(NULL, 0x2E);
ClearScriptVarArray(NULL, 0x2F);
ClearScriptVarArray(NULL, TRAINING_CONQUEST_LIST);
ClearScriptVarArray(NULL, TRAINING_PRESENT_LIST);
}
void nullsub_208(void)

View File

@ -74,7 +74,7 @@ bool32 IsMazeCompleted(s16 mazeIndex)
{
bool32 mazeCompletion;
mazeCompletion = GetScriptVarArrayValue(NULL, 0x2e, mazeIndex);
mazeCompletion = GetScriptVarArrayValue(NULL, TRAINING_CONQUEST_LIST, mazeIndex);
if (mazeCompletion) {
mazeCompletion = TRUE;
}
@ -84,7 +84,7 @@ bool32 IsMazeCompleted(s16 mazeIndex)
void sub_80975A8(s16 param_1,u8 param_2)
{
u16 param_1_u16 = param_1;
SetScriptVarArrayValue(NULL,0x2e,param_1_u16,param_2);
SetScriptVarArrayValue(NULL,TRAINING_CONQUEST_LIST,param_1_u16,param_2);
}
const u8 *sub_80975C4(s16 index)
@ -97,7 +97,7 @@ const u8 *sub_80975DC(u32 r0)
// TODO: slight hack but matches
r0 <<= 16;
if((0xffe90000 + r0) >> 16 < 2)
if(ScriptVarScenarioEqual(0x3, 0xE, -1))
if(ScriptVarScenarioEqual(SCENARIO_MAIN, 0xE, -1))
return gMeetNinetalesText;
else
return gAvoidCaptureText;
@ -118,9 +118,9 @@ bool8 HasCompletedAllMazes(void)
bool8 sub_8097640(void)
{
if(GetScriptVarArrayValue(NULL, 0x2E, 0x1F) == 0 && HasCompletedAllMazes())
if(GetScriptVarArrayValue(NULL, TRAINING_CONQUEST_LIST, 0x1F) == 0 && HasCompletedAllMazes())
{
SetScriptVarArrayValue(NULL, 0x2E, 0x1F, 1);
SetScriptVarArrayValue(NULL, TRAINING_CONQUEST_LIST, 0x1F, 1);
return TRUE;
}
else

View File

@ -75,7 +75,7 @@ void sub_809C478(void)
sub_8035758();
GetScriptVarScenario(3, &temp, &temp1);
GetScriptVarScenario(SCENARIO_MAIN, &temp, &temp1);
sub_80993C0(0);
}
@ -154,15 +154,15 @@ void sub_809C550(void)
switch(ret)
{
case 1:
if(ScriptVarScenarioBefore(4, 0x1D, 0x3))
if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1D, 0x3))
val = 1;
break;
case 2:
if(ScriptVarScenarioBefore(4, 0x1F, 0x2))
if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1F, 0x2))
val = 2;
break;
case 3:
if(ScriptVarScenarioBefore(0xB, 0x33, 0x8))
if(ScriptVarScenarioBefore(SCENARIO_SUB8, 0x33, 0x8))
val = 3;
break;
}

View File

@ -272,7 +272,7 @@ void sub_809C770(s16 param_1, s16 param_2)
break;
case 0:
default:
iVar5 = (s16)GetScriptVarValue(NULL,0x13);
iVar5 = (s16)GetScriptVarValue(NULL,DUNGEON_ENTER);
break;
}
@ -413,8 +413,8 @@ void sub_809CB74(void) {
void sub_809CB8C(void) {
ClearScriptVarArray(NULL, 0x3B);
ClearScriptVarArray(NULL, 0x3D);
ClearScriptVarArray(NULL, STATION_ITEM_TEMP);
ClearScriptVarArray(NULL, DELIVER_ITEM_TEMP);
}
bool8 HasItemInInventory(u8 item)

View File

@ -74,7 +74,7 @@ u32 sub_80A25AC(u16 param_1)
return 19;
if (param_1 != 1)
return param_1;
GetScriptVarValue(NULL, 40);
GetScriptVarValue(NULL, BASE_LEVEL); // wut???
return 1;
}
@ -460,5 +460,5 @@ const u8 *sub_80A2B18(s16 param_1)
UNUSED static const u8 *sub_80A2B28(u16 r0)
{
return sub_80A2B18(GetScriptVarValue(NULL, 17));
return sub_80A2B18(GetScriptVarValue(NULL, GROUND_PLACE));
}

View File

@ -14,7 +14,7 @@ bool8 sub_8035678(void)
sCredits2Work = MemoryAlloc(sizeof(Credits2Work), 8);
sCredits2Work->state = 0;
sCredits2Work->unk4 = 0;
ClearScriptVarArray(NULL, 57);
ClearScriptVarArray(NULL, EVENT_LOCAL);
return TRUE;
}
@ -62,7 +62,7 @@ u32 sub_80356A0(void)
return 3; // sub_809C478 clears the flash data when this is returned
}
if (GetScriptVarValue(NULL, 57) != 0) {
if (GetScriptVarValue(NULL, EVENT_LOCAL) != 0) {
sCredits2Work->state = 3;
return 2;
}
@ -76,4 +76,4 @@ void sub_8035758(void)
MemoryFree(sCredits2Work);
sCredits2Work = NULL;
}
}
}

View File

@ -53,8 +53,7 @@ extern void sub_80973A8(u32, u32);
// code_80972F4.h (read comment)
extern bool8 RescueScenarioConquered(s16);
// unused
u8 *GetScriptVarPointer(s16 varId)
UNUSED u8 *GetScriptVarPointer(s16 varId)
{
struct ScriptVarPtr local_1c;
@ -62,8 +61,7 @@ u8 *GetScriptVarPointer(s16 varId)
return local_1c.ptr;
}
// unused
s16 GetScriptVarArrayLength(s16 varId)
UNUSED s16 GetScriptVarArrayLength(s16 varId)
{
struct ScriptVarPtr local_1c;
@ -89,8 +87,7 @@ s32 GetScriptVarArraySum(u8 *localVarBuf, s16 varId)
return total;
}
// unused
void GetScriptVarString(s16 varId, u8 *buf, s32 maxLen)
UNUSED void GetScriptVarString(s16 varId, u8 *buf, s32 maxLen)
{
u8 *r1;
s32 r2;
@ -107,8 +104,7 @@ void GetScriptVarString(s16 varId, u8 *buf, s32 maxLen)
*buf = 0;
}
// unused
void ScriptVarStringPopFirstChar(s16 varId,u32 param_2,s32 maxLen)
UNUSED void ScriptVarStringPopFirstChar(s16 varId,u32 param_2,s32 maxLen)
{
u8 *r1;
s32 r2;
@ -145,7 +141,7 @@ void ScenarioCalc(s16 param_1,s32 param_2,s32 param_3)
GetScriptVarScenario(param_1_s32,&local_18,&local_14);
Log(6,gUnknown_80B72CC,param_1_s32,local_18,local_14,param_2,param_3); // SCENARIO CALC [%3d] %4d %4d -> %4d %4d
if ((param_1_s32 == 3) && ((param_2 != local_18 || (param_3 != local_14)))) {
SetScriptVarValue(NULL,0x19,0);
SetScriptVarValue(NULL,CLEAR_COUNT,0);
}
SetScriptVarArrayValue(NULL,param_1_s32,0,param_2);
SetScriptVarArrayValue(NULL,param_1_s32,1,param_3);
@ -154,27 +150,27 @@ void ScenarioCalc(s16 param_1,s32 param_2,s32 param_3)
{
case 3:
if (((u32)(param_2 - 1) < 0x1b)) {
if (ScriptVarScenarioAfter(3,8,-1)) {
if (ScriptVarScenarioAfter(SCENARIO_MAIN,8,-1)) {
sub_80976F8(0);
}
if (ScriptVarScenarioAfter(3,0xb,3)) {
if (ScriptVarScenarioAfter(SCENARIO_MAIN,0xb,3)) {
sub_80976F8(1);
}
if (ScriptVarScenarioAfter(3,0x11,0)) {
if (ScriptVarScenarioAfter(SCENARIO_MAIN,0x11,0)) {
sub_80976F8(2);
}
}
break;
case 4:
if (ScriptVarScenarioBefore(4,0x1f,0) == 0) {
if (ScriptVarScenarioBefore(SCENARIO_SUB1,0x1f,0) == 0) {
sub_80976F8(4);
}
if (ScriptVarScenarioBefore(4,0x20,0) == 0) {
if (ScriptVarScenarioBefore(SCENARIO_SUB1,0x20,0) == 0) {
sub_80976F8(5);
}
break;
case 0xC:
if(ScriptVarScenarioBefore(0xc,0x37,2) == 0) {
if(ScriptVarScenarioBefore(SCENARIO_SUB9,0x37,2) == 0) {
sub_80976F8(3);
}
break;
@ -235,26 +231,26 @@ void sub_8001D88(void)
GetScriptVarScenario(3, &auStack8, &local_c);
if (auStack8 - 1 < 0x1b) {
if (ScriptVarScenarioBefore(4,0x1f,0) != 0) {
if (ScriptVarScenarioAfter(3,0xf,7) != 0) {
ScenarioCalc(4,0x1f,0);
if (ScriptVarScenarioBefore(SCENARIO_SUB1,0x1f,0) != 0) {
if (ScriptVarScenarioAfter(SCENARIO_MAIN,0xf,7) != 0) {
ScenarioCalc(SCENARIO_SUB1,0x1f,0);
sub_8097418(0xe,1);
SetScriptVarValue(NULL,0x28,2);
SetScriptVarValue(NULL,BASE_LEVEL,2);
}
else {
if ((ScriptVarScenarioEqual(4,0,0)) && (ScriptVarScenarioAfter(3,0xf,3))) {
ScenarioCalc(4,0x1d,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB1,0,0)) && (ScriptVarScenarioAfter(SCENARIO_MAIN,0xf,3))) {
ScenarioCalc(SCENARIO_SUB1,0x1d,1);
}
}
}
if ((ScriptVarScenarioEqual(4,0x1f,0)) && (GetFriendAreaStatus(SKY_BLUE_PLAINS))) {
ScenarioCalc(4,0x1f,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB1,0x1f,0)) && (GetFriendAreaStatus(SKY_BLUE_PLAINS))) {
ScenarioCalc(SCENARIO_SUB1,0x1f,1);
sub_809733C(0xf,1);
}
if (auStack8 > 0x11) {
sub_80973A8(0x25,1);
if (((FindItemInInventory(ITEM_HM_DIVE) != -1) || (gTeamInventoryRef->teamStorage[ITEM_HM_DIVE] != 0)) ||
(ScriptVarScenarioAfter(5,0x21,3) != 0)) {
(ScriptVarScenarioAfter(SCENARIO_SUB2,0x21,3) != 0)) {
sub_80973A8(0x22,1);
}
if (GetFriendAreaStatus(FURNACE_DESERT) != 0) {
@ -276,24 +272,24 @@ void sub_8001D88(void)
if ((GetFriendAreaStatus(AGED_CHAMBER_AN)) && (GetFriendAreaStatus(AGED_CHAMBER_O_EXCLAIM))) {
sub_80973A8(0x26,1);
}
if (ScriptVarScenarioEqual(5,0,0)) {
ScenarioCalc(5,0x21,1);
if (ScriptVarScenarioEqual(SCENARIO_SUB2,0,0)) {
ScenarioCalc(SCENARIO_SUB2,0x21,1);
}
if ((FindItemInInventory(ITEM_HM_SURF) != -1) || (gTeamInventoryRef->teamStorage[ITEM_HM_SURF] != 0)) {
if (ScriptVarScenarioEqual(7,0,0)) {
ScenarioCalc(7,0x26,1);
if (ScriptVarScenarioEqual(SCENARIO_SUB4,0,0)) {
ScenarioCalc(SCENARIO_SUB4,0x26,1);
}
if ((ScriptVarScenarioEqual(9,0,0)) && (GetFriendAreaStatus(SOUTHERN_ISLAND))) {
ScenarioCalc(9,0x2e,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB6,0,0)) && (GetFriendAreaStatus(SOUTHERN_ISLAND))) {
ScenarioCalc(SCENARIO_SUB6,0x2e,1);
}
}
if (!ScriptVarScenarioBefore(9,0x30,0)) {
if ((ScriptVarScenarioEqual(5,0x22,0)) && HasRecruitedMon(MONSTER_ARTICUNO) && HasRecruitedMon(MONSTER_ZAPDOS) && HasRecruitedMon(MONSTER_MOLTRES)) {
ScenarioCalc(5,0x22,1);
if (!ScriptVarScenarioBefore(SCENARIO_SUB6,0x30,0)) {
if ((ScriptVarScenarioEqual(SCENARIO_SUB2,0x22,0)) && HasRecruitedMon(MONSTER_ARTICUNO) && HasRecruitedMon(MONSTER_ZAPDOS) && HasRecruitedMon(MONSTER_MOLTRES)) {
ScenarioCalc(SCENARIO_SUB2,0x22,1);
}
if (((ScriptVarScenarioEqual(0xb,0,0)) && (ScriptVarScenarioAfter(5,0x21,3) != 0)) &&
if (((ScriptVarScenarioEqual(SCENARIO_SUB8,0,0)) && (ScriptVarScenarioAfter(SCENARIO_SUB2,0x21,3) != 0)) &&
(GetFriendAreaStatus(SKY_BLUE_PLAINS))) {
ScenarioCalc(0xb,0x33,1);
ScenarioCalc(SCENARIO_SUB8,0x33,1);
}
if (GetFriendAreaStatus(SKY_BLUE_PLAINS)) {
sub_80973A8(0x27,1);
@ -302,20 +298,20 @@ void sub_8001D88(void)
sub_80973A8(0x29,1);
}
}
if (!ScriptVarScenarioBefore(5,0x22,0)) {
if (ScriptVarScenarioEqual(10,0,0)) {
ScenarioCalc(10,0x31,1);
if (!ScriptVarScenarioBefore(SCENARIO_SUB2,0x22,0)) {
if (ScriptVarScenarioEqual(SCENARIO_SUB7,0,0)) {
ScenarioCalc(SCENARIO_SUB7,0x31,1);
sub_809733C(0x1b,1);
}
if ((ScriptVarScenarioEqual(0xc,0,0)) && (!ScriptVarScenarioBefore(0xb,0x34,0))) {
ScenarioCalc(0xc,0x35,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB9,0,0)) && (!ScriptVarScenarioBefore(SCENARIO_SUB8,0x34,0))) {
ScenarioCalc(SCENARIO_SUB9,0x35,1);
}
}
if ((ScriptVarScenarioEqual(6,0,0)) && (HasRecruitedMon(MONSTER_LUGIA))) {
ScenarioCalc(6,0x24,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB3,0,0)) && (HasRecruitedMon(MONSTER_LUGIA))) {
ScenarioCalc(SCENARIO_SUB3,0x24,1);
}
if ((ScriptVarScenarioEqual(8,0,0)) && (HasRecruitedMon(MONSTER_HO_OH))) {
ScenarioCalc(8,0x2c,1);
if ((ScriptVarScenarioEqual(SCENARIO_SUB5,0,0)) && (HasRecruitedMon(MONSTER_HO_OH))) {
ScenarioCalc(SCENARIO_SUB5,0x2c,1);
}
}
}
@ -440,8 +436,7 @@ bool8 JudgeVarWithVar(u8 *param_1, s16 param_2, s16 param_3, enum FlagJudgeOpera
return _FlagJudge(uVar1,uVar2,operation);
}
// unused
s32 sub_8002354(u32 param_1)
UNUSED s32 sub_8002354(u32 param_1)
{
if (param_1 < 0x3b) {
return gUnknown_80B6D90[param_1].num;
@ -451,8 +446,7 @@ s32 sub_8002354(u32 param_1)
}
}
// unused
u8 *sub_8002374(u32 param_1)
UNUSED u8 *sub_8002374(u32 param_1)
{
if (param_1 < 0x3b) {
return gUnknown_80B6D90[param_1].text;
@ -462,8 +456,7 @@ u8 *sub_8002374(u32 param_1)
}
}
// Unused
u8 *sub_8002394(u32 param_1)
UNUSED u8 *sub_8002394(u32 param_1)
{
if (param_1 - 0x12 < 9) {
return gUnknown_80B714C[param_1 - 0x12];
@ -476,8 +469,7 @@ u8 *sub_8002394(u32 param_1)
}
}
// Unused
u8 *sub_80023C4(u32 param_1)
UNUSED u8 *sub_80023C4(u32 param_1)
{
if (param_1 < 4) {
return gUnknown_80B71A0[param_1]; // CISTART, CECONTINUE, CNLAST, CWEND
@ -492,59 +484,59 @@ bool8 sub_80023E4(u32 param_1)
{
switch(param_1) {
case 0:
return ScriptVarScenarioAfter(3,2,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,2,-1);
case 1:
return ScriptVarScenarioAfter(3,3,3);
return ScriptVarScenarioAfter(SCENARIO_MAIN,3,3);
case 2:
return ScriptVarScenarioAfter(3,4,3);
return ScriptVarScenarioAfter(SCENARIO_MAIN,4,3);
case 3:
return ScriptVarScenarioAfter(3,5,0);
return ScriptVarScenarioAfter(SCENARIO_MAIN,5,0);
case 4:
return (ScriptVarScenarioAfter(3,0xb,0) && ScriptVarScenarioBefore(3,0xd,0));
return (ScriptVarScenarioAfter(SCENARIO_MAIN,0xb,0) && ScriptVarScenarioBefore(SCENARIO_MAIN,0xd,0));
case 5:
return (ScriptVarScenarioAfter(3,0xb,3) && ScriptVarScenarioBefore(3,0xf,0));
return (ScriptVarScenarioAfter(SCENARIO_MAIN,0xb,3) && ScriptVarScenarioBefore(SCENARIO_MAIN,0xf,0));
case 6:
return ScriptVarScenarioAfter(3,0x11,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0x11,-1);
case 7:
return ScriptVarScenarioAfter(3,0x12,2);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0x12,2);
case 8:
return ScriptVarScenarioAfter(3,0x12,3);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0x12,3);
case 9:
return ScriptVarScenarioAfter(3,0x12,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0x12,-1);
case 10:
return ScriptVarScenarioAfter(3,5,4);
return ScriptVarScenarioAfter(SCENARIO_MAIN,5,4);
case 0xb:
return ScriptVarScenarioAfter(3,5,4);
return ScriptVarScenarioAfter(SCENARIO_MAIN,5,4);
case 0xc:
return (!ScriptVarScenarioEqual(3,0xb,2) && !ScriptVarScenarioEqual(3,0xb,3));
return (!ScriptVarScenarioEqual(SCENARIO_MAIN,0xb,2) && !ScriptVarScenarioEqual(SCENARIO_MAIN,0xb,3));
case 0xd:
return ScriptVarScenarioEqual(3,0x10,2);
return ScriptVarScenarioEqual(SCENARIO_MAIN,0x10,2);
case 0xe:
return !ScriptVarScenarioBefore(3,5,7);
return !ScriptVarScenarioBefore(SCENARIO_MAIN,5,7);
case 0xf:
return !ScriptVarScenarioBefore(3,0xf,0);
return !ScriptVarScenarioBefore(SCENARIO_MAIN,0xf,0);
case 0x10:
return ScriptVarScenarioAfter(3,7,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,7,-1);
case 0x11:
return ScriptVarScenarioAfter(3,0xc,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0xc,-1);
case 0x12:
return ScriptVarScenarioAfter(3,0xd,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0xd,-1);
case 0x13:
return ScriptVarScenarioAfter(3,0xf,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0xf,-1);
case 0x14:
return ScriptVarScenarioAfter(3,0x10,-1);
return ScriptVarScenarioAfter(SCENARIO_MAIN,0x10,-1);
case 0x15:
return ScriptVarScenarioAfter(5,0x21,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB2,0x21,-1);
case 0x16:
return ScriptVarScenarioAfter(5,0x22,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB2,0x22,-1);
case 0x17:
return ScriptVarScenarioAfter(6,0x24,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB3,0x24,-1);
case 0x18:
return ScriptVarScenarioAfter(7,0x2a,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB4,0x2a,-1);
case 0x19:
return ScriptVarScenarioAfter(8,0x2c,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB5,0x2c,-1);
case 0x1a:
return ScriptVarScenarioAfter(10,0x31,-1);
return ScriptVarScenarioAfter(SCENARIO_SUB7,0x31,-1);
case 0x1b:
return RescueScenarioConquered(0x29);
case 0x1c:
@ -613,24 +605,24 @@ bool8 SaveGlobalScriptVars(void *r0)
bool8 RestoreGlobalScriptVars(u8 *r0)
{
struct ScriptVarPtr temp;
GetScriptVarRef(&temp, 0, 0);
GetScriptVarRef(&temp, NULL, VERSION);
MemoryCopy8(gScriptVarBuffer, r0, 0x400);
if (temp.info->defaultValue != *(u32 *)temp.ptr)
return 0;
return 1;
}
void sub_8002758(s32 r0)
UNUSED void SetConditionBit(s32 r0)
{
UpdateScriptVarWithImmediate(NULL, 0x1, r0, CALC_SETBIT);
UpdateScriptVarWithImmediate(NULL, CONDITION, r0, CALC_SETBIT);
}
u8 sub_800276C(void)
UNUSED u8 sub_800276C(void)
{
return 0;
}
void nullsub_140(void)
UNUSED void nullsub_140(void)
{
}

View File

@ -90,26 +90,26 @@ void sub_8098BDC(void)
void sub_8098C58(void)
{
s32 temp, temp2;
ClearScriptVarArray(NULL, 54);
ClearScriptVarArray(NULL, 57);
ClearScriptVarArray(NULL, GROUND_LOCAL);
ClearScriptVarArray(NULL, EVENT_LOCAL);
sub_809CB8C();
sub_8001D88();
if (GetScriptVarValue(NULL, 42) != 0) {
temp = GetScriptVarValue(NULL, 41);
if (GetScriptVarValue(NULL, FLAG_KIND_CHANGE_REQUEST) != 0) {
temp = GetScriptVarValue(NULL, FLAG_KIND);
temp++;
if (temp > 15)
temp = 0;
SetScriptVarValue(NULL, 41, temp);
SetScriptVarValue(NULL, 42, 0);
SetScriptVarValue(NULL, FLAG_KIND, temp);
SetScriptVarValue(NULL, FLAG_KIND_CHANGE_REQUEST, 0);
}
temp2 = GetScriptVarArrayValue(NULL, 66, 0);
temp2 = GetScriptVarArrayValue(NULL, EVENT_GONBE, 0);
if (temp2 <= 0)
temp2 = 1;
temp2--;
SetScriptVarArrayValue(NULL, 66, 0, temp2);
SetScriptVarArrayValue(NULL, EVENT_GONBE, 0, temp2);
sub_8098CC8();
}
@ -117,15 +117,15 @@ void sub_8098C58(void)
void sub_8098CC8(void)
{
u32 temp;
if(ScriptVarScenarioBefore(0x3, 0xB, 0))
if(ScriptVarScenarioBefore(SCENARIO_MAIN, 0xB, 0))
{
temp = 0;
}
else if(ScriptVarScenarioBefore(0x3, 0xF, 0))
else if(ScriptVarScenarioBefore(SCENARIO_MAIN, 0xF, 0))
{
temp = 1;
}
else if(ScriptVarScenarioBefore(0x3, 0x12, 0))
else if(ScriptVarScenarioBefore(SCENARIO_MAIN, 0x12, 0))
{
temp = 2;
}
@ -275,12 +275,12 @@ bool8 GetScriptMode(void)
s16 sub_8098FA0(void)
{
return GetScriptVarValue(NULL, 0x11);
return GetScriptVarValue(NULL, GROUND_PLACE);
}
const char *sub_8098FB4(void)
{
return sub_80A2B18(GetScriptVarValue(NULL, 0x11));
return sub_80A2B18(GetScriptVarValue(NULL, GROUND_PLACE));
}
s16 sub_8098FCC(u32 unused)
@ -290,12 +290,12 @@ s16 sub_8098FCC(u32 unused)
s32 iVar6;
const DungeonInfo *iVar3;
iVar5 = (s16)GetScriptVarValue(NULL,0x13);
iVar5 = (s16)GetScriptVarValue(NULL,DUNGEON_ENTER);
iVar6 = iVar5;
if (iVar5 == -1) return 0xC;
if (iVar5 == 0x51)
iVar4 = (s16)GetScriptVarValue(NULL,0x14);
iVar4 = (s16)GetScriptVarValue(NULL,DUNGEON_ENTER_INDEX);
else
iVar4 = iVar6;
@ -305,7 +305,7 @@ s16 sub_8098FCC(u32 unused)
}
switch((s16)(iVar3->unk4 - 0xb2)) {
case 0:
if (ScriptVarScenarioAfter(3,2,-1) != 0) return 0xc;
if (ScriptVarScenarioAfter(SCENARIO_MAIN,2,-1) != 0) return 0xc;
break;
case 0xf:
case 0x11:

View File

@ -37,8 +37,8 @@ void FreeGroundMapAction(void)
void GroundMap_Reset(void)
{
ClearScriptVarArray(NULL, 0x37);
ClearScriptVarArray(NULL, 0x38);
ClearScriptVarArray(NULL, MAP_LOCAL);
ClearScriptVarArray(NULL, MAP_LOCAL_DOOR);
ActionResetScriptData((Action *)gGroundMapAction, gUnknown_8117538);
if (gGroundMapDungeon_3001B70 != NULL) {

View File

@ -52,7 +52,7 @@ void sub_80A5EBC(void)
void sub_80A5EDC(u8 param_1)
{
SetScriptVarValue(NULL, 27, -1);
SetScriptVarValue(NULL, WEATHER_KIND, -1);
gUnknown_3001B74->unk0 = -1;
gUnknown_3001B74->unk2 = param_1;
@ -84,7 +84,7 @@ void GroundWeather_Select(s16 param_1)
iVar2 = param_1;
iVar3 = iVar2;
Log(0, gGroundWeatherSelect, iVar2, gUnknown_3001B74->unk2);
SetScriptVarValue(NULL, 27, iVar2);
SetScriptVarValue(NULL, WEATHER_KIND, iVar2);
gUnknown_3001B74->unk0 = iVar2;
if (gUnknown_3001B74->unk2 == 0)

View File

@ -215,7 +215,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0x02: {
s32 arg = (s16)curCmd.arg1;
if (arg == -1) arg = (s16)GetScriptVarValue(NULL, 19);
if (arg == -1) arg = (s16)GetScriptVarValue(NULL, DUNGEON_ENTER);
if (ScriptLoggingEnabled(TRUE)) {
// " dungeon select %3d"
Log(1, gUnknown_81165F4, arg);
@ -247,7 +247,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
return 2; // do action
} else {
SetScriptVarValue(NULL, 18, sub_80A26B8((s16)curCmd.arg1));
SetScriptVarValue(NULL, DUNGEON_SELECT, sub_80A26B8((s16)curCmd.arg1));
action->scriptData.branchDiscriminant = 1;
return 2; // do action
}
@ -264,7 +264,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
} else {
SetScriptVarValue(NULL, 19, curCmd.arg1);
SetScriptVarValue(NULL, DUNGEON_ENTER, curCmd.arg1);
action->scriptData.branchDiscriminant = 1;
return 2;
}
@ -276,9 +276,9 @@ s32 ExecuteScriptCommand(Action *action) {
case 0x07: {
s32 tmp = (s16)curCmd.arg1;
if (tmp == -1) {
tmp = (s16)GetScriptVarValue(NULL, 19);
tmp = (s16)GetScriptVarValue(NULL, DUNGEON_ENTER);
} else {
SetScriptVarValue(NULL, 19, tmp);
SetScriptVarValue(NULL, DUNGEON_ENTER, tmp);
}
if (ScriptLoggingEnabled(TRUE)) {
Log(1, gUnknown_811660C, tmp);
@ -310,8 +310,8 @@ s32 ExecuteScriptCommand(Action *action) {
gGroundConversion_811BAF4[gCurrentMap].text);
}
}
SetScriptVarValue(NULL,0x10,gCurrentMap);
SetScriptVarValue(NULL,0x11,gGroundConversion_811BAF4[gCurrentMap].unk2);
SetScriptVarValue(NULL,GROUND_MAP,gCurrentMap);
SetScriptVarValue(NULL,GROUND_PLACE,gGroundConversion_811BAF4[gCurrentMap].unk2);
GroundSprite_Reset(gUnknown_2039A32);
sub_809D0BC();
DeleteGroundEvents();
@ -516,9 +516,9 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0x1f: {
s32 a = (s16)GetScriptVarValue(NULL, 19);
s32 a = (s16)GetScriptVarValue(NULL, DUNGEON_ENTER);
const DungeonInfo *ret1 = GetDungeonInfo_80A2608(a);
s32 thing = GetScriptVarArrayValue(NULL, 48, a) == 0 ? ret1->unk6 : ret1->unk8;
s32 thing = GetScriptVarArrayValue(NULL, DUNGEON_ENTER_LIST, a) == 0 ? ret1->unk6 : ret1->unk8;
// fakematch: this is almost certainly a range check of the form 0x37 <= a && a < 0x48
// but that loses the s32 -> u16 cast. Inlines, macros, or other schenanigans are likely involved
if (!((u16)(a - 0x37) < 0x11) && (s16)sub_80A2750(a) == 1) {
@ -1001,10 +1001,10 @@ s32 ExecuteScriptCommand(Action *action) {
Position32 pos;
s32 height;
s32 dir;
pos.x = GetScriptVarArrayValue(NULL, 0x32, (u16)curCmd.arg1); // POSITION_X
pos.y = GetScriptVarArrayValue(NULL, 0x33, (u16)curCmd.arg1); // POSITION_Y
height = GetScriptVarArrayValue(NULL, 0x34, (u16)curCmd.arg1); // POSITION_HEIGHT
dir = (s8)GetScriptVarArrayValue(NULL, 0x35, (u16)curCmd.arg1); // POSITION_DIRECTION
pos.x = GetScriptVarArrayValue(NULL, POSITION_X, (u16)curCmd.arg1);
pos.y = GetScriptVarArrayValue(NULL, POSITION_Y, (u16)curCmd.arg1);
height = GetScriptVarArrayValue(NULL, POSITION_HEIGHT, (u16)curCmd.arg1);
dir = (s8)GetScriptVarArrayValue(NULL, POSITION_DIRECTION, (u16)curCmd.arg1);
action->callbacks->moveReal(action->parentObject, &pos);
action->callbacks->setPosHeight(action->parentObject, height);
action->scriptData.unk26 = dir;
@ -1024,10 +1024,10 @@ s32 ExecuteScriptCommand(Action *action) {
action->callbacks->getHitboxCenter(action->parentObject, &pos);
action->callbacks->getPosHeightAndUnk(action->parentObject, &height, &wat);
action->callbacks->getDirection(action->parentObject, &dir);
SetScriptVarArrayValue(NULL, 0x32, (u16)curCmd.arg1, pos.x);
SetScriptVarArrayValue(NULL, 0x33, (u16)curCmd.arg1, pos.y);
SetScriptVarArrayValue(NULL, 0x34, (u16)curCmd.arg1, height);
SetScriptVarArrayValue(NULL, 0x35, (u16)curCmd.arg1, dir);
SetScriptVarArrayValue(NULL, POSITION_X, (u16)curCmd.arg1, pos.x);
SetScriptVarArrayValue(NULL, POSITION_Y, (u16)curCmd.arg1, pos.y);
SetScriptVarArrayValue(NULL, POSITION_HEIGHT, (u16)curCmd.arg1, height);
SetScriptVarArrayValue(NULL, POSITION_DIRECTION, (u16)curCmd.arg1, dir);
break;
}
case 0x60: {
@ -1466,12 +1466,12 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0xab: {
SetScriptVarValue(NULL, 19, curCmd.arg1);
SetScriptVarValue(NULL, 22, curCmd.argShort);
SetScriptVarValue(NULL, DUNGEON_ENTER, curCmd.arg1);
SetScriptVarValue(NULL, DUNGEON_RESULT, curCmd.argShort);
break;
}
case 0xac: {
SetScriptVarValue(NULL, 28, curCmd.argShort);
SetScriptVarValue(NULL, PLAYER_KIND, curCmd.argShort);
break;
}
case 0xad: {

View File

@ -308,7 +308,7 @@ void DrawLoadScreenText(void)
switch(sub_8011C1C())
{
case 1:
switch(GetScriptVarValue(NULL,24))
switch(GetScriptVarValue(NULL,START_MODE))
{
default:
sprintfStatic(auStack356,gUnknown_80E7804,sub_8098FB4());
@ -415,4 +415,4 @@ bool8 IsQuickSave(void)
bool8 sub_8039880(void)
{
return (CountMailType(WONDER_MAIL_TYPE_SOS) != 0 || CountMailType(WONDER_MAIL_TYPE_OKD) != 0 || sub_8011C1C() == 2);
}
}