Shipwright/ZAPDTR/ZAPD/ZRoom/ZNames.h
louist103 f31a841789
ZAPD Update (#2851)
* git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/

subrepo:
  subdir:   "ZAPDTR"
  merged:   "6aa54a551"
upstream:
  origin:   "C:/ZeldaStuff/ZAPDTR"
  branch:   "rebase2"
  commit:   "6aa54a551"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* git subrepo clone --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/

subrepo:
  subdir:   "ZAPDTR"
  merged:   "88b012240"
upstream:
  origin:   "C:/ZeldaStuff/ZAPDTR"
  branch:   "rebase2"
  commit:   "88b012240"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Update (its broken)

* fix the enum

* git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR

subrepo:
  subdir:   "ZAPDTR"
  merged:   "b7b6e1c82"
upstream:
  origin:   "C:/ZeldaStuff/ZAPDTR/"
  branch:   "rebase2"
  commit:   "b7b6e1c82"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* New names for LUS actions

* git subrepo push --remote=C:/ZeldaStuff/ZAPDTR/ ZAPDTR

subrepo:
  subdir:   "ZAPDTR"
  merged:   "c5cfebeee"
upstream:
  origin:   "C:/ZeldaStuff/ZAPDTR/"
  branch:   "rebase2"
  commit:   "c5cfebeee"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* git subrepo clone (merge) --force --branch=rebase2 C:/ZeldaStuff/ZAPDTR ZAPDTR/

subrepo:
  subdir:   "ZAPDTR"
  merged:   "d5f4769b8"
upstream:
  origin:   "C:/ZeldaStuff/ZAPDTR"
  branch:   "rebase2"
  commit:   "d5f4769b8"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Fix missing commands in the exporter.

* Cleanups.

* git subrepo pull --force --remote=https://github.com/harbourmasters/ZAPDTR --branch=master ZAPDTR

subrepo:
  subdir:   "ZAPDTR"
  merged:   "d4c35b90a"
upstream:
  origin:   "https://github.com/harbourmasters/ZAPDTR"
  branch:   "master"
  commit:   "d4c35b90a"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Add unordered_map include to fix MacOS

* fix string_view

* Update Main.cpp

* fix string view

* So close I can almost taste it

* So close

* Fix missed git marker.

* Fix surface types and

* Update ZFile.cpp

* Delete Jenkinsfile

---------

Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-05-07 19:58:50 -04:00

65 lines
1.7 KiB
C++

#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(); }
};