X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Foverkill%2Foknex.qc;h=55afbe45c1112e4f2fdf04632f62dd71becdbbb5;hb=59d3684c3ce95d95c6d3f14e6fc5567a2e6ff2ba;hp=cbfa1216d8206a70849a0360d927a650dc0f6347;hpb=83093a5626b3ec25a2dc4f87b24eda2a95a8335f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index cbfa1216d..55afbe45c 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -12,16 +12,21 @@ METHOD(OverkillNex, wr_glow, vector(OverkillNex this, entity actor, entity wepen if (!WEP_CVAR(oknex, charge)) return '0 0 0'; float charge = wepent.oknex_charge; float animlimit = WEP_CVAR(oknex, charge_animlimit); + float f = autocvar_g_weapon_charge_colormod_hdrmultiplier * min(1, charge / animlimit); vector g; - g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, charge / animlimit); - g.y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, charge / animlimit); - g.z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, charge / animlimit); + g.x = f * autocvar_g_weapon_charge_colormod_red_half; + g.y = f * autocvar_g_weapon_charge_colormod_green_half; + g.z = f * autocvar_g_weapon_charge_colormod_blue_half; if (charge > animlimit) { - g.x += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (charge - animlimit) / (1 - animlimit); - g.y += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (charge - animlimit) / (1 - animlimit); - g.z += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (charge - animlimit) / (1 - animlimit); + f = autocvar_g_weapon_charge_colormod_hdrmultiplier * (charge - animlimit) / (1 - animlimit); + g.x += f * autocvar_g_weapon_charge_colormod_red_full; + g.y += f * autocvar_g_weapon_charge_colormod_green_full; + g.z += f * autocvar_g_weapon_charge_colormod_blue_full; } + // transition color can't be '0 0 0' as it defaults to player model glow color + if (g == '0 0 0') + g = '0 0 0.000001'; return g; } #endif @@ -82,7 +87,7 @@ void W_OverkillNex_Attack(Weapon thiswep, entity actor, .entity weaponentity, fl mydmg *= charge; myforce *= charge; - W_SetupShot(actor, weaponentity, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg, WEP_OVERKILL_NEX.m_id); + W_SetupShot(actor, weaponentity, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg, thiswep.m_id); if(charge > WEP_CVAR(oknex, charge_animlimit) && WEP_CVAR(oknex, charge_animlimit)) // if the OverkillNex is overcharged, we play an extra sound { sound(actor, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(oknex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(oknex, charge_animlimit)), ATTN_NORM); @@ -90,7 +95,7 @@ void W_OverkillNex_Attack(Weapon thiswep, entity actor, .entity weaponentity, fl yoda = 0; damage_goodhits = 0; - FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_OVERKILL_NEX.m_id); + FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, true, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, thiswep.m_id); if(yoda && flying) Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); @@ -140,34 +145,16 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone { // Secondary uses it's own refire timer if refire_type is 1. actor.jump_interval = time + WEP_CVAR_SEC(oknex, refire) * W_WeaponRateFactor(actor); - // Ugly hack to reuse the fire mode of the blaster. - makevectors(actor.v_angle); - W_Blaster_Attack( - actor, - weaponentity, - WEP_BLASTER.m_id | HITTYPE_SECONDARY, - WEP_CVAR_SEC(oknex, shotangle), - WEP_CVAR_SEC(oknex, damage), - WEP_CVAR_SEC(oknex, edgedamage), - WEP_CVAR_SEC(oknex, radius), - WEP_CVAR_SEC(oknex, force), - WEP_CVAR_SEC(oknex, speed), - WEP_CVAR_SEC(oknex, spread), - WEP_CVAR_SEC(oknex, delay), - WEP_CVAR_SEC(oknex, lifetime) - ); + BLASTER_SECONDARY_ATTACK(oknex, actor, weaponentity); if ((actor.(weaponentity).wframe == WFRAME_IDLE) || (actor.(weaponentity).wframe == WFRAME_FIRE2)) { // Set secondary fire animation. - vector a = '0 0 0'; actor.(weaponentity).wframe = WFRAME_FIRE2; - a = actor.(weaponentity).anim_fire2; - a.z *= g_weaponratefactor; FOREACH_CLIENT(true, LAMBDA( if (it == actor || (IS_SPEC(it) && it.enemy == actor)) { - wframe_send(it, actor.(weaponentity), a, true); + wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true); } )); animdecide_setaction(actor, ANIMACTION_SHOOT, true); @@ -197,22 +184,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone { return; } - // ugly instagib hack to reuse the fire mode of the laser - makevectors(actor.v_angle); - W_Blaster_Attack( - actor, - weaponentity, - WEP_BLASTER.m_id | HITTYPE_SECONDARY, - WEP_CVAR_SEC(oknex, shotangle), - WEP_CVAR_SEC(oknex, damage), - WEP_CVAR_SEC(oknex, edgedamage), - WEP_CVAR_SEC(oknex, radius), - WEP_CVAR_SEC(oknex, force), - WEP_CVAR_SEC(oknex, speed), - WEP_CVAR_SEC(oknex, spread), - WEP_CVAR_SEC(oknex, delay), - WEP_CVAR_SEC(oknex, lifetime) - ); + BLASTER_SECONDARY_ATTACK(oknex, actor, weaponentity); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(oknex, animtime), w_ready); return; } @@ -246,7 +218,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone // if(fire & 2) // only eat ammo when the button is pressed // { // dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(oknex, charge_rate)); - // if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + // if(!(actor.items & IT_UNLIMITED_AMMO)) // { // // if this weapon is reloadable, decrease its load. Else decrease the player's ammo // if(autocvar_g_balance_vortex_reload_ammo) @@ -298,8 +270,8 @@ METHOD(OverkillNex, wr_setup, void(entity thiswep, entity actor, .entity weapone METHOD(OverkillNex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(oknex, ammo); - ammo_amount += (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).(weapon_load[WEP_OVERKILL_NEX.m_id]) >= WEP_CVAR_PRI(oknex, ammo)); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(oknex, ammo); + ammo_amount += (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(oknex, ammo)); return ammo_amount; } @@ -308,8 +280,8 @@ METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity we if (WEP_CVAR(oknex, secondary)) { // don't allow charging if we don't have enough ammo - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(oknex, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_NEX.m_id]) >= WEP_CVAR_SEC(oknex, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(oknex, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(oknex, ammo); return ammo_amount; } else