Added Troman's script functions
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@15 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
657192d9fd
commit
edbd2aa0f6
|
@ -6386,4 +6386,67 @@ BOOL scrTutorialTemplates(void)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static UDWORD playerToEnumDroid;
|
||||||
|
static UDWORD playerVisibleDroid;
|
||||||
|
static UDWORD enumDroidCount;
|
||||||
|
|
||||||
|
/* Prepare the droid iteration */
|
||||||
|
BOOL scrInitEnumDroids(void)
|
||||||
|
{
|
||||||
|
SDWORD targetplayer,playerVisible;
|
||||||
|
|
||||||
|
if ( !stackPopParams(2, VAL_INT, &targetplayer, VAL_INT, &playerVisible) )
|
||||||
|
{
|
||||||
|
//DbgMsg("scrInitEnumDroids() - failed to pop params");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerToEnumDroid = (UDWORD)targetplayer;
|
||||||
|
playerVisibleDroid = (UDWORD)playerVisible;
|
||||||
|
enumDroidCount = 0; //returned 0 droids so far
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get next droid */
|
||||||
|
BOOL scrEnumDroid(void)
|
||||||
|
{
|
||||||
|
UDWORD count;
|
||||||
|
DROID *psDroid;
|
||||||
|
BOOL found;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
for(psDroid=apsDroidLists[playerToEnumDroid];psDroid && count<enumDroidCount;count++)
|
||||||
|
{
|
||||||
|
psDroid = psDroid->psNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//search the players' list of droid to see if one exists and is visible
|
||||||
|
found = FALSE;
|
||||||
|
while(psDroid)
|
||||||
|
{
|
||||||
|
if(psDroid->visible[playerVisibleDroid])
|
||||||
|
{
|
||||||
|
if (!stackPushResult(ST_DROID,(UDWORD) psDroid)) // push result
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
enumDroidCount++;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
enumDroidCount++;
|
||||||
|
psDroid = psDroid->psNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
// push NULLDROID, since didn't find any
|
||||||
|
if (!stackPushResult(ST_DROID, (UDWORD)NULL))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -7,6 +7,9 @@
|
||||||
#ifndef _scriptfuncs_h
|
#ifndef _scriptfuncs_h
|
||||||
#define _scriptfuncs_h
|
#define _scriptfuncs_h
|
||||||
|
|
||||||
|
extern BOOL scrInitEnumDroids(void);
|
||||||
|
extern BOOL scrEnumDroid(void);
|
||||||
|
|
||||||
// not used in scripts, but used in code.
|
// not used in scripts, but used in code.
|
||||||
extern BOOL objectInRange(BASE_OBJECT *psList, SDWORD x, SDWORD y, SDWORD range);
|
extern BOOL objectInRange(BASE_OBJECT *psList, SDWORD x, SDWORD y, SDWORD range);
|
||||||
|
|
||||||
|
@ -496,3 +499,5 @@ extern BOOL scrSkFireLassat(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,11 @@ FUNC_SYMBOL asFuncTable[] =
|
||||||
*/
|
*/
|
||||||
FUNC_SYMBOL asFuncTable[] =
|
FUNC_SYMBOL asFuncTable[] =
|
||||||
{
|
{
|
||||||
|
{ "InitEnumDroids", scrInitEnumDroids, VAL_VOID,
|
||||||
|
2, { VAL_INT, VAL_INT } },
|
||||||
|
{ "EnumDroid", scrEnumDroid, ST_DROID,
|
||||||
|
0, { VAL_VOID } },
|
||||||
|
|
||||||
// These functions are part of the script library
|
// These functions are part of the script library
|
||||||
{ "traceOn", interpTraceOn, VAL_VOID,
|
{ "traceOn", interpTraceOn, VAL_VOID,
|
||||||
0, { VAL_VOID } },
|
0, { VAL_VOID } },
|
||||||
|
@ -1115,6 +1120,8 @@ VAR_SYMBOL asObjTable[] =
|
||||||
{ "health", VAL_INT, ST_OBJECT, ST_GROUP, GROUPID_HEALTH,
|
{ "health", VAL_INT, ST_OBJECT, ST_GROUP, GROUPID_HEALTH,
|
||||||
scrGroupObjGet, NULL },
|
scrGroupObjGet, NULL },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* This entry marks the end of the variable list */
|
/* This entry marks the end of the variable list */
|
||||||
{ NULL, VAL_VOID, ST_OBJECT, VAL_VOID, 0, NULL, NULL }
|
{ NULL, VAL_VOID, ST_OBJECT, VAL_VOID, 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue