Ejemplo n.º 1
0
gentity_t *fire_grapple (gentity_t *self, vec3_t start, vec3_t dir) {
    float vel = g_hookSpeed.integer;
    gentity_t	*hook;
    //gentity_t *missile;

    VectorNormalize (dir);

    vel = vel + DotProduct(dir, self->client->ps.velocity)*g_hookInheritance.value; //Inheritence scale

    if (vel < 250)
        vel = 250;

    hook = G_Spawn(qtrue);
    hook->classname = "laserTrap";
    hook->nextthink = level.time + 30000;
    hook->think = Weapon_HookFree;
    hook->s.eType = ET_MISSILE;
    hook->s.clientNum = self->s.clientNum;
    hook->r.svFlags = SVF_USE_CURRENT_ORIGIN;
    hook->s.weapon = WP_BRYAR_PISTOL;//WP_GRAPPLING_HOOK;
    hook->r.ownerNum = self->s.number;
    hook->methodOfDeath = MOD_STUN_BATON;//MOD_GRAPPLE
    hook->clipmask = MASK_SHOT;
    hook->parent = self;

    hook->s.owner = self->s.number;

    hook->s.pos.trType = TR_LINEAR;
    hook->s.pos.trTime = level.time;// - MISSILE_PRESTEP_TIME;
    hook->s.otherEntityNum = -1;
    hook->s.groundEntityNum = -1;

    hook->s.saberInFlight = qtrue;

    //hook->target_ent = NULL; // ???

    VectorCopy( start, hook->s.pos.trBase );

    if ( self->client->pers.haste )
        VectorScale( dir, vel * 1.3, hook->s.pos.trDelta );
    else
        VectorScale( dir, vel, hook->s.pos.trDelta );

    SnapVector( hook->s.pos.trDelta );			// save net bandwidth
    VectorCopy (start, hook->r.currentOrigin);

    self->client->hook = hook;

    //hm.
    G_Sound( self, CHAN_AUTO, G_SoundIndex( "sound/weapons/melee/swing2.wav" ) );
    StandardSetBodyAnim(self, BOTH_FORCEPUSH, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS, SETANIM_TORSO);
    //G_AddEvent( hook, EV_FIRE_WEAPON, 0 );

    return hook;
}
Ejemplo n.º 2
0
//This void is a mix of requirements to meet for the emote to work, and the custom emote animation itself.
void cm_TheEmote(int animation, gentity_t *ent, qboolean freeze)
{
	//OpenRP - Emote + /me support
	void G_Say(gentity_t *ent, gentity_t *target, int mode, const char *chatText);
	char *msg = ConcatArgs(1);

	if (ent->client->sess.spectatorState == SPECTATOR_FOLLOW || ent->client->sess.spectatorState == SPECTATOR_FREE) {
		return;
	}
	if (ent->client->ps.groundEntityNum == ENTITYNUM_NONE){
		return;
	}
	if (ent->client->ps.saberHolstered < 2){
		ent->client->ps.saberHolstered = 2;
	}
	if (BG_SaberInAttack(ent->client->ps.saberMove) || BG_SaberInSpecialAttack(ent->client->ps.saberMove) || ent->client->ps.saberLockTime){
		return;
	}
	if (freeze == qtrue)
	{
		if (ent->client->ps.forceDodgeAnim == animation)
		{
			//ent->client->emote_freeze=0;
			ent->client->ps.saberCanThrow = qtrue;
			ent->client->ps.forceDodgeAnim = 0;
			ent->client->ps.forceHandExtendTime = 0;
		}
		else
		{
			ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
			ent->client->ps.forceDodgeAnim = animation;
			ent->client->ps.forceHandExtendTime = level.time + Q3_INFINITE;
			//ent->client->ps.persistant[PERS_REGEN] = 1;
			ent->client->ps.saberCanThrow = qfalse;
			//ent->client->emote_freeze=1;
		}
	}
	else
	{
		StandardSetBodyAnim(ent, animation, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS);
	}
	//OpenRP - Emote + /me support
	if (trap->Argc() >= 2)
		G_Say(ent, NULL, SAY_ME, msg);

	trap->SendServerCommand(ent - g_entities, "print \"^3Note: Use the emote's command again to get out of the emote.\n\"");
	return;
}