summaryrefslogtreecommitdiff
path: root/src/object/objectAF.c
blob: 0415398bbbb57c0488ad40f5e48e98f53b832ca0 (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
#include "global.h"
#include "entity.h"

extern void sub_080A0640(Entity*);
extern void PositionRelative(Entity*, Entity*, s32, s32);
extern void CopyPosition(Entity*, Entity*);

extern void (*const gUnk_081248C4[])(Entity*);

void ObjectAF(Entity* this) {
    gUnk_081248C4[this->action](this);
}

void sub_080A05A4(Entity* this) {
    if ((this->entityType).form != 2) {
        this->action = 1;
        this->spritePriority.b0 = 6;
        sub_080A0640(this);
        InitializeAnimation(this, 1);
    } else {
        this->action = 2;
        this->y.HALF.HI++;
        this->height.HALF.HI = 0;
        this->spriteOffsetY--;
        InitializeAnimation(this, 3);
    }
}

void sub_080A05F4(Entity* this) {
    if (this->parent == NULL) {
        this->action = 2;
        InitializeAnimation(this, 2);
    } else {
        if (this->parent->field_0x4 == NULL) {
            DeleteThisEntity();
        }
        sub_080A0640(this);
        GetNextFrame(this);
    }
}

void sub_080A0624(Entity* this) {
    GetNextFrame(this);
    if ((this->frames.b.f3) != 0) {
        DeleteThisEntity();
    }
}

void sub_080A0640(Entity* this) {
    if (this->entityType.form == 0) {
        PositionRelative(*(Entity**)(this->parent->otherEntity + 0x4), this, 0, 0x80000);
    } else {
        CopyPosition(this->parent, this);
    }
    this->height.HALF.HI = 0;
}