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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/**
* @file lakituCloud.c
* @ingroup Enemies
*
* @brief Lakitu Cloud enemy
*/
#include "asm.h"
#include "effects.h"
#include "enemy.h"
#include "entity.h"
#include "object.h"
#include "sound.h"
#include "physics.h"
#include "player.h"
#include "room.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[12];
/*0x74*/ u16 unk_74;
/*0x76*/ u8 unused2[2];
/*0x78*/ u16 unk_78;
/*0x7a*/ u16 unk_7a;
} LakituCloudEntity;
extern void (*const LakituCloud_Functions[6])(LakituCloudEntity*);
extern void (*const gUnk_080D0430[3])(LakituCloudEntity*);
extern void (*const gUnk_080D043C[3])(LakituCloudEntity*);
void sub_0803CE14(LakituCloudEntity*);
void sub_0803CE3C(LakituCloudEntity*);
void LakituCloud(LakituCloudEntity* this) {
LakituCloud_Functions[GetNextFunction(super)](this);
}
void LakituCloud_OnTick(LakituCloudEntity* this) {
gUnk_080D0430[super->action](this);
}
void LakituCloud_OnKnockback(LakituCloudEntity* this) {
super->knockbackDuration = 0;
LakituCloud_OnTick(this);
}
void LakituCloud_OnGrabbed(LakituCloudEntity* this) {
if (!sub_0806F520(super)) {
if (super->subAction == 2) {
sub_0803CE3C(this);
}
} else {
gUnk_080D043C[super->subAction](this);
}
}
void sub_0803CD2C(LakituCloudEntity* this) {
super->subAction = 1;
super->gustJarTolerance = 0x3c;
}
void sub_0803CD38(LakituCloudEntity* this) {
sub_0806F4E8(super);
}
void sub_0803CD40(LakituCloudEntity* this) {
if (!sub_0806F3E4(super)) {
return;
}
ModHealth(-2);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
sub_08079D84();
sub_0803CE3C(this);
}
void sub_0803CD6C(LakituCloudEntity* this) {
Entity* lakitu;
super->action = 1;
super->z.HALF.HI = -2;
// Set parent to lakitu
lakitu = GetCurrentRoomProperty(super->type);
super->child = lakitu;
super->parent = lakitu;
this->unk_78 = super->x.HALF.HI;
this->unk_7a = super->y.HALF.HI;
InitAnimationForceUpdate(super, 4);
sub_0803CE14(this);
}
void sub_0803CDA8(LakituCloudEntity* this) {
UpdateAnimationSingleFrame(super);
if (!(super->direction & DIR_NOT_MOVING_CHECK)) {
LinearMoveUpdate(super);
}
if (--this->unk_74 << 0x10 == 0) {
sub_0803CE14(this);
}
}
void sub_0803CDD8(LakituCloudEntity* this) {
u8 one;
u8 draw;
draw = super->spriteSettings.draw;
one = 1;
super->spriteSettings.draw = draw ^ one;
super->timer--;
if (super->timer == 0) {
super->action = 1;
COLLISION_ON(super);
super->spriteSettings.draw = one;
}
}
void sub_0803CE14(LakituCloudEntity* this) {
u8 direction;
UpdateRailMovement(super, (u16**)&super->child, &this->unk_74);
direction = super->direction;
if (direction & DIR_NOT_MOVING_CHECK) {
return;
}
direction = direction / 8 + 4;
InitAnimationForceUpdate(super, direction);
}
void sub_0803CE3C(LakituCloudEntity* this) {
CreateFx(super, FX_DEATH, 0);
super->action = 2;
super->timer = 60;
COLLISION_OFF(super);
super->gustJarState &= 0xfb;
super->x.HALF.HI = this->unk_78;
super->y.HALF.HI = this->unk_7a;
super->child = super->parent;
sub_0803CE14(this);
}
void (*const LakituCloud_Functions[])(LakituCloudEntity*) = {
LakituCloud_OnTick,
LakituCloud_OnTick,
LakituCloud_OnKnockback,
(void (*)(LakituCloudEntity*))GenericDeath,
(void (*)(LakituCloudEntity*))GenericConfused,
LakituCloud_OnGrabbed,
};
void (*const gUnk_080D0430[])(LakituCloudEntity*) = {
sub_0803CD6C,
sub_0803CDA8,
sub_0803CDD8,
};
void (*const gUnk_080D043C[])(LakituCloudEntity*) = {
sub_0803CD2C,
sub_0803CD38,
sub_0803CD40,
};
|