From: Mario Date: Mon, 23 Dec 2024 13:46:43 +0000 (+1000) Subject: More reference cleanup, remove poorly designed per-weapon crosshair trueaim logic X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F1399%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git More reference cleanup, remove poorly designed per-weapon crosshair trueaim logic --- diff --git a/qcsrc/client/hud/crosshair.qc b/qcsrc/client/hud/crosshair.qc index 39d568696..1f2139fb7 100644 --- a/qcsrc/client/hud/crosshair.qc +++ b/qcsrc/client/hud/crosshair.qc @@ -49,7 +49,7 @@ void TrueAim_Init() (trueaim_rifle = new_pure(trueaim_rifle)).dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE; } -float EnemyHitCheck() +int EnemyHitCheck() { float t, n; wcross_origin = project_3d_to_2d(trace_endpos); @@ -70,9 +70,10 @@ float EnemyHitCheck() return SHOTTYPE_HITENEMY; } -float TrueAimCheck(entity wepent) +int TrueAimCheck(entity wepent) { - if(wepent.activeweapon.spawnflags & WEP_FLAG_NOTRUEAIM) + Weapon wep = wepent.activeweapon; + if(wep.spawnflags & WEP_FLAG_NOTRUEAIM) return SHOTTYPE_HITWORLD; float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us? @@ -86,39 +87,11 @@ float TrueAimCheck(entity wepent) ta = trueaim; mv = MOVE_NOMONSTERS; - switch(wepent.activeweapon) // WEAPONTODO - { - case WEP_VORTEX: - case WEP_OVERKILL_NEX: - case WEP_VAPORIZER: - mv = MOVE_NORMAL; - break; - case WEP_RIFLE: - ta = trueaim_rifle; - mv = MOVE_NORMAL; - if(zoomscript_caught) - { - tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * max_shot_distance, mv, ta); - return EnemyHitCheck(); - } - break; - case WEP_DEVASTATOR: // projectile has a size! - mi = '-3 -3 -3'; - ma = '3 3 3'; - break; - case WEP_FIREBALL: // projectile has a size! - mi = '-16 -16 -16'; - ma = '16 16 16'; - break; - case WEP_SEEKER: // projectile has a size! - mi = '-2 -2 -2'; - ma = '2 2 2'; - break; - case WEP_ELECTRO: // projectile has a size! - mi = '0 0 -3'; - ma = '0 0 -3'; - break; - } + if(wep.spawnflags & WEP_TYPE_HITSCAN) + mv = MOVE_NORMAL; // accurate enemy hit detection + + if(wep == WEP_RIFLE) + ta = trueaim_rifle; // WEAPONTODO vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * STAT(VIEWHEIGHT)); diff --git a/qcsrc/common/effects/all.inc b/qcsrc/common/effects/all.inc index 01b74119b..aa73cc7e4 100644 --- a/qcsrc/common/effects/all.inc +++ b/qcsrc/common/effects/all.inc @@ -237,11 +237,17 @@ EFFECT(0, ITEM_PICKUP, "item_pickup") EFFECT(0, ITEM_RESPAWN, "item_respawn") EFFECT(0, ITEM_DESPAWN, "item_despawn") +// FIXME: needs custom effect +EFFECT(0, ONS_ELECTRICITY_EXPLODE, "electro_ballexplode") EFFECT(0, ONS_GENERATOR_DAMAGED, "torch_small") EFFECT(0, ONS_GENERATOR_GIB, "onslaught_generator_gib_explode") EFFECT(0, ONS_GENERATOR_EXPLODE, "onslaught_generator_smallexplosion") EFFECT(0, ONS_GENERATOR_EXPLODE2, "onslaught_generator_finalexplosion") +// FIXME: needs custom effect +EFFECT(0, ONS_SHOCKWAVE, "electro_combo") +// FIXME: needs custom effect +EFFECT(0, KA_BALL_RESPAWN, "electro_combo") EFFECT(0, LASER_DEADLY, "laser_deadly") diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 9f694a0e0..e3791acbb 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -63,8 +63,8 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated this.nextthink = time + autocvar_g_keepawayball_respawntime; navigation_dynamicgoal_set(this, NULL); - Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1); - Send_Effect(EFFECT_ELECTRO_COMBO, this.origin, '0 0 0', 1); + Send_Effect(EFFECT_KA_BALL_RESPAWN, oldballorigin, '0 0 0', 1); + Send_Effect(EFFECT_KA_BALL_RESPAWN, this.origin, '0 0 0', 1); WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); WaypointSprite_Ping(this.waypointsprite_attachedforcarrier); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index ad0811649..784d785cb 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -54,7 +54,7 @@ void generator_draw(entity this) if(random() < 0.9 - GetResource(this, RES_HEALTH) / this.max_health) if(random() < 0.01) { - pointparticles(EFFECT_ELECTRO_BALLEXPLODE, this.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1); + pointparticles(EFFECT_ONS_ELECTRICITY_EXPLODE, this.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1); sound(this, CH_TRIGGER, SND_ONS_ELECTRICITY_EXPLODE, VOL_BASE, ATTEN_NORM); } else @@ -75,7 +75,7 @@ void generator_draw(entity this) if(this.count==40||this.count==20) { sound(this, CH_TRIGGER, SND_ONS_SHOCKWAVE, VOL_BASE, ATTEN_NORM); - pointparticles(EFFECT_ELECTRO_COMBO, this.origin, '0 0 0', 6); + pointparticles(EFFECT_ONS_SHOCKWAVE, this.origin, '0 0 0', 6); } // rays diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc index 0935b9709..16bea2df9 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc @@ -60,8 +60,8 @@ void tka_RespawnBall(entity this) // runs whenever the ball needs to be relocate this.nextthink = time + autocvar_g_tkaball_respawntime; navigation_dynamicgoal_set(this, NULL); - Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1); - Send_Effect(EFFECT_ELECTRO_COMBO, this.origin, '0 0 0', 1); + Send_Effect(EFFECT_KA_BALL_RESPAWN, oldballorigin, '0 0 0', 1); + Send_Effect(EFFECT_KA_BALL_RESPAWN, this.origin, '0 0 0', 1); WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); WaypointSprite_Ping(this.waypointsprite_attachedforcarrier); diff --git a/qcsrc/common/sounds/all.inc b/qcsrc/common/sounds/all.inc index 4af86ab29..de5bb6d35 100644 --- a/qcsrc/common/sounds/all.inc +++ b/qcsrc/common/sounds/all.inc @@ -34,7 +34,7 @@ Sound SND_RIC_RANDOM() { return REGISTRY_GET(Sounds, SND_RIC1.m_id + rint(random() * 2)); } -SOUND(ROCKET_IMPACT, W_Sound("rocket_impact")); +SOUND(ROCKET_IMPACT, W_Sound("rocket_impact")); // heavily used as a generic explosion sound SOUND(STRENGTH_FIRE, W_Sound("strength_fire")); SOUND(UNAVAILABLE, W_Sound("unavailable")); SOUND(WEAPONPICKUP, W_Sound("weaponpickup")); diff --git a/qcsrc/common/turrets/turret/ewheel_weapon.qc b/qcsrc/common/turrets/turret/ewheel_weapon.qc index 483bb214d..86dcc8e1c 100644 --- a/qcsrc/common/turrets/turret/ewheel_weapon.qc +++ b/qcsrc/common/turrets/turret/ewheel_weapon.qc @@ -7,14 +7,14 @@ SOUND(EWheelAttack_FIRE, W_Sound("lasergun_fire")); METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_EWheelAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_EWHEEL.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } turret_do_updates(actor); diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 14f99f6e5..ae0130c90 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -7,7 +7,7 @@ SOUND(FlacAttack_FIRE, W_Sound("hagar_fire")); METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_FlacAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_FLAC.m_id); @@ -15,7 +15,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.tur_impacttime = 10; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } turret_tag_fire_update(actor); diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index afe862b7e..1d30f308e 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -10,7 +10,7 @@ SOUND(HellionAttack_FIRE, W_Sound("rocket_fire")); METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_HellionAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_HELLION.m_id); @@ -18,7 +18,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.shot_radius = 500; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } if (!isPlayer) { if (actor.tur_head.frame != 0) diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index dc77480be..47220d35c 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -15,14 +15,14 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_HunterKillerAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_HK.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } entity missile = turret_projectile(actor, SND_HunterKillerAttack_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false); te_explosion (missile.origin); diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 1fa382fe3..d24fb0099 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -10,7 +10,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PHASER.m_id); @@ -18,7 +18,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.shot_speed = 1; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } entity beam = new(PhaserTurret_beam); setmodel(beam, MDL_TUR_PHASER_BEAM); diff --git a/qcsrc/common/turrets/turret/plasma_weapon.qc b/qcsrc/common/turrets/turret/plasma_weapon.qc index 48c924c36..6dc97f75b 100644 --- a/qcsrc/common/turrets/turret/plasma_weapon.qc +++ b/qcsrc/common/turrets/turret/plasma_weapon.qc @@ -5,14 +5,14 @@ SOUND(PlasmaAttack_FIRE, W_Sound("hagar_fire")); METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PlasmaAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PLASMA.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } entity missile = turret_projectile(actor, SND_PlasmaAttack_FIRE, 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true); missile.missile_flags = MIF_SPLASH; diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qc b/qcsrc/common/turrets/turret/tesla_weapon.qc index e877ce247..195b523bc 100644 --- a/qcsrc/common/turrets/turret/tesla_weapon.qc +++ b/qcsrc/common/turrets/turret/tesla_weapon.qc @@ -7,14 +7,14 @@ SOUND(TeslaCoilTurretAttack_FIRE, W_Sound("electro_fire")); METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_TeslaCoilTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_TESLA.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } float d = actor.shot_dmg; diff --git a/qcsrc/common/turrets/turret/walker_weapon.qc b/qcsrc/common/turrets/turret/walker_weapon.qc index 21356d0f7..cc565dee2 100644 --- a/qcsrc/common/turrets/turret/walker_weapon.qc +++ b/qcsrc/common/turrets/turret/walker_weapon.qc @@ -6,14 +6,14 @@ SOUND(WalkerTurretAttack_FIRE, W_Sound("uzi_fire")); METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) - if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_ELECTRO, refire))) { + if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 1)) { if (isPlayer) { turret_initparams(actor); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_WalkerTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_WALK_GUN.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; - weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_ELECTRO, animtime), w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0.5, w_ready); } sound (actor, CH_WEAPON_A, SND_WalkerTurretAttack_FIRE, VOL_BASE, ATTEN_NORM); fireBullet(actor, weaponentity, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, 0, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, EFFECT_BULLET);