WarpZone_RefSys_AddInverse(flag, receiver); // wz1^-1 ... wzn^-1 receiver
targ_origin = WarpZone_RefSys_TransformOrigin(receiver, flag, (0.5 * (receiver.absmin + receiver.absmax))); // this is target origin as seen by the flag
flag.velocity = (normalize(targ_origin - player.origin) * autocvar_g_ctf_pass_velocity);
+
+ // main
+ flag.movetype = MOVETYPE_FLY;
+ flag.takedamage = DAMAGE_NO;
+ flag.pass_sender = player;
+ flag.pass_target = receiver;
+ flag.ctf_status = FLAG_PASSING;
+
+ // other
+ sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTN_NORM);
+ WarpZone_TrailParticles(world, particleeffectnum(flag.passeffect), player.origin, targ_origin);
+ ctf_EventLog("pass", flag.team, player);
break;
}
makevectors((player.v_angle_y * '0 1 0') + (player.v_angle_x * '0.5 0 0'));
flag_velocity = ('0 0 200' + ((v_forward * autocvar_g_ctf_drop_velocity) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_drop_strengthmultiplier : 1)));
flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, FALSE);
+ ctf_Handle_Drop(flag, player, droptype);
break;
}
case DROP_NORMAL:
{
flag.velocity = W_CalculateProjectileVelocity(player.velocity, ('0 0 200' + ('0 100 0' * crandom()) + ('100 0 0' * crandom())), FALSE);
- break;
- }
- }
-
- switch(droptype)
- {
- case DROP_PASS:
- {
- // main
- flag.movetype = MOVETYPE_FLY;
- flag.takedamage = DAMAGE_NO;
- flag.pass_sender = player;
- flag.pass_target = receiver;
- flag.ctf_status = FLAG_PASSING;
-
- // other
- sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTN_NORM);
- WarpZone_TrailParticles(world, particleeffectnum(flag.passeffect), player.origin, targ_origin);
- ctf_EventLog("pass", flag.team, player);
- break;
- }
-
- case DROP_RESET:
- {
- // do nothing
- break;
- }
-
- default:
- case DROP_THROW:
- case DROP_NORMAL:
- {
ctf_Handle_Drop(flag, player, droptype);
break;
}
return;
}
- case FLAG_PASSING: // todo make work with warpzones
+ case FLAG_PASSING:
{
vector targ_origin = ((self.pass_target.absmin + self.pass_target.absmax) * 0.5);
- vector old_targ_origin = targ_origin;
targ_origin = WarpZone_RefSys_TransformOrigin(self.pass_target, self, targ_origin); // origin of target as seen by the flag (us)
WarpZone_TraceLine(self.origin, targ_origin, MOVE_NOMONSTERS, self);
-
- print(strcat("self: ", vtos(self.origin), ", old: ", vtos(old_targ_origin), " (", ftos(vlen(self.origin - old_targ_origin)), "qu)"), ", transformed: ", vtos(targ_origin), " (", ftos(vlen(self.origin - targ_origin)), "qu)", ".\n");
if((self.pass_target == world)
|| (self.pass_target.deadflag != DEAD_NO)
{
vector desired_direction = normalize(targ_origin - self.origin);
vector current_direction = normalize(self.velocity);
-
self.velocity = (normalize(current_direction + (desired_direction * autocvar_g_ctf_pass_turnrate)) * autocvar_g_ctf_pass_velocity);
}
return;