Exemplo n.º 1
0
void turretG2_set_models( gentity_t *self, qboolean dying )
{
    if ( dying )
    {
        if ( !(self->spawnflags&SPF_TURRETG2_TURBO) )
        {
            self->s.modelindex = G_ModelIndex( name2 );
            self->s.modelindex2 = G_ModelIndex( name );
        }

        trap_G2API_RemoveGhoul2Model( &self->ghoul2, 0 );
        G_KillG2Queue( self->s.number );
        self->s.modelGhoul2 = 0;
        /*
        trap_G2API_InitGhoul2Model( &self->ghoul2,
        							name2,
        							0, //base->s.modelindex,
        							//note, this is not the same kind of index - this one's referring to the actual
        							//index of the model in the g2 instance, whereas modelindex is the index of a
        							//configstring -rww
        							0,
        							0,
        							0,
        							0);
        */
    }
    else
    {
        if ( !(self->spawnflags&SPF_TURRETG2_TURBO) )
        {
            self->s.modelindex = G_ModelIndex( name );
            self->s.modelindex2 = G_ModelIndex( name2 );
            //set the new onw
            trap_G2API_InitGhoul2Model( &self->ghoul2,
                                        name,
                                        0, //base->s.modelindex,
                                        //note, this is not the same kind of index - this one's referring to the actual
                                        //index of the model in the g2 instance, whereas modelindex is the index of a
                                        //configstring -rww
                                        0,
                                        0,
                                        0,
                                        0);
        }
        else
        {
            self->s.modelindex = G_ModelIndex( name3 );
            //set the new onw
            trap_G2API_InitGhoul2Model( &self->ghoul2,
                                        name3,
                                        0, //base->s.modelindex,
                                        //note, this is not the same kind of index - this one's referring to the actual
                                        //index of the model in the g2 instance, whereas modelindex is the index of a
                                        //configstring -rww
                                        0,
                                        0,
                                        0,
                                        0);
        }

        self->s.modelGhoul2 = 1;
        if ( (self->spawnflags&SPF_TURRETG2_TURBO) )
        {   //larger
            self->s.g2radius = 128;
        }
        else
        {
            self->s.g2radius = 80;
        }

        if ( (self->spawnflags&SPF_TURRETG2_TURBO) )
        {   //different pitch bone and muzzle flash points
            G2Tur_SetBoneAngles(self, "pitch", vec3_origin);
            self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle1" );
            self->genericValue12 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle2" );
        }
        else
        {
            G2Tur_SetBoneAngles(self, "Bone_body", vec3_origin);
            self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*flash03" );
        }
    }
}
Exemplo n.º 2
0
void JMSaberTouch(gentity_t *self, gentity_t *other, trace_t *trace)
{
	int i = 0;
//	gentity_t *te;

	if (!other || !other->client || other->health < 1)
	{
		return;
	}

	if (self->enemy)
	{
		return;
	}

	if (!self->s.modelindex)
	{
		return;
	}

	if (other->client->ps.stats[STAT_WEAPONS] & (1 << WP_SABER))
	{
		return;
	}

	if (other->client->ps.isJediMaster)
	{
		return;
	}

	self->enemy = other;
	other->client->ps.stats[STAT_WEAPONS] = (1 << WP_SABER);
	other->client->ps.weapon = WP_SABER;
	other->s.weapon = WP_SABER;
	G_AddEvent(other, EV_BECOME_JEDIMASTER, 0);

	// Track the jedi master 
	trap_SetConfigstring ( CS_CLIENT_JEDIMASTER, va("%i", other->s.number ) );

	if (g_spawnInvulnerability.integer)
	{
		other->client->ps.eFlags |= EF_INVULNERABLE;
		other->client->invulnerableTimer = level.time + g_spawnInvulnerability.integer;
	}

	trap_SendServerCommand( -1, va("cp \"%s %s\n\"", other->client->pers.netname, G_GetStripEdString("SVINGAME", "BECOMEJM")) );

	other->client->ps.isJediMaster = qtrue;
	other->client->ps.saberIndex = self->s.number;

	if (other->health < 200 && other->health > 0)
	{ //full health when you become the Jedi Master
		other->client->ps.stats[STAT_HEALTH] = other->health = 200;
	}

	if (other->client->ps.fd.forcePower < 100)
	{
		other->client->ps.fd.forcePower = 100;
	}

	while (i < NUM_FORCE_POWERS)
	{
		other->client->ps.fd.forcePowersKnown |= (1 << i);
		other->client->ps.fd.forcePowerLevel[i] = FORCE_LEVEL_3;

		i++;
	}

	self->pos2[0] = 1;
	self->pos2[1] = level.time + JMSABER_RESPAWN_TIME;

	self->s.modelindex = 0;
	self->s.eFlags |= EF_NODRAW;
	self->s.modelGhoul2 = 0;
	self->s.eType = ET_GENERAL;

	/*
	te = G_TempEntity( vec3_origin, EV_DESTROY_GHOUL2_INSTANCE );
	te->r.svFlags |= SVF_BROADCAST;
	te->s.eventParm = self->s.number;
	*/
	G_KillG2Queue(self->s.number);

	return;
}