From 677efcbced186e2d9694b33ae2f9ffb9dd16e555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 18 Jun 2012 02:18:01 +0200 Subject: [PATCH 1/7] add notifications --- mods/d2k/rules/defaults.yaml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index 98f92e7b64..b1e22ffd96 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -23,8 +23,9 @@ GainsExperience: GivesExperience: DrawLineToTarget: +#TODO: not race specific ActorLostNotification: - Notification: + Notification: AI_ULOST.AUD ProximityCaptor: Types:Vehicle GivesBounty: @@ -58,7 +59,7 @@ GivesExperience: DrawLineToTarget: ActorLostNotification: - Notification: + Notification: AI_ULOST.AUD ProximityCaptor: Types:Tank GivesBounty: @@ -101,7 +102,7 @@ GivesExperience: DrawLineToTarget: ActorLostNotification: - Notification: + Notification: AI_ULOST.AUD ProximityCaptor: Types:Infantry GivesBounty: @@ -122,7 +123,7 @@ GivesExperience: DrawLineToTarget: ActorLostNotification: - Notification: + Notification: AI_ULOST.AUD DebugAircraftFacing: DebugAircraftSubPxX: DebugAircraftSubPxY: @@ -162,8 +163,18 @@ MustBeDestroyed: GivesExperience: # FrozenUnderFog: - CaptureNotification: - Notification: + CaptureNotification@Atreides: + Race: atreides + Notification: AI_CAPT.AUD + CaptureNotification@Harkonnen: + Race: harkonnen + Notification: HI_CAPT.AUD + CaptureNotification@Ordos: + Race: ordos + Notification: OI_CAPT.AUD +#TODO: not Race-specific + ActorLostNotification: + Notification: AI_BLOST.AUD EditorAppearance: RelativeToTopLeft: yes ShakeOnDeath: From ce0099f5d29ef2aa53c8650a9a0de35ede44ed8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 18 Jun 2012 17:07:56 +0200 Subject: [PATCH 2/7] fix settings for d2k and cnc no UPnP for CnC singleplayer skirmishes, use RA chromes at D2k --- OpenRA.Game/Game.cs | 1 + mods/cnc/chrome/createserver.yaml | 11 +- mods/d2k/chrome/cheats.yaml | 76 ------ mods/d2k/chrome/create-server.yaml | 78 ------ mods/d2k/chrome/dropdowns.yaml | 50 ---- mods/d2k/chrome/ingame.yaml | 369 ----------------------------- mods/d2k/chrome/map-chooser.yaml | 74 ------ mods/d2k/chrome/modchooser.yaml | 84 ------- mods/d2k/chrome/replaybrowser.yaml | 102 -------- mods/d2k/chrome/serverbrowser.yaml | 215 ----------------- mods/d2k/chrome/settings.yaml | 219 ----------------- mods/d2k/mod.yaml | 18 +- 12 files changed, 15 insertions(+), 1282 deletions(-) delete mode 100644 mods/d2k/chrome/cheats.yaml delete mode 100644 mods/d2k/chrome/create-server.yaml delete mode 100644 mods/d2k/chrome/dropdowns.yaml delete mode 100644 mods/d2k/chrome/ingame.yaml delete mode 100644 mods/d2k/chrome/map-chooser.yaml delete mode 100644 mods/d2k/chrome/modchooser.yaml delete mode 100644 mods/d2k/chrome/replaybrowser.yaml delete mode 100644 mods/d2k/chrome/serverbrowser.yaml delete mode 100644 mods/d2k/chrome/settings.yaml diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 41638ce1b4..8d2cee33fd 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -392,6 +392,7 @@ namespace OpenRA // Work around a miscompile in mono 2.6.7: // booleans that default to true cannot be set false by an initializer settings.AdvertiseOnline = false; + settings.AllowUPnP = false; server = new Server.Server(new IPEndPoint(IPAddress.Loopback, 0), Game.Settings.Game.Mods, settings, modData); diff --git a/mods/cnc/chrome/createserver.yaml b/mods/cnc/chrome/createserver.yaml index 8bdaf80c67..839eea09f4 100644 --- a/mods/cnc/chrome/createserver.yaml +++ b/mods/cnc/chrome/createserver.yaml @@ -70,13 +70,12 @@ Container@CREATESERVER_PANEL: Width:150 Height:20 Text:Advertise Online - Label@PORT_FORWARDING: - X:140 + Checkbox@UPNP_CHECKBOX: + X:110 Y:180 - Width:220 - WordWrap:true - Font:Tiny - Text:You must forward an external port from your router to your computer before other players will be able to join your server. + Width:300 + Height:20 + Text:Allow UPnP port forwarding Label@EXTERNAL_PORT_LABEL: X:15 Y:219 diff --git a/mods/d2k/chrome/cheats.yaml b/mods/d2k/chrome/cheats.yaml deleted file mode 100644 index ecbbee32c5..0000000000 --- a/mods/d2k/chrome/cheats.yaml +++ /dev/null @@ -1,76 +0,0 @@ -Background@CHEATS_PANEL: - Logic:CheatsLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:350 - Height:420 - Visible:true - Children: - Label@LABEL_TITLE: - X:(PARENT_RIGHT - WIDTH)/2 - Y:20 - Width:250 - Height:25 - Text:Developer Mode - Align:Center - Checkbox@DISABLE_SHROUD: - X:30 - Y:50 - Height:20 - Width:PARENT_RIGHT - 30 - Text:Disable Shroud - Button@GIVE_EXPLORATION - X:30 - Y:80 - Width:200 - Height:20 - Text: Give Exploration - Checkbox@SHOW_UNIT_PATHS: - X:30 - Y:110 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Show Unit Paths - Button@GIVE_CASH: - X:30 - Y:140 - Width:200 - Height:20 - Text: Give Cash - Checkbox@INSTANT_BUILD: - X:30 - Y:170 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Instant Build Speed - Checkbox@INSTANT_CHARGE: - X:30 - Y:200 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Support Powers Charge Instantly - Checkbox@ENABLE_TECH: - X:30 - Y:230 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Build Everything - Checkbox@UNLIMITED_POWER: - X:30 - Y:260 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Unlimited Power - Checkbox@BUILD_ANYWHERE: - X:30 - Y:290 - Width:PARENT_RIGHT - 30 - Height:20 - Text:Build Anywhere - Button@CLOSE: - X:30 - Y:360 - Width:PARENT_RIGHT - 60 - Height:20 - Text:Close - Key:escape diff --git a/mods/d2k/chrome/create-server.yaml b/mods/d2k/chrome/create-server.yaml deleted file mode 100644 index 2fd4466391..0000000000 --- a/mods/d2k/chrome/create-server.yaml +++ /dev/null @@ -1,78 +0,0 @@ -Background@CREATESERVER_BG: - Logic:ServerCreationLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:400 - Height:240 - Children: - Label@LABEL_TITLE: - X:0 - Y:20 - Width:400 - Height:25 - Text:Create Server - Align:Center - Font:Bold - Label@SERVER_NAME_LABEL: - X:50 - Y:59 - Width:95 - Height:25 - Align: Right - Text:Game Title: - TextField@SERVER_NAME: - X:150 - Y:60 - Width:210 - MaxLength:50 - Height:25 - Text:OpenRA Game - Label@EXTERNAL_PORT_LABEL: - X:50 - Y:94 - Width:95 - Height:25 - Align: Right - Text:External Port: - TextField@EXTERNAL_PORT: - X:150 - Y:95 - Width:50 - MaxLength:5 - Height:25 - Text:OpenRA Game - Label@LISTEN_PORT_LABEL: - X:210 - Y:94 - Width:95 - Height:25 - Align: Right - Text:Listen Port: - TextField@LISTEN_PORT: - X:310 - Y:95 - Width:50 - MaxLength:5 - Height:25 - Checkbox@ADVERTISE_CHECKBOX: - X:165 - Y:130 - Width:300 - Height:20 - Text:Advertise game Online - Button@CREATE_BUTTON: - X:130 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Create - Font:Bold - Key:return - Button@BACK_BUTTON: - X:260 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Cancel - Font:Bold - Key:escape diff --git a/mods/d2k/chrome/dropdowns.yaml b/mods/d2k/chrome/dropdowns.yaml deleted file mode 100644 index aa008a81a4..0000000000 --- a/mods/d2k/chrome/dropdowns.yaml +++ /dev/null @@ -1,50 +0,0 @@ -ScrollPanel@LABEL_DROPDOWN_TEMPLATE: - Width:DROPDOWN_WIDTH - Children: - ScrollItem@TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Label@LABEL: - X:10 - Width:PARENT_RIGHT-20 - Height:25 - -ScrollPanel@RACE_DROPDOWN_TEMPLATE: - Width:DROPDOWN_WIDTH - Children: - ScrollItem@TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Image@FLAG: - X:5 - Y:5 - Width:30 - Height:15 - Label@LABEL: - X:40 - Width:60 - Height:25 - -ScrollPanel@TEAM_DROPDOWN_TEMPLATE: - Width:DROPDOWN_WIDTH - Children: - ScrollItem@TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Label@LABEL: - X:0 - Width:PARENT_RIGHT - Height:25 - Align:Center \ No newline at end of file diff --git a/mods/d2k/chrome/ingame.yaml b/mods/d2k/chrome/ingame.yaml deleted file mode 100644 index 022239407c..0000000000 --- a/mods/d2k/chrome/ingame.yaml +++ /dev/null @@ -1,369 +0,0 @@ -Container@INGAME_ROOT: - Logic:IngameChromeLogic - Children: - WorldInteractionController@INTERACTION_CONTROLLER: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - ViewportScrollController: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - WorldCommand: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - Timer@GAME_TIMER: - X: WINDOW_RIGHT/2 - Y: 0-10 - StrategicProgress@STRATEGIC_PROGRESS: - X: WINDOW_RIGHT/2 - Y: 40 - Background@POSTGAME_BG: - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:400 - Height:100 - Background:dialog4 - Visible:false - Children: - Label@TEXT: - X:(PARENT_RIGHT - WIDTH)/2 - Y:0 - Width:200 - Height:80 - Align:Center - Button@POSTGAME_OBSERVE: - X:10 - Y:(PARENT_BOTTOM - HEIGHT - 10) - Width:150 - Height:25 - Font:Bold - Text:Observe - Button@POSTGAME_QUIT: - X:(PARENT_RIGHT - WIDTH - 10) - Y:(PARENT_BOTTOM - HEIGHT - 10) - Width:150 - Height:25 - Font:Bold - Text:Leave - SupportPowerBin@INGAME_POWERS_BIN: - X:0 - Y:25 - BuildPalette@INGAME_BUILD_PALETTE: - X:WINDOW_RIGHT - 250 - Y:280 - Width:250 - Height:500 - Button@INGAME_OPTIONS_BUTTON: - X:0 - Y:0 - Width:160 - Height:25 - Text:Options - Font:Bold - Key: escape - Button@INGAME_DIPLOMACY_BUTTON: - X:162 - Y:0 - Width:160 - Height:25 - Text:Diplomacy - Font:Bold - Button@CHEATS_BUTTON: - X:324 - Y:0 - Width:160 - Height:25 - Text:Cheats - Visible:false - Font:Bold - RadarBin@INGAME_RADAR_BIN: - WorldInteractionController:INTERACTION_CONTROLLER - PowerBin@INGAME_POWER_BIN: - MoneyBin@INGAME_MONEY_BIN: - X:WINDOW_RIGHT - WIDTH - Y:0 - Width:320 - Height: 32 - Children: - OrderButton@SELL: - Logic:OrderButtonsChromeLogic - X:3 - Y:0 - Width:30 - Height:30 - Image:sell - Description:Sell - LongDesc:Sell buildings, reclaiming a \nproportion of their build cost - OrderButton@POWER_DOWN: - Logic:OrderButtonsChromeLogic - X:39 - Y:0 - Width:30 - Height:30 - Image:power - Description:Powerdown - LongDesc:Disable unneeded structures so their \npower can be used elsewhere - OrderButton@REPAIR: - Logic:OrderButtonsChromeLogic - X:75 - Y:0 - Width:30 - Height:30 - Image:repair - Description:Repair - LongDesc:Repair damaged buildings - WorldTooltip: - Background@INGAME_OPTIONS_BG: - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:300 - Height:295 - Visible:false - Children: - Label@LABEL_TITLE: - X:(PARENT_RIGHT - WIDTH)/2 - Y:20 - Width:250 - Height:25 - Text:Options - Align:Center - Font:Bold - Button@RESUME: - X:(PARENT_RIGHT - WIDTH)/2 - Y:60 - Width:160 - Height:25 - Text:Resume - Font:Bold - Key:escape - Button@SETTINGS: - X:(PARENT_RIGHT - WIDTH)/2 - Y:100 - Width:160 - Height:25 - Text:Settings - Font:Bold - Button@MUSIC: - X:(PARENT_RIGHT - WIDTH)/2 - Y:140 - Width:160 - Height:25 - Text:Music - Font:Bold - Button@SURRENDER: - X:(PARENT_RIGHT - WIDTH)/2 - Y:180 - Width:160 - Height:25 - Text:Surrender - Font:Bold - Button@DISCONNECT: - X:(PARENT_RIGHT - WIDTH)/2 - Y:220 - Width:160 - Height:25 - Text:Abort Mission - Font:Bold - Background@DIPLOMACY_BG: - Logic:DiplomacyLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:450 - Height:400 - Visible:false - Children: - Label@LABEL_TITLE: - X:(PARENT_RIGHT - WIDTH)/2 - Y:20 - Width:250 - Height:25 - Text:Diplomacy - Align:Center - Font:Bold - ChatDisplay@CHAT_DISPLAY: - X:250 - Y:WINDOW_BOTTOM - HEIGHT - 30 - Width: 760 - Height: 200 - DrawBackground: False - RemoveTime:250 - UseContrast: yes - ChatEntry@CHAT_ENTRY: - X:250 - Y:WINDOW_BOTTOM - HEIGHT - Width: 760 - Height: 30 - UseContrast: yes - Background@PERF_BG: - ClickThrough:true - Background:dialog4 - Logic:PerfDebugLogic - X:10 - Y:WINDOW_BOTTOM - 250 - Width: 210 - Height: 250 - Children: - PerfGraph@GRAPH: - X:5 - Y:5 - Width:200 - Height:200 - Label@TEXT: - X:20 - Y:205 - Width:170 - Height:40 -Container@OBSERVER_ROOT: - Visible:true - Logic:IngameObserverChromeLogic - Children: - WorldInteractionController@INTERACTION_CONTROLLER: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - ViewportScrollController: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - Timer@GAME_TIMER: - X: WINDOW_RIGHT/2 - Y: 0-10 - Background@POSTGAME_BG: - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:400 - Height:100 - Background:dialog4 - Visible:false - Children: - Label@TEXT: - X:(PARENT_RIGHT - WIDTH)/2 - Y:0 - Width:200 - Height:80 - Align:Center - Button@POSTGAME_OBSERVE: - X:10 - Y:(PARENT_BOTTOM - HEIGHT - 10) - Width:150 - Height:25 - Font:Bold - Text:Observe - Button@POSTGAME_QUIT: - X:(PARENT_RIGHT - WIDTH - 10) - Y:(PARENT_BOTTOM - HEIGHT - 10) - Width:150 - Height:25 - Font:Bold - Text:Leave - SupportPowerBin@INGAME_POWERS_BIN: - X:0 - Y:25 - Button@INGAME_OPTIONS_BUTTON: - X:0 - Y:0 - Width:160 - Height:25 - Text:Options - Font:Bold - Key:escape - WorldTooltip: - Background@INGAME_OPTIONS_BG: - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:300 - Height:295 - Visible:false - Children: - Label@LABEL_TITLE: - X:(PARENT_RIGHT - WIDTH)/2 - Y:20 - Width:250 - Height:25 - Text:Options - Align:Center - Font:Bold - Button@RESUME: - X:(PARENT_RIGHT - WIDTH)/2 - Y:60 - Width:160 - Height:25 - Text:Resume - Font:Bold - Key:escape - Button@SETTINGS: - X:(PARENT_RIGHT - WIDTH)/2 - Y:100 - Width:160 - Height:25 - Text:Settings - Font:Bold - Button@MUSIC: - X:(PARENT_RIGHT - WIDTH)/2 - Y:140 - Width:160 - Height:25 - Text:Music - Font:Bold - Button@SURRENDER: - X:(PARENT_RIGHT - WIDTH)/2 - Y:180 - Width:160 - Height:25 - Text:Surrender - Font:Bold - Button@DISCONNECT: - X:(PARENT_RIGHT - WIDTH)/2 - Y:220 - Width:160 - Height:25 - Text:Abort Mission - Font:Bold - ChatDisplay@CHAT_DISPLAY: - X:250 - Y:WINDOW_BOTTOM - HEIGHT - 30 - Width: 760 - Height: 200 - DrawBackground: False - RemoveTime:250 - ChatEntry@CHAT_ENTRY: - X:250 - Y:WINDOW_BOTTOM - HEIGHT - Width: 760 - Height: 30 - Background@PERF_BG: - ClickThrough:true - Background:dialog4 - Logic:PerfDebugLogic - X:10 - Y:WINDOW_BOTTOM - 250 - Width: 210 - Height: 250 - Children: - PerfGraph@GRAPH: - X:5 - Y:5 - Width:200 - Height:200 - Label@TEXT: - X:20 - Y:205 - Width:170 - Height:40 -Background@FMVPLAYER: - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM - Background:dialog4 - Children: - VqaPlayer: - X:0 - Y:0 - Width:WINDOW_RIGHT - Height:WINDOW_BOTTOM diff --git a/mods/d2k/chrome/map-chooser.yaml b/mods/d2k/chrome/map-chooser.yaml deleted file mode 100644 index c57b815a41..0000000000 --- a/mods/d2k/chrome/map-chooser.yaml +++ /dev/null @@ -1,74 +0,0 @@ -Background@MAPCHOOSER_PANEL: - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Logic:MapChooserLogic - Width:800 - Height:600 - Children: - Label@MAPCHOOSER_TITLE: - X:0 - Y:17 - Align:Center - Width:800 - Height:20 - Text:Choose Map - Font:Bold - ScrollPanel@MAP_LIST: - X:20 - Y:47 - Width:PARENT_RIGHT - 40 - Height:474 - Children: - ScrollItem@MAP_TEMPLATE: - Width:180 - Height:208 - X:2 - Y:0 - Visible:false - Children: - Label@TITLE: - X:2 - Y:PARENT_BOTTOM-47 - Width:PARENT_RIGHT-4 - Height:25 - Align:Center - Label@DETAILS: - Width:PARENT_RIGHT-4 - X:2 - Y:PARENT_BOTTOM-35 - Align:Center - Height:25 - Font:Tiny - Label@AUTHOR: - Width:PARENT_RIGHT-4 - X:2 - Y:PARENT_BOTTOM-26 - Align:Center - Height:25 - Font:Tiny - MapPreview@PREVIEW: - X:(PARENT_RIGHT - WIDTH)/2 - Y:4 - Width:160 - Height:160 - DropDownButton@GAMEMODE_FILTER: - X:PARENT_RIGHT - 220 - Y:17 - Width:200 - Height:25 - Button@BUTTON_OK: - X:PARENT_RIGHT - 295 - Y:PARENT_BOTTOM - 49 - Width:120 - Height:25 - Text:Ok - Font:Bold - Key:return - Button@BUTTON_CANCEL: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-49 - Width:120 - Height:25 - Text:Cancel - Font:Bold - Key:escape diff --git a/mods/d2k/chrome/modchooser.yaml b/mods/d2k/chrome/modchooser.yaml deleted file mode 100644 index e11d52b424..0000000000 --- a/mods/d2k/chrome/modchooser.yaml +++ /dev/null @@ -1,84 +0,0 @@ -Background@MODS_PANEL: - Logic:ModBrowserLogic - Width:740 - Height:500 - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Children: - Label@TITLE: - Text:Select Mod - Width:PARENT_RIGHT - Y:20 - Font:Bold - Align:Center - ScrollPanel@MOD_LIST: - X:15 - Y:70 - Width:710 - Height:PARENT_BOTTOM - 125 - Children: - ScrollItem@MOD_TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Label@TITLE: - X:10 - Width:200 - Height:25 - Label@AUTHOR: - X:PARENT_RIGHT-300 - Align:Center - Width:50 - Height:25 - Label@VERSION: - Width:140 - X:PARENT_RIGHT-150 - Align:Center - Height:25 - Container@MOD_LABELS: - Width:710-25 - Height:25 - X:15 - Y:45 - Children: - Label@TITLE: - Width:125 - Height:25 - X:0 - Y:0 - Text:Title - Align:Center - Font:Bold - Label@AUTHOR: - X:PARENT_RIGHT-300 - Align:Center - Width:50 - Height:25 - Text:Author - Font:Bold - Label@VERSION: - Width:140 - X:PARENT_RIGHT-150 - Align:Center - Height:25 - Text:Version - Font:Bold - Button@BACK_BUTTON: - Key:escape - X:PARENT_RIGHT-180 - Y:PARENT_BOTTOM-45 - Width:160 - Height:25 - Font:Bold - Text:Cancel - Button@LOAD_BUTTON: - Key:return - X:PARENT_RIGHT-360 - Y:PARENT_BOTTOM-45 - Width:160 - Height:25 - Font:Bold - Text:Load Mod diff --git a/mods/d2k/chrome/replaybrowser.yaml b/mods/d2k/chrome/replaybrowser.yaml deleted file mode 100644 index 45d2be39a1..0000000000 --- a/mods/d2k/chrome/replaybrowser.yaml +++ /dev/null @@ -1,102 +0,0 @@ -Background@REPLAYBROWSER_BG: - Logic:ReplayBrowserLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:700 - Height:410 - Children: - Label@REPLAYBROWSER_LABEL_TITLE: - X:0 - Y:20 - Width:PARENT_RIGHT - Height:25 - Text:Choose Replay - Align:Center - Font:Bold - ScrollPanel@REPLAY_LIST: - X:20 - Y:50 - Width:390 - Height:300 - Children: - ScrollItem@REPLAY_TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Label@TITLE: - X:10 - Width:PARENT_RIGHT-20 - Height:25 - Container@REPLAY_INFO: - X:0 - Y:0 - Width:PARENT_RIGHT - Height:PARENT_BOTTOM - Visible:false - Children: - MapPreview@MAP_PREVIEW: - X:PARENT_RIGHT-241 - Y:30 - Width:192 - Height:192 - Label@MAP_TITLE_LABEL: - X:PARENT_RIGHT - 200 - WIDTH - Y:250 - Align:Right - Width:70 - Height:20 - Text:Map: - Font:Bold - Label@MAP_TITLE: - X:PARENT_RIGHT - 195 - Y:250 - Align:Left - Width:70 - Height:20 - Label@DURATION_LABEL: - X:PARENT_RIGHT - 200 - WIDTH - Y:270 - Align:Right - Width:70 - Height:20 - Text:Duration: - Font:Bold - Label@DURATION: - X:PARENT_RIGHT - 195 - Y:270 - Align:Left - Width:70 - Height:20 - Label@PLAYERS_LABEL: - X:PARENT_RIGHT - 200 - WIDTH - Y:290 - Align:Right - Width:70 - Height:20 - Text:Players: - Font:Bold - Label@PLAYERS: - X:PARENT_RIGHT - 195 - Y:290 - Align:Left - Width:70 - Height:20 - Button@WATCH_BUTTON: - X:PARENT_RIGHT - 140 - 130 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Watch - Font:Bold - Key:return - Button@CANCEL_BUTTON: - X:PARENT_RIGHT - 140 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Cancel - Font:Bold - Key:escape diff --git a/mods/d2k/chrome/serverbrowser.yaml b/mods/d2k/chrome/serverbrowser.yaml deleted file mode 100644 index 8e96dc2d90..0000000000 --- a/mods/d2k/chrome/serverbrowser.yaml +++ /dev/null @@ -1,215 +0,0 @@ -Background@JOINSERVER_BG: - Logic:ServerBrowserLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:540 - Height:535 - Children: - Label@JOINSERVER_LABEL_TITLE: - X:0 - Y:20 - Width:PARENT_RIGHT - Height:25 - Text:Join Server - Align:Center - Font:Bold - ScrollPanel@SERVER_LIST: - X:20 - Y:50 - Width:500 - Height:425 - Children: - ScrollItem@SERVER_TEMPLATE: - Width:PARENT_RIGHT-27 - Height:68 - X:2 - Y:0 - Children: - MapPreview@MAP_PREVIEW: - X:2 - Y:2 - Width:64 - Height:64 - ShowSpawnPoints:no - Label@TITLE: - X:70 - Width:200 - Height:25 - Font:Bold - Label@MAP: - X:70 - Y:20 - Width:250 - Height:25 - Label@PLAYERS: - X:70 - Y:40 - Width:50 - Height:25 - Label@STATE: - Width:140 - X:PARENT_RIGHT-150 - Align:Right - Height:25 - Font:Bold - Label@IP: - Width:140 - X:PARENT_RIGHT-150 - Y:20 - Align:Right - Height:25 - Label@VERSION: - Width:140 - X:PARENT_RIGHT-150 - Y:40 - Align:Right - Height:25 - - Label@PROGRESS_LABEL: - X:(PARENT_RIGHT - WIDTH) / 2 - Y:PARENT_BOTTOM / 2 - HEIGHT - Width:150 - Height:30 - Text:Fetching games... - Align:Center - Button@REFRESH_BUTTON: - X:20 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Refresh - Font:Bold - Button@JOIN_BUTTON: - X:PARENT_RIGHT - 140 - 130 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Join - Font:Bold - Key:return - Button@BACK_BUTTON: - X:PARENT_RIGHT - 140 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Cancel - Font:Bold - Key:escape -Background@DIRECTCONNECT_BG: - Logic:DirectConnectLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:400 - Height:155 - Children: - Label@DIRECTCONNECT_LABEL_TITLE: - X:0 - Y:20 - Width:400 - Height:25 - Text:Direct Connect - Align:Center - Font:Bold - Label@ADDRESS_LABEL: - X:50 - Y:59 - Width:95 - Height:25 - Align:Right - Text:Server Address: - TextField@IP: - X:150 - Y:60 - Width:160 - MaxLength:50 - Height:25 - TextField@PORT: - X:315 - Y:60 - Width:55 - MaxLength:5 - Height:25 - Button@JOIN_BUTTON: - X:130 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Join - Font:Bold - Key:return - Button@BACK_BUTTON: - X:260 - Y:PARENT_BOTTOM - 45 - Width:120 - Height:25 - Text:Cancel - Font:Bold - Key:escape -Background@CONNECTIONFAILED_PANEL: - Logic:ConnectionFailedLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:450 - Height:150 - Children: - Label@CONNECTION_FAILED_TITLE: - X:0 - Y:20 - Width:450 - Height:25 - Text:Connection Failed - Align:Center - Font:Bold - Label@CONNECTING_DESC: - X:0 - Y:60 - Width:PARENT_RIGHT - Height:25 - Text:Could not connect to AAA.BBB.CCC.DDD:EEEE - Align:Center - Button@RETRY_BUTTON: - X:PARENT_RIGHT - 360 - Y:PARENT_BOTTOM - 45 - Width:160 - Height:25 - Text:Retry - Font:Bold - Key:return - Button@ABORT_BUTTON: - X:PARENT_RIGHT - 180 - Y:PARENT_BOTTOM - 45 - Width:160 - Height:25 - Text:Cancel - Font:Bold - Key:escape -Background@CONNECTING_PANEL: - Logic:ConnectionLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM - HEIGHT)/2 - Width:450 - Height:150 - Children: - Label@CONNECTING_TITLE: - X:0 - Y:20 - Width:450 - Height:25 - Text:Connecting - Align:Center - Font:Bold - Label@CONNECTING_DESC: - X:0 - Y:60 - Width:PARENT_RIGHT - Height:25 - Text:Connecting to AAA.BBB.CCC.DDD:EEEE... - Align:Center - Button@ABORT_BUTTON: - X:PARENT_RIGHT - 180 - Y:PARENT_BOTTOM - 45 - Width:160 - Height:25 - Text:Abort - Font:Bold - Key:escape diff --git a/mods/d2k/chrome/settings.yaml b/mods/d2k/chrome/settings.yaml deleted file mode 100644 index 12f6c33b04..0000000000 --- a/mods/d2k/chrome/settings.yaml +++ /dev/null @@ -1,219 +0,0 @@ -Background@SETTINGS_MENU: - Logic:SettingsMenuLogic - X:(WINDOW_RIGHT - WIDTH)/2 - Y:(WINDOW_BOTTOM- HEIGHT)/2 - Width: 450 - Height: 350 - Children: - Label@SETTINGS_LABEL_TITLE: - X:0 - Y:20 - Width:450 - Height:25 - Text:Settings - Align:Center - Font:Bold - Button@BUTTON_CLOSE: - X:PARENT_RIGHT - 180 - Y:PARENT_BOTTOM - 45 - Width:160 - Height:25 - Text:Close - Font:Bold - Key:escape - Container@TAB_CONTAINER: - X:0 - Y:50 - Width:PARENT_RIGHT - Height:25 - Children: - Button@GENERAL: - X:45 - Y:0 - Width:90 - Height:25 - Text:General - Font:Bold - Button@AUDIO: - X:135 - Y:0 - Width:90 - Height:25 - Text:Audio - Font:Bold - Button@DISPLAY: - X:225 - Y:0 - Width:90 - Height:25 - Text:Display - Font:Bold - Button@DEBUG: - X:315 - Y:0 - Width:90 - Height:25 - Text:Debug - Font:Bold - Container@GENERAL_PANE: - X:37 - Y:100 - Width:PARENT_RIGHT - 37 - Height:PARENT_BOTTOM - 100 - Visible: true - Children: - Label@SETTINGS_PLAYER_NAME: - X:0 - Y:10 - Text: Player Name: - TextField@NAME: - Text:Name - Width:139 - Height:25 - X:90 - Y:0 - MaxLength:16 - Checkbox@EDGE_SCROLL: - X:0 - Y:30 - Width:200 - Height:20 - Text: Enable Edge Scrolling - Label@EDGE_SCROLL_AMOUNT_LABEL: - X:0 - Y:70 - Text: Scroll Speed - Slider@EDGE_SCROLL_AMOUNT: - X:130 - Y:60 - Width:250 - Height:20 - Ticks:5 - MinimumValue: 10 - MaximumValue: 50 - Checkbox@INVERSE_SCROLL: - X:0 - Y:90 - Width:200 - Height:20 - Text: Invert Mouse Drag Scrolling - Checkbox@TEAMCHAT_TOGGLE: - X:0 - Y:120 - Width:200 - Height:20 - Text: Shift-Enter Toggles Team Chat - Checkbox@SHOW_SHELLMAP: - X:0 - Y:150 - Width:200 - Height:20 - Text: Show Shellmap - Container@AUDIO_PANE: - X:37 - Y:100 - Width:PARENT_RIGHT - 37 - Height:PARENT_BOTTOM - 100 - Visible: false - Children: - Label@SOUND_VOLUME_LABEL: - X:0 - Y:10 - Text: Sound Volume - Slider@SOUND_VOLUME: - X:100 - Y:0 - Width:250 - Height:20 - Ticks:5 - Label@MUSIC_VOLUME_LABEL: - X:0 - Y:40 - Text: Music Volume - Slider@MUSIC_VOLUME: - X:100 - Y:30 - Width:250 - Height:20 - Ticks:5 - Container@DISPLAY_PANE: - X:37 - Y:100 - Width:PARENT_RIGHT - 37 - Height:PARENT_BOTTOM - 100 - Visible: false - Children: - Label@MODE_LABEL: - X:0 - Y:0 - Width:45 - Height:25 - Text:Mode: - DropDownButton@MODE_DROPDOWN: - X:50 - Y:1 - Width:170 - Height:25 - Font:Regular - Text:Windowed - Container@WINDOW_RESOLUTION: - X:220 - Y:0 - Children: - Label@At: - Text:@ - Font:Bold - Y:0-1 - Height:25 - Width:25 - Align:Center - TextField@WINDOW_WIDTH: - X:25 - Width:45 - Height:25 - MaxLength:5 - Label@X: - Text:x - Font:Bold - X:70 - Y:0-1 - Height:25 - Width:15 - Align:Center - TextField@WINDOW_HEIGHT: - X:85 - Width:45 - Height:25 - MaxLength:5 - Label@VIDEO_DESC: - Y:25 - Width:PARENT_RIGHT - Height:25 - Font:Tiny - Align:Center - Text:Mode/Resolution changes will be applied after the game is restarted - Checkbox@PIXELDOUBLE_CHECKBOX: - Y:50 - Width:200 - Height:20 - Font:Regular - Text:Enable Pixel Doubling - Container@DEBUG_PANE: - X:37 - Y:100 - Width:PARENT_RIGHT - 37 - Height:PARENT_BOTTOM - 100 - Visible: false - Children: - Checkbox@PERFDEBUG_CHECKBOX: - X:0 - Y:0 - Width:300 - Height:20 - Text:Show Performance Information - Checkbox@CHECKUNSYNCED_CHECKBOX: - X:0 - Y:30 - Width:300 - Height:20 - Text:Check Sync around Unsynced Code \ No newline at end of file diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index d4b5cbbcbe..0e4406f829 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -62,17 +62,17 @@ Assemblies: ChromeLayout: mods/d2k/chrome/gameinit.yaml - mods/d2k/chrome/ingame.yaml + mods/ra/chrome/ingame.yaml mods/d2k/chrome/mainmenu.yaml - mods/d2k/chrome/settings.yaml + mods/ra/chrome/settings.yaml mods/d2k/chrome/lobby.yaml - mods/d2k/chrome/map-chooser.yaml - mods/d2k/chrome/create-server.yaml - mods/d2k/chrome/serverbrowser.yaml - mods/d2k/chrome/replaybrowser.yaml - mods/d2k/chrome/dropdowns.yaml - mods/d2k/chrome/modchooser.yaml - mods/d2k/chrome/cheats.yaml + mods/ra/chrome/map-chooser.yaml + mods/ra/chrome/create-server.yaml + mods/ra/chrome/serverbrowser.yaml + mods/ra/chrome/replaybrowser.yaml + mods/ra/chrome/dropdowns.yaml + mods/ra/chrome/modchooser.yaml + mods/ra/chrome/cheats.yaml Weapons: mods/d2k/weapons.yaml From 7cbed30dc6521ef98bbab8d1d8570f7506053ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 18 Jun 2012 17:40:22 +0200 Subject: [PATCH 3/7] fix cnc palette issues cursor not supporting transparency; wrong icon, fx palette --- OpenRA.Game/Graphics/CursorProvider.cs | 7 ++++++- mods/cnc/rules/system.yaml | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index d60f706dcf..5d7fe88079 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -25,9 +25,14 @@ namespace OpenRA.Graphics { cursors = new Dictionary(); var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); + var transparent = false; + var currentMod = Mod.AllMods[Game.modData.Manifest.Mods[0]]; + + if (currentMod.Id == "d2k") + transparent = true; foreach (var s in sequences.NodesDict["Palettes"].Nodes) - Game.modData.Palette.AddPalette(s.Key, new Palette(FileSystem.Open(s.Value.Value), true)); + Game.modData.Palette.AddPalette(s.Key, new Palette(FileSystem.Open(s.Value.Value), transparent)); foreach (var s in sequences.NodesDict["Cursors"].Nodes) LoadSequencesForCursor(s.Key, s.Value); diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 45ce795c21..38d0b79717 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -74,10 +74,10 @@ World: Name: staticterrain PaletteFromFile@chrome: Name: chrome - Filename: temperat.pal + Filename: cursor.pal PaletteFromFile@effect: Name: effect - Filename: temperat.pal + Filename: cursor.pal PaletteFromRGBA@shadow: Name: shadow R: 0 From c6a1031ab78cab1d69b1b1a66d59539fd3d0cc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 18 Jun 2012 17:07:56 +0200 Subject: [PATCH 4/7] fix cnc palette issues cursor not supporting transparency which is only needed for d2k --- mods/cnc/rules/system.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 38d0b79717..45ce795c21 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -74,10 +74,10 @@ World: Name: staticterrain PaletteFromFile@chrome: Name: chrome - Filename: cursor.pal + Filename: temperat.pal PaletteFromFile@effect: Name: effect - Filename: cursor.pal + Filename: temperat.pal PaletteFromRGBA@shadow: Name: shadow R: 0 From 26b75f406f1f4eb427e353eb8937da026a1d8803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 19 Jun 2012 07:43:06 +0200 Subject: [PATCH 5/7] new settings Transparent for cursors.yaml --- OpenRA.Game/Graphics/CursorProvider.cs | 3 +-- mods/d2k/cursors.yaml | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index 5d7fe88079..032ae22447 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -26,9 +26,8 @@ namespace OpenRA.Graphics cursors = new Dictionary(); var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); var transparent = false; - var currentMod = Mod.AllMods[Game.modData.Manifest.Mods[0]]; - if (currentMod.Id == "d2k") + if (sequences.NodesDict.ContainsKey("Transparent")) transparent = true; foreach (var s in sequences.NodesDict["Palettes"].Nodes) diff --git a/mods/d2k/cursors.yaml b/mods/d2k/cursors.yaml index 35fdd6a91b..e001140b8b 100644 --- a/mods/d2k/cursors.yaml +++ b/mods/d2k/cursors.yaml @@ -1,4 +1,6 @@ -Palettes: +Transparent: + +Palettes: cursor: cursor.pal mouse: d2k.pal From 84d623397b2a99dd959d8efa4797853e21d980a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 19 Jun 2012 21:36:10 +0200 Subject: [PATCH 6/7] made PaletteFormat configurable as suggested in issue #2219 --- OpenRA.FileFormats/PlayerColorRemap.cs | 30 ++++++++----------- .../Traits/World/PlayerColorPalette.cs | 4 +-- OpenRA.Mods.RA/ColorPickerPaletteModifier.cs | 6 ++-- OpenRA.Utility/Command.cs | 21 ++++++------- OpenRA.Utility/Program.cs | 2 +- mods/cnc/rules/system.yaml | 2 +- mods/d2k/rules/system.yaml | 2 +- mods/ra/rules/system.yaml | 1 + 8 files changed, 32 insertions(+), 36 deletions(-) diff --git a/OpenRA.FileFormats/PlayerColorRemap.cs b/OpenRA.FileFormats/PlayerColorRemap.cs index dd071ca122..e318096952 100755 --- a/OpenRA.FileFormats/PlayerColorRemap.cs +++ b/OpenRA.FileFormats/PlayerColorRemap.cs @@ -14,40 +14,34 @@ using System.Linq; namespace OpenRA.FileFormats { - // TODO: ship this out of here. - public enum PaletteFormat { ra, cnc, d2k } public class PlayerColorRemap : IPaletteRemap { Dictionary remapColors; - static readonly int[] CncRemapRamp = new[] { 0, 2, 4, 6, 8, 10, 13, 15, 1, 3, 5, 7, 9, 11, 12, 14 }; - static readonly int[] NormalRemapRamp = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - - static int GetRemapBase(PaletteFormat fmt) + static int[] GetRemapRamp(int[] Ramp) { - return (fmt == PaletteFormat.cnc) ? 0xb0 : (fmt == PaletteFormat.d2k) ? 240 : 80; + int[] RemapRamp = new int[Ramp.Length]; + for (var i=0; i < Ramp.Length; i++) + RemapRamp[i] = Ramp[i] - Ramp[0]; + + return RemapRamp; } - static int[] GetRemapRamp(PaletteFormat fmt) + public static int GetRemapIndex(int[] Ramp, int i) { - return (fmt == PaletteFormat.cnc) ? CncRemapRamp : NormalRemapRamp; + return Ramp[i]; } - public static int GetRemapIndex(PaletteFormat fmt, int i) - { - return GetRemapBase(fmt) + GetRemapRamp(fmt)[i]; - } - - public PlayerColorRemap(PaletteFormat fmt, ColorRamp c) + public PlayerColorRemap(int[] Ramp, ColorRamp c) { var c1 = c.GetColor(0); var c2 = c.GetColor(1); /* temptemp: this can be expressed better */ - var baseIndex = GetRemapBase(fmt); - var ramp = GetRemapRamp(fmt); + var baseIndex = Ramp[0]; + var RemapRamp = GetRemapRamp(Ramp); - remapColors = ramp.Select((x, i) => Pair.New(baseIndex + i, Exts.ColorLerp(x / 16f, c1, c2))) + remapColors = RemapRamp.Select((x, i) => Pair.New(baseIndex + i, Exts.ColorLerp(x / 16f, c1, c2))) .ToDictionary(u => u.First, u => u.Second); } diff --git a/OpenRA.Game/Traits/World/PlayerColorPalette.cs b/OpenRA.Game/Traits/World/PlayerColorPalette.cs index 19c7d256af..6aaf6b5fc8 100644 --- a/OpenRA.Game/Traits/World/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/World/PlayerColorPalette.cs @@ -17,7 +17,7 @@ namespace OpenRA.Traits { public readonly string BasePalette = null; public readonly string BaseName = "player"; - public readonly PaletteFormat PaletteFormat = PaletteFormat.ra; + public readonly int[] RemapIndex = new[] {}; public object Create( ActorInitializer init ) { return new PlayerColorPalette( init.self.Owner, this ); } } @@ -37,7 +37,7 @@ namespace OpenRA.Traits { var paletteName = "{0}{1}".F( info.BaseName, owner.InternalName ); var newpal = new Palette(wr.GetPalette(info.BasePalette), - new PlayerColorRemap(info.PaletteFormat, owner.ColorRamp)); + new PlayerColorRemap(info.RemapIndex, owner.ColorRamp)); wr.AddPalette(paletteName, newpal); } } diff --git a/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs b/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs index 2f4f9937bd..ba343c9d53 100644 --- a/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs +++ b/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA public class ColorPickerPaletteModifier : IPalette, IPaletteModifier { ColorPickerPaletteModifierInfo Info; - PaletteFormat format; + int[] index; public ColorRamp Ramp; public ColorPickerPaletteModifier(ColorPickerPaletteModifierInfo info) { Info = info; } @@ -34,14 +34,14 @@ namespace OpenRA.Mods.RA { var info = Rules.Info["player"].Traits.WithInterface() .First(p => p.BaseName == Info.PlayerPalette); - format = info.PaletteFormat; + index = info.RemapIndex; wr.AddPalette("colorpicker", wr.GetPalette(info.BasePalette)); } public void AdjustPalette(Dictionary palettes) { palettes["colorpicker"] = new Palette(palettes["colorpicker"], - new PlayerColorRemap(format, Ramp)); + new PlayerColorRemap(index, Ramp)); } } } diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index 6fc2d02acc..3831273ccf 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -368,24 +368,25 @@ namespace OpenRA.Utility var remap = new Dictionary(); /* the first 4 entries are fixed */ - for( var i = 0; i < 4; i++ ) + for (var i = 0; i < 4; i++) remap[i] = i; - var srcPaletteType = Enum.Parse(args[1].Split(':')[0]); - var destPaletteType = Enum.Parse(args[2].Split(':')[0]); + // TODO: should read that from mods/*/system.yaml + var srcRemapIndex = Enum.Parse(args[1].Split(':')[0]); + var destRemapIndex = Enum.Parse(args[2].Split(':')[0]); - /* the remap range is always 16 entries, but their location and order changes */ - for( var i = 0; i < 16; i++ ) - remap[ PlayerColorRemap.GetRemapIndex(srcPaletteType, i) ] - = PlayerColorRemap.GetRemapIndex(destPaletteType, i); + // the remap range is always 16 entries, but their location and order changes + for (var i = 0; i < 16; i++) + remap[PlayerColorRemap.GetRemapIndex(srcRemapIndex, i)] + = PlayerColorRemap.GetRemapIndex(destRemapIndex, i); - /* map everything else to the best match based on channel-wise distance */ + // map everything else to the best match based on channel-wise distance var srcPalette = Palette.Load(args[1].Split(':')[1], false); var destPalette = Palette.Load(args[2].Split(':')[1], false); var fullIndexRange = Exts.MakeArray(256, x => x); - for( var i = 0; i < 256; i++ ) + for (var i = 0; i < 256; i++) if (!remap.ContainsKey(i)) remap[i] = fullIndexRange .Where(a => !remap.ContainsValue(a)) @@ -394,7 +395,7 @@ namespace OpenRA.Utility var srcImage = ShpReader.Load(args[3]); - using( var destStream = File.Create(args[4]) ) + using (var destStream = File.Create(args[4])) ShpWriter.Write(destStream, srcImage.Width, srcImage.Height, srcImage.Frames.Select( im => im.Image.Select(px => (byte)remap[px]).ToArray() )); } diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index d46783c004..08674a384c 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -60,7 +60,7 @@ namespace OpenRA.Utility Console.WriteLine(" --png SHPFILE PALETTE [--transparent] Convert a SHP to a PNG containing all of its frames, optionally setting up transparency"); Console.WriteLine(" --extract MOD[,MOD]* FILES Extract files from mod packages"); Console.WriteLine(" --tmp-png MOD[,MOD]* THEATER FILES Extract terrain tiles to PNG"); - Console.WriteLine(" --remap SRCMOD:PAL DESTMOD:PAL SRCSHP DESTSHP Remap SHPs to another palette"); + Console.WriteLine(" --remap SRCREMAPINDEX:PAL DESTREMAPINDEX:PAL SRCSHP DESTSHP Remap SHPs to another palette"); Console.WriteLine(" --r8 R8FILE PALETTE START END FILENAME [--transparent] [--infrantry] [--vehicle] [--projectile] [--building] [--wall] [--tileset] Convert Dune 2000 DATA.R8 to PNGs choosing start- and endframe as well as type for correct offset to append multiple frames to one PNG named by filename optionally setting up transparency."); Console.WriteLine(" --transpose SRCSHP DESTSHP START N M [START N M ...] Transpose the N*M block of frames starting at START."); } diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index 45ce795c21..9d0d944595 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -53,7 +53,7 @@ Player: orca: 5% PlayerColorPalette: BasePalette: terrain - PaletteFormat: cnc + RemapIndex: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190 BaseAttackNotifier: World: diff --git a/mods/d2k/rules/system.yaml b/mods/d2k/rules/system.yaml index 6c57bc451c..2c27208c52 100644 --- a/mods/d2k/rules/system.yaml +++ b/mods/d2k/rules/system.yaml @@ -101,7 +101,7 @@ Player: SquadSize: 10 PlayerColorPalette: BasePalette: d2k - PaletteFormat: d2k + RemapIndex: 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 BaseAttackNotifier: Audio: AI_ATACK.AUD diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index a25b700feb..42c77b2350 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -185,6 +185,7 @@ Player: SquadSize: 7 PlayerColorPalette: BasePalette: terrain + RemapIndex: 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 DebugResourceCash: DebugResourceOre: DebugResourceOreCapacity: From f4cb798c8b594a894af52e13dd4b42f9ec643eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 20 Jun 2012 09:51:00 +0200 Subject: [PATCH 7/7] small code optimisations as suggested --- OpenRA.FileFormats/PlayerColorRemap.cs | 5 +---- OpenRA.Game/Traits/World/PlayerColorPalette.cs | 2 +- OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenRA.FileFormats/PlayerColorRemap.cs b/OpenRA.FileFormats/PlayerColorRemap.cs index e318096952..ec07d24235 100755 --- a/OpenRA.FileFormats/PlayerColorRemap.cs +++ b/OpenRA.FileFormats/PlayerColorRemap.cs @@ -21,10 +21,7 @@ namespace OpenRA.FileFormats static int[] GetRemapRamp(int[] Ramp) { - int[] RemapRamp = new int[Ramp.Length]; - for (var i=0; i < Ramp.Length; i++) - RemapRamp[i] = Ramp[i] - Ramp[0]; - + var RemapRamp = Ramp.Select(r => r - Ramp[0]).ToArray(); return RemapRamp; } diff --git a/OpenRA.Game/Traits/World/PlayerColorPalette.cs b/OpenRA.Game/Traits/World/PlayerColorPalette.cs index 6aaf6b5fc8..bb3547aaea 100644 --- a/OpenRA.Game/Traits/World/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/World/PlayerColorPalette.cs @@ -17,7 +17,7 @@ namespace OpenRA.Traits { public readonly string BasePalette = null; public readonly string BaseName = "player"; - public readonly int[] RemapIndex = new[] {}; + public readonly int[] RemapIndex = {}; public object Create( ActorInitializer init ) { return new PlayerColorPalette( init.self.Owner, this ); } } diff --git a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj index eb480236de..8a55f226ee 100644 --- a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj +++ b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj @@ -91,7 +91,4 @@ cd "$(SolutionDir)" OpenRA.Mods.RA - - - \ No newline at end of file