这篇教程C++ AInventory类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AInventory类的典型用法代码示例。如果您正苦于以下问题:C++ AInventory类的具体用法?C++ AInventory怎么用?C++ AInventory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AInventory类的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Usebool ATeleporterBeacon::Use (bool pickup){ AInventory *drop; // [BC] This is handled server-side. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return ( true ); } // Increase the amount by one so that when DropInventory decrements it, // the actor will have the same number of beacons that he started with. // When we return to UseInventory, it will take care of decrementing // Amount again and disposing of this item if there are no more. Amount++; drop = Owner->DropInventory (this); if (drop == NULL) { Amount--; return false; } else { drop->SetState(drop->FindState(NAME_Drop)); drop->target = Owner; return true; }}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:29,
示例2: FixedMulAInventory *AAmmo::CreateCopy (AActor *other){ AInventory *copy; int amount = Amount; // extra ammo in baby mode and nightmare mode if (!(ItemFlags&IF_IGNORESKILL)) { amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor)); } if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo) && GetClass() != RUNTIME_CLASS(AAmmo)) { const PClass *type = GetParentAmmo(); assert (type->ActorInfo != NULL); if (!GoAway ()) { Destroy (); } copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE)); copy->Amount = amount; copy->BecomeItem (); } else { copy = Super::CreateCopy (other); copy->Amount = amount; } if (copy->Amount > copy->MaxAmount) { // Don't pick up more ammo than you're supposed to be able to carry. copy->Amount = copy->MaxAmount; } return copy;}
开发者ID:BadSanta1980,项目名称:gzdoom,代码行数:35,
示例3: G_StartTravelvoid G_StartTravel (){ if (deathmatch) return; for (int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i]) { AActor *pawn = players[i].mo; AInventory *inv; players[i].camera = NULL; // Only living players travel. Dead ones get a new body on the new level. if (players[i].health > 0) { pawn->UnlinkFromWorld (); P_DelSector_List (); int tid = pawn->tid; // Save TID pawn->RemoveFromHash (); pawn->tid = tid; // Restore TID (but no longer linked into the hash chain) pawn->ChangeStatNum (STAT_TRAVELLING); for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) { inv->ChangeStatNum (STAT_TRAVELLING); inv->UnlinkFromWorld (); P_DelSector_List (); } } } }}
开发者ID:Quaker540,项目名称:gzdoom,代码行数:33,
示例4: DrawWeaponsstatic void DrawWeapons(player_t *CPlayer, int x, int y){ int k,j; AInventory *inv; // First draw all weapons in the inventory that are not assigned to a weapon slot for(inv = CPlayer->mo->Inventory; inv; inv = inv->Inventory) { if (inv->IsKindOf(RUNTIME_CLASS(AWeapon)) && !CPlayer->weapons.LocateWeapon(static_cast<AWeapon*>(inv)->GetClass(), NULL, NULL)) { DrawOneWeapon(CPlayer, x, y, static_cast<AWeapon*>(inv)); } } // And now everything in the weapon slots back to front for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.Slots[k].Size() - 1; j >= 0; j--) { PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j); if (weap) { inv=CPlayer->mo->FindInventory(weap); if (inv) { DrawOneWeapon(CPlayer, x, y, static_cast<AWeapon*>(inv)); } } }}
开发者ID:Edward850,项目名称:zdoom,代码行数:29,
示例5: C_PrintInvvoid C_PrintInv(AActor *target){ AInventory *item; int count = 0; if (target == NULL) { Printf("No target found!/n"); return; } if (target->player) Printf("Inventory for Player '%s':/n", target->player->userinfo.GetName()); else Printf("Inventory for Target '%s':/n", target->GetClass()->TypeName.GetChars()); for (item = target->Inventory; item != NULL; item = item->Inventory) { Printf (" %s #%u (%d/%d)/n", item->GetClass()->TypeName.GetChars(), item->InventoryID, item->Amount, item->MaxAmount); count++; } Printf (" List count: %d/n", count);}
开发者ID:ArcticPheenix,项目名称:gzdoom,代码行数:25,
示例6: TakeStrifeItemstatic void TakeStrifeItem (const TypeInfo *itemtype, int amount){ if (itemtype == NULL || amount == 0) return; // Don't take quest items. if (itemtype->IsDescendantOf (RUNTIME_CLASS(AQuestItem))) return; // Don't take keys if (itemtype->IsDescendantOf (RUNTIME_CLASS(AKey))) return; // Don't take the sigil if (itemtype == RUNTIME_CLASS(ASigil)) return; AInventory *item = ConversationPC->FindInventory (itemtype); if (item != NULL) { item->Amount -= amount; if (item->Amount <= 0) { item->Destroy (); } }}
开发者ID:doomtech,项目名称:zdoom-old,代码行数:27,
示例7: DEFINE_ACTION_FUNCTIONDEFINE_ACTION_FUNCTION(AActor, A_Summon){ AMinotaurFriend *mo; mo = Spawn<AMinotaurFriend> (self->Pos(), ALLOW_REPLACE); if (mo) { if (P_TestMobjLocation(mo) == false || !self->tracer) { // Didn't fit - change back to artifact mo->Destroy (); AActor *arti = Spawn<AArtiDarkServant> (self->Pos(), ALLOW_REPLACE); if (arti) arti->flags |= MF_DROPPED; return; } mo->StartTime = level.maptime; if (self->tracer->flags & MF_CORPSE) { // Master dead mo->tracer = NULL; // No master } else { mo->tracer = self->tracer; // Pointer to master AInventory *power = Spawn<APowerMinotaur> (0, 0, 0, NO_REPLACE); power->CallTryPickup (self->tracer); mo->SetFriendPlayer(self->tracer->player); } // Make smoke puff Spawn ("MinotaurSmoke", self->Pos(), ALLOW_REPLACE); S_Sound (self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM); }}
开发者ID:BenJamesbabala,项目名称:ViZDoom,代码行数:33,
示例8: DEFINE_ACTION_FUNCTION_PARAMSDEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem){ ACTION_PARAM_START(1); ACTION_PARAM_INT(questitem, 0); // Give one of these quest items to every player in the game for (int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i]) { AInventory *item = static_cast<AInventory *>(Spawn (QuestItemClasses[questitem-1], 0,0,0, NO_REPLACE)); if (!item->CallTryPickup (players[i].mo)) { item->Destroy (); } } } char messageid[64]; mysnprintf(messageid, countof(messageid), "TXT_QUEST_%d", questitem); const char * name = GStrings[messageid]; if (name != NULL) { C_MidPrint (SmallFont, name); }}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:28,
示例9: check bool check(AActor *owner) { if (owner->IsKindOf(RUNTIME_CLASS(AKey))) { // P_GetMapColorForKey() checks the key directly return owner->IsA(key) || owner->GetSpecies() == key->TypeName; } else { // Other calls check an actor that may have a key in its inventory. AInventory *item; for (item = owner->Inventory; item != NULL; item = item->Inventory) { if (item->IsA(key)) { return true; } else if (item->GetSpecies() == key->TypeName) { return true; } } return false; } }
开发者ID:Accusedbold,项目名称:zdoom,代码行数:26,
示例10: TakeStrifeItemstatic void TakeStrifeItem (player_t *player, const PClass *itemtype, int amount){ if (itemtype == NULL || amount == 0) return; // Don't take quest items. if (itemtype->IsDescendantOf (PClass::FindClass(NAME_QuestItem))) return; // Don't take keys. if (itemtype->IsDescendantOf (RUNTIME_CLASS(AKey))) return; // Don't take the sigil. if (itemtype == RUNTIME_CLASS(ASigil)) return; AInventory *item = player->mo->FindInventory (itemtype); if (item != NULL) { item->Amount -= amount; if (item->Amount <= 0) { item->Destroy (); } }}
开发者ID:Jadeon,项目名称:gzdoom,代码行数:27,
示例11: P_PlayerOnSpecialFlatvoid P_PlayerOnSpecialFlat (player_t *player, int floorType){ if (Terrains[floorType].DamageAmount && !(level.time & Terrains[floorType].DamageTimeMask)) { AInventory *ironfeet = NULL; if (Terrains[floorType].AllowProtection) { for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) { if (ironfeet->IsKindOf (RUNTIME_CLASS(APowerIronFeet))) break; } } int damage = 0; if (ironfeet == NULL) { damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, Terrains[floorType].DamageMOD); } if (damage > 0 && Terrains[floorType].Splash != -1) { S_Sound (player->mo, CHAN_AUTO, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, ATTN_IDLE); } }}
开发者ID:Blue-Shadow,项目名称:zdoom,代码行数:30,
示例12: GetParentAmmoAInventory *AAmmo::CreateCopy (AActor *other){ AInventory *copy; if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo)) { const TypeInfo *type = GetParentAmmo(); if (!GoAway ()) { Destroy (); } copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0)); copy->Amount = Amount; copy->BecomeItem (); } else { copy = Super::CreateCopy (other); } if (copy->Amount > copy->MaxAmount) { // Don't pick up more ammo than you're supposed to be able to carry. copy->Amount = copy->MaxAmount; } return copy;}
开发者ID:doomtech,项目名称:zdoom-old,代码行数:25,
示例13: HandlePickupbool ABackpackItem::HandlePickup (AInventory *item){ // Since you already have a backpack, that means you already have every // kind of ammo in your inventory, so we don't need to look at the // entire PClass list to discover what kinds of ammo exist, and we don't // have to alter the MaxAmount either. if (item->IsKindOf (RUNTIME_CLASS(ABackpackItem))) { for (AInventory *probe = Owner->Inventory; probe != NULL; probe = probe->Inventory) { if (probe->GetClass()->ParentClass == RUNTIME_CLASS(AAmmo)) { if (probe->Amount < probe->MaxAmount || sv_unlimited_pickup) { int amount = static_cast<AAmmo*>(probe->GetDefault())->BackpackAmount; // extra ammo in baby mode and nightmare mode if (!(item->ItemFlags&IF_IGNORESKILL)) { amount = int(amount * G_SkillProperty(SKILLP_AmmoFactor)); } probe->Amount += amount; if (probe->Amount > probe->MaxAmount && !sv_unlimited_pickup) { probe->Amount = probe->MaxAmount; } } } } // The pickup always succeeds, even if you didn't get anything item->ItemFlags |= IF_PICKUPGOOD; return true; } return false;}
开发者ID:dwing4g,项目名称:gzdoom,代码行数:34,
示例14: whilevoid AMinotaurFriend::Die (AActor *source, AActor *inflictor, int dmgflags){ Super::Die (source, inflictor, dmgflags); if (tracer && tracer->health > 0 && tracer->player) { // Search thinker list for minotaur TThinkerIterator<AMinotaurFriend> iterator; AMinotaurFriend *mo; while ((mo = iterator.Next()) != NULL) { if (mo->health <= 0) continue; // [RH] Minotaurs can't be morphed, so this isn't needed //if (!(mo->flags&MF_COUNTKILL)) continue; // for morphed minotaurs if (mo->flags&MF_CORPSE) continue; if (mo->StartTime >= 0 && (level.maptime - StartTime) >= MAULATORTICS) continue; if (mo->tracer != NULL && mo->tracer->player == tracer->player) break; } if (mo == NULL) { AInventory *power = tracer->FindInventory(PClass::FindActor("PowerMinotaur")); if (power != NULL) { power->Destroy (); } } }}
开发者ID:nano-bot,项目名称:zdoom,代码行数:30,
示例15: GiveSpawnervoid GiveSpawner (player_t *player, const PClass *type, int amount){ if (player->mo == NULL || player->health <= 0) { return; } AInventory *item = static_cast<AInventory *> (Spawn (type, player->mo->x, player->mo->y, player->mo->z, NO_REPLACE)); if (item != NULL) { if (amount > 0) { if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorPickup))) { if (static_cast<ABasicArmorPickup*>(item)->SaveAmount != 0) { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } else { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } } else if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus))) { static_cast<ABasicArmorBonus*>(item)->SaveAmount *= amount; // [BB] static_cast<ABasicArmorBonus*>(item)->BonusCount *= amount; } else { item->Amount = MIN (amount, item->MaxAmount); } } if(item->flags & MF_COUNTITEM) // Given items shouldn't count against the map's total, { // since they aren't added to the player's total. level.total_items--; item->flags &= ~MF_COUNTITEM; } if (!item->CallTryPickup (player->mo)) { item->Destroy (); } else { // [BB] This construction is more or less a hack, but at least the give cheats are now working. SERVER_GiveInventoryToPlayer( player, item ); // [BC] Play the announcer sound. if ( players[consoleplayer].camera == players[consoleplayer].mo && cl_announcepickups ) ANNOUNCER_PlayEntry( cl_announcer, item->PickupAnnouncerEntry( )); } }}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:55,
示例16: CreateCopyAInventory *ACoin::CreateCopy (AActor *other){ if (GetClass() == RUNTIME_CLASS(ACoin)) { return Super::CreateCopy (other); } AInventory *copy = Spawn<ACoin> (0,0,0, NO_REPLACE); copy->Amount = Amount; copy->BecomeItem (); GoAwayAndDie (); return copy;}
开发者ID:BenJamesbabala,项目名称:ViZDoom,代码行数:12,
示例17: DrawInventorystatic void DrawInventory(player_t * CPlayer, int x,int y){ AInventory * rover; int numitems = (hudwidth - 2*x) / 32; int i; CPlayer->mo->InvFirst = rover = StatusBar->ValidateInvFirst(numitems); if (rover!=NULL) { if(rover->PrevInv()) { screen->DrawTexture(invgems[!!(level.time&4)], x-10, y, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE); } for(i=0;i<numitems && rover;rover=rover->NextInv()) { if (rover->Amount>0) { FTextureID AltIcon = GetHUDIcon(rover->GetClass()); if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) ) { int trans = rover==CPlayer->mo->InvSel ? FRACUNIT : 0x6666; DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans); if (rover->Amount>1) { char buffer[10]; int xx; mysnprintf(buffer, countof(buffer), "%d", rover->Amount); if (rover->Amount>=1000) xx = 32 - IndexFont->StringWidth(buffer); else xx = 22; screen->DrawText(IndexFont, CR_GOLD, x+xx, y+20, buffer, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, TAG_DONE); } x+=32; i++; } } } if(rover) { screen->DrawTexture(invgems[2 + !!(level.time&4)], x-10, y, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE); } }}
开发者ID:Edward850,项目名称:zdoom,代码行数:53,
示例18: V_AddPlayerBlendvoid V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int maxpainblend){ int cnt; // [RH] All powerups can affect the screen blending now for (AInventory *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) { PalEntry color = item->GetBlend (); if (color.a != 0) { V_AddBlend (color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f, blend); if (color.a/255.f > maxinvalpha) maxinvalpha = color.a/255.f; } } if (CPlayer->bonuscount) { cnt = CPlayer->bonuscount << 3; V_AddBlend (RPART(gameinfo.pickupcolor)/255.f, GPART(gameinfo.pickupcolor)/255.f, BPART(gameinfo.pickupcolor)/255.f, cnt > 128 ? 0.5f : cnt / 255.f, blend); } PalEntry painFlash = CPlayer->mo->DamageFade; CPlayer->mo->GetClass()->GetPainFlash(CPlayer->mo->DamageTypeReceived, &painFlash); if (painFlash.a != 0) { cnt = DamageToAlpha[MIN (113, CPlayer->damagecount * painFlash.a / 255)]; if (cnt) { if (cnt > maxpainblend) cnt = maxpainblend; V_AddBlend (painFlash.r / 255.f, painFlash.g / 255.f, painFlash.b / 255.f, cnt / 255.f, blend); } } // Unlike Doom, I did not have any utility source to look at to find the // exact numbers to use here, so I've had to guess by looking at how they // affect the white color in Hexen's palette and picking an alpha value // that seems reasonable. // [Gez] The exact values could be obtained by looking how they affect // each color channel in Hexen's palette. if (CPlayer->poisoncount) { cnt = MIN (CPlayer->poisoncount, 64); if (paletteflash & PF_POISON) { V_AddBlend(44/255.f, 92/255.f, 36/255.f, ((cnt + 7) >> 3) * 0.1f, blend); }
开发者ID:Edward850,项目名称:zdoom,代码行数:52,
示例19: TryPickupbool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return){ TObjPtr<AInventory> Invstack = Inventory; // A pointer of the inventories item stack. // unmorphed versions of a currently morphed actor cannot pick up anything. if (toucher->flags & MF_UNMORPHED) return false; bool res; if (CanPickup(toucher)) res = TryPickup(toucher); else if (!(ItemFlags & IF_RESTRICTABSOLUTELY)) res = TryPickupRestricted(toucher); // let an item decide for itself how it will handle this else return false; // Morph items can change the toucher so we need an option to return this info. if (toucher_return != NULL) *toucher_return = toucher; if (!res && (ItemFlags & IF_ALWAYSPICKUP) && !ShouldStay()) { res = true; GoAwayAndDie(); } if (res) { GiveQuest(toucher); // Transfer all inventory accross that the old object had, if requested. if ((ItemFlags & IF_TRANSFER)) { while (Invstack) { AInventory* titem = Invstack; Invstack = titem->Inventory; if (titem->Owner == this) { if (!titem->CallTryPickup(toucher)) // The object no longer can exist { titem->Destroy(); } } } } } return res;}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:47,
示例20: TryPickupbool AHealthTraining::TryPickup (AActor *&toucher){ if (Super::TryPickup (toucher)) { toucher->GiveInventoryType (PClass::FindActor("GunTraining")); AInventory *coin = Spawn<ACoin> (); if (coin != NULL) { coin->Amount = toucher->player->mo->accuracy*5 + 300; if (!coin->CallTryPickup (toucher)) { coin->Destroy (); } } return true; } return false;}
开发者ID:kevans91,项目名称:zdoom,代码行数:18,
示例21: DetachFromOwnervoid ABackpackItem::DetachFromOwner (){ // When removing a backpack, drop the player's ammo maximums to normal AInventory *item; for (item = Owner->Inventory; item != NULL; item = item->Inventory) { if (item->GetClass()->ParentClass == RUNTIME_CLASS(AAmmo) && item->MaxAmount == static_cast<AAmmo*>(item)->BackpackMaxAmount) { item->MaxAmount = static_cast<AInventory*>(item->GetDefault())->MaxAmount; if (item->Amount > item->MaxAmount) { item->Amount = item->MaxAmount; } } }}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:18,
示例22: P_AutoUseStrifeHealthvoid P_AutoUseStrifeHealth (player_t *player){ TArray<AInventory *> Items; for(AInventory *inv = player->mo->Inventory; inv != NULL; inv = inv->Inventory) { if (inv->Amount > 0 && inv->IsKindOf(RUNTIME_CLASS(AHealthPickup))) { int mode = static_cast<AHealthPickup*>(inv)->autousemode; if (mode == 3) Items.Push(inv); } } if (!sv_disableautohealth) { while (Items.Size() > 0) { int maxhealth = 0; int index = -1; // Find the largest item in the list for(unsigned i = 0; i < Items.Size(); i++) { if (Items[i]->health > maxhealth) { index = i; maxhealth = Items[i]->Amount; } } while (player->health < 50) { if (!player->mo->UseInventory (Items[index])) break; } if (player->health >= 50) return; // Using all of this item was not enough so delete it and restart with the next best one Items.Delete(index); } }}
开发者ID:eevee,项目名称:zdoom,代码行数:42,
示例23: GiveSpawnervoid GiveSpawner (player_t *player, PClassInventory *type, int amount){ if (player->mo == NULL || player->health <= 0) { return; } AInventory *item = static_cast<AInventory *> (Spawn (type, player->mo->Pos(), NO_REPLACE)); if (item != NULL) { if (amount > 0) { if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorPickup))) { if (static_cast<ABasicArmorPickup*>(item)->SaveAmount != 0) { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } else { static_cast<ABasicArmorPickup*>(item)->SaveAmount *= amount; } } else if (type->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus))) { static_cast<ABasicArmorBonus*>(item)->SaveAmount *= amount; } else { item->Amount = MIN (amount, item->MaxAmount); } } item->ClearCounters(); if (!item->CallTryPickup (player->mo)) { item->Destroy (); } }}
开发者ID:silky,项目名称:zdoom,代码行数:40,
示例24: Usebool ATeleporterBeacon::Use (bool pickup){ AInventory *drop; // Increase the amount by one so that when DropInventory decrements it, // the actor will have the same number of beacons that he started with. // When we return to UseInventory, it will take care of decrementing // Amount again and disposing of this item if there are no more. Amount++; drop = Owner->DropInventory (this); if (drop == NULL) { Amount--; return false; } else { drop->SetState(drop->FindState(NAME_Drop)); drop->target = Owner; return true; }}
开发者ID:FlameNeon,项目名称:gzdoom,代码行数:22,
示例25: ShowPop void ShowPop (int popnum) { DBaseStatusBar::ShowPop(popnum); if (popnum == CurrentPop) { if (popnum == POP_Keys) { AInventory *item; int i; KeyPopPos += 10; KeyPopScroll = 280; for (item = CPlayer->mo->Inventory, i = 0; item != NULL; item = item->Inventory) { if (item->IsKindOf (RUNTIME_CLASS(AKey))) { if (i == KeyPopPos) { return; } i++; } } } PendingPop = POP_None; // Do not scroll keys horizontally when dropping the popscreen KeyPopScroll = 0; KeyPopPos -= 10; } else { KeyPopPos = 0; PendingPop = popnum; } }
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:38,
示例26: ifvoid FGLRenderer::SetFixedColormap (player_t *player){ gl_fixedcolormap=CM_DEFAULT; // check for special colormaps player_t * cplayer = player->camera->player; if (cplayer) { if (cplayer->extralight == INT_MIN) { gl_fixedcolormap=CM_FIRSTSPECIALCOLORMAP + INVERSECOLORMAP; extralight=0; } else if (cplayer->fixedcolormap != NOFIXEDCOLORMAP) { gl_fixedcolormap = CM_FIRSTSPECIALCOLORMAP + cplayer->fixedcolormap; } else if (cplayer->fixedlightlevel != -1) { for(AInventory * in = cplayer->mo->Inventory; in; in = in->Inventory) { PalEntry color = in->GetBlend (); // Need special handling for light amplifiers if (in->IsKindOf(RUNTIME_CLASS(APowerTorch))) { gl_fixedcolormap = cplayer->fixedlightlevel + CM_TORCH; } else if (in->IsKindOf(RUNTIME_CLASS(APowerLightAmp))) { gl_fixedcolormap = CM_LITE; } } } } gl_RenderState.SetFixedColormap(gl_fixedcolormap);}
开发者ID:nashmuhandes,项目名称:GZDoom-GPL,代码行数:37,
示例27: P_AutoUseHealthvoid P_AutoUseHealth(player_t *player, int saveHealth){ TArray<AInventory *> NormalHealthItems; TArray<AInventory *> LargeHealthItems; for(AInventory *inv = player->mo->Inventory; inv != NULL; inv = inv->Inventory) { if (inv->Amount > 0 && inv->IsKindOf(RUNTIME_CLASS(AHealthPickup))) { int mode = static_cast<AHealthPickup*>(inv)->autousemode; if (mode == 1) NormalHealthItems.Push(inv); else if (mode == 2) LargeHealthItems.Push(inv); } } int normalhealth = CountHealth(NormalHealthItems); int largehealth = CountHealth(LargeHealthItems); bool skilluse = !!G_SkillProperty(SKILLP_AutoUseHealth); if (skilluse && normalhealth >= saveHealth) { // Use quartz flasks player->health += UseHealthItems(NormalHealthItems, saveHealth); } else if (largehealth >= saveHealth) { // Use mystic urns player->health += UseHealthItems(LargeHealthItems, saveHealth); } else if (skilluse && normalhealth + largehealth >= saveHealth) { // Use mystic urns and quartz flasks player->health += UseHealthItems(NormalHealthItems, saveHealth); if (saveHealth > 0) player->health += UseHealthItems(LargeHealthItems, saveHealth); } player->mo->health = player->health;}
开发者ID:eevee,项目名称:zdoom,代码行数:37,
示例28: P_PlayerInSpecialSector//// P_PlayerInSpecialSector// Called every tic frame// that the player origin is in a special sector//void P_PlayerInSpecialSector (player_t *player, sector_t * sector){ if (sector == NULL) { // Falling, not all the way down yet? sector = player->mo->Sector; if (!player->mo->isAtZ(sector->LowestFloorAt(player->mo)) && !player->mo->waterlevel) { return; } } // Has hit ground. AInventory *ironfeet; // [RH] Apply any customizable damage if (sector->damageamount > 0) { // Allow subclasses. Better would be to implement it as armor and let that reduce // the damage as part of the normal damage procedure. Unfortunately, I don't have // different damage types yet, so that's not happening for now. for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) { if (ironfeet->IsKindOf (RUNTIME_CLASS(APowerIronFeet))) break; } if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE; if ((ironfeet == NULL || pr_playerinspecialsector() < sector->leakydamage)) { if (sector->Flags & SECF_HAZARD) { player->hazardcount += sector->damageamount; player->hazardtype = sector->damagetype; player->hazardinterval = sector->damageinterval; } else if (level.time % sector->damageinterval == 0) { if (!(player->cheats & (CF_GODMODE|CF_GODMODE2))) P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) { G_ExitLevel(0, false); } if (sector->Flags & SECF_DMGTERRAINFX) { P_HitWater(player->mo, player->mo->Sector, player->mo->Pos(), false, true, true); } } } } else if (sector->damageamount < 0) { if (level.time % sector->damageinterval == 0) { P_GiveBody(player->mo, -sector->damageamount, 100); } } if (sector->isSecret()) { sector->ClearSecret(); P_GiveSecret(player->mo, true, true, int(sector - sectors)); }}
开发者ID:Blue-Shadow,项目名称:zdoom,代码行数:70,
示例29: PickConversationReplystatic void PickConversationReply (){ const char *replyText = NULL; FStrifeDialogueReply *reply = (FStrifeDialogueReply *)ConversationItems[ConversationMenu.lastOn].c.extra; bool takestuff; int i; M_ClearMenus (); CleanupConversationMenu (); if (reply == NULL) { return; } // Check if you have the requisite items for this choice for (i = 0; i < 3; ++i) { if (!CheckStrifeItem (reply->ItemCheck[i], reply->ItemCheckAmount[i])) { // No, you don't. Say so and let the NPC animate negatively. if (reply->QuickNo) { Printf ("%s/n", reply->QuickNo); } ConversationNPC->ConversationAnimation (2); return; } } // Yay, you do! Let the NPC animate affirmatively. ConversationNPC->ConversationAnimation (1); // If this reply gives you something, then try to receive it. takestuff = true; if (reply->GiveType != NULL) { AInventory *item = static_cast<AInventory *> (Spawn (reply->GiveType, 0, 0, 0)); // Items given here should not count as items! if (item->flags & MF_COUNTITEM) { level.total_items--; item->flags &= ~MF_COUNTITEM; } item->flags |= MF_DROPPED; if (!item->TryPickup (players[consoleplayer].mo)) { item->Destroy (); takestuff = false; } } // Take away required items if the give was successful or none was needed. if (takestuff) { for (i = 0; i < 3; ++i) { TakeStrifeItem (reply->ItemCheck[i], reply->ItemCheckAmount[i]); } replyText = reply->QuickYes; } else { replyText = "You seem to have enough!"; } // Update the quest log, if needed. if (reply->LogNumber != 0) { players[consoleplayer].SetLogNumber (reply->LogNumber); } // Does this reply alter the speaker's conversation node? If NextNode is positive, // the next time they talk, the will show the new node. If it is negative, then they // will show the new node right away without terminating the dialogue. if (reply->NextNode != 0) { int rootnode = FindNode (ConversationNPC->GetDefault()->Conversation); if (reply->NextNode < 0) { ConversationNPC->Conversation = StrifeDialogues[rootnode - reply->NextNode - 1]; if (gameaction != ga_slideshow) { P_StartConversation (ConversationNPC, players[consoleplayer].mo); return; } else { S_StopSound (ConversationNPC, CHAN_VOICE); } } else { ConversationNPC->Conversation = StrifeDialogues[rootnode + reply->NextNode - 1]; } } if (replyText != NULL) { Printf ("%s/n", replyText); }//.........这里部分代码省略.........
开发者ID:doomtech,项目名称:zdoom-old,代码行数:101,
注:本文中的AInventory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AMDataSource类代码示例 C++ AIInterface类代码示例 |