SERVER: Fix lightning colors for Traps and Wunderwaffe

This commit is contained in:
cypress 2023-11-22 09:40:11 -05:00
parent 2672e94387
commit fce7de38d6
3 changed files with 52 additions and 18 deletions

View file

@ -130,12 +130,12 @@ void zapper_play () {
#ifdef FTE #ifdef FTE
te_lightning2(self, self.origin, zents.origin); te_lightning1(self, self.origin, zents.origin);
#else #else
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2); WriteByte (MSG_BROADCAST, TE_LIGHTNING1);
WriteEntity (MSG_BROADCAST, self); WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x); WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y); WriteCoord (MSG_BROADCAST, org_y);

View file

@ -193,8 +193,11 @@ void() tesla_arc = {
vector target_pos = best_ent.origin + tesla_arc_ofs_for_ent(best_ent); vector target_pos = best_ent.origin + tesla_arc_ofs_for_ent(best_ent);
#ifdef FTE #ifdef FTE
te_lightning1(self, source_pos, target_pos); te_lightning1(self, source_pos, target_pos);
#else #else
WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_LIGHTNING1); WriteByte(MSG_BROADCAST, TE_LIGHTNING1);
WriteEntity(MSG_BROADCAST, self); WriteEntity(MSG_BROADCAST, self);
@ -204,7 +207,9 @@ void() tesla_arc = {
WriteCoord(MSG_BROADCAST, target_pos.x); WriteCoord(MSG_BROADCAST, target_pos.x);
WriteCoord(MSG_BROADCAST, target_pos.y); WriteCoord(MSG_BROADCAST, target_pos.y);
WriteCoord(MSG_BROADCAST, target_pos.z); WriteCoord(MSG_BROADCAST, target_pos.z);
#endif // FTE #endif // FTE
} }
// No ent to arc to, tell arc parent to resume its search // No ent to arc to, tell arc parent to resume its search
// else if(self.tesla_arc_parent != world) { // else if(self.tesla_arc_parent != world) {
@ -220,14 +225,14 @@ void() tesla_arc = {
// Fire lightning out of the gun // Fire lightning out of the gun
void() W_FireTesla = void() W_FireTesla =
{ {
vector source; vector source;
makevectors(self.v_angle);
source = self.origin + self.view_ofs; source = self.origin + self.view_ofs;
makevectors(self.v_angle); vector barrel_ofs = GetWeaponFlash_Offset(self.weapon);
vector barrel_ofs = '5.560 -3 30'; source += v_right * (barrel_ofs.x/1000);
source += v_right * barrel_ofs.x; source += v_up * (barrel_ofs.y/1000);
source += v_up * barrel_ofs.y; source += v_forward * (barrel_ofs.z/1000);
source += v_forward * barrel_ofs.z;
#ifdef FTE #ifdef FTE
@ -240,21 +245,49 @@ void() W_FireTesla =
self.dimension_hit = HITBOX_DIM_ZOMBIES; self.dimension_hit = HITBOX_DIM_ZOMBIES;
#endif // FTE #endif // FTE
// Initial Lightning is Red when Pack-A-Punched
if (IsPapWeapon(self.weapon)) {
#ifdef FTE #ifdef FTE
te_lightning1(world, source, trace_endpos);
te_lightning2(world, source, trace_endpos);
#else #else
WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_LIGHTNING2); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteEntity(MSG_BROADCAST, self); WriteByte(MSG_BROADCAST, TE_LIGHTNING2);
WriteCoord(MSG_BROADCAST, source_x); WriteEntity(MSG_BROADCAST, self);
WriteCoord(MSG_BROADCAST, source_y); WriteCoord(MSG_BROADCAST, source_x);
WriteCoord(MSG_BROADCAST, source_z); WriteCoord(MSG_BROADCAST, source_y);
WriteCoord(MSG_BROADCAST, trace_endpos_x); WriteCoord(MSG_BROADCAST, source_z);
WriteCoord(MSG_BROADCAST, trace_endpos_y); WriteCoord(MSG_BROADCAST, trace_endpos_x);
WriteCoord(MSG_BROADCAST, trace_endpos_z); WriteCoord(MSG_BROADCAST, trace_endpos_y);
WriteCoord(MSG_BROADCAST, trace_endpos_z);
#endif // FTE #endif // FTE
} else {
#ifdef FTE
te_lightning1(world, source, trace_endpos);
#else
WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_LIGHTNING1);
WriteEntity(MSG_BROADCAST, self);
WriteCoord(MSG_BROADCAST, source_x);
WriteCoord(MSG_BROADCAST, source_y);
WriteCoord(MSG_BROADCAST, source_z);
WriteCoord(MSG_BROADCAST, trace_endpos_x);
WriteCoord(MSG_BROADCAST, trace_endpos_y);
WriteCoord(MSG_BROADCAST, trace_endpos_z);
#endif // FTE
}
self.tesla_n_kills = 0; self.tesla_n_kills = 0;
entity hit_ent = trace_ent; entity hit_ent = trace_ent;

View file

@ -3700,6 +3700,7 @@ void(float weptype) precache_extra =
precache_sound("sounds/weapons/tesla/clipoff.wav"); precache_sound("sounds/weapons/tesla/clipoff.wav");
precache_sound("sounds/weapons/tesla/switchon.wav"); precache_sound("sounds/weapons/tesla/switchon.wav");
precache_sound("sounds/weapons/tesla/shoot.wav"); precache_sound("sounds/weapons/tesla/shoot.wav");
precache_sound("sounds/machines/elec_shock.wav");
break; break;
case W_BK: case W_BK:
case W_KRAUS: case W_KRAUS: