Korean translation (84 source files, 876 lines): - Translated all EUC-KR/CP949 Korean developer comments to English across 84 source files in Gameleap/code/. Zero Korean bytes remain outside the intentional font-table headers (D3FFontEdit2/fontedit all.h etc.). - Comment markers: //상훈 앞/뒤 -> //sanghoon begin/end (Sang-hun's code region markers); //상훈짱 begin/end, //상훈.. variants; // 鉉 -> // hyun (second developer's markers); // 鉉 - start/end patterns. - Functional string translations in recscore.cpp (mw4 + mw4print copies): body-part return values (왼발/오른발/etc. -> Left Leg/Right Leg/etc.), kill-announcer format strings (~30 entries), and the nonmfc.h assert dialog. - GosView profiler: 킪 -> us (microseconds) in timing display strings. - Network/socket code (ctcl.cpp, mugsocs.h, ctime.cpp across Launcher/ MW4Application/MW4GameEd2/AnimScript): state-machine comments, socket ID comments, login/session management comments. - render.hpp CHSH_Device member comments; GUIRadarManager.cpp drawing routine comments; hudchat/hudcomp2/huddamage/hudmap/hudweapon/hudtarg HUD component comments. - DXRasterizer.cpp: cleaned residual U+FFFD replacement characters left from a prior partial encoding conversion. UTF-8 encoding cleanup (76+ files): - Latin-1 single bytes converted to proper UTF-8 multi-byte sequences: © (0xA9) in 3dsmax4/Maxscrpt Autodesk/Wainwright copyright headers, ® (0xAE) in gosHelp/Remote.cpp, · (0xB7) bullet points in ai command.hpp, Û (0xDB) in SafeChain_Test.cpp tool header, ß (0xDF) in AnimationSuite version strings (8 files). - Font lookup tables (D3FFontEdit2/, fontedit/ *.h) intentionally left as-is: raw byte values are C array data, not text. Language DLL: - Replaced Gameleap/mw4/Language.dll (original Korean binary) and MW4/Language.dll with freshly built English version from Language - Win32 English config (Language.dsp). Fixes Korean button labels in the GameOS exception/crash dialog (??? ??... / ?? / ??? were showing instead of More Details.../Continue/Exit).
192 lines
3.8 KiB
C++
192 lines
3.8 KiB
C++
#include "stdafx.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/*
|
|
BOOL IsLeapYear(int nYear)
|
|
{
|
|
// nYear is in Solar system, 1982...
|
|
if (nYear % 4 == 0) {
|
|
if (nYear % 100 == 0) {
|
|
if (nYear % 400 == 0) {
|
|
//...
|
|
return FALSE;
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
int GetDayEnd(int nYear, int nMonth)
|
|
{
|
|
int nDayEnd;
|
|
|
|
if (nMonth == 2) {
|
|
nDayEnd = 28;
|
|
if (IsLeapYear(nYear)) {
|
|
nDayEnd++;
|
|
} else {
|
|
// 28
|
|
}
|
|
} else {
|
|
nDayEnd = 30;
|
|
if ((nMonth == 1) || (nMonth == 3) || (nMonth == 5) || (nMonth == 7) || (nMonth == 8) || (nMonth == 10) || (nMonth == 12))
|
|
nDayEnd++; // 31
|
|
}
|
|
|
|
return nDayEnd;
|
|
}
|
|
|
|
long GetTotalSeconds(int nYear, int nMonth, int nDay)
|
|
{
|
|
// Seconds elapsed since 00:00:00 on the date nYear/nMonth/nDay...
|
|
ASSERT(nYear >= 1970);
|
|
ASSERT((1 <= nMonth) && (nMonth <= 12));
|
|
ASSERT(1 <= nDay);
|
|
ASSERT(nDay <= GetDayEnd(nYear, nMonth));
|
|
|
|
long lTotal = 0;
|
|
int nStart;
|
|
for(nStart = 1970; nStart < nYear; nStart++) {
|
|
int nDays = 365;
|
|
if (IsLeapYear(nStart)) {
|
|
nDays++;
|
|
}
|
|
lTotal += nDays * 24 * 60 * 60; // 24 hours * 60 min * 60 sec
|
|
}
|
|
for(nStart = 1; nStart < nMonth; nStart++) {
|
|
int nDayEnd = GetDayEnd(nYear, nStart);
|
|
lTotal += nDayEnd * 24 * 60 * 60; // 24 hours * 60 min * 60 sec
|
|
}
|
|
lTotal += (nDay - 1) * 24 * 60 * 60; // 24 hours * 60 min * 60 sec
|
|
|
|
return lTotal;
|
|
}
|
|
*/
|
|
BOOL CTimeDate::IsLeapYear(int nYear)
|
|
{
|
|
// nYear is in Solar system, 1982...
|
|
if (nYear % 4 == 0) {
|
|
if (nYear % 100 == 0) {
|
|
if (nYear % 400 == 0) {
|
|
//...
|
|
return FALSE;
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
long CTimeDate::GetCurrent()
|
|
{
|
|
CTimeDate t;
|
|
|
|
t.CurrentDate();
|
|
|
|
return t.m_lDate;
|
|
}
|
|
|
|
void CTimeDate::CurrentDate()
|
|
{
|
|
ASSERT(this);
|
|
time_t t;
|
|
struct tm* p;
|
|
|
|
time(&t);
|
|
p = localtime(&t);
|
|
|
|
m_lDate = 0;
|
|
m_LN.m_xDay = p->tm_mday - 1;
|
|
m_LN.m_xMonth = p->tm_mon;
|
|
m_LN.m_xYear = (p->tm_year + 1900) - TIMEDATE_YEAR_BASE;
|
|
//m_LN.m_xReserved = 0;
|
|
//m_LN.m_xLunar = 0;
|
|
//m_LN.m_xLeap = 0;
|
|
}
|
|
|
|
BOOL CTimeDate::GetDate(long lDate, BOOL bLunar/* = FALSE*/, BOOL bLeap/* = FALSE*/)
|
|
{
|
|
ASSERT(!bLunar && !bLeap); // not yet implemented...
|
|
|
|
int nDay = lDate % 100;
|
|
lDate /= 100;
|
|
int nMonth = lDate % 100;
|
|
lDate /= 100;
|
|
int nYear = lDate;
|
|
BOOL bLeapYear = IsLeapYear(nYear);
|
|
nYear -= TIMEDATE_YEAR_BASE;
|
|
if ((nYear < 0) || (nYear >= (1 << TIMEDATE_YEAR_BITS)))
|
|
return FALSE;
|
|
if (!((1 <= nMonth) && (nMonth <= 12))) {
|
|
return FALSE;
|
|
}
|
|
int nDayMax = 30;
|
|
switch(nMonth) {
|
|
case 1:
|
|
case 3:
|
|
case 5:
|
|
case 7:
|
|
case 8:
|
|
case 10:
|
|
case 12:
|
|
nDayMax++; // 31
|
|
break;
|
|
case 2:
|
|
nDayMax--; // 29
|
|
if (!bLeapYear) {
|
|
nDayMax--; // 28
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (!((1 <= nDay) && (nDay <= nDayMax))) {
|
|
return FALSE;
|
|
}
|
|
nMonth--;
|
|
nDay--;
|
|
|
|
m_lDate = 0;
|
|
m_LN.m_xYear = nYear;
|
|
m_LN.m_xMonth = nMonth;
|
|
m_LN.m_xDay = nDay;
|
|
//m_LN.m_xReserved = 0;
|
|
//m_LN.m_xLunar = 0;
|
|
//m_LN.m_xLeap = 0;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
long CTimeLong::GetCurrent()
|
|
{
|
|
CTimeLong t;
|
|
|
|
t.CurrentTime();
|
|
|
|
return t.m_lTime;
|
|
}
|
|
|
|
void CTimeLong::CurrentTime()
|
|
{
|
|
ASSERT(this);
|
|
time_t t;
|
|
|
|
time(&t);
|
|
|
|
m_lTime = t;
|
|
}
|
|
|
|
void CTimeLong::GetTime(tm& t) const
|
|
{
|
|
ASSERT(this);
|
|
t = *localtime(&m_lTime);
|
|
}
|
|
|