• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FindItem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindItem函数的典型用法代码示例。如果您正苦于以下问题:C++ FindItem函数的具体用法?C++ FindItem怎么用?C++ FindItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindItem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FindItem

void wxMenuBar::MacInstallMenuBar()
{
    if ( s_macInstalledMenuBar == this )
        return ;

    m_rootMenu->GetPeer()->MakeRoot();
    
    // hide items in the apple menu that don't exist in the wx menubar
    
    wxMenuItem* appleItem = NULL;
    wxMenuItem* wxItem = NULL;

    int menuid = wxApp::s_macAboutMenuItemId;
    appleItem = m_appleMenu->FindItem(menuid);
    wxItem = FindItem(menuid);
    if ( appleItem != NULL )
    {
        if ( wxItem == NULL )
            appleItem->GetPeer()->Hide();
        else 
            appleItem->SetItemLabel(wxItem->GetItemLabel());
    }
    
    menuid = wxApp::s_macPreferencesMenuItemId;
    appleItem = m_appleMenu->FindItem(menuid);
    wxItem = FindItem(menuid);
    if ( appleItem != NULL )
    {
        if ( wxItem == NULL )
            appleItem->GetPeer()->Hide();
        else 
            appleItem->SetItemLabel(wxItem->GetItemLabel());
    }
    
        
#if 0

    // if we have a mac help menu, clean it up before adding new items
    MenuHandle helpMenuHandle ;
    MenuItemIndex firstUserHelpMenuItem ;

    if ( UMAGetHelpMenuDontCreate( &helpMenuHandle , &firstUserHelpMenuItem) == noErr )
    {
        for ( int i = CountMenuItems( helpMenuHandle ) ; i >= firstUserHelpMenuItem ; --i )
            DeleteMenuItem( helpMenuHandle , i ) ;
    }
    else
    {
        helpMenuHandle = NULL ;
    }

    if ( wxApp::s_macPreferencesMenuItemId)
    {
        wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
        if ( item == NULL || !(item->IsEnabled()) )
            DisableMenuCommand( NULL , kHICommandPreferences ) ;
        else
            EnableMenuCommand( NULL , kHICommandPreferences ) ;
    }

    // Unlike preferences which may or may not exist, the Quit item should be always
    // enabled unless it is added by the application and then disabled, otherwise
    // a program would be required to add an item with wxID_EXIT in order to get the
    // Quit menu item to be enabled, which seems a bit burdensome.
    if ( wxApp::s_macExitMenuItemId)
    {
        wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
        if ( item != NULL && !(item->IsEnabled()) )
            DisableMenuCommand( NULL , kHICommandQuit ) ;
        else
            EnableMenuCommand( NULL , kHICommandQuit ) ;
    }

    wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
    wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;
    wxMenuList::compatibility_iterator menuIter = m_menus.GetFirst();
    for (size_t i = 0; i < m_menus.GetCount(); i++, menuIter = menuIter->GetNext())
    {
        wxMenuItemList::compatibility_iterator node;
        wxMenuItem *item;
        wxMenu* menu = menuIter->GetData() , *subMenu = NULL ;
        wxString strippedMenuTitle = wxStripMenuCodes(m_titles[i]);

        if ( strippedMenuTitle == wxT("?") || strippedMenuTitle == strippedHelpMenuTitle || strippedMenuTitle == strippedTranslatedHelpMenuTitle )
        {
            for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
            {
                item = (wxMenuItem *)node->GetData();
                subMenu = item->GetSubMenu() ;
                if (subMenu)
                {
                    UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding() );
                    MenuItemIndex position = CountMenuItems(mh);
                    ::SetMenuItemHierarchicalMenu(mh, position, MAC_WXHMENU(subMenu->GetHMenu()));
                }
                else
                {
                    if ( item->GetId() != wxApp::s_macAboutMenuItemId )
                    {
                        // we have found a user help menu and an item other than the about item,
//.........这里部分代码省略.........
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:101,代码来源:menu_osx.cpp


示例2: NoAmmoWeaponChange

/*
=================
NoAmmoWeaponChange
=================
*/
void NoAmmoWeaponChange (edict_t *ent)
{
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("slugs"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("railgun"))] )
	{
		ent->client->newweapon = FindItem ("railgun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("hyperblaster"))] )
	{
		ent->client->newweapon = FindItem ("hyperblaster");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("chaingun"))] )
	{
		ent->client->newweapon = FindItem ("chaingun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("bullets"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("machinegun"))] )
	{
		ent->client->newweapon = FindItem ("machinegun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))] > 1
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("super shotgun"))] )
	{
		ent->client->newweapon = FindItem ("super shotgun");
		return;
	}
	if ( ent->client->pers.inventory[ITEM_INDEX(FindItem("shells"))]
		&&  ent->client->pers.inventory[ITEM_INDEX(FindItem("shotgun"))] )
	{
		ent->client->newweapon = FindItem ("shotgun");
		return;
	}
	ent->client->newweapon = FindItem ("blaster");
}
开发者ID:yquake2,项目名称:zaero,代码行数:45,代码来源:weapon.c


示例3: G_SetStats

/*
===============
G_SetStats
===============
*/
void G_SetStats (edict_t *ent)
{
	gitem_t		*item;
	int			index, cells;
	int			power_armor_type;

	//
	// health
	//
	ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health;
	ent->client->ps.stats[STAT_HEALTH] = ent->health;

	//
	// magicka
	//
	ent->client->ps.stats[STAT_MAGICKA_ICON] = level.pic_magicka;
	ent->client->ps.stats[STAT_MAGICKA] = ent->magicka;

	//
	// ammo
	//
	if (!ent->client->ammo_index /* || !ent->client->pers.inventory[ent->client->ammo_index] */)
	{
		ent->client->ps.stats[STAT_AMMO_ICON] = 0;
		ent->client->ps.stats[STAT_AMMO] = 0;
	}
	else
	{
		item = &itemlist[ent->client->ammo_index];
		ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index];
	}
	
	//
	// armor
	//
	power_armor_type = PowerArmorType (ent);
	if (power_armor_type)
	{
		cells = ent->client->pers.inventory[ITEM_INDEX(FindItem ("cells"))];
		if (cells == 0)
		{	// ran out of cells for power armor
			ent->flags &= ~FL_POWER_ARMOR;
			gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
			power_armor_type = 0;;
		}
	}

	index = ArmorIndex (ent);
	if (power_armor_type && (!index || (level.framenum & 8) ) )
	{	// flash between power armor and other armor icon
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powershield");
		ent->client->ps.stats[STAT_ARMOR] = cells;
	}
	else if (index)
	{
		item = GetItemByIndex (index);
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_ARMOR] = ent->client->pers.inventory[index];
	}
	else
	{
		ent->client->ps.stats[STAT_ARMOR_ICON] = 0;
		ent->client->ps.stats[STAT_ARMOR] = 0;
	}

	//
	// pickup message
	//
	if (level.time > ent->client->pickup_msg_time)
	{
		ent->client->ps.stats[STAT_PICKUP_ICON] = 0;
		ent->client->ps.stats[STAT_PICKUP_STRING] = 0;
	}

	//
	// timers
	//
	if (ent->client->quad_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_quad");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->quad_framenum - level.framenum)/10;
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_invulnerability");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->invincible_framenum - level.framenum)/10;
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_envirosuit");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->enviro_framenum - level.framenum)/10;
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
//.........这里部分代码省略.........
开发者ID:pmm33,项目名称:pmm33,代码行数:101,代码来源:p_hud.c


示例4: misc_model_cargo_die

void misc_model_cargo_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod, int dFlags, int hitLoc )
{
    int		flags;
    vec3_t	org, temp;
    gitem_t *health = NULL, *shields = NULL, *bacta = NULL, *batteries = NULL;

    // copy these for later
    flags = self->spawnflags;
    VectorCopy( self->currentOrigin, org );

    // we already had spawn flags, but we don't care what they were...we just need to set up the flags we want for misc_model_breakable_die
    self->spawnflags = 8; // NO_DMODEL

    // pass through to get the effects and such
    misc_model_breakable_die( self, inflictor, attacker, damage, mod );

    // now that the model is broken, we can safely spawn these in it's place without them being in solid
    temp[2] = org[2] + 16;

    // annoying, but spawn each thing in its own little quadrant so that they don't end up on top of each other
    if (( flags & DROP_MEDPACK ))
    {
        health = FindItem( "item_medpak_instant" );

        if ( health )
        {
            temp[0] = org[0] + crandom() * 8 + 16;
            temp[1] = org[1] + crandom() * 8 + 16;

            LaunchItem( health, temp, (float *)vec3_origin, NULL );
        }
    }
    if (( flags & DROP_SHIELDS ))
    {
        shields = FindItem( "item_shield_sm_instant" );

        if ( shields )
        {
            temp[0] = org[0] + crandom() * 8 - 16;
            temp[1] = org[1] + crandom() * 8 + 16;

            LaunchItem( shields, temp, (float *)vec3_origin, NULL );
        }
    }

    if (( flags & DROP_BACTA ))
    {
        bacta = FindItem( "item_bacta" );

        if ( bacta )
        {
            temp[0] = org[0] + crandom() * 8 - 16;
            temp[1] = org[1] + crandom() * 8 - 16;

            LaunchItem( bacta, temp, (float *)vec3_origin, NULL );
        }
    }

    if (( flags & DROP_BATTERIES ))
    {
        batteries = FindItem( "item_battery" );

        if ( batteries )
        {
            temp[0] = org[0] + crandom() * 8 + 16;
            temp[1] = org[1] + crandom() * 8 - 16;

            LaunchItem( batteries, temp, (float *)vec3_origin, NULL );
        }
    }
}
开发者ID:Boothand,项目名称:jedioutcast,代码行数:71,代码来源:g_misc_model.cpp


示例5: P_WorldEffects

/*
=============
P_WorldEffects
=============
*/
void P_WorldEffects (void)
{
	qboolean	breather;
	qboolean	envirosuit;
	int			waterlevel, old_waterlevel;

	if (current_player->movetype == MOVETYPE_NOCLIP)
	{
		current_player->air_finished = level.time + 12;	// don't need air
		return;
	}

	//K03 Begin
	//if (HasActiveCurse(current_player, CURSE_FROZEN))
	if (que_typeexists(current_player->curses, CURSE_FROZEN))
		current_player->air_finished = level.time + 6;
	//K03 End

	waterlevel = current_player->waterlevel;
	old_waterlevel = current_client->old_waterlevel;
	current_client->old_waterlevel = waterlevel;

	breather = current_client->breather_framenum > level.framenum;
	envirosuit = current_client->enviro_framenum > level.framenum;

	//
	// if just entered a water volume, play a sound
	//
	if (!old_waterlevel && waterlevel)
	{
		if ((current_player->client->pers.inventory[ITEM_INDEX(FindItem("Stealth Boots"))] < 1))
		{
			if((current_player->myskills.abilities[CLOAK].disable) || (current_player->myskills.abilities[CLOAK].current_level))
			{
				current_player->lastsound = level.framenum; // trigger monsters
				PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF);
				if (current_player->watertype & CONTENTS_LAVA)
					gi.sound (current_player, CHAN_BODY, gi.soundindex("player/lava_in.wav"), 1, ATTN_NORM, 0);
				else if (current_player->watertype & CONTENTS_SLIME)
					gi.sound (current_player, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
				else if (current_player->watertype & CONTENTS_WATER)
					gi.sound (current_player, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
			}
		}
		current_player->flags |= FL_INWATER;

		// clear damage_debounce, so the pain sound will play immediately
		current_player->damage_debounce_time = level.time - 1;
	}

	//
	// if just completely exited a water volume, play a sound
	//
	if (old_waterlevel && ! waterlevel)
	{
		if ((current_player->client->pers.inventory[ITEM_INDEX(FindItem("Stealth Boots"))]<1) && !current_player->mtype)
		{
			if((current_player->myskills.abilities[CLOAK].disable) || (current_player->myskills.abilities[CLOAK].current_level < 1))
			{
				current_player->lastsound = level.framenum; // trigger monsters
				PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF);
				gi.sound (current_player, CHAN_BODY, gi.soundindex("player/watr_out.wav"), 1, ATTN_NORM, 0);
			}
		}
		current_player->flags &= ~FL_INWATER;
	}

	//
	// check for head just going under water
	//
	if (old_waterlevel != 3 && waterlevel == 3)
	{
		if (current_player->client)//K03
			gi.sound (current_player, CHAN_BODY, gi.soundindex("player/watr_un.wav"), 1, ATTN_NORM, 0);
	}

	//
	// check for head just coming out of water
	//
	if (old_waterlevel == 3 && waterlevel != 3)
	{
		if (current_player->air_finished < level.time)
		{	// gasp for air
			if (current_player->client)//K03
			{
			gi.sound (current_player, CHAN_VOICE, gi.soundindex("player/gasp1.wav"), 1, ATTN_NORM, 0);
			PlayerNoise(current_player, current_player->s.origin, PNOISE_SELF);
			}
		}
		else  if (current_player->air_finished < level.time + 11)
		{	// just break surface
			if (current_player->client)//K03
				gi.sound (current_player, CHAN_VOICE, gi.soundindex("player/gasp2.wav"), 1, ATTN_NORM, 0);
		}
	}
//.........这里部分代码省略.........
开发者ID:Ciclop,项目名称:quake-2-vortex,代码行数:101,代码来源:p_view.c


示例6: STII

void CServerListView::AddItem(int ItemType, void *pItemData)
{
  STIInfo STII(ItemType,pItemData);

  if (ItemType == STI_SERVER)
  {
    // Server's go in the root of the tree...
    TreeItemInfo *pNewTII = new TreeItemInfo(STII.m_TIIItem,STII.m_ItemData,0,STII_NONE);
    m_TIIList.Add(pNewTII);
    HTREEITEM hItem=m_tree.InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM,
      STII.m_ItemName,
      STII.m_iconindices[2],STII.m_iconindices[3], // image & selected image numbers
      0,0, // unused
      (LPARAM)pNewTII, //pServer,
      TVI_ROOT,TVI_SORT);
  }
  else
  {
    TVITEM item;
    HTREEITEM hServerItem;
    HTREEITEM hGroupItem;
    HTREEITEM hItem;
    HTREEITEM hNewLocation;
    item.pszText = NULL;
    item.iImage = 0;
    item.iSelectedImage = 0;
    item.state = 0;
    item.stateMask = 0;
    item.lParam = 0;  
    TreeItemInfo *pTII;

    switch (ItemType)
    {
      case STI_DCCCHAT:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pServer->m_pOtherServer);
        break;
      case STI_QUERY:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pQuery->m_pServer);
        break;
      case STI_CHANNEL:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pChannel->m_pServer);
        break;
    }

    if (hServerItem)
    {
      item.mask = TVIF_CHILDREN;
      item.hItem = hServerItem; // we want more info about this tree node.
      if (m_tree.GetItem(&item))
      {
        // when we find the right place to put the item, we set it here.
        // when searching 
        hNewLocation = NULL;

        if (item.cChildren > 0)
        {
          // find the DCCChats/Channels/Queries child window group tree item
          if (hGroupItem = m_tree.GetChildItem(hServerItem))
          {
            do
            {
              item.mask = TVIF_PARAM;
              item.hItem = hGroupItem; // we want more info about this tree node.
              if (m_tree.GetItem(&item))
              {
                pTII = (TreeItemInfo *)item.lParam;
                if (pTII->m_Type == STII.m_TIIGroup)
                {
                  // found the channels tree view item under the server.
                  hNewLocation = hGroupItem;
                  break;
                }
              }
              hGroupItem = m_tree.GetNextSiblingItem(hGroupItem);
            } while (hGroupItem);
          }
        }

        if (hNewLocation == NULL)
        {
          // TODO: Add a pref for this
          if (!BOOLPREF(PREF_bServerListChannelGroups) && ItemType == STI_CHANNEL)
          {
            // add channels directly under the server node.
            hNewLocation = hServerItem;
          }
          else
          {
            // if there are no other windows of this kind open
            // So we add a group for them to appear under.

            // TODO: Insert groups alphabetcially (or in a proper defined order ?)
            TreeItemInfo *pNewTII = new TreeItemInfo(STII.m_TIIGroup,NULL,STII.m_TreeSortValue,STII_NONE);
            m_TIIList.Add(pNewTII);
            hNewLocation=m_tree.InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM,
              STII.m_GroupName,
              STII.m_iconindices[0],STII.m_iconindices[1], // image & selected image numbers
              0,0, // unused
              (LPARAM)pNewTII,
              hServerItem,hServerItem);
//.........这里部分代码省略.........
开发者ID:HydraIRC,项目名称:hydrairc,代码行数:101,代码来源:ServerList.cpp


示例7: ACEIT_ItemNeed


//.........这里部分代码省略.........
				return 0.0;
	
		case ITEMLIST_ROCKETS:
			if(self->client->pers.inventory[ITEMLIST_ROCKETS] < self->client->pers.max_rockets)
				return 1.5;  
			else
				return 0.0;

		// Knightmare added
		case ITEMLIST_HOMINGROCKETS:
			if(self->client->pers.inventory[ITEMLIST_HOMINGROCKETS] < self->client->pers.max_homing_missiles)
				return 1.5;  
			else
				return 0.0;

		case ITEMLIST_GRENADES:
			if(self->client->pers.inventory[ITEMLIST_GRENADES] < self->client->pers.max_grenades)
				return 0.3;  
			else
				return 0.0;

		// Knightmare added
		case ITEMLIST_FUEL:
			if(self->client->pers.inventory[ITEMLIST_FUEL] < self->client->pers.max_fuel)
				return 0.3;  
			else
				return 0.0;

		// Knightmare added
		case ITEMLIST_AMMOGENPACK:
			return 0.5;
	
		case ITEMLIST_BODYARMOR:
			if(ACEIT_CanUseArmor (FindItem("Body Armor"), self))
				return 0.6;  
			else
				return 0.0;
	
		case ITEMLIST_COMBATARMOR:
			if(ACEIT_CanUseArmor (FindItem("Combat Armor"), self))
				return 0.6;  
			else
				return 0.0;
	
		case ITEMLIST_JACKETARMOR:
			if(ACEIT_CanUseArmor (FindItem("Jacket Armor"), self))
				return 0.6;  
			else
				return 0.0;
	
		case ITEMLIST_POWERSCREEN:
		case ITEMLIST_POWERSHIELD:
			return 0.5;  

		case ITEMLIST_FLAG1:
			// If I am on team one or three, I want team two's flag
			if(!self->client->pers.inventory[item]
				&& self->client->resp.ctf_team == CTF_TEAM2 || self->client->resp.ctf_team == CTF_TEAM3)
				return 10.0;  
			else 
				return 0.0;

		case ITEMLIST_FLAG2:
			if(!self->client->pers.inventory[item]
				&& self->client->resp.ctf_team == CTF_TEAM1 || self->client->resp.ctf_team == CTF_TEAM3)
				return 10.0;  
开发者ID:calking25,项目名称:quake2vr,代码行数:67,代码来源:acebot_items.c


示例8: ClientEndServerFrame


//.........这里部分代码省略.........

	bobtime = (current_client->bobtime += bobmove);

	if (current_client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		bobtime *= 4;
	}

	bobcycle = (int)bobtime;
	bobfracsin = fabs(sin(bobtime*M_PI));

	// detect hitting the floor
	P_FallingDamage (ent);

	// apply all the damage taken this frame
	P_DamageFeedback (ent);

	// determine the view offsets
	SV_CalcViewOffset (ent);

	// determine the gun offsets
	SV_CalcGunOffset (ent);

	/* determine the full screen color blend
	   must be after viewoffset, so eye contents
	   can be accurately determined */
	SV_CalcBlend(ent);

	/* chase cam stuff */
	if (ent->client->resp.spectator)
	{
		G_SetSpectatorStats(ent);
	}
	else
	{
		G_SetStats(ent);
	}

	G_CheckChaseStats(ent);

	G_SetClientEvent (ent);

	G_SetClientEffects (ent);

	G_SetClientSound (ent);

	G_SetClientFrame (ent);

	VectorCopy (ent->velocity, ent->client->oldvelocity);
	VectorCopy (ent->client->ps.viewangles, ent->client->oldviewangles);

	// clear weapon kicks
	VectorClear (ent->client->kick_origin);
	VectorClear (ent->client->kick_angles);

	if (!(level.framenum & 31))
	{
		/* if the scoreboard is up, update it */
		if (ent->client->showscores)
		{
			if (ent->client->zCameraTrack) /* FS: Zaero specific game dll changes */
			{
				updateVisorHud(ent);
			}
			else
			{
				DeathmatchScoreboardMessage (ent, ent->enemy);
			}
			gi.unicast(ent, false);
		}

		/* if the help computer is up, update it */
		if (ent->client->showhelp)
		{
			ent->client->pers.helpchanged = 0;
			HelpComputer(ent);
			gi.unicast(ent, false);
		}
	}

	// this we want to do regardless
	if (ent->client->zCameraTrack)  /* FS: Zaero specific game dll changes */
	{
		// decrease the visor frame time
		ent->client->pers.visorFrames--;
		if (ent->client->pers.visorFrames == 0)
		{
			stopCamera(ent);
			ent->client->pers.inventory[ITEM_INDEX(FindItem("Visor"))]--;
			ValidateSelectedItem (ent);
		}
	}

	/* if the inventory is up, update it */
	if (ent->client->showinventory)
	{
		InventoryMessage(ent);
		gi.unicast(ent, false);
	}
}
开发者ID:basecq,项目名称:q2dos,代码行数:101,代码来源:p_view.c


示例9: FindItem

bool wxGridBagSizer::SetItemPosition(wxSizer *sizer, const wxGBPosition& pos)
{
    wxGBSizerItem* item = FindItem(sizer);
    wxCHECK_MSG(item, false, wxT("Failed to find item."));
    return item->SetPos(pos);
}
开发者ID:Anonymous2,项目名称:project64,代码行数:6,代码来源:gbsizer.cpp


示例10: Give_Class_Weapon

void Give_Class_Weapon(edict_t *ent)
{
	gitem_t		*item;
	gclient_t	*client;
	gitem_t		*ammo_item;

	client=ent->client;


	if (knifefest->value)
	{
		item = FindItem("Helmet");
		client->pers.inventory[ITEM_INDEX(item)] = 1;
		item = FindItem("Fists");
		client->pers.inventory[ITEM_INDEX(item)] = 1;
		item = FindItem("Knife");
		client->pers.inventory[ITEM_INDEX(item)] = 5;
		client->pers.selected_item=ITEM_INDEX(item);
		client->newweapon=item;
		ChangeWeapon(ent);
		return;
	}


	if (client->resp.mos == ENGINEER)
	{
		item = FindItem("Sandbags");
		client->pers.inventory[ITEM_INDEX(item)]= 2;

	}

	//give everyone a knife & fists & helmet

		item = FindItem("Helmet");
		client->pers.inventory[ITEM_INDEX(item)] = 1;
		item = FindItem("Fists");
		client->pers.inventory[ITEM_INDEX(item)] = 1;
		item = FindItem("Knife");
		client->pers.inventory[ITEM_INDEX(item)] = 1;

	// faf rifle-only code  //ddaylife 
	if ((mauser_only->value == 1) && !(client->resp.mos == MEDIC))
	{
			item= FindTeamItem(team_list[1]->teamid, LOC_RIFLE);
	}
	else if ((sniper_only->value == 1) && !(client->resp.mos == MEDIC))
	{
			item= FindTeamItem(team_list[(client->resp.team_on->index)]->teamid, LOC_SNIPER);
	}
	else if (swords->value == 1 && client->resp.mos != MEDIC)
	{
			item= FindItem("Sword");
	}

	else
		item=FindItem(client->resp.team_on->mos[client->resp.mos]->weapon1);


	// Loads primary weapon when spawning
	Load_Weapon (ent, item);
	

	if (!item) { //pbowens: prevents from crashing the game
		safe_cprintf(ent, PRINT_HIGH, "weapon1 item not found!\n");
		return;
	}

	client->pers.selected_item=ITEM_INDEX(item);
	client->newweapon=item;
	client->pers.inventory[client->pers.selected_item]=1;

	item = NULL;
	//if(client->resp.team_on->mos[client->resp.mos]->weapon2)
	//{
		if ((item=FindItem(client->resp.team_on->mos[client->resp.mos]->weapon2)) != NULL)
			client->pers.inventory[ITEM_INDEX(item)]=1;

	// Loads secondary weapon, if existant, when spawning
	if (item)
	{
		ammo_item = FindItem(item->ammo);
		if (!strcmp(item->dllname, team_list[1]->teamid) && item->position == LOC_PISTOL)
			ent->client->mags[1].pistol_rnd = ammo_item->quantity;
		else if (!strcmp(item->dllname, team_list[0]->teamid) && item->position == LOC_PISTOL)
			ent->client->mags[0].pistol_rnd = ammo_item->quantity;

		/*
		ammo_item = FindItem(item->ammo);
		if (!strcmp(item->ammo, "p38_mag"))
			ent->client->mags[1].pistol_rnd = ammo_item->quantity;
		else if (!strcmp(item->ammo, "colt45_mag"))
			ent->client->mags[0].pistol_rnd = ammo_item->quantity;
		*/
	}

	//}
	//if(client->resp.team_on->mos[client->resp.mos]->grenades)
	//{

	if (!no_nades->value)//ddaylife
//.........这里部分代码省略.........
开发者ID:basecq,项目名称:q2dos,代码行数:101,代码来源:p_classes.c


示例11: Load_Weapon

//fills a gun with bullets
void Load_Weapon (edict_t *ent, gitem_t	*item)
{
	gitem_t	*ammo_item;

	// Loads primary weapon when spawning
	ammo_item = FindItem(item->ammo);
	if (!ammo_item)
	{
		gi.dprintf(DEVELOPER_MSG_GAME, "WARNING: in Give_Class_Weapon %s spawned with no ammo for %s -> %s\n", ent->client->pers.netname, item->pickup_name, item->ammo);
		return;
	}


	if (!strcmp(item->ammo, "mauser98k_mag") && !strcmp(item->pickup_name, "Mauser 98k"))
		ent->client->mags[1].rifle_rnd = ammo_item->quantity;
	else if (!strcmp(item->ammo, "mauser98k_mag") && !strcmp(item->pickup_name, "Mauser 98ks"))
		ent->client->mags[1].sniper_rnd = ammo_item->quantity;

        else if (!strcmp(item->dllname, team_list[1]->teamid))  //faf:  if its a team 1 weap...(usually grm)
        {
                if (item->position == LOC_PISTOL)
                        ent->client->mags[1].pistol_rnd = ammo_item->quantity;
                else if (item->position == LOC_SUBMACHINEGUN)
                        ent->client->mags[1].submg_rnd = ammo_item->quantity;
                else if (item->position == LOC_L_MACHINEGUN)
                        ent->client->mags[1].lmg_rnd = ammo_item->quantity;
                else if (item->position == LOC_H_MACHINEGUN)
                        ent->client->mags[1].hmg_rnd = ammo_item->quantity;
                else if (item->position == LOC_ROCKET)
                        ent->client->mags[1].antitank_rnd = ammo_item->quantity;
                else if (item->position == LOC_RIFLE)
                        ent->client->mags[1].rifle_rnd = ammo_item->quantity;
                else if (item->position == LOC_SNIPER)
                        ent->client->mags[1].sniper_rnd = ammo_item->quantity;
                else if (item->position == LOC_SHOTGUN)
                        ent->client->mags[1].shotgun_rnd = ammo_item->quantity;
                 else if (item->position == LOC_SUBMACHINEGUN2)
                        ent->client->mags[1].submg2_rnd = ammo_item->quantity;
       }

        else if (!strcmp(item->dllname, team_list[0]->teamid))  //usually allied weapons here...
        {
                if (item->position == LOC_PISTOL)
                        ent->client->mags[0].pistol_rnd = ammo_item->quantity;
                else if (item->position ==  LOC_RIFLE)
                        ent->client->mags[0].rifle_rnd = ammo_item->quantity;
                else if (item->position == LOC_SNIPER)
                        ent->client->mags[0].sniper_rnd = ammo_item->quantity;  //faf:  not used for usa but so plugin team 1 can use same ammo for inf rifle and sniper rifle
                else if (item->position == LOC_SUBMACHINEGUN)
                        ent->client->mags[0].submg_rnd = ammo_item->quantity;
                else if (item->position == LOC_L_MACHINEGUN)
                        ent->client->mags[0].lmg_rnd = ammo_item->quantity;
                else if (item->position == LOC_H_MACHINEGUN)
                        ent->client->mags[0].hmg_rnd = ammo_item->quantity;
                else if (item->position == LOC_ROCKET)
                        ent->client->mags[0].antitank_rnd = ammo_item->quantity;
                else if (item->position == LOC_SNIPER)
                        ent->client->mags[0].sniper_rnd = ammo_item->quantity;
                else if (item->position == LOC_SHOTGUN)
                        ent->client->mags[0].shotgun_rnd = ammo_item->quantity;
                 else if (item->position == LOC_SUBMACHINEGUN2)
                        ent->client->mags[0].submg2_rnd = ammo_item->quantity;
       }

        else if (!strcmp(item->ammo, "flame_mag"))
                ent->client->flame_rnd = ammo_item->quantity;
	
}
开发者ID:basecq,项目名称:q2dos,代码行数:69,代码来源:p_classes.c


示例12: main

int main(void)
{
    char* command = malloc(10);
    int item = 0;
    struct treeNode** root = malloc(sizeof(struct treeNode*));
    *root = NULL;

    for(;;)
    {
        printf("Command: ");
        scanf("%s", command);
        if(!strcmp(command, "insert"))
        {
            printf("Item: ");
            scanf("%d", &item);
            Insert(root, item);
        }
        else if(!strcmp(command, "print"))
        {
            int choice = 0;
            if(*root == NULL){printf("Cannot print an empty tree!\n");continue;}
            printf("Order (1-PreOrder; 2-InOrder; 3-PostOrder): ");
            scanf("%d", &choice);
            if(choice == 1)
            {
                if(PrintPreOrder(*root)){printf("Cannot print an empty tree!\n");}
            }
            else if(choice == 2)
            {
                if(PrintInOrder(*root)){printf("Cannot print an empty tree!\n");}
            }
            else if(choice == 3)
            {
                if(PrintPostOrder(*root)){printf("Cannot print an empty tree!\n");}
            }
            else
            {
                printf("Invalid Choice\n");
            }
        }
        else if(!strcmp(command, "find"))
        {
            printf("Item: ");
            scanf("%d", &item);

            struct treeNode* temp = FindItem(*root, item);

            if(temp == NULL)
            {
                printf("Item not found - not in tree\n");
            }
            else
            {
                printf("Item found - address of item is: [%p]\n", (void *)temp);
            }
        }
        else if(!strcmp(command, "delete"))
        {
            printf("Item: ");
            scanf("%d", &item);

            if(DeleteNode(root, item))
            {
                printf("Node not found - not deleted\n");
            }
            else
            {
                printf("Node deleted\n");
            }
        }
        else if(!strcmp(command, "quit"))
        {
            break;
        }
    }

    free(command);
    freeTree(*root);
    free(root);
}
开发者ID:mchenchen,项目名称:Course-Work,代码行数:80,代码来源:treeTester.c


示例13: Cmd_Use_f

/*
==================
Cmd_Use_f

Use an inventory item
==================
*/
void Cmd_Use_f (edict_t *ent)
{
	int			index;
	gitem_t		*it;
	char		*s;

	s = gi.args();
	it = FindItem (s);
	if (!it)
	{
		gi.cprintf (ent, PRINT_HIGH, "unknown item: %s\n", s);
		return;
	}
	if (!it->use)
	{
		gi.cprintf (ent, PRINT_HIGH, "Item is not usable.\n");
		return;
	}
	gitem_t		*itt; //checks
	index = ITEM_INDEX(it); //doesn't matter what this is set to, not passed on
	if (!ent->client->pers.inventory[index])
	{
		// RAFAEL and Xatrogue mod, this makes the uber-l33t dual weapon binds and triple weapon binds work
		if (strcmp (it->pickup_name, "HyperBlaster") == 0)
		{
			itt = FindItem ("Ionripper");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				itt = FindItem ("ETF Rifle");
				index = ITEM_INDEX (itt);
				if (!ent->client->pers.inventory[index])
				{
					gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
					return;
				}
			}
		}
		
		else if (strcmp (it->pickup_name, "Railgun") == 0)
		{
			itt = FindItem ("Phalanx");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
				return;
			}
		}
		else if (strcmp (it->pickup_name, "Chaingun") == 0)
		{
			itt = FindItem ("Plasma Beam");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
				return;
			}
		}
		else if (strcmp (it->pickup_name, "Rocket Launcher") == 0)
		{
			itt = FindItem ("Disruptor");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
				return;
			}
		}
		else if (strcmp (it->pickup_name, "Grenade Launcher") == 0)
		{
			itt = FindItem ("Prox Launcher");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
				return;
			}
		}
		else if (strcmp (it->pickup_name, "Blaster") == 0)
		{
			itt = FindItem ("Chainfist");
			index = ITEM_INDEX (itt);
			if (!ent->client->pers.inventory[index])
			{
				gi.cprintf (ent, PRINT_HIGH, "Out of item: %s\n", s);
				return;
			}
		}
		else if (strcmp (it->pickup_name, "Grenades") == 0)
		{
			itt = FindItem ("Trap");
			index = ITEM_INDEX (itt);
//.........这里部分代码省略.........
开发者ID:dmitripot,项目名称:xatrogue,代码行数:101,代码来源:g_cmds.c


示例14: Cmd_Give_f

/*
==================
Cmd_Give_f

Give items to a client
==================
*/
void Cmd_Give_f (edict_t *ent)
{
	char		*name;
	gitem_t		*it;
	int			index;
	int			i;
	qboolean	give_all;
	edict_t		*it_ent;

	if (deathmatch->value && !sv_cheats->value)
	{
		gi.cprintf (ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
		return;
	}

	name = gi.args();

	if (Q_stricmp(name, "all") == 0)
		give_all = true;
	else
		give_all = false;

	if (give_all || Q_stricmp(gi.argv(1), "health") == 0)
	{
		if (gi.argc() == 3)
			ent->health = atoi(gi.argv(2));
		else
			ent->health = ent->max_health;
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "weapons") == 0)
	{
		for (i=0 ; i<game.num_items ; i++)
		{
			it = itemlist + i;
			if (!it->pickup)
				continue;
			if (!(it->flags & IT_WEAPON))
				continue;
			ent->client->pers.inventory[i] += 1;
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "ammo") == 0)
	{
		for (i=0 ; i<game.num_items ; i++)
		{
			it = itemlist + i;
			if (!it->pickup)
				continue;
			if (!(it->flags & IT_AMMO))
				continue;
			Add_Ammo (ent, it, 1000);
		}
		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "armor") == 0)
	{
		gitem_armor_t	*info;

		it = FindItem("Jacket Armor");
		ent->client->pers.inventory[ITEM_INDEX(it)] = 0;

		it = FindItem("Combat Armor");
		ent->client->pers.inventory[ITEM_INDEX(it)] = 0;

		it = FindItem("Body Armor");
		info = (gitem_armor_t *)it->info;
		ent->client->pers.inventory[ITEM_INDEX(it)] = info->max_count;

		if (!give_all)
			return;
	}

	if (give_all || Q_stricmp(name, "Power Shield") == 0)
	{
		it = FindItem("Power Shield");
		it_ent = G_Spawn();
		it_ent->classname = it->classname;
		SpawnItem (it_ent, it);
		Touch_Item (it_ent, ent, NULL, NULL);
		if (it_ent->inuse)
			G_FreeEdict(it_ent);

		if (!give_all)
			return;
	}
//.........这里部分代码省略.........
开发者ID:dmitripot,项目名称:xatrogue,代码行数:101,代码来源:g_cmds.c


示例15: cht_Give

void cht_Give (player_t *player, const char *name)
{
	BOOL giveall;
	int i;
	gitem_t *it;

	if (player != &consoleplayer())
		Printf (PRINT_HIGH, "%s is a cheater: give %s\n", player->userinfo.netname, name);

	if (stricmp (name, "all") == 0)
		giveall = true;
	else
		giveall = false;

	if (giveall || strnicmp (name, "health", 6) == 0) {
		int h;

		if (0 < (h = atoi (name + 6))) {
			if (player->mo) {
				player->mo->health += h;
	  			player->health = player->mo->health;
			} else {
				player->health += h;
			}
		} else {
			if (player->mo)
				player->mo->health = deh.GodHealth;
	  
			player->health = deh.GodHealth;
		}

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "backpack") == 0) {
		if (!player->backpack) {
			for (i=0 ; i<NUMAMMO ; i++)
			player->maxammo[i] *= 2;
			player->backpack = true;
		}
		for (i=0 ; i<NUMAMMO ; i++)
			P_GiveAmmo (player, (ammotype_t)i, 1);

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "weapons") == 0) {
		weapontype_t pendweap = player->pendingweapon;
		for (i = 0; i<NUMWEAPONS; i++)
			P_GiveWeapon (player, (weapontype_t)i, false);
		player->pendingweapon = pendweap;

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "ammo") == 0) {
		for (i=0;i<NUMAMMO;i++)
			player->ammo[i] = player->maxammo[i];

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "armor") == 0) {
		player->armorpoints = 200;
		player->armortype = 2;

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "keys") == 0) {
		for (i=0;i<NUMCARDS;i++)
			player->cards[i] = true;

		if (!giveall)
			return;
	}

	if (giveall)
		return;

	it = FindItem (name);
	if (!it) {
		it = FindItemByClassname (name);
		if (!it) {
			if (player == &consoleplayer())
				Printf (PRINT_HIGH, "Unknown item\n");
			return;
		}
	}

	if (it->flags & IT_AMMO) {
		int howmuch;

	/*	if (argc == 3)
			howmuch = atoi (argv[2]);
//.........这里部分代码省略.........
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:101,代码来源:m_cheat.cpp


示例16: SP_item_weapon_nambu

void SP_item_weapon_nambu(edict_t *self)

{
    SpawnItem(self,FindItem("weapon_nambu"));
}
开发者ID:basecq,项目名称:q2dos,代码行数:5,代码来源:jpn_spawn.c


示例17: SP_worldspawn


//.........这里部分代码省略.........
	gi.soundindex ("tng/excellent.wav");
	gi.soundindex ("tng/accuracy.wav");
	gi.soundindex ("tng/clanwar.wav");
	gi.soundindex ("tng/disabled.wav");
	gi.soundindex ("tng/enabled.wav");
	gi.soundindex ("misc/flashlight.wav"); // Caching Flashlight
	// AQ2:TNG - end of precache sounds

	gi.soundindex("boss3/bs3idle1.wav");
	gi.soundindex("user/letsrock.wav");
	gi.soundindex("makron/laf4.wav");
	gi.soundindex("world/xian1.wav");
	gi.soundindex("world/elv.wav");
	gi.soundindex("misc/secret.wav"); // used for ctf swap sound

	PrecacheRadioSounds ();
	//PG BUND - Begin
	PrecacheUserSounds ();
	//AQ2:TNG - Slicer Old location support
	//DescListInit(level.mapname);
	//AQ2:TNG END
	TourneyInit ();
	vInitLevel ();
	//PG BUND - End


	if (!st.gravity)
		gi.cvar_set ("sv_gravity", "800");
	else
		gi.cvar_set ("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (FindItem ("Blaster"));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");
	gi.soundindex ("*gurp1.wav");	// drowning damage
	gi.soundindex ("*gurp2.wav");
	gi.soundindex ("*jump1.wav");	// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pa 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindKey函数代码示例发布时间:2022-05-30
下一篇:
C++ FindIndex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap