mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- DropItem for ACS.
This commit is contained in:
parent
c0174ea7cd
commit
1b2d8420bb
1 changed files with 35 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include "p_acs.h"
|
#include "p_acs.h"
|
||||||
#include "p_saveg.h"
|
#include "p_saveg.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
|
#include "p_enemy.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
@ -4233,6 +4234,7 @@ enum EACSFunctions
|
||||||
ACSF_PlayActorSound,
|
ACSF_PlayActorSound,
|
||||||
ACSF_SpawnDecal,
|
ACSF_SpawnDecal,
|
||||||
ACSF_CheckFont,
|
ACSF_CheckFont,
|
||||||
|
ACSF_DropItem,
|
||||||
|
|
||||||
// ZDaemon
|
// ZDaemon
|
||||||
ACSF_GetTeamScore = 19620, // (int team)
|
ACSF_GetTeamScore = 19620, // (int team)
|
||||||
|
@ -5235,6 +5237,39 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
// bool CheckFont(str fontname)
|
// bool CheckFont(str fontname)
|
||||||
return V_GetFont(FBehavior::StaticLookupString(args[0])) != NULL;
|
return V_GetFont(FBehavior::StaticLookupString(args[0])) != NULL;
|
||||||
|
|
||||||
|
case ACSF_DropItem:
|
||||||
|
{
|
||||||
|
const char *type = FBehavior::StaticLookupString(args[1]);
|
||||||
|
int amount = argCount >= 3? args[2] : -1;
|
||||||
|
int chance = argCount >= 4? args[3] : -1;
|
||||||
|
const PClass *cls = PClass::FindClass(type);
|
||||||
|
int cnt = 0;
|
||||||
|
if (cls != NULL)
|
||||||
|
{
|
||||||
|
if (args[0] == 0)
|
||||||
|
{
|
||||||
|
if (activator != NULL)
|
||||||
|
{
|
||||||
|
P_DropItem(activator, cls, amount, chance);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FActorIterator it(args[0]);
|
||||||
|
AActor *actor;
|
||||||
|
|
||||||
|
while ((actor = it.Next()) != NULL)
|
||||||
|
{
|
||||||
|
P_DropItem(actor, cls, amount, chance);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue