blob: 83c217e9993e14e863b315bbca8fb6e0dfc8a146 (
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
|
#pragma once
#include <string>
#include "Globals.h"
#include "Utils/StringHelper.h"
class ZNames
{
public:
static std::string GetObjectName(size_t id)
{
if (id >= Globals::Instance->cfg.objectList.size())
return StringHelper::Sprintf("0x%04X", id);
return Globals::Instance->cfg.objectList[id];
}
static std::string GetActorName(uint16_t id)
{
switch (Globals::Instance->game)
{
case ZGame::OOT_RETAIL:
case ZGame::OOT_SW97:
if (id < ZNames::GetNumActors())
return Globals::Instance->cfg.actorList[id];
else
return StringHelper::Sprintf("0x%04X", id);
case ZGame::MM_RETAIL:
{
int32_t flags = id & 0xF000;
id &= 0xFFF;
std::string name;
if (id < ZNames::GetNumActors())
name = Globals::Instance->cfg.actorList[id];
else
name = StringHelper::Sprintf("0x%04X", id);
if (flags == 0)
return name;
else
return StringHelper::Sprintf("%s | 0x%04X", name.c_str(), flags);
}
}
return "";
}
static std::string GetEntranceName(uint16_t id)
{
if (ZNames::GetNumEntrances() == 0 || ZNames::GetNumSpecialEntrances() == 0)
return StringHelper::Sprintf("0x%04X", id);
if (id < ZNames::GetNumEntrances())
return Globals::Instance->cfg.entranceList[id];
else if ((id >= 0x7FF9 && id <= 0x7FFF) &&
!((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances
return Globals::Instance->cfg.specialEntranceList[id - 0x7FF9];
else
return StringHelper::Sprintf("0x%04X", id);
}
static size_t GetNumActors() { return Globals::Instance->cfg.actorList.size(); }
static size_t GetNumEntrances() { return Globals::Instance->cfg.entranceList.size(); }
static size_t GetNumSpecialEntrances()
{
return Globals::Instance->cfg.specialEntranceList.size();
}
};
|