Beispiel #1
0
/*
-------------------------
NPC_Mark1_Precache
-------------------------
*/
void NPC_Mark1_Precache(void)
{
	G_SoundIndex( "sound/chars/mark1/misc/mark1_wakeup");
	G_SoundIndex( "sound/chars/mark1/misc/shutdown");
	G_SoundIndex( "sound/chars/mark1/misc/walk");
	G_SoundIndex( "sound/chars/mark1/misc/run");
	G_SoundIndex( "sound/chars/mark1/misc/death1");
	G_SoundIndex( "sound/chars/mark1/misc/death2");
	G_SoundIndex( "sound/chars/mark1/misc/anger");
	G_SoundIndex( "sound/chars/mark1/misc/mark1_fire");
	G_SoundIndex( "sound/chars/mark1/misc/mark1_pain");
	G_SoundIndex( "sound/chars/mark1/misc/mark1_explo");

//	G_EffectIndex( "small_chunks");
	G_EffectIndex( "env/med_explode2");
	G_EffectIndex( "explosions/probeexplosion1");
	G_EffectIndex( "blaster/smoke_bolton");
	G_EffectIndex( "bryar/muzzle_flash");
	G_EffectIndex( "explosions/droidexplosion1" );

	RegisterItem( FindItemForAmmo( 	AMMO_METAL_BOLTS));
	RegisterItem( FindItemForAmmo( AMMO_BLASTER ));
	RegisterItem( FindItemForWeapon( WP_BOWCASTER ));
	RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL ));
}
Beispiel #2
0
//go through all classes on a team and register their
//weapons and items for precaching.
void G_SiegeRegisterWeaponsAndHoldables( int team ) {
	siegeTeam_t *stm = BG_SiegeFindThemeForTeam( team );

	if ( stm ) {
		int i = 0;
		siegeClass_t *scl;
		while ( i < stm->numClasses ) {
			scl = stm->classes[i];

			if ( scl ) {
				int j = 0;
				while ( j < WP_NUM_WEAPONS ) {
					if ( scl->weapons & (1 << j) ) { //we use this weapon so register it.
						RegisterItem( BG_FindItemForWeapon( j ) );
					}
					j++;
				}
				j = 0;
				while ( j < HI_NUM_HOLDABLE ) {
					if ( scl->invenItems & (1 << j) ) { //we use this item so register it.
						RegisterItem( BG_FindItemForHoldable( j ) );
					}
					j++;
				}
			}
			i++;
		}
	}
}
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// players always start with the base weapon
	RegisterItem( BG_FindItemForWeapon( WP_PISTOL ) );
	RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) );
	RegisterItem( BG_FindItem("Bag 'O Money" ) );
	RegisterItem( BG_FindItem("Hidden Stash" ) );
}
Beispiel #4
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// !TODO: Have map determine the base weapons:
	// players always start with the base weapon
	RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) );
	RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) );
	if( g_gametype.integer == GT_HARVESTER ) {
		RegisterItem( BG_FindItem( "Red Cube" ) );
		RegisterItem( BG_FindItem( "Blue Cube" ) );
	}
}
Beispiel #5
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, '0', bg_numItems );
	itemRegistered[ bg_numItems ] = 0;

	RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL ) );	//these are given in g_client, ClientSpawn(), but MUST be registered HERE, BEFORE cgame starts.
	RegisterItem( FindItemForWeapon( WP_STUN_BATON ) );			//these are given in g_client, ClientSpawn(), but MUST be registered HERE, BEFORE cgame starts.
	RegisterItem( FindItemForInventory( INV_ELECTROBINOCULARS ));
	// saber or baton is cached in SP_info_player_deathmatch now.

extern void Player_CacheFromPrevLevel(void);//g_client.cpp
	Player_CacheFromPrevLevel();	//reads from transition carry-over;
}
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// players always start with the base weapon
	RegisterItem( BG_FindItemForWeapon( WP_NIPPER ) );
	RegisterItem( BG_FindItemForWeapon( WP_PUNCHY ) );

	RegisterItem( BG_FindItemForWeapon( WP_KILLERDUCKS ) );

	if ( IsSyc() ) {
		RegisterItem( BG_FindItemForWeapon( WP_SPRAYPISTOL ) );
	}
}
Beispiel #7
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// players always start with the base weapon
	RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) );
	RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) );
#ifdef MISSIONPACK
	if( g_gametype.integer == GT_HARVESTER ) {
		RegisterItem( BG_FindItem( "Red Cube" ) );
		RegisterItem( BG_FindItem( "Blue Cube" ) );
	}
#endif
}
Beispiel #8
0
/*
-------------------------
NPC_ATST_Precache
-------------------------
*/
void NPC_ATST_Precache(void)
{
    G_SoundIndex( "sound/chars/atst/atst_damaged1" );
    G_SoundIndex( "sound/chars/atst/atst_damaged2" );

    RegisterItem( FindItemForWeapon( WP_ATST_MAIN ));	//precache the weapon
    RegisterItem( FindItemForWeapon( WP_BOWCASTER ));	//precache the weapon
    RegisterItem( FindItemForWeapon( WP_ROCKET_LAUNCHER ));	//precache the weapon

    G_EffectIndex( "env/med_explode2" );
//	G_EffectIndex( "smaller_chunks" );
    G_EffectIndex( "blaster/smoke_bolton" );
    G_EffectIndex( "explosions/droidexplosion1" );
}
Beispiel #9
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	if((item->giType == IT_TEAM && (g_instantgib.integer || g_rockets.integer) ) || (!g_instantgib.integer && !g_rockets.integer) )
	{
		//Don't load pickups in Elimination (or maybe... gives warnings)
		if (g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION && g_gametype.integer != GT_LMS)
			RegisterItem( item );
		//Registrer flags anyway in CTF Elimination:
		if (g_gametype.integer == GT_CTF_ELIMINATION && item->giType == IT_TEAM)
			RegisterItem( item );
		if ( G_ItemDisabled(item) )
			return;
	}
        if(!g_persistantpowerups.integer && item->giType == IT_PERSISTANT_POWERUP)
            return;

	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	ent->physicsBounce = 0.50;		// items are bouncy

	if (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS || 
			( item->giType != IT_TEAM && (g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer || g_gametype.integer==GT_CTF_ELIMINATION) ) ) {
		ent->s.eFlags |= EF_NODRAW; //Invisible in elimination
                ent->r.svFlags |= SVF_NOCLIENT;  //Don't broadcast
        }

	if(g_gametype.integer == GT_DOUBLE_D && (strcmp(ent->classname, "team_CTF_redflag")==0 || strcmp(ent->classname, "team_CTF_blueflag")==0 || strcmp(ent->classname, "team_CTF_neutralflag") == 0 || item->giType == IT_PERSISTANT_POWERUP  ))
		ent->s.eFlags |= EF_NODRAW; //Don't draw the flag models/persistant powerups

	if( g_gametype.integer != GT_1FCTF && strcmp(ent->classname, "team_CTF_neutralflag") == 0)
		ent->s.eFlags |= EF_NODRAW; // Don't draw the flag in CTF_elimination

        if(strcmp(ent->classname, "domination_point") == 0)
                ent->s.eFlags |= EF_NODRAW; // Don't draw domination_point. It is just a pointer to where the Domination points should be placed
	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}
}
Beispiel #10
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	ent->item = item;

	// targetname indicates they want to spawn it later
	if( ent->targetname )
	{
		ent->e_UseFunc = useF_item_spawn_use;
	}
	else
	{	// some movers spawn on the second frame, so delay item
		// spawns until the third frame so they can ride trains
		ent->nextthink = level.time + START_TIME_MOVERS_SPAWNED + 50;
		ent->e_ThinkFunc = thinkF_FinishSpawningItem;
	}

	ent->physicsBounce = 0.50;		// items are bouncy

	// Set a default infoString text color
	// NOTE: if we want to do cool cross-hair colors for items, we can just modify this, but for now, don't do it
	VectorSet( ent->startRGBA, 1.0f, 1.0f, 1.0f );
}
Beispiel #11
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	if ( G_ItemDisabled(item) )
		return;

	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	ent->physicsBounce = 0.50;		// items are bouncy

	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		// allow both teams to pick it up
		if ( ( ent->spawnflags & 2 ) && ( ent->spawnflags & 4 ) ) {
			ent->s.team = 255;
		}
		// only one team can pick it up
		else if ( ent->spawnflags & 2 )
			ent->s.team = TEAM_RED;
		else if ( ent->spawnflags & 4 )
			ent->s.team = TEAM_BLUE;
	}
}
Beispiel #12
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem( gentity_t *ent, gitem_t *item ) {
	char    *noise;
	int page;

	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	if ( G_SpawnString( "noise", 0, &noise ) ) {
		ent->noise_index = G_SoundIndex( noise );
	}

	ent->physicsBounce = 0.50;      // items are bouncy

	if ( ent->model ) {
		ent->s.modelindex2 = G_ModelIndex( ent->model );
	}

	if ( item->giType == IT_CLIPBOARD ) {
		if ( G_SpawnInt( "notebookpage", "1", &page ) ) {
			ent->key = page;
		}
	}

	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
	}
}
Beispiel #13
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
qboolean G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	
	if ( G_ItemDisabled(item) )
		return qfalse;

	if ( g_spacetrader.integer ) {
		if ( !G_ST_exec( ST_SPAWN_ITEM, ent, item ) )
			return qfalse;
	}

	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	ent->physicsBounce = 0.50;		// items are bouncy

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}

	return qtrue;
}
Beispiel #14
0
void NPC_Mark2_Precache( void ) {
	G_SoundIndex( "sound/chars/mark2/misc/mark2_explo" );// blows up on death
	G_SoundIndex( "sound/chars/mark2/misc/mark2_pain" );
	G_SoundIndex( "sound/chars/mark2/misc/mark2_fire" );
	G_SoundIndex( "sound/chars/mark2/misc/mark2_move_lp" );

	G_EffectIndex( "explosions/droidexplosion1" );
	G_EffectIndex( "env/med_explode2" );
	G_EffectIndex( "blaster/smoke_bolton" );
	G_EffectIndex( "bryar/muzzle_flash" );

	RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ) );
	RegisterItem( BG_FindItemForAmmo( AMMO_METAL_BOLTS ) );
	RegisterItem( BG_FindItemForAmmo( AMMO_POWERCELL ) );
	RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ) );
}
Beispiel #15
0
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// players always start with the base weapon
	//RAZMARK: Adding new weapons
	RegisterItem( BG_FindItemForWeapon( WP_QUANTIZER ) );
}
Beispiel #16
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	if ( G_ItemDisabled(item) )
		return;

	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	ent->physicsBounce = 0.50;		// items are bouncy

	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

#ifdef MISSIONPACK
	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}
#endif
}
Beispiel #17
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem(gentity_t * ent, gitem_t * item)
{
	G_SpawnFloat("random", "0", &ent->random);
	G_SpawnFloat("wait", "0", &ent->wait);

	//Elder: check spawn angles; client-side should make use of them too
	G_SpawnFloat("angle", "0", &ent->s.angles[1]);

	RegisterItem(item);
	if (G_ItemDisabled(item))
		return;

	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;
	//Makro - respawn function
	ent->reset = G_ResetItem;

	ent->physicsBounce = 0.50;	// items are bouncy

	if (item->giType == IT_POWERUP) {
		G_SoundIndex("sound/items/poweruprespawn.wav");
		G_SpawnFloat("noglobalsound", "0", &ent->speed);
	}
}
Beispiel #18
0
static void RegisterAssets( Vehicle_t *pVeh ) {
	//atst uses turret weapon
	RegisterItem( BG_FindItemForWeapon( WP_TURRET ) );

	//call the standard RegisterAssets now
	g_vehicleInfo[VEHICLE_BASE].RegisterAssets( pVeh );
}
void NPC_Probe_Precache(void)
{
	for ( int i = 1; i < 4; i++)
	{
		G_SoundIndex( va( "sound/chars/probe/misc/probetalk%d", i ) );
	}
	G_SoundIndex( "sound/chars/probe/misc/probedroidloop" );
	G_SoundIndex("sound/chars/probe/misc/anger1");
	G_SoundIndex("sound/chars/probe/misc/fire");

	G_EffectIndex( "chunks/probehead" );
	G_EffectIndex( "env/med_explode2" );
	G_EffectIndex( "explosions/probeexplosion1");
	G_EffectIndex( "bryar/muzzle_flash" );

	RegisterItem( FindItemForAmmo( AMMO_BLASTER ));
	RegisterItem( FindItemForWeapon( WP_BRYAR_PISTOL ) );
}
Beispiel #20
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems() 
{
#pragma message("this should probably be removed!")
	memset( itemRegistered, 0, sizeof( itemRegistered ) );
	// Always load health/ammo/fuel pickups
	RegisterItem( BG_FindItem( "5 Health" ) );
	RegisterItem( BG_FindItem( "25 Health" ) );
	RegisterItem( BG_FindItem( "50 Health" ) );
	RegisterItem( BG_FindItem( "Some Fuel" ) );
	RegisterItem( BG_FindItem( "More Fuel" ) );
	RegisterItem( BG_FindItem( "Shells" ) );
	RegisterItem( BG_FindItem( "Bullets" ) );
	RegisterItem( BG_FindItem( "Slugs" ) );
	RegisterItem( BG_FindItem( "Rockets" ) );
}
Beispiel #21
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
	memset( itemRegistered, 0, sizeof( itemRegistered ) );

	// players always start with the base weapon
	// (SA) Nope, not any more...

//----(SA)	this will be determined by the level or starting position, or the savegame
//			but for now, re-register the MP40 automatically
//	RegisterItem( BG_FindItemForWeapon( WP_MP40 ) );
	RegisterItem( BG_FindItem( "Med Health" ) );           // NERVE - SMF - this is so med packs properly display
}
Beispiel #22
0
static void RegisterAssets( Vehicle_t *pVeh )
{
	//atst uses turret weapon
#ifdef _JK2MP
	RegisterItem(BG_FindItemForWeapon(WP_TURRET));
#else
	// PUT SOMETHING HERE...
#endif

	//call the standard RegisterAssets now
	g_vehicleInfo[VEHICLE_BASE].RegisterAssets( pVeh );
}
Beispiel #23
0
//---------------------------------------------
void SP_misc_model_ammo_rack( gentity_t *ent )
{
// If BLASTER is checked...or nothing is checked then we'll do blasters
	if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL )))
	{
		if ( ent->spawnflags & RACK_WEAPONS )
		{
			RegisterItem( FindItemForWeapon( WP_BLASTER ));
		}
		RegisterItem( FindItemForAmmo( AMMO_BLASTER ));
	}

	if (( ent->spawnflags & RACK_METAL_BOLTS ))
	{
		if ( ent->spawnflags & RACK_WEAPONS )
		{
			RegisterItem( FindItemForWeapon( WP_REPEATER ));
		}
		RegisterItem( FindItemForAmmo( AMMO_METAL_BOLTS ));
	}

	if (( ent->spawnflags & RACK_ROCKETS ))
	{
		if ( ent->spawnflags & RACK_WEAPONS )
		{
			RegisterItem( FindItemForWeapon( WP_ROCKET_LAUNCHER ));
		}
		RegisterItem( FindItemForAmmo( AMMO_ROCKETS ));
	}

	if (( ent->spawnflags & RACK_PWR_CELL ))
	{
		RegisterItem( FindItemForAmmo( AMMO_POWERCELL ));
	}

	if (( ent->spawnflags & RACK_HEALTH ))
	{
		RegisterItem( FindItem( "item_medpak_instant" ));
	}

	ent->e_ThinkFunc = thinkF_spawn_rack_goods;
	ent->nextthink = level.time + 100;

	G_SetOrigin( ent, ent->s.origin );
	G_SetAngles( ent, ent->s.angles );

	ent->contents = CONTENTS_SHOTCLIP|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//CONTENTS_SOLID;//so use traces can go through them

	gi.linkentity( ent );
}
Beispiel #24
0
//---------------------------------------------
void SP_misc_model_cargo_small( gentity_t *ent )
{
	G_SpawnInt( "splashRadius", "96", &ent->splashRadius );
	G_SpawnInt( "splashDamage", "1", &ent->splashDamage );

	if (( ent->spawnflags & DROP_MEDPACK ))
	{
		RegisterItem( FindItem( "item_medpak_instant" ));
	}

	if (( ent->spawnflags & DROP_SHIELDS ))
	{
		RegisterItem( FindItem( "item_shield_sm_instant" ));
	}

	if (( ent->spawnflags & DROP_BACTA ))
	{
//		RegisterItem( FindItem( "item_bacta" ));
	}

	if (( ent->spawnflags & DROP_BATTERIES ))
	{
		RegisterItem( FindItem( "item_battery" ));
	}

	G_SpawnInt( "health", "25", &ent->health );

	SetMiscModelDefaults( ent, useF_NULL, "11", CONTENTS_SOLID|CONTENTS_OPAQUE|CONTENTS_BODY|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP, NULL, qtrue, NULL );
	ent->s.modelindex2 = G_ModelIndex("/models/map_objects/kejim/cargo_small.md3");	// Precache model

	// we only take damage from a heavy weapon class missile
	ent->flags |= FL_DMG_BY_HEAVY_WEAP_ONLY;

	ent->e_DieFunc = dieF_misc_model_cargo_die;

	ent->radius = 1.5f; // scale number of chunks spawned
}
Beispiel #25
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {
    for ( int i = 0; i < bg_numItems; i++ )
    {
        itemRegistered[i] = '0';
    }
    itemRegistered[ bg_numItems ] = 0;

    //these are given in g_client, ClientSpawn(), but MUST be registered HERE, BEFORE cgame starts.
    //RegisterItem( FindItemForWeapon( WP_NONE ) );	//has no item
    RegisterItem( FindItemForInventory( INV_ELECTROBINOCULARS ));
    //RegisterItem( FindItemForInventory( INV_BACTA_CANISTER ));
    // saber or baton is cached in SP_info_player_deathmatch now.

    extern void Player_CacheFromPrevLevel(void);//g_client.cpp
    Player_CacheFromPrevLevel();	//reads from transition carry-over;
}
Beispiel #26
0
/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	ent->item = item;

	// targetname indicates they want to spawn it later
	if( ent->targetname )
	{
		ent->e_UseFunc = useF_item_spawn_use;
	}
	else
	{	// some movers spawn on the second frame, so delay item
		// spawns until the third frame so they can ride trains
		ent->nextthink = level.time + START_TIME_MOVERS_SPAWNED + 50;
		ent->e_ThinkFunc = thinkF_FinishSpawningItem;
	}

	ent->physicsBounce = 0.50;		// items are bouncy

	// Set a default infoString text color
	// NOTE: if we want to do cool cross-hair colors for items, we can just modify this, but for now, don't do it
	VectorSet( ent->startRGBA, 1.0f, 1.0f, 1.0f );

	if ( ent->team && ent->team[0] )
	{
		ent->noDamageTeam = (team_t)GetIDForString( TeamTable, ent->team );
		if ( ent->noDamageTeam == TEAM_FREE )
		{
			G_Error("team name %s not recognized\n", ent->team);
		}
	}

	if ( ent->item
		&& ent->item->giType == IT_WEAPON
		&& ent->item->giTag == WP_SABER )
	{//weapon_saber item
		if ( !ent->count )
		{//can only pick up once
			ent->count = 1;
		}
	}
	ent->team = NULL;
}
Beispiel #27
0
/*
-------------------------
NPC_Sentry_Precache
-------------------------
*/
void NPC_Sentry_Precache( void ) {
    int i;

    G_SoundIndex( "sound/chars/sentry/misc/sentry_explo" );
    G_SoundIndex( "sound/chars/sentry/misc/sentry_pain" );
    G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_open" );
    G_SoundIndex( "sound/chars/sentry/misc/sentry_shield_close" );
    G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_1_lp" );
    G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" );

    for ( i = 1; i < 4; i++ ) {
        G_SoundIndex( va( "sound/chars/sentry/misc/talk%d", i ) );
    }

    G_EffectIndex( "bryar/muzzle_flash" );
    G_EffectIndex( "env/med_explode" );

    RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER ) );
}
Beispiel #28
0
void InitShooter( gentity_t *ent, int weapon ) {
	ent->use = Use_Shooter;
	ent->s.weapon = weapon;

	RegisterItem( BG_FindItemForWeapon( weapon ) );

	G_SetMovedir( &ent->s.angles, &ent->movedir );

	if ( !ent->random ) {
		ent->random = 1.0;
	}
	ent->random = sinf( M_PI * ent->random / 180 );
	// target might be a moving object, so we can't set movedir for it
	if ( ent->target ) {
		ent->think = InitShooter_Finish;
		ent->nextthink = level.time + 500;
	}
	trap->SV_LinkEntity( (sharedEntity_t *)ent );
}
Beispiel #29
0
/*
==============
ClearRegisteredItems
==============
*/
void ClearRegisteredItems( void ) {

	int i = 0;
	memset( itemRegistered, 0, sizeof( itemRegistered ) );


	// Navy Seals ++
	if ( g_cheats.integer == 0 ) {
		for ( i = 1 ; i < WP_NUM_WEAPONS - 1; i++ ) {
			// if ( i == WP_NUTSHELL ) continue;
			if ( i == WP_NONE ) {
				continue;
			}

			RegisterItem( BG_FindItemForWeapon( i ) );
		}
	}
	// Navy Seals --

}
Beispiel #30
0
/*
================
AICast_DelayedSpawnCast
================
*/
void AICast_DelayedSpawnCast( gentity_t *ent, int castType ) {
    int i;

    // ............................
    // head separation
    if ( !ent->aiSkin ) {
        G_SpawnString( "skin", "", &ent->aiSkin );
    }
    if ( !ent->aihSkin ) {
        G_SpawnString( "head", "default", &ent->aihSkin );
    }
    G_SpawnInt( "aiteam", "-1", &ent->aiTeam );
    // ............................


//----(SA)	make sure client registers the default weapons for this char
    for ( i = 0; aiDefaults[ent->aiCharacter].weapons[i]; i++ ) {
        RegisterItem( BG_FindItemForWeapon( aiDefaults[ent->aiCharacter].weapons[i] ) );
    }
//----(SA)	end

    // we have to wait a bit before spawning it, otherwise the server will just delete it, since it's treated like a client
    ent->think = AIChar_spawn;
    ent->nextthink = level.time + FRAMETIME * 4;  // have to wait more than 3 frames, since the server runs 3 frames before it clears all clients

    // we don't really want to start this character right away, but if we don't spawn the client
    // now, if the game gets saved after the character spawns in, when it gets re-loaded, the client
    // won't get spawned properly.
    if ( ent->spawnflags & 1 ) { // TriggerSpawn
        ent->AIScript_AlertEntity = AIChar_AIScript_AlertEntity;
        ent->aiInactive = qtrue;
    }

    // RF, had to move this down since some dev maps don't properly spawn the guys in, so we
    // get a crash when transitioning between levels after they all spawn at once (overloading
    // the client/server command buffers)
    ent->nextthink += FRAMETIME * ( ( numSpawningCast + 1 ) / 3 );    // space them out a bit so we don't overflow the client

    ent->aiCharacter = castType;
    numSpawningCast++;
}