mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Decomp InitScriptVariableValues. Replace enum script_var_id parameters with s16 (required to match InitScriptVariableValues)
This commit is contained in:
parent
cbfd88f580
commit
a9d031bdf0
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
.public _0209CF0C
|
||||
.public EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
.public _0209DF70
|
||||
.public Debug_Print0
|
||||
.public GAME_MODE
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
.public _0209CE9C
|
||||
.public _0209CEA4
|
||||
.public _0209CEBC
|
||||
.public _0209CFA4
|
||||
.public SUM_MSG
|
||||
.public _0209CFA8
|
||||
.public _0209CFB0
|
||||
.public _0209CFBC
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
.public _0209D168
|
||||
.public _0209D178
|
||||
.public _0209D188
|
||||
.public _0209D198
|
||||
.public SUB30_PROJECTP
|
||||
.public _0209D1A8
|
||||
.public _0209D1B8
|
||||
.public _0209D1C8
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
.public _0209D290
|
||||
.public _0209D2A4
|
||||
.public _0209D2B8
|
||||
.public _0209D2CC
|
||||
.public NOTE_MODIFY_FLAG
|
||||
.public _0209D2E0
|
||||
.public _0209D2F4
|
||||
.public _0209D308
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
.public _0209CE94
|
||||
.public _0209CE9C
|
||||
.public _0209CEA4
|
||||
.public _0209CFA4
|
||||
.public SUM_MSG
|
||||
.public _0209CFA8
|
||||
.public _0209CFB0
|
||||
.public _0209CFBC
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
.public _0209D168
|
||||
.public _0209D178
|
||||
.public _0209D188
|
||||
.public _0209D198
|
||||
.public SUB30_PROJECTP
|
||||
.public _0209D1A8
|
||||
.public _0209D1B8
|
||||
.public _0209D1C8
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
.public _0209D290
|
||||
.public _0209D2A4
|
||||
.public _0209D2B8
|
||||
.public _0209D2CC
|
||||
.public NOTE_MODIFY_FLAG
|
||||
.public _0209D2E0
|
||||
.public _0209D2F4
|
||||
.public _0209D308
|
||||
|
|
|
|||
|
|
@ -16,219 +16,12 @@ _0204B024: .word GAME_MODE
|
|||
sub_0204B028: ; 0x0204B028
|
||||
ldr r1, _0204B040 ; =_0209DF70
|
||||
ldr ip, _0204B044 ; =Debug_Print0
|
||||
ldr r0, _0204B048 ; =_0209CF0C
|
||||
ldr r0, _0204B048 ; =EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
ldrsh r1, [r1, #0x24]
|
||||
mov r2, #0x400
|
||||
bx ip
|
||||
.align 2, 0
|
||||
_0204B040: .word _0209DF70
|
||||
_0204B044: .word Debug_Print0
|
||||
_0204B048: .word _0209CF0C
|
||||
_0204B048: .word EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
arm_func_end sub_0204B028
|
||||
|
||||
arm_func_start InitScriptVariableValues
|
||||
InitScriptVariableValues: ; 0x0204B04C
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
|
||||
mov r1, #0
|
||||
ldr r0, _0204B2F8 ; =SCRIPT_VARS_VALUES
|
||||
mov r7, r1
|
||||
_0204B05C:
|
||||
strb r7, [r0, r1]
|
||||
add r1, r1, #1
|
||||
cmp r1, #0x400
|
||||
blt _0204B05C
|
||||
mov r4, #0
|
||||
ldr r6, _0204B2FC ; =SCRIPT_VARS
|
||||
mov r5, r4
|
||||
_0204B078:
|
||||
mov r0, r7, lsl #4
|
||||
ldrsh r0, [r6, r0]
|
||||
add r8, r6, r7, lsl #4
|
||||
cmp r0, #0
|
||||
cmpne r0, #9
|
||||
beq _0204B0C4
|
||||
mov sb, r5
|
||||
b _0204B0B8
|
||||
_0204B098:
|
||||
ldrsh r3, [r8, #0xa]
|
||||
mov r0, r4
|
||||
mov r1, r7
|
||||
mov r2, sb
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
add r0, sb, #1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov sb, r0, lsr #0x10
|
||||
_0204B0B8:
|
||||
ldrsh r0, [r8, #8]
|
||||
cmp sb, r0
|
||||
blt _0204B098
|
||||
_0204B0C4:
|
||||
add r0, r7, #1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r7, r0, asr #0x10
|
||||
cmp r7, #0x72
|
||||
blt _0204B078
|
||||
mov r0, #0
|
||||
mov r2, r0
|
||||
mov r1, #0x46
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #1
|
||||
bl ZeroInitScriptVariable
|
||||
bl InitEventFlagScriptVars
|
||||
mov sl, #0
|
||||
#ifdef JAPAN
|
||||
mov sb, sl
|
||||
mov r8, #0x21
|
||||
mov r7, #0x13c
|
||||
mov r6, sl
|
||||
mov r5, #0x22
|
||||
mov fp, sl
|
||||
mvn r4, #0
|
||||
#else
|
||||
ldr r7, _0204B300 ; =0x00000137
|
||||
mov sb, sl
|
||||
#ifdef EUROPE
|
||||
sub r4, r7, #0x144
|
||||
#else
|
||||
sub r4, r7, #0x138
|
||||
#endif
|
||||
mov r8, #0x21
|
||||
mov r6, sl
|
||||
mov r5, #0x22
|
||||
mov fp, sl
|
||||
#endif
|
||||
_0204B118:
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, sb
|
||||
mov r1, r8
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r7
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, r6
|
||||
mov r1, r5
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r6
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, fp
|
||||
mov r1, #0x23
|
||||
mov r2, r2, lsr #0x10
|
||||
#ifdef JAPAN
|
||||
mov r3, #0x13c
|
||||
#else
|
||||
mov r3, r7
|
||||
#endif
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, #0
|
||||
mov r1, #0x24
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r4
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, #0
|
||||
mov r1, #0x25
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, #0xbb
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r0, #0
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r1, #0x2d
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r0
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, #0
|
||||
mov r1, #0x2f
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r4
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r0, #0
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r1, #0x31
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r0
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r0, #0
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r1, #0x32
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r0
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r0, #0
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r1, #0x37
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r0
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r0, #0
|
||||
mov r1, #0x38
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, #2
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
mov r0, #0
|
||||
mov r2, sl, lsl #0x10
|
||||
mov r1, #0x39
|
||||
mov r2, r2, lsr #0x10
|
||||
mov r3, r0
|
||||
bl SaveScriptVariableValueAtIndex
|
||||
add sl, sl, #1
|
||||
cmp sl, #4
|
||||
blt _0204B118
|
||||
mov r1, #0x26
|
||||
sub r2, r1, #0x27
|
||||
mov r0, #0
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r2, r0
|
||||
mov r1, #0x33
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r2, r0
|
||||
mov r1, #0x6e
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r2, r0
|
||||
mov r1, #0x3e
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r2, r0
|
||||
mov r1, #0x40
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #0x42
|
||||
mov r2, #4
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #0x43
|
||||
mov r2, #1
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #0x4a
|
||||
sub r2, r1, #0x4b
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #0x4b
|
||||
bl ZeroInitScriptVariable
|
||||
mov r0, #0
|
||||
mov r1, #0x4c
|
||||
bl ZeroInitScriptVariable
|
||||
mov r0, #0
|
||||
mov r1, #0x4d
|
||||
bl ZeroInitScriptVariable
|
||||
bl InitScenarioProgressScriptVars
|
||||
bl InitWorldMapScriptVars
|
||||
bl InitDungeonListScriptVars
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
.align 2, 0
|
||||
_0204B2F8: .word SCRIPT_VARS_VALUES
|
||||
_0204B2FC: .word SCRIPT_VARS
|
||||
#if defined(EUROPE)
|
||||
_0204B300: .word 0x00000143
|
||||
#elif !defined(JAPAN)
|
||||
_0204B300: .word 0x00000137
|
||||
#endif
|
||||
arm_func_end InitScriptVariableValues
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ SCRIPT_VARS_LOCALS:
|
|||
.byte 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00
|
||||
.byte 0x01, 0x00, 0x00, 0x00
|
||||
.word _0209CE94
|
||||
.global _0209CF0C
|
||||
_0209CF0C:
|
||||
.global EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
EVENT_FLAG_SIZE_DEBUG_MSG:
|
||||
.byte 0x45, 0x76, 0x65, 0x6E, 0x74, 0x46, 0x6C, 0x61
|
||||
.byte 0x67, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x25, 0x30, 0x34, 0x78, 0x2F, 0x25, 0x30, 0x34, 0x78, 0x0A
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
|
|
@ -39,8 +39,8 @@ EVENT_FLAG_GAME_MODE_DEBUG_MSG:
|
|||
EVENT_FLAG_BACKUP_DEBUG_MSG:
|
||||
.byte 0x45, 0x76, 0x65, 0x6E, 0x74, 0x46, 0x6C, 0x61, 0x67, 0x20, 0x42, 0x61, 0x63, 0x6B, 0x75, 0x70
|
||||
.byte 0x47, 0x61, 0x6D, 0x65, 0x4D, 0x6F, 0x64, 0x65, 0x20, 0x25, 0x64, 0x0A, 0x00, 0x00, 0x00, 0x00
|
||||
.global _0209CFA4
|
||||
_0209CFA4:
|
||||
.global SUM_MSG
|
||||
SUM_MSG:
|
||||
.byte 0x53, 0x55, 0x4D, 0x00
|
||||
.global _0209CFA8
|
||||
_0209CFA8:
|
||||
|
|
@ -175,8 +175,8 @@ _0209D178:
|
|||
_0209D188:
|
||||
.byte 0x48, 0x45, 0x52, 0x4F, 0x5F, 0x54, 0x41, 0x4C, 0x4B, 0x5F, 0x4B, 0x49
|
||||
.byte 0x4E, 0x44, 0x00, 0x00
|
||||
.global _0209D198
|
||||
_0209D198:
|
||||
.global SUB30_PROJECTP
|
||||
SUB30_PROJECTP:
|
||||
.byte 0x53, 0x55, 0x42, 0x33, 0x30, 0x5F, 0x50, 0x52, 0x4F, 0x4A, 0x45, 0x43
|
||||
.byte 0x54, 0x50, 0x00, 0x00
|
||||
.global _0209D1A8
|
||||
|
|
@ -247,8 +247,8 @@ _0209D2A4:
|
|||
_0209D2B8:
|
||||
.byte 0x43, 0x52, 0x59, 0x53, 0x54, 0x41, 0x4C, 0x5F, 0x43, 0x4F, 0x4C, 0x4F
|
||||
.byte 0x52, 0x5F, 0x30, 0x33, 0x00, 0x00, 0x00, 0x00
|
||||
.global _0209D2CC
|
||||
_0209D2CC:
|
||||
.global NOTE_MODIFY_FLAG
|
||||
NOTE_MODIFY_FLAG:
|
||||
.byte 0x4E, 0x4F, 0x54, 0x45, 0x5F, 0x4D, 0x4F, 0x44
|
||||
.byte 0x49, 0x46, 0x59, 0x5F, 0x46, 0x4C, 0x41, 0x47, 0x00, 0x00, 0x00, 0x00
|
||||
.global _0209D2E0
|
||||
|
|
@ -853,13 +853,13 @@ SCRIPT_VARS:
|
|||
_0209DF70:
|
||||
.byte 0x09, 0x00, 0x02, 0x00
|
||||
.byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
|
||||
.word _0209D2CC
|
||||
.word NOTE_MODIFY_FLAG
|
||||
.byte 0x01, 0x00, 0x06, 0x00
|
||||
.byte 0xB3, 0x02, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00
|
||||
.word _0209D198
|
||||
.word SUB30_PROJECTP
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.byte 0xB4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
.word _0209CFA4
|
||||
.word SUM_MSG
|
||||
.global SCENARIO_CALC_DEBUG_MSG
|
||||
SCENARIO_CALC_DEBUG_MSG:
|
||||
.byte 0x53, 0x43, 0x45, 0x4E
|
||||
|
|
|
|||
|
|
@ -29,32 +29,35 @@ struct script_var_raw {
|
|||
union script_var_value *value;
|
||||
};
|
||||
|
||||
// See enum script_var_id for the sv_id parameters.
|
||||
|
||||
void InitScriptVariableValues();
|
||||
void InitEventFlagScriptVars();
|
||||
void DefaultInitScriptVariable(union script_var_value sv_locals[], enum script_var_id sv_id);
|
||||
void ZeroInitScriptVariable(union script_var_value sv_locals[], enum script_var_id sv_id);
|
||||
void LoadScriptVariableRaw(struct script_var_raw* sv_raw, union script_var_value sv_val_local[], const enum script_var_id sv_id);
|
||||
s32 LoadScriptVariableValue(union script_var_value sv_local[], enum script_var_id sv_id);
|
||||
s32 LoadScriptVariableValueAtIndex(union script_var_value sv_local[], enum script_var_id id, u16 idx);
|
||||
void SaveScriptVariableValue(union script_var_value sv_locals[], const enum script_var_id script_var_id, u32 new_val);
|
||||
void SaveScriptVariableValueAtIndex(union script_var_value sv_locals[], const enum script_var_id script_var_id, u16 idx, s32 new_val);
|
||||
s32 LoadScriptVariableValueSum(union script_var_value sv_local[], const enum script_var_id sv_id);
|
||||
void LoadScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s32 num_bytes);
|
||||
void LoadScriptVariableValueString(const enum script_var_id sv_id, u8* result, u8 num_bytes);
|
||||
void SaveScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s32 num_bytes);
|
||||
bool8 ScriptVariablesEqual(union script_var_value sv_val_ptr_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2);
|
||||
void DefaultInitScriptVariable(union script_var_value sv_locals[], s16 sv_id);
|
||||
void ZeroInitScriptVariable(union script_var_value sv_locals[], s16 sv_id);
|
||||
void LoadScriptVariableRaw(struct script_var_raw* sv_raw, union script_var_value sv_val_local[], const s16 sv_id);
|
||||
s32 LoadScriptVariableValue(union script_var_value sv_local[], s16 sv_id);
|
||||
s32 LoadScriptVariableValueAtIndex(union script_var_value sv_local[], s16 id, u16 idx);
|
||||
void SaveScriptVariableValue(union script_var_value sv_locals[], const s16 sv_id, u32 new_val);
|
||||
void SaveScriptVariableValueAtIndex(union script_var_value sv_locals[], s16 script_var_id, u16 idx, s32 new_val);
|
||||
s32 LoadScriptVariableValueSum(union script_var_value sv_local[], const s16 sv_id);
|
||||
void LoadScriptVariableValueBytes(const s16 sv_id, u8* result, s32 num_bytes);
|
||||
void LoadScriptVariableValueString(const s16 sv_id, u8* result, u8 num_bytes);
|
||||
void SaveScriptVariableValueBytes(const s16 sv_id, u8* result, s32 num_bytes);
|
||||
bool8 ScriptVariablesEqual(union script_var_value sv_val_ptr_local[], s16 sv_id_1, s16 sv_id_2);
|
||||
s32 CalcScriptVariables(s32 param_1, s32 param_2, enum script_calc_operation operation);
|
||||
bool8 CompareScriptVariables(s32 param_1, s32 param_2, enum compare_operation operation);
|
||||
s32 CalcScriptVariablesVeneer(s32 param_1, s32 param_2, enum script_calc_operation operation);
|
||||
void CalcAndUpdateScriptVarWithOtherValue(union script_var_value sv_local[], const enum script_var_id script_var_id, s32 param, enum script_calc_operation operation);
|
||||
void CalcAndUpdateScriptVarWithOtherScriptVar(union script_var_value sv_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2, enum script_calc_operation operation);
|
||||
void CalcAndUpdateScriptVarWithOtherValue(union script_var_value sv_local[], const s16 sv_id, s32 param, enum script_calc_operation operation);
|
||||
void CalcAndUpdateScriptVarWithOtherScriptVar(union script_var_value sv_local[], s16 sv_id_1, s16 sv_id_2, enum script_calc_operation operation);
|
||||
bool8 CompareScriptVariablesVeneer(s32 param_1, s32 param_2, enum compare_operation operation);
|
||||
bool8 LoadAndCompareScriptVarAndValue(union script_var_value sv_local[], enum script_var_id sv_id, s32 param, enum compare_operation op);
|
||||
bool8 LoadAndCompareScriptVars(union script_var_value sv_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2, enum compare_operation op);
|
||||
bool8 LoadAndCompareScriptVarAndValue(union script_var_value sv_local[], s16 sv_id, s32 param, enum compare_operation op);
|
||||
bool8 LoadAndCompareScriptVars(union script_var_value sv_local[], s16 sv_id_1, s16 sv_id_2, enum compare_operation op);
|
||||
void EventFlagResume();
|
||||
void EventFlagBackup();
|
||||
bool8 DumpScriptVariableValues(u8* dest);
|
||||
bool8 RestoreScriptVariableValues(u8* src);
|
||||
void InitScenarioProgressScriptVars();
|
||||
void LoadScriptVarValuePair(enum script_var_id script_var_id, s32* val_1, s32* val_2);
|
||||
void LoadScriptVarValuePair(s16 script_var_id, s32* val_1, s32* val_2);
|
||||
|
||||
#endif //PMDSKY_SCRIPT_VARIABLE_H
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef PMDSKY_STORY_PROGRESS_H
|
||||
#define PMDSKY_STORY_PROGRESS_H
|
||||
|
||||
void SetScenarioProgressScriptVar(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryBeforePoint(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryBeforeOrAtPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAtPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAtOrAfterPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAfterPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection);
|
||||
void SetScenarioProgressScriptVar(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryBeforePoint(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryBeforeOrAtPoint(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAtPoint(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAtOrAfterPoint(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
bool8 IsStoryAfterPoint(s16 script_var_id, s32 chapter, s32 subsection);
|
||||
|
||||
#endif //PMDSKY_STORY_PROGRESS_H
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "main_0200ECFC.h"
|
||||
#include "scenario_flag.h"
|
||||
#include "script_variable.h"
|
||||
#include "script_variable_2.h"
|
||||
#include "special_episode.h"
|
||||
#include "story_progress.h"
|
||||
|
||||
|
|
@ -47,6 +48,57 @@ extern s32 AddMoneyCarried(s32 arg0);
|
|||
extern s32 SetMoneyCarried(s32 arg0);
|
||||
extern s32 SetMoneyStored(s32 arg0);
|
||||
extern s32 SetNotifyNote(s32 arg0);
|
||||
extern void InitDungeonListScriptVars();
|
||||
|
||||
void InitScriptVariableValues() {
|
||||
for(s32 sv_id = 0; sv_id < LOCAL_SCRIPT_VAR_OFFSET; sv_id++) {
|
||||
SCRIPT_VARS_VALUES[sv_id] = 0;
|
||||
}
|
||||
|
||||
for (s16 sv_id = 0; sv_id < 114; sv_id++) {
|
||||
struct script_var_def* def = &SCRIPT_VARS[sv_id];
|
||||
s16 type = def->type;
|
||||
if (type != 0 && type != 9) {
|
||||
for (u16 idx = 0; idx < def->n_values; idx++) {
|
||||
SaveScriptVariableValueAtIndex(0, sv_id, idx, def->default_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveScriptVariableValue(0, VAR_ROM_VARIATION, 0);
|
||||
ZeroInitScriptVariable(0, 1);
|
||||
InitEventFlagScriptVars();
|
||||
|
||||
for(s32 idx2 = 0; idx2 < 4; idx2++) {
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_ENTER_BACKUP, idx2, VAR_GROUND_ENTER_VALUE);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_ENTER_LINK_BACKUP, idx2, 0);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_GETOUT_BACKUP, idx2, VAR_GROUND_ENTER_VALUE);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_MAP_BACKUP, idx2, -1);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_PLACE_BACKUP, idx2, 0xBB);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_DUNGEON_ENTER_BACKUP, idx2, 0);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_DUNGEON_ENTER_INDEX_BACKUP, idx2, -1);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_DUNGEON_RESULT_BACKUP, idx2, 0);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_GROUND_START_MODE_BACKUP, idx2, 0);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_PLAYER_KIND_BACKUP, idx2, 0);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_ATTENDANT1_KIND_BACKUP, idx2, 2);
|
||||
SaveScriptVariableValueAtIndex(0, VAR_ATTENDANT2_KIND_BACKUP, idx2, 0);
|
||||
}
|
||||
|
||||
SaveScriptVariableValue(0, VAR_DUNGEON_SELECT, -1);
|
||||
SaveScriptVariableValue(0, VAR_REQUEST_CLEAR_COUNT, 0);
|
||||
SaveScriptVariableValue(0, VAR_TEAM_RANK_EVENT_LEVEL, 0);
|
||||
SaveScriptVariableValue(0, VAR_HERO_FIRST_KIND, 0);
|
||||
SaveScriptVariableValue(0, VAR_PARTNER_FIRST_KIND, 0);
|
||||
SaveScriptVariableValue(0, VAR_HERO_TALK_KIND, 4);
|
||||
SaveScriptVariableValue(0, VAR_PARTNER_TALK_KIND, 1);
|
||||
SaveScriptVariableValue(0, VAR_SPECIAL_EPISODE_TYPE, -1);
|
||||
ZeroInitScriptVariable(0, VAR_SPECIAL_EPISODE_OPEN);
|
||||
ZeroInitScriptVariable(0, VAR_SPECIAL_EPISODE_OPEN_OLD);
|
||||
ZeroInitScriptVariable(0, VAR_SPECIAL_EPISODE_CONQUEST);
|
||||
InitScenarioProgressScriptVars();
|
||||
InitWorldMapScriptVars();
|
||||
InitDungeonListScriptVars();
|
||||
}
|
||||
|
||||
void InitEventFlagScriptVars() {
|
||||
SaveScriptVariableValue(0, VAR_GROUND_ENTER, VAR_GROUND_ENTER_VALUE);
|
||||
|
|
@ -63,7 +115,7 @@ void InitEventFlagScriptVars() {
|
|||
SaveScriptVariableValue(0, VAR_ATTENDANT2_KIND, 0);
|
||||
}
|
||||
|
||||
void DefaultInitScriptVariable(union script_var_value sv_locals[], enum script_var_id sv_id) {
|
||||
void DefaultInitScriptVariable(union script_var_value sv_locals[], s16 sv_id) {
|
||||
struct script_var_def* def;
|
||||
|
||||
if (sv_id < LOCAL_SCRIPT_VAR_OFFSET) {
|
||||
|
|
@ -77,7 +129,7 @@ void DefaultInitScriptVariable(union script_var_value sv_locals[], enum script_v
|
|||
}
|
||||
}
|
||||
|
||||
void ZeroInitScriptVariable(union script_var_value sv_locals[], enum script_var_id sv_id) {
|
||||
void ZeroInitScriptVariable(union script_var_value sv_locals[], s16 sv_id) {
|
||||
struct script_var_def* def;
|
||||
|
||||
if (sv_id < LOCAL_SCRIPT_VAR_OFFSET) {
|
||||
|
|
@ -93,7 +145,7 @@ void ZeroInitScriptVariable(union script_var_value sv_locals[], enum script_var_
|
|||
|
||||
void LoadScriptVariableRaw(struct script_var_raw* sv_raw,
|
||||
union script_var_value sv_val_local[],
|
||||
const enum script_var_id sv_id) {
|
||||
const s16 sv_id) {
|
||||
|
||||
if (sv_id < (s16) LOCAL_SCRIPT_VAR_OFFSET) {
|
||||
// global script var
|
||||
|
|
@ -107,7 +159,7 @@ void LoadScriptVariableRaw(struct script_var_raw* sv_raw,
|
|||
}
|
||||
}
|
||||
|
||||
s32 LoadScriptVariableValue(union script_var_value sv_local[], enum script_var_id sv_id)
|
||||
s32 LoadScriptVariableValue(union script_var_value sv_local[], s16 sv_id)
|
||||
{
|
||||
struct script_var_raw result;
|
||||
LoadScriptVariableRaw(&result, sv_local, sv_id);
|
||||
|
|
@ -164,7 +216,7 @@ s32 LoadScriptVariableValue(union script_var_value sv_local[], enum script_var_i
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 LoadScriptVariableValueAtIndex(union script_var_value sv_local[], enum script_var_id id, u16 idx)
|
||||
s32 LoadScriptVariableValueAtIndex(union script_var_value sv_local[], s16 id, u16 idx)
|
||||
{
|
||||
struct script_var_raw result;
|
||||
LoadScriptVariableRaw(&result, sv_local, id);
|
||||
|
|
@ -220,7 +272,7 @@ s32 LoadScriptVariableValueAtIndex(union script_var_value sv_local[], enum scrip
|
|||
return 0;
|
||||
}
|
||||
|
||||
void SaveScriptVariableValue(union script_var_value sv_locals[], const enum script_var_id script_var_id, u32 new_val)
|
||||
void SaveScriptVariableValue(union script_var_value sv_locals[], const s16 script_var_id, u32 new_val)
|
||||
{
|
||||
struct script_var_raw script_var_raw;
|
||||
LoadScriptVariableRaw(&script_var_raw, sv_locals, script_var_id);
|
||||
|
|
@ -291,7 +343,7 @@ void SaveScriptVariableValue(union script_var_value sv_locals[], const enum scri
|
|||
return;
|
||||
}
|
||||
|
||||
void SaveScriptVariableValueAtIndex(union script_var_value sv_locals[], const enum script_var_id script_var_id, u16 idx, s32 new_val)
|
||||
void SaveScriptVariableValueAtIndex(union script_var_value sv_locals[], s16 script_var_id, u16 idx, s32 new_val)
|
||||
{
|
||||
struct script_var_raw script_var_raw;
|
||||
LoadScriptVariableRaw(&script_var_raw, sv_locals, script_var_id);
|
||||
|
|
@ -355,7 +407,7 @@ void SaveScriptVariableValueAtIndex(union script_var_value sv_locals[], const en
|
|||
return;
|
||||
}
|
||||
|
||||
s32 LoadScriptVariableValueSum(union script_var_value sv_local[], const enum script_var_id sv_id)
|
||||
s32 LoadScriptVariableValueSum(union script_var_value sv_local[], const s16 sv_id)
|
||||
{
|
||||
struct script_var_raw script_var_raw;
|
||||
s32 total = 0;
|
||||
|
|
@ -369,7 +421,7 @@ s32 LoadScriptVariableValueSum(union script_var_value sv_local[], const enum scr
|
|||
return total;
|
||||
}
|
||||
|
||||
void LoadScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s32 num_bytes)
|
||||
void LoadScriptVariableValueBytes(const s16 sv_id, u8* result, s32 num_bytes)
|
||||
{
|
||||
struct script_var_raw sv_raw;
|
||||
LoadScriptVariableRaw(&sv_raw, 0, sv_id);
|
||||
|
|
@ -385,13 +437,13 @@ void LoadScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s3
|
|||
}
|
||||
}
|
||||
|
||||
void LoadScriptVariableValueString(const enum script_var_id sv_id, u8* result, u8 num_bytes)
|
||||
void LoadScriptVariableValueString(const s16 sv_id, u8* result, u8 num_bytes)
|
||||
{
|
||||
LoadScriptVariableValueBytes(sv_id, result, num_bytes);
|
||||
result[num_bytes] = 0;
|
||||
}
|
||||
|
||||
void SaveScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s32 num_bytes)
|
||||
void SaveScriptVariableValueBytes(const s16 sv_id, u8* result, s32 num_bytes)
|
||||
{
|
||||
struct script_var_raw sv_raw;
|
||||
LoadScriptVariableRaw(&sv_raw, 0, sv_id);
|
||||
|
|
@ -407,7 +459,7 @@ void SaveScriptVariableValueBytes(const enum script_var_id sv_id, u8* result, s3
|
|||
}
|
||||
}
|
||||
|
||||
bool8 ScriptVariablesEqual(union script_var_value sv_val_ptr_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2)
|
||||
bool8 ScriptVariablesEqual(union script_var_value sv_val_ptr_local[], s16 sv_id_1, s16 sv_id_2)
|
||||
{
|
||||
struct script_var_raw script_var_raw_1, script_var_raw_2;
|
||||
|
||||
|
|
@ -499,14 +551,14 @@ s32 CalcScriptVariablesVeneer(s32 param_1, s32 param_2, enum script_calc_operati
|
|||
return CalcScriptVariables(param_1, param_2, operation);
|
||||
}
|
||||
|
||||
void CalcAndUpdateScriptVarWithOtherValue(union script_var_value sv_local[], const enum script_var_id script_var_id, s32 param, enum script_calc_operation operation)
|
||||
void CalcAndUpdateScriptVarWithOtherValue(union script_var_value sv_local[], const s16 script_var_id, s32 param, enum script_calc_operation operation)
|
||||
{
|
||||
s32 value = LoadScriptVariableValue(sv_local, script_var_id);
|
||||
s32 result = CalcScriptVariables(value, param, operation);
|
||||
SaveScriptVariableValue(sv_local, script_var_id, result);
|
||||
}
|
||||
|
||||
void CalcAndUpdateScriptVarWithOtherScriptVar(union script_var_value sv_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2, enum script_calc_operation op)
|
||||
void CalcAndUpdateScriptVarWithOtherScriptVar(union script_var_value sv_local[], s16 sv_id_1, s16 sv_id_2, enum script_calc_operation op)
|
||||
{
|
||||
s32 value_1 = LoadScriptVariableValue(sv_local, sv_id_1);
|
||||
s32 value_2 = LoadScriptVariableValue(sv_local, sv_id_2);
|
||||
|
|
@ -519,13 +571,13 @@ bool8 CompareScriptVariablesVeneer(s32 param_1, s32 param_2, enum compare_operat
|
|||
return CompareScriptVariables(param_1, param_2, op);
|
||||
}
|
||||
|
||||
bool8 LoadAndCompareScriptVarAndValue(union script_var_value sv_local[], enum script_var_id sv_id, s32 param, enum compare_operation op)
|
||||
bool8 LoadAndCompareScriptVarAndValue(union script_var_value sv_local[], s16 sv_id, s32 param, enum compare_operation op)
|
||||
{
|
||||
s32 value = LoadScriptVariableValue(sv_local, sv_id);
|
||||
return CompareScriptVariables(value, param, op);
|
||||
}
|
||||
|
||||
bool8 LoadAndCompareScriptVars(union script_var_value sv_local[], enum script_var_id sv_id_1, enum script_var_id sv_id_2, enum compare_operation op)
|
||||
bool8 LoadAndCompareScriptVars(union script_var_value sv_local[], s16 sv_id_1, s16 sv_id_2, enum compare_operation op)
|
||||
{
|
||||
s32 value_1 = LoadScriptVariableValue(sv_local, sv_id_1);
|
||||
s32 value_2 = LoadScriptVariableValue(sv_local, sv_id_2);
|
||||
|
|
@ -533,7 +585,7 @@ bool8 LoadAndCompareScriptVars(union script_var_value sv_local[], enum script_va
|
|||
}
|
||||
|
||||
// This inline allows EventFlagResume to match
|
||||
static inline s32 LoadScriptVariableValueAtIndexInline(enum script_var_id sv_id, u32 idx)
|
||||
static inline s32 LoadScriptVariableValueAtIndexInline(s16 sv_id, u32 idx)
|
||||
{
|
||||
return LoadScriptVariableValueAtIndex(0, sv_id, idx);
|
||||
}
|
||||
|
|
@ -566,7 +618,7 @@ void EventFlagResume()
|
|||
}
|
||||
|
||||
// This inline allows EventFlagBackup to match
|
||||
static inline s32 SaveScriptVariableValueAtIndexInline(enum script_var_id sv_id, u32 idx, u32 new_val)
|
||||
static inline s32 SaveScriptVariableValueAtIndexInline(s16 sv_id, u32 idx, u32 new_val)
|
||||
{
|
||||
SaveScriptVariableValueAtIndex(0, sv_id, idx, new_val);
|
||||
}
|
||||
|
|
@ -657,7 +709,7 @@ void InitScenarioProgressScriptVars()
|
|||
SaveScriptVariableValue(0, VAR_PLAY_OLD_GAME, 0);
|
||||
}
|
||||
|
||||
void LoadScriptVarValuePair(enum script_var_id script_var_id, s32* val_1, s32* val_2)
|
||||
void LoadScriptVarValuePair(s16 script_var_id, s32* val_1, s32* val_2)
|
||||
{
|
||||
*val_1 = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
*val_2 = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
extern const u8 SCENARIO_CALC_DEBUG_MSG;
|
||||
|
||||
void SetScenarioProgressScriptVar(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
void SetScenarioProgressScriptVar(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 old_progress = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
s32 old_sub_prog = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
@ -25,7 +25,7 @@ void SetScenarioProgressScriptVar(enum script_var_id script_var_id, s32 chapter,
|
|||
SaveScriptVariableValueAtIndex(0, script_var_id, 1, subsection);
|
||||
}
|
||||
|
||||
bool8 IsStoryBeforePoint(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
bool8 IsStoryBeforePoint(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 cur_chapter = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
s32 cur_subsec = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
@ -42,7 +42,7 @@ bool8 IsStoryBeforePoint(enum script_var_id script_var_id, s32 chapter, s32 subs
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsStoryBeforeOrAtPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
bool8 IsStoryBeforeOrAtPoint(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 cur_chapter = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
s32 cur_subsec = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
@ -67,7 +67,7 @@ bool8 IsStoryBeforeOrAtPoint(enum script_var_id script_var_id, s32 chapter, s32
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsStoryAtPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
bool8 IsStoryAtPoint(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 cur_chapter = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
s32 cur_subsec = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
@ -84,7 +84,7 @@ bool8 IsStoryAtPoint(enum script_var_id script_var_id, s32 chapter, s32 subsecti
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsStoryAtOrAfterPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
bool8 IsStoryAtOrAfterPoint(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 cur_subsec;
|
||||
s32 cur_chapter;
|
||||
|
|
@ -111,7 +111,7 @@ bool8 IsStoryAtOrAfterPoint(enum script_var_id script_var_id, s32 chapter, s32 s
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsStoryAfterPoint(enum script_var_id script_var_id, s32 chapter, s32 subsection)
|
||||
bool8 IsStoryAfterPoint(s16 script_var_id, s32 chapter, s32 subsection)
|
||||
{
|
||||
s32 cur_chapter = LoadScriptVariableValueAtIndex(0, script_var_id, 0);
|
||||
s32 cur_subsec = LoadScriptVariableValueAtIndex(0, script_var_id, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user