summaryrefslogtreecommitdiff
path: root/arm9/src/scrcmd_berry_trees.c
blob: 43999cec57680bf3980b2bdb572273b8863f1435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "scrcmd.h"
#include "unk_02029FB0.h"

extern void* FUN_02039438(struct UnkSavStruct80*, int idx);

extern u8 FUN_0204B5FC(struct UnkSavStruct80*, void*);
extern void FUN_0204B57C(struct UnkSavStruct80*, void*, int);
extern u16 FUN_0204B63C(struct UnkSavStruct80*, void*);
extern u16 FUN_0204B660(struct UnkSavStruct80*, void*);
extern u16 FUN_0204B684(struct UnkSavStruct80*, void*);
extern u16 FUN_0204B6A4(struct UnkSavStruct80*, void*);
extern void FUN_0204B9CC(struct UnkSavStruct80*);
extern void FUN_0204B5A8(struct UnkSavStruct80*, void*, u16);
extern void FUN_0204B9A0(struct UnkSavStruct80*);
extern void FUN_0204B4FC(struct UnkSavStruct80*, void*);

THUMB_FUNC BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext* ctx)
{
    u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
    void** unk = FUN_02039438(ctx->unk80, 10);

    *ret_ptr = FUN_0204B5FC(ctx->unk80, *unk);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_GetBerryTreeType(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));

    *ret_ptr = FUN_0204B63C(ctx->unk80, *unk);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));

    *ret_ptr = FUN_0204B660(ctx->unk80, *unk);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));

    *ret_ptr = FUN_0204B684(ctx->unk80, *unk);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));

    *ret_ptr = FUN_0204B6A4(ctx->unk80, *unk);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));

    FUN_0204B57C(ctx->unk80, *unk, unk2);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_SetBerryTreeType(struct ScriptContext* ctx)
{
    void** unk = FUN_02039438(ctx->unk80, 10);
    struct GameStats* unk2 = Sav2_GameStats_get(ctx->unk80->saveBlock2);
    u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));

    FUN_0204B5A8(ctx->unk80, *unk, unk3);
    GameStats_Inc(unk2, 3);

    return FALSE;
}

THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) //SetBerryTreeWater/WaterBerryTree, or just the animation?
{
    u16 unk = ScriptReadHalfword(ctx);

    switch (unk)
    {
    case 0:
        FUN_0204B9A0(ctx->unk80);
        break;
    case 1:
        FUN_0204B9CC(ctx->unk80);
        break;
    default:
        GF_ASSERT(FALSE);
        break;
    }

    return TRUE;
}

THUMB_FUNC BOOL ScrCmd_TakeBerryTreeBerries(struct ScriptContext* ctx)
{
    struct GameStats* unk = Sav2_GameStats_get(ctx->unk80->saveBlock2);
    void** unk2 = FUN_02039438(ctx->unk80, 10);

    FUN_0204B4FC(ctx->unk80, *unk2);
    GameStats_AddSpecial(unk, 0);

    return FALSE;
}