/*Add the Transporter Interface*/ static bool _intAddTransporter(DROID *psSelected, bool offWorld) { bool Animate = true; onMission = offWorld; psCurrTransporter = psSelected; /*if transporter has died - close the interface - this can only happen in multiPlayer where the transporter can be killed*/ if (bMultiPlayer) { if (psCurrTransporter && isDead((BASE_OBJECT *)psCurrTransporter)) { intRemoveTransNoAnim(); return true; } } // Add the main Transporter form // Is the form already up? if (widgGetFromID(psWScreen, IDTRANS_FORM) != NULL) { intRemoveTransNoAnim(); Animate = false; } if (intIsRefreshing()) { Animate = false; } WIDGET *parent = psWScreen->psForm; IntFormAnimated *transForm = new IntFormAnimated(parent, Animate); // Do not animate the opening, if the window was already open. transForm->id = IDTRANS_FORM; transForm->setGeometry(TRANS_X, TRANS_Y, TRANS_WIDTH, TRANS_HEIGHT); /* Add the close button */ W_BUTINIT sButInit; sButInit.formID = IDTRANS_FORM; sButInit.id = IDTRANS_CLOSE; sButInit.x = TRANS_WIDTH - CLOSE_WIDTH; sButInit.y = 0; sButInit.width = CLOSE_WIDTH; sButInit.height = CLOSE_HEIGHT; sButInit.pTip = _("Close"); sButInit.pDisplay = intDisplayImageHilight; sButInit.UserData = PACKDWORD_TRI(0, IMAGE_CLOSEHILIGHT , IMAGE_CLOSE); if (!widgAddButton(psWScreen, &sButInit)) { return false; } if (!intAddTransButtonForm()) { return false; } // Add the Transporter Contents form (and buttons) if (!intAddTransporterContents()) { return false; } //if on a mission - add the Droids back at home base form if (onMission) { if (!intAddDroidsAvailForm()) { return false; } } return true; }
static void _intProcessTransporter(UDWORD id) { if (id >= IDTRANS_START && id <= IDTRANS_END) { /* A Transporter button has been pressed */ setCurrentTransporter(id); /*refresh the Contents list */ intAddTransporterContents(); } else if (id >= IDTRANS_CONTSTART && id <= IDTRANS_CONTEND) { //got to have a current transporter for this to work - and can't be flying if (psCurrTransporter != NULL && !transporterFlying(psCurrTransporter)) { unsigned currID = IDTRANS_CONTSTART; DROID *psDroid; for (psDroid = psCurrTransporter->psGroup->psList; psDroid != NULL && psDroid != psCurrTransporter; psDroid = psDroid->psGrpNext) { if (psDroid->selected) { continue; // Already scheduled this droid for removal. } if (currID == id) { break; } currID++; } if (psDroid != NULL) { transporterRemoveDroid(psCurrTransporter, psDroid, ModeQueue); } /*refresh the Contents list */ intAddTransporterContents(); if (onMission) { /*refresh the Avail list */ intAddDroidsAvailForm(); } } } else if (id == IDTRANS_CLOSE) { intRemoveTransContent(); intRemoveTrans(); psCurrTransporter = NULL; } else if (id == IDTRANS_CONTCLOSE) { intRemoveTransContent(); } else if (id == IDTRANS_DROIDCLOSE) { intRemoveTransDroidsAvail(); } else if (id >= IDTRANS_DROIDSTART && id <= IDTRANS_DROIDEND) { //got to have a current transporter for this to work - and can't be flying if (psCurrTransporter != NULL && !transporterFlying(psCurrTransporter)) { intTransporterAddDroid(id); /*don't need to explicitly refresh here since intRefreshScreen() is called by intTransporterAddDroid()*/ } } }
/*Add the Transporter Interface*/ static bool _intAddTransporter(DROID *psSelected, bool offWorld) { bool Animate = true; onMission = offWorld; psCurrTransporter = psSelected; /*if transporter has died - close the interface - this can only happen in multiPlayer where the transporter can be killed*/ if (bMultiPlayer) { if (psCurrTransporter && isDead((BASE_OBJECT *)psCurrTransporter)) { intRemoveTransNoAnim(); return true; } } // Add the main Transporter form // Is the form already up? if (widgGetFromID(psWScreen, IDTRANS_FORM) != NULL) { intRemoveTransNoAnim(); Animate = false; } if (intIsRefreshing()) { Animate = false; } W_FORMINIT sFormInit; sFormInit.formID = 0; sFormInit.id = IDTRANS_FORM; sFormInit.style = WFORM_PLAIN; sFormInit.x = (SWORD)TRANS_X; sFormInit.y = (SWORD)TRANS_Y; sFormInit.width = TRANS_WIDTH; sFormInit.height = TRANS_HEIGHT; // If the window was closed then do open animation. if (Animate) { sFormInit.pDisplay = intOpenPlainForm; sFormInit.disableChildren = true; } else { // otherwise just recreate it. sFormInit.pDisplay = intDisplayPlainForm; } if (!widgAddForm(psWScreen, &sFormInit)) { return false; } /* Add the close button */ W_BUTINIT sButInit; sButInit.formID = IDTRANS_FORM; sButInit.id = IDTRANS_CLOSE; sButInit.x = TRANS_WIDTH - CLOSE_WIDTH; sButInit.y = 0; sButInit.width = CLOSE_WIDTH; sButInit.height = CLOSE_HEIGHT; sButInit.pTip = _("Close"); sButInit.pDisplay = intDisplayImageHilight; sButInit.UserData = PACKDWORD_TRI(0, IMAGE_CLOSEHILIGHT , IMAGE_CLOSE); if (!widgAddButton(psWScreen, &sButInit)) { return false; } if (!intAddTransButtonForm()) { return false; } // Add the Transporter Contents form (and buttons) if (!intAddTransporterContents()) { return false; } //if on a mission - add the Droids back at home base form if (onMission) { if (!intAddDroidsAvailForm()) { return false; } } return true; }