mirror of
https://github.com/pret/pmd-red.git
synced 2025-02-17 20:07:46 +00:00
some ground_script work
This commit is contained in:
parent
8d7e774e81
commit
4796b0bd45
@ -677,74 +677,4 @@ _0809D708:
|
||||
bx r1
|
||||
thumb_func_end sub_809D6E4
|
||||
|
||||
thumb_func_start sub_809D710
|
||||
sub_809D710:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r3, r1, 0
|
||||
lsls r2, 16
|
||||
asrs r2, 16
|
||||
ldr r1, _0809D73C
|
||||
lsls r0, r2, 1
|
||||
adds r0, r2
|
||||
lsls r0, 2
|
||||
adds r1, 0x8
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
str r0, [r3]
|
||||
movs r0, 0x2
|
||||
strh r0, [r3, 0x4]
|
||||
cmp r4, 0
|
||||
beq _0809D740
|
||||
ldrh r0, [r4, 0x10]
|
||||
strh r0, [r3, 0x6]
|
||||
ldrb r0, [r4, 0x12]
|
||||
b _0809D746
|
||||
.align 2, 0
|
||||
_0809D73C: .4byte gFunctionScriptTable
|
||||
_0809D740:
|
||||
ldr r0, _0809D750
|
||||
strh r0, [r3, 0x6]
|
||||
movs r0, 0xFF
|
||||
_0809D746:
|
||||
strb r0, [r3, 0x8]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0809D750: .4byte 0x0000ffff
|
||||
thumb_func_end sub_809D710
|
||||
|
||||
thumb_func_start sub_809D754
|
||||
sub_809D754:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x24
|
||||
bl sub_809D568
|
||||
adds r4, 0x84
|
||||
adds r0, r4, 0
|
||||
bl sub_809D568
|
||||
movs r0, 0x1
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_809D754
|
||||
|
||||
thumb_func_start sub_809D770
|
||||
sub_809D770:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x24
|
||||
bl sub_809D568
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x84
|
||||
bl sub_809D568
|
||||
movs r0, 0x4
|
||||
strh r0, [r4, 0x26]
|
||||
movs r0, 0x1
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_809D770
|
||||
|
||||
.align 2,0
|
||||
|
@ -26,7 +26,7 @@ extern void GroundMap_GetStationScript(struct GroundScript_ExecutePP_3 *, s16, u
|
||||
|
||||
bool8 GroundScript_ExecutePP(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, struct GroundScript_ExecutePP_3 *param_3, struct DebugLocation *unused);
|
||||
extern u8 sub_809D678(void *);
|
||||
extern void sub_809D710(u32,struct GroundScript_ExecutePP_3 *, s32);
|
||||
extern void sub_809D710(u8 *, struct GroundScript_ExecutePP_3 *, s32);
|
||||
extern u8 sub_809D968(void *, s32);
|
||||
|
||||
void sub_80A4BE8(struct GroundScript_ExecutePP_3 *script, s16 r1)
|
||||
@ -34,17 +34,17 @@ void sub_80A4BE8(struct GroundScript_ExecutePP_3 *script, s16 r1)
|
||||
GroundMap_GetStationScript(script, r1, 0, 0);
|
||||
}
|
||||
|
||||
void GroundMap_ExecuteEvent(s16 param_1, u32 param_2)
|
||||
void GroundMap_ExecuteEvent(s16 scriptIndex, u32 param_2)
|
||||
{
|
||||
struct GroundScript_ExecutePP_3 script;
|
||||
s32 iVar1;
|
||||
s32 index_s32;
|
||||
u8 iVar2;
|
||||
|
||||
iVar1 = param_1;
|
||||
index_s32 = scriptIndex;
|
||||
iVar2 = param_2;
|
||||
|
||||
Log(0,gUnknown_8117594,iVar1,iVar2); // "GroundMap ExecuteEvent %3d %d
|
||||
sub_809D710(0,&script,iVar1);
|
||||
Log(0,gUnknown_8117594,index_s32,iVar2); // "GroundMap ExecuteEvent %3d %d
|
||||
sub_809D710(NULL, &script, index_s32);
|
||||
if (iVar2 != 0) {
|
||||
script.scriptType = 5;
|
||||
}
|
||||
|
@ -22,14 +22,96 @@ extern void sub_809D568(void *);
|
||||
extern u8 sub_80AC378(void);
|
||||
extern u8 sub_80AD290(void);
|
||||
extern u8 sub_80A8B74(void);
|
||||
extern void sub_809D6E4(struct GroundScript_ExecutePP_1 *, struct GroundScript_ExecutePP_3 *, s32);
|
||||
extern void sub_809D6E4(struct GroundScript_ExecutePP_1 *, struct GroundScript_ExecutePP_3 *, s32 index);
|
||||
extern u8 sub_809A750(void);
|
||||
extern u32 sub_80A2460(struct GroundScript_ExecutePP_1 *param_1, u32);
|
||||
extern u8 *sub_80A2460(struct GroundScript_ExecutePP_1 *param_1, u32);
|
||||
void FatalError(u32 *, const char *, ...) __attribute__((noreturn));
|
||||
|
||||
struct FunctionScript
|
||||
{
|
||||
u32 unk0;
|
||||
u8 *funcName;
|
||||
u8 *script;
|
||||
};
|
||||
|
||||
extern struct FunctionScript gFunctionScriptTable[];
|
||||
|
||||
|
||||
// NOTE: shift of index and load of gFunctionScriptTable is flipped
|
||||
#ifdef NONMATCHING
|
||||
void sub_809D710(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_ExecutePP_3 *script, s16 index)
|
||||
{
|
||||
script->scriptPointer = gFunctionScriptTable[index].script;
|
||||
script->scriptType = 2;
|
||||
if (param_1 != NULL) {
|
||||
script->unk6 = param_1->unk10;
|
||||
script->unk8 = param_1->unk12;
|
||||
}
|
||||
else {
|
||||
script->unk6 = -1;
|
||||
script->unk8 = -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED void sub_809D710(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_ExecutePP_3 *script, s16 index)
|
||||
{
|
||||
asm_unified(
|
||||
"\tpush {r4,lr}\n"
|
||||
"\tadds r4, r0, 0\n"
|
||||
"\tadds r3, r1, 0\n"
|
||||
"\tlsls r2, 16\n"
|
||||
"\tasrs r2, 16\n"
|
||||
"\tldr r1, _0809D73C\n"
|
||||
"\tlsls r0, r2, 1\n"
|
||||
"\tadds r0, r2\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tadds r1, 0x8\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tstr r0, [r3]\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tstrh r0, [r3, 0x4]\n"
|
||||
"\tcmp r4, 0\n"
|
||||
"\tbeq _0809D740\n"
|
||||
"\tldrh r0, [r4, 0x10]\n"
|
||||
"\tstrh r0, [r3, 0x6]\n"
|
||||
"\tldrb r0, [r4, 0x12]\n"
|
||||
"\tb _0809D746\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0809D73C: .4byte gFunctionScriptTable\n"
|
||||
"_0809D740:\n"
|
||||
"\tldr r0, _0809D750\n"
|
||||
"\tstrh r0, [r3, 0x6]\n"
|
||||
"\tmovs r0, 0xFF\n"
|
||||
"_0809D746:\n"
|
||||
"\tstrb r0, [r3, 0x8]\n"
|
||||
"\tpop {r4}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0809D750: .4byte 0x0000ffff");
|
||||
}
|
||||
#endif
|
||||
|
||||
bool8 sub_809D754(struct GroundScript_ExecutePP_1 *param_1, struct DebugLocation *unused)
|
||||
{
|
||||
sub_809D568(¶m_1->unk24);
|
||||
sub_809D568(¶m_1->unk84);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_809D770(struct GroundScript_ExecutePP_1 *param_1, struct DebugLocation *unused)
|
||||
{
|
||||
|
||||
sub_809D568(¶m_1->unk24);
|
||||
sub_809D568(¶m_1->unk84);
|
||||
param_1->unk24.unk2 = 4;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 GroundScript_ExecutePP(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, struct GroundScript_ExecutePP_3 *param_3, struct DebugLocation *unused)
|
||||
{
|
||||
if ((param_3 == NULL) || (param_3->unk0 == 0)) {
|
||||
if ((param_3 == NULL) || (param_3->scriptPointer == NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
switch(param_3->scriptType) {
|
||||
@ -77,8 +159,8 @@ _0809D84A:
|
||||
param_1->unk24.unk2 = 3;
|
||||
param_1->unk24.unkC = param_3->unk6;
|
||||
param_1->unk24.unkE = param_3->unk8;
|
||||
param_1->unk24.unk4 = param_3->unk0;
|
||||
param_1->unk24.unk8 = param_3->unk0;
|
||||
param_1->unk24.scriptPointer1 = param_3->scriptPointer;
|
||||
param_1->unk24.scriptPointer2 = param_3->scriptPointer;
|
||||
param_1->unk24.unk10 = 0;
|
||||
param_1->unk24.unk14 = 0;
|
||||
|
||||
@ -88,11 +170,11 @@ _0809D84A:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_809D8C0(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, s16 param_3, struct DebugLocation *debug)
|
||||
bool8 sub_809D8C0(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, s16 index, struct DebugLocation *debug)
|
||||
{
|
||||
struct GroundScript_ExecutePP_3 auStack28;
|
||||
|
||||
sub_809D6E4(param_1,&auStack28,param_3);
|
||||
sub_809D6E4(param_1,&auStack28,index);
|
||||
return GroundScript_ExecutePP(param_1, param_2, &auStack28, debug);
|
||||
}
|
||||
|
||||
@ -103,7 +185,7 @@ u8 sub_809D8EC(struct GroundScript_ExecutePP_1 *param_1, s16 param_2)
|
||||
param_2_s32 = param_2;
|
||||
|
||||
if ((param_2 == 0) && (sub_809A750() == 0)) {
|
||||
param_1->unk24.unk4 = sub_80A2460(param_1,0);
|
||||
param_1->unk24.scriptPointer1 = sub_80A2460(param_1, 0);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user