#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; static const char *brlanNames[3] = {"maphud_hitbutton.brlan", "maphud_in.brlan", "maphud_out.brlan"}; static const char *groupNames[4] = {"B01_Button", "B02_Button", "A00_Window", "A00_Window"}; bool output = layout.build("maphud.brlyt"); if (!IsWideScreen()) { layout.clippingEnabled = true; layout.clipX = 0; layout.clipY = 52; layout.clipWidth = 640; layout.clipHeight = 352; layout.layout.rootPane->scale.x = 0.7711f; layout.layout.rootPane->scale.y = 0.7711f; } layout.loadAnimations(brlanNames, 3); layout.loadGroups(groupNames, (int[4]){0, 0, 1, 2}, 4); layout.disableAllAnimations(); layout.enableNonLoopAnim(2); //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() { wchar_t newPointName[120]; // figure this out... WMPathPoint *point = dWMPathManager_c::instance->currentPoint; if (point->type == WMPathPoint::LEVEL_TYPE) { LevelInfo *li = &dScNewerWorldMap_c::instance->levelInfo; LevelInfo::Entry *entry = li->search(point->params[0] - 1, point->params[1] - 1); char *levelName = li->getNameForLevel(entry); // 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 { newPointName[0] = 0; } layout.findTextBoxByName("T_levelname_01")->SetString(newPointName); }