Show kcommandprocessor.cpp syntax highlighted
/*
Copyright (C) 2003, 2004, 2005 by Luca Cappa
Written by Luca Cappa groton@users.sourceforge.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "cssysdef.h"
#include "csver.h"
#include "csutil/sysfunc.h"
#include "csutil/cscolor.h"
#include "csutil/cmdhelp.h"
#include "csutil/cspmeter.h"
#include "csutil/csstring.h"
#include "csutil/scfstr.h"
#include "csutil/xmltiny.h"
#include "csutil/schedule.h"
#include "csutil/array.h"
#include "csgfx/memimage.h"
#include "csgfx/rgbpixel.h"
#include "cstool/csview.h"
#include "cstool/initapp.h"
#include "cstool/collider.h"
#include "cstool/cspixmap.h"
#include "iutil/vfs.h"
#include "iutil/eventq.h"
#include "iutil/event.h"
#include "iutil/objreg.h"
#include "iutil/csinput.h"
#include "iutil/virtclk.h"
#include "iutil/plugin.h"
#include "iutil/string.h"
#include "iutil/pluginconfig.h"
#include "iengine/sector.h"
#include "iengine/engine.h"
#include "iengine/camera.h"
#include "iengine/light.h"
#include "iengine/texture.h"
#include "iengine/mesh.h"
#include "iengine/movable.h"
#include "iengine/material.h"
#include "imesh/thing.h"
#include "imesh/object.h"
#include "imesh/sprite3d.h"
#include "ivideo/graph3d.h"
#include "ivideo/graph2d.h"
#include "ivideo/natwin.h"
#include "ivideo/txtmgr.h"
#include "ivideo/texture.h"
#include "ivideo/material.h"
#include "ivideo/fontserv.h"
#include "igraphic/imageio.h"
#include "imap/loader.h"
#include "ivaria/reporter.h"
#include "ivaria/stdrep.h"
#include "ivaria/conout.h"
#include "ivaria/reporter.h"
#include "ivaria/stdrep.h"
#include "ivaria/collider.h"
#include "csgeom/quaterni.h"
#include "csgeom/transfrm.h"
#include "csgeom/math3d_d.h"
#include "csgeom/math3d.h"
#include "igeom/polymesh.h"
#include "iaws/aws.h"
#include "iaws/awscnvs.h"
#include "iaws/awsparm.h"
#include "isense/iisensetracker.h"
#include "korientation.h"
#include "kblock.h"
#include "kmap.h"
#include "Kblockid.h"
#include "ksprite3d.h"
#include "ksprite3dlist.h"
#include "klandmark.h"
#include "klandmarklist.h"
#include "kdragmanager.h"
#include "kwireframe.h"
#include "kmousemanager.h"
#include "kappstate.h"
#include "skybox.h"
#include "kcamera.h"
#include "kdata.h"
#include "kdatalist.h"
#include "kthing.h"
#include "kobject3d.h"
#include "kmission.h"
#include "kpath.h"
#include "ske.h"
#include "kkeystate.h"
#include "ksign.h"
#include "kplayer.h"
#include "kutil.h"
#include "kkeys.h"
#include "ksaveddatamanager.h"
#include "klight.h"
#include "klightlist.h"
//Include for this file!
#include "kcommandprocessor.h"
// Static KCommandProcessor variables
iEngine* KCommandProcessor::s_engine = 0;
iCamera* KCommandProcessor::s_camera = 0;
iGraphics3D* KCommandProcessor::s_g3d = 0;
csStringHash KCommandProcessor::s_cmdSet;
iConsoleOutput* KCommandProcessor::s_console = 0;
iFile* KCommandProcessor::s_script = 0;
// Additional command handler
KCommandProcessor::CmdHandler KCommandProcessor::s_extraHandler = 0;
//
//iConsoleExecCallback implementation.
SCF_IMPLEMENT_IBASE (KCommandProcessor::PerformCallback)
SCF_IMPLEMENTS_INTERFACE (iConsoleExecCallback)
SCF_IMPLEMENT_IBASE_END
//
//Enumeration of the SKE commands.
enum
{
//CS related commands.
KCMD_MESH_LIST,
KCMD_LIGHT_LIST,
//landmarks commands.
KCMD_LOAD_LANDMARKS,
KCMD_SAVE_LANDMARKS,
//level commands.
KCMD_LOAD_LEVEL,
KCMD_SAVE_LEVEL,
KCMD_RESIZE_LEVEL,
//mission commands.
KCMD_END_MISSION,//Stop recording mission.
KCMD_STOPSAVE_MISSION,//Save the recorded datas.
KCMD_START_MISSION,
//editing commands
KCMD_SET_LIGHTMAPPING,
KCMD_PUT_BLOCK,
KCMD_SET_SKYBOX_VISIBLE,
//initial positions commands.
KCMD_DELETE_INIT_POS,
KCMD_LOAD_INIT_POS,
KCMD_SAVE_INIT_POS,
//player commands.
KCMD_ROTATE_LEFT,
KCMD_ROTATE_RIGHT,
KCMD_MOVE_FORWARD,
KCMD_MOVE_BACKWARD,
KCMD_LOOK_UPDOWN,
KCMD_LOOK_LEFTRIGHT,
KCMD_BEND_LEFTRIGHT,
//camera commands.
KCMD_CAMERA_MOVE_LEFT,
KCMD_CAMERA_MOVE_RIGHT,
KCMD_CAMERA_MOVE_FORWARD,
KCMD_CAMERA_MOVE_BACKWARD,
KCMD_CAMERA_ZOOM_INOUT,
KCMD_CAMERA_ROTATE_X,
KCMD_CAMERA_ROTATE_Y,
KCMD_CAMERA_ROTATE_Z,
KCMD_CAMERAMODE_TOGGLE,
KCMD_CAMERA_PANORAMIC_TOGGLE,
//replay commands
KCMD_REPLAY,
KCMD_END_REPLAY,
KCMD_START_REPLAY,
//light commands.
KCMD_DESTROY_LIGHT,
KCMD_ADD_LIGHT,
KCMD_RELIGHT,
//general commands.
KCMD_VERSION,
KCMD_QUIT,
KCMD_HELP,
KCMD_CONSOLE,
KCMD_GUI_TOGGLE,
KCMD_REPLAYGUI_TOGGLE,
KCMD_CANVAS_HIDDEN,
KCMD_CANVAS_EXPOSED,
KCMD_BIND,//Bind a string with a keyboard's key.
};
void KCommandProcessor::PerformCallback::Execute (const char* p_command)
{
KCommandProcessor::_PerformLine (p_command);
}
void KCommandProcessor::Initialize (iCamera* p_camera, iConsoleOutput*
p_console)
{
csRef<iEngine> l_e = CS_QUERY_REGISTRY (g_objReg, iEngine);
KCommandProcessor::s_engine = l_e;
csRef<iGraphics3D> l_g3d = CS_QUERY_REGISTRY (g_objReg, iGraphics3D);
KCommandProcessor::s_g3d = l_g3d;
KCommandProcessor::s_camera = p_camera;
KCommandProcessor::s_console = p_console;
s_cmdSet.Register ("mesh_list", KCMD_MESH_LIST);
s_cmdSet.Register ("light_list", KCMD_LIGHT_LIST);
s_cmdSet.Register ("load_landmarks", KCMD_LOAD_LANDMARKS);
s_cmdSet.Register ("save_landmarks", KCMD_SAVE_LANDMARKS);
s_cmdSet.Register ("load_level", KCMD_LOAD_LEVEL);
s_cmdSet.Register ("save_level", KCMD_SAVE_LEVEL);
s_cmdSet.Register ("resize_level", KCMD_RESIZE_LEVEL);
s_cmdSet.Register ("end_mission", KCMD_END_MISSION);
s_cmdSet.Register ("stopsave_mission", KCMD_STOPSAVE_MISSION);
s_cmdSet.Register ("start_mission", KCMD_START_MISSION);
s_cmdSet.Register ("set_lightmapping", KCMD_SET_LIGHTMAPPING);
s_cmdSet.Register ("put_block", KCMD_PUT_BLOCK);
s_cmdSet.Register ("set_skybox_visible", KCMD_SET_SKYBOX_VISIBLE);
s_cmdSet.Register ("delete_initpos", KCMD_DELETE_INIT_POS);
s_cmdSet.Register ("load_initpos", KCMD_LOAD_INIT_POS);
s_cmdSet.Register ("save_initpos", KCMD_SAVE_INIT_POS);
//player commands.
s_cmdSet.Register ("rotate_left", KCMD_ROTATE_LEFT);
s_cmdSet.Register ("rotate_right", KCMD_ROTATE_RIGHT);
s_cmdSet.Register ("move_forward", KCMD_MOVE_FORWARD);
s_cmdSet.Register ("move_backward", KCMD_MOVE_BACKWARD);
s_cmdSet.Register ("look_updown", KCMD_LOOK_UPDOWN);
s_cmdSet.Register ("look_leftright", KCMD_LOOK_LEFTRIGHT);
s_cmdSet.Register ("bend_leftright", KCMD_BEND_LEFTRIGHT);
//camera commands.
s_cmdSet.Register ("camera_move_left", KCMD_CAMERA_MOVE_LEFT);
s_cmdSet.Register ("camera_move_right", KCMD_CAMERA_MOVE_RIGHT);
s_cmdSet.Register ("camera_move_forward", KCMD_CAMERA_MOVE_FORWARD);
s_cmdSet.Register ("camera_move_backward", KCMD_CAMERA_MOVE_BACKWARD);
s_cmdSet.Register ("camera_zoom_inout", KCMD_CAMERA_ZOOM_INOUT);
s_cmdSet.Register ("camera_rotate_x", KCMD_CAMERA_ROTATE_X);
s_cmdSet.Register ("camera_rotate_y", KCMD_CAMERA_ROTATE_Y);
s_cmdSet.Register ("camera_rotate_z", KCMD_CAMERA_ROTATE_Z);
s_cmdSet.Register ("cameramode_toggle", KCMD_CAMERAMODE_TOGGLE);
s_cmdSet.Register ("camera_panoramic_toggle", KCMD_CAMERA_PANORAMIC_TOGGLE);
//replay commands.
s_cmdSet.Register ("replay", KCMD_REPLAY);
s_cmdSet.Register ("end_replay", KCMD_END_REPLAY);
s_cmdSet.Register ("start_replay", KCMD_START_REPLAY);
//light commands.
s_cmdSet.Register ("destroy_light", KCMD_DESTROY_LIGHT);
s_cmdSet.Register ("add_light", KCMD_ADD_LIGHT);
s_cmdSet.Register ("relight", KCMD_RELIGHT);
//general commands.
s_cmdSet.Register ("version", KCMD_VERSION);
s_cmdSet.Register ("quit", KCMD_QUIT);
s_cmdSet.Register ("help", KCMD_HELP);
s_cmdSet.Register ("console", KCMD_CONSOLE);
s_cmdSet.Register ("gui_toggle", KCMD_GUI_TOGGLE);
s_cmdSet.Register ("replaygui_toggle", KCMD_REPLAYGUI_TOGGLE);
s_cmdSet.Register ("canvas_hidden", KCMD_CANVAS_HIDDEN);
s_cmdSet.Register ("canvas_exposed", KCMD_CANVAS_EXPOSED);
s_cmdSet.Register ("bind", KCMD_BIND);
}
bool KCommandProcessor::PerformLine (const char* p_line)
{
return KCommandProcessor::_PerformLine (p_line);
}
static int ValueChoice (const char* p_arg, int p_oldValue,
const char* const* p_choices, int p_num)
{
if (!p_arg)
return -1;
int l_i = 0;
if (!strcasecmp (p_arg, "next"))
return (p_oldValue + 1) % p_num;
if (!strcasecmp (p_arg, "prev"))
return (p_oldValue - 1 + p_num) % p_num;
while (p_choices[l_i])
{
if (!strcasecmp (p_choices[l_i], p_arg))
return l_i;
l_i++;
}
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "Expected one of the following:");
l_i = 0;
while (p_choices[l_i])
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
" %s%s", p_choices[l_i], l_i == p_oldValue ? " (current)" : "");
l_i++;
}
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, " or 'next' or 'prev'");
return -1;
}
static bool YesOrNo (const char* p_arg, bool p_oldValue, bool& p_newValue)
{
if (!p_arg)
return false;
//Test for p_arg == '0'
if (*p_arg == '0' && *(p_arg+1) == 0)
{
p_newValue = false;
return true;
}//if
//Test for p_arg == '1'
if (*p_arg == '1' && *(p_arg+1) == 0)
{
p_newValue = true;
return true;
}//if
//Test for arg == "yes", "true", "on", "enable", "enabled".
if (!strcasecmp (p_arg, "yes") || !strcasecmp (p_arg, "true") ||
!strcasecmp (p_arg, "on") || !strcasecmp (p_arg, "enable") ||
!strcasecmp (p_arg, "enabled"))
{
p_newValue = true;
return true;
}//if
//Test for arg == "no", "false", "off", "disable", "disabled".
if (!strcasecmp (p_arg, "no") || !strcasecmp (p_arg, "false") ||
!strcasecmp (p_arg, "off") || !strcasecmp (p_arg, "disable") ||
!strcasecmp (p_arg, "disabled"))
{
p_newValue = false;
return true;
}//if
if (!strcasecmp (p_arg, "toggle") || !strcasecmp (p_arg, "toggled"))
{
p_newValue = !p_oldValue;
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_WARNING,
"Expected: enable, disable, enabled, disabled, yes, true, on, 1, no,\
false, off, 0, toggle or toggled!");
return false;
}
static const char* SayOnOrOff (int p_arg)
{
if (p_arg)
return "on";
return "off";
}
/*
* Standard processing to change/display a boolean value setting.
*/
void KCommandProcessor::ChangeBoolean (const char* p_arg, bool* p_value,
const char* p_what)
{
if (p_arg)
{
// Change value
bool l_newValue;
bool l_v = YesOrNo (p_arg, *p_value, l_newValue);
if (l_v)
{
*p_value = l_newValue;
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Set %s %s", p_what, SayOnOrOff (*p_value));
}//if
}//if
else
{
// Show value
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Current %s is %s", p_what, SayOnOrOff (*p_value));
}
}
//???ACTUALLY NOT USED
/*
//
//Standard processing to change/display a multi-value setting.
//
void KCommandProcessor::ChangeChoice (const char* arg, int* value, const char* what,
const char* const* choices, int num)
{
if (arg)
{
// Change value
int v = ValueChoice (arg, *value, choices, num);
if (v != -1)
{
*value = v;
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Set %s %s", what, choices[*value]);
}
}
else
{
// Show value
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Current %s is %s", what, choices[*value]);
}
}
//
//Standard processing to change/display a floating point setting.
//Return true if value changed.
//
bool KCommandProcessor::ChangeFloat (const char* arg, float* value, const char* what,
float min, float max)
{
if (arg)
{
// Change value.
float g;
if ((*arg == '+' || *arg == '-') && *(arg+1) == *arg)
{
float dv;
sscanf (arg+1, "%f", &dv);
g = *value+dv;
}
else sscanf (arg, "%f", &g);
if (g < min || g > max) g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Bad value for %s (%f <= value <= %f)!", what, min, max);
else
{
*value = g;
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Set %s to %f", what, *value);
return true;
}
}
else
{
// Show value.
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Current %s is %f", what, *value);
}
return false;
}
//
//Standard processing to change/display an integer setting.
//Return true if value changed.
//
bool KCommandProcessor::ChangeInt (const char* arg, int* value, const char* what,
int min, int max)
{
if (arg)
{
// Change value.
int g;
if ((*arg == '+' || *arg == '-') && *(arg+1) == *arg)
{
int dv;
sscanf (arg+1, "%d", &dv);
g = *value+dv;
}
else sscanf (arg, "%d", &g);
if (g < min || g > max)
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Bad value for %s (%d <= value <= %d)!", what, min, max);
else
{
*value = g;
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Set %s to %d", what, *value);
return true;
}
}
else
{
// Show value.
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Current %s is %d", what, *value);
}
return false;
}
//
//Standard processing to change/display a long setting.
//Return true if value changed.
//
bool KCommandProcessor::ChangeLong (const char* arg, long* value, const char* what,
long min, long max)
{
if (arg)
{
// Change value.
long g;
if ((*arg == '+' || *arg == '-') && *(arg+1) == *arg)
{
long dv;
sscanf (arg+1, "%ld", &dv);
g = *value+dv;
}
else sscanf (arg, "%ld", &g);
if (g < min || g > max) g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Bad value for %s (%ld <= value <= %ld)!", what, min, max);
else
{
*value = g;
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Set %s to %ld", what, *value);
return true;
}
}
else
{
// Show value.
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Current %s is %ld", what, *value);
}
return false;
}
*/
bool KCommandProcessor::_PerformLine (const char* line)
{
char cmd[512], arg[255];
if (*line == ';') return true; // Comment
if (*line == 0) return true; // Empty line
strcpy (cmd, line);
char* space = strchr (cmd, ' ');
if (space) { *space = 0; strcpy (arg, space+1); }
else *arg = 0;
return _Perform (cmd, *arg ? arg : (char*)NULL);
}
extern bool GetConfigOption (iBase* plugin, const char* optName, csVariant& optValue);
extern void SetConfigOption (iBase* plugin, const char* optName, const char* optValue);
extern void SetConfigOption (iBase* plugin, const char* optName, csVariant& optValue);
static char s_cmd [2048];
bool KCommandProcessor::_PerformFormat (const char* p_format, ...)
{
va_list l_list;
va_start (l_list, p_format);
ZeroMemory (s_cmd, sizeof(s_cmd));
vsprintf (s_cmd, p_format, l_list);
bool l_retVal = KCommandProcessor::_PerformLine (s_cmd);
va_end (l_list);
return l_retVal;
}
bool KCommandProcessor::_Perform (const char* cmd, const char* arg)
{
//Print out the command we are issuing.
if (arg != 0)
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "> %s %s", cmd, arg);
else
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "> %s", cmd);
if (s_extraHandler)
{
bool ret = s_extraHandler (cmd, arg);
if (ret)
return true;
}//if
switch (s_cmdSet.Request (cmd))
{
case KCMD_VERSION:
{
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY, "%s", CS_VERSION);
break;
};
case KCMD_CONSOLE:
{
if (s_console)
{
bool l_active = s_console->GetVisible ();
ChangeBoolean (arg, &l_active, "console");
if (l_active != s_console->GetVisible ())
s_console->SetVisible (l_active);
}//if
break;
};
case KCMD_LIGHT_LIST:
{
if (s_console)
{
s_console->PutText ("Light list:\n");
csRef<iLightIterator> l_lI = KCommandProcessor::s_engine->GetLightIterator ();
while (l_lI->HasNext ())
{
csRef<iLight> l_light = l_lI->Next ();
s_console->PutText (l_light->QueryObject ()->GetName ());
s_console->PutText ("\n");
}//while
}//if
break;
}//case
case KCMD_MESH_LIST:
{
if (s_console)
{
s_console->PutText ("Mesh list:\n");
csRef<iMeshList> l_mL = KCommandProcessor::s_engine->GetMeshes ();
int i;
for (i = 0; i < l_mL->GetCount (); i++)
{
csRef<iMeshWrapper> l_mesh = l_mL->Get (i);
s_console->PutText (l_mesh->QueryObject ()->GetName ());
s_console->PutText ("\n");
}//for
}//if
break;
}//case
default:
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "Unknown command: `%s'", cmd);
return false;
}//default
}//switch
return true;
}
bool KCommandProcessor::StartScript (const char* scr)
{
bool ok = false;
csRef<iVFS> v (CS_QUERY_REGISTRY (g_objReg, iVFS));
if (v)
{
if (v->Exists (scr))
{
csRef<iFile> f (v->Open (scr, VFS_FILE_READ));
if (!f)
g_ske->Report (CS_REPORTER_SEVERITY_NOTIFY,
"Could not open script file '%s'!", scr);
else
{
//
// Replace possible running script with this one.
if (s_script)
s_script->DecRef ();
s_script = f;
//
//Since s_script is "static", and static var could not be csref safely, then
//we do on it IncRef/DecRef manually.
s_script->IncRef ();
ok = true;
}//else
}//if
}//if
return ok;
}
bool KCommandProcessor::GetScriptLine (char* buf, int nbytes)
{
if (!s_script)
return false;
char c = '\n';
while (c == '\n' || c == '\r')
if (!s_script->Read(&c, 1))
break;
if (s_script->AtEOF ())
{
s_script = 0;
return false;
}//if
char* p = buf;
const char* plim = p + nbytes - 1;
while (p < plim)
{
if (c == '\n' || c == '\r')
break;
*p++ = c;
if (!s_script->Read(&c, 1))
break;
}//while
*p = '\0';
return true;
}
bool SKE::CommandHandlerBridge (const char *cmd, const char *arg)
{
return g_ske->CommandHandler (cmd, arg);
}
bool SKE::CommandHandler (const char *cmd, const char *arg)
{
int l_cmd = KCommandProcessor::s_cmdSet.Request (cmd);
switch (l_cmd)
{
case KCMD_HELP:
{
//?????????????????KCommandProcessor::_Perform (cmd, arg);
# undef CONPRI
# define CONPRI(m) Report (CS_REPORTER_SEVERITY_NOTIFY, m);
CONPRI("-*- Additional commands -*-");
CONPRI("Visibility:");
CONPRI(" db_frustum farplane");
CONPRI("Lights:");
CONPRI(" addlight dellight dellights");
CONPRI(" clrlights setlight");
CONPRI("Views:");
CONPRI(" split_view unsplit_view toggle_view");
CONPRI("Movement:");
CONPRI(" step_forward step_backward strafe_left strafe_right");
CONPRI(" look_up look_down rotate_left rotate_right jump move3d");
CONPRI(" i_forward i_backward i_left i_right i_up i_down i_rotleftc");
CONPRI(" i_rotleftw i_rotrightc i_rotrightw i_rotleftx i_rotleftz");
CONPRI(" i_rotrightx i_rotrightz do_gravity colldet freelook");
CONPRI("Statistics:");
CONPRI(" stats perftest coordshow");
CONPRI("Special effects:");
CONPRI(" addbot delbot addskel addghost fire explosion spiral frain rain");
CONPRI(" snow fountain flame portal fs_inter fs_fadeout fs_fadecol");
CONPRI(" fs_fadetxt fs_red fs_green fs_blue fs_whiteout fs_shadevert");
CONPRI("Debugging:");
CONPRI(" hi zbuf debug0 debug1 debug2 palette bugplug");
CONPRI(" db_boxshow db_boxcam1 db_boxcam2 db_boxsize1 db_boxsize2");
CONPRI(" db_radstep db_radhi db_radtodo");
CONPRI("Meshes:");
CONPRI(" loadmesh addmesh delmesh listmeshes");
CONPRI(" listactions setaction setmotion");
CONPRI("Various:");
CONPRI(" coordsave coordload bind p_alpha s_fog");
CONPRI(" snd_play snd_volume record play clrrec saverec");
CONPRI(" loadrec action plugins conflist confset");
# undef CONPRI
break;
}//case
case KCMD_SET_SKYBOX_VISIBLE:
{
/*
'set_skybox_visible true/false'
*/
if (arg == 0)
return true;
bool l_newVal;
if (YesOrNo (arg, !g_ske->m_skyBox->IsInvisible (), l_newVal))
m_skyBox->SetInvisible(l_newVal);
}//case
case KCMD_DELETE_INIT_POS:
{
/*
'delete_initpos initial_position_name'
*/
if (arg == 0)
return true;
char l_initPosName[256];
sscanf (arg, "%s", (char*)&l_initPosName);
scfString l_error;
if (!g_ske->m_savedDataMan->RemoveInitPos (l_initPosName,
&l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error removing initial position %s (%s) !",
l_initPosName, l_error.GetData ());
return true;
}//if
//
//Call the updating of the dialog.
PlConfUpdate ();
break;
}//case
case KCMD_LOAD_INIT_POS:
{
/*
'load_initpos initial_position_name'
*/
if (arg == 0)
return true;
char l_initPosName[256];
sscanf (arg, "%s", &l_initPosName);
scfString l_error;
if (!g_ske->m_savedDataMan->RetrieveInitPos (l_initPosName, &g_ske->m_initPos,
&l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error loading initial position called '%s' (%s) !",
l_initPosName, l_error.GetData ());
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Successfully loaded the initial position called '%s' !",
l_initPosName);
//Call the updating of the dialog.
PlConfUpdate ();
break;
}
case KCMD_SAVE_INIT_POS:
{
/*
'save_initpos initial_position_name'
*/
if (arg == 0)
return true;
char l_initPosName[256];
sscanf (arg, "%s", &l_initPosName);
scfString l_error;
if (!g_ske->m_savedDataMan->AddInitPos (l_initPosName,
&g_ske->m_initPos, &l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error saving initial position called '%s' (%s) !",
l_initPosName, l_error.GetData ());
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Saved successfully the initial position called '%s' !",
l_initPosName);
//Call the updating of the dialog.
PlConfUpdate();
break;
}//case
case KCMD_START_REPLAY:
{
/*
'start_replay xml_file_name'
*/
if (g_ske->m_appState != KAppState::EDITING)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"You can't switch to REPLAY mode when you are not in EDITING mode!");
return true;
}//if
if (arg == 0)
return true;
char l_xmlFileName[1024];
sscanf (arg, "%s", &l_xmlFileName);
csRef<iDataBuffer> lBuffer = g_ske->m_vfs->ReadFile (l_xmlFileName,
false);
if (0 == lBuffer)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"File %s does not exist !", l_xmlFileName);
return true;
}//if
//
//Parse the XML file.
csRef<iDocumentSystem> l_xml (CS_QUERY_REGISTRY (g_objReg,
iDocumentSystem));
if (!l_xml)
l_xml = csPtr<iDocumentSystem> (new csTinyDocumentSystem ());
csRef<iDocument> l_doc = l_xml->CreateDocument ();
const char* l_error = l_doc->Parse (lBuffer);
if (0 != l_error)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error parsing %s (%s) !", l_xmlFileName, l_error);
return true;
}//if
csRef<iDocumentNode> l_node = l_doc->GetRoot ();
//???UGLY CODE BEGINS...
csRef<iDocumentNodeIterator> l_dNI = l_node->GetNodes
("FreeWalkingMission");
csRef<iDocumentNode> l_missionNode = l_dNI->Next ();
if (0 != l_missionNode)
{
//?? this 2 lines above assume only one <FreeWalkingMission> tag is present.
CS_ASSERT (false == l_dNI->HasNext ());
g_ske->m_mission.AttachNew (new KFreeWalkingMission());
csRef<iKFreeWalkingMission> l_m =
SCF_QUERY_INTERFACE (g_ske->m_mission, iKFreeWalkingMission);
l_m->ReadAdditionalInfo (l_missionNode);
}//if
l_dNI = l_node->GetNodes ("NotFreeWalkingMission");
l_missionNode = l_dNI->Next ();
if (0 != l_missionNode)
{
//?? this 2 lines above assume only one <NotFreeWalkingMission> tag is present.
CS_ASSERT (l_dNI->HasNext () == false);
g_ske->m_mission.AttachNew (new KNotFreeWalkingMission());
csRef<iKNotFreeWalkingMission> l_m =
SCF_QUERY_INTERFACE (g_ske->m_mission, iKNotFreeWalkingMission);
l_m->ReadAdditionalInfo (l_missionNode);
}//if
l_dNI = l_node->GetNodes ("TargetingMission");
l_missionNode = l_dNI->Next ();
if (0 != l_missionNode)
{
//?? this 2 lines above assume only one <TargetingMission> tag is present.
CS_ASSERT (l_dNI->HasNext () == false);
g_ske->m_mission.AttachNew (new KTargetingMission ());
csRef<iKTargetingMission> l_m =
SCF_QUERY_INTERFACE (g_ske->m_mission, iKTargetingMission);
l_m->ReadAdditionalInfo (l_missionNode);
}//if
l_dNI = l_node->GetNodes ("PointingMission");
l_missionNode = l_dNI->Next ();
if (l_missionNode != 0)
{
//?? this 2 lines above assume only one <Mission> tag is present.
CS_ASSERT (l_dNI->HasNext () == false);
g_ske->m_mission.AttachNew (new KPointingTargetMission ());
csRef<iKPointingTargetMission> l_m =
SCF_QUERY_INTERFACE (g_ske->m_mission, iKPointingTargetMission);
l_m->ReadAdditionalInfo (l_missionNode);
}//if
//???UGLY CODE ENDS...
//
//Load the mission.
l_dNI = l_node->GetNodes ("Mission");
l_missionNode = l_dNI->Next ();
//?? this 2 lines above assume only one <Mission> tag is present.
CS_ASSERT (false == l_dNI->HasNext ());
csRef<iKMission> l_kM = SCF_QUERY_INTERFACE (g_ske->m_mission,
iKMission);
//??????UGLY BEGINS!
l_kM->SetMap (g_ske->m_map);
l_kM->SetLandmarks (g_ske->m_listLM);
l_kM->SetInitPosition (&g_ske->m_initPos);
//??????UGLY ENDS!
l_kM->LoadMissionInfo (l_missionNode);
//???
g_ske->m_walkedPath = new KPath ();
g_ske->m_walkedPath->SetName ("WalkedPath");
g_ske->m_walkedPath->SetDefaultMaterialForLineDrawing ("yellow");
KDataList* l_l = l_kM->GetDataList ();
int i;
for (i = 0; i < l_l->GetCount (); i++)
g_ske->m_walkedPath->AddPoint (l_l->Get (i)->GetPosition ().x,
l_l->Get (i)->GetPosition ().z);
g_ske->m_walkedPath->SetBallInvisible (true);
g_ske->m_walkedPath->Init (g_ske->m_player->m_mov3d.GetMaxVelocity ());
//
//Switch app state.
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Switching to REPLAY mode.");
g_ske->m_appState = KAppState::REPLAY;
//Switch camera state.
g_ske->m_kcam->SetState (THIRD);
//
//Reset the timer and the velocity.
g_ske->m_replayMsecs = 0;
g_ske->m_replaySpeed = 0;
//
//Relight the map.
//??Do not relight map automatically, never!
/*KCommandProcessor::_PerformLine ("relight");
KCommandProcessor::_PerformLine ("set_lightmapping enabled");*/
//
//Hide the mouse!
m_mouseManager->SetMode (HIDING_MODE);
break;
}//case
case KCMD_END_REPLAY:
{
/*
'end_replay'
*/
if (g_ske->m_appState != KAppState::REPLAY)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"You can't end a RELAY which never started!");
return true;
}//if
//
//Switch application mode.
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Switching to EDITING mode.");
g_ske->m_appState = KAppState::EDITING;
//
//Show the mouse!
m_mouseManager->SetMode (PUTTING_BLOCK_MODE);
//Destroy the path.
delete g_ske->m_walkedPath;
g_ske->m_walkedPath = 0;
break;
}//case
case KCMD_ADD_LIGHT:
{
/*
'add_light light_name x y z radius red green blue dyn attenuation'
*/
if (arg == 0)
return true;
char l_lightName[128];
csVector3 l_pos;
float l_radius;
csColor l_color;
int l_dynType, l_attenuation;
sscanf (arg, "%s %f %f %f %f %f %f %f %d %d", &l_lightName, &l_pos.x,
&l_pos.y, &l_pos.z, &l_radius, &l_color.red, &l_color.green,
&l_color.blue, &l_dynType, &l_attenuation);
//
//Create the mesh for the light.
csRef<KLight> l_light;
l_light.AttachNew (new KLight ());
l_light->Create (l_lightName, l_pos, l_radius, l_color,
(csLightDynamicType)l_dynType, (csLightAttenuationMode)l_attenuation);
//Add the light to the lights' list.
g_ske->m_map->AddLight (l_light);
LightUpdate ();
return true;
}//case;
case KCMD_DESTROY_LIGHT:
{
/*
'destroy_light light_name'
*/
if (arg == 0)
return true;
char l_lightName[128];
sscanf (arg, "%s", &l_lightName);
KLight* l_light = g_ske->m_map->GetLightList ()->FindByName
(l_lightName);
if (l_light == 0)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"The light called '%s' does not exist !!",
l_lightName);
return true;
}//if
//Remove the light from the lights' list.
g_ske->m_map->RemoveLight (l_light);
break;
}//case
case KCMD_RELIGHT:
{
/*
'relight'
*/
g_ske->m_engine->ForceRelight ();
g_ske->m_map->GetFlags ().Reset (KMap::KMAP_NEED_RELIGHTING);
//??UGLY HACK!
KCommandProcessor::_PerformLine ("set_lightmapping enabled");
break;
}//case
case KCMD_LOAD_LANDMARKS:
{
/*
'load_landmarks landmarks_list_name'
*/
if (arg == 0)
return true;
char l_lmsName[128];
sscanf (arg, "%s", &l_lmsName);
scfString l_error;
if (!g_ske->m_savedDataMan->RetrieveLandmarksList (l_lmsName,
g_ske->m_listLM, &l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error loading landmarks list %s (%s) !",
l_lmsName, l_error.GetData ());
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Successfully loaded the landmark list called '%s' !",
l_lmsName);
//
//call the updating of the dialog.
LMUpdate();
MUpdate();
return true;
}//case
case KCMD_SAVE_LANDMARKS:
{
/*
save_landmarks landmarks_list_name
*/
if (arg == 0)
return true;
char l_lmsName[128];
sscanf (arg, "%s", &l_lmsName);
//??pretty ugly
//Set the name fo the landmark.
g_ske->m_listLM->SetName (l_lmsName);
scfString l_error;
if (!g_ske->m_savedDataMan->AddLandmarksList (l_lmsName,
g_ske->m_listLM, &l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error saving landmarks list %s (%s) !",
l_lmsName, l_error.GetData ());
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Saved successfully the landmarks list called '%s' !",
l_lmsName);
//call the updating of the dialog.
LMUpdate();
return true;
}//case
case KCMD_SAVE_LEVEL:
{
/*
save_level levelname
*/
if (arg == 0)
return true;
char l_levelName[128];
sscanf (arg, "%s", &l_levelName);
//
//Set the name of the map.
g_ske->m_map->SetName (l_levelName);
scfString l_error;
if (!g_ske->m_savedDataMan->AddLevel (g_ske->m_map->GetName (),
g_ske->m_map, &l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Error saving level %s (%s) !",
l_levelName, l_error.GetData ());
return true;
}//if
csReport(g_objReg,CS_REPORTER_SEVERITY_NOTIFY,
"crystalspace.application.SKE","Saved successfully the level called '%s' !", l_levelName);
//call the updating of the dialog.
EditorUpdate();
break;
}//case
case KCMD_LOAD_LEVEL:
{
/*
load_level levelname
*/
if (arg == 0)
return true;
char l_levelName[128];
sscanf (arg, "%s", &l_levelName);
scfString l_error;
if (!g_ske->m_savedDataMan->RetrieveLevel (l_levelName, g_ske->m_map,
&l_error))
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "Error loading level %s (%s) !",
l_levelName, l_error.GetData ());
return true;
}//if
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Successfully loaded level called '%s' !", l_levelName);
//
//When a level is loaded, update the lights' listbox.
LightUpdate ();
return true;
}//case
case KCMD_RESIZE_LEVEL:
{
int lX, lY;
sscanf (arg, "%d %d", &lX, &lY);
g_ske->m_map->Resize (csVector2 (lX, lY));
break;
}//case
case KCMD_PUT_BLOCK:
{
char l_blockIdName[128];
int l_x, l_y;
char l_orientation[128];
sscanf (arg, "%s %d %d %s", &l_blockIdName, &l_x, &l_y, &l_orientation);
//
//If the block has been put, then disable lightmap.
if (g_ske->m_map->PutBlock (KBlockId::GetByName (l_blockIdName), l_x, l_y,
KOrientation::GetByName (l_orientation)))
KCommandProcessor::_PerformLine ("set_lightmapping disabled");
break;
}//case
case KCMD_SET_LIGHTMAPPING:
{
char l_enable[128];
sscanf (arg, "%s", &l_enable);
bool l_active;
if (YesOrNo (l_enable, m_g3d->GetRenderState
(G3DRENDERSTATE_LIGHTINGENABLE), l_active));
{
m_g3d->SetRenderState (G3DRENDERSTATE_LIGHTINGENABLE, l_active);
if (!l_active)
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "%s %s.",
"disabled", "lightmapping");
}//if
else
{
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "%s %s.",
"enabled", "lightmapping");
}//else
}//if
break;
}//case
//
//Exit the application.
case KCMD_QUIT:
{
csRef<iEventQueue> q (CS_QUERY_REGISTRY (g_objReg, iEventQueue));
if (q)
q->GetEventOutlet()->Broadcast (cscmdQuit);
break;
}//case
case KCMD_REPLAY:
{
if (m_appState != KAppState::REPLAY)
return true;
float l_speedFactor = 0;
int l_down = 0;
sscanf (arg, "%f %d", &l_speedFactor, &l_down);
if (l_down == 0)
m_replaySpeed = 0.0f;
else
{
if (m_kbd->GetKeyState (CSKEY_SHIFT))
l_speedFactor *= 2.0f;
m_replaySpeed = l_speedFactor;
}//else
break;
}
/*//?? THIS IS RELATED TO OUTPUTCONSOLE! case KCMD_CONSOLE_TOGGLE:
{
//toggle visibility of the console output.
bool l_visible = m_consoleOutput->GetVisible ();
m_consoleOutput->SetVisible (!l_visible);
break;
}*/
//
//Camera commands.
case KCMD_CAMERA_ROTATE_X:
{
if (strchr (arg, '0') != 0)
m_kcam->RotateX (0);
else if (!m_kbd->GetKeyState (CSKEY_SHIFT))
m_kcam->RotateX (1);
else
m_kcam->RotateX (-1);
break;
}
case KCMD_CAMERA_ROTATE_Y:
{
if (strchr (arg, '0') != NULL)
m_kcam->RotateY (0);
else if (!m_kbd->GetKeyState (CSKEY_SHIFT))
m_kcam->RotateY (1);
else
m_kcam->RotateY (-1);
break;
}
case KCMD_CAMERA_ROTATE_Z:
{
if (strchr (arg, '0') != NULL)
m_kcam->RotateZ (0);
else if (!m_kbd->GetKeyState (CSKEY_SHIFT))
m_kcam->RotateZ (1);
else
m_kcam->RotateZ (-1);
break;
}
case KCMD_CAMERA_ZOOM_INOUT:
{
if (arg)
{
if (strchr (arg, '0'))
{
if (strchr (arg, '+'))
m_kcam->ZoomIn (false);
else
m_kcam->ZoomOut (false);
}//if
else
{
if (strchr (arg, '+'))
m_kcam->ZoomIn (true);
else
m_kcam->ZoomOut (true);
}//if
}//if
break;
}
case KCMD_CAMERA_MOVE_FORWARD:
{
if (m_appState != KAppState::EDITING)
return true;
if (strchr (arg, '0') != NULL)
m_kcam->MoveForward (false);
else
m_kcam->MoveForward (true);
break;
}//case
case KCMD_CAMERA_MOVE_BACKWARD:
{
if (m_appState != KAppState::EDITING)
return true;
if (strchr (arg, '0') != NULL)
m_kcam->MoveBack (false);
else
m_kcam->MoveBack (true);
break;
}//case
case KCMD_CAMERA_MOVE_RIGHT:
{
if (m_appState != KAppState::EDITING)
return true;
if (strchr (arg, '0') != NULL)
m_kcam->MoveRight (false);
else
m_kcam->MoveRight (true);
break;
}//case
case KCMD_CAMERA_MOVE_LEFT:
{
if (m_appState != KAppState::EDITING)
return true;
if (strchr (arg, '0') != NULL)
m_kcam->MoveLeft (false);
else
m_kcam->MoveLeft (true);
break;
}//case
//
//Player commands.
case KCMD_MOVE_FORWARD:
{
if (m_appState != KAppState::WALKING)
return true;
if (strchr (arg, '0') != NULL)
Key_Forward = false;
else
Key_Forward = true;
break;
}
case KCMD_MOVE_BACKWARD:
{
if (m_appState != KAppState::WALKING)
return true;
if (strchr (arg, '0') != NULL)
Key_Back = false;
else
Key_Back = true;
break;
}
case KCMD_ROTATE_LEFT:
{
if (m_appState != KAppState::WALKING)
return true;
if (strchr (arg, '0') != NULL)
Key_Left = false;
else
Key_Left = true;
break;
}
case KCMD_ROTATE_RIGHT:
{
if (m_appState != KAppState::WALKING)
return true;
if (strchr (arg, '0') != NULL)
Key_Right = false;
else
Key_Right = true;
break;
}
case KCMD_LOOK_UPDOWN:
{
if ((m_appState != KAppState::STANDING) &&
(m_appState != KAppState::WALKING))
return true;
if (strchr (arg, '0'))
{
if (strchr (arg, '+'))
Key_LookUp = false;
else
Key_LookDown = false;
}//if
else
{
if (strchr (arg, '+'))
Key_LookUp = true;
else
Key_LookDown = true;
}//else
break;
}
case KCMD_LOOK_LEFTRIGHT:
{
if ((m_appState != KAppState::STANDING) &&
(m_appState != KAppState::WALKING))
return true;
if (strchr (arg, '0') != NULL)
{
if (strchr (arg, '-') )
Key_LookLeft = false;
else
Key_LookRight = false;
}//if
else
{
if (strchr (arg, '-') )
Key_LookLeft = true;
else
Key_LookRight = true;
}//else
break;
}//case
case KCMD_BEND_LEFTRIGHT:
{
if ((m_appState != KAppState::STANDING) &&
(m_appState != KAppState::WALKING))
return true;
if (strchr (arg, '0') != NULL)
{
if (strchr (arg, '-') )
Key_BendLeft = false;
else
Key_BendRight = false;
}//if
else
{
if (strchr (arg, '-') )
Key_BendLeft = true;
else
Key_BendRight = true;
}//else
break;
}//case
case KCMD_STOPSAVE_MISSION:
{
if (m_appState != KAppState::STANDING)
return true;
StopSaveMission (g_ske, NULL);//??? simulate a trigger call.
m_appState = KAppState::EDITING;
m_sign->SetDisplay (KSign::NONE);
return true;
}//case
case KCMD_START_MISSION:
{
if (m_appState != KAppState::POINTINGBEFOREWALKING)
return false;
m_sign->SetDisplay (KSign::NONE);
//
//Switch to WALKING state.
m_appState = KAppState::WALKING;
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Mode switched to WALKING.");
//start the recording.
m_mission->StartRecording (200);//200ms, that is 1/5 second.
//?? Reset the time when the mission start. Please, put this resetting in the proper place!
m_timePassed = 0;
//
//Set the right camera state
m_kcam->SetState (FIRST);
//
//Reset somehow the movement of the player.
ResetActions ();//???UGLY!
m_player->m_mov3d.SetVelocity (csVector3 (0));//???UGLY!
return true;
}
case KCMD_GUI_TOGGLE:
{
if (m_plConfWnd->isHidden())
{
//
//call all the needed xxxUpdate ();
PlConfUpdate ();
KUpdate ();
EditorUpdate ();
LMUpdate ();
PathUpdate ();
MUpdate ();
LightUpdate ();
m_plConfWnd->Show();//show the window.
}//if
else
{
m_plConfWnd->Hide();//hide the window.
}//else
return true;
}
case KCMD_REPLAYGUI_TOGGLE:
{
if (m_replayWnd->isHidden())
{
//
//call all the needed xxxUpdate ();
ReplayUpdate ();
m_replayWnd->Show();//show the window.
}//if
else
m_replayWnd->Hide();//hide the window.
return true;
}
case KCMD_END_MISSION:
{
if (m_appState != KAppState::WALKING)
return false;
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"Switching to STANDING mode.");
//DISPLAY AN IMAGE SAYING: "missione terminata".
m_sign->SetDisplay (KSign::MISSION_TERMINATED);
m_appState = KAppState::STANDING;
if (m_mission->GetCollectingData ())
{
m_mission->StopRecording ();
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "Mission recording ended!");
}//if
else
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY, "Mission ended!");
break;
}//else
case KCMD_CAMERA_PANORAMIC_TOGGLE:
{
if (arg == 0)
return true;
bool lNewVal;
if (YesOrNo (arg, m_kcam->IsPanoramic (), lNewVal))
m_kcam->SetPanoramic (lNewVal);
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
lNewVal ? "Panoramic View activated." :
"Panoramic View disactivated.");
return true;
}//case
case KCMD_CAMERAMODE_TOGGLE:
{
if (m_appState == KAppState::EDITING)
{
//
//Notify the command has no effect in this mode!
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
"You cannot change the camera viewing mode in editing mode !");
return true;
}//if
//
//Switch the camera mode.
int l_mode = m_kcam->SwitchPersonState ();
SKE::Report (CS_REPORTER_SEVERITY_NOTIFY,
l_mode == FIRST ? "View switched to FIRST_PERSON" :
"View switched to THIRD_PERSON");
return true;
}//case
case KCMD_CANVAS_EXPOSED:
{
m_backgrounded = false;
#ifdef CS_DEBUG
Report (CS_REPORTER_SEVERITY_NOTIFY, "canvas exposed!");
#endif
break;
}//case
case KCMD_CANVAS_HIDDEN:
{
m_backgrounded = true;
ResetActions ();
#ifdef CS_DEBUG
Report (CS_REPORTER_SEVERITY_NOTIFY, "canvas hidden!");
#endif
break;
}//case
case KCMD_BIND:
{
BindKey (arg);
break;
}
default:
return false;
}//switch
return true;
}
See more files for this project here