mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-11 04:47:50 -05:00
Merge pull request #194 from slaw-22/LoadScriptVariableRaw
Some checks failed
build / build (push) Has been cancelled
Some checks failed
build / build (push) Has been cancelled
Decomp LoadScriptVariableRaw
This commit is contained in:
@@ -1,34 +1,13 @@
|
||||
#pragma once
|
||||
.public AddMoneyCarried
|
||||
.public DEBUG_SPECIAL_EPISODE_NUMBER
|
||||
.public Debug_FatalError
|
||||
.public Debug_Print
|
||||
.public Debug_Print0
|
||||
.public GAME_MODE
|
||||
.public GetGameMode
|
||||
.public GetLanguageType
|
||||
.public GetMoneyCarried
|
||||
.public GetMoneyStored
|
||||
.public GetNotifyNote
|
||||
.public GetPartyMembers
|
||||
.public InitDungeonListScriptVars
|
||||
.public InitScenarioScriptVars
|
||||
.public InitWorldMapScriptVars
|
||||
.public MemcpySimple
|
||||
.public RandInt
|
||||
.public SCRIPT_VARS
|
||||
.public SCRIPT_VARS_LOCALS
|
||||
.public SCRIPT_VARS_VALUES
|
||||
.public ScenarioFlagBackup
|
||||
.public SetMoneyCarried
|
||||
.public SetMoneyStored
|
||||
.public SetNotifyNote
|
||||
.public _0209CEAC
|
||||
.public SaveScriptVariableValue
|
||||
.public SaveScriptVariableValueAtIndex
|
||||
.public _0209CF0C
|
||||
.public _0209CF28
|
||||
.public _0209CF48
|
||||
.public _0209CF64
|
||||
.public _0209CF84
|
||||
.public _0209DF70
|
||||
.public _0209DFA0
|
||||
.public _s32_div_f
|
||||
.public sub_0204CBE8
|
||||
|
||||
29
asm/include/main_0204B4EC.inc
Normal file
29
asm/include/main_0204B4EC.inc
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
.public AddMoneyCarried
|
||||
.public DEBUG_SPECIAL_EPISODE_NUMBER
|
||||
.public Debug_FatalError
|
||||
.public Debug_Print
|
||||
.public Debug_Print0
|
||||
.public GetGameMode
|
||||
.public GetLanguageType
|
||||
.public GetMoneyCarried
|
||||
.public GetMoneyStored
|
||||
.public GetNotifyNote
|
||||
.public GetPartyMembers
|
||||
.public LoadScriptVariableRaw
|
||||
.public MemcpySimple
|
||||
.public RandInt
|
||||
.public SCRIPT_VARS_VALUES
|
||||
.public ScenarioFlagBackup
|
||||
.public SetMoneyCarried
|
||||
.public SetMoneyStored
|
||||
.public SetNotifyNote
|
||||
.public ZinitScriptVariable
|
||||
.public _0209CEAC
|
||||
.public _0209CF28
|
||||
.public _0209CF48
|
||||
.public _0209CF64
|
||||
.public _0209CF84
|
||||
.public _0209DFA0
|
||||
.public _s32_div_f
|
||||
.public sub_0204CBE8
|
||||
1710
asm/main_0204B018.s
1710
asm/main_0204B018.s
File diff suppressed because it is too large
Load Diff
1687
asm/main_0204B4EC.s
Normal file
1687
asm/main_0204B4EC.s
Normal file
File diff suppressed because it is too large
Load Diff
40
include/scripting.h
Normal file
40
include/scripting.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef PMDSKY_SCRIPTING_H
|
||||
#define PMDSKY_SCRIPTING_H
|
||||
|
||||
#include "enums.h"
|
||||
#include "util.h"
|
||||
|
||||
struct script_var_definition {
|
||||
s16 p1;
|
||||
s16 p2;
|
||||
s16 value_offset; // offset within SCRIPT_VAR_VALUES, or local script var values.
|
||||
s16 p4;
|
||||
s16 p5;
|
||||
s16 p6;
|
||||
s16 p7;
|
||||
s16 p8;
|
||||
};
|
||||
|
||||
struct script_var_local_value {
|
||||
u32 p1;
|
||||
};
|
||||
|
||||
struct script_var_global_value {
|
||||
u8 p1;
|
||||
};
|
||||
|
||||
struct script_var_raw {
|
||||
struct script_var_definition* def;
|
||||
union {
|
||||
struct script_var_local_value* local;
|
||||
struct script_var_global_value* global;
|
||||
} value;
|
||||
};
|
||||
|
||||
const short LOCAL_SCRIPT_VAR_OFFSET = 0x400;
|
||||
|
||||
void LoadScriptVariableRaw(struct script_var_raw* sv_raw,
|
||||
struct script_var_local_value sv_locals[],
|
||||
const enum script_variables sv_id);
|
||||
|
||||
#endif //PMDSKY_SCRIPTING_H
|
||||
2
main.lsf
2
main.lsf
@@ -77,6 +77,8 @@ Static main
|
||||
Object asm/main_0203C774.o
|
||||
Object src/main_0204AFF8.o
|
||||
Object asm/main_0204B018.o
|
||||
Object src/scripting.o
|
||||
Object asm/main_0204B4EC.o
|
||||
Object src/dungeon_recruitment_3.o
|
||||
Object asm/main_0204CA94.o
|
||||
Object src/main_0204DA2C.o
|
||||
|
||||
22
src/scripting.c
Normal file
22
src/scripting.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "enums.h"
|
||||
#include "scripting.h"
|
||||
|
||||
|
||||
extern struct script_var_definition SCRIPT_VARS[];
|
||||
extern struct script_var_definition SCRIPT_VARS_LOCALS[];
|
||||
extern struct script_var_global_value SCRIPT_VARS_VALUES[];
|
||||
|
||||
void LoadScriptVariableRaw(struct script_var_raw* sv_raw,
|
||||
struct script_var_local_value sv_locals[],
|
||||
const enum script_variables sv_id)
|
||||
{
|
||||
if (sv_id < LOCAL_SCRIPT_VAR_OFFSET) {
|
||||
// script var is global
|
||||
sv_raw->def = &SCRIPT_VARS[sv_id];
|
||||
sv_raw->value.global = &SCRIPT_VARS_VALUES[sv_raw->def->value_offset];
|
||||
} else {
|
||||
// script var is local
|
||||
sv_raw->def = &SCRIPT_VARS_LOCALS[sv_id - LOCAL_SCRIPT_VAR_OFFSET];
|
||||
sv_raw->value.local = &sv_locals[sv_raw->def->value_offset];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user