这篇教程C++ BG_FindItem函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BG_FindItem函数的典型用法代码示例。如果您正苦于以下问题:C++ BG_FindItem函数的具体用法?C++ BG_FindItem怎么用?C++ BG_FindItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BG_FindItem函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SP_gametype_itemvoid SP_gametype_item ( gentity_t* ent ){ gitem_t *item = NULL; char *value; int team = -1; G_SpawnString("teamfilter", "", &value); G_SetOrigin( ent, ent->s.origin ); // If a team filter is set then override any team settings for the spawns if ( level.mTeamFilter[0] ) { if ( Q_stricmp ( level.mTeamFilter, "red") == 0 ) { team = TEAM_RED; } else if ( Q_stricmp ( level.mTeamFilter, "blue") == 0 ) { team = TEAM_BLUE; } } if (ent->targetname && ent->targetname[0]) { if (team != -1) { if (strstr(ent->targetname, "flag")) { if (team == TEAM_RED) { item = BG_FindItem("team_CTF_redflag"); } else { //blue item = BG_FindItem("team_CTF_blueflag"); } } } else if (strstr(ent->targetname, "red_flag")) { item = BG_FindItem("team_CTF_redflag"); } else if (strstr(ent->targetname, "blue_flag")) { item = BG_FindItem("team_CTF_blueflag"); } else { item = NULL; } if (item) { ent->targetname = NULL; ent->classname = item->classname; G_SpawnItem( ent, item ); } }}
开发者ID:Camron,项目名称:OpenJK,代码行数:60,
示例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: value/*QUAKED worldspawn(0 0 0) ? sun_cameraflareEvery map should have exactly one worldspawn."music" Music wav file"gravity" 800 is default gravity"message" Text to print during connection process"ambient" Ambient light value(must use '_color')"_color" Ambient light color(must be used with 'ambient')"sun" Shader to use for 'sun' image*/void SP_worldspawn(void) { char *s; gitem_t *item; // JPW NERVE 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, GAME_VERSION); 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); // (SA) FIXME: todo: sun shader set for worldspawn g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD; g_entities[ENTITYNUM_WORLD].r.ownerNum = ENTITYNUM_NONE; g_entities[ENTITYNUM_WORLD].classname = "worldspawn"; g_entities[ENTITYNUM_NONE].s.number = ENTITYNUM_NONE; g_entities[ENTITYNUM_NONE].r.ownerNum = ENTITYNUM_NONE; g_entities[ENTITYNUM_NONE].classname = "nothing"; // see if we want a warmup time trap_SetConfigstring(CS_WARMUP, ""); if (g_restarted.integer) { trap_Cvar_Set("g_restarted", "0"); level.warmupTime = 0; }// JPW NERVE change minigun overheat time for single player -- this array gets reloaded every time the server is reset, // so this is as good a place as any to do stuff like this if (g_gametype.integer != GT_SINGLE_PLAYER) { ammoTable[WP_VENOM].maxHeat *= 0.25; ammoTable[WP_DYNAMITE].uses = 0; // regens based on recharge time // reset ammo for subs to be distinct for multiplayer(so running out of rifle ammo doesn't deplete sidearm) // if player runs out of SMG ammunition, it shouldn't *also * deplete pistol ammunition. If you change this, change // g_spawn.c as well item = BG_FindItem("Thompson"); item->giAmmoIndex = WP_THOMPSON; item = BG_FindItem("Sten"); item->giAmmoIndex = WP_STEN; item = BG_FindItem("MP40"); item->giAmmoIndex = WP_MP40; }}
开发者ID:ioid3-games,项目名称:ioid3-rtcw,代码行数:67,
示例4: TossPlayerGametypeItems/*===========TossPlayerGametypeItemsDrop CTF flag and Harvester cubes===========*/void TossPlayerGametypeItems(gentity_t *ent) { int j; gitem_t *item; gentity_t *drop; int angle = 0; // drop flags in CTF item = NULL; j = 0; if ( ent->player->ps.powerups[ PW_REDFLAG ] ) { item = BG_FindItemForPowerup( PW_REDFLAG ); j = PW_REDFLAG; } else if ( ent->player->ps.powerups[ PW_BLUEFLAG ] ) { item = BG_FindItemForPowerup( PW_BLUEFLAG ); j = PW_BLUEFLAG; } else if ( ent->player->ps.powerups[ PW_NEUTRALFLAG ] ) { item = BG_FindItemForPowerup( PW_NEUTRALFLAG ); j = PW_NEUTRALFLAG; } if ( item ) { drop = Drop_Item( ent, item, angle ); angle += 45; // decide how many seconds it has left drop->count = ( ent->player->ps.powerups[ j ] - level.time ) / 1000; if ( drop->count < 1 ) { drop->count = 1; } ent->player->ps.powerups[ j ] = 0; }#ifdef MISSIONPACK if ( g_gametype.integer == GT_HARVESTER ) { if ( ent->player->ps.tokens > 0 ) { if ( ent->player->sess.sessionTeam == TEAM_RED ) { item = BG_FindItem( "Blue Cube" ); } else { item = BG_FindItem( "Red Cube" ); } if ( item ) { for ( j = 0; j < ent->player->ps.tokens; j++ ) { drop = Drop_Item( ent, item, angle ); if ( ent->player->sess.sessionTeam == TEAM_RED ) { drop->s.team = TEAM_BLUE; } else { drop->s.team = TEAM_RED; } angle += 45; } } ent->player->ps.tokens = 0; } }#endif}
开发者ID:mecwerks,项目名称:revamp,代码行数:63,
示例5: G_CheckTeamItems/*==================G_CheckTeamItems==================*/void G_CheckTeamItems(void){ // Set up team stuff Team_InitGame(); if (g_gametype.integer == GT_CTF) { gitem_t *item; gentity_t *flag, *ent; // check for the two flags item = BG_FindItem("Silver Case"); if (!item || !itemRegistered[item - bg_itemlist]) { G_Printf(S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map/n"); } item = BG_FindItem("Black Case"); if (!item || !itemRegistered[item - bg_itemlist]) { G_Printf(S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map/n"); } // NiceAss: Find the red flag flag = NULL; while ((flag = G_Find(flag, FOFS(classname), "team_CTF_redflag")) != NULL) { if (!(flag->flags & FL_DROPPED_ITEM)) break; } if (flag) { // Red team decal X ent = G_Spawn(); ent->classname = "Decal"; ent->s.eType = ET_DECAL; ent->s.pos.trType = TR_STATIONARY; ent->s.modelindex = TEAM_RED; G_SetOrigin(ent, flag->s.origin); trap_LinkEntity(ent); } // NiceAss: Find the blue flag flag = NULL; while ((flag = G_Find(flag, FOFS(classname), "team_CTF_blueflag")) != NULL) { if (!(flag->flags & FL_DROPPED_ITEM)) break; } if (flag) { // Red team decal X ent = G_Spawn(); ent->classname = "Decal"; ent->s.eType = ET_DECAL; ent->s.pos.trType = TR_STATIONARY; ent->s.modelindex = TEAM_BLUE; G_SetOrigin(ent, flag->s.origin); trap_LinkEntity(ent); } }}
开发者ID:zturtleman,项目名称:reaction,代码行数:60,
示例6: 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,
示例7: 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,
示例8: TossClientCubesvoid TossClientCubes(gentity_t * self){ gitem_t *item; gentity_t *drop; vec3_t velocity; vec3_t angles; vec3_t origin; self->client->ps.generic1 = 0; // this should never happen but we should never // get the server to crash due to skull being spawned in if(!G_EntitiesFree()) { return; } if(self->client->sess.sessionTeam == TEAM_RED) { item = BG_FindItem("Red Cube"); } else { item = BG_FindItem("Blue Cube"); } angles[YAW] = (float)(level.time % 360); angles[PITCH] = 0; // always forward angles[ROLL] = 0; AngleVectors(angles, velocity, NULL, NULL); VectorScale(velocity, 150, velocity); velocity[2] += 200 + crandom() * 50; if(neutralObelisk) { VectorCopy(neutralObelisk->s.pos.trBase, origin); origin[2] += 44; } else { VectorClear(origin); } drop = LaunchItem(item, origin, velocity); drop->nextthink = level.time + g_cubeTimeout.integer * 1000; drop->think = G_FreeEntity; drop->spawnflags = self->client->sess.sessionTeam;}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:50,
示例9: G_CheckTeamItems/*==================G_CheckTeamItems==================*/void G_CheckTeamItems( void ) { if ( g_gametype.integer == GT_CTF ) { gitem_t *item; // make sure we actually have two flags... item = BG_FindItem( "Red Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Error( "No team_CTF_redflag in map" ); } item = BG_FindItem( "Blue Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Error( "No team_CTF_blueflag in map" ); } }}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:20,
示例10: DropPortalDestinationvoid DropPortalDestination( gentity_t *player ) { gentity_t *ent; vec3_t snapped; // create the portal destination ent = G_Spawn(); ent->s.modelindex = G_ModelIndex( "models/powerups/teleporter/tele_exit.md3" ); VectorCopy( player->s.pos.trBase, snapped ); SnapVector( snapped ); G_SetOrigin( ent, snapped ); VectorCopy( player->r.mins, ent->r.mins ); VectorCopy( player->r.maxs, ent->r.maxs ); ent->classname = "hi_portal destination"; ent->s.pos.trType = TR_STATIONARY; ent->r.contents = CONTENTS_CORPSE; ent->takedamage = qtrue; ent->health = 200; ent->die = PortalDie; VectorCopy( player->s.apos.trBase, ent->s.angles ); ent->think = G_FreeEntity; ent->nextthink = level.time + 2 * 60 * 1000; trap_LinkEntity( ent ); player->client->portalID = ++level.portalSequence; ent->count = player->client->portalID; // give the item back so they can drop the source now player->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItem( "Portal" ) - bg_itemlist;}
开发者ID:d00man,项目名称:openarena-vm,代码行数:35,
示例11: BG_FindItemGametype_inf::Gametype_inf() { // Register the items // Boe!Man 11/29/12: Register items per gametype. gitem_t *item = BG_FindItem("briefcase"); if (item){ item->quantity = ITEM_BRIEFCASE; } // Boe!Man 11/29/12: Register triggers per gametype. gentity_t *find = NULL; while (NULL != (find = G_Find(find, FOFS(classname), "gametype_trigger"))) { if (strcmp(find->targetname, (const char*) "briefcase_destination")) { continue; } // Assign the id to it. find->health = TRIGGER_EXTRACTION; find->touch = gametype_trigger_touch; trap_LinkEntity(find); } caseTakenSound = G_SoundIndex("sound/ctf_flag.mp3"); caseCaptureSound = G_SoundIndex("sound/ctf_win.mp3"); caseReturnSound = G_SoundIndex("sound/ctf_return.mp3");}
开发者ID:Jordi1990,项目名称:Sof2MPSDK,代码行数:26,
示例12: ClearRegisteredItems/*==============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" ) );}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:20,
示例13: G_CheckTeamItems/*==================G_CheckTeamItems==================*/void G_CheckTeamItems( void ) { // Set up team stuff Team_InitGame(); if( g_gametype.integer == GT_CTF ) { gitem_t *item; // check for the two flags item = BG_FindItem( "red Lolly" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTL_redlolly in map" ); } item = BG_FindItem( "blue Lolly" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTL_bluelolly in map" ); } }}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:24,
示例14: G_ParseGametypeItems/*===============G_ParseGametypeItems===============*/bool G_ParseGametypeItems ( TGPGroup* itemsGroup ){ TGPGroup itemGroup; int itemCount; char temp[MAX_QPATH]; gentity_t *ent; // Handle NULL for convienience if ( !itemsGroup ) { return false; } // Loop over all the items and add each itemGroup = trap_GPG_GetSubGroups ( itemsGroup ); itemCount = 0; while ( itemGroup ) { gitem_t* item; // Parse out the pickup name trap_GPG_GetName ( itemGroup, temp ); item = BG_FindItem ( temp ); if ( !item ) { item = &bg_itemlist[ MODELINDEX_GAMETYPE_ITEM + itemCount ]; item->pickup_name = (char *)trap_VM_LocalStringAlloc ( temp ); itemCount++; } // Handle the entity specific stuff by finding all matching items that // were spawned. ent = NULL; while ( NULL != (ent = G_Find ( ent, FOFS(targetname), item->pickup_name ) ) ) { // If not a gametype item then skip it if ( strcmp ( ent->classname, "gametype_item" ) ) { continue; } // Setup the gametype data ent->item = item; ent->nextthink = level.time + 200; ent->think = G_GametypeItemThink; } // Next sub group itemGroup = trap_GPG_GetNext(itemGroup); } return true;}
开发者ID:Jordi1990,项目名称:Sof2MPSDK,代码行数:60,
示例15: ClearRegisteredItems/*==============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}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:16,
示例16: G_CheckTeamItems/*==================G_CheckTeamItems==================*/void G_CheckTeamItems() { // Set up team stuff Team_InitGame(); if( g_gametype.integer == GT_CTF ) { gitem_t *item; // check for the two flags item = BG_FindItem( "Red Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { Com_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map" ); } item = BG_FindItem( "Blue Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { Com_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map" ); } }}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:25,
示例17: ammo_touchvoid ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int i, clientcount = 0, count; gentity_t* touchClients[MAX_CLIENTS]; memset(touchClients, 0, sizeof(touchClients)); if( other->client == NULL ) { return; } // flags is for the last entity number that got ammo if ( self->timestamp > level.time ) { return; } self->timestamp = level.time + 1000; for( i = 0; i < level.numConnectedClients; i++ ) { int j = level.sortedClients[i]; if( trap_EntityContactCapsule( g_entities[j].r.absmin, g_entities[j].r.absmax, self ) && G_IsAllowedAmmo( &g_entities[j] ) ) { touchClients[clientcount] = &g_entities[j]; clientcount++; } } if(clientcount == 0) { return; } // Gordon: if low, just give out what's left if(self->health == -9999) { count = clientcount; } else { count = min(clientcount, self->health / (float)self->damage ); } for( i = 0; i < count; i++) { int ammoAdded = qfalse; // self->damage contains the amount of ammo to add ammoAdded = AddMagicAmmo(touchClients[i], self->damage); if (ammoAdded) { // add the ammo pack event (to get sound, etc.) G_AddPredictableEvent( touchClients[i], EV_ITEM_PICKUP, BG_FindItem("Ammo Pack")-bg_itemlist ); if (self->health != -9999) { // reduce the ammount of available ammo by the added clip number self->health -= self->damage;// G_Printf("%i clips left/n", self->health ); } } }}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:53,
示例18: G_CheckTeamItemsvoid G_CheckTeamItems( void ) { // Set up team stuff Team_InitGame(); if( level.gametype == GT_FLAGS ) { const gitem_t *item; // check for the two flags item = BG_FindItem( "team_redflag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { trap->Print( S_COLOR_YELLOW "WARNING: No team_redflag in map/n" ); } item = BG_FindItem( "team_blueflag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { trap->Print( S_COLOR_YELLOW "WARNING: No team_blueflag in map/n" ); } } if( level.gametype == GT_TROJAN ) { const gitem_t *item; // check for all three flags item = BG_FindItem( "team_redflag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { trap->Print( S_COLOR_YELLOW "WARNING: No team_redflag in map/n" ); } item = BG_FindItem( "team_blueflag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { trap->Print( S_COLOR_YELLOW "WARNING: No team_blueflag in map/n" ); } item = BG_FindItem( "team_neutralflag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { trap->Print( S_COLOR_YELLOW "WARNING: No team_neutralflag in map/n" ); } }}
开发者ID:Razish,项目名称:QtZ,代码行数:36,
示例19: Cmd_Give_f/*==================Cmd_Give_fGive items to a client==================*/void Cmd_Give_f (gentity_t *ent){ char *name; gitem_t *it; int i; qboolean give_all; gentity_t *it_ent; trace_t trace; if ( !CheatsOk( ent ) ) { return; } name = ConcatArgs( 1 ); if (Q_stricmp(name, "all") == 0) give_all = qtrue; else give_all = qfalse; if (give_all || Q_stricmp( name, "health") == 0) { ent->health = ent->client->ps.stats[STAT_MAX_HEALTH]; if (!give_all) return; } if (give_all || Q_stricmp(name, "weapons") == 0) { ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_NUM_WEAPONS) - 1 - ( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE ); if (!give_all) return; } if (give_all || Q_stricmp(name, "ammo") == 0) { for ( i = 0 ; i < MAX_WEAPONS ; i++ ) { ent->client->ps.ammo[i] = 999; } if (!give_all) return; } if (give_all || Q_stricmp(name, "armor") == 0) { ent->client->ps.stats[STAT_ARMOR] = 200; if (!give_all) return; } if (Q_stricmp(name, "excellent") == 0) { ent->client->ps.persistant[PERS_EXCELLENT_COUNT]++; return; } if (Q_stricmp(name, "impressive") == 0) { ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++; return; } if (Q_stricmp(name, "gauntletaward") == 0) { ent->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++; return; } if (Q_stricmp(name, "defend") == 0) { ent->client->ps.persistant[PERS_DEFEND_COUNT]++; return; } if (Q_stricmp(name, "assist") == 0) { ent->client->ps.persistant[PERS_ASSIST_COUNT]++; return; } // spawn a specific item right on the player if ( !give_all ) { it = BG_FindItem (name); if (!it) { return; } it_ent = G_Spawn(); VectorCopy( ent->r.currentOrigin, it_ent->s.origin ); it_ent->classname = it->classname; G_SpawnItem (it_ent, it); FinishSpawningItem(it_ent ); memset( &trace, 0, sizeof( trace ) ); Touch_Item (it_ent, ent, &trace); if (it_ent->inuse) { G_FreeEntity( it_ent ); } }}
开发者ID:MasaMune692,项目名称:alcexamples,代码行数:99,
示例20: G_CheckTeamItems/*==================G_CheckTeamItems==================*/void G_CheckTeamItems( void ) { // Set up team stuff Team_InitGame(); if( g_gametype.integer == GT_CTF ) { gitem_t *item; // check for the two flags item = BG_FindItem( "Red Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map" ); } item = BG_FindItem( "Blue Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map" ); } }#ifdef MISSIONPACK if( g_gametype.integer == GT_1FCTF ) { gitem_t *item; // check for all three flags item = BG_FindItem( "Red Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_redflag in map" ); } item = BG_FindItem( "Blue Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_blueflag in map" ); } item = BG_FindItem( "Neutral Flag" ); if ( !item || !itemRegistered[ item - bg_itemlist ] ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_CTF_neutralflag in map" ); } } if( g_gametype.integer == GT_OBELISK ) { gentity_t *ent; // check for the two obelisks ent = NULL; ent = G_Find( ent, FOFS(classname), "team_redobelisk" ); if( !ent ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map" ); } ent = NULL; ent = G_Find( ent, FOFS(classname), "team_blueobelisk" ); if( !ent ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map" ); } } if( g_gametype.integer == GT_HARVESTER ) { gentity_t *ent; // check for all three obelisks ent = NULL; ent = G_Find( ent, FOFS(classname), "team_redobelisk" ); if( !ent ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_redobelisk in map" ); } ent = NULL; ent = G_Find( ent, FOFS(classname), "team_blueobelisk" ); if( !ent ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_blueobelisk in map" ); } ent = NULL; ent = G_Find( ent, FOFS(classname), "team_neutralobelisk" ); if( !ent ) { G_Printf( S_COLOR_YELLOW "WARNING: No team_neutralobelisk in map" ); } }#endif}
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:83,
示例21: trap_DropClient/*===========ClientDisconnectCalled when a player drops from the server.Will not be called between levels.This should NOT be called directly by any game logic,call trap_DropClient(), which will call this and doserver system housekeeping.============*/void ClientDisconnect(int clientNum) { gentity_t *ent; gentity_t *flag = NULL; gitem_t *item = NULL; vec3_t launchvel; int i; ent = g_entities + clientNum; if (!ent->client) { return; } G_RemoveClientFromFireteams(clientNum, qtrue, qfalse); G_RemoveFromAllIgnoreLists(clientNum); G_LeaveTank(ent, qfalse); // Nico, remove the client from all specInvited lists for (i = 0; i < level.numConnectedClients; ++i) { COM_BitClear(level.clients[level.sortedClients[i]].sess.specInvitedClients, clientNum); } // stop any following clients for (i = 0 ; i < level.numConnectedClients ; i++) { flag = g_entities + level.sortedClients[i]; if (flag->client->sess.sessionTeam == TEAM_SPECTATOR && flag->client->sess.spectatorState == SPECTATOR_FOLLOW && flag->client->sess.spectatorClient == clientNum) { StopFollowing(flag); } if (flag->client->ps.pm_flags & PMF_LIMBO && flag->client->sess.spectatorClient == clientNum) { Cmd_FollowCycle_f(flag, 1); } } G_FadeItems(ent, MOD_SATCHEL); // remove ourself from teamlists { mapEntityData_t *mEnt; mapEntityData_Team_t *teamList; for (i = 0; i < 2; i++) { teamList = &mapEntityData[i]; if ((mEnt = G_FindMapEntityData(&mapEntityData[0], ent - g_entities)) != NULL) { G_FreeMapEntityData(teamList, mEnt); } mEnt = G_FindMapEntityDataSingleClient(teamList, NULL, ent->s.number, -1); while (mEnt) { mapEntityData_t *mEntFree = mEnt; mEnt = G_FindMapEntityDataSingleClient(teamList, mEnt, ent->s.number, -1); G_FreeMapEntityData(teamList, mEntFree); } } } // send effect if they were completely connected if (ent->client->pers.connected == CON_CONNECTED && ent->client->sess.sessionTeam != TEAM_SPECTATOR && !(ent->client->ps.pm_flags & PMF_LIMBO)) { // They don't get to take powerups with them! // Especially important for stuff like CTF flags // New code for tossing flags if (ent->client->ps.powerups[PW_REDFLAG]) { item = BG_FindItem("Red Flag"); if (!item) { item = BG_FindItem("Objective"); } ent->client->ps.powerups[PW_REDFLAG] = 0; } if (ent->client->ps.powerups[PW_BLUEFLAG]) { item = BG_FindItem("Blue Flag"); if (!item) { item = BG_FindItem("Objective"); } ent->client->ps.powerups[PW_BLUEFLAG] = 0; } if (item) { // OSP - fix for suicide drop exploit through walls/gates//.........这里部分代码省略.........
开发者ID:Exosum,项目名称:ETrun,代码行数:101,
示例22: G_SpawnItem/*============G_SpawnItemSets the clipping size and plants the object on the floor.Items can't be immediately dropped to floor, because they mightbe on an entity that hasn't spawned yet.============*/void G_SpawnItem(gentity_t *ent, gitem_t *item){ char *MinHealth = "1"; qboolean Egg = qfalse; G_SpawnFloat("random", "0", &ent->random); G_SpawnFloat("wait", "0", &ent->wait); if (item->giType == IT_TEAM) { if (g_gametype.integer == GT_INVASION || g_gametype.integer == GT_DESTROY) { if (!Q_stricmp(item->pickup_name, "Blue Flag")) { gitem_t *NewItem = BG_FindItem("Alien Egg"); if (NewItem) { item = NewItem; MinHealth = "60";//2500; Egg = qtrue; } ent->classname = item->classname; } else if (!Q_stricmp(item->pickup_name, "Red Flag")) { gitem_t *NewItem = BG_FindItem("Teleporter"); if (NewItem) item = NewItem; ent->classname = item->classname; } else if (!Q_stricmp(item->pickup_name, "Alien Egg")) Egg = qtrue; } RegisterItem(item); } if (G_ItemDisabled(item)) return; if (Egg && g_gametype.integer == GT_DESTROY) { float Coeff, Radius; G_SpawnFloat("health", MinHealth, &Coeff); if (Coeff < 0.1f) Coeff = 0.1f; ent->health = Coeff * g_InvEggHealth.integer; if (ent->health < 1)//MinHealth) ent->health = 1;//MinHealth; else if (ent->health > 25000) ent->health = 25000; G_SpawnFloat("Radius", "6", &Radius); G_SpawnFloat("Height", "24", &Coeff); Radius = Com_Clamp(3, 50, Radius); Coeff = Com_Clamp(3, 200, Coeff); VectorSet(ent->r.mins, -Radius, -Radius, 0); VectorSet(ent->r.maxs, Radius, Radius, Coeff); G_SpawnInt("Number", "100", &ent->count); if (ent->count < 0) ent->count = 0; } 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;//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:101,
示例23: player_die//.........这里部分代码省略........./* AddScore( attacker, WOLF_FRIENDLY_PENALTY ); */ if( g_gametype.integer == GT_WOLF_LMS ) { AddKillScore( attacker, WOLF_FRIENDLY_PENALTY ); } } else { //G_AddExperience( attacker, 1 ); // JPW NERVE -- mostly added as conveneience so we can tweak from the #defines all in one place AddScore(attacker, WOLF_FRAG_BONUS); if( g_gametype.integer == GT_WOLF_LMS ) { if( level.firstbloodTeam == -1 ) level.firstbloodTeam = attacker->client->sess.sessionTeam; AddKillScore( attacker, WOLF_FRAG_BONUS ); } attacker->client->lastKillTime = level.time; } } else { AddScore( self, -1 ); if( g_gametype.integer == GT_WOLF_LMS ) AddKillScore( self, -1 ); } // Add team bonuses Team_FragBonuses(self, inflictor, attacker); // drop flag regardless if (self->client->ps.powerups[PW_REDFLAG]) { item = BG_FindItem("Red Flag"); if (!item) item = BG_FindItem("Objective"); self->client->ps.powerups[PW_REDFLAG] = 0; } if (self->client->ps.powerups[PW_BLUEFLAG]) { item = BG_FindItem("Blue Flag"); if (!item) item = BG_FindItem("Objective"); self->client->ps.powerups[PW_BLUEFLAG] = 0; } if (item) { vec3_t launchvel = { 0, 0, 0 }; gentity_t *flag = LaunchItem(item, self->r.currentOrigin, launchvel, self->s.number); flag->s.modelindex2 = self->s.otherEntityNum2;// JPW NERVE FIXME set player->otherentitynum2 with old modelindex2 from flag and restore here flag->message = self->message; // DHM - Nerve :: also restore item name // Clear out player's temp copies self->s.otherEntityNum2 = 0; self->message = NULL; } // send a fancy "MEDIC!" scream. Sissies, ain' they? if (self->client != NULL) { if( self->health > GIB_HEALTH && meansOfDeath != MOD_SUICIDE && meansOfDeath != MOD_SWITCHTEAM ) { G_AddEvent( self, EV_MEDIC_CALL, 0 ); } } Cmd_Score_f( self ); // show scores
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:67,
示例24: player_die//.........这里部分代码省略......... // jpw AddScore( attacker, -1 ); } } else { // JPW NERVE -- mostly added as conveneience so we can tweak from the #defines all in one place if ( g_gametype.integer >= GT_WOLF ) { AddScore( attacker, WOLF_FRAG_BONUS ); } else { // jpw AddScore( attacker, 1 ); } attacker->client->lastKillTime = level.time; } } else { AddScore( self, -1 ); } // Add team bonuses Team_FragBonuses( self, inflictor, attacker ); // if client is in a nodrop area, don't drop anything// JPW NERVE new drop behavior if ( g_gametype.integer == GT_SINGLE_PLAYER ) { // only drop here in single player; in multiplayer, drop @ limbo contents = trap_PointContents( self->r.currentOrigin, -1 ); if ( !( contents & CONTENTS_NODROP ) ) { TossClientItems( self ); } } // drop flag regardless if ( g_gametype.integer != GT_SINGLE_PLAYER ) { if ( self->client->ps.powerups[PW_REDFLAG] ) { item = BG_FindItem( "Red Flag" ); if ( !item ) { item = BG_FindItem( "Objective" ); } self->client->ps.powerups[PW_REDFLAG] = 0; } if ( self->client->ps.powerups[PW_BLUEFLAG] ) { item = BG_FindItem( "Blue Flag" ); if ( !item ) { item = BG_FindItem( "Objective" ); } self->client->ps.powerups[PW_BLUEFLAG] = 0; } if ( item ) { launchvel[0] = crandom() * 20; launchvel[1] = crandom() * 20; launchvel[2] = 10 + random() * 10; flag = LaunchItem( item,self->r.currentOrigin,launchvel,self->s.number ); flag->s.modelindex2 = self->s.otherEntityNum2; // JPW NERVE FIXME set player->otherentitynum2 with old modelindex2 from flag and restore here flag->message = self->message; // DHM - Nerve :: also restore item name // Clear out player's temp copies self->s.otherEntityNum2 = 0; self->message = NULL; } // send a fancy "MEDIC!" scream. Sissies, ain' they? if ( self->client != NULL ) { if ( self->health > GIB_HEALTH && meansOfDeath != MOD_SUICIDE ) {
开发者ID:bibendovsky,项目名称:rtcw,代码行数:66,
示例25: G_Givestatic void G_Give( gentity_t *ent, const char *name, const char *args, int argc ) { const gitem_t *it; int i; qboolean give_all = qfalse; gentity_t *it_ent; trace_t trace; if ( !Q_stricmp( name, "all" ) ) give_all = qtrue; if ( give_all || !Q_stricmp( name, "health") ) { if ( argc == 3 ) ent->health = Q_clampi( 1, atoi( args ), MAX_HEALTH ); else ent->health = MAX_HEALTH; if ( !give_all ) return; } if ( give_all || !Q_stricmp( name, "armor" ) || !Q_stricmp( name, "shield" ) ) { if ( argc == 3 ) ent->client->ps.stats[STAT_ARMOR] = Q_clampi( 0, atoi( args ), MAX_ARMOR ); else ent->client->ps.stats[STAT_ARMOR] = MAX_ARMOR; if ( !give_all ) return; } if ( give_all || !Q_stricmp( name, "weapons" ) ) { ent->client->ps.stats[STAT_WEAPONS] = (1 << (WP_NUM_WEAPONS)) - (1 << WP_NONE); if ( !give_all ) return; } if ( !give_all && !Q_stricmp( name, "weaponnum" ) ) { ent->client->ps.stats[STAT_WEAPONS] |= (1 << atoi( args )); return; } if ( give_all || !Q_stricmp( name, "ammo" ) ) { int num = 999; if ( argc == 3 ) num = atoi( args ); for ( i=0; i<MAX_WEAPONS; i++ ) ent->client->ps.ammo[i] = num; if ( !give_all ) return; } // spawn a specific item right on the player if ( !give_all ) { it = BG_FindItem( name ); if ( !it ) return; it_ent = G_Spawn(); VectorCopy( &ent->r.currentOrigin, &it_ent->s.origin ); it_ent->classname = it->classname; G_SpawnItem( it_ent, it ); FinishSpawningItem( it_ent ); memset( &trace, 0, sizeof( trace ) ); Touch_Item( it_ent, ent, &trace ); if ( it_ent->inuse ) G_FreeEntity( it_ent ); }}
开发者ID:Razish,项目名称:QtZ,代码行数:72,
示例26: CG_Drop_fvoid CG_Drop_f( void ) { char command[ 128 ]; char message[ 128 ]; gitem_t *item; int j; if ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) { return; } if ( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) { CG_Printf( "You must be alive to use this command./n" ); return; } trap_Args( message, 128 ); item = BG_FindItem( message ); if ( !item ) { CG_Printf( "unknown item: %s/n", message ); return; } if ( !cg_items[ item->giTag ].registered ) { return; } j = item->giTag; switch ( item->giType ) { case IT_WEAPON: if ( cgs.dmflags & 256 ) { return; } if ( !( cg.snap->ps.stats[ STAT_WEAPONS ] & ( 1 << j ) ) ) { CG_Printf( "Out of item: %s/n", message ); return; } if ( cg.snap->ps.weaponstate != WEAPON_READY ) { return; } if ( j == cg.snap->ps.weapon ) { return; } if ( j <= WP_MACHINEGUN || j == WP_GRAPPLING_HOOK ) { CG_Printf( "Item is not dropable./n" ); return; } case IT_AMMO: if ( cg.snap->ps.ammo[ j ] < 1 ) { CG_Printf( "Out of item: %s/n", message ); return; } break; case IT_POWERUP: if ( cg.snap->ps.powerups[ j ] <= cg.time ) { CG_Printf( "Out of item: %s/n", message ); return; } break; case IT_HOLDABLE: if ( j == HI_KAMIKAZE ) { CG_Printf( "Item is not dropable./n" ); return; } if ( bg_itemlist[ cg.snap->ps.stats[ STAT_HOLDABLE_ITEM ] ].giTag != j ) { CG_Printf( "Out of item: %s/n", message ); return; } break; default: CG_Printf( "Item is not dropable./n" ); return; } Com_sprintf( command, 128, "drop %s", message ); trap_SendClientCommand( command );}
开发者ID:xzero450,项目名称:revolution,代码行数:74,
示例27: ClearRegisteredItems/*==============ClearRegisteredItems==============*/void ClearRegisteredItems( void ) { memset( itemRegistered, 0, sizeof( itemRegistered ) ); if(g_instantgib.integer) { if(g_instantgib.integer & 2) RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) ); //RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_RAILGUN ) ); } else if(g_rockets.integer) { //RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) ); //RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_ROCKET_LAUNCHER ) ); } else { // players always start with the base weapon RegisterItem( BG_FindItemForWeapon( WP_MACHINEGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_GAUNTLET ) ); if(g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_CTF_ELIMINATION || g_gametype.integer == GT_LMS || g_elimination_allgametypes.integer) { RegisterItem( BG_FindItemForWeapon( WP_SHOTGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_GRENADE_LAUNCHER ) ); RegisterItem( BG_FindItemForWeapon( WP_ROCKET_LAUNCHER ) ); RegisterItem( BG_FindItemForWeapon( WP_LIGHTNING ) ); RegisterItem( BG_FindItemForWeapon( WP_RAILGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_PLASMAGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_BFG ) ); RegisterItem( BG_FindItemForWeapon( WP_NAILGUN ) ); RegisterItem( BG_FindItemForWeapon( WP_PROX_LAUNCHER ) ); RegisterItem( BG_FindItemForWeapon( WP_CHAINGUN ) ); } } if( g_gametype.integer == GT_HARVESTER ) { RegisterItem( BG_FindItem( "Red Cube" ) ); RegisterItem( BG_FindItem( "Blue Cube" ) ); } if(g_gametype.integer == GT_DOUBLE_D ) { RegisterItem( BG_FindItem( "Point A (Blue)" ) ); RegisterItem( BG_FindItem( "Point A (Red)" ) ); RegisterItem( BG_FindItem( "Point A (White)" ) ); RegisterItem( BG_FindItem( "Point B (Blue)" ) ); RegisterItem( BG_FindItem( "Point B (Red)" ) ); RegisterItem( BG_FindItem( "Point B (White)" ) ); } if(g_gametype.integer == GT_DOMINATION ) { RegisterItem( BG_FindItem( "Neutral domination point" ) ); RegisterItem( BG_FindItem( "Red domination point" ) ); RegisterItem( BG_FindItem( "Blue domination point" ) ); } }
开发者ID:OpenArena,项目名称:legacy,代码行数:61,
示例28: Bot_ScriptInitBot//.........这里部分代码省略......... if(!Q_stricmp(token, "/class")) { token = COM_ParseExt(&p, qfalse); if(!token || !token[0] || token[0] == '/') { G_Error("BotScript, line %i: unexpected end of /class parameter", bsgd->lineNum); } // val = Team_ClassForString(token); if(val < 0) { G_Error("BotScript, line %i: unknown class /"%s/"", bsgd->lineNum, token); } if(bs->mpClass != val) { break; } } else // if(!Q_stricmp(token, "/weapon")) { memset(weapons, 0, sizeof(weapons)); // for each weapon while(qtrue) { // read the weapon token = COM_ParseExt(&p, qfalse); if(!token || !token[0] || token[0] == '/') { G_Error("BotScript, line %i: unexpected end of /weapon parameter", bsgd->lineNum); } // if((item = BG_FindItem(token))) { if(!item->giTag) { G_Error("BotScript, line %i: unknown weapon /"%s/"", bsgd->lineNum, token); } COM_BitSet(weapons, item->giTag); } else { G_Error("BotScript, line %i: unknown weapon /"%s/"", bsgd->lineNum, token); } // pBackup = p; token = COM_ParseExt(&p, qfalse); if(Q_stricmp(token, "or") != 0) { // not OR, so drop out of here p = pBackup; break; } } if(!(ent->client->ps.weapons[0] & weapons[0]) && !(ent->client->ps.weapons[1] & weapons[1])) { break; } } else // if(!Q_stricmp(token, "/within_range")) { // targetname token = COM_ParseExt(&p, qfalse);
开发者ID:ethr,项目名称:ETXreaLPro_etmain,代码行数:67,
注:本文中的BG_FindItem函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BG_FindItemForWeapon函数代码示例 C++ BG_EvaluateTrajectoryDelta函数代码示例 |