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
|
/**
* @file librari.c
* @ingroup NPCs
*
* @brief Librari NPC
*/
#include "entity.h"
#include "item.h"
#include "npc.h"
#include "flags.h"
#include "message.h"
#include "script.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 fusionOffer;
} LibrariEntity;
void Librari(LibrariEntity* this) {
switch (super->action) {
case 0:
super->action = 1;
super->spriteSettings.draw = TRUE;
super->animationState = super->timer;
this->fusionOffer = GetFusionToOffer(super);
AddInteractableWhenBigFuser(super, this->fusionOffer);
SetEntityPriority(super, PRIO_MESSAGE);
InitScriptForNPC(super);
break;
case 1:
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = INTERACTION_NONE;
InitializeNPCFusion(super);
} else {
ExecuteScriptForEntity(super, NULL);
HandleEntity0x82Actions(super);
UpdateAnimationSingleFrame(super);
}
break;
case 2:
if (UpdateFuseInteraction(super)) {
super->action = 1;
}
}
}
void sub_0806B260(Entity* this, ScriptExecutionContext* context) {
static const u16 messageIndices[] = {
TEXT_INDEX(TEXT_TOWN_MINISH1, 0X19),
TEXT_INDEX(TEXT_TOWN_MINISH1, 0X1a),
TEXT_INDEX(TEXT_TOWN_MINISH1, 0X22),
TEXT_INDEX(TEXT_TOWN_MINISH1, 0X27),
};
u32 index;
context->condition = 0;
if (!GetInventoryValue(ITEM_FLIPPERS)) {
if (CheckGlobalFlag(MIZUKAKI_START)) {
index = 2;
context->condition = 1;
} else if (!CheckLocalFlag(0x7a)) {
index = 0;
SetLocalFlag(0x7a);
} else {
index = 1;
}
} else {
index = 3;
}
MessageNoOverlap(messageIndices[index], this);
}
void sub_0806B2B4(Entity* this) {
static const u16 messageIndices[] = {
TEXT_INDEX(TEXT_MINISH, 0xad), TEXT_INDEX(TEXT_MINISH, 0xae), TEXT_INDEX(TEXT_MINISH, 0xaf),
TEXT_INDEX(TEXT_MINISH, 0xb0), TEXT_INDEX(TEXT_MINISH, 0xb1),
};
u32 index;
if (CheckLocalFlag(0xb3)) {
if (!CheckRoomFlag(0)) {
index = 1;
SetRoomFlag(0);
} else if (!CheckRoomFlag(1)) {
index = 2;
SetRoomFlag(1);
} else if (!CheckRoomFlag(2)) {
index = 3;
SetRoomFlag(2);
} else {
index = 4;
ClearRoomFlag(0);
ClearRoomFlag(1);
ClearRoomFlag(2);
}
} else {
index = 0;
}
MessageNoOverlap(messageIndices[index], this);
}
void Librari_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.draw = TRUE;
InitAnimationForceUpdate(this, 9);
} else {
UpdateAnimationSingleFrame(this);
}
}
|