summaryrefslogtreecommitdiff
path: root/src/moves_1.c
blob: 5a7bf6b46411f1fd974b41d500ec2c600412d8bf (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
#include "global.h"
#include "code_8092334.h"
#include "pokemon.h"
#include "constants/move_id.h"

void SavePokemonMove(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
    SaveIntegerBits(r0, &move->moveFlags, 4);
    SaveIntegerBits(r0, &move->moveID, 9);
    SaveIntegerBits(r0, &move->PP, 7);
}

void RestorePokemonMove(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
    RestoreIntegerBits(r0, &move->moveFlags, 4);
    RestoreIntegerBits(r0, &move->moveID, 9);
    RestoreIntegerBits(r0, &move->PP, 7);
}

void SavePokemonMoves(struct unkStruct_8094924 *r0, struct PokemonMove *moveSet)
{
    s32 iVar4;
    for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++)
    {
        SavePokemonMove(r0, &moveSet[iVar4]);
    }
}

void RestorePokemonMoves(struct unkStruct_8094924 *r0, struct PokemonMove *moveSet)
{
    s32 iVar4;
    for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++)
    {
        RestorePokemonMove(r0, &moveSet[iVar4]);
    }
}

void sub_8094148(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
    SaveIntegerBits(r0, &move->moveFlags, 4);
    SaveIntegerBits(r0, &move->sealed, 1);
    SaveIntegerBits(r0, &move->moveID, 9);
    SaveIntegerBits(r0, &move->PP, 7);
    SaveIntegerBits(r0, &move->powerBoost, 7);
}

void sub_8094184(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1)
{
    s32 r4;

    for(r4 = 0; r4 < MAX_MON_MOVES; r4++)
    {
        sub_8094148(r0, &r1->moves[r4]);
    }
    SaveIntegerBits(r0, &r1->unk20, 8);
}

void sub_80941B0(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
    memset(move, 0, sizeof(struct PokemonMove));
    RestoreIntegerBits(r0, &move->moveFlags, 4);
    RestoreIntegerBits(r0, &move->sealed, 1);
    RestoreIntegerBits(r0, &move->moveID, 9);
    RestoreIntegerBits(r0, &move->PP, 7);
    RestoreIntegerBits(r0, &move->powerBoost, 7);
}

void sub_80941FC(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1)
{
    s32 iVar4;
    for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++)
    {
        sub_80941B0(r0, &r1->moves[iVar4]);
    }
    r1->unk20 = 0;
    RestoreIntegerBits(r0, &r1->unk20, 8);
}

bool8 DoesMoveCharge(u16 move)
{
    if(move == MOVE_SOLARBEAM)
        return TRUE;
    if(move == MOVE_SKY_ATTACK)
        return TRUE;
    if(move == MOVE_RAZOR_WIND)
        return TRUE;
    if(move == MOVE_FOCUS_PUNCH)
        return TRUE;
    if(move == MOVE_SKULL_BASH)
        return TRUE;
    if(move == MOVE_FLY)
        return TRUE;
    if(move == MOVE_BOUNCE)
        return TRUE;
    if(move == MOVE_DIVE)
        return TRUE;
    if(move == MOVE_DIG)
        return TRUE;
    return FALSE;
}