mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Merge pull request #227 from slaw-22/Scripting9
Some checks are pending
build / build (push) Waiting to run
Some checks are pending
build / build (push) Waiting to run
Decomp game mode funcs
This commit is contained in:
commit
db83096aaa
|
|
@ -462,7 +462,7 @@
|
|||
.public sub_0203909C
|
||||
.public sub_02039218
|
||||
.public sub_0203931C
|
||||
.public sub_0204B028
|
||||
.public DebugPrintEventFlagSize
|
||||
.public SetSpecialEpisodeOpenOld
|
||||
.public sub_0204CDB8
|
||||
.public sub_0204E154
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
.public EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
.public _0209DF70
|
||||
.public Debug_Print0
|
||||
.public GAME_MODE
|
||||
.public InitDungeonListScriptVars
|
||||
.public InitScenarioProgressScriptVars
|
||||
.public InitWorldMapScriptVars
|
||||
.public SaveScriptVariableValue
|
||||
.public SaveScriptVariableValueAtIndex
|
||||
.public SCRIPT_VARS
|
||||
.public SCRIPT_VARS_LOCALS
|
||||
.public SCRIPT_VARS_VALUES
|
||||
.public ZeroInitScriptVariable
|
||||
.public DefaultInitScriptVariable
|
||||
.public InitEventFlagScriptVars
|
||||
|
|
@ -482,7 +482,7 @@
|
|||
.public sub_0204A1A4
|
||||
.public sub_0204AB18
|
||||
.public sub_0204AF98
|
||||
.public sub_0204B018
|
||||
.public SetGameMode
|
||||
.public sub_0204D018
|
||||
.public sub_0204E210
|
||||
.public sub_0204E6FC
|
||||
|
|
|
|||
|
|
@ -14526,7 +14526,7 @@ _0204841C: .word _020AFEF4
|
|||
arm_func_start sub_02048420
|
||||
sub_02048420: ; 0x02048420
|
||||
stmdb sp!, {r3, lr}
|
||||
bl sub_0204B028
|
||||
bl DebugPrintEventFlagSize
|
||||
bl sub_02048B74
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end sub_02048420
|
||||
|
|
@ -18067,18 +18067,3 @@ GetGameMode: ; 0x0204AFC0
|
|||
.align 2, 0
|
||||
_0204AFCC: .word GAME_MODE
|
||||
arm_func_end GetGameMode
|
||||
|
||||
arm_func_start sub_0204AFD0
|
||||
sub_0204AFD0: ; 0x0204AFD0
|
||||
ldr r0, _0204AFF4 ; =GAME_MODE
|
||||
ldrb r0, [r0]
|
||||
add r0, r0, #0xfe
|
||||
and r0, r0, #0xff
|
||||
cmp r0, #1
|
||||
movls r0, #1
|
||||
movhi r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0204AFF4: .word GAME_MODE
|
||||
arm_func_end sub_0204AFD0
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "main_0204B018.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start sub_0204B018
|
||||
sub_0204B018: ; 0x0204B018
|
||||
ldr r1, _0204B024 ; =GAME_MODE
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0204B024: .word GAME_MODE
|
||||
arm_func_end sub_0204B018
|
||||
|
||||
arm_func_start sub_0204B028
|
||||
sub_0204B028: ; 0x0204B028
|
||||
ldr r1, _0204B040 ; =_0209DF70
|
||||
ldr ip, _0204B044 ; =Debug_Print0
|
||||
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 EVENT_FLAG_SIZE_DEBUG_MSG
|
||||
arm_func_end sub_0204B028
|
||||
|
|
@ -15838,7 +15838,7 @@ MainLoop: ; 0x02065D1C
|
|||
bl sub_02026E78
|
||||
bl sub_020346C0
|
||||
mov r0, #0
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
mov r0, #2
|
||||
bl SetBothScreensWindowsColor
|
||||
bl sub_0204A1A4
|
||||
|
|
@ -15956,7 +15956,7 @@ _02065EE0:
|
|||
mov r6, #0
|
||||
_02065F20:
|
||||
mov r0, r6
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048624
|
||||
cmp r8, #0
|
||||
beq _02065FE0
|
||||
|
|
@ -16084,7 +16084,7 @@ _020660B0:
|
|||
movne r7, #0
|
||||
_020660C8:
|
||||
mov r0, #0
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
mov r0, #1
|
||||
bl LoadOverlay
|
||||
mov r0, #4
|
||||
|
|
@ -16133,7 +16133,7 @@ _02066154: ; jump table
|
|||
b _02066330 ; case 9
|
||||
_0206617C:
|
||||
mov r0, #2
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_020484C0
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
|
|
@ -16149,7 +16149,7 @@ _020661B0:
|
|||
bl GetDebugSpecialEpisodeNumber
|
||||
bl SetSpecialEpisodeType
|
||||
mov r0, #3
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
bl InitSpecialEpisodeHero
|
||||
mov r0, #2
|
||||
|
|
@ -16167,7 +16167,7 @@ _020661B0:
|
|||
b _02065F20
|
||||
_020661FC:
|
||||
mov r0, #2
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
bl LoadOverlay
|
||||
|
|
@ -16180,7 +16180,7 @@ _020661FC:
|
|||
b _02065F20
|
||||
_0206622C:
|
||||
mov r0, #3
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
bl LoadOverlay
|
||||
|
|
@ -16193,7 +16193,7 @@ _0206622C:
|
|||
b _02065F20
|
||||
_0206625C:
|
||||
mov r0, #2
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
bl LoadOverlay
|
||||
|
|
@ -16206,7 +16206,7 @@ _0206625C:
|
|||
b _02065F20
|
||||
_0206628C:
|
||||
mov r0, #2
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
bl LoadOverlay
|
||||
|
|
@ -16219,7 +16219,7 @@ _0206628C:
|
|||
b _02065F20
|
||||
_020662BC:
|
||||
mov r0, #4
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
bl sub_020485C4
|
||||
mov r0, #2
|
||||
|
|
@ -16237,7 +16237,7 @@ _020662BC:
|
|||
b _02065F20
|
||||
_02066300:
|
||||
mov r0, #4
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
mov r0, #2
|
||||
bl LoadOverlay
|
||||
|
|
@ -16250,7 +16250,7 @@ _02066300:
|
|||
b _02065F20
|
||||
_02066330:
|
||||
mov r0, #5
|
||||
bl sub_0204B018
|
||||
bl SetGameMode
|
||||
bl sub_02048644
|
||||
bl sub_020485D8
|
||||
mov r0, #2
|
||||
|
|
|
|||
11
include/game_mode.h
Normal file
11
include/game_mode.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef PMDSKY_GAME_MODE
|
||||
#define PMDSKY_GAME_MODE
|
||||
|
||||
#include "enums.h"
|
||||
#include "util.h"
|
||||
|
||||
bool8 sub_0204AFD0();
|
||||
bool8 IsGameModeRescue();
|
||||
void SetGameMode(enum game_mode new_game_mode);
|
||||
|
||||
#endif //PMDSKY_GAME_MODE
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef PMDSKY_MAIN_0204AFF8_H
|
||||
#define PMDSKY_MAIN_0204AFF8_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
bool8 IsGameModeRescue();
|
||||
|
||||
#endif //PMDSKY_MAIN_0204AFF8_H
|
||||
|
|
@ -30,7 +30,7 @@ struct script_var_raw {
|
|||
};
|
||||
|
||||
// See enum script_var_id for the sv_id parameters.
|
||||
|
||||
void DebugPrintEventFlagSize();
|
||||
void InitScriptVariableValues();
|
||||
void InitEventFlagScriptVars();
|
||||
void DefaultInitScriptVariable(union script_var_value sv_locals[], s16 sv_id);
|
||||
|
|
|
|||
3
main.lsf
3
main.lsf
|
|
@ -78,8 +78,7 @@ Static main
|
|||
Object asm/main_02034974.o
|
||||
Object src/main_0203C760.o
|
||||
Object asm/main_0203C774.o
|
||||
Object src/main_0204AFF8.o
|
||||
Object asm/main_0204B018.o
|
||||
Object src/game_mode.o
|
||||
Object src/script_variable.o
|
||||
Object asm/main_rodata_0209CECC.o
|
||||
Object src/dungeon_parameters_3.o
|
||||
|
|
|
|||
21
src/game_mode.c
Normal file
21
src/game_mode.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "game_mode.h"
|
||||
#include "enums.h"
|
||||
|
||||
extern enum game_mode GAME_MODE;
|
||||
|
||||
u8 sub_0204AFD0() {
|
||||
if ((u8)(GAME_MODE + 0xFE) <= 1) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 IsGameModeRescue()
|
||||
{
|
||||
return GAME_MODE == GAME_MODE_RESCUE;
|
||||
}
|
||||
|
||||
void SetGameMode(enum game_mode new_game_mode) {
|
||||
GAME_MODE = new_game_mode;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#include "main_0204AFF8.h"
|
||||
#include "enums.h"
|
||||
|
||||
extern enum game_mode GAME_MODE;
|
||||
|
||||
bool8 IsGameModeRescue()
|
||||
{
|
||||
return GAME_MODE == GAME_MODE_RESCUE;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "overlay_29_0234BBE8.h"
|
||||
#include "main_0204AFF8.h"
|
||||
#include "game_mode.h"
|
||||
#include "overlay_29_022DC61C.h"
|
||||
#include "overlay_29_0234CA68.h"
|
||||
#include "util.h"
|
||||
|
|
|
|||
|
|
@ -29,15 +29,8 @@ extern u8 EVENT_FLAG_EXPANSION_ERROR;
|
|||
extern u8 EVENT_FLAG_COMPARE_SCRIPT_VARIABLES_ERROR;
|
||||
extern const u8 EVENT_FLAG_GAME_MODE_DEBUG_MSG;
|
||||
extern const u8 EVENT_FLAG_BACKUP_DEBUG_MSG;
|
||||
const u8 EVENT_FLAG_FILE_NAME[] = "event_flag.c";
|
||||
const struct prog_pos_info EVENT_FLAG_PROG_POS_INFO_CALC_SCRIPT_VARIABLES = {
|
||||
(u8*) EVENT_FLAG_FILE_NAME,
|
||||
1001
|
||||
};
|
||||
const struct prog_pos_info EVENT_FLAG_PROG_POS_INFO_COMPARE_SCRIPT_VARIABLES = {
|
||||
(u8*) EVENT_FLAG_FILE_NAME,
|
||||
1044
|
||||
};
|
||||
extern u8 EVENT_FLAG_SIZE_DEBUG_MSG;
|
||||
extern s16 _0209DF70[18];
|
||||
|
||||
extern s32 GetPartyMembers(s32 param1);
|
||||
extern s32 GetMoneyStored();
|
||||
|
|
@ -50,6 +43,20 @@ extern s32 SetMoneyStored(s32 arg0);
|
|||
extern s32 SetNotifyNote(s32 arg0);
|
||||
extern void InitDungeonListScriptVars();
|
||||
|
||||
const u8 EVENT_FLAG_FILE_NAME[] = "event_flag.c";
|
||||
const struct prog_pos_info EVENT_FLAG_PROG_POS_INFO_CALC_SCRIPT_VARIABLES = {
|
||||
(u8*) EVENT_FLAG_FILE_NAME,
|
||||
1001
|
||||
};
|
||||
const struct prog_pos_info EVENT_FLAG_PROG_POS_INFO_COMPARE_SCRIPT_VARIABLES = {
|
||||
(u8*) EVENT_FLAG_FILE_NAME,
|
||||
1044
|
||||
};
|
||||
|
||||
void DebugPrintEventFlagSize() {
|
||||
Debug_Print0(&EVENT_FLAG_SIZE_DEBUG_MSG, _0209DF70[18], 0x400);
|
||||
}
|
||||
|
||||
void InitScriptVariableValues() {
|
||||
for(s32 sv_id = 0; sv_id < LOCAL_SCRIPT_VAR_OFFSET; sv_id++) {
|
||||
SCRIPT_VARS_VALUES[sv_id] = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user