blob: 62ebb99c3d74c5a3c97abc967938a1158070e0dc (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#include "worldmap.h"
dWMHud_c *dWMHud_c::instance = 0;
dWMHud_c *dWMHud_c::build() {
OSReport("Creating WM_Hud\n");
void *buffer = AllocFromGameHeap1(sizeof(dWMHud_c));
dWMHud_c *c = new(buffer) dWMHud_c;
OSReport("Created WM_Hud @ %p\n", c);
instance = c;
return c;
}
dWMHud_c::dWMHud_c() {
layoutLoaded = false;
}
int dWMHud_c::onCreate() {
if (!layoutLoaded) {
bool gotFile = layout.loadArc("maphud.arc", false);
if (!gotFile)
return false;
layout.build("banner.brlyt");
layout.findTextBoxByName("T_area_01")->AllocStringBuffer(100);
layoutLoaded = true;
}
return true;
}
int dWMHud_c::onDelete() {
return layout.free();
}
int dWMHud_c::onExecute() {
layout.execAnimations();
layout.update();
return true;
}
int dWMHud_c::onDraw() {
layout.scheduleForDrawing();
return true;
}
void dWMHud_c::updateText() {
u16 newPointName[120];
OSReport("Updating text.\n");
// figure this out...
WMPathPoint *point = dScNewerWorldMap_c::instance->currentPoint;
OSReport("Obtained point: %p\n", point);
if (point->type == WMPathPoint::LEVEL_TYPE) {
OSReport("It's a level: %d, %d\n", point->params[0], point->params[1]);
LevelInfo *li = &dScNewerWorldMap_c::instance->levelInfo;
LevelInfo::Entry *entry = li->search(point->params[0] - 1, point->params[1] - 1);
OSReport("Got entry: %p\n", entry);
char *levelName = li->getNameForLevel(entry);
OSReport("Got name: %s\n", levelName);
OSReport("Length: %d\n", entry->nameLength);
// copy it
// I need to make this into a function.
for (int i = 0; i < 120 && i < entry->nameLength; i++) {
newPointName[i] = levelName[i];
}
newPointName[entry->nameLength] = 0;
} else {
OSReport("No name!\n");
newPointName[0] = 0;
}
nw4r::lyt::TextBox *t = layout.findTextBoxByName("T_area_01");
OSReport("TextBox: %p\n", t);
layout.findTextBoxByName("T_area_01")->SetString((wchar_t*)newPointName);
OSReport("Set it to T_area_01\n");
}
|