Compare commits

...

933 Commits

Author SHA1 Message Date
Chris Forbes
2747fadd96 #657 give a useful error message when a sequence references frames outside the range that actually exist 2011-12-03 19:23:14 +13:00
Chris Forbes
66c59add94 write RadarWidget transforms sanely 2011-12-03 11:38:09 +13:00
Chris Forbes
4610461a81 fix naming convention in RadarWidget 2011-12-03 11:29:27 +13:00
Chris Forbes
c1cbe0f0f5 Simplify some of the mess in RadarBinWidget 2011-12-03 11:28:42 +13:00
Chris Forbes
a566a372f5 (2/2) #1210 Remove QueueResupplyActivities entirely, just queue ResupplyAircraft 2011-12-03 10:16:10 +13:00
Chris Forbes
7b06e39390 (1/2) #1210 Untangling QueueResupplyActivities 2011-12-03 10:16:10 +13:00
Chris Forbes
b8c4ff8668 tidy GetTargetQueue 2011-11-29 11:46:57 +13:00
Chris Forbes
3d25e59e9e update AUTHORS 2011-11-29 10:13:17 +13:00
Chris Forbes
1df572e6ee tidy in MasterServerPinger 2011-11-29 10:01:55 +13:00
Kenny Hoxworth
98d4af18a4 Don't cancel the FlyAttack activity if the activity has already been canceled. The Tick routine calls Cancel() on FlyAttack, which removes any NextActivity that may have been set by an outside listener. This is the case with a rare bug causing planes to be killed, removed from the playable game, but still existing in the game world. 2011-11-29 08:57:04 +13:00
Matthew Bowra-Dean
0f97466a75 Remove spurious .swp file 2011-11-28 09:19:46 +13:00
Chris Forbes
58a6c01c3b add framelimiter as per Joseph_Vissarion's patch 2011-11-26 16:17:34 +13:00
Chris Forbes
8bdab6a5f2 tidy in Settings 2011-11-26 15:54:43 +13:00
Mark Olson
f043aa6366 DISCONNECT should use a LeaveGame'ish method.
It should be moved out of IngameChromeLogic, but I don't know where to..
2011-11-25 18:03:12 +13:00
Mark Olson
8933b201f1 Add buttons to Observe or Leave after a user's game ends. 2011-11-25 18:03:04 +13:00
Mark Olson
2bb968d0d3 Hide Chrome once we have Won or Lost 2011-11-25 18:01:34 +13:00
Raymond Martineau
bf222425fc Fix bug #1271 2011-11-25 17:49:05 +13:00
Chris Forbes
0ea9e06c22 remove spurious parameter from ScanAndAttack 2011-11-25 17:41:19 +13:00
Chris Forbes
54e8266e37 tidy AttackOrderTargeter 2011-11-25 17:38:58 +13:00
Chris Forbes
2679e91b03 remove duplication in cnc order button wiring 2011-11-25 17:22:22 +13:00
Chris Forbes
2462902d8b remove some duplication in binding order buttons 2011-11-25 15:12:04 +13:00
Chris Forbes
55f811faf5 remove some duplication in global order OGs 2011-11-25 15:11:49 +13:00
Chris Forbes
45c41b6696 allow building repair always 2011-11-24 15:23:08 +13:00
Chris Forbes
6040b55d17 update CHANGELOG 2011-11-08 09:17:23 +13:00
Curtis S
77fc6199fe New serverbrowser for RA and CNC 2011-11-06 22:49:40 -07:00
Curtis S
49bf93085f Added support to GivesBounty for setting player Stances which give bounties 2011-11-06 13:24:20 -07:00
Curtis S
aa7d688905 Update ra mapchooser chrome as per lobby code merge 2011-11-06 10:12:16 -07:00
Chris Forbes
83929af62a tidy 2011-11-06 22:13:21 +13:00
Chris Forbes
6cb8ee1f9f expose appropriate *Inits, and make them work in editor 2011-11-06 18:17:13 +13:00
Chris Forbes
772734d032 merge cnc and ra lobby, fixes #1267, #1224, #106, others 2011-11-06 17:01:00 +13:00
Chris Forbes
4576eaadd6 more tidy 2011-11-06 11:39:49 +13:00
Chris Forbes
c20d71c9af make CncLobbyLogic tolerant of missing music button 2011-11-06 11:38:44 +13:00
Chris Forbes
40b89d177f make some cnc helper functions not public 2011-11-06 11:34:08 +13:00
Chris Forbes
314db743fc change CncConnectingLogic to CncConnectionLogic to match filename 2011-11-06 11:21:47 +13:00
Chris Forbes
9b5c7c2379 remove dead GetInheritanceChain in ActorInfo 2011-11-06 11:09:30 +13:00
Chris Forbes
564fdd650d add mechanism for traits to export the *Inits they can use 2011-11-05 12:29:55 +13:00
Chris Forbes
bd90666c07 tidy 2011-11-05 11:40:13 +13:00
Chris Forbes
cd155b21c9 tidy up some bizarre namespacing 2011-11-04 20:13:41 +13:00
Chris Forbes
cbee1513f3 fix formatting in CanPowerDown 2011-11-04 20:02:09 +13:00
Chris Forbes
6932db1d05 fixed #1264 - squish sound is positioned now 2011-11-04 19:45:02 +13:00
Chris Forbes
718742be4a fixed #1263 - don't trash the current directory on exporting a minimap 2011-11-04 19:28:19 +13:00
Chris Forbes
4ad7af8a58 fixed #1245 - repopulate the player chooser in the editor after refreshing the playerlist 2011-11-04 19:21:33 +13:00
Chris Forbes
57e2d4f9b1 fixed #1237 - crash in UpdateCurrentMap 2011-11-04 19:16:53 +13:00
Chris Forbes
5a029e337a fixed #1257 - predict stance changes on the client 2011-11-04 19:09:46 +13:00
Chris Forbes
bc5efa3fc5 #1241 fixed - crash in ChooseBuildTabOnSelect.SelectionChanged 2011-11-04 19:03:38 +13:00
Chris Forbes
192cbaf744 fix namespace for ChooseBuildTabOnSelect 2011-11-04 19:00:34 +13:00
Chris Forbes
053d661ed7 #1251 fixed - ss,msub,stnk have correct initial stance and can autotarget 2011-11-04 16:40:43 +13:00
Chris Forbes
9ac912fa0e #1262 fixed -- initial unit stance via AutoTarget:InitialStance: 2011-11-04 16:33:20 +13:00
Chris Forbes
b6c2b928cb fixed #1249 - use unit priority logic to select initial unit in doubleclick 2011-11-04 08:46:14 +13:00
Chris Forbes
58b437b7ea fix #1246 2011-11-04 08:29:46 +13:00
Curtis S
7498af6b66 Update CHANGELOG 2011-11-01 20:54:04 -06:00
Chris Forbes
b88a32759c fixed #800 - infantry can walk on AT mines 2011-11-01 22:16:35 +13:00
Chris Forbes
c9fd874b07 unify colorpickers across ra and cnc 2011-11-01 22:00:29 +13:00
Chris Forbes
a060d99780 add dropdown in editor for choosing owner of new actors 2011-11-01 22:00:29 +13:00
Seru
7bc7fbc006 Added ra map: Asymetric Battle 2011-11-01 22:00:29 +13:00
Nukem
ce8bcd1576 Updated ra map: Pandemonium 2011-11-01 22:00:29 +13:00
Curtis S
465f917836 Removed ra map: bavarian redux 2011-11-01 22:00:29 +13:00
Curtis S
de7fbfc927 Fixed a spawnpoint on map River War 2 2011-11-01 22:00:28 +13:00
Chris Forbes
2eac701aab make SpawnMPUnits initial unit configurable 2011-11-01 22:00:28 +13:00
Chris Forbes
0edda0fb31 make bot building repair controllable via yaml 2011-11-01 22:00:28 +13:00
Raymond Martineau
72c6a428c9 Fix exception, requiring usage of IComparable 2011-11-01 22:00:28 +13:00
Chris Forbes
986bf039fa remove HackyAI -> MPStartLocations dep; implement aggro as per alzeih's old patch 2011-11-01 22:00:28 +13:00
Chris Forbes
4dc3013cd0 slight tidy to HackyAI 2011-11-01 22:00:28 +13:00
Chris Forbes
58cae272c6 push unit queues for HackyAI out to yaml 2011-11-01 22:00:28 +13:00
Chris Forbes
1df9003fec fixed #1169 - bot rallypoint debug changed to BotDebug() 2011-11-01 22:00:20 +13:00
Chris Forbes
f83c9fd4d7 add IEnum<T>.JoinWith, use it to clean up a bunch of things 2011-11-01 21:57:58 +13:00
Chris Forbes
8111ccbea6 tidy projectfiles, Map 2011-11-01 21:57:58 +13:00
Chris Forbes
c50aae25d3 remove spurious .ToArray() in MainMenuButtonsLogic 2011-11-01 21:57:57 +13:00
Chris Forbes
7a6f4d3b04 relax items type for DropDownButtonLogic.ShowDropDown 2011-11-01 21:57:57 +13:00
Chris Forbes
eaa4d06052 tidy readiness checks in lobby 2011-11-01 21:57:57 +13:00
Chris Forbes
53599f062c fix indent in UnitOrders 2011-11-01 21:57:57 +13:00
Chris Forbes
2a64df997a fixed #1244 - cnc lobby crash on player joining 2011-10-31 09:12:10 +13:00
Chris Forbes
5bb535b50c factor out Marshal.SizeOf calls 2011-10-31 09:11:47 +13:00
Chris Forbes
77ebd5d6de removing more renderer code duplication; cleanup 2011-10-31 09:11:47 +13:00
Chris Forbes
9279161de6 tidy in OreRefinery, Harvester, CncLobbyLogic, ScaredyCat 2011-10-31 09:11:33 +13:00
Chris Forbes
268f06caf0 use actor type string rather than ProductionItem in ChooseBuildLocation 2011-10-31 09:10:01 +13:00
Chris Forbes
3a5cce1f1f Split HackyAI.BaseBuilder into its own file; Move hackyAI components into OpenRA.Mods.RA.AI namespace and dir 2011-10-31 09:10:01 +13:00
Chris Forbes
bfddbeeb02 fixed #1232 -- bots repair their own damaged buildings 2011-10-31 09:10:01 +13:00
Chris Forbes
92f5d67ef1 fix stupid naming in Reservable 2011-10-31 09:10:01 +13:00
Chris Forbes
e602e086f3 remove unused ReplaceWithActor trait 2011-10-24 17:27:11 +13:00
Chris Forbes
35b0231746 fixed #669 -- helicopters bob slightly in flight 2011-10-24 17:12:23 +13:00
Curtis S
f5807f5f3b Fix #1230: crash when no hpad owned by player 2011-10-23 14:53:33 -06:00
Curtis S
d9fbee6e01 Update CHANGELOG 2011-10-23 18:44:23 +13:00
Curtis S
a04ab94717 Hellfire (longbow) missiles now fire in bursts of 2 2011-10-22 18:50:03 -06:00
Tirili
4f505eb6a1 Add ability to disable the shellmap 2011-10-23 13:24:26 +13:00
Tirili
6174ccc882 Change World.DisableTick to World.EnableTick 2011-10-23 13:11:39 +13:00
Chris Forbes
7cc0a45727 give migs 4 salvos x 2 missiles, slightly increase damage per missile 2011-10-23 12:55:13 +13:00
Chris Forbes
deeef336a1 group IPostRenderSelection impls by type, not by actor 2011-10-23 12:40:08 +13:00
Chris Forbes
ce8267992a remove self parameter from IPostRenderSelection.RenderAfterWorld 2011-10-23 12:23:15 +13:00
Chris Forbes
b9ac25e044 split sprite-based and line-based things in Selectable into two traits 2011-10-23 12:13:11 +13:00
Chris Forbes
4168e54715 tidy in Selectable 2011-10-23 11:50:53 +13:00
Chris Forbes
aef3ff6e65 remove some redundant SelectableInfo lookups 2011-10-23 11:49:38 +13:00
Curtis S
eebfb34ea2 Fix #1187; aircraft rearm properly now 2011-10-22 13:41:09 -06:00
Curtis S
b1b9d1fca2 Fixed open areas on map Man to Man 2011-10-22 13:27:34 -06:00
Curtis S
7d9641e195 Update helis logic for returning to hpad, to mirror that of planes returning to aflds 2011-10-22 13:26:51 -06:00
Curtis S
9e21282341 Fix #725; planes don't stack afld / planes will fly to empty aflds 2011-10-22 13:23:30 -06:00
Curtis S
935c2eff31 Changed SupplyTruck's order string to something more appropriate 2011-10-22 13:21:42 -06:00
Chris Forbes
ff86c4d7fa update AUTHORS 2011-10-22 16:43:03 +13:00
Nukem
143f9e0e84 added RA map: Man to Man 2011-10-22 13:05:48 +13:00
Christer Ulfsparre
dec8c8ba4b Added ability to join a server on startup, for gamelist apps. 2011-10-22 12:33:46 +13:00
Chris Forbes
c0b5455016 fixed #649 - remember last played map 2011-10-22 11:51:32 +13:00
Chris Forbes
e7ed9a1ff7 tidy up select-all-on-screen 2011-10-22 11:30:09 +13:00
Chris Forbes
eec751f76a remove duplicated edgescroll code in cnc 2011-10-22 10:25:50 +13:00
Chris Forbes
52cec1e170 reduce default tooltip delay in cnc to a playable level 2011-10-21 23:20:30 +13:00
Chris Forbes
a290af6fb5 tidy SiloBarWidget 2011-10-21 23:12:06 +13:00
Chris Forbes
c8122a13ff tidy in ProductionPaletteWidget 2011-10-21 23:00:23 +13:00
Chris Forbes
00372f4748 more general tidying in CNC widget code 2011-10-21 22:58:49 +13:00
Chris Forbes
4c26710ccb swap args to PlayerColorRemap 2011-10-21 22:15:51 +13:00
Chris Forbes
4a30019536 add equality comparisons to ColorRamp 2011-10-21 22:11:18 +13:00
Chris Forbes
0c2e1f81da tidy in ColorRamp 2011-10-21 22:10:30 +13:00
Chris Forbes
7106f1fe74 another formatting tweak 2011-10-21 19:38:19 +13:00
Chris Forbes
0a977b2940 work around for broken type inference engine in gmcs-2.6.7 2011-10-21 19:38:06 +13:00
Chris Forbes
6010034b4a remove ObjectCreator.Param and all associated nonsense 2011-10-21 18:16:07 +13:00
Chris Forbes
4c8e048c2c relax ObjectCreator.Param requirement on non-renamed args 2011-10-21 17:38:00 +13:00
Chris Forbes
88bfee872f more tidy in DrawLineToTarget 2011-10-21 17:03:18 +13:00
Chris Forbes
3548dacad3 collapse useless layer of crap in DrawLineToTarget 2011-10-21 16:52:50 +13:00
Chris Forbes
b7b2db9ace remove some insanity in DrawLineToTarget 2011-10-21 16:34:54 +13:00
Chris Forbes
b119c14599 fix whitespace in Settings 2011-10-21 10:22:43 +13:00
Curtis S
d47c4f7ca2 Fixed a spawnpoint in map daejeon 2011-10-19 18:15:44 -06:00
Chris Forbes
808464f4d5 get RA replay browser closer to CNC version 2011-10-19 20:04:05 +13:00
Chris Forbes
f5c4a94f93 change currentSummary -> currentReplay in CncReplayBrowserLogic 2011-10-19 19:57:04 +13:00
Chris Forbes
a7c276849d fix formatting 2011-10-19 19:54:05 +13:00
Chris Forbes
10733c3a31 remove useless .ToString() calls in replay browsers 2011-10-19 19:50:02 +13:00
Chris Forbes
03ddbac83b change ReplaySummary to Replay; move to OpenRA.Network 2011-10-19 19:45:13 +13:00
Chris Forbes
a3897dc7a8 tidy DirectConnectLogic 2011-10-19 19:38:47 +13:00
Chris Forbes
2d4b00ec2a remove useless calls to ToArray() in *DirectConnectLogic 2011-10-19 19:34:23 +13:00
Chris Forbes
42aa8a57c5 unify {RA,Cnc}DownloadPackagesLogic 2011-10-19 19:32:28 +13:00
Chris Forbes
1c69f5bef9 add (another) backup file pattern to .gitignore 2011-10-19 16:02:01 +13:00
Chris Forbes
511c956117 fix title of map properties dialog 2011-10-19 10:13:46 +13:00
Chris Forbes
a5547eac97 fix typo in Bridge 2011-10-19 10:11:18 +13:00
Chris Forbes
325ec41182 remove dead functions from Arguments.cs 2011-10-18 21:58:17 +13:00
Chris Forbes
a1dd5cedd4 clean up duplicate trait lookup in RASpecialPowers 2011-10-18 21:52:58 +13:00
Chris Forbes
c790c41465 unify bot spawn choosers in CNC and RA 2011-10-18 21:39:12 +13:00
Chris Forbes
7161b8062e remove useless 'map' arg on ConvertToPreview 2011-10-18 20:55:49 +13:00
Chris Forbes
eddc4cc4b1 remove useless map var in CncLobbyLogic too 2011-10-18 20:47:48 +13:00
Chris Forbes
12968ff9b9 tidy LobbyLogic spawn chooser 2011-10-18 20:43:00 +13:00
Chris Forbes
7ef93f2cf5 remove useless var in LobbyLogic 2011-10-18 20:38:06 +13:00
Chris Forbes
59fdceb4fd convert Map.SpawnPoints to int2[]; tidy 2011-10-18 20:34:00 +13:00
Chris Forbes
0f7a744ef7 replace ridiculous GetSpawnColors function with something tidier 2011-10-18 20:23:10 +13:00
Chris Forbes
50010faf58 move duplicates of GetSpawnColors to LobbyInfo 2011-10-18 20:15:31 +13:00
Chris Forbes
89ea4d1e0a unify C&C and RA colorpicker palette manipulation code 2011-10-18 20:09:24 +13:00
Chris Forbes
bc6af1841b fix indents everywhere 2011-10-18 15:10:17 +13:00
Chris Forbes
227bbc109e fix wonky indent in WorldRenderer.cs 2011-10-18 14:55:51 +13:00
Chris Forbes
737756be51 fix formatting in Game.cs 2011-10-18 13:54:50 +13:00
Chris Forbes
1d5201d797 remove OpenRA.Renderer.SdlCommon.dll in windows uninstall 2011-10-17 17:36:00 +13:00
Curtis S
e29f838425 fixed author on map Paramount 2011-10-16 22:34:27 -06:00
Nukem
3432ce256a added RA map: Engagement 2011-10-16 22:33:11 -06:00
Nukem
cd8f8dbc0f added ore wells to ra map Mass Confliction 2011-10-16 15:15:40 -06:00
Sprog
b912f69212 Added RA map: Bombardment Islands 2011-10-16 15:12:32 -06:00
Curtis S
4812eb95b6 show bot info to all players in lobby 2011-10-16 15:06:13 -06:00
Curtis S
ea0348977e fixed playercount on ra map Battle Lake 2011-10-16 13:56:30 -06:00
Chris Forbes
2566b44627 preserve whole CountryInfo object in ProductionQueue 2011-10-15 13:46:36 +13:00
Chris Forbes
3716f0561c fix formatting 2011-10-15 13:01:45 +13:00
Chris Forbes
1e32014190 add CountryInfo.Selectable 2011-10-15 13:00:19 +13:00
Chris Forbes
d9d0e74d74 remove dead HttpUtil class 2011-10-15 12:38:23 +13:00
Chris Forbes
3991026cf3 add a new menu item to setup default players in editor 2011-10-15 12:29:17 +13:00
Chris Forbes
d202f9627f fix #1205 -- desync when AI builds harvs 2011-10-14 08:24:45 +13:00
Chris Forbes
770cdf38b6 update CHANGELOG for release 2011-10-13 09:48:50 +13:00
Chris Forbes
1e67984806 fix #1099 -- bogus armor on FTNK 2011-10-13 09:39:10 +13:00
Curtis S
5b23fd4873 update CHANGELOG 2011-10-11 22:08:57 -06:00
Nukem
35d167a4fd Added RA map by Nukem: HotZone 2011-10-11 22:08:10 -06:00
Curtis S
32d466ba10 update CHANGELOG 2011-10-11 21:43:12 -06:00
Chris Forbes
6ef8dbf282 updated changelog 2011-10-12 08:16:34 +13:00
Bellator
8de52cf7bc add Battle Lake map 2011-10-12 08:14:09 +13:00
Chris Forbes
261c4c5b62 update AUTHORS 2011-10-12 07:55:28 +13:00
Raymond Martineau
603a29b70d Flame turret range fix (previously outranged by infantry, despite being strong vs. infantry) 2011-10-12 07:53:18 +13:00
Curtis S
0d0d91113c update AUTHORS 2011-10-10 20:14:30 -06:00
Riderr3
536388ab5c Added new RA map by Riderr3: Drop Zone W 2011-10-10 20:13:52 -06:00
Curtis S
03b3649e54 changed MEDI cost to 300; changed SHOK cost to 500 2011-10-10 20:02:45 -06:00
Curtis S
16aec6ba90 Enabled tank squish in RA for 2tnk/3tnk/4tnk/ttnk/harv/mcv 2011-10-10 20:02:04 -06:00
Chris Forbes
47757161d6 fix cancel interaction with UnloadCargo activity; punt to the end of the frame 2011-10-11 14:47:16 +13:00
Chris Forbes
26b9feaf4b support transforming to a different actor type as a result of a passenger entering or leaving 2011-10-11 14:42:36 +13:00
Chris Forbes
c4256faf18 preserve cargo across transform 2011-10-11 14:42:35 +13:00
Chris Forbes
c39050fdda support setting initial cargo of units via ActorInit 2011-10-11 14:42:35 +13:00
Chris Forbes
f085b79491 add hooks for passengers entering/leaving a vehicle 2011-10-11 14:42:35 +13:00
Chris Forbes
206cb88146 update INSTALL file 2011-10-11 09:57:56 +13:00
Chris Forbes
eda7f17ad8 update AUTHORS 2011-10-11 09:52:24 +13:00
Chris Forbes
7f1918d07b add stance cycling on 'z' 2011-10-11 09:33:50 +13:00
Chris Forbes
59e4dd666a updated CHANGELOG 2011-10-11 08:06:37 +13:00
Nukem
1a15398605 add Chokepoint map 2011-10-11 08:06:26 +13:00
Bellator
75e65bf4c5 add Tiberium Oasis map 2011-10-11 08:06:24 +13:00
Bellator
81316a240b add Mad Scramble map 2011-10-11 08:06:24 +13:00
Chris Forbes
ac263697da fix #1197 -- bottom cordon of hectic was right against the map edge 2011-10-11 08:06:24 +13:00
Chris Forbes
20c4db914c implement selectable rules of engagement for AutoTarget 2011-10-11 08:06:23 +13:00
Curtis S
ea3ad0e378 Temp fix for #1200: SystemInformation.DoubleClickTime caused segfault in libx11 on some debian systems 2011-10-11 08:06:23 +13:00
Chris Forbes
2c415a8fd6 add tmp->png conversion to utility 2011-10-11 08:06:23 +13:00
Chris Forbes
a34b2d8c53 combine tileset.{Tiles,Templates}; image data now accessed via Templates[].Data 2011-10-11 08:06:23 +13:00
Chris Forbes
e2cbfb920b tidy in TileSet 2011-10-11 08:06:23 +13:00
Chris Forbes
1f1c2b25b0 move RenderTemplate onto TileSet 2011-10-11 08:06:23 +13:00
Chris Forbes
eaf15fa6b5 tidy in TileSet 2011-10-11 08:06:23 +13:00
Nukem
d2740847cf new AI configuration -- supports 3 difficulty levels 2011-10-11 08:06:06 +13:00
Curtis S
62e9f5c3f7 Removed pointless var in spawn picking logic 2011-10-10 17:15:45 +13:00
Curtis S
9d8ff12d23 Updated RA map Center of Attention 2011-10-10 17:15:43 +13:00
Chris Forbes
7864aeed37 remove obsolete Tao.Platform.Windows packaged dep 2011-10-10 16:25:26 +13:00
Chris Forbes
dc8726a6a0 fix multitap for keyboard events, in a way that doesnt break scrolling etc 2011-10-10 13:07:31 +13:00
Curtis S
3027c9d6f2 update CHANGELOG 2011-10-08 19:12:48 -06:00
Curtis S
bdf9447798 Added 3 RA maps by RAGEQUIT 2011-10-08 18:59:29 -06:00
Curtis S
756a3e551d Removed random sandbag from vegetation oramap 2011-10-08 18:45:04 -06:00
Curtis S
2da46a418f Added more options for bots in RA game lobby 2011-10-08 18:44:21 -06:00
Chris Forbes
88554a5039 temp disable multitap keys (not used yet); breaks keyboard scrolling 2011-10-09 12:48:36 +13:00
Chris Forbes
9f86ef526f move LobbyUtils into its own file 2011-10-09 12:02:57 +13:00
Chris Forbes
57308773a2 grid layout mapchooser in cnc too 2011-10-09 11:12:57 +13:00
Chris Forbes
d6f4b61b1c fixed #1187 - aircraft now reload when ordered back to base via F 2011-10-08 22:22:42 +13:00
Chris Forbes
6922ff3bf9 have ReturnOnIdle use QueueResupplyActivities so it works for airfields that can both rearm and repair 2011-10-08 22:17:15 +13:00
Chris Forbes
1702a9e9f5 tidy helicopter 2011-10-08 22:11:01 +13:00
Chris Forbes
38b6d3527b remove duplicate of ReserveSpawnBuilding from heli 2011-10-08 22:08:38 +13:00
Chris Forbes
9719e10edd drop spurious 'self' from ReserveSpawnBuilding, GetActorBelow 2011-10-08 22:07:15 +13:00
Chris Forbes
c7f780eb1d factor out GetActorBelow from ReserveSpawnBuilding 2011-10-08 22:04:21 +13:00
Chris Forbes
a193eeb202 Convert RA mapchooser to use a grid of minimap images 2011-10-08 21:35:46 +13:00
Chris Forbes
957c1cc74c tidy in ShpImageWidget 2011-10-08 18:16:12 +13:00
Chris Forbes
92bdec7f1d factor out layout policy for ScrollPanelWidget; add GridLayout option. 2011-10-08 18:15:24 +13:00
Chris Forbes
cf46a7ed5f scroll maplist to the top when changing filter 2011-10-08 17:36:48 +13:00
Chris Forbes
f966c08fed remove playercount labels in RA mapchooser 2011-10-08 17:20:52 +13:00
Chris Forbes
be8682fc19 move TextAlign out of LabelWidget 2011-10-08 17:20:52 +13:00
Chris Forbes
12b8774e6d game mode selector in map chooser 2011-10-08 17:20:09 +13:00
Chris Forbes
6c78bb481d fix ctor formatting 2011-10-08 17:19:44 +13:00
Chris Forbes
f79dfd51a2 add gamemode filter to EnumerateMaps 2011-10-08 17:09:01 +13:00
Chris Forbes
8e3bcb892f tidy multitap code up a lot 2011-10-08 17:09:01 +13:00
Curtis S
9b826d91a4 Fixed bogus yaml removals in koth maps 2011-10-07 21:55:41 -06:00
Curtis S
d802cbfd9d Fixed tank squish anims for CNC 2011-10-06 22:06:56 -06:00
Curtis S
22288d10e2 Added RA map by hamb: Vegetation 2011-10-06 20:24:53 -06:00
Curtis S
ce336b46fd fix #1196: can't capture civ buildings 2011-10-06 18:30:47 -06:00
Curtis S
9fdfca6ee5 Added MultiTap support 2011-10-07 09:54:35 +13:00
Chris Forbes
5ced7e270c fixed #536 -- add grid to editor 2011-10-07 09:34:23 +13:00
Chris Forbes
87223f5b64 show map name in ra lobby 2011-10-07 07:58:16 +13:00
Chris Forbes
52daca603b kill CncInstallMusicLogic 2011-10-07 00:02:00 +13:00
Chris Forbes
0fbc6c0a54 move CncInstallMusicLogic into its own file 2011-10-06 23:46:04 +13:00
Chris Forbes
e9a4ec5403 unify disk check between music install and game install for cnc 2011-10-06 23:43:32 +13:00
Chris Forbes
281f706b02 tidy 2011-10-06 23:37:52 +13:00
Chris Forbes
8ab40bc5e8 tidy CncIngameMenuLogic 2011-10-06 23:35:27 +13:00
Chris Forbes
928cfb1f31 fixed #1195 - allow custom delivery vehicle in ProductionAirdrop 2011-10-06 23:31:09 +13:00
Chris Forbes
dea66818cd fix indent in CncReplayBrowserLogic 2011-10-06 23:24:30 +13:00
Chris Forbes
c18dcca1bc fix spelling error in ProductionAirdrop 2011-10-06 23:23:47 +13:00
Chris Forbes
1cf12df1c4 tidy 2011-10-06 23:18:00 +13:00
Chris Forbes
b9e22f50ed tidy derp in CncColorPickerPaletteModifier 2011-10-06 23:17:00 +13:00
Chris Forbes
2bc260c833 move Activity from OpenRA.Traits.Activities namespace to OpenRA.Traits 2011-10-06 23:11:58 +13:00
Chris Forbes
3cf15b870a remove needless cast in CncLobbyLogic.AddChatLine 2011-10-06 22:58:32 +13:00
Chris Forbes
ec8c5849eb remove dead SlotDropDownOption type in CncLobbyLogic 2011-10-06 22:58:31 +13:00
Chris Forbes
c76ebe51a5 remove duplicate ShowRaceDropDown 2011-10-06 22:58:31 +13:00
Chris Forbes
8f560d79fd remove duplicate ShowTeamDropDown 2011-10-06 22:58:30 +13:00
Chris Forbes
6d469a1414 move ShowSlotDropDown to LobbyUtils; kill the cnc clone of it 2011-10-06 22:58:30 +13:00
Chris Forbes
57ac95123e make ShowSlotDropDown static 2011-10-06 22:58:29 +13:00
Chris Forbes
c260635228 remove duplication of lobby name widget setup in CncLobbyLogic 2011-10-06 22:58:28 +13:00
Chris Forbes
2a48e01d91 move SetupNameWidget function into new LobbyUtils static class 2011-10-06 22:58:28 +13:00
Chris Forbes
d3b5939613 remove duplication between CncMapChooserLogic and MapChooserLogic 2011-10-06 22:58:27 +13:00
Chris Forbes
bdcd8097e5 start reducing differences between cnc and ra mapchoosers 2011-10-06 22:58:27 +13:00
Chris Forbes
dfa456a537 tidy mapchooser files 2011-10-06 22:58:26 +13:00
Chris Forbes
f936bbeaf7 tidy 2011-10-06 22:58:26 +13:00
Chris Forbes
e02a6e7ec4 tidy more 2011-10-06 22:58:25 +13:00
Chris Forbes
baa79c2dbc tidy usings in lintpasses 2011-10-06 22:58:24 +13:00
Chris Forbes
23e101deb0 Updated CHANGELOG 2011-10-06 09:02:51 +13:00
Chris Forbes
0a88a6da8e fix #1083 -- allow rank crate to give multiple levels 2011-10-04 23:19:41 +13:00
Chris Forbes
84234e8794 tidy in ActorMap 2011-10-04 22:57:37 +13:00
Chris Forbes
9eecd7ba6b tidy Traits.Util usings 2011-10-04 22:55:19 +13:00
Chris Forbes
9c35debd46 more formatting tidy 2011-10-04 22:54:02 +13:00
Chris Forbes
dc850d3f73 tidy in Armor.cs 2011-10-04 22:49:58 +13:00
Chris Forbes
05ce48b732 tidy in RenderBuildingWarFactory 2011-10-04 22:44:23 +13:00
Chris Forbes
554032ad5f allow null player in RenderSimple.RenderPreview in prep for editor usage 2011-10-04 22:40:46 +13:00
Chris Forbes
e5a1658d87 less code in utility 2011-10-04 22:36:30 +13:00
Chris Forbes
2df7a657d3 remove spurious STAThread attribute from Utility main 2011-10-04 22:35:05 +13:00
Chris Forbes
8174e7fffb move WithDefault onto Exts 2011-10-04 22:33:52 +13:00
Chris Forbes
49a758f031 add --transparent flag to shp->png conversion utility 2011-10-04 22:31:02 +13:00
Chris Forbes
fb8fdb5899 move load from file wrapper for palette into Palette.cs 2011-10-04 22:28:51 +13:00
Chris Forbes
6de9c0b432 remove PrimaryBuilding support from afld/hpad; it doesnt make much sense for 1-unit-per-building 2011-10-04 22:18:36 +13:00
Chris Forbes
c42a39e064 fix #625 -- aircraft smoke should not be visible under fog 2011-10-04 22:11:57 +13:00
Chris Forbes
4fd3e6a390 fix #1151 -- husks should not be selectable 2011-10-04 21:57:20 +13:00
Curtis S
1dc0fbb625 updated CHANGELOG 2011-10-04 21:49:55 +13:00
Curtis S
b0747cafa8 Minor terrain fixes for maps 2011-10-04 21:49:54 +13:00
Curtis S
04a8801f08 Added 3 new RA maps by Nukem 2011-10-04 21:49:46 +13:00
Curtis S
06043512db Added new RA map by bellator: Arctic Triangle Affair 2011-10-04 21:49:43 +13:00
Curtis S
0d4f48822a Removed RA map: middle-mayhem.oramap 2011-10-04 21:49:40 +13:00
Curtis S
06e1a6a38d Changed pressure's (ra map) game type to Conquest 2011-10-04 21:49:36 +13:00
Chris Forbes
1776b17205 fix busted indent in Repair.cs 2011-10-04 13:17:59 +13:00
Chris Forbes
c27af37541 fix busted indents in Plane.cs 2011-09-30 11:06:15 +13:00
Curtis S
174ec12ff0 Fixed ingame crash caused by using "F" on planes when owning no AFLDs 2011-09-30 08:24:17 +13:00
Chris Forbes
4f5bfceb3f remove done todo 2011-09-28 10:04:51 +13:00
Jeff Harris
edecd166a2 Added: Mac launcher readme file with details of how to build the launcher correctly 2011-09-26 08:44:52 +13:00
Jeff Harris
632ae08b87 Updated: Launcher.Mac binary now only contains PPC and x86 code so x64 macs dont try to execv x86 mono (usually crashes) 2011-09-26 08:44:46 +13:00
Chris Forbes
e4afaf4344 remove SequenceEditor, it's no longer useful 2011-09-26 08:40:40 +13:00
Chris Forbes
9663316c6c fix #1138 -- shortcut description on linux 2011-09-26 08:40:40 +13:00
Chris Forbes
ed1b8080df fix formatting in Game.cs 2011-09-26 08:40:40 +13:00
Chris Forbes
567a82fd5d move CanJoin onto GameServer 2011-09-26 08:40:40 +13:00
Chris Forbes
f9eb62beee tidy uid->map lookup in ServerBrowser implementations 2011-09-26 08:40:40 +13:00
Chris Forbes
6b602d5262 tidy up SpawnViceroid 2011-09-26 08:40:40 +13:00
Chris Forbes
7cbd2cb9b6 what kind of name is 'cpts' for a variable? 2011-09-26 08:40:40 +13:00
Chris Forbes
54922a74b1 spliit CncDirectConnectLogic into its own file 2011-09-26 08:40:40 +13:00
Chris Forbes
07175277f1 remove spurious 'refreshing' var 2011-09-26 08:40:40 +13:00
Chris Forbes
c4d10f5637 start similarly tidying CncServerBrowserLogic 2011-09-26 08:40:40 +13:00
Chris Forbes
fdd0897927 untangle default selection in ServerBrowserLogic 2011-09-26 08:40:40 +13:00
Chris Forbes
623fde709f DirectConnectLogic in its own file 2011-09-26 08:40:40 +13:00
Chris Forbes
d3cdb82479 start tidying ServerBrowserLogic 2011-09-26 08:40:39 +13:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
0eb98ef3b5 use OrderBy().ThenBy() rather than relying on unspecified stability of OrderBy(). 2011-09-26 08:40:39 +13:00
Chris Forbes
f3ee2d589b tidy whitespace 2011-09-26 08:40:39 +13:00
Chris Forbes
cef45a890a tidy usings 2011-09-26 08:40:39 +13:00
Chris Forbes
67933fe253 tidy usings in MainMenuButtonsLogic 2011-09-26 08:40:39 +13:00
Chris Forbes
7b3de29f05 simplify teamchat code 2011-09-26 08:40:39 +13:00
Chris Forbes
1216cef981 remove (broken) cloning support from ChatDisplayWidget; doesn't make any sense. 2011-09-26 08:40:39 +13:00
Chris Forbes
d3bfcfea5c remove ChatLine.wrapped; never used 2011-09-26 08:40:39 +13:00
Chris Forbes
1c2f857222 just fetch the font once in ChatDisplayWidget 2011-09-26 08:40:39 +13:00
Chris Forbes
9fcddc0df2 remove duplicated mod prerequisite chain walk; write it clearly 2011-09-26 08:40:39 +13:00
Chris Forbes
23202eff0c untangle Mod.cs inserting of .Id 2011-09-26 08:40:38 +13:00
Chris Forbes
73f4997f6d remove spurious Standalone flag from mod metadata 2011-09-26 08:40:38 +13:00
Chris Forbes
ef71020835 style issue on CncLoadScreen 2011-09-26 08:40:38 +13:00
Chris Forbes
420052b12c remove duplicated path setup in Mod.cs 2011-09-26 08:40:38 +13:00
Chris Forbes
e7900d069d move ActiveModVersion,ActiveModTitle out of cnc-specific code 2011-09-26 08:40:38 +13:00
Chris Forbes
15d846bfb0 rename 'preferences' to 'settings' in various internal cnc bits; UI strings were 'settings' already 2011-09-26 08:39:58 +13:00
Chris Forbes
635315b0af rename SpecialPowerBinWidget to SupportPowerBinWidget 2011-09-24 20:56:41 +12:00
Chris Forbes
4bc963d621 clean up duplication in RA SpecialPowerBinWidget overlay handling 2011-09-24 20:54:16 +12:00
Chris Forbes
b83fa764d4 clean up whitespace in CncWaterPaletteRotation 2011-09-24 20:48:20 +12:00
Chris Forbes
589d201a16 make ShowMouseScrollDropdown static; it needs nothing from the instance. 2011-09-24 20:45:46 +12:00
Chris Forbes
6a78eec512 remove duplicated ShowWindowModeDropdown function from CncSettingsLogic 2011-09-24 20:44:38 +12:00
Chris Forbes
c608b45ef0 move cnc shellmap music toggle into Sound settings group where it belongs 2011-09-24 20:37:03 +12:00
Chris Forbes
68801ba7b5 fix formatting issues in settings 2011-09-24 20:34:21 +12:00
Chris Forbes
657e8ad250 remove misleading dead assignments on saving, before using vars as out params 2011-09-24 20:32:57 +12:00
Chris Forbes
a1fc76acc3 remove hardcoded 20px offset in TimerWidget 2011-09-24 20:28:34 +12:00
Chris Forbes
73676c8f0c remove spurious RenderBounds call 2011-09-24 20:24:18 +12:00
Chris Forbes
1eec17d430 clean up duplication in TimerWidget 2011-09-24 20:22:46 +12:00
Chris Forbes
b76ec11304 remove needless Stopwatch instance from TimerWidget 2011-09-24 20:21:46 +12:00
Chris Forbes
6c39f19a73 remove match timer configuration crap 2011-09-24 20:17:27 +12:00
Chris Forbes
3b2efc7b0b fix #1184 -- useless error message when forgetting to define Render:Image: on a derived actor type 2011-09-24 19:58:34 +12:00
Chris Forbes
e829e4b5aa fix formatting nit in SequenceProvider 2011-09-24 19:57:33 +12:00
Chris Forbes
f6661d5e47 fix sequences being ignored when the only sequences in the mod are provided by a map 2011-09-24 19:57:08 +12:00
Chris Forbes
2063277654 remove dead SaveSequencesForUnit 2011-09-24 19:56:29 +12:00
Curtis S
c1ec8fdd5c Update CHANGELOG 2011-09-18 23:08:02 -06:00
Curtis S
589f590fdc Added 3 RA maps by Nukem 2011-09-18 23:07:25 -06:00
Curtis S
538779e249 Added RA map by ihptru: Free Coasts 2011-09-18 20:53:32 -06:00
Curtis S
025dccaa3f Removed Neutral's colorramp in Styrian Mountains 2011-09-18 20:50:23 -06:00
Chris Forbes
776a1aa817 fix newlines in source files 2011-09-17 11:26:17 +12:00
Chris Forbes
9480846250 remove spurious constructor from MoveAdjacentTo 2011-09-17 11:24:39 +12:00
Chris Forbes
24c74dcdd9 remove needless duplicate Health trait query 2011-09-17 11:09:37 +12:00
Chris Forbes
bc8f02375f fixed #1171 -- don't shade buildable things just because we're building something else 2011-09-16 20:56:24 +12:00
Curtis S
c1f522db63 Fix #1157: Removed HARV minining from cell in front / using MoveAdjacentTo in logic. Was causing harvesters to get stuck - need to revisit this. 2011-09-15 20:49:33 -06:00
Chris Forbes
16fa2f2c1e sort file lists in projectfiles, fix newlines 2011-09-16 08:57:11 +12:00
Chris Forbes
7458deab81 update CHANGELOG 2011-09-14 09:30:11 +12:00
Curtis S
4e52dca3b6 Fixed PlayerIsAllowedToRepair - player requires FACT for repairs 2011-09-13 22:24:26 +12:00
Curtis S
575641155c Proper CNC palette fix for allyrepair.shp 2011-09-13 22:24:19 +12:00
Curtis S
561bec9ada Fix #1165 - PowerdownIndicator now works for replays/spec 2011-09-13 22:24:10 +12:00
Chris Forbes
be1a041a8c fixed #1071 -- adjust cnc resource parameters 2011-09-13 10:36:04 +12:00
Chris Forbes
44f65f15ea increase SYRD cost to 1000 2011-09-12 09:53:35 +12:00
Chris Forbes
25e257f2fa increase SPEN cost to 800 2011-09-12 09:53:26 +12:00
Chris Forbes
446193ecc7 reduce LST speed to 8 2011-09-12 09:40:44 +12:00
Chris Forbes
9942c4cbf8 require DOME for destroyer 2011-09-12 09:38:57 +12:00
Chris Forbes
a8097b1872 updated CHANGELOG 2011-09-11 17:49:54 +12:00
Chris Forbes
2b9d21feb7 fix #1162 (use large_slash for aircraft crashing into water) 2011-09-11 17:49:54 +12:00
Chris Forbes
9de1ed9761 fix #1146 (bogus client lookup) 2011-09-11 17:49:54 +12:00
Chris Forbes
ea190fcf86 combine LobbyCommands and PlayerCommands 2011-09-11 17:49:53 +12:00
Chris Forbes
21ae6ee983 convert FileExtractor into a Utility cmdlet 2011-09-11 17:49:53 +12:00
Curtis S
03adb7f2c3 Added new RA map by Tirili: Seven Stairs 2011-09-10 23:47:24 -06:00
Curtis S
c9c716aae4 Added 4 new RA maps by Nukem 2011-09-10 23:47:09 -06:00
Curtis S
9ee794ee1f Added RA map by Knivesron: Drop Zone Battle of Tikiaki 2011-09-10 23:07:57 -06:00
Curtis S
b2cf3d9513 Added RA map by Holloweye: Drop Zone 2011-09-10 23:06:43 -06:00
Curtis S
7306f92d22 1159: Implemented Nukem's RA AI rules 2011-09-10 22:42:44 -06:00
Curtis S
2cc6a67a95 Harvs built by HackyAI now call FindResources 2011-09-10 22:40:06 -06:00
Curtis S
460696192b PowerdownIndicator will only show to owner and teammates 2011-09-10 22:38:19 -06:00
Curtis S
be9948426c 1078: Added ally repairing for CNC and RA 2011-09-10 16:41:40 -06:00
Curtis S
1d052bbfa2 Powered down buildings now display a "powered off" animation 2011-09-08 20:31:16 +12:00
Chris Forbes
00c6c5c88d update CHANGELOG 2011-09-07 20:51:45 +12:00
Chris Forbes
a3818a6aa2 fix MoveAdjacentTo so it doesnt suck so much 2011-09-07 20:43:18 +12:00
Chris Forbes
cc18a6a515 enable building of LST in yaml 2011-09-07 18:45:16 +12:00
Chris Forbes
aec4e6b5e8 remove .manifest from root 2011-09-07 18:40:44 +12:00
Chris Forbes
75a8139e3b Update CHANGELOG for release 2011-09-06 08:39:01 +12:00
Chris Forbes
9cbf69608a updated CHANGELOG 2011-09-04 14:17:04 +12:00
Chris Forbes
3b22a8588f fix #1129 -- laserzap tolerates null explosion 2011-09-04 11:10:21 +12:00
Chris Forbes
082603dd54 don't offer attackmove OG in cases for other players' stuff 2011-09-04 10:49:26 +12:00
Chris Forbes
014e63383b fix comment in WorldCommandWidget 2011-09-04 10:45:10 +12:00
Chris Forbes
19c7cd650d boost sam rof slightly 2011-09-04 10:28:51 +12:00
Chris Forbes
ee0de12318 boost longbow aa missile speed 2011-09-04 10:28:23 +12:00
Chris Forbes
e64c7680e8 fix #1141 -- lobby kick being broken in ra 2011-09-04 08:53:16 +12:00
Chris Forbes
f62fc7acd3 Updated CHANGELOG 2011-09-03 10:12:54 +12:00
Chris Forbes
8316ffc07e remove spurious trait lookup in AutoHeal 2011-09-01 16:18:36 +12:00
Curtis S
2cce16fe3d Minor ore changes to Doughnut map 2011-08-30 21:51:52 -06:00
Curtis S
43c5137dce Fixed ore distribution on mjolnir-2 2011-08-30 21:51:33 -06:00
Curtis S
6f70b113c8 Fix #1132; Infantry/Husks don't stay above water when bridge beneath is destroyed 2011-08-30 20:58:57 -06:00
Curtis S
3d48c454dc Vehicle husks should not appear on water 2011-08-30 20:55:27 -06:00
Curtis S
29b32dd656 Added new RA map: Doughnut 2011-08-29 17:13:00 +12:00
Curtis S
dc181f495f Added new RA map: Mjolnir 2 2011-08-29 17:12:54 +12:00
Chris Forbes
4b2717118f fix #1130 -- LaserZap beam color is configurable 2011-08-27 13:40:30 +12:00
Curtis S
02d644a09f Reduced Inaccuracy of Cruiser's 8Inch from 120 to 80 2011-08-27 08:21:31 +12:00
Chris Forbes
7b9f389ed1 Updated CHANGELOG 2011-08-22 18:33:31 +12:00
Chris Forbes
064b996ea2 slight tidy in nuke 2011-08-22 07:14:24 +12:00
Chris Forbes
2231436c2f fixed #837 -- hind, yak weapons ignore walls 2011-08-21 22:28:43 +12:00
Chris Forbes
dd306c7b7c fixed #766 -- minelayers not entering FIX properly 2011-08-21 22:17:50 +12:00
Chris Forbes
be7c4193a4 remove duplicated Tick 2011-08-21 22:05:41 +12:00
Chris Forbes
fe40fbf7f7 removed duplicated ResolveOrder 2011-08-21 22:05:41 +12:00
Chris Forbes
c0fd252b9f removed duplicate AttackActivity from AttackPopupTurreted 2011-08-21 22:05:41 +12:00
Chris Forbes
33ec2b3f5e have AttackPopupTurreted inherit AttackTurreted 2011-08-21 22:05:41 +12:00
Chris Forbes
7437e8fabb fix naming of turret member 2011-08-21 21:34:47 +12:00
Chris Forbes
c11b7041f4 push turret facing check down to turret 2011-08-21 21:32:39 +12:00
Chris Forbes
6a092dbfda declare AttackTurreted -> Turreted dep; do trait lookup at spawn time 2011-08-21 21:27:36 +12:00
Chris Forbes
78a0c3e506 move Attack traits into Attack dir 2011-08-21 21:10:49 +12:00
Chris Forbes
05d1c8ee82 move AttackPopupTurreted into RA where it can be fixed. 2011-08-21 21:05:29 +12:00
Chris Forbes
6daeb73471 stop spraying all these damned parentheses where they aren't needed 2011-08-21 21:02:19 +12:00
Chris Forbes
3a5682a1f7 remove Quit option from ingame menu; rename Disconnect to Abort Mission 2011-08-21 20:56:37 +12:00
Chris Forbes
2c5c069480 slow down power bar lerp slightly; extract constant 2011-08-21 20:49:34 +12:00
Chris Forbes
8b33c6c8b0 tidy up spurious typenames in PowerBinWidget 2011-08-21 20:45:47 +12:00
Chris Forbes
6346373e0c remove power manager lookup every render 2011-08-21 20:44:37 +12:00
Chris Forbes
339d5c3405 fix phantom radarbin 2011-08-21 20:40:32 +12:00
Chris Forbes
896cbaae39 clean up ModData package mounting 2011-08-21 20:26:00 +12:00
Chris Forbes
840f6131ac tidy up some spurious trait lookups in HackyAI 2011-08-21 19:39:44 +12:00
Chris Forbes
5a3f5d9f3a move BuildState into BaseBuilder where it belongs 2011-08-21 19:37:22 +12:00
Chris Forbes
b95f49d6f3 remove pointless null checks for owner 2011-08-21 19:34:45 +12:00
Chris Forbes
ee2be405ca fix AppearsFriendlyTo/AppearsHostileTo 2011-08-21 19:31:20 +12:00
Chris Forbes
da4811abe8 rip out ActorStance garbage 2011-08-21 18:59:20 +12:00
Curtis S
8e9045d7f4 Removed ra maps fire alley, isle wars 3, ore isle 2011-08-21 18:51:22 +12:00
Chris Forbes
0e3d07f0b2 adjust size of mcv husk 2011-08-21 18:49:54 +12:00
Chris Forbes
42ab7908d0 adjust size of harvester husk 2011-08-21 18:49:06 +12:00
Chris Forbes
d75784df64 factor out build palette overlays; add timers 2011-08-21 14:26:28 +12:00
Chris Forbes
96860033fb #1121 fixed -- [Sync] and ISync inheritance rules made the same 2011-08-21 10:58:16 +12:00
Chris Forbes
8cc455d23f fix #1105; decloak sound was never used 2011-08-21 10:21:07 +12:00
Chris Forbes
f7fdd885fb produce much better exceptions for missing files in map packages 2011-08-20 14:23:09 +12:00
Chris Forbes
8428eb0499 tidy up new-map-from-tileset support 2011-08-20 14:17:56 +12:00
Chris Forbes
1fe5c1d60f catch map load failures 2011-08-20 14:13:52 +12:00
Chris Forbes
a9d25b603c factor out duplicated hardcoded font in CashTick 2011-08-17 07:52:35 +12:00
Chris Forbes
e922051282 factor formatting code out of CashTick ctor 2011-08-17 07:52:35 +12:00
Chris Forbes
257bd6f431 fixed #849 -- forceMove plumbing removed, noone uses it. 2011-08-17 07:52:35 +12:00
Chris Forbes
67b4ef3084 #1108 changed BuildingInfo.WaterBound to a list of terraintypes. makes it possible to have buildings with custom terrain requirements 2011-08-17 07:52:35 +12:00
Chris Forbes
55ec88316a #1050 Extract generic PlayMusicOnMapLoad trait from cnc shellmap script 2011-08-17 07:52:34 +12:00
Curtis S
c47833e9a0 Fixed a frame in harvempty.shp 2011-08-15 19:15:57 -06:00
Chris Forbes
36f6e503ef clean up some of the noise in Move 2011-08-15 14:48:17 +12:00
Chris Forbes
a74fd17d39 remove a Turreted lookup every render for RenderBuildingTurreted 2011-08-15 14:32:10 +12:00
Chris Forbes
1aa80e0377 fix #960 -- HackyAI shouldn't put itself in low power so much. 2011-08-15 14:23:54 +12:00
Chris Forbes
cc716ab8c7 #1106 fixed -- mac-specific hack should only be applied on a mac. 2011-08-15 14:15:55 +12:00
Chris Forbes
6dd0452c95 drop unused SupportDir= option from 'openra' script produced by 'make install' 2011-08-13 15:01:42 +12:00
Chris Forbes
f3ea06c373 Include OpenRA.Renderer.SdlCommon.dll in 'make install'.
Merged from gentoo ebuild, https://github.com/cerebrum/dr/blob/master/games-strategy/openra/files/Makefile_rsdl.patch
2011-08-13 15:01:42 +12:00
Curtis S
499d9736cc Fix #802; BRIK health reduced to 500. Arty effectiveness remains the same. 2011-08-13 15:01:42 +12:00
Curtis S
cc8a9552b5 Made ATEK a prerequisite for Allied Longbow 2011-08-13 15:01:42 +12:00
Curtis S
d420701e5a Split hellfire missiles into AA/AG definitions 2011-08-13 15:01:42 +12:00
Chris Forbes
99f2f1bab2 fixed #1098; idle animation speed for e2 2011-08-13 15:01:42 +12:00
Chris Forbes
7902c9847e rename Technician -> Civilian 2011-08-13 15:01:42 +12:00
Chris Forbes
5546e977a8 add audio feedback for Stop order 2011-08-13 15:01:42 +12:00
Chris Forbes
c4666df6b9 fix long line in Mobile 2011-08-13 15:01:41 +12:00
Chris Forbes
54df44d43a split recoil into PrimaryRecoil/SecondaryRecoil; make recovery rate configurable per turret; #1069 2011-08-13 15:01:41 +12:00
Chris Forbes
954b0a617f don't consider HideMapCrateAction if the player has GPS 2011-08-13 15:01:41 +12:00
Chris Forbes
ca385e41ea fix bogus file name for HideMapCrateAction 2011-08-13 15:01:41 +12:00
Chris Forbes
9f0f8d381f map scatter->move for audio; #1093 2011-08-13 15:01:41 +12:00
Chris Forbes
d3def71340 Add ReturnToBase (F) support for aircraft; #1084 2011-08-13 15:01:41 +12:00
Chris Forbes
663a323f29 remove trait lookup spam everywhere for IOccupySpace. 2011-08-13 15:01:41 +12:00
Chris Forbes
aff3111eac internals for #919 2011-08-13 15:01:41 +12:00
Curtis S
b6560e6026 Fixed #1090; pilots don't drop for dead players 2011-08-13 15:01:40 +12:00
Chris Forbes
132ca5c667 update text for instant charge time option 2011-08-13 15:01:40 +12:00
Chris Forbes
f2867fbc61 UnregisterEvents functions do not need to be public 2011-08-13 15:01:40 +12:00
Chris Forbes
8d9f7b715d remove Lock Teams checkbox from RA lobby 2011-08-09 08:51:36 +12:00
Chris Forbes
9b9f13ed1b remove some duplication in LobbyLogic's color picker handling 2011-08-09 08:51:36 +12:00
Chris Forbes
e329c9dc55 fix some whitespace issues in LobbyLogic 2011-08-09 08:51:36 +12:00
Chris Forbes
89a209ff52 remove bogus FirstOrDefault + deref in Teleport; just use Trait<> 2011-08-09 08:51:36 +12:00
Paul Chote
5d3ed6aa6a Remove obsolete bits from linux packaging 2011-08-09 08:51:36 +12:00
Paul Chote
21197c702e Update CHANGELOG 2011-08-09 08:51:36 +12:00
Chris Forbes
3051b147f5 fix whitespace in NullGraphicsDevice 2011-08-09 08:51:36 +12:00
Chris Forbes
4e11702a99 fix #1088; gpsdot should not be given to opponents 2011-08-09 08:51:36 +12:00
Chris Forbes
a79cc0a0e0 drop unused parameter on IGraphicsDevice.Clear() 2011-08-09 08:51:36 +12:00
Chris Forbes
2bf7cb1496 fix #1052; tidy up *Init; route initial turret facing for husks through new TurretFacingInit 2011-08-09 08:51:36 +12:00
Chris Forbes
096fe7759c fix ThrowsParticles/ThrowsParticle naming inconsistency 2011-08-09 08:51:35 +12:00
Chris Forbes
18481afda2 fix #1063; don't issue orders while dragging a selection box 2011-08-09 08:51:35 +12:00
Chris Forbes
78e6d69103 fix #1064; always show an arrow while dragging a selection box 2011-08-09 08:51:35 +12:00
Chris Forbes
cfa8298190 remove duplication of initial map choice logic 2011-08-09 08:51:35 +12:00
Chris Forbes
b748e4b11b fix whitespace issues in CncMenuLogic 2011-08-09 08:51:35 +12:00
Chris Forbes
8844ea8e2f fix #1082; setting a bot's color no longer clobbers saved player color 2011-08-09 08:51:35 +12:00
Chris Forbes
5a9cb18881 fix #1070; allow GiveCashCrateAction to generate a cashtick 2011-08-09 08:51:35 +12:00
Chris Forbes
fa78793927 fix #1057 -- bogus trait lookup in RenderUnitSpinner 2011-08-09 08:51:35 +12:00
Chris Forbes
ddc1311d87 Make RenderUnit require IFacing; RenderSimple can be used for crates, mines, etc; fix husk facing init 2011-08-09 08:51:35 +12:00
Chris Forbes
7044d81a40 remove dead makedist.cmd 2011-08-09 08:51:35 +12:00
Chris Forbes
833533b4c3 fix #1056 2011-08-09 08:51:35 +12:00
Chris Forbes
7429c8ef89 don't look up IFacing (twice!) every frame for every actor with RenderUnit; fixes #1054 2011-08-09 08:51:35 +12:00
Chris Forbes
2797ea72cb fix stupid default support dir. if there's something we can't identify reliably, it's going to be a *nix 2011-08-09 08:51:28 +12:00
Matthew Bowra-Dean
21f172228d Fix compilation with Visual Studio
OpenRA.Renderer.SdlCommon was missing the /unsafe compiler flag and RALint was missing a reference to System.Drawing.
2011-08-08 11:17:10 +12:00
Paul Chote
c84f53c10d Extract tile overlays into a shp instead of rolling our own in code; Remove UIOverlay. Fixes #1061. 2011-07-27 21:48:32 +12:00
Paul Chote
08ed7f0316 Hook up empty/full harvester husk variants in RA. 2011-07-27 20:09:37 +12:00
Paul Chote
5fe5addc0c Make Harvester.Fullness an int 2011-07-27 20:00:23 +12:00
Paul Chote
d62ef64fa6 Make ralint give useful stacktraces under mono 2011-07-27 19:58:37 +12:00
Paul Chote
ad12352f41 Add mcv husk by Daniel Hernandez 2011-07-27 19:26:41 +12:00
Paul Chote
a4814b82c8 Display cost/power tooltip labels in red if there are insufficient funds/power. Fixes #1076. 2011-07-27 17:38:37 +12:00
Paul Chote
1c7a9ce08e Fix desert civ building animations (bug #1097). 2011-07-27 16:59:44 +12:00
Paul Chote
4e68ad2b12 Fix default civ building husk walkability 2011-07-27 16:57:23 +12:00
Paul Chote
9df7348683 Add two missing desert buildings 2011-07-27 16:57:12 +12:00
Paul Chote
b216d73ac9 Fix civ structure sequence ordering 2011-07-27 16:34:46 +12:00
Paul Chote
2b3f58e3a4 Fix hospital animation and add husk 2011-07-27 13:36:49 +12:00
Paul Chote
39a3dfffd1 Disallow capturing hospitals until they give something useful 2011-07-27 13:36:49 +12:00
Paul Chote
4c60639a0d Remove build radius from tech structures 2011-07-27 13:36:49 +12:00
Paul Chote
8087f16df0 `The Sentinel' tweaks: replace blue tib fields with hospitals; move starting spawns closer to the center; remove excess tib trees. 2011-07-27 13:36:49 +12:00
Paul Chote
0946bf52c3 Tweak tib and add oil derricks to Chokepoint. 2011-07-27 13:36:49 +12:00
Paul Chote
e62ec6caa1 Remove extra tib trees from `Instant Karma' 2011-07-27 13:36:49 +12:00
Paul Chote
86bc01cf65 Fix tib trees in `dead in motion' (bug #1072) 2011-07-27 13:36:49 +12:00
Paul Chote
8a6a3eac85 Make nod airfield fly the width of the map instead of spawning a fixed distance outside the map. Increase aircraft speed to compensate. Fixes #283. 2011-07-27 13:36:49 +12:00
Paul Chote
d9174b7e3b Kill RenderSimple.OverrideTileset/OverrideImage. 2011-07-27 13:36:48 +12:00
Paul Chote
64ab44c3ea Log a message when trying to render a nonexistent actor in the editor 2011-07-27 13:36:48 +12:00
Paul Chote
d98649e7e1 Switch `minus two' to desert variants. 2011-07-27 13:36:48 +12:00
Paul Chote
2778752a17 Switch `instant karma' to desert variants. 2011-07-27 13:36:48 +12:00
Paul Chote
a0d1686fd1 Fix bogus desert variant in shellmap 2011-07-27 13:36:48 +12:00
Paul Chote
e1691a4a70 Switch `chokepoint' to desert variants. 2011-07-27 13:36:48 +12:00
Paul Chote
6fecb82c98 Switch `break of day' to desert variants. 2011-07-27 13:36:48 +12:00
Paul Chote
7211cd10c6 Define desert variants of civilian buildings as real actors instead of visual hacks. 2011-07-27 13:36:48 +12:00
Paul Chote
17d72f17d9 Add an EditorTilesetFilter trait for filtering the actor palette based on tileset. 2011-07-27 13:36:47 +12:00
Paul Chote
9f7c5791f9 Make vehicle husks unselectable 2011-07-27 13:36:47 +12:00
Paul Chote
7e3cfd7ee9 Don't show a selection cursor over targetable but unselectable actors 2011-07-27 13:36:47 +12:00
Paul Chote
aa2ae95ce1 Kill DeadBuildingState.Zombie 2011-07-27 13:36:47 +12:00
Paul Chote
f9017567c1 Implement dead civilian buildings ask husks. Fixes #149. 2011-07-27 13:36:47 +12:00
Paul Chote
d6ab8b2456 Fix tech structures: cannot sell, can repair, fix husks. 2011-07-27 13:36:47 +12:00
Paul Chote
3972836cd6 Don't allow engineers to repair neutral structures, it conflicts with capturing. 2011-07-27 13:36:47 +12:00
Paul Chote
d8ec459b97 Declare RenderSimple dep in WithFire 2011-07-27 13:36:47 +12:00
Paul Chote
d9bd49bac3 Tweak East vs West 3. Fixes #921. 2011-07-27 13:36:47 +12:00
Paul Chote
4138c5aeb7 Display version in the load screen 2011-07-27 13:36:46 +12:00
Paul Chote
00ba03cbce Fix #1062 2011-07-27 13:36:46 +12:00
Paul Chote
304601b5ca Split some useful bits from CncIngameMenuLogic into CncWidgetUtils for use elsewhere 2011-07-27 13:36:46 +12:00
Paul Chote
648979c8ae Fix a crash in Demolish 2011-07-27 13:36:40 +12:00
Paul Chote
cf9ac8d801 Fix a dumb crash & avoid a trait lookup in DragHusk 2011-07-26 10:01:32 +12:00
Paul Chote
59116fc5b8 Include mod version on the ingame menu (Feature #1075) 2011-07-26 01:19:02 +12:00
Paul Chote
0a5f81c39e Drag husks to their final location. Fixes #730. 2011-07-25 23:50:11 +12:00
Paul Chote
49cbaeb1d2 Fix a crash when an infantry is crushed and killed by conventional means in the same tick. 2011-07-25 22:23:21 +12:00
Paul Chote
8ad3f47608 Further resource tweaks:
- Resource value reduced by 25%
 - Resource spawn rate increased by 15%
 - Unload rate decreased by 50%
 - Harvest rate increased by 25%
2011-07-25 22:23:21 +12:00
Paul Chote
9270c9c6b7 Don't clear RA production queues whenever anything dies. 2011-07-25 22:23:21 +12:00
Paul Chote
eba178a427 Resource changes (Feature #970):
- Harvester capacity ~halved
 - Harvester harvesting rate halved
 - Resource value ~doubled
 - Silo/Refinery capacity increased slightly
2011-07-25 22:23:21 +12:00
Paul Chote
eadf6fe6cf Rename RenderBuildingOre -> RenderBuildingSilo 2011-07-25 22:23:21 +12:00
Paul Chote
2231940056 Harvesters harvest the cell in front of them; fix harvester target lines; split harvester activities into their own (correctly named) files. 2011-07-25 22:23:21 +12:00
Paul Chote
a5b2ff4c75 Remove unused proc sequences 2011-07-25 22:23:21 +12:00
Paul Chote
996a5407a9 Use proc tower lights as a fullness indicator (Feature #1035). 2011-07-25 22:23:20 +12:00
Paul Chote
97c608a9b9 Fix harvempty.shp and harvhalf.shp 2011-07-25 22:23:20 +12:00
Paul Chote
69d23e01aa Remove references to unused mix files 2011-07-25 22:23:20 +12:00
Paul Chote
6c129eed3c Split pip artwork into their own files and kill the hardcoded size/offset junk. Add a blue pip to support C&C blue tib. Fixes #836. 2011-07-25 22:23:20 +12:00
Paul Chote
c793e8571f Update CHANGELOG 2011-07-25 22:23:20 +12:00
Paul Chote
ab132fb743 Increase reload time of mammoth missiles 2011-07-25 22:23:20 +12:00
Paul Chote
f4a03e3d73 Increase missile ROT and remove arming delay to ensure that missiles can hit adjacent targets. 2011-07-25 22:23:19 +12:00
Paul Chote
54b7e8f344 Split apache guns into AA/AG variants too. Fixes #946. 2011-07-25 22:23:19 +12:00
Paul Chote
e30e49006f Split orca missiles into AA and AG variants to avoid splash damage leakage. 2011-07-25 22:23:19 +12:00
Paul Chote
22d3e16225 Installing from CD: Volume names / mount points are unreliable identifiers - check for specific files on the disk instead. 2011-07-25 22:23:19 +12:00
Paul Chote
a165a80101 Fix imported map spawn ownership 2011-07-25 22:23:19 +12:00
Paul Chote
abf63b3054 Remove GameInitInfoWidget and routing startup via widgets in RA. 2011-07-25 22:23:19 +12:00
Paul Chote
2d269155b1 Reimplement installing from CD in RA. 2011-07-25 22:23:19 +12:00
Paul Chote
bf6be0424f Remove file prompting and drop all the remaining utility communication plumbing. 2011-07-25 22:23:18 +12:00
Paul Chote
9ec229bef7 Fix utility to use Platform.SupportDir (#1067); drop the --SupportDir arg and the path passed to --settings-value; Update OSX launcher to match. 2011-07-25 22:23:18 +12:00
Paul Chote
ac9a5efd8e Use GL_ARB_vertex_buffer_object calls instead of gl 1.5 core calls. 2011-07-25 22:23:18 +12:00
Paul Chote
f88ea4c25a Add RA settings UI for PixelDouble 2011-07-25 22:23:18 +12:00
Paul Chote
a94a57db32 Add C&C settings UI for PixelDouble 2011-07-25 22:23:18 +12:00
Paul Chote
d2c033dcd3 Add a PixelDouble preference for rendering at 2x zoom. Allowing arbitrary zoom levels leads to too many rendering artifacts. 2011-07-25 22:23:18 +12:00
Paul Chote
626b83ba12 Fix lines not being centered in the middle of a pixel 2011-07-25 22:23:17 +12:00
Paul Chote
8516fa8748 fix viewport scroll limits 2011-07-25 22:23:17 +12:00
Paul Chote
0bfc9a957f Fix radar viewport rectangle 2011-07-25 22:23:17 +12:00
Paul Chote
0b0e3d5f14 Drop unnecessary `this' uses from Viewport. 2011-07-25 22:23:17 +12:00
Paul Chote
6183621a72 Scale line-width to match zoom. 2011-07-25 22:23:17 +12:00
Paul Chote
fc783ddf80 Support custom zoom levels 2011-07-25 22:23:17 +12:00
Paul Chote
926b396605 Fix bogus naming of Shaders/Renderers. Split LineRenderer into world and chrome variants. 2011-07-25 22:23:16 +12:00
Paul Chote
4fa0962d49 Check for bogus subject clients in ValidateOrder. Fixes crash in #1001. 2011-07-25 22:23:16 +12:00
Paul Chote
2b3ee9e5bc Replace fullscreen checkbox and misleading width/height fields in RA settings menu with a mode/resolution selector like C&C. Fixes bugs #118, #791. 2011-07-25 22:23:16 +12:00
Paul Chote
704c784b51 Remove power and silo icon placeholders 2011-07-25 22:23:16 +12:00
Paul Chote
9b96bfb33b Fix #931 ("Unit Ready" played when a production structure is destroyed). 2011-07-25 22:23:16 +12:00
Paul Chote
d42cf25789 Packaging fixes for renderer deduplication. 2011-07-25 22:23:15 +12:00
Paul Chote
c79f5b5365 Ignore damage modifiers when killing a unit via actor.Kill(). Fixes surrender desync (#460); Fixes invulnerable actors surviving in situations where they should be killed (bridge death, losing/surrender, etc). 2011-07-25 22:23:15 +12:00
Paul Chote
6ede28fdbe Fix mammoth tank not crushing infantry 2011-07-25 22:23:15 +12:00
Paul Chote
ac7c25efa3 Prioritize alerted tabs when switching group / via hotkey. 2011-07-25 22:23:15 +12:00
Paul Chote
1bafd35d61 Rework ProductionTabsWidget getting/setting of the current queue. 2011-07-25 22:23:15 +12:00
Paul Chote
9fb72c9063 Play click sound when using `tab' to cycle queues. 2011-07-25 22:23:15 +12:00
Paul Chote
7be84a5390 Remove demo.mix from the packaged build, not the local copy. 2011-07-25 22:23:14 +12:00
Paul Chote
b8ba48ee67 Switch to observer ui on victory/defeat (Feature #1002). 2011-07-25 22:23:14 +12:00
Paul Chote
8f62ce9b25 Show `-' instead of 0 for unteamed players in the objectives panel. 2011-07-25 22:23:14 +12:00
Paul Chote
ee3be9c89b Laser tweaks:
- Expose the beam duration to the projectileinfo
 - Play an explosion animation at the target
 - Beam tracks moving targets
 - Disable player beam color in C&C
2011-07-25 22:23:14 +12:00
Paul Chote
d9d20338bf Increase orca reload time 2011-07-25 22:23:14 +12:00
Paul Chote
e724a3b200 Decrease stnk speed slightly, increase it's health 2011-07-25 22:23:14 +12:00
Chris Forbes
71cf332ee1 trim some crap out of Contrail 2011-07-25 22:23:13 +12:00
Chris Forbes
e4e443b0ab remove unused SidebarButtonWidget 2011-07-25 22:23:13 +12:00
Chris Forbes
e81cbceb99 aircraft sync debug traits dont really need to do trait lookups every time the synchash is taken.. 2011-07-25 22:23:13 +12:00
Chris Forbes
5055e0be62 clean up PlayerResources trait lookup in MoneyBinWidget 2011-07-25 22:23:13 +12:00
Chris Forbes
ac71e60a4b remove SplitOreAndCash from MoneyBinWidget; noone uses it anymore 2011-07-25 22:23:13 +12:00
Chris Forbes
41baa3b7b0 add escape keybinding to settings dialog 2011-07-25 22:23:13 +12:00
Chris Forbes
2ac1d001a4 add enter/escape bindings to replaybrowser 2011-07-25 22:23:13 +12:00
Chris Forbes
7d506f0ab6 rename gamelobby.yaml -> lobby.yaml 2011-07-25 22:23:12 +12:00
Chris Forbes
2a99cdb935 split map-chooser out of gamelobby.yaml 2011-07-25 22:23:12 +12:00
Chris Forbes
14733841e5 add escape/enter bindings for other join-game dialogs 2011-07-25 22:23:12 +12:00
Chris Forbes
0b97122c41 add escape/enter bindings for server browser dialog 2011-07-25 22:23:12 +12:00
Chris Forbes
00543825e7 setup escape/enter bindings for create-server dialog 2011-07-25 22:23:12 +12:00
Chris Forbes
8d2b6edaf1 split create server dialog into its own yaml file 2011-07-25 22:23:12 +12:00
Chris Forbes
fc9ab25c3f add escape key binding to ingame options button 2011-07-25 22:23:12 +12:00
Chris Forbes
70dfcffaea add another lint pass to ensure that every (non-template) actor type is actually constructible 2011-07-25 22:23:12 +12:00
Chris Forbes
b3bdc2df85 declare RenderUnitTurreted -> Turreted,AttackBase deps; remove spurious TraitOrDefault on AttackBase which just failed later; fixes #1053 2011-07-25 22:23:12 +12:00
Chris Forbes
315c00f67f clean up Contrail trait lookups; fixes #1058 2011-07-25 22:23:11 +12:00
Chris Forbes
0bca88d9d3 remove silly trait lookup in RenderBuildingCharge 2011-07-25 22:23:11 +12:00
Chris Forbes
fc15aa47ad dont really need to setup palettes every frame in ResourceLayer 2011-07-25 22:23:11 +12:00
Chris Forbes
5aaca5bb32 drop ISelectionColorModifier; unused 2011-07-19 21:14:12 +12:00
Chris Forbes
3a1613667b drop unnecessary ISync from ProximityCapturable 2011-07-19 21:14:12 +12:00
Chris Forbes
0d018d3eff tidying some font uses in BuildPaletteWidget 2011-07-19 21:14:12 +12:00
Chris Forbes
4448089cb7 use text rendering to show hold/ready indicators rather than SHP 2011-07-19 21:14:12 +12:00
Chris Forbes
8544930db9 ProximityCapturable simplifications 2011-07-19 21:14:12 +12:00
Chris Forbes
70a582df33 more simplification of Strategic* 2011-07-19 21:14:12 +12:00
Chris Forbes
e7228680e8 make RALint quiet unless -v or --verbose is passed 2011-07-19 21:14:12 +12:00
Chris Forbes
68fd2c9744 clean up usings after prev 2011-07-19 21:14:12 +12:00
Chris Forbes
643e0ee7a2 move CheckActorReferences out of the core lint code 2011-07-19 21:14:11 +12:00
Chris Forbes
3340e124e4 simplify Strategic* 2011-07-19 21:14:11 +12:00
Chris Forbes
33704977b9 remove ScrollingTextWidget 2011-07-19 21:14:11 +12:00
Chris Forbes
3d2635fca5 drop CursorSheetBuilder; use normal SheetBuilder for cursors now. 2011-07-19 21:14:11 +12:00
Chris Forbes
5609c8d041 drop format2 support from CursorSheetBuilder 2011-07-19 21:14:11 +12:00
Chris Forbes
d634f9db90 convert cnc mouse3 to td/ra format 2011-07-19 21:14:11 +12:00
Chris Forbes
4b5d6572ef convert RA cursors to TD/RA format 2011-07-17 18:37:27 +12:00
Chris Forbes
2a16172a20 add d2k -> ra shp conversion support to utility 2011-07-17 18:37:12 +12:00
Chris Forbes
239be241ff fix broken cleanup of import folder in editor after failed import; #1012 2011-07-17 17:55:53 +12:00
Chris Forbes
a635e8a4d8 add Passenger to crate; remove special cases in Cargo to support not having Passenger; #851 2011-07-17 17:55:53 +12:00
Chris Forbes
a95b59081f remove duplicated GL setup code 2011-07-17 17:55:52 +12:00
Chris Forbes
2fcb11d7cc remove duplicated SDL input handling 2011-07-17 17:55:52 +12:00
Chris Forbes
31c2306a57 get rid of Cg versions of Texture and VertexBuffer 2011-07-17 17:55:52 +12:00
Chris Forbes
b0ccc58516 remove unused vsync parameter from renderers 2011-07-17 17:55:52 +12:00
Chris Forbes
df1201b4c2 start moving common parts of the renderer into OpenRA.Renderer.SdlCommon 2011-07-17 17:55:52 +12:00
Chris Forbes
2ac6ccd3a4 add player parameter to ReinforceFromSea in prep for using it elsewhere 2011-07-17 17:55:52 +12:00
Chris Forbes
8221b8acca declare Burns -> RenderSimple dep; remove first tick weirdness 2011-07-17 17:55:52 +12:00
Chris Forbes
4a0b7bb003 put AnimationWithOffset in its own file 2011-07-17 17:55:52 +12:00
Chris Forbes
59616671b6 add harvester husks 2011-07-17 17:55:51 +12:00
Chris Forbes
74b894b69f replace Range with MinimumValue/MaximumValue 2011-07-17 17:55:51 +12:00
Chris Forbes
a52e5a92ae adjust copy ctor for SliderWidget -- copying the isMoving state makes *no sense*; Value should be copied though 2011-07-17 17:55:51 +12:00
Chris Forbes
0efe82018a rewrite SliderWidget to be simpler and have much less fail 2011-07-17 17:55:51 +12:00
Chris Forbes
fe6a99c993 fixed #42 -- show harvester fullness in sprites 2011-07-17 17:55:51 +12:00
Chris Forbes
9dd0ad980b remove backwards compatibility crap from RA edgescroll config 2011-07-17 12:43:12 +12:00
Chris Forbes
5c5eb5d5b5 remove config item for match timer in RA 2011-07-17 12:41:21 +12:00
Chris Forbes
2d79c7c424 clean up graphics settings in SettingsMenuLogic.cs 2011-07-17 12:37:54 +12:00
Chris Forbes
10cb967711 tidy SettingsMenuLogic audio settings 2011-07-17 12:33:05 +12:00
Chris Forbes
f973b1a29f SliderWidget's OnChange event has a parameter for a reason.. 2011-07-17 12:30:45 +12:00
Chris Forbes
a302b7999a trim usings after prev 2011-07-17 12:25:32 +12:00
Chris Forbes
413dd0cce4 move CncColorPickerLogic into its own file 2011-07-17 12:23:42 +12:00
Chris Forbes
af05856a5f fix foreach/closure bugs in CncLobbyLogic when setting up spectators 2011-07-17 12:15:20 +12:00
Chris Forbes
c05215c477 fix foreach/closure bugs in RA LobbyLogic; factor out name widget setup 2011-07-17 12:10:49 +12:00
Chris Forbes
8b78bc0602 move ReserveSpawnBuilding out of Plane.Tick and name it 2011-07-17 11:57:07 +12:00
Chris Forbes
2d8b72a5ff fix usings in Spy.cs 2011-07-17 11:38:45 +12:00
Chris Forbes
37656a02d9 have RALint check actor type in EjectOnDeath 2011-07-17 11:28:40 +12:00
Chris Forbes
5f315bc404 split unit smoke out into WithSmoke trait; remove duplication 2011-07-17 11:27:20 +12:00
Chris Forbes
d6819a19b8 declare WithRotor -> RenderSimple dep 2011-07-17 11:08:02 +12:00
Chris Forbes
cfc499e459 tidy usings for MapChooserLogic 2011-07-17 10:52:05 +12:00
Chris Forbes
c401e9c8fb tidy up ra music player 2011-07-17 10:52:05 +12:00
Chris Forbes
f8a9511a15 have RALint check CrateAction.ExcludedActorTypes 2011-07-17 10:32:03 +12:00
Chris Forbes
835d671752 fix 1036 -- GiveUnitCrateAction can give units which don't have BuildableInfo, to anyone 2011-07-17 10:29:00 +12:00
Chris Forbes
6a99ff7931 reinstate CrateAction.ExcludedActorTypes; custom maps use this. 2011-07-16 19:09:28 +12:00
Paul Chote
21ab82f91d Increase infantry crushability slightly. 2011-07-16 05:03:42 +12:00
Paul Chote
5722db0e34 Make Civilians crushable 2011-07-16 05:03:19 +12:00
Paul Chote
87e02ee7b1 Update CHANGELOG 2011-07-16 00:05:44 +12:00
Curtis S
2748c54002 Added new RA map by Buddha: Snowy Island 2011-07-16 00:05:44 +12:00
Curtis S
70a3b0aaba New version of RA Map: Center Of Attention 2011-07-16 00:05:44 +12:00
Chris Forbes
2a08b28094 remove need for #pragma in Bridge.cs 2011-07-16 00:05:44 +12:00
Chris Forbes
b1eea4a4d3 remove the need for warning suppression in Lazy/Cached 2011-07-16 00:05:44 +12:00
Paul Chote
f9b1c4fcc3 Work around a non-interactable window bug exposed by earlier graphics refactoring. 2011-07-15 23:57:29 +12:00
Paul Chote
eabcc51738 Fix gun firing offset (Bug #940). 2011-07-15 21:31:48 +12:00
Paul Chote
e40581149a Fix mtnk firing offset (Bug #938). 2011-07-15 21:31:48 +12:00
Paul Chote
3ae34fabf1 Fix ltnk firing offsets (Bug #939). 2011-07-15 21:31:48 +12:00
Paul Chote
e39d45d108 Add a delay before playing the win/lose audio notification. 2011-07-15 21:31:48 +12:00
Paul Chote
bc1a50693c Toggle repair/sell button state when active. 2011-07-15 21:31:48 +12:00
Paul Chote
1c29c95614 Use toggle artwork for production tabs. Change tab label color on alerted tabs. Contributes towards #1006. 2011-07-15 21:31:48 +12:00
Paul Chote
8f4c2371c7 Rename TooltipButton -> ToggleButton and add an active state. Use for production group icons. 2011-07-15 21:31:48 +12:00
Paul Chote
fef8008c87 Add click sounds to production tabs. Contributes towards #1006. 2011-07-15 21:31:47 +12:00
Paul Chote
05acdc9b98 Clean up some uses of rect.Contains(int2). 2011-07-15 21:31:47 +12:00
Paul Chote
8390644fbe Fix scrollthumb hover state 2011-07-15 21:31:47 +12:00
Paul Chote
4d2310b077 Add left and right arrows for the tabstrip. Rearrange chrome.png layout slightly. 2011-07-15 21:31:47 +12:00
Paul Chote
affc99e1cd Remove obsolete buttons.psd from artsrc. 2011-07-15 21:31:47 +12:00
Paul Chote
a9b479dfea Show (Dead) in the player list in the objectives screen (Bug #1031). 2011-07-15 21:31:47 +12:00
Paul Chote
d6b5b282bf Fix player name color in objectives screen (Bug #1030). 2011-07-15 21:31:47 +12:00
Paul Chote
e333ea89c9 Remove mods/cnc/packages reference from C&C's mod.yaml to match RA. Packages are now loaded exclusively from the support dir for both mods. Completes fix for #1016. 2011-07-15 21:31:47 +12:00
Curtis S
60adc57ca2 Removed .\mods\ra\packages reference in mod.yaml 2011-07-15 21:31:47 +12:00
Curtis S
e73969cb26 Reduced MSUB damage from 400 to 300 2011-07-15 21:31:47 +12:00
Curtis S
33ad765e3b Changed msub cloak time from 50 ticks to 100 2011-07-15 21:31:47 +12:00
Curtis S
4be76fcfc0 Added CashTrickler trait to RA oil derrick 2011-07-15 21:31:47 +12:00
Curtis S
403b05b4db Fixed palette issues in RA oil derrick SHP 2011-07-15 21:31:46 +12:00
Paul Chote
725b0cda40 Fix Production Palette audio (Bug #1004). 2011-07-15 21:31:46 +12:00
Paul Chote
5fceaaec58 New APC turret; art by Daniel Hernandez. 2011-07-15 20:10:22 +12:00
Paul Chote
089cdf14ad Remove the baked harvester animation from proc. Fixes #1009. 2011-07-15 20:10:22 +12:00
Paul Chote
24d220213e Remove extraneous spaces after weapon names 2011-07-15 20:10:22 +12:00
Paul Chote
c981b4322e Increase bike damage by ~16%, give weapon a sensible name. 2011-07-15 20:10:22 +12:00
Paul Chote
6090fda144 Increase building repair rate, cost. 2011-07-15 20:10:21 +12:00
Paul Chote
6433e6b356 Halve Mammoth Tank regen rate 2011-07-15 20:10:21 +12:00
Paul Chote
39338c1d3a Update CHANGELOG 2011-07-15 20:10:21 +12:00
Paul Chote
e9bd03b686 Add crushable infantry support, enabled in C&C. 2011-07-15 20:10:21 +12:00
Paul Chote
7173d193cf Pass the sequence name to the Corpse effect instead of an InfDeath number. Only play death animations for standard deaths. 2011-07-15 20:10:21 +12:00
Paul Chote
19ead53223 Add a WarnCrush method to ICrushable which is called when a crusher begins to enter the cell. 2011-07-15 20:10:21 +12:00
Paul Chote
74d13286a8 Add a force flag to nudging which skips the ownership and idle checks 2011-07-15 20:10:21 +12:00
Paul Chote
98ae8c7630 Take ownership into account when determining crushability. Fixes the important half of #951 (tanks crushing your own walls). 2011-07-14 21:00:50 +12:00
Paul Chote
64b88819a9 Add plumbing to support ownership checks in MobileInfo.CanEnterCell. 2011-07-14 21:00:50 +12:00
Paul Chote
47ba4cb285 Add click sounds to ingame buttons 2011-07-14 21:00:45 +12:00
Paul Chote
195aecec0e Add chat notification audio 2011-07-14 20:29:14 +12:00
Paul Chote
f724da5628 Tweak lobby chat panel 2011-07-14 20:29:14 +12:00
Paul Chote
3f468353fc Fix player name color in lobby chat. 2011-07-14 20:29:14 +12:00
Paul Chote
562931196f Give observers a minimap 2011-07-14 20:29:14 +12:00
Paul Chote
9eb7a3c27b Tweak button positions 2011-07-14 20:29:14 +12:00
Paul Chote
b82b716506 Add icons for options/sell/repair 2011-07-14 20:29:14 +12:00
Paul Chote
dc0c0e744a Production group icons 2011-07-14 20:29:14 +12:00
Paul Chote
32322b1658 Add tooltip descriptions to support powers 2011-07-14 20:29:14 +12:00
Paul Chote
5b2d2265e3 Add 8 maps by Petrenko, remove evw2. 2011-07-14 20:29:14 +12:00
Paul Chote
2049030ad4 Show remaining build time, remove unnecessary calculations from production palette 2011-07-14 20:29:13 +12:00
Paul Chote
29a90021f6 Fix production tabs crash 2011-07-14 20:29:13 +12:00
Paul Chote
07ae0688ff Fix unexplored terrain tooltip 2011-07-14 20:29:13 +12:00
Paul Chote
ef8ed398ce Tweak special powers widget: move unnecessary calculations out of Draw(); display the charge time over the icon. 2011-07-14 20:29:13 +12:00
Paul Chote
574133429a Fix control groups 2011-07-14 20:29:13 +12:00
Paul Chote
3d9a8cc002 Fix a tooltip crash. 2011-07-14 20:29:13 +12:00
Paul Chote
b2bfc5368a Initial production tooltip 2011-07-14 20:29:13 +12:00
Paul Chote
6199ec1404 Hide the objectives panel when opening submenus 2011-07-14 20:29:13 +12:00
Paul Chote
d70e5d3c42 Simple support power tooltips 2011-07-14 20:29:12 +12:00
Paul Chote
e078c8f8d8 Add owner name/flag to world tooltip. 2011-07-14 20:29:12 +12:00
Paul Chote
c965899b8c Better support for dynamic tooltip sizes 2011-07-14 20:29:12 +12:00
Paul Chote
dd7e270780 Update tooltip every render - fixes tooltips for actors changing under the cursor. 2011-07-14 20:29:12 +12:00
Paul Chote
7c72c1564e Add tooltip hook to SupportPowers; save some batches. 2011-07-14 20:29:12 +12:00
Paul Chote
ca77f20f19 Save batches in ProductionPalette 2011-07-14 20:29:12 +12:00
Paul Chote
5f3483ed17 Improve edge-scroll behavior 2011-07-14 20:29:12 +12:00
Paul Chote
ca8605d3ee Remove dialog4 2011-07-14 20:29:12 +12:00
Paul Chote
b1fe085b4d Remove incorrectly hardcoded "dialog4" from WidgetUtils.GetBorderSizes(). 2011-07-14 20:29:12 +12:00
Paul Chote
06990e356f Simple world tooltip. 2011-07-14 20:29:12 +12:00
Paul Chote
88d68f7790 Containers shouldn't steal mouseover focus 2011-07-14 20:29:11 +12:00
Paul Chote
2f9114fcf8 Power/Silo bar tooltips. 2011-07-14 20:29:11 +12:00
Paul Chote
b4489028de Polish button tooltips. Add tooltips/hotkeys for menu/sell/repair 2011-07-14 20:29:11 +12:00
Paul Chote
460451c402 Start implementing new tooltip bits. Test tooltips added for buttons and production palette. 2011-07-14 20:29:11 +12:00
Chris Forbes
608bdc8fcd pull some validation out of individual lobby/player commands 2011-07-14 20:29:11 +12:00
Chris Forbes
2ec88a6f64 remove duplicated NextPowerOf2 definition 2011-07-14 20:29:11 +12:00
Chris Forbes
2259a0e7a5 remove duplication of DrawSelectionBox 2011-07-14 20:29:11 +12:00
Chris Forbes
2ab2ee17c1 remove duplicated HarvestThisTile function from Harvest.cs 2011-07-14 20:29:11 +12:00
Chris Forbes
332d6d82fe add using rather than fully qualifying StackTrace typename 2011-07-14 20:29:11 +12:00
Chris Forbes
6f477a2c14 fix broken detection of desktop resolution on linux 2011-07-14 20:29:10 +12:00
Chris Forbes
88d0c9238c more debug output from Cg renderer setup 2011-07-14 20:29:10 +12:00
Chris Forbes
b06647a079 reduce noise in Renderer 2011-07-14 20:29:10 +12:00
Chris Forbes
ceaca47747 don't use ScrollDirection.Set when it's not needed 2011-07-14 20:29:10 +12:00
Chris Forbes
1196948a13 remove duplicated box-drawing code from WICW 2011-07-14 20:29:10 +12:00
Chris Forbes
2a7be6debd add missing using for MouseScrollType 2011-07-14 20:29:10 +12:00
Chris Forbes
496135d321 clean up ViewportScrollControllerWidget.GetCursor 2011-07-14 20:29:10 +12:00
Chris Forbes
2da523e824 drop unused WorldRenderer.DrawBox 2011-07-14 20:29:10 +12:00
Chris Forbes
98ebb7c87e add DrawRect helper to LineRenderer, use it in both Radar*Widgets 2011-07-14 20:29:09 +12:00
Chris Forbes
5af4476cd8 split AnnounceOnKill into its own file 2011-07-14 20:29:09 +12:00
Chris Forbes
5633d84d21 add lint pass to check whether types with ISync actually have any [Sync] members 2011-07-14 20:29:09 +12:00
Chris Forbes
513b852a67 fix [Sync] being allowed in places that don't make sense 2011-07-14 20:29:09 +12:00
Chris Forbes
74335f0734 fix bogus indent in ObjectCreator 2011-07-14 20:29:09 +12:00
Chris Forbes
b1ee735f3b put CheckAutotargetWiring in its own file 2011-07-14 20:29:09 +12:00
Chris Forbes
60a3f170ab clean up remaining non-generic GetValue uses 2011-07-14 20:29:09 +12:00
Chris Forbes
913ca89d4f use generic GetValue<> in VoiceInfo 2011-07-14 20:29:09 +12:00
Chris Forbes
914b3e1bee use generic GetValue<> in MobileInfo custom loader 2011-07-14 20:29:09 +12:00
Chris Forbes
33e6c7d39f fix namespace on cnc ProductionQueueFromSelection 2011-07-14 20:29:09 +12:00
Chris Forbes
c6cdee6075 more noise reduction in SVC 2011-07-14 20:29:09 +12:00
Chris Forbes
d0ac8b9766 remove spam from SVC 2011-07-14 20:29:08 +12:00
Chris Forbes
6565f7b32c removing some noise from SVC 2011-07-14 20:29:08 +12:00
Chris Forbes
5b481c2445 add Bits<> support to FieldLoader 2011-07-14 20:29:08 +12:00
Chris Forbes
c7c97ec743 rename ColorHSLR.cs to ColorRamp.cs to match classname 2011-07-14 20:29:08 +12:00
Chris Forbes
95e29e06df add Bits/BitAllocator types 2011-07-14 20:29:08 +12:00
Chris Forbes
47e25bb5a1 use common version of AreMutualAllies in PC 2011-07-14 20:29:08 +12:00
Chris Forbes
85bb56fd8f use common version of AreMutualAllies in SPW 2011-07-14 20:29:08 +12:00
Chris Forbes
f37cf32021 use AreMutualAllies in SVC 2011-07-14 20:29:08 +12:00
Chris Forbes
4e1c845303 add common version of AreMutualAllies to WorldUtils 2011-07-14 20:29:07 +12:00
Chris Forbes
c9c31345aa fix broken indent in WorldUtils.cs 2011-07-14 20:29:07 +12:00
Chris Forbes
1076ebb884 declare SVC -> CVC dep, rather than silently not working 2011-07-14 20:29:07 +12:00
Chris Forbes
002a8edb4c remove RatioRequired, CriticalRatioRequired from SVC, use info members 2011-07-14 20:29:07 +12:00
Chris Forbes
6f920e9011 cleanup StrategicVictoryConditions.cs 2011-07-14 20:29:07 +12:00
Chris Forbes
a9c00bdfba fix vis,naming of StrategicVictoryConditions.self 2011-07-14 20:29:07 +12:00
Chris Forbes
e44b965785 fixed #999 -- replace order/first[ordefault] with .ClosestTo(point) 2011-07-14 20:29:07 +12:00
Chris Forbes
5c3a6c81ae tidy HackyAI 2011-07-14 20:29:07 +12:00
Chris Forbes
c1a6b3470a fix indent in HackyAI.DeployMcv 2011-07-14 20:29:06 +12:00
Chris Forbes
b6bdff6f85 [2/2] fixed #998 -- clean up HackyAI.BuildRandom 2011-07-14 20:29:06 +12:00
Chris Forbes
56a38b9463 [1/2] fixed #998 -- clean up HackyAI.BuildRandom 2011-07-14 20:29:06 +12:00
Chris Forbes
6f2d1c54d6 fixed #983 -- don't crash in HackyAI if we can't find a target. 2011-07-14 20:29:06 +12:00
Chris Forbes
14de16eeba fix indent in HackyAI.Activate 2011-07-14 20:29:06 +12:00
Chris Forbes
b69ed51fb1 remove spurious second BuildRandom(Vehicle) call 2011-07-14 20:29:06 +12:00
Chris Forbes
bccac29297 simplify FieldSaver.FormatValue 2011-07-14 20:29:06 +12:00
Chris Forbes
be1754d424 bug #997 -- remove duplication from HackyAIInfo 2011-07-14 20:29:06 +12:00
Chris Forbes
847a248a26 bug #997 -- introduce generic version of FieldLoader.GetValue 2011-07-14 20:29:06 +12:00
Chris Forbes
7e162ad744 remove done todos from hackyai 2011-07-14 20:29:06 +12:00
Chris Forbes
0cb1f98e7e fixed #994 - use FormatTimeSeconds in MusicPlayerLogic 2011-07-14 20:29:06 +12:00
Chris Forbes
8610222e2c remove spurious typenames from WidgetUtils.WrapText 2011-07-14 20:29:05 +12:00
Chris Forbes
5b5bca9903 split FormatTime, FormatTimeSeconds 2011-07-14 20:29:05 +12:00
Chris Forbes
d40b071ab1 tidy in WidgetUtils 2011-07-14 20:29:05 +12:00
Chris Forbes
99b8c765c7 fixed #996 -- Rules.InstalledMusic 2011-07-14 20:29:05 +12:00
Chris Forbes
1a2dc8ec1c fixed #995 - remove duplication in next/prev song in MusicPlayerLogic.cs 2011-07-14 20:29:05 +12:00
Chris Forbes
b71e8bfe85 work on #993 -- removed OnMouseUp from DeveloperModeLogic.cs 2011-07-14 20:29:05 +12:00
Chris Forbes
897f578fc4 work on #993 -- removed OnMouseUp from DiplomacyLogic.cs 2011-07-14 20:29:05 +12:00
Chris Forbes
b9834c5b88 work on #993 -- removed OnMouseUp from MapChooserLogic.cs 2011-07-14 20:29:05 +12:00
Chris Forbes
accf94d664 work on #993 -- removed OnMouseUp from ReplayBrowserLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
3bdea009e3 work on #993 -- removed OnMouseUp from CreateServerMenuLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
c4985a043b work on #993 -- removed OnMouseUp from IngameObserverChromeLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
50303107d8 work on #993 -- removed OnMouseUp from SettingsMenuLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
f666dc08f5 work on #993 -- removed OnMouseUp from LobbyLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
bd018484e1 work on #993 -- removed OnMouseUp from IngameChromeLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
dfd73ce209 work on #993 -- removed OnMouseUp from MainMenuButtonsLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
980dc265ef work on #993 -- removed OnMouseUp from ServerBrowserLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
c32e0186b9 work on #993 -- removed OnMouseUp from ConnectionDialogsLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
8e780759bf work on #993 -- removed OnMouseUp from GameInitLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
14f29eb30e work on #993 -- removed OnMouseUp from MusicPLayerLogic.cs 2011-07-14 20:29:04 +12:00
Chris Forbes
d5ee3655f3 fixed #992: removed spurious double-semicolons 2011-07-14 20:29:03 +12:00
Chris Forbes
d95b579ead Makefile: fix various issues
* Add missing dependency between shippable binaries and fixheader
* Remove spam when fixheader is used
* Remove error message on from clean
* Fix minimal rebuilds
* Use strict variables to avoid shelling out so often for file lists
* Reenable RALint checking of mods

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
2011-07-14 20:29:03 +12:00
Chris Forbes
cd63da85d8 remove FieldLoader.LoadAttribute; replace with FieldLoader.IgnoreAttribute 2011-07-14 20:29:03 +12:00
Chris Forbes
a4648cfbcc move SheetSize to Graphics section of settings 2011-07-14 20:29:03 +12:00
Chris Forbes
54dee43590 test for required extensions in Cg renderer too 2011-07-14 20:29:03 +12:00
Chris Forbes
dcd9627c22 fixed #989: don't do renderer setup in a reflected call. 2011-07-14 20:29:03 +12:00
Chris Forbes
a07e151ab5 drop bogus comment in renderer 2011-07-14 20:29:03 +12:00
Paul Chote
0c95b43c87 Save some dumb perf in Widget.RenderBounds. 2011-07-14 20:29:03 +12:00
Paul Chote
e9d67860de Proper mouseover support. 2011-07-14 20:29:02 +12:00
Paul Chote
1114293035 Apply consistent widget method names. Semantic change: Widgets that want to tick when !Visible must override TickOuter() instead of Tick(). 2011-07-14 20:29:02 +12:00
Paul Chote
193999a040 Move OnMouseUp onto ButtonWidget and drop its unnecessary plumbing. 2011-07-14 20:29:02 +12:00
Paul Chote
8189ef109e Reorganize Widget into static/nonstatic. 2011-07-14 20:29:02 +12:00
Paul Chote
e58e354c4b Move IsDisabled checking for OnMouseDown into ButtonWidget. Remove unnecessary bool plumbing. 2011-07-14 20:29:02 +12:00
Paul Chote
bbeaf2047b Remove OnMouseDown from Widget. Define it on just the widgets that want it. 2011-07-14 20:29:02 +12:00
Paul Chote
7a69daa99c Remove Widget.OnMouseMove. 2011-07-14 20:29:01 +12:00
Paul Chote
f905c87b97 New support powers bin 2011-07-14 20:29:01 +12:00
Paul Chote
e787c46a81 Remove border from buildclock overlay. 2011-07-14 20:29:01 +12:00
Paul Chote
5f8beb632a Switch tabs when a queue is lost, hide tab-strip when there are no queues available, rename queueType -> queueGroup. 2011-07-14 20:29:01 +12:00
Paul Chote
a065ba0338 Keyboard support for production palette:
y/u/i/o/p map to Buildings/Defense/Infantry/Vehicles/Aircraft.
Tab or successive y/u/i/o/p will switch tabs within a category.
Successive clicks on category icons will also switch tabs.
Shift + keyboard/click cycles tabs in reverse.
2011-07-14 20:29:01 +12:00
Paul Chote
c1f7152857 Change Widget key support: Move (unused) Widget.OnKeyPress hook onto ButtonWidget; Buttons will respond to keys with modifiers. 2011-07-14 20:28:35 +12:00
Paul Chote
6877c29fa6 Reimplement production queue switching from selection. 2011-07-03 07:02:17 +12:00
Paul Chote
70faee4e9c Remove obsoleted artwork 2011-07-03 06:32:05 +12:00
Paul Chote
8950ef7bcb Hook up sell/repair buttons 2011-07-03 06:29:41 +12:00
Paul Chote
f96840df36 Rewrite production palette. Tooltips will be reimplemented later. 2011-07-03 06:20:02 +12:00
Paul Chote
c76811c5e1 Rewrite production tabs (again): Avoid doing a pile of work every tick; support multiple queue types grouped under one category; Tab numbering is sticky. 2011-07-03 01:48:14 +12:00
Paul Chote
b85fce3b41 Disable queue buttons when there are no tabs 2011-07-02 21:37:31 +12:00
Paul Chote
fe380b13ac Rewrite ProductionTabsWidget. 2011-07-02 21:18:26 +12:00
Paul Chote
d5e63538ad Port production palette from ui2 branch. Needs reworking. Unfinished. 2011-07-02 07:32:34 +12:00
Paul Chote
dba77daae0 Fix namespace 2011-07-02 07:31:39 +12:00
Paul Chote
e922e8028c Hook up tib storage bar 2011-07-02 06:23:48 +12:00
Paul Chote
7e67fdb446 Wire up power bar 2011-07-02 04:27:40 +12:00
Paul Chote
1f92286b51 Wire up cash display 2011-07-02 03:53:13 +12:00
Paul Chote
7e42175a94 Mock up sidebar using existing widgets 2011-07-02 03:45:42 +12:00
Paul Chote
717471a522 New faction flags 2011-07-02 01:31:18 +12:00
Paul Chote
9b3cedd37f Show map title in the lobby 2011-07-01 23:37:53 +12:00
Daniel Hernandez
0224b3b745 Fix stnk husk (Fixes #985). 2011-07-01 23:22:07 +12:00
Paul Chote
3dec6016e7 Remove diplomacy menu, lock teams option (Feature #950). 2011-07-01 23:19:50 +12:00
Paul Chote
fa6b9983d3 Conquest objectives panel (Feature #949). 2011-07-01 23:07:50 +12:00
Paul Chote
c81735911e Add Funcs for custom label Color/ContrastColor 2011-07-01 23:04:48 +12:00
Paul Chote
97186d8bd9 Support custom checkbox symbols. Add a crossed variant to C&C. Correctly copies checkbox state when copying checkboxes. 2011-07-01 23:04:48 +12:00
Paul Chote
7c63138e3f Mechanism for showing mission objectives in the ingame menu. Fixes #948. 2011-07-01 02:34:30 +12:00
Paul Chote
aaa78649fc Make overflow tabs clickable. Fixes #550. 2011-07-01 00:42:53 +12:00
Paul Chote
c2519375b2 Reduce grenadier death damage. Fixes #957. 2011-07-01 00:35:09 +12:00
Paul Chote
0f3be08491 Halve tiberium damage to infantry, deal it smoothly. 2011-07-01 00:19:46 +12:00
Paul Chote
a835edfab1 Increase tiberium pathing penalty for infantry. Fixes #953. 2011-07-01 00:16:28 +12:00
Paul Chote
9cbf372698 Use new reveal-map and heal crate effects. Fixes #977. 2011-07-01 00:12:27 +12:00
Paul Chote
17fa312108 Use new cloak crate effect 2011-07-01 00:08:43 +12:00
Paul Chote
11a9bc7e43 Remove ExcludedActors from crate actions. Use a tag trait for cloakable actors. Ban MCV from receiving cloak. 2011-07-01 00:07:04 +12:00
Paul Chote
f360559869 Remove some crap from Cloak. 2011-06-30 23:54:42 +12:00
Paul Chote
fc10b79e1d Capturable Biolab allows production of player-controlled viceroids. 2011-06-30 20:20:00 +12:00
Paul Chote
0236dd04ae Work around capturable tech bug. 2011-06-30 20:17:49 +12:00
Paul Chote
9657d697fc Add dino/vice icons, dino voices, crate effects from Sole Survivor 2011-06-30 20:16:16 +12:00
Paul Chote
b58e091892 Write graphics.log on Cg renderer errors. Fixes second half of #967. Untested. 2011-06-29 11:37:52 +12:00
Paul Chote
d62a21da14 Improve GLSL renderer debug logging: Define GL_INVALID_OPERATION error code (was previously error 1282); Include GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION in graphics.log; write graphics.log when CheckGlError fails. Fixes #966 and half of #967. 2011-06-29 11:33:25 +12:00
Chris Forbes
0e45968573 remove 'private' keyword where possible 2011-06-29 09:15:39 +12:00
Chris Forbes
587b2ef0d1 convert Buildable trait construction to concise style 2011-06-29 07:50:20 +12:00
Paul Chote
3305d5fad9 Update CHANGELOG 2011-06-29 02:26:41 +12:00
Paul Chote
adc9318a05 Add Muzzleflash to RA SAM Site. 2011-06-29 02:03:58 +12:00
Paul Chote
05dead8271 Don't ship demo.mix in packages 2011-06-29 00:05:10 +12:00
Paul Chote
3816cca667 Remove Tundra map and the snow tileset. Fixes #969. 2011-06-29 00:05:10 +12:00
Paul Chote
c58284d06f Increase ATWR range by 1. Fixes #941 (detection circle not visible). 2011-06-29 00:05:10 +12:00
Paul Chote
a7670f10ea Reduce SAM Site range. Fixes #954. 2011-06-29 00:05:10 +12:00
Paul Chote
05826c0c9b Fix Apache tooltip, halve it's damage. Fixes #952. 2011-06-29 00:05:10 +12:00
Chris Forbes
11dc069104 fix RALint prereqs checking 2011-06-28 23:36:39 +12:00
Chris Forbes
0080762bbc fixed #359 -- diplomacy panel shows player colors 2011-06-28 23:21:49 +12:00
Chris Forbes
43d8750aad fixed #728: BuildableInfo.BaseNormal -> GivesBuildableArea 2011-06-28 23:11:20 +12:00
Chris Forbes
fb027a5650 fix broken palette handling in editor on linux/mac 2011-06-28 22:05:10 +12:00
Chris Forbes
9ae566cd68 remove some inconsistency from linux packaging script 2011-06-28 21:02:52 +12:00
Paul Chote
3d442afcab Update AUTHORS 2011-06-28 02:03:18 +12:00
Daniel Hernandez
5e0817fc37 Remappable oil derricks. Fixes #502. 2011-06-27 20:43:30 +12:00
Paul Chote
09bcc16cb1 Fix capturable tech structures. 2011-06-27 20:24:05 +12:00
Paul Chote
9886c1f6fe Fix unremappable pixels in heli.shp (Fixes #965). 2011-06-27 20:10:02 +12:00
Paul Chote
de44833457 Don't mangle shadows/cursors 2011-06-27 18:35:47 +12:00
Paul Chote
ebc0cea217 Fix #961 2011-06-27 18:30:44 +12:00
Paul Chote
3ec5693f69 Fix repair depot crash 2011-06-26 16:12:18 +12:00
Paul Chote
2cdc3c4288 Fix e3 firing offset. Fixes #936. 2011-06-26 02:29:25 +12:00
Paul Chote
31cb1c017f Fix e4, e5 firing offsets. 2011-06-26 02:29:25 +12:00
Paul Chote
98f4db750b Support for changing infantry barrel offsets when prone. Fixes #935. 2011-06-26 02:29:25 +12:00
Paul Chote
9b8e927c33 Fix Ion Cannon cursor 2011-06-25 22:04:00 +12:00
Chris Forbes
8df0d973fa add RA:Aftermath music 2011-06-25 18:48:01 +12:00
Chris Forbes
9f5ee7fc1a add RA:Counterstrike music 2011-06-25 18:44:31 +12:00
Chris Forbes
cf4769979d fixed #899 -- OpenRA.Utility --png was missing unlock 2011-06-25 18:20:32 +12:00
Chris Forbes
a3601b1214 drop redundant virtuals from WithMuzzleFlash 2011-06-25 18:12:05 +12:00
Daniel Hernandez
6da5724af8 added new 2x2 oil derrick 2011-06-25 17:51:51 +12:00
Paul Chote
a4e319b9d2 Define a specific harvest cursor. Use attack for cnc harvest. 2011-06-25 17:40:34 +12:00
Paul Chote
fd2d15c0fe Work around #937. May have negative perf impact. 2011-06-25 16:43:51 +12:00
Paul Chote
fc37733c3c Add a screen-space offset to barrel positions, and fix HTNK firing offsets. Fixes #803, 929. 2011-06-25 15:25:22 +12:00
Paul Chote
b64c5e001e Add support for C&C Covert Ops music (fixes half of #824). 2011-06-25 14:43:45 +12:00
Paul Chote
24a649d491 Fix artillery firing offset. Fixes #928. 2011-06-25 14:06:54 +12:00
Paul Chote
2f07a38de0 Fix JEEP turret offset (Fixes #927) 2011-06-25 13:57:05 +12:00
Paul Chote
81d1444b4a Fix turreted muzzleflashes. 2011-06-25 13:54:30 +12:00
Paul Chote
016a082a76 Add Great Shot!' and Map theme' scores. Use Map theme for the shellmap. Fixes #913. 2011-06-25 13:32:16 +12:00
Chris Forbes
fabb89f4da disable component UI in windows installer 2011-06-25 12:26:45 +12:00
Lawrence Wang
1fa4cf5c0a Bug 856- Removal of extra few lines of code 2011-06-25 11:54:19 +12:00
Lawrence Wang
de5db51f25 Fixed #856 - created trait for ammo reload time, set for some aircraft 2011-06-25 11:54:12 +12:00
Chris Forbes
6be55b61aa fixed #934 -- convert all AttackBase.MuzzleFlash uses to WithMuzzleFlash 2011-06-25 11:51:04 +12:00
Chris Forbes
29b81be5bb removed obsolete data sln 2011-06-25 11:41:13 +12:00
Paul Chote
a59ff827b8 Update CHANGELOG 2011-06-25 00:18:17 +12:00
Paul Chote
b39880a845 SAM site muzzleflash (Fixes #923) 2011-06-25 00:17:49 +12:00
Paul Chote
6817332317 Rework apache weapon and firing offsets. Has duel machine guns with 10 shots, reloads all of its ammo every 8 seconds. Damage increased, and can now attack air. Fixes second half of #930. 2011-06-24 23:58:52 +12:00
Paul Chote
44c86928ec Rework orca weapons and firing offsets. Now fires a volley of 10 rockets, which reload at 2 per 3 seconds. Fixes half of #930. 2011-06-24 23:58:30 +12:00
Paul Chote
3b55b92573 Fix BGGY turret location (Fixes #926) 2011-06-24 20:56:45 +12:00
Paul Chote
24266ebc93 Autodetect CD instead of prompting the user. Fixes #911. Requires testing under Windows and Linux. 2011-06-24 19:08:29 +12:00
Paul Chote
dc9b0adba9 Kill unused map installation code. 2011-06-24 17:26:33 +12:00
Paul Chote
916e63710c Fix #892 2011-06-24 17:08:58 +12:00
Paul Chote
8122d63a74 Remove SSM from Nod 2011-06-24 01:40:00 +12:00
Paul Chote
edbc7a028b Artillery goes back to Nod 2011-06-24 01:21:17 +12:00
Paul Chote
06c32a728a Update CHANGELOG 2011-06-24 00:40:58 +12:00
Paul Chote
35a5fc3356 Work around for #902. 2011-06-24 00:40:58 +12:00
Paul Chote
2d34169d79 Fix harv/proc/selling interaction. Fix formatting issues in OreRefinery. (Fixes #901, #903) 2011-06-24 00:40:58 +12:00
Paul Chote
122c7ec569 Don't show bounty cashticks of $0. 2011-06-24 00:40:58 +12:00
Paul Chote
ef8b6b2e71 Remove FlyOffMap.Interruptable. Fixes #906. 2011-06-24 00:40:58 +12:00
Paul Chote
78502317aa APC becomes an Anti-Air transport. Will need new turret artwork. 2011-06-24 00:40:57 +12:00
Paul Chote
1848405795 Rocket Launcher (MSAM) rework. Now fires 6 unguided rockets, has a fixed turret, cannot target air. 2011-06-24 00:40:57 +12:00
Paul Chote
41def5fef5 Split STNK weapon from MSAM, give it burst 2, and set correct barrel offsets. Doubles effective STNK damage. (Fixes #907) 2011-06-23 18:45:35 +12:00
Paul Chote
60a4a06ee4 Restore APC cargo pips (Fixes #910). 2011-06-23 18:13:08 +12:00
Paul Chote
ec3d467858 HackyAI supports teams (Fixes #917). 2011-06-23 17:41:38 +12:00
Paul Chote
6ed0c574be Update CHANGELOG 2011-06-22 22:33:57 +12:00
Paul Chote
099ede0428 Halve bridge strength 2011-06-21 20:44:19 +12:00
Paul Chote
65f1427bf2 Fix some other bogus bits in Bridge 2011-06-21 20:35:19 +12:00
Paul Chote
5e220a9ac7 Fix #306 2011-06-21 20:35:08 +12:00
Paul Chote
af4093f380 Swap the default value for FlyOffMap.Interruptible. The common case (scripted aircraft) don't want to be interruptible. Fixes badr desync caused by the mono 2.6.7 compiler dropping initializers for bools that default to true. 2011-06-21 14:20:08 +12:00
Paul Chote
74b2b36a40 Clean up and merge #883 2011-06-21 13:34:38 +12:00
Curtis S
bb2e514dfd Fixed title in ra map "Center of Attention" 2011-06-21 13:14:05 +12:00
Paul Chote
6feccab5db Add map-player check to SurrenderOnDisconnect 2011-06-21 03:41:36 +12:00
Paul Chote
1cdfd44d43 Fix #897. 2011-06-21 03:40:39 +12:00
Paul Chote
ce65127e34 Fix observer tooltips (Bug #769) 2011-06-21 02:51:50 +12:00
Paul Chote
e33995d71b Don't display a tooltip for actors without the Tooltip trait 2011-06-21 02:48:52 +12:00
Paul Chote
088573f2b7 Disable controls instead of hiding when ready. Fixes #889 2011-06-20 22:50:32 +12:00
Paul Chote
7838896c81 Display bot spawns to everyone, not just the host. 2011-06-20 22:50:32 +12:00
Paul Chote
43aae99dd0 Fix #888 2011-06-20 22:50:32 +12:00
Paul Chote
49dfbd43b7 Fix #896 2011-06-20 22:50:32 +12:00
Paul Chote
347a80f0a7 Unbitrot GDI01. The broken rules overrides have been left as a testcase for #768 2011-06-20 22:50:32 +12:00
Paul Chote
c014731a2f Fix Map.PlayerCount 2011-06-20 22:50:31 +12:00
Paul Chote
bafa411329 Expose LockTeam/LockSpawn to mappers 2011-06-20 22:50:31 +12:00
Paul Chote
8875d1adee Skirmish starts with the last used map. 2011-06-20 22:50:31 +12:00
Paul Chote
4fa9a2ba2b Group the music button on the left 2011-06-20 22:50:31 +12:00
Paul Chote
e00bfd487d Hook up the spawn selector. 2011-06-20 22:50:31 +12:00
Paul Chote
c80fbaacd5 Add a spawnpoint selector for bots (selector logic unimplemented) 2011-06-20 22:50:30 +12:00
Paul Chote
b4ce97691b Use images instead of checkboxes for non-editable status fields and fix player template naming: local/remote -> editable/non-editable. 2011-06-20 22:50:30 +12:00
Paul Chote
ac68f9dab3 Remove Bot: label from bots in the slot dropdown. 2011-06-20 22:50:30 +12:00
Paul Chote
e7543f28df Fix naming of Player.PlayerReference. 2011-06-20 22:50:29 +12:00
Paul Chote
91b31b1981 Rewrite ChooseInitialStance to support bot teams and remove obsolete crap. 2011-06-20 22:50:29 +12:00
Paul Chote
4f172d7ed8 Make bots first-class players.
- Bots have their own Clients, with unique ClientIDs
 - Hosts can set bot team/color in the lobby
 - Bots are kicked when switching to a smaller map without enough slots
 - Order validator assumes that only client 0 has permission to issue bot orders
2011-06-20 22:50:29 +12:00
Paul Chote
0c9190a1af Enforce color/race/team locking 2011-06-20 22:50:28 +12:00
Paul Chote
19d74fef52 Server support for host changing other client's race/color/team/spawn 2011-06-20 22:50:28 +12:00
Paul Chote
d2df5722b5 Fix the lobby slots.
- lobbyInfo.Slots is now a dictionary, keyed by the name of the PlayerReference that the slot is tied to.
 - LockRace/Color/Team is now specified on the slot, avoiding map lookups in the lobby
 - Observers are no longer tied to slots -> players will join as observers instead of crashing the game if there are no available slots
 - Observers are able to change their name and color
2011-06-20 22:50:27 +12:00
Paul Chote
e934baa6e9 Better bot spawning code; better random color and proper player names. 2011-06-20 22:50:27 +12:00
Paul Chote
0899916406 Disable diplomacy and cheats for observers 2011-06-20 22:50:26 +12:00
Paul Chote
532bd42aed Remove obsolete Player index cruft 2011-06-20 22:50:26 +12:00
Paul Chote
bcbd18bb52 Skirmish mode starts with a bot selected. 2011-06-20 22:50:22 +12:00
Paul Chote
c6182f6039 Fix player connected chat message 2011-06-20 14:39:03 +12:00
Chris Forbes
3409d8f046 remove type-specific functions for ChromeMetrics.Get; use FieldLoader 2011-06-20 14:39:03 +12:00
Paul Chote
7095f293ff Fix #865 2011-06-20 14:39:03 +12:00
Paul Chote
63e77755b7 Fix #864 - don't display the depressed state if the checkbox is disabled 2011-06-20 14:38:59 +12:00
Paul Chote
d043f4807f Make the checkbox depressed state optional, and disabled in ra. 2011-06-20 14:34:29 +12:00
Paul Chote
94bca753d2 Fix #866 2011-06-20 13:03:23 +12:00
Paul Chote
9bf0a97327 Fix RMBO death sequences 2011-06-20 13:03:23 +12:00
Paul Chote
fe5ef82cdf Allow bot players to be created via map.yaml 2011-06-20 13:03:23 +12:00
Paul Chote
64497c9b2f Fix exploding walls 2011-06-20 13:03:23 +12:00
Paul Chote
2f86208a9a Swap mod and replay buttons 2011-06-20 13:03:23 +12:00
Paul Chote
568814b15a Display cnc mod version in the main menu 2011-06-20 13:03:23 +12:00
Paul Chote
7fb46bb2b6 Work around CreateLocalServer miscompile 2011-06-20 13:03:20 +12:00
856 changed files with 21410 additions and 20662 deletions

3
.gitignore vendored
View File

@@ -7,6 +7,7 @@ obj
*.suo
*.user
*.sln.cache
*.manifest
mods/*/*.dll
# Red Alert binary files
@@ -55,3 +56,5 @@ OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3
Logs/
Replays/
settings.yaml
\#*
.*.sw?

49
AUTHORS
View File

@@ -1,13 +1,36 @@
AUTHORS
The OpenRA developers are:
* Chris Forbes
* Robert Pepperell
* Matthew Bowra-Dean
* Paul Chote
* Alli Witheford
* Joakim Lindberg
* Andrew Riedi
* Tim Mylemans
* Curtis Shmyr
* Caleb Anderson
AUTHORS
The OpenRA developers are:
* Alli Witheford (alzeih)
* Caleb Anderson (RobotCaleb)
* Chris Forbes (chrisf)
* Curtis Shmyr (hamb)
* Daniel Hernandez (Mancano)
* Matthew Bowra-Dean (beedee)
* Mike Bundy (kehaar)
Also thanks to:
* Akseli Virtanen (RAGEQUIT)
* Andrew Riedi
* Bellator
* Christer Ulfsparre (Holloweye)
* Erasmus Schroder (rasco)
* Igor Popov (ihptru)
* Jeff Harris (jeff_1amstudios)
* Joakim Lindberg (booom3)
* Kenny Hoxworth (hoxworth)
* Lawrence Wang
* Mark Olson (markolson)
* Matthew Gatland (mgatland)
* Max Ugrumov (katzsmile)
* Max621
* Nukem
* Paolo Chiodi (paolochiodi)
* Paul Dovydaitis (pdovy)
* Raymond Martineau (mart0258)
* Riderr3
* Tim Mylemans (gecko)
Past developers included:
* Paul Chote (pchote)
* Robert Pepperell (ytinasni)

260
CHANGELOG
View File

@@ -1,48 +1,244 @@
NEW:
Engine:
Don't show cashticks when selling walls
General performance improvements
Fixed minimap export breaking subsequent actions in the editor
Added owner chooser for new actors in the editor
Added actor info panel in the editor (doubleclick)
Added a Setup Default Players menu item to map editor
Both Mods:
Server lobbies upon creation use the previously played map
Added support for a Game.ConnectTo argument which allows clients to direct connect to a server when game is launched
Helicopters now bob slightly in flight
Bots now repair their own buildings
Fixed a bug where bots would be unable to set rallypoints for production buildings
Bots now maintain a level of aggro on enemy units
Made SpawnMPUnits' initial unit configurable
Added a dropdown list in the map editor for setting an actor's owner upon placement
Replaced the server browser with a new and awesome one
Fixed a bug where infantry squish sounds weren't positioned
Fixed a bug where actor priority wasn't correct for doubleclick
Red Alert:
Fixed a crash which occurred when playing an online game with Hard AI
Fixed a bug where planes could stack more than 1-per-airfield
Fixed a bug where planes would not rearm at airfields
Improved logic for sending planes and helicopters back to base
Changed MIG to fire 2 missiles per burst instead of 4
Changed HELI (longbow) to fire missiles in bursts of 2
Added a Show Shellmap setting
Changed team color picker to match C&C's
Fixed a bug where infantry could not pass over anti-tank mines, and vice versa
Fixed a bug where the shellmap would reload unnecessarily when disconnecting from a lobby that hasn't started
Added AutoTarget capability to submarines, but they are set to HoldFire stance by default
New Map: Bombardment Islands (Sprog)
New Map: Engagement (Nukem)
New Map: Man to Man (Nukem)
New Map: Asymetric Battle (Seru)
C&C:
Changed the bot spawn picker to match RA's
Reduced delay of tooltips
20111013:
Engine:
Fixed broken client IDs if players drop before the game starts
Converted FileExtractor into --extract cmdlet for Utility.
Added --transparent option to --png cmdlet in Utility.
Fixed shortcut description on Linux
Fixed launcher crashes on Mac
Removed obsolete SequenceEditor tool
Added --tmp-png cmdlet in Utility, to convert terrain to PNG.
Both Mods:
Allow building repair by allies
Use player color to show who is repairing a building
Only units/structures being built or queued are shaded in the production palette
Aircraft smoke is no longer visible under fog
Added a Show Grid option to the Map Editor
Added multitap support - double clicking a unit selects all units of the same type on screen
Changed map choosers to be a filterable grid of maps
Added internal machinery for IFV-style units
Red Alert:
Added naval transport
Added an indicator over powered down buildings
Aircraft crashing into water now use large_splash
Destroyer now requires Radar Dome
Increased cost of Shipyard and Sub Pen
Fixed a crash when sending aircraft back to base
Husks no longer interfere with selection
Added more options for bots in game lobby
Changed AI behavior -- now has Easy/Normal/Hard difficulty
Increased range of FTUR by 1
Reduced cost of MEDI from 500 to 300
Reduced cost of SHOK from 800 to 500
Heavy vehicles (Tanks, Harvesters, MCV) now crush infantry
New map: Classic DropZone (Holloweye)
New map: DropZone Battle of Tikiaki (Knivesron)
New map: DropZone W (Riderr3)
New map: Seven Stairs (Tirili)
New map: Contact (Nukem)
New map: Encounter (Nukem)
New map: Mass Confliction (Nukem)
New map: Calm before the Storm (Nukem)
New map: Baywatch (Nukem)
New map: Winter Warzone (Nukem)
New map: Paramount (Nukem)
New map: Doubles (Nukem)
New map: Hectic (Nukem)
New map: Pandemonium (Nukem)
New map: Chokepoint (Nukem)
New map: HotZone (Nukem)
New map: No Fly Zone (RAGEQUIT)
New map: Strip Mine (RAGEQUIT)
New map: Doughnut Hole (RAGEQUIT)
New map: Vegetation (hamb/Chris Forbes)
New map: Arctic Triangle Affair (Bellator)
New map: Mad Scramble (Bellator)
New map: Free Coasts (Ihptru)
New map: Battle Lake (Bellator)
C&C:
Slightly increased Tiberium growth rate
Increased harvester unload time
Reduced Tiberium value by 20%
Changed FTNK armor type to Light
Fixed tank squish animations to show properly
New map: Tiberium Oasis (Bellator)
20110906:
Engine:
Fixed compile failures under Windows
Improved rendering code
Reliable platform detection
Improved platform detection
Modding support for custom fonts
Video memory leaks fixed
Improved error messages for unsupported graphics cards
Fixed repairing of veteran units
Mod support for passengers that take multiple slots
Powered-down superweapons are no longer activated when multiple are available
Rally-points change color when a building is captured
Fix selection box dragging behind ui elements
Improved support for Intel graphics cards
Fixed incorrect resolution under some Linux systems
Write graphics.log on all graphics-related errors
Significant general performance improvements
[OSX] Shortcut for adding units to groups changed from ctrl->cmd
C&C:
Completely overhauled menu system
Local skirmish mode
Hotkey support:
Fix crashes when joining a game with no free player slots
Bots players are named after their AI type and pick better random colors
Map support for enforcing team and spawn choice
Fix resource-clearing weapons breaking custom terrain types (bridges)
Added a "Pixel double" mode to draw the world at 2x zoom.
Fixed broken mounting of map packages
Fixed crashes when loading broken maps
Fixed units being left alive but stranded on destroyed bridges
Fixed husks being created on water
Fixed AttackMove trying to send orders to units owned by others
Made LaserZap more flexible for modders
Both C&C and Red Alert:
Fixed desync when a player surrenders
Fixed installing from CD
Added Hotkey support:
escape to toggle ingame menu
escape to go up a level in menus / cancel prompts
return to confirm prompts
Support for installing game data and music from CD
Refinery footprint changed, price decreased to $1500
Flame tank explodes on death, damage reduced by 40%
Changed shortcut for adding units to groups changed from ctrl->cmd on OSX to avoid conflicting with Spaces
Fixed Tooltips for spectators
Fixed cashticks when selling walls
Fixed show explosions when walls are sold
Fixed veteran units not repairing correctly at service depots
Fixed Rally-point color when a building is captured
Fixed selection box dragging behind ui elements
Added Mod support for passengers that take multiple slots
Added Mod support for custom tesla zap effects
Fixed desync when a support aircraft is killed after completing its task
Fixed bugs with selling refineries
Fixed superweapons being fired from disabled structures when multiple are available
Added "Mission Accomplished" / "Mission Failed" notifications when you win or lose a multiplayer game
Fixed husks jumping to the middle of a cell when a unit dies
Fixed decloak sound never being used
Improved HackyAI power management
C&C:
Completely overhauled UI
Added support for installing from original game disks
Added support for installing music from original game disks
Added support for Covert Ops music tracks
Added Skirmish mode (creates a local game against bots)
Added Configurable bot race/team/spawns
Fixed Rocket Launcher turret raising/lowering when attacking
Added muzzle flashes to Guard Tower / SAM site
Fixed firing offsets on all units and structures
Fixed Ion Cannon cursor
Fixed Apache artwork
Fixed uncapturable oil derricks
Added capturable Biolab tech structure: allows you build viceroids
All vehicles leave husks on death
Concrete walls require vehicle production to build
MCV, Harvester, Engineer can no longer level up (via crates)
Fixed Rocket Launcher turret
Added muzzle flashes to Guard Tower
Corrected firing offsets on Flame tank / Advanced guard tower / Obelisk
Server/Skirmish creation selects the last played map by default
New animations for cloak and reveal map crates (from C&C Sole Survivor)
Added 8 new maps by Petrenko
Tweaked most existing maps
Removed East vs West 2 map
Fixed Harvester/Refinery docking animation beneath the fog of war
Improved Obelisk laser effect
Added a blue pip for harvested blue tiberium
Changed the Refinery tower lights to indicate the amount of stored tiberium
Fixed an exploit with Nod airfields on the right side of the map
Fixed bot color being saved as player color in lobby
Balance changes:
Refinery footprint changed, price decreased to $1500
Flame tank explodes on death, damage reduced by 40%
Stealth Tank damage increased, speed decreased
Rocket Launcher now fires 6 rockets, loses AA
Orca / Apache weapons reworked. Both now have limited volleys, but reload in the air. Both can attack other air units
APC weapons reworked. Now has a turret, but can attack air units only
Artillery given back to Nod
SSM launcher removed from Nod
Concrete walls require vehicle production to build
MCV, Harvester, Engineer can no longer level up (via crates)
MCV can no longer receive Cloak crates
Advanced Guard Tower range increased
SAM Site range decreased
Bridge HP halved
Infantry tiberium avoidance factor increased by 5x
Decrease tiberium damage to infantry
Rebalanced tiberium value / harvester capacity / harvesting speed
Reduced Grenadier death damage
Mammoth tank regen rate halved, Missile reload rate decreased
Building repair speed, price doubled
Recon Bike damage increased 16%
Infantry can be crushed by tanks
Removed build area radius around tech structures
Red Alert:
Corrected firing offsets on Flame trooper / Tesla trooper / Telsa tank / Tesla coil / Flame turret
Mod support for customizing tesla zap effect
Mines are visible to friendlies and spectators
Friendly units don't trigger mines
Bounties use correct unit value
Fixed firing offsets on Flame trooper / Tesla trooper / Telsa tank / Tesla coil / Flame turret
Fixed bounties using incorrect unit value
Fixed parachute offsets
Added muzzle flashes to Pillbox / Camo Pillbox
Medic cost reduced to $500
Correctly grant allies GPS
13 new maps by buddha, hamb, seru
Added muzzle flashes to Pillbox / Camo Pillbox / SAM Site
Fixed map reveal when an ally is granted GPS
Added 16 new maps by buddha, hamb, seru
Fixed bounties of $0 displaying
Removed 3 obsolete maps
Fixed Minelayers not entering the Service Depot properly
Fixed Hind, Yak weapons being blocked by walls
Fixed phantom radar bin on subsequent games
Added new Oil Derrick artwork
Added support for Counterstrike & Aftermath music tracks
Added player color to diplomacy panel
Added capturable oil refinery tech structure
Added new harvester artwork for half-empty/empty states
Added new MCV husk artwork
Fixed spy disguise not working
Fixed hellfire missiles splashing back against helicopters
Fixed animation speed for Grenadier idle animations
Removed Lock Teams option
Fixed cursor while dragging selection box
Fixed accidental order issuing while dragging selection box
Fixed lobby "kick" buttons
Balance changes:
Medic cost reduced to $500
Mines are visible to friendlies and spectators
Friendly units don't trigger mines
Increased reload rate for aircraft
Missile sub submerge delay doubled, damage decreased by 25%
Longbow now requires Allied Tech Center
Reduced wall health
Increased cruiser accuracy
Increased Longbow missile speed by 50%
Increased SAM Site rate of fire
Utility:
Fixes for converting shp -> png
Fixed --png mode for converting shp -> png
Editor:
Fixed actor rendering on OSX / Linux
Fixed crash relating to incorrect mix file location
20110511:
Engine:
@@ -685,4 +881,4 @@ NEW:
Improved debugging for performance issues
"Give Exploration" developer-mode option
Check for .net framework on windows install
Allow the viewport to scroll past the map edge to prevent ui from blocking buildings
Allow the viewport to scroll past the map edge to prevent ui from blocking buildings

View File

@@ -1,62 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.IO;
using OpenRA.FileFormats;
namespace FileExtractor
{
public class FileExtractor
{
int Length = 256;
public FileExtractor (string[] args)
{
if (args.Length != 2)
{
Console.WriteLine("usage: FileExtractor mod[,mod]* filename");
return;
}
var mods = args[0].Split(',');
var manifest = new Manifest(mods);
FileSystem.LoadFromManifest( manifest );
try
{
var readStream = FileSystem.Open(args[1]);
var writeStream = new FileStream(args[1], FileMode.OpenOrCreate, FileAccess.Write);
WriteOutFile(readStream, writeStream);
}
catch (FileNotFoundException)
{
Console.WriteLine(String.Format("No Such File {0}", args[1]));
}
}
void WriteOutFile (Stream readStream, Stream writeStream)
{
Byte[] buffer = new Byte[Length];
int bytesRead = readStream.Read(buffer,0,Length);
while( bytesRead > 0 )
{
writeStream.Write(buffer,0,bytesRead);
bytesRead = readStream.Read(buffer,0,Length);
}
readStream.Close();
writeStream.Close();
}
}
}

16
INSTALL
View File

@@ -22,7 +22,7 @@ WINDOWS:
* Cg Toolkit >= 2.2
(http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_October2009_Setup.exe)
To compile OpenRA, open the OpenRA.sln solution in the main folder,
To compile OpenRA, open the OpenRA.sln solution in the main folder,
or build it from the command-line with MSBuild.
Run the game with `OpenRA.Game.exe Game.Mods=ra` for Red Alert
@@ -37,11 +37,9 @@ UBUNTU (substitute comparable packages for other linux distros):
* libmono-winforms2.0-cil
* libopenal1
* libsdl1.2-dev
* nvidia-cg-toolkit (download the latest version from
http://developer.nvidia.com/object/cg_download.html)
* nvidia-cg-toolkit (for Cg renderer)
OpenRA is incompatible with Compiz, please disable desktop effects when trying
to run OpenRA or the game will crash.
OpenRA does not work with some older versions of Compiz. On affected systems, disable desktop effects before playing. This is fixed in Ubuntu Natty and later.
You will additionally need to copy the third party dependencies (.dll and .config) from the
thirdparty and thirdparty/Tao directories into the game root:
@@ -62,3 +60,11 @@ other applications that use Tao:
To compile OpenRA, run `make' from the command line.
Run the game with `mono OpenRA.Game.exe Game.Mods=ra` for Red Alert
or `mono OpenRA.Game.exe Game.Mods=cnc` for Command & Conquer
SLACKWARE:
The following packages from slackbuilds.org are required, on 13.37 32bit:
* libgdiplus
* mono
* openAL
* nvidia-cg-toolkit (for Cg renderer)

111
Makefile
View File

@@ -6,26 +6,25 @@ PHONY = core tools package all mods clean distclean
.SUFFIXES:
core: game renderers mod_ra mod_cnc utility
tools: editor ralint seqed filex tsbuild
package: fixheader core editor
tools: editor ralint tsbuild
package: core editor
mods: mod_ra mod_cnc
all: core tools
clean:
@-rm *.exe *.dll *.mdb mods/**/*.dll mods/**/*.mdb *.resources
@-rm -f *.exe *.dll *.mdb mods/**/*.dll mods/**/*.mdb *.resources
distclean: clean
#
# Core binaries
#
fileformats_SRCS = $(shell find OpenRA.FileFormats/ -iname '*.cs')
fileformats_SRCS := $(shell find OpenRA.FileFormats/ -iname '*.cs')
fileformats_TARGET = OpenRA.FileFormats.dll
#fileformats_DEPS = fixheader
fileformats_KIND = library
fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Forms.dll
PROGRAMS = fileformats
fileformats: $(fileformats_TARGET)
game_SRCS = $(shell find OpenRA.Game/ -iname '*.cs')
game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
game_TARGET = OpenRA.Game.exe
game_KIND = winexe
game_DEPS = $(fileformats_TARGET)
@@ -38,72 +37,72 @@ game: $(game_TARGET)
#
# Renderer dlls
#
rcg_SRCS = $(shell find OpenRA.Renderer.Cg/ -iname '*.cs')
rsdl_SRCS := $(shell find OpenRA.Renderer.SdlCommon/ -iname '*.cs')
rsdl_TARGET = OpenRA.Renderer.SdlCommon.dll
rsdl_KIND = library
rsdl_DEPS = $(fileformats_TARGET) $(game_TARGET)
rsdl_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \
$(rsdl_DEPS)
rcg_SRCS := $(shell find OpenRA.Renderer.Cg/ -iname '*.cs')
rcg_TARGET = OpenRA.Renderer.Cg.dll
rcg_KIND = library
rcg_DEPS = $(fileformats_TARGET) $(game_TARGET)
rcg_DEPS = $(fileformats_TARGET) $(game_TARGET) $(rsdl_TARGET)
rcg_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \
$(rcg_DEPS) $(game_TARGET)
$(rcg_DEPS)
rgl_SRCS = $(shell find OpenRA.Renderer.Gl/ -iname '*.cs')
rgl_SRCS := $(shell find OpenRA.Renderer.Gl/ -iname '*.cs')
rgl_TARGET = OpenRA.Renderer.Gl.dll
rgl_KIND = library
rgl_DEPS = $(fileformats_TARGET) $(game_TARGET)
rgl_DEPS = $(fileformats_TARGET) $(game_TARGET) $(rsdl_TARGET)
rgl_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \
$(rgl_DEPS) $(game_TARGET)
$(rgl_DEPS)
rnull_SRCS = $(shell find OpenRA.Renderer.Null/ -iname '*.cs')
rnull_TARGET = OpenRA.Renderer.Null.dll
rnull_SRCS := $(shell find OpenRA.Renderer.Null/ -iname '*.cs')
rnull_TARGET = OpenRA.Renderer.Null.dll
rnull_KIND = library
rnull_DEPS = $(fileformats_TARGET) $(game_TARGET)
rnull_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
$(rnull_DEPS) $(game_TARGET)
PROGRAMS += rcg rgl rnull
renderers: $(rcg_TARGET) $(rgl_TARGET) $(rnull_TARGET)
$(rnull_DEPS)
PROGRAMS += rcg rgl rnull rsdl
renderers: $(rcg_TARGET) $(rgl_TARGET) $(rnull_TARGET) $(rsdl_TARGET)
#
# Official Mods
#
# Red Alert
mod_ra_SRCS = $(shell find OpenRA.Mods.RA/ -iname '*.cs')
mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll
STD_MOD_LIBS = $(fileformats_TARGET) $(game_TARGET)
STD_MOD_DEPS = $(STD_MOD_LIBS) $(ralint_TARGET)
mod_ra_SRCS := $(shell find OpenRA.Mods.RA/ -iname '*.cs')
mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll
mod_ra_KIND = library
mod_ra_DEPS = $(fileformats_TARGET) $(game_TARGET)
mod_ra_LIBS = $(COMMON_LIBS) $(mod_ra_DEPS)
mod_ra_DEPS = $(STD_MOD_DEPS)
mod_ra_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS)
mod_ra_EXTRA_CMDS = mono --debug RALint.exe ra
PROGRAMS += mod_ra
mod_ra: $(mod_ra_TARGET)
# mono RALint.exe ra
# Command and Conquer
mod_cnc_SRCS = $(shell find OpenRA.Mods.Cnc/ -iname '*.cs')
mod_cnc_SRCS := $(shell find OpenRA.Mods.Cnc/ -iname '*.cs')
mod_cnc_TARGET = mods/cnc/OpenRA.Mods.Cnc.dll
mod_cnc_KIND = library
mod_cnc_DEPS = $(fileformats_TARGET) $(game_TARGET) $(mod_ra_TARGET)
mod_cnc_LIBS = $(COMMON_LIBS) $(mod_cnc_DEPS)
PROGRAMS += mod_cnc
mod_cnc_DEPS = $(STD_MOD_DEPS) $(mod_ra_TARGET)
mod_cnc_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(mod_ra_TARGET)
mod_cnc_EXTRA_CMDS = mono --debug RALint.exe cnc
PROGRAMS += mod_cnc
mod_cnc: $(mod_cnc_TARGET)
# mono RALint.exe cnc
#
# Tools
#
# Sequence editor (defunct)
seqed_SRCS = $(shell find SequenceEditor/ -iname '*.cs')
seqed_TARGET = SequenceEditor.exe
seqed_KIND = winexe
seqed_DEPS = $(fileformats_TARGET)
seqed_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll $(seqed_DEPS)
seqed_EXTRA = -resource:SequenceEditor.Form1.resources
PROGRAMS += seqed
SequenceEditor.Form1.resources:
resgen2 SequenceEditor/Form1.resx SequenceEditor.Form1.resources 1> /dev/null
seqed: SequenceEditor.Form1.resources $(seqed_TARGET)
# Map Editor
editor_SRCS = $(shell find OpenRA.Editor/ -iname '*.cs')
editor_TARGET = OpenRA.Editor.exe
editor_SRCS := $(shell find OpenRA.Editor/ -iname '*.cs')
editor_TARGET = OpenRA.Editor.exe
editor_KIND = winexe
editor_DEPS = $(fileformats_TARGET) $(game_TARGET)
editor_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll System.Data.dll $(editor_DEPS)
@@ -118,25 +117,16 @@ OpenRA.Editor.Form1.resources:
editor: OpenRA.Editor.MapSelect.resources OpenRA.Editor.Form1.resources $(editor_TARGET)
# Analyses mod yaml for easy to detect errors
ralint_SRCS = $(shell find RALint/ -iname '*.cs')
ralint_TARGET = RALint.exe
ralint_SRCS := $(shell find RALint/ -iname '*.cs')
ralint_TARGET = RALint.exe
ralint_KIND = exe
ralint_DEPS = $(fileformats_TARGET) $(game_TARGET)
ralint_LIBS = $(COMMON_LIBS) $(ralint_DEPS)
PROGRAMS += ralint
ralint: $(ralint_TARGET)
# Extracts files from packages (mixfiles, zips, etc)
filex_SRCS = $(shell find FileExtractor/ -iname '*.cs')
filex_TARGET = FileExtractor.exe
filex_KIND = exe
filex_DEPS = $(fileformats_TARGET)
filex_LIBS = $(COMMON_LIBS) $(filex_DEPS)
PROGRAMS += filex
filex: $(filex_TARGET)
# Builds and exports tilesets from a bitmap
tsbuild_SRCS = $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')
tsbuild_SRCS := $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')
tsbuild_TARGET = TilesetBuilder.exe
tsbuild_KIND = winexe
tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -151,12 +141,12 @@ tsbuild: OpenRA.TilesetBuilder.Form1.resources $(tsbuild_TARGET)
# Launchers / Utilities
#
# Patches binary headers to work around a mono bug
fixheader: packaging/fixheader.cs
fixheader.exe: packaging/fixheader.cs
@echo CSC fixheader.exe
@$(CSC) packaging/fixheader.cs $(CSFLAGS) -out:fixheader.exe -t:exe $(COMMON_LIBS:%=-r:%)
PHONY += fixheader
# Backend for the launcher apps - queries game/mod info and applies actions to an install
utility_SRCS = $(shell find OpenRA.Utility/ -iname '*.cs')
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
utility_TARGET = OpenRA.Utility.exe
utility_KIND = exe
utility_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -171,7 +161,7 @@ utility: $(utility_TARGET)
#
define BUILD_ASSEMBLY
$$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS)
$$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS) fixheader.exe
@echo CSC $$(@)
@$(CSC) $$($(1)_LIBS:%=-r:%) \
-out:$$(@) $(CSFLAGS) $$($(1)_FLAGS) \
@@ -179,8 +169,9 @@ $$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS)
-t:"$$($(1)_KIND)" \
$$($(1)_EXTRA) \
$$($(1)_SRCS)
@test -e fixheader.exe && mono fixheader.exe $$(@) || ``
@mono fixheader.exe $$(@) > /dev/null
@test `echo $$(@) | sed 's/^.*\.//'` = "dll" && chmod a-x $$(@) || ``
@$$($(1)_EXTRA_CMDS)
endef
$(foreach prog,$(PROGRAMS),$(eval $(call BUILD_ASSEMBLY,$(prog))))
@@ -197,7 +188,7 @@ BIN_INSTALL_DIR = $(DESTDIR)$(bindir)
INSTALL_DIR = $(DESTDIR)$(datadir)/openra
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
CORE = fileformats rcg rgl rnull game editor utility
CORE = fileformats rcg rgl rsdl rnull game editor utility
install: all
@-echo "Installing OpenRA to $(INSTALL_DIR)"
@@ -233,7 +224,7 @@ install: all
@echo "#!/bin/sh" > openra
@echo "cd "$(datadir)"/openra" >> openra
@echo "mono "$(datadir)"/openra/OpenRA.Game.exe SupportDir=~/.openra \"$$""@\"" >> openra
@echo "mono "$(datadir)"/openra/OpenRA.Game.exe \"$$""@\"" >> openra
@$(INSTALL_PROGRAM) -d $(BIN_INSTALL_DIR)
@$(INSTALL_PROGRAM) -m +rx openra $(BIN_INSTALL_DIR)

View File

@@ -1,16 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
namespace SequenceEditor
namespace OpenRA.Editor
{
partial class GetTextForm
partial class ActorPropertiesDialog
{
/// <summary>
/// Required designer variable.
@@ -38,67 +28,65 @@ namespace SequenceEditor
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(13, 13);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(337, 20);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(194, 50);
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(226, 333);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "OK";
this.button1.TabIndex = 0;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(275, 50);
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(145, 333);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Cancel";
this.button2.TabIndex = 0;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
// GetTextForm
// flowLayoutPanel1
//
this.AcceptButton = this.button1;
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.flowLayoutPanel1.Location = new System.Drawing.Point(13, 13);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(288, 314);
this.flowLayoutPanel1.TabIndex = 1;
//
// ActorPropertiesDialog
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(362, 85);
this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(313, 368);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GetTextForm";
this.Name = "ActorPropertiesDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Placeholder";
this.Text = "Actor Properties";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@@ -0,0 +1,49 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Drawing;
using System.Windows.Forms;
using OpenRA.FileFormats;
namespace OpenRA.Editor
{
public partial class ActorPropertiesDialog : Form
{
public ActorPropertiesDialog()
{
InitializeComponent();
}
public void AddRow(string name, Control c)
{
flowLayoutPanel1.Controls.Add(new Label
{
Text = name,
Width = flowLayoutPanel1.Width * 3 / 10,
Height = 25,
TextAlign = ContentAlignment.MiddleLeft,
});
c.Width = flowLayoutPanel1.Width * 6 / 10 - 25;
c.Height = 25;
flowLayoutPanel1.Controls.Add(c);
}
public Control MakeEditorControl(Type t, Func<object> getter, Action<object> setter)
{
var r = new TextBox();
r.Text = FieldSaver.FormatValue(getter(), t);
r.LostFocus += (e,_) => setter(FieldLoader.GetValue("<editor internals>", t, r.Text));
r.Enabled = false;
return r;
}
}
}

View File

@@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -22,10 +22,8 @@ namespace OpenRA.Editor
public void Preview(Surface surface, SGraphics g)
{
/* todo: include the player
* in the brush so we can color new buildings too */
surface.DrawActor(g, surface.GetBrushLocation(), Actor, null);
surface.DrawActor(g, surface.GetBrushLocation(), Actor,
surface.GetPaletteForPlayer(surface.NewActorOwner));
}
public void Apply(Surface surface)
@@ -33,7 +31,7 @@ namespace OpenRA.Editor
if (surface.Map.Actors.Value.Any(a => a.Value.Location() == surface.GetBrushLocation()))
return;
var owner = "Neutral";
var owner = surface.NewActorOwner;
var id = NextActorName(surface);
surface.Map.Actors.Value[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant())
{

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -26,8 +26,8 @@ namespace OpenRA.Editor
public void Apply(Surface surface)
{
// change the bits in the map
var tile = surface.TileSet.Tiles[Brush.N];
var template = surface.TileSet.Templates[Brush.N];
var tile = template.Data;
var pos = surface.GetBrushLocation();
if (surface.GetModifiers() == Keys.Shift)

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -42,9 +42,9 @@ namespace OpenRA.Editor
this.listBox1 = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
//
// label1
//
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Location = new System.Drawing.Point(10, 9);
@@ -52,9 +52,9 @@ namespace OpenRA.Editor
this.label1.Size = new System.Drawing.Size(610, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Your map import completed, but with errors:";
//
//
// listBox1
//
//
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -63,9 +63,9 @@ namespace OpenRA.Editor
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(607, 316);
this.listBox1.TabIndex = 1;
//
//
// button1
//
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(545, 359);
@@ -74,9 +74,9 @@ namespace OpenRA.Editor
this.button1.TabIndex = 2;
this.button1.Text = "Close";
this.button1.UseVisualStyleBackColor = true;
//
//
// ErrorListDialog
//
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(632, 394);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -47,12 +47,13 @@ namespace OpenRA.Editor
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tilePalette = new System.Windows.Forms.FlowLayoutPanel();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.actorPalette = new System.Windows.Forms.FlowLayoutPanel();
this.actorOwnerChooser = new System.Windows.Forms.ComboBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel();
this.surface1 = new OpenRA.Editor.Surface();
this.tt = new System.Windows.Forms.ToolTip(this.components);
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -73,12 +74,14 @@ namespace OpenRA.Editor
this.propertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showActorNamesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fixOpenAreasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setupDefaultPlayersMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel();
this.fixOpenAreasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -89,6 +92,7 @@ namespace OpenRA.Editor
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
@@ -182,7 +186,8 @@ namespace OpenRA.Editor
//
// tabPage2
//
this.tabPage2.Controls.Add(this.actorPalette);
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Controls.Add(this.actorOwnerChooser);
this.tabPage2.Location = new System.Drawing.Point(4, 20);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
@@ -191,15 +196,37 @@ namespace OpenRA.Editor
this.tabPage2.Text = "Actors";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.actorPalette);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 24);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(184, 525);
this.panel1.TabIndex = 4;
//
// actorPalette
//
this.actorPalette.AutoScroll = true;
this.actorPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.actorPalette.Dock = System.Windows.Forms.DockStyle.Fill;
this.actorPalette.Location = new System.Drawing.Point(3, 3);
this.actorPalette.Location = new System.Drawing.Point(0, 0);
this.actorPalette.Name = "actorPalette";
this.actorPalette.Size = new System.Drawing.Size(184, 546);
this.actorPalette.TabIndex = 2;
this.actorPalette.Size = new System.Drawing.Size(184, 525);
this.actorPalette.TabIndex = 3;
//
// actorOwnerChooser
//
this.actorOwnerChooser.Dock = System.Windows.Forms.DockStyle.Top;
this.actorOwnerChooser.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.actorOwnerChooser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.actorOwnerChooser.FormattingEnabled = true;
this.actorOwnerChooser.Location = new System.Drawing.Point(3, 3);
this.actorOwnerChooser.Name = "actorOwnerChooser";
this.actorOwnerChooser.Size = new System.Drawing.Size(184, 21);
this.actorOwnerChooser.TabIndex = 3;
this.actorOwnerChooser.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.onDrawPlayerItem);
this.actorOwnerChooser.SelectionChangeCommitted += new System.EventHandler(this.onSelectOwner);
//
// tabPage3
//
@@ -235,12 +262,6 @@ namespace OpenRA.Editor
//
this.tt.ShowAlways = true;
//
// saveFileDialog
//
this.saveFileDialog.DefaultExt = "*.png";
this.saveFileDialog.Filter = "PNG Image (*.png)|";
this.saveFileDialog.Title = "Export minimap to PNG";
//
// splitContainer3
//
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -395,7 +416,9 @@ namespace OpenRA.Editor
this.propertiesToolStripMenuItem,
this.resizeToolStripMenuItem,
this.showActorNamesToolStripMenuItem,
this.fixOpenAreasToolStripMenuItem});
this.showGridToolStripMenuItem,
this.fixOpenAreasToolStripMenuItem,
this.setupDefaultPlayersMenuItem});
this.mapToolStripMenuItem.Name = "mapToolStripMenuItem";
this.mapToolStripMenuItem.Size = new System.Drawing.Size(43, 23);
this.mapToolStripMenuItem.Text = "&Map";
@@ -405,7 +428,7 @@ namespace OpenRA.Editor
this.propertiesToolStripMenuItem.Enabled = false;
this.propertiesToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("propertiesToolStripMenuItem.Image")));
this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem";
this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.propertiesToolStripMenuItem.Text = "&Properties...";
this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.PropertiesClicked);
//
@@ -414,17 +437,38 @@ namespace OpenRA.Editor
this.resizeToolStripMenuItem.Enabled = false;
this.resizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("resizeToolStripMenuItem.Image")));
this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem";
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.resizeToolStripMenuItem.Text = "&Resize...";
this.resizeToolStripMenuItem.Click += new System.EventHandler(this.ResizeClicked);
//
// showActorNamesToolStripMenuItem
//
this.showActorNamesToolStripMenuItem.Name = "showActorNamesToolStripMenuItem";
this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.showActorNamesToolStripMenuItem.Text = "Show Actor &Names";
this.showActorNamesToolStripMenuItem.Click += new System.EventHandler(this.ShowActorNamesClicked);
//
// showGridToolStripMenuItem
//
this.showGridToolStripMenuItem.Name = "showGridToolStripMenuItem";
this.showGridToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.showGridToolStripMenuItem.Text = "Show &Grid";
this.showGridToolStripMenuItem.Click += new System.EventHandler(this.ShowGridClicked);
//
// fixOpenAreasToolStripMenuItem
//
this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem";
this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas";
this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas);
//
// setupDefaultPlayersMenuItem
//
this.setupDefaultPlayersMenuItem.Name = "setupDefaultPlayersMenuItem";
this.setupDefaultPlayersMenuItem.Size = new System.Drawing.Size(185, 22);
this.setupDefaultPlayersMenuItem.Text = "&Setup Default Players";
this.setupDefaultPlayersMenuItem.Click += new System.EventHandler(this.SetupDefaultPlayers);
//
// toolStripComboBox1
//
this.toolStripComboBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
@@ -463,13 +507,6 @@ namespace OpenRA.Editor
this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17);
this.toolStripStatusLabelMousePosition.Text = "0,0";
//
// fixOpenAreasToolStripMenuItem
//
this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem";
this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas";
this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -496,6 +533,7 @@ namespace OpenRA.Editor
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel1.PerformLayout();
@@ -518,13 +556,11 @@ namespace OpenRA.Editor
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.FlowLayoutPanel tilePalette;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.FlowLayoutPanel actorPalette;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.FlowLayoutPanel resourcePalette;
private System.Windows.Forms.FlowLayoutPanel resourcePalette;
private Surface surface1;
private System.Windows.Forms.PictureBox pmMiniMap;
private System.Windows.Forms.PictureBox pmMiniMap;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelMousePosition;
@@ -550,7 +586,12 @@ namespace OpenRA.Editor
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripComboBox toolStripComboBox1;
private System.Windows.Forms.ToolStripMenuItem showActorNamesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showGridToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fixOpenAreasToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem setupDefaultPlayersMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.FlowLayoutPanel actorPalette;
private System.Windows.Forms.ComboBox actorOwnerChooser;
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -10,6 +10,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
@@ -29,8 +30,8 @@ namespace OpenRA.Editor
currentMod = args.FirstOrDefault() ?? "ra";
toolStripComboBox1.Items.AddRange(Mod.AllMods.Keys.ToArray());
toolStripComboBox1.SelectedIndexChanged += (_, e) =>
toolStripComboBox1.SelectedIndexChanged += (_, e) =>
{
tilePalette.SuspendLayout();
actorPalette.SuspendLayout();
@@ -44,19 +45,20 @@ namespace OpenRA.Editor
surface1.Bind(null, null, null);
pmMiniMap.Image = null;
currentMod = toolStripComboBox1.SelectedItem as string;
Text = "OpenRA Editor (mod:{0})".F(currentMod);
Game.modData = new ModData(currentMod);
FileSystem.LoadFromManifest(Game.modData.Manifest);
Rules.LoadRules(Game.modData.Manifest, new Map());
loadedMapName = null;
};
toolStripComboBox1.SelectedItem = currentMod;
surface1.AfterChange += OnMapChanged;
surface1.MousePositionChanged += s => toolStripStatusLabelMousePosition.Text = s;
surface1.ActorDoubleClicked += ActorDoubleClicked;
if (args.Length >= 2)
LoadMap(args[1]);
}
@@ -67,7 +69,31 @@ namespace OpenRA.Editor
pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true));
}
void ActorDoubleClicked(KeyValuePair<string,ActorReference> kv)
{
using( var apd = new ActorPropertiesDialog() )
{
var name = kv.Key;
apd.AddRow("(Name)", apd.MakeEditorControl(typeof(string), () => name, v => name = (string)v));
apd.AddRow("(Type)", apd.MakeEditorControl(typeof(string), () => kv.Value.Type, v => kv.Value.Type = (string)v));
var objSaved = kv.Value.Save();
// TODO: make this work properly
foreach( var init in Rules.Info[kv.Value.Type].GetInitKeys() )
apd.AddRow(init.First,
apd.MakeEditorControl(init.Second,
() => objSaved.NodesDict.ContainsKey( init.First ) ? objSaved.NodesDict[init.First].Value : null,
_ => {}));
apd.ShowDialog();
// TODO: writeback
}
}
void MakeDirty() { dirty = true; }
string loadedMapName;
string currentMod = "ra";
TileSet tileset;
@@ -114,7 +140,6 @@ namespace OpenRA.Editor
tileset.LoadTiles();
var palette = new Palette(FileSystem.Open(tileset.Palette), true);
surface1.Bind(map, tileset, palette);
// construct the palette of tiles
var palettes = new[] { tilePalette, actorPalette, resourcePalette };
@@ -123,7 +148,7 @@ namespace OpenRA.Editor
{
try
{
var bitmap = RenderUtils.RenderTemplate(tileset, (ushort)t.Key, palette);
var bitmap = tileset.RenderTemplate((ushort)t.Key, palette);
var ibox = new PictureBox
{
Image = bitmap,
@@ -155,6 +180,13 @@ namespace OpenRA.Editor
{
var info = Rules.Info[a];
if (!info.Traits.Contains<RenderSimpleInfo>()) continue;
var etf = info.Traits.GetOrDefault<EditorTilesetFilterInfo>();
if (etf != null && etf.ExcludeTilesets != null
&& etf.ExcludeTilesets.Contains(tileset.Id)) continue;
if (etf != null && etf.RequireTilesets != null
&& !etf.RequireTilesets.Contains(tileset.Id)) continue;
var template = RenderUtils.RenderActor(info, tileset, palette);
var ibox = new PictureBox
{
@@ -165,7 +197,6 @@ namespace OpenRA.Editor
BorderStyle = BorderStyle.FixedSingle
};
ibox.Click += (_, e) => surface1.SetTool(new ActorTool(template));
actorPalette.Controls.Add(ibox);
@@ -228,6 +259,16 @@ namespace OpenRA.Editor
saveToolStripMenuItem.Enabled = true;
saveAsToolStripMenuItem.Enabled = true;
mnuMinimapToPNG.Enabled = true; // todo: what is this VB naming bullshit doing here?
PopulateActorOwnerChooser();
}
void PopulateActorOwnerChooser()
{
actorOwnerChooser.Items.Clear();
actorOwnerChooser.Items.AddRange(surface1.Map.Players.Values.ToArray());
actorOwnerChooser.SelectedIndex = 0;
surface1.NewActorOwner = (actorOwnerChooser.SelectedItem as PlayerReference).Name;
}
void ResizeClicked(object sender, EventArgs e)
@@ -359,7 +400,7 @@ namespace OpenRA.Editor
void ImportLegacyMapClicked(object sender, EventArgs e)
{
using (var ofd = new OpenFileDialog { RestoreDirectory = true,
using (var ofd = new OpenFileDialog { RestoreDirectory = true,
Filter = "Legacy maps (*.ini;*.mpr)|*.ini;*.mpr" })
if (DialogResult.OK == ofd.ShowDialog())
{
@@ -378,7 +419,7 @@ namespace OpenRA.Editor
eld.ShowDialog();
map.MakeDefaultPlayers();
map.Save(savePath);
LoadMap(savePath);
loadedMapName = null; /* editor needs to think this hasnt been saved */
@@ -403,11 +444,15 @@ namespace OpenRA.Editor
void ExportMinimap(object sender, EventArgs e)
{
saveFileDialog.InitialDirectory = Path.Combine(Environment.CurrentDirectory, "maps");
saveFileDialog.FileName = Path.ChangeExtension(loadedMapName, ".png");
if (DialogResult.OK == saveFileDialog.ShowDialog())
pmMiniMap.Image.Save(saveFileDialog.FileName);
using( var sfd = new SaveFileDialog() {
InitialDirectory = Path.Combine(Environment.CurrentDirectory, "maps"),
DefaultExt = "*.png",
Filter = "PNG Image (*.png)|*.png",
Title = "Export Minimap to PNG",
FileName = Path.ChangeExtension(loadedMapName, ".png"),
RestoreDirectory = true } )
if (DialogResult.OK == sfd.ShowDialog())
pmMiniMap.Image.Save(sfd.FileName);
}
void ShowActorNamesClicked(object sender, EventArgs e)
@@ -416,6 +461,13 @@ namespace OpenRA.Editor
surface1.ShowActorNames = showActorNamesToolStripMenuItem.Checked;
}
void ShowGridClicked(object sender, EventArgs e)
{
showGridToolStripMenuItem.Checked ^= true;
surface1.ShowGrid = showGridToolStripMenuItem.Checked;
surface1.Chunks.Clear();
}
void FixOpenAreas(object sender, EventArgs e)
{
dirty = true;
@@ -426,8 +478,8 @@ namespace OpenRA.Editor
{
var tr = surface1.Map.MapTiles.Value[i, j];
if (tr.type == 0xff || tr.type == 0xffff || tr.type == 1 || tr.type == 2)
tr.index = (byte)r.Next(0,
Rules.TileSets[surface1.Map.Tileset].Tiles[tr.type].TileBitmapBytes.Count);
tr.index = (byte)r.Next(0,
Rules.TileSets[surface1.Map.Tileset].Templates[tr.type].Data.TileBitmapBytes.Count);
surface1.Map.MapTiles.Value[i, j] = tr;
}
@@ -435,5 +487,40 @@ namespace OpenRA.Editor
surface1.Chunks.Clear();
surface1.Invalidate();
}
void SetupDefaultPlayers(object sender, EventArgs e)
{
dirty = true;
surface1.Map.MakeDefaultPlayers();
surface1.Chunks.Clear();
surface1.Invalidate();
PopulateActorOwnerChooser();
}
void onDrawPlayerItem(object sender, DrawItemEventArgs e)
{
// color block
var player = e.Index >= 0 ? (PlayerReference)(sender as ComboBox).Items[e.Index] : null;
e.DrawBackground();
e.DrawFocusRectangle();
if (player == null)
return;
var color = player.ColorRamp.GetColor(0);
using( var brush = new SolidBrush(color) )
e.Graphics.FillRectangle( brush, e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Height + 6, e.Bounds.Height - 4 );
using( var foreBrush = new SolidBrush(e.ForeColor) )
e.Graphics.DrawString( player.Name, e.Font, foreBrush, e.Bounds.Left + e.Bounds.Height + 12, e.Bounds.Top );
}
void onSelectOwner(object sender, EventArgs e)
{
var player = actorOwnerChooser.SelectedItem as PlayerReference;
surface1.NewActorOwner = player.Name;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -39,12 +39,12 @@ namespace OpenRA.Editor
{ "gold02", new Pair<byte,byte>(1,1) },
{ "gold03", new Pair<byte,byte>(1,2) },
{ "gold04", new Pair<byte,byte>(1,3) },
{ "gem01", new Pair<byte,byte>(2,0) },
{ "gem02", new Pair<byte,byte>(2,1) },
{ "gem03", new Pair<byte,byte>(2,2) },
{ "gem04", new Pair<byte,byte>(2,3) },
// cnc tiberium
{ "ti1", new Pair<byte,byte>(1,0) },
{ "ti2", new Pair<byte,byte>(1,1) },
@@ -67,7 +67,7 @@ namespace OpenRA.Editor
{"brik","brik"},
{"fenc","fenc"},
{"wood","wood"},
// Fields
{"v12","v12"},
{"v13","v13"},
@@ -76,12 +76,12 @@ namespace OpenRA.Editor
{"v16","v16"},
{"v17","v17"},
{"v18","v18"},
// Crates
// {"wcrate","crate"},
// {"scrate","crate"},
};
// todo: fix this -- will have bitrotted pretty badly.
static Dictionary<string,Pair<Color,Color>> namedColorMapping = new Dictionary<string, Pair<Color, Color>>()
{
@@ -96,13 +96,13 @@ namespace OpenRA.Editor
{"white",Pair.New(Color.FromArgb(255,255,255),Color.FromArgb(75,75,75))},
{"black",Pair.New(Color.FromArgb(80,80,80),Color.FromArgb(5,5,5))},
};
int MapSize;
int ActorCount = 0;
Map Map = new Map();
List<string> Players = new List<string>();
Action<string> errorHandler;
LegacyMapImporter(string filename, Action<string> errorHandler)
{
this.errorHandler = errorHandler;
@@ -116,10 +116,10 @@ namespace OpenRA.Editor
}
enum IniMapFormat { RedAlert = 3, /* otherwise, cnc (2 variants exist, we don't care to differentiate) */ };
public void ConvertIniMap(string iniFile)
{
var file = new IniFile(FileSystem.Open(iniFile));
var basic = file.GetSection("Basic");
var map = file.GetSection("Map");
@@ -137,12 +137,12 @@ namespace OpenRA.Editor
Map.MapSize.Y = MapSize;
Map.Bounds = Rectangle.FromLTRB(XOffset, YOffset, XOffset + Width, YOffset + Height);
Map.Selectable = true;
Map.Smudges = Lazy.New(() => new List<SmudgeReference>());
Map.Actors = Lazy.New(() => new Dictionary<string, ActorReference>());
Map.MapResources = Lazy.New(() => new TileReference<byte, byte>[MapSize, MapSize]);
Map.MapTiles = Lazy.New(() => new TileReference<ushort, byte>[MapSize, MapSize]);
if (legacyMapFormat == IniMapFormat.RedAlert)
{
UnpackRATileData(ReadPackedSection(file.GetSection("MapPack")));
@@ -155,30 +155,31 @@ namespace OpenRA.Editor
ReadCncOverlay(file);
ReadCncTrees(file);
}
LoadActors(file, "STRUCTURES");
LoadActors(file, "UNITS");
LoadActors(file, "INFANTRY");
LoadSmudges(file, "SMUDGE");
foreach (var p in Players)
LoadPlayer(file, p, (legacyMapFormat == IniMapFormat.RedAlert));
var wps = file.GetSection("Waypoints")
.Where(kv => int.Parse(kv.Value) > 0)
.Select(kv => Pair.New(int.Parse(kv.Key),
LocationFromMapOffset(int.Parse(kv.Value), MapSize)))
.ToArray();
// Add waypoint actors
foreach( var kv in wps )
{
var a = new ActorReference("mpspawn");
a.Add(new LocationInit(kv.Second));
a.Add(new OwnerInit("Neutral"));
Map.Actors.Value.Add("spawn" + kv.First, a);
}
}
static int2 LocationFromMapOffset(int offset, int mapSize)
@@ -242,7 +243,7 @@ namespace OpenRA.Editor
return ret;
}
void UnpackRATileData(MemoryStream ms)
{
for (int i = 0; i < MapSize; i++)
@@ -273,10 +274,10 @@ namespace OpenRA.Editor
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
Map.Actors.Value.Add("Actor" + ActorCount++,
new ActorReference(overlayActorMapping[raOverlayNames[o]])
{
new ActorReference(overlayActorMapping[raOverlayNames[o]])
{
new LocationInit( new int2(i, j) ),
new OwnerInit( "Neutral" )
new OwnerInit( "Neutral" )
});
}
}
@@ -290,7 +291,7 @@ namespace OpenRA.Editor
foreach (KeyValuePair<string, string> kv in terrain)
{
var loc = int.Parse(kv.Key);
Map.Actors.Value.Add("Actor" + ActorCount++,
Map.Actors.Value.Add("Actor" + ActorCount++,
new ActorReference(kv.Value.ToLowerInvariant())
{
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
@@ -312,7 +313,7 @@ namespace OpenRA.Editor
Map.MapTiles.Value[i, j].index = ReadByte(ms);
}
}
void ReadCncOverlay(IniFile file)
{
IniSection overlay = file.GetSection("OVERLAY", true);
@@ -331,7 +332,7 @@ namespace OpenRA.Editor
Map.MapResources.Value[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
Map.Actors.Value.Add("Actor" + ActorCount++,
Map.Actors.Value.Add("Actor" + ActorCount++,
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
{
new LocationInit(cell),
@@ -339,7 +340,7 @@ namespace OpenRA.Editor
});
}
}
void ReadCncTrees(IniFile file)
{
IniSection terrain = file.GetSection("TERRAIN", true);
@@ -378,38 +379,12 @@ namespace OpenRA.Editor
if (!Players.Contains(parts[0]))
Players.Add(parts[0]);
var stance = ActorStance.Stance.None;
switch (parts[5])
{
case "Area Guard":
case "Guard":
stance = ActorStance.Stance.Guard;
break;
case "Defend Base":
stance = ActorStance.Stance.Defend;
break;
case "Hunt":
case "Rampage":
case "Attack Base":
case "Attack Units":
case "Attack Civil.":
case "Attack Tarcom":
stance = ActorStance.Stance.Hunt;
break;
case "Retreat":
case "Return":
stance = ActorStance.Stance.Retreat;
break;
// do we care about `Harvest' and `Sticky'?
}
var actor = new ActorReference(parts[1].ToLowerInvariant())
{
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
new OwnerInit(parts[0]),
new HealthInit(float.Parse(parts[2], NumberFormatInfo.InvariantInfo)/256),
new FacingInit((section == "INFANTRY") ? int.Parse(parts[6]) : int.Parse(parts[4])),
new ActorStanceInit(stance),
};
if (section == "INFANTRY")
@@ -426,7 +401,7 @@ namespace OpenRA.Editor
}
}
}
void LoadSmudges(IniFile file, string section)
{
foreach (var s in file.GetSection(section, true))
@@ -437,28 +412,28 @@ namespace OpenRA.Editor
Map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), int.Parse(parts[2])));
}
}
void LoadPlayer(IniFile file, string section, bool isRA)
{
var c = (section == "BadGuy") ? "red" :
(isRA) ? "blue" : "gold";
{
var c = section == "BadGuy" ? "red" :
isRA ? "blue" : "gold";
var color = namedColorMapping[c];
var pr = new PlayerReference
{
Name = section,
OwnsWorld = (section == "Neutral"),
NonCombatant = (section == "Neutral"),
Race = (isRA) ? ((section == "BadGuy") ? "soviet" : "allies") : ((section == "BadGuy") ? "nod" : "gdi"),
OwnsWorld = section == "Neutral",
NonCombatant = section == "Neutral",
Race = isRA ? (section == "BadGuy" ? "soviet" : "allies") : (section == "BadGuy" ? "nod" : "gdi"),
ColorRamp = new ColorRamp(
(byte)((color.First.GetHue() / 360.0f) * 255),
(byte)(color.First.GetSaturation() * 255),
(byte)(color.First.GetBrightness() * 255),
(byte)(color.Second.GetBrightness() * 255))
(byte)((color.First.GetHue() / 360.0f) * 255),
(byte)(color.First.GetSaturation() * 255),
(byte)(color.First.GetBrightness() * 255),
(byte)(color.Second.GetBrightness() * 255))
};
var Neutral = new List<string>(){"Neutral"};
var Neutral = new [] {"Neutral"};
foreach (var s in file.GetSection(section, true))
{
Console.WriteLine(s.Key);
@@ -473,7 +448,7 @@ namespace OpenRA.Editor
break;
}
}
Map.Players.Add(section, pr);
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -10,33 +10,33 @@
namespace OpenRA.Editor
{
partial class MapSelect
{
/// <summary>
/// TODO
/// </summary>
private System.ComponentModel.IContainer components = null;
partial class MapSelect
{
/// <summary>
/// TODO
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// TODO
/// </summary>
/// <param name="disposing">TODO</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// TODO
/// </summary>
/// <param name="disposing">TODO</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// TODO
/// </summary>
private void InitializeComponent()
{
/// <summary>
/// TODO
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapSelect));
this.MapList = new System.Windows.Forms.ListView();
@@ -70,12 +70,12 @@ namespace OpenRA.Editor
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
//
// MapList
//
//
this.MapList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.MapList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colMapName});
this.colMapName});
this.MapList.FullRowSelect = true;
this.MapList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.MapList.LargeImageList = this.MapIconsList;
@@ -89,20 +89,20 @@ namespace OpenRA.Editor
this.MapList.UseCompatibleStateImageBehavior = false;
this.MapList.View = System.Windows.Forms.View.Details;
this.MapList.SelectedIndexChanged += new System.EventHandler(this.MapList_SelectedIndexChanged);
//
//
// colMapName
//
//
this.colMapName.Text = "Map name";
this.colMapName.Width = 240;
//
//
// MapIconsList
//
//
this.MapIconsList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
this.MapIconsList.ImageSize = new System.Drawing.Size(24, 24);
this.MapIconsList.TransparentColor = System.Drawing.Color.Transparent;
//
//
// btnCancel
//
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(407, 35);
this.btnCancel.Name = "btnCancel";
@@ -110,9 +110,9 @@ namespace OpenRA.Editor
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
//
// btnOk
//
//
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(326, 35);
this.btnOk.Name = "btnOk";
@@ -120,9 +120,9 @@ namespace OpenRA.Editor
this.btnOk.TabIndex = 2;
this.btnOk.Text = "Open";
this.btnOk.UseVisualStyleBackColor = true;
//
//
// lblNew
//
//
this.lblNew.AutoSize = true;
this.lblNew.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblNew.Location = new System.Drawing.Point(12, 40);
@@ -130,18 +130,18 @@ namespace OpenRA.Editor
this.lblNew.Size = new System.Drawing.Size(69, 13);
this.lblNew.TabIndex = 3;
this.lblNew.Text = "Map name:";
//
//
// txtNew
//
//
this.txtNew.BackColor = System.Drawing.SystemColors.Window;
this.txtNew.Location = new System.Drawing.Point(88, 37);
this.txtNew.Name = "txtNew";
this.txtNew.ReadOnly = true;
this.txtNew.Size = new System.Drawing.Size(232, 20);
this.txtNew.TabIndex = 1;
//
//
// pbMinimap
//
//
this.pbMinimap.BackColor = System.Drawing.Color.Black;
this.pbMinimap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pbMinimap.Location = new System.Drawing.Point(32, 25);
@@ -150,9 +150,9 @@ namespace OpenRA.Editor
this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbMinimap.TabIndex = 5;
this.pbMinimap.TabStop = false;
//
//
// pnlBottom
//
//
this.pnlBottom.Controls.Add(this.pictureBox1);
this.pnlBottom.Controls.Add(this.txtPathOut);
this.pnlBottom.Controls.Add(this.lblPathOut);
@@ -167,9 +167,9 @@ namespace OpenRA.Editor
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(494, 70);
this.pnlBottom.TabIndex = 6;
//
//
// txtPathOut
//
//
this.txtPathOut.BackColor = System.Drawing.SystemColors.Window;
this.txtPathOut.Location = new System.Drawing.Point(55, 10);
this.txtPathOut.Name = "txtPathOut";
@@ -177,17 +177,17 @@ namespace OpenRA.Editor
this.txtPathOut.Size = new System.Drawing.Size(265, 20);
this.txtPathOut.TabIndex = 0;
this.txtPathOut.TextChanged += new System.EventHandler(this.txtPathOut_TextChanged);
//
//
// lblPathOut
//
//
this.lblPathOut.AutoSize = true;
this.lblPathOut.Location = new System.Drawing.Point(55, 13);
this.lblPathOut.Name = "lblPathOut";
this.lblPathOut.Size = new System.Drawing.Size(0, 13);
this.lblPathOut.TabIndex = 6;
//
//
// lblPath
//
//
this.lblPath.AutoSize = true;
this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblPath.Location = new System.Drawing.Point(12, 13);
@@ -195,20 +195,20 @@ namespace OpenRA.Editor
this.lblPath.Size = new System.Drawing.Size(37, 13);
this.lblPath.TabIndex = 5;
this.lblPath.Text = "Path:";
//
//
// splitContainer1
//
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
//
// splitContainer1.Panel1
//
//
this.splitContainer1.Panel1.Controls.Add(this.lblMapList);
this.splitContainer1.Panel1.Controls.Add(this.MapList);
//
//
// splitContainer1.Panel2
//
//
this.splitContainer1.Panel2.Controls.Add(this.txtDesc);
this.splitContainer1.Panel2.Controls.Add(this.lblDesc);
this.splitContainer1.Panel2.Controls.Add(this.txtTheater);
@@ -222,90 +222,90 @@ namespace OpenRA.Editor
this.splitContainer1.Size = new System.Drawing.Size(494, 332);
this.splitContainer1.SplitterDistance = 300;
this.splitContainer1.TabIndex = 7;
//
//
// lblMapList
//
//
this.lblMapList.AutoSize = true;
this.lblMapList.Location = new System.Drawing.Point(12, 9);
this.lblMapList.Name = "lblMapList";
this.lblMapList.Size = new System.Drawing.Size(81, 13);
this.lblMapList.TabIndex = 1;
this.lblMapList.Text = "Available maps:";
//
//
// txtDesc
//
//
this.txtDesc.BackColor = System.Drawing.SystemColors.ButtonFace;
this.txtDesc.Location = new System.Drawing.Point(16, 289);
this.txtDesc.Name = "txtDesc";
this.txtDesc.ReadOnly = true;
this.txtDesc.Size = new System.Drawing.Size(162, 20);
this.txtDesc.TabIndex = 14;
//
//
// lblDesc
//
//
this.lblDesc.AutoSize = true;
this.lblDesc.Location = new System.Drawing.Point(13, 273);
this.lblDesc.Name = "lblDesc";
this.lblDesc.Size = new System.Drawing.Size(63, 13);
this.lblDesc.TabIndex = 13;
this.lblDesc.Text = "Description:";
//
//
// txtTheater
//
//
this.txtTheater.BackColor = System.Drawing.SystemColors.ButtonFace;
this.txtTheater.Location = new System.Drawing.Point(16, 252);
this.txtTheater.Name = "txtTheater";
this.txtTheater.ReadOnly = true;
this.txtTheater.Size = new System.Drawing.Size(162, 20);
this.txtTheater.TabIndex = 12;
//
//
// lblTheater
//
//
this.lblTheater.AutoSize = true;
this.lblTheater.Location = new System.Drawing.Point(13, 236);
this.lblTheater.Name = "lblTheater";
this.lblTheater.Size = new System.Drawing.Size(47, 13);
this.lblTheater.TabIndex = 11;
this.lblTheater.Text = "Tileset:";
//
//
// txtAuthor
//
//
this.txtAuthor.BackColor = System.Drawing.SystemColors.ButtonFace;
this.txtAuthor.Location = new System.Drawing.Point(16, 214);
this.txtAuthor.Name = "txtAuthor";
this.txtAuthor.ReadOnly = true;
this.txtAuthor.Size = new System.Drawing.Size(162, 20);
this.txtAuthor.TabIndex = 10;
//
//
// lblAuthor
//
//
this.lblAuthor.AutoSize = true;
this.lblAuthor.Location = new System.Drawing.Point(13, 198);
this.lblAuthor.Name = "lblAuthor";
this.lblAuthor.Size = new System.Drawing.Size(41, 13);
this.lblAuthor.TabIndex = 9;
this.lblAuthor.Text = "Author:";
//
//
// txtTitle
//
//
this.txtTitle.BackColor = System.Drawing.SystemColors.ButtonFace;
this.txtTitle.Location = new System.Drawing.Point(16, 177);
this.txtTitle.Name = "txtTitle";
this.txtTitle.ReadOnly = true;
this.txtTitle.Size = new System.Drawing.Size(162, 20);
this.txtTitle.TabIndex = 8;
//
//
// lblMapName
//
//
this.lblMapName.AutoSize = true;
this.lblMapName.Location = new System.Drawing.Point(13, 161);
this.lblMapName.Name = "lblMapName";
this.lblMapName.Size = new System.Drawing.Size(30, 13);
this.lblMapName.TabIndex = 7;
this.lblMapName.Text = "Title:";
//
//
// lblMinimap
//
//
this.lblMinimap.AutoSize = true;
this.lblMinimap.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblMinimap.Location = new System.Drawing.Point(29, 9);
@@ -313,9 +313,9 @@ namespace OpenRA.Editor
this.lblMinimap.Size = new System.Drawing.Size(71, 13);
this.lblMinimap.TabIndex = 6;
this.lblMinimap.Text = "Map preview:";
//
//
// pictureBox1
//
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(336, -9);
this.pictureBox1.Name = "pictureBox1";
@@ -323,9 +323,9 @@ namespace OpenRA.Editor
this.pictureBox1.TabIndex = 7;
this.pictureBox1.TabStop = false;
this.pictureBox1.Visible = false;
//
//
// MapSelect
//
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -353,33 +353,33 @@ namespace OpenRA.Editor
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
}
#endregion
#endregion
public System.Windows.Forms.ListView MapList;
public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Button btnOk;
public System.Windows.Forms.Label lblNew;
public System.Windows.Forms.TextBox txtNew;
public System.Windows.Forms.ColumnHeader colMapName;
public System.Windows.Forms.ImageList MapIconsList;
public System.Windows.Forms.PictureBox pbMinimap;
public System.Windows.Forms.Panel pnlBottom;
public System.Windows.Forms.SplitContainer splitContainer1;
public System.Windows.Forms.Label lblMinimap;
public System.Windows.Forms.TextBox txtTheater;
public System.Windows.Forms.Label lblTheater;
public System.Windows.Forms.TextBox txtAuthor;
public System.Windows.Forms.Label lblAuthor;
public System.Windows.Forms.TextBox txtTitle;
public System.Windows.Forms.Label lblMapName;
public System.Windows.Forms.TextBox txtDesc;
public System.Windows.Forms.Label lblDesc;
public System.Windows.Forms.Label lblMapList;
public System.Windows.Forms.Label lblPathOut;
public System.Windows.Forms.Label lblPath;
public System.Windows.Forms.TextBox txtPathOut;
public System.Windows.Forms.ListView MapList;
public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Button btnOk;
public System.Windows.Forms.Label lblNew;
public System.Windows.Forms.TextBox txtNew;
public System.Windows.Forms.ColumnHeader colMapName;
public System.Windows.Forms.ImageList MapIconsList;
public System.Windows.Forms.PictureBox pbMinimap;
public System.Windows.Forms.Panel pnlBottom;
public System.Windows.Forms.SplitContainer splitContainer1;
public System.Windows.Forms.Label lblMinimap;
public System.Windows.Forms.TextBox txtTheater;
public System.Windows.Forms.Label lblTheater;
public System.Windows.Forms.TextBox txtAuthor;
public System.Windows.Forms.Label lblAuthor;
public System.Windows.Forms.TextBox txtTitle;
public System.Windows.Forms.Label lblMapName;
public System.Windows.Forms.TextBox txtDesc;
public System.Windows.Forms.Label lblDesc;
public System.Windows.Forms.Label lblMapList;
public System.Windows.Forms.Label lblPathOut;
public System.Windows.Forms.Label lblPath;
public System.Windows.Forms.TextBox txtPathOut;
private System.Windows.Forms.PictureBox pictureBox1;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -10,75 +10,73 @@
using System;
using System.IO;
using System.Windows.Forms;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using System.Linq;
using System.Windows.Forms;
using OpenRA.Graphics;
namespace OpenRA.Editor
{
public partial class MapSelect : Form
{
public string MapFolderPath;
public partial class MapSelect : Form
{
public string MapFolderPath;
public MapSelect(string currentMod)
{
MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
public MapSelect(string currentMod)
{
MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
.Aggregate(Path.Combine);
InitializeComponent();
MapIconsList.Images.Add(pictureBox1.Image);
}
}
void MapSelect_Load(object sender, EventArgs e)
{
MapList.Items.Clear();
txtPathOut.Text = MapFolderPath;
foreach (var map in ModData.FindMapsIn(MapFolderPath))
{
ListViewItem map1 = new ListViewItem();
void MapSelect_Load(object sender, EventArgs e)
{
MapList.Items.Clear();
txtPathOut.Text = MapFolderPath;
foreach (var map in ModData.FindMapsIn(MapFolderPath))
{
ListViewItem map1 = new ListViewItem();
map1.Tag = map;
map1.Text = Path.GetFileNameWithoutExtension(map);
map1.ImageIndex = 0;
MapList.Items.Add(map1);
}
map1.ImageIndex = 0;
MapList.Items.Add(map1);
}
// hack
if (txtNew.Text != "unnamed")
MapList.Items[0].Selected = true;
}
MapList.Items[0].Selected = true;
}
void MapList_SelectedIndexChanged(object sender, EventArgs e)
{
if (MapList.SelectedItems.Count == 1)
{
txtNew.Text = MapList.SelectedItems[0].Text;
void MapList_SelectedIndexChanged(object sender, EventArgs e)
{
if (MapList.SelectedItems.Count == 1)
{
txtNew.Text = MapList.SelectedItems[0].Text;
txtNew.Tag = MapList.SelectedItems[0].Tag;
var map = new Map(txtNew.Tag as string);
txtTitle.Text = map.Title;
txtAuthor.Text = map.Author;
txtTheater.Text = map.Tileset;
txtDesc.Text = map.Description;
txtTitle.Text = map.Title;
txtAuthor.Text = map.Author;
txtTheater.Text = map.Tileset;
txtDesc.Text = map.Description;
pbMinimap.Image = null;
try
{
try
{
pbMinimap.Image = Minimap.AddStaticResources(map, Minimap.TerrainBitmap(map, true));
}
catch (Exception ed)
{
Console.WriteLine("No map preview image found: {0}", ed.ToString());
}
finally { }
}
}
}
catch (Exception ed)
{
Console.WriteLine("No map preview image found: {0}", ed.ToString());
}
finally { }
}
}
void txtPathOut_TextChanged(object sender, EventArgs e)
{
MapFolderPath = txtPathOut.Text;
}
}
void txtPathOut_TextChanged(object sender, EventArgs e)
{
MapFolderPath = txtPathOut.Text;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -58,9 +58,9 @@ namespace OpenRA.Editor
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit();
this.SuspendLayout();
//
//
// button2
//
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button2.Location = new System.Drawing.Point(229, 160);
this.button2.Name = "button2";
@@ -68,9 +68,9 @@ namespace OpenRA.Editor
this.button2.TabIndex = 7;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
//
// button1
//
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(310, 160);
this.button1.Name = "button1";
@@ -78,172 +78,172 @@ namespace OpenRA.Editor
this.button1.TabIndex = 8;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
//
//
// label3
//
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(31, 77);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(107, 13);
this.label3.TabIndex = 9;
this.label3.Text = "Cordon Right/Bottom";
//
//
// label2
//
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(31, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(86, 13);
this.label2.TabIndex = 11;
this.label2.Text = "Cordon Left/Top";
//
//
// label1
//
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 13);
this.label1.TabIndex = 10;
this.label1.Text = "Size";
//
//
// cordonBottom
//
//
this.cordonBottom.Location = new System.Drawing.Point(280, 75);
this.cordonBottom.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonBottom.Name = "cordonBottom";
this.cordonBottom.Size = new System.Drawing.Size(105, 20);
this.cordonBottom.TabIndex = 5;
this.cordonBottom.Value = new decimal(new int[] {
112,
0,
0,
0});
112,
0,
0,
0});
this.cordonBottom.Enter += new System.EventHandler(this.SelectText);
//
//
// cordonTop
//
//
this.cordonTop.Location = new System.Drawing.Point(280, 49);
this.cordonTop.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonTop.Name = "cordonTop";
this.cordonTop.Size = new System.Drawing.Size(105, 20);
this.cordonTop.TabIndex = 3;
this.cordonTop.Value = new decimal(new int[] {
16,
0,
0,
0});
16,
0,
0,
0});
this.cordonTop.Enter += new System.EventHandler(this.SelectText);
//
//
// cordonRight
//
//
this.cordonRight.Location = new System.Drawing.Point(169, 75);
this.cordonRight.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonRight.Name = "cordonRight";
this.cordonRight.Size = new System.Drawing.Size(105, 20);
this.cordonRight.TabIndex = 4;
this.cordonRight.Value = new decimal(new int[] {
112,
0,
0,
0});
112,
0,
0,
0});
this.cordonRight.Enter += new System.EventHandler(this.SelectText);
//
//
// cordonLeft
//
//
this.cordonLeft.Location = new System.Drawing.Point(169, 49);
this.cordonLeft.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonLeft.Name = "cordonLeft";
this.cordonLeft.Size = new System.Drawing.Size(105, 20);
this.cordonLeft.TabIndex = 2;
this.cordonLeft.Value = new decimal(new int[] {
16,
0,
0,
0});
16,
0,
0,
0});
this.cordonLeft.Enter += new System.EventHandler(this.SelectText);
//
//
// height
//
//
this.height.Increment = new decimal(new int[] {
8,
0,
0,
0});
8,
0,
0,
0});
this.height.Location = new System.Drawing.Point(280, 23);
this.height.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.height.Name = "height";
this.height.Size = new System.Drawing.Size(105, 20);
this.height.TabIndex = 1;
this.height.Value = new decimal(new int[] {
128,
0,
0,
0});
128,
0,
0,
0});
this.height.Enter += new System.EventHandler(this.SelectText);
//
//
// width
//
//
this.width.Increment = new decimal(new int[] {
8,
0,
0,
0});
8,
0,
0,
0});
this.width.Location = new System.Drawing.Point(169, 23);
this.width.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.width.Name = "width";
this.width.Size = new System.Drawing.Size(105, 20);
this.width.TabIndex = 0;
this.width.Value = new decimal(new int[] {
128,
0,
0,
0});
128,
0,
0,
0});
this.width.Enter += new System.EventHandler(this.SelectText);
//
//
// label4
//
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(31, 124);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Tileset";
//
//
// theater
//
//
this.theater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.theater.FormattingEnabled = true;
this.theater.Location = new System.Drawing.Point(169, 121);
this.theater.Name = "theater";
this.theater.Size = new System.Drawing.Size(216, 21);
this.theater.TabIndex = 6;
//
//
// NewMapDialog
//
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -19,9 +19,10 @@ namespace OpenRA.Editor
InitializeComponent();
}
private void SelectText(object sender, System.EventArgs e)
void SelectText(object sender, System.EventArgs e)
{
(sender as NumericUpDown).Select(0, (sender as NumericUpDown).ToString().Length);
var ud = sender as NumericUpDown;
ud.Select(0, ud.ToString().Length);
}
}
}

View File

@@ -53,6 +53,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActorPropertiesDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ActorPropertiesDialog.Designer.cs">
<DependentUpon>ActorPropertiesDialog.cs</DependentUpon>
</Compile>
<Compile Include="ActorTemplate.cs" />
<Compile Include="ActorTool.cs" />
<Compile Include="BrushTool.cs" />
@@ -90,6 +96,9 @@
<DependentUpon>PropertiesDialog.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="ActorPropertiesDialog.resx">
<DependentUpon>ActorPropertiesDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -30,30 +30,30 @@ namespace OpenRA.Editor
UpgradeMaps(args[1]);
return;
}
Application.CurrentCulture = CultureInfo.InvariantCulture;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args));
}
static void UpgradeMaps(string mod)
{
var MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", mod, "maps" }
.Aggregate(Path.Combine);
foreach (var path in ModData.FindMapsIn(MapFolderPath))
{
var map = new Map(path);
{
var map = new Map(path);
// Touch the lazy bits to initialize them
map.Actors.Force();
map.Smudges.Force();
map.MapTiles.Force();
map.MapResources.Force();
map.Actors.Force();
map.Smudges.Force();
map.MapTiles.Force();
map.MapResources.Force();
map.Save(path);
}
}
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -12,7 +12,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenRA.Editor")]
@@ -24,8 +24,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -35,11 +35,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -38,131 +38,131 @@ namespace OpenRA.Editor
/// </summary>
private void InitializeComponent()
{
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.title = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.desc = new System.Windows.Forms.TextBox();
this.selectable = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.author = new System.Windows.Forms.TextBox();
this.useAsShellmap = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button2.Location = new System.Drawing.Point(196, 193);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 14;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(277, 193);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 15;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 50);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 13);
this.label1.TabIndex = 16;
this.label1.Text = "Title";
//
// title
//
this.title.Location = new System.Drawing.Point(66, 47);
this.title.Name = "title";
this.title.Size = new System.Drawing.Size(286, 20);
this.title.TabIndex = 17;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 16;
this.label2.Text = "Desc";
//
// desc
//
this.desc.Location = new System.Drawing.Point(66, 73);
this.desc.Name = "desc";
this.desc.Size = new System.Drawing.Size(286, 20);
this.desc.TabIndex = 17;
//
// selectable
//
this.selectable.AutoSize = true;
this.selectable.Location = new System.Drawing.Point(118, 138);
this.selectable.Name = "selectable";
this.selectable.Size = new System.Drawing.Size(130, 17);
this.selectable.TabIndex = 18;
this.selectable.Text = "Show in Map Chooser";
this.selectable.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 102);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 16;
this.label3.Text = "Author";
//
// author
//
this.author.Location = new System.Drawing.Point(66, 99);
this.author.Name = "author";
this.author.Size = new System.Drawing.Size(286, 20);
this.author.TabIndex = 17;
//
// checkBox1
//
this.useAsShellmap.AutoSize = true;
this.useAsShellmap.Location = new System.Drawing.Point(118, 161);
this.useAsShellmap.Name = "checkBox1";
this.useAsShellmap.Size = new System.Drawing.Size(105, 17);
this.useAsShellmap.TabIndex = 18;
this.useAsShellmap.Text = "Use as Shellmap";
this.useAsShellmap.UseVisualStyleBackColor = true;
//
// PropertiesDialog
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(370, 228);
this.Controls.Add(this.useAsShellmap);
this.Controls.Add(this.selectable);
this.Controls.Add(this.author);
this.Controls.Add(this.label3);
this.Controls.Add(this.desc);
this.Controls.Add(this.label2);
this.Controls.Add(this.title);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "PropertiesDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "PropertiesDialog";
this.ResumeLayout(false);
this.PerformLayout();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.title = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.desc = new System.Windows.Forms.TextBox();
this.selectable = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.author = new System.Windows.Forms.TextBox();
this.useAsShellmap = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button2.Location = new System.Drawing.Point(196, 193);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 14;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(277, 193);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 15;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 50);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 13);
this.label1.TabIndex = 16;
this.label1.Text = "Title";
//
// title
//
this.title.Location = new System.Drawing.Point(66, 47);
this.title.Name = "title";
this.title.Size = new System.Drawing.Size(286, 20);
this.title.TabIndex = 17;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 16;
this.label2.Text = "Desc";
//
// desc
//
this.desc.Location = new System.Drawing.Point(66, 73);
this.desc.Name = "desc";
this.desc.Size = new System.Drawing.Size(286, 20);
this.desc.TabIndex = 17;
//
// selectable
//
this.selectable.AutoSize = true;
this.selectable.Location = new System.Drawing.Point(118, 138);
this.selectable.Name = "selectable";
this.selectable.Size = new System.Drawing.Size(130, 17);
this.selectable.TabIndex = 18;
this.selectable.Text = "Show in Map Chooser";
this.selectable.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 102);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 16;
this.label3.Text = "Author";
//
// author
//
this.author.Location = new System.Drawing.Point(66, 99);
this.author.Name = "author";
this.author.Size = new System.Drawing.Size(286, 20);
this.author.TabIndex = 17;
//
// checkBox1
//
this.useAsShellmap.AutoSize = true;
this.useAsShellmap.Location = new System.Drawing.Point(118, 161);
this.useAsShellmap.Name = "checkBox1";
this.useAsShellmap.Size = new System.Drawing.Size(105, 17);
this.useAsShellmap.TabIndex = 18;
this.useAsShellmap.Text = "Use as Shellmap";
this.useAsShellmap.UseVisualStyleBackColor = true;
//
// PropertiesDialog
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button1;
this.ClientSize = new System.Drawing.Size(370, 228);
this.Controls.Add(this.useAsShellmap);
this.Controls.Add(this.selectable);
this.Controls.Add(this.author);
this.Controls.Add(this.label3);
this.Controls.Add(this.desc);
this.Controls.Add(this.label2);
this.Controls.Add(this.title);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "PropertiesDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Map Properties";
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -177,6 +177,6 @@ namespace OpenRA.Editor
public System.Windows.Forms.CheckBox selectable;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox author;
public System.Windows.Forms.CheckBox useAsShellmap;
public System.Windows.Forms.CheckBox useAsShellmap;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -18,45 +18,6 @@ namespace OpenRA.Editor
{
static class RenderUtils
{
public static Bitmap RenderTemplate(TileSet ts, ushort n, Palette p)
{
var template = ts.Templates[n];
var tile = ts.Tiles[n];
var bitmap = new Bitmap(ts.TileSize * template.Size.X, ts.TileSize * template.Size.Y,
PixelFormat.Format8bppIndexed);
bitmap.Palette = p.AsSystemPalette();
var data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
unsafe
{
byte* q = (byte*)data.Scan0.ToPointer();
var stride = data.Stride;
for (var u = 0; u < template.Size.X; u++)
for (var v = 0; v < template.Size.Y; v++)
if (tile.TileBitmapBytes[u + v * template.Size.X] != null)
{
var rawImage = tile.TileBitmapBytes[u + v * template.Size.X];
for (var i = 0; i < ts.TileSize; i++)
for (var j = 0; j < ts.TileSize; j++)
q[(v * ts.TileSize + j) * stride + u * ts.TileSize + i] = rawImage[i + ts.TileSize * j];
}
else
{
for (var i = 0; i < ts.TileSize; i++)
for (var j = 0; j < ts.TileSize; j++)
q[(v * ts.TileSize + j) * stride + u * ts.TileSize + i] = 0;
}
}
bitmap.UnlockBits(data);
return bitmap;
}
static Bitmap RenderShp(ShpReader shp, Palette p)
{
var frame = shp[0];
@@ -84,9 +45,9 @@ namespace OpenRA.Editor
public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, Palette p)
{
var image = RenderSimple.GetImage(info, tileset.Id);
using (var s = FileSystem.OpenWithExts(image, tileset.Extensions))
var image = RenderSimple.GetImage(info);
using (var s = FileSystem.OpenWithExts(image, tileset.Extensions))
{
var shp = new ShpReader(s);
var bitmap = RenderShp(shp, p);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -56,101 +56,101 @@ namespace OpenRA.Editor
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
this.SuspendLayout();
//
//
// width
//
//
this.width.Increment = new decimal(new int[] {
8,
0,
0,
0});
8,
0,
0,
0});
this.width.Location = new System.Drawing.Point(161, 18);
this.width.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.width.Name = "width";
this.width.Size = new System.Drawing.Size(105, 20);
this.width.TabIndex = 0;
//
//
// label1
//
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(23, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Size";
//
//
// label2
//
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(23, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(86, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Cordon Left/Top";
//
//
// cordonLeft
//
//
this.cordonLeft.Location = new System.Drawing.Point(161, 44);
this.cordonLeft.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonLeft.Name = "cordonLeft";
this.cordonLeft.Size = new System.Drawing.Size(105, 20);
this.cordonLeft.TabIndex = 0;
//
//
// cordonTop
//
//
this.cordonTop.Location = new System.Drawing.Point(272, 44);
this.cordonTop.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonTop.Name = "cordonTop";
this.cordonTop.Size = new System.Drawing.Size(105, 20);
this.cordonTop.TabIndex = 0;
//
//
// cordonRight
//
//
this.cordonRight.Location = new System.Drawing.Point(161, 70);
this.cordonRight.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonRight.Name = "cordonRight";
this.cordonRight.Size = new System.Drawing.Size(105, 20);
this.cordonRight.TabIndex = 0;
//
//
// cordonBottom
//
//
this.cordonBottom.Location = new System.Drawing.Point(272, 70);
this.cordonBottom.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.cordonBottom.Name = "cordonBottom";
this.cordonBottom.Size = new System.Drawing.Size(105, 20);
this.cordonBottom.TabIndex = 0;
//
//
// label3
//
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(107, 13);
this.label3.TabIndex = 1;
this.label3.Text = "Cordon Right/Bottom";
//
//
// button1
//
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(302, 111);
this.button1.Name = "button1";
@@ -158,9 +158,9 @@ namespace OpenRA.Editor
this.button1.TabIndex = 2;
this.button1.Text = "Cancel";
this.button1.UseVisualStyleBackColor = true;
//
//
// button2
//
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button2.Location = new System.Drawing.Point(221, 111);
this.button2.Name = "button2";
@@ -168,26 +168,26 @@ namespace OpenRA.Editor
this.button2.TabIndex = 2;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
//
// height
//
//
this.height.Increment = new decimal(new int[] {
8,
0,
0,
0});
8,
0,
0,
0});
this.height.Location = new System.Drawing.Point(272, 18);
this.height.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
2048,
0,
0,
0});
this.height.Name = "height";
this.height.Size = new System.Drawing.Size(105, 20);
this.height.TabIndex = 0;
//
//
// ResizeDialog
//
//
this.AcceptButton = this.button2;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -30,7 +30,7 @@ namespace OpenRA.Editor
index = (byte)random.Next(Resource.Info.SpriteNames.Length)
};
var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize,
var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize,
(surface.GetBrushLocation().Y) / Surface.ChunkSize);
if (surface.Chunks.ContainsKey(ch))

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -33,12 +33,16 @@ namespace OpenRA.Editor
public float Zoom = 1.0f;
ITool Tool;
public bool IsPanning;
public bool ShowActorNames;
public bool ShowGrid;
public string NewActorOwner;
public event Action AfterChange = () => { };
public event Action<string> MousePositionChanged = _ => { };
public event Action<KeyValuePair<string, ActorReference>> ActorDoubleClicked = _ => { };
Dictionary<string, ActorTemplate> ActorTemplates = new Dictionary<string, ActorTemplate>();
Dictionary<int, ResourceTemplate> ResourceTemplates = new Dictionary<int, ResourceTemplate>();
@@ -88,6 +92,15 @@ namespace OpenRA.Editor
Invalidate();
}
protected override void OnDoubleClick(EventArgs e)
{
base.OnDoubleClick(e);
var x = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());
if (x.Key != null)
ActorDoubleClicked(x);
}
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
@@ -153,7 +166,7 @@ namespace OpenRA.Editor
return;
Tool = null;
var key = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == BrushLocation);
if (key.Key != null) Map.Actors.Value.Remove(key.Key);
@@ -198,7 +211,6 @@ namespace OpenRA.Editor
{
var bitmap = new Bitmap(ChunkSize * TileSet.TileSize, ChunkSize * TileSet.TileSize);
bitmap.SetPixel(0, 0, Color.Green);
var data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
@@ -212,7 +224,7 @@ namespace OpenRA.Editor
for (var j = 0; j < ChunkSize; j++)
{
var tr = Map.MapTiles.Value[u * ChunkSize + i, v * ChunkSize + j];
var tile = TileSet.Tiles[tr.type];
var tile = TileSet.Templates[tr.type].Data;
var index = (tr.index < tile.TileBitmapBytes.Count) ? tr.index : (byte)0;
var rawImage = tile.TileBitmapBytes[index];
for (var x = 0; x < TileSet.TileSize; x++)
@@ -242,6 +254,16 @@ namespace OpenRA.Editor
}
bitmap.UnlockBits(data);
if (ShowGrid)
using( var g = SGraphics.FromImage(bitmap) )
{
var rect = new Rectangle(0,0,bitmap.Width, bitmap.Height);
ControlPaint.DrawGrid( g, rect, new Size(2, Game.CellSize), Color.DarkRed );
ControlPaint.DrawGrid( g, rect, new Size(Game.CellSize, 2), Color.DarkRed );
ControlPaint.DrawGrid( g, rect, new Size(Game.CellSize, Game.CellSize), Color.Red );
}
return bitmap;
}
@@ -282,36 +304,41 @@ namespace OpenRA.Editor
if (cp != null) bmp.Palette = restorePalette;
}
void DrawActorBorder(System.Drawing.Graphics g, int2 p, ActorTemplate t)
void DrawActorBorder(SGraphics g, int2 p, ActorTemplate t)
{
var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft;
var drawPos = GetDrawPosition(p, t.Bitmap, centered);
g.DrawRectangle(CordonPen,
drawPos.X, drawPos.Y,
t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom);
}
ColorPalette GetPaletteForPlayer(string name)
ColorPalette GetPaletteForPlayerInner(string name)
{
var pr = Map.Players[name];
var pcpi = Rules.Info["player"].Traits.Get<PlayerColorPaletteInfo>();
var remap = new PlayerColorRemap(pr.ColorRamp, pcpi.PaletteFormat);
var remap = new PlayerColorRemap(pcpi.PaletteFormat, pr.ColorRamp);
return new Palette(Palette, remap).AsSystemPalette();
}
Cache<string, ColorPalette> PlayerPalettes;
ColorPalette GetPaletteForActor(ActorReference ar)
public ColorPalette GetPaletteForPlayer(string player)
{
if (PlayerPalettes == null)
PlayerPalettes = new Cache<string, ColorPalette>(GetPaletteForPlayer);
PlayerPalettes = new Cache<string, ColorPalette>(GetPaletteForPlayerInner);
return PlayerPalettes[player];
}
ColorPalette GetPaletteForActor(ActorReference ar)
{
var ownerInit = ar.InitDict.GetOrDefault<OwnerInit>();
if (ownerInit == null)
return null;
return PlayerPalettes[ownerInit.PlayerName];
return GetPaletteForPlayer(ownerInit.PlayerName);
}
protected override void OnPaint(PaintEventArgs e)
@@ -345,6 +372,8 @@ namespace OpenRA.Editor
if (ActorTemplates.ContainsKey(ar.Value.Type))
DrawActor(e.Graphics, ar.Value.Location(), ActorTemplates[ar.Value.Type],
GetPaletteForActor(ar.Value));
else
Console.WriteLine("Warning: Unknown or excluded actor: {0}", ar.Value.Type);
}
if (ShowActorNames)
@@ -358,7 +387,7 @@ namespace OpenRA.Editor
if (Tool != null)
Tool.Preview(this, e.Graphics);
if (Tool == null)
{
var x = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -12,36 +12,36 @@ using System.Drawing;
namespace OpenRA.FileFormats
{
public struct ColorRamp
{
public byte H,S,L,R;
public struct ColorRamp
{
public byte H,S,L,R;
public ColorRamp(byte h, byte s, byte l, byte r)
{
H = h; S = s; L = l; R = r;
}
public ColorRamp(byte h, byte s, byte l, byte r)
{
H = h; S = s; L = l; R = r;
}
/* returns a color along the Lum ramp */
public Color GetColor( float t )
{
return ColorFromHSL( H / 255f, S / 255f, float2.Lerp( L / 255f, L*R / (255f * 255f), t ) );
}
public static readonly ColorRamp Empty = new ColorRamp(0,0,0,0);
public override string ToString()
{
return "{0},{1},{2},{3}".F(H, S, L, R);
}
/* returns a color along the Lum ramp */
public Color GetColor( float t )
{
return ColorFromHSL( H / 255f, S / 255f, float2.Lerp( L / 255f, L*R / (255f * 255f), t ) );
}
// hk is hue in the range [0,1] instead of [0,360]
public override string ToString()
{
return "{0},{1},{2},{3}".F(H, S, L, R);
}
// hk is hue in the range [0,1] instead of [0,360]
public static Color ColorFromHSL(float hk, float s, float l)
{
// Convert from HSL to RGB
var q = (l < 0.5f) ? l * (1 + s) : l + s - (l * s);
var p = 2 * l - q;
float[] trgb = { hk + 1 / 3.0f,
hk,
hk - 1/3.0f };
float[] trgb = { hk + 1 / 3.0f, hk, hk - 1/3.0f };
float[] rgb = { 0, 0, 0 };
for (int k = 0; k < 3; k++)
@@ -60,5 +60,23 @@ namespace OpenRA.FileFormats
return Color.FromArgb((int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255));
}
}
public static bool operator ==(ColorRamp me, ColorRamp other)
{
return (me.H == other.H && me.S == other.S && me.L == other.L && me.R == other.R );
}
public static bool operator !=(ColorRamp me, ColorRamp other) { return !(me == other); }
public override int GetHashCode() { return H.GetHashCode() ^ S.GetHashCode() ^ L.GetHashCode() ^ R.GetHashCode(); }
public override bool Equals(object obj)
{
if (obj == null)
return false;
ColorRamp o = (ColorRamp)obj;
return o == this;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -61,12 +61,12 @@ namespace OpenRA.FileFormats
while ((temp = s.Pop()) != "(") yield return temp;
}
else if (char.IsNumber(t[0])) yield return t;
else if (char.IsLetter(t[0]))
else if (char.IsLetter(t[0]))
{
if (!syms.ContainsKey(t))
throw new InvalidOperationException("Substitution `{0}` undefined".F(t));
yield return syms[t].ToString();;
yield return syms[t].ToString();
}
else
{
@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
s.Push(t);
}
}
while (s.Count > 0) yield return s.Pop();
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -24,6 +24,12 @@ namespace OpenRA
return string.Format(fmt, args);
}
public static T WithDefault<T>(T def, Func<T> f)
{
try { return f(); }
catch { return def; }
}
public static void Do<T>(this IEnumerable<T> e, Action<T> fn)
{
foreach (var ee in e)
@@ -107,52 +113,73 @@ namespace OpenRA
return r.Contains(p.ToPointF());
}
public static bool HasModifier(this Modifiers k, Modifiers mod)
{
return (k & mod) == mod;
}
public static bool HasModifier(this Modifiers k, Modifiers mod)
{
return (k & mod) == mod;
}
public static bool IsValidInput(this KeyInput key)
{
return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) ||
char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) ||
return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) ||
char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) ||
char.IsPunctuation(key.UnicodeChar);
}
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k)
where V : new()
{
return d.GetOrAdd(k, _ => new V());
}
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k)
where V : new()
{
return d.GetOrAdd(k, _ => new V());
}
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k, Func<K, V> createFn)
{
V ret;
if (!d.TryGetValue(k, out ret))
d.Add(k, ret = createFn(k));
return ret;
}
public static V GetOrAdd<K, V>(this Dictionary<K, V> d, K k, Func<K, V> createFn)
{
V ret;
if (!d.TryGetValue(k, out ret))
d.Add(k, ret = createFn(k));
return ret;
}
public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r)
{
var xs = ts.ToArray();
return xs[r.Next(xs.Length)];
}
public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r)
{
var xs = ts.ToArray();
return xs[r.Next(xs.Length)];
}
public static float Product(this IEnumerable<float> xs)
{
return xs.Aggregate(1f, (a, x) => a * x);
}
public static float Product(this IEnumerable<float> xs)
{
return xs.Aggregate(1f, (a, x) => a * x);
}
public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> xs, IEnumerable<T> ys)
{
// this is probably a shockingly-slow way to do this, but it's concise.
return xs.Except(ys).Concat(ys.Except(xs));
}
public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> xs, IEnumerable<T> ys)
{
// this is probably a shockingly-slow way to do this, but it's concise.
return xs.Except(ys).Concat(ys.Except(xs));
}
public static IEnumerable<T> Iterate<T>( this T t, Func<T,T> f )
{
for(;;) { yield return t; t = f(t); }
}
public static int NextPowerOf2(int v)
{
--v;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
++v;
return v;
}
public static string JoinWith<T>(this IEnumerable<T> ts, string j)
{
return string.Join(j, ts.Select(t => t.ToString()).ToArray());
}
public static IEnumerable<T> Append<T>( this IEnumerable<T> ts, params T[] moreTs)
{
return ts.Concat(moreTs);
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -77,7 +77,7 @@ namespace OpenRA.FileFormats
field.SetValue( self, GetValue( field.Name, field.FieldType, value ) );
return;
}
var prop = self.GetType().GetProperty( key.Trim() );
if (prop != null)
@@ -90,6 +90,11 @@ namespace OpenRA.FileFormats
UnknownFieldAction( key.Trim(), self.GetType() );
}
public static T GetValue<T>( string field, string value )
{
return (T) GetValue( field, typeof(T), value );
}
public static object GetValue( string field, Type fieldType, string x )
{
if (x != null) x = x.Trim();
@@ -138,64 +143,71 @@ namespace OpenRA.FileFormats
return InvalidValueAction(x,fieldType, field);
}
else if (fieldType == typeof(ColorRamp))
{
var parts = x.Split(',');
if (parts.Length == 4)
return new ColorRamp(
(byte)int.Parse(parts[0]).Clamp(0, 255),
(byte)int.Parse(parts[1]).Clamp(0, 255),
(byte)int.Parse(parts[2]).Clamp(0, 255),
(byte)int.Parse(parts[3]).Clamp(0, 255));
else if (fieldType == typeof(ColorRamp))
{
var parts = x.Split(',');
if (parts.Length == 4)
return new ColorRamp(
(byte)int.Parse(parts[0]).Clamp(0, 255),
(byte)int.Parse(parts[1]).Clamp(0, 255),
(byte)int.Parse(parts[2]).Clamp(0, 255),
(byte)int.Parse(parts[3]).Clamp(0, 255));
return InvalidValueAction(x, fieldType, field);
}
return InvalidValueAction(x, fieldType, field);
}
else if (fieldType.IsEnum)
{
if (!Enum.GetNames(fieldType).Select(a => a.ToLower()).Contains(x.ToLower()))
return InvalidValueAction(x, fieldType, field);
return Enum.Parse(fieldType, x, true);
}
else if (fieldType.IsEnum)
{
if (!Enum.GetNames(fieldType).Select(a => a.ToLower()).Contains(x.ToLower()))
return InvalidValueAction(x, fieldType, field);
return Enum.Parse(fieldType, x, true);
}
else if (fieldType == typeof(bool))
return ParseYesNo(x, fieldType, field);
else if (fieldType == typeof(bool))
return ParseYesNo(x, fieldType, field);
else if (fieldType.IsArray)
{
if (x == null)
return Array.CreateInstance(fieldType.GetElementType(), 0);
else if (fieldType.IsArray)
{
if (x == null)
return Array.CreateInstance(fieldType.GetElementType(), 0);
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var ret = Array.CreateInstance(fieldType.GetElementType(), parts.Length);
for (int i = 0; i < parts.Length; i++)
ret.SetValue(GetValue(field, fieldType.GetElementType(), parts[i].Trim()), i);
return ret;
}
else if (fieldType == typeof(int2))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return new int2(int.Parse(parts[0]), int.Parse(parts[1]));
}
else if (fieldType == typeof(float2))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
float xx = 0;
float yy = 0;
float res;
if (float.TryParse(parts[0].Replace("%", ""), out res))
xx = res * (parts[0].Contains('%') ? 0.01f : 1f);
if (float.TryParse(parts[1].Replace("%", ""), out res))
yy = res * (parts[1].Contains('%') ? 0.01f : 1f);
return new float2(xx, yy);
}
var ret = Array.CreateInstance(fieldType.GetElementType(), parts.Length);
for (int i = 0; i < parts.Length; i++)
ret.SetValue(GetValue(field, fieldType.GetElementType(), parts[i].Trim()), i);
return ret;
}
else if (fieldType == typeof(int2))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return new int2(int.Parse(parts[0]), int.Parse(parts[1]));
}
else if (fieldType == typeof(float2))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
float xx = 0;
float yy = 0;
float res;
if (float.TryParse(parts[0].Replace("%", ""), out res))
xx = res * (parts[0].Contains('%') ? 0.01f : 1f);
if (float.TryParse(parts[1].Replace("%", ""), out res))
yy = res * (parts[1].Contains('%') ? 0.01f : 1f);
return new float2(xx, yy);
}
else if (fieldType == typeof(Rectangle))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return new Rectangle(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]));
}
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
return new Rectangle(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]));
}
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(Bits<>))
{
var parts = x.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var argTypes = new Type[] { typeof(string[]) };
var argValues = new object[] { parts };
return fieldType.GetConstructor(argTypes).Invoke(argValues);
}
UnknownFieldAction("[Type] {0}".F(x),fieldType);
return null;
}
@@ -219,26 +231,22 @@ namespace OpenRA.FileFormats
foreach( var ff in type.GetFields() )
{
var field = ff;
var load = field.GetCustomAttributes<LoadAttribute>( false );
var ignore = field.GetCustomAttributes<IgnoreAttribute>( false );
var loadUsing = field.GetCustomAttributes<LoadUsingAttribute>( false );
var fromYamlKey = field.GetCustomAttributes<FieldFromYamlKeyAttribute>( false );
if( loadUsing.Length != 0 )
ret[ field ] = ( _1, fieldType, yaml ) => loadUsing[ 0 ].LoaderFunc( field )( yaml );
else if( fromYamlKey.Length != 0 )
ret[ field ] = ( f, ft, yaml ) => GetValue( f, ft, yaml.Value );
else if( load.Length != 0 )
else if( ignore.Length == 0 )
ret[ field ] = null;
}
if( ret.Count == 0 )
foreach( var f in type.GetFields() )
ret.Add( f, null );
return ret;
}
[AttributeUsage( AttributeTargets.Field )]
public class LoadAttribute : Attribute { }
public class IgnoreAttribute : Attribute { }
[AttributeUsage( AttributeTargets.Field )]
public class LoadUsingAttribute : Attribute
@@ -296,15 +304,14 @@ namespace OpenRA.FileFormats
{
return new MiniYamlNode(field, FieldSaver.FormatValue( o, o.GetType().GetField(field) ));
}
public static string FormatValue(object o, FieldInfo f)
public static string FormatValue(object v, Type t)
{
var v = f.GetValue(o);
if (v == null)
return "";
// Color.ToString() does the wrong thing; force it to format as an array
if (f.FieldType == typeof(Color))
if (t == typeof(Color))
{
var c = (Color)v;
return "{0},{1},{2},{3}".F(((int)c.A).Clamp(0, 255),
@@ -312,15 +319,25 @@ namespace OpenRA.FileFormats
((int)c.G).Clamp(0, 255),
((int)c.B).Clamp(0, 255));
}
else if (f.FieldType == typeof(Rectangle))
if (t == typeof(Rectangle))
{
var r = (Rectangle)v;
return "{0},{1},{2},{3}".F(r.X, r.Y, r.Width, r.Height);
}
return f.FieldType.IsArray
? string.Join(",", ((Array)v).OfType<object>().Select(a => a.ToString()).ToArray())
: v.ToString();
if (t.IsArray)
{
var elems = ((Array)v).OfType<object>();
return elems.JoinWith(",");
}
return v.ToString();
}
public static string FormatValue(object o, FieldInfo f)
{
return FormatValue(f.GetValue(o), f.FieldType);
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -109,13 +109,13 @@ namespace OpenRA.FileFormats
/*var dataSize = */ br.ReadInt32();
var outputSize = br.ReadInt32();
var flags = (SoundFlags) br.ReadByte();
var samples = outputSize;
if (0 != (flags & SoundFlags.Stereo)) samples /= 2;
if (0 != (flags & SoundFlags._16Bit)) samples /= 2;
return samples / sampleRate;
}
public static byte[] LoadSound(Stream s)
{
var br = new BinaryReader(s);
@@ -140,9 +140,9 @@ namespace OpenRA.FileFormats
var t = DecodeSample(b, ref index, ref currentSample);
output[offset++] = (byte)t;
output[offset++] = (byte)(t >> 8);
if (offset < outputSize)
{
{
/* possible that only half of the final byte is used! */
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
output[offset++] = (byte)t;

View File

@@ -1,12 +1,12 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*
* This file is based on the blast routines (version 1.1 by Mark Adler)
* This file is based on the blast routines (version 1.1 by Mark Adler)
* included in zlib/contrib
*/
#endregion
@@ -20,7 +20,7 @@ namespace OpenRA.FileFormats
{
public static readonly int MAXBITS = 13; // maximum code length
public static readonly int MAXWIN = 4096; // maximum window size
static byte[] litlen = new byte[] {
11, 124, 8, 7, 28, 7, 188, 13, 76, 4,
10, 8, 12, 10, 12, 10, 8, 23, 8, 9,
@@ -51,28 +51,28 @@ namespace OpenRA.FileFormats
0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
3, 4, 5, 6, 7, 8
};
static Huffman litcode = new Huffman(litlen, litlen.Length, 256);
static Huffman lencode = new Huffman(lenlen, lenlen.Length, 16);
static Huffman distcode = new Huffman(distlen, distlen.Length, 64);
// Decode PKWare Compression Library stream.
public static byte[] Decompress(byte[] src)
{
BitReader br = new BitReader(src);
// Are literals coded?
int coded = br.ReadBits(8);
if (coded < 0 || coded > 1)
throw new NotImplementedException("Invalid datastream");
bool EncodedLiterals = (coded == 1);
// log2(dictionary size) - 6
int dict = br.ReadBits(8);
if (dict < 4 || dict > 6)
throw new InvalidDataException("Invalid dictionary size");
throw new InvalidDataException("Invalid dictionary size");
// output state
ushort next = 0; // index of next write location in out[]
bool first = true; // true to check distances (for first 4K)
@@ -94,33 +94,33 @@ namespace OpenRA.FileFormats
ms.WriteByte(outBuffer[i]);
break;
}
// Distance
symbol = len == 2 ? 2 : dict;
int dist = Decode(distcode, br) << symbol;
dist += br.ReadBits(symbol);
dist++;
if (first && dist > next)
throw new InvalidDataException("Attempt to jump before data");
// copy length bytes from distance bytes back
do
{
int dest = next;
int source = dest - dist;
int copy = MAXWIN;
if (next < dist)
{
source += copy;
copy = dist;
}
copy -= next;
if (copy > len)
copy = len;
len -= copy;
next += (ushort)copy;
@@ -129,7 +129,7 @@ namespace OpenRA.FileFormats
// the same as Array.Copy()
while( copy-- > 0 )
outBuffer[dest++] = outBuffer[source++];
// Flush window to outstream
if (next == MAXWIN)
{
@@ -153,12 +153,12 @@ namespace OpenRA.FileFormats
}
}
} while (true);
return ms.ToArray();
}
// Decode a code using huffman table h.
private static int Decode(Huffman h, BitReader br)
// Decode a code using huffman table h.
static int Decode(Huffman h, BitReader br)
{
int code = 0; // len bits being decoded
int first = 0; // first code of length len
@@ -178,19 +178,19 @@ namespace OpenRA.FileFormats
}
}
}
class BitReader
{
readonly byte[] src;
int offset = 0;
int offset = 0;
int bitBuffer = 0;
int bitCount = 0;
public BitReader(byte[] src)
{
this.src = src;
this.src = src;
}
public int ReadBits(int count)
{
int ret = 0;
@@ -202,7 +202,7 @@ namespace OpenRA.FileFormats
bitBuffer = src[offset++];
bitCount = 8;
}
ret |= (bitBuffer & 1) << filled;
bitBuffer >>= 1;
bitCount--;
@@ -230,7 +230,7 @@ namespace OpenRA.FileFormats
{
short[] length = new short[256]; // code lengths
int s = 0; // current symbol
// convert compact repeat counts into symbol bit length list
foreach (byte code in rep)
{
@@ -242,16 +242,16 @@ namespace OpenRA.FileFormats
} while (--num > 0);
}
n = s;
// count number of codes of each length
Count = new short[Blast.MAXBITS + 1];
for (int i = 0; i < n; i++)
Count[length[i]]++;
// no codes!
if (Count[0] == n)
return;
// check for an over-subscribed or incomplete set of lengths
int left = 1; // one possible code of zero length
for (int len = 1; len <= Blast.MAXBITS; len++)
@@ -263,12 +263,12 @@ namespace OpenRA.FileFormats
if (left < 0)
throw new InvalidDataException ("over subscribed code set");
}
// generate offsets into symbol table for each length for sorting
short[] offs = new short[Blast.MAXBITS + 1];
for (int len = 1; len < Blast.MAXBITS; len++)
offs[len + 1] = (short)(offs[len] + Count[len]);
// put symbols in table sorted by length, by symbol order within each length
Symbol = new short[SymbolCount];
for (short i = 0; i < n; i++)

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -13,516 +13,516 @@ using System.Linq;
namespace OpenRA.FileFormats
{
/* possibly the fugliest C# i've ever seen. */
/* possibly the fugliest C# i've ever seen. */
class BlowfishKeyProvider
{
const string pubkeyStr = "AihRvNoIbTn85FZRYNZRcT+i6KpU+maCsEqr3Q5q+LDB5tH7Tz2qQ38V";
class BlowfishKeyProvider
{
const string pubkeyStr = "AihRvNoIbTn85FZRYNZRcT+i6KpU+maCsEqr3Q5q+LDB5tH7Tz2qQ38V";
static sbyte[] char2num = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
static sbyte[] char2num = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
class PublicKey
{
public uint[] key1 = new uint[64];
public uint[] key2 = new uint[64];
public uint len;
}
PublicKey pubkey = new PublicKey();
class PublicKey
{
public uint[] key1 = new uint[64];
public uint[] key2 = new uint[64];
public uint len;
}
PublicKey pubkey = new PublicKey();
uint[] glob1 = new uint[64];
uint glob1_bitlen, glob1_len_x2;
uint[] glob2 = new uint[130];
uint[] glob1_hi = new uint[4];
uint[] glob1_hi_inv = new uint[4];
uint glob1_hi_bitlen;
uint glob1_hi_inv_lo, glob1_hi_inv_hi;
uint[] glob1 = new uint[64];
uint glob1_bitlen, glob1_len_x2;
uint[] glob2 = new uint[130];
uint[] glob1_hi = new uint[4];
uint[] glob1_hi_inv = new uint[4];
uint glob1_hi_bitlen;
uint glob1_hi_inv_lo, glob1_hi_inv_hi;
void init_bignum(uint[] n, uint val, uint len)
{
for (int i = 0; i < len; i++) n[i] = 0;
n[0] = val;
}
void init_bignum(uint[] n, uint val, uint len)
{
for (int i = 0; i < len; i++) n[i] = 0;
n[0] = val;
}
void move_key_to_big(uint[] n, byte[] key, uint klen, uint blen)
{
byte sign;
void move_key_to_big(uint[] n, byte[] key, uint klen, uint blen)
{
byte sign;
if ((key[0] & 0x80) != 0) sign = 0xff;
else sign = 0;
if ((key[0] & 0x80) != 0) sign = 0xff;
else sign = 0;
unsafe
{
fixed (uint* _pn = &n[0])
{
byte* pn = (byte*)_pn;
uint i = blen * 4;
for (; i > klen; i--) pn[i - 1] = (byte)sign;
for (; i > 0; i--) pn[i - 1] = key[klen - i];
}
}
}
unsafe
{
fixed (uint* _pn = &n[0])
{
byte* pn = (byte*)_pn;
uint i = blen * 4;
for (; i > klen; i--) pn[i - 1] = (byte)sign;
for (; i > 0; i--) pn[i - 1] = key[klen - i];
}
}
}
void key_to_bignum(uint[] n, byte[] key, uint len)
{
uint keylen;
int i;
void key_to_bignum(uint[] n, byte[] key, uint len)
{
uint keylen;
int i;
int j = 0;
int j = 0;
if (key[j] != 2) return;
j++;
if (key[j] != 2) return;
j++;
if ((key[j] & 0x80) != 0)
{
keylen = 0;
for (i = 0; i < (key[j] & 0x7f); i++) keylen = (keylen << 8) | key[j + i + 1];
j += (key[j] & 0x7f) + 1;
}
else
{
keylen = key[j];
j++;
}
if (keylen <= len * 4)
move_key_to_big(n, key.Skip(j).ToArray(), keylen, len);
}
if ((key[j] & 0x80) != 0)
{
keylen = 0;
for (i = 0; i < (key[j] & 0x7f); i++) keylen = (keylen << 8) | key[j + i + 1];
j += (key[j] & 0x7f) + 1;
}
else
{
keylen = key[j];
j++;
}
if (keylen <= len * 4)
move_key_to_big(n, key.Skip(j).ToArray(), keylen, len);
}
uint len_bignum(uint[] n, uint len)
{
uint i;
i = len - 1;
while ((i >= 0) && (n[i] == 0)) i--;
return i + 1;
}
uint len_bignum(uint[] n, uint len)
{
uint i;
i = len - 1;
while ((i >= 0) && (n[i] == 0)) i--;
return i + 1;
}
uint bitlen_bignum(uint[] n, uint len)
{
uint ddlen, bitlen, mask;
ddlen = len_bignum(n, len);
if (ddlen == 0) return 0;
bitlen = ddlen * 32;
mask = 0x80000000;
while ((mask & n[ddlen - 1]) == 0)
{
mask >>= 1;
bitlen--;
}
return bitlen;
}
uint bitlen_bignum(uint[] n, uint len)
{
uint ddlen, bitlen, mask;
ddlen = len_bignum(n, len);
if (ddlen == 0) return 0;
bitlen = ddlen * 32;
mask = 0x80000000;
while ((mask & n[ddlen - 1]) == 0)
{
mask >>= 1;
bitlen--;
}
return bitlen;
}
void init_pubkey()
{
int i = 0;
uint i2, tmp;
byte[] keytmp = new byte[256];
void init_pubkey()
{
int i = 0;
uint i2, tmp;
byte[] keytmp = new byte[256];
init_bignum(pubkey.key2, 0x10001, 64);
init_bignum(pubkey.key2, 0x10001, 64);
i2 = 0;
while (i < pubkeyStr.Length)
{
tmp = (uint)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
keytmp[i2++] = (byte)((tmp >> 16) & 0xff);
keytmp[i2++] = (byte)((tmp >> 8) & 0xff);
keytmp[i2++] = (byte)(tmp & 0xff);
}
i2 = 0;
while (i < pubkeyStr.Length)
{
tmp = (uint)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]];
keytmp[i2++] = (byte)((tmp >> 16) & 0xff);
keytmp[i2++] = (byte)((tmp >> 8) & 0xff);
keytmp[i2++] = (byte)(tmp & 0xff);
}
key_to_bignum(pubkey.key1, keytmp, 64);
pubkey.len = bitlen_bignum(pubkey.key1, 64) - 1;
}
key_to_bignum(pubkey.key1, keytmp, 64);
pubkey.len = bitlen_bignum(pubkey.key1, 64) - 1;
}
uint len_predata()
{
uint a = (pubkey.len - 1) / 8;
return (55 / a + 1) * (a + 1);
}
uint len_predata()
{
uint a = (pubkey.len - 1) / 8;
return (55 / a + 1) * (a + 1);
}
int cmp_bignum(uint[] n1, uint[] n2, uint len)
{
int cmp_bignum(uint[] n1, uint[] n2, uint len)
{
while (len > 0)
{
--len;
if (n1[len] < n2[len]) return -1;
if (n1[len] > n2[len]) return 1;
}
return 0;
}
while (len > 0)
{
--len;
if (n1[len] < n2[len]) return -1;
if (n1[len] > n2[len]) return 1;
}
return 0;
}
void mov_bignum(uint[] dest, uint[] src, uint len)
{
Array.Copy(src, dest, len);
}
void mov_bignum(uint[] dest, uint[] src, uint len)
{
Array.Copy(src, dest, len);
}
void shr_bignum(uint[] n, int bits, int len)
{
int i; int i2 = bits / 32;
void shr_bignum(uint[] n, int bits, int len)
{
int i; int i2 = bits / 32;
if (i2 > 0)
{
for (i = 0; i < len - i2; i++) n[i] = n[i + i2];
for (; i < len; i++) n[i] = 0;
bits = bits % 32;
}
if (bits == 0) return;
for (i = 0; i < len - 1; i++) n[i] = (n[i] >> bits) | (n[i + 1] << (32 -
bits));
n[i] = n[i] >> bits;
}
if (i2 > 0)
{
for (i = 0; i < len - i2; i++) n[i] = n[i + i2];
for (; i < len; i++) n[i] = 0;
bits = bits % 32;
}
if (bits == 0) return;
for (i = 0; i < len - 1; i++) n[i] = (n[i] >> bits) | (n[i + 1] << (32 -
bits));
n[i] = n[i] >> bits;
}
void shl_bignum(uint[] n, int bits, int len)
{
int i, i2;
void shl_bignum(uint[] n, int bits, int len)
{
int i, i2;
i2 = bits / 32;
if (i2 > 0)
{
for (i = len - 1; i > i2; i--) n[i] = n[i - i2];
for (; i > 0; i--) n[i] = 0;
bits = bits % 32;
}
if (bits == 0) return;
for (i = len - 1; i > 0; i--) n[i] = (n[i] << bits) | (n[i - 1] >> (32 -
bits));
n[0] <<= bits;
}
i2 = bits / 32;
if (i2 > 0)
{
for (i = len - 1; i > i2; i--) n[i] = n[i - i2];
for (; i > 0; i--) n[i] = 0;
bits = bits % 32;
}
if (bits == 0) return;
for (i = len - 1; i > 0; i--) n[i] = (n[i] << bits) | (n[i - 1] >> (32 -
bits));
n[0] <<= bits;
}
uint sub_bignum(uint[] dest, uint[] src1, uint[] src2, uint carry, int len)
{
uint i1, i2;
uint sub_bignum(uint[] dest, uint[] src1, uint[] src2, uint carry, int len)
{
uint i1, i2;
len += len;
unsafe
{
fixed (uint* _ps1 = &src1[0])
fixed (uint* _ps2 = &src2[0])
fixed (uint* _pd = &dest[0])
{
ushort* ps1 = (ushort*)_ps1;
ushort* ps2 = (ushort*)_ps2;
ushort* pd = (ushort*)_pd;
len += len;
unsafe
{
fixed (uint* _ps1 = &src1[0])
fixed (uint* _ps2 = &src2[0])
fixed (uint* _pd = &dest[0])
{
ushort* ps1 = (ushort*)_ps1;
ushort* ps2 = (ushort*)_ps2;
ushort* pd = (ushort*)_pd;
while (--len != -1)
{
i1 = *ps1++;
i2 = *ps2++;
*pd++ = (ushort)(i1 - i2 - carry);
if (((i1 - i2 - carry) & 0x10000) != 0) carry = 1; else carry = 0;
}
}
}
return carry;
}
while (--len != -1)
{
i1 = *ps1++;
i2 = *ps2++;
*pd++ = (ushort)(i1 - i2 - carry);
if (((i1 - i2 - carry) & 0x10000) != 0) carry = 1; else carry = 0;
}
}
}
return carry;
}
unsafe uint sub_bignum(uint* dest, uint* src1, uint* src2, uint carry, int len)
{
uint i1, i2;
unsafe uint sub_bignum(uint* dest, uint* src1, uint* src2, uint carry, int len)
{
uint i1, i2;
len += len;
len += len;
ushort* ps1 = (ushort*)src1;
ushort* ps2 = (ushort*)src2;
ushort* pd = (ushort*)dest;
ushort* ps1 = (ushort*)src1;
ushort* ps2 = (ushort*)src2;
ushort* pd = (ushort*)dest;
while (--len != -1)
{
i1 = *ps1++;
i2 = *ps2++;
*pd++ = (ushort)(i1 - i2 - carry);
if (((i1 - i2 - carry) & 0x10000) != 0) carry = 1; else carry = 0;
while (--len != -1)
{
i1 = *ps1++;
i2 = *ps2++;
*pd++ = (ushort)(i1 - i2 - carry);
if (((i1 - i2 - carry) & 0x10000) != 0) carry = 1; else carry = 0;
}
return carry;
}
}
return carry;
}
void inv_bignum(uint[] n1, uint[] n2, uint len)
{
uint[] n_tmp = new uint[64];
uint n2_bytelen, bit;
int n2_bitlen;
void inv_bignum(uint[] n1, uint[] n2, uint len)
{
uint[] n_tmp = new uint[64];
uint n2_bytelen, bit;
int n2_bitlen;
int j = 0;
int j = 0;
init_bignum(n_tmp, 0, len);
init_bignum(n1, 0, len);
n2_bitlen = (int)bitlen_bignum(n2, len);
bit = ((uint)1) << (n2_bitlen % 32);
j = ((n2_bitlen + 32) / 32) - 1;
n2_bytelen = (uint)((n2_bitlen - 1) / 32) * 4;
n_tmp[n2_bytelen / 4] |= ((uint)1) << ((n2_bitlen - 1) & 0x1f);
init_bignum(n_tmp, 0, len);
init_bignum(n1, 0, len);
n2_bitlen = (int)bitlen_bignum(n2, len);
bit = ((uint)1) << (n2_bitlen % 32);
j = ((n2_bitlen + 32) / 32) - 1;
n2_bytelen = (uint)((n2_bitlen - 1) / 32) * 4;
n_tmp[n2_bytelen / 4] |= ((uint)1) << ((n2_bitlen - 1) & 0x1f);
while (n2_bitlen > 0)
{
n2_bitlen--;
shl_bignum(n_tmp, 1, (int)len);
if (cmp_bignum(n_tmp, n2, len) != -1)
{
sub_bignum(n_tmp, n_tmp, n2, 0, (int)len);
n1[j] |= bit;
}
bit >>= 1;
if (bit == 0)
{
j--;
bit = 0x80000000;
}
}
init_bignum(n_tmp, 0, len);
}
while (n2_bitlen > 0)
{
n2_bitlen--;
shl_bignum(n_tmp, 1, (int)len);
if (cmp_bignum(n_tmp, n2, len) != -1)
{
sub_bignum(n_tmp, n_tmp, n2, 0, (int)len);
n1[j] |= bit;
}
bit >>= 1;
if (bit == 0)
{
j--;
bit = 0x80000000;
}
}
init_bignum(n_tmp, 0, len);
}
void inc_bignum(uint[] n, uint len)
{
int i = 0;
while ((++n[i] == 0) && (--len > 0)) i++;
}
void inc_bignum(uint[] n, uint len)
{
int i = 0;
while ((++n[i] == 0) && (--len > 0)) i++;
}
void init_two_dw(uint[] n, uint len)
{
mov_bignum(glob1, n, len);
glob1_bitlen = bitlen_bignum(glob1, len);
glob1_len_x2 = (glob1_bitlen + 15) / 16;
mov_bignum(glob1_hi, glob1.Skip((int)len_bignum(glob1, len) - 2).ToArray(), 2);
glob1_hi_bitlen = bitlen_bignum(glob1_hi, 2) - 32;
shr_bignum(glob1_hi, (int)glob1_hi_bitlen, 2);
inv_bignum(glob1_hi_inv, glob1_hi, 2);
shr_bignum(glob1_hi_inv, 1, 2);
glob1_hi_bitlen = (glob1_hi_bitlen + 15) % 16 + 1;
inc_bignum(glob1_hi_inv, 2);
if (bitlen_bignum(glob1_hi_inv, 2) > 32)
{
shr_bignum(glob1_hi_inv, 1, 2);
glob1_hi_bitlen--;
}
glob1_hi_inv_lo = (ushort)glob1_hi_inv[0];
glob1_hi_inv_hi = (ushort)(glob1_hi_inv[0] >> 16);
}
void init_two_dw(uint[] n, uint len)
{
mov_bignum(glob1, n, len);
glob1_bitlen = bitlen_bignum(glob1, len);
glob1_len_x2 = (glob1_bitlen + 15) / 16;
mov_bignum(glob1_hi, glob1.Skip((int)len_bignum(glob1, len) - 2).ToArray(), 2);
glob1_hi_bitlen = bitlen_bignum(glob1_hi, 2) - 32;
shr_bignum(glob1_hi, (int)glob1_hi_bitlen, 2);
inv_bignum(glob1_hi_inv, glob1_hi, 2);
shr_bignum(glob1_hi_inv, 1, 2);
glob1_hi_bitlen = (glob1_hi_bitlen + 15) % 16 + 1;
inc_bignum(glob1_hi_inv, 2);
if (bitlen_bignum(glob1_hi_inv, 2) > 32)
{
shr_bignum(glob1_hi_inv, 1, 2);
glob1_hi_bitlen--;
}
glob1_hi_inv_lo = (ushort)glob1_hi_inv[0];
glob1_hi_inv_hi = (ushort)(glob1_hi_inv[0] >> 16);
}
unsafe void mul_bignum_word(ushort *pn1, uint[] n2, uint mul, uint len)
{
uint i, tmp;
unsafe
{
fixed (uint* _pn2 = &n2[0])
{
ushort* pn2 = (ushort*)_pn2;
unsafe void mul_bignum_word(ushort *pn1, uint[] n2, uint mul, uint len)
{
uint i, tmp;
unsafe
{
fixed (uint* _pn2 = &n2[0])
{
ushort* pn2 = (ushort*)_pn2;
tmp = 0;
for (i = 0; i < len; i++)
{
tmp = mul * (*pn2) + (*pn1) + tmp;
*pn1 = (ushort)tmp;
pn1++;
pn2++;
tmp >>= 16;
}
*pn1 += (ushort)tmp;
}
}
}
tmp = 0;
for (i = 0; i < len; i++)
{
tmp = mul * (*pn2) + (*pn1) + tmp;
*pn1 = (ushort)tmp;
pn1++;
pn2++;
tmp >>= 16;
}
*pn1 += (ushort)tmp;
}
}
}
void mul_bignum(uint[] dest, uint[] src1, uint[] src2, uint len)
{
uint i;
void mul_bignum(uint[] dest, uint[] src1, uint[] src2, uint len)
{
uint i;
unsafe
{
fixed( uint * _psrc2 = &src2[0] )
fixed(uint* _pdest = &dest[0])
{
ushort* psrc2 = (ushort*)_psrc2;
ushort* pdest = (ushort*)_pdest;
unsafe
{
fixed( uint * _psrc2 = &src2[0] )
fixed(uint* _pdest = &dest[0])
{
ushort* psrc2 = (ushort*)_psrc2;
ushort* pdest = (ushort*)_pdest;
init_bignum(dest, 0, len * 2);
for (i = 0; i < len * 2; i++)
mul_bignum_word(pdest++, src1, *psrc2++, len * 2);
}
}
}
init_bignum(dest, 0, len * 2);
for (i = 0; i < len * 2; i++)
mul_bignum_word(pdest++, src1, *psrc2++, len * 2);
}
}
}
void not_bignum(uint[] n, uint len)
{
uint i;
for (i = 0; i < len; i++) n[i] = ~n[i];
}
void not_bignum(uint[] n, uint len)
{
uint i;
for (i = 0; i < len; i++) n[i] = ~n[i];
}
void neg_bignum(uint[] n, uint len)
{
not_bignum(n, len);
inc_bignum(n, len);
}
void neg_bignum(uint[] n, uint len)
{
not_bignum(n, len);
inc_bignum(n, len);
}
unsafe uint get_mulword(uint* n)
{
ushort* wn = (ushort*)n;
uint i = (uint)((((((((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_lo + 0x10000) >> 1)
+ (((*(wn - 2) ^ 0xffff) * glob1_hi_inv_hi + glob1_hi_inv_hi) >> 1) + 1)
>> 16) + ((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_hi) >> 1) +
(((*wn ^ 0xffff) * glob1_hi_inv_lo) >> 1) + 1) >> 14) + glob1_hi_inv_hi
* (*wn ^ 0xffff) * 2) >> (int)glob1_hi_bitlen);
if (i > 0xffff) i = 0xffff;
return i & 0xffff;
}
unsafe uint get_mulword(uint* n)
{
ushort* wn = (ushort*)n;
uint i = (uint)((((((((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_lo + 0x10000) >> 1)
+ (((*(wn - 2) ^ 0xffff) * glob1_hi_inv_hi + glob1_hi_inv_hi) >> 1) + 1)
>> 16) + ((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_hi) >> 1) +
(((*wn ^ 0xffff) * glob1_hi_inv_lo) >> 1) + 1) >> 14) + glob1_hi_inv_hi
* (*wn ^ 0xffff) * 2) >> (int)glob1_hi_bitlen);
if (i > 0xffff) i = 0xffff;
return i & 0xffff;
}
void dec_bignum(uint[] n, uint len)
{
int i = 0;
while ((--n[i] == 0xffffffff) && (--len > 0))
i++;
}
void dec_bignum(uint[] n, uint len)
{
int i = 0;
while ((--n[i] == 0xffffffff) && (--len > 0))
i++;
}
void calc_a_bignum(uint[] n1, uint[] n2, uint[] n3, uint len)
{
uint g2_len_x2, len_diff;
unsafe
{
fixed( uint* g1 = &glob1[0])
fixed (uint* g2 = &glob2[0])
{
mul_bignum(glob2, n2, n3, len);
glob2[len * 2] = 0;
g2_len_x2 = len_bignum(glob2, len * 2 + 1) * 2;
if (g2_len_x2 >= glob1_len_x2)
{
inc_bignum(glob2, len * 2 + 1);
neg_bignum(glob2, len * 2 + 1);
len_diff = g2_len_x2 + 1 - glob1_len_x2;
ushort* esi = ((ushort*)g2) + (1 + g2_len_x2 - glob1_len_x2);
ushort* edi = ((ushort*)g2) + (g2_len_x2 + 1);
for (; len_diff != 0; len_diff--)
{
edi--;
uint tmp = get_mulword((uint*)edi);
esi--;
if (tmp > 0)
{
mul_bignum_word(esi, glob1, tmp, 2 * len);
if ((*edi & 0x8000) == 0)
{
if (0 != sub_bignum((uint*)esi, (uint*)esi, g1, 0, (int)len)) (*edi)--;
}
}
}
neg_bignum(glob2, len);
dec_bignum(glob2, len);
}
mov_bignum(n1, glob2, len);
}
}
}
void calc_a_bignum(uint[] n1, uint[] n2, uint[] n3, uint len)
{
uint g2_len_x2, len_diff;
unsafe
{
fixed( uint* g1 = &glob1[0])
fixed (uint* g2 = &glob2[0])
{
mul_bignum(glob2, n2, n3, len);
glob2[len * 2] = 0;
g2_len_x2 = len_bignum(glob2, len * 2 + 1) * 2;
if (g2_len_x2 >= glob1_len_x2)
{
inc_bignum(glob2, len * 2 + 1);
neg_bignum(glob2, len * 2 + 1);
len_diff = g2_len_x2 + 1 - glob1_len_x2;
ushort* esi = ((ushort*)g2) + (1 + g2_len_x2 - glob1_len_x2);
ushort* edi = ((ushort*)g2) + (g2_len_x2 + 1);
for (; len_diff != 0; len_diff--)
{
edi--;
uint tmp = get_mulword((uint*)edi);
esi--;
if (tmp > 0)
{
mul_bignum_word(esi, glob1, tmp, 2 * len);
if ((*edi & 0x8000) == 0)
{
if (0 != sub_bignum((uint*)esi, (uint*)esi, g1, 0, (int)len)) (*edi)--;
}
}
}
neg_bignum(glob2, len);
dec_bignum(glob2, len);
}
mov_bignum(n1, glob2, len);
}
}
}
void clear_tmp_vars(uint len)
{
init_bignum(glob1, 0, len);
init_bignum(glob2, 0, len);
init_bignum(glob1_hi_inv, 0, 4);
init_bignum(glob1_hi, 0, 4);
glob1_bitlen = 0;
glob1_hi_bitlen = 0;
glob1_len_x2 = 0;
glob1_hi_inv_lo = 0;
glob1_hi_inv_hi = 0;
}
void clear_tmp_vars(uint len)
{
init_bignum(glob1, 0, len);
init_bignum(glob2, 0, len);
init_bignum(glob1_hi_inv, 0, 4);
init_bignum(glob1_hi, 0, 4);
glob1_bitlen = 0;
glob1_hi_bitlen = 0;
glob1_len_x2 = 0;
glob1_hi_inv_lo = 0;
glob1_hi_inv_hi = 0;
}
void calc_a_key(uint[] n1, uint[] n2, uint[] n3, uint[] n4, uint len)
{
uint[] n_tmp = new uint[64];
uint n3_len, n4_len;
int n3_bitlen;
uint bit_mask;
void calc_a_key(uint[] n1, uint[] n2, uint[] n3, uint[] n4, uint len)
{
uint[] n_tmp = new uint[64];
uint n3_len, n4_len;
int n3_bitlen;
uint bit_mask;
unsafe
{
fixed (uint* _pn3 = &n3[0])
{
uint* pn3 = _pn3;
unsafe
{
fixed (uint* _pn3 = &n3[0])
{
uint* pn3 = _pn3;
init_bignum(n1, 1, len);
n4_len = len_bignum(n4, len);
init_two_dw(n4, n4_len);
n3_bitlen = (int)bitlen_bignum(n3, n4_len);
n3_len = (uint)((n3_bitlen + 31) / 32);
bit_mask = (((uint)1) << ((n3_bitlen - 1) % 32)) >> 1;
pn3 += n3_len - 1;
n3_bitlen--;
mov_bignum(n1, n2, n4_len);
while (--n3_bitlen != -1)
{
if (bit_mask == 0)
{
bit_mask = 0x80000000;
pn3--;
}
calc_a_bignum(n_tmp, n1, n1, n4_len);
if ((*pn3 & bit_mask) != 0)
calc_a_bignum(n1, n_tmp, n2, n4_len);
else
mov_bignum(n1, n_tmp, n4_len);
bit_mask >>= 1;
}
init_bignum(n_tmp, 0, n4_len);
clear_tmp_vars(len);
}
}
}
init_bignum(n1, 1, len);
n4_len = len_bignum(n4, len);
init_two_dw(n4, n4_len);
n3_bitlen = (int)bitlen_bignum(n3, n4_len);
n3_len = (uint)((n3_bitlen + 31) / 32);
bit_mask = (((uint)1) << ((n3_bitlen - 1) % 32)) >> 1;
pn3 += n3_len - 1;
n3_bitlen--;
mov_bignum(n1, n2, n4_len);
while (--n3_bitlen != -1)
{
if (bit_mask == 0)
{
bit_mask = 0x80000000;
pn3--;
}
calc_a_bignum(n_tmp, n1, n1, n4_len);
if ((*pn3 & bit_mask) != 0)
calc_a_bignum(n1, n_tmp, n2, n4_len);
else
mov_bignum(n1, n_tmp, n4_len);
bit_mask >>= 1;
}
init_bignum(n_tmp, 0, n4_len);
clear_tmp_vars(len);
}
}
}
unsafe void memcpy(byte* dest, byte* src, int len)
{
while (len-- != 0) *dest++ = *src++;
}
unsafe void memcpy(byte* dest, byte* src, int len)
{
while (len-- != 0) *dest++ = *src++;
}
unsafe void process_predata(byte* pre, uint pre_len, byte *buf)
{
uint[] n2 = new uint[64];
uint[] n3 = new uint[64];
unsafe void process_predata(byte* pre, uint pre_len, byte *buf)
{
uint[] n2 = new uint[64];
uint[] n3 = new uint[64];
uint a = (pubkey.len - 1) / 8;
while (a + 1 <= pre_len)
{
init_bignum(n2, 0, 64);
fixed( uint * pn2 = &n2[0] )
memcpy((byte *)pn2, pre, (int)a + 1);
calc_a_key(n3, n2, pubkey.key2, pubkey.key1, 64);
uint a = (pubkey.len - 1) / 8;
while (a + 1 <= pre_len)
{
init_bignum(n2, 0, 64);
fixed( uint * pn2 = &n2[0] )
memcpy((byte *)pn2, pre, (int)a + 1);
calc_a_key(n3, n2, pubkey.key2, pubkey.key1, 64);
fixed( uint * pn3 = &n3[0] )
memcpy(buf, (byte *)pn3, (int)a);
fixed( uint * pn3 = &n3[0] )
memcpy(buf, (byte *)pn3, (int)a);
pre_len -= a + 1;
pre += a + 1;
buf += a;
}
}
pre_len -= a + 1;
pre += a + 1;
buf += a;
}
}
public byte[] DecryptKey(byte[] src)
{
init_pubkey();
byte[] dest = new byte[256];
public byte[] DecryptKey(byte[] src)
{
init_pubkey();
byte[] dest = new byte[256];
unsafe
{
fixed (byte* pdest = &dest[0])
fixed (byte* psrc = &src[0])
process_predata(psrc, len_predata(), pdest);
}
return dest.Take(56).ToArray();
}
}
unsafe
{
fixed (byte* pdest = &dest[0])
fixed (byte* psrc = &src[0])
process_predata(psrc, len_predata(), pdest);
}
return dest.Take(56).ToArray();
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -14,20 +14,20 @@ namespace OpenRA.FileFormats
{
public static int DecodeInto( byte[] src, byte[] dest )
{
var ctx = new FastByteReader(src);
var ctx = new FastByteReader(src);
int destIndex = 0;
while( true )
{
byte i = ctx.ReadByte();
byte i = ctx.ReadByte();
if( ( i & 0x80 ) == 0 )
{
int count = i & 0x7F;
if( count == 0 )
{
// case 6
count = ctx.ReadByte();
byte value = ctx.ReadByte();
count = ctx.ReadByte();
byte value = ctx.ReadByte();
for( int end = destIndex + count ; destIndex < end ; destIndex++ )
dest[ destIndex ] ^= value;
}
@@ -35,7 +35,7 @@ namespace OpenRA.FileFormats
{
// case 5
for( int end = destIndex + count ; destIndex < end ; destIndex++ )
dest[destIndex] ^= ctx.ReadByte();
dest[destIndex] ^= ctx.ReadByte();
}
}
else
@@ -43,7 +43,7 @@ namespace OpenRA.FileFormats
int count = i & 0x7F;
if( count == 0 )
{
count = ctx.ReadWord();
count = ctx.ReadWord();
if( count == 0 )
return destIndex;
@@ -56,12 +56,12 @@ namespace OpenRA.FileFormats
{
// case 3
for( int end = destIndex + ( count & 0x3FFF ) ; destIndex < end ; destIndex++ )
dest[destIndex] ^= ctx.ReadByte();
dest[destIndex] ^= ctx.ReadByte();
}
else
{
// case 4
byte value = ctx.ReadByte();
byte value = ctx.ReadByte();
for( int end = destIndex + ( count & 0x3FFF ) ; destIndex < end ; destIndex++ )
dest[ destIndex ] ^= value;
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -13,32 +13,32 @@ using System.IO;
namespace OpenRA.FileFormats
{
class FastByteReader
{
readonly byte[] src;
int offset = 0;
class FastByteReader
{
readonly byte[] src;
int offset = 0;
public FastByteReader(byte[] src)
{
this.src = src;
}
public FastByteReader(byte[] src)
{
this.src = src;
}
public bool Done() { return offset >= src.Length; }
public byte ReadByte() { return src[offset++]; }
public int ReadWord()
{
int x = ReadByte();
return x | (ReadByte() << 8);
}
public bool Done() { return offset >= src.Length; }
public byte ReadByte() { return src[offset++]; }
public int ReadWord()
{
int x = ReadByte();
return x | (ReadByte() << 8);
}
public void CopyTo(byte[] dest, int offset, int count)
{
Array.Copy(src, this.offset, dest, offset, count);
this.offset += count;
}
public void CopyTo(byte[] dest, int offset, int count)
{
Array.Copy(src, this.offset, dest, offset, count);
this.offset += count;
}
public int Remaining() { return src.Length - offset; }
}
}
public static class Format80
{
@@ -61,16 +61,16 @@ namespace OpenRA.FileFormats
public static int DecodeInto( byte[] src, byte[] dest )
{
var ctx = new FastByteReader(src);
var ctx = new FastByteReader(src);
int destIndex = 0;
while( true )
{
byte i = ctx.ReadByte();
byte i = ctx.ReadByte();
if( ( i & 0x80 ) == 0 )
{
// case 2
byte secondByte = ctx.ReadByte();
byte secondByte = ctx.ReadByte();
int count = ( ( i & 0x70 ) >> 4 ) + 3;
int rpos = ( ( i & 0xf ) << 8 ) + secondByte;
@@ -93,8 +93,8 @@ namespace OpenRA.FileFormats
if( count3 == 0x3E )
{
// case 4
int count = ctx.ReadWord();
byte color = ctx.ReadByte();
int count = ctx.ReadWord();
byte color = ctx.ReadByte();
for( int end = destIndex + count ; destIndex < end ; destIndex++ )
dest[ destIndex ] = color;
@@ -102,8 +102,8 @@ namespace OpenRA.FileFormats
else if( count3 == 0x3F )
{
// case 5
int count = ctx.ReadWord();
int srcIndex = ctx.ReadWord();
int count = ctx.ReadWord();
int srcIndex = ctx.ReadWord();
if( srcIndex >= destIndex )
throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) );
@@ -114,7 +114,7 @@ namespace OpenRA.FileFormats
{
// case 3
int count = count3 + 3;
int srcIndex = ctx.ReadWord();
int srcIndex = ctx.ReadWord();
if( srcIndex >= destIndex )
throw new NotImplementedException( string.Format( "srcIndex >= destIndex {0} {1}", srcIndex, destIndex ) );
@@ -129,7 +129,7 @@ namespace OpenRA.FileFormats
{
/* quick & dirty format80 encoder -- only uses raw copy operator, terminated with a zero-run. */
/* this does not produce good compression, but it's valid format80 */
var ctx = new FastByteReader(src);
var ms = new MemoryStream();

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -38,46 +38,46 @@ namespace OpenRA.FileFormats
static IFolder OpenPackage(string filename)
{
return OpenPackage(filename, order++);
return OpenPackage(filename, order++);
}
public static IFolder CreatePackage(string filename, int order, Dictionary<string, byte[]> content)
{
{
if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
return new MixFile(filename, order, content);
else if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order, content);
else if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order, content);
else if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))
throw new NotImplementedException("Creating .Z archives is unsupported");
else
return new Folder(filename, order, content);
}
public static IFolder OpenPackage(string filename, int order)
{
if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
return new MixFile(filename, order);
else if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order);
else if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order);
else if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))
return new InstallShieldPackage(filename, order);
else
return new Folder(filename, order);
}
return new MixFile(filename, order, content);
else if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order, content);
else if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order, content);
else if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))
throw new NotImplementedException("Creating .Z archives is unsupported");
else
return new Folder(filename, order, content);
}
public static IFolder OpenPackage(string filename, int order)
{
if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
return new MixFile(filename, order);
else if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order);
else if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(filename, order);
else if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))
return new InstallShieldPackage(filename, order);
else
return new Folder(filename, order);
}
public static void Mount(string name)
{
var optional = name.StartsWith("~");
if (optional) name = name.Substring(1);
// paths starting with ^ are relative to the support dir
if (name.StartsWith("^"))
name = Platform.SupportDir+name.Substring(1);
var a = (Action)(() => FileSystem.MountInner(OpenPackage(name)));
if (optional)
@@ -169,7 +169,7 @@ namespace OpenRA.FileFormats
{
foreach (var folder in mountedFolders)
if (folder.Exists(filename))
return true;
return true;
return false;
}
@@ -198,7 +198,7 @@ namespace OpenRA.FileFormats
assemblyCache.Add(filename, a);
return a;
}
return null;
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -26,11 +26,11 @@ namespace OpenRA.FileFormats
this.path = path;
this.priority = priority;
if (Directory.Exists(path))
Directory.Delete(path);
Directory.Delete(path, true);
Write(contents);
}
public Folder(string path, int priority)
{
this.path = path;
@@ -50,7 +50,7 @@ namespace OpenRA.FileFormats
foreach( var filename in Directory.GetFiles( path, "*", SearchOption.TopDirectoryOnly ) )
yield return PackageEntry.HashFilename( Path.GetFileName(filename) );
}
public bool Exists(string filename)
{
return File.Exists(Path.Combine(path,filename));
@@ -61,7 +61,7 @@ namespace OpenRA.FileFormats
{
get { return priority; }
}
public void Write(Dictionary<string, byte[]> contents)
{
if (!Directory.Exists(path))
@@ -70,7 +70,7 @@ namespace OpenRA.FileFormats
foreach (var file in contents)
using (var dataStream = File.Create(Path.Combine(path, file.Key)))
using (var writer = new BinaryWriter(dataStream))
writer.Write(file.Value);
writer.Write(file.Value);
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -32,7 +32,7 @@ namespace OpenRA.FileFormats
uint signature = reader.ReadUInt32();
if (signature != 0x8C655D13)
throw new InvalidDataException("Not an Installshield package");
reader.ReadBytes(8);
/*var FileCount = */reader.ReadUInt16();
reader.ReadBytes(4);
@@ -41,7 +41,7 @@ namespace OpenRA.FileFormats
var TOCAddress = reader.ReadInt32();
reader.ReadBytes(4);
var DirCount = reader.ReadUInt16();
// Parse the directory list
s.Seek(TOCAddress, SeekOrigin.Begin);
BinaryReader TOCreader = new BinaryReader(s);
@@ -56,15 +56,15 @@ namespace OpenRA.FileFormats
var ChunkSize = reader.ReadUInt16();
var NameLength = reader.ReadUInt16();
reader.ReadChars(NameLength); //var DirName = new String(reader.ReadChars(NameLength));
// Skip to the end of the chunk
reader.ReadBytes(ChunkSize - NameLength - 6);
// Parse files
for (var i = 0; i < FileCount; i++)
ParseFile(reader);
}
uint AccumulatedData = 0;
void ParseFile(BinaryReader reader)
{
@@ -79,11 +79,11 @@ namespace OpenRA.FileFormats
var hash = PackageEntry.HashFilename(FileName);
index.Add(hash, new PackageEntry(hash,AccumulatedData, CompressedSize));
AccumulatedData += CompressedSize;
// Skip to the end of the chunk
reader.ReadBytes(ChunkSize - NameLength - 30);
}
public Stream GetContent(uint hash)
{
PackageEntry e;
@@ -93,7 +93,7 @@ namespace OpenRA.FileFormats
s.Seek( dataStart + e.Offset, SeekOrigin.Begin );
byte[] data = new byte[ e.Length ];
s.Read( data, 0, (int)e.Length );
return new MemoryStream(Blast.Decompress(data));
}
@@ -106,7 +106,7 @@ namespace OpenRA.FileFormats
{
return index.Keys;
}
public bool Exists(string filename)
{
return index.ContainsKey(PackageEntry.HashFilename(filename));
@@ -117,7 +117,7 @@ namespace OpenRA.FileFormats
{
get { return 2000 + priority; }
}
public void Write(Dictionary<string, byte[]> contents)
{
throw new NotImplementedException("Cannot save InstallShieldPackages.");

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -31,14 +31,14 @@ namespace OpenRA.FileFormats
readonly long dataStart;
readonly Stream s;
int priority;
// Create a new MixFile
public MixFile(string filename, int priority, Dictionary<string, byte[]> contents)
{
this.priority = priority;
if (File.Exists(filename))
File.Delete(filename);
s = File.Create(filename);
Write(contents);
}
@@ -137,7 +137,7 @@ namespace OpenRA.FileFormats
dataStart = s.Position;
return items;
}
public Stream GetContent(uint hash)
{
PackageEntry e;
@@ -159,7 +159,7 @@ namespace OpenRA.FileFormats
{
return index.Keys;
}
public bool Exists(string filename)
{
return index.ContainsKey(PackageEntry.HashFilename(filename));
@@ -170,17 +170,17 @@ namespace OpenRA.FileFormats
{
get { return 1000 + priority; }
}
public void Write(Dictionary<string, byte[]> contents)
{
// Cannot modify existing mixfile - rename existing file and
// create a new one with original content plus modifications
FileSystem.Unmount(this);
// TODO: Add existing data to the contents list
if (index.Count > 0)
throw new NotImplementedException("Updating mix files unfinished");
// Construct a list of entries for the file header
uint dataSize = 0;
var items = new List<PackageEntry>();

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -44,7 +44,7 @@ namespace OpenRA.FileFormats
if (File.Exists(filename))
File.Delete(filename);
pkg = SZipFile.Create(filename);
Write(contents);
}
@@ -70,7 +70,7 @@ namespace OpenRA.FileFormats
foreach(ZipEntry entry in pkg)
yield return PackageEntry.HashFilename(entry.Name);
}
public bool Exists(string filename)
{
return pkg.GetEntry(filename) != null;
@@ -80,7 +80,7 @@ namespace OpenRA.FileFormats
{
get { return 500 + priority; }
}
public void Write(Dictionary<string, byte[]> contents)
{
pkg.Close();
@@ -108,7 +108,7 @@ namespace OpenRA.FileFormats
{
this.data = data;
}
public Stream GetSource()
{
return new MemoryStream(data);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -83,14 +83,14 @@ namespace OpenRA.FileFormats
BinaryReader reader = new BinaryReader(stream);
ImageCount = reader.ReadUInt16();
//Last offset is pointer to end of file.
uint[] offsets = new uint[ImageCount + 1];
uint temp = reader.ReadUInt32();
//If fourth byte in file is non-zero, the offsets are two bytes each.
bool twoByteOffsets = (temp & 0xFF0000) > 0;
bool twoByteOffsets = (temp & 0xFF0000) > 0;
if (twoByteOffsets)
{
offsets[0] = ((temp & 0xFFFF0000) >> 16) + 2; //Offset does not account for image count bytes
@@ -132,7 +132,7 @@ namespace OpenRA.FileFormats
{
get { return headers[index]; }
}
public IEnumerator<Dune2ImageHeader> GetEnumerator()
{
return headers.GetEnumerator();

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -21,12 +21,17 @@ namespace OpenRA.FileFormats.Graphics
public RendererAttribute( Type graphicsDeviceType )
{
if( !typeof( IGraphicsDevice ).IsAssignableFrom( graphicsDeviceType ) )
if( !typeof( IDeviceFactory ).IsAssignableFrom( graphicsDeviceType ) )
throw new InvalidOperationException( "Incorrect type in RendererAttribute" );
Type = graphicsDeviceType;
}
}
public interface IDeviceFactory
{
IGraphicsDevice Create( Size size, WindowMode windowMode );
}
public interface IGraphicsDevice
{
IVertexBuffer<Vertex> CreateVertexBuffer( int length );
@@ -37,12 +42,13 @@ namespace OpenRA.FileFormats.Graphics
Size WindowSize { get; }
int GpuMemoryUsed { get; }
void Clear( Color color );
void Clear();
void Present();
void PumpInput(IInputHandler inputHandler);
void DrawPrimitives( PrimitiveType type, int firstVertex, int numVertices );
void SetLineWidth( float width );
void EnableScissor( int left, int top, int width, int height );
void DisableScissor();
}
@@ -67,20 +73,20 @@ namespace OpenRA.FileFormats.Graphics
void SetData(byte[] colors, int width, int height);
}
public enum PrimitiveType
{
PointList,
LineList,
TriangleList,
public enum PrimitiveType
{
PointList,
LineList,
TriangleList,
QuadList,
}
}
public struct Range<T>
{
public readonly T Start, End;
public Range( T start, T end ) { Start = start; End = end; }
}
public enum WindowMode
{
Windowed,

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -27,13 +27,15 @@ namespace OpenRA
public MouseButton Button;
public int2 Location;
public Modifiers Modifiers;
public int MultiTapCount;
public MouseInput( MouseInputEvent ev, MouseButton button, int2 location, Modifiers mods )
public MouseInput( MouseInputEvent ev, MouseButton button, int2 location, Modifiers mods, int multiTapCount )
{
this.Event = ev;
this.Button = button;
this.Location = location;
this.Modifiers = mods;
this.MultiTapCount = multiTapCount;
}
}
@@ -68,5 +70,6 @@ namespace OpenRA
public string KeyName;
public Modifiers Modifiers;
public int VirtKey;
public int MultiTapCount;
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -63,7 +63,7 @@ namespace OpenRA.FileFormats
public Size Size { get { return new Size(Width, Height); } }
private readonly List<ImageHeader> headers = new List<ImageHeader>();
readonly List<ImageHeader> headers = new List<ImageHeader>();
int recurseDepth = 0;
@@ -156,7 +156,7 @@ namespace OpenRA.FileFormats
return compressedBytes;
}
private byte[] CopyImageData( byte[] baseImage )
byte[] CopyImageData( byte[] baseImage )
{
byte[] imageData = new byte[ Width * Height ];
for( int i = 0 ; i < Width * Height ; i++ )

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -19,7 +19,7 @@ namespace OpenRA.FileFormats
public readonly byte Framerate;
public readonly ushort Width;
public readonly ushort Height;
Stream stream;
int currentFrame;
ushort numColors;
@@ -32,75 +32,75 @@ namespace OpenRA.FileFormats
// Stores a list of subpixels, referenced by the VPTZ chunk
byte[] cbf;
byte[] cbp;
byte[] cbp;
int cbChunk = 0;
int cbOffset = 0;
// Top half contains block info, bottom half contains references to cbf array
byte[] origData;
// Final frame output
uint[,] frameData;
byte[] audioData; // audio for this frame: 22050Hz 16bit mono pcm, uncompressed.
public byte[] AudioData { get { return audioData; } }
public int CurrentFrame { get { return currentFrame; } }
public VqaReader( Stream stream )
{
this.stream = stream;
BinaryReader reader = new BinaryReader( stream );
// Decode FORM chunk
if (new String(reader.ReadChars(4)) != "FORM")
throw new InvalidDataException("Invalid vqa (invalid FORM section)");
/*var length = */ reader.ReadUInt32();
if (new String(reader.ReadChars(8)) != "WVQAVQHD")
throw new InvalidDataException("Invalid vqa (not WVQAVQHD)");
/* var length = */reader.ReadUInt32();
/*var version = */reader.ReadUInt16();
/*var flags = */reader.ReadUInt16();
Frames = reader.ReadUInt16();
Width = reader.ReadUInt16();
Height = reader.ReadUInt16();
blockWidth = reader.ReadByte();
blockHeight = reader.ReadByte();
Framerate = reader.ReadByte();
cbParts = reader.ReadByte();
blocks = new int2(Width / blockWidth, Height / blockHeight);
numColors = reader.ReadUInt16();
/*var maxBlocks = */reader.ReadUInt16();
/*var unknown1 = */reader.ReadUInt16();
/*var unknown2 = */reader.ReadUInt32();
// Audio
/*var freq = */reader.ReadUInt16();
/*var channels = */reader.ReadByte();
/*var bits = */reader.ReadByte();
/*var unknown3 = */reader.ReadChars(14);
var frameSize = NextPowerOf2(Math.Max(Width,Height));
var frameSize = Exts.NextPowerOf2(Math.Max(Width,Height));
cbf = new byte[Width*Height];
cbp = new byte[Width*Height];
palette = new uint[numColors];
origData = new byte[2*blocks.X*blocks.Y];
frameData = new uint[frameSize,frameSize];
var type = new String(reader.ReadChars(4));
if (type != "FINF")
{
reader.ReadBytes(27);
type = new String(reader.ReadChars(4));
}
/*var length = */reader.ReadUInt16();
/*var unknown4 = */reader.ReadUInt16();
// Frame offsets
offsets = new UInt32[Frames];
for (int i = 0; i < Frames; i++)
@@ -111,7 +111,7 @@ namespace OpenRA.FileFormats
}
CollectAudioData();
Reset();
}
@@ -120,7 +120,7 @@ namespace OpenRA.FileFormats
currentFrame = cbOffset = cbChunk = 0;
LoadFrame();
}
void CollectAudioData()
{
var ms = new MemoryStream();
@@ -163,17 +163,17 @@ namespace OpenRA.FileFormats
currentFrame++;
LoadFrame();
}
void LoadFrame()
{
{
if (currentFrame >= Frames)
return;
// Seek to the start of the frame
stream.Seek(offsets[currentFrame], SeekOrigin.Begin);
BinaryReader reader = new BinaryReader(stream);
var end = (currentFrame < Frames - 1) ? offsets[currentFrame+1] : stream.Length;
while(reader.BaseStream.Position < end)
{
var type = new String(reader.ReadChars(4));
@@ -189,17 +189,17 @@ namespace OpenRA.FileFormats
reader.ReadBytes((int)length);
break;
}
// Chunks are aligned on even bytes; advance by a byte if the next one is null
if (reader.PeekChar() == 0) reader.ReadByte();
}
}
// VQA Frame
public void DecodeVQFR(BinaryReader reader)
{
{
while(true)
{
{
// Chunks are aligned on even bytes; may be padded with a single null
if (reader.PeekChar() == 0) reader.ReadByte();
var type = new String(reader.ReadChars(4));
@@ -214,9 +214,9 @@ namespace OpenRA.FileFormats
case "CBF0":
cbf = reader.ReadBytes(subchunkLength);
break;
// frame-modifier chunk
case "CBP0":
case "CBP0":
case "CBPZ":
// Partial buffer is full; dump and recreate
if (cbChunk == cbParts)
@@ -225,16 +225,16 @@ namespace OpenRA.FileFormats
cbf = (byte[])cbp.Clone();
else
Format80.DecodeInto( cbp, cbf );
cbOffset = cbChunk = 0;
}
var bytes = reader.ReadBytes(subchunkLength);
bytes.CopyTo(cbp,cbOffset);
cbOffset += subchunkLength;
cbChunk++;
break;
// Palette
case "CPL0":
for (int i = 0; i < numColors; i++)
@@ -245,7 +245,7 @@ namespace OpenRA.FileFormats
palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
}
break;
// Frame data
case "VPTZ":
Format80.DecodeInto( reader.ReadBytes(subchunkLength), origData );
@@ -256,39 +256,36 @@ namespace OpenRA.FileFormats
}
}
}
int cachedFrame = -1;
public uint[,] FrameData { get
void DecodeFrameData( int frame )
{
if (cachedFrame != currentFrame)
cachedFrame = currentFrame;
for (var y = 0; y < blocks.Y; y++)
for (var x = 0; x < blocks.X; x++)
{
var px = origData[x + y*blocks.X];
var mod = origData[x + (y + blocks.Y)*blocks.X];
for (var j = 0; j < blockHeight; j++)
for (var i = 0; i < blockWidth; i++)
{
var cbfi = (mod*256 + px)*8 + j*blockWidth + i;
byte color = (mod == 0x0f) ? px : cbf[cbfi];
frameData[y*blockHeight + j, x*blockWidth + i] = palette[color];
}
}
}
public uint[,] FrameData
{
get
{
cachedFrame = currentFrame;
for (var y = 0; y < blocks.Y; y++)
for (var x = 0; x < blocks.X; x++)
{
var px = origData[x + y*blocks.X];
var mod = origData[x + (y + blocks.Y)*blocks.X];
for (var j = 0; j < blockHeight; j++)
for (var i = 0; i < blockWidth; i++)
{
var cbfi = (mod*256 + px)*8 + j*blockWidth + i;
byte color = (mod == 0x0f) ? px : cbf[cbfi];
frameData[y*blockHeight + j, x*blockWidth + i] = palette[color];
}
}
if (cachedFrame != currentFrame)
DecodeFrameData(currentFrame);
return frameData;
}
return frameData;
}}
int NextPowerOf2(int v)
{
--v;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
++v;
return v;
}
}
}

View File

@@ -1,97 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace OpenRA.FileFormats
{
public static class HttpUtil
{
public static byte[] DownloadData(string url, Action<int, int> f, int chunkSize)
{
var uri = new Uri(url);
var ip = Dns.GetHostEntry(uri.DnsSafeHost).AddressList[0];
using (var s = new TcpClient())
{
s.Connect(new IPEndPoint(ip, uri.Port));
var ns = s.GetStream();
var sw = new StreamWriter(ns);
sw.Write("GET {0} HTTP/1.0\r\nHost:{1}\r\n\r\n", uri.PathAndQuery, uri.Host);
sw.Flush();
var br = new BinaryReader(ns);
var contentLength = 0;
var offset = 0;
for (; ; )
{
var result = br.ReadLine();
var kv = result.Split(new string[] { ": " }, StringSplitOptions.RemoveEmptyEntries);
if (result == "")
{
/* data follows the blank line */
if (contentLength > 0)
{
if (f != null)
f(offset, contentLength);
var data = new byte[contentLength];
while (offset < contentLength)
{
var thisChunk = Math.Min(contentLength - offset, chunkSize);
br.Read(data, offset, thisChunk);
offset += thisChunk;
if (f != null)
f(offset, contentLength);
}
s.Close();
return data;
}
else
{
s.Close();
return new byte[] { };
}
}
else if (kv[0] == "Content-Length")
contentLength = int.Parse(kv[1]);
}
}
}
public static byte[] DownloadData(string url, Action<int, int> f)
{
return DownloadData(url, f, 4096);
}
public static byte[] DownloadData(string url)
{
return DownloadData(url, null);
}
static string ReadLine(this BinaryReader br)
{
var sb = new StringBuilder();
char c;
while ((c = br.ReadChar()) != '\n')
if (c != '\r' && c != '\n')
sb.Append(c);
return sb.ToString();
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
@@ -26,13 +27,22 @@ namespace OpenRA.FileFormats
if (e != null) yield return e; else break;
}
}
public static string GetMountedDisk(Func<string, bool> isValidDisk)
{
var volumes = DriveInfo.GetDrives()
.Where(v => v.DriveType == DriveType.CDRom && v.IsReady)
.Select(v => v.RootDirectory.FullName);
return volumes.FirstOrDefault(v => isValidDisk(v));
}
// TODO: The package should be mounted into its own context to avoid name collisions with installed files
public static bool ExtractFromPackage(string srcPath, string package, string[] files, string destPath, Action<string> onProgress, Action<string> onError)
{
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
if (!Directory.Exists(srcPath)) { onError("Cannot find "+package); return false; }
FileSystem.Mount(srcPath);
if (!FileSystem.Exists(package)) { onError("Cannot find "+package); return false; }
@@ -48,11 +58,9 @@ namespace OpenRA.FileFormats
destStream.Write(sourceStream.ReadAllBytes());
}
}
onProgress("Extraction complete");
return true;
}
public static bool CopyFiles(string srcPath, string[] files, string destPath, Action<string> onProgress, Action<string> onError)
{
foreach (var file in files)
@@ -67,10 +75,9 @@ namespace OpenRA.FileFormats
onProgress("Extracting "+destFile);
File.Copy(fromPath, Path.Combine(destPath, destFile), true);
}
onProgress("Extraction complete");
return true;
}
public static bool ExtractZip(string zipFile, string dest, Action<string> onProgress, Action<string> onError)
{
if (!File.Exists(zipFile))
@@ -78,38 +85,37 @@ namespace OpenRA.FileFormats
onError("Invalid path: "+zipFile);
return false;
}
List<string> extracted = new List<string>();
try
{
var z = new ZipInputStream(File.OpenRead(zipFile));
z.ExtractZip(dest, extracted, s => onProgress("Extracting "+s));
onProgress("Extraction complete");
}
catch (SharpZipBaseException)
{
foreach(var f in extracted)
File.Delete(f);
onError("Invalid archive");
return false;
}
return true;
}
// TODO: this belongs in FileSystem/ZipFile
static void ExtractZip(this ZipInputStream z, string destPath, List<string> extracted, Action<string> onProgress)
{
foreach (var entry in z.GetEntries())
{
if (!entry.IsFile) continue;
onProgress(entry.Name);
Directory.CreateDirectory(Path.Combine(destPath, Path.GetDirectoryName(entry.Name)));
var path = Path.Combine(destPath, entry.Name);
extracted.Add(path);
using (var f = File.Create(path))
{
int bufSize = 2048;
@@ -118,7 +124,7 @@ namespace OpenRA.FileFormats
f.Write(buf, 0, bufSize);
}
}
z.Close();
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -48,10 +48,10 @@ namespace OpenRA.FileFormats
Movies = YamlList(yaml, "Movies");
TileSets = YamlList(yaml, "TileSets");
ChromeMetrics = YamlList(yaml, "ChromeMetrics");
LoadScreen = yaml["LoadScreen"];
Fonts = yaml["Fonts"].NodesDict.ToDictionary(x => x.Key, x => Pair.New(x.Value.NodesDict["Font"].Value,
int.Parse(x.Value.NodesDict["Size"].Value)));
int.Parse(x.Value.NodesDict["Size"].Value)));
if (yaml.ContainsKey("TileSize"))
TileSize = int.Parse(yaml["TileSize"].Value);
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -20,23 +20,29 @@ namespace OpenRA.FileFormats
public bool OwnsWorld = false;
public bool NonCombatant = false;
public bool Playable = false;
public string Bot = null;
public bool DefaultStartingUnits = false;
public bool AllowBots = true;
public bool LockRace = false;
public string Race;
public bool LockColor = false;
public ColorRamp ColorRamp = new ColorRamp(0,0,238,34);
public ColorRamp ColorRamp = new ColorRamp(0,0,238,34);
public bool LockSpawn = false;
public int Spawn = 0;
public bool LockTeam = false;
public int Team = 0;
public int InitialCash = 0;
public string[] Allies = {};
public string[] Enemies = {};
public PlayerReference() {}
public PlayerReference(MiniYaml my)
{
FieldLoader.Load(this, my);
}
public PlayerReference(MiniYaml my) { FieldLoader.Load(this, my); }
public override string ToString() { return Name; }
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -21,7 +21,7 @@ namespace OpenRA.FileFormats
Location = location;
Depth = depth;
}
public override string ToString ()
{
return string.Format("{0} {1},{2} {3}", Type, Location.X,Location.Y, Depth);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -18,35 +18,35 @@ namespace OpenRA.FileFormats
public readonly List<byte[]> TileBitmapBytes = new List<byte[]>();
public Terrain( Stream stream, int size )
{
{
// Try loading as a cnc .tem
BinaryReader reader = new BinaryReader( stream );
int Width = reader.ReadUInt16();
int Height = reader.ReadUInt16();
if( Width != size || Height != size )
throw new InvalidDataException( "{0}x{1} != {2}x{2}".F(Width, Height, size ) );
/*NumTiles = */reader.ReadUInt16();
/*Zero1 = */reader.ReadUInt16();
/*Zero1 = */reader.ReadUInt16();
/*uint Size = */reader.ReadUInt32();
uint ImgStart = reader.ReadUInt32();
/*Zero2 = */reader.ReadUInt32();
int IndexEnd, IndexStart;
if (reader.ReadUInt16() == 65535) // ID1 = FFFFh for cnc
{
/*ID2 = */reader.ReadUInt16();
/*ID2 = */reader.ReadUInt16();
IndexEnd = reader.ReadInt32();
IndexStart = reader.ReadInt32();
}
else // Load as a ra .tem
{
stream.Position = 0;
stream.Position = 0;
reader = new BinaryReader( stream );
Width = reader.ReadUInt16();
Height = reader.ReadUInt16();
/*NumTiles = */reader.ReadUInt16();
reader.ReadUInt16();
/*XDim = */reader.ReadUInt16();
@@ -57,7 +57,7 @@ namespace OpenRA.FileFormats
reader.ReadUInt32();
IndexEnd = reader.ReadInt32();
reader.ReadUInt32();
IndexStart = reader.ReadInt32();
IndexStart = reader.ReadInt32();
}
stream.Position = IndexStart;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -14,7 +14,7 @@ namespace OpenRA.FileFormats
{
public T type;
public U index;
public TileReference(T t, U i)
{
type = t;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -19,31 +20,28 @@ namespace OpenRA.FileFormats
public class TerrainTypeInfo
{
public string Type;
public bool Buildable = true;
public bool AcceptSmudge = true;
public bool IsWater = false;
public Color Color;
public TerrainTypeInfo() {}
public TerrainTypeInfo(MiniYaml my) { FieldLoader.Load(this, my); }
public MiniYaml Save() { return FieldSaver.Save(this); }
}
public class TileTemplate
{
[FieldLoader.Load] public ushort Id;
[FieldLoader.Load] public string Image;
[FieldLoader.Load] public int2 Size;
[FieldLoader.Load] public bool PickAny;
public ushort Id;
public string Image;
public int2 Size;
public bool PickAny;
[FieldLoader.LoadUsing( "LoadTiles" )]
public Dictionary<byte, string> Tiles = new Dictionary<byte, string>();
public TileTemplate() {}
public TileTemplate(MiniYaml my)
{
FieldLoader.Load( this, my );
}
public TileTemplate(MiniYaml my) { FieldLoader.Load( this, my ); }
static object LoadTiles( MiniYaml y )
{
@@ -51,11 +49,13 @@ namespace OpenRA.FileFormats
t => byte.Parse(t.Key),
t => t.Value.Value );
}
static readonly string[] Fields = { "Id", "Image", "Size", "PickAny" };
public MiniYaml Save()
{
var root = new List<MiniYamlNode>();
foreach (var field in new string[] {"Id", "Image", "Size", "PickAny"})
foreach (var field in Fields)
{
FieldInfo f = this.GetType().GetField(field);
if (f.GetValue(this) == null) continue;
@@ -64,11 +64,13 @@ namespace OpenRA.FileFormats
root.Add( new MiniYamlNode( "Tiles", null,
Tiles.Select( x => new MiniYamlNode( x.Key.ToString(), x.Value ) ).ToList() ) );
return new MiniYaml(null, root);
}
public Terrain Data;
}
public class TileSet
{
public string Name;
@@ -77,15 +79,16 @@ namespace OpenRA.FileFormats
public int TileSize = 24;
public string[] Extensions;
public Dictionary<string, TerrainTypeInfo> Terrain = new Dictionary<string, TerrainTypeInfo>();
public Dictionary<ushort, Terrain> Tiles = new Dictionary<ushort, Terrain>();
public Dictionary<ushort, TileTemplate> Templates = new Dictionary<ushort, TileTemplate>();
static List<string> fields = new List<string>() {"Name", "TileSize", "Id", "Palette", "Extensions"};
static readonly string[] fields = {"Name", "TileSize", "Id", "Palette", "Extensions"};
public TileSet() {}
public TileSet( string filepath )
{
var yaml = MiniYaml.DictFromFile( filepath );
// General info
FieldLoader.Load(this, yaml["General"]);
@@ -97,30 +100,30 @@ namespace OpenRA.FileFormats
Templates = yaml["Templates"].NodesDict.Values
.Select(y => new TileTemplate(y)).ToDictionary(t => t.Id);
}
public void LoadTiles()
{
foreach (var t in Templates)
using( Stream s = FileSystem.OpenWithExts(t.Value.Image, Extensions) )
{
if( !Tiles.ContainsKey( t.Key ) )
Tiles.Add( t.Key, new Terrain( s, TileSize ) );
}
if (t.Value.Data == null)
using( var s = FileSystem.OpenWithExts(t.Value.Image, Extensions) )
t.Value.Data = new Terrain(s, TileSize);
}
public void Save(string filepath)
{
{
var root = new List<MiniYamlNode>();
var gen = new List<MiniYamlNode>();
foreach (var field in fields)
{
FieldInfo f = this.GetType().GetField(field);
if (f.GetValue(this) == null) continue;
gen.Add( new MiniYamlNode( field, FieldSaver.FormatValue( this, f ) ) );
}
root.Add( new MiniYamlNode( "General", null, gen ) );
root.Add( new MiniYamlNode( "Terrain", null,
root.Add( new MiniYamlNode( "Terrain", null,
Terrain.Select( t => new MiniYamlNode(
"TerrainType@{0}".F( t.Value.Type ),
t.Value.Save() ) ).ToList() ) );
@@ -130,14 +133,14 @@ namespace OpenRA.FileFormats
"Template@{0}".F( t.Value.Id ),
t.Value.Save() ) ).ToList() ) );
root.WriteToFile(filepath);
}
}
public byte[] GetBytes(TileReference<ushort,byte> r)
{
Terrain tile;
if( Tiles.TryGetValue( r.type, out tile ) )
return tile.TileBitmapBytes[ r.index ];
TileTemplate tile;
if( Templates.TryGetValue( r.type, out tile ) )
return tile.Data.TileBitmapBytes[ r.index ];
byte[] missingTile = new byte[ TileSize * TileSize ];
for( int i = 0 ; i < missingTile.Length ; i++ )
missingTile[ i ] = 0x36;
@@ -153,5 +156,43 @@ namespace OpenRA.FileFormats
return "Clear"; // Default walkable
return ret;
}
public Bitmap RenderTemplate(ushort n, Palette p)
{
var template = Templates[n];
var bitmap = new Bitmap(TileSize * template.Size.X, TileSize * template.Size.Y,
PixelFormat.Format8bppIndexed);
bitmap.Palette = p.AsSystemPalette();
var data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
unsafe
{
byte* q = (byte*)data.Scan0.ToPointer();
var stride = data.Stride;
for (var u = 0; u < template.Size.X; u++)
for (var v = 0; v < template.Size.Y; v++)
if (template.Data.TileBitmapBytes[u + v * template.Size.X] != null)
{
var rawImage = template.Data.TileBitmapBytes[u + v * template.Size.X];
for (var i = 0; i < TileSize; i++)
for (var j = 0; j < TileSize; j++)
q[(v * TileSize + j) * stride + u * TileSize + i] = rawImage[i + TileSize * j];
}
else
{
for (var i = 0; i < TileSize; i++)
for (var j = 0; j < TileSize; j++)
q[(v * TileSize + j) * stride + u * TileSize + i] = 0;
}
}
bitmap.UnlockBits(data);
return bitmap;
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -22,7 +22,7 @@ namespace OpenRA.FileFormats
public struct SourceLocation
{
public string Filename; public int Line;
public override string ToString() { return "{0}:{1}".F(Filename, Line); }
public override string ToString() { return "{0}:{1}".F(Filename, Line); }
}
public SourceLocation Location;
@@ -55,10 +55,10 @@ namespace OpenRA.FileFormats
{
}
public override string ToString()
{
return "{{YamlNode: {0} @ {1}}}".F(Key, Location);
}
public override string ToString()
{
return "{{YamlNode: {0} @ {1}}}".F(Key, Location);
}
}
public class MiniYaml
@@ -98,7 +98,7 @@ namespace OpenRA.FileFormats
{
return new MiniYaml( null, list.Select( x => new MiniYamlNode( x.ToString(), new MiniYaml( null ) ) ).ToList() );
}
static List<MiniYamlNode> FromLines(string[] lines, string filename)
{
var levels = new List<List<MiniYamlNode>>();
@@ -121,7 +121,7 @@ namespace OpenRA.FileFormats
var d = new List<MiniYamlNode>();
var rhs = SplitAtColon( ref t );
levels[ level ].Add( new MiniYamlNode( t, rhs, d, new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo } ) );
levels.Add(d);
}
return levels[ 0 ];
@@ -143,11 +143,11 @@ namespace OpenRA.FileFormats
{
StreamReader reader = new StreamReader( FileSystem.Open(path) );
List<string> lines = new List<string>();
while( !reader.EndOfStream )
lines.Add(reader.ReadLine());
reader.Close();
return FromLines(lines.ToArray(), path);
}
@@ -162,7 +162,7 @@ namespace OpenRA.FileFormats
}
public static List<MiniYamlNode> FromFile( string path )
{
{
return FromLines(File.ReadAllLines( path ), path);
}
@@ -177,15 +177,15 @@ namespace OpenRA.FileFormats
return FromLines(text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries), "<no filename available>");
}
public static List<MiniYamlNode> MergeLiberal(List<MiniYamlNode> a, List<MiniYamlNode> b)
{
return Merge(a, b, false);
}
public static List<MiniYamlNode> MergeLiberal(List<MiniYamlNode> a, List<MiniYamlNode> b)
{
return Merge(a, b, false);
}
public static List<MiniYamlNode> MergeStrict(List<MiniYamlNode> a, List<MiniYamlNode> b)
{
return Merge(a, b, true);
}
public static List<MiniYamlNode> MergeStrict(List<MiniYamlNode> a, List<MiniYamlNode> b)
{
return Merge(a, b, true);
}
static List<MiniYamlNode> Merge( List<MiniYamlNode> a, List<MiniYamlNode> b, bool throwErrors )
{
@@ -200,8 +200,8 @@ namespace OpenRA.FileFormats
var bDict = b.ToDictionary( x => x.Key );
var keys = aDict.Keys.Union( bDict.Keys ).ToList();
var noInherit = keys.Where(x => x.Length > 0 && x[0] == '-')
.ToDictionary(x => x.Substring(1), x => false);
var noInherit = keys.Where(x => x.Length > 0 && x[0] == '-')
.ToDictionary(x => x.Substring(1), x => false);
foreach( var key in keys )
{
@@ -211,11 +211,11 @@ namespace OpenRA.FileFormats
if( noInherit.ContainsKey( key ) )
{
if (!throwErrors)
if (aa != null)
ret.Add(aa);
if (!throwErrors)
if (aa != null)
ret.Add(aa);
noInherit[key] = true;
noInherit[key] = true;
}
else
{
@@ -225,23 +225,23 @@ namespace OpenRA.FileFormats
}
}
if (throwErrors)
if (noInherit.ContainsValue(false))
throw new YamlException("Bogus yaml removals: {0}".F(
string.Join(", ", noInherit.Where(x => !x.Value).Select(x => x.Key).ToArray())));
if (throwErrors)
if (noInherit.ContainsValue(false))
throw new YamlException("Bogus yaml removals: {0}".F(
noInherit.Where(x => !x.Value).JoinWith(", ")));
return ret;
}
public static MiniYaml MergeLiberal(MiniYaml a, MiniYaml b)
{
return Merge(a, b, false);
}
public static MiniYaml MergeLiberal(MiniYaml a, MiniYaml b)
{
return Merge(a, b, false);
}
public static MiniYaml MergeStrict(MiniYaml a, MiniYaml b)
{
return Merge(a, b, true);
}
public static MiniYaml MergeStrict(MiniYaml a, MiniYaml b)
{
return Merge(a, b, true);
}
static MiniYaml Merge( MiniYaml a, MiniYaml b, bool throwErrors )
{
@@ -271,9 +271,9 @@ namespace OpenRA.FileFormats
public static string WriteToString(this MiniYamlNodes y)
{
return string.Join("\n", y.ToLines(true).Select(x => x.TrimEnd()).ToArray());
return y.ToLines(true).Select(x => x.TrimEnd()).JoinWith("\n");
}
public static IEnumerable<string> ToLines(this MiniYamlNodes y, bool lowest)
{
foreach (var kv in y)
@@ -286,8 +286,8 @@ namespace OpenRA.FileFormats
}
}
public class YamlException : Exception
{
public YamlException(string s) : base(s) { }
}
public class YamlException : Exception
{
public YamlException(string s) : base(s) { }
}
}

View File

@@ -1,18 +1,16 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Linq;
namespace OpenRA.FileFormats
{
@@ -24,7 +22,6 @@ namespace OpenRA.FileFormats
public string Version;
public string Author;
public string Requires;
public bool Standalone = false;
public static readonly Dictionary<string, Mod> AllMods = ValidateMods(Directory.GetDirectories("mods").Select(x => x.Substring(5)).ToArray());
@@ -33,17 +30,27 @@ namespace OpenRA.FileFormats
var ret = new Dictionary<string, Mod>();
foreach (var m in mods)
{
if (!File.Exists("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml"))
var yamlPath = new[] { "mods", m, "mod.yaml" }.Aggregate( Path.Combine );
if (!File.Exists(yamlPath))
continue;
var yaml = new MiniYaml(null, MiniYaml.FromFile("mods" + Path.DirectorySeparatorChar + m + Path.DirectorySeparatorChar + "mod.yaml"));
var yaml = new MiniYaml(null, MiniYaml.FromFile(yamlPath));
if (!yaml.NodesDict.ContainsKey("Metadata"))
continue;
ret.Add(m, FieldLoader.Load<Mod>(yaml.NodesDict["Metadata"]));
ret[m].Id = m;
var mod = FieldLoader.Load<Mod>(yaml.NodesDict["Metadata"]);
mod.Id = m;
ret.Add(m, mod);
}
return ret;
}
public string[] WithPrerequisites()
{
return Id.Iterate(m => AllMods[m].Requires)
.TakeWhile(m => m != null)
.ToArray();
}
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -60,17 +60,38 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ColorHSLR.cs" />
<Compile Include="ColorRamp.cs" />
<Compile Include="Evaluator.cs" />
<Compile Include="Exts.cs" />
<Compile Include="FieldLoader.cs" />
<Compile Include="FileFormats\AudLoader.cs" />
<Compile Include="FileFormats\Blast.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="FileFormats\Format2.cs" />
<Compile Include="FileFormats\Format40.cs" />
<Compile Include="FileFormats\Format80.cs" />
<Compile Include="FileFormats\IniFile.cs" />
<Compile Include="Filesystem\FileSystem.cs" />
<Compile Include="Filesystem\Folder.cs" />
<Compile Include="Filesystem\InstallShieldPackage.cs" />
<Compile Include="Filesystem\MixFile.cs" />
<Compile Include="Filesystem\ZipFile.cs" />
<Compile Include="Graphics\Dune2ShpReader.cs" />
<Compile Include="Graphics\IGraphicsDevice.cs" />
<Compile Include="Graphics\IInputHandler.cs" />
<Compile Include="Graphics\PngLoader.cs" />
<Compile Include="Graphics\ShpReader.cs" />
<Compile Include="Graphics\ShpWriter.cs" />
<Compile Include="Graphics\Vertex.cs" />
<Compile Include="HttpUtil.cs" />
<Compile Include="Graphics\VqaReader.cs" />
<Compile Include="InstallUtils.cs" />
<Compile Include="Manifest.cs" />
<Compile Include="Map\PlayerReference.cs" />
<Compile Include="Map\SmudgeReference.cs" />
<Compile Include="Map\Terrain.cs" />
<Compile Include="Map\TileReference.cs" />
<Compile Include="Map\TileSet.cs" />
<Compile Include="MiniYaml.cs" />
<Compile Include="Mod.cs" />
<Compile Include="PackageEntry.cs" />
@@ -78,43 +99,22 @@
<Compile Include="Platform.cs" />
<Compile Include="PlayerColorRemap.cs" />
<Compile Include="Primitives\ActionQueue.cs" />
<Compile Include="Primitives\Bits.cs" />
<Compile Include="Primitives\Cache.cs" />
<Compile Include="Primitives\Cached.cs" />
<Compile Include="Primitives\DisposableAction.cs" />
<Compile Include="Primitives\Lazy.cs" />
<Compile Include="Primitives\Pair.cs" />
<Compile Include="Primitives\PriorityQueue.cs" />
<Compile Include="Primitives\Set.cs" />
<Compile Include="Primitives\float2.cs" />
<Compile Include="Primitives\int2.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Thirdparty\Random.cs" />
<Compile Include="Support\Log.cs" />
<Compile Include="Support\Stopwatch.cs" />
<Compile Include="Support\Timer.cs" />
<Compile Include="Thirdparty\Random.cs" />
<Compile Include="TypeDictionary.cs" />
<Compile Include="Map\TileReference.cs" />
<Compile Include="Map\Terrain.cs" />
<Compile Include="Primitives\Cache.cs" />
<Compile Include="Primitives\float2.cs" />
<Compile Include="Primitives\Pair.cs" />
<Compile Include="Map\TileSet.cs" />
<Compile Include="Primitives\PriorityQueue.cs" />
<Compile Include="Primitives\Lazy.cs" />
<Compile Include="FileFormats\AudLoader.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="Primitives\Set.cs" />
<Compile Include="Graphics\Dune2ShpReader.cs" />
<Compile Include="FileFormats\Format2.cs" />
<Compile Include="FileFormats\Format40.cs" />
<Compile Include="FileFormats\Format80.cs" />
<Compile Include="FileFormats\IniFile.cs" />
<Compile Include="Graphics\ShpReader.cs" />
<Compile Include="Primitives\int2.cs" />
<Compile Include="Map\SmudgeReference.cs" />
<Compile Include="Map\PlayerReference.cs" />
<Compile Include="Graphics\VqaReader.cs" />
<Compile Include="Filesystem\MixFile.cs" />
<Compile Include="Filesystem\FileSystem.cs" />
<Compile Include="Filesystem\Folder.cs" />
<Compile Include="Filesystem\InstallShieldPackage.cs" />
<Compile Include="FileFormats\Blast.cs" />
<Compile Include="Filesystem\ZipFile.cs" />
<Compile Include="InstallUtils.cs" />
<Compile Include="Primitives\Cached.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -20,21 +20,21 @@ namespace OpenRA.FileFormats
public readonly uint Offset;
public readonly uint Length;
public PackageEntry(uint hash, uint offset, uint length)
{
Hash = hash;
Offset = offset;
Length = length;
}
public PackageEntry(BinaryReader r)
{
Hash = r.ReadUInt32();
Offset = r.ReadUInt32();
Length = r.ReadUInt32();
}
public void Write(BinaryWriter w)
{
w.Write(Hash);
@@ -63,7 +63,7 @@ namespace OpenRA.FileFormats
MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
BinaryReader reader = new BinaryReader(ms);
int len = name.Length >> 2;
int len = name.Length >> 2;
uint result = 0;
while (len-- != 0)
@@ -73,7 +73,7 @@ namespace OpenRA.FileFormats
}
static Dictionary<uint, string> Names = new Dictionary<uint,string>();
public static void AddStandardName(string s)
{
uint hash = HashFilename(s);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -11,6 +11,8 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System;
using System.Reflection;
namespace OpenRA.FileFormats
{
@@ -21,26 +23,26 @@ namespace OpenRA.FileFormats
{
return Color.FromArgb((int)colors[index]);
}
public void SetColor(int index, Color color)
{
colors[index] = (uint)color.ToArgb();
}
public void SetColor(int index, uint color)
{
colors[index] = (uint)color;
}
public uint[] Values
{
{
get { return colors; }
}
public Palette(Stream s, bool remapTransparent)
{
colors = new uint[256];
using (BinaryReader reader = new BinaryReader(s))
{
for (int i = 0; i < 256; i++)
@@ -67,22 +69,34 @@ namespace OpenRA.FileFormats
for(int i = 0; i < 256; i++)
colors[i] = (uint)r.GetRemappedColor(Color.FromArgb((int)p.colors[i]),i).ToArgb();
}
public Palette(Palette p)
{
colors = (uint[])p.colors.Clone();
}
public ColorPalette AsSystemPalette()
{
ColorPalette pal;
using (var b = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
pal = b.Palette;
for (var i = 0; i < 256; i++)
pal.Entries[i] = GetColor(i);
// hack around a mono bug -- the palette flags get set wrong.
if (Platform.CurrentPlatform != PlatformType.Windows)
typeof(ColorPalette).GetField("flags",
BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pal, 1);
return pal;
}
public static Palette Load( string filename, bool remap )
{
using(var s = File.OpenRead(filename))
return new Palette(s, remap);
}
}
public interface IPaletteRemap { Color GetRemappedColor(Color original, int index); }

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -15,30 +15,19 @@ using OpenRA.FileFormats;
namespace OpenRA
{
public enum PlatformType
{
Unknown,
Windows,
OSX,
Linux
}
public enum PlatformType { Unknown, Windows, OSX, Linux }
public static class Platform
{
public static PlatformType CurrentPlatform
{
get
{
return currentPlatform.Value;
}
}
public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } }
static Lazy<PlatformType> currentPlatform = Lazy.New((Func<PlatformType>)GetCurrentPlatform);
static Lazy<PlatformType> currentPlatform = new Lazy<PlatformType>(GetCurrentPlatform);
static PlatformType GetCurrentPlatform()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT) return PlatformType.Windows;
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
return PlatformType.Windows;
try
{
var psi = new ProcessStartInfo("uname", "-s");
@@ -52,26 +41,28 @@ namespace OpenRA
return PlatformType.OSX;
}
catch { }
return PlatformType.Unknown;
}
public static string SupportDir
{
get
get
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
switch (CurrentPlatform)
{
case PlatformType.OSX:
dir += "/Library/Application Support/OpenRA";
break;
case PlatformType.Linux:
dir += "/.openra";
break;
default:
dir += Path.DirectorySeparatorChar + "OpenRA";
break;
case PlatformType.Windows:
dir += Path.DirectorySeparatorChar + "OpenRA";
break;
case PlatformType.OSX:
dir += "/Library/Application Support/OpenRA";
break;
case PlatformType.Linux:
default:
dir += "/.openra";
break;
}
if (!Directory.Exists(dir))

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -21,10 +21,10 @@ namespace OpenRA.FileFormats
{
Dictionary<int, Color> remapColors;
public PlayerColorRemap(ColorRamp c, PaletteFormat fmt)
public PlayerColorRemap(PaletteFormat fmt, ColorRamp c)
{
var c1 = c.GetColor(0);
var c2 = c.GetColor(1); /* temptemp: this can be expressed better */
var c1 = c.GetColor(0);
var c2 = c.GetColor(1); /* temptemp: this can be expressed better */
var baseIndex = (fmt == PaletteFormat.cnc) ? 0xb0 : (fmt == PaletteFormat.d2k) ? 240 : 80;
var ramp = (fmt == PaletteFormat.cnc)
@@ -42,11 +42,11 @@ namespace OpenRA.FileFormats
(int)(t * c2.G + (1 - t) * c1.G),
(int)(t * c2.B + (1 - t) * c1.B));
}
public Color GetRemappedColor(Color original, int index)
{
Color c;
return remapColors.TryGetValue(index, out c)
return remapColors.TryGetValue(index, out c)
? c : original;
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -18,23 +18,45 @@ namespace OpenRA.FileFormats
public class ActionQueue
{
object syncRoot = new object();
Action actions = () => { };
PriorityQueue<DelayedAction> actions = new PriorityQueue<DelayedAction>();
public void Add(Action a)
public void Add(Action a) { Add(a, 0); }
public void Add(Action a, int delay)
{
lock (syncRoot)
actions += a;
actions.Add(new DelayedAction(a, Environment.TickCount + delay));
}
public void PerformActions()
{
Action a;
Action a = () => {};
lock (syncRoot)
{
a = actions;
actions = () => { };
var t = Environment.TickCount;
while (!actions.Empty && actions.Peek().Time <= t)
{
var da = actions.Pop();
a += da.Action;
}
}
a();
}
}
struct DelayedAction : IComparable<DelayedAction>
{
public int Time;
public Action Action;
public DelayedAction(Action action, int time)
{
Action = action;
Time = time;
}
public int CompareTo(DelayedAction other)
{
return Math.Sign(Time - other.Time);
}
}
}

View File

@@ -0,0 +1,65 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenRA.FileFormats
{
static class BitAllocator<T> where T : struct
{
static int nextVal = 1;
static Cache<string,int> bits;
static BitAllocator() { bits = new Cache<string, int>( _ => Allocate() ); }
static int Allocate()
{
if (nextVal == 0)
throw new InvalidOperationException(
"Too many values in BitAllocator<{0}>".F(typeof(T).Name));
var val = nextVal;
nextVal <<= 1;
return val;
}
public static int GetValue(string[] val)
{
return val.Select( a => bits[a] ).Aggregate( 0, (a,b) => a | b );
}
public static IEnumerable<string> GetStrings(int val)
{
for( var i = 0; i < 32; i++ )
{
var x = 1 << i;
if ((val & x) != 0)
yield return bits.Single( a => a.Value == x ).Key;
}
}
}
public struct Bits<T> where T : struct
{
public int Value;
public Bits(string[] val) { Value = BitAllocator<T>.GetValue(val); }
public Bits(Bits<T> other) { Value = other.Value; }
public override string ToString()
{
return BitAllocator<T>.GetStrings(Value).JoinWith(",");
}
public override int GetHashCode() { return Value.GetHashCode(); }
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -39,13 +39,8 @@ namespace OpenRA.FileFormats
}
}
public void Force()
{
#pragma warning disable 0168
var ignored = Value;
#pragma warning restore 0168
}
public T Force() { return Value; }
public void Invalidate()
{
hasValue = false;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -38,12 +38,7 @@ namespace OpenRA.FileFormats
}
}
public void Force()
{
#pragma warning disable 0168
var ignored = Value;
#pragma warning restore 0168
}
public T Force() { return Value; }
}
public static class Lazy

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -71,10 +71,10 @@ namespace OpenRA.FileFormats
public static IEqualityComparer<Pair<T, U>> EqualityComparer { get { return new PairEqualityComparer(); } }
}
public static class Pair
{
public static class Pair
{
public static Pair<T, U> New<T, U>(T t, U u) { return new Pair<T, U>(t, u); }
static Pair()
{
Pair<char,Color>.uc = new ColorEqualityComparer();
@@ -86,5 +86,5 @@ namespace OpenRA.FileFormats
public bool Equals(Color x, Color y) { return x.ToArgb() == y.ToArgb(); }
public int GetHashCode(Color obj) { return obj.GetHashCode(); }
}
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -62,6 +62,7 @@ namespace OpenRA.FileFormats
return At(lastLevel, lastIndex);
}
public T Peek() { return At(0,0); }
public T Pop()
{
if (level == 0 && index == 0)

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -62,23 +62,23 @@ namespace OpenRA
Constrain(Y, min.Y, max.Y));
}
public static float2 operator *(float a, float2 b) { return new float2(a * b.X, a * b.Y); }
public static float2 operator *(float2 b, float a) { return new float2(a * b.X, a * b.Y); }
public static float2 operator *(float a, float2 b) { return new float2(a * b.X, a * b.Y); }
public static float2 operator *(float2 b, float a) { return new float2(a * b.X, a * b.Y); }
public static float2 operator *( float2 a, float2 b ) { return new float2( a.X * b.X, a.Y * b.Y ); }
public static float2 operator /( float2 a, float2 b ) { return new float2( a.X / b.X, a.Y / b.Y ); }
public static bool operator ==(float2 me, float2 other) { return (me.X == other.X && me.Y == other.Y); }
public static bool operator !=(float2 me, float2 other) { return !(me == other); }
public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode(); }
public static bool operator ==(float2 me, float2 other) { return (me.X == other.X && me.Y == other.Y); }
public static bool operator !=(float2 me, float2 other) { return !(me == other); }
public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode(); }
public override bool Equals(object obj)
{
if (obj == null)
return false;
public override bool Equals(object obj)
{
if (obj == null)
return false;
float2 o = (float2)obj;
return o == this;
}
float2 o = (float2)obj;
return o == this;
}
public static readonly float2 Zero = new float2(0, 0);

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -52,11 +52,11 @@ namespace OpenRA
public static readonly int2 Zero = new int2(0, 0);
public Point ToPoint() { return new Point(X, Y); }
public PointF ToPointF() { return new PointF(X, Y); }
public PointF ToPointF() { return new PointF(X, Y); }
public float2 ToFloat2() { return new float2(X, Y); }
public override string ToString() { return string.Format("{0},{1}", X, Y); }
// Change endianness of a uint32
public static uint Swap(uint orig)
{
@@ -72,13 +72,13 @@ namespace OpenRA
{
return a + ( b - a ) * mul / div;
}
public int2 Clamp(Rectangle r)
{
return new int2(Math.Min(r.Right, Math.Max(X, r.Left)),
Math.Min(r.Bottom, Math.Max(Y, r.Top)));
Math.Min(r.Bottom, Math.Max(Y, r.Top)));
}
public static int Dot(int2 a, int2 b) { return a.X * b.X + a.Y * b.Y; }
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -33,39 +33,39 @@ namespace OpenRA
get { return LogPathPrefix; }
set
{
LogPathPrefix = value;
LogPathPrefix = value;
Directory.CreateDirectory(LogPathPrefix);
}
}
static IEnumerable<string> FilenamesForChannel(string channelName, string baseFilename)
{
for(var i = 0;; i++ )
yield return Path.Combine(LogPathPrefix,
i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename);
}
static IEnumerable<string> FilenamesForChannel(string channelName, string baseFilename)
{
for(var i = 0;; i++ )
yield return Path.Combine(LogPathPrefix,
i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename);
}
public static void AddChannel(string channelName, string baseFilename)
{
if (channels.ContainsKey(channelName)) return;
public static void AddChannel(string channelName, string baseFilename)
{
if (channels.ContainsKey(channelName)) return;
foreach (var filename in FilenamesForChannel(channelName, baseFilename))
try
{
var writer = File.CreateText(filename);
writer.AutoFlush = true;
foreach (var filename in FilenamesForChannel(channelName, baseFilename))
try
{
var writer = File.CreateText(filename);
writer.AutoFlush = true;
channels.Add(channelName,
new ChannelInfo()
{
Filename = filename,
Writer = writer
});
channels.Add(channelName,
new ChannelInfo()
{
Filename = filename,
Writer = writer
});
return;
}
catch (IOException) { }
}
return;
}
catch (IOException) { }
}
public static void Write(string channel, string format, params object[] args)
{

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -18,11 +18,11 @@ namespace OpenRA.Thirdparty
{
uint[] mt = new uint[624];
int index = 0;
public int Last;
public Random() : this(Environment.TickCount) { }
public Random(int seed)
{
mt[0] = (uint)seed;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -64,13 +64,18 @@ namespace OpenRA.FileFormats
public T GetOrDefault<T>()
{
if( dataMultiple.ContainsKey( typeof( T ) ) )
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", typeof( T ) ) );
return (T)GetOrDefault(typeof(T));
}
public object GetOrDefault(Type t)
{
if( dataMultiple.ContainsKey(t) )
throw new InvalidOperationException( string.Format( "TypeDictionary contains multiple instance of type `{0}`", t ) );
object ret;
if( !dataSingular.TryGetValue( typeof( T ), out ret ) )
return default( T );
return (T)ret;
if( !dataSingular.TryGetValue(t, out ret ) )
return null;
return ret;
}
public IEnumerable<T> WithInterface<T>()

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -14,7 +14,6 @@ using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
namespace OpenRA
{
@@ -24,31 +23,31 @@ namespace OpenRA
public readonly World World;
public readonly uint ActorID;
IOccupySpace OccupiesSpace;
Lazy<IOccupySpace> occupySpace;
IHasLocation HasLocation;
Lazy<IMove> Move;
public Cached<Rectangle> Bounds;
public Cached<Rectangle> ExtendedBounds;
public int2 Location
{ get {
if (OccupiesSpace == null)
OccupiesSpace = Trait<IOccupySpace>();
return OccupiesSpace.TopLeft;
}}
public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } }
public int2 Location { get { return occupySpace.Value.TopLeft; } }
public int2 CenterLocation
{ get {
if (HasLocation == null)
HasLocation = Trait<IHasLocation>();
return HasLocation.PxPosition;
}}
{
get
{
if (HasLocation == null)
HasLocation = Trait<IHasLocation>();
return HasLocation.PxPosition;
}
}
[Sync]
public Player Owner;
private Activity currentActivity;
Activity currentActivity;
public Group Group;
internal Actor(World world, string name, TypeDictionary initDict )
@@ -60,6 +59,8 @@ namespace OpenRA
if( initDict.Contains<OwnerInit>() )
Owner = init.Get<OwnerInit,Player>();
occupySpace = Lazy.New( () => TraitOrDefault<IOccupySpace>() );
if (name != null)
{
if (!Rules.Info.ContainsKey(name.ToLowerInvariant()))
@@ -69,7 +70,7 @@ namespace OpenRA
foreach (var trait in Info.TraitsInConstructOrder())
AddTrait(trait.Create(init));
}
Move = Lazy.New( () => TraitOrDefault<IMove>() );
Size = Lazy.New(() =>
@@ -81,12 +82,12 @@ namespace OpenRA
// auto size from render
var firstSprite = TraitsImplementing<IRender>().SelectMany(ApplyIRender).FirstOrDefault();
if (firstSprite.Sprite == null) return int2.Zero;
return (firstSprite.Sprite.size * firstSprite.Scale).ToInt2();
return (firstSprite.Sprite.size * firstSprite.Scale).ToInt2();
});
ApplyIRender = x => x.Render(this);
ApplyRenderModifier = (m, p) => p.ModifyRender(this, m);
Bounds = Cached.New( () => CalculateBounds(false) );
ExtendedBounds = Cached.New( () => CalculateBounds(true) );
}
@@ -95,7 +96,7 @@ namespace OpenRA
{
Bounds.Invalidate();
ExtendedBounds.Invalidate();
currentActivity = Util.RunActivity( this, currentActivity );
}
@@ -104,7 +105,7 @@ namespace OpenRA
get { return currentActivity == null; }
}
OpenRA.FileFormats.Lazy<int2> Size;
OpenRA.FileFormats.Lazy<int2> Size;
// note: these delegates are cached to avoid massive allocation.
Func<IRender, IEnumerable<Renderable>> ApplyIRender;
@@ -115,7 +116,7 @@ namespace OpenRA
var sprites = TraitsImplementing<IRender>().SelectMany(ApplyIRender);
return mods.Aggregate(sprites, ApplyRenderModifier);
}
// When useAltitude = true, the bounding box is extended
// vertically to altitude = 0 to support FindUnitsInCircle queries
// When false, the bounding box is given for the actor
@@ -124,7 +125,7 @@ namespace OpenRA
{
var size = Size.Value;
var loc = CenterLocation - size / 2;
var si = Info.Traits.GetOrDefault<SelectableInfo>();
if (si != null && si.Bounds != null && si.Bounds.Length > 2)
{
@@ -139,7 +140,7 @@ namespace OpenRA
if (useAltitude)
size = new int2(size.X, size.Y + move.Altitude);
}
return new Rectangle(loc.X, loc.Y, size.X, size.Y);
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -17,6 +17,7 @@ namespace OpenRA
{
public readonly Actor self;
public World world { get { return self.World; } }
internal TypeDictionary dict;
public ActorInitializer( Actor actor, TypeDictionary dict )
@@ -25,101 +26,67 @@ namespace OpenRA
this.dict = dict;
}
public T Get<T>()
where T : IActorInit
{
return dict.Get<T>();
}
public U Get<T,U>()
where T : IActorInit<U>
{
return dict.Get<T>().Value( world );
}
public bool Contains<T>()
where T : IActorInit
{
return dict.Contains<T>();
}
public T Get<T>() where T : IActorInit { return dict.Get<T>(); }
public U Get<T,U>() where T : IActorInit<U> { return dict.Get<T>().Value( world ); }
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
}
public interface IActorInit {}
public interface IActorInit<T> : IActorInit
{
T Value( World world );
}
public class FacingInit : IActorInit<int>
{
[FieldFromYamlKey]
public readonly int value = 128;
[FieldFromYamlKey] public readonly int value = 128;
public FacingInit() { }
public FacingInit( int init )
{
value = init;
}
public int Value( World world )
{
return value;
}
public FacingInit( int init ) { value = init; }
public int Value( World world ) { return value; }
}
public class TurretFacingInit : IActorInit<int>
{
[FieldFromYamlKey] public readonly int value = 128;
public TurretFacingInit() { }
public TurretFacingInit( int init ) { value = init; }
public int Value( World world ) { return value; }
}
public class AltitudeInit : IActorInit<int>
{
[FieldFromYamlKey]
public readonly int value = 0;
[FieldFromYamlKey] public readonly int value = 0;
public AltitudeInit() { }
public AltitudeInit( int init )
{
value = init;
}
public int Value( World world )
{
return value;
}
public AltitudeInit( int init ) { value = init; }
public int Value( World world ) { return value; }
}
public class LocationInit : IActorInit<int2>
{
[FieldFromYamlKey]
public readonly int2 value = int2.Zero;
[FieldFromYamlKey] public readonly int2 value = int2.Zero;
public LocationInit() { }
public LocationInit( int2 init ) { value = init; }
public int2 Value( World world ) { return value; }
}
public LocationInit( int2 init )
{
value = init;
}
public int2 Value( World world )
{
return value;
}
public class CenterLocationInit : IActorInit<int2>
{
[FieldFromYamlKey] public readonly int2 value = int2.Zero;
public CenterLocationInit() { }
public CenterLocationInit( int2 init ) { value = init; }
public int2 Value( World world ) { return value; }
}
public class OwnerInit : IActorInit<Player>
{
[FieldFromYamlKey]
public readonly string PlayerName = "Neutral";
[FieldFromYamlKey] public readonly string PlayerName = "Neutral";
Player player;
public OwnerInit() { }
public OwnerInit( string playerName ) { this.PlayerName = playerName; }
public OwnerInit( string playerName )
{
this.PlayerName = playerName;
}
public OwnerInit( Player player )
{
public OwnerInit( Player player ) {
this.player = player;
this.PlayerName = player.InternalName;
}
@@ -128,7 +95,7 @@ namespace OpenRA
{
if( player != null )
return player;
return world.players.Values.First( x => x.InternalName == PlayerName );
return world.Players.First( x => x.InternalName == PlayerName );
}
}
}

View File

@@ -1,32 +1,21 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Traits;
namespace OpenRA
{
public enum SubCell
{
FullCell,
TopLeft,
TopRight,
Center,
BottomLeft,
BottomRight
}
public enum SubCell { FullCell, TopLeft, TopRight, Center, BottomLeft, BottomRight }
public class ActorMap
{
class InfluenceNode
@@ -35,7 +24,7 @@ namespace OpenRA
public SubCell subCell;
public Actor actor;
}
InfluenceNode[,] influence;
Map map;
@@ -44,8 +33,8 @@ namespace OpenRA
map = world.Map;
influence = new InfluenceNode[world.Map.MapSize.X, world.Map.MapSize.Y];
world.ActorAdded += a => Add( a, a.TraitOrDefault<IOccupySpace>() );
world.ActorRemoved += a => Remove( a, a.TraitOrDefault<IOccupySpace>() );
world.ActorAdded += a => Add( a, a.OccupiesSpace );
world.ActorRemoved += a => Remove( a, a.OccupiesSpace );
}
public IEnumerable<Actor> GetUnitsAt( int2 a )
@@ -56,7 +45,7 @@ namespace OpenRA
if (!i.actor.Destroyed)
yield return i.actor;
}
public IEnumerable<Actor> GetUnitsAt( int2 a, SubCell sub )
{
if (!map.IsInMap(a)) yield break;
@@ -65,23 +54,23 @@ namespace OpenRA
if (!i.actor.Destroyed && (i.subCell == sub || i.subCell == SubCell.FullCell))
yield return i.actor;
}
public bool HasFreeSubCell(int2 a)
{
if (!AnyUnitsAt(a))
return true;
return new[]{SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
SubCell.BottomLeft, SubCell.BottomRight}.Any(b => !AnyUnitsAt(a,b));
return new[]{ SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
SubCell.BottomLeft, SubCell.BottomRight }.Any(b => !AnyUnitsAt(a,b));
}
public bool AnyUnitsAt(int2 a)
{
return influence[ a.X, a.Y ] != null;
}
public bool AnyUnitsAt(int2 a, SubCell sub)
{
{
for( var i = influence[ a.X, a.Y ] ; i != null ; i = i.next )
if (i.subCell == sub || i.subCell == SubCell.FullCell)
return true;

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -15,8 +15,8 @@ namespace OpenRA.FileFormats
{
public class ActorReference : IEnumerable
{
public readonly string Type;
public readonly TypeDictionary InitDict;
public string Type;
public TypeDictionary InitDict;
public ActorReference( string type ) : this( type, new Dictionary<string, MiniYaml>() ) { }

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -18,33 +18,33 @@ namespace OpenRA
{
WebClient wc;
bool cancelled;
public Download(string url, string path, Action<DownloadProgressChangedEventArgs> onProgress, Action<AsyncCompletedEventArgs, bool> onComplete)
{
wc = new WebClient();
wc.Proxy = null;
wc.DownloadProgressChanged += (_,a) => onProgress(a);
wc.DownloadFileCompleted += (_,a) => onComplete(a, cancelled);
Game.OnQuit += () => Cancel();
wc.DownloadFileCompleted += (_,a) => {Game.OnQuit -= () => Cancel();};
wc.DownloadFileAsync(new Uri(url), path);
wc.DownloadFileAsync(new Uri(url), path);
}
public void Cancel()
{
Game.OnQuit -= () => Cancel();
wc.CancelAsync();
cancelled = true;
}
public static string FormatErrorMessage(Exception e)
{
var ex = e as System.Net.WebException;
if (ex == null) return e.Message;
switch(ex.Status)
{
case WebExceptionStatus.NameResolutionFailure:

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -36,7 +36,7 @@ namespace OpenRA.Effects
{
if (!target.IsInWorld)
yield break;
if (remainingTicks % 2 == 0)
foreach (var r in target.Render())
yield return r.WithPalette("highlight");

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -27,12 +27,10 @@ namespace OpenRA
{
public static class Game
{
public static Utilities Utilities;
public static int CellSize { get { return modData.Manifest.TileSize; } }
public static ModData modData;
private static WorldRenderer worldRenderer;
static WorldRenderer worldRenderer;
public static Viewport viewport;
public static Settings Settings;
@@ -57,9 +55,9 @@ namespace OpenRA
if( !Directory.Exists( path ) ) Directory.CreateDirectory( path );
var replayFile = File.Create( Path.Combine( path, replayFilename ) );
JoinInner(new OrderManager(host, port,
JoinInner(new OrderManager(host, port,
new ReplayRecorderConnection(new NetworkConnection(host, port), replayFile)));
}
}
static string ChooseReplayFilename()
{
@@ -92,14 +90,14 @@ namespace OpenRA
public static event Action<OrderManager> ConnectionStateChanged = _ => { };
static ConnectionState lastConnectionState = ConnectionState.PreConnecting;
public static int LocalClientId { get { return orderManager.Connection.LocalClientId; } }
// Hacky workaround for orderManager visibility
public static Widget OpenWindow(World world, string widget)
{
return Widget.OpenWindow(widget, new WidgetArgs() {{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }});
}
// Who came up with the great idea of making these things
// impossible for the things that want them to access them directly?
public static Widget OpenWindow(string widget, WidgetArgs args)
@@ -111,7 +109,7 @@ namespace OpenRA
{ "worldRenderer", worldRenderer },
});
}
// Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree
public static Widget LoadWidget(World world, string id, Widget parent, WidgetArgs args)
{
@@ -123,8 +121,9 @@ namespace OpenRA
}, parent, id);
}
static ActionQueue afterTickActions = new ActionQueue();
public static void RunAfterTick(Action a) { afterTickActions.Add(a); }
static ActionQueue delayedActions = new ActionQueue();
public static void RunAfterTick(Action a) { delayedActions.Add(a); }
public static void RunAfterDelay(int delay, Action a) { delayedActions.Add(a, delay); }
static void Tick( OrderManager orderManager, Viewport viewPort )
{
@@ -142,7 +141,7 @@ namespace OpenRA
{
++RenderFrame;
viewport.DrawRegions(worldRenderer, new DefaultInputHandler( orderManager.world ));
Sound.SetListenerPosition(viewport.Location + .5f * new float2(viewport.Width, viewport.Height));
Sound.SetListenerPosition(viewport.CenterLocation);
}
PerfHistory.items["render"].Tick();
@@ -150,7 +149,7 @@ namespace OpenRA
PerfHistory.items["render_widgets"].Tick();
PerfHistory.items["render_flip"].Tick();
afterTickActions.PerformActions();
delayedActions.PerformActions();
}
static void Tick( OrderManager orderManager )
@@ -163,7 +162,7 @@ namespace OpenRA
orderManager.LastTickTime += Settings.Game.Timestep;
Widget.DoTick();
var world = orderManager.world;
if( orderManager.GameStarted && world.LocalPlayer != null )
if (orderManager.GameStarted)
++Viewport.TicksSinceLastMove;
Sound.Tick();
Sync.CheckSyncUnchanged( world, () => { orderManager.TickImmediate(); } );
@@ -206,13 +205,13 @@ namespace OpenRA
}
public static event Action BeforeGameStart = () => {};
internal static void StartGame(string mapUID)
internal static void StartGame(string mapUID, bool isShellmap)
{
BeforeGameStart();
var map = modData.PrepareMap(mapUID);
viewport = new Viewport(new int2(Renderer.Resolution), map.Bounds, Renderer);
orderManager.world = new World(modData.Manifest, map, orderManager);
orderManager.world = new World(modData.Manifest, map, orderManager) { IsShellmap = isShellmap };
worldRenderer = new WorldRenderer(orderManager.world);
if (orderManager.GameStarted) return;
@@ -228,7 +227,7 @@ namespace OpenRA
{
get { return orderManager.Connection.LocalClientId == 0; }
}
public static Dictionary<String, Mod> CurrentMods
{
get { return Mod.AllMods.Where( k => modData.Manifest.Mods.Contains( k.Key )).ToDictionary( k => k.Key, k => k.Value ); }
@@ -244,8 +243,6 @@ namespace OpenRA
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
Utilities = new Utilities(args.GetValue("UtilityPath", "OpenRA.Utility.exe"));
Settings = new Settings(Platform.SupportDir + "settings.yaml", args);
Settings.Save();
@@ -257,15 +254,15 @@ namespace OpenRA
FileSystem.Mount("."); // Needed to access shaders
Renderer.Initialize( Game.Settings.Graphics.Mode );
Renderer = new Renderer();
Console.WriteLine("Available mods:");
foreach(var mod in Mod.AllMods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
Sound.Create();
InitializeWithMods(Settings.Game.Mods);
}
public static void InitializeWithMods(string[] mods)
{
// Clear static state if we have switched mods
@@ -280,22 +277,22 @@ namespace OpenRA
server.Shutdown();
if (orderManager != null)
orderManager.Dispose();
// Discard any invalid mods
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
Console.WriteLine("Loading mods: {0}", mm.JoinWith(","));
Settings.Game.Mods = mm;
Settings.Save();
Sound.StopMusic();
Sound.StopVideo();
Sound.Initialize();
modData = new ModData( mm );
Renderer.InitializeFonts(modData.Manifest);
modData.LoadInitialAssets();
PerfHistory.items["render"].hasNormalTick = false;
PerfHistory.items["batches"].hasNormalTick = false;
PerfHistory.items["render_widgets"].hasNormalTick = false;
@@ -303,33 +300,46 @@ namespace OpenRA
JoinLocal();
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);
modData.LoadScreen.StartGame();
}
public static void LoadShellMap()
{
StartGame(ChooseShellmap());
StartGame(ChooseShellmap(), true);
}
static string ChooseShellmap()
{
var shellmaps = modData.AvailableMaps
.Where(m => m.Value.UseAsShellmap);
static string ChooseShellmap()
{
var shellmaps = modData.AvailableMaps
.Where(m => m.Value.UseAsShellmap);
if (shellmaps.Count() == 0)
throw new InvalidDataException("No valid shellmaps available");
return shellmaps.Random(CosmeticRandom).Key;
}
}
static bool quit;
public static event Action OnQuit = () => {};
internal static void Run()
{
while (!quit)
{
var idealFrameTime = 1.0 / Settings.Graphics.MaxFramerate;
var sw = new Stopwatch();
Tick( orderManager, viewport );
if (Settings.Graphics.CapFramerate)
{
var waitTime = idealFrameTime - sw.ElapsedTime();
if (waitTime > 0)
System.Threading.Thread.Sleep( TimeSpan.FromSeconds(waitTime) );
}
}
OnQuit();
}
@@ -339,18 +349,19 @@ namespace OpenRA
public static void Debug(string s, params object[] args)
{
AddChatLine(Color.White, "Debug", String.Format(s,args));
AddChatLine(Color.White, "Debug", String.Format(s,args));
}
public static void Disconnect()
{
if (orderManager.world != null)
orderManager.world.traitDict.PrintReport();
orderManager.Dispose();
CloseServer();
JoinLocal();
orderManager.Dispose();
}
public static void CloseServer()
{
if (server != null)
@@ -361,28 +372,28 @@ namespace OpenRA
{
return modData.ObjectCreator.CreateObject<T>( name );
}
public static void CreateServer(ServerSettings settings)
{
server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort),
Game.Settings.Game.Mods,
settings,
modData);
Game.Settings.Game.Mods, settings, modData);
}
public static int CreateLocalServer(string map)
{
var settings = new ServerSettings()
{
Name = "Skirmish Game",
AdvertiseOnline = false,
Map = map
};
// Work around a miscompile in mono 2.6.7:
// booleans that default to true cannot be set false by an initializer
settings.AdvertiseOnline = false;
server = new Server.Server(new IPEndPoint(IPAddress.Loopback, 0),
Game.Settings.Game.Mods,
settings,
modData);
Game.Settings.Game.Mods, settings, modData);
return server.Port;
}
@@ -390,5 +401,22 @@ namespace OpenRA
{
return orderManager != null && orderManager.world == world;
}
public static void JoinExternalGame()
{
var addressParts = Game.Settings.Game.ConnectTo.Split(
new [] { ':' }, StringSplitOptions.RemoveEmptyEntries);
if (addressParts.Length < 1 || addressParts.Length > 2)
return;
var host = addressParts[0];
var port = Exts.WithDefault(1234, () => int.Parse(addressParts[1]));
Game.Settings.Game.ConnectTo = "";
Game.Settings.Save();
Game.JoinServer(host, port);
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -23,30 +23,21 @@ namespace OpenRA
public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
{
try
{
var mergedNode = MergeWithParent(node, allUnits).NodesDict;
try
{
var mergedNode = MergeWithParent(node, allUnits).NodesDict;
Name = name;
foreach (var t in mergedNode)
if (t.Key != "Inherits" && !t.Key.StartsWith("-"))
Traits.Add(LoadTraitInfo(t.Key.Split('@')[0], t.Value));
}
catch (YamlException e)
{
throw new YamlException("Actor type {0}: {1}".F(name, e.Message));
}
Name = name;
foreach (var t in mergedNode)
if (t.Key != "Inherits" && !t.Key.StartsWith("-"))
Traits.Add(LoadTraitInfo(t.Key.Split('@')[0], t.Value));
}
catch (YamlException e)
{
throw new YamlException("Actor type {0}: {1}".F(name, e.Message));
}
}
static IEnumerable<MiniYaml> GetInheritanceChain(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
{
while (node != null)
{
yield return node;
node = GetParent(node, allUnits);
}
}
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
{
MiniYaml inherits;
@@ -56,9 +47,9 @@ namespace OpenRA
MiniYaml parent;
allUnits.TryGetValue( inherits.Value, out parent );
if (parent == null)
throw new InvalidOperationException(
"Bogus inheritance -- actor type {0} does not exist".F(inherits.Value));
if (parent == null)
throw new InvalidOperationException(
"Bogus inheritance -- actor type {0} does not exist".F(inherits.Value));
return parent;
}
@@ -66,14 +57,14 @@ namespace OpenRA
static MiniYaml MergeWithParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
{
var parent = GetParent( node, allUnits );
if (parent != null)
{
var result = MiniYaml.MergeStrict(node, MergeWithParent(parent, allUnits));
if (parent != null)
{
var result = MiniYaml.MergeStrict(node, MergeWithParent(parent, allUnits));
// strip the '-'
result.Nodes.RemoveAll(a => a.Key.StartsWith("-"));
return result;
}
// strip the '-'
result.Nodes.RemoveAll(a => a.Key.StartsWith("-"));
return result;
}
return node;
}
@@ -92,7 +83,7 @@ namespace OpenRA
while (t.Count != 0)
{
var prereqs = PrerequisitesOf(t[index]);
var unsatisfied = prereqs.Where(n => !ret.Any(x => x.GetType() == n || x.GetType().IsSubclassOf(n)));
var unsatisfied = prereqs.Where(n => !ret.Any(x => x.GetType() == n || n.IsAssignableFrom(x.GetType())));
if (!unsatisfied.Any())
{
ret.Add(t[index]);
@@ -102,14 +93,14 @@ namespace OpenRA
else if (++index >= t.Count)
throw new InvalidOperationException("Trait prerequisites not satisfied (or prerequisite loop) Actor={0} Unresolved={1} Missing={2}".F(
Name,
string.Join(",", t.Select(x => x.GetType().Name).ToArray()),
string.Join(",", unsatisfied.Select(x => x.Name).ToArray())));
t.Select(x => x.GetType().Name).JoinWith(","),
unsatisfied.Select(x => x.Name).JoinWith(",")));
}
return ret;
}
static List<Type> PrerequisitesOf( ITraitInfo info )
static List<Type> PrerequisitesOf(ITraitInfo info)
{
return info
.GetType()
@@ -118,5 +109,19 @@ namespace OpenRA
.Select( t => t.GetGenericArguments()[ 0 ] )
.ToList();
}
public IEnumerable<Pair<string, Type>> GetInitKeys()
{
var inits = Traits.WithInterface<ITraitInfo>().SelectMany(
t => t.GetType().GetInterfaces()
.Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(UsesInit<>))
.Select(i => i.GetGenericArguments()[0])).ToList();
inits.Add( typeof(OwnerInit) ); /* not exposed by a trait; this is used by the Actor itself */
return inits.Select(
i => Pair.New(
i.Name.Replace( "Init", "" ), i ));
}
}
}

View File

@@ -1,7 +1,7 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
@@ -21,21 +21,23 @@ namespace OpenRA.GameRules
public MusicInfo( string key, MiniYaml value )
{
Filename = key+".aud";
Title = value.Value;
var nd = value.NodesDict;
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
if (!FileSystem.Exists(Filename))
return;
Exists = true;
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
}
public void Reload()
{
if (!FileSystem.Exists(Filename))
return;
Exists = true;
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
}

Some files were not shown because too many files have changed in this diff Show More