X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fw_vortex.qc;h=d47cebde462504361bf615f0fcf20589f70e116c;hb=2718fac2d710f2c4e63a6de3cfe0ffc66dc7d6a3;hp=784f2056ad5f7ad96d151a53f9f44c299ad7d9e8;hpb=bc84852344a61cf02dea8f6db1a1e3a2449b4253;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/w_vortex.qc b/qcsrc/common/weapons/w_vortex.qc index 784f2056a..d47cebde4 100644 --- a/qcsrc/common/weapons/w_vortex.qc +++ b/qcsrc/common/weapons/w_vortex.qc @@ -1,8 +1,8 @@ -#ifdef REGISTER_WEAPON +#ifndef IMPLEMENTATION REGISTER_WEAPON( /* WEP_##id */ VORTEX, /* function */ W_Vortex, -/* ammotype */ ammo_plasma, +/* ammotype */ ammo_cells, /* impulse */ 7, /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN, /* rating */ BOT_PICKUP_RATING_HIGH, @@ -53,10 +53,13 @@ REGISTER_WEAPON( #ifdef SVQC VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) + +.float vortex_lasthit; +#endif #endif -#else +#ifdef IMPLEMENTATION #ifdef SVQC -void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX); } +void spawnfunc_weapon_vortex(void) { weapon_defaultspawnfunc(WEP_VORTEX.m_id); } void spawnfunc_weapon_nex(void) { spawnfunc_weapon_vortex(); } void SendCSQCVortexBeamParticle(float charge) { @@ -64,19 +67,19 @@ void SendCSQCVortexBeamParticle(float charge) { v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg_x); - WriteCoord(MSG_BROADCAST, w_shotorg_y); - WriteCoord(MSG_BROADCAST, w_shotorg_z); - WriteCoord(MSG_BROADCAST, v_x); - WriteCoord(MSG_BROADCAST, v_y); - WriteCoord(MSG_BROADCAST, v_z); + WriteCoord(MSG_BROADCAST, w_shotorg.x); + WriteCoord(MSG_BROADCAST, w_shotorg.y); + WriteCoord(MSG_BROADCAST, w_shotorg.z); + WriteCoord(MSG_BROADCAST, v.x); + WriteCoord(MSG_BROADCAST, v.y); + WriteCoord(MSG_BROADCAST, v.z); WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255)); } void W_Vortex_Attack(float issecondary) { float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; - + mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage); myforce = WEP_CVAR_BOTH(vortex, !issecondary, force); mymindist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist); @@ -100,17 +103,25 @@ void W_Vortex_Attack(float issecondary) mydmg *= charge; myforce *= charge; - W_SetupShot(self, TRUE, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg); + W_SetupShot(self, true, 5, W_Sound("nexfire"), CH_WEAPON_A, mydmg); if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound { - sound(self, CH_WEAPON_B, "weapons/nexcharge.wav", VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); + sound(self, CH_WEAPON_B, W_Sound("nexcharge"), VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM); } yoda = 0; - FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX); + damage_goodhits = 0; + FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id); if(yoda && flying) - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + if(damage_goodhits && self.vortex_lasthit) + { + Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); + damage_goodhits = 0; // only every second time + } + + self.vortex_lasthit = damage_goodhits; //beam and muzzle flash done on client SendCSQCVortexBeamParticle(charge); @@ -121,7 +132,7 @@ void W_Vortex_Attack(float issecondary) void spawnfunc_weapon_vortex(void); // defined in t_items.qc .float vortex_chargepool_pauseregen_finished; -float W_Vortex(float req) +bool W_Vortex(int req) { float dt; float ammo_amount; @@ -129,20 +140,20 @@ float W_Vortex(float req) { case WR_AIM: { - if(bot_aim(1000000, 0, 1, FALSE)) - self.BUTTON_ATCK = TRUE; + if(bot_aim(1000000, 0, 1, false)) + self.BUTTON_ATCK = true; else { if(WEP_CVAR(vortex, charge)) - self.BUTTON_ATCK2 = TRUE; + self.BUTTON_ATCK2 = true; } - return TRUE; + return true; } case WR_THINK: { if(WEP_CVAR(vortex, charge) && self.vortex_charge < WEP_CVAR(vortex, charge_limit)) self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME); - + if(WEP_CVAR_SEC(vortex, chargepool)) if(self.vortex_chargepool_ammo < 1) { @@ -204,7 +215,7 @@ float W_Vortex(float req) { self.clip_load = max(WEP_CVAR_SEC(vortex, ammo), self.clip_load - WEP_CVAR_SEC(vortex, ammo) * dt); } - self.(weapon_load[WEP_VORTEX]) = self.clip_load; + self.(weapon_load[WEP_VORTEX.m_id]) = self.clip_load; } else { @@ -237,27 +248,32 @@ float W_Vortex(float req) } } } - - return TRUE; + + return true; } case WR_INIT: { precache_model("models/nexflash.md3"); - precache_model("models/weapons/g_nex.md3"); - precache_model("models/weapons/v_nex.md3"); - precache_model("models/weapons/h_nex.iqm"); - precache_sound("weapons/nexfire.wav"); - precache_sound("weapons/nexcharge.wav"); - precache_sound("weapons/nexwhoosh1.wav"); - precache_sound("weapons/nexwhoosh2.wav"); - precache_sound("weapons/nexwhoosh3.wav"); - VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP) - return TRUE; + precache_model(W_Model("g_nex.md3")); + precache_model(W_Model("v_nex.md3")); + precache_model(W_Model("h_nex.iqm")); + precache_sound(W_Sound("nexfire")); + precache_sound(W_Sound("nexcharge")); + precache_sound(W_Sound("nexwhoosh1")); + precache_sound(W_Sound("nexwhoosh2")); + precache_sound(W_Sound("nexwhoosh3")); + VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP); + return true; + } + case WR_SETUP: + { + self.vortex_lasthit = 0; + return true; } case WR_CHECKAMMO1: { ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_PRI(vortex, ammo); - ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX]) >= WEP_CVAR_PRI(vortex, ammo)); + ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo)); return ammo_amount; } case WR_CHECKAMMO2: @@ -266,23 +282,28 @@ float W_Vortex(float req) { // don't allow charging if we don't have enough ammo ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_SEC(vortex, ammo); - ammo_amount += self.(weapon_load[WEP_VORTEX]) >= WEP_CVAR_SEC(vortex, ammo); + ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo); return ammo_amount; } else { - return FALSE; // zoom is not a fire mode + return false; // zoom is not a fire mode } } case WR_CONFIG: { - VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS) - return TRUE; + VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS); + return true; + } + case WR_RESETPLAYER: + { + self.vortex_lasthit = 0; + return true; } case WR_RELOAD: { - W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), "weapons/reload.wav"); - return TRUE; + W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), W_Sound("reload")); + return true; } case WR_SUICIDEMESSAGE: { @@ -293,12 +314,12 @@ float W_Vortex(float req) return WEAPON_VORTEX_MURDER; } } - return FALSE; + return false; } #endif #ifdef CSQC -var float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO -float W_Vortex(float req) +float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO +bool W_Vortex(int req) { switch(req) { @@ -308,34 +329,34 @@ float W_Vortex(float req) org2 = w_org + w_backoff * 6; pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); - - return TRUE; + sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); + + return true; } case WR_INIT: { - precache_sound("weapons/neximpact.wav"); + precache_sound(W_Sound("neximpact")); if(autocvar_cl_reticle && autocvar_cl_reticle_weapon) { precache_pic("gfx/reticle_nex"); } - return TRUE; + return true; } case WR_ZOOMRETICLE: { if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2)) { reticle_image = "gfx/reticle_nex"; - return TRUE; + return true; } else { // no weapon specific image for this weapon - return FALSE; + return false; } } } - return FALSE; + return false; } #endif #endif