mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-01-08 13:50:19 +00:00
Decomp scrcmd_moneybox
This commit is contained in:
parent
b0d82a9cdb
commit
2e960b46ab
@ -1,84 +0,0 @@
|
||||
#include "constants/sndseq.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/std_script.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/sprites.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/mmodel.h"
|
||||
#include "constants/items.h"
|
||||
#include "msgdata/msg/msg_0096_D31R0201.h"
|
||||
#include "msgdata/msg/msg_0066_D23R0102.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "global.inc"
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ScrCmd_ShowMoneyBox
|
||||
ScrCmd_ShowMoneyBox: ; 0x02203138
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r4, r0, #0
|
||||
add r1, r4, #0
|
||||
add r1, #0x80
|
||||
ldr r5, [r1]
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0
|
||||
add r0, r4, #0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0]
|
||||
bl VarGet
|
||||
add r6, r0, #0
|
||||
add r0, r4, #0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0
|
||||
add r0, r4, #0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0]
|
||||
bl VarGet
|
||||
add r7, r0, #0
|
||||
add r0, r5, #0
|
||||
mov r1, #0x28
|
||||
bl FieldSysGetAttrAddr
|
||||
lsl r1, r6, #0x18
|
||||
lsl r2, r7, #0x18
|
||||
add r4, #0x80
|
||||
add r5, r0, #0
|
||||
ldr r0, [r4]
|
||||
lsr r1, r1, #0x18
|
||||
lsr r2, r2, #0x18
|
||||
bl Fsys_ShowMoneyBox
|
||||
str r0, [r5]
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end ScrCmd_ShowMoneyBox
|
||||
|
||||
thumb_func_start ScrCmd_HideMoneyBox
|
||||
ScrCmd_HideMoneyBox: ; 0x02203188
|
||||
push {r3, lr}
|
||||
add r0, #0x80
|
||||
ldr r0, [r0]
|
||||
mov r1, #0x28
|
||||
bl FieldSysGetAttrAddr
|
||||
ldr r0, [r0]
|
||||
bl MoneyBoxSys_Delete
|
||||
mov r0, #0
|
||||
pop {r3, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end ScrCmd_HideMoneyBox
|
||||
|
||||
thumb_func_start ScrCmd_UpdateMoneyBox
|
||||
ScrCmd_UpdateMoneyBox: ; 0x022031A0
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0]
|
||||
mov r1, #0x28
|
||||
bl FieldSysGetAttrAddr
|
||||
add r1, r0, #0
|
||||
add r4, #0x80
|
||||
ldr r0, [r4]
|
||||
ldr r1, [r1]
|
||||
bl MoneyBoxSys_Update
|
||||
mov r0, #0
|
||||
pop {r4, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end ScrCmd_UpdateMoneyBox
|
13
include/scrcmd_moneybox.h
Normal file
13
include/scrcmd_moneybox.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef POKEHEARTGOLD_SCRCMD_MONEYBOX_H
|
||||
#define POKEHEARTGOLD_SCRCMD_MONEYBOX_H
|
||||
|
||||
#include "global.h"
|
||||
#include "scrcmd.h"
|
||||
|
||||
BOOL ScrCmd_ShowMoneyBox(SCRIPTCONTEXT *ctx);
|
||||
BOOL ScrCmd_HideMoneyBox(SCRIPTCONTEXT *ctx);
|
||||
BOOL ScrCmd_UpdateMoneyBox(SCRIPTCONTEXT *ctx);
|
||||
|
||||
extern WINDOW *Fsys_ShowMoneyBox(FieldSystem *, u8, u8);
|
||||
|
||||
#endif //POKEHEARTGOLD_SCRCMD_MONEYBOX_H
|
@ -73,7 +73,7 @@ typedef struct ScriptEnvironment {
|
||||
void *unk_B4;
|
||||
void *unk_B8;
|
||||
WINDOW unk_BC;
|
||||
WINDOW unk_CC;
|
||||
WINDOW moneyBox;
|
||||
void *unk_DC;
|
||||
} ScriptEnvironment;
|
||||
|
||||
@ -118,7 +118,7 @@ enum ScriptEnvField {
|
||||
SCRIPTENV_EYE_TRAINER_2_OBJPTR = 37,
|
||||
SCRIPTENV_54_1_18 = 38,
|
||||
SCRIPTENV_BC = 39,
|
||||
SCRIPTENV_CC = 40,
|
||||
SCRIPTENV_MONEY_BOX = 40,
|
||||
SCRIPTENV_DC = 41,
|
||||
SCRIPTENV_SPECIAL_VAR_8000 = 42,
|
||||
SCRIPTENV_SPECIAL_VAR_8001 = 43,
|
||||
|
2
main.lsf
2
main.lsf
@ -495,7 +495,7 @@ Overlay field
|
||||
Object asm/overlay_01_02200858.o
|
||||
Object asm/scrcmd_pokemon_misc.o
|
||||
Object asm/scrcmd_move_tutor.o
|
||||
Object asm/scrcmd_moneybox.o
|
||||
Object src/scrcmd_moneybox.o
|
||||
Object asm/overlay_01_022031C0.o
|
||||
Object asm/overlay_01_02203A18.o
|
||||
Object asm/overlay_01_02203E40.o
|
||||
|
@ -296,8 +296,8 @@ void *FieldSysGetAttrAddrInternal(ScriptEnvironment *unk, enum ScriptEnvField fi
|
||||
return &unk->engagedTrainers[1].unk18;
|
||||
case SCRIPTENV_BC:
|
||||
return &unk->unk_BC;
|
||||
case SCRIPTENV_CC:
|
||||
return &unk->unk_CC;
|
||||
case SCRIPTENV_MONEY_BOX:
|
||||
return &unk->moneyBox;
|
||||
case SCRIPTENV_DC:
|
||||
return &unk->unk_DC;
|
||||
case SCRIPTENV_SPECIAL_VAR_8000:
|
||||
|
27
src/scrcmd_moneybox.c
Normal file
27
src/scrcmd_moneybox.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include "scrcmd_moneybox.h"
|
||||
|
||||
BOOL ScrCmd_ShowMoneyBox(SCRIPTCONTEXT *ctx) {
|
||||
FieldSystem *fsys = ctx->fsys;
|
||||
u16 var0 = VarGet(ctx->fsys, ScriptReadHalfword(ctx));
|
||||
u16 var1 = VarGet(ctx->fsys, ScriptReadHalfword(ctx));
|
||||
|
||||
WINDOW **moneyBox = FieldSysGetAttrAddr(fsys, SCRIPTENV_MONEY_BOX);
|
||||
*moneyBox = Fsys_ShowMoneyBox(ctx->fsys, var0, var1);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_HideMoneyBox(SCRIPTCONTEXT *ctx) {
|
||||
FieldSystem *fsys = ctx->fsys;
|
||||
WINDOW **moneyBox = FieldSysGetAttrAddr(fsys, SCRIPTENV_MONEY_BOX);
|
||||
MoneyBoxSys_Delete(*moneyBox);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL ScrCmd_UpdateMoneyBox(SCRIPTCONTEXT *ctx) {
|
||||
FieldSystem *fsys = ctx->fsys;
|
||||
WINDOW **moneyBox = FieldSysGetAttrAddr(fsys, SCRIPTENV_MONEY_BOX);
|
||||
MoneyBoxSys_Update(ctx->fsys, *moneyBox);
|
||||
return FALSE;
|
||||
}
|
Loading…
Reference in New Issue
Block a user