这篇教程C++ BG_FindItemForWeapon函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BG_FindItemForWeapon函数的典型用法代码示例。如果您正苦于以下问题:C++ BG_FindItemForWeapon函数的具体用法?C++ BG_FindItemForWeapon怎么用?C++ BG_FindItemForWeapon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BG_FindItemForWeapon函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: NPC_Mark1_Precache/*-------------------------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( BG_FindItemForAmmo( AMMO_METAL_BOLTS)); RegisterItem( BG_FindItemForAmmo( AMMO_BLASTER )); RegisterItem( BG_FindItemForWeapon( WP_BOWCASTER )); RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ));}
开发者ID:Chedo,项目名称:OpenJK,代码行数:30,
示例2: ClearRegisteredItems/*==============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" ) );}
开发者ID:ballju,项目名称:SpaceTrader-GPL-1.1.14,代码行数:14,
示例3: ClearRegisteredItems/*==============ClearRegisteredItems==============*/void ClearRegisteredItems(void){ memset(itemRegistered, 0, sizeof(itemRegistered)); // players always start with the base weapon //Blaze: Changed WP_MACHINEGUN to WP_PISTOL and WP_GAUNTLET to WP_KNIFE RegisterItem(BG_FindItemForWeapon(WP_PISTOL)); RegisterItem(BG_FindItemForWeapon(WP_KNIFE)); //Elder: add unique items here RegisterItem(BG_FindItemForHoldable(HI_KEVLAR)); RegisterItem(BG_FindItemForHoldable(HI_SLIPPERS)); RegisterItem(BG_FindItemForHoldable(HI_SILENCER)); RegisterItem(BG_FindItemForHoldable(HI_BANDOLIER)); RegisterItem(BG_FindItemForHoldable(HI_LASER)); // JBravo: adding the helmet if (g_RQ3_haveHelmet.integer) RegisterItem(BG_FindItemForHoldable(HI_HELMET)); //Makro - all weapons should be loaded in teamplay //JBravo: and CTF if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF || g_gametype.integer == GT_TEAM) { RegisterItem(BG_FindItemForWeapon(WP_M3)); RegisterItem(BG_FindItemForWeapon(WP_MP5)); RegisterItem(BG_FindItemForWeapon(WP_HANDCANNON)); RegisterItem(BG_FindItemForWeapon(WP_SSG3000)); RegisterItem(BG_FindItemForWeapon(WP_M4)); RegisterItem(BG_FindItemForWeapon(WP_AKIMBO)); RegisterItem(BG_FindItemForWeapon(WP_GRENADE)); }}
开发者ID:zturtleman,项目名称:reaction,代码行数:34,
示例4: ClearRegisteredItems/*==============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" ) ); }}
开发者ID:LavenderMoon,项目名称:mint-arena,代码行数:17,
示例5: ClearRegisteredItems/*==============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 ) ); }}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:18,
示例6: ClearRegisteredItems/*==============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}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:18,
示例7: NPC_ATST_Precachevoid NPC_ATST_Precache( void ) { G_SoundIndex( "sound/chars/atst/atst_damaged1" ); G_SoundIndex( "sound/chars/atst/atst_damaged2" ); // RegisterItem( BG_FindItemForWeapon( WP_ATST_MAIN )); //precache the weapon //rwwFIXMEFIXME: add this weapon RegisterItem( BG_FindItemForWeapon( WP_BOWCASTER ) ); //precache the weapon RegisterItem( BG_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" );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:14,
示例8: RegisterAssetsstatic 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 );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:7,
示例9: ClearRegisteredItemsvoid ClearRegisteredItems( void ) { memset( itemRegistered, 0, sizeof( itemRegistered ) ); // players always start with the base weapon //RAZMARK: Adding new weapons RegisterItem( BG_FindItemForWeapon( WP_QUANTIZER ) );}
开发者ID:Razish,项目名称:QtZ,代码行数:7,
示例10: TossClientItems/*=================TossClientItemsToss the weapon and powerups for the killed player=================*/void TossClientItems( gentity_t *self ) { gitem_t *item; int weapon; float angle; int i; gentity_t *drop; // drop the weapon if not a gauntlet or machinegun weapon = self->s.weapon; //Never drop in elimination or last man standing mode! if( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS) return; // make a special check to see if they are changing to a new // weapon that isn't the mg or gauntlet. Without this, a client // can pick up a weapon, be killed, and not drop the weapon because // their weapon change hasn't completed yet and they are still holding the MG. if ( weapon == WP_MACHINEGUN || weapon == WP_GRAPPLING_HOOK ) { if ( self->client->ps.weaponstate == WEAPON_DROPPING ) { weapon = self->client->pers.cmd.weapon; } if ( !( self->client->ps.stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) { weapon = WP_NONE; } } if (g_instantgib.integer || g_rockets.integer || g_gametype.integer == GT_CTF_ELIMINATION || g_elimination_allgametypes.integer){ //Nothing! } else if ( weapon > WP_MACHINEGUN && weapon != WP_GRAPPLING_HOOK && self->client->ps.ammo[ weapon ] ) { // find the item type for this weapon item = BG_FindItemForWeapon( weapon ); // spawn the item Drop_Item( self, item, 0 ); } // drop all the powerups if not in teamplay if ( g_gametype.integer != GT_TEAM ) { angle = 45; for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) { if ( self->client->ps.powerups[ i ] > level.time ) { item = BG_FindItemForPowerup( i ); if ( !item ) { continue; } drop = Drop_Item( self, item, angle ); // decide how many seconds it has left drop->count = ( self->client->ps.powerups[ i ] - level.time ) / 1000; if ( drop->count < 1 ) { drop->count = 1; } angle += 45; } } }}
开发者ID:d00man,项目名称:openarena-vm,代码行数:67,
示例11: G_SiegeRegisterWeaponsAndHoldables//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++; } }}
开发者ID:boyisgood86,项目名称:japp,代码行数:31,
示例12: RegisterAssetsstatic 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 );}
开发者ID:PJayB,项目名称:jk3src,代码行数:12,
示例13: TossPlayerItems/*=================TossPlayerItemsToss the weapon and powerups for the killed player=================*/void TossPlayerItems( gentity_t *self ) { gitem_t *item; int weapon; float angle; int i; gentity_t *drop; // drop the weapon if not a gauntlet or machinegun weapon = self->s.weapon; // make a special check to see if they are changing to a new // weapon that isn't the mg or gauntlet. Without this, a player // can pick up a weapon, be killed, and not drop the weapon because // their weapon change hasn't completed yet and they are still holding the MG. if ( weapon == WP_MACHINEGUN || weapon == WP_GRAPPLING_HOOK ) { if ( self->player->ps.weaponstate == WEAPON_DROPPING ) { BG_DecomposeUserCmdValue( self->player->pers.cmd.stateValue, &weapon ); } if ( !( self->player->ps.stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) { weapon = WP_NONE; } } if ( weapon > WP_MACHINEGUN && weapon != WP_GRAPPLING_HOOK && self->player->ps.ammo[ weapon ] ) { // find the item type for this weapon item = BG_FindItemForWeapon( weapon ); // spawn the item Drop_Item( self, item, 0 ); } // drop all the powerups if not in teamplay if ( g_gametype.integer != GT_TEAM ) { angle = 45; for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) { if ( self->player->ps.powerups[ i ] > level.time ) { item = BG_FindItemForPowerup( i ); if ( !item ) { continue; } drop = Drop_Item( self, item, angle ); // decide how many seconds it has left drop->count = ( self->player->ps.powerups[ i ] - level.time ) / 1000; if ( drop->count < 1 ) { drop->count = 1; } angle += 45; } } }}
开发者ID:mecwerks,项目名称:revamp,代码行数:59,
示例14: NPC_Mark2_Precachevoid 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 ) );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:16,
示例15: G_Suckvoid G_Suck( gentity_t *self ) { int wait = self->wait; // if in water disable burning if (!Q_stricmp(self->classname, "grenadeend")){ gitem_t *item; item = BG_FindItemForWeapon( WP_DYNAMITE ); self->s.apos.trDelta[0] = 0; self->s.modelindex = item- bg_itemlist; self->s.modelindex2 = 1; self->item = item; self->s.eType = ET_ITEM; self->r.contents = CONTENTS_TRIGGER2; self->wait = -1; self->flags |= FL_THROWN_ITEM; self->touch = Touch_Item; self->classname = "grenadesit"; self->think = G_KnifeThink; self->nextthink = level.time + 100; self->wait = level.time + 60000; self->r.currentAngles[1] = rand() % 360; self->r.currentAngles[PITCH] = 90; VectorCopy(self->r.currentAngles, self->s.apos.trBase); return; } if(self->s.pos.trType == TR_STATIONARY){ // just to be sure KnifeThink doesn't delete the dynamite self->wait = level.time + 999999; // runs solid checks: is dynamite hovering in the air? G_KnifeThink(self); } self->nextthink = level.time + 100; self->think = G_Suck; self->wait = wait; if (level.time > self->wait && !Q_stricmp(self->classname, "grenade")) G_ExplodeMissile( self );}
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:47,
示例16: G_ThrowWeaponvoid G_ThrowWeapon( int weapon, gentity_t *ent ){ playerState_t *ps; gitem_t *item; gentity_t *drop; ps = &ent->client->ps; if(!(ps->stats[STAT_WEAPONS] & (1 << weapon))) return; if(weapon == WP_NONE) return; item = BG_FindItemForWeapon( weapon ); drop = G_dropWeapon( ent, item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM ); if(drop){ trap_SendServerCommand( ent-g_entities, va("print /"%s dropped./n/"", item->pickup_name)); } // delete weapon from inventory if(bg_weaponlist[weapon].wp_sort == WPS_PISTOL && (ps->stats[STAT_FLAGS] & SF_SEC_PISTOL)){ if (ps->ammo[weapon] < ps->ammo[WP_AKIMBO]) { int ammo = ps->ammo[weapon]; ps->ammo[weapon] = ps->ammo[WP_AKIMBO]; ps->ammo[WP_AKIMBO] = ammo; } if(drop) drop->count= ps->ammo[ WP_AKIMBO ]+1; ps->ammo[ WP_AKIMBO] = 0; ps->stats[STAT_FLAGS] &= ~SF_SEC_PISTOL; } else { if(drop) drop->count= ps->ammo[ weapon ]+1; ps->ammo[ weapon ] = 0; ps->stats[STAT_WEAPONS] &= ~( 1 << weapon ); }}
开发者ID:Mixone-FinallyHere,项目名称:SmokinGuns,代码行数:46,
示例17: NPC_Probe_Precachevoid NPC_Probe_Precache( void ) { int i; for ( 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( BG_FindItemForAmmo( AMMO_BLASTER ) ); RegisterItem( BG_FindItemForWeapon( WP_BRYAR_PISTOL ) );}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:18,
示例18: TossClientItems/*=================TossClientItemsToss the weapon and powerups for the killed player=================*/void TossClientItems( gentity_t *self ) { gitem_t *item; int weapon; gentity_t *drop = 0; // drop the weapon if not a gauntlet or machinegun weapon = self->s.weapon; // make a special check to see if they are changing to a new // weapon that isn't the mg or gauntlet. Without this, a client // can pick up a weapon, be killed, and not drop the weapon because // their weapon change hasn't completed yet and they are still holding the MG. // (SA) always drop what you were switching to if ( 1 ) { if ( self->client->ps.weaponstate == WEAPON_DROPPING ) { weapon = self->client->pers.cmd.weapon; } if ( !( COM_BitCheck( self->client->ps.weapons, weapon ) ) ) { weapon = WP_NONE; } } // JPW NERVE don't drop these weapon types if ( ( weapon == WP_FLAMETHROWER ) || ( weapon == WP_GARAND ) || ( weapon == WP_MAUSER ) || ( weapon == WP_VENOM ) ) { weapon = WP_NONE; } // jpw if ( weapon > WP_NONE && weapon < WP_MONSTER_ATTACK1 && self->client->ps.ammo[ BG_FindAmmoForWeapon( weapon_t (weapon) )] ) { // find the item type for this weapon item = BG_FindItemForWeapon( weapon_t (weapon) ); // spawn the item // Rafael if ( !( self->client->ps.persistant[PERS_HWEAPON_USE] ) ) { drop = Drop_Item( self, item, 0, qfalse ); // JPW NERVE -- fix ammo counts drop->count = self->client->ps.ammoclip[BG_FindClipForWeapon( weapon_t (weapon) )]; drop->item->quantity = self->client->ps.ammoclip[BG_FindClipForWeapon( weapon_t (weapon) )]; // jpw } }}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:51,
示例19: InitShootervoid 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 );}
开发者ID:AstralSerpent,项目名称:QtZ,代码行数:19,
示例20: G_DropBinocsvoid G_DropBinocs( gentity_t *ent ){ vec3_t angles, velocity, org, offset, mins, maxs; gclient_t *client = ent->client; gentity_t *ent2; gitem_t *item; trace_t tr; item = BG_FindItemForWeapon( WP_BINOCULARS ); VectorCopy( client->ps.viewangles, angles ); // clamp pitch if ( angles[PITCH] < -30 ) angles[PITCH] = -30; else if ( angles[PITCH] > 30 ) angles[PITCH] = 30; AngleVectors( angles, velocity, NULL, NULL ); VectorScale( velocity, 64, offset ); offset[2] += client->ps.viewheight / 2.f; VectorScale( velocity, 75, velocity ); velocity[2] += 50 + random() * 35; VectorAdd( client->ps.origin, offset, org ); VectorSet( mins, -ITEM_RADIUS, -ITEM_RADIUS, 0 ); VectorSet( maxs, ITEM_RADIUS, ITEM_RADIUS, 2*ITEM_RADIUS ); trap_Trace( &tr, client->ps.origin, mins, maxs, org, ent->s.number, MASK_SOLID ); VectorCopy( tr.endpos, org ); ent2 = LaunchBinocs( item, org, velocity, client->ps.clientNum ); COM_BitClear( client->ps.weapons, WP_BINOCULARS ); // Clear out empty weapon, change to next best weapon G_AddEvent( ent, EV_WEAPONSWITCHED, 0 ); if( WP_BINOCULARS == client->ps.weapon ) client->ps.weapon = 0; client->ps.ammoclip[BG_FindClipForWeapon(WP_BINOCULARS)] = 0;}
开发者ID:thewolfteam,项目名称:Reloaded,代码行数:42,
示例21: ClearRegisteredItems/*==============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 --}
开发者ID:zturtleman,项目名称:navy-seals,代码行数:25,
示例22: AICast_DelayedSpawnCast/*================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++;}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:46,
示例23: InitShootervoid InitShooter( gentity_t *ent, int weapon ) { ent->use = Use_Shooter; ent->s.weapon = weapon;#ifdef SMOKINGUNS if(weapon != WP_NONE)#endif RegisterItem( BG_FindItemForWeapon( weapon ) ); G_SetMovedir( ent->s.angles, ent->movedir ); if ( !ent->random ) { ent->random = 1.0; } ent->random = sin( 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_LinkEntity( ent );}
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:22,
示例24: random/*==================BotRandomWeaponName==================*/char *BotRandomWeaponName(void) { int rnd; gitem_t *item;#if 0 rnd = 1 + random() * ( (float)WP_NUM_WEAPONS - 1.1f );#else // skip grapple rnd = 1 + random() * ( (float)WP_NUM_WEAPONS - 2.1f ); // only happens if there is a weapon after grapple, like in Team Arena if ( rnd >= WP_GRAPPLING_HOOK ) { rnd++; }#endif item = BG_FindItemForWeapon( rnd ); if ( item ) { return item->pickup_name; } return "[unknown weapon]";}
开发者ID:LavenderMoon,项目名称:mint-arena,代码行数:29,
示例25: G_DropWeaponvoid G_DropWeapon( gentity_t *ent, weapon_t weapon ){ vec3_t angles, velocity, org, offset, mins, maxs; gclient_t *client = ent->client; gentity_t *ent2; gitem_t *item; trace_t tr; item = BG_FindItemForWeapon( weapon ); VectorCopy( client->ps.viewangles, angles ); // clamp pitch if ( angles[PITCH] < -30 ) angles[PITCH] = -30; else if ( angles[PITCH] > 30 ) angles[PITCH] = 30; AngleVectors( angles, velocity, NULL, NULL ); VectorScale( velocity, 64, offset ); offset[2] += client->ps.viewheight / 2.f; VectorScale( velocity, 75, velocity ); velocity[2] += 50 + random() * 35; VectorAdd( client->ps.origin, offset, org ); VectorSet( mins, -ITEM_RADIUS, -ITEM_RADIUS, 0 ); VectorSet( maxs, ITEM_RADIUS, ITEM_RADIUS, 2*ITEM_RADIUS ); trap_Trace( &tr, client->ps.origin, mins, maxs, org, ent->s.number, MASK_SOLID ); VectorCopy( tr.endpos, org ); ent2 = LaunchItem( item, org, velocity, client->ps.clientNum ); COM_BitClear( client->ps.weapons, weapon ); if( weapon == WP_KAR98 ) { COM_BitClear( client->ps.weapons, WP_GPG40 ); } else if ( weapon == WP_CARBINE ) { COM_BitClear( client->ps.weapons, WP_M7 ); } else if ( weapon == WP_FG42 ) { COM_BitClear( client->ps.weapons, WP_FG42SCOPE ); } else if( weapon == WP_K43 ) { COM_BitClear( client->ps.weapons, WP_K43_SCOPE ); } else if( weapon == WP_GARAND ) { COM_BitClear( client->ps.weapons, WP_GARAND_SCOPE ); } else if( weapon == WP_MORTAR ) { COM_BitClear( client->ps.weapons, WP_MORTAR_SET ); } else if( weapon == WP_MOBILE_MG42 ) { COM_BitClear( client->ps.weapons, WP_MOBILE_MG42_SET ); } // Clear out empty weapon, change to next best weapon G_AddEvent( ent, EV_WEAPONSWITCHED, 0 ); if( weapon == client->ps.weapon ) client->ps.weapon = 0; if( weapon == WP_MORTAR ) { ent2->count = client->ps.ammo[BG_FindAmmoForWeapon(weapon)] + client->ps.ammoclip[BG_FindClipForWeapon(weapon)]; } else { ent2->count = client->ps.ammoclip[BG_FindClipForWeapon(weapon)]; } if( weapon == WP_KAR98 || weapon == WP_CARBINE ) { ent2->delay = client->ps.ammo[BG_FindAmmoForWeapon(weapAlts[weapon])] + client->ps.ammoclip[BG_FindClipForWeapon(weapAlts[weapon])]; } else { ent2->delay = 0; }// ent2->item->quantity = client->ps.ammoclip[BG_FindClipForWeapon(weapon)]; // Gordon: um, modifying an item is not a good idea client->ps.ammoclip[BG_FindClipForWeapon(weapon)] = 0;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:71,
示例26: effect/*QUAKED worldspawn (0 0 0) ? RED_HAS_BOMB BLUE_HAS_BOMBEvery map should have exactly one worldspawn.The bomb flags are only used for the tactical gametype."music" music wav file"gravity" 800 is default gravity"message" Text to print during connection process"atmosphere" used to create atmospheric effects "T=xxxx" type of effect (SNOW or RAIN) "D=xx xx" drops (base and gust, max 2000, def: 500 500) "S=xx xx" splashes on/off (water and land, def: 1 1) "B=xx xx" min and max base time (in secs, def: 5 10) "C=xx xx" min and max change time (in secs, def: 1 1) "G=xx xx" min and max gust time (in secs, def: 0 2) "BV=xx xx" base wind direction vector (def: 0 0) "GV=xx xx" gust wind direction vector (def: 0 100)*/void SP_worldspawn( void ) { char *s; int i; G_SpawnString( "classname", "", &s ); if ( Q_stricmp( s, "worldspawn" ) ) { G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); } // make some data visible to connecting client trap_SetConfigstring( CS_GAME_VERSION, VERSION_SHORT ); trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) ); G_SpawnString( "music", "", &s ); trap_SetConfigstring( CS_MUSIC, s ); G_SpawnString( "message", "", &s ); trap_SetConfigstring( CS_MESSAGE, s ); // map specific message trap_SetConfigstring( CS_MOTD, g_motd.string ); // message of the day G_SpawnString( "gravity", "800", &s ); trap_Cvar_Set( "g_gravity", s ); G_SpawnString( "enableDust", "0", &s ); trap_Cvar_Set( "g_enableDust", s ); G_SpawnString( "enableBreath", "0", &s ); trap_Cvar_Set( "g_enableBreath", s ); G_SpawnString( "atmosphere", "", &s ); trap_SetConfigstring( CS_ATMOSEFFECT, s ); // Atmospheric effect g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD; g_entities[ENTITYNUM_WORLD].classname = "worldspawn"; // see if a team has the bomb G_SpawnInt( "spawnflags", "0", &i ); level.bombTeam = ( i & 3 ); // register the bomb if one is here if ( ( i & 3 ) && g_gametype.integer == GT_TACTICAL ) RegisterItem( BG_FindItemForWeapon( WP_BLAST ) ); // round time setting if ( g_mapRoundTime.integer ) { G_SpawnInt( "roundtime", va( "%i", DEFAULT_ROUNDTIME ), &i ); if ( i < MIN_ROUNDTIME || i > MAX_ROUNDTIME ) i = DEFAULT_ROUNDTIME; trap_Cvar_Set( "roundtime", va("%i", i ) ); } // check weapon enabling/disabling (GT_TACTICAL only) if ( g_gametype.integer == GT_TACTICAL ) { char name[128]; gitem_t *item; // parse map weapon disabling information if ( g_mapWeaponDisable.integer ) { for ( item = bg_itemlist + 1; item->classname; item++ ) { if ( item->giType == IT_WEAPON ) { Com_sprintf(name, sizeof(name), "disable_%s", item->classname); G_SpawnInt( name, "0", &i ); if ( i || trap_Cvar_VariableIntegerValue( name ) ) trap_Cvar_Set( name, va("%i", i ) ); } } } // register enabled weapons level.weaponsEnabled = 0; for ( i = 1 ; i < WP_NUM_WEAPONS - 1; i++ ) { // without Blastpack Com_sprintf(name, sizeof(name), "disable_%s", BG_FindItemForWeapon(i)->classname); if ( !trap_Cvar_VariableIntegerValue( name ) ) { RegisterItem( BG_FindItemForWeapon(i) ); level.weaponsEnabled |= ( 1 << i ); } } } // see if we want a warmup time trap_SetConfigstring( CS_WARMUP, "" ); if ( g_restarted.integer ) { trap_Cvar_Set( "g_restarted", "0" ); level.warmupTime = 0; } else if ( g_doWarmup.integer ) { // Turn it on//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:101,
示例27: G_MissileImpact//.........这里部分代码省略......... if(ent->s.apos.trDelta[0]) G_AddEvent( ent, EV_MISSILE_FIRE, DirToByte( trace->plane.normal)); // not burning else G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal)); } else if ( other->takedamage && other->client ) {#endif G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) ); ent->s.otherEntityNum = other->s.number;#ifndef SMOKINGUNS } else if( trace->surfaceFlags & SURF_METALSTEPS ) {#else } else if( trace->surfaceFlags & SURF_METAL ) {#endif G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) ); } else { G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) ); }#ifndef SMOKINGUNS ent->freeAfterEvent = qtrue; // change over to a normal entity right at the point of impact ent->s.eType = ET_GENERAL;#else if(Q_stricmp(ent->classname, "knife")){ ent->freeAfterEvent = qtrue; // change over to a normal entity right at the point of impact ent->s.eType = ET_GENERAL; } else { vec3_t dir; gitem_t *item; item = BG_FindItemForWeapon(WP_KNIFE); ent->s.modelindex = item-bg_itemlist; ent->s.modelindex2 = 1; ent->item = item; ent->s.eType = ET_ITEM; ent->s.pos.trType = TR_GRAVITY; ent->physicsBounce = 0.01f; ent->r.contents = CONTENTS_TRIGGER; ent->touch = Touch_Item; ent->nextthink = level.time + 100; ent->think = G_KnifeThink; ent->wait = level.time + 30000; ent->flags |= FL_THROWN_ITEM; vectoangles(ent->s.pos.trDelta, dir); VectorCopy(dir, ent->s.apos.trBase); VectorCopy(dir, ent->r.currentAngles); } //modified by Spoon END#endif SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth G_SetOrigin( ent, trace->endpos ); // splash damage (doesn't apply to person directly hit) if ( ent->splashDamage ) { if( G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:67,
示例28: ThrowWeaponint ThrowWeapon(gentity_t * ent, qboolean forceThrow){ gclient_t *client; usercmd_t *ucmd; gitem_t *xr_item; gentity_t *xr_drop; int weap; client = ent->client; ucmd = &ent->client->pers.cmd; if (!forceThrow) if ((ucmd->buttons & BUTTON_ATTACK) || client->ps.weaponTime > 0) return 0; //Elder: remove zoom bits Cmd_Unzoom(ent);// JBravo: simulate AQ drop weapon for akimbo with no special weap if (client->ps.weapon == WP_AKIMBO && client->uniqueWeapons == 0) { trap_SendServerCommand(ent - g_entities, va("stuff weapon %i/n", WP_PISTOL)); return 0; } weap = 0; if (client->uniqueWeapons > 0) { if (client->ps.weapon == WP_AKIMBO || client->ps.weapon == WP_PISTOL || client->ps.weapon == WP_GRENADE || client->ps.weapon == WP_KNIFE || client->ps.weapon == WP_NONE) // shouldn't have to worry about NONE, but just in case { weap = client->ps.stats[STAT_WEAPONS]; if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M4)) == (1 << WP_M4)) weap = WP_M4; if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_M3)) == (1 << WP_M3)) weap = WP_M3; if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_MP5)) == (1 << WP_MP5)) weap = WP_MP5; if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_HANDCANNON)) == (1 << WP_HANDCANNON)) weap = WP_HANDCANNON; if ((client->ps.stats[STAT_WEAPONS] & (1 << WP_SSG3000)) == (1 << WP_SSG3000)) weap = WP_SSG3000; if (weap == 0) return 0; } else { weap = client->ps.weapon; } xr_item = BG_FindItemForWeapon(weap); client->pers.hadUniqueWeapon[weap] = qtrue; //Elder: for immediate weapon drops if (client->ps.weapon == weap) { client->ps.stats[STAT_RQ3] |= RQ3_THROWWEAPON; trap_SendServerCommand(ent - g_entities, va("rq3_cmd %i", SELECTPISTOL)); } client->weaponCount[weap]--; if (client->weaponCount[weap] == 0) client->ps.stats[STAT_WEAPONS] &= ~(1 << weap); xr_drop = dropWeapon(ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM); xr_drop->count = -1; // XRAY FMJ 0 is already taken, -1 means no ammo // remember who dropped you, child! xr_drop->s.otherEntityNum = client->ps.clientNum; client->uniqueWeapons--; } return weap;}
开发者ID:Zekom,项目名称:reaction,代码行数:68,
示例29: turret_base_spawn_top//.........这里部分代码省略......... base->maxHealth = base->health; G_ScaleNetHealth(base); } base->takedamage = qtrue; base->pain = TurretBasePain; base->die = bottom_die; //design specified shot speed G_SpawnFloat( "shotspeed", "1100", &base->mass ); top->mass = base->mass; //even if we don't want to show health, let's at least light the crosshair up properly over ourself if ( !top->s.teamowner ) { top->s.teamowner = top->alliedTeam; } base->alliedTeam = top->alliedTeam; base->s.teamowner = top->s.teamowner; base->s.shouldtarget = qtrue; top->s.shouldtarget = qtrue; //link them to each other base->target_ent = top; top->target_ent = base; //top->s.owner = MAX_CLIENTS; //not owned by any client // search radius if ( !base->radius ) { base->radius = 1024; } top->radius = base->radius; // How quickly to fire if ( !base->wait ) { base->wait = 300 + random() * 55; } top->wait = base->wait; if ( !base->splashDamage ) { base->splashDamage = 300; } top->splashDamage = base->splashDamage; if ( !base->splashRadius ) { base->splashRadius = 128; } top->splashRadius = base->splashRadius; // how much damage each shot does if ( !base->damage ) { base->damage = 100; } top->damage = base->damage; // how fast it turns if ( !base->speed ) { base->speed = 20; } top->speed = base->speed; VectorSet( top->r.maxs, 48.0f, 48.0f, 16.0f ); VectorSet( top->r.mins, -48.0f, -48.0f, 0.0f ); // Precache moving sounds //G_SoundIndex( "sound/chars/turret/startup.wav" ); //G_SoundIndex( "sound/chars/turret/shutdown.wav" ); //G_SoundIndex( "sound/chars/turret/ping.wav" ); G_SoundIndex( "sound/vehicles/weapons/hoth_turret/turn.wav" ); top->genericValue13 = G_EffectIndex( "turret/hoth_muzzle_flash" ); top->genericValue14 = G_EffectIndex( "turret/hoth_shot" ); top->genericValue15 = G_EffectIndex( "turret/hoth_impact" ); top->r.contents = CONTENTS_BODY; //base->max_health = base->health; top->takedamage = qtrue; top->pain = TurretPain; top->die = auto_turret_die; top->material = MAT_METAL; //base->r.svFlags |= SVF_NO_TELEPORT|SVF_NONNPC_ENEMY|SVF_SELF_ANIMATING; // Register this so that we can use it for the missile effect RegisterItem( BG_FindItemForWeapon( WP_EMPLACED_GUN )); // But set us as a turret so that we can be identified as a turret top->s.weapon = WP_EMPLACED_GUN; trap_LinkEntity( top ); return qtrue;}
开发者ID:jwginge,项目名称:ojpa,代码行数:101,
注:本文中的BG_FindItemForWeapon函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BG_PlayerStateToEntityState函数代码示例 C++ BG_FindItem函数代码示例 |