mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 16:51:31 +00:00
- fixed: Since A_Give/TaketoChildren/siblings use the same code as A_Give/TakeInventory but do not use the third parameter this must be ignored by the code. This is merely a band-aid fix, because this problem doesn't exist in the same form in the scripting branch.
This commit is contained in:
parent
04c6c5ca55
commit
a4c07a9ee3
1 changed files with 5840 additions and 5825 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);
|
||||
|
||||
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;
|
||||
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