Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): keep a general's power row armed, and five HUD fixes

Olcay Seygan5800880b499a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5740bbda3..3d7cd7a03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -201,6 +201,9 @@ found and fixed — EA's own, not port damage.**
- Cancelling a plan is silent — nothing was built, so nothing explodes.
- Ground your units have walked stays buildable after they leave it.
- A plan opens no fog of its own, and your opponent never sees it.
+- And nothing shoots at one. A plan is invisible to the other side, so a tank that stopped and
+ opened fire on empty ground was telling that player where your base was going up before a single
+ wall existed. The first work a builder puts in ends this and the site is a target like any other.
- Your units walk straight over a plan — nothing solid is there until the builder starts work.
- The plan turns solid the instant the first work goes in, so no building goes up inside its own ghost.
- The builder starts work from where it reaches the site instead of shuffling into place first.
@@ -283,14 +286,16 @@ found and fixed — EA's own, not port damage.**
- Every button's corner markings - the hotkey, the price, the time, the number queued - sit flush in the corners instead of floating a few pixels inside them, and are set a size smaller than the button's own text: four labels at full size were eating the picture they were meant to annotate.
- The messages in the top left corner - out of money, building captured, a unit lost - are set a size smaller, the same notch the superweapon countdowns were taken down by. They are notes on the battlefield, not part of the panel, and at full size a run of them was climbing over the fight they were reporting.
- A superweapon's wait is written in plain seconds - 200, not 3:20 - so it compares with every other countdown on the screen at a glance. Once it is charged the number goes away entirely and the picture itself breathes in your colour, which is the one thing you want to catch out of the corner of your eye.
-- The countdown inside a strip picture lost its black backing plate. On a picture that small the plate was most of the picture; the number now sits straight on the sweeping clock.
+- The countdown inside a strip picture moved down into its bottom left corner and carries the unit with it - 45s, 200s - on a translucent plate. In the middle of the picture it sat on the one thing the picture is there to show, and the plate it lost when it was in the middle earns its place down in the corner, where a pale cameo was swallowing the digits and their shadow together. This applies to the superweapon countdowns in the top right as well.
- Every picture in the row stands in a tray - the same tray your general's powers stand in down in the corner, your own side's copy of it, so the American, Chinese and GLA strips each carry their own metal. The tray is turned back to front, because that bar grows out of the right hand corner and the strip grows out of the left, so its heavy rail leads the row instead of standing between every pair of pictures. It is never stretched to fit, and the trays close up behind each other by exactly what that bar closes its own up by, so the row reads as one run of metal rather than a line of loose boxes. The strip is flush against the left edge, and a black rectangle laid over the battlefield is gone.
- The queue stands up out of the corner instead of lying across the bottom of the screen. It is a column now, five pictures high, growing upward from just above the command bar with the next thing to arrive at the bottom of it - so the one picture you actually read is always in the same place, a thumb's width above the buttons, and it does not move when six more tanks are ordered. What is left over closes the column as a sixth cell wearing a "+N". A busy base used to lay its whole queue across the battlefield; now it costs one picture's width of screen, whatever it has coming, and the buildings going up on the ground stand in a second column beside it. Watching a match, that is one column per player, side by side.
- A slot in it is a slot of that bar to the pixel, at every resolution - the size is measured off the bar itself rather than guessed - so the queue is read at a glance instead of squinted at: these were postage stamps a third of that size. Ten tanks ordered back to back are one picture with an x10 in its corner rather than ten copies of the same tank eating the row, so what is left of the row still says what else is coming.
- Above the queue is a row of what is actually going up on the ground: every building your workers are raising, each with its own sweep and the seconds it still needs, soonest first. Click one and the camera goes to the site - a half-finished building under fire on the far side of the map is one click away instead of a hunt across the minimap. Nothing in that row can be cancelled by mistake: a building already standing is sold or lost, never cancelled, so Ctrl over it does nothing.
- The superweapon strip in the top right stands in the same metal, the right way round this time: it is anchored to the right hand edge and grows leftwards, which is the way that bar in the corner grows, so its rail closes the row against the edge of the screen. The black rectangle behind those pictures is gone with it, and the countdowns are the size of the ones down in the corner rather than half of it.
- A game opens with nothing selected, so your first click is not a rally point.
-- Your general's powers no longer climb the right hand edge of the screen. They sit three abreast, filling from the bottom corner where the first one has always been and wrapping upward, so a general holding eleven of them still reads as a block instead of a ladder from the radar to the sky. The keys follow the same shape: the first press picks a row, the second picks the power in it, so every power is two keys away - F1 F1 for the one in the corner, F2 F1 for the row above it. Only the keys you can press next are written on the pictures, so you are never reading eleven labels to find one, and Escape drops a row you thought better of - so does clicking a power with the mouse, and so does a couple of seconds' pause, so a key hit by mistake in a fight never turns your next one into a superweapon. Rows with nothing in them yet cannot be picked at all: early on, when you hold three powers, only the row you have answers a key.
+- Your general's powers no longer climb the right hand edge of the screen. They sit three abreast, filling from the bottom corner where the first one has always been and wrapping upward, so a general holding eleven of them still reads as a block instead of a ladder from the radar to the sky. The keys follow the same shape: the first press picks a row, the second picks the power in it, so every power is two keys away - F1 F1 for the one in the corner, F2 F1 for the row above it. Only the keys you can press next are written on the pictures, so you are never reading eleven labels to find one, and Escape drops a row you thought better of - so does clicking a power with the mouse, and so does four seconds' pause, so a key hit by mistake in a fight never turns your next one into a superweapon. Rows with nothing in them yet cannot be picked at all: early on, when you hold three powers, only the row you have answers a key.
+- The second key of that pair works now. Anything that touched the interface at all - a promotion, a unit rolling out, a building captured somewhere across the map - was quietly forgetting the row you had just picked, and in a real fight that happens several times a second, so the pair almost never completed and the powers looked as though they answered no key at all.
+- The key written on a power is drawn over its cooldown sweep instead of under it. A power still charging had its label buried by the black wedge sweeping across the picture, which is exactly when you want to know which key it is.
- The tilde key opens the general's promotions, and Escape closes them - Escape used to bring up the pause menu on top of the open screen, leaving the small exit button in its corner as the only way out. The screen is five columns wide and 1 to 5 now name them: each number sits in the corner of the science that column would sell you next, and pressing it twice buys that one - once to mark, once to spend, so a point is never gone to a key hit in a hurry. Buy the top of a chain and the number drops onto the next rung down, so a whole column goes in with one finger while the fight carries on behind you.
- `S` stops your units again; the key was simply never bound.
- Every button carries its build, research or cooldown time in the corner.
@@ -339,6 +344,7 @@ found and fixed — EA's own, not port damage.**
- A health bar keeps its size against the unit at any resolution. It was a fixed number of pixels wide and three tall, so the bigger the screen the thinner the thread over a tank.
- Health bars are in the owner's colour instead of green to red. A building going up fills its bar in that same colour as it rises, so a glance across the map says whose expansion it is - the seconds written over it already say it is not finished. A disabled building keeps the blue.
- A building's bar sits above its roof rather than inside its art.
+- The progress bar stacked over the health bar is white, wherever it turns up - a factory turning out a tank, a silo charging, a supply drop counting down to its payout. It was yellow, which is a colour the game already spends on your own units and on damage, and a strip of it sitting directly above a coloured health bar read as part of the same bar.
- Every garrisonable building shows how full it is, whoever holds it.
- A vehicle's load stays private.
- What you have selected wears a white frame just outside its bar, so a selection is still readable in a crowd where every unit carries a bar - and the bar itself keeps its owner colour all the way round.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index fc7b76dcb..a93fec8ff 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -753,7 +753,7 @@ public:
(a click, a new selection, a key that is not part of the chord, or simply time passing)
must drop it. */
void dropChord( void );
- enum { CHORD_TIMEOUT_MS = 2000 }; ///< real time, not frames: the client frame rate is uncapped
+ enum { CHORD_TIMEOUT_MS = 4000 }; ///< real time, not frames: the client frame rate is uncapped
/// is the drawable the currently selected drawable for the context sensitive UI?
Bool isDrivingContextUI( Drawable *draw ) const { return draw == m_currentSelectedDrawable; }
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index e032147d8..499142d65 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -1014,7 +1014,7 @@ protected:
void drawProductionStripColumn( Int row, Int left, Int bottomY );
const Image *productionStripTray( void ); ///< the bar's tray, mirrored, kept until the bar changes side
void stripTrayMetrics( ICoord2D *tray, ICoord2D *cameo, ICoord2D *hole, Int *step ); ///< that tray's size, its cameo hole, and the column step
- void drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seconds, Bool plainSeconds = FALSE ); ///< countdown written inside a cameo
+ void drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seconds ); ///< countdown written inside a cameo
void drawStripQuantity( Int which, Int x, Int y, Int w, Int quantity ); ///< the "xN" in a cameo's top right corner
void addSuperweaponIcon( const Image *image, Int seconds, Int percent, Bool ready, Color color );
void drawSuperweaponStrip( void ); ///< those icons, top right, soonest at the right hand end
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
index f131e57eb..a6fe71111 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
@@ -177,6 +177,9 @@ extern Real Object_shroudClearingRange( Real ownRange, Bool underConstruction, R
///< does this object go away without any death of its own - no explosion, no collapse, no rubble?
extern Bool Object_deathIsSilent( Bool underConstruction, Real constructionPercent );
+///< is there anything standing here for a weapon to shoot at, or is it still only a plan?
+extern Bool Object_isAttackableStructure( Bool underConstruction, Real constructionPercent );
+
class Object : public Thing, public Snapshot
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index 4313d4ee9..8e29c140c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -4278,7 +4278,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
// the one below it
Int stackY = healthBarRegion->lo.y - 3;
- // own producers show a yellow production-progress bar above the health bar, with seconds left at its top-left
+ // own producers show a white production-progress bar above the health bar, with seconds left at its top-left
ProductionUpdateInterface *pu = showsOwnerDetail( obj ) ? obj->getProductionUpdateInterface() : NULL;
const ProductionEntry *pe = pu ? pu->firstProduction() : NULL;
if( pe )
@@ -4291,10 +4291,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
else if( pct < 0.0f )
pct = 0.0f;
TheDisplay->drawOpenRect( healthBarRegion->lo.x, prodY, healthBoxWidth, healthBoxHeight,
- healthBoxOutlineSize, GameMakeColor( 128, 128, 0, 255 ) );
+ healthBoxOutlineSize, GameMakeColor( 255, 255, 255, 255 ) );
TheDisplay->drawFillRect( healthBarRegion->lo.x + 1, prodY + 1,
(healthBoxWidth - 2) * pct * 0.01f, healthBoxHeight - 2,
- GameMakeColor( 255, 255, 0, 255 ) );
+ GameMakeColor( 255, 255, 255, 255 ) );
Player *player = obj->getControllingPlayer();
Int totalFrames = pe->getProductionType() == PRODUCTION_UNIT
@@ -4362,7 +4362,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
//
// A superweapon charging, or a building on a timed payout (the supply drop zone), gets the
- // same yellow bar the production queue uses - stacked above it rather than on top of it,
+ // same white bar the production queue uses - stacked above it rather than on top of it,
// which is what a Chinese nuclear silo researching an upgrade while its missile charges used
// to draw: two bars and two countdowns in the same row of pixels. Only powers that carry a public timer count -
// that is the flag the superweapon list in the corner goes by.
@@ -4485,10 +4485,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
{
Int chargeY = stackY - healthBoxHeight;
TheDisplay->drawOpenRect( healthBarRegion->lo.x, chargeY, healthBoxWidth, healthBoxHeight,
- healthBoxOutlineSize, GameMakeColor( 128, 128, 0, 255 ) );
+ healthBoxOutlineSize, GameMakeColor( 255, 255, 255, 255 ) );
TheDisplay->drawFillRect( healthBarRegion->lo.x + 1, chargeY + 1,
(healthBoxWidth - 2) * chargePct * 0.01f, healthBoxHeight - 2,
- GameMakeColor( 255, 255, 0, 255 ) );
+ GameMakeColor( 255, 255, 255, 255 ) );
//
// ... and how long that is, the same way a production bar says it. A bar filling up
@@ -4521,7 +4521,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
Int textW, textH;
chargeTimeString->getSize( &textW, &textH );
chargeTimeString->draw( healthBarRegion->lo.x, chargeY - textH,
- GameMakeColor( 255, 255, 0, 255 ), GameMakeColor( 0, 0, 0, 255 ) );
+ GameMakeColor( 255, 255, 255, 255 ), GameMakeColor( 0, 0, 0, 255 ) );
}
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index 1a7c2357c..44ebf31bb 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -4969,9 +4969,14 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)
const CommandSet *commandSet;
Int i;
- // the bar is being rebuilt, so a row picked against the old one means nothing
- clearSpecialPowerShortcutRow();
- if(!player || !player->getPlayerTemplate()
+ //
+ // An armed row survives this. markUIDirty() runs the bar through here again for anything that
+ // touches the interface at all - a promotion, a unit finishing, a structure captured, a stealth
+ // unit blinking - and dozens of those happen a minute, so clearing the row here meant the second
+ // key of the chord almost never found one. What actually invalidates a row is the bar going away
+ // or coming back with fewer powers than the row names, and update() drops it for both.
+ //
+ if(!player || !player->getPlayerTemplate()
|| !player->isLocalPlayer() || m_currentlyUsedSpecialPowersButtons == 0
|| m_specialPowerShortcutButtons == NULL || m_specialPowerShortcutButtonParents == NULL)
return;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index cfaf9cc06..967b27690 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -134,24 +134,17 @@ static Int stripPixels( Int nominal )
}
//-------------------------------------------------------------------------------------------------
-/** A countdown short enough to be written inside a cameo: bare seconds while there are fewer than
- * sixty of them, m:ss once there are more. A tank takes seconds and a superweapon charges for
- * minutes, and both are written into the same little box.
- *
- * 'plainSeconds' keeps the bare count however big it gets. A superweapon is read as "how long
- * until I can fire it", and against that question 3:20 is a number you have to convert before
- * you can compare it with anything else on the screen - every other countdown the HUD writes is
- * in seconds. */
+/** A countdown written inside a cameo, always in bare seconds with the unit on it: "45s", "200s".
+ * A tank takes seconds and a superweapon charges for minutes, and both are read against every
+ * other countdown on the screen, all of which are in seconds - m:ss was a number you had to
+ * convert first. The trailing s is what stops a lone "45" reading as a count of something. */
//-------------------------------------------------------------------------------------------------
-static void formatStripSeconds( UnicodeString *text, Int seconds, Bool plainSeconds = FALSE )
+static void formatStripSeconds( UnicodeString *text, Int seconds )
{
if( seconds < 0 )
seconds = 0;
- if( seconds < 60 || plainSeconds )
- text->format( L"%d", seconds );
- else
- text->format( L"%d:%2.2d", seconds / 60, seconds % 60 );
+ text->format( L"%ds", seconds );
}
//-------------------------------------------------------------------------------------------------
@@ -6390,9 +6383,10 @@ Int InGameUI::stripRowStep( Int trayHeight )
//-------------------------------------------------------------------------------------------------
/** Write a countdown inside a cameo. The radial sweep says how much of the whole is left, which
* is a shape rather than a number: it answers "nearly" and never "eleven seconds". Both strips
- * put the number in the middle of the box, over the sweep. */
+ * put the number in the bottom left corner of the box, over the sweep - the middle is where the
+ * picture is, and a number sitting on it hid the one thing the cameo is there to show. */
//-------------------------------------------------------------------------------------------------
-void InGameUI::drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seconds, Bool plainSeconds )
+void InGameUI::drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seconds )
{
// its own string, kept between frames - see m_stripSecondsString
DisplayString *&secondsString = m_stripSecondsString[ which ];
@@ -6406,18 +6400,21 @@ void InGameUI::drawStripSeconds( Int which, Int x, Int y, Int w, Int h, Int seco
}
UnicodeString text;
- formatStripSeconds( &text, seconds, plainSeconds );
+ formatStripSeconds( &text, seconds );
secondsString->setText( text );
Int textWidth = 0, textHeight = 0;
secondsString->getSize( &textWidth, &textHeight );
- const Int textX = x + ( w - textWidth ) / 2;
- const Int textY = y + ( h - textHeight ) / 2;
+ const Int textX = x + 1;
+ const Int textY = y + h - textHeight - 1;
+
+ // a plate under it: down in the corner the number sits on whatever the picture happens to be
+ // there, and a pale cameo swallowed the drop shadow along with the digits
+ if( textWidth > 0 && textHeight > 0 )
+ TheDisplay->drawFillRect( textX - 1, textY, textWidth + 2, textHeight,
+ GameMakeColor( 0, 0, 0, 160 ) );
- // no plate under it: the cameo is already under the sweep's scrim, and a second black box
- // inside a sixteen pixel box was most of the cameo - the number read as a label stuck over
- // the picture instead of a countdown running on it. The drop shadow carries it.
secondsString->draw( textX, textY, GameMakeColor( 245, 245, 245, 255 ),
GameMakeColor( 0, 0, 0, 255 ) );
}
@@ -6635,7 +6632,7 @@ void InGameUI::drawSuperweaponStrip( void )
if( !slot->ready )
drawStripSeconds( PRODUCTION_STRIP_ROWS * PRODUCTION_STRIP_ROW_MAX + first + secondsSlot,
- x, y, cameoW, cameoH, slot->seconds, TRUE );
+ x, y, cameoW, cameoH, slot->seconds );
}
// the border is whose weapon it is - the colour the timer was registered with
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
index 71360d073..c2b1cc963 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
@@ -5334,6 +5334,17 @@ Bool Object_deathIsSilent( Bool underConstruction, Real constructionPercent )
return Object_isAwaitingBuilder( underConstruction, constructionPercent );
}
+//-------------------------------------------------------------------------------------------------
+/** And nothing standing is nothing to shoot at either. A plan clears no shroud and is drawn only
+ * for the player who placed it, so an enemy cannot see it - a unit that stopped and opened fire
+ * on one was reporting where a base was going up to a player who had no way of knowing. The
+ * first percent of work ends this and the structure is a target like any other from there. */
+//-------------------------------------------------------------------------------------------------
+Bool Object_isAttackableStructure( Bool underConstruction, Real constructionPercent )
+{
+ return !Object_isAwaitingBuilder( underConstruction, constructionPercent );
+}
+
Real Object::getShroudClearingRange() const
{
Real shroudClearingRange = Object_shroudClearingRange( m_shroudClearingRange,
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
index 1b9b44869..0af994b83 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
@@ -480,6 +480,17 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac
if (victim->isKindOf(KINDOF_UNATTACKABLE))
return ATTACKRESULT_NOT_POSSIBLE;
+ //
+ // A planned structure standing at zero percent with its builder still walking over is nothing
+ // anyone can shoot. It clears no shroud and it is drawn only for its own player, so an enemy
+ // cannot see it at all - and something invisible to one side that its units still stop and
+ // shoot at is a free scouting report on where a base is going up. It stops being a plan the
+ // moment the builder puts the first percent in, and from there it is a building like any other.
+ //
+ if (!Object_isAttackableStructure(victim->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION),
+ victim->getConstructionPercent()))
+ return ATTACKRESULT_NOT_POSSIBLE;
+
// this object is not currently auto-acquireable
if (victim->testStatus(OBJECT_STATUS_NO_ATTACK_FROM_AI) && commandSource == CMD_FROM_AI)
return ATTACKRESULT_NOT_POSSIBLE;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
index 8e96d7db9..ca9353696 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp
@@ -430,9 +430,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData )
} // end if
- // draw the button text
- if( instData->getTextLength() )
- drawButtonText( window, instData );
+ // the button text is drawn after the clock overlay, further down
// if we have a video buffer, draw the video buffer
if ( instData->m_videoBuffer )
@@ -461,7 +459,7 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData )
}
// the clock is not consumed by drawing it - see GadgetButtonDrawClock
}
-
+
if( pData->drawBorder && pData->colorBorder != GAME_COLOR_UNDEFINED )
{
TheDisplay->drawOpenRect(origin.x -1, origin.y - 1, size.x + 2, size.y + 2,1 , pData->colorBorder);
@@ -480,6 +478,11 @@ void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData )
drawButtonBar( window, pData->barPercent, pData->barColor );
}
+ // the text goes on last: the cooldown clock sweeps across the whole button and used to
+ // bury the shortcut key letter under it
+ if( instData->getTextLength() )
+ drawButtonText( window, instData );
+
} // end W3DGadgetPushButtonDraw
@@ -605,9 +608,7 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window,
TheDisplay->drawImage( image, start.x, start.y, end.x, end.y, colorMultiplier, drawMode );
} // end if
- // draw the button text
- if( instData->getTextLength() )
- drawButtonText( window, instData );
+ // the button text is drawn at the very end, after the clock and the state overlays
// get window position
window->winGetScreenPosition( &start.x, &start.y );
@@ -701,6 +702,12 @@ void W3DGadgetPushButtonImageDrawOne( GameWindow *window,
}
}
}
+
+ // the text goes on last: the cooldown clock and the state overlays both sweep across the
+ // whole button and used to bury the shortcut key letter under them
+ if( instData->getTextLength() )
+ drawButtonText( window, instData );
+
} // end W3DGadgetPushButtonImageDraw
@@ -874,10 +881,8 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst
end.y = start.y + size.y;
TheWindowManager->winDrawImage(rightImage, start.x, start.y, end.x, end.y);
}
-
- // draw the button text
- if( instData->getTextLength() )
- drawButtonText( window, instData );
+
+ // the button text is drawn at the very end, after the clock overlay
// get window position
window->winGetScreenPosition( &start.x, &start.y );
@@ -929,4 +934,9 @@ void W3DGadgetPushButtonImageDrawThree(GameWindow *window, WinInstanceData *inst
if( pData->barPercent >= 0 )
drawButtonBar( window, pData->barPercent, pData->barColor );
}
+
+ // the text goes on last: the cooldown clock sweeps across the whole button and used to
+ // bury the shortcut key letter under it
+ if( instData->getTextLength() )
+ drawButtonText( window, instData );
}
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index ca5ff1bac..08c0115ec 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -5569,6 +5569,24 @@ TEST(a_structure_waiting_for_its_builder_is_drawn_as_a_silhouette)
CHECK( Drawable_effectiveOpacity( 1.0f, 1.0f, TRUE ) != 1.0f );
}
+/** A plan is not a target. It clears no shroud and is drawn only for the player who placed it, so
+ an enemy has no way of seeing it - and a unit that stopped and shot at one told that enemy
+ exactly where a base was going up. WeaponSet::getAbleToAttackSpecificObject rejects a victim
+ this says nothing is standing on. */
+TEST(a_structure_waiting_for_its_builder_cannot_be_shot_at)
+{
+ CHECK( Object_isAttackableStructure( TRUE, 0.0f ) == FALSE );
+
+ // the builder arrives and it is a building like any other
+ CHECK( Object_isAttackableStructure( TRUE, 0.1f ) == TRUE );
+ CHECK( Object_isAttackableStructure( TRUE, 99.9f ) == TRUE );
+
+ // and everything that is not a structure going up is a target: a finished building carries
+ // CONSTRUCTION_COMPLETE, a unit is simply not under construction
+ CHECK( Object_isAttackableStructure( FALSE, CONSTRUCTION_COMPLETE ) == TRUE );
+ CHECK( Object_isAttackableStructure( FALSE, 0.0f ) == TRUE );
+}
+
/** The first percent of work is what ends the plan, so the moment the builder arrives and starts
the structure turns solid and stays solid for the rest of its life. A finished building carries
CONSTRUCTION_COMPLETE (-1) and must not be mistaken for one sitting at zero. */