blob: 05529683af91b3bfe12e053e56796289a9497601 (
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
|
/**
* @file paper.c
* @ingroup Objects
*
* @brief Paper object
*/
#include "map.h"
#include "object.h"
#include "asm.h"
#include "room.h"
#include "player.h"
#include "tiles.h"
void Paper_Init(Entity*);
void Paper_Action1(Entity*);
void Paper_Type0(Entity*);
void Paper_Type1(Entity*);
void Paper_Type2(Entity*);
void Paper(Entity* this) {
static void (*const Paper_Actions[])(Entity*) = {
Paper_Init,
Paper_Action1,
};
Paper_Actions[this->action](this);
}
void Paper_Init(Entity* this) {
static void (*const Paper_Types[])(Entity*) = {
Paper_Type0,
Paper_Type1,
Paper_Type2,
};
Paper_Types[this->type](this);
}
void Paper_Type0(Entity* this) {
this->action = 1;
this->spriteRendering.b3 = 1;
this->z.HALF.HI -= 8;
if (this->type2 != 1) {
if (this->type2 != 2) {
return;
}
this->spriteSettings.draw = 0;
}
SetTile(SPECIAL_TILE_81, COORD_TO_TILE(this), LAYER_BOTTOM);
}
void Paper_Type1(Entity* this) {
this->action = 1;
this->frameIndex = this->type2;
switch (this->type2) {
case 0:
this->spriteOffsetY = 2;
break;
case 2:
this->spriteOffsetY = -2;
break;
}
}
void Paper_Type2(Entity* this) {
this->action = 1;
this->y.HALF.HI++;
this->spriteOffsetY = -1;
SetTile(SPECIAL_TILE_81, COORD_TO_TILE(this) - 1, LAYER_BOTTOM);
SetTile(SPECIAL_TILE_81, COORD_TO_TILE(this), LAYER_BOTTOM);
}
void Paper_Action1(Entity* this) {
if (this->type == 0) {
if ((gPlayerEntity.base.y.HALF.HI < this->y.HALF.HI) ||
(gPlayerEntity.base.y.HALF.HI) > this->y.HALF.HI + 0x18) {
this->spriteRendering.b3 = 1;
} else {
this->spriteRendering.b3 = 2;
}
}
}
|