Merge branch 'master' into cpp
Conflicts: lib/widget/bar.cpp lib/widget/editbox.cppmaster
commit
0d2e373456
|
@ -35,6 +35,7 @@
|
|||
#include "frameint.h"
|
||||
#include "frameresource.h"
|
||||
#include "input.h"
|
||||
#include "lib/widget/scrap.h"
|
||||
#include "SDL_framerate.h"
|
||||
#include "physfs_ext.h"
|
||||
|
||||
|
@ -264,6 +265,9 @@ bool frameInitialise(
|
|||
/* Initialise the input system */
|
||||
inputInitialise();
|
||||
|
||||
// Initialise clipboard stuff.
|
||||
init_scrap();
|
||||
|
||||
/* Initialise the frame rate stuff */
|
||||
InitFrameStuff();
|
||||
|
||||
|
|
|
@ -3089,7 +3089,7 @@ static void sendDebugSync(uint8_t *buf, uint32_t bufLen, uint32_t time)
|
|||
NETend();
|
||||
}
|
||||
|
||||
static uint8_t debugSyncTmpBuf[1000000];
|
||||
static uint8_t debugSyncTmpBuf[2000000];
|
||||
static void recvDebugSync(NETQUEUE queue)
|
||||
{
|
||||
uint32_t time = 0;
|
||||
|
@ -3139,12 +3139,15 @@ bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc)
|
|||
// Dump our version, and also erase it, so we only dump it at most once.
|
||||
debug(LOG_ERROR, "Inconsistent sync debug at gameTime %u. My version has %u lines, CRC = 0x%08X.", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
|
||||
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "===== BEGIN gameTime=%u, %u lines, CRC 0x%08X =====\n", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
|
||||
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
|
||||
for (i = 0; i < syncDebugNum[index]; ++i)
|
||||
{
|
||||
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "[%s] %s\n", syncDebugFunctions[index][i], syncDebugStrings[index][i]);
|
||||
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
|
||||
free(syncDebugStrings[index][i]);
|
||||
}
|
||||
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "===== END gameTime=%u, %u lines, CRC 0x%08X =====\n", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
|
||||
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
|
||||
if (numDumps < 5)
|
||||
{
|
||||
++numDumps;
|
||||
|
|
|
@ -38,6 +38,8 @@ W_BARGRAPH::W_BARGRAPH(W_BARINIT const *init)
|
|||
, iRange(init->iRange)
|
||||
, iValue(0)
|
||||
, iOriginal(0)
|
||||
, denominator(MAX(init->denominator, 1))
|
||||
, precision(init->precision)
|
||||
, majorCol(init->sCol)
|
||||
, minorCol(init->sMinorCol)
|
||||
, pTip(init->pTip)
|
||||
|
|
|
@ -36,6 +36,8 @@ struct W_BARGRAPH : public WIDGET
|
|||
UWORD iRange; // Maximum range
|
||||
UWORD iValue; // Current value
|
||||
UWORD iOriginal; // hack to keep uncapped value around
|
||||
int denominator; // Denominator, 1 by default.
|
||||
int precision; // Number of places after the decimal point to display, 0 by default.
|
||||
PIELIGHT majorCol; // Colour for the major bar
|
||||
PIELIGHT minorCol; // Colour for the minor bar
|
||||
const char *pTip; // The tool tip for the graph
|
||||
|
|
|
@ -78,8 +78,6 @@ W_EDITBOX::W_EDITBOX(W_EDBINIT const *init)
|
|||
}
|
||||
|
||||
editBoxInitialise(this);
|
||||
|
||||
init_scrap();
|
||||
}
|
||||
|
||||
W_EDITBOX::~W_EDITBOX()
|
||||
|
|
|
@ -209,6 +209,8 @@ struct W_BARINIT : public W_INIT
|
|||
UWORD size; ///< Initial percentage of the graph that is filled
|
||||
UWORD minorSize; ///< Percentage of second bar graph if there is one
|
||||
UWORD iRange; ///< Maximum range
|
||||
int denominator; ///< Denominator, 1 by default.
|
||||
int precision; ///< Number of places after the decimal point to display, 0 by default.
|
||||
PIELIGHT sCol; ///< Bar colour
|
||||
PIELIGHT sMinorCol; ///< Minor bar colour
|
||||
const char *pTip; ///< Tool tip text
|
||||
|
|
|
@ -1545,13 +1545,19 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the bar graphs*/
|
||||
sBarInit.id = IDDES_SENSORRANGE;
|
||||
sBarInit.iRange = (UWORD)getMaxSensorRange();//DBAR_SENSORMAXRANGE;
|
||||
sBarInit.pTip = _("Sensor Range");
|
||||
sBarInit.denominator = TILE_UNITS;
|
||||
sBarInit.precision = 1;
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_SENSORPOWER;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.iRange = (UWORD)getMaxSensorPower();//DBAR_SENSORMAXPOWER;
|
||||
sBarInit.pTip = _("Sensor Power");
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -1559,6 +1565,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sBarInit.id = IDDES_SENSORWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y3; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.iRange = (UWORD)getMaxComponentWeight();//DBAR_MAXWEIGHT;
|
||||
sBarInit.pTip = _("Weight");
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -1598,6 +1605,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
/* Add the bar graphs */
|
||||
sBarInit.id = IDDES_ECMPOWER;
|
||||
sBarInit.iRange = (UWORD)getMaxECMPower();//DBAR_ECMMAXPOWER;
|
||||
sBarInit.pTip = _("ECM Power");
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -1605,6 +1613,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sBarInit.id = IDDES_ECMWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.iRange = (UWORD)getMaxComponentWeight();//DBAR_MAXWEIGHT;
|
||||
sBarInit.pTip = _("Weight");
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -1714,10 +1723,14 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
|
|||
sBarInit.id = IDDES_WEAPRANGE;
|
||||
sBarInit.iRange = (UWORD)getMaxWeaponRange();//DBAR_WEAPMAXRANGE;
|
||||
sBarInit.pTip = _("Range");
|
||||
sBarInit.denominator = TILE_UNITS;
|
||||
sBarInit.precision = 1;
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_WEAPDAMAGE;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.iRange = (UWORD)getMaxWeaponDamage();//DBAR_WEAPMAXDAMAGE;
|
||||
|
@ -1900,10 +1913,14 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sBarInit.id = IDDES_PROPAIR;
|
||||
sBarInit.iRange = (UWORD)getMaxPropulsionSpeed();//DBAR_PROPMAXSPEED;
|
||||
sBarInit.pTip = _("Air Speed");
|
||||
sBarInit.denominator = TILE_UNITS;
|
||||
sBarInit.precision = 2;
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_PROPWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.iRange = (UWORD)getMaxComponentWeight();//DBAR_MAXWEIGHT;
|
||||
|
@ -1937,6 +1954,8 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
sBarInit.id = IDDES_PROPROAD;
|
||||
sBarInit.pTip = _("Road Speed");
|
||||
sBarInit.iRange = (UWORD)getMaxPropulsionSpeed();//DBAR_PROPMAXSPEED;
|
||||
sBarInit.denominator = TILE_UNITS;
|
||||
sBarInit.precision = 2;
|
||||
if (!widgAddBarGraph(psWScreen, &sBarInit))
|
||||
{
|
||||
return false;
|
||||
|
@ -1957,6 +1976,8 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
sBarInit.denominator = 0;
|
||||
sBarInit.precision = 0;
|
||||
sBarInit.id = IDDES_PROPWEIGHT;
|
||||
sBarInit.y = DES_STATBAR_Y4; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
|
||||
sBarInit.pTip = _("Weight");
|
||||
|
|
484
src/hci.cpp
484
src/hci.cpp
|
@ -397,14 +397,6 @@ static BOOL powerBarUp = false;
|
|||
static BOOL StatsUp = false;
|
||||
static BASE_OBJECT *psStatsScreenOwner = NULL;
|
||||
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
// Size of a production run for manufacturing.
|
||||
static UBYTE ProductionRun = 1;
|
||||
#endif
|
||||
|
||||
/* pointer to hold the imd to use for a new template in the design screen */
|
||||
//iIMDShape *pNewDesignIMD = NULL;
|
||||
|
||||
/* The previous object for each object bar */
|
||||
static BASE_OBJECT *apsPreviousObj[IOBJ_MAX];
|
||||
|
||||
|
@ -463,9 +455,6 @@ static SWORD CurrentDroidType = 0;
|
|||
/* Add the power bars */
|
||||
static BOOL intAddPower(void);
|
||||
|
||||
/* Remove the power bars */
|
||||
//static void intRemovePower(void);
|
||||
|
||||
/* Set the shadow for the PowerBar */
|
||||
static void intRunPower(void);
|
||||
|
||||
|
@ -504,10 +493,8 @@ BOOL intInitialise(void)
|
|||
widgSetTipColour(WZCOL_TOOLTIP_TEXT);
|
||||
|
||||
if(GetGameMode() == GS_NORMAL) {
|
||||
// WidgSetAudio(WidgetAudioCallback,ID_SOUND_HILIGHTBUTTON,ID_SOUND_SELECT);
|
||||
WidgSetAudio(WidgetAudioCallback,-1,ID_SOUND_SELECT);
|
||||
} else {
|
||||
// WidgSetAudio(WidgetAudioCallback,FE_AUDIO_HILIGHTBUTTON,FE_AUDIO_SELECTBUT);
|
||||
WidgSetAudio(WidgetAudioCallback,-1,ID_SOUND_SELECT);
|
||||
}
|
||||
|
||||
|
@ -534,8 +521,6 @@ BOOL intInitialise(void)
|
|||
//needs to be UWORD sized for Patches
|
||||
pList = (UWORD *) malloc(sizeof (UWORD) * MAXRESEARCH);
|
||||
pSList = (UWORD *) malloc(sizeof (UWORD) * MAXRESEARCH);
|
||||
//pList = (UBYTE *) malloc(sizeof (UBYTE) * MAXRESEARCH);
|
||||
//pSList = (UBYTE *) malloc(sizeof (UBYTE) * MAXRESEARCH);
|
||||
|
||||
if (pList == NULL)
|
||||
{
|
||||
|
@ -560,19 +545,6 @@ BOOL intInitialise(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
if(GetGameMode() == GS_NORMAL) {
|
||||
//load up the 'blank' template imd
|
||||
|
||||
|
||||
/*
|
||||
if (pNewDesignIMD == NULL)
|
||||
{
|
||||
DBERROR(("Unable to load Blank Template IMD"));
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* Create storage for the feature list */
|
||||
apsFeatureList = (FEATURE_STATS **)malloc(sizeof(FEATURE_STATS *) *
|
||||
MAXFEATURES);
|
||||
|
@ -663,7 +635,6 @@ BOOL intInitialise(void)
|
|||
outlineNotOK = WZCOL_MAP_OUTLINE_BAD;
|
||||
|
||||
// reset the previous objects
|
||||
//memset(apsPreviousObj, 0, sizeof(apsPreviousObj));
|
||||
intResetPreviousObj();
|
||||
|
||||
// reset the jump positions
|
||||
|
@ -704,7 +675,6 @@ void intResetPreviousObj(void)
|
|||
/* Shut down the in game interface */
|
||||
void interfaceShutDown(void)
|
||||
{
|
||||
// widgEndScreen(psWScreen);
|
||||
widgReleaseScreen(psWScreen);
|
||||
|
||||
free(apsStructStatsList);
|
||||
|
@ -790,12 +760,7 @@ static void intDoScreenRefresh(void)
|
|||
BOOL OrderWasUp = false;
|
||||
|
||||
// If the stats form is up then remove it, but remember that it was up.
|
||||
/* if(widgGetFromID(psWScreen,IDSTAT_FORM) != NULL) {
|
||||
StatsWasUp = true;
|
||||
// intRemoveStatsNoAnim();
|
||||
}*/
|
||||
if ( (intMode == INT_STAT) &&
|
||||
widgGetFromID(psWScreen,IDSTAT_FORM) != NULL )
|
||||
if ((intMode == INT_STAT) && widgGetFromID(psWScreen,IDSTAT_FORM) != NULL)
|
||||
{
|
||||
StatsWasUp = true;
|
||||
}
|
||||
|
@ -834,10 +799,6 @@ static void intDoScreenRefresh(void)
|
|||
OrderWasUp = true;
|
||||
}
|
||||
|
||||
// if(widgGetFromID(psWScreen,IDOBJ_FORM) != NULL) {
|
||||
// intRemoveObjectNoAnim();
|
||||
// }
|
||||
|
||||
switch(objMode)
|
||||
{
|
||||
case IOBJ_MANUFACTURE: // The manufacture screen (factorys on bottom bar)
|
||||
|
@ -944,9 +905,7 @@ static void intHidePowerBar(void)
|
|||
/* Remove the options widgets from the widget screen */
|
||||
static void intRemoveOptions(void)
|
||||
{
|
||||
// widgEndScreen(psWScreen);
|
||||
widgDelete(psWScreen, IDOPT_FORM);
|
||||
// widgStartScreen(psWScreen);
|
||||
}
|
||||
|
||||
|
||||
|
@ -958,8 +917,6 @@ static BOOL intAddEdit(void)
|
|||
W_LABINIT sLabInit;
|
||||
W_BUTINIT sButInit;
|
||||
|
||||
// widgEndScreen(psWScreen);
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
@ -1014,9 +971,7 @@ static BOOL intAddEdit(void)
|
|||
/* Remove the edit widgets from the widget screen */
|
||||
static void intRemoveEdit(void)
|
||||
{
|
||||
// widgEndScreen(psWScreen);
|
||||
widgDelete(psWScreen, IDED_FORM);
|
||||
// widgStartScreen(psWScreen);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1216,11 +1171,7 @@ void intResetScreen(BOOL NoAnim)
|
|||
break;
|
||||
|
||||
case INT_MISSIONRES:
|
||||
// if(NoAnim) {
|
||||
intRemoveMissionResultNoAnim();
|
||||
// }else{
|
||||
// intRemoveMissionResult();
|
||||
// }
|
||||
break;
|
||||
|
||||
|
||||
|
@ -1242,13 +1193,11 @@ void intResetScreen(BOOL NoAnim)
|
|||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_QUIT);
|
||||
}
|
||||
|
||||
// pc
|
||||
if(!bMultiPlayer)
|
||||
{
|
||||
gameTimeStart();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case INT_INTELMAP:
|
||||
|
@ -1271,16 +1220,6 @@ void intResetScreen(BOOL NoAnim)
|
|||
|
||||
break;
|
||||
|
||||
/* case INT_TUTORIAL:
|
||||
//remove 3dView
|
||||
intRemoveMessageView();
|
||||
|
||||
if(!bMultiPlayer)
|
||||
{
|
||||
gameTimeStart();
|
||||
}
|
||||
break;*/
|
||||
|
||||
case INT_TRANSPORTER:
|
||||
if(NoAnim)
|
||||
{
|
||||
|
@ -1301,9 +1240,6 @@ void intResetScreen(BOOL NoAnim)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// calulate the center world coords for a structure stat given
|
||||
// top left tile coords
|
||||
static void intCalcStructCenter(STRUCTURE_STATS *psStats, UDWORD tilex, UDWORD tiley, uint16_t direction, UDWORD *pcx, UDWORD *pcy)
|
||||
|
@ -1393,7 +1329,6 @@ static void intProcessOptions(UDWORD id)
|
|||
intAddStats(ppsStatsList, i, NULL, NULL);
|
||||
intMode = INT_EDITSTAT;
|
||||
editPosMode = IED_NOPOS;
|
||||
// widgSetButtonState(psWScreen, IDRET_OPTIONS, 0);
|
||||
break;
|
||||
case IDOPT_STRUCT:
|
||||
intRemoveOptions();
|
||||
|
@ -1406,7 +1341,6 @@ static void intProcessOptions(UDWORD id)
|
|||
intAddStats(ppsStatsList, i, NULL, NULL);
|
||||
intMode = INT_EDITSTAT;
|
||||
editPosMode = IED_NOPOS;
|
||||
// widgSetButtonState(psWScreen, IDRET_OPTIONS, 0);
|
||||
break;
|
||||
case IDOPT_FEATURE:
|
||||
intRemoveOptions();
|
||||
|
@ -1418,7 +1352,6 @@ static void intProcessOptions(UDWORD id)
|
|||
intAddStats(ppsStatsList, i, NULL, NULL);
|
||||
intMode = INT_EDITSTAT;
|
||||
editPosMode = IED_NOPOS;
|
||||
// widgSetButtonState(psWScreen, IDRET_OPTIONS, 0);
|
||||
break;
|
||||
/* Close window buttons */
|
||||
case IDOPT_TILE:
|
||||
|
@ -1445,7 +1378,6 @@ static void intProcessOptions(UDWORD id)
|
|||
case IDOPT_CLOSE:
|
||||
intRemoveOptions();
|
||||
intMode = INT_NORMAL;
|
||||
// widgSetButtonState(psWScreen, IDRET_OPTIONS, 0);
|
||||
break;
|
||||
case IDOPT_IVISLIGHTING:
|
||||
if (pie_GetLightingState())
|
||||
|
@ -1574,8 +1506,6 @@ static void intProcessEditStats(UDWORD id)
|
|||
addConsoleMessage(buf, DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
|
||||
#endif
|
||||
}
|
||||
// else //Do we add this or does it not matter?
|
||||
// ASSERT(false,"unexpected id [%d] found!",id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1793,7 +1723,6 @@ INT_RETVAL intRunWidgets(void)
|
|||
|
||||
case IDRET_OPTIONS:
|
||||
intResetScreen(false);
|
||||
// widgSetButtonState(psWScreen, IDRET_OPTIONS, WBUT_CLICKLOCK); // commented out by ajl, now command droids menu
|
||||
(void)intAddOptions();
|
||||
intMode = INT_OPTION;
|
||||
break;
|
||||
|
@ -1837,7 +1766,7 @@ INT_RETVAL intRunWidgets(void)
|
|||
break;
|
||||
|
||||
case IDRET_INTEL_MAP:
|
||||
// //check if RMB was clicked
|
||||
// check if RMB was clicked
|
||||
if (widgGetButtonKey(psWScreen) & WKEY_SECONDARY)
|
||||
{
|
||||
//set the current message to be the last non-proximity message added
|
||||
|
@ -2037,10 +1966,6 @@ INT_RETVAL intRunWidgets(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
// if(!driveModeActive()) {
|
||||
// ((DROID *)psObjSelected)->selected = false;//deselect the droid if build command successful
|
||||
// DeSelectDroid((DROID*)psObjSelected);
|
||||
// }
|
||||
|
||||
if (!quickQueueMode)
|
||||
{
|
||||
|
@ -2230,8 +2155,6 @@ static void intRunPower(void)
|
|||
//get the research points
|
||||
psResearch = (RESEARCH *)ppResearchList[statID - IDSTAT_START];
|
||||
|
||||
|
||||
// if (asPlayerResList[selectedPlayer][psResearch - asResearch].researched != CANCELLED_RESEARCH)
|
||||
// has research been not been canceled
|
||||
if (IsResearchCancelled(&asPlayerResList[selectedPlayer][psResearch - asResearch])==0)
|
||||
{
|
||||
|
@ -2240,14 +2163,6 @@ static void intRunPower(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
// Multiply the power quantity by the size of the production run.
|
||||
if(objMode == IOBJ_MANUFACTURE) {
|
||||
quantity *= widgGetSliderPos(psWScreen,IDSTAT_SLIDER) + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//update the power bars
|
||||
intSetShadowPower(quantity);
|
||||
}
|
||||
|
@ -2261,70 +2176,6 @@ static void intRunPower(void)
|
|||
// Process stats screen.
|
||||
static void intRunStats(void)
|
||||
{
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
UDWORD statID;
|
||||
UDWORD Power = 0;
|
||||
UBYTE Quantity;
|
||||
BASE_OBJECT *psOwner;
|
||||
STRUCTURE *psStruct;
|
||||
FACTORY *psFactory;
|
||||
|
||||
if(intMode != INT_EDITSTAT && objMode == IOBJ_MANUFACTURE)
|
||||
{
|
||||
psOwner = (BASE_OBJECT *)widgGetUserData(psWScreen, IDSTAT_SLIDERCOUNT);
|
||||
psStruct = (STRUCTURE *)psOwner;
|
||||
psFactory = (FACTORY *)psStruct->pFunctionality;
|
||||
if (psFactory->psSubject)
|
||||
{
|
||||
Quantity = psFactory->quantity;
|
||||
//adjust the infinity button if necessary
|
||||
if (Quantity == NON_STOP_PRODUCTION)
|
||||
{
|
||||
widgSetButtonState(psWScreen, IDSTAT_INFINITE_BUTTON,
|
||||
WBUT_CLICKLOCK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//check if the infinite production button has been pressed
|
||||
if (widgGetButtonState(psWScreen, IDSTAT_INFINITE_BUTTON) &
|
||||
WBUT_CLICKLOCK)
|
||||
{
|
||||
Quantity = STAT_SLDSTOPS + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Quantity = (UBYTE)(widgGetSliderPos(psWScreen,IDSTAT_SLIDER) + 1);
|
||||
//Quantity = widgGetSliderPos(psWScreen,IDSTAT_SLIDER);
|
||||
}
|
||||
}
|
||||
//check for available power if not non stop production
|
||||
if (Quantity < STAT_SLDSTOPS)
|
||||
{
|
||||
/* Find out which button was hilited */
|
||||
statID = widgGetMouseOver(psWScreen);
|
||||
if (statID >= IDSTAT_START && statID <= IDSTAT_END)
|
||||
{
|
||||
//get the template build points
|
||||
Power = calcTemplatePower((DROID_TEMPLATE *)apsTemplateList[statID - IDSTAT_START]);
|
||||
if (Power * Quantity > getPower(selectedPlayer))
|
||||
{
|
||||
Quantity = (UBYTE)(getPower(selectedPlayer) / Power);
|
||||
}
|
||||
}
|
||||
}
|
||||
psFactory->quantity = Quantity;
|
||||
|
||||
// fire the tutorial trigger if neccessary
|
||||
if (bInTutorial && Quantity != ProductionRun && Quantity > 1)
|
||||
{
|
||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_MANURUN);
|
||||
}
|
||||
|
||||
ProductionRun = Quantity;
|
||||
}
|
||||
#endif
|
||||
|
||||
BASE_OBJECT *psOwner;
|
||||
STRUCTURE *psStruct;
|
||||
FACTORY *psFactory;
|
||||
|
@ -2494,10 +2345,6 @@ static void intSelectDroid(BASE_OBJECT *psObj)
|
|||
clearSel();
|
||||
((DROID*)psObj)->selected = true;
|
||||
driveSelectionChanged();
|
||||
// clearSelection();
|
||||
// ((DROID*)psObj)->selected = true;
|
||||
// StopDriverMode();
|
||||
// StartDriverMode();
|
||||
driveDisableControl();
|
||||
} else {
|
||||
clearSelection();
|
||||
|
@ -2531,7 +2378,6 @@ static void intResetWindows(BASE_OBJECT *psObj)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
//intAddObjectStats(psObj, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2657,7 +2503,6 @@ static void intProcessObject(UDWORD id)
|
|||
{
|
||||
camToggleStatus();
|
||||
}
|
||||
// intSetMapPos(asJumpPos[butIndex].x, asJumpPos[butIndex].y);
|
||||
|
||||
asJumpPos[butIndex].x = 0;
|
||||
asJumpPos[butIndex].y = 0;
|
||||
|
@ -2707,8 +2552,6 @@ static void intProcessObject(UDWORD id)
|
|||
}
|
||||
else if (psObj->type == OBJ_STRUCTURE)
|
||||
{
|
||||
// clearSelection();
|
||||
// psObj->selected = true;
|
||||
|
||||
if (StructIsFactory((STRUCTURE *)psObj))
|
||||
{
|
||||
|
@ -2933,25 +2776,6 @@ static void intProcessStats(UDWORD id)
|
|||
{
|
||||
// process the proximity blip buttons.
|
||||
}
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
else if(id == IDSTAT_INFINITE_BUTTON)
|
||||
{
|
||||
// Process the infinte button.
|
||||
//if the button is locked - unlock and vice versa
|
||||
if (widgGetButtonState(psWScreen, IDSTAT_INFINITE_BUTTON) &
|
||||
WBUT_CLICKLOCK)
|
||||
{
|
||||
//unlock
|
||||
widgSetButtonState(psWScreen, IDSTAT_INFINITE_BUTTON, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//lock
|
||||
widgSetButtonState(psWScreen, IDSTAT_INFINITE_BUTTON,
|
||||
WBUT_CLICKLOCK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(id == IDSTAT_LOOP_BUTTON)
|
||||
{
|
||||
// Process the loop button.
|
||||
|
@ -3636,9 +3460,6 @@ BOOL intAddReticule(void)
|
|||
//options button
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
SetReticuleButPos(RETBUT_COMMAND,&sButInit);
|
||||
// sButInit.x = 19+RETXOFFSET;
|
||||
// sButInit.y = 35+RETYOFFSET;
|
||||
// sButInit.pText = "O";
|
||||
sButInit.pTip = _("Commanders (F6)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_COMMANDDROID_UP;
|
||||
|
@ -3652,9 +3473,6 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
|
||||
sButInit.id = IDRET_INTEL_MAP;
|
||||
SetReticuleButPos(RETBUT_INTELMAP,&sButInit);
|
||||
// sButInit.x = 19+RETXOFFSET;
|
||||
// sButInit.y = 70+RETYOFFSET;
|
||||
// sButInit.pText = "S";
|
||||
sButInit.pTip = _("Intelligence Display (F5)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_INTELMAP_UP;
|
||||
|
@ -3668,9 +3486,6 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.id = IDRET_MANUFACTURE;
|
||||
SetReticuleButPos(RETBUT_FACTORY,&sButInit);
|
||||
// sButInit.x = 53+RETXOFFSET;
|
||||
// sButInit.y = 17+RETYOFFSET;
|
||||
// sButInit.pText = "M";
|
||||
sButInit.pTip = _("Manufacture (F1)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_MANUFACTURE_UP;
|
||||
|
@ -3684,9 +3499,6 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.id = IDRET_DESIGN;
|
||||
SetReticuleButPos(RETBUT_DESIGN,&sButInit);
|
||||
// sButInit.x = 53+RETXOFFSET;
|
||||
// sButInit.y = 88+RETYOFFSET;
|
||||
// sButInit.pText = "D";
|
||||
sButInit.pTip = _("Design (F4)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_DESIGN_UP;
|
||||
|
@ -3700,9 +3512,6 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.id = IDRET_RESEARCH;
|
||||
SetReticuleButPos(RETBUT_RESEARCH,&sButInit);
|
||||
// sButInit.x = 87+RETXOFFSET;
|
||||
// sButInit.y = 35+RETYOFFSET;
|
||||
// sButInit.pText = "R";
|
||||
sButInit.pTip = _("Research (F2)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_RESEARCH_UP;
|
||||
|
@ -3716,9 +3525,6 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.id = IDRET_BUILD;
|
||||
SetReticuleButPos(RETBUT_BUILD,&sButInit);
|
||||
// sButInit.x = 87+RETXOFFSET;
|
||||
// sButInit.y = 70+RETYOFFSET;
|
||||
// sButInit.pText = "B";
|
||||
sButInit.pTip = _("Build (F3)");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_BUILD_UP;
|
||||
|
@ -3732,11 +3538,8 @@ BOOL intAddReticule(void)
|
|||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.id = IDRET_CANCEL;
|
||||
SetReticuleButPos(RETBUT_CANCEL,&sButInit);
|
||||
// sButInit.x = 48+RETXOFFSET;
|
||||
// sButInit.y = 49+RETYOFFSET;
|
||||
sButInit.width = RET_BUTWIDTH + 10;
|
||||
sButInit.height = RET_BUTHEIGHT + 8;
|
||||
// sButInit.pText = "C";
|
||||
sButInit.pTip = _("Close");
|
||||
sButInit.pDisplay = intDisplayReticuleButton;
|
||||
sButInit.UserData = IMAGE_CANCEL_UP;
|
||||
|
@ -3744,7 +3547,6 @@ BOOL intAddReticule(void)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
// intCheckReticuleButtons();
|
||||
ReticuleUp = true;
|
||||
}
|
||||
|
||||
|
@ -3808,17 +3610,6 @@ BOOL intAddPower(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Remove the power bar widgets */
|
||||
/*void intRemovePower(void)
|
||||
{
|
||||
if (powerBarUp)
|
||||
{
|
||||
widgDelete(psWScreen, IDPOW_POWERBAR_T);
|
||||
powerBarUp = false;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Set the shadow power for the selected player */
|
||||
// Now just sets the global variable ManuPower which is used in the power bar display callback. PD
|
||||
void intSetShadowPower(UDWORD quantity)
|
||||
|
@ -3837,8 +3628,6 @@ BOOL intAddOptions(void)
|
|||
UDWORD player;
|
||||
char aText[WIDG_MAXSTR];
|
||||
|
||||
// widgEndScreen(psWScreen);
|
||||
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
memset(&sLabInit, 0, sizeof(W_LABINIT));
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
|
@ -4166,7 +3955,6 @@ BOOL intAddOptions(void)
|
|||
widgSetButtonState(psWScreen, IDOPT_IVISLIGHTING, WBUT_CLICKLOCK);
|
||||
}
|
||||
|
||||
// widgStartScreen(psWScreen);
|
||||
widgSetButtonState(psWScreen, IDOPT_PLAYERSTART + selectedPlayer, WBUT_LOCK);
|
||||
|
||||
return true;
|
||||
|
@ -4282,14 +4070,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
//order the objects according to what they are
|
||||
orderObjectInterface();
|
||||
|
||||
// wont ever get here cause if theres no research facility then the research reticule button
|
||||
// is disabled so commented out.
|
||||
// if (numObjects == 0 && objMode == IOBJ_RESEARCH)
|
||||
// {
|
||||
// audio_QueueTrack(ID_SOUND_RESEARCH_FAC_REQ);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// set the selected object if necessary
|
||||
if (psSelected == NULL)
|
||||
{
|
||||
|
@ -4476,7 +4256,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sBarInit2.y = STAT_POWERBARY;
|
||||
sBarInit2.size = 50;
|
||||
// don't set the tip cos we haven't got a suitable text string at this point - 2/2/99
|
||||
//sBarInit2.pTip = _("Build Speed");
|
||||
sBarInit2.pTip = NULL;
|
||||
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
|
@ -4555,14 +4334,13 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sBarInit2.size = WBAR_SCALE;
|
||||
}
|
||||
}
|
||||
// sBFormInit.pTip = ((DROID *)psObj)->pName;
|
||||
|
||||
sBFormInit.pTip = droidGetName((DROID *)psObj);
|
||||
|
||||
break;
|
||||
|
||||
case OBJ_STRUCTURE:
|
||||
// Get the construction power of a structure..
|
||||
// Get the construction power of a structure
|
||||
Structure = (STRUCTURE *)psObj;
|
||||
switch(Structure->pStructureType->type) {
|
||||
case REF_FACTORY:
|
||||
|
@ -4632,9 +4410,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sLabIntObjText.id++;
|
||||
}
|
||||
// Add the power bar.
|
||||
if (psObj->type != OBJ_DROID ||
|
||||
(((DROID *)psObj)->droidType == DROID_CONSTRUCT ||
|
||||
((DROID *)psObj)->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
if (psObj->type != OBJ_DROID || (((DROID *)psObj)->droidType == DROID_CONSTRUCT || ((DROID *)psObj)->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
{
|
||||
sBarInit2.formID = sBFormInit.id;
|
||||
sBarInit.iRange = GAME_TICKS_PER_SEC;
|
||||
|
@ -4661,7 +4437,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
// the experience stars
|
||||
sLabInitCmdExp.formID = sBFormInit.id;
|
||||
sLabInitCmdExp.pCallback = intUpdateCommandExp;
|
||||
// sLabInitCmdExp.pDisplay = intDisplayCommandExp;
|
||||
sLabInitCmdExp.pUserData = psObj;
|
||||
if (!widgAddLabel(psWScreen, &sLabInitCmdExp))
|
||||
{
|
||||
|
@ -4838,7 +4613,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
}
|
||||
}
|
||||
|
||||
// widgStartScreen(psWScreen);
|
||||
widgSetTabs(psWScreen, IDOBJ_TABFORM, (UWORD)displayForm, 0);
|
||||
|
||||
// if the selected object isn't on one of the main buttons (too many objects)
|
||||
|
@ -4882,7 +4656,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
intShowPowerBar();
|
||||
}
|
||||
|
||||
// if ((objMode==IOBJ_RESEARCH) && bInTutorial)
|
||||
if (bInTutorial)
|
||||
{
|
||||
debug( LOG_NEVER, "Go with object open callback!\n" );
|
||||
|
@ -4955,19 +4728,10 @@ static void intRemoveObjectNoAnim(void)
|
|||
widgDelete(psWScreen, IDOBJ_CLOSE);
|
||||
widgDelete(psWScreen, IDOBJ_FORM);
|
||||
|
||||
|
||||
|
||||
ClearObjectBuffers();
|
||||
ClearTopicBuffers();
|
||||
|
||||
intHidePowerBar();
|
||||
|
||||
/* if (bInTutorial)
|
||||
{
|
||||
DBPRINTF(("Go with object close callback!(noanim)\n"));
|
||||
eventFireCallbackTrigger(CALL_OBJECTCLOSE);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -4976,10 +4740,6 @@ void intRemoveStats(void)
|
|||
{
|
||||
W_TABFORM *Form;
|
||||
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
widgDelete(psWScreen, IDSTAT_SLIDERCOUNT);
|
||||
widgDelete(psWScreen, IDSTAT_SLIDER);
|
||||
#endif
|
||||
widgDelete(psWScreen, IDSTAT_CLOSE);
|
||||
widgDelete(psWScreen, IDSTAT_TABFORM);
|
||||
|
||||
|
@ -5002,10 +4762,6 @@ void intRemoveStats(void)
|
|||
/* Remove the stats widgets from the widget screen */
|
||||
void intRemoveStatsNoAnim(void)
|
||||
{
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
widgDelete(psWScreen, IDSTAT_SLIDERCOUNT);
|
||||
widgDelete(psWScreen, IDSTAT_SLIDER);
|
||||
#endif
|
||||
widgDelete(psWScreen, IDSTAT_CLOSE);
|
||||
widgDelete(psWScreen, IDSTAT_TABFORM);
|
||||
widgDelete(psWScreen, IDSTAT_FORM);
|
||||
|
@ -5134,22 +4890,6 @@ void HandleClosingWindows(void)
|
|||
}
|
||||
}
|
||||
|
||||
//if(ClosingMissionRes) {
|
||||
// Widg = widgGetFromID(psWScreen,IDMISSIONRES_FORM);
|
||||
// if(Widg) {
|
||||
// Has the window finished closing?
|
||||
// if( ((UDWORD)Widg->pUserData) ) {
|
||||
// intRemoveMissionResultNoAnim();
|
||||
// resetMissionPauseState(); //reset the pauses
|
||||
// }
|
||||
// } else {
|
||||
// ClosingMissionRes = false;
|
||||
// //reset the pauses
|
||||
// resetMissionPauseState();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
if(ClosingMultiMenu) {
|
||||
Widg = widgGetFromID(psWScreen,MULTIMENU_FORM);
|
||||
if(Widg) {
|
||||
|
@ -5317,10 +5057,6 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
BOOL Animate = true;
|
||||
W_LABINIT sLabInit;
|
||||
FACTORY *psFactory;
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
W_SLDINIT sSldInit;
|
||||
#endif
|
||||
//char sCaption[6];
|
||||
|
||||
// should this ever be called with psOwner == NULL?
|
||||
|
||||
|
@ -5378,84 +5114,6 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
// Add the quantity slider ( if it's a factory ).
|
||||
if(objMode == IOBJ_MANUFACTURE) {
|
||||
|
||||
//add the non stop production button
|
||||
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
||||
sButInit.formID = IDSTAT_FORM;
|
||||
sButInit.id = IDSTAT_INFINITE_BUTTON;
|
||||
sButInit.style = WBUT_PLAIN;
|
||||
sButInit.x = STAT_SLDX + STAT_SLDWIDTH + 2;
|
||||
sButInit.y = STAT_SLDY;
|
||||
sButInit.width = iV_GetImageWidth(IntImages,IMAGE_INFINITE_DOWN);
|
||||
sButInit.height = iV_GetImageHeight(IntImages,IMAGE_INFINITE_DOWN);
|
||||
// sButInit.pText = pCloseText;
|
||||
sButInit.pTip = _("Infinite Production");
|
||||
sButInit.FontID = font_regular;
|
||||
sButInit.pDisplay = intDisplayButtonPressed;
|
||||
sButInit.UserData = PACKDWORD_TRI(IMAGE_INFINITE_DOWN, IMAGE_INFINITE_HI, IMAGE_INFINITE_UP);
|
||||
if (!widgAddButton(psWScreen, &sButInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//add the number display
|
||||
memset(&sLabInit,0,sizeof(W_LABINIT));
|
||||
sLabInit.formID = IDSTAT_FORM; //0;
|
||||
sLabInit.id = IDSTAT_SLIDERCOUNT;
|
||||
sLabInit.style = WLAB_PLAIN;
|
||||
sLabInit.x = (SWORD)(STAT_SLDX + STAT_SLDWIDTH + sButInit.width + 2);
|
||||
sLabInit.y = STAT_SLDY + 3;
|
||||
sLabInit.width = 16;
|
||||
sLabInit.height = 16;
|
||||
sLabInit.FontID = font_regular;
|
||||
sLabInit.pUserData = psOwner;
|
||||
//sLabInit.pCallback = intUpdateSlider;
|
||||
sLabInit.pDisplay = intDisplayNumber;
|
||||
if (!widgAddLabel(psWScreen, &sLabInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
memset(&sSldInit, 0, sizeof(W_SLDINIT));
|
||||
sSldInit.formID = IDSTAT_FORM;
|
||||
sSldInit.id = IDSTAT_SLIDER;
|
||||
sSldInit.style = WSLD_PLAIN;
|
||||
sSldInit.x = STAT_SLDX;
|
||||
sSldInit.y = STAT_SLDY;
|
||||
sSldInit.width = STAT_SLDWIDTH;
|
||||
sSldInit.height = STAT_SLDHEIGHT;
|
||||
sSldInit.orientation = WSLD_LEFT;
|
||||
sSldInit.numStops = STAT_SLDSTOPS-1;
|
||||
sSldInit.barSize = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BUT);
|
||||
sSldInit.pos = 0;
|
||||
if ( psOwner != NULL )
|
||||
{
|
||||
psFactory = (FACTORY *)((STRUCTURE *)psOwner)->pFunctionality;
|
||||
if (psFactory->psSubject)
|
||||
{
|
||||
if (psFactory->quantity > sSldInit.numStops)
|
||||
{
|
||||
sSldInit.pos = sSldInit.numStops;
|
||||
}
|
||||
else
|
||||
{
|
||||
sSldInit.pos = (UWORD)psFactory->quantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sSldInit.pDisplay = intDisplaySlider;
|
||||
if (!widgAddSlider(psWScreen, &sSldInit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add the quantity slider ( if it's a factory ).
|
||||
if(objMode == IOBJ_MANUFACTURE)
|
||||
{
|
||||
|
@ -5626,7 +5284,6 @@ if (numForms(numStats, butPerForm)> MAX_TAB_SMALL_SHOWN) //only want these butto
|
|||
// NOTE, there is really no limit now to the # of menu items we can have,
|
||||
// It is #defined in hci.h to be 200 now. [#define MAXSTRUCTURES 200]
|
||||
//Same goes for research. [#define MAXRESEARCH 200]
|
||||
// if (( (objMode == IOBJ_MANUFACTURE) || (objMode == IOBJ_BUILD) || (objMode == IOBJ_RESEARCH)) &&
|
||||
if (sFormInit.numMajor > MAX_TAB_STD_SHOWN)
|
||||
{ //Just switching from normal sized tabs to smaller ones to fit more in form.
|
||||
sFormInit.pUserData = &SmallTab;
|
||||
|
@ -5849,8 +5506,6 @@ donelab:
|
|||
sBarInit.id += 1;
|
||||
}
|
||||
|
||||
// widgStartScreen(psWScreen);
|
||||
|
||||
/* Set the correct page and button if necessary */
|
||||
if (statID)
|
||||
{
|
||||
|
@ -5888,7 +5543,6 @@ donelab:
|
|||
/* Select a command droid */
|
||||
static BOOL selectCommand(BASE_OBJECT *psObj)
|
||||
{
|
||||
// UDWORD i;
|
||||
DROID *psDroid;
|
||||
|
||||
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
|
||||
|
@ -5926,7 +5580,6 @@ static BOOL setCommandStats(WZ_DECL_UNUSED BASE_OBJECT *psObj, WZ_DECL_UNUSED BA
|
|||
/* Select a construction droid */
|
||||
static BOOL selectConstruction(BASE_OBJECT *psObj)
|
||||
{
|
||||
// UDWORD i;
|
||||
DROID *psDroid;
|
||||
|
||||
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
|
||||
|
@ -5934,20 +5587,11 @@ static BOOL selectConstruction(BASE_OBJECT *psObj)
|
|||
psDroid = (DROID *)psObj;
|
||||
|
||||
//check the droid type
|
||||
//if ( (psDroid->droidType == DROID_CONSTRUCT) && (psDroid->died == 0) )
|
||||
if ( (psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType ==
|
||||
DROID_CYBORG_CONSTRUCT) && (psDroid->died == 0) )
|
||||
if ((psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType == DROID_CYBORG_CONSTRUCT) && (psDroid->died == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*for (i=0; i < psDroid->numProgs; i++)
|
||||
{
|
||||
if (psDroid->asProgs[i].psStats->order == ORDER_BUILD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6140,16 +5784,6 @@ static BOOL setResearchStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
|
|||
//meant to still be in the list but greyed out
|
||||
pPlayerRes = asPlayerResList[selectedPlayer] + count;
|
||||
|
||||
/*subtract the power required to research*/
|
||||
/*if (pPlayerRes->researched != CANCELLED_RESEARCH)
|
||||
{
|
||||
if (!usePower(selectedPlayer, pResearch->researchPower))
|
||||
{
|
||||
addConsoleMessage("Research: No Power",DEFAULT_JUSTIFY,SYSTEM_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
//set the subject up
|
||||
psResFacilty->psSubject = psStats;
|
||||
|
||||
|
@ -6166,12 +5800,9 @@ static BOOL setResearchStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
|
|||
sendResearchStatus(psBuilding,count,selectedPlayer,true); // inform others, I'm researching this.
|
||||
|
||||
MakeResearchStarted(pPlayerRes);
|
||||
//psResFacilty->timeStarted = gameTime;
|
||||
psResFacilty->timeStarted = ACTION_START_TIME;
|
||||
psResFacilty->timeStartHold = 0;
|
||||
//this is no longer used...AB 30/06/99
|
||||
psResFacilty->timeToResearch = pResearch->researchPoints /
|
||||
psResFacilty->researchPoints;
|
||||
psResFacilty->timeToResearch = pResearch->researchPoints / psResFacilty->researchPoints;
|
||||
//check for zero research time - usually caused by 'silly' data!
|
||||
if (psResFacilty->timeToResearch == 0)
|
||||
{
|
||||
|
@ -6243,68 +5874,6 @@ static BOOL setManufactureStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_PRODSLIDER
|
||||
if (ProductionRun == 0)
|
||||
{
|
||||
//check if its because there isn't enough power - warning if it is
|
||||
if (psStats)
|
||||
{
|
||||
(void)checkPower(selectedPlayer, ((DROID_TEMPLATE *)psStats)->powerPoints);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Structure = (STRUCTURE*)psObj;
|
||||
if (psStats != NULL)
|
||||
{
|
||||
//temp code to set non stop production up
|
||||
if (ProductionRun == STAT_SLDSTOPS)
|
||||
{
|
||||
ProductionRun = NON_STOP_PRODUCTION;
|
||||
}
|
||||
/* check power if factory not on infinte production*/
|
||||
if (ProductionRun != NON_STOP_PRODUCTION)
|
||||
{
|
||||
if (!checkPower(selectedPlayer, ((DROID_TEMPLATE *)psStats)->powerPoints))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/* Set the factory to build droid(s) */
|
||||
if (!structSetManufacture(Structure, (DROID_TEMPLATE *)psStats, ProductionRun))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*set the slider for this production */
|
||||
/*if (Quantity == 0)
|
||||
{
|
||||
widgSetSliderPos(psWScreen, IDSTAT_SLIDER, 0);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
//#ifdef INCLUDE_PRODSLIDER
|
||||
widgSetSliderPos(psWScreen, IDSTAT_SLIDER, (UWORD)(ProductionRun-1));
|
||||
//#endif
|
||||
//}
|
||||
|
||||
|
||||
} else {
|
||||
// Stop manufacturing.
|
||||
//return half the power cost if cancelled mid production
|
||||
if (((FACTORY*)Structure->pFunctionality)->timeStarted != ACTION_START_TIME)
|
||||
{
|
||||
if (((FACTORY*)Structure->pFunctionality)->psSubject != NULL)
|
||||
{
|
||||
addPower(Structure->player, ((DROID_TEMPLATE *)((FACTORY*)Structure->
|
||||
pFunctionality)->psSubject)->powerPoints / 2);
|
||||
}
|
||||
}
|
||||
((FACTORY*)Structure->pFunctionality)->quantity = 0;
|
||||
((FACTORY*)Structure->pFunctionality)->psSubject = NULL;
|
||||
intManufactureFinished(Structure);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6345,8 +5914,6 @@ static BOOL intAddManufacture(STRUCTURE *psSelected)
|
|||
objMode = IOBJ_MANUFACTURE;
|
||||
|
||||
/* Create the object screen with the required data */
|
||||
//return intAddObject((BASE_OBJECT *)apsStructLists[selectedPlayer],
|
||||
|
||||
return intAddObjectWindow((BASE_OBJECT *)interfaceStructList(),
|
||||
(BASE_OBJECT *)psSelected,true);
|
||||
}
|
||||
|
@ -6366,8 +5933,6 @@ static BOOL intAddResearch(STRUCTURE *psSelected)
|
|||
objMode = IOBJ_RESEARCH;
|
||||
|
||||
/* Create the object screen with the required data */
|
||||
//return intAddObject((BASE_OBJECT *)apsStructLists[selectedPlayer],
|
||||
|
||||
return intAddObjectWindow((BASE_OBJECT *)interfaceStructList(),
|
||||
(BASE_OBJECT *)psSelected,true);
|
||||
}
|
||||
|
@ -6387,11 +5952,8 @@ static BOOL intAddCommand(DROID *psSelected)
|
|||
objMode = IOBJ_COMMAND;
|
||||
|
||||
/* Create the object screen with the required data */
|
||||
//return intAddObject((BASE_OBJECT *)apsStructLists[selectedPlayer],
|
||||
|
||||
return intAddObjectWindow((BASE_OBJECT *)apsDroidLists[selectedPlayer],
|
||||
(BASE_OBJECT *)psSelected,true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -6558,6 +6120,7 @@ void addIntelScreen(void)
|
|||
|
||||
// Just display the 3d, no interface
|
||||
displayWorld();
|
||||
|
||||
// Upload the current display back buffer into system memory.
|
||||
pie_UploadDisplayBuffer();
|
||||
|
||||
|
@ -6568,28 +6131,6 @@ void addIntelScreen(void)
|
|||
//add all the intelligence screen interface
|
||||
(void)intAddIntelMap();
|
||||
intMode = INT_INTELMAP;
|
||||
|
||||
/*if (psCurrentMsg && psCurrentMsg->type == MSG_TUTORIAL)
|
||||
{
|
||||
//just display the message
|
||||
if (psCurrentMsg->pViewData)
|
||||
{
|
||||
intAddMessageView(psCurrentMsg->type);
|
||||
if (psCurrentMsg->pViewData->audioID != NO_AUDIO_MSG)
|
||||
{
|
||||
audio_PlayTrack(psCurrentMsg->pViewData->audioID);
|
||||
}
|
||||
intMode = INT_TUTORIAL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
widgSetButtonState(psWScreen, IDRET_INTEL_MAP, WBUT_CLICKLOCK);
|
||||
//add the power bar - for looks!
|
||||
(void)intAddPower();
|
||||
(void)intAddIntelMap(playImmediate);
|
||||
intMode = INT_INTELMAP;
|
||||
}*/
|
||||
}
|
||||
|
||||
//sets up the Transporter Screen as far as the interface is concerned
|
||||
|
@ -6621,7 +6162,6 @@ STRUCTURE* interfaceStructList(void)
|
|||
/*causes a reticule button to start flashing*/
|
||||
void flashReticuleButton(UDWORD buttonID)
|
||||
{
|
||||
|
||||
W_TABFORM *psButton;
|
||||
|
||||
//get the button for the id
|
||||
|
@ -6631,13 +6171,11 @@ void flashReticuleButton(UDWORD buttonID)
|
|||
//set flashing byte to true
|
||||
psButton->UserData = (1 << 24) | psButton->UserData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// stop a reticule button flashing
|
||||
void stopReticuleButtonFlash(UDWORD buttonID)
|
||||
{
|
||||
|
||||
WIDGET *psButton = widgGetFromID(psWScreen,buttonID);
|
||||
if (psButton)
|
||||
{
|
||||
|
@ -6651,7 +6189,6 @@ void stopReticuleButtonFlash(UDWORD buttonID)
|
|||
flashTime = 0;
|
||||
psButton->UserData = PACKDWORD_QUAD(flashTime,flashing,DownTime,Index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//displays the Power Bar
|
||||
|
@ -6709,8 +6246,6 @@ BOOL intAddProximityButton(PROXIMITY_DISPLAY *psProxDisp, UDWORD inc)
|
|||
sBFormInit.majorID = 0;
|
||||
sBFormInit.minorID = 0;
|
||||
sBFormInit.style = WFORM_CLICKABLE;
|
||||
//sBFormInit.width = iV_GetImageWidth(IntImages,IMAGE_GAM_ENMREAD);
|
||||
//sBFormInit.height = iV_GetImageHeight(IntImages,IMAGE_GAM_ENMREAD);
|
||||
sBFormInit.width = PROX_BUTWIDTH;
|
||||
sBFormInit.height = PROX_BUTHEIGHT;
|
||||
//the x and y need to be set up each time the button is drawn - see intDisplayProximityBlips
|
||||
|
@ -6973,9 +6508,7 @@ void intCheckResearchButton(void)
|
|||
if (resFree)
|
||||
{
|
||||
//set to value that won't be reached in fillResearchList
|
||||
//needs to be UWORD sized for the Patches
|
||||
index = (UWORD)(numResearch + 1);
|
||||
//index = (UBYTE)(numResearch + 1);
|
||||
//calculate the list
|
||||
count = fillResearchList(pList,selectedPlayer, index, MAXRESEARCH);
|
||||
if (count)
|
||||
|
@ -7123,7 +6656,6 @@ DROID *intGotoNextDroidType(DROID *CurrDroid,UDWORD droidType,BOOL AllowGroup)
|
|||
if(psDroid != CurrentDroid) {
|
||||
clearSel();
|
||||
SelectDroid(psDroid);
|
||||
// psDroid->selected = true;
|
||||
CurrentDroid = psDroid;
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -7142,7 +6674,6 @@ DROID *intGotoNextDroidType(DROID *CurrDroid,UDWORD droidType,BOOL AllowGroup)
|
|||
if(psDroid != CurrentDroid) {
|
||||
clearSel();
|
||||
SelectDroid(psDroid);
|
||||
// psDroid->selected = true;
|
||||
CurrentDroid = psDroid;
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -7193,4 +6724,3 @@ BOOL CoordInBuild(int x, int y)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,9 +259,6 @@ typedef enum {
|
|||
INT_MAXMODE, //leave as last so we can start the objMode at this value
|
||||
} INTMODE;
|
||||
|
||||
//NOT ANYMORE! 10/08/98 AB
|
||||
//#define INCLUDE_PRODSLIDER // Include quantity slider in manufacture window.
|
||||
|
||||
extern INTMODE intMode;
|
||||
|
||||
/* The widget screen */
|
||||
|
|
|
@ -2902,106 +2902,71 @@ void StatGetResearchImage(BASE_STATS *psStat, SDWORD *Image, iIMDShape **Shape,
|
|||
}
|
||||
}
|
||||
|
||||
/* Draws a stats bar for the design screen */
|
||||
void intDisplayStatsBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
||||
static void intDisplayBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, bool isPowerBar)
|
||||
{
|
||||
W_BARGRAPH *BarGraph = (W_BARGRAPH *)psWidget;
|
||||
SDWORD x0, y0, iX, iY;
|
||||
static char szVal[6], szCheckWidth[6] = "00000";
|
||||
char szVal[30];
|
||||
char const *szCheckWidth = "00000";
|
||||
int x0 = xOffset + BarGraph->x;
|
||||
int y0 = yOffset + BarGraph->y;
|
||||
int arbitaryOffset = 3;
|
||||
int iX, iY;
|
||||
int barWidth = 100, width;
|
||||
int i, precisionFactor = 1, value;
|
||||
|
||||
x0 = xOffset + BarGraph->x;
|
||||
y0 = yOffset + BarGraph->y;
|
||||
|
||||
// //draw the background image
|
||||
// iV_DrawImage(IntImages,IMAGE_DES_STATSBACK,x0,y0);
|
||||
|
||||
//increment for the position of the level indicator
|
||||
x0 += 3;
|
||||
y0 += 3;
|
||||
|
||||
/* indent to allow text value */
|
||||
iX = x0 + iV_GetTextWidth( szCheckWidth );
|
||||
iY = y0 + (iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR) - iV_GetTextLineSize())/2 -
|
||||
iV_GetTextAboveBase();
|
||||
|
||||
//draw current value section
|
||||
iV_DrawImageRect( IntImages, IMAGE_DES_STATSCURR, iX, y0,
|
||||
BarGraph->majorSize, iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR));
|
||||
|
||||
/* draw text value */
|
||||
sprintf(szVal, "%d", BarGraph->iOriginal);
|
||||
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
||||
iV_DrawText( szVal, x0, iY );
|
||||
|
||||
//draw the comparison value - only if not zero
|
||||
if (BarGraph->minorSize != 0)
|
||||
if (isPowerBar)
|
||||
{
|
||||
y0 -= 1;
|
||||
iV_DrawImage(IntImages,IMAGE_DES_STATSCOMP,iX+BarGraph->minorSize ,y0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Draws a Template Power Bar for the Design Screen */
|
||||
void intDisplayDesignPowerBar(WIDGET *psWidget, UDWORD xOffset,
|
||||
UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
||||
{
|
||||
W_BARGRAPH *BarGraph = (W_BARGRAPH*)psWidget;
|
||||
SDWORD x0, y0, iX, iY;
|
||||
UDWORD width, barWidth;
|
||||
static char szVal[6], szCheckWidth[6] = "00000";
|
||||
UBYTE arbitaryOffset;
|
||||
|
||||
x0 = xOffset + BarGraph->x;
|
||||
y0 = yOffset + BarGraph->y;
|
||||
|
||||
//draw the background image
|
||||
iV_DrawImage(IntImages, IMAGE_DES_POWERBAR_LEFT, x0, y0);
|
||||
iV_DrawImage(IntImages,IMAGE_DES_POWERBAR_RIGHT,
|
||||
//xOffset+psWidget->width-iV_GetImageWidth(IntImages, IMAGE_DES_POWERBAR_RIGHT),y0);
|
||||
x0 + psWidget->width-iV_GetImageWidth(IntImages, IMAGE_DES_POWERBAR_RIGHT),y0);
|
||||
iV_DrawImage(IntImages, IMAGE_DES_POWERBAR_RIGHT, x0 + psWidget->width - iV_GetImageWidth(IntImages, IMAGE_DES_POWERBAR_RIGHT), y0);
|
||||
}
|
||||
|
||||
//increment for the position of the bars within the background image
|
||||
arbitaryOffset = 3;
|
||||
// Arbitrary increment for the position of the bars
|
||||
x0 += arbitaryOffset;
|
||||
y0 += arbitaryOffset;
|
||||
|
||||
/* indent to allow text value */
|
||||
iX = x0 + iV_GetTextWidth(szCheckWidth);
|
||||
iY = y0 + (iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR) - iV_GetTextLineSize())/2 -
|
||||
iV_GetTextAboveBase();
|
||||
iY = y0 + (iV_GetImageHeight(IntImages, IMAGE_DES_STATSCURR) - iV_GetTextLineSize())/2 - iV_GetTextAboveBase();
|
||||
|
||||
if (isPowerBar)
|
||||
{
|
||||
// Adjust the width based on the text drawn
|
||||
barWidth = BarGraph->width - (iX - x0 + arbitaryOffset);
|
||||
width = BarGraph->majorSize * barWidth / 100;
|
||||
// Quick check that don't go over the end - ensure % is not > 100
|
||||
if (width > barWidth)
|
||||
{
|
||||
width = barWidth;
|
||||
}
|
||||
|
||||
//draw current value section
|
||||
iV_DrawImageRect(IntImages,IMAGE_DES_STATSCURR, iX, y0,
|
||||
width, iV_GetImageHeight(IntImages,IMAGE_DES_STATSCURR));
|
||||
width = MIN(BarGraph->majorSize * barWidth / 100, barWidth);
|
||||
iV_DrawImageRect(IntImages, IMAGE_DES_STATSCURR, iX, y0, width, iV_GetImageHeight(IntImages, IMAGE_DES_STATSCURR));
|
||||
|
||||
/* draw text value */
|
||||
sprintf(szVal, "%d", BarGraph->iOriginal);
|
||||
for (i = 0; i < BarGraph->precision; ++i)
|
||||
{
|
||||
precisionFactor *= 10;
|
||||
}
|
||||
value = (BarGraph->iOriginal * precisionFactor + BarGraph->denominator/2) / BarGraph->denominator;
|
||||
sprintf(szVal, "%d%s%.*d", value/precisionFactor, precisionFactor == 1? "" : ".", BarGraph->precision, value%precisionFactor);
|
||||
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
||||
iV_DrawText(szVal, x0, iY);
|
||||
|
||||
//draw the comparison value - only if not zero
|
||||
if (BarGraph->minorSize != 0)
|
||||
{
|
||||
y0 -= 1;
|
||||
width = BarGraph->minorSize * barWidth / 100;
|
||||
if (width > barWidth)
|
||||
width = MIN(BarGraph->minorSize * barWidth / 100, barWidth);
|
||||
iV_DrawImage(IntImages, IMAGE_DES_STATSCOMP, iX + width, y0 - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Draws a stats bar for the design screen */
|
||||
void intDisplayStatsBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
||||
{
|
||||
width = barWidth;
|
||||
}
|
||||
//iV_DrawImage(IntImages,IMAGE_DES_STATSCOMP,x0+BarGraph->minorSize ,y0);
|
||||
iV_DrawImage(IntImages, IMAGE_DES_STATSCOMP, iX + width ,y0);
|
||||
intDisplayBar(psWidget, xOffset, yOffset, false);
|
||||
}
|
||||
|
||||
/* Draws a Template Power Bar for the Design Screen */
|
||||
void intDisplayDesignPowerBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
||||
{
|
||||
intDisplayBar(psWidget, xOffset, yOffset, true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3198,9 +3198,16 @@ void runMultiOptions(void)
|
|||
}
|
||||
|
||||
if (CancelPressed())
|
||||
{
|
||||
if (multiRequestUp)
|
||||
{
|
||||
changeTitleMode(lastTitleMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
processMultiopWidgets(CON_CANCEL); // "Press" the cancel button to clean up net connections and stuff.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL startMultiOptions(BOOL bReenter)
|
||||
|
|
116
src/order.cpp
116
src/order.cpp
|
@ -1052,7 +1052,6 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
{
|
||||
DROID *psSpotter = (DROID *)psDroid->psTarget;
|
||||
|
||||
// psFireTarget = orderStateObj((DROID *)psDroid->psTarget, DORDER_OBSERVE);
|
||||
if (psSpotter->action == DACTION_OBSERVE
|
||||
|| (psSpotter->droidType == DROID_COMMAND && psSpotter->action == DACTION_ATTACK))
|
||||
{
|
||||
|
@ -1140,11 +1139,9 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
{
|
||||
// not doing anything, make sure the droid is close enough
|
||||
// to the thing it is defending
|
||||
//if ((psDroid->droidType != DROID_REPAIR) &&
|
||||
if ((!(psDroid->droidType == DROID_REPAIR || psDroid->droidType ==
|
||||
DROID_CYBORG_REPAIR)) && psDroid->psTarget != NULL &&
|
||||
psDroid->psTarget->type == OBJ_DROID &&
|
||||
((DROID *)psDroid->psTarget)->droidType == DROID_COMMAND)
|
||||
if ((!(psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR))
|
||||
&& psDroid->psTarget != NULL && psDroid->psTarget->type == OBJ_DROID
|
||||
&& ((DROID *)psDroid->psTarget)->droidType == DROID_COMMAND)
|
||||
{
|
||||
// guarding a commander, allow more space
|
||||
orderCheckGuardPosition(psDroid, DEFEND_CMD_BASEDIST);
|
||||
|
@ -1154,14 +1151,12 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
orderCheckGuardPosition(psDroid, DEFEND_BASEDIST);
|
||||
}
|
||||
}
|
||||
else if (psDroid->droidType == DROID_REPAIR ||
|
||||
psDroid->droidType == DROID_CYBORG_REPAIR)
|
||||
else if (psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR)
|
||||
{
|
||||
// repairing something, make sure the droid doesn't go too far
|
||||
orderCheckGuardPosition(psDroid, REPAIR_MAXDIST);
|
||||
}
|
||||
else if (psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
else if (psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
// repairing something, make sure the droid doesn't go too far
|
||||
orderCheckGuardPosition(psDroid, CONSTRUCT_MAXDIST);
|
||||
|
@ -1232,8 +1227,7 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
|
||||
//repair droids default to repairing droids within a given range
|
||||
psObj = NULL;
|
||||
if ((psDroid->droidType == DROID_REPAIR ||
|
||||
psDroid->droidType == DROID_CYBORG_REPAIR))
|
||||
if ((psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR))
|
||||
{
|
||||
if (psDroid->action == DACTION_NONE)
|
||||
{
|
||||
|
@ -1250,8 +1244,7 @@ void orderUpdateDroid(DROID *psDroid)
|
|||
}
|
||||
//construct droids default to repairing structures within a given range
|
||||
psObj = NULL;
|
||||
if ((psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
if ((psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
{
|
||||
if (psDroid->action == DACTION_NONE)
|
||||
{
|
||||
|
@ -2835,18 +2828,9 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
}
|
||||
}
|
||||
//check for transporters first
|
||||
if (psObj->type == OBJ_DROID && ((DROID *)psObj)->droidType == DROID_TRANSPORTER
|
||||
&& psObj->player == psDroid->player)
|
||||
if (psObj->type == OBJ_DROID && ((DROID *)psObj)->droidType == DROID_TRANSPORTER && psObj->player == psDroid->player)
|
||||
{
|
||||
order = DORDER_EMBARK;
|
||||
|
||||
//Cannot test this here since bMultiPlayer will have been set to false
|
||||
/* //in multiPlayer can only put cyborgs onto a Transporter
|
||||
if (bMultiPlayer && psDroid->droidType != DROID_CYBORG)
|
||||
{
|
||||
order = DORDER_NONE;
|
||||
}
|
||||
*/
|
||||
}
|
||||
// go to recover an artifact/oil drum - don't allow VTOL's to get this order
|
||||
else if (psObj->type == OBJ_FEATURE &&
|
||||
|
@ -2882,9 +2866,9 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
&& !aiCheckAlliances(psObj->player , psDroid->player) )
|
||||
{
|
||||
//check for standard sensor or VTOL intercept sensor
|
||||
if (asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == STANDARD_SENSOR ||
|
||||
asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == VTOL_INTERCEPT_SENSOR ||
|
||||
asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == SUPER_SENSOR)
|
||||
if (asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == STANDARD_SENSOR
|
||||
|| asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == VTOL_INTERCEPT_SENSOR
|
||||
|| asSensorStats[psDroid->asBits[COMP_SENSOR].nStat].type == SUPER_SENSOR)
|
||||
{
|
||||
// a sensor droid observing an object
|
||||
order = DORDER_OBSERVE;
|
||||
|
@ -2906,24 +2890,15 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
psDroid->droidType != DROID_COMMAND &&
|
||||
psDroid->droidType != DROID_CONSTRUCT &&
|
||||
psDroid->droidType != DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
// if (!isVtolDroid(psDroid))
|
||||
{
|
||||
// get a droid to join a command droids group
|
||||
cmdDroidAddDroid((DROID *) psObj, psDroid);
|
||||
DeSelectDroid(psDroid);
|
||||
|
||||
order = DORDER_NONE;
|
||||
}
|
||||
/* else
|
||||
{
|
||||
order = DORDER_FIRESUPPORT;
|
||||
}*/
|
||||
}
|
||||
//repair droid
|
||||
else if (aiCheckAlliances(psObj->player, psDroid->player) &&
|
||||
psObj->type == OBJ_DROID &&
|
||||
//psDroid->droidType == DROID_REPAIR &&
|
||||
(psDroid->droidType == DROID_REPAIR ||
|
||||
psDroid->droidType == DROID_CYBORG_REPAIR) &&
|
||||
droidIsDamaged((DROID *)psObj))
|
||||
|
@ -2950,8 +2925,7 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
psObj->type == OBJ_STRUCTURE )
|
||||
{
|
||||
psStruct = (STRUCTURE *) psObj;
|
||||
ASSERT( psObj != NULL,
|
||||
"chooseOrderObj: invalid structure pointer" );
|
||||
ASSERT(psObj != NULL, "Invalid structure pointer");
|
||||
|
||||
/* check whether construction droid */
|
||||
order = DORDER_NONE;
|
||||
|
@ -3007,7 +2981,6 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
/* check repair facility and in need of repair */
|
||||
if ( psStruct->pStructureType->type == REF_REPAIR_FACILITY &&
|
||||
psStruct->status == SS_BUILT)
|
||||
// ((SDWORD)(PERCENT(psDroid->body,psDroid->originalBody)) < 100) )
|
||||
{
|
||||
order = DORDER_RTR_SPECIFIED;
|
||||
}
|
||||
|
@ -3021,12 +2994,10 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
//check for counter battery assignment
|
||||
else if (structSensorDroidWeapon(psStruct, psDroid))
|
||||
{
|
||||
// secondarySetState(psDroid, DSO_HALTTYPE, DSS_HALT_HOLD);
|
||||
order = DORDER_FIRESUPPORT;
|
||||
//inform display system
|
||||
setSensorAssigned();
|
||||
//deselect droid
|
||||
// psDroid->selected = false;
|
||||
DeSelectDroid(psDroid);
|
||||
}
|
||||
//REARM VTOLS
|
||||
|
@ -3038,13 +3009,9 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
if (psStruct->pStructureType->type == REF_REARM_PAD)
|
||||
{
|
||||
//don't bother checking cos we want it to go there if directed
|
||||
//check if need to be rearmed/repaired
|
||||
//if (!vtolHappy(psDroid))
|
||||
{
|
||||
order = DORDER_REARM;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Some droids shouldn't be guarding
|
||||
else if ((psDroid->droidType == DROID_WEAPON ||
|
||||
psDroid->droidType == DROID_CYBORG ||
|
||||
|
@ -3056,13 +3023,11 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, BOOL altOrder)
|
|||
}
|
||||
}
|
||||
//check for constructor droid clearing up wrecked buildings
|
||||
else if ( (psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT) &&
|
||||
psObj->type == OBJ_FEATURE )
|
||||
else if ((psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
&& psObj->type == OBJ_FEATURE)
|
||||
{
|
||||
psFeature = (FEATURE *) psObj;
|
||||
ASSERT( psObj != NULL,
|
||||
"chooseOrderObj: invalid feature pointer" );
|
||||
ASSERT(psObj != NULL, "Invalid feature pointer");
|
||||
if (psFeature->psStats->subType == FEAT_BUILD_WRECK)
|
||||
{
|
||||
order = DORDER_CLEARWRECK;
|
||||
|
@ -3290,8 +3255,8 @@ BOOL secondarySupported(DROID *psDroid, SECONDARY_ORDER sec)
|
|||
supported = false;
|
||||
}
|
||||
// don't allow factories to be assigned to commanders during a Limbo Expand mission
|
||||
if ((sec == DSO_ASSIGN_PRODUCTION || sec == DSO_ASSIGN_CYBORG_PRODUCTION ||
|
||||
sec == DSO_ASSIGN_VTOL_PRODUCTION) && missionLimboExpand())
|
||||
if ((sec == DSO_ASSIGN_PRODUCTION || sec == DSO_ASSIGN_CYBORG_PRODUCTION || sec == DSO_ASSIGN_VTOL_PRODUCTION)
|
||||
&& missionLimboExpand())
|
||||
{
|
||||
supported = false;
|
||||
}
|
||||
|
@ -3299,13 +3264,11 @@ BOOL secondarySupported(DROID *psDroid, SECONDARY_ORDER sec)
|
|||
|
||||
case DSO_ATTACK_RANGE:
|
||||
case DSO_ATTACK_LEVEL:
|
||||
if (psDroid->droidType == DROID_REPAIR ||
|
||||
psDroid->droidType == DROID_CYBORG_REPAIR)
|
||||
if (psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR)
|
||||
{
|
||||
supported = false;
|
||||
}
|
||||
if (psDroid->droidType == DROID_CONSTRUCT ||
|
||||
psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
if (psDroid->droidType == DROID_CONSTRUCT || psDroid->droidType == DROID_CYBORG_CONSTRUCT)
|
||||
{
|
||||
supported = false;
|
||||
}
|
||||
|
@ -3386,7 +3349,6 @@ SECONDARY_STATE secondaryGetState(DROID *psDroid, SECONDARY_ORDER sec)
|
|||
return (SECONDARY_STATE)(state & DSS_RTL_MASK);
|
||||
break;
|
||||
case DSO_FIRE_DESIGNATOR:
|
||||
// *pState = state & DSS_FIREDES_MASK;
|
||||
if (cmdDroidGetDesignator(psDroid->player) == psDroid)
|
||||
{
|
||||
return DSS_FIREDES_SET;
|
||||
|
@ -3539,8 +3501,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
|
|||
CurrState = (CurrState & ~DSS_ALEV_MASK) | State;
|
||||
if (State == DSS_ALEV_NEVER)
|
||||
{
|
||||
if ( orderState(psDroid, DORDER_ATTACK) )// ||
|
||||
// orderState(psDroid, DORDER_FIRESUPPORT) )
|
||||
if (orderState(psDroid, DORDER_ATTACK))
|
||||
{
|
||||
// just kill these orders
|
||||
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
|
||||
|
@ -3755,19 +3716,9 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
|
|||
switch (State & DSS_RTL_MASK)
|
||||
{
|
||||
case DSS_RTL_REPAIR:
|
||||
// if (FindARepairFacility() != NULL)
|
||||
{
|
||||
order = DORDER_RTR;
|
||||
CurrState |= DSS_RTL_REPAIR;
|
||||
// can't clear the selection here cos it breaks
|
||||
// the secondary order screen
|
||||
// psDroid->selected = false;
|
||||
// psDroid->group = UBYTE_MAX;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// retVal = false;
|
||||
// }
|
||||
// can't clear the selection here cos it breaks the secondary order screen
|
||||
break;
|
||||
case DSS_RTL_BASE:
|
||||
order = DORDER_RTB;
|
||||
|
@ -3968,7 +3919,6 @@ void orderMoralCheck(UDWORD player)
|
|||
// too many units, don't run
|
||||
return;
|
||||
}
|
||||
// debug( LOG_NEVER, "moral check for player %d\n", player );
|
||||
|
||||
// calculate the overall leadership
|
||||
leadership = asRunData[player].leadership + 10;
|
||||
|
@ -3994,7 +3944,6 @@ void orderMoralCheck(UDWORD player)
|
|||
{
|
||||
if (check > personLShip)
|
||||
{
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
|
||||
syncDebug("Person running.");
|
||||
orderDroid(psCurr, DORDER_RUN, ModeImmediate);
|
||||
}
|
||||
|
@ -4003,7 +3952,6 @@ void orderMoralCheck(UDWORD player)
|
|||
{
|
||||
if (check > leadership)
|
||||
{
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
|
||||
syncDebug("Droid running.");
|
||||
orderDroid(psCurr, DORDER_RUN, ModeImmediate);
|
||||
}
|
||||
|
@ -4062,7 +4010,6 @@ void orderGroupMoralCheck(DROID_GROUP *psGroup)
|
|||
{
|
||||
if (check > personLShip)
|
||||
{
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
|
||||
syncDebug("Person running.");
|
||||
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y, ModeImmediate);
|
||||
}
|
||||
|
@ -4071,7 +4018,6 @@ void orderGroupMoralCheck(DROID_GROUP *psGroup)
|
|||
{
|
||||
if (check > leadership)
|
||||
{
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
|
||||
syncDebug("Droid running.");
|
||||
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y, ModeImmediate);
|
||||
}
|
||||
|
@ -4128,7 +4074,6 @@ void orderHealthCheck(DROID *psDroid)
|
|||
orderState(psDroid, DORDER_RTR) ||
|
||||
orderState(psDroid, DORDER_DESTRUCT)))
|
||||
{
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psDroid->id );
|
||||
syncDebug("Droid running.");
|
||||
orderDroidLoc(psDroid, DORDER_RUN, retreatX, retreatY, ModeImmediate);
|
||||
}
|
||||
|
@ -4138,18 +4083,12 @@ void orderHealthCheck(DROID *psDroid)
|
|||
{
|
||||
for(psCurr = psDroid->psGroup->psList; psCurr; psCurr=psCurr->psGrpNext)
|
||||
{
|
||||
if (orderState(psCurr, DORDER_RUN) ||
|
||||
orderState(psCurr, DORDER_RUNBURN) ||
|
||||
orderState(psCurr, DORDER_RETREAT) ||
|
||||
orderState(psCurr, DORDER_RTB) ||
|
||||
orderState(psCurr, DORDER_RTR) ||
|
||||
orderState(psCurr, DORDER_DESTRUCT))
|
||||
if (orderState(psCurr, DORDER_RUN) || orderState(psCurr, DORDER_RUNBURN) || orderState(psCurr, DORDER_RETREAT)
|
||||
|| orderState(psCurr, DORDER_RTB) || orderState(psCurr, DORDER_RTR) || orderState(psCurr, DORDER_DESTRUCT))
|
||||
{
|
||||
// already running - ignore
|
||||
continue;
|
||||
}
|
||||
|
||||
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
|
||||
syncDebug("Group running.");
|
||||
orderDroidLoc(psCurr, DORDER_RUN, retreatX, retreatY, ModeImmediate);
|
||||
}
|
||||
|
@ -4230,11 +4169,7 @@ BOOL getFactoryState(STRUCTURE *psStruct, SECONDARY_ORDER sec, SECONDARY_STATE *
|
|||
{
|
||||
UDWORD state;
|
||||
|
||||
if (!StructIsFactory(psStruct))
|
||||
{
|
||||
ASSERT( false, "getFactoryState: structure is not a factory" );
|
||||
return false;
|
||||
}
|
||||
ASSERT_OR_RETURN(false, StructIsFactory(psStruct), "Structure is not a factory");
|
||||
|
||||
state = ((FACTORY *)psStruct->pFunctionality)->secondaryOrder;
|
||||
|
||||
|
@ -4301,8 +4236,7 @@ void orderStructureObj(UDWORD player, BASE_OBJECT *psObj)
|
|||
psStruct->asWeaps[0].lastFired = gameTime;
|
||||
|
||||
//play 5 second countdown message
|
||||
audio_QueueTrackPos( ID_SOUND_LAS_SAT_COUNTDOWN,
|
||||
psObj->pos.x, psObj->pos.y, psObj->pos.z );
|
||||
audio_QueueTrackPos(ID_SOUND_LAS_SAT_COUNTDOWN, psObj->pos.x, psObj->pos.y, psObj->pos.z);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -3213,7 +3213,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
|
|||
objTrace(psDroid->id, "Repair not needed - move to delivery point");
|
||||
orderDroidLoc(psDroid, DORDER_MOVE,
|
||||
psRepairFac->psDeliveryPoint->coords.x,
|
||||
psRepairFac->psDeliveryPoint->coords.y, ModeImmediate);
|
||||
psRepairFac->psDeliveryPoint->coords.y, ModeQueue); // ModeQueue because delivery points are not yet synchronised!
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -3699,7 +3699,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
|
|||
objTrace(psDroid->id, "Repair complete - move to delivery point");
|
||||
orderDroidLoc( psDroid, DORDER_MOVE,
|
||||
psRepairFac->psDeliveryPoint->coords.x,
|
||||
psRepairFac->psDeliveryPoint->coords.y, ModeImmediate);
|
||||
psRepairFac->psDeliveryPoint->coords.y, ModeQueue); // ModeQueue because delivery points are not yet synchronised!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue