X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapons.qc;h=c0033cb8254af026abb8013a854878636bb59fdd;hb=0e26c3902561461d57b86521f4b3cab9005c1121;hp=121df37b2129cce7f680ce5bdcdb90206d7461cf;hpb=72496c0c862f19ccf8607189c6dfd4ee7351a157;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index 121df37b2..c0033cb82 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -74,25 +74,39 @@ WepSet ReadWepSet() } #endif -void register_weapon(float id, WepSet bit, float(float) func, .float ammotype, float i, float weapontype, float pickupbasevalue, vector clr, string modelname, string shortname, string wname) +void register_weapon( + float id, + WepSet bit, + float(float) func, + .float ammotype, + float i, + float weapontype, + float pickupbasevalue, + vector clr, + string modelname, + string crosshair, + string refname, + string wepname) { entity e; weapon_info[id - 1] = e = spawn(); e.classname = "weapon_info"; e.weapon = id; e.weapons = bit; - e.netname = shortname; - e.message = wname; - //e.items = ammotype; e.weapon_func = func; + e.ammo_field = ammotype; + e.impulse = i; + e.spawnflags = weapontype; + e.bot_pickupbasevalue = pickupbasevalue; e.wpcolor = clr; e.mdl = modelname; e.model = strzone(strcat("models/weapons/g_", modelname, ".md3")); - e.spawnflags = weapontype; + e.w_crosshair = strzone(car(crosshair)); + string s = cdr(crosshair); + e.w_crosshair_size = ((s != "") ? stof(s) : 1); // so that we can scale the crosshair from code (for compat) e.model2 = strzone(strcat("wpn-", ftos(id))); - e.impulse = i; - e.bot_pickupbasevalue = pickupbasevalue; - e.current_ammo = ammotype; + e.netname = refname; + e.message = wepname; #ifndef MENUQC func(WR_INIT); @@ -110,7 +124,6 @@ void register_weapons_done() dummy_weapon_info.weapons = '0 0 0'; dummy_weapon_info.netname = ""; dummy_weapon_info.message = "AOL CD Thrower"; - //dummy_weapon_info.items = 0; dummy_weapon_info.weapon_func = w_null; dummy_weapon_info.mdl = ""; dummy_weapon_info.model = ""; @@ -118,7 +131,10 @@ void register_weapons_done() dummy_weapon_info.model2 = ""; dummy_weapon_info.impulse = -1; dummy_weapon_info.bot_pickupbasevalue = 0; - dummy_weapon_info.current_ammo = ammo_none; + dummy_weapon_info.ammo_field = ammo_none; + + dummy_weapon_info.w_crosshair = "gfx/crosshair1"; + dummy_weapon_info.w_crosshair_size = 1; float i; weaponorder_byid = ""; @@ -240,7 +256,43 @@ void W_RandomWeapons(entity e, float n) e.weapons = result; } -string W_Name(float weaponid) // WEAPONTODO: make into a macro +#ifdef CSQC +.float GetAmmoFieldFromNum(float i) { - return (get_weaponinfo(weaponid)).message; + switch(i) + { + case 0: return ammo_shells; + case 1: return ammo_nails; + case 2: return ammo_rockets; + case 3: return ammo_cells; + case 4: return ammo_fuel; + default: return ammo_none; + } } + +string GetAmmoPicture(.float ammotype) +{ + switch(ammotype) + { + case ammo_shells: return "ammo_shells"; + case ammo_nails: return "ammo_nails"; + case ammo_rockets: return "ammo_rockets"; + case ammo_cells: return "ammo_cells"; + case ammo_fuel: return "ammo_fuel"; + default: return ""; // wtf, no ammo type? + } +} + +float GetAmmoStat(.float ammotype) +{ + switch(ammotype) + { + case ammo_shells: return STAT_SHELLS; + case ammo_nails: return STAT_NAILS; + case ammo_rockets: return STAT_ROCKETS; + case ammo_cells: return STAT_CELLS; + case ammo_fuel: return STAT_FUEL; + default: return -1; + } +} +#endif