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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameclient): give the chinese beacon button its transparent corners
Olcay Seygan46b1a47c8d9d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4bc057a90..effc8efd4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1122,7 +1122,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- Classic Graphics, on the Graphics page, puts the game back the way it looked in 2003 in one click: its own textures and ground in place of the upscaled ones, the old hard shadows, the round dark patch under every tree where Reforged lays the tree's own outline on the ground, and no glow or sharpening over the picture. Leave it off and you have Reforged. The rest of the options stay yours either way, and the box takes effect the next time the game starts.- Interface, in the launcher, picks between Classic and Reforged. Classic is the command bar, mouse and hotkeys of Zero Hour 1.04 that your hands still remember; Reforged is the console in the middle, right-click orders and the key grid this version built. Every player starts on Classic, and a game started without the launcher is Classic too. The choice is yours alone: two players on different styles still play the same match and the same replay. It takes effect the next time the game starts. Classic's screen is EA's again: the command bar in each side's own painting, the radar with its flashing under-attack lamp, the beacon button, six lines of messages in the top left that fade as they did, superweapon countdowns written out by name, the old chat line and quit menu, lettering at the old sizes, and Tab opening diplomacy. The menus outside a match fill the screen as 1.04's did; in a match the options and save screens keep their drawn shape in the middle, over the battlefield. The match's own furniture is never pulled out of shape and never waits in a frame in the middle. The command bar comes in three pieces at every resolution: the radar stands on the left edge of the screen, the build grid in the middle and your selection on the right edge, each at the size a 4:3 screen of the same height gives it, with battlefield between them on anything wider. At 1920x1080 a build button is 90 by 79 pixels, the shape it was drawn, where EA's stretched bar made it 120 by 79, and on a 5120x1440 screen the radar is still in the corner your eye goes to, not 1280 pixels in from it. Your general's powers climb the right edge, the build tooltip and the chat line sit over the radar, diplomacy opens in the top left, the messages run from the top left corner and the superweapon countdowns from the top right, all at that same size, as they stood on a 4:3 screen. The mouse and keys are 1.04's as well. The left button selects and gives the order, so an enemy under it is an attack and a bunker under your infantry is a way in; the right button drops your selection or takes back a half-given order, and a right drag scrolls the map. Ctrl held is force fire. Alt held lays waypoints, and the white path joining them is drawn again. A guard order holds the range it always held, Shift and a number adds that group to what you have selected, and a build button is one unit a click. The keys are your language's own key map from the game's files, with nothing of Reforged's grid laid over it, and a build button's key is the letter 1.04 gave it, taken from the English name in every language, so a Turkish or German player presses the same key an English one does. The letter sits in the button's corner on the dark badge Reforged puts its grid keys on, in the middle of a square plate the same size for every letter, larger than Reforged's and in gold while the button can be pressed; the tooltip's name is plain white with no letter picked out. A structure is selected on its own, as it always was. The radar shows no money piles or tech buildings, and the clock plate, the frame counter and the experience bar under the portrait stay off the screen. So does the peace time plate, though a host's truce still holds. The money readout is the money alone, with no income figure beside it. Health bars and garrison squares look and behave as they do in Reforged, and the Health Bars and empty garrison squares settings are back on Classic's options page. The build buttons are the pictures alone, without the seconds, price and power figures. Those seconds were measured against the wall clock, so on a match running just under full speed a 120 second build read 125. An upgrade bought for a group of buildings goes to the one whose buttons you see. In a network game a Classic player's camera is not sent to observers, as it never was in 1.04. The camera zooms as fast as Reforged's, about fourteen notches from the ground to the whole map where 1.04 took eighty, on the middle of the screen unless you tick Zoom to Cursor, as near and as far as Reforged's camera goes, turns without snapping unless you tick Snap Camera Rotation, and scrolls from the last three pixels of a full screen and not at all in a window, whatever the options say. It runs past the edge of the map as far as Reforged's camera does, 200 units unless `CameraBoundaryMargin` says otherwise, so a base in a corner comes to the middle of the screen in either interface. A move order puts 1.04's animated ring on the ground where it lands, and no marker or line stays behind it. None of it reaches the battle itself: Classic sends the game only the orders 1.04 sent, so a Classic player and a Reforged one share a match, and a replay plays back the same in either.- Classic shows what a factory is building again. Select one with anything queued and its queue takes the portrait's place, the unit in production wearing its build clock, and a click on any entry cancels it; the portrait comes back when the queue runs dry. Until now a Classic factory could queue a hundred units with nothing on screen to count them by. The queue stops at nine, the number of slots that show it, and the build buttons grey out at nine as they did in 1.04. Your general's powers climb the right edge of the screen from the top of the bar, one over the other, as they did in 1.04, and the empty strip above them no longer swallows clicks on the battlefield. They carry how many are ready, with no key letter and no recharge seconds, and the promotion screen carries no number keys either, since Classic's number keys pick teams. Every button on that screen takes its click again: the right half used to sit under the powers bar's empty frame and the bottom row under the command bar's top edge, and a click there went nowhere.-- Classic's command bar lets the battlefield have the ground it shows. A click on the battlefield between its three pieces, or over the sloped shoulders of the build grid's plate, reaches the unit standing there; only the painted metal keeps it. Change the resolution with the bar minimised and the build tooltip used to come back 245 pixels too high at 1920x1080, as far as the bar had dropped; it stays over the radar now. The options, idle worker, beacon and chat buttons down the left of the grid's plate sit in the black strip the plate leaves for them. On the American and Chinese plates they used to lie across the left rib, a few pixels too far left, the same in a match and on the observer's bar while you watch a player.+- Classic's command bar lets the battlefield have the ground it shows. A click on the battlefield between its three pieces, or over the sloped shoulders of the build grid's plate, reaches the unit standing there; only the painted metal keeps it. Change the resolution with the bar minimised and the build tooltip used to come back 245 pixels too high at 1920x1080, as far as the bar had dropped; it stays over the radar now. The options, idle worker, beacon and chat buttons down the left of the grid's plate sit in the black strip the plate leaves for them. On the American and Chinese plates they used to lie across the left rib, a few pixels too far left, the same in a match and on the observer's bar while you watch a player. The Chinese beacon button, the red one with the exclamation mark, no longer sits on a black card: EA's picture of it had no transparent corners, and the lit and pressed versions always did.- Classic's command bar empties when you let your worker go, as 1.04's did. Reforged's habit of showing a builder's buildings with nothing selected had leaked into Classic, so a dozer's build menu stayed on the bar after you dropped it, and was there from the first second of a match before you had picked anything. In Reforged that builder's menu now also comes back after a resolution change; it used to leave the bar empty until you clicked something.- Classic brings back 1.04's Alternate Mouse Setup, on its Controls page where EA had it and off until you tick it. Ticked, the right button gives the order and the left one only selects: a left click on open ground drops your selection, a right drag still scrolls the map, a double right click is the guard order when Double Click Guard is ticked, and the radar looks on the left button and sends units on the right. It is saved under the name 1.04 gave it, so a settings file 1.04 wrote keeps your choice. Reforged has one mouse, no box, and ignores the setting. The orders are 1.04's either way, so the box changes nothing about a match or its replay.- Supply piles stop shouting their cash over the whole map. A small pile shows its amount only while your cursor is on it or close by, in a smaller font; a big supply dock keeps its label all the time. Classic has the same labels now, with the radar still leaving the piles off.diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifestindex 324e6ac1b..68f3c80bd 100644--- a/GeneralsMD/Code/BuildFingerprint.manifest+++ b/GeneralsMD/Code/BuildFingerprint.manifest@@ -2,6 +2,7 @@ CMakeLists.txtData/Art/Textures/ReforgedBarAmericaCenter.tgaData/Art/Textures/ReforgedBarAmericaLeft.tgaData/Art/Textures/ReforgedBarAmericaRight.tga+Data/Art/Textures/ReforgedBarChinaBeacon.tgaData/Art/Textures/ReforgedBarChinaCenter.tgaData/Art/Textures/ReforgedBarChinaLeft.tgaData/Art/Textures/ReforgedBarChinaRight.tga@@ -91,6 +92,7 @@ Data/INI/CommandSetReforged.iniData/INI/ControlBarSchemeReforged.iniData/INI/FXListReforged.iniData/INI/FixesReforged.ini+Data/INI/MappedImages/HandCreated/ReforgedBarChinaBeacon.iniData/INI/MappedImages/HandCreated/ReforgedOrders.iniData/INI/ObjectCreationListReforged.iniData/INI/ParticleSystemReforged.ini@@ -3719,6 +3721,7 @@ Tools/build-posix.shTools/buildVersionUpdate/buildVersionUpdate.cppTools/buildVersionUpdate/buildVersionUpdate.dspTools/cheat_check.py+Tools/china_beacon.pyTools/control_client.pyTools/d3d9posix_check.pyTools/ffmpeg-build-posix.shdiff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedBarChinaBeacon.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedBarChinaBeacon.tganew file mode 100644index 000000000..b528f9668Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedBarChinaBeacon.tga differdiff --git a/GeneralsMD/Code/Data/INI/ControlBarSchemeReforged.ini b/GeneralsMD/Code/Data/INI/ControlBarSchemeReforged.iniindex 255916176..907500002 100644--- a/GeneralsMD/Code/Data/INI/ControlBarSchemeReforged.ini+++ b/GeneralsMD/Code/Data/INI/ControlBarSchemeReforged.ini@@ -12,6 +12,10 @@; The Observer scheme wears the American plate and moves with America. Watching a player puts his; side's scheme on, so the observer bar follows whichever side it shows. The Reforged interface; stands the four buttons down and draws its own.+;+; EA's Chinese beacon button at rest, SNBeacon, has no alpha, so it stood on a black card. The+; Chinese schemes wear ReforgedChinaBeacon, the same picture with its corners open+; (Tools/china_beacon.py).ControlBarScheme America8x6OptionsUL X:187 Y:490@@ -77,6 +81,7 @@ ControlBarScheme China8x6BeaconLR X:228 Y:566ChatUL X:192 Y:568ChatLR X:228 Y:592+ BeaconButtonEnable ReforgedChinaBeaconEndControlBarScheme ChinaTankGeneral8x6@@ -88,6 +93,7 @@ ControlBarScheme ChinaTankGeneral8x6BeaconLR X:228 Y:566ChatUL X:192 Y:568ChatLR X:228 Y:592+ BeaconButtonEnable ReforgedChinaBeaconEndControlBarScheme ChinaInfantryGeneral8x6@@ -99,6 +105,7 @@ ControlBarScheme ChinaInfantryGeneral8x6BeaconLR X:228 Y:566ChatUL X:192 Y:568ChatLR X:228 Y:592+ BeaconButtonEnable ReforgedChinaBeaconEndControlBarScheme ChinaNukeGeneral8x6@@ -110,6 +117,7 @@ ControlBarScheme ChinaNukeGeneral8x6BeaconLR X:228 Y:566ChatUL X:192 Y:568ChatLR X:228 Y:592+ BeaconButtonEnable ReforgedChinaBeaconEndControlBarScheme ChinaBossGeneral8x6@@ -121,4 +129,5 @@ ControlBarScheme ChinaBossGeneral8x6BeaconLR X:228 Y:566ChatUL X:192 Y:568ChatLR X:228 Y:592+ BeaconButtonEnable ReforgedChinaBeaconEnddiff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedBarChinaBeacon.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedBarChinaBeacon.ininew file mode 100644index 000000000..6e32b1208--- /dev/null+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedBarChinaBeacon.ini@@ -0,0 +1,12 @@+; The Chinese command bar's beacon button at rest, EA's SNBeacon with the rounded corners its alpha+; never had, written by Tools/china_beacon.py into Art/Textures/ReforgedBarChinaBeacon.tga. The+; Chinese schemes in ControlBarSchemeReforged.ini wear it. Mapped images are not in the+; multiplayer INI checksum.++MappedImage ReforgedChinaBeacon+ Texture = ReforgedBarChinaBeacon.tga+ TextureWidth = 64+ TextureHeight = 32+ Coords = Left:0 Top:0 Right:34 Bottom:24+ Status = NONE+Enddiff --git a/GeneralsMD/Code/Tools/china_beacon.py b/GeneralsMD/Code/Tools/china_beacon.pynew file mode 100644index 000000000..7d124ca40--- /dev/null+++ b/GeneralsMD/Code/Tools/china_beacon.py@@ -0,0 +1,53 @@+"""The Chinese command bar's beacon button with the alpha EA left off it. SNBeacon, the button at+rest, sits apart from the rest of its set in SNControlBar512_001.tga (100,281 where the others are+past x 389), and its alpha is solid over the whole 34x24 rectangle bar 68 texels of the bottom row,+so the Classic bar drew it as a red button on a black card. SNBeaconH, SNBeaconP and SNBeaconI, the+same button lit, pressed and greyed, have the rounded corners open. This takes SNBeacon's colour+and SNBeaconH's alpha into a texture of its own; ReforgedBarChinaBeacon.ini maps it and the Chinese+schemes in ControlBarSchemeReforged.ini wear it.++ python Tools/china_beacon.py <base game Textures.big>+ writes Data/Art/Textures/ReforgedBarChinaBeacon.tga. The archive is the base game's,+ Run/ZH_Generals/Textures.big on this machine."""+import io+import os+import sys++from PIL import Image++sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))+from bigfile import _read_index, _matches++SOURCE = "art/textures/sncontrolbar512_001.tga"+BEACON = (100, 281, 134, 305) # SNBeacon in SNControlBar512.INI+BEACON_LIT = (461, 269, 495, 293) # SNBeaconH, the same shape with its corners open+TEXTURE_W, TEXTURE_H = 64, 32+OUT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures", "ReforgedBarChinaBeacon.tga")+++def read_member(archive, pattern):+ with open(archive, "rb") as f:+ for path, offset, size in list(_read_index(f)):+ if _matches(path, pattern):+ f.seek(offset)+ return f.read(size)+ raise ValueError("%s has no %s" % (archive, pattern))+++def texture(archive):+ sheet = Image.open(io.BytesIO(read_member(archive, SOURCE))).convert("RGBA")+ button = sheet.crop(BEACON)+ button.putalpha(sheet.crop(BEACON_LIT).getchannel("A"))+ out = Image.new("RGBA", (TEXTURE_W, TEXTURE_H), (0, 0, 0, 0))+ out.paste(button, (0, 0))+ assert out.getpixel((0, 0))[3] == 0 and out.getpixel((16, 12))[3] == 255+ return out+++def main():+ texture(sys.argv[1]).save(OUT_PATH)+ print(OUT_PATH)+++if __name__ == "__main__":+ main()