/loadcrosshair fixes/updates (plz review/test)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7211 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+7
-2
@@ -787,9 +787,14 @@ docident [listcomplete] [];
|
||||
docident [listdemos] [Get the game demos listing from the server we are currently connected.];
|
||||
docident [listignored] [Print a list of all players that you are currently ignoring.];
|
||||
docident [listmuted] [Print a list of all players that you have muted.];
|
||||
docident [loadcrosshair] [Loads a crosshair for a specific weapon of - if the weapon argument is omitted or <0 - for all weapons.];
|
||||
docident [loadcrosshair] [Loads a crosshair for argument T.];
|
||||
docargument [I] [image] [] [0];
|
||||
docargument [W] [weapon] [-1,0..7] [0];
|
||||
docargument [T] [type] [all, scope, teammate, knife, pistol, carbine, shotgun, smg, sniper, ar, cpistol, grenades, akimbo] [0];
|
||||
docexample [loadcrosshair red_dot.png] [Loads the red_dot.png crosshair for all weapons.];
|
||||
docexample [loadcrosshair red_dot.png all] [Same as above. Loads the red_dot.png crosshair for all weapons.];
|
||||
docexample [loadcrosshair red_dot.png knife] [Loads the red_dot.png crosshair for your knife only.];
|
||||
docexample [loadcrosshair red_dot.png ar] [Loads the red_dot.png crosshair for your assault rifle only.];
|
||||
docexample [loadcrosshair red_dot.png scope] [Loads the red_dot.png crosshair for your sniper rifle scope only.];
|
||||
docident [localfootsteps] [Indicates if the footsteps sound for the local player should be played];
|
||||
docargument [B] [enable footsteps] [1 (true), 0 (false) min 0/max 1/default 1];
|
||||
docident [magcontent] [Returns contents of current magazine.];
|
||||
|
||||
+11
-1
@@ -270,7 +270,17 @@ enum
|
||||
CROSSHAIR_DEFAULT = 0,
|
||||
CROSSHAIR_TEAMMATE,
|
||||
CROSSHAIR_SCOPE,
|
||||
CROSSHAIR_NUM
|
||||
CROSSHAIR_KNIFE,
|
||||
CROSSHAIR_PISTOL,
|
||||
CROSSHAIR_CARBINE,
|
||||
CROSSHAIR_SHOTGUN,
|
||||
CROSSHAIR_SMG,
|
||||
CROSSHAIR_SNIPER,
|
||||
CROSSHAIR_AR,
|
||||
CROSSHAIR_CPISTOL,
|
||||
CROSSHAIR_GRENADES,
|
||||
CROSSHAIR_AKIMBO,
|
||||
CROSSHAIR_NUM,
|
||||
};
|
||||
|
||||
extern void drawcrosshair(playerent *p, int n, struct color *c = NULL, float size = -1.0f);
|
||||
|
||||
@@ -240,7 +240,7 @@ void drawscope(bool preload)
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
const char *crosshairnames[CROSSHAIR_NUM] = { "default", "teammate", "scope" };
|
||||
const char *crosshairnames[CROSSHAIR_NUM] = { "default", "teammate", "scope", "knife", "pistol", "carbine", "shotgun", "smg", "sniper", "ar", "cpistol", "grenades", "akimbo" };
|
||||
Texture *crosshairs[CROSSHAIR_NUM] = { NULL }; // weapon specific crosshairs
|
||||
|
||||
Texture *loadcrosshairtexture(const char *c)
|
||||
@@ -253,13 +253,25 @@ Texture *loadcrosshairtexture(const char *c)
|
||||
|
||||
void loadcrosshair(char *c, char *name)
|
||||
{
|
||||
int n = -1;
|
||||
loopi(CROSSHAIR_NUM) if(!strcmp(crosshairnames[i], name)) { n = i; break; }
|
||||
if(n<0)
|
||||
if (strcmp(name, "") == 0 || strcmp(name, "all") == 0)
|
||||
{
|
||||
n = atoi(name);
|
||||
if(n<0 || n>=CROSSHAIR_NUM) return;
|
||||
for (int i = 0; i < CROSSHAIR_NUM; i++)
|
||||
{
|
||||
if (i == CROSSHAIR_TEAMMATE || i == CROSSHAIR_SCOPE) continue;
|
||||
crosshairs[i] = loadcrosshairtexture(c);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int n = -1;
|
||||
|
||||
for (int i = 0; i < CROSSHAIR_NUM; i++)
|
||||
{
|
||||
if(strcmp(crosshairnames[i], name) == 0) { n = i; break; }
|
||||
}
|
||||
|
||||
if (n < 0 || n >= CROSSHAIR_NUM) return;
|
||||
|
||||
crosshairs[n] = loadcrosshairtexture(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -907,7 +907,7 @@ void weapon::onselecting()
|
||||
}
|
||||
|
||||
void weapon::renderhudmodel() { renderhudmodel(owner->lastaction); }
|
||||
void weapon::renderaimhelp(bool teamwarning) { drawcrosshair(owner, teamwarning ? CROSSHAIR_TEAMMATE : CROSSHAIR_DEFAULT); }
|
||||
void weapon::renderaimhelp(bool teamwarning) { drawcrosshair(owner, teamwarning ? CROSSHAIR_TEAMMATE : owner->weaponsel->type + 3); }
|
||||
int weapon::dynspread() { return info.spread; }
|
||||
float weapon::dynrecoil() { return info.recoil; }
|
||||
bool weapon::selectable() { return this != owner->weaponsel && owner->state == CS_ALIVE && !owner->weaponchanging; }
|
||||
|
||||
Reference in New Issue
Block a user