From: FruitieX Date: Sat, 24 Jul 2010 15:42:29 +0000 (+0300) Subject: melee icon code :-) X-Git-Tag: xonotic-v0.1.0preview~423^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0207b16897f668044098b8105c46f3b40d6d5aba;p=xonotic%2Fxonotic-data.pk3dir.git melee icon code :-) --- diff --git a/gfx/hud/default/notify_melee.tga b/gfx/hud/default/notify_melee.tga deleted file mode 100644 index 2223d9375..000000000 Binary files a/gfx/hud/default/notify_melee.tga and /dev/null differ diff --git a/gfx/hud/default/notify_melee_laser.tga b/gfx/hud/default/notify_melee_laser.tga new file mode 100644 index 000000000..2223d9375 Binary files /dev/null and b/gfx/hud/default/notify_melee_laser.tga differ diff --git a/gfx/hud/default/notify_melee_shotgun.tga b/gfx/hud/default/notify_melee_shotgun.tga new file mode 100644 index 000000000..cf003bd29 Binary files /dev/null and b/gfx/hud/default/notify_melee_shotgun.tga differ diff --git a/gfx/hud/luminos/notify_melee.tga b/gfx/hud/luminos/notify_melee.tga deleted file mode 100644 index cf003bd29..000000000 Binary files a/gfx/hud/luminos/notify_melee.tga and /dev/null differ diff --git a/gfx/hud/luminos/notify_melee_laser.tga b/gfx/hud/luminos/notify_melee_laser.tga new file mode 100644 index 000000000..2223d9375 Binary files /dev/null and b/gfx/hud/luminos/notify_melee_laser.tga differ diff --git a/gfx/hud/luminos/notify_melee_shotgun.tga b/gfx/hud/luminos/notify_melee_shotgun.tga new file mode 100644 index 000000000..cf003bd29 Binary files /dev/null and b/gfx/hud/luminos/notify_melee_shotgun.tga differ diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index b348ff0d7..10cf86f09 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2434,29 +2434,10 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) if (stof(s2) > 2) // killcount > 2 print ("^1",s1,"^1 ended it all after a ",s2," kill spree\n"); - } else if(msg == MSG_KILL_MELEE) { // handle melee types separately - if(type == KILL_FRAG_GAUNTLET) { - if(alsoprint) - { - if(gentle) { - print ("^1", s1, "^1 got too close to", s2, "^1's gauntlet\n"); - } else { - print ("^1", s1, "^1 was cut in half by", s2, "^1's gauntlet\n"); - } - } - } - else if(type == KILL_FRAG_SHOTGUN_MELEE) - { - if(alsoprint) - { - print ("^7", s2, "^7 slapped ", s1, "^7 around a bit with a large ^2shotgun\n"); - } - } - HUD_KillNotify_Push(s1, s2, 1, type); } else if(msg == MSG_KILL) { w = DEATH_WEAPONOF(type); if(WEP_VALID(w)) { - HUD_KillNotify_Push(s2, s1, 1, w); + HUD_KillNotify_Push(s2, s1, 1, type); if (alsoprint) print("^1", sprintf(Weapon_KillMessage(type), strcat(s2, "^1"), strcat(s1, "^1")), "\n"); // default order: victim, killer } @@ -2883,6 +2864,9 @@ void HUD_Notify (void) a = 0; } + float w; + w = DEATH_WEAPONOF(killnotify_deathtype[j]); + // TODO: maybe print in team colors? // // Y [used by] X @@ -3013,18 +2997,18 @@ void HUD_Notify (void) { s = "weaponelectro"; } - else if(WEP_VALID(killnotify_deathtype[j])) + else if(killnotify_deathtype[j] & HITTYPE_SECONDARY && w == WEP_LASER) { - self = get_weaponinfo(killnotify_deathtype[j]); - s = strcat("weapon", self.netname); + s = "notify_melee"; } - else if(killnotify_deathtype[j] == KILL_FRAG_GAUNTLET) + else if(killnotify_deathtype[j] & HITTYPE_SECONDARY && w == WEP_SHOTGUN) { s = "notify_melee"; } - else if(killnotify_deathtype[j] == KILL_FRAG_SHOTGUN_MELEE) + else if(WEP_VALID(w)) { - s = "notify_melee"; + self = get_weaponinfo(w); + s = strcat("weapon", self.netname); } else if(killnotify_deathtype[j] == KILL_TEAM_RED) { diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 61ce6900a..7a5cf3447 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -550,12 +550,11 @@ float MAX_SHOT_DISTANCE = 32768; // CSQC centerprint/notify message types float MSG_SUICIDE = 0; -float MSG_KILL_MELEE = 1; -float MSG_KILL = 2; -float MSG_SPREE = 3; -float MSG_KILL_ACTION = 4; -float MSG_KILL_ACTION_SPREE = 5; -float MSG_INFO = 6; +float MSG_KILL = 1; +float MSG_SPREE = 2; +float MSG_KILL_ACTION = 3; +float MSG_KILL_ACTION_SPREE = 4; +float MSG_INFO = 5; float KILL_TEAM_RED = 10301; float KILL_TEAM_BLUE = 10302; @@ -565,24 +564,22 @@ float KILL_FIRST_VICTIM = 10305; float KILL_TYPEFRAG = 10306; float KILL_TYPEFRAGGED = 10307; float KILL_FRAG = 10308; -float KILL_FRAG_GAUNTLET = 10309; -float KILL_FRAG_SHOTGUN_MELEE = 10310; -float KILL_FRAGGED = 10311; -float KILL_SPREE = 10312; -float KILL_END_SPREE = 10313; -float KILL_SPREE_3 = 10314; -float KILL_SPREE_5 = 10315; -float KILL_SPREE_10 = 10316; -float KILL_SPREE_15 = 10317; -float KILL_SPREE_20 = 10318; -float KILL_SPREE_25 = 10319; -float KILL_SPREE_30 = 10320; - -float INFO_GOTFLAG = 10321; -float INFO_PICKUPFLAG = 10322; -float INFO_LOSTFLAG = 10323; -float INFO_RETURNFLAG = 10324; -float INFO_CAPTUREFLAG = 10325; +float KILL_FRAGGED = 10309; +float KILL_SPREE = 10310; +float KILL_END_SPREE = 10311; +float KILL_SPREE_3 = 10312; +float KILL_SPREE_5 = 10313; +float KILL_SPREE_10 = 10314; +float KILL_SPREE_15 = 10315; +float KILL_SPREE_20 = 10316; +float KILL_SPREE_25 = 10317; +float KILL_SPREE_30 = 10318; + +float INFO_GOTFLAG = 10319; +float INFO_PICKUPFLAG = 10320; +float INFO_LOSTFLAG = 10321; +float INFO_RETURNFLAG = 10322; +float INFO_CAPTUREFLAG = 10323; // weapon requests float WR_SETUP = 1; // (SVQC) setup weapon data diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 5ed980b23..7c3dc9a36 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -370,19 +370,6 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) msg = ftos(strstrofs(inflictor.message2, "#", 0)); } - float msgtype; - w = DEATH_WEAPONOF(deathtype); - if(w == WEP_LASER && ((cvar("g_balance_laser_secondary_gauntlet") && w & HITTYPE_SECONDARY) || (cvar("g_balance_laser_primary_gauntlet") && !(w & HITTYPE_SECONDARY)))) - { - msgtype = MSG_KILL_MELEE; - deathtype = KILL_FRAG_GAUNTLET; - } - else if(w == WEP_SHOTGUN && (cvar("g_balance_shotgun_secondary_melee") && w & HITTYPE_SECONDARY)) - { - msgtype = MSG_KILL_MELEE; - deathtype = KILL_FRAG_SHOTGUN_MELEE; - } - Send_KillNotification(s, a, msg, deathtype, MSG_KILL); if(g_ctf && targ.flagcarried) diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 3351816b2..81a5527ac 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -40,10 +40,7 @@ void W_Laser_Attack (float issecondary) else nodamage = FALSE; - if (issecondary == 1) - a = cvar("g_balance_laser_secondary_shotangle"); - else - a = cvar("g_balance_laser_primary_shotangle"); + a = cvar("g_balance_laser_primary_shotangle"); s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD); if(nodamage) @@ -57,28 +54,20 @@ void W_Laser_Attack (float issecondary) missile = spawn (); missile.owner = self; missile.classname = "laserbolt"; - missile.dmg = (issecondary == 1); + missile.dmg = 0; if(!nodamage) { missile.bot_dodge = TRUE; - if (issecondary == 1) - missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage"); - else - missile.bot_dodgerating = cvar("g_balance_laser_primary_damage"); + missile.bot_dodgerating = cvar("g_balance_laser_primary_damage"); } PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = WEP_LASER; - if(issecondary == 1) - missile.projectiledeathtype |= HITTYPE_SECONDARY; setorigin (missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); - if (issecondary == 1) - W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_secondary); - else - W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_primary); + W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_primary); missile.angles = vectoangles (missile.velocity); //missile.glow_color = 250; // 244, 250 //missile.glow_size = 120; @@ -87,10 +76,7 @@ void W_Laser_Attack (float issecondary) missile.flags = FL_PROJECTILE; missile.think = W_Laser_Think; - if (issecondary == 1) - missile.nextthink = time + cvar("g_balance_laser_secondary_delay"); - else - missile.nextthink = time + cvar("g_balance_laser_primary_delay"); + missile.nextthink = time + cvar("g_balance_laser_primary_delay"); if(time >= missile.nextthink) { entity oldself; @@ -132,21 +118,12 @@ float gauntletbeam_send(entity to, float sf) void gauntletbeam_think() { float damage, myforce, myradius; - if(self.cnt) - { - damage = cvar("g_balance_laser_secondary_damage"); - myforce = cvar("g_balance_laser_secondary_force"); - myradius = cvar("g_balance_laser_secondary_radius"); - } - else - { - damage = cvar("g_balance_laser_primary_damage"); - myforce = cvar("g_balance_laser_primary_force"); - myradius = cvar("g_balance_laser_primary_radius"); - } + damage = cvar("g_balance_laser_secondary_damage"); + myforce = cvar("g_balance_laser_secondary_force"); + myradius = cvar("g_balance_laser_secondary_radius"); self.owner.prevgauntletfire = time; - if (self.owner.weaponentity.state != WS_INUSE || self != self.owner.gauntletbeam || self.owner.deadflag != DEAD_NO || (!self.owner.BUTTON_ATCK2 && self.cnt) || (!self.owner.BUTTON_ATCK && !self.cnt)) + if (self.owner.weaponentity.state != WS_INUSE || self != self.owner.gauntletbeam || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK2) { remove(self); return; @@ -167,7 +144,7 @@ void gauntletbeam_think() { vector force; force = w_shotdir * myforce; - Damage (trace_ent, self.owner, self.owner, damage * dt, WEP_ELECTRO, trace_endpos, force * dt); + Damage (trace_ent, self.owner, self.owner, damage * dt, WEP_LASER | HITTYPE_SECONDARY, trace_endpos, force * dt); } // draw effect @@ -184,7 +161,7 @@ void gauntletbeam_think() } // experimental gauntlet -void W_Laser_Attack2 (float issecondary) +void W_Laser_Attack2 () { // only play fire sound if 0.5 sec has passed since player let go the fire button if(time - self.prevgauntletfire > 0.5) @@ -202,7 +179,6 @@ void W_Laser_Attack2 (float issecondary) beam.shot_spread = 0; beam.bot_dodge = TRUE; beam.bot_dodgerating = cvar("g_balance_laser_primary_damage"); - beam.cnt = issecondary; Net_LinkEntity(beam, FALSE, 0, gauntletbeam_send); oldself = self; @@ -246,24 +222,18 @@ float w_laser(float req) else if (req == WR_THINK) { if (self.BUTTON_ATCK) - if (weapon_prepareattack(0, (cvar("g_balance_laser_primary_gauntlet") ? 0 : cvar("g_balance_laser_primary_refire")))) + if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire"))) { - if(cvar("g_balance_laser_primary_gauntlet")) - W_Laser_Attack2(0); - else - W_Laser_Attack(0); + W_Laser_Attack(1); weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready); } if (self.BUTTON_ATCK2) { if(cvar("g_balance_laser_secondary")) { - if (weapon_prepareattack(0, (cvar("g_balance_laser_secondary_gauntlet") ? 0 : cvar("g_balance_laser_secondary_refire")))) + if (weapon_prepareattack(0, 0)) { - if(cvar("g_balance_laser_secondary_gauntlet")) - W_Laser_Attack2(1); - else - W_Laser_Attack(1); + W_Laser_Attack2(); weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready); } } diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 7b74e5693..6528f22f3 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -46,49 +46,6 @@ void W_Shotgun_Attack (void) } -void W_Shotgun_Attack2 (void) -{ - float sc; - float ammoamount; - float bullets; - float d; - float f; - float spread; - float bulletspeed; - float bulletconstant; - local entity flash; - - ammoamount = cvar("g_balance_shotgun_secondary_ammo"); - bullets = cvar("g_balance_shotgun_secondary_bullets"); - d = cvar("g_balance_shotgun_secondary_damage"); - f = cvar("g_balance_shotgun_secondary_force"); - spread = cvar("g_balance_shotgun_secondary_spread"); - bulletspeed = cvar("g_balance_shotgun_secondary_speed"); - bulletconstant = cvar("g_balance_shotgun_secondary_bulletconstant"); - - W_SetupShot (self, cvar("g_antilag_bullets") && bulletspeed >= cvar("g_antilag_bullets"), 5, "weapons/shotgun_fire.wav", cvar("g_balance_shotgun_secondary_damage")); - for (sc = 0;sc < bullets;sc = sc + 1) - fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN | HITTYPE_SECONDARY, 0, 1, bulletconstant); - endFireBallisticBullet(); - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.ammo_shells = self.ammo_shells - ammoamount; - - pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo")); - - // casing code - if (cvar("g_casings") >= 1) - for (sc = 0;sc < ammoamount;sc = sc + 1) - SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, self); - - flash = spawn(); - setmodel(flash, "models/uziflash.md3"); // precision set below - flash.scale = 1.2; - flash.think = SUB_Remove; - flash.nextthink = time + 0.06; - flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - W_AttachToShotorg(flash, '5 0 0'); -} - void shotgun_meleethink (void) { // store time when we started swinging down inside self.cnt @@ -111,7 +68,7 @@ void shotgun_meleethink (void) { vector force; force = angle * cvar("g_balance_shotgun_secondary_force"); - Damage (trace_ent, self.owner, self.owner, cvar("g_balance_shotgun_secondary_damage") * ((f + 1) / 2), WEP_SHOTGUN, self.owner.origin + self.owner.view_ofs, force); + Damage (trace_ent, self.owner, self.owner, cvar("g_balance_shotgun_secondary_damage") * ((f + 1) / 2), WEP_SHOTGUN | HITTYPE_SECONDARY , self.owner.origin + self.owner.view_ofs, force); remove(self); } else if(time >= self.cnt + cvar("g_balance_shotgun_secondary_melee_time")) // missed, remove ent @@ -120,7 +77,7 @@ void shotgun_meleethink (void) self.nextthink = time; } -void W_Shotgun_Attack3 (void) +void W_Shotgun_Attack2 (void) { sound (self, CHAN_PROJECTILE, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM); weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), w_ready); @@ -132,18 +89,6 @@ void W_Shotgun_Attack3 (void) meleetemp.nextthink = time + cvar("g_balance_shotgun_secondary_melee_delay"); } -// weapon frames -void shotgun_fire2_03() -{ - W_Shotgun_Attack2(); - weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), w_ready); -} -void shotgun_fire2_02() -{ - W_Shotgun_Attack2(); - weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03); -} - void spawnfunc_weapon_shotgun(); // defined in t_items.qc float w_shotgun(float req) @@ -164,16 +109,8 @@ float w_shotgun(float req) if (self.BUTTON_ATCK2 && cvar("g_balance_shotgun_secondary")) if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire"))) { - if(cvar("g_balance_shotgun_secondary_melee")) - { - // force playback of the anim by switching to another anim (that we never play) here... - weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack3); - } - else - { - W_Shotgun_Attack2(); - weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02); - } + // attempt forcing playback of the anim by switching to another anim (that we never play) here... + weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2); } } else if (req == WR_PRECACHE) @@ -192,9 +129,7 @@ float w_shotgun(float req) return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo"); else if (req == WR_CHECKAMMO2) { - if(cvar("g_balance_shotgun_secondary_melee")) - return TRUE; - return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3; + return TRUE; } return TRUE; };