// get a target from a cluster using the preferences BOOL scrTargetInCluster(void) { SDWORD tarPlayer, tarType, visPlayer, clusterID, cluster; BASE_OBJECT *psTarget; if (!stackPopParams(2, VAL_INT, &clusterID, VAL_INT, &visPlayer)) { return FALSE; } if (clusterID < 0 || clusterID >= CLUSTER_MAX) { ASSERT((FALSE, "scrTargetInCluster: invalid clusterID")); return FALSE; } cluster = aClusterMap[clusterID]; tarPlayer = aClusterInfo[cluster] & CLUSTER_PLAYER_MASK; tarType = (aClusterInfo[cluster] & CLUSTER_DROID) ? SCR_TAR_DROID : SCR_TAR_STRUCT; psTarget = scrTargetInArea(tarPlayer, visPlayer, tarType, cluster, scrollMinX*TILE_UNITS,scrollMinY*TILE_UNITS, scrollMaxX*TILE_UNITS,scrollMaxY*TILE_UNITS); if (!stackPushResult(ST_BASEOBJECT, (UDWORD)psTarget)) { return FALSE; } return TRUE; }
// get a target from a cluster using the preferences bool scrTargetInCluster(void) { SDWORD tarPlayer, tarType, visPlayer, clusterID, cluster; BASE_OBJECT *psTarget; if (!stackPopParams(2, VAL_INT, &clusterID, VAL_INT, &visPlayer)) { return false; } if (clusterID < 0 || clusterID >= CLUSTER_MAX) { ASSERT(false, "scrTargetInCluster: invalid clusterID"); return false; } cluster = aClusterMap[clusterID]; tarPlayer = aClusterInfo[cluster] & CLUSTER_PLAYER_MASK; tarType = (aClusterInfo[cluster] & CLUSTER_DROID) ? SCR_TAR_DROID : SCR_TAR_STRUCT; psTarget = scrTargetInArea(tarPlayer, visPlayer, tarType, cluster, scrollMinX * TILE_UNITS, scrollMinY * TILE_UNITS, scrollMaxX * TILE_UNITS, scrollMaxY * TILE_UNITS); scrFunctionResult.v.oval = psTarget; if (!stackPushResult((INTERP_TYPE)ST_BASEOBJECT, &scrFunctionResult)) { return false; } return true; }
// get a structure target in an area using the preferences bool scrStructTargetInArea(void) { SDWORD x1, y1, x2, y2; SDWORD tarPlayer, visPlayer; if (!stackPopParams(6, VAL_INT, &tarPlayer, VAL_INT, &visPlayer, VAL_INT, &x1, VAL_INT, &y1, VAL_INT, &x2, VAL_INT, &y2)) { return false; } scrFunctionResult.v.oval = (STRUCTURE *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_STRUCT, 0, x1, y1, x2, y2); if (!stackPushResult((INTERP_TYPE)ST_STRUCTURE, &scrFunctionResult)) { return false; } return true; }
// get a droid target on the map using the preferences BOOL scrDroidTargetOnMap(void) { SDWORD tarPlayer, visPlayer; DROID *psTarget; if (!stackPopParams(2, VAL_INT, &tarPlayer, VAL_INT, &visPlayer)) { return FALSE; } psTarget = (DROID *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_DROID, 0, scrollMinX*TILE_UNITS,scrollMinY*TILE_UNITS, scrollMaxX*TILE_UNITS,scrollMaxY*TILE_UNITS); if (!stackPushResult(ST_DROID, (UDWORD)psTarget)) { return FALSE; } return TRUE; }
// get a droid target in an area using the preferences BOOL scrDroidTargetInArea(void) { SDWORD x1,y1,x2,y2; SDWORD tarPlayer, visPlayer; DROID *psTarget; if (!stackPopParams(6, VAL_INT, &tarPlayer, VAL_INT, &visPlayer, VAL_INT, &x1, VAL_INT, &y1, VAL_INT, &x2, VAL_INT, &y2)) { return FALSE; } psTarget = (DROID *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_DROID, 0, x1,y1, x2,y2); if (!stackPushResult(ST_DROID, (UDWORD)psTarget)) { return FALSE; } return TRUE; }
// get a structure target on the map using the preferences BOOL scrStructTargetOnMap(void) { SDWORD tarPlayer, visPlayer; STRUCTURE *psTarget; if (!stackPopParams(2, VAL_INT, &tarPlayer, VAL_INT, &visPlayer)) { return FALSE; } psTarget = (STRUCTURE *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_STRUCT, 0, scrollMinX*TILE_UNITS,scrollMinY*TILE_UNITS, scrollMaxX*TILE_UNITS,scrollMaxY*TILE_UNITS); if (!stackPushResult(ST_STRUCTURE, (UDWORD)psTarget)) { return FALSE; } return TRUE; }
// get a structure target in an area using the preferences BOOL scrStructTargetInArea(void) { SDWORD x1,y1,x2,y2; SDWORD tarPlayer, visPlayer; STRUCTURE *psTarget; if (!stackPopParams(6, VAL_INT, &tarPlayer, VAL_INT, &visPlayer, VAL_INT, &x1, VAL_INT, &y1, VAL_INT, &x2, VAL_INT, &y2)) { return FALSE; } psTarget = (STRUCTURE *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_STRUCT, 0, x1,y1, x2,y2); if (!stackPushResult(ST_STRUCTURE, (UDWORD)psTarget)) { return FALSE; } return TRUE; }
// get a droid target on the map using the preferences bool scrDroidTargetOnMap(void) { SDWORD tarPlayer, visPlayer; DROID *psTarget; if (!stackPopParams(2, VAL_INT, &tarPlayer, VAL_INT, &visPlayer)) { return false; } psTarget = (DROID *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_DROID, 0, scrollMinX * TILE_UNITS, scrollMinY * TILE_UNITS, scrollMaxX * TILE_UNITS, scrollMaxY * TILE_UNITS); scrFunctionResult.v.oval = psTarget; if (!stackPushResult((INTERP_TYPE)ST_DROID, &scrFunctionResult)) { return false; } return true; }
// get a droid target in an area using the preferences bool scrDroidTargetInArea(void) { SDWORD x1, y1, x2, y2; SDWORD tarPlayer, visPlayer; DROID *psTarget; if (!stackPopParams(6, VAL_INT, &tarPlayer, VAL_INT, &visPlayer, VAL_INT, &x1, VAL_INT, &y1, VAL_INT, &x2, VAL_INT, &y2)) { return false; } psTarget = (DROID *)scrTargetInArea(tarPlayer, visPlayer, SCR_TAR_DROID, 0, x1, y1, x2, y2); scrFunctionResult.v.oval = psTarget; if (!stackPushResult((INTERP_TYPE)ST_DROID, &scrFunctionResult)) { return false; } return true; }