mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
add csrike source code
This commit is contained in:
+46
-11
@@ -199,7 +199,7 @@ CON_COMMAND( touch_show, "show button" )
|
||||
if( args.ArgC() >= 2 )
|
||||
gTouch.ShowButton( args[1] );
|
||||
else
|
||||
Msg( "Usage: touch_show <name>\n" );
|
||||
Msg( "Usage: touch_show <name>\n" );
|
||||
}
|
||||
|
||||
CON_COMMAND( touch_hide, "hide button" )
|
||||
@@ -225,12 +225,12 @@ CON_COMMAND( touch_writeconfig, "save current config" )
|
||||
gTouch.WriteConfig();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
CON_COMMAND( touch_loaddefaults, "generate config from defaults" )
|
||||
{
|
||||
|
||||
gTouch.ResetToDefaults();
|
||||
}
|
||||
|
||||
/*
|
||||
CON_COMMAND( touch_roundall, "round all buttons coordinates to grid" )
|
||||
{
|
||||
|
||||
@@ -255,16 +255,54 @@ CON_COMMAND( touch_fade, "start fade animation for selected buttons" )
|
||||
|
||||
CON_COMMAND( touch_toggleselection, "toggle visibility on selected button in editor" )
|
||||
{
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
void CTouchControls::ResetToDefaults()
|
||||
{
|
||||
rgba_t color(255, 255, 255, 155);
|
||||
char buf[MAX_PATH];
|
||||
|
||||
RemoveButtons();
|
||||
|
||||
Q_snprintf(buf, sizeof buf, "cfg/%s", TOUCH_DEFAULT_CFG);
|
||||
if( !filesystem->FileExists(buf) )
|
||||
{
|
||||
AddButton( "look", "", "_look", 0.5, 0, 1, 1, color, 0, 0, 0 );
|
||||
AddButton( "move", "", "_move", 0, 0, 0.5, 1, color, 0, 0, 0 );
|
||||
|
||||
AddButton( "use", "vgui/touch/use", "+use", 0.880000, 0.213333, 1.000000, 0.426667, color );
|
||||
AddButton( "jump", "vgui/touch/jump", "+jump", 0.880000, 0.462222, 1.000000, 0.675556, color );
|
||||
AddButton( "attack", "vgui/touch/shoot", "+attack", 0.760000, 0.583333, 0.880000, 0.796667, color );
|
||||
AddButton( "attack2", "vgui/touch/shoot_alt", "+attack2", 0.760000, 0.320000, 0.880000, 0.533333, color );
|
||||
AddButton( "duck", "vgui/touch/crouch", "+duck", 0.880000, 0.746667, 1.000000, 0.960000, color );
|
||||
AddButton( "tduck", "vgui/touch/tduck", ";+duck", 0.560000, 0.817778, 0.620000, 0.924444, color );
|
||||
AddButton( "zoom", "vgui/touch/zoom", "+zoom", 0.680000, 0.00000, 0.760000, 0.142222, color );
|
||||
AddButton( "speed", "vgui/touch/speed", "+speed", 0.180000, 0.568889, 0.280000, 0.746667, color );
|
||||
AddButton( "loadquick", "vgui/touch/load", "load quick", 0.760000, 0.000000, 0.840000, 0.142222, color );
|
||||
AddButton( "savequick", "vgui/touch/save", "save quick", 0.840000, 0.000000, 0.920000, 0.142222, color );
|
||||
AddButton( "reload", "vgui/touch/reload", "+reload", 0.000000, 0.320000, 0.120000, 0.533333, color );
|
||||
AddButton( "flashlight", "vgui/touch/flash_light_filled", "impulse 100", 0.920000, 0.000000, 1.000000, 0.142222, color );
|
||||
AddButton( "invnext", "vgui/touch/next_weap", "invnext", 0.000000, 0.533333, 0.120000, 0.746667, color );
|
||||
AddButton( "invprev", "vgui/touch/prev_weap", "invprev", 0.000000, 0.071111, 0.120000, 0.284444, color );
|
||||
AddButton( "edit", "vgui/touch/settings", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color );
|
||||
AddButton( "menu", "vgui/touch/menu", "gameui_activate", 0.000000, 0.00000, 0.080000, 0.142222, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf(buf, sizeof buf, "exec %s", TOUCH_DEFAULT_CFG);
|
||||
engine->ClientCmd_Unrestricted(buf);
|
||||
}
|
||||
|
||||
WriteConfig();
|
||||
}
|
||||
|
||||
void CTouchControls::Init()
|
||||
{
|
||||
int w,h;
|
||||
engine->GetScreenSize( w, h );
|
||||
screen_w = w; screen_h = h;
|
||||
|
||||
Msg("grid_x: %f, grid_y: %x\n", GRID_X, GRID_Y);
|
||||
configchanged = false;
|
||||
config_loaded = false;
|
||||
btns.EnsureCapacity( 64 );
|
||||
@@ -295,7 +333,6 @@ void CTouchControls::Init()
|
||||
AddButton( "duck", "vgui/touch/crouch", "+duck", 0.880000, 0.746667, 1.000000, 0.960000, color );
|
||||
AddButton( "tduck", "vgui/touch/tduck", ";+duck", 0.560000, 0.817778, 0.620000, 0.924444, color );
|
||||
AddButton( "zoom", "vgui/touch/zoom", "+zoom", 0.680000, 0.00000, 0.760000, 0.142222, color );
|
||||
// AddButton( "score", "vgui/touch/map", "+score", 0.680000, 0.00000, 0.760000, 0.142222, color );
|
||||
AddButton( "speed", "vgui/touch/speed", "+speed", 0.180000, 0.568889, 0.280000, 0.746667, color );
|
||||
AddButton( "loadquick", "vgui/touch/load", "load quick", 0.760000, 0.000000, 0.840000, 0.142222, color );
|
||||
AddButton( "savequick", "vgui/touch/save", "save quick", 0.840000, 0.000000, 0.920000, 0.142222, color );
|
||||
@@ -305,17 +342,16 @@ void CTouchControls::Init()
|
||||
AddButton( "invprev", "vgui/touch/prev_weap", "invprev", 0.000000, 0.071111, 0.120000, 0.284444, color );
|
||||
AddButton( "edit", "vgui/touch/settings", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color );
|
||||
AddButton( "menu", "vgui/touch/menu", "gameui_activate", 0.000000, 0.00000, 0.080000, 0.142222, color );
|
||||
// AddButton( "lie", "vgui/touch/lie", "+alt1", 0.580000, 0.568889, 0.680000, 0.746667, color );
|
||||
|
||||
char buf[256];
|
||||
Q_snprintf(buf, sizeof buf, "exec %s\n", touch_config_file.GetString());
|
||||
engine->ClientCmd_Unrestricted(buf);
|
||||
|
||||
Q_snprintf(buf, sizeof buf, "cfg/%s", touch_config_file.GetString());
|
||||
Q_snprintf(buf, sizeof buf, "cfg/%s", touch_config_file.GetString());
|
||||
if( !filesystem->FileExists(buf) )
|
||||
WriteConfig();
|
||||
|
||||
initialized = true;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void CTouchControls::Shutdown( )
|
||||
@@ -383,7 +419,6 @@ void CTouchControls::IN_Look()
|
||||
float def_fov = default_fov.GetFloat();
|
||||
float fov = pl->GetFOV();
|
||||
diff = fov/def_fov;
|
||||
Msg("diff=%f\n", diff);
|
||||
}
|
||||
|
||||
if( !pitch && !yaw )
|
||||
|
||||
Reference in New Issue
Block a user