add reset option for loadcrosshair

loadcrosshair reset

    loads all default crosshairs (including teammate and scope)

    short form of "loadcrosshair default default.png ; loadcrosshair
    scope red_dot.png ; loadcrosshair teammate teammate.png"

DOCREF loadcrosshair
This commit is contained in:
ac-stef
2017-06-10 00:15:58 +02:00
parent b2890a3334
commit 800e4f3a13
5 changed files with 32 additions and 18 deletions
+1 -3
View File
@@ -2,9 +2,7 @@
// Do not modify anything below, instead change settings in game, or add to autoexec.cfg
name "unarmed" // Change your name!
loadcrosshair default default.png // Choose another crosshair, see ./packages/crosshairs/
loadcrosshair teammate teammate.png // Teammate crosshair.
loadcrosshair scope red_dot.png // Scope crosshair.
loadcrosshair reset // load hardcoded defaults
skin_cla (rnd 4) // Change your look.
skin_rvsf (rnd 6)
setfont default // Choose your font
+20 -10
View File
@@ -403,14 +403,22 @@ menuitem "\f2 [ Apply! ] " [ if $__resetbindsyes resetbinds [ sho
//// Main > Settings > Mouse ////
newmenu Mouse
menuitemcheckbox "Invert mouse: " "$invmouse" [ invmouse $arg1 ]
menuitemcheckbox "Automatic Sniper-scope sensitivity: " "$autoscopesens" [ autoscopesens $arg1 ]
menuitemtextinput "Mouse Sensitivity: " "$sensitivity" [ sensitivity $arg1 ]
menuitemtextinput "Mouse Acceleration: " "$mouseaccel" [ mouseaccel $arg1 ]
menuitemtextinput "Filter mouse (for bad ones): " "$mfilter" [ mfilter $arg1 ]
menuitemtextinput "Sniper-scope sensitivity scale: " "$scopesensscale" [ scopesensscale $arg1 ]
menuitem "" -1
menuitem "Customize crosshairs\i\3" [ showmenu [Customize crosshairs] ]
menuinit [
resetcurmenu
menuitemcheckbox "Invert mouse:" "$invmouse" [ invmouse $arg1 ]
menuitemtextinput "Mouse Sensitivity:" "$sensitivity" [ sensitivity $arg1 ]
menuitemtextinput "Mouse Acceleration:" "$mouseaccel" [ mouseaccel $arg1 ]
menuitemtextinput "Filter mouse (for bad ones):" "$mfilter" [ mfilter $arg1 ]
menuitem "" -1
menuitemradio "Sniper-scope sensitivity: " 0 1 "$autoscopesens" [manual automatic] [ autoscopesens $arg1 ; refreshcurmenu]
if $autoscopesens [
menuitem [@"\f4Sniper-scope sensitivity scale: \n\f4"@scopesensscale] -1
][
menuitemtextinput "Sniper-scope sensitivity scale: " "$scopesensscale" [ scopesensscale $arg1 ]
]
menuitem "" -1
menuitem "Customize crosshairs\i\3" [ showmenu [Customize crosshairs] ]
]
//// Main > Settings > Mouse > Customize crosshairs ////
@@ -428,6 +436,8 @@ menuinit [
menuitemcheckbox "Crosshair effect: change color for low health" [ (at "0 1 1 0" $crosshairfx) ] [ crosshairfx (at (if $arg1 ["2 1 2 1"] ["0 3 0 3"]) $crosshairfx) ]
menuitemcheckbox "Crosshair effect: show assault rifle spread increase" [ (at "0 1 0 1" $crosshairfx) ] [ crosshairfx (at (if $arg1 ["3 1 1 3"] ["0 2 2 0"]) $crosshairfx) ]
menuitemcheckbox "Crosshair effect: show team-sign when aiming at teammates " "$crosshairteamsign" [ crosshairteamsign $arg1 ]
menuitem "" -1
menuitem "Reset all crosshairs to defaults" [ loadcrosshair reset ]
]
//// Main > Settings > Mouse > Customize crosshairs > Crosshairs ////
@@ -435,8 +445,8 @@ menuinit [
newmenu Crosshairs
menuinit [
resetcurmenu
menuheader "" (concatword "'" $__crosshairset "' crosshair")
menudirlist "packages/crosshairs" png [ loadcrosshair $__crosshairset (concatword $arg1 .png) ] 1
menuheader "" ['@[__crosshairset]' crosshair]
menudirlist "packages/crosshairs" png [ loadcrosshair @__crosshairset [@[arg1].png] ] 1
]
+2 -2
View File
@@ -81,7 +81,7 @@ bool changemapserv(char *name, int mode, int download, int revision) // f
// don't care if he's in the scenery or other players,
// just don't overlap with our client
void updatepos(playerent *d)
void updateplayerpos(playerent *d)
{
const float r = player1->radius+d->radius;
const float dx = player1->o.x-d->o.x;
@@ -198,7 +198,7 @@ void parsepositions(ucharbuf &p)
f >>= 2;
d->last_pos = totalmillis;
updatecrouch(d, f&1);
updatepos(d);
updateplayerpos(d);
updatelagtime(d);
extern int smoothmove, smoothdist;
if(d->state==CS_DEAD)
+1 -1
View File
@@ -245,7 +245,7 @@ struct mitemmanual : mitem
mitemmanual(gmenu *parent, char *text, char *action, char *hoveraction, color *bgcolor, const char *desc) : mitem(parent, bgcolor, mitem::TYPE_MANUAL), text(text), action(action), hoveraction(hoveraction), desc(desc) {}
virtual int width() { return text_width(text); }
virtual int width() { return text_width(text) + (strchr(text, '\n') ? menurighttabwidth : 0); }
virtual void render(int x, int y, int w)
{
+8 -2
View File
@@ -172,12 +172,18 @@ Texture *loadcrosshairtexture(const char *c)
return crosshair;
}
void loadcrosshair(char *type, char *filename)
void loadcrosshair(const char *type, const char *filename)
{
int index = CROSSHAIR_DEFAULT;
if(!*filename)
{ // special form: loadcrosshair filename // short for "loadcrosshair default filename"
filename = type;
if(strcasecmp(type, "reset")) filename = type;
else
{ // "loadcrosshair reset" does exactly that
filename = "default.png";
crosshairs[CROSSHAIR_TEAMMATE] = loadcrosshairtexture("teammate.png");
crosshairs[CROSSHAIR_SCOPE] = loadcrosshairtexture("red_dot.png");
}
}
else if(strchr(type, '.'))
{ // old syntax "loadcrosshair filename type", remove this in 2020