Commit 6ba6f21d authored by D-AIRY's avatar D-AIRY

cvarlist command; rus text in console

parent 2d4478bd
......@@ -421,6 +421,12 @@ void cmd_help(int argc, const char ** argv)
}
}
void DumpCVars();
void cmd_cvarlist(int argc, const char ** argv)
{
DumpCVars();
}
void ConsoleRegisterCmds()
{
Core_0RegisterConcmdArg("echo", echo, "Echoes all parameters to console");
......@@ -428,6 +434,7 @@ void ConsoleRegisterCmds()
Core_0RegisterConcmd("exit", cmd_exit, "Shuts down the engine");
Core_0RegisterConcmdArg("cvar_handle", cvar_handle, "Handle to show or set cvar value");
Core_0RegisterConcmdArg("help", cmd_help, "Handle to show command description");
Core_0RegisterConcmdArg("cvarlist", cmd_cvarlist, "List all CVars");
}
SX_LIB_API UINT_PTR Core_ConsoleGetOutHandler()
......
......@@ -21,6 +21,7 @@ SX_LIB_API void Core_0RegisterCVarString(const char * name, const char * value,
cv.value.c = new char[strlen(value) + 1];
strcpy((char*)cv.value.c, value);
cv.desc = NULL;
if(desc)
{
......@@ -47,6 +48,7 @@ SX_LIB_API void Core_0RegisterCVarInt(const char * name, int value, const char *
cv.default_val.i = value;
cv.value.i = value;
cv.desc = NULL;
if(desc)
{
......@@ -72,7 +74,7 @@ SX_LIB_API void Core_0RegisterCVarFloat(const char * name, float value, const ch
cv.default_val.f = value;
cv.value.f = value;
cv.desc = NULL;
if(desc)
{
cv.desc = new char[strlen(desc) + 1];
......@@ -97,6 +99,7 @@ SX_LIB_API void Core_0RegisterCVarBool(const char * name, bool value, const char
cv.default_val.b = value;
cv.value.b = value;
cv.desc = NULL;
if(desc)
{
......@@ -318,3 +321,61 @@ void SetCVar(const char * name, const char * value)
break;
}
}
void DumpCVars()
{
int iLenName = 0,
iLenType = 6,
iLenVal = 10;
for(AssotiativeArray<String, CVar>::Iterator i = g_mCVars.begin(); i; i++)
{
CVar * pCvar = i.second;
int len = i.first->length();
if(iLenName < len)
{
iLenName = len;
}
if(pCvar->type == CVAR_STRING)
{
len = strlen(pCvar->value.c);
if(iLenVal < len)
{
iLenVal = len;
}
}
}
char szRow[128];
sprintf(szRow, COLOR_LGREEN " %%%ds " COLOR_GRAY "| " COLOR_MAGENTA "%%%ds " COLOR_GRAY "|" COLOR_YELLOW " %%%ds " COLOR_GRAY "|" COLOR_GREEN " %%s" COLOR_RESET "\n", iLenName, iLenType, iLenVal);
printf(szRow, "Name", "Type", "Value", "Description");
char tmp[64];
char tmpName[64];
for(AssotiativeArray<String, CVar>::Iterator i = g_mCVars.begin(); i; i++)
{
CVar * pCvar = i.second;
sprintf(tmpName, "%s", i.first->c_str());
int j;
for(j = i.first->length(); j < iLenName; ++j)
{
tmpName[j] = ' ';
}
tmpName[j] = 0;
switch(pCvar->type)
{
case CVAR_STRING:
printf(szRow, tmpName, "string", pCvar->value.c, pCvar->desc ? pCvar->desc : "");
break;
case CVAR_INT:
sprintf(tmp, "%d", pCvar->value.i);
printf(szRow, tmpName, "int", tmp, pCvar->desc ? pCvar->desc : "");
break;
case CVAR_FLOAT:
sprintf(tmp, "%f", pCvar->value.f);
printf(szRow, tmpName, "float", tmp, pCvar->desc ? pCvar->desc : "");
break;
case CVAR_BOOL:
printf(szRow, tmpName, "bool", pCvar->value.b ? "true" : "false", pCvar->desc ? pCvar->desc : "");
break;
}
}
}
......@@ -188,7 +188,7 @@ void SkyXEngine_Init()
Core_0RegisterCVarFloat("main_rain_density", 1.f, 0);
Core_0RegisterCVarBool("main_thunderbolt", true, 0);
Core_0RegisterCVarFloat("weather_snd_volume", 1.f, 0);
Core_0RegisterCVarFloat("weather_snd_volume", 1.f, "Громкость звуков погоды");
Core_0RegisterCVarFloat("ambient_snd_volume", 1.f, 0);
static float3_t fog_color(0.5, 0.5, 0.5);
......@@ -288,12 +288,12 @@ void SkyXEngine_InitPaths()
void SkyXEngine_Render(DWORD timeDelta)
{
int64_t ttime;
// ?
//потеряно ли устройство или произошло изменение размеров?
if (GData::DXDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET || GData::ReSize)
{
//
//если не свернуто окно
if (!IsIconic(GData::Handle3D) && ((GData::HandleParent3D != 0 && !IsIconic(GData::HandleParent3D)) || GData::HandleParent3D == 0))
SXRenderFunc::ComDeviceLost(); //
SXRenderFunc::ComDeviceLost(); //пытаемся восстановить
return;
}
......@@ -349,20 +349,20 @@ void SkyXEngine_Render(DWORD timeDelta)
if (GData::FinalImage == DS_RT::ds_rt_ambient_diff || GData::FinalImage == DS_RT::ds_rt_specular || GData::FinalImage == DS_RT::ds_rt_scene_light_com)
{
//
//рендерим глубину от света
ttime = TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER));
SXRenderFunc::UpdateShadow(timeDelta);
SXRenderFunc::Delay::UpdateShadow += TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER)) - ttime;
}
// mrt
//рисуем сцену и заполняем mrt данными
ttime = TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER));
SXRenderFunc::BuildMRT(timeDelta);
SXRenderFunc::Delay::RenderMRT += TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER)) - ttime;
if (GData::FinalImage == DS_RT::ds_rt_ambient_diff || GData::FinalImage == DS_RT::ds_rt_specular || GData::FinalImage == DS_RT::ds_rt_scene_light_com)
{
//
//освещаем сцену
ttime = TimeGetMcsU(Core_RIntGet(G_RI_INT_TIMER_RENDER));
SXRenderFunc::ComLighting(timeDelta, true);
SXRenderFunc::UnionLayers();
......
......@@ -702,12 +702,14 @@ int main(int argc, char ** argv)
{
g_pColor = new ColorPrint();
g_hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleOutputCP(CP_UTF8);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(g_hStdOut, &csbi);
g_iCurColorBG = g_pColor->getDefaultBG();
g_iCurColorFG = g_pColor->getDefaultFG();
csbi.dwMaximumWindowSize.X;
csbi.dwMaximumWindowSize.Y;
SetColor(ANSI_LCYAN);
......
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