本文整理汇总了C++中AInventory::TryPickup方法的典型用法代码示例。如果您正苦于以下问题:C++ AInventory::TryPickup方法的具体用法?C++ AInventory::TryPickup怎么用?C++ AInventory::TryPickup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AInventory
的用法示例。
在下文中一共展示了AInventory::TryPickup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PickConversationReply
static 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);
}
//.........这里部分代码省略.........