| 173 | } |
| 174 | |
| 175 | void loadcrosshair(const char *type, const char *filename) |
| 176 | { |
| 177 | int index = CROSSHAIR_DEFAULT; |
| 178 | if(!*filename) |
| 179 | { // special form: loadcrosshair filename // short for "loadcrosshair default filename" |
| 180 | if(strcasecmp(type, "reset")) filename = type; |
| 181 | else |
| 182 | { // "loadcrosshair reset" does exactly that |
| 183 | filename = "default.png"; |
| 184 | crosshairs[CROSSHAIR_TEAMMATE] = loadcrosshairtexture("teammate.png"); |
| 185 | crosshairs[CROSSHAIR_SCOPE] = loadcrosshairtexture("red_dot.png"); |
| 186 | } |
| 187 | } |
| 188 | else if(strchr(type, '.')) |
| 189 | { // old syntax "loadcrosshair filename type", remove this in 2020 |
| 190 | const char *oldcrosshairnames[CROSSHAIR_NUM + 1] = { "default", "teammate", "scope", "knife", "pistol", "carbine", "shotgun", "smg", "sniper", "ar", "grenades", "akimbo", "" }; |
| 191 | index = getlistindex(filename, oldcrosshairnames, false, 0); |
| 192 | if(index > 2) index -= 3; |
| 193 | else index += NUMGUNS; |
| 194 | filename = type; |
| 195 | } |
| 196 | else |
| 197 | { // new syntax with proper gun names |
| 198 | index = getlistindex(type, crosshairnames, false, CROSSHAIR_DEFAULT); |
| 199 | } |
| 200 | if(index == CROSSHAIR_DEFAULT) |
| 201 | { |
| 202 | loopi(CROSSHAIR_NUM) if(i != CROSSHAIR_TEAMMATE && i != CROSSHAIR_SCOPE) crosshairs[i] = loadcrosshairtexture(filename); |
| 203 | } |
| 204 | else |
| 205 | { |
| 206 | crosshairs[index] = loadcrosshairtexture(filename); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | COMMAND(loadcrosshair, "ss"); |
| 211 |
nothing calls this directly
no test coverage detected