Commit e21988ae authored by Dark Zane's avatar Dark Zane Committed by GitHub

Merge branch 'fallenstardust:master' into master

parents a482ecf0 1cda9341
......@@ -15,7 +15,7 @@ inline void SetS3DVertex(S3DVertex* v, f32 x1, f32 y1, f32 x2, f32 y2, f32 z, f3
v[3] = S3DVertex(x2, y2, z, 0, 0, nz, SColor(255, 255, 255, 255), tu2, tv2);
}
void Game::SetCardS3DVertex() {
f32 defalutScale = (mainGame->xScale - mainGame->yScale) / 10;
f32 defalutScale = (mainGame->xScale - mainGame->yScale) / 9.5f;
ALOGD("cc drawing defalutScale = %f",defalutScale);
SetS3DVertex(matManager.vCardFront, -0.35f + defalutScale, -0.5f, 0.35f - defalutScale, 0.5f, 0, 1, 0, 0, 1, 1);
SetS3DVertex(matManager.vCardOutline, -0.375f + defalutScale, -0.54f, 0.37f - defalutScale, 0.54f, 0, 1, 0, 0, 1, 1);
......
......@@ -10,6 +10,8 @@
#include "netserver.h"
#include "single_mode.h"
#include <thread>
#include <string>
#include <regex>
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIComboBox.h>
......@@ -2064,15 +2066,47 @@ void Game::ClearChatMsg() {
chatTiming[i] = 0;
}
}
std::string WCharToUTF8(const wchar_t* input) {
std::string output;
if(input == nullptr) return output;
char buffer[1024];
wcstombs(buffer, input, 1024);
output = buffer;
return output;
}
void Game::AddDebugMsg(const char* msg) {
std::string message(msg);
unsigned int cardID = 0;
std::regex cardIdPattern(R"((\d{8}))");
auto words_begin = std::sregex_iterator(message.begin(), message.end(), cardIdPattern);
auto words_end = std::sregex_iterator();
for (std::sregex_iterator i = words_begin; i != words_end; ++i) {
std::smatch match = *i;
cardID = std::stoul(match.str());
break;
}
std::string cardName = "Unknown";
if(cardID != 0) {
cardName = WCharToUTF8(dataManager.GetName(cardID));
}
std::string fullMsg;
if(cardID != 0 && cardName != "???") {
fullMsg += cardName;
fullMsg += ":";
} else {
fullMsg += "";
}
fullMsg += message;
if (enable_log & 0x1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msg, wbuf);
BufferIO::DecodeUTF8(fullMsg.c_str(), wbuf);
AddChatMsg(wbuf, 9);
}
if (enable_log & 0x2) {
char msgbuf[1040];
std::snprintf(msgbuf, sizeof msgbuf, "[Script Error]: %s", msg);
std::snprintf(msgbuf, sizeof msgbuf, "[Script Error]: %s", fullMsg.c_str());
ErrorLog(msgbuf);
}
}
......
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