Fix transporter check for SP games.
Add some FIXME comments when we properly fix the campaign scripts. Expose DROID_SUPERTRANSPORTER to the script engine Fix gifting of the Super Transporter, along with some other fixes. Fixes ticket:3224master
parent
475d1e6252
commit
9e63fe3433
|
@ -188,6 +188,7 @@ int32_t droidDamage(DROID *psDroid, unsigned damage, WEAPON_CLASS weaponClass, W
|
|||
else if (relativeDamage < 0)
|
||||
{
|
||||
// HACK: Prevent transporters from being destroyed in single player
|
||||
// FIXME: When we fix campaign scripts to use DROID_SUPERTRANSPORTER
|
||||
if ((game.type == CAMPAIGN) && !bMultiPlayer && (psDroid->droidType == DROID_TRANSPORTER))
|
||||
{
|
||||
debug(LOG_ATTACK, "Transport(%d) saved from death--since it should never die (SP only)", psDroid->id);
|
||||
|
|
|
@ -69,13 +69,13 @@ enum DROID_TYPE
|
|||
DROID_PERSON, ///< person
|
||||
DROID_CYBORG, ///< cyborg-type thang
|
||||
DROID_TRANSPORTER, ///< guess what this is!
|
||||
DROID_SUPERTRANSPORTER, ///< SuperTransport (MP)
|
||||
DROID_COMMAND, ///< Command droid
|
||||
DROID_REPAIR, ///< Repair droid
|
||||
DROID_DEFAULT, ///< Default droid
|
||||
DROID_CYBORG_CONSTRUCT, ///< cyborg constructor droid - new for update 28/5/99
|
||||
DROID_CYBORG_REPAIR, ///< cyborg repair droid - new for update 28/5/99
|
||||
DROID_CYBORG_SUPER, ///< cyborg repair droid - new for update 7/6/99
|
||||
DROID_SUPERTRANSPORTER, ///< SuperTransport (MP)
|
||||
DROID_ANY, ///< Any droid. Only used as a parameter for intGotoNextDroidType(DROID_TYPE).
|
||||
};
|
||||
|
||||
|
|
|
@ -671,6 +671,7 @@ void missionFlyTransportersIn( SDWORD iPlayer, bool bTrackTransporter )
|
|||
NULL; psTransporter = psNext)
|
||||
{
|
||||
psNext = psTransporter->psNext;
|
||||
// FIXME: When we convert campaign scripts to use DROID_SUPERTRANSPORTER
|
||||
if (psTransporter->droidType == DROID_TRANSPORTER)
|
||||
{
|
||||
// Check that this transporter actually contains some droids
|
||||
|
@ -1909,7 +1910,7 @@ void missionMoveTransporterOffWorld( DROID *psTransporter )
|
|||
{
|
||||
W_CLICKFORM *psForm;
|
||||
DROID *psDroid;
|
||||
|
||||
// FIXME: When we convert campaign scripts, use DROID_SUPERTRANSPORTER
|
||||
if (psTransporter->droidType == DROID_TRANSPORTER)
|
||||
{
|
||||
/* trigger script callback */
|
||||
|
|
|
@ -1149,7 +1149,7 @@ static void moveCalcDroidSlide(DROID *psDroid, int *pmx, int *pmy)
|
|||
{
|
||||
if (psObj->type == OBJ_DROID)
|
||||
{
|
||||
if (((DROID *)psObj)->droidType == DROID_TRANSPORTER)
|
||||
if (((DROID *)psObj)->droidType == DROID_TRANSPORTER || ((DROID *)psObj)->droidType == DROID_SUPERTRANSPORTER)
|
||||
{
|
||||
// ignore transporters
|
||||
continue;
|
||||
|
@ -1270,7 +1270,7 @@ static Vector2i moveGetObstacleVector(DROID *psDroid, Vector2i dest)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (psObstacle->droidType == DROID_TRANSPORTER ||
|
||||
if ((psObstacle->droidType == DROID_TRANSPORTER || psObstacle->droidType == DROID_SUPERTRANSPORTER) ||
|
||||
(psObstacle->droidType == DROID_PERSON &&
|
||||
psObstacle->player != psDroid->player))
|
||||
{
|
||||
|
|
|
@ -237,7 +237,7 @@ static void sendGiftDroids(uint8_t from, uint8_t to)
|
|||
|
||||
for (psD = apsDroidLists[from]; psD && totalToSend != 0; psD = psD->psNext)
|
||||
{
|
||||
if (psD->droidType == DROID_TRANSPORTER
|
||||
if ((psD->droidType == DROID_TRANSPORTER || psD->droidType == DROID_SUPERTRANSPORTER)
|
||||
&& !transporterIsEmpty(psD))
|
||||
{
|
||||
CONPRINTF(ConsoleString, (ConsoleString, _("Tried to give away a non-empty %s - but this is not allowed."), psD->aName));
|
||||
|
|
|
@ -779,7 +779,7 @@ BASE_OBJECT *getBaseObjFromData(unsigned id, unsigned player, OBJECT_TYPE type)
|
|||
return psObj;
|
||||
}
|
||||
// if transporter check any droids in the grp
|
||||
if ((psObj->type == OBJ_DROID) && (((DROID*)psObj)->droidType == DROID_TRANSPORTER))
|
||||
if ((psObj->type == OBJ_DROID) && ((((DROID*)psObj)->droidType == DROID_TRANSPORTER || ((DROID*)psObj)->droidType == DROID_SUPERTRANSPORTER)))
|
||||
{
|
||||
for(psTrans = ((DROID*)psObj)->psGroup->psList; psTrans != NULL; psTrans = psTrans->psGrpNext)
|
||||
{
|
||||
|
@ -865,7 +865,7 @@ BASE_OBJECT *getBaseObjFromId(UDWORD id)
|
|||
return psObj;
|
||||
}
|
||||
// if transporter check any droids in the grp
|
||||
if ((psObj->type == OBJ_DROID) && (((DROID*)psObj)->droidType == DROID_TRANSPORTER))
|
||||
if ((psObj->type == OBJ_DROID) && ((((DROID*)psObj)->droidType == DROID_TRANSPORTER || ((DROID*)psObj)->droidType == DROID_SUPERTRANSPORTER)))
|
||||
{
|
||||
for(psTrans = ((DROID*)psObj)->psGroup->psList; psTrans != NULL; psTrans = psTrans->psGrpNext)
|
||||
{
|
||||
|
|
|
@ -792,11 +792,9 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
DROID *temp = NULL;
|
||||
|
||||
temp = (DROID*)psDroid->order.psObj;
|
||||
if ((temp->droidType == DROID_TRANSPORTER) && !cyborgDroid(psDroid))
|
||||
// FIXME: since we now have 2 transporter types, we should fix this in the scripts for campaign
|
||||
if ((temp->droidType == DROID_TRANSPORTER) && !cyborgDroid(psDroid) && game.type != CAMPAIGN && bMultiPlayer)
|
||||
{
|
||||
// NOTE: since we only have one type of transport (DROID_TRANSPORT), it isn't worth changing tons of code
|
||||
// to have two types available (DROID_TRANSPORT_SUPER), so we just check the name which can never be
|
||||
// renamed anyway, so we should be safe with this kludge.
|
||||
psDroid->order = DroidOrder(DORDER_NONE);
|
||||
actionDroid(psDroid, DACTION_NONE);
|
||||
audio_PlayTrack( ID_SOUND_BUILD_FAIL );
|
||||
|
@ -1483,8 +1481,9 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
else if (psOrder->psObj && !psOrder->psObj->died)
|
||||
{
|
||||
//cannot attack a Transporter with EW in multiPlayer
|
||||
// FIXME: Why not ?
|
||||
if (game.type == SKIRMISH && electronicDroid(psDroid)
|
||||
&& psOrder->psObj->type == OBJ_DROID && ((DROID *)psOrder->psObj)->droidType == DROID_TRANSPORTER)
|
||||
&& psOrder->psObj->type == OBJ_DROID && (((DROID *)psOrder->psObj)->droidType == DROID_TRANSPORTER || ((DROID *)psOrder->psObj)->droidType == DROID_SUPERTRANSPORTER))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -2491,6 +2490,7 @@ void orderSelectedLoc(uint32_t player, uint32_t x, uint32_t y, bool add)
|
|||
if (psCurr->selected)
|
||||
{
|
||||
// can't use bMultiPlayer since multimsg could be off.
|
||||
// FIXME: Fix this for DROID_SUPERTRANSPORTER when we fix campaign scripts
|
||||
if (psCurr->droidType == DROID_TRANSPORTER && game.type == CAMPAIGN)
|
||||
{
|
||||
// Transport in campaign cannot be controlled by players
|
||||
|
|
|
@ -1312,7 +1312,7 @@ static QScriptValue js_groupAddArea(QScriptContext *context, QScriptEngine *engi
|
|||
for (DROID *psDroid = apsDroidLists[player]; psGroup && psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
if (psDroid->pos.x >= x1 && psDroid->pos.x <= x2 && psDroid->pos.y >= y1 && psDroid->pos.y <= y2
|
||||
&& psDroid->droidType != DROID_COMMAND && psDroid->droidType != DROID_TRANSPORTER)
|
||||
&& psDroid->droidType != DROID_COMMAND && (psDroid->droidType != DROID_TRANSPORTER && psDroid->droidType != DROID_SUPERTRANSPORTER))
|
||||
{
|
||||
psGroup->add(psDroid);
|
||||
}
|
||||
|
@ -2119,6 +2119,7 @@ bool registerFunctions(QScriptEngine *engine)
|
|||
engine->globalObject().setProperty("DROID_ECM", DROID_ECM, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("DROID_CYBORG", DROID_CYBORG, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("DROID_TRANSPORTER", DROID_TRANSPORTER, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("DROID_SUPERTRANSPORTER", DROID_SUPERTRANSPORTER, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("DROID_COMMAND", DROID_COMMAND, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("HQ", REF_HQ, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
engine->globalObject().setProperty("FACTORY", REF_FACTORY, QScriptValue::ReadOnly | QScriptValue::Undeletable);
|
||||
|
|
|
@ -1986,8 +1986,7 @@ void replaceTransDroidComponents(DROID *psTransporter, UDWORD oldType,
|
|||
{
|
||||
DROID *psCurr;
|
||||
|
||||
ASSERT( psTransporter->droidType == DROID_TRANSPORTER,
|
||||
"replaceTransUnitComponents: invalid unit type" );
|
||||
ASSERT ((psTransporter->droidType == DROID_TRANSPORTER || psTransporter->droidType == DROID_SUPERTRANSPORTER), "invalid unit type" );
|
||||
|
||||
for (psCurr = psTransporter->psGroup->psList; psCurr != NULL; psCurr =
|
||||
psCurr->psGrpNext)
|
||||
|
|
|
@ -1188,7 +1188,7 @@ bool scrAddDroidToTransporter(void)
|
|||
|
||||
ASSERT(psTransporter != NULL, "scrAddUnitToTransporter: invalid transporter pointer");
|
||||
ASSERT(psDroid != NULL, "scrAddUnitToTransporter: invalid unit pointer");
|
||||
ASSERT(psTransporter->droidType == DROID_TRANSPORTER, "scrAddUnitToTransporter: invalid transporter type");
|
||||
ASSERT((psTransporter->droidType == DROID_TRANSPORTER || psTransporter->droidType == DROID_SUPERTRANSPORTER), "scrAddUnitToTransporter: invalid transporter type");
|
||||
|
||||
/* check for space */
|
||||
if (checkTransporterSpace(psTransporter, psDroid))
|
||||
|
|
|
@ -5709,7 +5709,7 @@ bool validTemplateForFactory(DROID_TEMPLATE *psTemplate, STRUCTURE *psFactory)
|
|||
if (!bMultiPlayer)
|
||||
{
|
||||
//ignore Transporter Droids
|
||||
if (psTemplate->droidType == DROID_TRANSPORTER)
|
||||
if (psTemplate->droidType == DROID_TRANSPORTER || psTemplate->droidType == DROID_SUPERTRANSPORTER)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue