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
181
182
183
184
185
186
187
188
189
190
191
192
|
/**
* @file sturgeon.c
* @ingroup NPCs
*
* @brief Sturgeon NPC
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "item.h"
#include "npc.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 fusionOffer;
} SturgeonEntity;
const SpriteLoadData gUnk_0810FA38[] = {
{ 59, 140, 0 },
{ 59, 140, 0 },
{ 0, 0, 0 },
};
void sub_08064B44(SturgeonEntity*);
void sub_08064B88(SturgeonEntity*);
void sub_08064C2C(SturgeonEntity*);
void sub_08064C50(SturgeonEntity*);
void (*const gUnk_0810FA44[])(SturgeonEntity*) = {
sub_08064B44,
sub_08064B88,
sub_08064C2C,
sub_08064C50,
};
extern const u16 gUnk_0810FA54[];
// const u16 gUnk_0810FA54[] = {
// TEXT_INDEX(TEXT_LIBRARY, 0xe),
// TEXT_INDEX(TEXT_LIBRARY, 0x15),
// TEXT_INDEX(TEXT_LIBRARY, 0x11),
// };
extern u32 gUnk_0810FA5A; // TODO second parameter of sub_0806EE04
void Sturgeon_MakeInteractable(SturgeonEntity* this);
void sub_08064C9C(Entity* this);
void sub_08064CD8(Entity* this);
void Sturgeon(SturgeonEntity* this) {
if ((super->flags & ENT_SCRIPTED) == 0) {
gUnk_0810FA44[super->action](this);
sub_0806ED78(super);
} else {
if (super->action == 0) {
if (LoadExtraSpriteData(super, gUnk_0810FA38)) {
super->action = 1;
super->timer = 0;
InitScriptForNPC(super);
}
} else {
u32 tmp = super->action & 0x80;
if (tmp) {
if (UpdateFuseInteraction(super)) {
super->action = 1;
}
} else {
if (super->interactType == INTERACTION_FUSE) {
super->action = super->action | 0xff;
super->interactType = INTERACTION_NONE;
InitAnimationForceUpdate(super,
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
InitializeNPCFusion(super);
} else {
ExecuteScriptAndHandleAnimation(super, NULL);
sub_08064C9C(super);
}
}
}
}
}
void sub_08064B44(SturgeonEntity* this) {
if (LoadExtraSpriteData(super, gUnk_0810FA38)) {
InitializeAnimation(super, 2);
sub_0806EE04(super, &gUnk_0810FA5A, 0);
Sturgeon_MakeInteractable(this);
super->action = 1;
super->subAction = 0;
super->spriteSettings.draw = 1;
}
}
void sub_08064B88(SturgeonEntity* this) {
s32 temp;
s32 temp2;
switch (super->interactType) {
case INTERACTION_NONE:
temp = sub_0806EE20(super);
super->animationState = super->knockbackDirection;
if (temp != 0) {
InitializeAnimation(super, temp & 0x7f);
}
GetNextFrame(super);
break;
case INTERACTION_FUSE:
super->action = 3;
temp2 = GetAnimationState(super);
if (temp2 < 0) {
temp2 = super->animationState;
}
super->subtimer = super->animIndex;
InitializeAnimation(super, temp2);
super->interactType = INTERACTION_NONE;
InitializeNPCFusion(super);
break;
case INTERACTION_TALK:
default:
super->action = 2;
temp2 = GetAnimationState(super);
if (temp2 < 0) {
temp2 = super->animationState;
}
super->subtimer = super->animIndex;
InitializeAnimation(super, temp2);
super->interactType = INTERACTION_NONE;
sub_08064CD8(super);
}
}
void sub_08064C2C(SturgeonEntity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
super->action = 1;
InitializeAnimation(super, (u32)super->subtimer);
}
}
void sub_08064C50(SturgeonEntity* this) {
if (UpdateFuseInteraction(super) != 0) {
super->action = 1;
InitializeAnimation(super, super->subtimer);
}
}
void Sturgeon_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (u8)this->frame & 0x3f);
SetExtraSpriteFrame(this, 1, (u32)this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_08064C9C(Entity* this) {
if ((this->timer != 0) && ((gRoomTransition.frameCount & 3U) == 0)) {
CreateDust(this);
}
}
void Sturgeon_MakeInteractable(SturgeonEntity* this) {
this->fusionOffer = GetFusionToOffer(super);
AddInteractableWhenBigFuser(super, this->fusionOffer);
}
void sub_08064CD8(Entity* this) {
u32 flag;
u32 tmp = 2;
if (GetInventoryValue(ITEM_FLIPPERS) == 0) {
if (CheckLocalFlag(0x73)) {
tmp = 1;
} else {
tmp = 0;
}
}
MessageNoOverlap(gUnk_0810FA54[tmp], this);
}
void sub_08064D08(Entity* this) {
this->timer = 1;
}
void sub_08064D10(Entity* this) {
this->timer = 0;
}
void Sturgeon_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, gUnk_0810FA38)) {
this->action++;
this->spriteSettings.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
|