mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
Redo commit a4c07a9
- Line endings are inconsistant in this file, but at least the commit doesn't touch the whole file.
This commit is contained in:
parent
d828173ce3
commit
b69edbbec1
1 changed files with 32 additions and 17 deletions
|
@ -1670,14 +1670,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
|
||||
static void DoGiveInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO)
|
||||
{
|
||||
ACTION_PARAM_START(3);
|
||||
ACTION_PARAM_START(2+use_aaptr);
|
||||
ACTION_PARAM_CLASS(mi, 0);
|
||||
ACTION_PARAM_INT(amount, 1);
|
||||
ACTION_PARAM_INT(setreceiver, 2);
|
||||
|
||||
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
|
||||
if (use_aaptr)
|
||||
{
|
||||
ACTION_PARAM_INT(setreceiver, 2);
|
||||
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
|
||||
}
|
||||
|
||||
bool res=true;
|
||||
|
||||
|
@ -1685,6 +1688,11 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
|
|||
if (mi)
|
||||
{
|
||||
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE));
|
||||
if (!item)
|
||||
{
|
||||
ACTION_SET_RESULT(false);
|
||||
return;
|
||||
}
|
||||
if (item->IsKindOf(RUNTIME_CLASS(AHealth)))
|
||||
{
|
||||
item->Amount *= amount;
|
||||
|
@ -1709,12 +1717,12 @@ static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
|
|||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
|
||||
{
|
||||
DoGiveInventory(self, PUSH_PARAMINFO);
|
||||
DoGiveInventory(self, true, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
|
||||
{
|
||||
DoGiveInventory(self->target, PUSH_PARAMINFO);
|
||||
DoGiveInventory(self->target, true, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
|
||||
|
@ -1724,7 +1732,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
|
|||
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self) DoGiveInventory(mo, PUSH_PARAMINFO);
|
||||
if (mo->master == self) DoGiveInventory(mo, false, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1737,7 +1745,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings)
|
|||
{
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self->master && mo != self) DoGiveInventory(mo, PUSH_PARAMINFO);
|
||||
if (mo->master == self->master && mo != self) DoGiveInventory(mo, false, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1753,16 +1761,23 @@ enum
|
|||
TIF_NOTAKEINFINITE = 1,
|
||||
};
|
||||
|
||||
void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO)
|
||||
void DoTakeInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO)
|
||||
{
|
||||
ACTION_PARAM_START(4);
|
||||
ACTION_PARAM_START(3+use_aaptr);
|
||||
ACTION_PARAM_CLASS(item, 0);
|
||||
ACTION_PARAM_INT(amount, 1);
|
||||
ACTION_PARAM_INT(flags, 2);
|
||||
ACTION_PARAM_INT(setreceiver, 3);
|
||||
|
||||
if (!item) return;
|
||||
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
|
||||
if (!item)
|
||||
{
|
||||
ACTION_SET_RESULT(false);
|
||||
return;
|
||||
}
|
||||
if (use_aaptr)
|
||||
{
|
||||
ACTION_PARAM_INT(setreceiver, 3);
|
||||
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
|
||||
}
|
||||
|
||||
bool res = false;
|
||||
|
||||
|
@ -1794,12 +1809,12 @@ void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO)
|
|||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
|
||||
{
|
||||
DoTakeInventory(self, PUSH_PARAMINFO);
|
||||
DoTakeInventory(self, true, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
|
||||
{
|
||||
DoTakeInventory(self->target, PUSH_PARAMINFO);
|
||||
DoTakeInventory(self->target, true, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
|
||||
|
@ -1809,7 +1824,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
|
|||
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self) DoTakeInventory(mo, PUSH_PARAMINFO);
|
||||
if (mo->master == self) DoTakeInventory(mo, false, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1822,7 +1837,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings)
|
|||
{
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self->master && mo != self) DoTakeInventory(mo, PUSH_PARAMINFO);
|
||||
if (mo->master == self->master && mo != self) DoTakeInventory(mo, false, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue