}\r
};\r
\r
-// Bringed back weapon frame\r
.float display_setup;\r
+void W_DisplayDigitThink()\r
+{\r
+ self.nextthink = time;\r
+ float w_load, w_ammo;\r
+ w_load = self.owner.weapon_load[self.owner.weapon];\r
+ w_ammo = self.owner.(self.owner.current_ammo);\r
+\r
+ // the owner has switched to another weapon, remove the digits\r
+ if(!self.owner.display_setup)\r
+ {\r
+ self.nextthink = 0;\r
+ remove(self);\r
+ self = world;\r
+ return;\r
+ }\r
+\r
+ // copy all properties of the weapon to the digit\r
+ self.origin = self.weaponentity.origin;\r
+ self.angles = self.weaponentity.angles;\r
+ self.scale = self.weaponentity.scale;\r
+ self.effects = self.weaponentity.effects;\r
+ self.alpha = self.weaponentity.alpha;\r
+ self.colormap = self.weaponentity.colormap;\r
+ self.colormod = self.weaponentity.colormod; // used by the regurgitating colors\r
+ self.glowmod = self.weaponentity.glowmod;\r
+\r
+ string txt;\r
+ if(self.team) // weapon load display\r
+ {\r
+ if(w_load <= 0)\r
+ {\r
+ self.skin = 11; // unavailable digit\r
+ return;\r
+ }\r
+ else\r
+ {\r
+ txt = ftos(floor(w_load));\r
+ txt = substring(txt, self.cnt - 1, 1);\r
+ }\r
+\r
+ if(self.owner.weapon_load[self.owner.weapon] <= ceil(cvar("g_gundisplay_warn_load")))\r
+ {\r
+ // in warning mode, only keep red color\r
+ if(!self.colormod)\r
+ self.colormod = '1 1 1';\r
+ self.colormod_y = 0;\r
+ self.colormod_z = 0;\r
+ }\r
+ }\r
+ else // ammo display\r
+ {\r
+ txt = ftos(floor(w_ammo));\r
+ txt = substring(txt, self.cnt - 1, 1);\r
+\r
+ if(w_ammo <= ceil(cvar("g_gundisplay_warn_ammo")))\r
+ {\r
+ // in warning mode, only keep red color\r
+ if(!self.colormod)\r
+ self.colormod = '1 1 1';\r
+ self.colormod_y = 0;\r
+ self.colormod_z = 0;\r
+ }\r
+ }\r
+\r
+ if((!txt || txt == ""))\r
+ self.skin = 10; // empty digit\r
+ else\r
+ self.skin = stof(txt);\r
+}\r
+\r
+void W_DisplayDigitSetup(entity own, float num, float load, float exterior)\r
+{\r
+ entity digit, e;\r
+ digit = spawn();\r
+ digit.owner = own;\r
+ //digit.weapon = own.weapon;\r
+ digit.team = load;\r
+ digit.cnt = num;\r
+ e = get_weaponinfo(own.weapon);\r
+\r
+ if(exterior) // exterior weapon\r
+ {\r
+ // keep the digit attached to the same bone as the gun\r
+ setattachment(digit, digit.owner, "bip01 r hand");\r
+ digit.weaponentity = digit.owner.exteriorweaponentity;\r
+ }\r
+ else // view weapon\r
+ {\r
+ // keep the digit attached to the same bone as the gun\r
+ // TODO: Does this work with self-animated weapons too?\r
+ if(gettagindex(digit.owner.weaponentity, "weapon"))\r
+ setattachment(digit, digit.owner.weaponentity, "weapon");\r
+ else if(gettagindex(digit.owner.weaponentity, "tag_weapon"))\r
+ setattachment(digit, digit.owner.weaponentity, "tag_weapon");\r
+ digit.weaponentity = digit.owner.weaponentity;\r
+ }\r
+\r
+ if(load)\r
+ {\r
+ // weapon load digit\r
+ setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(num) , ".md3"));\r
+ }\r
+ else\r
+ {\r
+ // ammo count digit\r
+ setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(num) , ".md3"));\r
+ }\r
+ digit.think = W_DisplayDigitThink;\r
+ digit.nextthink = time;\r
+}\r
+\r
+// Bringed back weapon frame\r
void W_WeaponFrame()\r
{\r
vector fo, ri, up;\r
ri = v_right;\r
up = v_up;\r
\r
- if(!self.display_setup)\r
+ // setup weapon display digits\r
+ if(self.weapon != self.switchweapon || self.classname != "player" || self.deadflag != DEAD_NO)\r
+ self.display_setup = FALSE;\r
+ else if(!self.display_setup)\r
{\r
if(self.weaponentity.modelindex && self.exteriorweaponentity.modelindex)\r
{\r
self.display_setup = TRUE;\r
}\r
}\r
- else if(self.weapon != self.switchweapon || self.classname != "player" || self.deadflag != DEAD_NO)\r
- self.display_setup = FALSE;\r
\r
// Change weapon\r
if (self.weapon != self.switchweapon)\r
#define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"))\r
#define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"))\r
\r
-void W_DisplayDigitThink()\r
-{\r
- // dprint(strcat(ftos(gun.scale), " --------\n"));\r
-\r
- self.nextthink = time;\r
- float w_load, w_ammo;\r
- w_load = self.owner.weapon_load[self.owner.weapon];\r
- w_ammo = self.owner.(self.owner.current_ammo);\r
-\r
- // the owner has switched to another weapon, remove the digits\r
- if(self.weapon != self.owner.weapon || self.owner.classname != "player" || self.owner.deadflag != DEAD_NO)\r
- {\r
- self.nextthink = 0;\r
- remove(self);\r
- self = world;\r
- return;\r
- }\r
-\r
- // copy all properties of the weapon to the digit\r
- self.origin = self.weaponentity.origin;\r
- self.angles = self.weaponentity.angles;\r
- self.scale = self.weaponentity.scale;\r
- self.effects = self.weaponentity.effects;\r
- self.alpha = self.weaponentity.alpha;\r
- self.colormap = self.weaponentity.colormap;\r
- self.colormod = self.weaponentity.colormod; // used by the regurgitating colors\r
- self.glowmod = self.weaponentity.glowmod;\r
-\r
- string txt;\r
- if(self.team) // weapon load display\r
- {\r
- if(w_load <= 0)\r
- {\r
- self.skin = 11; // unavailable digit\r
- return;\r
- }\r
- else\r
- {\r
- txt = ftos(floor(w_load));\r
- txt = substring(txt, self.cnt - 1, 1);\r
- }\r
-\r
- if(self.owner.weapon_load[self.owner.weapon] <= ceil(cvar("g_gundisplay_warn_load")))\r
- {\r
- // in warning mode, only keep red color\r
- if(!self.colormod)\r
- self.colormod = '1 1 1';\r
- self.colormod_y = 0;\r
- self.colormod_z = 0;\r
- }\r
- }\r
- else // ammo display\r
- {\r
- txt = ftos(floor(w_ammo));\r
- txt = substring(txt, self.cnt - 1, 1);\r
-\r
- if(w_ammo <= ceil(cvar("g_gundisplay_warn_ammo")))\r
- {\r
- // in warning mode, only keep red color\r
- if(!self.colormod)\r
- self.colormod = '1 1 1';\r
- self.colormod_y = 0;\r
- self.colormod_z = 0;\r
- }\r
- }\r
-\r
- if((!txt || txt == ""))\r
- self.skin = 10; // empty digit\r
- else\r
- self.skin = stof(txt);\r
-}\r
-\r
-void W_DisplayDigitSetup(entity own, float num, float load, float exterior)\r
-{\r
- entity digit, e;\r
- digit = spawn();\r
- digit.owner = own;\r
- digit.weapon = own.weapon;\r
- digit.team = load;\r
- digit.cnt = num;\r
- e = get_weaponinfo(digit.weapon);\r
-\r
- if(exterior) // exterior weapon\r
- {\r
- // keep the digit attached to the same bone as the gun\r
- setattachment(digit, digit.owner, "bip01 r hand");\r
- digit.weaponentity = digit.owner.exteriorweaponentity;\r
- }\r
- else // view weapon\r
- {\r
- // keep the digit attached to the same bone as the gun\r
- // TODO: Does this work with self-animated weapons too?\r
- if(gettagindex(digit.owner.weaponentity, "weapon"))\r
- setattachment(digit, digit.owner.weaponentity, "weapon");\r
- else if(gettagindex(digit.owner.weaponentity, "tag_weapon"))\r
- setattachment(digit, digit.owner.weaponentity, "tag_weapon");\r
- digit.weaponentity = digit.owner.weaponentity;\r
- }\r
-\r
- if(load)\r
- {\r
- // weapon load digit\r
- setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(num) , ".md3"));\r
- }\r
- else\r
- {\r
- // ammo count digit\r
- setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(num) , ".md3"));\r
- }\r
- digit.think = W_DisplayDigitThink;\r
- digit.nextthink = time;\r
-}\r
-\r
void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)\r
{\r
if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)\r
\r
void precache()\r
{\r
+ float i;\r
+\r
// gamemode related things\r
precache_model ("models/misc/chatbubble.spr");\r
\r
// common weapon precaches\r
precache_sound ("weapons/weapon_switch.wav");\r
precache_sound ("weapons/weaponpickup.wav");\r
- precache_model ("models/weapons/w_displaydigit.md3");\r
\r
- float i;\r
+ // precache display digits\r
+ for(i = WEP_FIRST; i <= WEP_LAST; ++i)\r
+ {\r
+ entity e;\r
+ float w;\r
+ e = get_weaponinfo(i);\r
+ for(w = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit1-", ftos(w) , ".md3")); w++)\r
+ precache_model (strcat("models/weapons/v_", e.netname, "_digit1-", ftos(w) , ".md3"));\r
+ for(w = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit2-", ftos(w) , ".md3")); w++)\r
+ precache_model (strcat("models/weapons/v_", e.netname, "_digit2-", ftos(w) , ".md3"));\r
+ }\r
+\r
for(i = 0; i < 8; i += 1)\r
precache_sound (strcat("weapons/hit", ftos(i), ".wav"));\r
\r
\r
- 0.8 BUG: When you get stomach kicked, weapon reloading resets. Is this a bug, or does it actually work better?\r
\r
-- 0.7: Move source branch to mediasource like Xonotic
\ No newline at end of file
+- 0.7: Move source branch to mediasource like Xonotic\r
+\r
+- 0.7 | 0.8 BUG: Bots can still senect no weapon when they have the grabber
\ No newline at end of file