Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CMode::ScreenShot()
- {
- if ( m_screenShotNow )
- {
- const char *week[] =
- {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
- char msg[128];
- GetLocalTime(&st);
- sprintf(msg, "%d/%02d/%02d/%s %02d: %02d: %02d",
- st.wYear, st.wMonth, st.wDay, week[st.wDayOfWeek], st.wHour, st.wMinute, st.wSecond);
- CRenderer::TextOutScreen(5, g_renderer->m_height - 16, msg, 0x000000);
- CRenderer::TextOutScreen(3, g_renderer->m_height - 16, msg, 0x000000);
- CRenderer::TextOutScreen(4, g_renderer->m_height - 15, msg, 0x000000);
- CRenderer::TextOutScreen(4, g_renderer->m_height - 17, msg, 0x000000);
- CRenderer::TextOutScreen(4, g_renderer->m_height - 16, msg, 0xFFFFFF);
- m_screenShotNow = false;
- char tmp[2048]
- sprintf(tmp, "%s\\ScreenShot", g_baseDir3);
- if (!access(tmp, 0) || !_mkdir(tmp))
- {
- auto serverName = X; // the global with the name of the char server is just.. X
- for (auto it = serverName.begin(); it != serverName.end(); ++it)
- {
- if (*it == '\\'
- || *it == '/'
- || *it == ':'
- || *it == '*'
- || *it == '?'
- || *it == '"'
- || *it == '<'
- || *it == '>'
- || *it == '|')
- *it = '_';
- }
- bool isCtrl = !(GetAsyncKeyState(VK_CONTROL) >> 8);
- auto serverNamePtr = serverName.c_str();
- CBitmapRes resLogo = g_resMgr->Get("scr_logo.bmp");
- //captureCnt is a global that states how many screens have been saved so far (but it's never initialized until a screenshot is taken)
- int ssIndex = captureCnt++;
- if (isCtrl)
- {
- sprintf(tmp, "%s\\ScreenShot\\screen%s%03d.jpg", g_baseDir3, serverNamePtr, ssIndex);
- while (!access(tmp, 0))
- {
- ssIndex = captureCnt++;
- sprintf(tmp, "%s\\ScreenShot\\screen%s%03d.jpg", g_baseDir3, serverNamePtr, ssIndex);
- }
- g_renderer->SaveJPG(tmp, resLogo);
- }
- else
- {
- sprintf(tmp, "%s\\ScreenShot\\screen%s%03d.bmp", g_baseDir3, serverNamePtr, ssIndex);
- while (!access(tmp, 0))
- {
- ssIndex = captureCnt++;
- sprintf(tmp, "%s\\ScreenShot\\screen%s%03d.bmp", g_baseDir3, serverNamePtr, ssIndex);
- }
- g_renderer->SaveBmp(tmp, resLogo);
- }
- auto screenShotMsg = new std::string(tmp, strlen(tmp)); // i dont know why they use new and delete here
- screenShotMsg.append(" is Saved.");
- g_renderer->SendMsg(UIM_PUSHINTOCHATHISTORY, screenShotMsg.c_str(), 0x00FF00);
- delete screenShotMsg;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement