Commit 0cf2937f authored by wind2009's avatar wind2009

Merge remote-tracking branch 'salix5/patch-data1' into develop

parents 221d8332 f7e6b52c
......@@ -292,95 +292,81 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
else
return unknown_string;
}
const wchar_t* DataManager::FormatAttribute(int attribute) {
wchar_t* p = attBuffer;
unsigned filter = 1;
int i = 1010;
for(; filter != 0x80; filter <<= 1, ++i) {
if(attribute & filter) {
BufferIO::CopyWStrRef(GetSysString(i), p, 16);
*p = L'|';
*++p = 0;
std::wstring DataManager::FormatAttribute(unsigned int attribute) const {
std::wstring buffer;
for (int i = 0; i < ATTRIBUTES_COUNT; ++i) {
if (attribute & (0x1U << i)) {
buffer.append(GetSysString(1010 + i));
buffer.push_back(L'|');
}
}
if(p != attBuffer)
*(p - 1) = 0;
else
return unknown_string;
return attBuffer;
if (buffer.empty())
return std::wstring(unknown_string);
buffer.pop_back();
return buffer;
}
const wchar_t* DataManager::FormatRace(int race) {
wchar_t* p = racBuffer;
unsigned filter = 1;
int i = 1020;
for(; filter < (1 << RACES_COUNT); filter <<= 1, ++i) {
if(race & filter) {
BufferIO::CopyWStrRef(GetSysString(i), p, 16);
*p = L'|';
*++p = 0;
std::wstring DataManager::FormatRace(unsigned int race) const {
std::wstring buffer;
for(int i = 0; i < RACES_COUNT; ++i) {
if(race & (0x1U << i)) {
buffer.append(GetSysString(1020 + i));
buffer.push_back(L'|');
}
}
if(p != racBuffer)
*(p - 1) = 0;
else
return unknown_string;
return racBuffer;
if (buffer.empty())
return std::wstring(unknown_string);
buffer.pop_back();
return buffer;
}
const wchar_t* DataManager::FormatType(int type) {
wchar_t* p = tpBuffer;
unsigned filter = 1;
std::wstring DataManager::FormatType(unsigned int type) const {
std::wstring buffer;
int i = 1050;
for(; filter != 0x8000000; filter <<= 1, ++i) {
if(type & filter) {
BufferIO::CopyWStrRef(GetSysString(i), p, 16);
*p = L'|';
*++p = 0;
for (unsigned filter = TYPE_MONSTER; filter <= TYPE_LINK; filter <<= 1, ++i) {
if (type & filter) {
buffer.append(GetSysString(i));
buffer.push_back(L'|');
}
}
if(p != tpBuffer)
*(p - 1) = 0;
else
return unknown_string;
return tpBuffer;
if (buffer.empty())
return std::wstring(unknown_string);
buffer.pop_back();
return buffer;
}
const wchar_t* DataManager::FormatSetName(const uint16_t setcode[]) {
wchar_t* p = scBuffer;
std::wstring DataManager::FormatSetName(const uint16_t setcode[]) const {
std::wstring buffer;
for(int i = 0; i < 10; ++i) {
if (!setcode[i])
break;
const wchar_t* setname = GetSetName(setcode[i]);
if(setname) {
BufferIO::CopyWStrRef(setname, p, 32);
*p = L'|';
*++p = 0;
buffer.append(setname);
buffer.push_back(L'|');
}
}
if(p != scBuffer)
*(p - 1) = 0;
else
return unknown_string;
return scBuffer;
if (buffer.empty())
return std::wstring(unknown_string);
buffer.pop_back();
return buffer;
}
const wchar_t* DataManager::FormatLinkMarker(int link_marker) {
wchar_t* p = lmBuffer;
*p = 0;
if(link_marker & LINK_MARKER_TOP_LEFT)
BufferIO::CopyWStrRef(L"[\u2196]", p, 4);
if(link_marker & LINK_MARKER_TOP)
BufferIO::CopyWStrRef(L"[\u2191]", p, 4);
if(link_marker & LINK_MARKER_TOP_RIGHT)
BufferIO::CopyWStrRef(L"[\u2197]", p, 4);
if(link_marker & LINK_MARKER_LEFT)
BufferIO::CopyWStrRef(L"[\u2190]", p, 4);
if(link_marker & LINK_MARKER_RIGHT)
BufferIO::CopyWStrRef(L"[\u2192]", p, 4);
if(link_marker & LINK_MARKER_BOTTOM_LEFT)
BufferIO::CopyWStrRef(L"[\u2199]", p, 4);
if(link_marker & LINK_MARKER_BOTTOM)
BufferIO::CopyWStrRef(L"[\u2193]", p, 4);
if(link_marker & LINK_MARKER_BOTTOM_RIGHT)
BufferIO::CopyWStrRef(L"[\u2198]", p, 4);
return lmBuffer;
std::wstring DataManager::FormatLinkMarker(unsigned int link_marker) const {
std::wstring buffer;
if (link_marker & LINK_MARKER_TOP_LEFT)
buffer.append(L"[\u2196]");
if (link_marker & LINK_MARKER_TOP)
buffer.append(L"[\u2191]");
if (link_marker & LINK_MARKER_TOP_RIGHT)
buffer.append(L"[\u2197]");
if (link_marker & LINK_MARKER_LEFT)
buffer.append(L"[\u2190]");
if (link_marker & LINK_MARKER_RIGHT)
buffer.append(L"[\u2192]");
if (link_marker & LINK_MARKER_BOTTOM_LEFT)
buffer.append(L"[\u2199]");
if (link_marker & LINK_MARKER_BOTTOM)
buffer.append(L"[\u2193]");
if (link_marker & LINK_MARKER_BOTTOM_RIGHT)
buffer.append(L"[\u2198]");
return buffer;
}
uint32 DataManager::CardReader(uint32 code, card_data* pData) {
if (!dataManager.GetData(code, pData))
......
......@@ -32,11 +32,11 @@ public:
const wchar_t* GetSetName(int code) const;
std::vector<unsigned int> GetSetCodes(std::wstring setname) const;
const wchar_t* FormatLocation(int location, int sequence) const;
const wchar_t* FormatAttribute(int attribute);
const wchar_t* FormatRace(int race);
const wchar_t* FormatType(int type);
const wchar_t* FormatSetName(const uint16_t setcode[]);
const wchar_t* FormatLinkMarker(int link_marker);
std::wstring FormatAttribute(unsigned int attribute) const;
std::wstring FormatRace(unsigned int race) const;
std::wstring FormatType(unsigned int type) const;
std::wstring FormatSetName(const uint16_t setcode[]) const;
std::wstring FormatLinkMarker(unsigned int link_marker) const;
std::unordered_map<unsigned int, std::wstring> _counterStrings;
std::unordered_map<unsigned int, std::wstring> _victoryStrings;
......@@ -47,11 +47,8 @@ public:
string_pointer strings_begin;
string_pointer strings_end;
wchar_t attBuffer[128]{};
wchar_t racBuffer[128]{};
wchar_t tpBuffer[128]{};
wchar_t scBuffer[128]{};
wchar_t lmBuffer[32]{};
wchar_t numStrings[301][4]{};
wchar_t numBuffer[6]{};
static byte scriptBuffer[0x20000];
static const wchar_t* unknown_string;
......
......@@ -1288,8 +1288,9 @@ void Game::DrawDeckBd() {
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
if(!(ptr->second.type & TYPE_LINK)) {
const wchar_t* form = L"\u2605";
if(ptr->second.type & TYPE_XYZ) form = L"\u2606";
myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), form, ptr->second.level);
if(ptr->second.type & TYPE_XYZ)
form = L"\u2606";
myswprintf(textBuffer, L"%ls/%ls %ls%d", dataManager.FormatAttribute(ptr->second.attribute).c_str(), dataManager.FormatRace(ptr->second.race).c_str(), form, ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0 && ptr->second.defense < 0)
myswprintf(textBuffer, L"?/?");
......@@ -1299,7 +1300,7 @@ void Game::DrawDeckBd() {
myswprintf(textBuffer, L"%d/?", ptr->second.attack);
else myswprintf(textBuffer, L"%d/%d", ptr->second.attack, ptr->second.defense);
} else {
myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute), dataManager.FormatRace(ptr->second.race), ptr->second.level);
myswprintf(textBuffer, L"%ls/%ls LINK-%d", dataManager.FormatAttribute(ptr->second.attribute).c_str(), dataManager.FormatRace(ptr->second.race).c_str(), ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.attack < 0)
myswprintf(textBuffer, L"?/-");
......@@ -1320,8 +1321,8 @@ void Game::DrawDeckBd() {
} else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
const wchar_t* ptype = dataManager.FormatType(ptr->second.type);
DrawShadowText(textFont, ptype, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
auto ptype = dataManager.FormatType(ptr->second.type);
DrawShadowText(textFont, ptype.c_str(), Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
textBuffer[0] = 0;
if((ptr->second.ot & AVAIL_OCGTCG) == AVAIL_OCG)
wcscat(textBuffer, L"[OCG]");
......
......@@ -1104,7 +1104,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break;
}
case HINT_RACE: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatRace(data));
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatRace(data).c_str());
mainGame->AddLog(textBuffer);
mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
......@@ -1114,7 +1114,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break;
}
case HINT_ATTRIB: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatAttribute(data));
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatAttribute(data).c_str());
mainGame->AddLog(textBuffer);
mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
......
......@@ -1600,7 +1600,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf(formatBuffer, L"\nLINK-%d", mcard->link);
str.append(formatBuffer);
}
myswprintf(formatBuffer, L" %ls/%ls", dataManager.FormatRace(mcard->race), dataManager.FormatAttribute(mcard->attribute));
myswprintf(formatBuffer, L" %ls/%ls", dataManager.FormatRace(mcard->race).c_str(), dataManager.FormatAttribute(mcard->attribute).c_str());
str.append(formatBuffer);
if(mcard->location == LOCATION_HAND && (mcard->type & TYPE_PENDULUM)) {
myswprintf(formatBuffer, L"\n%d/%d", mcard->lscale, mcard->rscale);
......@@ -1626,9 +1626,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else if(mcard->cHint == CHINT_CARD)
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(212), dataManager.GetName(mcard->chValue));
else if(mcard->cHint == CHINT_RACE)
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(213), dataManager.FormatRace(mcard->chValue));
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(213), dataManager.FormatRace(mcard->chValue).c_str());
else if(mcard->cHint == CHINT_ATTRIBUTE)
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(214), dataManager.FormatAttribute(mcard->chValue));
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(214), dataManager.FormatAttribute(mcard->chValue).c_str());
else if(mcard->cHint == CHINT_NUMBER)
myswprintf(formatBuffer, L"\n%ls%d", dataManager.GetSysString(215), mcard->chValue);
str.append(formatBuffer);
......
......@@ -624,14 +624,14 @@ bool Game::Initialize() {
wANAttribute->setVisible(false);
for(int filter = 0x1, i = 0; i < 7; filter <<= 1, ++i)
chkAttribute[i] = env->addCheckBox(false, rect<s32>(10 + (i % 4) * 80, 25 + (i / 4) * 25, 90 + (i % 4) * 80, 50 + (i / 4) * 25),
wANAttribute, CHECK_ATTRIBUTE, dataManager.FormatAttribute(filter));
wANAttribute, CHECK_ATTRIBUTE, dataManager.FormatAttribute(filter).c_str());
//announce race
wANRace = env->addWindow(rect<s32>(480, 200, 850, 410), false, dataManager.GetSysString(563));
wANRace->getCloseButton()->setVisible(false);
wANRace->setVisible(false);
for(int filter = 0x1, i = 0; i < RACES_COUNT; filter <<= 1, ++i)
chkRace[i] = env->addCheckBox(false, rect<s32>(10 + (i % 4) * 90, 25 + (i / 4) * 25, 100 + (i % 4) * 90, 50 + (i / 4) * 25),
wANRace, CHECK_RACE, dataManager.FormatRace(filter));
wANRace, CHECK_RACE, dataManager.FormatRace(filter).c_str());
//selection hint
stHintMsg = env->addStaticText(L"", rect<s32>(500, 60, 820, 90), true, false, 0, -1, false);
stHintMsg->setBackgroundColor(0xc0ffffff);
......@@ -763,13 +763,13 @@ bool Game::Initialize() {
cbAttribute->setMaxSelectionRows(10);
cbAttribute->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(dataManager.FormatAttribute(filter), filter);
cbAttribute->addItem(dataManager.FormatAttribute(filter).c_str(), filter);
stRace = env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 195, 60 + 75 / 6), wFilter, COMBOBOX_RACE);
cbRace->setMaxSelectionRows(10);
cbRace->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter < (1 << RACES_COUNT); filter <<= 1)
cbRace->addItem(dataManager.FormatRace(filter), filter);
cbRace->addItem(dataManager.FormatRace(filter).c_str(), filter);
stAttack = env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter, EDITBOX_INPUTS);
ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
......@@ -1586,7 +1586,7 @@ void Game::ShowCardInfo(int code, bool resize) {
}
if (target->second.setcode[0]) {
offset = 23;// *yScale;
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(target->second.setcode));
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(target->second.setcode).c_str());
stSetName->setText(formatBuffer);
}
else
......@@ -1597,7 +1597,7 @@ void Game::ShowCardInfo(int code, bool resize) {
}
if(is_valid && cit->second.type & TYPE_MONSTER) {
auto& cd = cit->second;
myswprintf(formatBuffer, L"[%ls] %ls/%ls", dataManager.FormatType(cd.type), dataManager.FormatRace(cd.race), dataManager.FormatAttribute(cd.attribute));
myswprintf(formatBuffer, L"[%ls] %ls/%ls", dataManager.FormatType(cd.type).c_str(), dataManager.FormatRace(cd.race).c_str(), dataManager.FormatAttribute(cd.attribute).c_str());
stInfo->setText(formatBuffer);
int offset_info = 0;
irr::core::dimension2d<unsigned int> dtxt = guiFont->getDimension(formatBuffer);
......@@ -1625,7 +1625,7 @@ void Game::ShowCardInfo(int code, bool resize) {
else
myswprintf(adBuffer, L"%d/- ", cd.attack);
wcscat(formatBuffer, adBuffer);
wcscat(formatBuffer, dataManager.FormatLinkMarker(cd.link_marker));
wcscat(formatBuffer, dataManager.FormatLinkMarker(cd.link_marker).c_str());
}
if(cd.type & TYPE_PENDULUM) {
wchar_t scaleBuffer[16];
......@@ -1645,9 +1645,9 @@ void Game::ShowCardInfo(int code, bool resize) {
}
else {
if (is_valid)
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cit->second.type));
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cit->second.type).c_str());
else
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(0));
myswprintf(formatBuffer, L"[%ls]", dataManager.unknown_string);
stInfo->setText(formatBuffer);
stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60, 296 * xScale, 60 + offset));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment