mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- added UseInventory/UseActorInventory ACS functions.
SVN r636 (trunk)
This commit is contained in:
parent
3eb741e391
commit
671cf5a888
5 changed files with 93 additions and 2 deletions
|
@ -1,3 +1,6 @@
|
|||
December 25, 2007 (Changes by Graf Zahl)
|
||||
- added UseInventory/UseActorInventory ACS functions.
|
||||
|
||||
December 24, 2007 (Changes by Graf Zahl)
|
||||
- added some functionality to FDynamicColormap to allow not creating
|
||||
the colormap data.
|
||||
|
|
|
@ -357,6 +357,61 @@ static void TakeInventory (AActor *activator, const char *type, int amount)
|
|||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// DoUseInv
|
||||
//
|
||||
// Makes a single actor use an inventory item
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
static bool DoUseInv (AActor *actor, const PClass *info)
|
||||
{
|
||||
AInventory *item = actor->FindInventory (info);
|
||||
if (item != NULL)
|
||||
{
|
||||
return actor->UseInventory(item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// UseInventory
|
||||
//
|
||||
// makes one or more actors use an inventory item.
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
static int UseInventory (AActor *activator, const char *type)
|
||||
{
|
||||
const PClass *info;
|
||||
int ret = 0;
|
||||
|
||||
if (type == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
info = PClass::FindClass (type);
|
||||
if (info == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (activator == NULL)
|
||||
{
|
||||
for (int i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (playeringame[i])
|
||||
ret += DoUseInv (players[i].mo, info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = DoUseInv (activator, info);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// CheckInventory
|
||||
|
@ -4322,6 +4377,32 @@ int DLevelScript::RunScript ()
|
|||
pc += 1;
|
||||
break;
|
||||
|
||||
case PCD_USEINVENTORY:
|
||||
STACK(1) = UseInventory (activator, FBehavior::StaticLookupString (STACK(1)));
|
||||
break;
|
||||
|
||||
case PCD_USEACTORINVENTORY:
|
||||
{
|
||||
int ret;
|
||||
const char *type = FBehavior::StaticLookupString(STACK(1));
|
||||
if (STACK(2) == 0)
|
||||
{
|
||||
ret = UseInventory(NULL, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator it(STACK(2));
|
||||
AActor *actor;
|
||||
for (actor = it.Next(); actor != NULL; actor = it.Next())
|
||||
{
|
||||
ret += UseInventory(actor, type);
|
||||
}
|
||||
}
|
||||
STACK(2) = ret;
|
||||
sp--;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCD_GETSIGILPIECES:
|
||||
{
|
||||
ASigil *sigil;
|
||||
|
|
|
@ -541,6 +541,8 @@ public:
|
|||
PCD_PRINTBIND,
|
||||
PCD_SETACTORSTATE,
|
||||
PCD_THINGDAMAGE2,
|
||||
PCD_USEINVENTORY,
|
||||
PCD_USEACTORINVENTORY,
|
||||
|
||||
PCODE_COMMAND_COUNT
|
||||
};
|
||||
|
|
|
@ -135,7 +135,7 @@ static int DoomSpecificInfo (char *buffer, char *end)
|
|||
SDL_Quit();
|
||||
|
||||
p = 0;
|
||||
p += snprintf (buffer+p, size-p, "ZDoom version " DOTVERSIONSTR " (" __DATE__ ")\n");
|
||||
p += snprintf (buffer+p, size-p, GAMENAME" version " DOTVERSIONSTR " (" __DATE__ ")\n");
|
||||
p += snprintf (buffer+p, size-p, "\nCommand line:");
|
||||
for (i = 0; i < Args.NumArgs(); ++i)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ static int DoomSpecificInfo (char *buffer, char *end)
|
|||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
printf("ZDoom v%s - SVN revision %s - SDL version\nCompiled on %s\n\n",
|
||||
printf(GAMENAME" v%s - SVN revision %s - SDL version\nCompiled on %s\n\n",
|
||||
DOTVERSIONSTR_NOREV,SVN_REVISION_STRING,__DATE__);
|
||||
|
||||
{
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifndef __WIN32IFACE_H
|
||||
#define __WIN32IFACE_H
|
||||
|
||||
#ifndef DIRECTDRAW_VERSION
|
||||
#define DIRECTDRAW_VERSION 0x0300
|
||||
#endif
|
||||
|
@ -306,3 +309,5 @@ FILE *dbg;
|
|||
#define LOG4(x,y,z,a,b)
|
||||
#define LOG5(x,y,z,a,b,c)
|
||||
#endif
|
||||
|
||||
#endif // __WIN32IFACE_H
|
||||
|
|
Loading…
Reference in a new issue