这篇教程C++ FindItem函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FindItem函数的典型用法代码示例。如果您正苦于以下问题:C++ FindItem函数的具体用法?C++ FindItem怎么用?C++ FindItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FindItem函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FindItemvoid 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,
示例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,
示例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,
示例4: misc_model_cargo_dievoid 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,
示例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,
示例6: STIIvoid 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,
示例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,
示例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,
示例9: FindItembool 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,
示例10: Give_Class_Weaponvoid 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,
示例11: Load_Weapon//fills a gun with bulletsvoid 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,
示例12: mainint 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,
示例13: Cmd_Use_f/*==================Cmd_Use_fUse 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,
示例14: Cmd_Give_f/*==================Cmd_Give_fGive 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,
示例15: cht_Givevoid 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,
示例16: SP_item_weapon_nambuvoid SP_item_weapon_nambu(edict_t *self){ SpawnItem(self,FindItem("weapon_nambu"));}
开发者ID:basecq,项目名称:q2dos,代码行数:5,
示例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 ("*pain25_2.wav"); gi.soundindex ("*pain50_1.wav"); gi.soundindex ("*pain50_2.wav"); gi.soundindex ("*pain75_1.wav"); gi.soundindex ("*pain75_2.wav"); gi.soundindex ("*pain100_1.wav"); gi.soundindex ("*pain100_2.wav"); //-------------------
开发者ID:darkshade9,项目名称:aq2-tng-alpha,代码行数:67,
示例18: G_Givevoid G_Give( gentity_t *ent, const char *name, const char *args, int argc ){ gitem_t *it; int i; qboolean give_all = qfalse; if ( !Q_stricmp( name, "all" ) ) give_all = qtrue; if ( give_all || !Q_stricmp( name, "health") ) { if ( argc == 3 ) ent->health = Com_Clampi( 1, ent->client->ps.stats[STAT_MAX_HEALTH], atoi( args ) ); else ent->health = ent->client->ps.stats[STAT_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] = Com_Clampi( 0, ent->client->ps.stats[STAT_MAX_HEALTH], atoi( args ) ); else ent->client->ps.stats[STAT_ARMOR] = ent->client->ps.stats[STAT_MAX_HEALTH]; if ( !give_all ) return; } if ( give_all || !Q_stricmp( name, "force" ) ) { if ( argc == 3 ) ent->client->ps.forcePower = Com_Clampi( 0, FORCE_POWER_MAX, atoi( args ) ); else ent->client->ps.forcePower = FORCE_POWER_MAX; if ( !give_all ) return; } if ( give_all || !Q_stricmp( name, "weapons" ) ) { ent->client->ps.stats[STAT_WEAPONS] = (1 << (WP_MELEE)) - ( 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, "eweaps" ) ) //for developing, gives you all the weapons, including enemy { ent->client->ps.stats[STAT_WEAPONS] = (unsigned)(1 << WP_NUM_WEAPONS) - ( 1 << WP_NONE ); // NOTE: this wasn't giving the last weapon in the list return; } if ( give_all || !Q_stricmp( name, "ammo" ) ) { int num = 999; if ( argc == 3 ) num = Com_Clampi( 0, 999, atoi( args ) ); for ( i=AMMO_FORCE; i<MAX_AMMO; i++ ) ent->client->ps.ammo[i] = num != -1 ? num : ammoData[i].max; if ( !give_all ) return; } if ( give_all || !Q_stricmp( name, "batteries" ) ) { if ( argc == 3 ) ent->client->ps.batteryCharge = Com_Clampi( 0, MAX_BATTERIES, atoi( args ) ); else ent->client->ps.batteryCharge = MAX_BATTERIES; if (!give_all) return; } // spawn a specific item right on the player if ( !give_all ) { gentity_t *it_ent; trace_t trace; it = FindItem (args); if (!it) { it = FindItem (name); if (!it) { gi.SendServerCommand( ent-g_entities, "print /"unknown item/n/""); return; } } it_ent = G_Spawn(); VectorCopy( ent->currentOrigin, it_ent->s.origin ); it_ent->classname = G_NewString(it->classname); G_SpawnItem (it_ent, it); FinishSpawningItem(it_ent );//.........这里部分代码省略.........
开发者ID:archSeer,项目名称:OpenJK,代码行数:101,
示例19: spawn_rack_goods// AMMO RACK!!void spawn_rack_goods( gentity_t *ent ){ float v_off = 0; gitem_t *blaster = NULL, *metal_bolts = NULL, *rockets = NULL, *it = NULL; gitem_t *am_blaster = NULL, *am_metal_bolts = NULL, *am_rockets = NULL, *am_pwr_cell = NULL; gitem_t *health = NULL; int pos = 0, ct = 0; gitem_t *itemList[4]; // allocating 4, but we only use 3. done so I don't have to validate that the array isn't full before I add another gi.unlinkentity( ent ); // If BLASTER is checked...or nothing is checked then we'll do blasters if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { if ( ent->spawnflags & RACK_WEAPONS ) { blaster = FindItemForWeapon( WP_BLASTER ); } am_blaster = FindItemForAmmo( AMMO_BLASTER ); } if (( ent->spawnflags & RACK_METAL_BOLTS )) { if ( ent->spawnflags & RACK_WEAPONS ) { metal_bolts = FindItemForWeapon( WP_REPEATER ); } am_metal_bolts = FindItemForAmmo( AMMO_METAL_BOLTS ); } if (( ent->spawnflags & RACK_ROCKETS )) { if ( ent->spawnflags & RACK_WEAPONS ) { rockets = FindItemForWeapon( WP_ROCKET_LAUNCHER ); } am_rockets = FindItemForAmmo( AMMO_ROCKETS ); } if (( ent->spawnflags & RACK_PWR_CELL )) { am_pwr_cell = FindItemForAmmo( AMMO_POWERCELL ); } if (( ent->spawnflags & RACK_HEALTH )) { health = FindItem( "item_medpak_instant" ); RegisterItem( health ); } //---------Ammo types if ( am_blaster ) { itemList[ct++] = am_blaster; } if ( am_metal_bolts ) { itemList[ct++] = am_metal_bolts; } if ( am_pwr_cell ) { itemList[ct++] = am_pwr_cell; } if ( am_rockets ) { itemList[ct++] = am_rockets; } if ( !(ent->spawnflags & RACK_NO_FILL) && ct ) //double negative..should always have at least one item on there, but just being safe { for ( ; ct < 3 ; ct++ ) { itemList[ct] = itemList[0]; // first item ALWAYS propagates to fill up the shelf } } // now actually add the items to the shelf...validate that we have a list to add if ( ct ) { for ( int i = 0; i < ct; i++ ) { GunRackAddItem( itemList[i], ent->s.origin, ent->s.angles, crandom() * 0.5f, (i-1)* 8, 7.0f ); } } // -----Weapon option if ( ent->spawnflags & RACK_WEAPONS ) { if ( !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { // nothing was selected, so we assume blaster pack it = blaster; } else { // if weapon is checked...and so are one or more ammo types, then pick a random weapon to display..always give weaker weapons first//.........这里部分代码省略.........
开发者ID:Boothand,项目名称:jedioutcast,代码行数:101,
示例20: switchvoidlistview::MessageReceived(BMessage *msg){ switch (msg->what) { case ITEM_MENU_SELECTED_MSG: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node);// nodeInfo.SetTo(); char type[256]; nodeInfo.GetType(type); BString t; t << type; // printf(type); // const char *text = type;// (new BAlert("Niue", type, "Ok", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); // if (t == "text/plain" || t == "text/rtf" || t == "text/x-makefile" || t == "text/x-vnd.Be.ResourceDef" || t == "text/x-source-code")// { BMessage msg(SHOW_FILE_MSG); msg.AddRef("refs", fileref); msg.AddPointer("YWin",this); be_app->PostMessage(&msg);// }// else// {// //be_roster->Launch(fileref);// } break; } case ITEM_MENU_INVOKED_MSG: {// entry_ref *fileref = FindItem();// be_roster->Launch(fileref); break; } case MNU_LEFT_SET_SOURCE: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node); nodeInfo.SetType("text/x-source-code"); //rebuild list BuildList(startref); break; } case MNU_LEFT_SET_MAKEFILE: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node); nodeInfo.SetType("text/x-makefile"); //rebuild list BuildList(startref); break; } case MNU_LEFT_SET_RESOURCE: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node); nodeInfo.SetType("application/x-be-resource"); //rebuild list BuildList(startref); break; } case MNU_LEFT_SET_TEXT: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node); nodeInfo.SetType("text/plain"); //rebuild list BuildList(startref); break; } case MNU_LEFT_SET_IMAGE: { entry_ref *fileref = FindItem(); BNode node(fileref); BNodeInfo nodeInfo(&node); //.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Niue,代码行数:101,
示例21: P_FallingDamage/*=================P_FallingDamage=================*/void P_FallingDamage (edict_t *ent){ float delta; int damage; vec3_t dir; if (ent->s.modelindex != 255) return; // not in the player model if (ent->movetype == MOVETYPE_NOCLIP) return; if ((ent->client->oldvelocity[2] < 0) && (ent->velocity[2] > ent->client->oldvelocity[2]) && (!ent->groundentity)) { // if we are airborne and using double-jump, we shouldn't take damage //FIXME: why are we taking fall damage when we are in the air in the first place??? if (ent->v_flags & SFLG_DOUBLEJUMP) return; delta = ent->client->oldvelocity[2]; } else { if (!ent->groundentity) return; delta = ent->velocity[2] - ent->client->oldvelocity[2]; } delta = delta*delta * 0.0001; //K03 Begin if (ent->client->thrusting) return; if (ent->client->hook_state == HOOK_ON) return; //K03 End // never take falling damage if completely underwater if (ent->waterlevel == 3) return; if (ent->waterlevel == 2) delta *= 0.25; if (ent->waterlevel == 1) delta *= 0.5; if (delta < 1) return; if (delta < 15) { if ((ent->client->pers.inventory[ITEM_INDEX(FindItem("Stealth Boots"))] < 1)) { if((ent->myskills.abilities[CLOAK].disable) || (ent->myskills.abilities[CLOAK].current_level < 1)) { // morphed players don't make footsteps if (!ent->mtype) ent->s.event = EV_FOOTSTEP; PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko // if the player is not crouched, then alert monsters of footsteps if (!(ent->client->ps.pmove.pm_flags & PMF_DUCKED)) ent->lastsound = level.framenum; } } return; } ent->client->fall_value = delta*0.5; if (ent->client->fall_value > 40) ent->client->fall_value = 40; ent->client->fall_time = level.time + FALL_TIME; if (delta > 30) { if (ent->health > 0) { if (delta >= 55) ent->s.event = EV_FALLFAR; else ent->s.event = EV_FALL; PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko } ent->pain_debounce_time = level.time; // no normal pain sound damage = (delta-30)/2; if (damage < 1) damage = 1; VectorSet (dir, 0, 0, 1); if (!deathmatch->value || !((int)dmflags->value & DF_NO_FALLING) ) T_Damage (ent, world, world, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING); } else { ent->s.event = EV_FALLSHORT; PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko//.........这里部分代码省略.........
开发者ID:Ciclop,项目名称:quake-2-vortex,代码行数:101,
示例22: FindItemint CPlayerPlaylistBar::GetSelIdx() const{ return FindItem(m_pl.GetPos());}
开发者ID:Azpidatziak,项目名称:mpc-hc,代码行数:4,
示例23: IgnoreDialogProcstatic INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){ HANDLE hContact = (HANDLE)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: { DWORD dwMask; struct ClcContact *contact = NULL; int pCaps; HWND hwndAdd; hContact = (HANDLE)lParam; SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)hContact); dwMask = cfg::getDword(hContact, "Ignore", "Mask1", 0); SendMessage(hWnd, WM_USER + 100, (WPARAM)hContact, dwMask); SendMessage(hWnd, WM_USER + 120, 0, 0); TranslateDialogDefault(hWnd); hwndAdd = GetDlgItem(hWnd, IDC_IGN_ADDPERMANENTLY); // CreateWindowEx(0, _T("CLCButtonClass"), _T("FOO"), WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL); SendMessage(hwndAdd, BUTTONSETASFLATBTN, 0, 1); SendMessage(hwndAdd, BUTTONSETASFLATBTN + 10, 0, 1); SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(210), IMAGE_ICON, 16, 16, LR_SHARED)); SetWindowText(hwndAdd, TranslateT("Add permanently")); EnableWindow(hwndAdd, cfg::getByte(hContact, "CList", "NotOnList", 0)); hwndAdd = GetDlgItem(hWnd, IDC_DSP_LOADDEFAULT); // CreateWindowEx(0, _T("CLCButtonClass"), _T("FOO"), WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL); SendMessage(hwndAdd, BUTTONSETASFLATBTN, 0, 1); SendMessage(hwndAdd, BUTTONSETASFLATBTN + 10, 0, 1); SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DELETE), IMAGE_ICON, 16, 16, LR_SHARED)); SetWindowText(hwndAdd, TranslateT("Revert to default")); EnableWindow(hwndAdd, TRUE); SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Default (global setting)")); SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always when available")); SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Hide always")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Default (global setting)")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When space is available")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message")); if(cfg::clcdat) { FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); if(contact && contact->type != CLCIT_CONTACT) { DestroyWindow(hWnd); return FALSE; } else { TCHAR szTitle[512]; DWORD dwFlags = cfg::getDword(hContact, "CList", "CLN_Flags", 0); BYTE bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", -1); DWORD dwXMask = cfg::getDword(hContact, "CList", "CLN_xmask", 0); int i = 0; mir_sntprintf(szTitle, 512, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); SetWindowText(hWnd, szTitle); SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)); pCaps = CallProtoService(contact ? contact->proto : (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0), PS_GETCAPS, PFLAGNUM_1, 0); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSONLINE, pCaps & PF1_INVISLIST ? TRUE : FALSE); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSOFFLINE, pCaps & PF1_VISLIST ? TRUE : FALSE); CheckDlgButton(hWnd, IDC_IGN_PRIORITY, cfg::getByte(hContact, "CList", "Priority", 0) ? 1 : 0); Utils::enableDlgControl(hWnd, IDC_IGN_PRIORITY, TRUE); Utils::enableDlgControl(hWnd, IDC_AVATARDISPMODE, TRUE); Utils::enableDlgControl(hWnd, IDC_SECONDLINEMODE, TRUE); if(dwFlags & ECF_FORCEAVATAR) SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 1, 0); else if(dwFlags & ECF_HIDEAVATAR) SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 2, 0); else SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 0, 0); if(dwFlags & ECF_FORCEOVERLAY) SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_CHECKED, 0); else if(dwFlags & ECF_HIDEOVERLAY) SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_INDETERMINATE, 0); if(dwFlags & ECF_FORCELOCALTIME) SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_CHECKED, 0); else if(dwFlags & ECF_HIDELOCALTIME) SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_INDETERMINATE, 0); if(dwFlags & ECF_FORCEVISIBILITY) SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_CHECKED, 0); else if(dwFlags & ECF_HIDEVISIBILITY) SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_INDETERMINATE, 0); while(xImgCtrlIds[i] != 0) { if(dwXMask & (1 << (2 * xImgCtrlBits[i]))) SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_SETCHECK, BST_CHECKED, 0); else if(dwXMask & (1 << (2 * xImgCtrlBits[i] + 1))) SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_SETCHECK, BST_UNCHECKED, 0);//.........这里部分代码省略.........
开发者ID:raoergsls,项目名称:miranda,代码行数:101,
示例24: SP_worldspawn/*QUAKED worldspawn (0 0 0) ?Only used for the world."sky" environment map name"skyaxis" vector axis for rotating sky"skyrotate" speed of rotation in degrees/second"sounds" music cd track number"gravity" 800 is default gravity"message" text to print at user logon*/void SP_worldspawn (edict_t *ent){ ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; ent->inuse = true; // since the world doesn't use G_Spawn() ent->s.modelindex = 1; // world model is always index 1 //--------------- // reserve some spots for dead player bodies for coop / deathmatch InitBodyQue (); // set configstrings for items SetItemNames (); if (st.nextmap) strcpy (level.nextmap, st.nextmap); // make some data visible to the server if (ent->message && ent->message[0]) { gi.configstring (CS_NAME, ent->message); strncpy (level.level_name, ent->message, sizeof(level.level_name)); } else strncpy (level.level_name, level.mapname, sizeof(level.level_name)); if (st.sky && st.sky[0]) gi.configstring (CS_SKY, st.sky); else gi.configstring (CS_SKY, "unit1_"); gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) ); gi.configstring (CS_SKYAXIS, va("%f %f %f", st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) ); gi.configstring (CS_CDTRACK, va("%i", ent->sounds) ); gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) ); Chicken_GameInit(); // Chicken // status bar program if (deathmatch->value) gi.configstring (CS_STATUSBAR, ctc_statusbar); // Chicken else gi.configstring (CS_STATUSBAR, single_statusbar); //--------------- // help icon for statusbar gi.imageindex ("i_help"); level.pic_health = gi.imageindex ("i_health"); gi.imageindex ("help"); gi.imageindex ("field_3"); 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//.........这里部分代码省略.........
开发者ID:protomouse,项目名称:q2-ctc,代码行数:101,
示例25: Cmd_Give_f//.........这里部分代码省略......... ent->client->ps.inventory[INV_ELECTROBINOCULARS] = 1; ent->client->ps.inventory[INV_BACTA_CANISTER] = 5; ent->client->ps.inventory[INV_SEEKER] = 5; ent->client->ps.inventory[INV_LIGHTAMP_GOGGLES] = 1; ent->client->ps.inventory[INV_SENTRY] = 5; ent->client->ps.inventory[INV_GOODIE_KEY] = 5; ent->client->ps.inventory[INV_SECURITY_KEY] = 5; if (!give_all) { return; } } if (give_all || Q_stricmp(name, "weapons") == 0) { ent->client->ps.stats[STAT_WEAPONS] = (1 << (MAX_PLAYER_WEAPONS+1)) - ( 1 << WP_NONE );// ent->client->ps.stats[STAT_WEAPONS] |= (1 << (WP_MELEE)); if (!give_all) return; } if ( !give_all && Q_stricmp(gi.argv(1), "weaponnum") == 0 ) { ent->client->ps.stats[STAT_WEAPONS] |= (1 << atoi(gi.argv(2))); return; } if ( Q_stricmp(name, "eweaps") == 0) //for developing, gives you all the weapons, including enemy { ent->client->ps.stats[STAT_WEAPONS] = (unsigned)(1 << WP_NUM_WEAPONS) - ( 1 << WP_NONE ); // NOTE: this wasn't giving the last weapon in the list if (!give_all) return; } if (give_all || Q_stricmp(name, "ammo") == 0) { for ( i = 0 ; i < AMMO_MAX ; i++ ) { ent->client->ps.ammo[i] = ammoData[i].max; } if (!give_all) return; } if (give_all || Q_stricmp(gi.argv(1), "batteries") == 0) { if (gi.argc() == 3) ent->client->ps.batteryCharge = atoi(gi.argv(2)); else ent->client->ps.batteryCharge = MAX_BATTERIES; if (!give_all) return; } if (give_all || Q_stricmp(gi.argv(1), "armor") == 0) { if (gi.argc() == 3) ent->client->ps.stats[STAT_ARMOR] = atoi(gi.argv(2)); else ent->client->ps.stats[STAT_ARMOR] = ent->client->ps.stats[STAT_MAX_HEALTH]; if ( ent->client->ps.stats[STAT_ARMOR] > 0 ) { ent->client->ps.powerups[PW_BATTLESUIT] = Q3_INFINITE; } else { ent->client->ps.powerups[PW_BATTLESUIT] = 0; } if (!give_all) return; } // spawn a specific item right on the player if ( !give_all ) { it = FindItem (name); if (!it) { name = gi.argv(1); it = FindItem (name); if (!it) { gi.SendServerCommand( ent-g_entities, "print /"unknown item/n/""); return; } } it_ent = G_Spawn(); VectorCopy( ent->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:PJayB,项目名称:jk2src,代码行数:101,
示例26: indirect/* ============ T_Damage targ entity that is being damaged inflictor entity that is causing the damage attacker entity that caused the inflictor to damage targ example: targ=monster, inflictor=rocket, attacker=player dir direction of the attack point point at which the damage is being inflicted normal normal vector from that point damage amount of damage being inflicted knockback force to be applied against targ as a result of the damage dflags these flags are used to control how T_Damage works DAMAGE_RADIUS damage was indirect (from a nearby explosion) DAMAGE_NO_ARMOR armor does not protect from this damage DAMAGE_ENERGY damage is from an energy based weapon DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles DAMAGE_BULLET damage is from a bullet (used for ricochets) DAMAGE_NO_PROTECTION kills godmode, armor, everything ============*/static intCheckPowerArmor (edict_t * ent, vec3_t point, vec3_t normal, int damage, int dflags){ gclient_t *client; int save; int power_armor_type; // AQ:TNG - JBravo fixing compilerwarnings. // Bah. JB will crash da servah if dis is wrong. int index = 0; // JBravo. int damagePerCell; int pa_te_type; int power = 0; int power_used; if (!damage) return 0; client = ent->client; if (dflags & DAMAGE_NO_ARMOR) return 0; if (client) { power_armor_type = PowerArmorType (ent); if (power_armor_type != POWER_ARMOR_NONE) { index = ITEM_INDEX (FindItem ("Cells")); power = client->pers.inventory[index]; } } else if (ent->svflags & SVF_MONSTER) { power_armor_type = ent->monsterinfo.power_armor_type; power = ent->monsterinfo.power_armor_power; } else return 0; if (power_armor_type == POWER_ARMOR_NONE) return 0; if (!power) return 0; if (power_armor_type == POWER_ARMOR_SCREEN) { vec3_t vec; float dot; vec3_t forward; // only works if damage point is in front AngleVectors (ent->s.angles, forward, NULL, NULL); VectorSubtract (point, ent->s.origin, vec); VectorNormalize (vec); dot = DotProduct (vec, forward); if (dot <= 0.3) return 0; damagePerCell = 1; pa_te_type = TE_SCREEN_SPARKS; damage = damage / 3; } else { damagePerCell = 2; pa_te_type = TE_SHIELD_SPARKS; damage = (2 * damage) / 3; } save = power * damagePerCell; if (!save) return 0; if (save > damage) save = damage;//.........这里部分代码省略.........
开发者ID:andrijan,项目名称:ajaq,代码行数:101,
示例27: Cmd_Give_f/*==================Cmd_Give_fGive 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; int numargs; char tryname[256]; 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(); numargs = gi.argc(); 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, "Visor") == 0) { it = FindItem("Visor"); 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);//.........这里部分代码省略.........
开发者ID:alexey-lysiuk,项目名称:quake2,代码行数:101,
示例28: CheckPowerArmor/* * targ entity that is being damaged * inflictor entity that is causing the damage * attacker entity that caused the inflictor to damage targ * example: targ=monster, inflictor=rocket, attacker=player * * dir direction of the attack * point point at which the damage is being inflicted * normal normal vector from that point * damage amount of damage being inflicted * knockback force to be applied against targ as a result of the damage * * dflags these flags are used to control how T_Damage works * DAMAGE_RADIUS damage was indirect (from a nearby explosion) * DAMAGE_NO_ARMOR armor does not protect from this damage * DAMAGE_ENERGY damage is from an energy based weapon * DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles * DAMAGE_BULLET damage is from a bullet (used for ricochets) * DAMAGE_NO_PROTECTION kills godmode, armor, everything * ============ */intCheckPowerArmor(edict_t *ent, vec3_t point, vec3_t normal, int damage, int dflags){ gclient_t *client; int save; int power_armor_type; int index = 0; int damagePerCell; int pa_te_type; int power = 0; int power_used; if (!ent) { return 0; } if (!damage) { return 0; } index = 0; client = ent->client; if (dflags & DAMAGE_NO_ARMOR) { return 0; } if (client) { power_armor_type = PowerArmorType(ent); if (power_armor_type != POWER_ARMOR_NONE) { index = ITEM_INDEX(FindItem("Cells")); power = client->pers.inventory[index]; } } else if (ent->svflags & SVF_MONSTER) { power_armor_type = ent->monsterinfo.power_armor_type; power = ent->monsterinfo.power_armor_power; index = 0; } else { return 0; } if (power_armor_type == POWER_ARMOR_NONE) { return 0; } if (!power) { return 0; } if (power_armor_type == POWER_ARMOR_SCREEN) { vec3_t vec; float dot; vec3_t forward; /* only works if damage point is in front */ AngleVectors(ent->s.angles, forward, NULL, NULL); VectorSubtract(point, ent->s.origin, vec); VectorNormalize(vec); dot = DotProduct(vec, forward); if (dot <= 0.3) { return 0; }//.........这里部分代码省略.........
开发者ID:phine4s,项目名称:xatrix,代码行数:101,
注:本文中的FindItem函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FindKey函数代码示例 C++ FindIndex函数代码示例 |