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(gameclient): money never wraps, shift rows follow the drag angle

Olcay Seyganbb8ce3333b7f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33a7e8e2a..45100a0d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -625,7 +625,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- A minimised command bar stays minimised. Changing seats, or clicking another player's unit while watching, put the whole bar back up over the battlefield you had just cleared. A new match still opens with the bar up.
- The command bar's frame is drawn new, in the same steel as the boards. Each panel holds one thing and is exactly its size, the radar, the command grid, the portrait with the experience bar, and wears a steel border outside it. Grey for America, red for China, sand for GLA. It slides and minimises with the bar, and like the boards it is a page in the Window folder; take the page away and the old painted bar comes back.
- The command bar is laid out anew, all of it running rightwards from the bottom left corner, and it is smaller: at 1920x1080 it stands 248 pixels tall where the old bar took 312, and it ends a third of the way across, so the rest of the screen's bottom edge is battlefield but for the general's powers in the corner. The radar sits in the corner, taller than before so its top lines up with the power bar's, with your general's experience bar standing beside it, and on its top edge the under-attack light, the skills key with your rank's stars on that, and over the stars the idle worker button whenever a worker stands idle. Next to it is one grid of eighteen buttons, six across and three down, and every button is its own key: Q W E R T Y over A S D F G H over Z X C V B N. No more two-key building shortcuts and no second bars: a dozer's buildings, a factory's units, a unit's abilities and upgrades and its orders all share the grid, each a single press. The orders stay put whatever you select. For a unit, A attacks, S stops, D attack-moves, V moves, Z ejects the passengers, X guards and C holds position; for a building, N sells it, B sets its rally point and Z empties its garrison. Workers keep three of their own: N clears mines on every side's worker and dozer, H swaps a GLA worker between real and fake buildings, and B is the Demolition worker's suicide charge. Everything else packs into the top left corner, two rows at a time, Q A W Z S E X D R C and on, so the buildings you reach for most sit under your fingers; what a building makes comes first and its upgrades after. Only the buttons your selection has are drawn, and with nothing selected the grid stays as a plate of bare steel. Its buttons are a fifth bigger than the rest of the bar's, so what you build stands out. Attack, hold position and move are buttons now, where no unit ever had one, with pictures painted to sit among the game's own: a crosshair on a red plate over a burning sky, a raised palm on a blue one, an arrow on a green diamond. V, or a click on the arrow, is a move for the left button: the next click on the ground sends the selection there, and a left drag lays them out along the line you draw. Beside the grid, on the bottom edge of the screen, runs a portrait bar only as long as what it holds. Select one unit and its upgrades follow its portrait; select a group and the bar holds every kind of unit in it once, each with how many you have, the one Tab has picked lit and the rest dimmed. Point at an upgrade and its card tells you what it is and what it does; point at a group's picture and it names the unit and how many you have. The power bar lies along the top of the grid, and your money sits on its left end, so both are one glance from the buttons you spend them on. The Legacy mouse and keyboard and the W A S D camera are gone from the Options screen: there is one way to play, and an Options.ini that still names them loads as it always did.
-- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge. The power bar lies in a steel groove of its own along the top of the command grid, twenty cells that light up from the left with your production and fill the groove when full, the consumption marked by a white needle across it. The money stands on the power bar's left end in a steel plate of its own, the figure in a dark well that is only as wide as the figure. It widens the moment your money gains a digit and waits three seconds before it narrows again, so it keeps still while the figure bobs around 10000 as you build. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.
+- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge. The power bar lies in a steel groove of its own along the top of the command grid, twenty cells that light up from the left with your production and fill the groove when full, the consumption marked by a white needle across it. The money stands on the power bar's left end in a steel plate of its own, the figure in a dark well that is only as wide as the figure. It widens the moment your money gains a digit and waits three seconds before it narrows again, so it keeps still while the figure bobs around 10000 as you build. The figure and your income stay on one line at every resolution; at 1280x720 the income used to drop under the money and hang out of the plate. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.
- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel tab over your rank's stars, where it no longer hides the end of the power bar. While a worker stands idle it flashes amber a little faster than once a second, and goes dark the moment every worker has a job. The bar's steel is 40 percent darker than it was, so the pictures on it stand out and it sits quieter against the battlefield. Each button stands in its own dark cell with steel running between them, and the steel is laid over the edge of every picture the way a frame holds a card, the whole picture showing inside it. The production queue and the general's powers are framed the same way. The power bar is sunk into the same steel as the build grid, lying along its top, and is as long as the grid on every side, where it used to change length from one faction to the next. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The beacon button is gone from the bar too; the smoke signals over the radar are how you point your team at a spot. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. A watcher has nothing to promote and no longer gets the tab, which used to hang half into the screen's corner. Its button goes with it: a watcher who clicked a unit used to find an empty patch of screen there that still showed the promotions tooltip and opened the promotion screen. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, each rank in a steel well of its own with its heading, the wells a plate's thickness apart, the grid's steel laid over the edge of every picture so the picture sits in its cell like a card in a frame, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. It comes up the way the Esc menu does, the battlefield behind it dimmed to 65% black and the screen fading in over an eighth of a second; the side's old painted screen no longer fades in over it for the first nine frames. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.
- The general's powers you have bought and can fire, the column that climbed the right edge of the screen, stand in the bottom right corner now in a tray of the bar's own steel. The first sits in the corner against the right edge of the screen, and each one you gain takes the place to the left of the last, three to a row before a new row starts above, so the tray is only ever as big as what you hold and an empty one takes no room at all. Each power sits on a dark cell three quarters the size of a build button, where the side's old tray art used to frame it. It is always out; there is no button to fold it away.
- Three buttons sit side by side in a step of the radar's own steel, on its top edge: the smoke signals Alt+Z, X and C send. Press one and the pointer turns to a cross; your next click puts the signal there, on the ground or on the radar, and a right click or Escape takes it back; until now a button dropped its smoke in the middle of your view. Every signal now leaves a mark on the ground in your colour for ten seconds, and the radar ping lasts as long: crossed swords to attack, a shield to defend, an eye to look, each in a ring a few tanks across, fading out over its last two seconds. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.
@@ -642,7 +642,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Unbuildable ground is a soft red wash, crossed out square by square.
- Running out of money no longer strands the ghost on the map.
- Holding shift and clicking out a row of buildings no longer stops halfway and selects one.
-- Hold shift and drag, and the row is one stroke. Press where the first building goes, drag the way the row runs, and a ghost appears for every building that fits end to end along the line, all facing the way the first one was turned. The row goes straight or on the diagonal and packs the buildings as close as their shape allows: one turned onto the line of the row stands wall to wall with the next, and a factory keeps its door lane clear. A row of Power Plants turned square to the map packs 44 apart; it used to go down on whole grid squares, 50 apart, with a strip of dirt at every joint. It stops at the last building your bank can pay for. A ghost that lands on a rock or someone's tank turns red and is left out when you let go; the rest go up. With two or three workers selected the buildings are shared out to the nearest free one, and the ones nobody is free for wait as plans until a worker comes off its job. A plain drag still turns the building, and walls still tile the way they always did.
+- Hold shift and drag, and the row is one stroke. Press where the first building goes, drag the way the row runs, and a ghost appears for every building that fits end to end along the line, all facing the way the first one was turned. The row runs exactly the way you drag it, at 20 degrees as happily as along the map's edge, and packs the buildings as close as their shape allows: one turned onto the line of the row stands wall to wall with the next, and a factory keeps its door lane clear. A row of Power Plants turned square to the map packs 44 apart; it used to go down on whole grid squares, 50 apart, with a strip of dirt at every joint. It stops at the last building your bank can pay for. A ghost that lands on a rock or someone's tank turns red and is left out when you let go; the rest go up. With two or three workers selected the buildings are shared out to the nearest free one, and the ones nobody is free for wait as plans until a worker comes off its job. A plain drag still turns the building, and walls still tile the way they always did.
- Buildings need a worker selected. With nothing selected the command bar used to borrow one of your dozers and offer its buildings anyway. It stays empty now until you pick a worker, and a replay recorded with a building placed that way plays back without it.
- Turning a building no longer turns everything you build afterwards. A wheeled heading still carries from one wall to the next, but the next supply centre comes out facing the way it was designed to.
- A building you point at blocked ground slides to the nearest spot it fits, and lands there.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 8865690de..2fa96932b 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -687,28 +687,28 @@ public: // ********************************************************************
}
/** A shift-dragged row: the step from one structure to the next, and how many fit between the
- * anchor and a cursor 'dx'/'dy' away. The row runs along the nearest eighth of a turn - a
- * component counts once it is more than tan 22.5 degrees of the other - and packs as tight as
- * the footprint allows along it: the footprint is the box 'halfFacing' by 'halfSide' turned to
- * the heading. So a structure turned onto the row's own line stands face to face with the
- * next, and one turned across it corner to corner, which is the closest a straight row of those
- * can get. The step is not rounded to the build grid: a Power Plant is 44 across and the grid
- * is 10, and rounding it up left 6 of dirt at every joint. Never fewer than one, never more
- * than 'most'. Inline and static so a test can reach it without linking the whole in-game UI. */
+ * anchor and a cursor 'dx'/'dy' away. The row runs the way the drag does, at any angle; it
+ * went along the nearest eighth of a turn until the owner asked for 2026-09-28, and a line
+ * dragged at 20 degrees came out flat. It packs as tight as the footprint allows along it:
+ * the footprint is the box 'halfFacing' by 'halfSide' turned to the heading. So a structure
+ * turned onto the row's own line stands face to face with the next, and one turned across it
+ * corner to corner, which is the closest a straight row of those can get. The step is not
+ * rounded to the build grid: a Power Plant is 44 across and the grid is 10, and rounding it
+ * up left 6 of dirt at every joint. Never fewer than one, never more than 'most'. Inline
+ * and static so a test can reach it without linking the whole in-game UI. */
static Int placementRow( Real dx, Real dy, Real headingCos, Real headingSin, Real halfFacing,
Real halfSide, Int most, Coord2D *step )
{
- const Real slope = 0.41421356f; // tan 22.5 degrees
- const Real diagonal = 0.70710678f; // each component of a unit step on a diagonal
-
- const Real signX = fabs( dx ) > fabs( dy ) * slope ? ( dx < 0.0f ? -1.0f : 1.0f ) : 0.0f;
- const Real signY = fabs( dy ) > fabs( dx ) * slope ? ( dy < 0.0f ? -1.0f : 1.0f ) : 0.0f;
- const Real along = ( signX != 0.0f && signY != 0.0f ) ? diagonal : 1.0f;
-
- const Real touch = placementTouchDistance( signX * along, signY * along, headingCos, headingSin,
- 2.0f * halfFacing, 2.0f * halfSide );
- step->x = signX * along * touch;
- step->y = signY * along * touch;
+ step->x = 0.0f;
+ step->y = 0.0f;
+ const Real length = (Real)sqrt( dx * dx + dy * dy );
+ if( length > 0.0f )
+ {
+ const Real touch = placementTouchDistance( dx / length, dy / length, headingCos, headingSin,
+ 2.0f * halfFacing, 2.0f * halfSide );
+ step->x = dx / length * touch;
+ step->y = dy / length * touch;
+ }
Int count = 1;
const Real stepSqr = step->x * step->x + step->y * step->y;
@@ -1539,7 +1539,6 @@ protected:
Int m_lastMoneyDisplayed; ///< so the money gadget is only written when the amount changes
Int m_lastEarningDisplayed; ///< or the money earned a second beside it
MoneyPlateWidth m_moneyPlate; ///< the money plate's width, following the figure's
- DisplayString * m_moneyMeasure; ///< the money's text on one line, never wrapped, to measure it by
UnsignedInt m_hudDrawCount; ///< rendered frames counted by drawHudOverlay itself
UnsignedInt m_hudLastSampleFrame; ///< m_hudDrawCount the fps sample was last refreshed on
UnsignedInt m_hudLastSampleMs; ///< wall clock of that sample
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 1216f0e58..ad17c06bd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1189,7 +1189,6 @@ InGameUI::InGameUI()
m_lastMoneyDisplayed = -1;
m_lastEarningDisplayed = 0;
m_moneyPlate = MoneyPlateWidth();
- m_moneyMeasure = NULL;
m_hudDrawCount = 0;
m_hudLastSampleFrame = 0;
m_hudLastSampleMs = 0;
@@ -3406,8 +3405,7 @@ void InGameUI::handleBuildPlacements( void )
// only adjust angle if we've actually moved the mouse, and not into a row: that drag
// lays structures, the heading stays the one they had
const Bool dragged = start.x != end.x || start.y != end.y;
- row = dragged && placesRow();
- if( dragged && !row )
+ row = dragged && placesRow(); if( dragged && !row )
angle = computePlacementAngle( &start, &end );
} // end if
@@ -3562,9 +3560,11 @@ void InGameUI::handleBuildPlacements( void )
return;
// both ends, so a wall lands on the grid and tiles from a grid square; a row starts where
- // the ghost did, against its neighbour
+ // the ghost did, against its neighbour, and runs toward the cursor itself, since a snapped
+ // end turned a short drag a few degrees off the line the player drew
snapPlacementToGrid( &worldStart, m_pendingPlaceType, angle );
- snapPlacementToGrid( &worldEnd, m_pendingPlaceType, angle );
+ if( lineBuild )
+ snapPlacementToGrid( &worldEnd, m_pendingPlaceType, angle );
snapPlacementToNeighbour( &worldStart, m_pendingPlaceType, angle );
// get the builder object that will be constructing things
@@ -6977,7 +6977,6 @@ void InGameUI::computePlacementRow( const ThingTemplate *what, Real angle, const
Coord2D step;
const Int count = placementRow( end->x - start->x, end->y - start->y, (Real)Cos( angle ),
(Real)Sin( angle ), halfFacing, minor, most, &step );
-
positions->clear();
for( Int i = 0; i < count; i++ )
{
@@ -11654,19 +11653,15 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
putPowerGroove( values, power, centreShown );
putPowerBar( values, lists[ "powercells" ] ); // after the groove, which it divides into cells
// the money's well is as wide as the figure and a margin each side, following it through
- // InGameUI_moneyPlateWidth on the client's clock. The gadget's own string is wrapped to the
- // window's width every time it draws, so measured it gave the widest line of a figure already cut
- // in two, "$ 10000" without its "+25/s", and the plate stayed too narrow to ever unwrap it: the
- // text is measured on a string of its own that never wraps
+ // InGameUI_moneyPlateWidth on the client's clock. A static text wraps at its window's width less
+ // ten pixels, which the margin only covered from a scale of 1.0 up: at 1280x720 "$ 48500 +0/s"
+ // broke onto two lines and spilled out of the plate. The window is one line, which the static
+ // text draws unwrapped, so the figure is never cut and its own string measures it
GameWindow *moneyWindow = controlBarWindow( "MoneyDisplay" );
DisplayString *moneyText = ( (TextData *)moneyWindow->winGetUserData() )->text;
- if( m_moneyMeasure == NULL )
- m_moneyMeasure = TheDisplayStringManager->newDisplayString();
- if( m_moneyMeasure->getFont() != moneyText->getFont() )
- m_moneyMeasure->setFont( moneyText->getFont() );
- if( m_moneyMeasure->getText().compare( moneyText->getText() ) != 0 )
- m_moneyMeasure->setText( moneyText->getText() );
- const Int moneyNeeded = m_moneyMeasure->getWidth() + 2 * REAL_TO_INT( MONEY_TEXT_MARGIN * scale );
+ moneyWindow->winSetStatus( WIN_STATUS_ONE_LINE );
+ moneyText->setWordWrap( 0 );
+ const Int moneyNeeded = moneyText->getWidth() + 2 * REAL_TO_INT( MONEY_TEXT_MARGIN * scale );
putMoney( values, powerBox, InGameUI_moneyPlateWidth( m_moneyPlate, moneyNeeded, nowMs ),
centreShown && !moneyWindow->winIsHidden() );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
index 266954b9b..d9736f2e7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
@@ -379,7 +379,6 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
//
Coord3D worldEnd;
TheTacticalView->screenToTerrain( &anchorEnd, &worldEnd );
- TheInGameUI->snapPlacementToGrid( &worldEnd, build, angle );
std::vector<Coord3D> pieces;
TheInGameUI->computePlacementRow( build, angle, &world, &worldEnd, &pieces );
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp
index 8c4119df6..45a6f0be5 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp
@@ -95,8 +95,8 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData,
window->winGetScreenPosition( &origin.x, &origin.y );
window->winGetSize( &size.x, &size.y );
- // Set the text Wrap width
- wordWrap = size.x - 10;
+ // Set the text Wrap width; a one line window never wraps
+ wordWrap = BitTest( window->winGetStatus(), WIN_STATUS_ONE_LINE ) ? 0 : size.x - 10;
//if(wordWrap == 89)
// wordWrap = 95;
text->setWordWrap(wordWrap);
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index d1ece7db4..da2edefe1 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -2258,7 +2258,7 @@ TEST(placement_grid_snap_puts_footprint_edges_on_cell_lines)
CHECK_NEAR(InGameUI::snapPlacementAxis(13.0f, 0.0f), 14.5f, 0.0001f);
}
-TEST(placement_row_packs_the_footprint_along_the_nearest_eighth)
+TEST(placement_row_packs_the_footprint_along_the_drag)
{
Coord2D step;
const Real half = 0.70710678f; /* cos and sin of an eighth of a turn */
@@ -2270,11 +2270,18 @@ TEST(placement_row_packs_the_footprint_along_the_nearest_eighth)
CHECK_NEAR(step.y, 0.0f, 0.0001f);
CHECK_EQ(InGameUI::placementRow(122.0f, 0.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step), 4);
- /* a hand-drawn line 20 degrees off still runs straight, and backwards runs backwards */
- CHECK_EQ(InGameUI::placementRow(-100.0f, 36.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step), 3);
+ /* backwards runs backwards */
+ CHECK_EQ(InGameUI::placementRow(-100.0f, 0.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step), 3);
CHECK_NEAR(step.x, -40.5f, 0.0001f);
CHECK_NEAR(step.y, 0.0f, 0.0001f);
+ /* a line dragged 20 degrees off the axis runs at 20 degrees, not flat: the pieces meet through
+ * the facing face, 40 / cos 20 apart, and the hair */
+ const Real twenty = 20.0f * PI / 180.0f;
+ InGameUI::placementRow(100.0f * Cos(twenty), 100.0f * Sin(twenty), 1.0f, 0.0f, 20.0f, 15.0f, 50, &step);
+ CHECK_NEAR(step.y / step.x, Sin(twenty) / Cos(twenty), 0.0001f);
+ CHECK_NEAR(sqrt(step.x * step.x + step.y * step.y), 40.0f / Cos(twenty) + 0.5f, 0.001f);
+
/* along y the step is the footprint's other side */
InGameUI::placementRow(0.0f, -90.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step);
CHECK_NEAR(step.x, 0.0f, 0.0001f);
@@ -2282,7 +2289,7 @@ TEST(placement_row_packs_the_footprint_along_the_nearest_eighth)
/* a diagonal slides each piece along the last one's long side instead of meeting it corner
* to corner: 30 on each axis and the hair, where 40 by 30 left a triangle of ground */
- CHECK_EQ(InGameUI::placementRow(80.0f, 60.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step), 3);
+ CHECK_EQ(InGameUI::placementRow(80.0f, 80.0f, 1.0f, 0.0f, 20.0f, 15.0f, 50, &step), 3);
CHECK_NEAR(step.x, 30.0f + 0.5f * half, 0.001f);
CHECK_NEAR(step.y, 30.0f + 0.5f * half, 0.001f);