summaryrefslogtreecommitdiff
path: root/src/manager/manager27.c
blob: 6540c1ad10b7be4eacfe0952fc76f36145b19b1e (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
#include "global.h"
#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"

extern u32 sub_0805C920(Entity*);

void sub_0805C874(Entity*);
void sub_0805C894(Entity*);
void sub_0805C8B4(Entity*);
void sub_0805C908(Entity*);

void (*const gUnk_08108D10[])(Entity*) = { sub_0805C874, sub_0805C894, sub_0805C8B4, sub_0805C908 };

const u8 gUnk_08108D20[] = { 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 };

void Manager27(Entity* this) {

    gUnk_08108D10[this->action](this);
    if (CheckLocalFlagByOffset(0x300, this->type + 0x67)) {
        gScreenTransition.field_0xac |= (1 << this->type);
    } else {
        gScreenTransition.field_0xac &= ~(1 << this->type);
    }
}

void sub_0805C874(Entity* this) {
    u8 bVar1;

    if (sub_0805C920(this)) {
        this->action = 2;
    } else {
        this->action = 1;
    }

    this->actionDelay = 1;
    this->field_0xf = 0;
}

void sub_0805C894(Entity* this) {
    if (sub_0805C920(this)) {
        this->action = 2;
        this->actionDelay = 1;
        SoundReq(SFX_EM_ARMOS_ON);
    }
}

void sub_0805C8B4(Entity* this) {
    u8 bVar1;
    int iVar2;

    if (--this->actionDelay == 0) {
        this->actionDelay = 0x14;

        if (5 < ++this->field_0xf) {
            this->field_0xf = 0;
        }
        LoadPaletteGroup(gUnk_08108D20[this->field_0xf]);
        if (this->field_0xf == 0) {
            SoundReq(SFX_EM_ARMOS_ON);
        }
    }
    if (sub_0805C920(this) == 0) {
        this->action = 3;
    }
}

void sub_0805C908(Entity* this) {
    if (this->field_0xf == 0) {
        this->action = 1;
    } else {
        sub_0805C8B4(this);
    }
}

u32 sub_0805C920(Entity* this) {
    return CheckLocalFlagByOffset(0x300, this->type + 0x67);
}