Compare commits

...

895 Commits

Author SHA1 Message Date
Paul Chote
3deaf6c7bb Fix infantry idle animations playing immediately after creation. 2019-10-20 16:42:36 +02:00
Paul Chote
8bbf43f45d Don't consider unit creation as movement. 2019-10-20 16:42:26 +02:00
abcdefg30
5cd674445c Explain that CanEnterCell ignores 'subCell' if there is a free subcell 2019-10-19 23:15:10 +01:00
abcdefg30
27f1c37eca Let Mobile's CanEnterCell consider ToSubCell 2019-10-19 23:15:10 +01:00
abcdefg30
258259af4a Add a subCell parameter to IPositionableInfo.CanEnterCell 2019-10-19 23:15:10 +01:00
Paul Chote
276b1a9509 Don't override spawn CenterPosition for non-aircraft reinforcements. 2019-10-19 23:45:59 +02:00
Paul Chote
5b19dbe20c Disable Carryable while submerged. 2019-10-19 13:18:54 +02:00
Paul Chote
40424814a4 Allow carryall pickup orders on deployed vehicles. 2019-10-19 13:18:54 +02:00
Paul Chote
c0ea92850b Add UndeployOnPickup to GrantConditionOnDeploy. 2019-10-19 13:18:54 +02:00
Paul Chote
dc1f11f412 Prevent movement pausing at invalid position. 2019-10-19 13:18:54 +02:00
Paul Chote
e4602f8db2 Replace MoveIntoWorld with ReturnToCell/AssociateWithAirfield. 2019-10-17 23:32:28 +02:00
Paul Chote
b4b4412664 Revert "Suppress MoveIntoWorldInit for map-placed Mobile actors."
This reverts commit f0c28cc153.
2019-10-17 23:32:26 +02:00
reaperrr
a23634897a Fix zombie stand2 sequence and run tickrate 2019-10-14 17:29:24 +02:00
abc013
082efe1b08 Adjusted die sequence length of zombie 2019-10-14 17:29:22 +02:00
abc013
c6c05802d2 Fixed zombie.shp
Added missing zombie attack frame
and other fixes.
2019-10-14 17:29:20 +02:00
tovl
c091d7dc67 Fix lastVisibleTarget not being set in FlyAttack and AttackActivity. 2019-10-14 01:23:22 +02:00
abcdefg30
ac1d95c863 Guard against overlaps on HiDPI by having a 5px border on graphs 2019-10-14 01:05:38 +02:00
abcdefg30
f15bb98f4a Special case the TD spectator UI to fit the minimum width 2019-10-14 01:05:24 +02:00
abcdefg30
1353ad38a0 Reduce the width of the combat stats tab 2019-10-14 01:05:10 +02:00
abcdefg30
508f74822c Reduce the Width of INGAME_OBSERVERSTATS_BG 2019-10-14 01:04:55 +02:00
reaperrr
4b5ae12536 Fix missing rules in prep update path 2019-10-13 22:37:23 +01:00
abc013
4ad4e143b7 Add isDead-check to the flamethrowers in allies06b 2019-10-13 18:21:12 +02:00
abc013
94aa310612 Make normal difficulty on allies06b easier 2019-10-13 18:21:10 +02:00
Nakarin Srijumrat
06d5826a0b increased ingame edge scrollspeed to 30 from 10 2019-10-13 13:23:02 +02:00
Paul Chote
a64f0eb0f5 Update macOS launcher package.
This pulls in a fix for the missing libmono-native-compat.dylib
2019-10-11 22:03:20 +02:00
abcdefg30
814878126b Minor style fixes 2019-10-11 21:17:46 +02:00
abcdefg30
3438dd3f74 Reduce string allocations in ObserverStatsLogic 2019-10-11 21:17:31 +02:00
abcdefg30
e6b9bc07e9 Keep army and income graph disabled if they were disabled once 2019-10-11 21:17:17 +02:00
abcdefg30
cee511f59d Replace "$/min" by "Income" and increase graph update rates 2019-10-11 21:17:04 +02:00
abcdefg30
992559d317 Remove $/min from the basic stats 2019-10-11 21:16:49 +02:00
abcdefg30
f27440d67e Add an XAxisTicksPerLabel property to LineGraphWidget 2019-10-11 21:16:37 +02:00
abcdefg30
6b1aac4d98 Work around a recursive loop in TargetAndAttack 2019-10-11 21:04:22 +02:00
Paul Chote
96b95c8980 Suppress MoveIntoWorldInit for map-placed Mobile actors. 2019-10-07 19:09:42 +02:00
teinarss
088288fee1 PlayerStatistics should stop ticking after lost/win 2019-10-06 20:50:04 +01:00
tovl
a93fbc3219 pause MovePart when Mobile is paused. 2019-10-06 20:29:47 +01:00
abcdefg30
58273c532c Fix FallsToEarth queueing an activity in its ctor 2019-10-06 14:43:26 +01:00
abcdefg30
4498f52723 Add an ICreationActivity interface 2019-10-06 14:43:22 +01:00
abcdefg30
28ede7ad8f Fix setting the position of the wrong actor 2019-10-06 14:43:16 +01:00
abcdefg30
fd663cc3f3 Fix the XAxis of LineGraphWidget not being updated properly 2019-10-06 13:12:07 +01:00
abcdefg30
75d6495003 Cache method call results in variables in Draw of LineGraphWidget 2019-10-06 13:11:58 +01:00
Paul Chote
eb4ba7e793 Remove double-negative from appimage wrapper. 2019-10-05 18:31:51 +02:00
Paul Chote
4532cf9b55 Reset environment variables before switching mods. 2019-10-05 18:31:49 +02:00
Paul Chote
2fba47151c Add Engine.LaunchWrapper launch argument for mod switching. 2019-10-05 18:31:47 +02:00
Paul Chote
d4f1ea54e7 Compile using Mono 6.4.0. 2019-10-05 18:26:25 +02:00
Paul Chote
4a6efc99ee Update packaged mono to 6.4.0. 2019-10-05 18:26:22 +02:00
Paul Chote
c150ed373c Filter invalid actors when loading and saving games. 2019-10-05 17:51:10 +02:00
Paul Chote
d99b22db51 Replace actor list with count in UnitBuilderBotModule. 2019-10-05 17:50:51 +02:00
abcdefg30
51ad7e6b59 Fix double clicking a save in the save game dialogue loading it 2019-10-05 17:38:57 +02:00
abcdefg30
493294c61e Fix harvesters idling on Infiltration 2019-10-05 16:13:39 +02:00
abcdefg30
ea7d00df8d Fix the town attackers in Infiltration not stopping 2019-10-05 16:13:26 +02:00
abcdefg30
3218249a2d Remove unnecessary SearchFromHarvesterRadius overwrites from TD missions 2019-10-05 16:02:56 +02:00
abcdefg30
2be9200ce7 Add SearchFromProcRadius to TD missions that need it 2019-10-05 16:02:36 +02:00
abcdefg30
90ca7cedc2 Fix a crash when MaxLevel of GainsExperience is zero 2019-10-05 15:59:42 +02:00
teinarss
4f884f9835 Remove CanEnterCell from OccupiedCells 2019-10-05 14:45:58 +02:00
teinarss
1f8aa67593 Mark cells that have changed MovementType as dirty 2019-10-05 14:45:53 +02:00
Ivaylo Draganov
44af88bb49 Set duplicates flag for hotkeys in HotkeyManager 2019-10-05 13:17:44 +02:00
tovl
522ee22845 Fix deployed units being nudgeable. 2019-10-05 11:15:18 +01:00
Ivaylo Draganov
9d98276c7d Add duplicate hotkey tracking with a boolean property on the definition 2019-10-05 11:08:35 +01:00
Punsho
7ecc653183 RA balance changes for September 2019 2019-10-05 11:03:52 +01:00
Michael Silber
de330daf85 Fix destroyed truck escaping ra mission sarin-gas-1 2019-10-04 22:41:49 +01:00
Paul Chote
e2a74f21b7 Expire invalid instances from the SupportPowerBotModule cache. 2019-10-01 19:30:59 +02:00
Paul Chote
7bb594e11b Drop invalid power references when loading save games. 2019-10-01 19:29:54 +02:00
abcdefg30
4055952be3 Increase the SearchFromProcRadius radius in soviet05 2019-09-30 20:31:04 +02:00
abcdefg30
77daea61bb Remove the now unnecessary Helper refinery 2019-09-30 20:31:01 +02:00
Punsho
fec1e244f3 Make mine targetable on attack everything stance for AutoTargetGround 2019-09-28 14:31:15 +02:00
teinarss
1e26672b70 Add check to see if transport is dead to UnreserveSpace 2019-09-28 14:10:01 +02:00
abcdefg30
aead03d9b3 Fix the expansion mcv in soviet05 being transported off the map 2019-09-28 14:06:38 +02:00
abcdefg30
a9d44d4e44 Revert the search radius decrease in D2k 2019-09-28 13:57:49 +02:00
tovl
7047ba3a31 Skip rally point if order is queued after resupply. 2019-09-27 13:44:31 +02:00
tovl
e169368cf4 Add missing target line to aircraft taking off from resupplying. 2019-09-27 13:44:30 +02:00
tovl
90f3788187 Refactor unreserve actions. 2019-09-27 13:44:30 +02:00
tovl
96b65aa969 Prevent bogus attackmove on take-off. 2019-09-27 13:44:30 +02:00
Punsho
0771a42749 Fix ctank and stank building faster then they should 2019-09-27 13:44:29 +02:00
SoScared
8afa1d8dde Add map Climax to RA map pool 2019-09-27 13:44:29 +02:00
Paul Chote
79f6a51deb Fix player viewport saving for non-spectators. 2019-09-27 13:44:29 +02:00
Oliver Brakmann
4bb4897ba3 Fix idling aircraft on Intervention 2019-09-27 13:44:29 +02:00
abcdefg30
f82aa58d2b Remove selling from Infilitration
It is weird, unsatisfying for the player and inconsistent with the rest of our missions
2019-09-27 13:44:28 +02:00
abcdefg30
30ee546fb3 Fix potentially bogus usages of OnAllRemovedFromWorld 2019-09-27 13:44:28 +02:00
abcdefg30
2dad293328 Prevent users from selecting a directional target outside the map 2019-09-27 13:44:28 +02:00
tovl
14c4e2978f Fix crash with dead cargo. 2019-09-27 13:44:27 +02:00
Jan Beich
cb75a85341 Extend Linux dllmap to other systems
- Drop `os` in Eluant config as it's only used on Linux
- Make generic to help BSDs and Solaris
- Update OpenAL-CS and SDL2-CS to get the same

Exception of type `System.DllNotFoundException`: lua51.dll
TypeName=``
  at (wrapper managed-to-native) Eluant.LuaApi.lua_newstate(Eluant.LuaRuntime/LuaAllocator,intptr)
  at Eluant.LuaRuntime..ctor ()
  at Eluant.MemoryConstrainedLuaRuntime..ctor ()
  at OpenRA.Scripting.ScriptContext..ctor (OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer, System.Collections.Generic.IEnumerable`1[T] scripts)
  at OpenRA.Mods.Common.Scripting.LuaScript.OpenRA.Traits.IWorldLoaded.WorldLoaded (OpenRA.World world, OpenRA.Graphics.WorldRenderer worldRenderer)
  at OpenRA.World.LoadComplete (OpenRA.Graphics.WorldRenderer wr)
  at OpenRA.Game.StartGame (System.String mapUID, OpenRA.WorldType type)
  at OpenRA.Game.LoadShellMap ()
  at OpenRA.Mods.Common.LoadScreens.BlankLoadScreen.StartGame (OpenRA.Arguments args)
  at OpenRA.Game.InitializeMod (System.String mod, OpenRA.Arguments args)
  at OpenRA.Game.Initialize (OpenRA.Arguments args)
  at OpenRA.Game.InitializeAndRun (System.String[] args)
  at OpenRA.Program.Main (System.String[] args)
2019-09-27 13:44:27 +02:00
Jan Beich
dbbbb2c782 command -v with more than one argument is non-portable
On FreeBSD build fails, so check if `msbuild` exists without arguments.

$ gmake
command: wrong number of arguments
OpenRA requires the 'msbuild -verbosity:m -nologo' tool provided by Mono >= 5.4.
gmake: *** [Makefile:154: core] Error 1

# FreeBSD sh
$ command -v echo ls
command: wrong number of arguments

# dash
$ command -v echo ls
echo

# ksh, bash, zsh
$ command -v echo ls
echo
/bin/ls
2019-09-27 13:44:27 +02:00
teinarss
bf432df830 Locomotor cache should handle custom layers 2019-09-27 13:44:27 +02:00
abcdefg30
c42e2db542 Replaced "Earned this min" by an Oil Derrick count in the economy statistics 2019-09-27 13:44:26 +02:00
abcdefg30
bc55717b6b Add an "UpdatesDerrickCount" trait 2019-09-27 13:44:26 +02:00
teinarss
19551063a8 Remove IronCurtainable from RA aircraft. 2019-09-08 12:33:02 +02:00
teinarss
6d0f3a0008 Fix crushable logic for actors in cell 2019-09-07 13:32:08 +01:00
abcdefg30
88d11b4c66 Fix a division by zero error in FindAndDeliverResources
by preventing an overflow through dividing directly
2019-09-07 10:49:00 +01:00
puritylake
9f7c3d6bac #17018 Gets rif of cutoff line in chat window 2019-09-06 23:04:54 +02:00
teinarss
55ba6b9e26 More robust logic for ThisMinute stats 2019-09-06 14:03:31 +02:00
teinarss
79627d036e GetAvailableSubCell should block cells outside the map 2019-09-06 13:33:13 +02:00
abcdefg30
2438ee487a Remove the duplicate Selectable trait on TENF 2019-09-06 13:26:42 +02:00
Paul Chote
2b4ad71151 Remove unused OwnerLinkedProc field. 2019-08-25 17:20:38 +02:00
Paul Chote
815ea1e13b Make LastSearchFailed local to FindAndDeliverResources. 2019-08-25 17:20:38 +02:00
Paul Chote
1d2b3ac917 Update the displayed replay filename after renaming. 2019-08-25 16:10:29 +02:00
Paul Chote
c1be8d277e Disable player color for TD walls. 2019-08-25 15:33:46 +02:00
Paul Chote
19d9541aad Disable player color for RA walls. 2019-08-25 15:33:46 +02:00
teinarss
4dd8472d9b Reset server after game 2019-08-25 15:30:45 +02:00
Paul Chote
6702395357 Fix flare animation definition in RA and TD. 2019-08-25 15:24:32 +02:00
tovl
946c9f420b Fix Move not cancelling during turns. 2019-08-25 13:13:37 +02:00
Paul Chote
8b0f2e1462 Fix NRE in SquadManagerBotModule. 2019-08-24 14:33:11 +02:00
Paul Chote
d5f42c0628 Recalculate visibility during moves too. 2019-08-23 14:31:29 +02:00
Paul Chote
76d1447a91 Fix incorrect shroud visibility for stationary units. 2019-08-23 14:31:29 +02:00
Paul Chote
4db3da61e1 Avoid an integer (long) overflow in FindAndDeliverResources. 2019-08-23 14:15:51 +02:00
Ivaylo Draganov
be1f820674 Move hotkey dialog logic into SettingsLogic, fix bugs and improve usability of the dialog 2019-08-23 14:08:09 +02:00
tovl
ed8abe9861 Define nearenough parameter for aircraft so they can exit movement early when stuck. 2019-08-23 13:54:58 +02:00
reaperrr
e71001f4f8 Fix Resupply closeEnough bugs
Fixes that
- RepairableNear actors wouldn't move close enough
- isCloseEnough would return 'true' even if the host
  is invalid.
2019-08-22 10:26:36 +01:00
Paul Chote
8457dfdc39 Add Gatekeeper notice to macOS dmg. 2019-08-21 15:16:00 +01:00
Paul Chote
a491bae39b Bind triggers to RA Shellmap's APC passengers. 2019-08-21 11:24:20 +02:00
Paul Chote
f31cfe5b96 Fix SendParatroopers return value. 2019-08-21 11:24:20 +02:00
Paul Chote
ab94ea9715 Discourage harvesters from wandering too far from the refinery. 2019-08-20 20:22:39 +02:00
Paul Chote
7e4da8ea2c Don't reload after finishing a field. 2019-08-20 19:51:12 +02:00
Paul Chote
7311ae889f Clear placed mines queued fields too. 2019-08-20 19:51:12 +02:00
Paul Chote
9aec48aec3 Lay mines in order from start to end. 2019-08-20 19:51:12 +02:00
abcdefg30
3a51cf0ef8 Update AUTHORS 2019-08-20 19:26:02 +02:00
teinarss
7544d4b4e6 Cells with Temporary blockers should not exit early in locomotor cache 2019-08-19 19:06:57 +02:00
abcdefg30
345905bf68 Remove the gunboat from Lost Souls 2019-08-19 16:55:35 +02:00
abcdefg30
8cf6aa267c Allow single observers to use spectator team chat in mp 2019-08-19 16:45:15 +02:00
tovl
3fe78a8311 Add to AUTHORS. 2019-08-19 00:33:38 +02:00
tovl
2d394f33b8 Fix units from transports appearing at load point. 2019-08-19 00:33:38 +02:00
tovl
70459b311e Refactor FlyAttack to make strafing runs interruptible when target becomes invalid. 2019-08-18 12:50:20 +02:00
Paul Chote
e600848947 Fix crash for invalid Resupply hosts. 2019-08-18 12:48:17 +02:00
Hedog
2a6f2bbe0e Update movement inside leap to show attack animation 2019-08-17 12:42:06 +02:00
Paul Chote
2c24a607bc Fix Target.Positions returning null for invalid FrozenActors. 2019-08-15 20:13:04 +02:00
Ivaylo Draganov
8f7da18dc5 Kill buildings on surrender in TS 2019-08-15 19:13:15 +02:00
tovl
08c472b2e2 Disallow attack-moving units from chasing their targets. 2019-08-15 18:03:30 +02:00
Paul Chote
441585b3aa Truncate SLOT_OPTIONS and PLAYER_ACTION dropdown labels. 2019-08-15 17:25:14 +02:00
Paul Chote
78302ea593 Rework aircraft rally point handling. 2019-08-15 17:02:27 +02:00
reaperrr
08db7586d4 Fix Enter cursor for non-TakeOffOnResupply
If the aircraft does not take off on resupply,
we allow it to enter resuppliers without ForceMove modifier.

ResolveOrder already handled this correctly, only the cursor
shown was wrong.
2019-08-13 02:26:21 +02:00
teinarss
e05dc0afe3 Remove support power timers from spectator ui 2019-08-13 02:13:54 +02:00
Paul Chote
9c81507d6d Adjust lobby option bin margins. 2019-08-12 19:13:05 +02:00
abcdefg30
ea80a13b11 Let the utility remove stray trailing whitespaces 2019-08-11 16:40:55 +02:00
abcdefg30
84fbcd7c47 Apply the update rule to the default mods 2019-08-11 16:40:55 +02:00
abcdefg30
bfc3e1354b Rename SearchFromOrderRadius to SearchFromHarvesterRadius 2019-08-11 16:40:55 +02:00
abcdefg30
698ef5e375 Don't use SearchFromProcRadius when searching from self.Location 2019-08-11 16:40:55 +02:00
abcdefg30
ead35bccda Decrease SearchFromProcRadius and SearchFromOrderRadius 2019-08-11 16:40:55 +02:00
reaperrr
b7d966f78f Don't exit FlyOffMap immediately on leaving map
Usually they'll get removed afterwards, so they need to be
out of players' sight before ending this activity.
2019-08-11 16:28:42 +02:00
reaperrr
64780fc865 Fix ProductionAirdrop aircraft removal timing
...when leaving map before finishing TakeOff.
2019-08-11 16:28:42 +02:00
teinarss
ff1d4ec9ae Fix Out of sync caused by Locomotor cache 2019-08-11 09:53:02 +02:00
abcdefg30
859d01da7d Always remove the spawn cameras after prison infiltration 2019-08-10 21:20:17 +01:00
abcdefg30
a8ff8e75fc Make warfactory infiltration a secondary objective 2019-08-10 21:20:17 +01:00
abcdefg30
7ddae59d83 Prevent a second infiltration of warfactory or prison 2019-08-10 21:20:17 +01:00
abcdefg30
851d115a44 Fix allies05a crashing by ensuring the cameras exist before removing them 2019-08-10 21:20:17 +01:00
tovl
a8b9562d74 Adjust waypoint linewidths. 2019-08-10 21:17:38 +01:00
tovl
8690a4a6ce CLean up type check in harvesterbotmodule. 2019-08-10 19:12:50 +01:00
tovl
1b4ab564fe Fix AI harvester not resuming after chronoshift. 2019-08-10 19:12:50 +01:00
tovl
5393b689d4 Disable preemptive targeting for queued orders. 2019-08-10 19:10:45 +01:00
teinarss
4193247169 Reset Locomotor cache on world loaded 2019-08-10 17:34:11 +02:00
teinarss
ab9834fdcd Update locomotor cache when Crushable is enabled/disabled 2019-08-10 17:34:11 +02:00
teinarss
277906c657 Fixes on blocking logic 2019-08-10 17:34:11 +02:00
Tomase
98602cb1cb Change impassable terrain to short.max 2019-08-10 17:34:11 +02:00
Paul Chote
702f4d1937 Remove unused return values from Show*Dropdown methods. 2019-08-10 16:03:59 +02:00
Paul Chote
d0faaf29ff Restore selection lines for TargetLinesType.Automatic spectators. 2019-08-10 16:03:59 +02:00
Paul Chote
19aea3c07a Change target line default to "Manual". 2019-08-10 16:03:59 +02:00
Paul Chote
95ca14d4a3 Replace DrawTargetLine checkbox with an Automatic/Manual/Disabled dropdown. 2019-08-10 16:03:59 +02:00
Paul Chote
2909445452 Display target lines when the Waypoint command bar mode is active. 2019-08-10 16:03:59 +02:00
Paul Chote
292196e2d6 Allow left click to cancel AttackMove without clearing selected units. 2019-08-10 13:08:32 +02:00
Paul Chote
ad099b5c98 Allow Attack Move and Guard OGs to be activated while shift is held. 2019-08-10 13:08:32 +02:00
abcdefg30
d1c56d78e1 Fix spamming repair orders repairing faster 2019-08-10 11:39:12 +01:00
tovl
c0d5cd750d Add missing target lines. 2019-08-10 12:17:36 +02:00
teinarss
daa82d113e Prevent crash when unloading Cargo structures 2019-08-10 11:52:33 +02:00
Ivaylo Draganov
017eca3dc1 Add support for "select all" and "select by type" for multiple players 2019-08-09 22:40:09 +02:00
reaperrr
7cfc65010f Fix that aircraft with TakeOffOnResupply can't force-land 2019-08-09 09:45:40 +02:00
reaperrr
969be686a3 Fix aircraft with TakeOffOnResupply not taking off
...after auto-resupply.
2019-08-09 09:45:40 +02:00
abcdefg30
ddf824b494 Fix AutoCarryall crashing when the cargo dies 2019-08-08 17:46:34 +02:00
reaperrr
ac3b3db7ac Made Resupply canceling more robust
The following improvements are made here:
- merged and streamlined the two IsCanceling checks in Tick
  into one that covers both isCloseEnough cases
- isCloseEnough now only checks distance to host
  if host is still valid and otherwise returns 'false'
- called transports are now also cancelled when host becomes
  invalid, not only if the activity is cancelled via order
- aircraft now always take off if the host becomes invalid
- ground actors only try to leave if host is still existing
2019-08-08 17:22:53 +02:00
Paul Chote
ddc4c4ff06 Add queuing support to RepairOrderGenerator for units. 2019-08-07 21:31:20 +02:00
Paul Chote
1543ccb749 Reverse target line draw order. 2019-08-07 14:03:40 +02:00
reaperrr
b0a7865cfa Reduce Map.Contains(CPos) cost in legacy mods
If a mod uses rectangular maps and no height levels,
checking if the CPos is within Bounds
should be enough and cheaper than the whole ToMPos
conversion and checks.
2019-08-07 14:02:18 +02:00
Paul Chote
8ffd8ae822 Remove ShowTargetLines from delivery Lua API calls.
Lines should only be activated in response to an
explicit player action.
2019-08-06 17:56:56 +02:00
Paul Chote
96263d47c5 Restore target line display for allied players and spectators.
Change behaviour to require the force-display modifier to reduce
visual noise.
2019-08-06 17:52:43 +02:00
tovl
58bb7fcbc0 Rework minefield visualisation. 2019-08-05 02:53:09 +01:00
tovl
b7a7b7aa7e Revise target line colours to distinguish different attack types. 2019-08-05 02:53:09 +01:00
Turupawn
3240b1e9eb Overhaul target line rendering:
- Targets are now defined by the activities
- Queued activities are shown
- Support custom attack colors
2019-08-05 02:53:09 +01:00
Paul Chote
bc4dea406d Fix AttackTDGunboatTurreted exiting early. 2019-08-05 02:53:09 +01:00
tovl
8c7ff3b5b0 Make VisualMove uninterruptible by making Turn a Child of Drag. 2019-08-04 11:48:59 +02:00
tovl
207305e7d2 Reimplement MADtank logic as activity. 2019-07-30 11:03:32 +02:00
tovl
9e6f8aef60 Do not cancel parent activity when refinery is destroyed. 2019-07-29 19:56:23 +02:00
Paul Chote
a4b8ffa99d Allow PBOG to nudge blocking helicopters. 2019-07-28 11:31:24 +02:00
Paul Chote
2f99512bd4 Clear dirty blocking cells after updating. 2019-07-27 17:21:43 +02:00
Paul Chote
6345655bb1 Add a PerfSample to UpdateCellBlocking. 2019-07-27 17:21:43 +02:00
Paul Chote
8ae2b00414 Allow boxes to be placed in interior maps. 2019-07-27 13:11:51 +02:00
Paul Chote
6e978db1da Extract a ^Box template to reduce duplication. 2019-07-27 13:11:51 +02:00
4mfie
ff02b8ba06 Add timestamps to server log files
Servers are now writing timestamps to the log files using the the ISO 8601 timestamp format defined in the game server settings.
2019-07-27 10:47:24 +01:00
Andre Mohren
ebc533ed53 Exception should inform which actors causes it. 2019-07-27 10:44:30 +01:00
teinarss
b5c387774c Fixed selecting none in spec dropdown should set none as active panel 2019-07-27 10:17:34 +01:00
teinarss
cc84daacea Added cache for cell cost and blocking 2019-07-26 15:54:22 +02:00
teinarss
fb1af81280 Updated TerrainInfo cost to use short 2019-07-26 15:54:22 +02:00
teinarss
27077d6427 Added CellUpdated event to ActorMap 2019-07-26 15:54:22 +02:00
teinarss
3a17b26405 Creating PlayerMask 2019-07-26 15:54:22 +02:00
teinarss
2ddf9fa826 Using Locomotor instead of Info for pathfinding 2019-07-26 15:54:22 +02:00
Paul Chote
c00b13a18e Fix player color when a client is bumped to a spectator slot. 2019-07-24 23:07:12 +02:00
reaperrr
4c3f2f3afa Fix aircraft allowing enter when it should not
Show "enter-blocked" cursor when resupply is not possible,
except when
-  the actor CanForceLand,
- does not TakeOffOnResupply,
- and has active ForceEnter modifier.
2019-07-23 17:01:41 +02:00
reaperrr
5b3e6175ea Fix Repairable returning order targeter for aircraft
Aircraft (currently) does its own order targeting for resupplies,
so this could lead to conflicts.
2019-07-23 17:01:41 +02:00
reaperrr
e7769357a8 Improve AircraftCanEnter readability 2019-07-23 17:01:41 +02:00
reaperrr
e662f17f06 Fix that VTOLs can ignore TurnToDock/-Land
When already at horizontal target position, no Turn was queued.
2019-07-23 16:17:18 +02:00
tovl
d9e1a68453 Cancel carryall transport request when cancelling order. 2019-07-22 22:54:01 +02:00
Punsho
9ac3d7507c Add Fake Allied Barracks to RA 2019-07-21 23:59:14 +02:00
reaperrr
f25449a3bf Set InitialFacing for TS aircraft to 224
North-East looks better as starting and landing facing.
2019-07-21 16:29:38 +02:00
reaperrr
30c2e6b4d2 Remove Resupply re-queueing hack from Aircraft
By preventing that other traits can remotely cancel Resupply
or ReturnToBase.
2019-07-21 16:29:38 +02:00
reaperrr
bfcdb3a8a2 Add IdleBehavior enum to Aircraft 2019-07-21 16:29:38 +02:00
reaperrr
d185f6e9f1 Remove AbortOnResupply from Aircraft again
This was accidentally re-added during a rebase in
a previous PR.
2019-07-21 16:29:38 +02:00
reaperrr
7f4fbfcf46 Change Resupply closeEnough 'infinite' to negative
...instead of 'zero'.

Returning 'true' at a distance of zero was a legacy left-over
that isn't used anymore once #16695 is merged.
2019-07-21 15:17:09 +02:00
reaperrr
fa41554309 Fix actors resupplying even if too far from resupplier 2019-07-21 15:17:09 +02:00
teinarss
f46cad5347 Fix game minute in PlayerStatistics 2019-07-21 14:23:25 +02:00
teinarss
e06c97bc03 Updated the LineGraphWidget with new layout 2019-07-21 14:23:25 +02:00
teinarss
60250e621c Fix random flag for spec in score screen 2019-07-21 13:50:02 +02:00
teinarss
551d72b061 Fixes flag in spec ui 2019-07-21 13:50:02 +02:00
tovl
c5558e2145 Remove SequenceActivities. 2019-07-20 23:41:31 +02:00
Ivaylo Draganov
86c8dfe96e Add a tooltip text to overflowing ButtonWidget in hotkey settings panel 2019-07-20 17:39:07 +02:00
Ivaylo Draganov
ef0cb7552d Revert "Scissor the text of a ButtonWidget if it overflows and display a tooltip"
This reverts parts of commit 76a6e7ec92.
2019-07-20 17:39:07 +02:00
Punsho
70dc053c5f RA balance changes 2019-07-20 12:09:54 +01:00
tovl
a38c2d9aae Allow ReturnToBase to exit if actor does not land at building. 2019-07-19 12:19:15 +02:00
tovl
ed18ecfcaf Allow explicit landing orders to be disabled in yaml. 2019-07-19 12:14:39 +02:00
teinarss
931d5acc33 Balancing changes TD 2019-07-19 12:08:45 +02:00
tovl
0e62490d57 Let autocarryall switch destination when carryable switches destination. 2019-07-19 10:49:24 +02:00
tovl
231825d0d0 Remove WaitForTransport activity. 2019-07-19 10:49:24 +02:00
tovl
922c6e9c40 Fix harvesters losing their last harvesting position when carried by carryall. 2019-07-19 10:49:24 +02:00
tovl
d59b01597a Always clear requested targets when exiting AttackActivity/Flyattack. 2019-07-18 23:14:56 +01:00
reaperrr
83a607e089 Fix resupply anim continuing if docked actor dies during resupply 2019-07-18 22:59:27 +01:00
Punsho
8fa7bb16f8 Remove redundant burst delay from heavy tanks 2019-07-18 13:31:43 +02:00
reaperrr
4bf659ca38 CanSlide update rule 2019-07-18 10:26:43 +02:00
reaperrr
747e60d8b1 Revert FlightDynamics yaml changes
- TD and RA were straight up reverted.

- D2k was manually reverted with following changes:
-- Frigate staying VTOL.
-- Carryall staying CanSlide: true but CanHover: false.
-- bogus VTOL/CanHover flags on Ornithopter staying removed.

- TS was manually reverted to keep the behavior
improvements of the original FlightDynamics PR.
2019-07-18 10:26:43 +02:00
reaperrr
cf4d73ab91 Revert FlightDynamics
This needs more thought and most parts might get superseded
by other approaches.

Kept CanSlide separation from CanHover.
2019-07-18 10:26:43 +02:00
reaperrr
aa5c8b4efa Revert FlightDynamics update rule 2019-07-18 10:26:43 +02:00
Mustafa Alperen Seki
30e2b69dba Fix several traits missing OrderString checks for VoicePhraseForOrder 2019-07-16 10:04:55 +01:00
reaperrr
c51f2c036a Make aircraft always take off after repair
Reservable logic doesn't handle repairs, and we
don't want aircraft to block repair bays etc. until it does.
2019-07-15 23:48:54 +01:00
reaperrr
a010c72780 Fixed comment typo in Aircraft 2019-07-15 23:48:54 +01:00
reaperrr
5211eb25aa Improve handling of finished/cancelled Resupply 2019-07-15 23:48:54 +01:00
reaperrr
5b65e618ee Remove Resupply Cancel override
This became detrimental to actor responsiveness
while resupplying.
2019-07-15 23:48:54 +01:00
reaperrr
e4011b86ac Move AbortOnResupply to AttackAircraft
Additionally, if AbortOnResupply is set to 'true',
abort FlyAttack right away when queueing ReturnToBase.
2019-07-15 23:48:54 +01:00
reaperrr
1f16cb6864 Make Repairable(Near) implement interfaces explicitly 2019-07-15 23:48:54 +01:00
reaperrr
1bb988512f Move AmmoPool RemainingTicks reset to Rearmable
This is a better place to do this than the Resupply activity.
2019-07-15 23:48:54 +01:00
reaperrr
f71912f337 Move movement to resupplier inside Resupply activity
From Repairable(Near).
2019-07-15 23:48:54 +01:00
reaperrr
a7fa372045 Fix Resupply regression
The work-around was originally written with ground units in mind
and caused issues with aircraft.
2019-07-15 23:48:54 +01:00
abcdefg30
4fc6a911a0 Disable MAD tanks on exodus 2019-07-15 23:33:58 +01:00
abcdefg30
e37474cf63 Make some Soviet actors buildable in exodus
Their Allied counter-parts are already buildable.
Arty is still excluded on purpose.
2019-07-15 23:33:58 +01:00
abcdefg30
7908ce6274 Remove unnecessary definitions
The production buildings for those units are not buildable
2019-07-15 23:33:58 +01:00
abcdefg30
736a726a2b Rebrand leftover Hind rules in the missions 2019-07-15 23:33:58 +01:00
Paul Chote
579d2c19e2 Add --check-conditional-trait-interface-overrides utility command.
This command is used by `make check` to detect traits that incorrectly
override interface methods that are required for conditions to work
correctly.
2019-07-14 00:41:59 +02:00
Paul Chote
6eaf615798 Fix conditional traits that incorrectly override INotifyCreated. 2019-07-14 00:41:59 +02:00
Punsho
37325dbfc7 Reskin Hind with Black Hawk sprite 2019-07-13 01:10:30 +02:00
reaperrr
701b1524e5 Fix InstantHit crashing if blockable and target is dead
If the weapon has TargetActorCenter, the projectile is Blockable
and the target dies the same tick the projectile is fired but before
the 'blocked' check is performed, the target.CenterPosition lookup
would crash since the target has become invalid.

Work around this by ignoring TargetActorCenter and using
args.PassiveTarget position instead if the target is already dead.
2019-07-12 22:09:14 +02:00
tovl
71a1060ecb Prevent carryalls picking up non-existent units. 2019-07-11 13:19:19 +02:00
tovl
0562814efa Prevent carryalls delivering non-existent units. 2019-07-11 13:19:19 +02:00
Ivaylo Draganov
768043bc4e Add missing tooltip container to settings.yaml 2019-07-10 19:55:30 +01:00
reaperrr
1c03fb9e51 Revert Simplify CreateEffectWarhead
Reverts #16312.
2019-07-07 19:15:08 +02:00
tovl
2912bff850 Fix location checks for queued deployment. 2019-07-07 00:40:38 +01:00
abcdefg30
b4b3ce68a9 chrome.yaml style fixes 2019-07-05 13:38:49 +02:00
reaperrr
da8a353e65 Remove redundant code from ProductionAirdrop
With the updated Land code, this is now obsolete.
2019-07-05 00:03:36 +02:00
reaperrr
bbf4495668 Update rule for FlightDynamics 2019-07-05 00:03:36 +02:00
reaperrr
990087d434 FlightDynamics yaml changes
Rules updates for official mods.
2019-07-05 00:03:36 +02:00
reaperrr
0ebeb30880 Replace various Aircraft fields with FlightDynamics
Replaces various booleans with a FlightDynamics flag list.
2019-07-05 00:03:36 +02:00
tovl
824db72a4c Prevent VisualMoveIntoTarget from overshooting when turning. 2019-07-03 20:42:19 +02:00
tovl
985020b4ad Simplify special exits of several acitivities. 2019-07-03 20:42:19 +02:00
tovl
3790169db9 Make Tick return bool 2019-07-03 20:42:19 +02:00
tovl
09c1611239 Always check if activity state is Done. 2019-07-03 20:42:19 +02:00
tovl
714b09ac4f Add default for Activity-Tick 2019-07-03 20:42:19 +02:00
tovl
b9c302a73a Move ChildActivity handling into base Activity class. 2019-07-03 20:42:19 +02:00
tovl
37379daf3c Refactor MoveAdjacentTo. 2019-07-03 20:42:19 +02:00
tovl
3ac5ac25f6 Queue WaitForTransport childactivity in OnFirstRun. 2019-07-03 20:42:19 +02:00
abcdefg30
b35dfb50a8 Remove Selectable from planes in TD 2019-07-01 20:19:10 +01:00
Punsho
4f6aa79e91 Normalise Construction Yard Cost 2019-07-01 17:04:14 +02:00
Paul Chote
5d8b6d6057 Fix force-landed transports taking off after (un)loading passengers. 2019-07-01 16:00:03 +02:00
Paul Chote
da0b24e891 Disable water trails for carried Hover MLRS. 2019-06-30 18:04:43 +02:00
tovl
71a035315c Prevent infinite loop between FlyAttack and ReturnToBase. 2019-06-30 18:04:43 +02:00
tovl
5920de1384 Airborne transports only land to (un)load. 2019-06-30 18:04:43 +02:00
tovl
76422933f6 Allow forced landing on helipads and enforce takeoff otherwise. 2019-06-30 18:04:43 +02:00
tovl
79a48765d9 Allow VTOLs to land with force-move 2019-06-30 18:04:43 +02:00
tovl
8e5875453a Improve Carryall behaviour and integration with Aircraft. 2019-06-30 18:04:43 +02:00
tovl
adecd4ca87 Overhaul Land activity:
- Landing on an actor is no longer blocked by the underlying terrain
- Land in a nearby cell if the requested location is blocked
- Internally manages the fixed-wing landing sequence
- ProductionAirdrop transport waits until the exit is free before landing
2019-06-30 18:04:43 +02:00
Paul Chote
ff9db0bf7a Reset RequestedTargets that are cancelled before the first attack tick. 2019-06-29 23:28:23 +02:00
Paul Chote
8f7426f579 Reduce duplication around AttackFollow's targets. 2019-06-29 23:28:23 +02:00
Ivaylo Draganov
caa440ce9a Adjust height of multiplayer-browser chrome to be in line with other panels 2019-06-29 23:10:25 +02:00
Ivaylo Draganov
3fb60740be Add support for opening DropDownButtonWidget upwards if clipped by the viewport 2019-06-29 23:10:25 +02:00
Ivaylo Draganov
e23054631d Add "Flat" and "Low Priority" selection modes to default mods 2019-06-29 20:46:12 +02:00
Ivaylo Draganov
c1fc0c1b74 Allow selection priority to be modified using a hotkey 2019-06-29 20:46:12 +02:00
Mustafa Alperen Seki
3e39ada304 Implement DetectCloakedMultiplier. 2019-06-28 12:19:08 +02:00
Mustafa Alperen Seki
d36973138c Implement ReloadAmmoDelay multiplier. 2019-06-28 12:16:48 +02:00
Ivaylo Draganov
c9ff54bfd5 Add hotkey settings panel with a hotkey remap dialog
* Add HotkeyDialogLogic.cs
* Add dialog-hotkey.yaml to all mods
* Add `GetFirstDuplicate` method to HotkeyManager to aid in validation
* Add "Player" and/or "Spectator" type to all hotkeys to allow for
validation based on overlapping types
* Change settings.yaml and SettingsLogic.cs to work with the new dialog
2019-06-28 12:10:48 +02:00
Ivaylo Draganov
9783fdaf78 Change the name of Keycode.UNKNOWN to "Undefined" 2019-06-28 12:10:48 +02:00
Ivaylo Draganov
7dfd91bc39 Remove from HotkeyManager hotkeys found in settings.yaml but not in hotkey definitons 2019-06-28 12:10:48 +02:00
Ivaylo Draganov
db8c8fee4d Add generic notice colors for the UI (info, success, warning, error) 2019-06-28 12:10:48 +02:00
Ivaylo Draganov
76a6e7ec92 Scissor the text of a ButtonWidget if it overflows and display a tooltip
Also:
* add a variable to a comomn pattern used for truncating text in HotkeyEntryWidget and TextFieldWidget
2019-06-28 12:10:48 +02:00
teinarss
f325a4d190 Relative mouse pos 2019-06-27 23:34:16 +02:00
teinarss
d7643602c1 Added a MouseAttachmentWidget to render the Direction arrows in SelectDirectionalTarget 2019-06-27 23:34:16 +02:00
teinarss
f07fb57e98 Rework relative mouse events. 2019-06-27 23:34:16 +02:00
teinarss
647cc2698b CursorViewportZoomed in SelectDirectionalTarget 2019-06-27 23:34:16 +02:00
teinarss
ffd3834849 Lock mouse position 2019-06-27 23:34:16 +02:00
abcdefg30
7bbfd823d0 Fix Minelayer crashes 2019-06-27 20:22:10 +02:00
Paul Chote
739f437c18 Fix blocked cursor for queued undeploy orders. 2019-06-25 01:15:10 +02:00
RoosterDragon
8f573568c8 Fix PostProcess command to handle paths with spaces. 2019-06-24 23:19:24 +02:00
Paul Chote
98125a3d94 Fix Mobile conditions.
The explicit IObservesVariables implementation was hiding
the base PausableConditionalTrait variable initialization.
2019-06-24 16:25:40 +02:00
Paul Chote
71ed22a473 Fix crate paradrop animation. 2019-06-22 15:52:19 +03:00
Paul Chote
d70c86d37a Allow crates to spawn in water. 2019-06-22 15:52:19 +03:00
Paul Chote
a2d51753ba Fix final parachuted actor position. 2019-06-22 15:52:19 +03:00
Ivaylo Draganov
d26919efd5 Fix position of lobby admin icon in player tooltips 2019-06-21 23:07:34 +01:00
RoosterDragon
58dced7e05 Silence some doc errors in VS2019. 2019-06-21 21:22:12 +02:00
teinarss
b647d46196 Vertical alignment in TS 2019-06-21 12:51:45 +02:00
teinarss
95874ccfde Vertical alignment in RA 2019-06-21 12:51:45 +02:00
teinarss
ed1250b14d Vertical alignment in D2k 2019-06-21 12:51:45 +02:00
teinarss
702a419fc5 Vertical alignment fixes in common 2019-06-21 12:51:45 +02:00
teinarss
d2639645bf Vertical alignment on labels in TD 2019-06-21 12:51:45 +02:00
teinarss
cc588f11c4 Updated vertical alignment for labels in Manage Content 2019-06-21 12:51:45 +02:00
teinarss
4e84545b55 Updated ChatDisplayWidget to use the new vertical alignment 2019-06-21 12:51:45 +02:00
teinarss
ab382ce4d6 Removed BaseLine and updated ButtonWidget and CheckboxWidget to use Font.TopOffset 2019-06-21 12:51:45 +02:00
teinarss
9982b01642 Get the Ascender value from mod.yaml instead from the Font 2019-06-21 12:51:45 +02:00
Paul Chote
a260b50ce1 Document the revised protocol. 2019-06-20 22:50:17 +02:00
Paul Chote
c6232f20f9 Split Protocol version into Handshake vs Orders.
Handshake is kept at 7.
Orders is incremented to 8 to reflect immediate order changes.
2019-06-20 22:50:17 +02:00
Paul Chote
fe41dcb45e Restore 0xFE order for handshakes.
This restores handshake compatibility with protocol 7 servers.
2019-06-20 22:50:17 +02:00
Paul Chote
bfddfec461 Replace magic numbers with an OrderType enum. 2019-06-20 22:50:17 +02:00
Paul Chote
862a274357 Merge ServerOrder into Order and 0xFE order type into 0xFF. 2019-06-20 22:50:17 +02:00
Paul Chote
90ebffc6c0 Remove unused PauseGame handling.
Pause is not an immediate order.
2019-06-20 22:50:17 +02:00
Paul Chote
9daf02a955 Remove unused field from HandshakeRequest.
This field was not serialised, so compatibility
is not impacted.
2019-06-20 22:50:17 +02:00
Paul Chote
1e23c0a7b7 Fix bot PlaceBuilding orders. 2019-06-20 18:51:02 +01:00
reaperrr
db0c6d88bf Fix AbortOnResupply not working
Going by yaml rules, all(!) aircraft in the shipping
mods should be aborting any previous activities
on resupply. None actually did, due to this bug.
2019-06-20 15:01:30 +01:00
Ivaylo Draganov
9f59b007ab Add palette order to support powers in TD, RA and d2k 2019-06-15 09:55:22 +02:00
Ivaylo Draganov
a85b634655 Add SupportPowerPaletteOrder to SupportPowerInfo 2019-06-15 09:55:22 +02:00
Paul Chote
a8b7fcaf87 Fix undeploy orders always being queued. 2019-06-15 09:49:23 +02:00
Mustafa Alperen Seki
b63792c73e Update global mix database.dat with Sole Survivor definitions. 2019-06-15 06:23:24 +02:00
reaperrr
c8a42cbce2 Introduce AirAttackType
Aircraft attack behavior (currently FlyBy or Hover)
is now controlled via this instead of the CanHover boolean.
2019-06-10 12:43:34 +02:00
Paul Chote
b59ae476e4 Add PlaceBuildingVariant trait. 2019-06-10 11:46:32 +02:00
Paul Chote
44e41cc054 Add key handling to order generators. 2019-06-10 11:46:32 +02:00
Mustafa Alperen Seki
0eb5063260 Add lua function Media.DisplaySystemMessage 2019-06-09 16:29:42 +02:00
reaperrr
97084effac Improve Aircraft firstTick code
- Remove ReserveSpawnBuilding:
Only used in one place, and removing it
avoids a double GetActorBelow() look-up.

- Remove FallsToEarth check form Aircraft.firstTick:
Aircraft triggers UnReserve() on actor disposal,
so this work-around should no longer be necessary.
2019-06-09 11:24:07 +01:00
Paul Chote
788e73db64 Enable StyleCop rule SA1115. 2019-06-08 19:28:14 +02:00
Paul Chote
4dd08d9dc2 Enable StyleCop rule SA1500. 2019-06-08 19:26:53 +02:00
Paul Chote
ebf2ce32c0 Make sure braces for multi-line statements are on their own lines. 2019-06-08 19:26:53 +02:00
Paul Chote
c89f8dbb89 Enable StyleCop rule SA1002. 2019-06-08 18:46:03 +02:00
Paul Chote
65856f3b0e Fix remaining semicolon spacing issues. 2019-06-08 18:46:03 +02:00
Paul Chote
c253aaeb9d Replace for(;;) with while (true). 2019-06-08 18:46:03 +02:00
Paul Chote
4d8aaeb690 Enable StyleCop rule SA1128. 2019-06-08 18:44:50 +02:00
Paul Chote
674155a8dd Move ctor initializers to their own line. 2019-06-08 18:44:50 +02:00
reaperrr
979ed1b140 Merge HeliAttack into FlyAttack
And polish CanHover FlyAttack behavior:

- Get rid of direct TickFacing usage
- Fix that the CanHover facing/altitude update would override
  TakeOff child of Fly
- Streamline the queueing of child activities
- Get rid of a direct FlyTick in favor of relying on Fly activity
- Pull queueing of TakeOff out of the if-else
2019-06-08 17:07:18 +01:00
Paul Chote
a7617b2443 Reseed the RNG when restarting a game. 2019-06-08 16:23:33 +02:00
abcdefg30
586fa80943 Defer running the contents of TraitEnabled in WithMoveAnimation 2019-06-08 15:28:54 +02:00
Paul Chote
1aa80f9c11 Add download hashes for the default mod packages. 2019-06-08 13:39:17 +02:00
Paul Chote
03c1eaad76 Add a SHA1 check for downloaded packages. 2019-06-08 13:39:17 +02:00
Paul Chote
1d3754f9c0 Enable StyleCop rules SA1509, SA1513. 2019-06-08 13:20:14 +02:00
Paul Chote
548de12e85 Add newlines after closing braces. 2019-06-08 13:20:14 +02:00
Paul Chote
9f15754926 Remove scoped blocks in ReplayBrowserLogic. 2019-06-08 13:20:14 +02:00
Paul Chote
208b5b9686 Enable StyleCop rule SA1129. 2019-06-08 13:19:57 +02:00
Paul Chote
ebd36891dc Switch other struct types to default(T). 2019-06-08 13:19:57 +02:00
Paul Chote
dba1301b61 Change new BitSet<T> to default(BitSet<T>). 2019-06-08 13:19:57 +02:00
Paul Chote
37889af20e Enable StyleCop rule SX1101 2019-06-08 13:19:27 +02:00
Paul Chote
dabc7ec8dd Remove unnecessary this. references. 2019-06-08 13:19:27 +02:00
Paul Chote
ebe37a44ad Require force move for all undeploy-triggering orders. 2019-06-08 02:09:30 +02:00
Paul Chote
5d886b79f1 Remove AlternateTransportsMode.
This conflicts with undeploy orders and has been largely
superseded by queued enter orders.
2019-06-08 02:09:30 +02:00
Paul Chote
ecd8dee575 Add TransformsInto* traits to trigger construction yard undeploy. 2019-06-08 02:09:30 +02:00
Paul Chote
1b026b7e20 Disable out-of-range non-force targeting for deployed units. 2019-06-08 02:09:30 +02:00
Paul Chote
c853e8c5d6 Disable non-force move for deployed units. 2019-06-08 02:09:30 +02:00
tovl
ea036d4cc0 Allow move orders to cancel DeployForGrantedCondition. 2019-06-08 02:09:30 +02:00
reaperrr
8589e26dc2 Resolve rally point target on first run. 2019-06-07 22:18:33 +01:00
reaperrr
e6402d28a3 Fix and streamline MaximumPitch values in TS
The internal default is way too low for TS aircraft
(especially when passing cliffs).
2019-06-07 22:18:33 +01:00
reaperrr
52ef5617d3 Clarify MaximumPitch and AltitudeVelocity descriptions
AltitudeVelocity is strictly only for vertical-only movement,
MaximumPitch is only for altitude changes during horizontal movement.
2019-06-07 22:18:33 +01:00
reaperrr
ac08f24828 Make aircraft move to CruiseAltitude on new order 2019-06-07 22:18:33 +01:00
reaperrr
ce3d7c98ad Refactor TakeOff
- Make it self-contained by moving actual take-off
  from 'Fly' to this
- Make 'moveToRallyPoint' a simple boolean
- Make AttackMove to rally point a child activity
- Make TakeOff uninterruptible
2019-06-07 22:18:33 +01:00
reaperrr
4f8f8cfb9d Merge HeliFly into Fly 2019-06-07 22:18:33 +01:00
reaperrr
5698ea0910 Remove HeliFlyAndLandWhenIdle
Already obsolete, as aircraft with CanHover do properly become idle
and land when LandOnIdle is set to 'true'.
They currently need VTOL too, but all CanHover-aircraft
in the shipping mods have that and it will be fixed soon as well.
2019-06-07 22:18:33 +01:00
abcdefg30
27cfa9b1f0 Fix MAD tanks always being repairable 2019-06-06 00:48:50 +02:00
abcdefg30
bf6fa94224 Remove unnecessary comments from aircraft.yaml 2019-06-05 00:54:55 +02:00
abcdefg30
26ec5946b3 Add LandableTerrainTypes to D2k's frigate 2019-06-05 00:54:55 +02:00
abcdefg30
1a078d13aa Remove the Ore landable terrain type from TRAN in TD 2019-06-05 00:54:55 +02:00
abcdefg30
c10f4e53e0 Work around C17s not being able to deliver units 2019-06-05 00:54:55 +02:00
Paul Chote
760a2b483e Fix RA/TD map editor copy/paste tile definitions. 2019-06-02 16:09:12 +02:00
Mustafa Alperen Seki
ccc68b0272 Make Crate trait public. 2019-06-02 15:34:06 +02:00
Paul Chote
229bac6777 Disable capturing while the make animation is playing. 2019-06-02 15:26:26 +02:00
reaperrr
3ff8fb3cd2 Rename Hovers' OffsetModifier to BobDistance 2019-06-02 10:00:58 +01:00
reaperrr
2f1f0c8aec Adapt TS aircraft to changed Hovers defaults 2019-06-02 10:00:58 +01:00
reaperrr
d5c66d9474 Fix or prevent bugs in Hovers
- Clamp fallTickHeight to at least 1,
  to avoid potential DivideByZero crash.
- Prevent modders from setting values that
  are bogus or would trigger other bugs,
  via loadtime YamlExceptions.
2019-06-02 10:00:58 +01:00
reaperrr
b60346abb1 Polish various aspects of Hovers
- Use WDist instead of int for fields
- Change default values to approximately restore previous
  releases' default behavior
- Improve and clarify descriptions
2019-06-02 10:00:58 +01:00
teinarss
4fae77ed1c Writing benchmark data at the end of the game 2019-06-02 00:00:48 +02:00
Ivaylo Draganov
982291119c Fix misaligned TD production tooltip icons 2019-06-01 08:52:59 +01:00
Paul Chote
1614cba99e Fix warhead removal lint warnings. 2019-05-31 20:55:38 +02:00
Paul Chote
fb075dc803 Improve linting of weapon and trait yaml removals. 2019-05-31 20:55:38 +02:00
ltem
2a7ea28b74 Fix inconsistency in oberserver statistics 2019-05-31 20:50:23 +02:00
abcdefg30
11e4c971c4 Fix a compiler error (wrong using) in D2kActorPreviewPlaceBuildingPreview 2019-05-31 16:36:19 +02:00
Evgeniy S
3a30b013a5 Move Selection into a Trait 2019-05-31 15:50:53 +02:00
Paul Chote
6723306bb4 Remove Enum.HasFlag from building preview generation. 2019-05-31 15:44:09 +02:00
Paul Chote
697935f931 Display yellow footprint for cells that trigger damage in D2k. 2019-05-31 15:44:09 +02:00
Paul Chote
3b2b093e0e Use original RA and TD footprint artwork. 2019-05-31 15:44:09 +02:00
Paul Chote
b3c1d96027 Add place previews for TS building plugs. 2019-05-31 15:44:09 +02:00
Paul Chote
087887250f Add line-build palette to RA, TD, D2k. 2019-05-31 15:44:09 +02:00
Paul Chote
3f9e4a313f Improve visibility of building placement preview. 2019-05-31 15:44:09 +02:00
Paul Chote
cdad07d172 Fix footprint type for line build structures. 2019-05-31 15:44:09 +02:00
Paul Chote
52fd32c311 Split IPlaceBuildingPreviewGeneratorInfo from PBOG. 2019-05-31 15:44:09 +02:00
Paul Chote
e2b27328bd Rework paradrop logic to be more robust. 2019-05-31 15:31:47 +02:00
Paul Chote
829b8cd2e1 Fix loadscreen text when switching between internal mods. 2019-05-31 15:22:08 +02:00
abcdefg30
1c965d812f Fix WithSpriteBody crashes 2019-05-29 20:58:45 +01:00
reaperrr
7a403c9af5 Play StartSequence when With*SpriteBody is enabled
Not only on actor creation.
2019-05-28 22:13:38 +02:00
reaperrr
666169e9b9 Add LockOnInaccuracy to Missile 2019-05-28 22:13:38 +02:00
Ivaylo Draganov
fde215360c Add tooltips to overflowing labels 2019-05-27 17:28:47 +02:00
Ivaylo Draganov
1fee50be2e Add TruncateLabelWithTooltip helper function
* Move GetContrastColor helper to SpriteFont
* Move WidgetUtils  from OpenRA.Game.Widgets to OpenRA.Mods.Common.Widgets
2019-05-27 17:28:47 +02:00
Ivaylo Draganov
79d1899426 Remove redundant compiler workaround 2019-05-27 17:28:47 +02:00
Paul Chote
1c6c55092f Fix Appveyor builds. 2019-05-26 23:13:37 +02:00
Paul Chote
4358b0956e Fix RunConfiguration condition whitespace. 2019-05-26 23:13:37 +02:00
Paul Chote
bb5268bef6 Package separate x64 and x86 Windows installers. 2019-05-26 23:13:37 +02:00
Paul Chote
4f7dca809f Fix csproj formatting. 2019-05-26 23:13:37 +02:00
Paul Chote
845fca25d1 Change platform from x86 to Any CPU (preferring 64 bit)
A Release-x86 configuration allows x86 Windows installers to still be created.
2019-05-26 23:13:37 +02:00
Paul Chote
7cf939fc68 Update OpenAL-CS.
Required for Win64 support.
2019-05-26 23:13:37 +02:00
Paul Chote
aed6098eaa Change default support dir location on Windows and Linux:
Windows now prefers the ApplicationData directory
Linux now prefers XDG_CONFIG_HOME

Fall back to the previous directory to avoid data loss or duplication.
2019-05-26 21:13:35 +02:00
teinarss
c89f4b7a76 Added tooltip to support powers in spec ui 2019-05-26 19:08:24 +01:00
teinarss
12484caf04 Added field to ProductionQueue to customize ordering in ObserverProductionIconsWidget 2019-05-26 19:04:54 +01:00
reaperrr
71995dbcbe Fix Bullet contrails 2019-05-26 13:02:54 +02:00
abcdefg30
29d238ba03 Empty the default of TrailSequences in NukePower (version 2) 2019-05-26 01:19:12 +02:00
Mustafa Alperen Seki
e007568e17 Make ClonesProducedUnits Conditional. 2019-05-25 23:19:41 +02:00
Paul Chote
1ed36da107 Update macOS launcher tag in fetch-thirdparty-deps-osx.sh. 2019-05-25 20:10:14 +02:00
reaperrr
3735c60533 Simplify CreateEffectWarhead 2019-05-24 20:08:33 +01:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Evgeniy S
fbf9461890 Make StoresResources trait public 2019-05-23 14:20:38 +02:00
teinarss
9fc8b829e4 Updated the observer ui 2019-05-22 22:37:50 +01:00
teinarss
b90b3095a6 Updated ColorBlockWidget to handle setting the Color in yaml 2019-05-22 22:37:50 +01:00
teinarss
dad29cd3b3 Added GradientColorBlockWidget 2019-05-22 22:37:50 +01:00
teinarss
b25d0694b8 Updated ScrollPanelWidget to handle Scrollbar alignment 2019-05-22 22:37:50 +01:00
Paul Chote
c480b2b599 Prefer own service depots over allies. 2019-05-22 20:41:51 +02:00
Paul Chote
217221d174 Fix multiple clients being assigned as admin. 2019-05-22 20:30:54 +02:00
teinarss
881cacbef8 Replaces RunConfiguration and Configuration with launchSettings.json 2019-05-22 19:58:56 +02:00
teinarss
a495c0c475 Remove check to see if DeveloperMode is enabled 2019-05-22 19:46:30 +02:00
Mustafa Alperen Seki
3709380733 Implement ResourcePurifier 2019-05-22 19:41:21 +02:00
Mustafa Alperen Seki
feeae74455 Add INotifyResourceDumped Interface 2019-05-22 19:41:21 +02:00
Zimmermann Gyula
1e99075c70 Implement RefineryResourceMultiplier. 2019-05-22 19:41:21 +02:00
Zimmermann Gyula
71acfaf014 Implement HarvesterResourceMultiplier. 2019-05-22 19:41:21 +02:00
teinarss
ef47a3394f Added cell pos and world pos to debug 2019-05-21 22:28:44 +01:00
Paul Chote
3ca9d4b773 Drop targets when switching to a more restrictive stance. 2019-05-21 15:52:55 +02:00
Paul Chote
62b5d22e53 Add INotify(Activity)StanceChanged interfaces. 2019-05-21 15:52:55 +02:00
Paul Chote
07dc2a1132 Fix "Max Speed" option when viewing replays. 2019-05-19 18:09:45 +02:00
Paul Chote
327fdaea2d Defer NSIS installation to the pre-packaging step. 2019-05-19 16:59:54 +01:00
Paul Chote
15e88d9e58 Bump travis and the macOS/Linux packaging to use mono 5.20.1. 2019-05-19 16:59:54 +01:00
reaperrr
a2775a5c0f Fix DivideByZero crashes in Railgun projectile 2019-05-19 16:56:49 +02:00
reaperrr
90325305d6 Minor projectile clean-ups and perf optimizations 2019-05-19 16:56:49 +02:00
airetaM
6897ebe2a8 Makes Dogs buildable at the Barracks/Tent 2019-05-19 13:44:44 +02:00
Paul Chote
fbce22784b Fix ICaptureProgressWatchers continuing after captor disposal. 2019-05-19 13:37:42 +02:00
Paul Chote
44c5d38a0e Disable AutoTarget if targeting a persistent fallback. 2019-05-19 13:23:01 +02:00
Paul Chote
55f6744cf3 Replace IPreventsAutoTarget with IDisable(Enemy)AutoTarget.
This allows traits on the attacking unit to suppress auto targeting
and makes the distinction between the two interfaces clear.
2019-05-19 13:23:01 +02:00
Paul Chote
f9fe7486b3 Fix TD observer production icon hover crash. 2019-05-19 13:14:00 +02:00
Punsho
336cfedf84 Mines will no longer damage each other 2019-05-18 20:08:42 +02:00
Ivaylo Draganov
0bb832917a Fix TD chrome.yaml definitions for panel-allblack 2019-05-17 21:01:54 +02:00
Paul Chote
4756558f8a Merge man-page target into install-man-page 2019-05-17 19:02:46 +01:00
Paul Chote
c47c9d7ed6 Fix Makefile targets 2019-05-17 19:02:46 +01:00
reaperrr
7becbe6b14 Allow non-VTOL to LandOnCondition
Note: This might still break in unexpected ways,
since non-VTOLs implicitly rely on ReturnToBase
to calculate the approach vector for them.
2019-05-17 18:51:21 +01:00
reaperrr
0c2666b97e Streamline Land activity
Removed some redundant parameters, some redundant overloads
and made Land always consider LandAltitude relative to target.
2019-05-17 18:51:21 +01:00
reaperrr
14bd5ada1a Merge HeliLand into Land activity 2019-05-17 18:51:21 +01:00
abcdefg30
bc3cabdea0 Display an error when TrailSequences is empty and TrailImage is not 2019-05-17 18:53:52 +02:00
abcdefg30
b8fbc63542 Empty the default of TrailSequences in NukePower 2019-05-17 18:53:52 +02:00
teinarss
79f0bdc65c Added configurations for starting the mods in VS 2019-05-16 19:34:21 +01:00
teinarss
70f0075415 Use Write-Host instead of echo 2019-05-16 20:05:55 +02:00
abcdefg30
e888a235c0 Fix powershell if statements not checking the return value of calls 2019-05-16 19:41:29 +02:00
Paul Chote
242ebc5da9 Fix FrozenUnderFog visibility calculation when fog is disabled. 2019-05-16 18:23:47 +02:00
abcdefg30
215af20e62 Give a lint error when TimeLimitDefault is not in TimeLimitOptions 2019-05-16 14:56:56 +02:00
abcdefg30
09d6387e64 Prevent negative times in GameTimerLogic 2019-05-16 14:56:56 +02:00
Oliver Brakmann
28016a3a33 Disable TimeLimit dropdown on MP missions and Fort Lonestar 2019-05-16 14:56:56 +02:00
Oliver Brakmann
f617da08f6 Convert "Top o' the World" mission to use TimeLimit API 2019-05-16 14:56:56 +02:00
Oliver Brakmann
f11b7393ef Convert Allies-02 to make use of TimeLimit API 2019-05-16 14:56:56 +02:00
Oliver Brakmann
26d712728a Add scripting support for TimeLimitManager 2019-05-16 14:56:56 +02:00
Oliver Brakmann
47d88983fb Let sidebar timer count backwards if a time limit is set 2019-05-16 14:56:56 +02:00
abcdefg30
4a35d85884 Add a DropdownVisible property to TimeLimitManager 2019-05-16 14:56:56 +02:00
Oliver Brakmann
a63cc2d317 Add a time limit lobby option 2019-05-16 14:56:56 +02:00
abcdefg30
1364581696 Fix Sarin Gas Crackdown not ending after losing all units 2019-05-16 14:22:03 +02:00
evgeniysergeev
3bc5b07277 Fix for System.IO.InvalidDataException in VocLoader
Fix for VOC version check

use cached value from MoveNext instead of try/catch section
2019-05-15 21:20:24 +02:00
Paul Chote
72dbb871ac Add faction specific tooltip backgrounds. 2019-05-15 21:05:49 +02:00
Ivaylo Draganov
a5bd08bd02 Revamp Tiberian Dawn ingame UI 2019-05-15 21:05:49 +02:00
Ivaylo Draganov
4931fc2ca6 Enable AddFactionSuffixLogic for ProductionTabsWidget and BackgroundWidget 2019-05-15 21:05:49 +02:00
Paul Chote
6f1aaab3e3 Remove CallFunc. 2019-05-12 19:06:52 +02:00
Paul Chote
e57e881662 Use Target in DeliverUnit 2019-05-12 19:06:52 +02:00
tovl
0b747ba927 Rework Carryall drop-off queueing and ordering. 2019-05-12 19:06:52 +02:00
reaperrr
a403d9937d Fix palette effects on desert buildings/rocks 2019-05-12 17:46:25 +02:00
Paul Chote
6248326b29 Rename AttackMove *ScanConditions. 2019-05-12 10:59:36 +02:00
tovl
0e1374f0eb Replace pseudo-childactivities in AttackMoveActivity. 2019-05-12 10:59:36 +02:00
abcdefg30
1c13520ffd Update the forum link in the readme 2019-05-10 00:35:44 +01:00
reaperrr
17a40099df Fix launch delay and offset of TS ClusterMissile 2019-05-09 22:28:46 +01:00
reaperrr
6eb31401f1 Implement D2k DeathHand cluster logic 2019-05-09 22:28:46 +01:00
reaperrr
cf091e0548 Implement TS cluster missile warhead 2019-05-09 22:28:46 +01:00
reaperrr
9e91232ca7 Add DetonationAltitude to NukePower
And RemoveMissileOnDetonation boolean.

Allows airburst, and optionally missile continuing
until it hits the ground (without a second explosion).
2019-05-09 22:28:46 +01:00
Zimmermann Gyula
2648764ee3 Add FireClusterWarhead 2019-05-09 22:28:46 +01:00
teinarss
0e3d343f15 VAlign correctly in LabelWidget 2019-05-09 22:17:24 +02:00
teinarss
2d1c110857 Calculate font size correctly 2019-05-09 22:17:24 +02:00
Paul Chote
7c71e55b01 Restore no-arg ExponentialSliderWidget ctor.
This is required for dynamic widget creation.
2019-05-09 21:38:40 +02:00
Paul Chote
ba282865f1 Replace legacy StyleCop(Plus) with StyleCopAnalyzers
Analyzers are enabled in the Debug configuration
only to avoid unnecessary overheads when compiling
normally.
2019-05-09 20:40:08 +02:00
Paul Chote
353db73381 Fix a collection of minor style violations.
This enables several new StyleCopAnalyzer rules to
be enabled immediately during migration.
2019-05-09 20:40:08 +02:00
Paul Chote
76a8ae9f98 Set default values for BitSet<TargetableType>. 2019-05-09 20:40:08 +02:00
reaperrr
c24398e32c Repulsion performance optimizations
`cruising` is updated  on every position change,
so we can safely re-use it instead of
performing another DAT check.
Additionally, if repulsion force is
horizontally zero, it's guaranteed to be WVec.Zero,
so we can save that conversion too.
2019-05-09 19:00:07 +02:00
reaperrr
83b4e448c8 Fix Jumpjet default HeightOffset
Jumpjet CruiseHeight in TS was 500, roughly equivalent to
3.9 cells in OpenRA.
2019-05-05 23:41:55 +02:00
reaperrr
2953cbd9f1 Improve TS Harpy rotor offset 2019-05-05 23:41:55 +02:00
reaperrr
64d891cc6c Improve TS aircraft altitude values
The CruiseAltitude values and AltitudeVelocity
default were far too low compared to the original.
2019-05-05 23:41:55 +02:00
Paul Chote
f0d59391b5 Remove Start-Process from make.ps1.
This also removes the hardcoded path
requirement for dotnet.exe, and simplifies
the utility and dotnet detection.

The nr flag is no longer needed for dotnet,
and nologo is added to reduce unnecessary output.

The Release configuration is set for consistency
with the real Makefile.
2019-05-05 23:19:04 +02:00
Paul Chote
ac8252531b Fix solution listings in the Rider IDE. 2019-05-05 23:19:04 +02:00
Paul Chote
b93490efd0 Remove legacy cruft from .gitignore. 2019-05-05 23:19:04 +02:00
Paul Chote
1955cac84e Unify Windows and mono build systems.
The Makefile behaviour is recreated using the new and significantly
cleaner .NET Core csproj format.

fixheader.exe is promoted to OpenRA.PostProcess.exe and now runs
on all platforms.
2019-05-05 23:19:04 +02:00
Paul Chote
6e364cdbee Switch AppVeyor to use Visual Studio 2017. 2019-05-05 23:19:04 +02:00
Paul Chote
761b5e094d Reduce minimum .NET requirement to 4.6.1.
4.7.2 causes compatibility issues with Mono 5.4
in the interim period before we migrate to netstandard2.
2019-05-05 23:19:04 +02:00
Mustafa Alperen Seki
a4bac42c7f Add /playerxp command. 2019-05-05 21:52:28 +02:00
Paul Chote
5e38cfda81 Enable skirmish saves. 2019-05-05 09:30:58 +02:00
Paul Chote
c8f2ee5270 Save and load skirmish spectator viewport. 2019-05-05 09:30:58 +02:00
Paul Chote
410d0796c3 Disable bot logic while reloading game saves. 2019-05-05 09:30:58 +02:00
Paul Chote
100ec17ef0 Implement IGameSaveTraitData on BotModules. 2019-05-05 09:30:58 +02:00
Paul Chote
5f8a0f3372 Add IBotEnabled interface. 2019-05-05 09:30:58 +02:00
tovl
9abf715fd7 Allow opportunity fire for aircraft. 2019-05-04 23:40:16 +02:00
tovl
f16ff9eaa0 Base AttackAircraft on AttackFollow and get rid of SequenceActivities. 2019-05-04 23:40:16 +02:00
reaperrr
da6bf1a57d Make ActorTags display ChildActivities 2019-05-04 21:33:10 +02:00
jrb0001
b774556a5f Reduce overhead of every single order/sync frame by 162/222 bytes 2019-05-04 09:48:36 +02:00
LipkeGu
7f7809fe70 Use TryGet instead of Get and assign a default Fallback Color
This Fixes a crash in Situations when custom mods are used and reset OpenRA to its initial state.
2019-05-04 09:39:56 +02:00
matjaeck
c7b8f9f09f Add references to the Code of Conduct. 2019-05-04 09:27:34 +02:00
Paul Chote
e3f868f0a8 Update TS map previews and formatting. 2019-05-02 13:40:22 +02:00
Paul Chote
143cee2a80 Update D2k map previews and formatting. 2019-05-02 13:40:22 +02:00
Paul Chote
67683aacdb Update TD map previews and formatting. 2019-05-02 13:40:22 +02:00
Paul Chote
fe68780d1c Remove space from "Snow Town" map path. 2019-05-02 13:40:22 +02:00
Paul Chote
e431954107 Update RA map previews and formatting. 2019-05-02 13:40:22 +02:00
Paul Chote
f301cb891f Add missing LockPreview to mission maps. 2019-05-02 13:40:22 +02:00
Paul Chote
5f157c572f Restore newlines between top-level map.yaml blocks. 2019-05-02 13:40:22 +02:00
Paul Chote
d9c30c9659 Fix missing EOF yaml newlines and other style issues. 2019-05-02 13:40:22 +02:00
Paul Chote
2a085945df Add terminating newline to yaml strings. 2019-05-02 13:40:22 +02:00
Paul Chote
753a0b1e3e Add --refresh-map utility command. 2019-05-02 13:40:22 +02:00
reaperrr
ad4c0e6dee Remove HeliFlyCircle activity
FlyCircle actually works fine for D2k Carryalls,
and no other place used this.
2019-05-01 20:50:10 +01:00
Unknown
77d890848b Fix givecashall debug command
Issuing an order to another client causes a validation error in
ValidateOrder.OrderValidation(...). To fix this /givecashall will now
be issued as an order to the client that introduced the command. This
client will then resolve the command and give the cash to all playable
parties.
2019-05-01 18:30:44 +02:00
reaperrr
543d46f47c Make ground actors leave resupplier if resupply is aborted 2019-04-29 01:40:52 +01:00
reaperrr
bc0d8ca015 Remove ResupplyAircraft and AllowYieldingReservation
The few extra things those two activities did can be done
in Resupply, making them redundant.
2019-04-29 01:40:52 +01:00
reaperrr
4a06c66dbd Fix resupply anim not always finishing properly 2019-04-29 01:40:52 +01:00
reaperrr
83934074a4 Merge INotifyRearm/Repair into INotifyResupply
And streamline its notify methods.
Also cache INotifyResupply traits at beginning
of Resupply activity.
2019-04-29 01:40:52 +01:00
reaperrr
ba4b5738d7 Merge Rearm and Repair into Resupply activity
Allows parallel rearming and repairing.
2019-04-29 01:40:52 +01:00
Smittytron
123b3f054f Remove cash steal objectives from Allies 06a and 06b 2019-04-28 10:19:37 +02:00
Paul Chote
f26992443d Remove periods from lobby option tooltips. 2019-04-28 00:24:28 +02:00
teinarss
d9d2202599 System messages should be yellow to distinguish them from normal 2019-04-27 14:51:59 +02:00
jrb0001
db487e1264 Give every immediate order its own framing 2019-04-23 01:00:52 +02:00
jrb0001
f3133617dd Prevent immediate orders from being sent as regular orders 2019-04-23 01:00:52 +02:00
BGluth
55aa346ad7 Aircraft can now scatter 2019-04-22 22:04:51 +02:00
teinarss
e801537d96 Hide cursor and render the placeholder directly 2019-04-22 21:51:49 +02:00
teinarss
09f4b69aef Fixed the problem with clicking the Support Power button 2019-04-22 21:51:49 +02:00
teinarss
5e58364fad Made SelectDirectionalTarget a opted in feature and added fields for palettes 2019-04-22 21:51:49 +02:00
abcdefg30
b2278e85f0 Add support for arbitrary objective type names 2019-04-22 21:04:42 +02:00
abcdefg30
38b3a4a668 Split INotifyWinStateChanged from INotifyObjectivesUpdated 2019-04-22 21:04:42 +02:00
abcdefg30
6163523334 Enable spectator team chat in the lobby 2019-04-22 19:55:04 +01:00
abcdefg30
e6feba8884 Remove the TeamChat order type 2019-04-22 19:55:04 +01:00
abcdefg30
83b92ebacb Disable team chat when only one team member is alive 2019-04-22 19:55:04 +01:00
abcdefg30
9a84ccdd1d Send the designated team number as extra data in the order 2019-04-22 19:55:04 +01:00
abcdefg30
991093df81 Let immediate orders send a bitfield for extra order data 2019-04-22 19:55:04 +01:00
abcdefg30
5e363f18c9 Disable the team chat button after the game ended 2019-04-22 19:55:04 +01:00
abcdefg30
7b8df0ed54 Disable spectator chat when there is only one spectator
and re-enable it when players die
2019-04-22 19:55:04 +01:00
abcdefg30
767de564fc Use Team numbers instead of stances 2019-04-22 19:55:04 +01:00
abcdefg30
43f22f908d Don't make team messages of dead players public 2019-04-22 19:55:04 +01:00
abcdefg30
9bd0a71ca8 Return early instead of nesting 2019-04-22 19:55:04 +01:00
abcdefg30
e7f60a1e25 Don't ignore the message limit in team chat 2019-04-22 19:55:04 +01:00
abcdefg30
4a9a5ba757 Remove and restyle comments in UnitOrders 2019-04-22 19:55:04 +01:00
Mustafa Alperen Seki
2bb2d6e9c5 Add ability to grant condition multipile times to GrantExternalConditionCrateAction 2019-04-22 20:51:23 +02:00
Mustafa Alperen Seki
de7706c98f Add ProductionCost/TimeMultiplier 2019-04-22 20:44:50 +02:00
Mustafa Alperen Seki
1f730fbfb9 Make EngineerRepairable Conditional. 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
c89d90e4b0 Add Types to EngineerRepair(able). 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
e63f52c43f Add RepairSound to EngineerRepair. 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
0f9a157943 Add support for Custom Cursors in EngineerRepairable. 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
2194584b25 Fix EngineerRepairable stance checks. 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
8752e76d1e Split EngineerRepairable to its own file. 2019-04-22 20:25:52 +02:00
Mustafa Alperen Seki
2463b2ed43 Remove Exit: from D2k ConYard. 2019-04-22 20:20:47 +02:00
Mustafa Alperen Seki
7a9d04395a Check for producee's IOccupySpaceInfo for production completation. 2019-04-22 20:20:47 +02:00
Mustafa Alperen Seki
f9ef41f165 Properly check for exitinfo != null in DoProduction() 2019-04-22 20:20:47 +02:00
Mustafa Alperen Seki
1573da03bb Fix production of dummy actors from producers without Exit trait. 2019-04-22 20:20:47 +02:00
tovl
ffbee7e45b Temp fix for harvester getting stuck around resource spawn 2019-04-22 16:39:47 +02:00
tovl
2eaeb2097c Refactor resource harvesting logic. 2019-04-22 16:39:47 +02:00
Mustafa Alperen Seki
77b313611e Make Queue Groups work with ClassicProductionQueue. 2019-04-22 16:16:35 +02:00
tovl
8e91a1ba89 Add order voice to GrantConditionOnDeploy. 2019-04-22 15:34:07 +02:00
tovl
9419d1b924 Fix TS artillery barrel disapearing during deploy animation. 2019-04-22 15:34:07 +02:00
tovl
351df4769b Let TS deployable units honor emp-disabled. 2019-04-22 15:34:07 +02:00
reaperrr
36783efbfb Give TS ClusterMissile a smoke trail
And increase visual FlightVelocity.

We don't know when this will be replaced with
TS-style voxel projectile, so a bit of visual polish can't hurt.
2019-04-22 15:13:11 +02:00
reaperrr
cee56a00af Give some translucency to TS missile trails 2019-04-22 15:13:11 +02:00
reaperrr
ba04965a63 Fix missile offsets & implement trail on DeathHand 2019-04-22 15:13:11 +02:00
reaperrr
78f538f103 Add sprite trail support to NukeLaunch/NukePower 2019-04-22 15:13:11 +02:00
reaperrr
4a71a6746f Group all Bullet Trail* properties together
Just a small code readability improvement.
2019-04-22 15:13:11 +02:00
tovl
560f8c26bc Add crushing logic to aircraft. 2019-04-22 02:56:57 +02:00
tovl
c633e07410 Make aircraft occupy cells when landed. 2019-04-22 02:56:57 +02:00
reaperrr
04a71a6c6a Exclude OpenRA.Platforms.Default.dll.config from clean
OpenRA.Platforms.Default.dll.config is part of the repo.
Linux makefile already excludes the file from removal.
2019-04-21 20:31:35 +02:00
tovl
6aea91bd46 Replace pseudo-childactivities in WaitForTransport. 2019-04-20 16:14:59 +01:00
tovl
a000b173d8 Replace pseudo-childactivities in Enter and related. 2019-04-20 16:14:59 +01:00
Paul Chote
d5588c51ed Implement "Game Saved" / "Game Loaded" notifications in RA and D2k. 2019-04-20 14:54:48 +02:00
Paul Chote
492b5aec82 Save and restore viewport position / selection / control groups. 2019-04-20 14:54:48 +02:00
Paul Chote
de9649df27 Add save/load browser and buttons to the UI. 2019-04-20 14:54:48 +02:00
Paul Chote
3a693d8def Implement loading screens. 2019-04-20 14:54:48 +02:00
Paul Chote
1f3b30c2d2 Implement game save/load backend. 2019-04-20 14:54:48 +02:00
Paul Chote
877215c86a Dynamically populate the ingame menu. 2019-04-20 14:54:48 +02:00
Paul Chote
1cfb110d03 Allow the cursor to be force disabled. 2019-04-20 14:54:48 +02:00
Paul Chote
f731c09086 Fix TD input prompt button height. 2019-04-20 14:54:48 +02:00
Paul Chote
bb324fb2d4 Add Sound.DisableAllSounds property. 2019-04-20 14:54:48 +02:00
Paul Chote
5d43417a5f Add player trait support for IWorldLoaded. 2019-04-20 14:54:48 +02:00
Lars Beckers
e6750bf19c Fix attack behaviour of disabled units. 2019-04-20 02:28:27 +02:00
abcdefg30
1bb319425b Add Sound.Play overloads that play a random sound from a list 2019-04-20 01:22:30 +02:00
reaperrr
5f6c8ba5d3 Fix Mobile.CurrentMovementType vertical handling
On bleed, the Horizontal flag is always returned on any position change,
even if that change is vertical-only.
2019-04-20 00:48:12 +02:00
abcdefg30
981fe6fae1 Remove the Lua return type of Beacon.New 2019-04-19 16:31:03 +02:00
abcdefg30
c93dc1424c Throw a LuaException when placing a beacon without the player trait 2019-04-19 16:31:03 +02:00
reaperrr
db68c6e264 Fix Mobile actors turning even if Mobile is paused 2019-04-14 21:58:28 +02:00
tovl
cc7e758b27 Replace pseudo-childactivities in carryall logic. 2019-04-14 19:05:06 +01:00
reaperrr
0eb0a5a2bd Add WithHarvesterSpriteBody
And move PrefixByFullness there.
Also put it into Mods.Cnc, as RA is the only shipping mod
using this.
2019-04-14 19:09:28 +02:00
reaperrr
840eb7006d Make actors ignore ReturnToBase order if already on resupplier 2019-04-13 18:47:08 +02:00
reaperrr
717b8a24f1 Fix ReturnToBase restarting on each hotkey press
Now that the RTB process is a single activity with childs,
it's relatively easy to prevent the activity from restarting
every time the deploy/RTB hotkey is pressed.
2019-04-13 18:47:08 +02:00
reaperrr
b24e4510c8 Make aircraft without TakeOffOnResupply always land
on resupplier, even if ammo is full, when given a
"ReturnToBase" order via deploy key.
In other words, in that case treat the RTB order like an
explicit "Repair" or "Enter" order.
2019-04-13 18:47:08 +02:00
reaperrr
c7eee6ae5d Improve ReturnToBase Activity.cs adherance
And make it use child activities for queueability.
2019-04-13 18:47:08 +02:00
reaperrr
8edf5b56ea Exclude dead actors from ChooseResupplier 2019-04-13 18:47:08 +02:00
reaperrr
2cdae0b380 Merge HeliReturnToBase into ReturnToBase 2019-04-13 18:47:08 +02:00
tovl
2a942bd04a Fix crash in FindAndDeliverResources.GetSearchFromLocation. 2019-04-13 16:04:54 +02:00
abcdefg30
14a4c47758 Increase the ZOffset of ore and gem mines in RA 2019-04-12 00:11:47 +02:00
teinarss
71596ae959 Added drag direction mouse interaction for set the approach direction for airstrike and parabombs 2019-04-04 20:10:34 +02:00
teinarss
1dd90a1d7b Pushed down the MouseInput handling to the OrderGenerators and made a base class for handling the basic logic 2019-04-04 20:10:34 +02:00
Mustafa Alperen Seki
9ec8d25dff Add AppearsOnMapPreview to default mods.
To Walls, (Tib)Trees, Ore/Gem Mines and Tech Structures.
2019-04-04 19:37:19 +02:00
Mustafa Alperen Seki
9fef2c01ec Add AppearsOnMapPreview
Allows preplaced actors to be rendered on map preview when saving the
map.

Also removes requirements for ResourceLayer in OpenRA.Game and moves it
to OpenRA.Mods.Common.
2019-04-04 19:37:19 +02:00
tovl
ea4f24d0b7 Rework harvester automation. 2019-04-04 19:22:25 +02:00
tovl
1d590ac207 Sanitize harvester search behavior. 2019-04-04 19:22:25 +02:00
tovl
8d8cade266 Remove no-op on harvester creation. 2019-04-04 19:22:25 +02:00
tovl
bc7516989e Rework harvester unblock and idle behavior. 2019-04-04 19:22:25 +02:00
tovl
3bfa32ca33 harvester Harvest order works with queues
fix for autocarryable harvesters

Make use of QueueActivity's own handling of order.Queued
2019-04-04 19:22:25 +02:00
tovl
307a87cd9e harvester Deliver order works with queues 2019-04-04 19:22:25 +02:00
Anson Wayman
f64c8f1ee8 Fix pluggable regression
Modified gapowr and gatower upgrade requirements to prevent multiple
stacking plug bug.
2019-04-04 19:11:04 +02:00
Mustafa Alperen Seki
e7b8a56511 Add ValidStances to AutoTargetPriority. 2019-04-04 19:08:10 +02:00
tovl
25bc3ae2d2 Fix chinook being unable to land. 2019-03-31 18:25:14 +02:00
teinarss
a467e2c92e Added the setting insert_final_newline to editorconfig 2019-03-31 18:02:17 +02:00
Daniel Llewellyn
6289816a69 Update thirdparty/configure-native-deps.sh
Add aarch64 and ppc64le architecture library to search paths.
2019-03-31 15:47:05 +02:00
Oliver Brakmann
320717003f Fix crash due to conflicting access to collection in killed Cargo 2019-03-31 08:41:06 +02:00
Mustafa Alperen Seki
1373a4e16e Seperate TS shellmap rules to Rules yaml.
And make all buildings and walls indestructible.
2019-03-30 23:08:46 +01:00
Paul Chote
f69c6ab3fb Update SharpZipLib to 1.1.0.
The default code page has been changed to UTF8
so our workarounds are no longer needed.
2019-03-30 20:47:22 +01:00
Paul Chote
9cbf08201f Disable debug and enable optimizations by default.
This does not affect stacktraces produced during
a crash when run using `mono --debug`.
2019-03-30 20:17:17 +01:00
Paul Chote
93193d4e63 Document dependency changes in INSTALL.md. 2019-03-30 20:17:17 +01:00
Paul Chote
2c0711d5fb Enable HiDPI rendering in Windows installer. 2019-03-30 20:17:17 +01:00
Paul Chote
d53338ca5e Switch to the newer Roslyn compiler on Linux/macOS. 2019-03-30 20:17:17 +01:00
Paul Chote
5b00586de2 Update Travis to Ubuntu 16.04, Mono 5.10, NSIS 3.03. 2019-03-30 20:17:17 +01:00
tovl
8ee11028d7 Replace SequenceActivities with ChildActivity in several air activities. 2019-03-30 18:54:30 +00:00
Mustafa Alperen Seki
7fe2d1223b Disable veterancy on TS Shellmap 2019-03-30 17:26:43 +01:00
Mustafa Alperen Seki
18be10b537 Make walls on shellmap indestructible. 2019-03-30 17:26:43 +01:00
Mustafa Alperen Seki
dc2fe5b682 Fix Veterancy removal on shellmap rules. 2019-03-30 17:26:43 +01:00
reaperrr
c82888204b MovementTypes refactor update rule 2019-03-30 16:24:47 +00:00
reaperrr
404eee23f9 Adapt WithMoveAnimation to INotifyMoving
And add ValidMovementTypes for configurability.
2019-03-30 16:24:47 +00:00
reaperrr
4c53599736 Adapt GrantConditionOnMovement to INotifyMoving 2019-03-30 16:24:47 +00:00
reaperrr
a10af382b4 Add plumbing for notifying traits of movement
More precisely, about start and stop of movement.
2019-03-30 16:24:47 +00:00
reaperrr
32ab822786 Fix ResupplyAircraft being cancelable by Stop command
It is now immediately queued again, as long as the actor
has not finished rearming/repairing yet.
2019-03-30 16:44:04 +01:00
reaperrr
b92aef5754 Make Aircraft.GetActorBelow() LandAltitude-aware 2019-03-30 16:44:04 +01:00
reaperrr
3211119027 Simplify ResupplyAircraft
By moving part of the take-off prevention (when TakeOffOnResupply
is set to false) to Aircraft.

Main reason & advantage is that dropping the 'WaitFor' child
makes this activity always end when resupplies are done,
which makes it more compatible with being queued as ChildActivity
itself (for example by ReturnToBase).
2019-03-30 16:44:04 +01:00
Oliver Brakmann
b4fd7331b2 Simplify Activity class
After the removal of the CompositeActivity class, all the supporting
code that made it work can be removed as well.
2019-03-30 14:38:23 +00:00
AngryBirdz
19977bb7da Counterstrike Soviet mission Top o' The World ported
I've just finished porting this mission. Tell me if you spot something wrong ;)

Update: Fixed a few things in the lua and rules.
2019-03-28 15:21:21 +01:00
Ivaylo Draganov
7695714f66 Add hotkey for removing actors from control groups
* Add `RemoveFromControlGroup` hotkey
* Add `RemoveFromControlGroup` method to `OpenRA.Game.Selection`
2019-03-28 13:20:47 +01:00
Smittytron
99987db5d9 Add Counterstrike mission Sarin Gas 2: Down Under 2019-03-28 13:14:35 +01:00
Clément Bœsch
3b926d71b5 Honor modifiers in multitap detection
Fixes Issue #15577.
2019-03-26 22:29:04 +01:00
Paul Chote
54d5afed57 Package mono inside the macOS app bundles.
This also removes the explicit dependency on mono's
packaged FreeType, which should allow development
builds to be used with homebrew-packaged mono.
2019-03-26 22:11:58 +01:00
tovl
872bf737e0 Fix transport being blocked by its own passengers. 2019-03-26 21:55:43 +01:00
Voidwalker
a46ec5d930 Cargo improvements 2019-03-26 21:34:09 +01:00
tovl
30de4df749 Replace SequenceActivities with ChildActivity in several activities. 2019-03-25 20:22:35 +00:00
Paul Chote
90ddf24cf3 Display the correct version on generated wiki pages. 2019-03-24 23:24:04 +01:00
Paul Chote
d7ff894346 Actually push the generated weapon docs to the wiki. 2019-03-24 23:24:04 +01:00
Vasya N
63817ae807 TS: fix disruptor healing 2019-03-24 17:23:49 +00:00
Oliver Brakmann
44ca01d36c Remove pretick argument from Activity.Queue()
Pre-ticking a next activity would break the assumption that activities
in a queue would be processed in sequence.
2019-03-24 15:53:13 +00:00
reaperrr
9a15df9dde Update bleed update rule folder and update path
The release is out now, so it's time for updating this.
2019-03-23 21:34:22 +01:00
tovl
5782dde1c7 Remove ISync from AttackMove. 2019-03-23 21:02:04 +01:00
reaperrr
151fea9c00 Remove duplicate Aircraft from TS jumpjet husk 2019-03-23 12:35:12 +01:00
Paul Chote
817db8dbe0 Fix build artifacts leaking between platforms.
This moves the `dependencies` target from `core`
to `default`, so that we aren't forced to run
`linux-dependencies` for non-linux platforms.
2019-03-22 21:36:20 +01:00
Paul Chote
2afd8a3a74 Package mono 5.10 in the AppImages. 2019-03-22 21:36:20 +01:00
Paul Chote
2ba2510018 Check for unpackaged dependencies in make check. 2019-03-22 21:36:20 +01:00
Mustafa Alperen Seki
6c9d961bb5 Polishing Hovers 2019-03-22 21:12:36 +01:00
tovl
16f1750252 Remove ResupplyAircraft hack 2019-03-22 19:02:05 +01:00
tovl
e2e4caf0ba Make Aircraft.OnBecomingIdle accesible. 2019-03-22 19:02:05 +01:00
tovl
64cec4a0ad Revise AttackMoveActivity. 2019-03-22 19:02:05 +01:00
Paul Chote
01f6f98097 Require .NET Framework >= 4.7.2 on Windows. 2019-03-21 20:04:14 +01:00
Mustafa Alperen Seki
ac7d2e00e3 Use .Trait<ConditionManager>(); on GrantConditionOnDamageState 2019-03-21 14:36:33 +01:00
Mustafa Alperen Seki
d54e4395e5 Add GrantConditionOnHealth 2019-03-21 14:36:33 +01:00
Maarten
040f071833 Also trigger mission fail when subpen is sold 2019-03-21 14:25:48 +01:00
abcdefg30
a3325277d9 Prevent support powers from creating two camera actors 2019-03-14 19:29:39 +00:00
Paul Chote
aa9724cc40 Remove SharpFont dependency. 2019-03-14 16:39:26 +01:00
Paul Chote
ebeaf95e4c Reimplement FreeTypeFont against FreeType directly. 2019-03-14 16:39:26 +01:00
Paul Chote
1d4576229a Move FreeType handling into the Platform dll. 2019-03-14 16:39:26 +01:00
abcdefg30
e2a51676f7 Add an update rule for the PlaceSimpleBeacon removal 2019-03-14 01:55:34 +01:00
abcdefg30
2ab127537c Remove PlaceSimpleBeacon and AnimatedBeacon 2019-03-14 01:55:34 +01:00
abcdefg30
8578ce1346 Merge PlaceSimpleBeacon and AnimatedBeacon into PlaceBeacon and Beacon 2019-03-14 01:55:34 +01:00
Mustafa Alperen Seki
8edbf665c5 Make D2k AI don't update ConYard for 2,5 Minutes. 2019-03-14 01:36:44 +01:00
Mustafa Alperen Seki
2aebb05cd0 Implement Building/UnitDelays 2019-03-14 01:36:44 +01:00
Paul Chote
2a9721a9f8 Remove System.Drawing dependency. 2019-03-14 01:01:49 +01:00
Paul Chote
5cc81f7bf7 Implement a simple managed png writer. 2019-03-14 01:01:49 +01:00
tovl
9f419fca34 make cargo unload deploy action queueable
fix line spacing

remove unnecessary null check
2019-03-14 00:54:54 +01:00
tovl
da2e56e478 Make deploying mines queueable. 2019-03-14 00:23:47 +01:00
Mustafa Alperen Seki
556774804f Make Capture related traits conditional. 2019-03-13 23:43:16 +01:00
Mustafa Alperen Seki
35ad33e8be Fix filenames of capture related traits. 2019-03-13 23:43:16 +01:00
abcdefg30
00b8576edf Remove the unused INotifySold.Selling implementation 2019-03-13 23:14:35 +01:00
abcdefg30
f021439dee Use explicit implementation in ScriptTriggers.cs 2019-03-13 23:14:35 +01:00
abcdefg30
59a438b80e Add the ScriptTriggers trait to the world actors 2019-03-13 23:14:35 +01:00
abcdefg30
2db2148310 Add OnAnyProduction and OnSold lua triggers 2019-03-13 23:14:35 +01:00
tovl
c096fbde96 make portable chrono queueable
give PortableChrono fallback movement

style fix

add chrono target line

require and cache IMove
2019-03-12 13:38:48 +01:00
Paul Chote
71b61ad8ee Remove bogus and unnecessary Color[] FieldLoader override. 2019-03-12 12:44:29 +01:00
Paul Chote
d70055c38d Add int channel version of Color.FromAhsl. 2019-03-12 12:41:06 +01:00
Paul Chote
6927767013 Add authentication fingerprint to replay metadata. 2019-03-12 12:37:51 +01:00
abcdefg30
ed255fa919 Move update rules into the correct subfolder 2019-03-11 21:56:13 +00:00
Curtis Shmyr
c1506416c9 Change MECH repair voice from Move to Action 2019-03-11 22:38:47 +01:00
abcdefg30
0ab7e0a855 Add support for multiple (un)deploy sounds on GrantConditionOnDeploy 2019-03-11 21:31:39 +00:00
Paul Chote
ab6ae7bc8d Support 24 bit png loading. 2019-03-11 20:14:09 +01:00
reaperrr
ea2e452075 Add SpawnActorEffect
And use it to drop DelayedAction from ReinforcementsGlobal.
2019-03-11 12:54:58 +01:00
reaperrr
ab4268025a Fix TS Stealth Generator ignoring EMP
On bleed it continues to stealth the surrounding actors when EMP'd.
2019-03-10 23:16:25 +00:00
tovl
6f213dddec Make Attack use ChildActivities 2019-03-10 20:51:47 +01:00
reaperrr
5ec47b47af Rename fields on Repairable traits
To bring them in line with RearmActors,
Repairable.RepairBuildings and
RepairableNear.Buildings have been renamed
to RepairActors.
Additionally, their RA-specific internal
defaults were removed and the FieldLoader
now requires them to be set explicitly.
2019-03-10 19:19:49 +01:00
Mazar Farran
6dd84b2882 Add mazarf to AUTHORS 2019-03-10 18:20:01 +01:00
Oliver Brakmann
0bd00d3b7c Add a ReturnToGroundLayerOnIdle flag to CustomMovementLayers
Co-authored-by: Mazar Farran <farranmazar@gmail.com>
Co-authored-by: Paul Chote <paul@chote.net>
2019-03-10 18:20:01 +01:00
Paul Chote
8fc483b30b Work around a crash for invalid FrozenActor targets. 2019-03-10 17:29:17 +01:00
Paul Chote
6472840690 Notify players when a vehicle have been lost to a Thief. 2019-03-10 17:11:38 +01:00
Paul Chote
71dd84b9d5 Fix invalid target crash in SupportPowerManager.Activate. 2019-03-10 13:26:49 +01:00
Mustafa Alperen Seki
1a728ee153 Add ExperienceTrickler trait. 2019-03-10 13:13:16 +01:00
Mustafa Alperen Seki
b8a85091d4 Make WithRangeCircle conditional 2019-03-10 02:39:27 +01:00
Paul Chote
2ee6243e67 Remove shadow remapping from RA cursors. 2019-03-09 21:57:37 +00:00
Paul Chote
06e63e7dbc Remove bogus green-shadow remap from TD cursors. 2019-03-09 21:57:37 +00:00
tovl
705795abde Activity.Cancel returns void instead of bool. 2019-03-09 21:47:43 +00:00
tovl
a17cd0fa06 Replaced Canceled state with Canceling state. 2019-03-09 21:47:43 +00:00
tovl
8191a6566b Add missing self and optional pretick parameters to Queue, QueueChild and PrintActivity methods.
This means sequenceActivities needs to accept self as well.
2019-03-09 21:47:43 +00:00
tovl
69004f2b94 Prevent premature nulling of childactivities. 2019-03-09 21:47:43 +00:00
tovl
35dba74ded remove unused CompositeActivity 2019-03-09 21:47:43 +00:00
tovl
6d51d3988c fix aircraft ResupplyActivity 2019-03-09 21:47:43 +00:00
Mustafa Alperen Seki
0b0b82bd43 Implement Harvester>BaleUnloadAmount 2019-03-09 12:19:02 +00:00
reaperrr
a7702a8ecd Make HeliReturnToBase use RTB.ChooseResupplier
Small consistency fix and prep for merging HRTB into RTB.
2019-03-09 12:12:51 +00:00
reaperrr
2ac9d92ce7 Remove some legacy activity cruft from Aircraft
You only need to look at the RTB activities to tell that
Aircraft doing its own stuff here was somewhat redundant
and just made things worse regarding debugging and
code consistency.
2019-03-09 12:12:51 +00:00
reaperrr
d7f8f2ba7b Fix D2k Death Hand launch transition
Missile would otherwise visually disappear for a tick.
2019-03-09 12:02:44 +00:00
reaperrr
fa3bf5cefe Add delay support to NukeLaunch
And use that to remove the remaining DelayedAction from NukePower.
2019-03-09 12:02:44 +00:00
abcdefg30
d0c2dbcbb0 Let civilians use the normal stand animation when panicking 2019-03-09 11:57:45 +01:00
abcdefg30
0524a59b6b Fix map preview generation for isometric terrain 2019-03-08 21:21:10 +01:00
abcdefg30
19b2cb0afb Log the stack trace when map saving fails 2019-03-08 21:21:10 +01:00
Pavel Penev
ffac21c3d3 Explicitly specified NuGet package source in the Windows dependencies script
Otherwise NuGet breaks there are alternative (private) NuGet feeds set up on the local machine and one of them isn't responding currently.
2019-03-07 23:58:23 +01:00
Pavel Penev
6d63c99104 Changed NuGet download link for the Windows dependencies script
The previous link downloaded a very old version of nuget.exe for some reason.
2019-03-07 23:58:23 +01:00
reaperrr
2c311a84c9 Add OpenRA.StyleCheck.exe.config 2019-03-07 19:39:57 +01:00
reaperrr
33060a661f Revert #16196 2019-03-07 19:39:57 +01:00
tovl
2e5e7c22f4 Make Mobile a PausableConditionalTrait 2019-03-07 02:50:43 +01:00
Paul Chote
f63d0272a7 Fix map title not updating after remote query completes. 2019-03-06 18:23:33 +01:00
Paul Chote
fc9169a633 Reset spawn previews for empty servers. 2019-03-06 18:23:33 +01:00
Paul Chote
dad21fe879 Remove unused references to System.Data and System.XML. 2019-03-04 18:26:42 +00:00
Paul Chote
4886cca5d3 Remove System.Drawing references from mod code. 2019-03-04 18:26:42 +00:00
Paul Chote
3e404f6ac2 Remove HSLColor. 2019-03-04 18:26:42 +00:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
Paul Chote
ef9f74411b Remove unused variable in ButtonTooltipWithDescHighlightLogic. 2019-03-04 18:26:42 +00:00
Paul Chote
094c8b6432 Use Color.ToString() in perf logs. 2019-03-04 18:26:42 +00:00
Paul Chote
015316e909 Remove uses of state-mutating Rectangle.Offset and Intersect. 2019-03-04 18:26:42 +00:00
Paul Chote
0b641c20df Remove unnecessary uses of System.Drawing primitives. 2019-03-04 18:26:42 +00:00
Paul Chote
00496e2ec2 Remove Order.TargetLocation. 2019-03-04 18:08:42 +00:00
Paul Chote
c7dc237143 Remove Order.TargetLocation from Mobile. 2019-03-04 18:08:42 +00:00
Paul Chote
4c6f4f97d5 Remove Order.TargetLocation from Carryall. 2019-03-04 18:08:42 +00:00
Paul Chote
a5c89c2edc Remove Order.TargetLocation from AttackMove. 2019-03-04 18:08:42 +00:00
Paul Chote
c7d9d9613e Remove Order.TargetLocation from Harvester. 2019-03-04 18:08:42 +00:00
Paul Chote
cd92e94d74 Remove Order.TargetLocation from Aircraft. 2019-03-04 18:08:42 +00:00
Paul Chote
f70a452c56 Remove Order.TargetLocation from Minelayer. 2019-03-04 18:08:42 +00:00
Paul Chote
9c4231165b Remove Order.TargetLocation from beacons. 2019-03-04 18:08:42 +00:00
Paul Chote
d91d96a2e3 Remove Order.TargetLocation from building code. 2019-03-04 18:08:42 +00:00
Paul Chote
6dcd23e874 Remove Order.TargetLocation from support powers. 2019-03-04 18:08:42 +00:00
Unrud
7d72aae5ba Add /app/lib to Lua search locations (for Flatpak) 2019-03-02 20:11:06 +00:00
Paul Chote
666d2e7bac Work around harvester unloading activity queue issues. 2019-03-02 18:22:44 +01:00
Paul Chote
8b618ef7bc Fix maximum range estimation for stationary turrets. 2019-03-02 18:16:12 +01:00
Orb
cbbafd096d MGG Speed Reduction 2019-03-02 17:50:41 +01:00
Orb
e7134282c2 Balance Changes for Next Release by Orb 2019-03-02 17:50:41 +01:00
abcdefg30
7f3c527f4e Fix a crash in soviet05 2019-03-01 22:26:54 +00:00
reaperrr
cae6da77d4 Increase dog attack damage
To make sure it kills veteran Tanya as well as Drop Zone shok troopers.
2019-03-01 14:52:31 +01:00
reaperrr
638c727f5b Fix Drop Zone maps
Fixes Lint errors, Bomb truck gfx & lobby options.
2019-03-01 14:52:31 +01:00
TheChosenEvilOne
30103da2db Conditional TakeCover 2019-02-24 14:43:47 +01:00
Paul Chote
94f7f6fd2e Remove obsolete code. 2019-02-24 14:02:19 +01:00
Paul Chote
5a1124426d Rewrite screenshot saving. 2019-02-24 14:02:19 +01:00
Paul Chote
5f212a99fe Convert Map.SavePreview to new Png code. 2019-02-24 14:02:19 +01:00
Paul Chote
368b0314d5 Convert ConvertSpriteToPngCommand to new Png code. 2019-02-24 14:02:19 +01:00
Paul Chote
82fade25a6 Replace Sheet.AsBitmap with Sheet.AsPng. 2019-02-24 14:02:19 +01:00
Paul Chote
2c96eb9d24 Simplify PngSheetImportMetadataCommand. 2019-02-24 14:02:19 +01:00
Paul Chote
b41d4f5cee Allow Pngs to be created from pixel data. 2019-02-24 14:02:19 +01:00
Paul Chote
4f73b51240 Add Png.Save method. 2019-02-24 14:02:19 +01:00
netnazgul
88d16904ff Fix Pitfight: split stacked ore mine actors to different cells 2019-02-24 13:11:20 +01:00
Paul Chote
ea05e8aae5 Remove flawed RateLimit implementation. 2019-02-23 18:05:57 +00:00
tovl
dc9c758f12 unreserve when not queued 2019-02-22 21:48:34 +00:00
tovl
2975738477 make ReturnToBase order queueable 2019-02-22 21:48:34 +00:00
Punsho
621a42b7d7 Update fakes.yaml 2019-02-22 21:30:48 +00:00
SoScared
b480fecdbd Alter default bot and faction dropdownhights for the RA mod. 2019-02-22 21:26:37 +00:00
Andre Mohren
42446ac9ba Implemented trait defined Rollovers. 2019-02-22 21:15:33 +00:00
Mustafa Alperen Seki
7049f68fbd Add a boolean to show or not Refund X$ on the tooltip while selling. 2019-02-22 21:07:29 +00:00
Mustafa Alperen Seki
bc0296ad13 Add descriptions to the fields in Sellable, which lack them. 2019-02-22 21:07:29 +00:00
Mustafa Alperen Seki
3672a281d2 Make JamsMissiles conditional 2019-02-22 21:01:51 +00:00
portablestew
d592f37617 App config for StyleCheck 2019-02-22 20:15:20 +00:00
reaperrr
117dde32ba Removed unused sanity checks from pathfinding
These haven't been active and used in years.
2019-02-22 19:59:41 +00:00
reaperrr
5166b8cd5d Add missing closing bracket in Move comment 2019-02-22 19:59:41 +00:00
Paul Chote
f6ac32412d Avoid resetting FrozenActor.Hidden when refreshing GPS. 2019-02-22 20:53:39 +01:00
Paul Chote
bf9d06cb12 Reuse GPSDotEffect for the lifetime of the actor. 2019-02-22 20:40:23 +01:00
Ivaylo Draganov
3b6249323d Reorder stance hotkeys in settings to match command bar 2019-02-22 14:45:13 +01:00
abcdefg30
7c2f8ef918 Update the description of EnemyWatcher and AnnounceOnSeen 2019-02-22 14:32:16 +01:00
abcdefg30
db7414e822 Include a note about the necessity of AnnounceOnSeen for OnDiscovered 2019-02-22 14:32:16 +01:00
abcdefg30
599d174f33 Fix a typo in the Lua API description of OnDiscovered 2019-02-22 14:32:16 +01:00
Paul Chote
72c90d84a8 Fix editor crash when modifying newly placed actor ID. 2019-02-21 16:22:32 +01:00
Oliver Brakmann
6841da286c Fix pre-placed frozen actors not being targetable 2019-02-20 16:31:13 +00:00
teinarss
be741cea5e Prevent multiple enumeration of validCells in SpawnMPUnits 2019-02-18 19:35:33 +01:00
Maarten
f91d3f2603 Clarify mission objectives #16169 2019-02-15 15:30:43 +01:00
portablestew
a49287cc97 Possible fix for #14102: Consider airfield available if already reserved for the same actor 2019-02-15 13:59:53 +01:00
Paul Chote
f9cf45e634 Cache passenger bounty traits.
This avoids querying from potentially dead actors.
2019-02-09 19:46:46 +01:00
Paul Chote
49621bebd0 Abort activities when we don't know how close to move to a target. 2019-02-09 19:20:10 +01:00
portablestew
2d4bad66ae Fix for #7083: Fly stops turning when target is inside the turn radius 2019-02-08 19:38:01 +01:00
Paul Chote
95dc9cb1d2 Defer UpdateFrozenActor until the end of the tick.
Updating the frozen actor calls Actor.GetTargetablePositions,
and so we must guarantee that Created has been called for
the ITargetablePositions traits first.
2019-02-07 19:50:50 +00:00
Oliver Brakmann
0ee9219df3 Fix unresponsive aircraft when executing orders queued during resupply 2019-02-06 18:01:51 +00:00
reaperrr
297be6d6cc Normalize RA tracks 2019-02-03 20:46:39 +01:00
reaperrr
6ff41fe894 Normalize TD track volumes and fix order
Some tracks from the original were falsely listed under CovOps.
2019-02-03 20:46:39 +01:00
abcdefg30
25a4d156ce Let the extraction helicopter of Monster Tank Madness leave 2019-02-03 19:32:51 +00:00
Paul Chote
2b6ebcd09c Fix inconsistent FrozenActor state on capture/destruction. 2019-02-03 20:21:51 +01:00
Paul Chote
08e3e429db Remove obsolete LegacyEnter and ResolveFrozenActorOrder. 2019-02-03 20:21:51 +01:00
Paul Chote
42068f380e Remove ResolveFrozenActorOrder from MadTank. 2019-02-03 20:21:51 +01:00
Paul Chote
6ed2654038 Remove ResolveFrozenActorOrder from EntersTunnels. 2019-02-03 20:21:51 +01:00
Paul Chote
240c2243f2 Remove ResolveFrozenActorOrder from Carryall. 2019-02-03 20:21:51 +01:00
Paul Chote
71dd3202c3 Port EnterTransport to the new Enter activity.
This dramatically simplifies the reservation logic,
which seemed to be needlessly complicated. This may
regress unexpected edge-cases.
2019-02-03 20:21:51 +01:00
Paul Chote
d6b7d5c4c7 Port DonateExperience to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
cc288f5afc Port DonateCash to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
4551625bb4 Port RepairBridge to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
49e3c46d00 Port RepairBuilding to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
167371d540 Port Demolish to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
a17608a24e Port Infiltrate to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
e9c3216048 Port CaptureActor to the new Enter activity. 2019-02-03 20:21:51 +01:00
Paul Chote
c1e8bbfc58 Rewrite Enter activity, accounting for frozen and hidden actors. 2019-02-03 20:21:51 +01:00
Paul Chote
d2274f4285 Rewrite Mobile.MoveIntoTarget to support moving targets. 2019-02-03 20:21:51 +01:00
Paul Chote
1f7b558b29 Rename Enter to LegacyEnter. 2019-02-03 20:21:51 +01:00
Paul Chote
83212b100e Pause actor movement between cells when Mobile is disabled. 2019-02-03 20:21:51 +01:00
Paul Chote
c8f05e90dc Fix turn disabling mobile.IsMoving when setIsMoving is false. 2019-02-03 20:21:51 +01:00
Paul Chote
5995915281 Fix Positions returned by FrozenActor targets.
Also removes redundant Targetables check from actors.
2019-02-03 20:21:51 +01:00
reaperrr
31f4b0a5c4 Fix D2k bots wasting cash on building repairs
D2k bots not repairing buildings when damaged due to placement
without concrete was intentional, and this was bleed's default behavior
before BuildingRepairBotModule got introduced, too.
2019-02-03 18:24:15 +01:00
Paul Chote
f8991470da Disable OpportunityFire on Disruptors.
The original game defined NoMovingFire=true.
2019-02-03 18:07:02 +01:00
Paul Chote
c26e77552e Allow turreted actors to acquire targets while doing other activities. 2019-02-03 18:07:02 +01:00
Paul Chote
012b17b974 Implement a secondary target-of-opportunity for AttackFollow. 2019-02-03 18:07:02 +01:00
Smittytron
1830b3ee80 Add e6 and thf to Monster Tank Madness 2019-02-03 17:05:54 +01:00
Paul Chote
2194f17dc2 Fix double-revoke crash in Demolishable. 2019-02-03 16:38:04 +01:00
Paul Chote
0a57fbda3c Prefer target to lastVisible target if it is visible. 2019-02-03 16:32:25 +01:00
matjaeck
b466b5d660 Reset unit stance on owner change. 2019-02-03 16:20:24 +01:00
Paul Chote
fd013ad9d0 Remove unnecessary trait queries from HarvesterBotModule 2019-02-03 15:54:07 +01:00
reaperrr
4da2d32bc5 Fix that bots don't re-use capturers
They were never removed from activeCapturers when their target becomes invalid,
preventing the bot from reusing them.
2019-02-03 12:12:34 +00:00
reaperrr
32a3caf423 Fix CaptureManagerBotModule crashing on multiple Capturable
By removing the now-redundant CaptureTarget class.
2019-02-03 12:12:34 +00:00
Oliver Brakmann
3093f67427 Consider dead aircraft to no longer be in range 2019-02-03 11:31:44 +00:00
tovl
ee19cb61b4 add check for NextActivity to FlyCircle
prevent infinite loop

fix for ReturnToBase

cleanup
2019-02-03 11:24:19 +00:00
Paul Chote
b71c080285 Add VolumeModifier support to music. 2019-02-02 22:32:29 +01:00
Paul Chote
810aa744bf Remove AttackSuicides trait. 2019-02-01 23:18:18 +00:00
Paul Chote
24a491a7d7 Implement Hunter-Seeker kill behaviour. 2019-02-01 23:18:18 +00:00
Paul Chote
d750db26b7 Replace AttackSuicides with AttackFrontal and conditions in RA. 2019-02-01 23:18:18 +00:00
Paul Chote
0464a0db58 Remove unused negativeDamage variable from AttackBase. 2019-02-01 23:18:18 +00:00
Smittytron
f1f040a361 Reduce thief speed and engineer CaptureDelay 2019-02-01 22:42:36 +01:00
Paul Chote
cbb9b75144 Enable "campaign" bot for all scripted players in D2k missions. 2019-02-01 20:59:19 +01:00
Paul Chote
61acb905cd Enable "campaign" bot for all scripted players in TD missions. 2019-02-01 20:59:19 +01:00
Paul Chote
73b42e452d Enable "campaign" bot for all scripted players in RA missions. 2019-02-01 20:59:19 +01:00
Paul Chote
9c9cad1a15 Amend Force Attack command bar tooltip. 2019-01-28 00:14:27 +01:00
Paul Chote
2d9822638f Enable ForceFireIgnoresActors on artillery-style units. 2019-01-28 00:14:27 +01:00
Paul Chote
ab6dd3dcf2 Add ForceFireIgnoresActors to AttackBase. 2019-01-28 00:14:27 +01:00
Paul Chote
a2e35144a7 Fix gate animations. 2019-01-27 21:37:55 +01:00
Paul Chote
d6d1f3a06d Fix FrozenUnderFog / FrozenActor visibility consistency.
This fixes cases where both objects return visible / not
when queried at the wrong time during a tick.
2019-01-27 15:21:13 +01:00
Paul Chote
dc40a973e3 Allow attack orders to preempt move completion for turreted units. 2019-01-27 15:21:13 +01:00
Paul Chote
518a54a494 Reduce cash tick volume in the default mods. 2019-01-27 15:05:27 +01:00
Paul Chote
cbe3733deb Add VolumeModifier support to sound definitions. 2019-01-27 15:05:27 +01:00
Paul Chote
70f4c51a17 Add AttackMove workaround for Aircraft. 2019-01-27 00:19:50 +00:00
Paul Chote
60fcf5951c Fix target invalidation and reacquisition in fly activities. 2019-01-26 22:53:46 +00:00
Paul Chote
8efa0da54d Fix target invalidation and reacquisition in (Fly|Heli)Attack. 2019-01-26 22:53:46 +00:00
Paul Chote
0bfc487999 Fix target invalidation and reacquisition in AttackFollow. 2019-01-26 22:53:46 +00:00
Paul Chote
5ef7809002 Fix target invalidation and reacquisition in LeapAttack. 2019-01-26 22:53:46 +00:00
Paul Chote
7c52a6f498 Fix target invalidation and reacquisition in Attack. 2019-01-26 22:53:46 +00:00
Paul Chote
616b6c8499 Fix target invalidation and reacquisition in Follow. 2019-01-26 22:53:46 +00:00
Paul Chote
975821023d Fix target invalidation and reacquisition in MoveAdjacentTo. 2019-01-26 22:53:46 +00:00
Paul Chote
d03c5b1c48 Split Target.Recalculate into methods with and without invalidation.
TargetExtensions is moved into its own file.
2019-01-26 22:53:46 +00:00
Paul Chote
2080c72ab9 Define plumbing to pass initial target positions to inner move activities. 2019-01-26 22:53:46 +00:00
Paul Chote
b2d960ec19 Pass target line color to inner move activities. 2019-01-26 22:53:46 +00:00
Paul Chote
62102b9f77 Add support for Terrain targets with multiple positions. 2019-01-26 22:53:46 +00:00
Paul Chote
fbb1947624 Make Target fields readonly. 2019-01-26 22:53:46 +00:00
Paul Chote
c627a59b54 Fix self parameter name in DrawLineToTarget. 2019-01-26 22:53:46 +00:00
Paul Chote
7d85c1e81f Remove FrameEndTask from DrawLineToTarget.
This is no longer needed and causes ordering
issues when the unit becomes idle in the same
tick that SetTargetLine is called.
2019-01-26 22:53:46 +00:00
abcdefg30
2c6c2c00b4 Change the year number in README.md from 2018 to 2019 2019-01-26 23:15:21 +01:00
abcdefg30
4a9b00d3e7 Update the year numbers in the packaging section to 2019 2019-01-26 23:15:21 +01:00
abcdefg30
6151443618 Update CreateManPage.cs to print the new header 2019-01-26 23:15:21 +01:00
abcdefg30
12f278cdac Remove trailing white spaces from ant-attack.lua 2019-01-26 23:15:21 +01:00
abcdefg30
03e0fb6986 Add a header to ant-attack.lua 2019-01-26 23:15:21 +01:00
abcdefg30
8b9603168a Change the year number in all lua headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Paul Chote
628547a8e5 Fix source package creation. 2019-01-26 23:07:20 +01:00
Paul Chote
9025d11c54 Map Ctrl to Cmd for editor copy hotkey. 2019-01-26 21:46:46 +00:00
rob-v
de851fba2c Add shortcut for Copy in Map editor 2019-01-26 21:46:46 +00:00
Paul Chote
a545b2e5fa Deselect actors when their owner changes. 2019-01-26 21:40:31 +00:00
Paul Chote
0df159e73b Cache world INotifySelection traits in Selection. 2019-01-26 21:40:31 +00:00
Paul Chote
64c853a4e0 Only play queued notification if queue is empty.
This matches the behaviour of the RA2 sidebar.
2019-01-26 21:36:45 +00:00
Paul Chote
8d276ff9de Replace broken (Disabled)TabClick and with (Disabled)ClickSound. 2019-01-26 21:36:45 +00:00
Paul Chote
635038aa0b Disable bot logic during replays. 2019-01-26 21:33:47 +00:00
abcdefg30
531560c41e Allies03b: Fix the insertion helicopter revealing shroud 2019-01-26 21:29:04 +00:00
abcdefg30
e637b45cab Allies03: Remove hacke6 2019-01-26 21:29:04 +00:00
abcdefg30
c9c4d15b1e Allies03b: Fix heavy tank reinforcements triggering twice 2019-01-26 21:29:04 +00:00
abcdefg30
ff0521e5c8 Allies01: Remove redundance (caused by inheritance) 2019-01-26 21:29:04 +00:00
abcdefg30
c0b1225edc Allies01: Add a new line at the end of the briefing 2019-01-26 21:29:04 +00:00
abcdefg30
41dc9c7ca3 Allies01: Fix civilian infantry being visible below fog 2019-01-26 21:29:04 +00:00
abcdefg30
43a6558ac6 Allies01: Fix the extraction helicopter revealing shroud 2019-01-26 21:29:04 +00:00
abcdefg30
76b05c0c0d Allies01: Fix the extraction helicopter landing before being removed 2019-01-26 21:29:04 +00:00
abcdefg30
3e93242929 Fix OnAllRemovedFromWorld only triggering once 2019-01-22 23:09:21 +00:00
Paul Chote
d379555784 Remove Game.Debug messages from ValidateOrder. 2019-01-22 22:59:37 +00:00
rob-v
a2c6b19205 No player name in replay for chat commands 2019-01-22 22:57:11 +00:00
abcdefg30
428155c093 Fix LeapAttack setting attack.IsAiming too early 2019-01-22 22:52:43 +00:00
abcdefg30
3039b1d710 Reset the client state when being moved to spectator 2019-01-22 22:47:39 +00:00
abcdefg30
e08b75c2ad Only consider system maps in the mission browser 2019-01-19 18:47:29 +00:00
abcdefg30
717b483ce7 Use map folder names instead of paths in the mission browser 2019-01-19 18:47:29 +00:00
rob-v
9ed2ffea91 Fix Warhead.IsValidAgainst (FrozenActor.Owner null) 2019-01-19 12:03:15 +00:00
abcdefg30
7eff82c99b Move Actor103 in Allies02 one cell to the right
He was standing on impassable terrain and therefore couldn't move.
2019-01-19 11:56:22 +00:00
abcdefg30
30e3b45637 Let the remaing enemy troops in Allies02 attack the player
once the base is destroyed.
Does not include unit guarding the convoy path.
2019-01-19 11:56:22 +00:00
Smittytron
da40f45ece Add IsDead check to fix crash in Sarin Gas 1 2019-01-19 11:45:31 +00:00
abcdefg30
9c7ba51e29 Fix a crash in Infiltration 2019-01-19 11:27:15 +00:00
Smittytron
98e54edf04 Change tree husks from FrozenUnderFog to HiddenUnderShroud 2019-01-19 11:16:12 +00:00
Paul Chote
b1e87e4f60 Remove System.Bitmap from ITexture. 2019-01-08 21:20:06 +00:00
Paul Chote
84e965835b Remove System.Bitmap from badge and mod icons. 2019-01-08 21:20:06 +00:00
Paul Chote
f65a777366 Remove System.Bitmap from map preview loading. 2019-01-08 21:20:06 +00:00
Paul Chote
4f10d4a302 Remove System.Bitmap from UI artwork loading. 2019-01-08 21:20:06 +00:00
Paul Chote
52be0192f6 Add RGBA support to png parser. 2019-01-08 21:20:06 +00:00
Paul Chote
49b04221b2 Add palette checks for png sprites. 2019-01-08 21:20:06 +00:00
Paul Chote
d2ee9bcad9 Move Png loader back to OpenRA.Game. 2019-01-08 21:20:06 +00:00
Smittytron
05b866a87a Change LST turn speed to default max 2019-01-07 12:37:00 +01:00
Oliver Brakmann
c2cf8ba599 Add an interface to prevent actors from being spawned by SpawnMapActors 2019-01-07 10:13:50 +00:00
Mustafa Alperen Seki
df1d928242 Hide husks under fog regardless of their owner. 2019-01-06 22:12:04 +01:00
2136 changed files with 33672 additions and 19184 deletions

View File

@@ -4,6 +4,7 @@ root = true
; Unix-style newlines
[*]
end_of_line = LF
insert_final_newline = true
; 4-column tab indentation
[*.cs]

5
.gitattributes vendored
View File

@@ -8,8 +8,3 @@
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

21
.gitignore vendored
View File

@@ -13,12 +13,6 @@ obj
_ReSharper.*/
/.vs
# movies
*.vqa
# archives
*.mix
# binaries
mods/*/*.dll
mods/*/*.mdb
@@ -30,6 +24,7 @@ mods/*/*.pdb
/*.pdb
/*.mdb
/*.exe
/*.exe.config
thirdparty/download/*
*.mmdb.gz
@@ -46,20 +41,6 @@ thirdparty/download/*
# Mac OS X
.DS_Store
# XCode
packaging/osx/launcher/build/
packaging/osx/launcher/OpenRA.xcodeproj/*.pbxuser
packaging/osx/launcher/OpenRA.xcodeproj/*.perspectivev3
packaging/osx/launcher/OpenRA.xcodeproj/*.mode1v3
temp.c
temp.o
temp.s
OpenRA.Launcher.Mac/build/
OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.pbxuser
OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.perspectivev3
OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3
*.resources
# auto-generated documentation
DOCUMENTATION.md
WEAPONS.md

View File

@@ -1,11 +1,9 @@
# Travis-CI Build for OpenRA
# see travis-ci.org for details
dist: xenial
language: csharp
mono: 4.6.1
# http://docs.travis-ci.com/user/migrating-from-legacy
sudo: false
mono: 6.4.0
cache:
directories:
@@ -15,8 +13,6 @@ addons:
apt:
packages:
- lua5.1
- nsis
- nsis-common
- dpkg
- markdown
- zlib1g-dev
@@ -37,7 +33,7 @@ env:
# Run the NUnit tests
script:
- travis_retry make all-dependencies
- make all SDK="-sdk:4.5"
- make all
- make check
- make check-scripts
- make test
@@ -67,6 +63,11 @@ notifications:
skip_join: true
before_deploy:
- wget http://mirrors.kernel.org/ubuntu/pool/universe/n/nsis/nsis-common_3.03-2_all.deb
- wget http://mirrors.kernel.org/ubuntu/pool/universe/n/nsis/nsis_3.03-2_amd64.deb
- sudo dpkg -i nsis-common_3.03-2_all.deb
- sudo dpkg -i nsis_3.03-2_amd64.deb
- makensis -VERSION
- export PATH=$PATH:$HOME/usr/bin
- DOTVERSION=`echo ${TRAVIS_TAG} | sed "s/-/\\./g"`
- cd packaging

12
AUTHORS
View File

@@ -3,24 +3,24 @@ hard work of many contributors.
The OpenRA developers are:
* Chris Forbes (chrisf)
* Igor Popov (ihptru)
* Lukas Franke (abcdefg30)
* Oliver Brakmann (obrakmann)
* Paul Chote (pchote)
* Reaperrr
* Tom Roostan (RoosterDragon)
Previous developers included:
* Alli Witheford (alzeih)
* Caleb Anderson (RobotCaleb)
* Curtis Shmyr (hamb)
* Daniel Hernandez (Mancano)
* Igor Popov (ihptru)
* Matthias Mailänder (Mailaender)
* Megan Bowra-Dean (beedee)
* Mike Bundy (kehaar)
* Oliver Brakmann (obrakmann)
* Pavel Penev (penev92)
* Robert Pepperell (ytinasni)
* ScottNZ
* Tom Roostan (RoosterDragon)
Also thanks to:
* Adam Valy (Tschokky)
@@ -103,6 +103,7 @@ Also thanks to:
* Matthijs Benschop (Nerdie)
* Max621
* Max Ugrumov (katzsmile)
* Mazar Farran (mazarf)
* Michael Rätzel
* Michael Silber (frühstück)
* Michael Sztolcman (s1w_)
@@ -138,6 +139,8 @@ Also thanks to:
* Teemu Nieminen (Temeez)
* Tim Mylemans (gecko)
* Tirili
* Tomas Einarsson (Mesacer)
* Tom van Leth (tovl)
* Tristan Keating (Kilkakon)
* Tristan Mühlbacher (MicroBit)
* UnknownProgrammer
@@ -161,9 +164,6 @@ the Apache 2.0 license.
Using GeoLite2 data created by MaxMind and
distributed under the CC BY-SA 3.0 license.
Using SharpFont created by Robert Rouhani and
distributed under the MIT license.
Using SDL2-CS and OpenAL-CS created by Ethan
Lee and released under the zlib license.

View File

@@ -1,5 +1,8 @@
# OpenRA Contributing Guidelines
## Participating
Help us keep OpenRA open and inclusive. Please read and follow our [Code of Conduct](https://github.com/OpenRA/OpenRA/blob/bleed/CODE_OF_CONDUCT.md).
## Bug reports
* Have you read the [FAQ](https://github.com/OpenRA/OpenRA/wiki/FAQ)?

View File

@@ -6,15 +6,17 @@ The following lists per-platform dependencies required to build from source.
Windows
=======
* [Windows PowerShell >= 4.0](http://microsoft.com/powershell)
* [.NET Framework >= 4.5 (Client Profile)](http://www.microsoft.com/en-us/download/details.aspx?id=30653)
* [SDL 2](http://www.libsdl.org/download-2.0.php) (included)
* [FreeType](http://gnuwin32.sourceforge.net/packages/freetype.htm) (included)
* [zlib](http://gnuwin32.sourceforge.net/packages/zlib.htm) (included)
* [OpenAL](http://kcat.strangesoft.net/openal.html) (included)
* [liblua 5.1](http://luabinaries.sourceforge.net/download.html) (included)
Compiling OpenRA requires the following dependencies:
* [Windows PowerShell >= 4.0](http://microsoft.com/powershell) (included by default in recent Windows 10 versions)
* [.NET Framework 4.6.1 (Developer Pack)](https://dotnet.microsoft.com/download/dotnet-framework/net461) (or via Visual Studio 2017)
* [.NET Core 2.2 SDK](https://dotnet.microsoft.com/download/dotnet-core/2.2) (or via Visual Studio 2017)
You need to fetch the thirdparty dependencies and place them at the appropriate places by typing `make dependencies` in a command terminal.
Type `make dependencies` in a command terminal to download pre-compiled native libraries for:
* [SDL 2](http://www.libsdl.org/download-2.0.php)
* [FreeType](http://gnuwin32.sourceforge.net/packages/freetype.htm)
* [zlib](http://gnuwin32.sourceforge.net/packages/zlib.htm)
* [OpenAL](http://kcat.strangesoft.net/openal.html)
* [liblua 5.1](http://luabinaries.sourceforge.net/download.html)
To compile OpenRA, open the `OpenRA.sln` solution in the main folder, build it from the command-line with MSBuild or use the Makefile analogue command `make all` scripted in PowerShell syntax.
@@ -23,6 +25,8 @@ Run the game with `launch-game.cmd`. It can be handed arguments that specify the
Linux
=====
Mono, version 5.4 or later, is required to compile OpenRA. You can add the [upstream mono repository](https://www.mono-project.com/download/stable/#download-lin) for your distro to obtain the latest version if your system packages are not sufficient.
Use `make dependencies` to map the native libraries to your system and fetch the remaining CLI dependencies to place them at the appropriate places.
To compile OpenRA, run `make all` from the command line. After this one can run the game with `./launch-game.sh`. It is also possible to specify the mod you wish to run from the command line, e.g. with `./launch-game.sh Game.Mod=ts` if you wish to try the experimental Tiberian Sun mod.
@@ -41,6 +45,10 @@ sudo pacman -S mono openal libgl freetype2 sdl2 lua51 xdg-utils zenity
Debian/Ubuntu
-------------
:warning: The `mono` packages in the Ubuntu < 19.04 and Debian < 10 repositories are too old to support OpenRA. :warning:
See the instructions under the *Linux* section above to upgrade `mono` using the upstream releases if needed.
```
sudo apt install mono-devel libfreetype6 libopenal1 liblua5.1-0 libsdl2-2.0-0 xdg-utils zenity wget
```
@@ -48,6 +56,11 @@ sudo apt install mono-devel libfreetype6 libopenal1 liblua5.1-0 libsdl2-2.0-0 xd
Fedora
------
:warning: The `mono` packages in the Fedora repositories are too old to support OpenRA. :warning:
See the instructions under the *Linux* section above to upgrade `mono` using the upstream releases.
```
sudo dnf install "pkgconfig(mono)" SDL2 freetype "lua = 5.1" openal-soft xdg-utils zenity
```
@@ -85,7 +98,14 @@ sudo yum install "pkgconfig(mono)" SDL2 freetype "lua = 5.1" openal-soft xdg-uti
OSX
=====
Use `make dependencies` to map the native libraries to your system.
Before compiling OpenRA you must install the following dependencies:
* [Mono >= 5.4](https://www.mono-project.com/download/stable/#download-mac)
Use `make dependencies` to download pre-compiled native libraries for:
* [SDL 2](http://www.libsdl.org/download-2.0.php)
* [FreeType](http://gnuwin32.sourceforge.net/packages/freetype.htm)
* [OpenAL](http://kcat.strangesoft.net/openal.html)
* [liblua 5.1](http://luabinaries.sourceforge.net/download.html)
To compile OpenRA, run `make` from the command line.

247
Makefile
View File

@@ -1,7 +1,7 @@
############################# INSTRUCTIONS #############################
#
# to compile, run:
# make [DEBUG=false]
# make [DEBUG=true]
#
# to check unit tests (requires NUnit version >= 2.6), run:
# make nunit [NUNIT_CONSOLE=<path-to/nunit[2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]
@@ -33,28 +33,22 @@
# to start the game, run:
# openra
############################## TOOLCHAIN ###############################
#
SDK ?=
CSC = mcs $(SDK)
CSFLAGS = -nologo -warn:4 -codepage:utf8 -langversion:5 -unsafe -warnaserror
DEFINE = TRACE
COMMON_LIBS = System.dll System.Core.dll System.Data.dll System.Data.DataSetExtensions.dll System.Drawing.dll System.Numerics.dll System.Xml.dll thirdparty/download/ICSharpCode.SharpZipLib.dll thirdparty/download/FuzzyLogicLibrary.dll thirdparty/download/MaxMind.Db.dll thirdparty/download/Eluant.dll thirdparty/download/rix0rrr.BeaconLib.dll
# List of .NET assemblies that we can guarantee exist
# OpenRA.Game.dll is a harmless false positive that we can ignore
WHITELISTED_OPENRA_ASSEMBLIES = OpenRA.Game.exe OpenRA.Utility.exe OpenRA.Platforms.Default.dll OpenRA.Mods.Common.dll OpenRA.Mods.Cnc.dll OpenRA.Mods.D2k.dll OpenRA.Game.dll
# These are explicitly shipped alongside our core files by the packaging script
WHITELISTED_THIRDPARTY_ASSEMBLIES = ICSharpCode.SharpZipLib.dll FuzzyLogicLibrary.dll MaxMind.Db.dll Eluant.dll rix0rrr.BeaconLib.dll Open.Nat.dll SDL2-CS.dll OpenAL-CS.dll
# These are shipped in our custom minimal mono runtime and also available in the full system-installed .NET/mono stack
# This list *must* be kept in sync with the files packaged by the AppImageSupport and OpenRALauncherOSX repositories
WHITELISTED_CORE_ASSEMBLIES = mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll
NUNIT_LIBS_PATH :=
NUNIT_LIBS := $(NUNIT_LIBS_PATH)nunit.framework.dll
DEBUG = true
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
CSFLAGS += -debug:pdbonly -optimize+
else
CSFLAGS += -debug:full -optimize-
DEFINE := DEBUG;$(DEFINE)
endif
######################### UTILITIES/SETTINGS ###########################
#
# install locations
@@ -81,8 +75,13 @@ INSTALL_DIR = $(INSTALL) -d
INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
# Toolchain
MSBUILD = msbuild -verbosity:m -nologo
# Enable 32 bit builds while generating the windows installer
WIN32 = false
# program targets
CORE = pdefault game utility server
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
# dependencies
@@ -93,108 +92,30 @@ else
os-dependencies = linux-dependencies
endif
######################## PROGRAM TARGET RULES ##########################
#
# Core binaries
game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
game_TARGET = OpenRA.Game.exe
game_KIND = winexe
game_LIBS = $(COMMON_LIBS) $(game_DEPS) thirdparty/download/SharpFont.dll thirdparty/download/Open.Nat.dll
PROGRAMS += game
game: $(game_TARGET)
# Platform dlls
pdefault_SRCS := $(shell find OpenRA.Platforms.Default/ -iname '*.cs')
pdefault_TARGET = OpenRA.Platforms.Default.dll
pdefault_KIND = library
pdefault_DEPS = $(game_TARGET)
pdefault_LIBS = $(COMMON_LIBS) thirdparty/download/SDL2-CS.dll thirdparty/download/OpenAL-CS.dll $(pdefault_DEPS)
PROGRAMS += pdefault
platforms: $(pdefault_TARGET)
# Mods Common
mod_common_SRCS := $(shell find OpenRA.Mods.Common/ -iname '*.cs')
mod_common_TARGET = mods/common/OpenRA.Mods.Common.dll
mod_common_KIND = library
mod_common_DEPS = $(game_TARGET)
mod_common_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS)
PROGRAMS += mod_common
mod_common: $(mod_common_TARGET)
# NUnit testing
test_dll_SRCS := $(shell find OpenRA.Test/ -iname '*.cs')
test_dll_TARGET = OpenRA.Test.dll
test_dll_KIND = library
test_dll_DEPS = $(game_TARGET) $(mod_common_TARGET)
test_dll_FLAGS = -warn:1
test_dll_LIBS = $(COMMON_LIBS) $(game_TARGET) $(mod_common_TARGET) $(NUNIT_LIBS)
PROGRAMS += test_dll
test_dll: $(test_dll_TARGET)
##### Official Mods #####
STD_MOD_LIBS = $(game_TARGET)
STD_MOD_DEPS = $(STD_MOD_LIBS)
# Command and Conquer
mod_cnc_SRCS := $(shell find OpenRA.Mods.Cnc/ -iname '*.cs')
mod_cnc_TARGET = mods/common/OpenRA.Mods.Cnc.dll
mod_cnc_KIND = library
mod_cnc_DEPS = $(STD_MOD_DEPS) $(mod_common_TARGET)
mod_cnc_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(mod_common_TARGET)
PROGRAMS += mod_cnc
mod_cnc: $(mod_cnc_TARGET)
# Dune 2000
mod_d2k_SRCS := $(shell find OpenRA.Mods.D2k/ -iname '*.cs')
mod_d2k_TARGET = mods/d2k/OpenRA.Mods.D2k.dll
mod_d2k_KIND = library
mod_d2k_DEPS = $(STD_MOD_DEPS) $(mod_common_TARGET)
mod_d2k_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(mod_common_TARGET)
PROGRAMS += mod_d2k
mod_d2k: $(mod_d2k_TARGET)
check-scripts:
@echo
@echo "Checking for Lua syntax errors..."
@luac -p $(shell find mods/*/maps/* -iname '*.lua')
@luac -p $(shell find lua/* -iname '*.lua')
check: utility stylecheck mods
check: dependencies
@echo
@echo "Compiling in debug mode..."
@$(MSBUILD) -t:build -p:Configuration=Debug
@echo
@echo "Checking runtime assemblies..."
@mono --debug OpenRA.Utility.exe all --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES)
@echo
@echo "Checking for explicit interface violations..."
@mono --debug OpenRA.Utility.exe all --check-explicit-interfaces
@echo
@echo "Checking for code style violations in OpenRA.Game..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Game
@echo
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Platforms.Default
@echo
@echo "Checking for code style violations in OpenRA.Mods.Common..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Mods.Common
@echo
@echo "Checking for code style violations in OpenRA.Mods.Cnc..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Mods.Cnc
@echo
@echo "Checking for code style violations in OpenRA.Mods.D2k..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Mods.D2k
@echo
@echo "Checking for code style violations in OpenRA.Utility..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Utility
@echo
@echo "Checking for code style violations in OpenRA.Test..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Test
@echo
@echo "Checking for code style violations in OpenRA.Server..."
@mono --debug OpenRA.StyleCheck.exe OpenRA.Server
@echo "Checking for incorrect conditional trait interface overrides..."
@mono --debug OpenRA.Utility.exe all --check-conditional-trait-interface-overrides
NUNIT_CONSOLE := $(shell test -f thirdparty/download/nunit3-console.exe && echo mono thirdparty/download/nunit3-console.exe || \
which nunit3-console 2>/dev/null || which nunit2-console 2>/dev/null || which nunit-console 2>/dev/null)
nunit: test_dll
nunit: core
@echo
@echo "Checking unit tests..."
@if [ "$(NUNIT_CONSOLE)" = "" ] ; then \
@@ -211,7 +132,7 @@ nunit: test_dll
fi
@$(NUNIT_CONSOLE) --noresult OpenRA.Test.nunit
test: utility mods
test: core
@echo
@echo "Testing Tiberian Sun mod MiniYAML..."
@mono --debug OpenRA.Utility.exe ts --check-yaml
@@ -225,71 +146,22 @@ test: utility mods
@echo "Testing Red Alert mod MiniYAML..."
@mono --debug OpenRA.Utility.exe ra --check-yaml
##### Launchers / Utilities #####
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
utility_TARGET = OpenRA.Utility.exe
utility_KIND = exe
utility_DEPS = $(game_TARGET)
utility_LIBS = $(COMMON_LIBS) $(utility_DEPS) thirdparty/download/ICSharpCode.SharpZipLib.dll
PROGRAMS += utility
utility: $(utility_TARGET)
stylecheck_SRCS := $(shell find OpenRA.StyleCheck/ -iname '*.cs')
stylecheck_TARGET = OpenRA.StyleCheck.exe
stylecheck_KIND = exe
stylecheck_LIBS = thirdparty/download/StyleCop.dll thirdparty/download/StyleCop.CSharp.dll thirdparty/download/StyleCop.CSharp.Rules.dll
PROGRAMS += stylecheck
stylecheck: $(stylecheck_TARGET)
# Dedicated server
server_SRCS := $(shell find OpenRA.Server/ -iname '*.cs')
server_TARGET = OpenRA.Server.exe
server_KIND = exe
server_DEPS = $(game_TARGET)
server_LIBS = $(COMMON_LIBS) $(server_DEPS)
PROGRAMS += server
server: $(server_TARGET)
# Patches binary headers to work around a mono bug
fixheader.exe: packaging/fixheader.cs
@command -v $(CSC) >/dev/null || (echo "Mono is not installed. Please install Mono from http://www.mono-project.com/download/ before building OpenRA."; exit 1)
@echo CSC fixheader.exe
@$(CSC) packaging/fixheader.cs $(CSFLAGS) -out:fixheader.exe -t:exe $(COMMON_LIBS:%=-r:%)
# Generate build rules for each target defined above in PROGRAMS
define BUILD_ASSEMBLY
$$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS) fixheader.exe
@echo CSC $$(@)
@$(CSC) $$($(1)_LIBS:%=-r:%) \
-out:$$(@) $(CSFLAGS) $$($(1)_FLAGS) \
-define:"$(DEFINE)" \
-t:"$$($(1)_KIND)" \
$$($(1)_EXTRA) \
$$($(1)_SRCS)
@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))))
########################## MAKE/INSTALL RULES ##########################
#
default: core
all: dependencies core
core: dependencies game platforms mods utility server
mods: mod_common mod_cnc mod_d2k
all: dependencies core stylecheck
core:
@command -v $(firstword $(MSBUILD)) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
ifeq ($(WIN32), $(filter $(WIN32),true yes y on 1))
@$(MSBUILD) -t:build -p:Configuration="Release-x86"
else
@$(MSBUILD) -t:build -p:Configuration=Release
endif
clean:
@-$(RM_F) *.exe *.dll *.dylib *.dll.config ./OpenRA*/*.dll ./OpenRA*/*.mdb *.mdb mods/**/*.dll mods/**/*.mdb *.resources
@ $(MSBUILD) -t:clean
@-$(RM_F) *.config
@-$(RM_F) *.exe *.dll *.dylib ./OpenRA*/*.dll *.pdb mods/**/*.dll mods/**/*.pdb *.resources
@-$(RM_RF) ./*/bin ./*/obj
@-$(RM_RF) ./thirdparty/download
@@ -299,6 +171,7 @@ cli-dependencies:
@./thirdparty/fetch-thirdparty-deps.sh
@ $(CP_R) thirdparty/download/*.dll .
@ $(CP_R) thirdparty/download/*.dll.config .
@ test -f OpenRA.Game/obj/project.assets.json || $(MSBUILD) -t:restore
linux-dependencies: cli-dependencies geoip-dependencies linux-native-dependencies
@@ -306,7 +179,11 @@ linux-native-dependencies:
@./thirdparty/configure-native-deps.sh
windows-dependencies: cli-dependencies geoip-dependencies
@./thirdparty/fetch-thirdparty-deps-windows.sh
ifeq ($(WIN32), $(filter $(WIN32),true yes y on 1))
@./thirdparty/fetch-thirdparty-deps-windows.sh x86
else
@./thirdparty/fetch-thirdparty-deps-windows.sh x64
endif
osx-dependencies: cli-dependencies geoip-dependencies
@./thirdparty/fetch-thirdparty-deps-osx.sh
@@ -329,18 +206,19 @@ version: VERSION mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mo
rm $${i}.tmp; \
done
man-page: utility mods
@mono --debug OpenRA.Utility.exe all --man-page > openra.6
install: default install-core
install: dependencies core install-core
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
install-engine:
@-echo "Installing OpenRA engine to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) $(foreach prog,$(CORE),$($(prog)_TARGET)) "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) OpenRA.Game.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) OpenRA.Server.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) OpenRA.Utility.exe "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) OpenRA.Platforms.Default.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_DATA) OpenRA.Platforms.Default.dll.config "$(DATA_INSTALL_DIR)"
@$(INSTALL_DATA) "GeoLite2-Country.mmdb.gz" "$(DATA_INSTALL_DIR)/GeoLite2-Country.mmdb.gz"
@$(INSTALL_DATA) VERSION "$(DATA_INSTALL_DIR)/VERSION"
@$(INSTALL_DATA) AUTHORS "$(DATA_INSTALL_DIR)/AUTHORS"
@@ -353,8 +231,6 @@ install-engine:
@$(CP) Eluant* "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) ICSharpCode.SharpZipLib.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) FuzzyLogicLibrary.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) SharpFont.dll "$(DATA_INSTALL_DIR)"
@$(CP) SharpFont.dll.config "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) Open.Nat.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) MaxMind.Db.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) rix0rrr.BeaconLib.dll "$(DATA_INSTALL_DIR)"
@@ -363,8 +239,8 @@ install-common-mod-files:
@-echo "Installing OpenRA common mod files to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)/mods"
@$(CP_R) mods/common "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_PROGRAM) $(mod_common_TARGET) "$(DATA_INSTALL_DIR)/mods/common"
@$(INSTALL_PROGRAM) $(mod_cnc_TARGET) "$(DATA_INSTALL_DIR)/mods/common"
@$(INSTALL_PROGRAM) mods/common/OpenRA.Mods.Common.dll "$(DATA_INSTALL_DIR)/mods/common"
@$(INSTALL_PROGRAM) mods/common/OpenRA.Mods.Cnc.dll "$(DATA_INSTALL_DIR)/mods/common"
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
install-default-mods:
@@ -373,7 +249,7 @@ install-default-mods:
@$(CP_R) mods/cnc "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/ra "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/d2k "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_PROGRAM) $(mod_d2k_TARGET) "$(DATA_INSTALL_DIR)/mods/d2k"
@$(INSTALL_PROGRAM) mods/d2k/OpenRA.Mods.D2k.dll "$(DATA_INSTALL_DIR)/mods/d2k"
@$(CP_R) mods/modcontent "$(DATA_INSTALL_DIR)/mods/"
install-core: install-engine install-common-mod-files install-default-mods
@@ -419,9 +295,11 @@ install-linux-appdata:
@$(INSTALL_DATA) packaging/linux/openra-d2k.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@-$(RM) packaging/linux/openra-ra.appdata.xml packaging/linux/openra-cnc.appdata.xml packaging/linux/openra-d2k.appdata.xml
install-man-page: man-page
install-man-page:
@$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man6/"
@mono --debug OpenRA.Utility.exe all --man-page > openra.6
@$(INSTALL_DATA) openra.6 "$(DESTDIR)$(mandir)/man6/"
@-$(RM) openra.6
install-linux-scripts:
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
@@ -503,13 +381,10 @@ help:
@echo 'to start the game, run:'
@echo ' openra'
########################### MAKEFILE SETTINGS ##########################
#
.DEFAULT_GOAL := default
.DEFAULT_GOAL := all
.SUFFIXES:
.PHONY: core package all mods clean distclean dependencies version $(PROGRAMS) nunit
.PHONY: check-scripts check nunit test all core clean distclean cli-dependencies linux-dependencies linux-native-dependencies windows-dependencies osx-dependencies geoip-dependencies dependencies all-dependencies version install install-linux-shortcuts install-engine install-common-mod-files install-default-mods install-core install-linux-icons install-linux-desktop install-linux-mime install-linux-appdata install-man-page install-linux-scripts uninstall help

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,158 +12,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Activities
{
public enum ActivityState { Queued, Active, Done, Canceled }
public enum ActivityState { Queued, Active, Canceling, Done }
public class TargetLineNode
{
public readonly Target Target;
public readonly Color Color;
public readonly Sprite Tile;
public TargetLineNode(Target target, Color color, Sprite tile = null)
{
// Note: Not all activities are drawable. In that case, pass Target.Invalid as target,
// if "yield break" in TargetLineNode(Actor self) is not feasible.
Target = target;
Color = color;
Tile = tile;
}
}
/*
* Activities are actions carried out by actors during each tick.
*
* Activities exist in a graph data structure built up amongst themselves. Each activity has a parent activity,
* optionally child activities, and usually a next activity. An actor's CurrentActivity is a pointer into that graph
* and moves through it as activities run.
*
* There are two kinds of activities, the base activity and composite activities. They differ in the way their children
* are run: while a base activity is responsible for running its children itself, a composite activity relies on the actor's
* activity-running code. Therefore, the actor's CurrentActivity stays on the base activity while it runs its children. With
* composite activities however, the CurrentActivity moves through the list of children as they run.
*
*
* Things to be aware of when writing activities:
*
* - Use "return NextActivity" at least once somewhere in the tick method.
* - Do not use "return new SomeActivity()" as that will break the graph. Queue the new activity and use "return NextActivity" instead.
* - Do not "reuse" (with "SequenceActivities", for example) activity objects that have already finished running.
* - Use "return true" at least once somewhere in the tick method.
* - Do not "reuse" (with "SequenceActivities", for example) activity objects that have already started running.
* Queue a new instance instead.
* - Avoid calling actor.CancelActivity(). It is almost always a bug. Call activity.Cancel() instead.
* - A composite activity will run at least twice. The first time when it returns its children,
* the second time when its last child returns its Parent.
* - Do not return the Parent explicitly unless you have an extremly good reason. "return NextActivity"
* will do the right thing in all circumstances.
* - You do not need to care about the ChildActivity pointer advancing through the list of children,
* the activity code already takes care of that.
* - If you want to check whether there are any follow-up activities queued, check against "NextInQueue"
* in favour of "NextActivity" to avoid checking against the Parent activity.
*
*
* Guide when to use which kind of activity:
*
* - The activity does not have any children -> base activity
* - The activity needs to run preparatory steps during each tick before its children can be run -> base activity
* - The activity or the actor is left in a bogus state when one of the child activities is canceled -> base activity
* - The activity's children are self-contained and can run independently of the parent -> composite activity
* - The activity does not have any or little logic of its own, but is just composed of sub-steps -> composite activity
*/
public abstract class Activity
*/
public abstract class Activity : IActivityInterface
{
public ActivityState State { get; private set; }
/// <summary>
/// Returns the top-most activity *from the point of view of the calling activity*. Note that the root activity
/// can and likely will have next activities of its own, which would in turn be the root for their children.
/// </summary>
public Activity RootActivity
{
get
{
var p = this;
while (p.ParentActivity != null)
p = p.ParentActivity;
return p;
}
}
Activity parentActivity;
public Activity ParentActivity
{
get
{
return parentActivity;
}
protected set
{
parentActivity = value;
var next = NextInQueue;
if (next != null)
next.ParentActivity = parentActivity;
}
}
Activity childActivity;
protected Activity ChildActivity
{
get
{
return childActivity != null && childActivity.State < ActivityState.Done ? childActivity : null;
}
set
{
if (value == this || value == ParentActivity || value == NextInQueue)
childActivity = null;
else
{
childActivity = value;
if (childActivity != null)
childActivity.ParentActivity = this;
}
}
}
Activity nextActivity;
/// <summary>
/// The getter will return either the next activity or, if there is none, the parent one.
/// </summary>
public virtual Activity NextActivity
{
get
{
return nextActivity != null ? nextActivity : ParentActivity;
}
set
{
if (value == this || value == ParentActivity || (value != null && value.ParentActivity == this))
nextActivity = null;
else
{
nextActivity = value;
if (nextActivity != null)
nextActivity.ParentActivity = ParentActivity;
}
}
}
/// <summary>
/// The getter will return the next activity on the same level _only_, in contrast to NextActivity.
/// Use this to check whether there are any follow-up activities queued.
/// </summary>
public Activity NextInQueue
{
get { return nextActivity; }
set { NextActivity = value; }
}
protected Activity ChildActivity { get; private set; }
public Activity NextActivity { get; private set; }
public bool IsInterruptible { get; protected set; }
public bool IsCanceled { get { return State == ActivityState.Canceled; } }
public bool ChildHasPriority { get; protected set; }
public bool IsCanceling { get { return State == ActivityState.Canceling; } }
bool finishing;
bool lastRun;
public Activity()
{
IsInterruptible = true;
ChildHasPriority = true;
}
public Activity TickOuter(Actor self)
{
if (State == ActivityState.Done && Game.Settings.Debug.StrictActivityChecking)
throw new InvalidOperationException("Actor {0} attempted to tick activity {1} after it had already completed.".F(self, this.GetType()));
if (State == ActivityState.Done)
throw new InvalidOperationException("Actor {0} attempted to tick activity {1} after it had already completed.".F(self, GetType()));
if (State == ActivityState.Queued)
{
@@ -171,24 +74,61 @@ namespace OpenRA.Activities
State = ActivityState.Active;
}
var ret = Tick(self);
if (ret == null || (ret != this && ret.ParentActivity != this))
// Only run the parent tick when the child is done.
// We must always let the child finish on its own before continuing.
if (ChildHasPriority)
{
// Make sure that the Parent's ChildActivity pointer is moved forwards as the child queue advances.
// The Child's ParentActivity will be set automatically during assignment.
if (ParentActivity != null && ParentActivity != ret)
ParentActivity.ChildActivity = ret;
if (State != ActivityState.Canceled)
State = ActivityState.Done;
OnLastRun(self);
lastRun = TickChild(self) && (finishing || Tick(self));
finishing |= lastRun;
}
return ret;
// The parent determines whether the child gets a chance at ticking.
else
lastRun = Tick(self);
// Avoid a single tick delay if the childactivity was just queued.
if (ChildActivity != null && ChildActivity.State == ActivityState.Queued)
{
if (ChildHasPriority)
lastRun = TickChild(self) && finishing;
else
TickChild(self);
}
if (lastRun)
{
State = ActivityState.Done;
OnLastRun(self);
return NextActivity;
}
return this;
}
public abstract Activity Tick(Actor self);
protected bool TickChild(Actor self)
{
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
return ChildActivity == null;
}
/// <summary>
/// Called every tick to run activity logic. Returns false if the activity should
/// remain active, or true if it is complete. Cancelled activities must ensure they
/// return the actor to a consistent state before returning true.
///
/// Child activities can be queued using QueueChild, and these will be ticked
/// instead of the parent while they are active. Activities that need to run logic
/// in parallel with child activities should set ChildHasPriority to false and
/// manually call TickChildren.
///
/// Queuing one or more child activities and returning true is valid, and causes
/// the activity to be completed immediately (without ticking again) once the
/// children have completed.
/// </summary>
public virtual bool Tick(Actor self)
{
return true;
}
/// <summary>
/// Runs once immediately before the first Tick() execution.
@@ -218,32 +158,29 @@ namespace OpenRA.Activities
OnActorDispose(self);
}
public virtual bool Cancel(Actor self, bool keepQueue = false)
public virtual void Cancel(Actor self, bool keepQueue = false)
{
if (!IsInterruptible)
return false;
if (ChildActivity != null && !ChildActivity.Cancel(self))
return false;
if (!keepQueue)
NextActivity = null;
ChildActivity = null;
State = ActivityState.Canceled;
if (!IsInterruptible)
return;
return true;
if (ChildActivity != null)
ChildActivity.Cancel(self);
State = ActivityState.Canceling;
}
public virtual void Queue(Activity activity)
public void Queue(Activity activity)
{
if (NextInQueue != null)
NextInQueue.Queue(activity);
if (NextActivity != null)
NextActivity.Queue(activity);
else
NextInQueue = activity;
NextActivity = activity;
}
public virtual void QueueChild(Activity activity)
public void QueueChild(Activity activity)
{
if (ChildActivity != null)
ChildActivity.Queue(activity);
@@ -252,30 +189,31 @@ namespace OpenRA.Activities
}
/// <summary>
/// Prints the activity tree, starting from the root or optionally from a given origin.
/// Prints the activity tree, starting from the top or optionally from a given origin.
///
/// Call this method from any place that's called during a tick, such as the Tick() method itself or
/// the Before(First|Last)Run() methods. The origin activity will be marked in the output.
/// </summary>
/// <param name="origin">Activity from which to start traversing, and which to mark. If null, mark the calling activity, and start traversal from the root.</param>
/// <param name="self">The actor performing this activity.</param>
/// <param name="origin">Activity from which to start traversing, and which to mark. If null, mark the calling activity, and start traversal from the top.</param>
/// <param name="level">Initial level of indentation.</param>
protected void PrintActivityTree(Activity origin = null, int level = 0)
protected void PrintActivityTree(Actor self, Activity origin = null, int level = 0)
{
if (origin == null)
RootActivity.PrintActivityTree(this);
self.CurrentActivity.PrintActivityTree(self, this);
else
{
Console.Write(new string(' ', level * 2));
if (origin == this)
Console.Write("*");
Console.WriteLine(this.GetType().ToString().Split('.').Last());
Console.WriteLine(GetType().ToString().Split('.').Last());
if (ChildActivity != null)
ChildActivity.PrintActivityTree(origin, level + 1);
ChildActivity.PrintActivityTree(self, origin, level + 1);
if (NextInQueue != null)
NextInQueue.PrintActivityTree(origin, level);
if (NextActivity != null)
NextActivity.PrintActivityTree(self, origin, level);
}
}
@@ -283,39 +221,34 @@ namespace OpenRA.Activities
{
yield break;
}
}
/// <summary>
/// In contrast to the base activity class, which is responsible for running its children itself,
/// composite activities rely on the actor's activity-running logic for their children.
/// </summary>
public abstract class CompositeActivity : Activity
{
/// <summary>
/// The getter will return the first non-null value of either child, next or parent activity, in that order, or ultimately null.
/// </summary>
public override Activity NextActivity
public virtual IEnumerable<TargetLineNode> TargetLineNodes(Actor self)
{
get
yield break;
}
public IEnumerable<string> DebugLabelComponents()
{
var act = this;
while (act != null)
{
if (ChildActivity != null)
return ChildActivity;
else if (NextInQueue != null)
return NextInQueue;
else
return ParentActivity;
yield return act.GetType().Name;
act = act.ChildActivity;
}
}
}
public static class ActivityExts
{
public static IEnumerable<Target> GetTargetQueue(this Actor self)
public IEnumerable<T> ActivitiesImplementing<T>(bool includeChildren = true) where T : IActivityInterface
{
return self.CurrentActivity
.Iterate(u => u.NextActivity)
.TakeWhile(u => u != null)
.SelectMany(u => u.GetTargets(self));
if (includeChildren && ChildActivity != null)
foreach (var a in ChildActivity.ActivitiesImplementing<T>())
yield return a;
if (this is T)
yield return (T)(object)this;
if (NextActivity != null)
foreach (var a in NextActivity.ActivitiesImplementing<T>())
yield return a;
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -24,10 +24,10 @@ namespace OpenRA.Activities
Action a;
public override Activity Tick(Actor self)
public override bool Tick(Actor self)
{
if (a != null) a();
return NextActivity;
return true;
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Eluant;
using Eluant.ObjectBinding;
@@ -83,6 +82,7 @@ namespace OpenRA
readonly INotifyIdle[] tickIdles;
readonly ITargetablePositions[] targetablePositions;
WPos[] staticTargetablePositions;
bool created;
internal Actor(World world, string name, TypeDictionary initDict)
{
@@ -139,6 +139,35 @@ namespace OpenRA
SyncHashes = TraitsImplementing<ISync>().Select(sync => new SyncHash(sync)).ToArray();
}
internal void Created()
{
created = true;
foreach (var t in TraitsImplementing<INotifyCreated>())
t.Created(this);
// The initial activity should run before any activities queued by INotifyCreated.Created
// However, we need to know which traits are enabled (via conditions), so wait for after the calls and insert the activity as the first
ICreationActivity creationActivity = null;
foreach (var ica in TraitsImplementing<ICreationActivity>())
{
if (!ica.IsTraitEnabled())
continue;
if (creationActivity != null)
throw new InvalidOperationException("More than one enabled ICreationActivity trait: {0} and {1}".F(creationActivity.GetType().Name, ica.GetType().Name));
var activity = ica.GetCreationActivity();
if (activity == null)
continue;
creationActivity = ica;
activity.Queue(CurrentActivity);
CurrentActivity = activity;
}
}
public void Tick()
{
var wasIdle = IsIdle;
@@ -215,23 +244,25 @@ namespace OpenRA
{
if (!queued)
CancelActivity();
QueueActivity(nextActivity);
}
public void QueueActivity(Activity nextActivity)
{
if (!created)
throw new InvalidOperationException("An activity was queued before the actor was created. Queue it inside the INotifyCreated.Created callback instead.");
if (CurrentActivity == null)
CurrentActivity = nextActivity;
else
CurrentActivity.RootActivity.Queue(nextActivity);
CurrentActivity.Queue(nextActivity);
}
public bool CancelActivity()
public void CancelActivity()
{
if (CurrentActivity != null)
return CurrentActivity.RootActivity.Cancel(this);
return true;
CurrentActivity.Cancel(this);
}
public override int GetHashCode()
@@ -284,7 +315,7 @@ namespace OpenRA
// If CurrentActivity isn't null, run OnActorDisposeOuter in case some cleanups are needed.
// This should be done before the FrameEndTask to avoid dependency issues.
if (CurrentActivity != null)
CurrentActivity.RootActivity.OnActorDisposeOuter(this);
CurrentActivity.OnActorDisposeOuter(this);
// Allow traits/activities to prevent a race condition when they depend on disposing the actor (e.g. Transforms)
WillDispose = true;
@@ -336,6 +367,9 @@ namespace OpenRA
foreach (var t in TraitsImplementing<INotifyOwnerChanged>())
t.OnOwnerChanged(this, oldOwner, newOwner);
foreach (var t in World.WorldActor.TraitsImplementing<INotifyOwnerChanged>())
t.OnOwnerChanged(this, oldOwner, newOwner);
if (wasInWorld)
World.Add(this);
}
@@ -377,7 +411,7 @@ namespace OpenRA
public BitSet<TargetableType> GetAllTargetTypes()
{
// PERF: Avoid LINQ.
var targetTypes = new BitSet<TargetableType>();
var targetTypes = default(BitSet<TargetableType>);
foreach (var targetable in Targetables)
targetTypes = targetTypes.Union(targetable.TargetTypes);
return targetTypes;
@@ -386,7 +420,7 @@ namespace OpenRA
public BitSet<TargetableType> GetEnabledTargetTypes()
{
// PERF: Avoid LINQ.
var targetTypes = new BitSet<TargetableType>();
var targetTypes = default(BitSet<TargetableType>);
foreach (var targetable in Targetables)
if (targetable.IsTraitEnabled())
targetTypes = targetTypes.Union(targetable.TargetTypes);
@@ -412,7 +446,7 @@ namespace OpenRA
if (enabledTargetablePositionTraits.Any())
return enabledTargetablePositionTraits.SelectMany(tp => tp.TargetablePositions(this));
return new[] { this.CenterPosition };
return new[] { CenterPosition };
}
#region Scripting interface

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -34,7 +34,8 @@ namespace OpenRA
public byte Layer { get { return (byte)Bits; } }
public CPos(int bits) { Bits = bits; }
public CPos(int x, int y) : this(x, y, 0) { }
public CPos(int x, int y)
: this(x, y, 0) { }
public CPos(int x, int y, byte layer)
{
Bits = (x & 0xFFF) << 20 | (y & 0xFFF) << 8 | layer;
@@ -149,4 +150,4 @@ namespace OpenRA
#endregion
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,9 +10,9 @@
#endregion
using System;
using System.Drawing;
using Eluant;
using Eluant.ObjectBinding;
using OpenRA.Primitives;
using OpenRA.Scripting;
namespace OpenRA

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -17,4 +17,4 @@ namespace OpenRA
void Store(string key, T data);
T Retrieve(string key);
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -42,4 +42,4 @@ namespace OpenRA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) { yield break; }
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,9 +12,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
namespace OpenRA
@@ -77,8 +77,7 @@ namespace OpenRA
if (iconNode != null && !string.IsNullOrEmpty(iconNode.Value.Value))
{
using (var stream = new MemoryStream(Convert.FromBase64String(iconNode.Value.Value)))
using (var bitmap = new Bitmap(stream))
mod.Icon = sheetBuilder.Add(bitmap);
mod.Icon = sheetBuilder.Add(new Png(stream));
}
// Avoid possibly overwriting a valid mod with an obviously bogus one

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,11 +11,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.Linq;
using System.Reflection;
using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Traits;
@@ -79,16 +78,6 @@ namespace OpenRA
return val;
}
public static bool Contains(this Rectangle r, int2 p)
{
return r.Contains(p.ToPoint());
}
public static bool Contains(this RectangleF r, int2 p)
{
return r.Contains(p.ToPointF());
}
static int WindingDirectionTest(int2 v0, int2 v1, int2 p)
{
return (v1.X - v0.X) * (p.Y - v0.Y) - (p.X - v0.X) * (v1.Y - v0.Y);
@@ -175,7 +164,11 @@ namespace OpenRA
public static IEnumerable<T> Iterate<T>(this T t, Func<T, T> f)
{
for (;;) { yield return t; t = f(t); }
while (true)
{
yield return t;
t = f(t);
}
}
public static T MinBy<T, U>(this IEnumerable<T> ts, Func<T, U> selector)
@@ -448,27 +441,6 @@ namespace OpenRA
return result;
}
public static Rectangle Bounds(this Bitmap b) { return new Rectangle(0, 0, b.Width, b.Height); }
public static Bitmap CloneWith32bbpArgbPixelFormat(this Bitmap original)
{
// Note: We would use original.Clone(original.Bounds(), PixelFormat.Format32bppArgb)
// but this doesn't work on mono.
var clone = new Bitmap(original.Width, original.Height, PixelFormat.Format32bppArgb);
try
{
using (var g = System.Drawing.Graphics.FromImage(clone))
g.DrawImage(original, original.Bounds());
}
catch (Exception)
{
clone.Dispose();
throw;
}
return clone;
}
public static int ToBits(this IEnumerable<bool> bits)
{
var i = 0;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,8 +12,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -42,7 +40,8 @@ namespace OpenRA
}
}
public MissingFieldsException(string[] missing, string header = null, string headerSingle = null) : base(null)
public MissingFieldsException(string[] missing, string header = null, string headerSingle = null)
: base(null)
{
Header = missing.Length > 1 ? header : headerSingle ?? header;
Missing = missing;
@@ -230,46 +229,11 @@ namespace OpenRA
else if (fieldType == typeof(Color))
{
Color color;
if (value != null && HSLColor.TryParseRGB(value, out color))
if (value != null && Color.TryParse(value, out color))
return color;
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(Color[]))
{
if (value != null)
{
var parts = value.Split(',');
var colors = new Color[parts.Length];
for (var i = 0; i < colors.Length; i++)
if (!HSLColor.TryParseRGB(parts[i], out colors[i]))
return InvalidValueAction(value, fieldType, fieldName);
return colors;
}
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(HSLColor))
{
if (value != null)
{
Color rgb;
if (HSLColor.TryParseRGB(value, out rgb))
return new HSLColor(rgb);
// Allow old HSLColor/ColorRamp formats to be parsed as HSLColor
var parts = value.Split(',');
if (parts.Length == 3 || parts.Length == 4)
return new HSLColor(
(byte)Exts.ParseIntegerInvariant(parts[0]).Clamp(0, 255),
(byte)Exts.ParseIntegerInvariant(parts[1]).Clamp(0, 255),
(byte)Exts.ParseIntegerInvariant(parts[2]).Clamp(0, 255));
}
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(Hotkey))
{
Hotkey res;
@@ -450,29 +414,6 @@ namespace OpenRA
return InvalidValueAction(value, fieldType, fieldName);
}
}
else if (fieldType == typeof(ImageFormat))
{
if (value != null)
{
switch (value.ToLowerInvariant())
{
case "bmp":
return ImageFormat.Bmp;
case "gif":
return ImageFormat.Gif;
case "jpg":
case "jpeg":
return ImageFormat.Jpeg;
case "tif":
case "tiff":
return ImageFormat.Tiff;
default:
return ImageFormat.Png;
}
}
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(bool))
return ParseYesNo(value, fieldType, fieldName);
else if (fieldType == typeof(int2[]))

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,8 +12,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.Linq;
using System.Reflection;
@@ -76,21 +74,9 @@ namespace OpenRA
var t = v.GetType();
// Color.ToString() does the wrong thing; force it to format as rgb[a] hex
if (t == typeof(Color))
{
return HSLColor.ToHexString((Color)v);
}
// HSLColor.ToString() does the wrong thing; force it to format as rgb[a] hex
if (t == typeof(HSLColor))
{
return ((HSLColor)v).ToHexString();
}
if (t == typeof(ImageFormat))
{
return ((ImageFormat)v).ToString();
return ((Color)v).ToString();
}
if (t == typeof(Rectangle))

View File

@@ -0,0 +1,355 @@
#region Copyright & License Information
/*
* Copyright 2007-2019 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using ICSharpCode.SharpZipLib.Checksum;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
{
public class Png
{
static readonly byte[] Signature = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
public int Width { get; set; }
public int Height { get; set; }
public Color[] Palette { get; set; }
public byte[] Data { get; set; }
public Dictionary<string, string> EmbeddedData = new Dictionary<string, string>();
public Png(Stream s)
{
if (!Verify(s))
throw new InvalidDataException("PNG Signature is bogus");
s.Position += 8;
var headerParsed = false;
var isPaletted = false;
var is24Bit = false;
var data = new List<byte>();
while (true)
{
var length = IPAddress.NetworkToHostOrder(s.ReadInt32());
var type = Encoding.UTF8.GetString(s.ReadBytes(4));
var content = s.ReadBytes(length);
/*var crc = */s.ReadInt32();
if (!headerParsed && type != "IHDR")
throw new InvalidDataException("Invalid PNG file - header does not appear first.");
using (var ms = new MemoryStream(content))
{
switch (type)
{
case "IHDR":
{
if (headerParsed)
throw new InvalidDataException("Invalid PNG file - duplicate header.");
Width = IPAddress.NetworkToHostOrder(ms.ReadInt32());
Height = IPAddress.NetworkToHostOrder(ms.ReadInt32());
var bitDepth = ms.ReadUInt8();
var colorType = (PngColorType)ms.ReadByte();
isPaletted = IsPaletted(bitDepth, colorType);
is24Bit = colorType == PngColorType.Color;
var dataLength = Width * Height;
if (!isPaletted)
dataLength *= 4;
Data = new byte[dataLength];
var compression = ms.ReadByte();
/*var filter = */ms.ReadByte();
var interlace = ms.ReadByte();
if (compression != 0)
throw new InvalidDataException("Compression method not supported");
if (interlace != 0)
throw new InvalidDataException("Interlacing not supported");
headerParsed = true;
break;
}
case "PLTE":
{
Palette = new Color[256];
for (var i = 0; i < length / 3; i++)
{
var r = ms.ReadByte(); var g = ms.ReadByte(); var b = ms.ReadByte();
Palette[i] = Color.FromArgb(r, g, b);
}
break;
}
case "tRNS":
{
if (Palette == null)
throw new InvalidDataException("Non-Palette indexed PNG are not supported.");
for (var i = 0; i < length; i++)
Palette[i] = Color.FromArgb(ms.ReadByte(), Palette[i]);
break;
}
case "IDAT":
{
data.AddRange(content);
break;
}
case "tEXt":
{
var key = ms.ReadASCIIZ();
EmbeddedData.Add(key, ms.ReadASCII(length - key.Length - 1));
break;
}
case "IEND":
{
using (var ns = new MemoryStream(data.ToArray()))
{
using (var ds = new InflaterInputStream(ns))
{
var pxStride = isPaletted ? 1 : is24Bit ? 3 : 4;
var srcStride = Width * pxStride;
var destStride = Width * (isPaletted ? 1 : 4);
var prevLine = new byte[srcStride];
for (var y = 0; y < Height; y++)
{
var filter = (PngFilter)ds.ReadByte();
var line = ds.ReadBytes(srcStride);
for (var i = 0; i < srcStride; i++)
line[i] = i < pxStride
? UnapplyFilter(filter, line[i], 0, prevLine[i], 0)
: UnapplyFilter(filter, line[i], line[i - pxStride], prevLine[i], prevLine[i - pxStride]);
if (is24Bit)
{
// Fold alpha channel into RGB data
for (var i = 0; i < line.Length / 3; i++)
{
Array.Copy(line, 3 * i, Data, y * destStride + 4 * i, 3);
Data[y * destStride + 4 * i + 3] = 255;
}
}
else
Array.Copy(line, 0, Data, y * destStride, line.Length);
prevLine = line;
}
}
}
if (isPaletted && Palette == null)
throw new InvalidDataException("Non-Palette indexed PNG are not supported.");
return;
}
}
}
}
}
public Png(byte[] data, int width, int height, Color[] palette = null,
Dictionary<string, string> embeddedData = null)
{
var expectLength = width * height;
if (palette == null)
expectLength *= 4;
if (data.Length != expectLength)
throw new InvalidDataException("Input data does not match expected length");
Width = width;
Height = height;
Palette = palette;
Data = data;
if (embeddedData != null)
EmbeddedData = embeddedData;
}
public static bool Verify(Stream s)
{
var pos = s.Position;
var isPng = Signature.Aggregate(true, (current, t) => current && s.ReadUInt8() == t);
s.Position = pos;
return isPng;
}
static byte UnapplyFilter(PngFilter f, byte x, byte a, byte b, byte c)
{
switch (f)
{
case PngFilter.None: return x;
case PngFilter.Sub: return (byte)(x + a);
case PngFilter.Up: return (byte)(x + b);
case PngFilter.Average: return (byte)(x + (a + b) / 2);
case PngFilter.Paeth: return (byte)(x + Paeth(a, b, c));
default:
throw new InvalidOperationException("Unsupported Filter");
}
}
static byte Paeth(byte a, byte b, byte c)
{
var p = a + b - c;
var pa = Math.Abs(p - a);
var pb = Math.Abs(p - b);
var pc = Math.Abs(p - c);
return (pa <= pb && pa <= pc) ? a :
(pb <= pc) ? b : c;
}
[Flags]
enum PngColorType { Indexed = 1, Color = 2, Alpha = 4 }
enum PngFilter { None, Sub, Up, Average, Paeth }
static bool IsPaletted(byte bitDepth, PngColorType colorType)
{
if (bitDepth == 8 && colorType == (PngColorType.Indexed | PngColorType.Color))
return true;
if (bitDepth == 8 && colorType == (PngColorType.Color | PngColorType.Alpha))
return false;
if (bitDepth == 8 && colorType == PngColorType.Color)
return false;
throw new InvalidDataException("Unknown pixel format");
}
void WritePngChunk(Stream output, string type, Stream input)
{
input.Position = 0;
var typeBytes = Encoding.ASCII.GetBytes(type);
output.Write(IPAddress.HostToNetworkOrder((int)input.Length));
output.WriteArray(typeBytes);
var data = input.ReadAllBytes();
output.WriteArray(data);
var crc32 = new Crc32();
crc32.Update(typeBytes);
crc32.Update(data);
output.Write(IPAddress.NetworkToHostOrder((int)crc32.Value));
}
public byte[] Save()
{
using (var output = new MemoryStream())
{
output.WriteArray(Signature);
using (var header = new MemoryStream())
{
header.Write(IPAddress.HostToNetworkOrder(Width));
header.Write(IPAddress.HostToNetworkOrder(Height));
header.WriteByte(8); // Bit depth
var colorType = Palette != null
? PngColorType.Indexed | PngColorType.Color
: PngColorType.Color | PngColorType.Alpha;
header.WriteByte((byte)colorType);
header.WriteByte(0); // Compression
header.WriteByte(0); // Filter
header.WriteByte(0); // Interlacing
WritePngChunk(output, "IHDR", header);
}
bool alphaPalette = false;
if (Palette != null)
{
using (var palette = new MemoryStream())
{
foreach (var c in Palette)
{
palette.WriteByte(c.R);
palette.WriteByte(c.G);
palette.WriteByte(c.B);
alphaPalette |= c.A > 0;
}
WritePngChunk(output, "PLTE", palette);
}
}
if (alphaPalette)
{
using (var alpha = new MemoryStream())
{
foreach (var c in Palette)
alpha.WriteByte(c.A);
WritePngChunk(output, "tRNS", alpha);
}
}
using (var data = new MemoryStream())
{
using (var compressed = new DeflaterOutputStream(data))
{
var stride = Width * (Palette != null ? 1 : 4);
for (var y = 0; y < Height; y++)
{
// Write uncompressed scanlines for simplicity
compressed.WriteByte(0);
compressed.Write(Data, y * stride, stride);
}
compressed.Flush();
compressed.Finish();
WritePngChunk(output, "IDAT", data);
}
}
foreach (var kv in EmbeddedData)
{
using (var text = new MemoryStream())
{
text.WriteArray(Encoding.ASCII.GetBytes(kv.Key + (char)0 + kv.Value));
WritePngChunk(output, "tEXt", text);
}
}
WritePngChunk(output, "IEND", new MemoryStream());
return output.ToArray();
}
}
public void Save(string path)
{
File.WriteAllBytes(path, Save());
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -328,7 +328,7 @@ namespace OpenRA.FileSystem
if (!(mod.Package is Folder))
return null;
path = Path.Combine(mod.Package.Name, filename);
path = Path.Combine(mod.Package.Name, filename);
}
else
path = Path.Combine(parentPath, filename);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -33,7 +33,7 @@ namespace OpenRA.FileSystem
public ReadOnlyZipFile(Stream s, string filename)
{
Name = filename;
pkg = ZipFileHelper.Create(s);
pkg = new ZipFile(s);
}
public Stream GetStream(string filename)
@@ -113,7 +113,7 @@ namespace OpenRA.FileSystem
}
pkgStream.Position = 0;
pkg = ZipFileHelper.Create(pkgStream);
pkg = new ZipFile(pkgStream);
Name = filename;
}

37
OpenRA.Game/Fonts.cs Normal file
View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2019 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Collections.Generic;
namespace OpenRA
{
public class FontData
{
public readonly string Font;
public readonly int Size;
public readonly int Ascender;
}
public class Fonts : IGlobalModData
{
[FieldLoader.LoadUsing("LoadFonts")]
public readonly Dictionary<string, FontData> FontList;
static object LoadFonts(MiniYaml y)
{
var ret = new Dictionary<string, FontData>();
foreach (var node in y.Nodes)
ret.Add(node.Key, FieldLoader.Load<FontData>(node.Value));
return ret;
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,8 +12,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -41,7 +39,9 @@ namespace OpenRA
public static ModData ModData;
public static Settings Settings;
public static ICursor Cursor;
public static bool HideCursor;
static WorldRenderer worldRenderer;
static string modLaunchWrapper;
internal static OrderManager OrderManager;
static Server.Server server;
@@ -52,13 +52,12 @@ namespace OpenRA
public static Sound Sound;
public static bool HasInputFocus = false;
public static bool BenchmarkMode = false;
public static string EngineVersion { get; private set; }
public static LocalPlayerProfile LocalPlayerProfile;
static Task discoverNat;
static bool takeScreenshot = false;
static Benchmark benchmark = null;
public static event Action OnShellmapLoaded = () => { };
@@ -168,6 +167,8 @@ namespace OpenRA
using (new PerfTimer("NewWorld"))
OrderManager.World = new World(ModData, map, OrderManager, type);
OrderManager.World.GameOver += FinishBenchmark;
worldRenderer = new WorldRenderer(ModData, OrderManager.World);
GC.Collect();
@@ -197,7 +198,12 @@ namespace OpenRA
var replay = OrderManager.Connection as ReplayConnection;
var replayName = replay != null ? replay.Filename : null;
var lobbyInfo = OrderManager.LobbyInfo;
var orders = new[] {
// Reseed the RNG so this isn't an exact repeat of the last game
lobbyInfo.GlobalSettings.RandomSeed = CosmeticRandom.Next();
var orders = new[]
{
Order.Command("sync_lobby {0}".F(lobbyInfo.Serialize())),
Order.Command("startgame")
};
@@ -290,7 +296,7 @@ namespace OpenRA
Log.AddChannel("perf", "perf.log");
Log.AddChannel("debug", "debug.log");
Log.AddChannel("server", "server.log");
Log.AddChannel("server", "server.log", true);
Log.AddChannel("sound", "sound.log");
Log.AddChannel("graphics", "graphics.log");
Log.AddChannel("geoip", "geoip.log");
@@ -346,6 +352,8 @@ namespace OpenRA
foreach (var mod in Mods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Metadata.Title, mod.Value.Metadata.Version);
modLaunchWrapper = args.GetValue("Engine.LaunchWrapper", null);
ExternalMods = new ExternalMods();
Manifest currentMod;
@@ -466,6 +474,9 @@ namespace OpenRA
Log.Write("nat", e.ToString());
}
ChromeMetrics.TryGet("ChatMessageColor", out chatMessageColor);
ChromeMetrics.TryGet("SystemMessageColor", out systemMessageColor);
ModData.LoadScreen.StartGame(args);
}
@@ -501,8 +512,15 @@ namespace OpenRA
{
try
{
var path = mod.LaunchPath;
var args = launchArguments != null ? mod.LaunchArgs.Append(launchArguments) : mod.LaunchArgs;
var p = Process.Start(mod.LaunchPath, args.Select(a => "\"" + a + "\"").JoinWith(" "));
if (modLaunchWrapper != null)
{
path = modLaunchWrapper;
args = new[] { mod.LaunchPath }.Concat(args);
}
var p = Process.Start(path, args.Select(a => "\"" + a + "\"").JoinWith(" "));
if (p == null || p.HasExited)
onFailed();
else
@@ -525,36 +543,26 @@ namespace OpenRA
// Note: These delayed actions should only be used by widgets or disposing objects
// - things that depend on a particular world should be queuing them on the world actor.
static volatile ActionQueue delayedActions = new ActionQueue();
static Color systemMessageColor = Color.White;
static Color chatMessageColor = Color.White;
public static void RunAfterTick(Action a) { delayedActions.Add(a, RunTime); }
public static void RunAfterDelay(int delayMilliseconds, Action a) { delayedActions.Add(a, RunTime + delayMilliseconds); }
static void TakeScreenshotInner()
{
Log.Write("debug", "Taking screenshot");
Bitmap bitmap;
using (new PerfTimer("Renderer.TakeScreenshot"))
bitmap = Renderer.Context.TakeScreenshot();
ThreadPool.QueueUserWorkItem(_ =>
using (new PerfTimer("Renderer.SaveScreenshot"))
{
var mod = ModData.Manifest.Metadata;
var directory = Platform.ResolvePath(Platform.SupportDirPrefix, "Screenshots", ModData.Manifest.Id, mod.Version);
Directory.CreateDirectory(directory);
var filename = TimestampedFilename(true);
var format = Settings.Graphics.ScreenshotFormat;
var extension = ImageCodecInfo.GetImageEncoders().FirstOrDefault(x => x.FormatID == format.Guid)
.FilenameExtension.Split(';').First().ToLowerInvariant().Substring(1);
var destination = Path.Combine(directory, string.Concat(filename, extension));
var path = Path.Combine(directory, string.Concat(filename, ".png"));
Log.Write("debug", "Taking screenshot " + path);
using (new PerfTimer("Save Screenshot ({0})".F(format)))
bitmap.Save(destination, format);
bitmap.Dispose();
RunAfterTick(() => Debug("Saved screenshot " + filename));
});
Renderer.Context.SaveScreenshot(path);
Debug("Saved screenshot " + filename);
}
}
static void InnerLogicTick(OrderManager orderManager)
@@ -574,7 +582,7 @@ namespace OpenRA
Cursor.Tick();
}
var worldTimestep = world == null ? Timestep : world.Timestep;
var worldTimestep = world == null ? Timestep : world.IsLoadingGameSave ? 1 : world.Timestep;
var worldTickDelta = tick - orderManager.LastTickTime;
if (worldTimestep != 0 && worldTickDelta >= worldTimestep)
{
@@ -601,16 +609,12 @@ namespace OpenRA
Log.Write("debug", "--Tick: {0} ({1})", LocalTick, isNetTick ? "net" : "local");
if (BenchmarkMode)
Log.Write("cpu", "{0};{1}".F(LocalTick, PerfHistory.Items["tick_time"].LastValue));
if (isNetTick)
orderManager.Tick();
Sync.RunUnsynced(Settings.Debug.SyncCheckUnsyncedCode, world, () =>
{
world.OrderGenerator.Tick(world);
world.Selection.Tick(world);
});
world.Tick();
@@ -624,12 +628,15 @@ namespace OpenRA
if (orderManager.LocalFrameNumber > 0)
Sync.RunUnsynced(Settings.Debug.SyncCheckUnsyncedCode, world, () => world.TickRender(worldRenderer));
}
if (benchmark != null)
benchmark.Tick(LocalTick);
}
}
static void LogicTick()
{
delayedActions.PerformActions(RunTime);
PerformDelayedActions();
if (OrderManager.Connection.ConnectionState != lastConnectionState)
{
@@ -642,6 +649,11 @@ namespace OpenRA
InnerLogicTick(worldRenderer.World.OrderManager);
}
public static void PerformDelayedActions()
{
delayedActions.PerformActions(RunTime);
}
public static void TakeScreenshot()
{
takeScreenshot = true;
@@ -658,7 +670,10 @@ namespace OpenRA
{
Renderer.BeginFrame(worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.Zoom);
Sound.SetListenerPosition(worldRenderer.Viewport.CenterPosition);
worldRenderer.Draw();
// Use worldRenderer.World instead of OrderManager.World to avoid a rendering mismatch while processing orders
if (!worldRenderer.World.IsLoadingGameSave)
worldRenderer.Draw();
}
else
Renderer.BeginFrame(int2.Zero, 1f);
@@ -673,8 +688,13 @@ namespace OpenRA
if (ModData != null && ModData.CursorProvider != null)
{
Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default");
Cursor.Render(Renderer);
if (HideCursor)
Cursor.SetCursor(null);
else
{
Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default");
Cursor.Render(Renderer);
}
}
}
@@ -692,9 +712,6 @@ namespace OpenRA
PerfHistory.Items["batches"].Tick();
PerfHistory.Items["render_widgets"].Tick();
PerfHistory.Items["render_flip"].Tick();
if (BenchmarkMode)
Log.Write("render", "{0};{1}".F(RenderFrame, PerfHistory.Items["render"].LastValue));
}
static void Loop()
@@ -751,6 +768,13 @@ namespace OpenRA
var maxFramerate = Settings.Graphics.CapFramerate ? Settings.Graphics.MaxFramerate.Clamp(1, 1000) : 1000;
var renderInterval = 1000 / maxFramerate;
// Tick as fast as possible while restoring game saves, capping rendering at 5 FPS
if (OrderManager.World != null && OrderManager.World.IsLoadingGameSave)
{
logicInterval = 1;
renderInterval = 200;
}
var now = RunTime;
// If the logic has fallen behind too much, skip it and catch up
@@ -770,7 +794,7 @@ namespace OpenRA
LogicTick();
// Force at least one render per tick during regular gameplay
if (OrderManager.World != null && !OrderManager.World.IsReplay)
if (OrderManager.World != null && !OrderManager.World.IsLoadingGameSave && !OrderManager.World.IsReplay)
forceRender = true;
}
@@ -834,14 +858,19 @@ namespace OpenRA
state = RunStatus.Success;
}
public static void AddChatLine(Color color, string name, string text)
public static void AddSystemLine(string name, string text)
{
OrderManager.AddChatLine(color, name, text);
OrderManager.AddChatLine(name, systemMessageColor, text, systemMessageColor);
}
public static void AddChatLine(string name, Color nameColor, string text)
{
OrderManager.AddChatLine(name, nameColor, text, chatMessageColor);
}
public static void Debug(string s, params object[] args)
{
AddChatLine(Color.White, "Debug", string.Format(s, args));
AddSystemLine("Debug", string.Format(s, args));
}
public static void Disconnect()
@@ -893,5 +922,37 @@ namespace OpenRA
{
return Renderer.Window.SetClipboardText(text);
}
public static void BenchmarkMode(string prefix)
{
benchmark = new Benchmark(prefix);
}
public static void LoadMap(string launchMap)
{
var orders = new List<Order>
{
Order.Command("option gamespeed {0}".F("default")),
Order.Command("state {0}".F(Session.ClientState.Ready))
};
var path = Platform.ResolvePath(launchMap);
var map = ModData.MapCache.SingleOrDefault(m => m.Uid == launchMap) ??
ModData.MapCache.SingleOrDefault(m => m.Package.Name == path);
if (map == null)
throw new InvalidOperationException("Could not find map '{0}'.".F(launchMap));
CreateAndStartLocalServer(map.Uid, orders);
}
public static void FinishBenchmark()
{
if (benchmark != null)
{
benchmark.Write();
Exit();
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,8 +12,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Network;
using OpenRA.Primitives;
namespace OpenRA
{
@@ -122,7 +122,8 @@ namespace OpenRA
Team = client.Team,
SpawnPoint = runtimePlayer.SpawnPoint,
IsRandomFaction = runtimePlayer.Faction.InternalName != client.Faction,
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint,
Fingerprint = client.Fingerprint
};
playersByRuntime.Add(runtimePlayer, player);
@@ -155,7 +156,7 @@ namespace OpenRA
/// <summary>The faction ID, a.k.a. the faction's internal name.</summary>
public string FactionId;
public HSLColor Color;
public Color Color;
/// <summary>The team ID on start-up, or 0 if the player is not part of a team.</summary>
public int Team;
@@ -167,6 +168,9 @@ namespace OpenRA
/// <summary>True if the spawn point was chosen at random; otherwise, false.</summary>
public bool IsRandomSpawnPoint;
/// <summary>Player authentication fingerprint for the OpenRA forum.</summary>
public string Fingerprint;
#endregion
#region

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -155,7 +155,7 @@ namespace OpenRA
public BitSet<TargetableType> GetAllTargetTypes()
{
// PERF: Avoid LINQ.
var targetTypes = new BitSet<TargetableType>();
var targetTypes = default(BitSet<TargetableType>);
foreach (var targetable in TraitInfos<ITargetableInfo>())
targetTypes = targetTypes.Union(targetable.GetTargetTypes());
return targetTypes;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -19,6 +19,7 @@ namespace OpenRA.GameRules
public readonly string Filename;
public readonly string Title;
public readonly bool Hidden;
public readonly float VolumeModifier = 1f;
public int Length { get; private set; } // seconds
public bool Exists { get; private set; }
@@ -31,6 +32,9 @@ namespace OpenRA.GameRules
if (nd.ContainsKey("Hidden"))
bool.TryParse(nd["Hidden"].Value, out Hidden);
if (nd.ContainsKey("VolumeModifier"))
VolumeModifier = FieldLoader.GetValue<float>("VolumeModifier", nd["VolumeModifier"].Value);
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -33,7 +33,7 @@ namespace OpenRA.GameRules
{
FieldLoader.Load(this, y);
VoicePools = Exts.Lazy(() => Voices.ToDictionary(a => a.Key, a => new SoundPool(0, a.Value)));
VoicePools = Exts.Lazy(() => Voices.ToDictionary(a => a.Key, a => new SoundPool(1f, a.Value)));
NotificationsPools = Exts.Lazy(() => ParseSoundPool(y, "Notifications"));
}
@@ -43,13 +43,13 @@ namespace OpenRA.GameRules
var classifiction = y.Nodes.First(x => x.Key == key);
foreach (var t in classifiction.Value.Nodes)
{
var rateLimit = 0;
var rateLimitNode = t.Value.Nodes.FirstOrDefault(x => x.Key == "RateLimit");
if (rateLimitNode != null)
rateLimit = FieldLoader.GetValue<int>(rateLimitNode.Key, rateLimitNode.Value.Value);
var volumeModifier = 1f;
var volumeModifierNode = t.Value.Nodes.FirstOrDefault(x => x.Key == "VolumeModifier");
if (volumeModifierNode != null)
volumeModifier = FieldLoader.GetValue<float>(volumeModifierNode.Key, volumeModifierNode.Value.Value);
var names = FieldLoader.GetValue<string[]>(t.Key, t.Value.Value);
var sp = new SoundPool(rateLimit, names);
var sp = new SoundPool(volumeModifier, names);
ret.Add(t.Key, sp);
}
@@ -59,15 +59,14 @@ namespace OpenRA.GameRules
public class SoundPool
{
public readonly float VolumeModifier;
readonly string[] clips;
readonly int rateLimit;
readonly List<string> liveclips = new List<string>();
long lastPlayed = 0;
public SoundPool(int rateLimit, params string[] clips)
public SoundPool(float volumeModifier, params string[] clips)
{
VolumeModifier = volumeModifier;
this.clips = clips;
this.rateLimit = rateLimit;
}
public string GetNext()
@@ -79,16 +78,6 @@ namespace OpenRA.GameRules
if (liveclips.Count == 0)
return null;
// Perform rate limiting if necessary
if (rateLimit != 0)
{
var now = Game.RunTime;
if (lastPlayed != 0 && now < lastPlayed + rateLimit)
return null;
lastPlayed = now;
}
var i = Game.CosmeticRandom.Next(liveclips.Count);
var s = liveclips[i];
liveclips.RemoveAt(i);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,8 +10,8 @@
#endregion
using System;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Support;
namespace OpenRA.Graphics

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -57,4 +57,4 @@ namespace OpenRA.Graphics
return new AnimationWithOffset(a, null, null, null);
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,147 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Drawing;
using System.Globalization;
using OpenRA.Scripting;
namespace OpenRA.Graphics
{
public struct HSLColor : IScriptBindable
{
public readonly byte H;
public readonly byte S;
public readonly byte L;
public readonly Color RGB;
public static HSLColor FromHSV(float h, float s, float v)
{
var ll = 0.5f * (2 - s) * v;
var ss = (ll >= 1 || v <= 0) ? 0 : 0.5f * s * v / (ll <= 0.5f ? ll : 1 - ll);
return new HSLColor((byte)(255 * h), (byte)(255 * ss), (byte)(255 * ll));
}
public HSLColor(Color color)
{
RGB = color;
H = (byte)((color.GetHue() / 360.0f) * 255);
S = (byte)(color.GetSaturation() * 255);
L = (byte)(color.GetBrightness() * 255);
}
public static HSLColor FromRGB(int r, int g, int b)
{
return new HSLColor(Color.FromArgb(r, g, b));
}
public static Color RGBFromHSL(float h, 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 = { h + 1 / 3.0f, h, h - 1 / 3.0f };
float[] rgb = { 0, 0, 0 };
for (var k = 0; k < 3; k++)
{
while (trgb[k] < 0) trgb[k] += 1.0f;
while (trgb[k] > 1) trgb[k] -= 1.0f;
}
for (var k = 0; k < 3; k++)
{
if (trgb[k] < 1 / 6.0f)
rgb[k] = p + ((q - p) * 6 * trgb[k]);
else if (trgb[k] >= 1 / 6.0f && trgb[k] < 0.5)
rgb[k] = q;
else if (trgb[k] >= 0.5f && trgb[k] < 2.0f / 3)
rgb[k] = p + ((q - p) * 6 * (2.0f / 3 - trgb[k]));
else
rgb[k] = p;
}
return Color.FromArgb((int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255));
}
public static bool TryParseRGB(string value, out Color color)
{
color = new Color();
value = value.Trim();
if (value.Length != 6 && value.Length != 8)
return false;
byte red, green, blue, alpha = 255;
if (!byte.TryParse(value.Substring(0, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out red)
|| !byte.TryParse(value.Substring(2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out green)
|| !byte.TryParse(value.Substring(4, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out blue))
return false;
if (value.Length == 8
&& !byte.TryParse(value.Substring(6, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out alpha))
return false;
color = Color.FromArgb(alpha, red, green, blue);
return true;
}
public static bool operator ==(HSLColor me, HSLColor other)
{
// Binary floating point numbers (float, double) calculations can yield the same RGB color created by different functions with little different HSL representation
return (me.H == other.H && me.S == other.S && me.L == other.L) || me.RGB == other.RGB;
}
public static bool operator !=(HSLColor me, HSLColor other) { return !(me == other); }
public HSLColor(byte h, byte s, byte l)
{
H = h;
S = s;
L = l;
RGB = RGBFromHSL(H / 255f, S / 255f, L / 255f);
}
public void ToHSV(out float h, out float s, out float v)
{
var ll = 2 * L / 255f;
var ss = S / 255f * ((ll <= 1) ? ll : 2 - ll);
h = H / 255f;
s = (2 * ss) / (ll + ss);
v = (ll + ss) / 2;
}
public override string ToString()
{
return "{0},{1},{2}".F(H, S, L);
}
public static string ToHexString(Color color)
{
if (color.A == 255)
return color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
return color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2") + color.A.ToString("X2");
}
public string ToHexString()
{
return ToHexString(RGB);
}
public override int GetHashCode() { return H.GetHashCode() ^ S.GetHashCode() ^ L.GetHashCode(); }
public override bool Equals(object obj)
{
var o = obj as HSLColor?;
return o != null && o == this;
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -20,12 +20,26 @@ namespace OpenRA.Graphics
{
readonly Dictionary<string, IHardwareCursor[]> hardwareCursors = new Dictionary<string, IHardwareCursor[]>();
readonly CursorProvider cursorProvider;
readonly Dictionary<string, Sprite[]> sprites = new Dictionary<string, Sprite[]>();
readonly SheetBuilder sheetBuilder;
readonly HardwarePalette hardwarePalette = new HardwarePalette();
readonly Cache<string, PaletteReference> paletteReferences;
CursorSequence cursor;
bool isLocked = false;
int2 lockedPosition;
public HardwareCursor(CursorProvider cursorProvider)
{
this.cursorProvider = cursorProvider;
paletteReferences = new Cache<string, PaletteReference>(CreatePaletteReference);
foreach (var p in cursorProvider.Palettes)
hardwarePalette.AddPalette(p.Key, p.Value, false);
hardwarePalette.Initialize();
sheetBuilder = new SheetBuilder(SheetType.Indexed);
foreach (var kv in cursorProvider.Cursors)
{
var palette = cursorProvider.Palettes[kv.Value.Palette];
@@ -34,11 +48,22 @@ namespace OpenRA.Graphics
.ToArray();
hardwareCursors.Add(kv.Key, hc);
var s = kv.Value.Frames.Select(a => sheetBuilder.Add(a)).ToArray();
sprites.Add(kv.Key, s);
}
sheetBuilder.Current.ReleaseBuffer();
Update();
}
PaletteReference CreatePaletteReference(string name)
{
var pal = hardwarePalette.GetPalette(name);
return new PaletteReference(name, hardwarePalette.GetPaletteIndex(name), pal, hardwarePalette);
}
IHardwareCursor CreateCursor(ISpriteFrame f, ImmutablePalette palette, string name, CursorSequence sequence)
{
var hotspot = sequence.Hotspot - f.Offset.ToInt2() + new int2(f.Size) / 2;
@@ -96,6 +121,7 @@ namespace OpenRA.Graphics
int frame;
int ticks;
public void Tick()
{
if (cursor == null || cursor.Length == 1)
@@ -112,18 +138,46 @@ namespace OpenRA.Graphics
void Update()
{
if (cursor == null)
if (cursor != null && frame >= cursor.Length)
frame %= cursor.Length;
if (cursor == null || isLocked)
Game.Renderer.Window.SetHardwareCursor(null);
else
{
if (frame >= cursor.Length)
frame = frame % cursor.Length;
Game.Renderer.Window.SetHardwareCursor(hardwareCursors[cursor.Name][frame]);
}
}
public void Render(Renderer renderer) { }
public void Render(Renderer renderer)
{
if (cursor.Name == null || !isLocked)
return;
var cursorSequence = cursorProvider.GetCursorSequence(cursor.Name);
var cursorSprite = sprites[cursor.Name][frame];
var cursorOffset = cursorSequence.Hotspot + (0.5f * cursorSprite.Size.XY).ToInt2();
renderer.SetPalette(hardwarePalette);
renderer.SpriteRenderer.DrawSprite(cursorSprite,
lockedPosition - cursorOffset,
paletteReferences[cursorSequence.Palette],
cursorSprite.Size);
}
public void Lock()
{
lockedPosition = Viewport.LastMousePos;
Game.Renderer.Window.SetRelativeMouseMode(true);
isLocked = true;
Update();
}
public void Unlock()
{
Game.Renderer.Window.SetRelativeMouseMode(false);
isLocked = false;
Update();
}
public void Dispose()
{
@@ -131,7 +185,8 @@ namespace OpenRA.Graphics
foreach (var cursor in cursors.Value)
cursor.Dispose();
sheetBuilder.Dispose();
hardwareCursors.Clear();
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,8 +10,8 @@
#endregion
using System;
using System.Drawing;
using OpenRA.FileSystem;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -55,4 +55,4 @@ namespace OpenRA.Graphics
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,11 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -36,30 +33,6 @@ namespace OpenRA.Graphics
return Color.FromArgb((int)palette[index]);
}
public static ColorPalette AsSystemPalette(this IPalette palette)
{
ColorPalette pal;
using (var b = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
pal = b.Palette;
for (var i = 0; i < Size; i++)
pal.Entries[i] = palette.GetColor(i);
return pal;
}
public static Bitmap AsBitmap(this IPalette palette)
{
var b = new Bitmap(Size, 1, PixelFormat.Format32bppArgb);
var data = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
var temp = new uint[Size];
palette.CopyToArray(temp, 0);
Marshal.Copy((int[])(object)temp, 0, data.Scan0, Size);
b.UnlockBits(data);
return b;
}
public static IPalette AsReadOnly(this IPalette palette)
{
if (palette is ImmutablePalette)

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,8 +10,8 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA
{
@@ -19,6 +19,7 @@ namespace OpenRA
{
IPlatformWindow CreateWindow(Size size, WindowMode windowMode, int batchSize);
ISoundEngine CreateSound(string device);
IFont CreateFont(byte[] data);
}
public interface IHardwareCursor : IDisposable { }
@@ -51,18 +52,18 @@ namespace OpenRA
IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot);
void SetHardwareCursor(IHardwareCursor cursor);
void SetRelativeMouseMode(bool mode);
}
public interface IGraphicsContext : IDisposable
{
IVertexBuffer<Vertex> CreateVertexBuffer(int size);
ITexture CreateTexture();
ITexture CreateTexture(Bitmap bitmap);
IFrameBuffer CreateFrameBuffer(Size s);
IShader CreateShader(string name);
void EnableScissor(int left, int top, int width, int height);
void DisableScissor();
Bitmap TakeScreenshot();
void SaveScreenshot(string path);
void Present();
void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices);
void Clear();
@@ -97,7 +98,6 @@ namespace OpenRA
public interface ITexture : IDisposable
{
void SetData(Bitmap bitmap);
void SetData(uint[,] colors);
void SetData(byte[] colors, int width, int height);
byte[] GetData();
@@ -131,4 +131,17 @@ namespace OpenRA
Fullscreen,
PseudoFullscreen,
}
public interface IFont : IDisposable
{
FontGlyph CreateGlyph(char c, int size, float deviceScale);
}
public struct FontGlyph
{
public int2 Offset;
public Size Size;
public float Advance;
public byte[] Data;
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
@@ -26,12 +25,16 @@ namespace OpenRA.Graphics
return ramp[i];
}
public PlayerColorRemap(int[] ramp, HSLColor c, float rampFraction)
public PlayerColorRemap(int[] ramp, Color c, float rampFraction)
{
var h = c.GetHue() / 360.0f;
var s = c.GetSaturation();
var l = c.GetBrightness();
// Increase luminosity if required to represent the full ramp
var rampRange = (byte)((1 - rampFraction) * c.L);
var c1 = new HSLColor(c.H, c.S, Math.Max(rampRange, c.L)).RGB;
var c2 = new HSLColor(c.H, c.S, (byte)Math.Max(0, c.L - rampRange)).RGB;
var rampRange = (byte)((1 - rampFraction) * l);
var c1 = Color.FromAhsl(h, s, Math.Max(rampRange, l));
var c2 = Color.FromAhsl(h, s, (byte)Math.Max(0, l - rampRange));
var baseIndex = ramp[0];
var remapRamp = ramp.Select(r => r - ramp[0]);
var rampMaxIndex = ramp.Length - 1;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -9,7 +9,7 @@
*/
#endregion
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -238,6 +238,29 @@ namespace OpenRA.Graphics
parent.DrawRGBAVertices(vertices);
}
public void FillRect(float3 a, float3 b, float3 c, float3 d, Color topLeftColor, Color topRightColor, Color bottomRightColor, Color bottomLeftColor)
{
vertices[0] = VertexWithColor(a + Offset, topLeftColor);
vertices[1] = VertexWithColor(b + Offset, topRightColor);
vertices[2] = VertexWithColor(c + Offset, bottomRightColor);
vertices[3] = VertexWithColor(c + Offset, bottomRightColor);
vertices[4] = VertexWithColor(d + Offset, bottomLeftColor);
vertices[5] = VertexWithColor(a + Offset, topLeftColor);
parent.DrawRGBAVertices(vertices);
}
static Vertex VertexWithColor(float3 xyz, Color color)
{
color = Util.PremultiplyAlpha(color);
var cr = color.R / 255.0f;
var cg = color.G / 255.0f;
var cb = color.B / 255.0f;
var ca = color.A / 255.0f;
return new Vertex(xyz, cr, cg, cb, ca, 0, 0);
}
public void FillEllipse(float3 tl, float3 br, Color color, int vertices = 32)
{
// TODO: Create an ellipse polygon instead

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenRA.FileSystem;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,10 +10,9 @@
#endregion
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -50,13 +49,10 @@ namespace OpenRA.Graphics
public Sheet(SheetType type, Stream stream)
{
using (var bitmap = (Bitmap)Image.FromStream(stream))
{
Size = bitmap.Size;
data = new byte[4 * Size.Width * Size.Height];
Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
}
var png = new Png(stream);
Size = new Size(png.Width, png.Height);
data = new byte[4 * Size.Width * Size.Height];
Util.FastCopyIntoSprite(new Sprite(this, new Rectangle(0, 0, png.Width, png.Height), TextureChannel.Red), png);
Type = type;
ReleaseBuffer();
@@ -81,48 +77,27 @@ namespace OpenRA.Graphics
return texture;
}
public Bitmap AsBitmap()
public Png AsPng()
{
var d = GetData();
var dataStride = 4 * Size.Width;
var bitmap = new Bitmap(Size.Width, Size.Height);
var bd = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
for (var y = 0; y < Size.Height; y++)
Marshal.Copy(d, y * dataStride, IntPtr.Add(bd.Scan0, y * bd.Stride), dataStride);
bitmap.UnlockBits(bd);
return bitmap;
return new Png(GetData(), Size.Width, Size.Height);
}
public Bitmap AsBitmap(TextureChannel channel, IPalette pal)
public Png AsPng(TextureChannel channel, IPalette pal)
{
var d = GetData();
var plane = new byte[Size.Width * Size.Height];
var dataStride = 4 * Size.Width;
var bitmap = new Bitmap(Size.Width, Size.Height);
var channelOffset = (int)channel;
var bd = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
unsafe
{
var colors = (uint*)bd.Scan0;
for (var y = 0; y < Size.Height; y++)
{
var dataRowIndex = y * dataStride + channelOffset;
var bdRowIndex = y * bd.Stride / 4;
for (var x = 0; x < Size.Width; x++)
{
var paletteIndex = d[dataRowIndex + 4 * x];
colors[bdRowIndex + x] = pal[paletteIndex];
}
}
}
for (var y = 0; y < Size.Height; y++)
for (var x = 0; x < Size.Width; x++)
plane[y * Size.Width + x] = d[y * dataStride + channelOffset + 4 * x];
bitmap.UnlockBits(bd);
var palColors = new Color[Palette.Size];
for (var i = 0; i < Palette.Size; i++)
palColors[i] = pal.GetColor(i);
return bitmap;
return new Png(plane, Size.Width, Size.Height, palColors);
}
public void CreateBuffer()

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -39,7 +40,7 @@ namespace OpenRA.Graphics
Sheet current;
TextureChannel channel;
int rowHeight = 0;
Point p;
int2 p;
public static Sheet AllocateSheet(SheetType type, int sheetSize)
{
@@ -75,9 +76,9 @@ namespace OpenRA.Graphics
return rect;
}
public Sprite Add(Bitmap src)
public Sprite Add(Png src)
{
var rect = Allocate(src.Size);
var rect = Allocate(new Size(src.Width, src.Height));
Util.FastCopyIntoSprite(rect, src);
current.CommitBufferedData();
return rect;
@@ -106,7 +107,7 @@ namespace OpenRA.Graphics
{
if (imageSize.Width + p.X > current.Size.Width)
{
p = new Point(0, p.Y + rowHeight);
p = new int2(0, p.Y + rowHeight);
rowHeight = imageSize.Height;
}
@@ -127,11 +128,11 @@ namespace OpenRA.Graphics
channel = next.Value;
rowHeight = imageSize.Height;
p = new Point(0, 0);
p = int2.Zero;
}
var rect = new Sprite(current, new Rectangle(p, imageSize), zRamp, spriteOffset, channel, BlendMode.Alpha);
p.X += imageSize.Width;
var rect = new Sprite(current, new Rectangle(p.X, p.Y, imageSize.Width, imageSize.Height), zRamp, spriteOffset, channel, BlendMode.Alpha);
p += new int2(imageSize.Width, 0);
return rect;
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -21,6 +21,8 @@ namespace OpenRA.Graphics
void Render(Renderer renderer);
void SetCursor(string cursor);
void Tick();
void Lock();
void Unlock();
}
public sealed class SoftwareCursor : ICursor
@@ -31,6 +33,9 @@ namespace OpenRA.Graphics
readonly CursorProvider cursorProvider;
readonly SheetBuilder sheetBuilder;
bool isLocked = false;
int2 lockedPosition;
public SoftwareCursor(CursorProvider cursorProvider)
{
this.cursorProvider = cursorProvider;
@@ -77,7 +82,7 @@ namespace OpenRA.Graphics
return;
var cursorSequence = cursorProvider.GetCursorSequence(cursorName);
var cursorSprite = sprites[cursorName][((int)cursorFrame % cursorSequence.Length)];
var cursorSprite = sprites[cursorName][(int)cursorFrame % cursorSequence.Length];
var cursorSize = CursorProvider.CursorViewportZoomed ? 2.0f * cursorSprite.Size : cursorSprite.Size;
var cursorOffset = CursorProvider.CursorViewportZoomed ?
@@ -85,12 +90,26 @@ namespace OpenRA.Graphics
cursorSequence.Hotspot + (0.5f * cursorSprite.Size.XY).ToInt2();
renderer.SetPalette(palette);
var mousePos = isLocked ? lockedPosition : Viewport.LastMousePos;
renderer.SpriteRenderer.DrawSprite(cursorSprite,
Viewport.LastMousePos - cursorOffset,
mousePos - cursorOffset,
paletteReferences[cursorSequence.Palette],
cursorSize);
}
public void Lock()
{
Game.Renderer.Window.SetRelativeMouseMode(true);
lockedPosition = Viewport.LastMousePos;
isLocked = true;
}
public void Unlock()
{
Game.Renderer.Window.SetRelativeMouseMode(false);
isLocked = false;
}
public void Dispose()
{
palette.Dispose();

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,28 +10,25 @@
#endregion
using System;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Widgets;
using SharpFont;
namespace OpenRA.Graphics
{
public sealed class SpriteFont : IDisposable
{
static readonly Library Library = new Library();
public int TopOffset { get; private set; }
readonly int size;
readonly SheetBuilder builder;
readonly Func<string, float> lineWidth;
readonly Face face;
readonly IFont font;
readonly Cache<Pair<char, Color>, GlyphInfo> glyphs;
float deviceScale;
public SpriteFont(string name, byte[] data, int size, float scale, SheetBuilder builder)
public SpriteFont(string name, byte[] data, int size, int ascender, float scale, SheetBuilder builder)
{
if (builder.Type != SheetType.BGRA)
throw new ArgumentException("The sheet builder must create BGRA sheets.", "builder");
@@ -40,8 +37,7 @@ namespace OpenRA.Graphics
this.size = size;
this.builder = builder;
face = new Face(Library, data, 0);
face.SetPixelSizes((uint)(size * deviceScale), (uint)(size * deviceScale));
font = Game.Renderer.CreateFont(data);
glyphs = new Cache<Pair<char, Color>, GlyphInfo>(CreateGlyph, Pair<char, Color>.EqualityComparer);
@@ -51,18 +47,19 @@ namespace OpenRA.Graphics
if (size <= 24)
PrecacheColor(Color.White, name);
TopOffset = size - ascender;
}
public void SetScale(float scale)
{
deviceScale = scale;
face.SetPixelSizes((uint)(size * deviceScale), (uint)(size * deviceScale));
glyphs.Clear();
}
void PrecacheColor(Color c, string name)
{
using (new PerfTimer("PrecacheColor {0} {1}px {2}".F(name, size, c.Name)))
using (new PerfTimer("PrecacheColor {0} {1}px {2}".F(name, size, c)))
for (var n = (char)0x20; n < (char)0x7f; n++)
if (glyphs[Pair.New(n, c)] == null)
throw new InvalidOperationException();
@@ -89,7 +86,53 @@ namespace OpenRA.Graphics
new float2(
(int)Math.Round(p.X * deviceScale + g.Offset.X, 0) / deviceScale,
p.Y + g.Offset.Y / deviceScale),
g.Sprite.Size / deviceScale);
g.Sprite.Size / deviceScale);
p += new float2(g.Advance / deviceScale, 0);
}
}
float3 Rotate(float3 v, float sina, float cosa, float2 offset)
{
return new float3(
v.X * cosa - v.Y * sina + offset.X,
v.X * sina + v.Y * cosa + offset.Y,
0);
}
public void DrawText(string text, float2 location, Color c, float angle)
{
// Offset from the baseline position to the top-left of the glyph for rendering
var offset = new float2(0, size);
var cosa = (float)Math.Cos(-angle);
var sina = (float)Math.Sin(-angle);
var p = offset;
foreach (var s in text)
{
if (s == '\n')
{
offset += new float2(0, size);
p = offset;
continue;
}
var g = glyphs[Pair.New(s, c)];
if (g.Sprite != null)
{
var tl = new float3(
(int)Math.Round(p.X * deviceScale + g.Offset.X, 0) / deviceScale,
p.Y + g.Offset.Y / deviceScale, 0);
var br = tl + g.Sprite.Size / deviceScale;
var tr = new float3(br.X, tl.Y, 0);
var bl = new float3(tl.X, br.Y, 0);
Game.Renderer.RgbaSpriteRenderer.DrawSprite(g.Sprite,
Rotate(tl, sina, cosa, location),
Rotate(tr, sina, cosa, location),
Rotate(br, sina, cosa, location),
Rotate(bl, sina, cosa, location));
}
p += new float2(g.Advance / deviceScale, 0);
}
@@ -110,7 +153,7 @@ namespace OpenRA.Graphics
public void DrawTextWithContrast(string text, float2 location, Color fg, Color bgDark, Color bgLight, int offset)
{
DrawTextWithContrast(text, location, fg, WidgetUtils.GetContrastColor(fg, bgDark, bgLight), offset);
DrawTextWithContrast(text, location, fg, GetContrastColor(fg, bgDark, bgLight), offset);
}
public void DrawTextWithShadow(string text, float2 location, Color fg, Color bg, int offset)
@@ -123,7 +166,20 @@ namespace OpenRA.Graphics
public void DrawTextWithShadow(string text, float2 location, Color fg, Color bgDark, Color bgLight, int offset)
{
DrawTextWithShadow(text, location, fg, WidgetUtils.GetContrastColor(fg, bgDark, bgLight), offset);
DrawTextWithShadow(text, location, fg, GetContrastColor(fg, bgDark, bgLight), offset);
}
public void DrawTextWithShadow(string text, float2 location, Color fg, Color bg, int offset, float angle)
{
if (offset != 0)
DrawText(text, location + new float2(offset, offset), bg, angle);
DrawText(text, location, fg, angle);
}
public void DrawTextWithShadow(string text, float2 location, Color fg, Color bgDark, Color bgLight, int offset, float angle)
{
DrawTextWithShadow(text, location, fg, GetContrastColor(fg, bgDark, bgLight), offset, angle);
}
public int2 Measure(string text)
@@ -137,11 +193,9 @@ namespace OpenRA.Graphics
GlyphInfo CreateGlyph(Pair<char, Color> c)
{
try
{
face.LoadChar(c.First, LoadFlags.Default, LoadTarget.Normal);
}
catch (FreeTypeException)
var glyph = font.CreateGlyph(c.First, size, deviceScale);
if (glyph.Data == null)
{
return new GlyphInfo
{
@@ -151,44 +205,31 @@ namespace OpenRA.Graphics
};
}
face.Glyph.RenderGlyph(RenderMode.Normal);
var size = new Size((int)face.Glyph.Metrics.Width, (int)face.Glyph.Metrics.Height);
var s = builder.Allocate(size);
var s = builder.Allocate(glyph.Size);
var g = new GlyphInfo
{
Sprite = s,
Advance = (float)face.Glyph.Metrics.HorizontalAdvance,
Offset = new int2(face.Glyph.BitmapLeft, -face.Glyph.BitmapTop)
Advance = glyph.Advance,
Offset = glyph.Offset
};
// A new bitmap is generated each time this property is accessed, so we do need to dispose it.
using (var bitmap = face.Glyph.Bitmap)
var dest = s.Sheet.GetData();
var destStride = s.Sheet.Size.Width * 4;
for (var j = 0; j < s.Size.Y; j++)
{
unsafe
for (var i = 0; i < s.Size.X; i++)
{
var p = (byte*)bitmap.Buffer;
var dest = s.Sheet.GetData();
var destStride = s.Sheet.Size.Width * 4;
for (var j = 0; j < s.Size.Y; j++)
var p = glyph.Data[j * glyph.Size.Width + i];
if (p != 0)
{
for (var i = 0; i < s.Size.X; i++)
{
if (p[i] != 0)
{
var q = destStride * (j + s.Bounds.Top) + 4 * (i + s.Bounds.Left);
var pmc = Util.PremultiplyAlpha(Color.FromArgb(p[i], c.Second));
var q = destStride * (j + s.Bounds.Top) + 4 * (i + s.Bounds.Left);
var pmc = Util.PremultiplyAlpha(Color.FromArgb(p, c.Second));
dest[q] = pmc.B;
dest[q + 1] = pmc.G;
dest[q + 2] = pmc.R;
dest[q + 3] = pmc.A;
}
}
p += bitmap.Pitch;
dest[q] = pmc.B;
dest[q + 1] = pmc.G;
dest[q + 2] = pmc.R;
dest[q + 3] = pmc.A;
}
}
}
@@ -198,9 +239,14 @@ namespace OpenRA.Graphics
return g;
}
static Color GetContrastColor(Color fgColor, Color bgDark, Color bgLight)
{
return fgColor == Color.White || fgColor.GetBrightness() > 0.33 ? bgDark : bgLight;
}
public void Dispose()
{
face.Dispose();
font.Dispose();
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.FileSystem;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,8 +10,8 @@
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -19,11 +19,15 @@ namespace OpenRA.Graphics
{
readonly IEnumerable<WPos> waypoints;
readonly Color color;
readonly int width;
readonly int markerSize;
public TargetLineRenderable(IEnumerable<WPos> waypoints, Color color)
public TargetLineRenderable(IEnumerable<WPos> waypoints, Color color, int width = 1, int markerSize = 1)
{
this.waypoints = waypoints;
this.color = color;
this.width = width;
this.markerSize = markerSize;
}
public WPos Pos { get { return waypoints.First(); } }
@@ -42,23 +46,23 @@ namespace OpenRA.Graphics
if (!waypoints.Any())
return;
var iz = 1 / wr.Viewport.Zoom;
var sw = width / wr.Viewport.Zoom;
var first = wr.Screen3DPosition(waypoints.First());
var a = first;
foreach (var b in waypoints.Skip(1).Select(pos => wr.Screen3DPosition(pos)))
{
Game.Renderer.WorldRgbaColorRenderer.DrawLine(a, b, iz, color);
DrawTargetMarker(wr, color, b);
Game.Renderer.WorldRgbaColorRenderer.DrawLine(a, b, sw, color);
DrawTargetMarker(wr, color, b, markerSize);
a = b;
}
DrawTargetMarker(wr, color, first);
}
public static void DrawTargetMarker(WorldRenderer wr, Color color, float3 location)
public static void DrawTargetMarker(WorldRenderer wr, Color color, float3 location, int size = 1)
{
var iz = 1 / wr.Viewport.Zoom;
var offset = new float2(iz, iz);
var sw = size / wr.Viewport.Zoom;
var offset = new float2(sw, sw);
var tl = location - offset;
var br = location + offset;
Game.Renderer.WorldRgbaColorRenderer.FillRect(tl, br, color);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Support;
namespace OpenRA.Graphics

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -9,7 +9,7 @@
*/
#endregion
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,8 +10,8 @@
#endregion
using System;
using System.Drawing;
using System.Drawing.Imaging;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -81,53 +81,43 @@ namespace OpenRA.Graphics
}
}
public static void FastCopyIntoSprite(Sprite dest, Bitmap src)
public static void FastCopyIntoSprite(Sprite dest, Png src)
{
var createdTempBitmap = false;
if (src.PixelFormat != PixelFormat.Format32bppArgb)
var destData = dest.Sheet.GetData();
var destStride = dest.Sheet.Size.Width;
var width = dest.Bounds.Width;
var height = dest.Bounds.Height;
unsafe
{
src = src.CloneWith32bbpArgbPixelFormat();
createdTempBitmap = true;
}
try
{
var destData = dest.Sheet.GetData();
var destStride = dest.Sheet.Size.Width;
var width = dest.Bounds.Width;
var height = dest.Bounds.Height;
var srcData = src.LockBits(src.Bounds(),
ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
// Cast the data to an int array so we can copy the src data directly
fixed (byte* bd = &destData[0])
{
var c = (int*)srcData.Scan0;
var data = (int*)bd;
var x = dest.Bounds.Left;
var y = dest.Bounds.Top;
// Cast the data to an int array so we can copy the src data directly
fixed (byte* bd = &destData[0])
var k = 0;
for (var j = 0; j < height; j++)
{
var data = (int*)bd;
var x = dest.Bounds.Left;
var y = dest.Bounds.Top;
for (var j = 0; j < height; j++)
for (var i = 0; i < width; i++)
{
for (var i = 0; i < width; i++)
Color cc;
if (src.Palette == null)
{
var cc = Color.FromArgb(*(c + (j * srcData.Stride >> 2) + i));
data[(y + j) * destStride + x + i] = PremultiplyAlpha(cc).ToArgb();
var r = src.Data[k++];
var g = src.Data[k++];
var b = src.Data[k++];
var a = src.Data[k++];
cc = Color.FromArgb(a, r, g, b);
}
else
cc = src.Palette[src.Data[k++]];
data[(y + j) * destStride + x + i] = PremultiplyAlpha(cc).ToArgb();
}
}
}
src.UnlockBits(srcData);
}
finally
{
if (createdTempBitmap)
src.Dispose();
}
}
@@ -330,7 +320,7 @@ namespace OpenRA.Graphics
public static float[] MakeFloatMatrix(Int32Matrix4x4 imtx)
{
var multipler = 1f / imtx.M44;
return new float[]
return new[]
{
imtx.M11 * multipler,
imtx.M12 * multipler,
@@ -362,13 +352,16 @@ namespace OpenRA.Graphics
var iz = new uint[] { 2, 5, 2, 5, 2, 5, 2, 5 };
// Vectors to opposing corner
var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue,
float.MinValue, float.MinValue, float.MinValue };
var ret = new[]
{
float.MaxValue, float.MaxValue, float.MaxValue,
float.MinValue, float.MinValue, float.MinValue
};
// Transform vectors and find new bounding box
for (var i = 0; i < 8; i++)
{
var vec = new float[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
var vec = new[] { bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1 };
var tvec = MatrixVectorMultiply(mtx, vec);
ret[0] = Math.Min(ret[0], tvec[0] / tvec[3]);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -311,4 +311,4 @@ namespace OpenRA.Graphics
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,9 +11,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Effects;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Graphics
@@ -67,7 +67,7 @@ namespace OpenRA.Graphics
debugVis = Exts.Lazy(() => world.WorldActor.TraitOrDefault<DebugVisualizations>());
}
public void UpdatePalettesForPlayer(string internalName, HSLColor color, bool replaceExisting)
public void UpdatePalettesForPlayer(string internalName, Color color, bool replaceExisting)
{
foreach (var pal in World.WorldActor.TraitsImplementing<ILoadsPlayerPalettes>())
pal.LoadPlayerPalettes(this, internalName, color, replaceExisting);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -20,6 +20,7 @@ namespace OpenRA
public readonly Hotkey Default = Hotkey.Invalid;
public readonly string Description = "";
public readonly HashSet<string> Types = new HashSet<string>();
public bool HasDuplicates { get; internal set; }
public HotkeyDefinition(string name, MiniYaml node)
{
@@ -37,4 +38,4 @@ namespace OpenRA
Types = FieldLoader.GetValue<HashSet<string>>("Types", typesNode.Value.Value);
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -34,7 +34,13 @@ namespace OpenRA
}
foreach (var kv in settings)
keys[kv.Key] = kv.Value;
{
if (definitions.ContainsKey(kv.Key))
keys[kv.Key] = kv.Value;
}
foreach (var hd in definitions)
hd.Value.HasDuplicates = GetFirstDuplicate(hd.Value.Name, this[hd.Value.Name].GetValue(), hd.Value) != null;
}
internal Func<Hotkey> GetHotkeyReference(string name)
@@ -62,6 +68,34 @@ namespace OpenRA
settings[name] = value;
else
settings.Remove(name);
var hadDuplicates = definition.HasDuplicates;
definition.HasDuplicates = GetFirstDuplicate(definition.Name, this[definition.Name].GetValue(), definition) != null;
if (hadDuplicates || definition.HasDuplicates)
{
foreach (var hd in definitions)
{
if (hd.Value == definition)
continue;
hd.Value.HasDuplicates = GetFirstDuplicate(hd.Value.Name, this[hd.Value.Name].GetValue(), hd.Value) != null;
}
}
}
public HotkeyDefinition GetFirstDuplicate(string name, Hotkey value, HotkeyDefinition definition)
{
foreach (var kv in keys)
{
if (kv.Key == name)
continue;
if (kv.Value == value && definitions[kv.Key].Types.Overlaps(definition.Types))
return definitions[kv.Key];
}
return null;
}
public HotkeyReference this[string name]

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -26,17 +26,17 @@ namespace OpenRA
{
public MouseInputEvent Event;
public MouseButton Button;
public int ScrollDelta;
public int2 Location;
public int2 Delta;
public Modifiers Modifiers;
public int MultiTapCount;
public MouseInput(MouseInputEvent ev, MouseButton button, int scrollDelta, int2 location, Modifiers mods, int multiTapCount)
public MouseInput(MouseInputEvent ev, MouseButton button, int2 location, int2 delta, Modifiers mods, int multiTapCount)
{
Event = ev;
Button = button;
ScrollDelta = scrollDelta;
Location = location;
Delta = delta;
Modifiers = mods;
MultiTapCount = multiTapCount;
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -258,7 +258,7 @@ namespace OpenRA
{
static readonly Dictionary<Keycode, string> KeyNames = new Dictionary<Keycode, string>
{
{ Keycode.UNKNOWN, "Unknown" },
{ Keycode.UNKNOWN, "Undefined" },
{ Keycode.RETURN, "Return" },
{ Keycode.ESCAPE, "Escape" },
{ Keycode.BACKSPACE, "Backspace" },

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,9 +12,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Primitives;
@@ -83,8 +83,7 @@ namespace OpenRA
{
using (var stream = package.GetStream("icon.png"))
if (stream != null)
using (var bitmap = new Bitmap(stream))
icons[id] = sheetBuilder.Add(bitmap);
icons[id] = sheetBuilder.Add(new Png(stream));
}
else if (!manifest.Metadata.Hidden)
Log.Write("debug", "Mod '{0}' is missing 'icon.png'.".F(path));
@@ -128,4 +127,4 @@ namespace OpenRA
public bool TryGetValue(string key, out Manifest value) { return mods.TryGetValue(key, out value); }
IEnumerator IEnumerable.GetEnumerator() { return mods.GetEnumerator(); }
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -160,7 +160,7 @@ namespace OpenRA
}
innerState = LinkState.Uninitialized;
parameters = new RSAParameters();
parameters = default(RSAParameters);
innerFingerprint = null;
innerData = null;
}
@@ -185,4 +185,4 @@ namespace OpenRA
return CryptoUtil.DecryptString(parameters, data);
}
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -10,7 +10,7 @@
#endregion
using System;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA
{
@@ -92,4 +92,4 @@ namespace OpenRA
public override string ToString() { return U + "," + V; }
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -66,17 +66,19 @@ namespace OpenRA
public readonly IReadOnlyDictionary<string, string> Packages;
public readonly IReadOnlyDictionary<string, string> MapFolders;
public readonly MiniYaml LoadScreen;
public readonly Dictionary<string, Pair<string, int>> Fonts;
public readonly string[] SoundFormats = { };
public readonly string[] SpriteFormats = { };
public readonly string[] PackageFormats = { };
readonly string[] reservedModuleNames = { "Metadata", "Folders", "MapFolders", "Packages", "Rules",
readonly string[] reservedModuleNames =
{
"Metadata", "Folders", "MapFolders", "Packages", "Rules",
"Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
"Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions", "Hotkeys",
"ServerTraits", "LoadScreen", "Fonts", "SupportsMapsFrom", "SoundFormats", "SpriteFormats",
"RequiresMods", "PackageFormats" };
"ServerTraits", "LoadScreen", "SupportsMapsFrom", "SoundFormats", "SpriteFormats",
"RequiresMods", "PackageFormats"
};
readonly TypeDictionary modules = new TypeDictionary();
readonly Dictionary<string, MiniYaml> yaml;
@@ -120,12 +122,6 @@ namespace OpenRA
if (!yaml.TryGetValue("LoadScreen", out LoadScreen))
throw new InvalidDataException("`LoadScreen` section is not defined.");
Fonts = yaml["Fonts"].ToDictionary(my =>
{
var nd = my.ToDictionary();
return Pair.New(nd["Font"].Value, Exts.ParseIntegerInvariant(nd["Size"].Value));
});
// Allow inherited mods to import parent maps.
var compat = new List<string> { Id };

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -49,7 +49,9 @@ namespace OpenRA
public class LocationInit : IActorInit<CPos>
{
[FieldFromYamlKey] readonly CPos value = CPos.Zero;
[FieldFromYamlKey]
readonly CPos value = CPos.Zero;
public LocationInit() { }
public LocationInit(CPos init) { value = init; }
public CPos Value(World world) { return value; }
@@ -57,7 +59,9 @@ namespace OpenRA
public class OwnerInit : IActorInit<Player>
{
[FieldFromYamlKey] public readonly string PlayerName = "Neutral";
[FieldFromYamlKey]
public readonly string PlayerName = "Neutral";
Player player;
public OwnerInit() { }

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -28,7 +28,8 @@ namespace OpenRA
Lazy<TypeDictionary> initDict;
public ActorReference(string type) : this(type, new Dictionary<string, MiniYaml>()) { }
public ActorReference(string type)
: this(type, new Dictionary<string, MiniYaml>()) { }
public ActorReference(string type, Dictionary<string, MiniYaml> inits)
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,7 +12,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Primitives;
namespace OpenRA
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,12 +11,11 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Primitives;
using OpenRA.Support;
@@ -567,6 +566,10 @@ namespace OpenRA
foreach (var field in YamlFields)
field.Serialize(this, root);
// HACK: map.yaml is expected to have empty lines between top-level blocks
for (var i = root.Count - 1; i > 0; i--)
root.Insert(i, new MiniYamlNode("", ""));
// Saving to a new package: copy over all the content from the map
if (Package != null && toPackage != Package)
foreach (var file in Package.Contents)
@@ -647,8 +650,24 @@ namespace OpenRA
public byte[] SavePreview()
{
var tileset = Rules.TileSet;
var resources = Rules.Actors["world"].TraitInfos<ResourceTypeInfo>()
.ToDictionary(r => r.ResourceType, r => r.TerrainType);
var actorTypes = Rules.Actors.Values.Where(a => a.HasTraitInfo<IMapPreviewSignatureInfo>());
var actors = ActorDefinitions.Where(a => actorTypes.Where(ai => ai.Name == a.Value.Value).Any());
var positions = new List<Pair<MPos, Color>>();
foreach (var actor in actors)
{
var s = new ActorReference(actor.Value.Value, actor.Value.ToDictionary());
var ai = Rules.Actors[actor.Value.Value];
var impsis = ai.TraitInfos<IMapPreviewSignatureInfo>();
foreach (var impsi in impsis)
impsi.PopulateMapPreviewSignatureCells(this, ai, s, positions);
}
// ResourceLayer is on world actor, which isn't caught above, so an extra check for it.
var worldActorInfo = Rules.Actors["world"];
var worldimpsis = worldActorInfo.TraitInfos<IMapPreviewSignatureInfo>();
foreach (var worldimpsi in worldimpsis)
worldimpsi.PopulateMapPreviewSignatureCells(this, worldActorInfo, null, positions);
using (var stream = new MemoryStream())
{
@@ -664,61 +683,64 @@ namespace OpenRA
if (isRectangularIsometric)
bitmapWidth = 2 * bitmapWidth - 1;
using (var bitmap = new Bitmap(bitmapWidth, height))
var stride = bitmapWidth * 4;
var pxStride = 4;
var minimapData = new byte[stride * height];
Color leftColor, rightColor;
for (var y = 0; y < height; y++)
{
var bitmapData = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
for (var x = 0; x < width; x++)
{
var colors = (int*)bitmapData.Scan0;
var stride = bitmapData.Stride / 4;
Color leftColor, rightColor;
for (var y = 0; y < height; y++)
var uv = new MPos(x + Bounds.Left, y + Bounds.Top);
var actorsThere = positions.Where(ap => ap.First == uv);
if (actorsThere.Any())
{
for (var x = 0; x < width; x++)
leftColor = rightColor = actorsThere.First().Second;
}
else
{
// Cell contains terrain
var type = tileset.GetTileInfo(Tiles[uv]);
leftColor = type != null ? type.LeftColor : Color.Black;
rightColor = type != null ? type.RightColor : Color.Black;
}
if (isRectangularIsometric)
{
// Odd rows are shifted right by 1px
var dx = uv.V & 1;
var xOffset = pxStride * (2 * x + dx);
if (x + dx > 0)
{
var uv = new MPos(x + Bounds.Left, y + Bounds.Top);
var resourceType = Resources[uv].Type;
if (resourceType != 0)
{
// Cell contains resources
string res;
if (!resources.TryGetValue(resourceType, out res))
continue;
var z = y * stride + xOffset - pxStride;
minimapData[z++] = leftColor.R;
minimapData[z++] = leftColor.G;
minimapData[z++] = leftColor.B;
minimapData[z++] = leftColor.A;
}
leftColor = rightColor = tileset[tileset.GetTerrainIndex(res)].Color;
}
else
{
// Cell contains terrain
var type = tileset.GetTileInfo(Tiles[uv]);
leftColor = type != null ? type.LeftColor : Color.Black;
rightColor = type != null ? type.RightColor : Color.Black;
}
if (isRectangularIsometric)
{
// Odd rows are shifted right by 1px
var dx = uv.V & 1;
if (x + dx > 0)
colors[y * stride + 2 * x + dx - 1] = leftColor.ToArgb();
if (2 * x + dx < stride)
colors[y * stride + 2 * x + dx] = rightColor.ToArgb();
}
else
colors[y * stride + x] = leftColor.ToArgb();
if (xOffset < stride)
{
var z = y * stride + xOffset;
minimapData[z++] = rightColor.R;
minimapData[z++] = rightColor.G;
minimapData[z++] = rightColor.B;
minimapData[z++] = rightColor.A;
}
}
else
{
var z = y * stride + pxStride * x;
minimapData[z++] = leftColor.R;
minimapData[z++] = leftColor.G;
minimapData[z++] = leftColor.B;
minimapData[z++] = leftColor.A;
}
}
bitmap.UnlockBits(bitmapData);
bitmap.Save(stream, ImageFormat.Png);
}
return stream.ToArray();
var png = new Png(minimapData, bitmapWidth, height);
return png.Save();
}
}
@@ -730,6 +752,11 @@ namespace OpenRA
if (Grid.Type == MapGridType.RectangularIsometric && cell.X < cell.Y)
return false;
// If the mod uses flat & rectangular maps, ToMPos and Contains(MPos) create unnecessary cost.
// Just check if CPos is within map bounds.
if (Grid.MaximumTerrainHeight == 0 && Grid.Type == MapGridType.Rectangular)
return Bounds.Contains(cell.X, cell.Y);
return Contains(cell.ToMPos(this));
}
@@ -1057,7 +1084,8 @@ namespace OpenRA
var v = rand.Next(Bounds.Top, Bounds.Bottom);
cells = Unproject(new PPos(u, v));
} while (!cells.Any());
}
while (!cells.Any());
return cells.Random(rand).ToCPos(Grid.Type);
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -233,7 +233,7 @@ namespace OpenRA
var maxKeepAlive = 5000 / emptyDelay;
var keepAlive = maxKeepAlive;
for (;;)
while (true)
{
List<MapPreview> todo;
lock (syncRoot)

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -11,9 +11,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -19,7 +19,8 @@ namespace OpenRA
{
public readonly Dictionary<string, PlayerReference> Players;
public MapPlayers() : this(new List<MiniYamlNode>()) { }
public MapPlayers()
: this(new List<MiniYamlNode>()) { }
public MapPlayers(IEnumerable<MiniYamlNode> playerDefinitions)
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -12,12 +12,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Primitives;
@@ -78,7 +78,7 @@ namespace OpenRA
public CPos[] SpawnPoints;
public MapGridType GridType;
public Rectangle Bounds;
public Bitmap Preview;
public Png Preview;
public MapStatus Status;
public MapClassification Class;
public MapVisibility Visibility;
@@ -147,7 +147,7 @@ namespace OpenRA
public CPos[] SpawnPoints { get { return innerData.SpawnPoints; } }
public MapGridType GridType { get { return innerData.GridType; } }
public Rectangle Bounds { get { return innerData.Bounds; } }
public Bitmap Preview { get { return innerData.Preview; } }
public Png Preview { get { return innerData.Preview; } }
public MapStatus Status { get { return innerData.Status; } }
public MapClassification Class { get { return innerData.Class; } }
public MapVisibility Visibility { get { return innerData.Visibility; } }
@@ -323,7 +323,7 @@ namespace OpenRA
if (p.Contains("map.png"))
using (var dataStream = p.GetStream("map.png"))
newData.Preview = new Bitmap(dataStream);
newData.Preview = new Png(dataStream);
// Assign the new data atomically
innerData = newData;
@@ -376,7 +376,7 @@ namespace OpenRA
newData.GridType = r.map_grid_type;
try
{
newData.Preview = new Bitmap(new MemoryStream(Convert.FromBase64String(r.minimap)));
newData.Preview = new Png(new MemoryStream(Convert.FromBase64String(r.minimap)));
}
catch (Exception e)
{

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2019 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, either version 3 of
@@ -9,7 +9,7 @@
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA
{
@@ -30,7 +30,7 @@ namespace OpenRA
public string Faction;
public bool LockColor = false;
public HSLColor Color = new HSLColor(0, 0, 238);
public Color Color = Color.FromAhsl(0, 0, 238);
public bool LockSpawn = false;
public int Spawn = 0;

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