Permalink
Browse files

The 'showorders' cheat now shows orders on every unit.

  • Loading branch information...
perim committed Nov 3, 2017
1 parent a81b3cf commit 34383827cf7f2347b2545201e8947ffeededba84
Showing with 63 additions and 0 deletions.
  1. +15 −0 src/display3d.cpp
  2. +47 −0 src/order.cpp
  3. +1 −0 src/order.h
View
@@ -110,6 +110,7 @@ static void drawRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius);
static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure, const glm::mat4 &viewMatrix);
static void doConstructionLines(const glm::mat4 &viewMatrix);
static void drawDroidCmndNo(DROID *psDroid);
static void drawDroidOrder(const DROID *psDroid);
static void drawDroidRank(DROID *psDroid);
static void drawDroidSensorLock(DROID *psDroid);
static void calcAverageTerrainHeight(iView *player);
@@ -2873,6 +2874,10 @@ static void drawDroidSelections()
/* Go thru' all the droidss */
for (const DROID *psDroid = apsDroidLists[i]; psDroid; psDroid = psDroid->psNext)
{
if (showORDERS)
{
drawDroidOrder(psDroid);
}
if (i != selectedPlayer && !psDroid->died && psDroid->sDisplay.frameNumber == currentGameFrame)
{
/* If it's selected */
@@ -2958,6 +2963,16 @@ static void drawDroidGroupNumber(DROID *psDroid)
/// X offset to display the group number at
#define CMND_STAR_X_OFFSET (6)
#define CMND_GN_Y_OFFSET (8)
static void drawDroidOrder(const DROID *psDroid)
{
const int xShift = psDroid->sDisplay.screenR + GN_X_OFFSET;
const int yShift = psDroid->sDisplay.screenR - CMND_GN_Y_OFFSET;
const char *letter = getDroidOrderKey(psDroid->order.type);
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
iV_DrawText(letter, psDroid->sDisplay.screenX - xShift - CMND_STAR_X_OFFSET, psDroid->sDisplay.screenY + yShift, font_regular);
}
/// Draw the number of the commander the droid is assigned to
static void drawDroidCmndNo(DROID *psDroid)
{
View
@@ -4035,3 +4035,50 @@ const char *getDroidOrderName(DROID_ORDER order)
return "DORDER_#INVALID#";
}
const char *getDroidOrderKey(DROID_ORDER order)
{
switch (order)
{
case DORDER_NONE: return "N";
case DORDER_STOP: return "Stop";
case DORDER_MOVE: return "M";
case DORDER_ATTACK: return "A";
case DORDER_BUILD: return "B";
case DORDER_HELPBUILD: return "hB";
case DORDER_LINEBUILD: return "lB";
case DORDER_DEMOLISH: return "D";
case DORDER_REPAIR: return "R";
case DORDER_OBSERVE: return "O";
case DORDER_FIRESUPPORT: return "F";
case DORDER_RETREAT: return "RET";
case DORDER_UNUSED_2: return "Err";
case DORDER_RTB: return "RTB";
case DORDER_RTR: return "RTR";
case DORDER_RUN: return "RUN";
case DORDER_EMBARK: return "E";
case DORDER_DISEMBARK: return "!E";
case DORDER_ATTACKTARGET: return "AT";
case DORDER_COMMANDERSUPPORT: return "CS";
case DORDER_BUILDMODULE: return "BM";
case DORDER_RECYCLE: return "RCY";
case DORDER_TRANSPORTOUT: return "To";
case DORDER_TRANSPORTIN: return "Ti";
case DORDER_TRANSPORTRETURN: return "Tr";
case DORDER_GUARD: return "G";
case DORDER_DROIDREPAIR: return "DR";
case DORDER_RESTORE: return "RES";
case DORDER_SCOUT: return "S";
case DORDER_UNUSED_3: return "Err";
case DORDER_UNUSED: return "Err";
case DORDER_PATROL: return "P";
case DORDER_REARM: return "RE";
case DORDER_RECOVER: return "RCV";
case DORDER_LEAVEMAP: return "L";
case DORDER_RTR_SPECIFIED: return "RTR";
case DORDER_CIRCLE: return "C";
case DORDER_HOLD: return "H";
};
ASSERT(false, "DROID_ORDER out of range: %u", order);
return "Err";
}
View
@@ -128,6 +128,7 @@ void orderGroupMoralCheck(DROID_GROUP *psGroup);
/** \brief Gets the name of an order. */
const char *getDroidOrderName(DROID_ORDER order);
const char *getDroidOrderKey(DROID_ORDER order);
/** \brief Gets a player's transporter. */
DROID *FindATransporter(DROID const *embarkee);

0 comments on commit 3438382

Please sign in to comment.