Skip to content
Permalink
Browse files

Remove optimal/short/long range GUI elements.

  • Loading branch information
perim committed Jul 28, 2012
1 parent a7f8e68 commit 244c8ec1418d21484499d9a1f79f7afeb9330b86
Showing with 14 additions and 97 deletions.
  1. +4 −21 src/action.cpp
  2. +0 −1 src/cmddroid.cpp
  3. +3 −19 src/intorder.cpp
  4. +0 −18 src/keybind.cpp
  5. +0 −4 src/keybind.h
  6. +3 −6 src/keymap.cpp
  7. +3 −21 src/order.cpp
  8. +1 −2 src/orderdef.h
  9. +0 −1 src/scripttabs.cpp
  10. +0 −4 src/structure.cpp
@@ -185,31 +185,14 @@ static bool actionInAttackRange(DROID *psDroid, BASE_OBJECT *psObj, int weapon_s
}
else
{
switch (psDroid->secondaryOrder & DSS_ARANGE_MASK)
if (weaponShortHit(psStats, psDroid->player) > weaponLongHit(psStats, psDroid->player))
{
case DSS_ARANGE_DEFAULT:
if (weaponShortHit(psStats, psDroid->player) > weaponLongHit(psStats, psDroid->player))
{
rangeSq = psStats->shortRange * psStats->shortRange;
}
else
{
longRange = proj_GetLongRange(psStats);
rangeSq = longRange * longRange;
}
break;
case DSS_ARANGE_SHORT:
rangeSq = psStats->shortRange * psStats->shortRange;
break;
case DSS_ARANGE_LONG:
longRange = proj_GetLongRange(psStats);
rangeSq = longRange * longRange;
break;
default:
ASSERT(!"unknown attackrange order", "unknown attack range order");
}
else
{
longRange = proj_GetLongRange(psStats);
rangeSq = longRange * longRange;
break;
}
}

@@ -97,7 +97,6 @@ void cmdDroidAddDroid(DROID *psCommander, DROID *psDroid)
psDroid->group = UBYTE_MAX;

// set the secondary states for the unit
secondarySetState(psDroid, DSO_ATTACK_RANGE, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_ARANGE_MASK), ModeImmediate);
secondarySetState(psDroid, DSO_REPAIR_LEVEL, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_REPLEV_MASK), ModeImmediate);
secondarySetState(psDroid, DSO_ATTACK_LEVEL, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_ALEV_MASK), ModeImmediate);
secondarySetState(psDroid, DSO_HALTTYPE, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_HALT_MASK), ModeImmediate);
@@ -194,20 +194,6 @@ static const char *getDORDDescription(int id)
// Define the order button groups.
ORDERBUTTONS OrderButtons[NUM_ORDERS]=
{
{
ORDBUTCLASS_NORMAL,
DSO_ATTACK_RANGE,
DSS_ARANGE_MASK,
ORD_BTYPE_RADIO,
ORD_JUSTIFY_CENTER | ORD_JUSTIFY_NEWLINE,
IDORDER_ATTACK_RANGE,
3,0,
{IMAGE_ORD_RANGE3UP, IMAGE_ORD_RANGE1UP, IMAGE_ORD_RANGE2UP},
{IMAGE_ORD_RANGE3UP, IMAGE_ORD_RANGE1UP, IMAGE_ORD_RANGE2UP},
{IMAGE_DES_HILIGHT, IMAGE_DES_HILIGHT, IMAGE_DES_HILIGHT},
{STR_DORD_RANGE3, STR_DORD_RANGE1, STR_DORD_RANGE2},
{DSS_ARANGE_DEFAULT, DSS_ARANGE_SHORT, DSS_ARANGE_LONG}
},
{
ORDBUTCLASS_NORMAL,
DSO_REPAIR_LEVEL,
@@ -529,15 +515,13 @@ static std::vector<AVORDER> buildStructureOrderList(STRUCTURE *psStructure)

//this can be hard-coded!
std::vector<AVORDER> orders(4);
orders[0].OrderIndex = 0;//DSO_ATTACK_RANGE;
orders[1].OrderIndex = 1;//DSO_REPAIR_LEVEL;
orders[2].OrderIndex = 2;//DSO_ATTACK_LEVEL;
orders[3].OrderIndex = 5;//DSO_HALTTYPE;
orders[0].OrderIndex = 1;//DSO_REPAIR_LEVEL;
orders[1].OrderIndex = 2;//DSO_ATTACK_LEVEL;
orders[2].OrderIndex = 5;//DSO_HALTTYPE;

return orders;
}


// return the state for an order for all the units selected
// if there are multiple states then don't return a state
static SECONDARY_STATE GetSecondaryStates(SECONDARY_ORDER sec)
@@ -2315,24 +2315,6 @@ void kf_SelectAllSameType( void )
selDroidSelection(selectedPlayer,DS_BY_TYPE,DST_ALL_SAME,false);
}

// --------------------------------------------------------------------------
void kf_SetDroidRangeShort( void )
{
kfsf_SetSelectedDroidsState(DSO_ATTACK_RANGE,DSS_ARANGE_SHORT);
}

// --------------------------------------------------------------------------
void kf_SetDroidRangeDefault( void )
{
kfsf_SetSelectedDroidsState(DSO_ATTACK_RANGE,DSS_ARANGE_DEFAULT);
}

// --------------------------------------------------------------------------
void kf_SetDroidRangeLong( void )
{
kfsf_SetSelectedDroidsState(DSO_ATTACK_RANGE,DSS_ARANGE_LONG);
}

// --------------------------------------------------------------------------
void kf_SetDroidRetreatMedium( void )
{
@@ -145,10 +145,6 @@ void kf_SelectAllLandCombatUnits();
void kf_SelectAllCombatCyborgs();
extern void kf_SelectAllSameType( void );

extern void kf_SetDroidRangeShort( void );
extern void kf_SetDroidRangeDefault( void );
extern void kf_SetDroidRangeLong( void );

extern void kf_SetDroidRetreatMedium( void );
extern void kf_SetDroidRetreatHeavy( void );
extern void kf_SetDroidRetreatNever( void );
@@ -159,15 +159,15 @@ _keymapsave keyMapSaveTable[] =
kf_SetDroidAttackReturn ,
kf_SetDroidAttackAtWill ,
kf_SetDroidReturnToBase ,
kf_SetDroidRangeDefault,
kf_NOOP,
kf_ToggleFormationSpeedLimiting,
kf_SetDroidRangeShort,
kf_NOOP,
kf_SetDroidMovePursue ,
kf_SetDroidMovePatrol ,
kf_SetDroidGoForRepair ,
kf_SetDroidMoveHold ,
kf_SendTextMessage,
kf_SetDroidRangeLong,
kf_NOOP,
kf_ScatterDroids,
kf_SetDroidRetreatMedium,
kf_SetDroidRetreatHeavy,
@@ -400,15 +400,12 @@ void keyInitMappings( bool bForceDefaults )
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_F, KEYMAP_PRESSED, kf_SetDroidAttackAtWill, N_("Fire at Will"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_G, KEYMAP_PRESSED, kf_SetDroidMoveGuard, N_("Guard Position"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_H, KEYMAP_PRESSED, kf_SetDroidReturnToBase, N_("Return to HQ"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_I, KEYMAP_PRESSED, kf_SetDroidRangeDefault, N_("Optimum Range"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_O, KEYMAP_PRESSED, kf_SetDroidRangeShort, N_("Short Range"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_P, KEYMAP_PRESSED, kf_SetDroidMovePursue, N_("Pursue"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_Q, KEYMAP_PRESSED, kf_SetDroidMovePatrol, N_("Patrol"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_R, KEYMAP_PRESSED, kf_SetDroidGoForRepair, N_("Return For Repair"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_S, KEYMAP_PRESSED, kf_SetDroidMoveHold, N_("Hold Position"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_T, KEYMAP_PRESSED, kf_SetDroidGoToTransport, N_("Go to Transport"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_RETURN, KEYMAP_PRESSED, kf_SendTextMessage, N_("Send Text Message"));
keyAddMapping(KEYMAP_ASSIGNABLE, KEY_IGNORE, KEY_U, KEYMAP_PRESSED, kf_SetDroidRangeLong, N_("Long Range"));

keyAddMapping(KEYMAP_ASSIGNABLE, KEY_LALT, KEY_H, KEYMAP_PRESSED, kf_AddHelpBlip, N_("Drop a beacon"));

@@ -3005,7 +3005,6 @@ bool secondarySupported(DROID *psDroid, SECONDARY_ORDER sec)
}
break;

case DSO_ATTACK_RANGE:
case DSO_ATTACK_LEVEL:
if (psDroid->droidType == DROID_REPAIR || psDroid->droidType == DROID_CYBORG_REPAIR)
{
@@ -3062,9 +3061,6 @@ SECONDARY_STATE secondaryGetState(DROID *psDroid, SECONDARY_ORDER sec, QUEUE_MOD

switch (sec)
{
case DSO_ATTACK_RANGE:
return (SECONDARY_STATE)(state & DSS_ARANGE_MASK);
break;
case DSO_REPAIR_LEVEL:
return (SECONDARY_STATE)(state & DSS_REPLEV_MASK);
break;
@@ -3231,10 +3227,6 @@ bool secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
uint32_t secondarySet = 0;
switch (sec)
{
case DSO_ATTACK_RANGE:
secondaryMask = DSS_ARANGE_MASK;
secondarySet = State;
break;
case DSO_REPAIR_LEVEL:
secondaryMask = DSS_REPLEV_MASK;
secondarySet = State;
@@ -3321,6 +3313,7 @@ bool secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
secondarySet |= DSS_HALT_GUARD;
}
break;
case DSO_UNUSED:
case DSO_FIRE_DESIGNATOR:
// Do nothing.
break;
@@ -3353,10 +3346,6 @@ bool secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
retVal = true;
switch (sec)
{
case DSO_ATTACK_RANGE:
CurrState = (CurrState & ~DSS_ARANGE_MASK) | State;
break;

case DSO_REPAIR_LEVEL:
CurrState = (CurrState & ~DSS_REPLEV_MASK) | State;
psDroid->secondaryOrder = CurrState;
@@ -3760,7 +3749,6 @@ void secondarySetAverageGroupState(UDWORD player, UDWORD group)
#define MAX_ORDERS 4
struct { SECONDARY_ORDER order; UDWORD mask; } aOrders[MAX_ORDERS] =
{
{ DSO_ATTACK_RANGE, DSS_ARANGE_MASK },
{ DSO_REPAIR_LEVEL, DSS_REPLEV_MASK },
{ DSO_ATTACK_LEVEL, DSS_ALEV_MASK },
{ DSO_HALTTYPE, DSS_HALT_MASK }
@@ -4003,11 +3991,8 @@ bool setFactoryState(STRUCTURE *psStruct, SECONDARY_ORDER sec, SECONDARY_STATE S
CurrState = psFactory->secondaryOrder;

retVal = true;
switch (sec) {
case DSO_ATTACK_RANGE:
CurrState = (CurrState & ~DSS_ARANGE_MASK) | State;
break;

switch (sec)
{
case DSO_REPAIR_LEVEL:
CurrState = (CurrState & ~DSS_REPLEV_MASK) | State;
break;
@@ -4066,9 +4051,6 @@ bool getFactoryState(STRUCTURE *psStruct, SECONDARY_ORDER sec, SECONDARY_STATE *

switch (sec)
{
case DSO_ATTACK_RANGE:
*pState = (SECONDARY_STATE)(state & DSS_ARANGE_MASK);
break;
case DSO_REPAIR_LEVEL:
*pState = (SECONDARY_STATE)(state & DSS_REPLEV_MASK);
break;
@@ -81,7 +81,7 @@ typedef DroidOrderType DROID_ORDER;
/** All the possible secondary orders for droids. */
enum SECONDARY_ORDER
{
DSO_ATTACK_RANGE, /**< The attack range a given droid is allowed to fire: can be short, long or default (best chance to hit). */
DSO_UNUSED,
DSO_REPAIR_LEVEL, /**< The repair level at which the droid falls back to repair: can be low, high or never. Used with DSS_REPLEV_LOW, DSS_REPLEV_HIGH, DSS_REPLEV_NEVER. */
DSO_ATTACK_LEVEL, /**< The attack level at which a droid can attack: can be always, attacked or never. Used with DSS_ALEV_ALWAYS, DSS_ALEV_ATTACKED, DSS_ALEV_NEVER. */
DSO_ASSIGN_PRODUCTION, /**< Assigns a factory to a command droid - the state is given by the factory number. */
@@ -125,7 +125,6 @@ enum SECONDARY_STATE
};

/** masks for the secondary order state. */
#define DSS_ARANGE_MASK 0x000003
#define DSS_REPLEV_MASK 0x00000c
#define DSS_ALEV_MASK 0x000030
#define DSS_HALT_MASK 0x0000c0
@@ -1850,7 +1850,6 @@ CONST_SYMBOL asConstantTable[] =
{ "DACTION_FIRESUPPORT_RETREAT",VAL_INT, false, DACTION_FIRESUPPORT_RETREAT,NULL, NULL, 0.0f },

// secondary orders
{ "DSO_ATTACK_RANGE", VAL_INT, false, DSO_ATTACK_RANGE, NULL, NULL, 0.0f },
{ "DSO_REPAIR_LEVEL", VAL_INT, false, DSO_REPAIR_LEVEL, NULL, NULL, 0.0f },
{ "DSO_ATTACK_LEVEL", VAL_INT, false, DSO_ATTACK_LEVEL, NULL, NULL, 0.0f },
{ "DSO_RECYCLE", VAL_INT, false, DSO_RECYCLE, NULL, NULL, 0.0f },
@@ -2356,10 +2356,6 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
{
uint32_t newState = psStructure->pFunctionality->factory.secondaryOrder;
uint32_t diff = newState ^ psNewDroid->secondaryOrder;
if ((diff & DSS_ARANGE_MASK) != 0)
{ // TODO Should synchronise factory.secondaryOrder and flag positions.
secondarySetState(psNewDroid, DSO_ATTACK_RANGE, (SECONDARY_STATE)(newState & DSS_ARANGE_MASK));
}
if ((diff & DSS_REPLEV_MASK) != 0)
{
secondarySetState(psNewDroid, DSO_REPAIR_LEVEL, (SECONDARY_STATE)(newState & DSS_REPLEV_MASK));

0 comments on commit 244c8ec

Please sign in to comment.
You can’t perform that action at this time.