Compare commits

...

847 Commits

Author SHA1 Message Date
reaperrr
bd951d8fb0 Fix FindActorsOnLine overscan 2017-08-26 23:48:01 +01:00
Paul Chote
f520b375e4 Add mod-specific appdata metadata. 2017-08-26 23:47:33 +01:00
Paul Chote
cadf6956a9 Use curl instead of wget in fetch-thirdparty-deps. 2017-08-26 13:54:42 +02:00
SoScared
db317eb226 Additional tweak of the Artillery weapon 2017-08-25 15:32:11 +02:00
Matthias Mailänder
b36ca98a83 Fix Dune 2000 harvester husk offset.
Closes #10087.
2017-08-24 11:36:58 +02:00
C. Helmig
1b5261e58a d2k: sonic weapon fix.
Works around buggy friend-foe discrimination (/Falloff) for sonic weapon. Damage values closer to original game. (Fixes #13850)
2017-08-23 13:04:43 +02:00
reaperrr
5654736086 Properly account for disabled Armaments in various places
These places didn't care if an Armament was disabled, which could lead to unexpected behavior.
2017-08-22 20:57:56 +01:00
reaperrr
3038f15f00 Consider disabled armaments invalid 2017-08-22 20:57:48 +01:00
SoScared
187dd5a071 fix ore spots on Dual Cold Front 2017-08-22 19:40:24 +02:00
reaperrr
740f04801b Allow skipping make anim for actors with WithMakeAnimation and GrantConditionOnDeploy 2017-08-17 22:04:47 +01:00
reaperrr
619d433e8b Allow skipping 'sell'/reversed make anim on Sell 2017-08-17 22:04:43 +01:00
reaperrr
4ca87c1e05 Allow skipping 'sell'/undeploy anim for actors that TransformOnCapture 2017-08-17 22:04:35 +01:00
Paul Chote
0b97003d83 Add x64process stat. 2017-08-17 19:48:21 +02:00
Paul Chote
6ba02da2eb Force '.' decimal point for windowscale stat. 2017-08-17 19:48:07 +02:00
SoScared
4496cffa4a probe new civilian structures 2017-08-17 15:26:58 +02:00
AoAGeneral
c3f1f617e0 TD Bridges.
Currently in both playtest and release the bridges for TD used to be 500hp with no armor. Meaning that minigunners and other unit types were able to kill them off fairly quickly. Giving them extra HP and an armor type means units such as minigunners, humvees, flamethrowers, and APCs can't kill bridges off quickly.
2017-08-13 20:21:50 +02:00
rob-v
dbab122594 Keep Attack M./Guard action while holding hotkey (revert Playtest change) 2017-08-13 17:46:41 +01:00
Allan Greis Eriksen
521236398d Audio device names is now shown correcly in the Audio Device combolist.
Ignored DA version of resource dll.
2017-08-13 18:38:29 +02:00
Oliver Brakmann
4b7f8c6c82 Fix Mobile not sanitizing target location of Move orders 2017-08-13 17:25:19 +01:00
Paul Chote
2e60e41764 Change beaconlib reference to match other deps. 2017-08-13 18:16:52 +02:00
Paul Chote
e8f552bf68 Update BeaconLib to 1.0.1. 2017-08-13 18:16:52 +02:00
abcdefg30
8743f13caa Fix monster tanks not attacking radar domes 2017-08-13 18:01:36 +02:00
abcdefg30
963a8e6ea9 Add the win and loss videos to Monster Tank Madness 2017-08-13 18:01:36 +02:00
Paul Chote
c8f1ce0d42 Update macOS launcher to 20170812 tag. 2017-08-13 17:53:58 +02:00
Paul Chote
13e0e927fe Switch to .NET 4.5 compatible Marshal.SizeOf overload. 2017-08-13 17:40:50 +02:00
Paul Chote
d3c130e8ae Fix d2k commandbar artwork glitch. 2017-08-13 14:10:10 +02:00
Paul Chote
8ff1762eac Revert TicksBeforePathing move from Mobile to Move.
This partially reverts commit 11c8cda0c3.
2017-08-13 13:41:13 +02:00
abc013
ef418403c5 Changed SAM launch offset 2017-08-13 12:55:03 +02:00
abcdefg30
74da4065fc Remove TargetWhenIdle and TargetWhenDamaged from AutoTarget 2017-08-10 19:18:57 +02:00
abcdefg30
b3e4fc807e Add TRUCK.Husk to Tiberian Dawn 2017-08-10 18:25:16 +02:00
SoScared
893ee6eb2c final RA balance patch for the next playtest/release 2017-08-10 18:17:48 +02:00
abcdefg30
a5df442499 Don't spawn new actors before all RemovedFromWorld callbacks have run 2017-08-10 18:03:47 +02:00
Paul Chote
a87df0f81e Focus the ViewportController on Standard/Inverted scroll modes. 2017-08-10 12:49:30 +02:00
Paul Chote
75130c47ff Extract ViewportEdgeScrollMargin settings entry. 2017-08-10 12:44:52 +02:00
Paul Chote
fd73556685 Revert "Have some activities count as idle activities"
This reverts commit ae111248f3.
2017-08-10 12:25:15 +02:00
rob-v
958cfcd378 Disable click sound on command bar buttons 2017-08-09 21:52:04 +01:00
rob-v
08be5d3907 Add ButtonWidget.DisableKeySound property 2017-08-09 21:51:58 +01:00
reaperrr
4adee762d9 Fix SpawnActorPower not playing launch sounds 2017-08-09 21:28:26 +01:00
abcdefg30
bf0b139398 Move the interior tile 384 from the Floor to the Wall category 2017-08-09 20:55:56 +02:00
SoScared
65fedd1eb1 Add Gap effect values to new vision range changes and ironing out misc. values 2017-08-09 20:37:06 +02:00
rob-v
117b229cb6 Fix Client tooltip crash in Lobby 2017-08-09 19:17:33 +01:00
abc013
76f52abd3d Fix ground units can stay on water (tile 409) 2017-08-08 12:33:19 +02:00
AoAGeneral
a7212d52fb TD Prerequisite changes.
Adds prerequisite labels to E1, E3, E6, and TDTRUCK.

Closes #13780
2017-08-08 12:22:19 +02:00
reaperrr
5e0a789dac Shrink shape of TD SAM 2017-08-07 14:52:29 +02:00
reaperrr
17b4158a56 Shrink shape of RA SAM
To adress balancing concerns.
Also tweaked sprite offsets to make it more centered.
2017-08-07 14:52:25 +02:00
reaperrr
09d9cf7da6 Rename tdtruk to truck 2017-08-07 11:00:48 +02:00
reaperrr
63ee481f01 Rename TD TowerMissle to TowerMissile 2017-08-07 11:00:46 +02:00
reaperrr
818fc9d173 Fix RA effect waheads
- take Trees into consideration (they don't have Ground TargetType)
- fixed the delayed effect warheads on Vulcan
2017-08-07 11:00:44 +02:00
Oliver Brakmann
fed3b5f565 Fix harv docking activities getting lost under certain circumstances 2017-08-07 10:45:57 +02:00
AoAGeneral
1d2dc1c232 TD Balance Changes. (20170802)
Engineer movement speed reduced to 48 from 56.

Helicopter crash damage increased to 100 from 40.

Rocket infantry spread damage reduced to 32 from 128.

------

Engineer movement was the same speed as minigunners and at times would enable them to escape the minigunners. This slight speed reduction helps for this.

Helicopter crash damage was lacking and a slight increase in this enables them to do some damage. With the cost of the helicopter it is still not a good idea to sacrifice aircraft just for exta damage.

Rocket infantry spread is reduced because of the damage done to infantry packs. Games turned into tanks mixed with rocket infantry. Reducing this spread enables them to single target units more closely then in larger armies.
2017-08-07 09:38:16 +02:00
Matthias Mailänder
722ea75cab Add weapon rules documentation. 2017-08-05 21:03:52 +02:00
Matthias Mailänder
e81b9e9467 Cache shouldn't be exposed at all so drop it. 2017-08-05 21:03:52 +02:00
Matthias Mailänder
509dc09aa6 Explain the color notation. 2017-08-05 21:03:52 +02:00
Matthias Mailänder
d71c377e93 Give Dictionaries a friendlier notation. 2017-08-05 21:03:52 +02:00
Matthias Mailänder
c6baf16fa7 Move friendly type names into shared helper class. 2017-08-05 21:03:52 +02:00
Lars Beckers
0529a16298 Fix RA Aftermath installer metadata on Linux 2017-08-02 20:11:23 +02:00
FrameLimiter
53adc2bec7 Fix duplicate Targetable value on ^Ammobox 2017-08-02 19:45:41 +02:00
Taryn Hill
e97617d618 Improve the exception message when a Bridge's DemolishWeapon cannot be found 2017-07-29 22:30:47 +02:00
Paul Chote
4d47dd6ad7 Add Demo Truck and MAD Tank to Deploy description. 2017-07-23 20:10:57 +02:00
Paul Chote
7ad95ed0b0 Implement IIssueDeployOrder on MADTank. 2017-07-23 20:10:57 +02:00
GSonderling
1d6732f24f Removed references to make docs 2017-07-23 15:26:45 +02:00
SoScared
85931d5f0b Revert 4 cell adjacency of Kennel/Silo back to 2. 2017-07-22 22:48:51 +01:00
abcdefg30
6f68b4fb3e Disable bots on Poland Raid (again) 2017-07-22 22:34:10 +01:00
Paul Chote
9d84f4a845 Fix the automated installer generation. 2017-07-21 18:49:59 +01:00
reaperrr
5b24fddd5a Fix TD airfield targetable positions 2017-07-21 17:42:18 +01:00
Paul Chote
0f54d6f709 Allow mod to be launched after installing required content. 2017-07-21 00:15:38 +02:00
Paul Chote
d1ed0e09d0 Create user map directory if it doesn't exist. 2017-07-21 00:10:48 +02:00
abcdefg30
d8bc4905cb Add a selection priority of 6 to supply trucks 2017-07-20 15:13:41 +01:00
abcdefg30
4204ba1c1f Fix funpark01 failing at mission start 2017-07-18 22:49:12 +01:00
reaperrr
17f469f1a5 Revert Yak gun strafing 2017-07-18 14:25:00 +02:00
SoScared
0e64ac4709 Reduce vision range of MSILO, IC and Chronoshpere to 6c0 2017-07-18 01:13:15 +02:00
Paul Chote
afd8b9ab86 Rework harvester resource claiming:
* Maintains lists of claims, and only restricts
   reservations for friendly units.
 * Removes OnNotifyResourceClaimLost; it's not
   clear whether that is still useful, and it
   prevents future necessary cleanups.
 * Moves other code without changing behaviour.

This fixed stale claims from dead units and enemy
claims from preventing otherwise valid harvest
activities.
2017-07-18 01:09:19 +02:00
SoScared
9097837e6d Adjust AoE damage vs Wood in relation to HitShapes 2017-07-18 00:59:25 +02:00
Paul Chote
93fcfbb131 Fix ReadWriteZipFile crashing on update. 2017-07-18 00:10:07 +02:00
GSonderling
7a2d2cfd5f Reorganised desert beach templates.
Deleted spurious tabs and spaces

As requested by @reaperrr

Removed more spaces.

One last space deleted.
2017-07-18 00:02:24 +02:00
SoScared
bfca4897ea Visual, Polish/Performance and Balance Tweak 2017-07-17 23:37:04 +02:00
Jean-Rémy Buchs
488440197e Add new trait ReloadArmamentsBar which renders a bar to show the current reload status 2017-07-16 14:58:00 +01:00
Paul Chote
4ffcd9b4a5 Add template type to editor coordinate label. 2017-07-16 13:12:13 +02:00
Paul Chote
72cf5d29e7 Add search bar to editor Template list. 2017-07-16 13:12:13 +02:00
Paul Chote
f1b54ece8a Add search bar to editor Actors list. 2017-07-16 13:12:13 +02:00
andrew
ce671a2737 TD Supply Truck 2017-07-16 11:07:35 +01:00
Jean-Rémy Buchs
224ca78257 Fix crash in DistanceFromEdge if vector is too long 2017-07-15 17:49:29 +02:00
reaperrr
ace353cb84 Upgrade rule for Missile.TerrainHeightAware 2017-07-15 17:36:20 +02:00
reaperrr
7e8f920bc1 Allow disabling terrain height checks in Missile
This saves a good deal of performance for mods with no real height levels, including RA, TD and D2k.
2017-07-15 17:36:20 +02:00
reaperrr
86ab6e7ed3 Fix MoveWithinRange subcell consideration 2017-07-15 17:31:25 +02:00
reaperrr
b859b9ee43 Fix RotationPaletteEffect not working with player palettes 2017-07-15 11:19:09 +01:00
abcdefg30
0b6b997e81 Add a CommandBarBlacklist trait to blacklist Stop and Waypoint Mode 2017-07-14 23:18:28 +01:00
AoAGeneral
f921a45747 TD Airstrike Balance.
This has been a tough decision. I have nerfed the napalm damage from 65 to 35 commited by reaperrr since at 65 they were still one shotting weapon factories and airstrips. The problem however was that it still did way to much damage. Bringing the Vulcan down from 25 to 15 wood damage helps to keep it alive a majority of the time. (Still brings it to red at times.) Problem now is the airstrike is now a unit killing role rather then killing power plants and various other structures. (Doesn't exactly kill barracks/helipads everytime anymore.)
2017-07-15 00:16:19 +02:00
Paul Chote
3bea08f020 Fix Windows desktop icons being installed for all users. 2017-07-15 00:12:45 +02:00
RoosterDragon
9413d9595c Providing streaming AudFormat data.
AudFormat.GetPCMInputStream now returns data that is streamed, rather than a MemoryStream.
2017-07-14 23:02:49 +01:00
RoosterDragon
85c948fd8d Add a streaming audio playback interface.
This allows audio to be streamed, rather than needed to be fully loaded into memory.
2017-07-14 23:02:49 +01:00
reaperrr
45606c9528 Editor actor categories style fixes 2017-07-14 10:28:29 +02:00
reaperrr
1b0ae1e512 Mention hard-coded 'Air' TargetType in CEWH.AirThreshod desc 2017-07-13 20:58:47 +02:00
reaperrr
70b43222fe Adapt D2k AA missiles to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
bc54789641 Adapt TD anti-air weapons to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
65920a883f Upgrade rule for CreateEffectWarhead ImpactTypes -> Targets 2017-07-13 20:58:47 +02:00
reaperrr
5cd8acada4 Adapt TS effect warheads to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
ce8f3ed168 RA mission weapon warhead fixes 2017-07-13 20:58:47 +02:00
reaperrr
a7334d5583 Adapt RA missiles to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
db16165261 Adapt RA explosions, supers and other weapons to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
34dc52451a Adapt RA smallarms to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
346b6af30d Adapt RA ballistic weapons to CEWH refactor 2017-07-13 20:58:47 +02:00
reaperrr
13983765d6 Tweak RA naval vessel target types
The extremely coarse, shared with terrain Ground and Water types make it hard to distinguish between different actor categories, so we add Ship to all non-submerged vessels.
Additionally, we add 'Water' to submerged subs to prevent players from finding them by moving the cursor of a ship with DepthCharge over the suspected sub position.
The latter also allows force-firing DepthCharge at empty water cells.
2017-07-13 20:58:47 +02:00
reaperrr
cf5abc68ad Refactor CreateEffectWarhead ImpactTypes
Use target validity to simplify ImpactTypes.
2017-07-13 20:58:47 +02:00
reaperrr
efd8a9c1cb Rebalanced Yak
- increased ammo per gun from 9 to 10, for two full double-5-burst salvoes, adjusted ReloadDelay to keep total reload time about the same
- increased Spread by 33% to make up for lower effective pin-point accuracy
- increased damage vs. infantry by 25%, vs. light armor by 16.67%, vs. heavy armor by ~10%
2017-07-13 19:12:16 +02:00
reaperrr
fa02c97111 RA Parabombs balance fix
They're too over-powered on bleed due to the hitshap changes.
2017-07-13 19:12:16 +02:00
reaperrr
4afe9dd248 Enable RA ParaBomb shadow 2017-07-13 19:12:16 +02:00
reaperrr
abb8e27747 TD airstrike balance tweak
The increased building hitshape sizes allowed TD airstrikes to kill even Cyards and temples on bleed, which is overpowered compared to before the hitshapes were merged.
Cutting bomb damage vs. Wood to 65% lets Cyards, temples and adv. comm. centres survive airstrikes with yellow health.
2017-07-13 19:12:16 +02:00
reaperrr
afa9b9760e Unhardcode AttackBomber bomb and gun logic 2017-07-13 19:12:16 +02:00
reaperrr
a1cb0cf002 AttackBomber style fixes 2017-07-13 19:12:16 +02:00
reaperrr
07edf2f7c6 Reset burst counter if ReloadDelay has passed since last shot
This fixes the following issues:
- units like mammoth tanks sometimes at first only fired 1 shot on new encounter because they only depleted 1 burst before previous target was killed
- weapons that use strafing logic would not reset the offset multiplier after passing the target once, leading to wrong offsets on following attacks
2017-07-13 19:12:16 +02:00
reaperrr
6212b82f6d Use strafing for RA Yak
This is done by modifying the target offset by a value matching the Yak's
speed * BurstDelay, to sync the offsets with the actor speed.
2017-07-13 19:12:16 +02:00
reaperrr
afa8d3522c Add strafing support to weapons 2017-07-13 19:12:16 +02:00
reaperrr
92c9988eea Fix D2k Palace footprint 2017-07-13 17:43:41 +02:00
reaperrr
d95d7e0b0f Rename UseOccupiedCellsOffsets to UseTargetableCellsOffsets
With the introduction of the new 'u' BlockingUntargetable cell type, the old property name became inaccurate.
2017-07-13 17:43:41 +02:00
reaperrr
77ef3a0ed2 Simplify RA base building hitshape rules 2017-07-13 17:43:41 +02:00
reaperrr
70c251d5d5 Simplify TD base building hitshape rules 2017-07-13 17:43:41 +02:00
reaperrr
03c7c8f79c Simplify D2k TargetableOffsets rules
By using the new 'u' Footprint letter.
2017-07-13 17:43:41 +02:00
reaperrr
5bdb7bd689 Add OccupiedUntargetable FootprintCellType
For cells that are occupied & unpassable, but should be ignored by HitShape.UseOccupiedCellsOffsets.
2017-07-13 17:43:41 +02:00
reaperrr
fdb3866238 Remove FootprintUtils 2017-07-13 17:43:41 +02:00
reaperrr
46dc827d46 Refactor footprint cell lookups and move them to Building
Removing FootprintUtils happens in the next commit for better
reviewability.
2017-07-13 17:43:41 +02:00
Forcecore
801796b184 FIX game hanging when units with 0 min-range attack units at 0 range.
Fixes #13307
2017-07-12 20:51:35 +02:00
Paul Chote
59dae0ebf6 Split install-core into finer grained targets for the mod template. 2017-07-12 16:22:36 +02:00
Paul Chote
1c2db8806b Update to latest osx launcher tag. 2017-07-12 16:22:36 +02:00
reaperrr
9a7778e55d Fix black tile on template 438 of RA desert tileset 2017-07-12 15:57:19 +02:00
Jean-Rémy Buchs
6749060e57 Add RangeCircleMode to trait RenderRangeCircle 2017-07-12 00:10:52 +02:00
AoAGeneral
4a39bc8286 TD Balance Changes. 20172606
The list of changes do not affect the new hitboxes of the structures.

+ Orca damage increased from 25 to 28.
Damage is increased because of their lack of damage vs armored units and structures.

+ Apache ammo reload reduced from 200 to 40.
Apaches gaining a full clip of ammo is a bit to strong. Firing the first shot starts the timer tick and will reload even if the clip is not fully reloaded. This also fixes so they don't sit on top of infantry and blow them all away to quickly.

+ Apache ammo reload amount reduced from 10 to 1.
Fixed in unison with ammo reload timer.

+ Sam now fires two missiles. (CNC95)
Does extra damage.

+ Sam range increase from 8c0 to 10c0.
Compensate for the aircraft changes. Also had a problem of MSAMs were always the better choice rather then the structure SAMs itself. This change will make them more viable.

+ Sam range limit from 9c614 to 12c0.
Makes it so aircraft can still escape while the missile won't detonate at the edge of the circle range.

+ Humvee damag vs light increased from 50 to 55.
Compensates for the price of the hummer. Having just the HP wasn't enough to counter certian builds of Nod. Enabling them a slightly higher damage allows them to kill buggies and bikes a bit more effectively. Makes them also decent arty and MRLS killers.

+ Crates got some love.

+ Viceroids now spawn.

+ An atomic bomb can now detonate. (CNC95)

+ Veterancy level is now to rank 4.
This makes grabbing crates all the more rewarding and riskier. Such as willing to bring a mammoth tank or commando to the crate rather then a minigunner.
2017-07-11 16:25:49 +02:00
Paul Chote
e38db04ab7 Move Stylecop checks to their own helper executable. 2017-07-09 21:58:21 +02:00
Paul Chote
1fa1677204 Register default mods during installation on Windows. 2017-07-09 20:54:02 +02:00
Paul Chote
2685dbea3b Register default mods during installation on Debian/Ubuntu. 2017-07-09 20:54:02 +02:00
Paul Chote
2c522e0371 Add mod registration utility commands. 2017-07-09 20:54:02 +02:00
Paul Chote
bc4a5193e9 Add ExternalMods.Unregister method. 2017-07-09 20:54:02 +02:00
Paul Chote
739f357090 Read mod registrations from system support dir. 2017-07-09 20:54:02 +02:00
Paul Chote
e69f129fed Add Platform.SystemSupportDir for shared user data. 2017-07-09 20:54:02 +02:00
Paul Chote
372d940936 Rework stale ExternalMod metadata clearing. 2017-07-09 20:54:02 +02:00
Paul Chote
b30cfe4ada Move launchPath argument from ExternalMods ctor to .Register. 2017-07-09 20:54:02 +02:00
Paul Chote
daf8f8d956 Throw a FileNotFoundException if source zip file isn't found. 2017-07-08 23:22:44 +02:00
Paul Chote
6e145f902b Fix empty lobby faction tooltips. 2017-07-08 22:45:51 +02:00
Paul Chote
cd9ef47f94 Suppress unrelated mouse events while scrolling. 2017-07-08 22:21:04 +02:00
rob-v
f341330d5e Fix Joystick scrolling stuck 2017-07-08 22:21:04 +02:00
Paul Chote
4f16b0d464 Revert "Replace legacy Evaluator with IntegerExpressions."
This reverts commit cd0898236d.
2017-07-08 22:11:36 +02:00
Paul Chote
f7c57cfc6f Fix crash when loading read-only ReadWriteZipFiles. 2017-07-08 16:45:44 +01:00
Paul Chote
ab1a798d04 Add GrantConditionOnBotOwner trait. 2017-07-07 21:31:45 +01:00
Paul Chote
96a1c8d54b Update internal ra/cnc/d2k/ts bot types. 2017-07-07 21:31:45 +01:00
Paul Chote
b0906e1836 Add a bot type identifier. 2017-07-07 21:31:45 +01:00
Paul Chote
e88754cd4a Expose Player.BotType and make fields readonly. 2017-07-07 21:31:45 +01:00
Markus Hartung
3a6796ac9d Fix for some AppDomains that doesn't add trailing DirectorySeparatorChar. 2017-07-06 18:29:24 +01:00
Markus Hartung
c2e36b8eeb Ignore Visual Studio 2017 generated files 2017-07-06 18:29:24 +01:00
rob-v
1a546d9baf Polish Actor Categories 2017-07-06 01:50:43 +02:00
rob-v
aab9dfcaa0 Add TS Actor Categories 2017-07-06 01:50:43 +02:00
rob-v
8da112dc92 Add D2K Actor Categories 2017-07-06 01:50:43 +02:00
rob-v
6c962b6675 Add TD Actor Categories 2017-07-06 01:50:43 +02:00
rob-v
6005b59064 Add RA Actor Categories 2017-07-06 01:50:43 +02:00
rob-v
686686417f Add Actor Categories and Category dropdown filter in Map editor 2017-07-06 01:50:43 +02:00
reaperrr
8f4a92af99 Upgrade rules and yaml updates for Bib refactor 2017-07-06 01:42:55 +02:00
reaperrr
3200f4fb0f Remove bib-related hacks from Building and FootprintUtils 2017-07-06 01:42:55 +02:00
reaperrr
9b137afa6d Add ITargetableCells interface 2017-07-06 01:42:55 +02:00
reaperrr
69aa4f5962 Building style fixes for better readability 2017-07-06 01:42:55 +02:00
RoosterDragon
297f4ad9ed Ensure we set ZipConstants.DefaultCodePage by using a helper method.
We were currently dealing with this terrible global variable in FileSystem/ZipFile.cs previously, but other parts of the code such as DownloadPackageLogic were creating these files too, and may not have executed the static ctors that fixed the encoding yet.
2017-07-05 22:45:15 +01:00
rob-v
1f436ad0cb TS - Rename Template.Category to Template.Categories 2017-07-05 22:46:59 +02:00
rob-v
c3ccd1906d D2K - Rename Template.Category to Template.Categories 2017-07-05 22:46:59 +02:00
rob-v
5cee040fc0 TD - Rename Template.Category to Template.Categories 2017-07-05 22:46:59 +02:00
rob-v
03cfd5b880 RA - Rename Template.Category to Template.Categories 2017-07-05 22:46:59 +02:00
rob-v
4b9c6c4746 Allow multiple terrain (tile) categories 2017-07-05 22:46:59 +02:00
reaperrr
3abd65052c Fix TS Titan barrel, armament offsets and disable projectile image 2017-07-03 18:52:54 +02:00
reaperrr
b491ec871c Tweak TS sprite walker animations
- replace WithInfantryBody with WithFacingSpriteBody + WithMoveAnimation on Titan
- rename all mech 'run' anims to 'walk'
- tweak walk anim rates to better match movement speed/original
- tweak Wolverine attack anim to play a little faster
2017-07-03 18:52:54 +02:00
reaperrr
9a25dd6a60 Add elite explosion to TS Sonic & Stealth Tanks
Matching original TS.
2017-07-02 16:03:40 -05:00
reaperrr
faf9f7cede Change Explodes.Weapon default to null
FieldLoader.Require makes the default pointless, so it makes more sense to change it to null.
2017-07-02 16:03:40 -05:00
reaperrr
a6b9bab033 Make Explodes conditional 2017-07-02 16:03:40 -05:00
Mustafa Alperen Seki
6dca6b3740 Reimport 8PLAY3 and 5 2017-07-02 21:04:16 +02:00
Jean-Rémy Buchs
2e4cd8d820 Make SpawnActorOnDeath conditional 2017-07-02 10:00:08 -05:00
reaperrr
9e138178ad WithAttackAnimation style fix
Looks better this way.
2017-07-01 12:33:51 +01:00
reaperrr
9c2e3aaa05 Make WithMoveAnimation conditional and modify only a single assigned sprite body
The latter to match what we do on WithAttackAnimation already.
2017-07-01 12:33:51 +01:00
reaperrr
8a5a8a1646 RA yaml style fix 2017-07-01 11:11:51 +01:00
reaperrr
ff268eee44 Remove comments on explosion sequences in TD
We don't ship comments for explosions in the other mods, and every modder will either already know or can look them up in the asset browser.
2017-07-01 11:11:51 +01:00
reaperrr
ec5c218ac4 TD yaml style fixes 2017-07-01 11:11:51 +01:00
Paul Chote
fdafbd9f15 Remove hardcoded references to FacingInit and TurretFacingInit. 2017-07-01 10:35:22 +01:00
Paul Chote
2a2bd676a3 Remove hardcoded references to HideBibPreviewInit. 2017-07-01 10:35:22 +01:00
Paul Chote
b2c3a55c12 Add IActorPreviewInitInfo interface. 2017-07-01 10:35:22 +01:00
Paul Chote
e10b64d62c Add command bar to D2K. 2017-07-01 00:35:47 +02:00
Paul Chote
f801fc502f Adjust UI spritesheet to make more usable space. 2017-07-01 00:35:47 +02:00
reaperrr
3f8efb1163 Remove ApplyToAllTargetablePositions hack from RectangleShape
In its current form it is bad for performance due to the ITargetablePositions look-up, and fixing that only to remove the hack entirely a few weeks later would be kind of pointless, so let's get this over with.
2017-06-29 22:01:19 +02:00
rob-v
f75115a645 Remove unnecessary loading mod exceptions, log missing icon.png 2017-06-29 19:43:44 +02:00
abcdefg30
04033e5c79 Don't iterate over an array with only one element 2017-06-29 16:56:21 +02:00
abcdefg30
841798a0a8 Don't use a broken version string when git is not found 2017-06-29 16:56:21 +02:00
abcdefg30
057c201e85 Don't echo "Invalid command" when using the version command with a parameter 2017-06-29 16:56:21 +02:00
abcdefg30
83be37acaf Try to bypass the security warning 2017-06-29 16:56:21 +02:00
abcdefg30
57af145c12 Don't let the launcher scripts close the console window 2017-06-29 16:56:21 +02:00
Markus Hartung
27ce2fcda9 Add some resharper rules 2017-06-27 22:47:50 +01:00
rob-v
78bedb0513 Fix IsSinglePlayer 2017-06-27 22:43:15 +01:00
C. Helmig
8a508ecafa Change concrete radar color to match rock.
This is/was problematic, because right now players can spot expansions through the fog-of-war instantly.
This replicates original game behavior, too. Concrete in original dune2k doesn't show up on the radar.
2017-06-27 23:31:09 +02:00
Paul Chote
dbe16bfdb5 Add faction tooltips to TS. 2017-06-27 23:27:53 +02:00
Paul Chote
88ab77ce0f Polish Random faction tooltips. 2017-06-27 23:27:53 +02:00
Paul Chote
714b24329c Use standard button tooltip for faction descriptions. 2017-06-27 23:27:53 +02:00
Paul Chote
3996aadcb6 Add description yaml to D2K button tooltip. 2017-06-27 23:27:53 +02:00
reaperrr
2650973d51 Add ForceDisplayAtGroundLevel to CreateEffectWarhead
Allows to force the effect to always play at ground level, regardless of explosion altitude.
2017-06-27 23:19:32 +02:00
reaperrr
d283231d94 Fix TS Cyborg explosion and Tiberium explosion palette
Otherwise these would appear darker than the other explosions on maps with darker ambient color and have now translucency.
2017-06-27 23:19:32 +02:00
reaperrr
f7aac24c43 Fix TS Grenade explosion size
Now matches original.
2017-06-27 23:19:32 +02:00
rob-v
3e7bf1880f Fix Map editor total ore money 2017-06-27 22:05:40 +01:00
reaperrr
266b5d194f Fix TS visceroid and tib floater weapons
They'll need to target closest targetable position to be able to attack larger buildings, which conflicts with the TargetDamage warhead.
2017-06-27 21:07:39 +01:00
ltem
115c72aa4b Fixed the positioning of the performance graph. 2017-06-26 23:11:32 +01:00
Paul Chote
d81a07931f Fix D2K units not auto-targeting defenses in Defend stance. 2017-06-25 22:49:37 +02:00
reaperrr
ba1279aa93 Disable some effect warhead victim scans in TS 2017-06-25 22:40:12 +02:00
reaperrr
32e7ab7a30 Disable effect warhead victim scans in TD
They are meant to play regardless of whether an actor was hit anyway.
2017-06-25 22:40:12 +02:00
reaperrr
4823d5454d Disable effect warhead victim scans in D2k
They are always displayed unconditionally anyway.
2017-06-25 22:40:12 +02:00
reaperrr
e0abf8ed27 Disable effect WH victim scans in RA where sensible
AA missiles, flame weapons and nukes, pretty much, because they always
display the effect regardless of what they hit.
2017-06-25 22:40:12 +02:00
reaperrr
1d2361cdd3 Change default and auto-calc of victim scans to -1
For all projectiles and warheads.

Not really a must for everything else, but for CreateEffectWarhead, the
ImpactTypes refactor (separate PR) makes it a bit harder to make the
warhead valid in every situation, so setting the victim scan to zero is the easiest way to disable scanning for actors completely.
2017-06-25 22:40:12 +02:00
reaperrr
ca475fe133 Projectile style fixes 2017-06-25 22:40:12 +02:00
reaperrr
dc5818d035 Warhead style fixes
Implement interfaces explicitly
2017-06-25 22:40:12 +02:00
Paul Chote
a755070d76 Fix VisualHeight of RA commandbar buttons. 2017-06-25 22:37:36 +02:00
rob-v
f29d2028fe Fix missing-failing logging of Ruleset (Yaml)Exceptions 2017-06-25 18:45:12 +02:00
rob-v
6e1b2333f3 Fix ClientTooltip disables tooltip delay 2017-06-24 11:52:27 +01:00
rob-v
1b3422db2d Fix flickering tooltip 2017-06-24 11:52:27 +01:00
rob-v
7772ebedf4 Check for Carryall, RevealOnFire FrozenActor.Actor is null 2017-06-24 11:42:50 +01:00
rob-v
78bf530a4e Check for EnterTunnel FrozenActor.Actor is null 2017-06-24 11:42:50 +01:00
rob-v
6df7f18a3b Fix Initialize sounds (dispose of null SoundSource) 2017-06-24 11:29:55 +01:00
reaperrr
0a1083e554 Merge the Valid(...)Weapons methods 2017-06-24 11:24:17 +01:00
reaperrr
33e8bf9928 Adapt Attack logic to Weapon.TargetActorCenter 2017-06-24 11:24:17 +01:00
reaperrr
edffaa4987 Introduce Weapon.TargetActorCenter and adapt projectiles
This also fixes issues with attackers that don't have their own Attack
trait.
2017-06-24 11:24:17 +01:00
reaperrr
6b3c04a584 Fix old shape scaling 2017-06-24 11:15:12 +01:00
reaperrr
7d3cf7894b Fix upgrade rule dates
These were merged into bleed after prep was branched off, so they need a date newer than last release.
2017-06-24 11:15:12 +01:00
reaperrr
522a29f1e4 Reduce Ornithopter damage vs buildings
Especially larger ones.
2017-06-24 11:11:56 +01:00
abcdefg30
c58db84d35 Fix the harvesting sequence being invisible in TS 2017-06-23 12:45:16 +02:00
abcdefg30
1760a12428 Replace the wrong CURRENTENGINE description by OLDENGINE 2017-06-23 11:42:44 +02:00
abcdefg30
118039ded3 Add a missing i 2017-06-22 14:35:26 +02:00
abcdefg30
839945cf57 Fix a crash in CheckSequences when the sprite image is null 2017-06-22 14:35:26 +02:00
rob-v
da5c70184e Refactor RefreshServerListInner's games+lanGames argument 2017-06-22 11:59:04 +02:00
rob-v
3c323a8672 Extract loading of game rows into LoadGameRows method. 2017-06-22 11:59:04 +02:00
rob-v
53c7954f84 MP Browser - display current mod+version first 2017-06-22 11:59:04 +02:00
rob-v
7237fd83c6 Fix error handling of failed MP server refresh 2017-06-22 11:59:04 +02:00
reaperrr
8e9f20cf4b Cache traits implementing INotifyAttack 2017-06-22 04:13:47 -05:00
reaperrr
779218f381 Cache traits implementing modifiers 2017-06-22 04:13:47 -05:00
reaperrr
243ed3d76a Cache traits implementing INotifyBurstComplete 2017-06-22 04:13:47 -05:00
Forcecore
100abe3246 Requested changes applied
* private this.info --> public Info for GCOnDeploy
* Parameter change for (un)deploy activities
2017-06-20 23:42:14 -05:00
Forcecore
a7cedc54ff Deploy activities for mods and future AI scripting 2017-06-20 23:42:14 -05:00
Paul Chote
300a7222f3 Don't autotarget structures in Defend stance. 2017-06-18 21:07:21 +02:00
Paul Chote
2e2e1cae7f Fix MSAM/MLRS autotargeting. 2017-06-18 21:07:21 +02:00
Paul Chote
57df34dcbf Fix auto-targeting vs TD/TS/D2K creeps. 2017-06-18 21:07:21 +02:00
Paul Chote
0a1f2b7275 Fix auto-targeting vs submerged but detected RA submarines. 2017-06-18 21:07:21 +02:00
Paul Chote
0aa84aa5ed Fix auto-targeting vs RA tanks. 2017-06-18 21:07:21 +02:00
Paul Chote
4040863707 Fix queued move activities. 2017-06-18 20:55:50 +02:00
Oliver Brakmann
f6e87f63e7 Fix GetSupportDir not returning an absolute path 2017-06-18 20:46:22 +02:00
Mustafa Alperen Seki
c4e8af08ec Implement EliteAbility=VEIN_PROOF and SENSORS on units that need 2017-06-18 16:23:34 +02:00
Forcecore
a3c9d72cfd Unbreak queued order 2017-06-18 12:03:29 +01:00
Forcecore
07a2ee5eab Engineer repair activity can be queued 2017-06-18 12:03:29 +01:00
Forcecore
568d7efdb1 ExternalCaptures Type filter fix up 2017-06-18 12:37:59 +02:00
Paul Chote
4b4172f757 Make the Enter activity use the closest target position. 2017-06-17 21:18:28 +02:00
Paul Chote
995a3da43a Rename Enter.targetCenter to repathWhileMoving. 2017-06-17 21:18:28 +02:00
rob-v
b0f1059df2 Remove unnecessary PostBuildEvent from D2k project 2017-06-17 20:17:31 +02:00
Paul Chote
f0ffb4e8d9 Remove leftover target references.
Fixes a warning generated by `xbuild`.
2017-06-17 20:17:31 +02:00
Paul Chote
3db15beeb9 Fix compatibility with msbuild/csc on non-windows. 2017-06-17 20:17:31 +02:00
Forcecore
728162e688 GCOnDeploy's ValidTerrain() takes location parameter
Fixes ##13394.

Possible use: AI's future deploy planning when the actor isn't actually
there yet. Also used in my mod for Slave Miner's deploy planning
2017-06-17 19:00:07 +02:00
reaperrr
f98e7656da Make TS GDI Juggernaut attack the target center
Instead of closest targetable position/offset.
2017-06-15 01:32:37 +02:00
reaperrr
c20d02fd2e Make TD artillery actors attack the target center
Instead of closest targetable position/offset.
Applies to:
-Artillery
-Rocket Launcher (MLRS)
2017-06-15 01:32:37 +02:00
reaperrr
26e6d86821 Make RA artillery actors attack the target center
Instead of closest targetable position/offset.
Applies to:
-Artillery
-Cruiser
-Missile Sub
2017-06-15 01:32:37 +02:00
reaperrr
7eab278711 Adapt tracking projectiles to support targeting CenterPosition
Instead of closest targetable position.
2017-06-15 01:32:37 +02:00
reaperrr
da7433a95f Add plumbing for targeting of target center instead of closest targetable position
Note: Projectiles that can track their target need minor additional changes, but for InstantHit (which already implemented support for this) and unguided projectiles (Bullet, GravityBomb) this commit is already sufficient.
2017-06-15 01:32:37 +02:00
Paul Chote
9c9a23be86 Make Frames and Limbs private. 2017-06-14 18:56:06 +02:00
Paul Chote
2683b2507e Fix remaining voxel references in Game. 2017-06-14 18:56:06 +02:00
Paul Chote
6ca0208694 Rename VoxelPreview to ModelPreview. 2017-06-14 18:56:06 +02:00
Paul Chote
736e70df78 Rename VoxelRenderable to ModelRenderable. 2017-06-14 18:56:06 +02:00
Paul Chote
17089f2aee Rename VoxelSequences to ModelSequences. 2017-06-14 18:56:06 +02:00
Paul Chote
34810756c2 Move Voxel code to Mods.Cnc. 2017-06-14 18:56:06 +02:00
Paul Chote
dc4c3fd546 Rename VoxelRenderer to ModelRenderer. 2017-06-14 18:56:06 +02:00
Paul Chote
4f42778d26 Rename VoxelAnimation to ModelAnimation. 2017-06-14 18:56:06 +02:00
Paul Chote
e1cd00c1dd Add backend plumbing for model loaders. 2017-06-14 18:56:06 +02:00
reaperrr
086fc88e3e Increased ZOffset of TD explosions
To make sure they always play on top of actors.
2017-06-14 18:28:20 +02:00
reaperrr
35e131bac7 Give TD base buildings custom hit shapes 2017-06-14 18:28:20 +02:00
reaperrr
b219214426 Give TD civilian and tech buildings custom shapes 2017-06-14 18:28:20 +02:00
reaperrr
d1790229a9 Add hit-shape defaults to TD
Plus some resulting cleanup of defaults.yaml.
2017-06-14 18:28:20 +02:00
reaperrr
600478603c Fix TD civ field husk footprint
Players should not be able to build on it.
2017-06-14 18:28:20 +02:00
Mustafa Alperen Seki
4187a69904 Remove afld and hpad from Rush AI's Production: list 2017-06-14 18:26:18 +02:00
Paul Chote
90778bc8a8 Fix queued move orders on Chrono Tank. 2017-06-12 19:38:18 -05:00
Paul Chote
242f33c2ba Implement RA command bar. 2017-06-12 19:38:18 -05:00
Paul Chote
2923c9907f Fix minor issues with TD command bar. 2017-06-12 19:38:18 -05:00
reaperrr
d52313ab18 Rename WithAttackAnimation.BodyName to just .Body
Shorter and more consistent with Armament.Turret, WithTurretedAttackAnimation.Turret, WithSpriteBarrel.Armament etc.
2017-06-12 19:01:10 -05:00
reaperrr
fef388834e Throw yaml exception if WithAttackAnimation has no assigned sprite body
...or too many assigned bodies.

Also, further simplify WithAttackAnimation code.
2017-06-12 19:01:10 -05:00
reaperrr
5fb468922e Make WithAttackAnimation conditional 2017-06-12 19:01:10 -05:00
reaperrr
2e70b6931b Refactor WithAttackAnimation
- made trait compatible with actors that have more than one sprite body or enable/disable sprite bodies via conditions
- added check for running attack anim and prevent aim/reload sequences from overriding it
- added caching of whether trait has either aim or reload sequence, to avoid some string.IsNullOrEmpty look-ups every tick
2017-06-12 19:01:10 -05:00
rob-v
8276b17570 Fix Sound memory leak (OutOfMemoryException), remove Music caching to free memory 2017-06-12 18:33:53 -05:00
RoosterDragon
2def72a078 Clear previous effects data when generating a new sync report. 2017-06-12 18:25:35 -05:00
Paul Chote
2e801a55ce Update ts AutoTarget definitions. 2017-06-11 17:14:21 -05:00
Paul Chote
52b08a769d Update d2k AutoTarget definitions. 2017-06-11 17:14:21 -05:00
Paul Chote
d7f9c2f852 Update cnc AutoTarget definitions. 2017-06-11 17:14:21 -05:00
Paul Chote
b613b1b2e0 Update RA AutoTarget definitions. 2017-06-11 17:14:21 -05:00
Paul Chote
716343732f Add AutoTargetPriority trait for smarter AutoTarget logic. 2017-06-11 17:14:21 -05:00
reaperrr
ab8bc53ed8 Replace doneDamage bool in TeslaZap with DamageDuration
Allows it to deal continous damage via a single projectile.
2017-06-11 23:28:17 +02:00
reaperrr
6ff31786cb Refactor TeslaZap targeting
- made it target closest targetable position, instead of CenterPosition
- made target tracking optional (enabled by default)
- made tracking independent from whether damage has already been dealt
- cache target position and update it in Tick only if tracking
2017-06-11 23:28:17 +02:00
reaperrr
c474b77d79 Remove unused 'initialized' bool from TeslaZap
It was never set to 'true', and doing so would break Duration > 1, so it's better to just remove it.
2017-06-11 23:28:17 +02:00
reaperrr
2704f3bcd5 Minor TeslaZap cleanup
Renaming timeUntilRemove to ticksUntilRemove makes it more clear and allows to drop the comment.
2017-06-11 23:28:17 +02:00
reaperrr
16e260e69f Increase ZOffset of RA explosions
To make sure they play on top of actors.
2017-06-10 11:38:04 +01:00
reaperrr
7cadbcb8f6 Set custom hit shapes for civilian buildings 2017-06-10 11:38:04 +01:00
reaperrr
07e6708b88 Align RA base building hitshapes with their sprites 2017-06-10 11:38:04 +01:00
reaperrr
7ba276c0c1 Add building hitshape defaults to RA
And do some cleanup.
Intentionally omitted uncommon shapes that only appear once or twice.
2017-06-10 11:38:04 +01:00
C. Helmig
3b626e5ff7 Fixes tile error in #13047. See comment Item in #12868. 2017-06-07 18:54:39 +02:00
C. Helmig
452aed0a97 Multiple passability changes to replicate original game behavior. (= Items comments on #12868 )
Fix the passability of some bridge tiles
2017-06-07 18:54:39 +02:00
abcdefg30
5d40ed3e32 Move tiles into correct category. 2017-06-07 18:54:39 +02:00
abcdefg30
8494200321 Renamed and reordered Categories - uniform naming, similar categories adjacent to one another, most used to top. 2017-06-07 18:54:39 +02:00
Paul Chote
83c4c842ee Update to latest osx launcher package. 2017-06-06 22:08:08 +02:00
reaperrr
423ea555b3 Fix RA bridge crash 2017-06-06 22:04:00 +02:00
reaperrr
4af31be6bd Fix TD bridge crash 2017-06-06 22:04:00 +02:00
Paul Chote
ff9bddbf21 Add unit command bar to TD. 2017-06-06 08:53:54 -06:00
Paul Chote
52f1ab0969 Add backend code for unit command bar. 2017-06-06 08:53:54 -06:00
Paul Chote
f1eb96b273 Add DisableKeyRepeat flag to ButtonWidget. 2017-06-06 08:53:54 -06:00
Paul Chote
854dd75282 Add ButtonTooltipWithDescHighlightLogic.
Highlights TooltipDesc characters inside {}.
2017-06-06 08:53:54 -06:00
Paul Chote
8f2a933ba8 Add support for button tooltip descriptions. 2017-06-06 08:53:54 -06:00
Paul Chote
ce233a6cca Reduce edge scrolling threshold and polish cursor hotspots. 2017-06-06 08:53:54 -06:00
Paul Chote
94fba3521a Add ForceModifiersOrderGenerator for force move/attack and queueing. 2017-06-06 08:53:54 -06:00
Paul Chote
8dfb7d8bbc Add Selection.Hash for tracking selection changes. 2017-06-06 08:53:54 -06:00
Paul Chote
e8d6d63707 Add IIssueDeployOrder. 2017-06-06 08:53:54 -06:00
Paul Chote
533b2f9ad7 Flip tooltips above the cursor at the bottom of the screen. 2017-06-06 08:53:54 -06:00
Mustafa Alperen Seki
46d0157c2e Add Harkonnen 4 2017-06-05 22:32:49 +02:00
reaperrr
3507ad2f87 Give D2k structures footprint hit-shapes 2017-06-05 14:22:47 +02:00
reaperrr
e2647e8a60 Move down D2k High-tech factory sprite
This better aligns its visuals with the footprint, hit-shape and targetable positions.
2017-06-05 14:22:47 +02:00
reaperrr
6a212eea53 Make attacking actors/turrets face the targeted position 2017-06-05 14:22:47 +02:00
reaperrr
7acc6dacbc Fix armaments/projectiles to aim at closest Target.Positions
Instead of CenterPosition.
TargetablePositions were already used for targeting/attack decisions, but not armaments/projectiles.
2017-06-05 14:22:47 +02:00
Markus Hartung
73577e3a7e Add myself to authors 2017-06-04 17:11:44 +02:00
Markus Hartung
2a0b3b39ea INotifyCreated.Created now calls base properly 2017-06-04 17:11:44 +02:00
Markus Hartung
f7ddb969c6 Change so Attack* calls Created on base class 2017-06-04 17:11:44 +02:00
abcdefg30
40e8c5136d Fix the close enough check in Repair.cs 2017-06-04 15:35:40 +02:00
Paul Chote
abdcf90c30 Ship VERSION with binary releases. 2017-06-04 13:21:27 +02:00
Paul Chote
36d7b5131e Use ContentInstallerMod in MainMenuLogic. 2017-06-04 13:21:27 +02:00
Paul Chote
f79a3a8d03 Use engine version in crash logs. 2017-06-04 13:21:27 +02:00
Paul Chote
f7db7e3308 Use engine version for master server queries. 2017-06-04 13:21:27 +02:00
Paul Chote
49f0e35bd7 Add engine VERSION file. 2017-06-04 13:21:27 +02:00
reaperrr
82758a8bef Add TargetableOffsets to HitShape
And remove ITargetablePositions from Building.
Also, added UseFootprintOffsets to replicate the old Building behavior for easier setup of TargetablePositions for buildings.
2017-06-04 00:07:08 +02:00
reaperrr
7fd0a3aa58 Lint check and yaml enforcement for HitShape
Now that Health no longer provides a HitShape, actors with Health need at
least one HitShape trait.
2017-06-04 00:07:08 +02:00
reaperrr
7f81de2f8a Upgrade rule for Health.Shape to HitShape.Type 2017-06-04 00:07:08 +02:00
reaperrr
43b55ae333 Move Shape from Health to new HitShape trait
Renamed Shape to Type
2017-06-04 00:07:08 +02:00
reaperrr
c7c6cf864c Fix inconsistent rules in preparation of HitShape refactor
- TD C17 and A10 are not targetable and therefore technically invulnerable, so we should remove Health and Armor
- D2k ^carryall.colorpicker and TS ^mmch.colorpicker shouldn't have Health
- TS crash sites are supposed to be indestructible map deco as per original (they had "Immune=yes")
2017-06-04 00:07:08 +02:00
Mustafa Alperen Seki
61afa096e3 Add 8PLAY6 2017-06-03 16:17:34 +02:00
Mustafa Alperen Seki
aa9c00367b Add 8PLAY2 2017-06-03 16:14:52 +02:00
Oliver Brakmann
677904c682 Hide tooltips for unoccupied spawnpoints in the replay browser 2017-06-03 15:56:27 +02:00
rob-v
fc0495ac27 Fix keys scrolling stuck (+ some function double calls) 2017-06-01 23:07:25 +02:00
Mustafa Alperen Seki
f4988356a0 Add 8PLAY4 2017-06-01 20:28:48 +02:00
Mustafa Alperen Seki
8bcc2b30d9 Add 8PLAY1 2017-06-01 20:14:59 +02:00
Andre Mohren
96ca3baff8 Fixed PNGLoader crash with palette containing less than 256 colors. 2017-05-31 20:34:09 +02:00
Oliver Brakmann
a869dacdc4 Remove tooltips from map preview in MP server browser 2017-05-30 22:30:31 +01:00
rob-v
ada5b6d0e5 Add Unit stance hotkeys, remove Cycle Stance hotkey 2017-05-30 21:16:31 +02:00
Andre Mohren
d080a47cbf Allow load screens to override StartGame. 2017-05-30 18:15:28 +02:00
atlimit8
afa5a7772d Split ConditionByStance in AutoTarget 2017-05-29 20:41:10 +01:00
atlimit8
cadfbe8a29 Grant condition by unit stance 2017-05-29 20:41:10 +01:00
reaperrr
5834d7615b Fix Rectangle OuterRadius
Rectangle shapes always assumed that either top-left or bottom-right would have the largest distance from actor center, which is wrong, because depending on the position of the shape, top-right or bottom-left can be the furthest away corner as well, potentially resulting in a too small OuterRadius.
2017-05-29 07:41:20 -05:00
reaperrr
bc5eb66088 Add OuterRadius debug overlay to Rectangle and Capsule
Circle obviously doesn't need it now (might change with the introduction of offsets, but we can still add it when that happens).
2017-05-29 07:41:20 -05:00
reaperrr
8d69d26542 Add debug overlay for custom TargetPositions 2017-05-29 07:41:20 -05:00
reaperrr
479795f494 Fix D2k repair pad footprint
To match the original.
2017-05-29 07:41:20 -05:00
rob-v
45041bde14 Dispose-stop Beacon on closing server browser 2017-05-29 13:28:39 +01:00
rob-v
9a9920e4af Catch and ignore BeaconLib errors 2017-05-29 13:28:39 +01:00
abcdefg30
e1b7fc2617 Replace the removed SupplyTruck trait in disable-player-experience.yaml 2017-05-29 07:15:57 -05:00
Paul Chote
45b13dabfb Explicitly implement interfaces in AttackBase. 2017-05-29 06:27:19 -05:00
Paul Chote
34844e87a3 Replace Lazy trait lookups with INotifyCreated. 2017-05-29 06:27:19 -05:00
Paul Chote
69587a2128 Move InstallShieldPackage to Mods.Common. 2017-05-29 12:41:28 +02:00
Paul Chote
e5222f95f6 Remove ambiguity from FileSystem references. 2017-05-29 12:41:28 +02:00
Paul Chote
ba7290cc2c Move classic-mod package loaders and support files to Mods.Cnc. 2017-05-29 12:41:28 +02:00
Paul Chote
28fdb71163 Remove mod chooser reference from music installation prompt. 2017-05-29 12:33:20 +02:00
Paul Chote
8321d1f3e3 Remove legacy FileSystem.OpenPackage(string, IReadOnlyPackage). 2017-05-29 12:27:24 +02:00
Paul Chote
df40d38b91 Rework read/write zip file loading/saving. 2017-05-29 12:20:32 +02:00
evgeniysergeev
c06df1ed21 make IsCloseEnoughToBase function virtual 2017-05-29 11:50:56 +02:00
abcdefg30
aecfff905d Throw a more detailed error message when creating invalid frozen actors 2017-05-28 14:02:18 +02:00
abcdefg30
2a3139dc39 Add a IAutoSelctionSizeInfo trait interface 2017-05-28 14:02:18 +02:00
Mustafa Alperen Seki
767fd5438e Add Ordos 3b 2017-05-28 13:49:08 +02:00
Paul Chote
a43ec158fa Update error messages. 2017-05-27 13:03:47 +02:00
Paul Chote
7f3f36885a Fix bogus variable names in widget widths. 2017-05-27 13:00:00 +02:00
Paul Chote
29d827079e Fix "game" chat tab mouseover not working from globalchat login tab. 2017-05-27 13:00:00 +02:00
Paul Chote
b104f8baa2 Improve handling of unknown error codes. 2017-05-27 12:43:25 +02:00
Glenn Martin Jensen
e8b2a12714 Add support for blacklist response
Adds support for the new blacklist response in servernames
2017-05-27 12:43:25 +02:00
Paul Chote
0ddc4360fe Remove unused MiniYaml DictFromFile. 2017-05-26 23:02:25 -05:00
Paul Chote
c6816cd33f Persist unknown settings.yaml entries across load/save. 2017-05-26 23:02:25 -05:00
Paul Chote
b1ac1d06e3 Catch and ignore exceptions while loading map previews. 2017-05-26 23:41:30 +02:00
abcdefg30
1f93029e51 Always make sure to be on the host actor when repairing 2017-05-26 22:53:03 +02:00
Jean-Rémy Buchs
2e0d7d0e79 Add KillCargo and FlashScreen to PortableChrono 2017-05-26 10:31:59 +02:00
Paul Chote
2e7de2874d Fix cloak sounds playing on build for initially cloaked actors. 2017-05-24 16:30:04 +02:00
Mustafa Alperen Seki
5dd6aa7a3a Add Ordos 3a 2017-05-20 13:30:41 +02:00
abcdefg30
5e40a5b683 Remove the effect from MissionColt 2017-05-20 11:28:14 +02:00
abcdefg30
ddba9b2efd Remove outdated values and replace Bullet by InstantHit in allies05a 2017-05-20 11:28:14 +02:00
abcdefg30
7ea40482e2 Fix the Colt sometimes shooting even after Tanya was released 2017-05-20 11:28:14 +02:00
abcdefg30
cc6191554a Remove the hacky MissionColt actor from allies05a 2017-05-20 11:28:14 +02:00
abcdefg30
550256373a Replace Camera.Truk by using ValidStances on RevealsShroud 2017-05-20 11:28:14 +02:00
abcdefg30
434ea9ca88 Throw a lint error or an exception when no player owns the world 2017-05-20 11:02:00 +02:00
abcdefg30
ac4fef6630 Don't close the console window when OpenRA closes 2017-05-20 10:55:09 +02:00
abcdefg30
61659d0d32 Add support for using launch-game.cmd with parameters 2017-05-20 10:55:09 +02:00
Paul Chote
b74141666b Implement a workaround for the mono 5.0 cursor enumerator bug. 2017-05-19 14:31:00 +02:00
rob-v
3258d89651 Fix map parameter warning as error from PR 13233 2017-05-17 22:58:56 +02:00
rob-v
127ef8bb27 LobbyLogic, ReplayBrowserLogic Map property changed to map field 2017-05-14 21:06:16 +01:00
rob-v
a26210f914 Replays with MapPreview (like in Lobby) 2017-05-14 21:06:16 +01:00
rob-v
0e3cc1ad28 (Lobby)MapPreviewLogic refactoring 2017-05-14 21:06:16 +01:00
rob-v
ffc3f6e0d0 LAN games discovery 2017-05-14 22:01:25 +02:00
rob-v
b2e6a0484b Fix Selecting a map resets player color 2017-05-14 14:00:45 +01:00
reaperrr
d95bb4152a Add Firestorm Juggernaut to TS 2017-05-14 14:41:20 +02:00
rob-v
224bda6de5 Fix Player slot when changing map 2017-05-14 13:19:18 +02:00
reaperrr
d8edcb1bad Fix TS Nod artillery turret / barrel / weapon offsets 2017-05-14 11:52:42 +01:00
Paul Chote
d45870ca23 Allow fixed barrel pitches to be defined in yaml. 2017-05-14 11:52:42 +01:00
Paul Chote
430429f337 Fix WRot FieldLoader parsing. 2017-05-14 11:52:42 +01:00
reaperrr
b8c251cf41 Add StartBurstReport to WeaponInfo
The FS Juggernaut firing sound already contains 3 shots, so without this, players would hear a total of 9(!) shots per salvo.
2017-05-14 11:49:38 +01:00
reaperrr
d502b296bb Upgrade rule for DeployAnimation removal 2017-05-14 00:22:26 -05:00
reaperrr
aa8d9f5dda Fix GrantConditionOnDeploy to support multiple sprite bodies 2017-05-14 00:22:26 -05:00
reaperrr
6f19379a2b Make WithMoveAnimation multi-WithSpriteBody-compatible 2017-05-14 00:22:26 -05:00
reaperrr
3b798897be Add Name ID field to WithSpriteBody 2017-05-14 00:22:26 -05:00
rob-v
48abb7372b Remove ChatSettings.NickName, use PlayerName always as default 2017-05-13 11:40:47 -07:00
reaperrr
5b8c313d55 Remove lint rule for victim scan radii
They're now calculated automatically to use the most sensible value by default. Only people who know what they're doing or fool around will use custom values, and in that case a lint rule might actually just annoy people.
2017-05-13 11:15:38 -07:00
reaperrr
96d629cefd Upgrade rule for victim scan radii changes
The game/engine now calculates the best values automatically and the field names have changed, so instead of renaming, we can just remove them under the assumption that only modders who really know what they're doing will ever use the override.
2017-05-13 11:15:38 -07:00
reaperrr
d04c6275da Make warheads use the the most sensible victim scan radius
By default, but allow custom overrides.
2017-05-13 11:15:38 -07:00
reaperrr
033268a7ba Make projectiles use most sensible blocker scan radius
By default, but allow custom overrides.
2017-05-13 11:15:38 -07:00
reaperrr
9f9d1f9e5f Added helper utility for finding best hit-shape scan radius 2017-05-13 11:15:38 -07:00
reaperrr
d92d9f86fc Add IBlocksProjectilesInfo interface 2017-05-13 11:15:38 -07:00
Zimmermann Gyula
0d2d17d2fb Fix the AI acting the same at game restart. 2017-05-13 19:08:20 +01:00
reaperrr
db85fff7c0 Remove TS infantry hit-shape height
We should either implement this for all non-blocker actors at once, or not at all. By now we have walls/gates as examples for vertical shape height, so for now there's no reason to leave this on infantry.
2017-05-13 10:51:41 -07:00
reaperrr
91c65f1e9c Adapt blocking height of TS walls etc.
to WDist rescaling.

Also, make wall hit-shape height match blocking height and tweak it to
approximate original TS behaviour as much as possible (Tick Tanks could
shoot over them, but only from certain angles/distances).
2017-05-13 10:51:41 -07:00
reaperrr
ccda89f268 Refactor Shape.Rectangle.RotateToIsometry
And fixes TS wall and gate shapes.
2017-05-13 10:51:41 -07:00
C. Helmig
b11af3bcb5 D2k editor: Moved all appropriate tiles into Cliff-Type-Changer and replaced Sand-Smooth with Cliff-Ends category. 2017-05-13 10:48:37 -07:00
reaperrr
97ec200dcf Merge pull request #13282 from pchote/osx-fullscreen
Work around resolution issues in (legacy) Fullscreen on OSX.
2017-05-13 15:51:10 +02:00
Paul Chote
42232f4a55 Work around resolution issues in (legacy) Fullscreen on OSX. 2017-05-13 00:02:29 +01:00
reaperrr
cf65bb6e41 Merge pull request #13203 from reaperrr/ts-balance-fixes
Fix some wrong TS unit stats
2017-05-12 15:30:39 +02:00
reaperrr
5e736527b7 Merge pull request #13223 from pchote/mod-package-loaders
Unhardcode mod package loaders
2017-05-12 14:04:58 +02:00
reaperrr
2a0cfa5c43 Merge pull request #13278 from reaperrr/disable-win-dpi
Disable DPI scaling on Windows by default
2017-05-12 01:11:15 +02:00
reaperrr
f0c6e5e855 Disable DPI scaling on WIndows by default 2017-05-11 20:09:13 +02:00
abcdefg30
618ac5838a Merge pull request #13215 from pchote/packaging-simplification
Overhaul packaging scripts
2017-05-10 16:34:01 +02:00
atlimit8
55de4a59d0 Merge pull request #13247 from pchote/widget-evaluator-expressions
Replaced legacy Evaluator with IntegerExpressions.
2017-05-08 21:19:52 -05:00
atlimit8
4a80c37507 Merge pull request #13253 from pchote/rescale-isometric-world-coords
Rescaled isometric world coordinates to measure 1024 along the cell axes.
2017-05-08 20:59:51 -05:00
reaperrr
e94ef1658f Merge pull request #13156 from MustaphaTR/d2k-harkonnen-3b
D2K - Add Harkonnen Mission 3b
2017-05-07 16:53:26 +02:00
Paul Chote
552cf83951 Fix missile characteristics. 2017-05-07 13:49:50 +01:00
Paul Chote
fc29438748 Fix grenade speed. 2017-05-07 13:49:44 +01:00
Paul Chote
d2973801e4 Update TS LocalOffsets for new coordinate system. 2017-05-07 13:47:12 +01:00
Paul Chote
cf09b99ed8 Adjust TS subcell positions for new coordinate system. 2017-05-07 13:45:30 +01:00
Paul Chote
cdf2df58a0 Define RectangularIsometric world coordinate scale along the cell axis. 2017-05-07 13:45:30 +01:00
Paul Chote
5dcb840f9f Fix WithHarvesterOffset.LocalOffset name. 2017-05-07 13:44:47 +01:00
Paul Chote
a3f7641b68 Move D2kSoundResources to Mods.D2k dll. 2017-05-07 13:25:43 +01:00
Paul Chote
0222ea675c Implement mod-defined package loaders. 2017-05-07 13:25:38 +01:00
Paul Chote
9b4f602cca Remove unused leftover oramod loading code. 2017-05-07 13:25:04 +01:00
Paul Chote
248c12827e Resolve assembly paths before loading the FileSystem. 2017-05-07 13:25:03 +01:00
Paul Chote
f0d7a6caca Move GetLoaders to ObjectCreator. 2017-05-07 13:25:03 +01:00
reaperrr
74437ed56c Merge pull request #13178 from rob-v/ReturnHeliToNearestBase
Helis return to nearest base like Planes
2017-05-07 13:16:40 +02:00
reaperrr
1194f14cfe Merge pull request #13232 from rob-v/NumberAIPlayers
Number AI players
2017-05-07 13:09:20 +02:00
reaperrr
e9926fdc28 Merge pull request #13248 from pchote/detect-key-repeat
Prevent repeated keys from toggling observer shroud selector.
2017-05-07 13:03:34 +02:00
Paul Chote
e6ec071ceb Merge pull request #13093 from rob-v/ServicePadMoveToRallyPoint
Fix Service Depot Rally point path finding
2017-05-07 08:48:47 +01:00
Paul Chote
d787429a2e Merge pull request #12996 from atlimit8/RemoveIDisable-part2
Remove IDisable - part 2
2017-05-07 08:38:09 +01:00
atlimit8
e01c79be06 Added rule upgrade notice for support powers' PauseOnCondition. 2017-05-06 17:19:43 -05:00
atlimit8
431f06cd49 Convert support powers from actor disabled to pausable-conditional. 2017-05-06 17:19:43 -05:00
atlimit8
9a1ba31753 Added upgrade rule for PauseOnLowPower removal & AffectedByPowerOutage condition granting. 2017-05-06 17:19:43 -05:00
atlimit8
700b117122 Convert WithRepairAnimation from disable to conditional. 2017-05-06 17:19:43 -05:00
atlimit8
5fd4b3a1bd Convert WithRearmAnimation from disable to conditional. 2017-05-06 17:19:42 -05:00
atlimit8
b0706e7cd0 Removes actor disabled support from WithIdleAnimation. 2017-05-06 17:19:42 -05:00
atlimit8
0dfdea1826 Convert AffectedByPowerOutage from disabler to conditional condition granter. 2017-05-06 17:19:42 -05:00
atlimit8
61b84e0c5a Added ts power outage WithIdleOverlay polish. 2017-05-06 17:19:42 -05:00
atlimit8
64a2b9de55 WithRepairOverlay into pausable-conditional trait EMP disabled polish. 2017-05-06 17:19:42 -05:00
atlimit8
1c5427c86f Convert WithIdleOverlay from actor disabled to pausable-conditional. 2017-05-06 17:19:42 -05:00
atlimit8
11933c7e2c Added /poweroutage dev command. 2017-05-06 17:19:39 -05:00
rob-v
fb1d8d780f Fix Service Depot Rally point path finding (+rename ignoredActor) 2017-05-06 19:49:40 +02:00
Paul Chote
c867687d9a Prevent repeated keys from toggling observer shroud selector. 2017-05-06 14:13:12 +01:00
Paul Chote
fff2f097d0 Add KeyInput.IsRepeat. 2017-05-06 14:10:24 +01:00
Paul Chote
cd0898236d Replace legacy Evaluator with IntegerExpressions. 2017-05-06 13:50:30 +01:00
reaperrr
669cf01d80 Merge pull request #13224 from daVoodooShuffle/fix-13153
Cleaned Up Chrome Expression Whitespacing
2017-05-06 14:44:40 +02:00
Paul Chote
9be5ef2bd5 Merge pull request #13214 from GraionDilach/expand-disguise
Expose the drop-disguise-when-attacking aspect to yaml.
2017-05-06 12:00:02 +01:00
daVoodooShuffle
53bf52149c Closes #13153
Modified all expressions to contain a space on either side

Only effects the YAML files that contain config variables:

X:
Y:
Width:
Height:
2017-05-06 15:26:41 +10:00
reaperrr
22d8167d49 Merge pull request #13162 from pchote/tunnel-enter-cursor
Implement "Enter Tunnel" cursor
2017-05-05 23:47:57 +02:00
reaperrr
f5ddea305a Merge pull request #13217 from pchote/jumpjet-death
Fix jumpjet flying death animations
2017-05-05 13:11:17 +02:00
Zimmermann Gyula
81b79a1b29 Expose the drop-disguise-when-attacking aspect to yaml.
Also adds Damaged for more usecases.
2017-05-05 07:58:14 +02:00
atlimit8
4ec0089250 Merge pull request #13219 from GraionDilach/fix-rangemodifier-regression
Fix RangeMultiplier regression.
2017-05-04 20:10:13 -05:00
reaperrr
ea29cce3cf Merge pull request #13002 from rob-v/LobbyOptionsEditableByHost
Host can change Team and Spawn of any player. #12936
2017-05-04 19:15:01 +02:00
reaperrr
c4e79a11a8 Merge pull request #12919 from obrakmann/transform-refactor
Refactor Transform to make use of child activities
2017-05-04 18:55:41 +02:00
rob-v
1ff11d4115 Number AI players 2017-05-03 19:33:04 +02:00
Zimmermann Gyula
c48cf51190 Fix RangeMultiplier regression. 2017-05-01 14:47:17 +02:00
Paul Chote
21a10f84a5 Fix jumpjet flying death animations. 2017-05-01 11:43:18 +01:00
Paul Chote
7a7b668f2b Merge pull request #12999 from reaperrr/RevealOnDeath
Add RevealOnDeath trait
2017-05-01 11:17:18 +01:00
reaperrr
dcf31f356d Merge pull request #13211 from pchote/d2k-hires-logo
Add new d2k mod logo
2017-05-01 12:02:07 +02:00
reaperrr
dbe4b670d0 Make D2k structures reveal shroud on death 2017-05-01 11:57:12 +02:00
Paul Chote
5a273700bf Merge pull request #13204 from IceReaper/reloading-sound
Added ReloadSound and ReloadSoundDelay to weapon declarations.
2017-05-01 00:05:19 +01:00
Andre Mohren
d68bc48ba5 Added ReloadSound and ReloadSoundDelay to weapon declarations. 2017-04-30 22:43:32 +02:00
reaperrr
437f9a7930 Merge pull request #12955 from atlimit8/RemoveIDisable-part1
Remove IDisable - part 1
2017-04-30 21:21:12 +02:00
Oliver Brakmann
f9913db5e8 Make Transform use child activities 2017-04-30 19:40:14 +01:00
Oliver Brakmann
f9951f76ca Allow cancelling an activity without aborting the entire queue 2017-04-30 19:07:50 +01:00
atlimit8
166063337e Make Repair activity halt if RepairsUnit is paused or abort if disabled. 2017-04-30 09:59:03 -05:00
atlimit8
6075569659 Make RepairsUnits pausable-conditional 2017-04-30 09:48:02 -05:00
atlimit8
748afad45e Added PausableConditionalTrait abstract trait 2017-04-30 09:47:28 -05:00
atlimit8
18eddf4a70 Convert ProximityExternalCondition from disable-able to conditional. 2017-04-30 09:46:56 -05:00
atlimit8
770efd710b Remove DisabledOverlay using WithColoredOverlay & remove IDisable from Husk 2017-04-30 09:46:21 -05:00
Paul Chote
705d77501b Add new high resolution D2K mod logo. 2017-04-30 13:38:12 +01:00
Paul Chote
696b48b7bf Overhaul the packaging scripts:
- Ingame mod versions now always match the package version
- Adds macOS compatibility
- Removes trait and lua api docs pending future overhaul
- Individual platform packages can be compiled directly
- Improved error checking
- Removes unnecessary redundancy and indirection
2017-04-30 13:26:36 +01:00
Paul Chote
3111b2cf9b Merge pull request #13129 from pchote/osx-packaging
Update OSX packaging for per-mod launchers.
2017-04-30 13:23:42 +01:00
Paul Chote
e0adbe652e Merge pull request #13138 from pchote/deb-packaging
Update Linux packaging for per-mod launchers.
2017-04-30 13:21:39 +01:00
reaperrr
1349dfb670 Merge pull request #13210 from pchote/polish-deployers
Polish TS deployer animations
2017-04-30 12:14:40 +02:00
reaperrr
d5740efda8 Merge pull request #13186 from rob-v/TakeScreenshotInDialogs
Take screenshot in dialogs #13184
2017-04-30 11:53:13 +02:00
rob-v
382fefebfe Take screenshot in dialogs #13184 2017-04-30 10:17:55 +02:00
Paul Chote
1871715699 Implement "Enter Tunnel" cursor. 2017-04-29 15:58:42 +01:00
Paul Chote
10734f2877 Reenable and polish broken bridge in Sunstroke. 2017-04-29 15:50:16 +01:00
Paul Chote
43ff56eea9 Fix tunnel top definitions. 2017-04-29 15:50:16 +01:00
Taryn Hill
12f2fc3410 Merge pull request #13175 from rob-v/GlobalChat
Enhance - unify global chat (with lobby chat)
2017-04-29 09:28:34 -05:00
atlimit8
cb6e4b9926 Merge pull request #13202 from reaperrr/UpgradeRejectsOrders
Add Reject field to RejectsOrders for blacklisting orders.
2017-04-29 08:51:34 -05:00
Paul Chote
69ca9ffaba Set the default voxel Scale to match the original game. 2017-04-29 13:21:13 +01:00
Paul Chote
4e6af29bb8 Match LPST pre/post deploy sizes and offsets. 2017-04-29 12:21:30 +01:00
Paul Chote
993f4ee6da Match TTNK pre/post deploy sizes and offsets. 2017-04-29 12:21:10 +01:00
reaperrr
53aaa28a71 Remove bogus Turreted from TS amphib APC 2017-04-29 13:13:53 +02:00
reaperrr
0c6911bd2f Fix Mobile Sensor Array sight ranges to match original 2017-04-29 13:13:23 +02:00
reaperrr
398956b690 Add support for multiple RejectsOrders traits per actor 2017-04-29 12:56:30 +02:00
atlimit8
4917c6e453 Merge pull request #12924 from reaperrr/fix-tunnel-atk
Prevent units in tunnels/underground from attacking
2017-04-29 00:25:23 -05:00
reaperrr
9759fce9d7 Fix TS MCV stats to match original 2017-04-27 21:33:37 +02:00
reaperrr
2d2d869b5a Fix TS engineer health to match original 2017-04-27 21:18:48 +02:00
reaperrr
965a73fc53 Fix TS infantry sight range
In original TS, E1 had 5, E2 and E3 had 7.
2017-04-27 21:18:23 +02:00
reaperrr
0a484b424e Fix TS infantry move speed
E3 speed in original was 4.
JumpJet ground speed in original was 5.
2017-04-27 21:17:06 +02:00
reaperrr
1fae993593 Prevent attacking while in tunnel/underground 2017-04-27 17:50:02 +02:00
Paul Chote
bc38cb3cc2 Package OSX launchers in a disk image. 2017-04-26 22:17:27 +01:00
Paul Chote
74bbde751f Create separate OSX launchers for each mod. 2017-04-26 22:17:26 +01:00
Paul Chote
60bc114e39 Merge pull request #13133 from pchote/windows-packaging
Update Windows packaging for per-mod launchers.
2017-04-26 22:12:05 +01:00
Paul Chote
c8af9168c9 Improve general installer quality:
- Remove uninstaller and readme start menu links
  (they are explicitly discouraged by best practices)
- Explicitly declare installer execution level
- Define additional control panel metadata
2017-04-26 22:00:42 +01:00
Paul Chote
2c1b8da7fd Merge pull request #13191 from Enverex/patch-1
Correct make install command for Linux
2017-04-26 21:58:17 +01:00
reaperrr
539ed67527 Merge pull request #13190 from pchote/object-weirdness
Fix ObjectCreator assembly resolving on Windows.
2017-04-26 21:29:33 +02:00
atlimit8
2ae40e7eb4 Merge pull request #13181 from pchote/repair-cursor-flash
Fix repair cursor visual feedback target.
2017-04-25 16:52:10 -05:00
reaperrr
61a1cc18e1 Merge pull request #13195 from atlimit8/ActorExts-AppearsFriendlyTo-simplification
ActorExts.AppearsFriendlyTo Simplification
2017-04-25 23:29:37 +02:00
atlimit8
6aaa7fa042 ActorExts.AppearsFriendlyTo simplification 2017-04-25 15:53:50 -05:00
Paul Chote
a01b3f88fc Remove unused ObjectCreator constructor. 2017-04-25 21:49:37 +01:00
Paul Chote
8dd50c0421 Keep ObjectCreator ResolveAssembly override bound until disposal. 2017-04-25 21:49:37 +01:00
Benjamin Hodgetts
8abf5ce372 Correct make install command
No-longer "install-all".
2017-04-25 12:08:13 +01:00
reaperrr
a9676235db Add custom DeathTypes/DamageTypes support to RevealOnDeath 2017-04-24 19:12:31 +02:00
reaperrr
7dddc7fc44 Make FallToEarth kill the actor instead of disposing it 2017-04-24 19:12:31 +02:00
reaperrr
6045ad2ecf Make D2k units reveal shroud on destruction
For 4 seconds.
2017-04-24 19:12:31 +02:00
reaperrr
4bfd306cc2 Add RevealOnDeath trait
Allows revealing shroud on actor death.
2017-04-24 19:12:31 +02:00
Paul Chote
d9800d4e2b Fix repair cursor visual feedback target. 2017-04-24 08:52:48 +01:00
atlimit8
99f3f37afe Merge pull request #13104 from rob-v/RepairNavalUnitsWithRepairCursor
Naval units (RepairableNear) units repairable using Repair cursor
2017-04-23 22:05:46 -05:00
atlimit8
fe03929e6b Merge pull request #13174 from reaperrr/ts-floater
Add Tiberium Floater to TS
2017-04-23 21:38:27 -05:00
reaperrr
e8f16b1b75 Merge pull request #13150 from rob-v/SaveMapError
Show 'Failed to save map' error message in dialog box
2017-04-23 15:29:10 +02:00
reaperrr
9ce110f6d9 Merge pull request #12971 from rob-v/LobbyResetingPlayerName
Global chat name is reset when connecting
2017-04-23 15:11:24 +02:00
reaperrr
2dc528899e Add Tib Floaters to Sunstroke 2017-04-23 15:00:33 +02:00
reaperrr
f3f443d904 Add FS Tiberium Floater to TS
For better compatibility with FS maps, and more variety for mappers.
2017-04-23 15:00:31 +02:00
rob-v
bd025873cf Host can change Team and Spawn of any player. #12936 2017-04-23 12:06:44 +02:00
atlimit8
172161b9fe Merge pull request #13180 from GraionDilach/make-ps1-gamemonitor
Remove the bitrot GameMonitor StyleCop check.
2017-04-22 22:46:01 -05:00
atlimit8
7a7197216c Merge pull request #13025 from pchote/laser-fence
Implement TS Laser Fences
2017-04-22 19:41:36 -05:00
Paul Chote
fcbdb147ed Update build icon order. 2017-04-23 00:44:11 +01:00
Paul Chote
0ddb631117 Add TS Laser Fences. 2017-04-23 00:44:11 +01:00
Paul Chote
64896eb73d Add EnergyWall trait. 2017-04-23 00:44:11 +01:00
Paul Chote
a83c0f96dd Add GrantConditionOnLineBuildDirection trait. 2017-04-23 00:44:10 +01:00
Paul Chote
f8af51643d Add LineBuildSegmentExternalCondition. 2017-04-23 00:44:10 +01:00
Paul Chote
a8bb03aa34 Draw TS line-build cell previews with increased translucency. 2017-04-23 00:44:10 +01:00
Paul Chote
227b80d6c2 Add support for removing segments when parent nodes are removed. 2017-04-23 00:44:10 +01:00
Paul Chote
304e3ef9f9 Distinguish between line build nodes and segments. 2017-04-23 00:44:09 +01:00
Paul Chote
62603b324d Add support for granting a condition while the make animation plays. 2017-04-23 00:44:09 +01:00
Paul Chote
2b9b9bb984 Fix powerdown indicator position. 2017-04-23 00:44:09 +01:00
Paul Chote
227655f9aa Fix wall artwork interaction with conditions. 2017-04-23 00:44:09 +01:00
Paul Chote
ac53bc502e Remove bogus Requires<HealthInfo> from GrantConditionOnDisabled. 2017-04-23 00:44:08 +01:00
Zimmermann Gyula
2ca6721027 Remove the bitrot GameMonitor StyleCop check. 2017-04-22 23:17:39 +02:00
atlimit8
6744cec239 Merge pull request #13172 from pchote/mod-metadata-cleanup
Remove metadata that was only used by the mod chooser.
2017-04-22 15:57:53 -05:00
rob-v
1206205d17 Enhance - unify global chat (with lobby chat) 2017-04-22 20:25:20 +02:00
reaperrr
ac1d45211d Merge pull request #13134 from atlimit8/NegMinusExpressionParsing
VariableExpression: whitespace/hyphen/binop parsing fix
2017-04-22 19:33:47 +02:00
reaperrr
e29c234ce9 Merge pull request #13164 from reaperrr/ts-arty-deploy
Migrate TS artillery deployment to condition system
2017-04-22 16:44:00 +02:00
reaperrr
863d477928 Merge pull request #13157 from atlimit8/RemoveDictionaryLoadUsings
Remove LoadUsing where FieldLoader.GetValue works for the dictionaries
2017-04-22 16:27:13 +02:00
reaperrr
9ca75d6c8d Merge pull request #13176 from pchote/fix-td-dialog-spam
Remove invalid Background widgets from TD map editor.
2017-04-22 16:15:35 +02:00
rob-v
df07d89f9e Helis return to nearest base like Planes 2017-04-22 15:53:05 +02:00
reaperrr
b53ac5df36 Merge pull request #13074 from atlimit8/IConditionConsumerProvider
Better Support for Multiple Condition Expressions in a Trait
2017-04-22 15:48:37 +02:00
atlimit8
d433473249 Replace IConditionConsumer w/ variable observers for multiple variable expressions for traits. 2017-04-22 08:36:18 -05:00
reaperrr
9f8e9426af Merge pull request #13005 from rob-v/LobbyMapTooltips
Added tooltip to Lobby Map title #12930 #12595
2017-04-22 15:31:34 +02:00
Paul Chote
2e751e937f Remove invalid Background widgets from TD map editor. 2017-04-22 14:17:33 +01:00
atlimit8
8a04156280 VariableExpression: require whitespace around bool/arithmetic binary operators. 2017-04-22 08:14:52 -05:00
rob-v
63de0bb910 Fix ignored 'Failed to save map' #13036 2017-04-22 14:44:06 +02:00
reaperrr
1e63013eb1 Add support for random sounds to AmbientSound 2017-04-22 14:36:55 +02:00
Paul Chote
9b93771dbc Remove metadata that was only used by the mod chooser. 2017-04-22 11:31:43 +01:00
Paul Chote
b24e681531 Create separate Linux launchers for each mod. 2017-04-21 20:18:05 +01:00
Paul Chote
62b0be9db8 Allow non-openra:// Launch.URI prefixes. 2017-04-21 20:18:05 +01:00
Paul Chote
07dc79ab19 Separate release/playtest/git installs. 2017-04-21 20:16:58 +01:00
Paul Chote
3e0f055a3c Create separate Windows launchers for each mod. 2017-04-21 20:16:58 +01:00
Paul Chote
b5523d6b3f Allow non-openra:// Launch.URI prefixes. 2017-04-21 20:16:58 +01:00
Paul Chote
4c990e48d7 Merge pull request #13166 from gdavegdave/bleed
Tweaked map Deterring Democracy to fix harvester stall
2017-04-21 18:52:16 +01:00
GDave
8dbeada0f7 Tweaked map Deterring Democracy to prevent harvester stalling to the immediate right of the lower-right green tree. 2017-04-21 18:40:40 +01:00
Oliver Brakmann
7f204b2dec Merge pull request #13049 from pchote/mod-content
Remove ingame mod chooser.
2017-04-21 19:16:49 +02:00
Paul Chote
9d248433c9 Fix linux packaging. 2017-04-21 18:02:20 +01:00
Paul Chote
84db123b93 Rename modchooser to modcontent. 2017-04-21 18:02:20 +01:00
Paul Chote
ff088323b5 Update --man-page utility command. 2017-04-21 18:02:20 +01:00
Paul Chote
ec42aed6bc Redirect mod chooser to content manager. 2017-04-21 18:02:20 +01:00
Paul Chote
688feea33b Require Game.Mod to be give an a launch arg to OpenRA.Game.exe. 2017-04-21 18:02:14 +01:00
Paul Chote
215aa6fa60 Remove support for loading mods from the support dir. 2017-04-21 17:55:15 +01:00
Paul Chote
e984c98565 Remove oramod package support. 2017-04-21 17:55:15 +01:00
Paul Chote
5d5fd7a0e8 Remove RequiredMods logic. 2017-04-21 17:55:15 +01:00
reaperrr
d9eb224c77 Move Tib Fiend and visc rules to critters.yaml 2017-04-21 17:39:25 +02:00
reaperrr
ec704b7e34 Move Tiberian Fiend and visceroid sequences to critters.yaml 2017-04-21 16:53:10 +02:00
Oliver Brakmann
43b9aa00d8 Merge pull request #13161 from reaperrr/mods-cnc-tweak
Unhardcode LightPaletteRotator properties
2017-04-21 15:26:04 +02:00
reaperrr
5e1cd5dff9 Disable automatic turret realign for deployed Tick Tank and Artillery 2017-04-21 12:41:18 +02:00
reaperrr
5789b73091 Convert TS Nod Artillery to condition system
Getting rid of legacy Transforms approach.
2017-04-21 12:41:18 +02:00
atlimit8
c23f248840 Merge pull request #13159 from pchote/return-to-ground
Force Mobile units to return to the ground layer when becoming idle.
2017-04-20 23:55:58 -05:00
reaperrr
4a8571161a Unhardcode LightPaletteRotator properties 2017-04-21 00:24:23 +02:00
atlimit8
3fbdde5317 Merge pull request #13160 from pchote/fix-tunnel-harvesting
Fix harvesters harvesting resources from underground.
2017-04-20 16:21:48 -05:00
reaperrr
04f8a85cc6 Make LightPaletteRotator interfaces explicit and add desc 2017-04-20 21:12:07 +02:00
Paul Chote
c5547ec20b Fix harvesters harvesting resources from underground. 2017-04-20 19:57:26 +01:00
reaperrr
bb9790c754 Move legacy map import commands into matching subfolder 2017-04-20 20:50:04 +02:00
Paul Chote
b373714da7 Force Mobile units to return to the ground layer when becoming idle. 2017-04-20 19:48:21 +01:00
reaperrr
60fccc1bc4 Merge pull request #12980 from abcdefg30/laysTerrain
Update the documentation of LaysTerrain
2017-04-20 20:10:14 +02:00
reaperrr
ebb6505190 Merge pull request #13106 from abcdefg30/spawnOffset
Add an Offset property to SpawnActorOnDeath
2017-04-20 17:53:33 +02:00
abcdefg30
57bdb1cff3 Update the documentation of LaysTerrain 2017-04-20 15:41:35 +02:00
atlimit8
b97162d9f1 Merge pull request #13110 from MartinCurwen/bleed
Multiple armament check fix in AttackGarrisoned
2017-04-19 12:05:35 -05:00
MartinCurwen
ea6e1fdd64 Multiple armament check fix in AttackGarrisoned 2017-04-19 17:40:14 +01:00
atlimit8
4767b91037 Remove LoadUsing where FieldLoader.GetValue works for the dictionaries 2017-04-19 09:51:06 -05:00
Mustafa Alperen Seki
c94eb2582b Add Harkonnen 3b 2017-04-19 16:46:42 +02:00
Oliver Brakmann
843ac85c92 Merge pull request #13000 from reaperrr/supply-to-cnc
Refactor SupplyTruck/AcceptsSupplies to *Cash traits
2017-04-18 23:38:29 +02:00
Oliver Brakmann
89c19e717f Merge pull request #13118 from MustaphaTR/d2k-harkonnen-3a
D2K - Add Harkonnen Mission 3a
2017-04-18 22:55:31 +02:00
atlimit8
2053aec5f9 Rename VariableExpression.OperandSides => VariableExpression.Sides 2017-04-18 15:22:04 -05:00
atlimit8
c34b947e43 VariableExpression: Restrict CharClass.Mixed to middle of identifiers 2017-04-18 15:15:21 -05:00
atlimit8
f9974624c8 VariableExpression: hyphen after digit lexing fix 2017-04-18 15:14:55 -05:00
reaperrr
225d26bfdb Add explicit Reject field to RejectsOrders 2017-04-18 20:23:00 +02:00
reaperrr
afc1f22c63 Merge pull request #13149 from pchote/defer-tunnel-orders
Require cancelled move orders to exit tunnels before completion.
2017-04-18 19:42:49 +02:00
reaperrr
9814083ac3 Rename DonateSupplies activity to DonateCash 2017-04-18 19:27:46 +02:00
reaperrr
80ec530e4c Refactor supply traits to *Cash traits
Adding 'Type' and 'Stances' support as well.
2017-04-18 19:27:46 +02:00
abcdefg30
361cbc34cc Merge pull request #13139 from AoAGeneral/AoATD
TD Flame infantry spread.
2017-04-18 17:10:27 +02:00
abcdefg30
7416cd0ac1 Add an Offset property to SpawnActorOnDeath 2017-04-18 17:09:25 +02:00
abcdefg30
23ba3cfcb6 Merge pull request #13050 from rob-v/DefeatedPlayersCanNotPauseGame
Lost players except Host can not pause game #12227
2017-04-18 17:00:04 +02:00
abcdefg30
8e6f6a3a52 Merge pull request #13007 from rob-v/ProductionStatisticsTooltip
Add tooltips to production statistics #12820
2017-04-18 16:55:05 +02:00
Oliver Brakmann
e164a6119d Merge pull request #13123 from SoScared/fix3maps
[RA] [Map Pool] Fix tiles on Countercross, Siberian Pass & Six Below Zero.
2017-04-18 16:29:26 +02:00
Paul Chote
0b0f8bc51e Require cancelled move orders to exit tunnels before completion. 2017-04-17 22:34:21 +01:00
Paul Chote
c6d8957307 Merge pull request #13080 from reaperrr/fix-ts-effectlighting
Make TS explosions + muzzle flashes unaffected by global lighting
2017-04-17 21:14:44 +01:00
rob-v
199e9847d1 Add tooltips to production statistics #12820 2017-04-17 21:51:23 +02:00
reaperrr
2548e62e31 Merge pull request #13148 from obrakmann/fix13147_fix-rtb-dead-dest-race
Check for dead destination airfield in ReturnToBase
2017-04-17 20:41:39 +02:00
Oliver Brakmann
b50f15c645 Check for dead destination helipad in HeliReturnToBase 2017-04-17 19:31:53 +02:00
Oliver Brakmann
ff8f204cac Check for dead destination airfield in ReturnToBase 2017-04-17 19:23:11 +02:00
Paul Chote
6df453f806 Merge pull request #13127 from obrakmann/fix13099_disableDpiScalingSetting
Add a setting to disable DPI scaling on Windows systems
2017-04-17 17:46:46 +01:00
Oliver Brakmann
3ec6754289 Merge pull request #13141 from pchote/mod-urls
Move web urls from user config to mod config.
2017-04-17 17:13:52 +02:00
Paul Chote
462ee48c60 Merge pull request #13119 from rob-v/DownloadPackageErrorLog
Add exception message to Download (Invalid archive) error #12985
2017-04-17 15:14:36 +01:00
Matthias Mailänder
37219ad67b Make Tiberian Sun railways passable by trains. 2017-04-17 15:11:33 +01:00
Matthias Mailänder
4480f49e0f Add ChangesTerrain. 2017-04-17 15:11:33 +01:00
reaperrr
1860b448b7 Merge pull request #13143 from reaperrr/icereap-bleed
Added WithTurretedAttackAnimation
2017-04-17 16:10:42 +02:00
Paul Chote
774a717c19 Merge pull request #13117 from abcdefg30/veteranOverlay
Fixed VeteranProductionIcons not being disabled when Prerequisites are removed
2017-04-17 14:47:32 +01:00
Andre Mohren
9b22f0e11a Support attack animation for turrets via new WithTurretedAttackAnimation trait. 2017-04-17 15:34:45 +02:00
reaperrr
1d3daa5e4d Merge pull request #13108 from atlimit8/ConditionsToVariables
ConditionExpression to (Boolean|Integer)Expression refactor
2017-04-17 14:52:21 +02:00
reaperrr
4c63c7bdd8 Merge pull request #13096 from rob-v/DisableEdgeScrollWhileStandardScroll
Fix/Disable Edge scroll while standard (middle mouse) scroll
2017-04-17 14:36:21 +02:00
Paul Chote
1722f42f83 Move web urls from user config to mod config. 2017-04-17 12:00:41 +01:00
AoAGeneral
ddc31825ec TD Flame infantry spread.
Increases the flame infantry attack spread from 341 to 468.

This allows the flame infantry to have a wider cone attack as the previous 10 damage increase helped. They still however lacked the wide attack spread needed on massive infantry assaults. Their attack spread matches that of grenadiers and a lot of armaments (Artillery) and being a frontal unit can use a slight increase to help with this.
Units going prone still takes three hits to kill infantry (two for e3 and anyone standing).
2017-04-16 14:13:12 -07:00
SoScared
7168912273 Fix tiles on Countercross, Siberian Pass, Sudden Death & Six Below Zero. 2017-04-15 19:50:12 +02:00
reaperrr
04f5937476 Merge pull request #13086 from kyrylo/winter-storm-update
mods/ra/maps: update Winter Storm
2017-04-15 13:45:24 +02:00
reaperrr
8c1ed0d39f Merge pull request #13102 from abcdefg30/06yak
Fix allies06a freezing when yaks try to attack camo pillboxes
2017-04-15 12:36:18 +02:00
Oliver Brakmann
0635f3636d Add a setting to disable DPI scaling on Windows systems 2017-04-14 23:23:14 +02:00
Oliver Brakmann
3cd7493664 Merge pull request #13095 from jrb0001/licenseheaders-lua
add GPLv3+ header to all lua scripts
2017-04-14 22:25:46 +02:00
Oliver Brakmann
63e4fbc5ad Merge pull request #12828 from Phrohdoh/util-engine-mod-search-paths
Utility and server: Get mod search paths from env MOD_SEARCH_PATHS
2017-04-14 21:59:09 +02:00
Paul Chote
9637e1b2c7 Merge pull request #13120 from MustaphaTR/update-openra-sln-for-lua-again
Add new lua files added with new D2K missions to OpenRA.sln (Again)
2017-04-14 14:54:56 +01:00
rob-v
ee91396984 Add exception to Archive extraction failed (Invalid archive) error ##12985 2017-04-13 20:44:03 +02:00
Mustafa Alperen Seki
cdf01cc25b Update OpenRA.sln for lua files again 2017-04-13 18:51:16 +02:00
abcdefg30
87a44023b2 Fixed VeteranProductionIcons not being disabled when Prerequisites are removed 2017-04-13 17:54:17 +02:00
Mustafa Alperen Seki
c170f658ff Add Harkonnen 3a 2017-04-13 17:53:01 +02:00
abcdefg30
81fe19ca4a Merge pull request #12966 from pchote/windows-launcher
Reorganize Windows game launcher to support per-mod launchers.
2017-04-13 15:34:10 +02:00
reaperrr
e043539805 Merge pull request #13056 from AoAGeneral/AoATD
TD Commando ScanRadius.
2017-04-12 20:39:36 +02:00
reaperrr
b0caa104f6 Merge pull request #13053 from MustaphaTR/ts-build-palette-orders
TS - Reorder the Cameos
2017-04-12 20:38:29 +02:00
reaperrr
e058eae706 Merge pull request #13063 from MustaphaTR/d2k-ordos-4
D2K - Add Ordos Mission 4
2017-04-12 20:30:25 +02:00
reaperrr
8e5fbfe227 Merge pull request #12785 from abcdefg30/atreides05
Add atreides05
2017-04-12 19:26:02 +02:00
reaperrr
fb4cb04934 Merge pull request #13066 from rob-v/MouseWheelZoomWithoutModifier
Mouse wheel zoom without modifier option
2017-04-12 19:20:28 +02:00
reaperrr
f33bf002ea Merge pull request #13109 from abcdefg30/clean
Fix the make.ps1 clean command not removing all files
2017-04-12 19:13:47 +02:00
reaperrr
882b5da20d Make TS explosions and muzzle flashes 'glow' on darker maps
The new effectglow palette is not affected by global lighting, making effects 'glow' at full light on darker maps.
Exception: pistol/rifle/machine gun piffs.
2017-04-12 19:11:24 +02:00
abcdefg30
39cdf65764 Fix the make.ps1 clean command not removing all files 2017-04-12 01:14:07 +02:00
atlimit8
6b18eb1993 Merge pull request #12977 from rob-v/RallyPointPrimaryBuilding
When changing rally point with ctrl also make primary
2017-04-11 18:05:16 -05:00
abcdefg30
035c4adeb0 Merge pull request #12909 from pchote/file-handlers
Remove oramod and orarep file type handlers from Windows and Linux.
2017-04-12 01:01:34 +02:00
rob-v
a11ff104a2 Lost players except Host can not pause game #12227 2017-04-11 21:40:59 +02:00
rob-v
9216427c2b RepairableNearUnitsWithRepairCursor #12361 2017-04-11 19:03:41 +02:00
abcdefg30
739653ce37 Merge pull request #13089 from rob-v/FixPreDamagedTilesHealth
Fix Pre-damaged bridge tiles visually transform to new #13076
2017-04-11 18:22:01 +02:00
Paul Chote
bbbf3b086b Add multi-resolution RA logo icon. 2017-04-11 17:17:47 +01:00
Paul Chote
2997f31bc3 Set OpenRA.Game.exe icon to match the mod. 2017-04-11 17:17:47 +01:00
Paul Chote
8e96d85d24 Allow runtime mod to be customized. 2017-04-11 17:15:22 +01:00
Paul Chote
31a91a0269 Allow FAQ URL to be customized. 2017-04-11 17:15:21 +01:00
Paul Chote
044a5e18ee Allow mod display name to be customized. 2017-04-11 17:15:21 +01:00
Paul Chote
005b4166cc Move Windows launcher compilation to packaging scripts. 2017-04-11 17:15:21 +01:00
Paul Chote
35249c1faf Remove windows icon from OpenRA.Game.exe. 2017-04-11 17:15:20 +01:00
Paul Chote
a853d431fc Remove long unneeded tools target. 2017-04-11 17:15:20 +01:00
abcdefg30
3808a1885e Merge pull request #12976 from rob-v/ConnectionFailedCustomMap
Connection Failed when trying to join custom map #12881
2017-04-11 13:15:23 +02:00
abcdefg30
e37667efb6 Merge pull request #12606 from reaperrr/forward-bombs2
Add forward movement support to GravityBomb
2017-04-11 13:07:15 +02:00
abcdefg30
60531c6eef Merge pull request #13088 from pchote/muzzle-fix
Fix duplicate muzzle rendering.
2017-04-11 12:58:47 +02:00
atlimit8
b0187dd646 Added (Boolean|Integer)Expression subclasses of VariableExpression 2017-04-11 02:52:54 -05:00
atlimit8
e73d3922dd Rename ConditionExpression => VariableExpression 2017-04-11 01:26:38 -05:00
Jean-Rémy Buchs
fc725c6c0c add GPLv3+ header to all lua scripts 2017-04-10 21:13:51 +02:00
rob-v
e87a96f2b8 Fix/Disable Edge scroll while standard (middle mouse) scroll 2017-04-10 19:56:53 +02:00
Kyrylo Silin
09c610e2cc mods/ra/maps: update Winter Storm
Map link: http://resource.openra.net/maps/20503/

Changes:

* Renamed from `Winter Storm 2` to `Winter Storm`
* Decorated the chain links near middle oil derricks
* Resized the map from 89x82 to 89x86 to add more sea tiles to the top
  and to the bottom
* Fixed broken tile near the ridge to the middle right
2017-04-10 10:32:21 +03:00
reaperrr
1fa8286f1e Merge pull request #13085 from kyrylo/tandem-update
mods/ra/maps: update Tandem
2017-04-10 00:31:28 +02:00
reaperrr
563d9abce9 Merge pull request #13083 from kyrylo/behind-the-veil-update
mods/ra/maps: update Behind the Veil
2017-04-10 00:22:28 +02:00
abcdefg30
14ece703ef Fix allies06a freezing when yaks try to attack camo pillboxes 2017-04-09 15:50:27 +02:00
Mustafa Alperen Seki
2ca3a1d120 Reorder the TS Cameos 2017-04-09 15:24:49 +02:00
rob-v
4b652aa894 Fix Pre-damaged bridge tiles visually transform to new when attacked #13076 2017-04-09 14:50:36 +02:00
atlimit8
c69a85a328 Merge pull request #12992 from pchote/launch-game-dot-sh
Overhaul launch-game.sh for OS X/Linux/POSIX
2017-04-09 07:13:14 -05:00
Paul Chote
b5068facdc Fix duplicate muzzle rendering. 2017-04-09 12:41:53 +01:00
Paul Chote
5c0674d695 Merge pull request #13048 from reaperrr/fix-ts-lights
Fix some TS building overlays
2017-04-09 11:45:04 +01:00
Paul Chote
77af9ca01d Overhaul launch-game.sh
- Adds macOS support
- Adds mod chooser dialog if zenity available
- Improved text-mode output when zenity not available.
2017-04-09 11:33:27 +01:00
Paul Chote
d7c710e5fc Remove oramod and orarep file type handlers. 2017-04-09 11:09:14 +01:00
Kyrylo Silin
2c678a240c mods/ra/maps: update Tandem
Map link: http://resource.openra.net/maps/20495/

Changes:

* Fixed some bad tiles (thanks to Frame Limiter)

  > Bad tile: 75,45
  > Road tiles: 98,59 , 50,12

* Changed author name from `Kyrylo` to `Kyrylo Silin`
2017-04-09 12:02:36 +03:00
Kyrylo Silin
6d84079a94 mods/ra/maps: update Behind The Veil
Map link: http://resource.openra.net/maps/20494/

Changes:

* Renamed from `Behind The Veil` to `Behind the Veil`
* Replaced chain link with walls in the middle to protect oil derricks
  from direct attacks
* Added barrels to the middle area. A middle oil derrick can be
  captured only from 2 spots (if barrels are not destroyed)
* Added barrels between side ridges
* Fixed some bad road tiles (thanks to Frame Limiter)
* Widen side passages to corner expansions by 1 cell
2017-04-09 11:36:22 +03:00
Oliver Brakmann
3f4f56d728 Merge pull request #13073 from atlimit8/fix-ConditionManager.GrantCondition-doc
Fix ConditionManager.GrantCondition doc
2017-04-08 23:38:17 +02:00
Oliver Brakmann
92bf1f43af Merge pull request #13079 from pchote/fix-carryall-crash
Fix crash when carryall cargo is killed on same tick as pickup.
2017-04-08 22:49:14 +02:00
Oliver Brakmann
59d6b14e06 Merge pull request #13069 from abcdefg30/mtmTran
Fix the extraction helicopter not showing up in Monster Tank Madness
2017-04-08 22:43:27 +02:00
Paul Chote
a82e835f87 Set sensible initial turret facings. 2017-04-08 21:30:38 +01:00
Oliver Brakmann
b9f0504380 Fix friendly monster tanks not revealing shroud in Monster Tank Madness 2017-04-08 20:55:40 +02:00
Paul Chote
043d7587a6 Fix crash when carryall cargo is killed on same tick as pickup. 2017-04-08 12:58:18 +01:00
atlimit8
8f2f54f92f Fix ConditionManager.GrantCondition doc 2017-04-06 22:05:16 -05:00
abcdefg30
8f50052a1c Remove a misplaced barrel 2017-04-05 22:27:39 +02:00
abcdefg30
009cbb74f5 Fix Oil Pumps spawning infantry on death 2017-04-05 22:19:55 +02:00
abcdefg30
d6cf3b35b6 Fix the explosions of the civilian buildings
- it looked weird when they spawned civilians
- other buildings on the map exploded with the wrong explosion
2017-04-05 22:16:37 +02:00
abcdefg30
e4d3712205 Set the initial cash to 0 2017-04-05 21:53:31 +02:00
abcdefg30
49c3dfe2fc Fix the extraction helicopter not showing up in Monster Tank Madness 2017-04-05 21:52:19 +02:00
Oliver Brakmann
737764a47a Merge pull request #13019 from gdavegdave/bleed
Update the official cnc/TD map pool
2017-04-05 21:25:25 +02:00
GDave
d6b9304fd8 Update the official cnc/TD map pool 2017-04-05 11:32:42 +01:00
rob-v
6217cfbcd2 Mouse wheel zoom without modifier option 2017-04-05 10:57:40 +02:00
Mustafa Alperen Seki
1c3276c935 Add Ordos 4 2017-04-05 09:19:17 +02:00
abcdefg30
96e2b4fe70 Add atreides-05 2017-04-04 23:23:44 +02:00
Taryn Hill
4d5f9e0de7 Server: Get mod search paths from env MOD_SEARCH_PATHS 2017-04-03 17:58:44 -05:00
abcdefg30
62a3099215 Merge pull request #13047 from MustaphaTR/d2k-ordos-2b
D2K - Add Ordos Mission 2b
2017-04-03 22:07:53 +02:00
Mustafa Alperen Seki
2c8b2c5c7d Add Ordos 2b 2017-04-03 19:57:24 +02:00
rob-v
ffb639bd7c Added tooltip to Lobby Map title #12930 #12595 2017-04-03 10:11:29 +02:00
atlimit8
1afdcfb749 Merge pull request #12906 from pchote/project-args
Allow specific mods to be launched from MD/XS >= 6.1 GUI.
2017-04-02 21:53:52 -05:00
atlimit8
ee260af064 Merge pull request #13021 from abcdefg30/idleActivity
FlyCircle and HeliFlyCircle count as idle activities.
2017-04-02 21:11:37 -05:00
Taryn Hill
d095ccf668 Utility: Get mod search paths from env MOD_SEARCH_PATHS 2017-04-02 18:49:03 -05:00
AoAGeneral
af85ca8f18 TD Commando ScanRadius. 2017-04-02 14:01:31 -07:00
abcdefg30
6b4700b24f Merge pull request #13045 from reaperrr/fix-ts-grenpal
Fix palette and disable false Report of TS Grenade
2017-04-02 22:32:31 +02:00
Oliver Brakmann
d33a0105a2 Merge pull request #13042 from AoAGeneral/AoATD
TD Artillery/MRLS Vision.
2017-04-02 22:00:59 +02:00
Oliver Brakmann
11f85a1a36 Merge pull request #13020 from abcdefg30/airHunt
Fixed aircraft not being able to hunt
2017-04-02 21:40:34 +02:00
rob-v
c3255e275c Connection Failed when trying to join custom map #12881 2017-04-02 16:26:13 +02:00
Paul Chote
8b9c363222 Merge pull request #12888 from jrb0001/bleed
Load debug symbols for mods if they are loaded from the filesystem
2017-04-02 14:56:17 +01:00
Oliver Brakmann
832ae3149d Merge pull request #13033 from pchote/launch-game-dot-cmd
Add a windows version of the launch-game script.
2017-04-01 19:36:02 +02:00
Oliver Brakmann
b492e1e891 Merge pull request #12973 from rob-v/SortPlayingGamesInLobby
Sort 'Playing' games in the lobby by play time. #12959
2017-04-01 19:20:01 +02:00
reaperrr
d9b3d0fd84 Fix TS helipad anim speed
Too slow on bleed compared to original, especially the GDI one.
2017-04-01 16:39:11 +02:00
reaperrr
8ee67a4438 Fix TS ConYard top lights anim speed
Way too slow on bleed compared to original
2017-04-01 16:35:04 +02:00
reaperrr
fd717041ae Fix TS factory/barracks lights
In TS,
-GDI Factory lights were all idle and didn't have a damaged state
-GDI Barracks lights were all idle, and flag anim played more slowly
-Hand of Nod lights were all idle
-Nod Factory lights were idle
2017-04-01 16:30:20 +02:00
reaperrr
7ba8a19862 Fix palette and disable false Report of TS Grenade 2017-04-01 15:06:09 +02:00
reaperrr
783eb1e9ea Merge pull request #13031 from FrameLimiter/patch-3
Fixed vision for aircraft husks under Gap
2017-04-01 14:22:08 +02:00
abcdefg30
0fa6c7ed3c Merge pull request #12993 from reaperrr/fix-ts-obsicon
Fix TS observer flag alignment
2017-04-01 13:28:36 +02:00
AoAGeneral
537184b65c TD Artillery/MRLS Vision.
This is changing the vision of Artillery and MRLS from 8c0 to 5c0.

The reason behind this is because we have scouting artillery and MRLS units that have a much larger vision range then infantry and the same vision as hummers and buggies. This turns into games where people build infantry and artillery/MRLS armies and march of death to the enemy. Its more counterable in 1v1 and 2v2 but team games of 3v3+ it becomes incredibly spammy of these units and hard to stop.
2017-03-31 15:04:32 -07:00
reaperrr
4f07a00994 Merge pull request #13038 from reaperrr/misc-cleanups-0317
Misc yaml style fixes (all mods)
2017-03-31 12:27:56 +02:00
reaperrr
df85ea222a TS yaml style fixes
To reduce upgrade rule 'noise' a little.
2017-03-31 11:23:44 +02:00
reaperrr
cf8db74d85 RA yaml style fixes
To reduce upgrade rule noise a little.
2017-03-31 11:23:42 +02:00
reaperrr
2172d91efb Add newline to TD shellmap's map.yaml
To avoid upgrade rule 'noise'.
2017-03-31 11:00:04 +02:00
reaperrr
4fdda9efd2 Remove wrong space and 2nd free line from d2k yamls 2017-03-31 10:55:01 +02:00
Paul Chote
ae7a7418eb Add a windows version of the launch-game script. 2017-03-29 21:09:13 +01:00
reaperrr
edc1753e22 Update GravityBomb velocity after position
Otherwise launch velocity would already be Velocity + Acceleration.
2017-03-29 19:30:55 +02:00
reaperrr
7fdbe10319 Upgrade rule for GravityBomb velocity/accel changes 2017-03-29 19:30:54 +02:00
reaperrr
e1e47e7e0d Tweak TS Orca bomb fall behavior 2017-03-29 19:30:52 +02:00
reaperrr
5b617cf6e5 Refactor GravityBomb velocity/acceleration 2017-03-29 19:30:51 +02:00
FrameLimiter
b59f1f39fe Fixed vision for aircraft husks under Gap. 2017-03-29 11:42:32 -04:00
reaperrr
aa3f21632c Merge pull request #12880 from MustaphaTR/d2k-ordos-2a
D2K - Add Ordos Mission 2a
2017-03-29 16:52:19 +02:00
atlimit8
4c32e23f89 Merge pull request #12634 from GraionDilach/bullet-airburst
Implement airburst support to Bullet.
2017-03-28 17:53:24 -05:00
reaperrr
bfc0f7f9e6 Merge pull request #12997 from SoScared/mapEnsioFix
[RA] [Map pool] Fix tile errors on various maps.
2017-03-28 22:39:29 +02:00
Mustafa Alperen Seki
7f68c38e72 Add Ordos 2a 2017-03-27 17:19:54 +02:00
abcdefg30
dac8a8e4f6 Merge pull request #13024 from MustaphaTR/d2k-remove-sonic-tank-immunity
D2K - Remove Sonic Tanks' immunity to other friendly Sonic Tanks.
2017-03-26 19:26:23 +02:00
Mustafa Alperen Seki
5ccfcb1cb9 Remove Sonic Tanks' immunity to other friendly sonic tanks. 2017-03-26 10:15:19 +02:00
SoScared
d2a0535442 fix tile errors on various maps 2017-03-25 15:36:03 +01:00
abcdefg30
ae111248f3 Have some activities count as idle activities 2017-03-24 18:06:10 +01:00
abcdefg30
4d335af9fc Fixed aircraft not being able to hunt 2017-03-24 17:40:11 +01:00
rob-v
bfcb37e1b7 When changing rally point also make primary building #12855 2017-03-22 16:41:30 +01:00
atlimit8
b6810f3dd3 Merge pull request #12986 from abcdefg30/withDesc
Expand the documentation of Reinforce(WithTransport)
2017-03-22 10:23:36 -05:00
abcdefg30
cc67f9328c Merge pull request #12974 from rob-v/IngameMessagePrefixes
Unify ingame message prefixes. #12923
2017-03-19 23:13:59 +01:00
atlimit8
ff998fd552 Merge pull request #12981 from abcdefg30/grantOwner
Fix GrantConditionOnPrerequisite not refreshing when the actor's owner changes.
2017-03-19 17:09:08 -05:00
abcdefg30
d819f3206e Merge pull request #12882 from abc013/ContrailFix
Fix contrail gets rendered between loading in and loading out position
2017-03-19 23:03:33 +01:00
atlimit8
a49227c494 Merge pull request #12862 from abcdefg30/captureCursor
Minor revision to CaptureOrderTargeter.
2017-03-19 10:54:22 -05:00
abc013
b7ca740155 Fix contrail gets rendered between loading in and loading out position 2017-03-19 09:25:39 +01:00
abcdefg30
aa99c3cd40 Merge pull request #12729 from Mailaender/sunstroke
Added Firestorm map Sunstroke
2017-03-19 03:01:05 +01:00
reaperrr
294259c726 Set up custom creeps on Sunstroke 2017-03-19 02:51:33 +01:00
reaperrr
44254472d5 Disable fixed palette for TS old base buildings 2017-03-19 02:51:33 +01:00
reaperrr
ee63835778 Fix allowed terrain types of veins 2017-03-19 02:51:33 +01:00
Matthias Mailänder
1291d1a53d Add the custom rules
sunrise effect and TW1 units.
2017-03-19 02:51:25 +01:00
Matthias Mailänder
49d26fd238 Outcomment high bridge huts and low bridge segments. 2017-03-19 02:34:29 +01:00
Matthias Mailänder
37101bf4f0 Import the Sunstroke map
http://www.ppmforums.com/viewtopic.php?t=15379
2017-03-19 02:34:28 +01:00
abcdefg30
e1dda2bf54 Fix GrantConditionOnPrerequisite not refreshing when the actor's owner changes 2017-03-19 02:30:45 +01:00
abcdefg30
b2b3390bc0 Move GrantConditionOnPrerequisite into the Conditions folder 2017-03-19 02:29:26 +01:00
abcdefg30
ceab7a222e Merge pull request #12902 from MustaphaTR/d2k-add-6PLAY3
D2K - Add Mauddib's Cave to map pool.
2017-03-19 02:18:49 +01:00
reaperrr
7a3bae33ea Fix TS observer flag position 2017-03-19 00:20:02 +01:00
abcdefg30
00d854f31b Merge pull request #12984 from MustaphaTR/ts-add-tech-levels
TS - Add Tech Levels
2017-03-18 22:49:01 +01:00
rob-v
bad2c1c2bf Unify ingame message prefixes. #12923
Unify ingame message prefixes. #12923
2017-03-18 21:46:30 +01:00
Mustafa Alperen Seki
66d50ba0b5 Add Tech Levels to Tiberian Sun 2017-03-18 20:08:44 +02:00
reaperrr
245ca7d996 Merge pull request #12989 from abcdefg30/onDoc
Add a note about EnemyWatcher being required for On(Player)Discovered
2017-03-18 18:25:11 +01:00
Mustafa Alperen Seki
0e345b465c Add 6PLAY3 2017-03-18 19:21:40 +02:00
abcdefg30
b295f36fa7 Merge pull request #12987 from reaperrr/fast-gamespeed
Add "Fast" game speed to all mods
2017-03-18 18:12:45 +01:00
abcdefg30
a36a77d637 Add a note about EnemyWatcher being required for On(Player)Discovered 2017-03-18 18:09:20 +01:00
abcdefg30
7bb8cbf867 Merge pull request #12901 from MustaphaTR/d2k-add-6PLAY2
D2K - Add Carthag to map pool.
2017-03-18 18:00:46 +01:00
abcdefg30
c19463f5b4 Merge pull request #12903 from MustaphaTR/d2k-add-6PLAY4
D2K - Add Thufir's Point to map pool.
2017-03-18 17:58:48 +01:00
abcdefg30
7491ede65a Merge pull request #12904 from MustaphaTR/d2k-add-6PLAY5
D2K - Add Leto's Erg to map pool.
2017-03-18 17:55:34 +01:00
abcdefg30
1abe93f25a Merge pull request #12900 from MustaphaTR/d2k-add-6PLAY1
D2K - Add Arakeen to map pool.
2017-03-18 17:51:22 +01:00
reaperrr
785e20e0f3 Add "Fast" game speed to all mods
Sitting smack in the middle between Default and "Faster", except for order delay (which is same as Faster to avoid rejected/dropped orders).
2017-03-18 17:45:02 +01:00
abcdefg30
6069a12973 Expand the documentation of Reinforce(WithTransport) 2017-03-18 16:40:35 +01:00
Zimmermann Gyula
902d2a0016 Implement airburst support to Bullet. 2017-03-18 15:05:06 +01:00
Mustafa Alperen Seki
31d5d048fe Add 6PLAY1 2017-03-18 15:23:46 +02:00
reaperrr
28e204a8ae Merge pull request #12982 from rob-v/MissionsDifficultyTough
Real tough guy difficulty doesn't fit the UI #12844
2017-03-18 14:23:43 +01:00
Mustafa Alperen Seki
8fd9f98180 Add 6PLAY2 2017-03-18 15:22:24 +02:00
Mustafa Alperen Seki
dd12d70ded Add 6PLAY4 2017-03-18 15:19:33 +02:00
Mustafa Alperen Seki
06f6a8646f Add 6PLAY5 2017-03-18 15:18:14 +02:00
reaperrr
02b82ae344 Merge pull request #12860 from abcdefg30/removeGroupProxy
Remove the dead ActorGroupProxy trait
2017-03-18 14:04:28 +01:00
reaperrr
d0e859cbeb Merge pull request #12784 from abcdefg30/d2kTiles
Add missing tiles to arrakis.yaml and fixed the map import
2017-03-18 13:58:12 +01:00
reaperrr
620ae45cb3 Merge pull request #12747 from atlimit8/Pluggable-Requirements
Prevent duplicate upgrades (plugs) to GDI Upgrade Center (Pluggable Requirements)
2017-03-18 13:55:30 +01:00
abcdefg30
880f90345e Add an upgrade rule 2017-03-18 13:42:49 +01:00
abcdefg30
5e923ff091 Remove the dead ActorGroupProxy trait 2017-03-18 13:40:05 +01:00
rob-v
d7684ee680 Real tough guy difficulty doesn't fit the UI #12844 2017-03-17 22:31:02 +01:00
abcdefg30
fbd62c242f Merge pull request #12969 from atlimit8/UncloakOnDamageSign
UncloakOn: Damage, Heal, SelfHeal split
2017-03-17 21:12:10 +01:00
C. Helmig
b331065b87 Add the missing d2k tiles for the MP maps 2017-03-17 20:00:25 +01:00
abcdefg30
80f4feeab3 Let the map importer account for duplicate tiles 2017-03-17 20:00:18 +01:00
abcdefg30
a6078b6e46 Add missing templates to arrakis.yaml 2017-03-17 19:58:32 +01:00
Jean-Rémy Buchs
fbd3a2efea Load debug symbols (.mdb on mono only; .pdb on .NET only) for mods if they are present 2017-03-16 17:22:59 +01:00
rob-v
f38c5f3380 Sort 'Playing' games in the lobby by play time. #12959 2017-03-16 17:17:35 +01:00
atlimit8
abad50d2b9 MiniYaml upgrade rule for UncloakOn: Damage => Damage, Heal, SelfHeal 2017-03-15 20:26:08 -05:00
atlimit8
cca7eda530 Restore CloakOn: Heal behavior in mods via MiniYaml changes. 2017-03-15 20:26:08 -05:00
atlimit8
d3e4720507 Added UncloakOn: SelfHeal (not overlapping with Heal). 2017-03-15 20:26:05 -05:00
atlimit8
aa8c434668 Make Repair activity host actor the attacker for repairs. 2017-03-15 20:25:12 -05:00
atlimit8
8e7de1a4fa Make UncloakOn Damage check sign with added Heal value for UncloakOn. 2017-03-15 20:25:08 -05:00
rob-v
e766c6f342 Global chat name is reset when connecting #12325
removed TrySetNickname(Game.Settings.Player.Name) in GlobalChat ctor overwriting Chat.Nickname. instead of removing, it could be replaced by TrySetNickname(Game.Settings.Chat.Nickname)
2017-03-15 23:53:43 +01:00
Paul Chote
34a37421f6 Allow specific mods to be launched from VS/MD gui. 2017-03-15 22:01:01 +00:00
abcdefg30
eb77c57ac3 Merge pull request #12968 from SoScared/DualColdFrontReverse
[RA] Map Pool - Reverse alteration of Dual Cold Front
2017-03-15 22:16:08 +01:00
abcdefg30
bbc08627ac Merge pull request #12970 from SoScared/WallTweak
[RA] [Balance] Tweak price/production of S.Bags/Fence/Walls
2017-03-15 22:00:48 +01:00
Paul Chote
67144fe66b Merge pull request #12842 from abc013/Allies06SubFix
Allies 06a: Make the AI only build submarines if the player has a shipyard
2017-03-15 20:12:18 +00:00
Paul Chote
395d31b249 Merge pull request #12967 from SoScared/ReverseFriendlyMines
Reverse making friendly units aware of friendly mines.
2017-03-15 19:58:57 +00:00
SoScared
e0985162a0 Double price/production of S.Bags/Fence/Walls 2017-03-15 16:55:29 +01:00
SoScared
681dcc81a1 Reverse alteration of Dual Cold Front 2017-03-15 00:26:16 +01:00
SoScared
33bcdb10ba Reverse making friendly units aware of friendly mines. 2017-03-14 20:46:19 +01:00
abc013
046427beea Polished the mission objectives in allies06a 2017-03-14 19:29:40 +01:00
abc013
db4554acec Make the AI only build submarines if the player has a shipyard 2017-03-14 17:31:03 +01:00
abcdefg30
3aeddbf9bd Merge pull request #12953 from MustaphaTR/d2k-add-stealth-detection-to-turrets
D2K - Make defences detect Cloak
2017-03-14 15:48:56 +01:00
reaperrr
4c32803c16 Merge pull request #12945 from MustaphaTR/add-noozes-1-tile-cliffs
RA/TD - Add 1 Tile Cliffs by Nooze
2017-03-13 19:59:51 +01:00
Mustafa Alperen Seki
4f0e317371 Add Nooze's 1 Tile Cliffs to TD 2017-03-13 17:20:05 +02:00
Mustafa Alperen Seki
ab6b7c8551 Add Nooze's 1 Tile Cliffs to RA 2017-03-13 17:19:46 +02:00
reaperrr
d138a05baf Merge pull request #12946 from pchote/fix-serverquery-crash
Fix crash when master server query returns unexpected data.
2017-03-12 18:44:06 +01:00
Mustafa Alperen Seki
dcf1cfe118 Make defences detect cloak. 2017-03-12 16:04:51 +02:00
atlimit8
fbc850a73f Prevent duplicate upgrades (plugs) to GDI Upgrade Center 2017-03-12 03:43:42 -05:00
atlimit8
08a71795d1 PluggableInfo.Requirements entry overrides in-use check now to allow swapping. 2017-03-12 03:43:42 -05:00
atlimit8
daf4eb812c Added ConditionExpression Requirements for plugs to Pluggable 2017-03-12 03:43:35 -05:00
Oliver Brakmann
63ee126898 Merge pull request #12947 from pchote/fix-obelisk-targeting
Fix obelisk targeting.
2017-03-11 22:28:42 +01:00
reaperrr
0847cb9d31 Merge pull request #12951 from SoScared/fixGapEffect_vs_Airplanes
Fix RevealsShroud@GAPGEN vs MiG/YAK
2017-03-11 17:58:20 +01:00
SoScared
daeba01bc1 fixed RevealsShroud@GAPGEN vs MiG/YAK 2017-03-11 13:44:44 +01:00
Paul Chote
c45634ed8d Merge pull request #12941 from forcecore/ai_ref_placement
HackyAI now builds refinery near ore.
2017-03-11 12:40:48 +00:00
Paul Chote
f3cfe24e11 Merge pull request #12942 from SoScared/mapswap5
[RA] Add/remove official maps 5.
2017-03-11 11:56:47 +00:00
Paul Chote
a3030aa074 Merge pull request #12933 from SoScared/mapswap4
[RA] Add/remove official maps 4.
2017-03-11 11:41:48 +00:00
reaperrr
d86ff6696a Merge pull request #12887 from MustaphaTR/ra-make-turkish-flag-outline-blue
Change Turkish Flag outline to Blue
2017-03-10 22:19:43 +01:00
reaperrr
da2330a116 Merge pull request #12935 from pchote/td-map-tweaks
Update TD playtest maps
2017-03-10 21:22:57 +01:00
Paul Chote
4d2563cc11 Remove unnecessary AttackTesla : AttackOmni subclass. 2017-03-10 19:42:18 +00:00
Paul Chote
a9cfbd9ad7 Fix Obelisk not dropping targets when they move out of range. 2017-03-10 19:42:15 +00:00
Paul Chote
00b1bc7cd2 Fix crash when master server query returns unexpected data. 2017-03-10 18:38:35 +00:00
SoScared
2f48e67e6d final 6p plus map pool alteration 2017-03-09 18:24:31 +01:00
Forcecore
7588d6708b HackyAI now builds refinery near ore. 2017-03-09 09:42:56 -06:00
abcdefg30
5e737980fe Merge pull request #12910 from pchote/fix-bogus-enumeration-issue
Fix spurious warnings when the support mods dir doesn't exist.
2017-03-09 09:19:55 +01:00
SoScared
73698c2ecb final 2-4 player map alteration 2017-03-08 23:51:03 +01:00
Paul Chote
f6b11bb662 Remove TD map Vectors of Battle (10p). 2017-03-08 22:06:16 +00:00
Paul Chote
e055db94ab Update TD map Order of Battle. 2017-03-08 22:05:50 +00:00
Paul Chote
82d5979eb1 Update TD map Axis of Advance. 2017-03-08 22:05:39 +00:00
Oliver Brakmann
3499325f23 Merge pull request #12921 from reaperrr/ts-economy
Fix TS economy to match original
2017-03-08 22:19:30 +01:00
Oliver Brakmann
439a4a70d4 Merge pull request #12908 from reaperrr/polish-poseidon
Polish Morbid Aimless Poseidon
2017-03-08 22:03:44 +01:00
Jean-Rémy Buchs
28cd480225 Load debug symbols (.mdb on mono only; .pdb) for mods if they are present 2017-03-08 20:11:41 +01:00
Jean-Rémy Buchs
f999001caf Load debug symbols (.mdb on mono only; .pdb) for mods if they are present 2017-03-07 18:30:08 +01:00
abcdefg30
c87e1c789a Merge pull request #12920 from reaperrr/fix-spy-atk
Fix RA Spy attack sequence
2017-03-06 22:40:35 +01:00
reaperrr
386e5b3772 Limit TS AI silos to 2
The up to 4 refineries already provide a total of 8000 credits storage, 2 silos for additional 3000 should be more than the AI will likely ever need.
2017-03-06 04:00:38 +01:00
reaperrr
1d636082a3 Fix TS harvester load, unload and movement speed
Matching original.
2017-03-06 03:55:22 +01:00
reaperrr
a40639c559 Fix TS tiberium values
25 for green, 40 for blue (Vinifera). Alternate blue tib (Aboreus) with value 30 might be added later.
2017-03-06 03:54:25 +01:00
reaperrr
062eef37f4 Fix TS silo storage pip color 2017-03-06 03:52:59 +01:00
reaperrr
d7a49daae8 Fix TS refinery storage capacity to match original 2017-03-06 03:52:37 +01:00
reaperrr
e57fd37697 Fix RA Spy attack sequence 2017-03-06 02:30:48 +01:00
Paul Chote
407ecbc397 Fix spurious warnings when the support mods dir doesn't exist. 2017-03-05 19:13:07 +00:00
reaperrr
e25cb2914f Polish Morbid Aimless Poseidon
A lot of the cliffs, in particular "north-facing" ones, only reptitively used a single variant, and in some cases the one that should only be used for the "left ending" of a cliff. I fixed the latter and added variation to the former cases.
2017-03-05 17:07:11 +01:00
reaperrr
120efcedaa Merge pull request #12859 from abcdefg30/supportPrereqs
Fix support powers not being enabled by cheats
2017-03-05 16:27:43 +01:00
reaperrr
efcaa86db6 Merge pull request #12889 from Mailaender/bye
Removed myself from the active developer list
2017-03-05 15:32:14 +01:00
Jean-Rémy Buchs
a0598d2b9c Load debug symbols (.mdb .pdb) for mods if they are present 2017-03-04 17:37:40 +01:00
Jean-Rémy Buchs
19616c059c Load debug symbols for mods if they are present 2017-03-04 14:20:16 +01:00
Matthias Mailänder
06c7dad50e Move myself to previous developers. 2017-03-04 12:56:34 +01:00
Jean-Rémy Buchs
d3491c2979 Load debug symbols for mods if they are loaded from the filesystem 2017-03-04 12:38:07 +01:00
Mustafa Alperen Seki
7ad63bd3c7 Change Turkish Flag outline to Blue. 2017-03-04 08:54:18 +02:00
abcdefg30
8b7797326a Revise CaptureOrderTargeter a tiny bit 2017-02-27 00:28:18 +01:00
abcdefg30
e318c028ba Fix support powers not being enabled by cheats 2017-02-25 16:57:30 +01:00
1070 changed files with 35387 additions and 12074 deletions

4
.gitignore vendored
View File

@@ -11,6 +11,7 @@ obj
*.CodeAnalysisLog.xml
*.lastcodeanalysissucceeded
_ReSharper.*/
/.vs
# movies
*.vqa
@@ -61,6 +62,7 @@ OpenRA.Launcher.Mac/OpenRA.xcodeproj/*.mode1v3
# auto-generated documentation
DOCUMENTATION.md
WEAPONS.md
Lua-API.md
*.html
openra.6
@@ -79,3 +81,5 @@ StyleCopViolations.xml
# Support directory
/Support
/da/Microsoft.Build.Utilities.v3.5.resources.dll
/da

View File

@@ -19,6 +19,11 @@ addons:
- nsis-common
- dpkg
- markdown
- zlib1g-dev
- libbz2-dev
- cmake
- genisoimage
- fakeroot
# Environment variables
env:
@@ -39,7 +44,7 @@ script:
# Automatically update the trait documentation and Lua API
after_success:
- test $TRAVIS_PULL_REQUEST == "false" && make docs && cd packaging && ./update-wiki.sh $TRAVIS_BRANCH; cd ..
- test $TRAVIS_PULL_REQUEST == "false" && cd packaging && ./update-wiki.sh $TRAVIS_BRANCH; cd ..
# Only watch the development branch and tagged release.
branches:
@@ -72,7 +77,7 @@ deploy:
secure: "g/LU11f+mjqv+lj0sR1UliHwogXL4ofJUwoG5Dbqlvdf5UTLWytw/OWSCv8RGyuh10miyWeaoqHh1cn2C1IFhUEqN1sSeKKKOWOTvJ2FR5mzi9uH3d/MOBzG5icQ7Qh0fZ1YPz5RaJJhYu6bmfvA/1gD49GoaX2kxQL4J5cEBgg="
file:
- build/OpenRA-${TRAVIS_TAG}.exe
- build/OpenRA-${TRAVIS_TAG}.zip
- build/OpenRA-${TRAVIS_TAG}.dmg
- build/openra_${DOTVERSION}_all.deb
skip_cleanup: true
on:

View File

@@ -5,7 +5,6 @@ The OpenRA developers are:
* Chris Forbes (chrisf)
* Igor Popov (ihptru)
* Lukas Franke (abcdefg30)
* Matthias Mailänder (Mailaender)
* Oliver Brakmann (obrakmann)
* Paul Chote (pchote)
* Reaperrr
@@ -16,6 +15,7 @@ Previous developers included:
* Caleb Anderson (RobotCaleb)
* Curtis Shmyr (hamb)
* Daniel Hernandez (Mancano)
* Matthias Mailänder (Mailaender)
* Megan Bowra-Dean (beedee)
* Mike Bundy (kehaar)
* Pavel Penev (penev92)
@@ -89,6 +89,7 @@ Also thanks to:
* Lesueur Benjamin (Valkirie)
* Maarten Meuris (Nyerguds)
* Mark Olson (markolson)
* Markus Hartung (hartmark)
* Matija Hustic (matija-hustic)
* Matthew Gatland (mgatland)
* Matthew Uzzell (MUzzell)
@@ -170,6 +171,8 @@ Krueger and distributed under the GNU GPL terms.
Using SmartIrc4Net developed by Mirco Bauer
distributed under the LGPL version 2.1 or later.
Using rix0rrr.BeaconLib developed by Rico Huijbers
distributed under MIT License.
Finally, special thanks goes to the original teams
at Westwood Studios and EA for creating the classic

View File

@@ -29,7 +29,7 @@ To compile OpenRA, run `make all` from the command line.
Run with either `launch-game.sh` or `mono --debug OpenRA.Game.exe`.
Type `sudo make install-all` for system wide installation. Run `make install-linux-shortcuts` to get startup scripts, icons and desktop files. You can then run from the `openra` shortcut.
Type `sudo make install` for system wide installation. Run `make install-linux-shortcuts` to get startup scripts, icons and desktop files. You can then run from the `openra` shortcut.
Debian/Ubuntu
-------------

256
Makefile
View File

@@ -3,9 +3,6 @@
# to compile, run:
# make [DEBUG=false]
#
# to compile with development tools, run:
# make all [DEBUG=false]
#
# 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>]
# Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths
@@ -17,18 +14,16 @@
# to check the official mod dlls for StyleCop violations, run:
# make check
#
# to generate documentation aimed at modders, run:
# make docs
#
# to install, run:
# make [prefix=/foo] [bindir=/bar/bin] install
#
# to install with development tools, run:
# make [prefix=/foo] [bindir=/bar/bin] install-all
#
# to install Linux startup scripts, desktop files and icons:
# make install-linux-shortcuts [DEBUG=false]
#
# to install the engine and common mod files (omitting the default mods):
# make install-engine
# make install-common-mod-files
#
# to uninstall, run:
# make uninstall
#
@@ -46,7 +41,7 @@ SDK ?=
CSC = mcs $(SDK)
CSFLAGS = -nologo -warn:4 -codepage:utf8 -unsafe -warnaserror
DEFINE = TRACE
COMMON_LIBS = System.dll System.Core.dll System.Data.dll System.Data.DataSetExtensions.dll System.Drawing.dll System.Xml.dll thirdparty/download/ICSharpCode.SharpZipLib.dll thirdparty/download/FuzzyLogicLibrary.dll thirdparty/download/MaxMind.Db.dll thirdparty/download/Eluant.dll thirdparty/download/SmarIrc4net.dll
COMMON_LIBS = System.dll System.Core.dll System.Data.dll System.Data.DataSetExtensions.dll System.Drawing.dll System.Xml.dll thirdparty/download/ICSharpCode.SharpZipLib.dll thirdparty/download/FuzzyLogicLibrary.dll thirdparty/download/MaxMind.Db.dll thirdparty/download/Eluant.dll thirdparty/download/SmarIrc4net.dll thirdparty/download/rix0rrr.BeaconLib.dll
NUNIT_LIBS_PATH :=
NUNIT_LIBS := $(NUNIT_LIBS_PATH)nunit.framework.dll
@@ -88,7 +83,6 @@ INSTALL_DATA = $(INSTALL) -m644
# program targets
CORE = pdefault game utility server
TOOLS = gamemonitor
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
# dependencies
@@ -109,7 +103,6 @@ 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
game_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico
PROGRAMS += game
game: $(game_TARGET)
@@ -127,7 +120,7 @@ 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) thirdparty/download/StyleCop.dll thirdparty/download/StyleCop.CSharp.dll thirdparty/download/StyleCop.CSharp.Rules.dll
mod_common_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS)
PROGRAMS += mod_common
mod_common: $(mod_common_TARGET)
@@ -170,37 +163,34 @@ check-scripts:
@luac -p $(shell find mods/*/maps/* -iname '*.lua')
@luac -p $(shell find lua/* -iname '*.lua')
check: utility mods
check: utility stylecheck mods
@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.Utility.exe ra --check-code-style OpenRA.Game
@mono --debug OpenRA.StyleCheck.exe OpenRA.Game
@echo
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
@echo
@echo "Checking for code style violations in OpenRA.GameMonitor..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor
@mono --debug OpenRA.StyleCheck.exe OpenRA.Platforms.Default
@echo
@echo "Checking for code style violations in OpenRA.Mods.Common..."
@mono --debug OpenRA.Utility.exe ra --check-code-style 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.Utility.exe ra --check-code-style 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.Utility.exe ra --check-code-style OpenRA.Mods.D2k
@mono --debug OpenRA.StyleCheck.exe OpenRA.Mods.D2k
@echo
@echo "Checking for code style violations in OpenRA.Utility..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Utility
@mono --debug OpenRA.StyleCheck.exe OpenRA.Utility
@echo
@echo "Checking for code style violations in OpenRA.Test..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Test
@mono --debug OpenRA.StyleCheck.exe OpenRA.Test
@echo
@echo "Checking for code style violations in OpenRA.Server..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Server
@mono --debug OpenRA.StyleCheck.exe OpenRA.Server
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)
@@ -238,16 +228,6 @@ test: utility mods
##### Launchers / Utilities #####
gamemonitor_SRCS := $(shell find OpenRA.GameMonitor/ -iname '*.cs')
gamemonitor_TARGET = OpenRA.exe
gamemonitor_KIND = winexe
gamemonitor_DEPS = $(game_TARGET)
gamemonitor_LIBS = $(COMMON_LIBS) $(gamemonitor_DEPS) System.Windows.Forms.dll
gamemonitor_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico
PROGRAMS += gamemonitor
gamemonitor: $(gamemonitor_TARGET)
# Backend for the launcher apps - queries game/mod info and applies actions to an install
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
utility_TARGET = OpenRA.Utility.exe
utility_KIND = exe
@@ -256,6 +236,13 @@ utility_LIBS = $(COMMON_LIBS) $(utility_DEPS) thirdparty/download/ICSharpCode.Sh
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
@@ -297,13 +284,9 @@ default: core
core: dependencies game platforms mods utility server
tools: gamemonitor
package: all-dependencies core tools docs version
mods: mod_common mod_cnc mod_d2k
all: dependencies core tools
all: dependencies core stylecheck
clean:
@-$(RM_F) *.exe *.dll *.dylib *.dll.config ./OpenRA*/*.dll ./OpenRA*/*.mdb *.mdb mods/**/*.dll mods/**/*.mdb *.resources
@@ -317,62 +300,49 @@ cli-dependencies:
@ $(CP_R) thirdparty/download/*.dll .
@ $(CP_R) thirdparty/download/*.dll.config .
linux-dependencies: cli-dependencies linux-native-dependencies
linux-dependencies: cli-dependencies geoip-dependencies linux-native-dependencies
linux-native-dependencies:
@./thirdparty/configure-native-deps.sh
windows-dependencies:
windows-dependencies: cli-dependencies geoip-dependencies
@./thirdparty/fetch-thirdparty-deps-windows.sh
osx-dependencies: cli-dependencies
osx-dependencies: cli-dependencies geoip-dependencies
@./thirdparty/fetch-thirdparty-deps-osx.sh
@ $(CP_R) thirdparty/download/osx/*.dylib .
@ $(CP_R) thirdparty/download/osx/*.dll.config .
dependencies: $(os-dependencies)
geoip-dependencies:
@./thirdparty/fetch-geoip-db.sh
@ $(CP) thirdparty/download/GeoLite2-Country.mmdb.gz .
all-dependencies: cli-dependencies windows-dependencies osx-dependencies
dependencies: $(os-dependencies)
version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modchooser/mod.yaml mods/all/mod.yaml
all-dependencies: cli-dependencies windows-dependencies osx-dependencies geoip-dependencies
version: VERSION mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml
@echo "$(VERSION)" > VERSION
@for i in $? ; do \
awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $${i} > $${i}.tmp && \
awk '{sub("\tmodchooser:.*$$","\tmodchooser: $(VERSION)"); print $0}' $${i}.tmp > $${i}.tmp2 && \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp2 > $${i} && \
rm $${i}.tmp $${i}.tmp2; \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp > $${i} && \
rm $${i}.tmp; \
done
docs: utility mods version
@mono --debug OpenRA.Utility.exe all --docs > DOCUMENTATION.md
@mono --debug OpenRA.Utility.exe all --lua-docs > Lua-API.md
man-page: utility mods
@mono --debug OpenRA.Utility.exe all --man-page > openra.6
install: install-core
install-all: install-core install-tools
install: default install-core
install-linux-shortcuts: install-linux-scripts install-linux-icons install-linux-desktop
install-core: default
@-echo "Installing OpenRA to $(DATA_INSTALL_DIR)"
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_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"
@$(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"
@$(CP_R) mods/modchooser "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
@$(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"
@$(INSTALL_DATA) COPYING "$(DATA_INSTALL_DIR)/COPYING"
@@ -388,15 +358,27 @@ install-core: default
@$(INSTALL_PROGRAM) Open.Nat.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) MaxMind.Db.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) SmarIrc4net.dll "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) rix0rrr.BeaconLib.dll "$(DATA_INSTALL_DIR)"
ifneq ($(UNAME_S),Darwin)
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_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
install-default-mods:
@-echo "Installing OpenRA default mods to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)/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"
@$(CP_R) mods/modcontent "$(DATA_INSTALL_DIR)/mods/"
install-core: install-engine install-common-mod-files install-default-mods
@$(CP) *.sh "$(DATA_INSTALL_DIR)"
endif
install-tools: tools
@-echo "Installing OpenRA tools to $(DATA_INSTALL_DIR)"
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
@$(INSTALL_PROGRAM) $(foreach prog,$(TOOLS),$($(prog)_TARGET)) "$(DATA_INSTALL_DIR)"
install-linux-icons:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/icons/"
@@ -404,70 +386,101 @@ install-linux-icons:
install-linux-desktop:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/ra/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Red Alert/g' > packaging/linux/openra-ra.desktop
@$(INSTALL_DATA) packaging/linux/openra-ra.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/cnc/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Tiberian Dawn/g' > packaging/linux/openra-cnc.desktop
@$(INSTALL_DATA) packaging/linux/openra-cnc.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/d2k/g' packaging/linux/openra.desktop.in | sed 's/{MODNAME}/Dune 2000/g' > packaging/linux/openra-d2k.desktop
@$(INSTALL_DATA) packaging/linux/openra-d2k.desktop "$(DESTDIR)$(datadir)/applications"
@-$(RM) packaging/linux/openra-ra.desktop packaging/linux/openra-cnc.desktop packaging/linux/openra-d2k.desktop
install-linux-mime:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/mime/packages/"
@sed 's/{MOD}/ra/g' packaging/linux/openra-mimeinfo.xml.in | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-mimeinfo.xml
@$(INSTALL_DATA) packaging/linux/openra-mimeinfo.xml "$(DESTDIR)$(datadir)/mime/packages/openra.xml"
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-replays.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-launch-mod.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/ra/g' packaging/linux/openra-join-servers.desktop.in | sed 's/{MODNAME}/Red Alert/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-ra-join-servers.desktop
@$(INSTALL_DATA) packaging/linux/openra-ra-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/cnc/g' packaging/linux/openra-join-servers.desktop.in | sed 's/{MODNAME}/Tiberian Dawn/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-cnc-join-servers.desktop
@$(INSTALL_DATA) packaging/linux/openra-cnc-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@sed 's/{MOD}/d2k/g' packaging/linux/openra-join-servers.desktop.in | sed 's/{MODNAME}/Dune 2000/g' | sed 's/{TAG}/$(VERSION)/g' > packaging/linux/openra-d2k-join-servers.desktop
@$(INSTALL_DATA) packaging/linux/openra-d2k-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@-$(RM) packaging/linux/openra-mimeinfo.xml packaging/linux/openra-ra-join-servers.desktop packaging/linux/openra-cnc-join-servers.desktop packaging/linux/openra-d2k-join-servers.desktop
install-linux-appdata:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/appdata/"
@$(INSTALL_DATA) packaging/linux/openra.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MOD}/ra/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Red Alert/g' | sed 's/{SCREENSHOT_RA}/ type="default"/g' | sed 's/{SCREENSHOT_CNC}//g' | sed 's/{SCREENSHOT_D2K}//g'> packaging/linux/openra-ra.appdata.xml
@$(INSTALL_DATA) packaging/linux/openra-ra.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MOD}/cnc/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Tiberian Dawn/g' | sed 's/{SCREENSHOT_RA}//g' | sed 's/{SCREENSHOT_CNC}/ type="default"/g' | sed 's/{SCREENSHOT_D2K}//g'> packaging/linux/openra-cnc.appdata.xml
@$(INSTALL_DATA) packaging/linux/openra-cnc.appdata.xml "$(DESTDIR)$(datadir)/appdata/"
@sed 's/{MOD}/d2k/g' packaging/linux/openra.appdata.xml.in | sed 's/{MOD_NAME}/Dune 2000/g' | sed 's/{SCREENSHOT_RA}//g' | sed 's/{SCREENSHOT_CNC}//g' | sed 's/{SCREENSHOT_D2K}/ type="default"/g'> packaging/linux/openra-d2k.appdata.xml
@$(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_DIR) "$(DESTDIR)$(mandir)/man6/"
@$(INSTALL_DATA) openra.6 "$(DESTDIR)$(mandir)/man6/"
install-linux-scripts:
@echo "#!/bin/sh" > openra
@echo 'cd "$(gameinstalldir)"' >> openra
# Note: this relies on the non-standard -f flag implemented by gnu readlink
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
@echo 'mono OpenRA.Game.exe Engine.LaunchPath="$$(readlink -f $$0)" "$$@"' >> openra
@sed 's/{DEBUG}//' packaging/linux/openra.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra.debug.in
@sed 's/{DEBUG}//' packaging/linux/openra-server.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra-server.debug.in
else
@echo 'mono --debug OpenRA.Game.exe Engine.LaunchPath="$$(readlink -f $$0)" "$$@"' >> openra
endif
@echo 'if [ $$? != 0 -a $$? != 1 ]' >> openra
@echo 'then' >> openra
@echo 'ZENITY=`which zenity` || echo "OpenRA needs zenity installed to display a graphical error dialog. See ~/.openra. for log files."' >> openra
@echo '$$ZENITY --question --title "OpenRA" --text "OpenRA has encountered a fatal error.\nLog Files are available in ~/.openra." --ok-label "Quit" --cancel-label "View FAQ" || xdg-open https://github.com/OpenRA/OpenRA/wiki/FAQ' >> openra
@echo 'exit 1' >> openra
@echo 'fi' >> openra
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx openra "$(BIN_INSTALL_DIR)"
@-$(RM) openra
@echo "#!/bin/sh" > openra-server
@echo 'cd "$(gameinstalldir)"' >> openra-server
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
@echo 'mono OpenRA.Server.exe "$$@"' >> openra-server
else
@echo 'mono --debug OpenRA.Server.exe "$$@"' >> openra-server
@sed 's/{DEBUG}/--debug/' packaging/linux/openra.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra.debug.in
@sed 's/{DEBUG}/--debug/' packaging/linux/openra-server.in | sed 's|{GAME_INSTALL_DIR}|$(gameinstalldir)|' | sed 's|{BIN_DIR}|$(bindir)|' > packaging/linux/openra-server.debug.in
endif
@sed 's/{MOD}/ra/g' packaging/linux/openra.debug.in | sed 's/{MODNAME}/Red Alert/g' > packaging/linux/openra-ra
@sed 's/{MOD}/cnc/g' packaging/linux/openra.debug.in | sed 's/{MODNAME}/Tiberian Dawn/g' > packaging/linux/openra-cnc
@sed 's/{MOD}/d2k/g' packaging/linux/openra.debug.in | sed 's/{MODNAME}/Dune 2000/g' > packaging/linux/openra-d2k
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx openra-server "$(BIN_INSTALL_DIR)"
@-$(RM) openra-server
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-ra "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-cnc "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-d2k "$(BIN_INSTALL_DIR)"
@-$(RM) packaging/linux/openra-ra packaging/linux/openra-cnc packaging/linux/openra-d2k packaging/linux/openra.debug.in
@sed 's/{MOD}/ra/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Red Alert/g' > packaging/linux/openra-ra-server
@sed 's/{MOD}/cnc/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Tiberian Dawn/g' > packaging/linux/openra-cnc-server
@sed 's/{MOD}/d2k/g' packaging/linux/openra-server.debug.in | sed 's/{MODNAME}/Dune 2000/g' > packaging/linux/openra-d2k-server
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-ra-server "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-cnc-server "$(BIN_INSTALL_DIR)"
@$(INSTALL_PROGRAM) -m +rx packaging/linux/openra-d2k-server "$(BIN_INSTALL_DIR)"
@-$(RM) packaging/linux/openra-ra-server packaging/linux/openra-cnc-server packaging/linux/openra-d2k-server packaging/linux/openra-server.debug.in
uninstall:
@-$(RM_R) "$(DATA_INSTALL_DIR)"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-server"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-join-servers.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-launch-mod.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-join-servers.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/openra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/64x64/apps/openra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/128x128/apps/openra.png"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-ra"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-ra-server"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-cnc"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-cnc-server"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-d2k"
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-d2k-server"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-ra.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-cnc.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-d2k.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-ra-join-servers.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-cnc-join-servers.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra-d2k-join-servers.desktop"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra-ra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra-ra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/openra-ra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/64x64/apps/openra-ra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/128x128/apps/openra-ra.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra-cnc.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra-cnc.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/openra-cnc.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/64x64/apps/openra-cnc.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/128x128/apps/openra-cnc.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra-d2k.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra-d2k.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/openra-d2k.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/64x64/apps/openra-d2k.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/128x128/apps/openra-d2k.png"
@-$(RM_F) "$(DESTDIR)$(datadir)/mime/packages/openra.xml"
@-$(RM_F) "$(DESTDIR)$(datadir)/appdata/openra.appdata.xml"
@-$(RM_F) "$(DESTDIR)$(mandir)/man6/openra.6"
@@ -476,9 +489,6 @@ help:
@echo 'to compile, run:'
@echo ' make [DEBUG=false]'
@echo
@echo 'to compile with development tools, run:'
@echo ' make all [DEBUG=false]'
@echo
@echo 'to check unit tests (requires NUnit version >= 2.6), run:'
@echo ' make nunit [NUNIT_CONSOLE=<path-to/nunit[3|2]-console>] [NUNIT_LIBS_PATH=<path-to-libs-dir>] [NUNIT_LIBS=<nunit-libs>]'
@echo ' Use NUNIT_CONSOLE if nunit[3|2]-console was not downloaded by `make dependencies` nor is it in bin search paths'
@@ -488,15 +498,9 @@ help:
@echo 'to check the official mods for erroneous yaml files, run:'
@echo ' make test'
@echo
@echo 'to generate documentation aimed at modders, run:'
@echo ' make docs'
@echo
@echo 'to install, run:'
@echo ' make [prefix=/foo] [bindir=/bar/bin] install'
@echo
@echo 'to install with development tools, run:'
@echo ' make [prefix=/foo] [bindir=/bar/bin] install-all'
@echo
@echo 'to install Linux startup scripts, desktop files and icons'
@echo ' make install-linux-shortcuts [DEBUG=false]'
@echo
@@ -515,4 +519,4 @@ help:
.SUFFIXES:
.PHONY: core tools package all mods clean distclean dependencies version $(PROGRAMS) nunit
.PHONY: core package all mods clean distclean dependencies version $(PROGRAMS) nunit

View File

@@ -200,7 +200,7 @@ namespace OpenRA.Activities
/// </summary>
protected virtual void OnLastRun(Actor self) { }
public virtual bool Cancel(Actor self)
public virtual bool Cancel(Actor self, bool keepQueue = false)
{
if (!IsInterruptible)
return false;
@@ -208,9 +208,11 @@ namespace OpenRA.Activities
if (ChildActivity != null && !ChildActivity.Cancel(self))
return false;
State = ActivityState.Canceled;
NextActivity = null;
if (!keepQueue)
NextActivity = null;
ChildActivity = null;
State = ActivityState.Canceled;
return true;
}

View File

@@ -45,7 +45,6 @@ namespace OpenRA
public Activity CurrentActivity { get; private set; }
public Group Group;
public int Generation;
public Rectangle Bounds { get; private set; }

View File

@@ -16,10 +16,12 @@ using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA
{
[Flags]
enum ModRegistration { User = 1, System = 2 }
public class ExternalMod
{
public readonly string Id;
@@ -38,38 +40,37 @@ namespace OpenRA
{
readonly Dictionary<string, ExternalMod> mods = new Dictionary<string, ExternalMod>();
readonly SheetBuilder sheetBuilder;
readonly string launchPath;
public ExternalMods(string launchPath)
public ExternalMods()
{
// Process.Start requires paths to not be quoted, even if they contain spaces
if (launchPath.First() == '"' && launchPath.Last() == '"')
launchPath = launchPath.Substring(1, launchPath.Length - 2);
this.launchPath = launchPath;
sheetBuilder = new SheetBuilder(SheetType.BGRA, 256);
// Load registered mods
var supportPath = Platform.ResolvePath(Path.Combine("^", "ModMetadata"));
if (!Directory.Exists(supportPath))
return;
foreach (var path in Directory.GetFiles(supportPath, "*.yaml"))
// If the player has defined a local support directory (in the game directory)
// then this will override both the regular and system support dirs
var sources = new[] { Platform.SystemSupportDir, Platform.SupportDir };
foreach (var source in sources.Distinct())
{
try
var metadataPath = Path.Combine(source, "ModMetadata");
if (!Directory.Exists(metadataPath))
continue;
foreach (var path in Directory.GetFiles(metadataPath, "*.yaml"))
{
var yaml = MiniYaml.FromStream(File.OpenRead(path), path).First().Value;
LoadMod(yaml);
}
catch (Exception e)
{
Log.Write("debug", "Failed to parse mod metadata file '{0}'", path);
Log.Write("debug", e.ToString());
try
{
var yaml = MiniYaml.FromStream(File.OpenRead(path), path).First().Value;
LoadMod(yaml, path);
}
catch (Exception e)
{
Log.Write("debug", "Failed to parse mod metadata file '{0}'", path);
Log.Write("debug", e.ToString());
}
}
}
}
void LoadMod(MiniYaml yaml)
void LoadMod(MiniYaml yaml, string path = null)
{
var mod = FieldLoader.Load<ExternalMod>(yaml);
var iconNode = yaml.Nodes.FirstOrDefault(n => n.Key == "Icon");
@@ -80,10 +81,13 @@ namespace OpenRA
mod.Icon = sheetBuilder.Add(bitmap);
}
mods.Add(ExternalMod.MakeKey(mod), mod);
// Avoid possibly overwriting a valid mod with an obviously bogus one
var key = ExternalMod.MakeKey(mod);
if (File.Exists(mod.LaunchPath) && (path == null || Path.GetFileNameWithoutExtension(path) == key))
mods[key] = mod;
}
internal void Register(Manifest mod)
internal void Register(Manifest mod, string launchPath, ModRegistration registration)
{
if (mod.Metadata.Hidden)
return;
@@ -107,41 +111,87 @@ namespace OpenRA
}))
};
var supportPath = Platform.ResolvePath(Path.Combine("^", "ModMetadata"));
var sources = new List<string>();
if (registration.HasFlag(ModRegistration.System))
sources.Add(Platform.SystemSupportDir);
try
{
// Make sure the mod is available for this session, even if saving it fails
LoadMod(yaml.First().Value);
if (registration.HasFlag(ModRegistration.User))
sources.Add(Platform.SupportDir);
Directory.CreateDirectory(supportPath);
File.WriteAllLines(Path.Combine(supportPath, key + ".yaml"), yaml.ToLines(false).ToArray());
}
catch (Exception e)
{
Log.Write("debug", "Failed to register currrent mod metadata");
Log.Write("debug", e.ToString());
}
// Make sure the mod is available for this session, even if saving it fails
LoadMod(yaml.First().Value);
// Clean up stale mod registrations:
// - LaunchPath no longer exists (uninstalled)
// - LaunchPath and mod match the current mod, but version differs (newer version installed on top)
List<string> toRemove = null;
foreach (var kv in mods)
foreach (var source in sources.Distinct())
{
var k = kv.Key;
var m = kv.Value;
if (!File.Exists(m.LaunchPath) || (m.LaunchPath == launchPath && m.Id == mod.Id && k != key))
if (!Directory.Exists(source))
continue;
var metadataPath = Path.Combine(source, "ModMetadata");
try
{
Log.Write("debug", "Removing stale mod metadata entry '{0}'", k);
if (toRemove == null)
toRemove = new List<string>();
Directory.CreateDirectory(metadataPath);
File.WriteAllLines(Path.Combine(metadataPath, key + ".yaml"), yaml.ToLines(false).ToArray());
}
catch (Exception e)
{
Log.Write("debug", "Failed to register current mod metadata");
Log.Write("debug", e.ToString());
}
}
}
toRemove.Add(k);
var path = Path.Combine(supportPath, k + ".yaml");
/// <summary>
/// Removes invalid mod registrations:
/// * LaunchPath no longer exists
/// * LaunchPath and mod id matches the active mod, but the version is different
/// * Filename doesn't match internal key
/// * Fails to parse as a mod registration
/// </summary>
internal void ClearInvalidRegistrations(ExternalMod activeMod, ModRegistration registration)
{
var sources = new List<string>();
if (registration.HasFlag(ModRegistration.System))
sources.Add(Platform.SystemSupportDir);
if (registration.HasFlag(ModRegistration.User))
sources.Add(Platform.SupportDir);
foreach (var source in sources.Distinct())
{
var metadataPath = Path.Combine(source, "ModMetadata");
if (!Directory.Exists(metadataPath))
continue;
foreach (var path in Directory.GetFiles(metadataPath, "*.yaml"))
{
string modKey = null;
try
{
var yaml = MiniYaml.FromStream(File.OpenRead(path), path).First().Value;
var m = FieldLoader.Load<ExternalMod>(yaml);
modKey = ExternalMod.MakeKey(m);
// Continue to the next entry if this one is valid
if (File.Exists(m.LaunchPath) && Path.GetFileNameWithoutExtension(path) == modKey &&
!(activeMod != null && m.LaunchPath == activeMod.LaunchPath && m.Id == activeMod.Id && m.Version != activeMod.Version))
continue;
}
catch (Exception e)
{
Log.Write("debug", "Failed to parse mod metadata file '{0}'", path);
Log.Write("debug", e.ToString());
}
// Remove from the ingame mod switcher
if (Path.GetFileNameWithoutExtension(path) == modKey)
mods.Remove(modKey);
// Remove stale or corrupted metadata
try
{
File.Delete(path);
Log.Write("debug", "Removed invalid mod metadata file '{0}'", path);
}
catch (Exception e)
{
@@ -150,10 +200,34 @@ namespace OpenRA
}
}
}
}
if (toRemove != null)
foreach (var r in toRemove)
mods.Remove(r);
internal void Unregister(Manifest mod, ModRegistration registration)
{
var sources = new List<string>();
if (registration.HasFlag(ModRegistration.System))
sources.Add(Platform.SystemSupportDir);
if (registration.HasFlag(ModRegistration.User))
sources.Add(Platform.SupportDir);
var key = ExternalMod.MakeKey(mod);
mods.Remove(key);
foreach (var source in sources.Distinct())
{
var path = Path.Combine(source, "ModMetadata", key + ".yaml");
try
{
if (File.Exists(path))
File.Delete(path);
}
catch (Exception e)
{
Log.Write("debug", "Failed to remove mod metadata file '{0}'", path);
Log.Write("debug", e.ToString());
}
}
}
public ExternalMod this[string key] { get { return mods[key]; } }

View File

@@ -349,7 +349,7 @@ namespace OpenRA
if (parts.Length == 3)
{
int rr, rp, ry;
if (Exts.TryParseIntegerInvariant(value, out rr) && Exts.TryParseIntegerInvariant(value, out rp) && Exts.TryParseIntegerInvariant(value, out ry))
if (Exts.TryParseIntegerInvariant(parts[0], out rr) && Exts.TryParseIntegerInvariant(parts[1], out rp) && Exts.TryParseIntegerInvariant(parts[2], out ry))
return new WRot(new WAngle(rr), new WAngle(rp), new WAngle(ry));
}
}
@@ -398,13 +398,29 @@ namespace OpenRA
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(ConditionExpression))
else if (fieldType == typeof(BooleanExpression))
{
if (value != null)
{
try
{
return new ConditionExpression(value);
return new BooleanExpression(value);
}
catch (InvalidDataException e)
{
throw new YamlException(e.Message);
}
}
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(IntegerExpression))
{
if (value != null)
{
try
{
return new IntegerExpression(value);
}
catch (InvalidDataException e)
{

View File

@@ -82,7 +82,7 @@ namespace OpenRA.FileFormats
case "PLTE":
{
palette = new Color[256];
for (var i = 0; i < 256; i++)
for (var i = 0; i < length / 3; i++)
{
var r = cr.ReadByte(); var g = cr.ReadByte(); var b = cr.ReadByte();
palette[i] = Color.FromArgb(r, g, b);

View File

@@ -1,127 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.FileSystem
{
public sealed class BagFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Stream s;
readonly Dictionary<string, IdxEntry> index;
public BagFile(FileSystem context, string filename)
{
Name = filename;
// A bag file is always accompanied with an .idx counterpart
// For example: audio.bag requires the audio.idx file
var indexFilename = Path.ChangeExtension(filename, ".idx");
// Build the index and dispose the stream, it is no longer needed after this
List<IdxEntry> entries;
using (var indexStream = context.Open(indexFilename))
entries = new IdxReader(indexStream).Entries;
index = entries.ToDictionaryWithConflictLog(x => x.Filename,
"{0} (bag format)".F(filename),
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length));
s = context.Open(filename);
}
public Stream GetStream(string filename)
{
IdxEntry entry;
if (!index.TryGetValue(filename, out entry))
return null;
s.Seek(entry.Offset, SeekOrigin.Begin);
var waveHeaderMemoryStream = new MemoryStream();
var channels = (entry.Flags & 1) > 0 ? 2 : 1;
if ((entry.Flags & 2) > 0)
{
// PCM
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("RIFF"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length + 36));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("WAVE"));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fmt "));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(16));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)1));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)channels));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(2 * channels * entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)(2 * channels)));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)16));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("data"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length));
}
if ((entry.Flags & 8) > 0)
{
// IMA ADPCM
var samplesPerChunk = (2 * (entry.ChunkSize - 4)) + 1;
var bytesPerSec = (int)Math.Floor(((double)(2 * entry.ChunkSize) / samplesPerChunk) * ((double)entry.SampleRate / 2));
var chunkSize = entry.ChunkSize > entry.Length ? entry.Length : entry.ChunkSize;
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("RIFF"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length + 52));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("WAVE"));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fmt "));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(20));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)17));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)channels));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(bytesPerSec));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)chunkSize));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)4));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)2));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)samplesPerChunk));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fact"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(4));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(4 * entry.Length));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("data"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length));
}
waveHeaderMemoryStream.Seek(0, SeekOrigin.Begin);
// Construct a merged stream
var mergedStream = new MergedStream(waveHeaderMemoryStream, s);
mergedStream.SetLength(waveHeaderMemoryStream.Length + entry.Length);
return mergedStream;
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public void Dispose()
{
s.Dispose();
}
}
}

View File

@@ -1,105 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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;
namespace OpenRA.FileSystem
{
public sealed class BigFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Stream s;
public BigFile(FileSystem context, string filename)
{
Name = filename;
s = context.Open(filename);
try
{
if (s.ReadASCII(4) != "BIGF")
throw new InvalidDataException("Header is not BIGF");
// Total archive size.
s.ReadUInt32();
var entryCount = s.ReadUInt32();
if (BitConverter.IsLittleEndian)
entryCount = int2.Swap(entryCount);
// First entry offset? This is apparently bogus for EA's .big files
// and we don't have to try seeking there since the entries typically start next in EA's .big files.
s.ReadUInt32();
for (var i = 0; i < entryCount; i++)
{
var entry = new Entry(s);
index.Add(entry.Path, entry);
}
}
catch
{
Dispose();
throw;
}
}
class Entry
{
readonly Stream s;
readonly uint offset;
readonly uint size;
public readonly string Path;
public Entry(Stream s)
{
this.s = s;
offset = s.ReadUInt32();
size = s.ReadUInt32();
if (BitConverter.IsLittleEndian)
{
offset = int2.Swap(offset);
size = int2.Swap(size);
}
Path = s.ReadASCIIZ();
}
public Stream GetData()
{
s.Position = offset;
return new MemoryStream(s.ReadBytes((int)size));
}
}
public Stream GetStream(string filename)
{
return index[filename].GetData();
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public void Dispose()
{
s.Dispose();
}
}
}

View File

@@ -1,81 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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;
using System.IO;
using OpenRA.Primitives;
namespace OpenRA.FileSystem
{
public sealed class D2kSoundResources : IReadOnlyPackage
{
struct Entry
{
public readonly uint Offset;
public readonly uint Length;
public Entry(uint offset, uint length)
{
Offset = offset;
Length = length;
}
}
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Stream s;
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
public D2kSoundResources(FileSystem context, string filename)
{
Name = filename;
s = context.Open(filename);
try
{
var headerLength = s.ReadUInt32();
while (s.Position < headerLength + 4)
{
var name = s.ReadASCIIZ();
var offset = s.ReadUInt32();
var length = s.ReadUInt32();
index.Add(name, new Entry(offset, length));
}
}
catch
{
Dispose();
throw;
}
}
public Stream GetStream(string filename)
{
Entry e;
if (!index.TryGetValue(filename, out e))
return null;
s.Seek(e.Offset, SeekOrigin.Begin);
return new MemoryStream(s.ReadBytes((int)e.Length));
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public void Dispose()
{
s.Dispose();
}
}
}

View File

@@ -34,82 +34,63 @@ namespace OpenRA.FileSystem
// Mod packages that should not be disposed
readonly List<IReadOnlyPackage> modPackages = new List<IReadOnlyPackage>();
readonly IReadOnlyDictionary<string, Manifest> installedMods;
readonly IPackageLoader[] packageLoaders;
Cache<string, List<IReadOnlyPackage>> fileIndex = new Cache<string, List<IReadOnlyPackage>>(_ => new List<IReadOnlyPackage>());
public FileSystem(IReadOnlyDictionary<string, Manifest> installedMods)
public FileSystem(IReadOnlyDictionary<string, Manifest> installedMods, IPackageLoader[] packageLoaders)
{
this.installedMods = installedMods;
this.packageLoaders = packageLoaders
.Append(new ZipFileLoader())
.ToArray();
}
public bool TryParsePackage(Stream stream, string filename, out IReadOnlyPackage package)
{
package = null;
foreach (var packageLoader in packageLoaders)
if (packageLoader.TryParsePackage(stream, filename, this, out package))
return true;
return false;
}
public IReadOnlyPackage OpenPackage(string filename)
{
if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
return new MixFile(this, filename);
if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(this, filename);
if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(this, filename);
if (filename.EndsWith(".oramod", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(this, filename);
if (filename.EndsWith(".RS", StringComparison.InvariantCultureIgnoreCase))
return new D2kSoundResources(this, filename);
if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))
return new InstallShieldPackage(this, filename);
if (filename.EndsWith(".PAK", StringComparison.InvariantCultureIgnoreCase))
return new PakFile(this, filename);
if (filename.EndsWith(".big", StringComparison.InvariantCultureIgnoreCase))
return new BigFile(this, filename);
if (filename.EndsWith(".bag", StringComparison.InvariantCultureIgnoreCase))
return new BagFile(this, filename);
// Raw directories are the easiest and one of the most common cases, so try these first
var resolvedPath = Platform.ResolvePath(filename);
if (!filename.Contains("|") && Directory.Exists(resolvedPath))
return new Folder(resolvedPath);
// Children of another package require special handling
IReadOnlyPackage parent;
string subPath = null;
if (TryGetPackageContaining(filename, out parent, out subPath))
return OpenPackage(subPath, parent);
return parent.OpenPackage(subPath, this);
return new Folder(Platform.ResolvePath(filename));
}
// Try and open it normally
IReadOnlyPackage package;
var stream = Open(filename);
if (TryParsePackage(stream, filename, out package))
return package;
public IReadOnlyPackage OpenPackage(string filename, IReadOnlyPackage parent)
{
// HACK: limit support to zip and folder until we generalize the PackageLoader support
if (filename.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase) ||
filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
{
using (var s = parent.GetStream(filename))
return new ZipFile(s, filename, parent);
}
if (parent is ZipFile)
return new ZipFolder(this, (ZipFile)parent, filename, filename);
if (parent is ZipFolder)
{
var folder = (ZipFolder)parent;
return new ZipFolder(this, folder.Parent, folder.Name + "/" + filename, filename);
}
if (parent is Folder)
{
var subFolder = Platform.ResolvePath(Path.Combine(parent.Name, filename));
if (Directory.Exists(subFolder))
return new Folder(subFolder);
}
// No package loaders took ownership of the stream, so clean it up
stream.Dispose();
return null;
}
public void Mount(string name, string explicitName = null)
{
var optional = name.StartsWith("~");
var optional = name.StartsWith("~", StringComparison.Ordinal);
if (optional)
name = name.Substring(1);
try
{
IReadOnlyPackage package;
if (name.StartsWith("$"))
if (name.StartsWith("$", StringComparison.Ordinal))
{
name = name.Substring(1);
@@ -299,5 +280,40 @@ namespace OpenRA.FileSystem
return fileIndex.ContainsKey(filename);
}
/// <summary>
/// Resolves a filesystem for an assembly, accounting for explicit and mod mounts.
/// Assemblies must exist in the native OS file system (not inside an OpenRA-defined package).
/// </summary>
public static string ResolveAssemblyPath(string path, Manifest manifest, InstalledMods installedMods)
{
var explicitSplit = path.IndexOf('|');
if (explicitSplit > 0)
{
var parent = path.Substring(0, explicitSplit);
var filename = path.Substring(explicitSplit + 1);
var parentPath = manifest.Packages.FirstOrDefault(kv => kv.Value == parent).Key;
if (parentPath == null)
return null;
if (parentPath.StartsWith("$", StringComparison.Ordinal))
{
Manifest mod;
if (!installedMods.TryGetValue(parentPath.Substring(1), out mod))
return null;
if (!(mod.Package is Folder))
return null;
path = Path.Combine(mod.Package.Name, filename);
}
else
path = Path.Combine(parentPath, filename);
}
var resolvedPath = Platform.ResolvePath(path);
return File.Exists(resolvedPath) ? resolvedPath : null;
}
}
}

View File

@@ -51,6 +51,30 @@ namespace OpenRA.FileSystem
return combined.StartsWith(path, StringComparison.Ordinal) && File.Exists(combined);
}
public IReadOnlyPackage OpenPackage(string filename, FileSystem context)
{
var resolvedPath = Platform.ResolvePath(Path.Combine(Name, filename));
if (Directory.Exists(resolvedPath))
return new Folder(resolvedPath);
// Zip files loaded from Folders (and *only* from Folders) can be read-write
IReadWritePackage readWritePackage;
if (ZipFileLoader.TryParseReadWritePackage(resolvedPath, out readWritePackage))
return readWritePackage;
// Other package types can be loaded normally
IReadOnlyPackage package;
var s = GetStream(filename);
if (s == null)
return null;
if (context.TryParsePackage(s, filename, out package))
return package;
s.Dispose();
return null;
}
public void Update(string filename, byte[] contents)
{
// HACK: ZipFiles can't be loaded as read-write from a stream, so we are

View File

@@ -15,12 +15,23 @@ using System.IO;
namespace OpenRA.FileSystem
{
public interface IPackageLoader
{
/// <summary>
/// Attempt to parse a stream as this type of package.
/// If successful, the loader is expected to take ownership of `s` and dispose it once done.
/// If unsuccessful, the loader is expected to return the stream position to where it started.
/// </summary>
bool TryParsePackage(Stream s, string filename, FileSystem context, out IReadOnlyPackage package);
}
public interface IReadOnlyPackage : IDisposable
{
string Name { get; }
IEnumerable<string> Contents { get; }
Stream GetStream(string filename);
bool Contains(string filename);
IReadOnlyPackage OpenPackage(string filename, FileSystem context);
}
public interface IReadWritePackage : IReadOnlyPackage

View File

@@ -1,137 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileFormats;
namespace OpenRA.FileSystem
{
public sealed class InstallShieldPackage : IReadOnlyPackage
{
public struct Entry
{
public readonly uint Offset;
public readonly uint Length;
public Entry(uint offset, uint length)
{
Offset = offset;
Length = length;
}
}
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Stream s;
readonly long dataStart = 255;
public InstallShieldPackage(FileSystem context, string filename)
{
Name = filename;
s = context.Open(filename);
try
{
// Parse package header
var signature = s.ReadUInt32();
if (signature != 0x8C655D13)
throw new InvalidDataException("Not an Installshield package");
s.Position += 8;
/*var FileCount = */s.ReadUInt16();
s.Position += 4;
/*var ArchiveSize = */s.ReadUInt32();
s.Position += 19;
var tocAddress = s.ReadInt32();
s.Position += 4;
var dirCount = s.ReadUInt16();
// Parse the directory list
s.Position = tocAddress;
// Parse directories
var directories = new Dictionary<string, uint>();
for (var i = 0; i < dirCount; i++)
{
// Parse directory header
var fileCount = s.ReadUInt16();
var chunkSize = s.ReadUInt16();
var nameLength = s.ReadUInt16();
var dirName = s.ReadASCII(nameLength);
// Skip to the end of the chunk
s.ReadBytes(chunkSize - nameLength - 6);
directories.Add(dirName, fileCount);
}
// Parse files
foreach (var dir in directories)
for (var i = 0; i < dir.Value; i++)
ParseFile(s, dir.Key);
}
catch
{
Dispose();
throw;
}
}
uint accumulatedData = 0;
void ParseFile(Stream s, string dirName)
{
s.Position += 7;
var compressedSize = s.ReadUInt32();
s.Position += 12;
var chunkSize = s.ReadUInt16();
s.Position += 4;
var nameLength = s.ReadByte();
var fileName = dirName + "\\" + s.ReadASCII(nameLength);
// Use index syntax to overwrite any duplicate entries with the last value
index[fileName] = new Entry(accumulatedData, compressedSize);
accumulatedData += compressedSize;
// Skip to the end of the chunk
s.Position += chunkSize - nameLength - 30;
}
public Stream GetStream(string filename)
{
Entry e;
if (!index.TryGetValue(filename, out e))
return null;
s.Seek(dataStart + e.Offset, SeekOrigin.Begin);
var ret = new MemoryStream();
Blast.Decompress(s, ret);
ret.Seek(0, SeekOrigin.Begin);
return ret;
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public IReadOnlyDictionary<string, Entry> Index { get { return new ReadOnlyDictionary<string, Entry>(index); } }
public void Dispose()
{
s.Dispose();
}
}
}

View File

@@ -1,243 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Globalization;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.FileSystem
{
public sealed class MixFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, PackageEntry> index;
readonly long dataStart;
readonly Stream s;
readonly FileSystem context;
public MixFile(FileSystem context, string filename)
{
Name = filename;
this.context = context;
s = context.Open(filename);
try
{
// Detect format type
var isCncMix = s.ReadUInt16() != 0;
// The C&C mix format doesn't contain any flags or encryption
var isEncrypted = false;
if (!isCncMix)
isEncrypted = (s.ReadUInt16() & 0x2) != 0;
List<PackageEntry> entries;
if (isEncrypted)
{
long unused;
entries = ParseHeader(DecryptHeader(s, 4, out dataStart), 0, out unused);
}
else
entries = ParseHeader(s, isCncMix ? 0 : 4, out dataStart);
index = ParseIndex(entries.ToDictionaryWithConflictLog(x => x.Hash,
"{0} ({1} format, Encrypted: {2}, DataStart: {3})".F(filename, isCncMix ? "C&C" : "RA/TS/RA2", isEncrypted, dataStart),
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length)));
}
catch (Exception)
{
Dispose();
throw;
}
}
Dictionary<string, PackageEntry> ParseIndex(Dictionary<uint, PackageEntry> entries)
{
var classicIndex = new Dictionary<string, PackageEntry>();
var crcIndex = new Dictionary<string, PackageEntry>();
var allPossibleFilenames = new HashSet<string>();
// Try and find a local mix database
var dbNameClassic = PackageEntry.HashFilename("local mix database.dat", PackageHashType.Classic);
var dbNameCRC = PackageEntry.HashFilename("local mix database.dat", PackageHashType.CRC32);
foreach (var kv in entries)
{
if (kv.Key == dbNameClassic || kv.Key == dbNameCRC)
{
using (var content = GetContent(kv.Value))
{
var db = new XccLocalDatabase(content);
foreach (var e in db.Entries)
allPossibleFilenames.Add(e);
}
break;
}
}
// Load the global mix database
// TODO: This should be passed to the mix file ctor
if (context.Exists("global mix database.dat"))
{
using (var db = new XccGlobalDatabase(context.Open("global mix database.dat")))
{
foreach (var e in db.Entries)
allPossibleFilenames.Add(e);
}
}
foreach (var filename in allPossibleFilenames)
{
var classicHash = PackageEntry.HashFilename(filename, PackageHashType.Classic);
var crcHash = PackageEntry.HashFilename(filename, PackageHashType.CRC32);
PackageEntry e;
if (entries.TryGetValue(classicHash, out e))
classicIndex.Add(filename, e);
if (entries.TryGetValue(crcHash, out e))
crcIndex.Add(filename, e);
}
var bestIndex = crcIndex.Count > classicIndex.Count ? crcIndex : classicIndex;
var unknown = entries.Count - bestIndex.Count;
if (unknown > 0)
Log.Write("debug", "{0}: failed to resolve filenames for {1} unknown hashes".F(Name, unknown));
return bestIndex;
}
static List<PackageEntry> ParseHeader(Stream s, long offset, out long headerEnd)
{
s.Seek(offset, SeekOrigin.Begin);
var numFiles = s.ReadUInt16();
/*uint dataSize = */s.ReadUInt32();
var items = new List<PackageEntry>();
for (var i = 0; i < numFiles; i++)
items.Add(new PackageEntry(s));
headerEnd = offset + 6 + numFiles * PackageEntry.Size;
return items;
}
static MemoryStream DecryptHeader(Stream s, long offset, out long headerEnd)
{
s.Seek(offset, SeekOrigin.Begin);
// Decrypt blowfish key
var keyblock = s.ReadBytes(80);
var blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock);
var fish = new Blowfish(blowfishKey);
// Decrypt first block to work out the header length
var ms = Decrypt(ReadBlocks(s, offset + 80, 1), fish);
var numFiles = ms.ReadUInt16();
// Decrypt the full header - round bytes up to a full block
var blockCount = (13 + numFiles * PackageEntry.Size) / 8;
headerEnd = offset + 80 + blockCount * 8;
return Decrypt(ReadBlocks(s, offset + 80, blockCount), fish);
}
static MemoryStream Decrypt(uint[] h, Blowfish fish)
{
var decrypted = fish.Decrypt(h);
var ms = new MemoryStream();
var writer = new BinaryWriter(ms);
foreach (var t in decrypted)
writer.Write(t);
writer.Flush();
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
static uint[] ReadBlocks(Stream s, long offset, int count)
{
if (offset < 0)
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
if (count < 0)
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
if (offset + (count * 2) > s.Length)
throw new ArgumentException("Bytes to read {0} and offset {1} greater than stream length {2}.".F(count * 2, offset, s.Length));
s.Seek(offset, SeekOrigin.Begin);
// A block is a single encryption unit (represented as two 32-bit integers)
var ret = new uint[2 * count];
for (var i = 0; i < ret.Length; i++)
ret[i] = s.ReadUInt32();
return ret;
}
public Stream GetContent(PackageEntry entry)
{
Stream parentStream;
var baseOffset = dataStart + entry.Offset;
var nestedOffset = baseOffset + SegmentStream.GetOverallNestedOffset(s, out parentStream);
// Special case FileStream - instead of creating an in-memory copy,
// just reference the portion of the on-disk file that we need to save memory.
// We use GetType instead of 'is' here since we can't handle any derived classes of FileStream.
if (parentStream.GetType() == typeof(FileStream))
{
var path = ((FileStream)parentStream).Name;
return new SegmentStream(File.OpenRead(path), nestedOffset, entry.Length);
}
// For all other streams, create a copy in memory.
// This uses more memory but is the only way in general to ensure the returned streams won't clash.
s.Seek(baseOffset, SeekOrigin.Begin);
return new MemoryStream(s.ReadBytes((int)entry.Length));
}
public Stream GetStream(string filename)
{
PackageEntry e;
if (!index.TryGetValue(filename, out e))
return null;
return GetContent(e);
}
public IReadOnlyDictionary<string, PackageEntry> Index
{
get
{
var absoluteIndex = index.ToDictionary(e => e.Key, e => new PackageEntry(e.Value.Hash, (uint)(e.Value.Offset + dataStart), e.Value.Length));
return new ReadOnlyDictionary<string, PackageEntry>(absoluteIndex);
}
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public void Dispose()
{
s.Dispose();
}
}
}

View File

@@ -1,84 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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;
using System.IO;
namespace OpenRA.FileSystem
{
struct Entry
{
public uint Offset;
public uint Length;
public string Filename;
}
public sealed class PakFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, Entry> index;
readonly Stream stream;
public PakFile(FileSystem context, string filename)
{
Name = filename;
index = new Dictionary<string, Entry>();
stream = context.Open(filename);
try
{
index = new Dictionary<string, Entry>();
var offset = stream.ReadUInt32();
while (offset != 0)
{
var file = stream.ReadASCIIZ();
var next = stream.ReadUInt32();
var length = (next == 0 ? (uint)stream.Length : next) - offset;
// Ignore duplicate files
if (index.ContainsKey(file))
continue;
index.Add(file, new Entry { Offset = offset, Length = length, Filename = file });
offset = next;
}
}
catch
{
Dispose();
throw;
}
}
public Stream GetStream(string filename)
{
Entry entry;
if (!index.TryGetValue(filename, out entry))
return null;
stream.Seek(entry.Offset, SeekOrigin.Begin);
var data = stream.ReadBytes((int)entry.Length);
return new MemoryStream(data);
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public void Dispose()
{
stream.Dispose();
}
}
}

View File

@@ -9,152 +9,225 @@
*/
#endregion
using System.Collections;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using ICSharpCode.SharpZipLib.Zip;
using SZipFile = ICSharpCode.SharpZipLib.Zip.ZipFile;
using OpenRA.Primitives;
namespace OpenRA.FileSystem
{
public sealed class ZipFile : IReadWritePackage
public class ZipFileLoader : IPackageLoader
{
public IReadWritePackage Parent { get; private set; }
public string Name { get; private set; }
readonly Stream pkgStream;
readonly SZipFile pkg;
static readonly string[] Extensions = { ".zip", ".oramap" };
static ZipFile()
class ReadOnlyZipFile : IReadOnlyPackage
{
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
}
public string Name { get; protected set; }
protected ZipFile pkg;
public ZipFile(Stream stream, string name, IReadOnlyPackage parent = null)
{
// SharpZipLib breaks when asked to update archives loaded from outside streams or files
// We can work around this by creating a clean in-memory-only file, cutting all outside references
pkgStream = new MemoryStream();
stream.CopyTo(pkgStream);
pkgStream.Position = 0;
// Dummy constructor for use with ReadWriteZipFile
protected ReadOnlyZipFile() { }
Name = name;
Parent = parent as IReadWritePackage;
pkg = new SZipFile(pkgStream);
}
public ReadOnlyZipFile(Stream s, string filename)
{
Name = filename;
pkg = ZipFileHelper.Create(s);
}
public ZipFile(IReadOnlyFileSystem context, string filename)
{
string name;
IReadOnlyPackage p;
if (!context.TryGetPackageContaining(filename, out p, out name))
throw new FileNotFoundException("Unable to find parent package for " + filename);
public Stream GetStream(string filename)
{
var entry = pkg.GetEntry(filename);
if (entry == null)
return null;
Name = name;
Parent = p as IReadWritePackage;
using (var z = pkg.GetInputStream(entry))
{
var ms = new MemoryStream();
z.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
}
// SharpZipLib breaks when asked to update archives loaded from outside streams or files
// We can work around this by creating a clean in-memory-only file, cutting all outside references
pkgStream = new MemoryStream();
using (var sourceStream = p.GetStream(name))
sourceStream.CopyTo(pkgStream);
pkgStream.Position = 0;
public IEnumerable<string> Contents
{
get
{
foreach (ZipEntry entry in pkg)
yield return entry.Name;
}
}
pkg = new SZipFile(pkgStream);
}
public bool Contains(string filename)
{
return pkg.GetEntry(filename) != null;
}
ZipFile(string filename, IReadWritePackage parent)
{
pkgStream = new MemoryStream();
public void Dispose()
{
if (pkg != null)
pkg.Close();
}
Name = filename;
Parent = parent;
pkg = SZipFile.Create(pkgStream);
}
public IReadOnlyPackage OpenPackage(string filename, FileSystem context)
{
// Directories are stored with a trailing "/" in the index
var entry = pkg.GetEntry(filename) ?? pkg.GetEntry(filename + "/");
if (entry == null)
return null;
public static ZipFile Create(string filename, IReadWritePackage parent)
{
return new ZipFile(filename, parent);
}
if (entry.IsDirectory)
return new ZipFolder(this, filename);
public Stream GetStream(string filename)
{
var entry = pkg.GetEntry(filename);
if (entry == null)
// Other package types can be loaded normally
IReadOnlyPackage package;
var s = GetStream(filename);
if (s == null)
return null;
if (context.TryParsePackage(s, filename, out package))
return package;
s.Dispose();
return null;
using (var z = pkg.GetInputStream(entry))
{
var ms = new MemoryStream();
z.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
}
public IEnumerable<string> Contents
sealed class ReadWriteZipFile : ReadOnlyZipFile, IReadWritePackage
{
get
readonly MemoryStream pkgStream = new MemoryStream();
public ReadWriteZipFile(string filename, bool create = false)
{
foreach (ZipEntry entry in pkg)
yield return entry.Name;
// SharpZipLib breaks when asked to update archives loaded from outside streams or files
// We can work around this by creating a clean in-memory-only file, cutting all outside references
if (!create)
new MemoryStream(File.ReadAllBytes(filename)).CopyTo(pkgStream);
pkgStream.Position = 0;
pkg = ZipFileHelper.Create(pkgStream);
Name = filename;
}
void Commit()
{
var pos = pkgStream.Position;
pkgStream.Position = 0;
File.WriteAllBytes(Name, pkgStream.ReadBytes((int)pkgStream.Length));
pkgStream.Position = pos;
}
public void Update(string filename, byte[] contents)
{
pkg.BeginUpdate();
pkg.Add(new StaticStreamDataSource(new MemoryStream(contents)), filename);
pkg.CommitUpdate();
Commit();
}
public void Delete(string filename)
{
pkg.BeginUpdate();
pkg.Delete(filename);
pkg.CommitUpdate();
Commit();
}
}
public bool Contains(string filename)
sealed class ZipFolder : IReadOnlyPackage
{
return pkg.GetEntry(filename) != null;
public string Name { get { return path; } }
public ReadOnlyZipFile Parent { get; private set; }
readonly string path;
public ZipFolder(ReadOnlyZipFile parent, string path)
{
if (path.EndsWith("/", StringComparison.Ordinal))
path = path.Substring(0, path.Length - 1);
Parent = parent;
this.path = path;
}
public Stream GetStream(string filename)
{
// Zip files use '/' as a path separator
return Parent.GetStream(path + '/' + filename);
}
public IEnumerable<string> Contents
{
get
{
foreach (var entry in Parent.Contents)
{
if (entry.StartsWith(path, StringComparison.Ordinal) && entry != path)
{
var filename = entry.Substring(path.Length + 1);
var dirLevels = filename.Split('/').Count(c => !string.IsNullOrEmpty(c));
if (dirLevels == 1)
yield return filename;
}
}
}
}
public bool Contains(string filename)
{
return Parent.Contains(path + '/' + filename);
}
public IReadOnlyPackage OpenPackage(string filename, FileSystem context)
{
return Parent.OpenPackage(path + '/' + filename, context);
}
public void Dispose() { /* nothing to do */ }
}
void Commit()
class StaticStreamDataSource : IStaticDataSource
{
if (Parent == null)
throw new InvalidDataException("Cannot update ZipFile without writable parent");
readonly Stream s;
public StaticStreamDataSource(Stream s)
{
this.s = s;
}
var pos = pkgStream.Position;
pkgStream.Position = 0;
Parent.Update(Name, pkgStream.ReadBytes((int)pkgStream.Length));
pkgStream.Position = pos;
public Stream GetSource()
{
return s;
}
}
public void Update(string filename, byte[] contents)
public bool TryParsePackage(Stream s, string filename, FileSystem context, out IReadOnlyPackage package)
{
pkg.BeginUpdate();
pkg.Add(new StaticStreamDataSource(new MemoryStream(contents)), filename);
pkg.CommitUpdate();
Commit();
if (!Extensions.Any(e => filename.EndsWith(e, StringComparison.InvariantCultureIgnoreCase)))
{
package = null;
return false;
}
package = new ReadOnlyZipFile(s, filename);
return true;
}
public void Delete(string filename)
public static bool TryParseReadWritePackage(string filename, out IReadWritePackage package)
{
pkg.BeginUpdate();
pkg.Delete(filename);
pkg.CommitUpdate();
Commit();
if (!Extensions.Any(e => filename.EndsWith(e, StringComparison.InvariantCultureIgnoreCase)))
{
package = null;
return false;
}
package = new ReadWriteZipFile(filename);
return true;
}
public void Dispose()
public static IReadWritePackage Create(string filename)
{
if (pkg != null)
pkg.Close();
if (pkgStream != null)
pkgStream.Dispose();
}
}
class StaticStreamDataSource : IStaticDataSource
{
readonly Stream s;
public StaticStreamDataSource(Stream s)
{
this.s = s;
}
public Stream GetSource()
{
return s;
return new ReadWriteZipFile(filename, true);
}
}
}

View File

@@ -1,76 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Text;
using ICSharpCode.SharpZipLib.Zip;
using SZipFile = ICSharpCode.SharpZipLib.Zip.ZipFile;
namespace OpenRA.FileSystem
{
public sealed class ZipFolder : IReadOnlyPackage
{
public string Name { get; private set; }
public ZipFile Parent { get; private set; }
readonly string path;
static ZipFolder()
{
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
}
public ZipFolder(FileSystem context, ZipFile parent, string path, string filename)
{
if (filename.EndsWith("/"))
filename = filename.Substring(0, filename.Length - 1);
Name = filename;
Parent = parent;
if (path.EndsWith("/"))
path = path.Substring(0, path.Length - 1);
this.path = path;
}
public Stream GetStream(string filename)
{
// Zip files use '/' as a path separator
return Parent.GetStream(path + '/' + filename);
}
public IEnumerable<string> Contents
{
get
{
foreach (var entry in Parent.Contents)
{
if (entry.StartsWith(path) && entry != path)
{
var filename = entry.Substring(path.Length + 1);
var dirLevels = filename.Split('/').Count(c => !string.IsNullOrEmpty(c));
if (dirLevels == 1)
yield return filename;
}
}
}
}
public bool Contains(string filename)
{
return Parent.Contains(path + '/' + filename);
}
public void Dispose() { /* nothing to do */ }
}
}

View File

@@ -57,6 +57,8 @@ namespace OpenRA
public static GlobalChat GlobalChat;
public static string EngineVersion { get; private set; }
static Task discoverNat;
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
@@ -163,7 +165,7 @@ namespace OpenRA
using (new PerfTimer("PrepareMap"))
map = ModData.PrepareMap(mapUID);
using (new PerfTimer("NewWorld"))
OrderManager.World = new World(map, OrderManager, type);
OrderManager.World = new World(ModData, map, OrderManager, type);
worldRenderer = new WorldRenderer(ModData, OrderManager.World);
@@ -246,14 +248,26 @@ namespace OpenRA
{
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
// Load the engine version as early as possible so it can be written to exception logs
try
{
EngineVersion = File.ReadAllText(Platform.ResolvePath(Path.Combine(".", "VERSION"))).Trim();
}
catch { }
if (string.IsNullOrEmpty(EngineVersion))
EngineVersion = "Unknown";
Console.WriteLine("Engine version is {0}", EngineVersion);
// Special case handling of Game.Mod argument: if it matches a real filesystem path
// then we use this to override the mod search path, and replace it with the mod id
var modArgument = args.GetValue("Game.Mod", null);
var modID = args.GetValue("Game.Mod", null);
var explicitModPaths = new string[0];
if (modArgument != null && (File.Exists(modArgument) || Directory.Exists(modArgument)))
if (modID != null && (File.Exists(modID) || Directory.Exists(modID)))
{
explicitModPaths = new[] { modArgument };
args.ReplaceValue("Game.Mod", Path.GetFileNameWithoutExtension(modArgument));
explicitModPaths = new[] { modID };
modID = Path.GetFileNameWithoutExtension(modID);
}
InitializeSettings(args);
@@ -317,32 +331,37 @@ namespace OpenRA
var modSearchArg = args.GetValue("Engine.ModSearchPaths", null);
var modSearchPaths = modSearchArg != null ?
FieldLoader.GetValue<string[]>("Engine.ModsPath", modSearchArg) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
new[] { Path.Combine(".", "mods") };
Mods = new InstalledMods(modSearchPaths, explicitModPaths);
Console.WriteLine("Internal mods:");
foreach (var mod in Mods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Metadata.Title, mod.Value.Metadata.Version);
var launchPath = args.GetValue("Engine.LaunchPath", Assembly.GetEntryAssembly().Location);
ExternalMods = new ExternalMods(launchPath);
ExternalMods = new ExternalMods();
Manifest currentMod;
if (modID != null && Mods.TryGetValue(modID, out currentMod))
{
var launchPath = args.GetValue("Engine.LaunchPath", Assembly.GetEntryAssembly().Location);
// Sanitize input from platform-specific launchers
// Process.Start requires paths to not be quoted, even if they contain spaces
if (launchPath.First() == '"' && launchPath.Last() == '"')
launchPath = launchPath.Substring(1, launchPath.Length - 2);
ExternalMods.Register(Mods[modID], launchPath, ModRegistration.User);
ExternalMod activeMod;
if (ExternalMods.TryGetValue(ExternalMod.MakeKey(Mods[modID]), out activeMod))
ExternalMods.ClearInvalidRegistrations(activeMod, ModRegistration.User);
}
Console.WriteLine("External mods:");
foreach (var mod in ExternalMods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
InitializeMod(Settings.Game.Mod, args);
}
public static bool IsModInstalled(string modId)
{
return Mods.ContainsKey(modId) && Mods[modId].RequiresMods.All(IsModInstalled);
}
public static bool IsModInstalled(KeyValuePair<string, string> mod)
{
return Mods.ContainsKey(mod.Key)
&& Mods[mod.Key].Metadata.Version == mod.Value
&& IsModInstalled(mod.Key);
InitializeMod(modID, args);
}
public static void InitializeMod(string mod, Arguments args)
@@ -372,17 +391,17 @@ namespace OpenRA
ModData = null;
// Fall back to default if the mod doesn't exist or has missing prerequisites.
if (mod == null || !IsModInstalled(mod))
mod = args.GetValue("Engine.DefaultMod", "modchooser");
if (mod == null)
throw new InvalidOperationException("Game.Mod argument missing.");
if (!Mods.ContainsKey(mod))
throw new InvalidOperationException("Unknown or invalid mod '{0}'.".F(mod));
Console.WriteLine("Loading mod: {0}", mod);
Settings.Game.Mod = mod;
Sound.StopVideo();
ModData = new ModData(Mods[mod], Mods, true);
ExternalMods.Register(ModData.Manifest);
if (!ModData.LoadScreen.BeforeLoad())
return;
@@ -539,8 +558,6 @@ namespace OpenRA
var integralTickTimestep = (uiTickDelta / Timestep) * Timestep;
Ui.LastTickTime += integralTickTimestep >= TimestepJankThreshold ? integralTickTimestep : Timestep;
Viewport.TicksSinceLastMove += uiTickDelta / Timestep;
Sync.CheckSyncUnchanged(world, Ui.Tick);
Cursor.Tick();
}
@@ -633,9 +650,9 @@ namespace OpenRA
using (new PerfSample("render_widgets"))
{
Renderer.WorldVoxelRenderer.BeginFrame();
Renderer.WorldModelRenderer.BeginFrame();
Ui.PrepareRenderables();
Renderer.WorldVoxelRenderer.EndFrame();
Renderer.WorldModelRenderer.EndFrame();
Ui.Draw();

View File

@@ -29,6 +29,7 @@ namespace OpenRA
public readonly IReadOnlyDictionary<string, MusicInfo> Music;
public readonly TileSet TileSet;
public readonly SequenceProvider Sequences;
public readonly IReadOnlyDictionary<string, MiniYamlNode> ModelSequences;
public Ruleset(
IReadOnlyDictionary<string, ActorInfo> actors,
@@ -37,7 +38,8 @@ namespace OpenRA
IReadOnlyDictionary<string, SoundInfo> notifications,
IReadOnlyDictionary<string, MusicInfo> music,
TileSet tileSet,
SequenceProvider sequences)
SequenceProvider sequences,
IReadOnlyDictionary<string, MiniYamlNode> modelSequences)
{
Actors = actors;
Weapons = weapons;
@@ -46,6 +48,7 @@ namespace OpenRA
Music = music;
TileSet = tileSet;
Sequences = sequences;
ModelSequences = modelSequences;
foreach (var a in Actors.Values)
{
@@ -119,8 +122,11 @@ namespace OpenRA
var music = MergeOrDefault("Manifest,Music", fs, m.Music, null, null,
k => new MusicInfo(k.Key, k.Value));
var modelSequences = MergeOrDefault("Manifest,ModelSequences", fs, m.ModelSequences, null, null,
k => k);
// The default ruleset does not include a preferred tileset or sequence set
ruleset = new Ruleset(actors, weapons, voices, notifications, music, null, null);
ruleset = new Ruleset(actors, weapons, voices, notifications, music, null, null, modelSequences);
};
if (modData.IsOnMainThread)
@@ -145,12 +151,13 @@ namespace OpenRA
var dr = modData.DefaultRules;
var ts = modData.DefaultTileSets[tileSet];
var sequences = modData.DefaultSequences[tileSet];
return new Ruleset(dr.Actors, dr.Weapons, dr.Voices, dr.Notifications, dr.Music, ts, sequences);
return new Ruleset(dr.Actors, dr.Weapons, dr.Voices, dr.Notifications, dr.Music, ts, sequences, dr.ModelSequences);
}
public static Ruleset Load(ModData modData, IReadOnlyFileSystem fileSystem, string tileSet,
MiniYaml mapRules, MiniYaml mapWeapons, MiniYaml mapVoices, MiniYaml mapNotifications,
MiniYaml mapMusic, MiniYaml mapSequences)
MiniYaml mapMusic, MiniYaml mapSequences, MiniYaml mapModelSequences)
{
var m = modData.Manifest;
var dr = modData.DefaultRules;
@@ -180,8 +187,12 @@ namespace OpenRA
var sequences = mapSequences == null ? modData.DefaultSequences[tileSet] :
new SequenceProvider(fileSystem, modData, ts, mapSequences);
// TODO: Add support for custom voxel sequences
ruleset = new Ruleset(actors, weapons, voices, notifications, music, ts, sequences);
var modelSequences = dr.ModelSequences;
if (mapModelSequences != null)
modelSequences = MergeOrDefault("ModelSequences", fileSystem, m.ModelSequences, mapModelSequences, dr.ModelSequences,
k => k);
ruleset = new Ruleset(actors, weapons, voices, notifications, music, ts, sequences, modelSequences);
};
if (modData.IsOnMainThread)

View File

@@ -39,9 +39,24 @@ namespace OpenRA.GameRules
[Desc("The maximum range the weapon can fire.")]
public readonly WDist Range = WDist.Zero;
[Desc("The sound played when the weapon is fired.")]
[Desc("First burst is aimed at this offset relative to target position.")]
public readonly WVec FirstBurstTargetOffset = WVec.Zero;
[Desc("Each burst after the first lands by this offset away from the previous burst.")]
public readonly WVec FollowingBurstTargetOffset = WVec.Zero;
[Desc("The sound played each time the weapon is fired.")]
public readonly string[] Report = null;
[Desc("Sound played only on first burst in a salvo.")]
public readonly string[] StartBurstReport = null;
[Desc("The sound played when the weapon is reloaded.")]
public readonly string[] AfterFireSound = null;
[Desc("Delay in ticks to play reloading sound.")]
public readonly int AfterFireSoundDelay = 0;
[Desc("Delay in ticks between reloading ammo magazines.")]
public readonly int ReloadDelay = 1;
@@ -60,6 +75,9 @@ namespace OpenRA.GameRules
[Desc("The minimum range the weapon can fire.")]
public readonly WDist MinRange = WDist.Zero;
[Desc("Does this weapon aim at the target's center regardless of other targetable offsets?")]
public readonly bool TargetActorCenter = false;
[FieldLoader.LoadUsing("LoadProjectile")]
public readonly IProjectileInfo Projectile;

View File

@@ -79,6 +79,8 @@ namespace OpenRA.Chat
volatile ChatConnectionStatus connectionStatus = ChatConnectionStatus.Disconnected;
public ChatConnectionStatus ConnectionStatus { get { return connectionStatus; } }
string nickname;
public GlobalChat()
{
client.Encoding = System.Text.Encoding.UTF8;
@@ -106,8 +108,6 @@ namespace OpenRA.Chat
client.OnDevoice += (_, e) => SetUserVoiced(e.Whom, false);
client.OnPart += OnPart;
client.OnQuit += OnQuit;
TrySetNickname(Game.Settings.Player.Name);
}
void SetUserOp(string whom, bool isOp)
@@ -130,11 +130,13 @@ namespace OpenRA.Chat
});
}
public void Connect()
public void Connect(string nickname)
{
if (client.IsConnected)
if (client.IsConnected || !IsValidNickname(nickname))
return;
this.nickname = nickname;
new Thread(() =>
{
try
@@ -185,12 +187,7 @@ namespace OpenRA.Chat
AddNotification("Connected.");
connectionStatus = ChatConnectionStatus.Connected;
// Guard against settings.yaml modification
var nick = SanitizedName(Game.Settings.Chat.Nickname);
if (nick != Game.Settings.Chat.Nickname)
Game.RunAfterTick(() => Game.Settings.Chat.Nickname = nick);
client.Login(nick, "in-game IRC client", 0, "OpenRA");
client.Login(nickname, "in-game IRC client", 0, "OpenRA");
client.RfcJoin("#" + Game.Settings.Chat.Channel);
}
@@ -341,7 +338,6 @@ namespace OpenRA.Chat
if (Rfc2812.IsValidNickname(nick))
{
client.RfcNick(nick);
Game.Settings.Chat.Nickname = nick;
return true;
}
@@ -368,7 +364,7 @@ namespace OpenRA.Chat
AddNotification("Disconnecting from {0}...".F(client.Address));
Game.RunAfterTick(() => Game.Settings.Chat.ConnectAutomatically = false);
Game.RunAfterTick(() => { Game.Settings.Chat.ConnectAutomatically = false; Game.Settings.Save(); });
}
public void Dispose()

View File

@@ -95,7 +95,8 @@ namespace OpenRA.Graphics
public static bool operator ==(HSLColor me, HSLColor other)
{
return me.H == other.H && me.S == other.S && me.L == other.L;
// 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); }

View File

@@ -0,0 +1,83 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileSystem;
namespace OpenRA.Graphics
{
public interface IModel
{
uint Frames { get; }
uint Sections { get; }
float[] TransformationMatrix(uint section, uint frame);
float[] Size { get; }
float[] Bounds(uint frame);
ModelRenderData RenderData(uint section);
}
public struct ModelRenderData
{
public readonly int Start;
public readonly int Count;
public readonly Sheet Sheet;
public ModelRenderData(int start, int count, Sheet sheet)
{
Start = start;
Count = count;
Sheet = sheet;
}
}
public interface IModelCache : IDisposable
{
IModel GetModelSequence(string model, string sequence);
bool HasModelSequence(string model, string sequence);
IVertexBuffer<Vertex> VertexBuffer { get; }
}
public interface IModelSequenceLoader
{
Action<string> OnMissingModelError { get; set; }
IModelCache CacheModels(IReadOnlyFileSystem fileSystem, ModData modData, IReadOnlyDictionary<string, MiniYamlNode> modelDefinitions);
}
public class PlaceholderModelSequenceLoader : IModelSequenceLoader
{
public Action<string> OnMissingModelError { get; set; }
class PlaceholderModelCache : IModelCache
{
public IVertexBuffer<Vertex> VertexBuffer { get { throw new NotImplementedException(); } }
public void Dispose() { }
public IModel GetModelSequence(string model, string sequence)
{
throw new NotImplementedException();
}
public bool HasModelSequence(string model, string sequence)
{
throw new NotImplementedException();
}
}
public PlaceholderModelSequenceLoader(ModData modData) { }
public IModelCache CacheModels(IReadOnlyFileSystem fileSystem, ModData modData, IReadOnlyDictionary<string, MiniYamlNode> modelDefinitions)
{
return new PlaceholderModelCache();
}
}
}

View File

@@ -14,18 +14,18 @@ using System.Collections.Generic;
namespace OpenRA.Graphics
{
public struct VoxelAnimation
public struct ModelAnimation
{
public readonly Voxel Voxel;
public readonly IModel Model;
public readonly Func<WVec> OffsetFunc;
public readonly Func<IEnumerable<WRot>> RotationFunc;
public readonly Func<bool> DisableFunc;
public readonly Func<uint> FrameFunc;
public readonly bool ShowShadow;
public VoxelAnimation(Voxel voxel, Func<WVec> offset, Func<IEnumerable<WRot>> rotation, Func<bool> disable, Func<uint> frame, bool showshadow)
public ModelAnimation(IModel model, Func<WVec> offset, Func<IEnumerable<WRot>> rotation, Func<bool> disable, Func<uint> frame, bool showshadow)
{
Voxel = voxel;
Model = model;
OffsetFunc = offset;
RotationFunc = rotation;
DisableFunc = disable;

View File

@@ -17,14 +17,14 @@ using OpenRA.Primitives;
namespace OpenRA.Graphics
{
public class VoxelRenderProxy
public class ModelRenderProxy
{
public readonly Sprite Sprite;
public readonly Sprite ShadowSprite;
public readonly float ShadowDirection;
public readonly float3[] ProjectedShadowBounds;
public VoxelRenderProxy(Sprite sprite, Sprite shadowSprite, float3[] projectedShadowBounds, float shadowDirection)
public ModelRenderProxy(Sprite sprite, Sprite shadowSprite, float3[] projectedShadowBounds, float shadowDirection)
{
Sprite = sprite;
ShadowSprite = shadowSprite;
@@ -33,7 +33,7 @@ namespace OpenRA.Graphics
}
}
public sealed class VoxelRenderer : IDisposable
public sealed class ModelRenderer : IDisposable
{
// Static constants
static readonly float[] ShadowDiffuse = new float[] { 0, 0, 0 };
@@ -53,7 +53,7 @@ namespace OpenRA.Graphics
SheetBuilder sheetBuilder;
public VoxelRenderer(Renderer renderer, IShader shader)
public ModelRenderer(Renderer renderer, IShader shader)
{
this.renderer = renderer;
this.shader = shader;
@@ -78,8 +78,8 @@ namespace OpenRA.Graphics
shader.SetMatrix("View", view);
}
public VoxelRenderProxy RenderAsync(
WorldRenderer wr, IEnumerable<VoxelAnimation> voxels, WRot camera, float scale,
public ModelRenderProxy RenderAsync(
WorldRenderer wr, IEnumerable<ModelAnimation> models, WRot camera, float scale,
float[] groundNormal, WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
PaletteReference color, PaletteReference normals, PaletteReference shadowPalette)
{
@@ -105,18 +105,18 @@ namespace OpenRA.Graphics
var stl = new float2(float.MaxValue, float.MaxValue);
var sbr = new float2(float.MinValue, float.MinValue);
foreach (var v in voxels)
foreach (var m in models)
{
// Convert screen offset back to world coords
var offsetVec = Util.MatrixVectorMultiply(invCameraTransform, wr.ScreenVector(v.OffsetFunc()));
var offsetVec = Util.MatrixVectorMultiply(invCameraTransform, wr.ScreenVector(m.OffsetFunc()));
var offsetTransform = Util.TranslationMatrix(offsetVec[0], offsetVec[1], offsetVec[2]);
var worldTransform = v.RotationFunc().Aggregate(Util.IdentityMatrix(),
var worldTransform = m.RotationFunc().Aggregate(Util.IdentityMatrix(),
(x, y) => Util.MatrixMultiply(Util.MakeFloatMatrix(y.AsMatrix()), x));
worldTransform = Util.MatrixMultiply(scaleTransform, worldTransform);
worldTransform = Util.MatrixMultiply(offsetTransform, worldTransform);
var bounds = v.Voxel.Bounds(v.FrameFunc());
var bounds = m.Model.Bounds(m.FrameFunc());
var worldBounds = Util.MatrixAABBMultiply(worldTransform, bounds);
var screenBounds = Util.MatrixAABBMultiply(cameraTransform, worldBounds);
var shadowBounds = Util.MatrixAABBMultiply(shadowTransform, worldBounds);
@@ -177,13 +177,13 @@ namespace OpenRA.Graphics
doRender.Add(Pair.New<Sheet, Action>(sprite.Sheet, () =>
{
foreach (var v in voxels)
foreach (var m in models)
{
// Convert screen offset to world offset
var offsetVec = Util.MatrixVectorMultiply(invCameraTransform, wr.ScreenVector(v.OffsetFunc()));
var offsetVec = Util.MatrixVectorMultiply(invCameraTransform, wr.ScreenVector(m.OffsetFunc()));
var offsetTransform = Util.TranslationMatrix(offsetVec[0], offsetVec[1], offsetVec[2]);
var rotations = v.RotationFunc().Aggregate(Util.IdentityMatrix(),
var rotations = m.RotationFunc().Aggregate(Util.IdentityMatrix(),
(x, y) => Util.MatrixMultiply(Util.MakeFloatMatrix(y.AsMatrix()), x));
var worldTransform = Util.MatrixMultiply(scaleTransform, rotations);
worldTransform = Util.MatrixMultiply(offsetTransform, worldTransform);
@@ -196,11 +196,11 @@ namespace OpenRA.Graphics
var lightTransform = Util.MatrixMultiply(Util.MatrixInverse(rotations), invShadowTransform);
var frame = v.FrameFunc();
for (uint i = 0; i < v.Voxel.Limbs; i++)
var frame = m.FrameFunc();
for (uint i = 0; i < m.Model.Sections; i++)
{
var rd = v.Voxel.RenderData(i);
var t = v.Voxel.TransformationMatrix(i, frame);
var rd = m.Model.RenderData(i);
var t = m.Model.TransformationMatrix(i, frame);
var it = Util.MatrixInverse(t);
if (it == null)
throw new InvalidOperationException("Failed to invert the transformed matrix of frame {0} during RenderAsync.".F(i));
@@ -208,12 +208,12 @@ namespace OpenRA.Graphics
// Transform light vector from shadow -> world -> limb coords
var lightDirection = ExtractRotationVector(Util.MatrixMultiply(it, lightTransform));
Render(rd, Util.MatrixMultiply(transform, t), lightDirection,
Render(rd, wr.World.ModelCache, Util.MatrixMultiply(transform, t), lightDirection,
lightAmbientColor, lightDiffuseColor, color.TextureMidIndex, normals.TextureMidIndex);
// Disable shadow normals by forcing zero diffuse and identity ambient light
if (v.ShowShadow)
Render(rd, Util.MatrixMultiply(shadow, t), lightDirection,
if (m.ShowShadow)
Render(rd, wr.World.ModelCache, Util.MatrixMultiply(shadow, t), lightDirection,
ShadowAmbient, ShadowDiffuse, shadowPalette.TextureMidIndex, normals.TextureMidIndex);
}
}
@@ -221,7 +221,7 @@ namespace OpenRA.Graphics
var screenLightVector = Util.MatrixVectorMultiply(invShadowTransform, ZVector);
screenLightVector = Util.MatrixVectorMultiply(cameraTransform, screenLightVector);
return new VoxelRenderProxy(sprite, shadowSprite, screenCorners, -screenLightVector[2] / screenLightVector[1]);
return new ModelRenderProxy(sprite, shadowSprite, screenCorners, -screenLightVector[2] / screenLightVector[1]);
}
static void CalculateSpriteGeometry(float2 tl, float2 br, float scale, out Size size, out int2 offset)
@@ -258,7 +258,8 @@ namespace OpenRA.Graphics
}
void Render(
VoxelRenderData renderData,
ModelRenderData renderData,
IModelCache cache,
float[] t, float[] lightDirection,
float[] ambientLight, float[] diffuseLight,
float colorPaletteTextureMidIndex, float normalsPaletteTextureMidIndex)
@@ -270,7 +271,7 @@ namespace OpenRA.Graphics
shader.SetVec("AmbientLight", ambientLight, 3);
shader.SetVec("DiffuseLight", diffuseLight, 3);
shader.Render(() => renderer.DrawBatch(Game.ModData.VoxelLoader.VertexBuffer, renderData.Start, renderData.Count, PrimitiveType.TriangleList));
shader.Render(() => renderer.DrawBatch(cache.VertexBuffer, renderData.Start, renderData.Count, PrimitiveType.TriangleList));
}
public void BeginFrame()

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Graphics
}
}
public static long TicksSinceLastMove = 0;
public static long LastMoveRunTime = 0;
public static int2 LastMousePos;
float ClosestTo(float[] collection, float target)

View File

@@ -1,84 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileSystem;
namespace OpenRA.Graphics
{
public static class VoxelProvider
{
static Dictionary<string, Dictionary<string, Voxel>> units;
public static void Initialize(VoxelLoader loader, IReadOnlyFileSystem fileSystem, List<MiniYamlNode> sequences)
{
units = new Dictionary<string, Dictionary<string, Voxel>>();
foreach (var s in sequences)
LoadVoxelsForUnit(loader, s.Key, s.Value);
loader.RefreshBuffer();
}
static Voxel LoadVoxel(VoxelLoader voxelLoader, string unit, MiniYaml info)
{
var vxl = unit;
var hva = unit;
if (info.Value != null)
{
var fields = info.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (fields.Length >= 1)
vxl = hva = fields[0].Trim();
if (fields.Length >= 2)
hva = fields[1].Trim();
}
return voxelLoader.Load(vxl, hva);
}
static void LoadVoxelsForUnit(VoxelLoader loader, string unit, MiniYaml sequences)
{
Game.ModData.LoadScreen.Display();
try
{
var seq = sequences.ToDictionary(my => LoadVoxel(loader, unit, my));
units.Add(unit, seq);
}
catch (FileNotFoundException) { } // Do nothing; we can crash later if we actually wanted art
}
public static Voxel GetVoxel(string unitName, string voxelName)
{
try { return units[unitName][voxelName]; }
catch (KeyNotFoundException)
{
if (units.ContainsKey(unitName))
throw new InvalidOperationException(
"Unit `{0}` does not have a voxel `{1}`".F(unitName, voxelName));
else
throw new InvalidOperationException(
"Unit `{0}` does not have any voxels defined.".F(unitName));
}
}
public static bool HasVoxel(string unit, string seq)
{
if (!units.ContainsKey(unit))
throw new InvalidOperationException(
"Unit `{0}` does not have any voxels defined.".F(unit));
return units[unit].ContainsKey(seq);
}
}
}

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Graphics
r => ZPosition(r.Pos, r.ZOffset);
public readonly Size TileSize;
public readonly int TileScale;
public readonly World World;
public readonly Theater Theater;
public Viewport Viewport { get; private set; }
@@ -41,6 +42,7 @@ namespace OpenRA.Graphics
{
World = world;
TileSize = World.Map.Grid.TileSize;
TileScale = World.Map.Grid.Type == MapGridType.RectangularIsometric ? 1448 : 1024;
Viewport = new Viewport(this, world.Map);
createPaletteReference = CreatePaletteReference;
@@ -111,9 +113,9 @@ namespace OpenRA.Graphics
worldRenderables = worldRenderables.Concat(World.Effects.SelectMany(e => e.Render(this)));
worldRenderables = worldRenderables.OrderBy(RenderableScreenZPositionComparisonKey);
Game.Renderer.WorldVoxelRenderer.BeginFrame();
Game.Renderer.WorldModelRenderer.BeginFrame();
var renderables = worldRenderables.Select(r => r.PrepareRender(this)).ToList();
Game.Renderer.WorldVoxelRenderer.EndFrame();
Game.Renderer.WorldModelRenderer.EndFrame();
return renderables;
}
@@ -180,14 +182,14 @@ namespace OpenRA.Graphics
if (World.OrderGenerator != null)
aboveShroudOrderGenerator = World.OrderGenerator.RenderAboveShroud(this, World);
Game.Renderer.WorldVoxelRenderer.BeginFrame();
Game.Renderer.WorldModelRenderer.BeginFrame();
var finalOverlayRenderables = aboveShroud
.Concat(aboveShroudSelected)
.Concat(aboveShroudEffects)
.Concat(aboveShroudOrderGenerator)
.Select(r => r.PrepareRender(this))
.ToList();
Game.Renderer.WorldVoxelRenderer.EndFrame();
Game.Renderer.WorldModelRenderer.EndFrame();
// HACK: Keep old grouping behaviour
foreach (var g in finalOverlayRenderables.GroupBy(prs => prs.GetType()))
@@ -216,13 +218,13 @@ namespace OpenRA.Graphics
// Conversion between world and screen coordinates
public float2 ScreenPosition(WPos pos)
{
return new float2(TileSize.Width * pos.X / 1024f, TileSize.Height * (pos.Y - pos.Z) / 1024f);
return new float2((float)TileSize.Width * pos.X / TileScale, (float)TileSize.Height * (pos.Y - pos.Z) / TileScale);
}
public float3 Screen3DPosition(WPos pos)
{
var z = ZPosition(pos, 0) * TileSize.Height / 1024f;
return new float3(TileSize.Width * pos.X / 1024f, TileSize.Height * (pos.Y - pos.Z) / 1024f, z);
var z = ZPosition(pos, 0) * (float)TileSize.Height / TileScale;
return new float3((float)TileSize.Width * pos.X / TileScale, (float)TileSize.Height * (pos.Y - pos.Z) / TileScale, z);
}
public int2 ScreenPxPosition(WPos pos)
@@ -239,16 +241,16 @@ namespace OpenRA.Graphics
return new float3((float)Math.Round(px.X), (float)Math.Round(px.Y), px.Z);
}
// For scaling vectors to pixel sizes in the voxel renderer
// For scaling vectors to pixel sizes in the model renderer
public float3 ScreenVectorComponents(WVec vec)
{
return new float3(
TileSize.Width * vec.X / 1024f,
TileSize.Height * (vec.Y - vec.Z) / 1024f,
TileSize.Height * vec.Z / 1024f);
(float)TileSize.Width * vec.X / TileScale,
(float)TileSize.Height * (vec.Y - vec.Z) / TileScale,
(float)TileSize.Height * vec.Z / TileScale);
}
// For scaling vectors to pixel sizes in the voxel renderer
// For scaling vectors to pixel sizes in the model renderer
public float[] ScreenVector(WVec vec)
{
var xyz = ScreenVectorComponents(vec);
@@ -264,7 +266,7 @@ namespace OpenRA.Graphics
public float ScreenZPosition(WPos pos, int offset)
{
return ZPosition(pos, offset) * TileSize.Height / 1024f;
return ZPosition(pos, offset) * (float)TileSize.Height / TileScale;
}
static int ZPosition(WPos pos, int offset)
@@ -278,7 +280,7 @@ namespace OpenRA.Graphics
/// </summary>
public WPos ProjectedPosition(int2 screenPx)
{
return new WPos(1024 * screenPx.X / TileSize.Width, 1024 * screenPx.Y / TileSize.Height, 0);
return new WPos(TileScale * screenPx.X / TileSize.Width, TileScale * screenPx.Y / TileSize.Height, 0);
}
public void Dispose()

View File

@@ -1,45 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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;
using System.Linq;
namespace OpenRA
{
public class Group
{
readonly Actor[] actors;
readonly int id;
static int nextGroup;
public IEnumerable<Actor> Actors { get { return actors; } }
public Group(IEnumerable<Actor> actors)
{
this.actors = actors.ToArray();
foreach (var a in actors)
a.Group = this;
id = nextGroup++;
}
public void Dump()
{
/* debug crap */
Game.Debug("Group #{0}: {1}".F(
id, actors.Select(a => "#{0} {1}".F(a.ActorID, a.Info.Name)).JoinWith(",")));
}
/* TODO: add lazy group path crap, groupleader, pruning, etc */
}
}

View File

@@ -69,5 +69,6 @@ namespace OpenRA
public Modifiers Modifiers;
public int MultiTapCount;
public char UnicodeChar;
public bool IsRepeat;
}
}

View File

@@ -46,12 +46,13 @@ namespace OpenRA
{
try
{
var directory = new DirectoryInfo(Platform.ResolvePath(path));
var resolved = Platform.ResolvePath(path);
if (!Directory.Exists(resolved))
continue;
var directory = new DirectoryInfo(resolved);
foreach (var subdir in directory.EnumerateDirectories())
mods.Add(Pair.New(subdir.Name, subdir.FullName));
foreach (var file in directory.EnumerateFiles("*.oramod"))
mods.Add(Pair.New(Path.GetFileNameWithoutExtension(file.Name), file.FullName));
}
catch (Exception e)
{
@@ -67,40 +68,39 @@ namespace OpenRA
IReadOnlyPackage package = null;
try
{
if (Directory.Exists(path))
package = new Folder(path);
else
if (!Directory.Exists(path))
{
try
{
using (var fileStream = File.OpenRead(path))
package = new ZipFile(fileStream, path);
}
catch
{
throw new InvalidDataException(path + " is not a valid mod package");
}
Log.Write("debug", path + " is not a valid mod package");
return null;
}
if (!package.Contains("mod.yaml"))
throw new InvalidDataException(path + " is not a valid mod package");
package = new Folder(path);
if (package.Contains("mod.yaml"))
{
var manifest = new Manifest(id, package);
using (var stream = package.GetStream("icon.png"))
if (stream != null)
using (var bitmap = new Bitmap(stream))
icons[id] = sheetBuilder.Add(bitmap);
if (package.Contains("icon.png"))
{
using (var stream = package.GetStream("icon.png"))
if (stream != null)
using (var bitmap = new Bitmap(stream))
icons[id] = sheetBuilder.Add(bitmap);
}
else if (!manifest.Metadata.Hidden)
Log.Write("debug", "Mod '{0}' is missing 'icon.png'.".F(path));
// Mods in the support directory and oramod packages (which are listed later
// in the CandidateMods list) override mods in the main install.
return new Manifest(id, package);
return manifest;
}
}
catch (Exception)
catch (Exception e)
{
if (package != null)
package.Dispose();
return null;
Log.Write("debug", "Load mod '{0}': {1}".F(path, e));
}
if (package != null)
package.Dispose();
return null;
}
Dictionary<string, Manifest> GetInstalledMods(IEnumerable<string> searchPaths, IEnumerable<string> explicitPaths)
@@ -112,9 +112,6 @@ namespace OpenRA
foreach (var pair in candidates)
{
var mod = LoadMod(pair.First, pair.Second);
// Mods in the support directory and oramod packages (which are listed later
// in the CandidateMods list) override mods in the main install.
if (mod != null)
ret[pair.First] = mod;
}

View File

@@ -31,12 +31,21 @@ namespace OpenRA
}
}
public sealed class ModelSequenceFormat : IGlobalModData
{
public readonly string Type;
public readonly IReadOnlyDictionary<string, MiniYaml> Metadata;
public ModelSequenceFormat(MiniYaml yaml)
{
Type = yaml.Value;
Metadata = new ReadOnlyDictionary<string, MiniYaml>(yaml.ToDictionary());
}
}
public class ModMetadata
{
public string Title;
public string Description;
public string Version;
public string Author;
public bool Hidden;
}
@@ -48,25 +57,24 @@ namespace OpenRA
public readonly ModMetadata Metadata;
public readonly string[]
Rules, ServerTraits,
Sequences, VoxelSequences, Cursors, Chrome, Assemblies, ChromeLayout,
Sequences, ModelSequences, Cursors, Chrome, Assemblies, ChromeLayout,
Weapons, Voices, Notifications, Music, Translations, TileSets,
ChromeMetrics, MapCompatibility, Missions;
public readonly IReadOnlyDictionary<string, string> Packages;
public readonly IReadOnlyDictionary<string, string> MapFolders;
public readonly MiniYaml LoadScreen;
public readonly Dictionary<string, string> RequiresMods;
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",
"Sequences", "VoxelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
"Sequences", "ModelSequences", "Cursors", "Chrome", "Assemblies", "ChromeLayout", "Weapons",
"Voices", "Notifications", "Music", "Translations", "TileSets", "ChromeMetrics", "Missions",
"ServerTraits", "LoadScreen", "Fonts", "SupportsMapsFrom", "SoundFormats", "SpriteFormats",
"RequiresMods" };
"RequiresMods", "PackageFormats" };
readonly TypeDictionary modules = new TypeDictionary();
readonly Dictionary<string, MiniYaml> yaml;
@@ -90,7 +98,7 @@ namespace OpenRA
Rules = YamlList(yaml, "Rules");
Sequences = YamlList(yaml, "Sequences");
VoxelSequences = YamlList(yaml, "VoxelSequences");
ModelSequences = YamlList(yaml, "ModelSequences");
Cursors = YamlList(yaml, "Cursors");
Chrome = YamlList(yaml, "Chrome");
Assemblies = YamlList(yaml, "Assemblies");
@@ -115,8 +123,6 @@ namespace OpenRA
return Pair.New(nd["Font"].Value, Exts.ParseIntegerInvariant(nd["Size"].Value));
});
RequiresMods = yaml["RequiresMods"].ToDictionary(my => my.Value);
// Allow inherited mods to import parent maps.
var compat = new List<string> { Id };
@@ -125,6 +131,9 @@ namespace OpenRA
MapCompatibility = compat.ToArray();
if (yaml.ContainsKey("PackageFormats"))
PackageFormats = FieldLoader.GetValue<string[]>("PackageFormats", yaml["PackageFormats"].Value);
if (yaml.ContainsKey("SoundFormats"))
SoundFormats = FieldLoader.GetValue<string[]>("SoundFormats", yaml["SoundFormats"].Value);

View File

@@ -18,6 +18,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Support;
using OpenRA.Traits;
@@ -168,7 +169,7 @@ namespace OpenRA
new MapField("Actors", "ActorDefinitions"),
new MapField("Rules", "RuleDefinitions", required: false),
new MapField("Sequences", "SequenceDefinitions", required: false),
new MapField("VoxelSequences", "VoxelSequenceDefinitions", required: false),
new MapField("ModelSequences", "ModelSequenceDefinitions", required: false),
new MapField("Weapons", "WeaponDefinitions", required: false),
new MapField("Voices", "VoiceDefinitions", required: false),
new MapField("Music", "MusicDefinitions", required: false),
@@ -199,7 +200,7 @@ namespace OpenRA
// Custom map yaml. Public for access by the map importers and lint checks
public readonly MiniYaml RuleDefinitions;
public readonly MiniYaml SequenceDefinitions;
public readonly MiniYaml VoxelSequenceDefinitions;
public readonly MiniYaml ModelSequenceDefinitions;
public readonly MiniYaml WeaponDefinitions;
public readonly MiniYaml VoiceDefinitions;
public readonly MiniYaml MusicDefinitions;
@@ -386,13 +387,13 @@ namespace OpenRA
try
{
Rules = Ruleset.Load(modData, this, Tileset, RuleDefinitions, WeaponDefinitions,
VoiceDefinitions, NotificationDefinitions, MusicDefinitions, SequenceDefinitions);
VoiceDefinitions, NotificationDefinitions, MusicDefinitions, SequenceDefinitions, ModelSequenceDefinitions);
}
catch (Exception e)
{
Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e);
InvalidCustomRules = true;
Rules = Ruleset.LoadDefaultsForTileSet(modData, Tileset);
Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e.Message);
}
Rules.Sequences.Preload();
@@ -761,8 +762,11 @@ namespace OpenRA
// (b) Therefore:
// - ax + by adds (a - b) * 512 + 512 to u
// - ax + by adds (a + b) * 512 + 512 to v
var z = Height.Contains(cell) ? 512 * Height[cell] : 0;
return new WPos(512 * (cell.X - cell.Y + 1), 512 * (cell.X + cell.Y + 1), z);
// (c) u, v coordinates run diagonally to the cell axes, and we define
// 1024 as the length projected onto the primary cell axis
// - 512 * sqrt(2) = 724
var z = Height.Contains(cell) ? 724 * Height[cell] : 0;
return new WPos(724 * (cell.X - cell.Y + 1), 724 * (cell.X + cell.Y + 1), z);
}
public WPos CenterOfSubCell(CPos cell, SubCell subCell)
@@ -786,15 +790,15 @@ namespace OpenRA
return new CPos(pos.X / 1024, pos.Y / 1024);
// Convert from world position to isometric cell position:
// (a) Subtract (512, 512) to move the rotation center to the middle of the corner cell
// (b) Rotate axes by -pi/4
// (c) Divide through by sqrt(2) to bring us to an equivalent world pos aligned with u,v axes
// (d) Apply an offset so that the integer division by 1024 rounds in the right direction:
// (i) u is always positive, so add 512 (which then partially cancels the -1024 term from the rotation)
// (ii) v can be negative, so we need to be careful about rounding directions. We add 512 *away from 0* (negative if y > x).
// (e) Divide by 1024 to bring into cell coords.
var u = (pos.Y + pos.X - 512) / 1024;
var v = (pos.Y - pos.X + (pos.Y > pos.X ? 512 : -512)) / 1024;
// (a) Subtract ([1/2 cell], [1/2 cell]) to move the rotation center to the middle of the corner cell
// (b) Rotate axes by -pi/4 to align the world axes with the cell axes
// (c) Apply an offset so that the integer division by [1 cell] rounds in the right direction:
// (i) u is always positive, so add [1/2 cell] (which then partially cancels the -[1 cell] term from the rotation)
// (ii) v can be negative, so we need to be careful about rounding directions. We add [1/2 cell] *away from 0* (negative if y > x).
// (e) Divide by [1 cell] to bring into cell coords.
// The world axes are rotated relative to the cell axes, so the standard cell size (1024) is increased by a factor of sqrt(2)
var u = (pos.Y + pos.X - 724) / 1448;
var v = (pos.Y - pos.X + (pos.Y > pos.X ? 724 : -724)) / 1448;
return new CPos(u, v);
}
@@ -868,19 +872,19 @@ namespace OpenRA
Bounds = Rectangle.FromLTRB(tl.U, tl.V, br.U + 1, br.V + 1);
// Directly calculate the projected map corners in world units avoiding unnecessary
// conversions. This abuses the definition that the width of the cell is always
// 1024 units, and that the height of two rows is 2048 for classic cells and 1024
// conversions. This abuses the definition that the width of the cell along the x world axis
// is always 1024 or 1448 units, and that the height of two rows is 2048 for classic cells and 724
// for isometric cells.
var wtop = tl.V * 1024;
var wbottom = (br.V + 1) * 1024;
if (Grid.Type == MapGridType.RectangularIsometric)
{
wtop /= 2;
wbottom /= 2;
ProjectedTopLeft = new WPos(tl.U * 1448, tl.V * 724, 0);
ProjectedBottomRight = new WPos(br.U * 1448 - 1, (br.V + 1) * 724 - 1, 0);
}
else
{
ProjectedTopLeft = new WPos(tl.U * 1024, tl.V * 1024, 0);
ProjectedBottomRight = new WPos(br.U * 1024 - 1, (br.V + 1) * 1024 - 1, 0);
}
ProjectedTopLeft = new WPos(tl.U * 1024, wtop, 0);
ProjectedBottomRight = new WPos(br.U * 1024 - 1, wbottom - 1, 0);
ProjectedCellBounds = new ProjectedCellRegion(this, tl, br);
}

View File

@@ -54,12 +54,21 @@ namespace OpenRA
? MapClassification.Unknown : Enum<MapClassification>.Parse(kv.Value);
IReadOnlyPackage package;
var optional = name.StartsWith("~");
var optional = name.StartsWith("~", StringComparison.Ordinal);
if (optional)
name = name.Substring(1);
try
{
// HACK: If the path is inside the the support directory then we may need to create it
if (name.StartsWith("^", StringComparison.Ordinal))
{
// Assume that the path is a directory if there is not an existing file with the same name
var resolved = Platform.ResolvePath(name);
if (!File.Exists(resolved))
Directory.CreateDirectory(resolved);
}
package = modData.ModFiles.OpenPackage(name);
}
catch
@@ -92,7 +101,7 @@ namespace OpenRA
{
using (new Support.PerfTimer(map))
{
mapPackage = modData.ModFiles.OpenPackage(map, kv.Key);
mapPackage = kv.Key.OpenPackage(map, modData.ModFiles);
if (mapPackage == null)
continue;
@@ -113,7 +122,7 @@ namespace OpenRA
}
}
public void QueryRemoteMapDetails(IEnumerable<string> uids, Action<MapPreview> mapDetailsReceived = null, Action queryFailed = null)
public void QueryRemoteMapDetails(string repositoryUrl, IEnumerable<string> uids, Action<MapPreview> mapDetailsReceived = null, Action queryFailed = null)
{
var maps = uids.Distinct()
.Select(uid => previews[uid])
@@ -126,7 +135,7 @@ namespace OpenRA
foreach (var p in maps.Values)
p.UpdateRemoteSearch(MapStatus.Searching, null);
var url = Game.Settings.Game.MapRepository + "hash/" + string.Join(",", maps.Keys) + "/yaml";
var url = repositoryUrl + "hash/" + string.Join(",", maps.Keys) + "/yaml";
Action<DownloadDataCompletedEventArgs> onInfoComplete = i =>
{
@@ -201,7 +210,19 @@ namespace OpenRA
foreach (var p in todo)
{
if (p.Preview != null)
Game.RunAfterTick(() => p.SetMinimap(sheetBuilder.Add(p.Preview)));
{
Game.RunAfterTick(() =>
{
try
{
p.SetMinimap(sheetBuilder.Add(p.Preview));
}
catch (Exception e)
{
Log.Write("debug", "Failed to load minimap with exception: {0}", e);
}
});
}
// Yuck... But this helps the UI Jank when opening the map selector significantly.
Thread.Sleep(Environment.ProcessorCount == 1 ? 25 : 5);

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
@@ -91,21 +92,34 @@ namespace OpenRA
else if (defaultSubCellIndex < (SubCellOffsets.Length > 1 ? 1 : 0) || defaultSubCellIndex >= SubCellOffsets.Length)
throw new InvalidDataException("Subcell default index must be a valid index into the offset triples and must be greater than 0 for mods with subcells");
var leftDelta = Type == MapGridType.RectangularIsometric ? new WVec(-512, 0, 0) : new WVec(-512, -512, 0);
var topDelta = Type == MapGridType.RectangularIsometric ? new WVec(0, -512, 0) : new WVec(512, -512, 0);
var rightDelta = Type == MapGridType.RectangularIsometric ? new WVec(512, 0, 0) : new WVec(512, 512, 0);
var bottomDelta = Type == MapGridType.RectangularIsometric ? new WVec(0, 512, 0) : new WVec(-512, 512, 0);
CellCorners = cellCornerHalfHeights.Select(ramp => new WVec[]
{
leftDelta + new WVec(0, 0, 512 * ramp[0]),
topDelta + new WVec(0, 0, 512 * ramp[1]),
rightDelta + new WVec(0, 0, 512 * ramp[2]),
bottomDelta + new WVec(0, 0, 512 * ramp[3])
}).ToArray();
var makeCorners = Type == MapGridType.RectangularIsometric ?
(Func<int[], WVec[]>)IsometricCellCorners : RectangularCellCorners;
CellCorners = cellCornerHalfHeights.Select(makeCorners).ToArray();
TilesByDistance = CreateTilesByDistance();
}
static WVec[] IsometricCellCorners(int[] cornerHeight)
{
return new WVec[]
{
new WVec(-724, 0, 724 * cornerHeight[0]),
new WVec(0, -724, 724 * cornerHeight[1]),
new WVec(724, 0, 724 * cornerHeight[2]),
new WVec(0, 724, 724 * cornerHeight[3])
};
}
static WVec[] RectangularCellCorners(int[] cornerHeight)
{
return new WVec[]
{
new WVec(-512, -512, 512 * cornerHeight[0]),
new WVec(512, -512, 512 * cornerHeight[1]),
new WVec(512, 512, 512 * cornerHeight[2]),
new WVec(-512, 512, 512 * cornerHeight[3])
};
}
CVec[][] CreateTilesByDistance()
{
var ts = new List<CVec>[MaximumTileSearchRange + 1];

View File

@@ -123,8 +123,8 @@ namespace OpenRA
}
static readonly CPos[] NoSpawns = new CPos[] { };
MapCache cache;
ModData modData;
readonly MapCache cache;
readonly ModData modData;
public readonly string Uid;
public IReadOnlyPackage Package { get; private set; }
@@ -307,8 +307,9 @@ namespace OpenRA
var musicDefinitions = LoadRuleSection(yaml, "Music");
var notificationDefinitions = LoadRuleSection(yaml, "Notifications");
var sequenceDefinitions = LoadRuleSection(yaml, "Sequences");
var modelSequenceDefinitions = LoadRuleSection(yaml, "ModelSequences");
var rules = Ruleset.Load(modData, this, TileSet, ruleDefinitions, weaponDefinitions,
voiceDefinitions, notificationDefinitions, musicDefinitions, sequenceDefinitions);
voiceDefinitions, notificationDefinitions, musicDefinitions, sequenceDefinitions, modelSequenceDefinitions);
var flagged = Ruleset.DefinesUnsafeCustomRules(modData, this, ruleDefinitions,
weaponDefinitions, voiceDefinitions, notificationDefinitions, sequenceDefinitions);
return Pair.New(rules, flagged);
@@ -390,8 +391,9 @@ namespace OpenRA
var musicDefinitions = LoadRuleSection(rulesYaml, "Music");
var notificationDefinitions = LoadRuleSection(rulesYaml, "Notifications");
var sequenceDefinitions = LoadRuleSection(rulesYaml, "Sequences");
var modelSequenceDefinitions = LoadRuleSection(rulesYaml, "ModelSequences");
var rules = Ruleset.Load(modData, this, TileSet, ruleDefinitions, weaponDefinitions,
voiceDefinitions, notificationDefinitions, musicDefinitions, sequenceDefinitions);
voiceDefinitions, notificationDefinitions, musicDefinitions, sequenceDefinitions, modelSequenceDefinitions);
var flagged = Ruleset.DefinesUnsafeCustomRules(modData, this, ruleDefinitions,
weaponDefinitions, voiceDefinitions, notificationDefinitions, sequenceDefinitions);
return Pair.New(rules, flagged);
@@ -416,7 +418,7 @@ namespace OpenRA
innerData = newData;
}
public void Install(Action onSuccess)
public void Install(string mapRepositoryUrl, Action onSuccess)
{
if (Status != MapStatus.DownloadAvailable || !Game.Settings.Game.AllowDownloading)
return;
@@ -431,12 +433,11 @@ namespace OpenRA
}
var mapInstallPackage = installLocation.Key as IReadWritePackage;
var modData = Game.ModData;
new Thread(() =>
{
// Request the filename from the server
// Run in a worker thread to avoid network delays
var mapUrl = Game.Settings.Game.MapRepository + Uid;
var mapUrl = mapRepositoryUrl + Uid;
var mapFilename = string.Empty;
try
{
@@ -472,7 +473,7 @@ namespace OpenRA
Log.Write("debug", "Downloaded map to '{0}'", mapFilename);
Game.RunAfterTick(() =>
{
var package = modData.ModFiles.OpenPackage(mapFilename, mapInstallPackage);
var package = mapInstallPackage.OpenPackage(mapFilename, modData.ModFiles);
if (package == null)
innerData.Status = MapStatus.DownloadError;
else

View File

@@ -84,7 +84,7 @@ namespace OpenRA
public readonly int[] Frames;
public readonly int2 Size;
public readonly bool PickAny;
public readonly string Category;
public readonly string[] Categories;
public readonly string Palette;
readonly TerrainTileInfo[] tileInfo;

View File

@@ -231,11 +231,6 @@ namespace OpenRA
return ret;
}
public static Dictionary<string, MiniYaml> DictFromFile(string path)
{
return FromFile(path).ToDictionary(x => x.Key, x => x.Value);
}
public static Dictionary<string, MiniYaml> DictFromStream(Stream stream, string fileName = "<no filename available>")
{
return FromStream(stream, fileName).ToDictionary(x => x.Key, x => x.Value);

View File

@@ -13,7 +13,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Widgets;
@@ -27,11 +26,12 @@ namespace OpenRA
public readonly ObjectCreator ObjectCreator;
public readonly WidgetLoader WidgetLoader;
public readonly MapCache MapCache;
public readonly IPackageLoader[] PackageLoaders;
public readonly ISoundLoader[] SoundLoaders;
public readonly ISpriteLoader[] SpriteLoaders;
public readonly ISpriteSequenceLoader SpriteSequenceLoader;
public readonly IModelSequenceLoader ModelSequenceLoader;
public ILoadScreen LoadScreen { get; private set; }
public VoxelLoader VoxelLoader { get; private set; }
public CursorProvider CursorProvider { get; private set; }
public FS ModFiles;
public IReadOnlyFileSystem DefaultFileSystem { get { return ModFiles; } }
@@ -49,13 +49,13 @@ namespace OpenRA
{
Languages = new string[0];
ModFiles = new FS(mods);
// Take a local copy of the manifest
Manifest = new Manifest(mod.Id, mod.Package);
ModFiles.LoadFromManifest(Manifest);
ObjectCreator = new ObjectCreator(Manifest, mods);
PackageLoaders = ObjectCreator.GetLoaders<IPackageLoader>(Manifest.PackageFormats, "package");
ObjectCreator = new ObjectCreator(Manifest, ModFiles);
ModFiles = new FS(mods, PackageLoaders);
ModFiles.LoadFromManifest(Manifest);
Manifest.LoadCustomData(ObjectCreator);
if (useLoadScreen)
@@ -68,18 +68,27 @@ namespace OpenRA
WidgetLoader = new WidgetLoader(this);
MapCache = new MapCache(this);
SoundLoaders = GetLoaders<ISoundLoader>(Manifest.SoundFormats, "sound");
SpriteLoaders = GetLoaders<ISpriteLoader>(Manifest.SpriteFormats, "sprite");
SoundLoaders = ObjectCreator.GetLoaders<ISoundLoader>(Manifest.SoundFormats, "sound");
SpriteLoaders = ObjectCreator.GetLoaders<ISpriteLoader>(Manifest.SpriteFormats, "sprite");
var sequenceFormat = Manifest.Get<SpriteSequenceFormat>();
var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");
var ctor = sequenceLoader != null ? sequenceLoader.GetConstructor(new[] { typeof(ModData) }) : null;
if (sequenceLoader == null || !sequenceLoader.GetInterfaces().Contains(typeof(ISpriteSequenceLoader)) || ctor == null)
var sequenceCtor = sequenceLoader != null ? sequenceLoader.GetConstructor(new[] { typeof(ModData) }) : null;
if (sequenceLoader == null || !sequenceLoader.GetInterfaces().Contains(typeof(ISpriteSequenceLoader)) || sequenceCtor == null)
throw new InvalidOperationException("Unable to find a sequence loader for type '{0}'.".F(sequenceFormat.Type));
SpriteSequenceLoader = (ISpriteSequenceLoader)ctor.Invoke(new[] { this });
SpriteSequenceLoader = (ISpriteSequenceLoader)sequenceCtor.Invoke(new[] { this });
SpriteSequenceLoader.OnMissingSpriteError = s => Log.Write("debug", s);
var modelFormat = Manifest.Get<ModelSequenceFormat>();
var modelLoader = ObjectCreator.FindType(modelFormat.Type + "Loader");
var modelCtor = modelLoader != null ? modelLoader.GetConstructor(new[] { typeof(ModData) }) : null;
if (modelLoader == null || !modelLoader.GetInterfaces().Contains(typeof(IModelSequenceLoader)) || modelCtor == null)
throw new InvalidOperationException("Unable to find a model loader for type '{0}'.".F(modelFormat.Type));
ModelSequenceLoader = (IModelSequenceLoader)modelCtor.Invoke(new[] { this });
ModelSequenceLoader.OnMissingModelError = s => Log.Write("debug", s);
defaultRules = Exts.Lazy(() => Ruleset.LoadDefaults(this));
defaultTileSets = Exts.Lazy(() =>
{
@@ -122,28 +131,9 @@ namespace OpenRA
Game.Sound.Initialize(SoundLoaders, fileSystem);
if (VoxelLoader != null)
VoxelLoader.Dispose();
VoxelLoader = new VoxelLoader(fileSystem);
CursorProvider = new CursorProvider(this);
}
TLoader[] GetLoaders<TLoader>(IEnumerable<string> formats, string name)
{
var loaders = new List<TLoader>();
foreach (var format in formats)
{
var loader = ObjectCreator.FindType(format + "Loader");
if (loader == null || !loader.GetInterfaces().Contains(typeof(TLoader)))
throw new InvalidOperationException("Unable to find a {0} loader for type '{1}'.".F(name, format));
loaders.Add((TLoader)ObjectCreator.CreateBasic(loader));
}
return loaders.ToArray();
}
public IEnumerable<string> Languages { get; private set; }
void LoadTranslations(Map map)
@@ -204,9 +194,6 @@ namespace OpenRA
foreach (var entry in map.Rules.Music)
entry.Value.Load(map);
VoxelProvider.Initialize(VoxelLoader, map, MiniYaml.Load(map, Manifest.VoxelSequences, map.VoxelSequenceDefinitions));
VoxelLoader.Finish();
return map;
}
@@ -215,8 +202,9 @@ namespace OpenRA
if (LoadScreen != null)
LoadScreen.Dispose();
MapCache.Dispose();
if (VoxelLoader != null)
VoxelLoader.Dispose();
if (ObjectCreator != null)
ObjectCreator.Dispose();
}
}

View File

@@ -46,6 +46,7 @@ namespace OpenRA
public uint ExtraData;
public bool IsImmediate;
public bool SuppressVisualFeedback;
public Actor VisualFeedbackTarget;
public Player Player { get { return Subject != null ? Subject.Owner : null; } }

View File

@@ -90,9 +90,14 @@ namespace OpenRA.Network
return Slots.FirstOrDefault(s => !s.Value.Closed && ClientInSlot(s.Key) == null && s.Value.AllowBots).Key;
}
public bool IsSinglePlayer
public IEnumerable<Client> NonBotClients
{
get { return Clients.Count(c => c.Bot == null) == 1; }
get { return Clients.Where(c => c.Bot == null); }
}
public IEnumerable<Client> NonBotPlayers
{
get { return Clients.Where(c => c.Bot == null && c.Slot != null); }
}
public enum ClientState { NotReady, Invalid, Ready, Disconnected = 1000 }

View File

@@ -65,6 +65,8 @@ namespace OpenRA.Network
report.SyncedRandom = orderManager.World.SharedRandom.Last;
report.TotalCount = orderManager.World.SharedRandom.TotalCount;
report.Traits.Clear();
report.Effects.Clear();
foreach (var actor in orderManager.World.ActorsHavingTrait<ISync>())
foreach (var syncHash in actor.SyncHashes)
if (syncHash.Hash != 0)

View File

@@ -18,6 +18,8 @@ namespace OpenRA.Network
{
static class UnitOrders
{
const string ServerChatName = "Battlefield Control";
static Player FindPlayerByClient(this World world, Session.Client c)
{
/* TODO: this is still a hack.
@@ -57,7 +59,7 @@ namespace OpenRA.Network
}
case "Message": // Server message
Game.AddChatLine(Color.White, "Server", order.TargetString);
Game.AddChatLine(Color.White, ServerChatName, order.TargetString);
break;
case "Disconnected": /* reports that the target player disconnected */
@@ -105,7 +107,7 @@ namespace OpenRA.Network
break;
}
Game.AddChatLine(Color.White, "Server", "The game has started.");
Game.AddChatLine(Color.White, ServerChatName, "The game has started.");
Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map, WorldType.Regular);
break;
}
@@ -116,10 +118,10 @@ namespace OpenRA.Network
if (client != null)
{
var pause = order.TargetString == "Pause";
if (orderManager.World.Paused != pause && world != null && !world.LobbyInfo.IsSinglePlayer)
if (orderManager.World.Paused != pause && world != null && world.LobbyInfo.NonBotClients.Count() > 1)
{
var pausetext = "The game is {0} by {1}".F(pause ? "paused" : "un-paused", client.Name);
Game.AddChatLine(Color.White, "", pausetext);
Game.AddChatLine(Color.White, ServerChatName, pausetext);
}
orderManager.World.Paused = pause;

View File

@@ -11,13 +11,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OpenRA.Primitives;
namespace OpenRA
{
public class ObjectCreator
public sealed class ObjectCreator : IDisposable
{
// .NET does not support unloading assemblies, so mod libraries will leak across mod changes.
// This tracks the assemblies that have been loaded since game start so that we don't load multiple copies
@@ -27,34 +28,30 @@ namespace OpenRA
readonly Cache<Type, ConstructorInfo> ctorCache;
readonly Pair<Assembly, string>[] assemblies;
public ObjectCreator(Assembly a)
{
typeCache = new Cache<string, Type>(FindType);
ctorCache = new Cache<Type, ConstructorInfo>(GetCtor);
assemblies = a.GetNamespaces().Select(ns => Pair.New(a, ns)).ToArray();
}
public ObjectCreator(Manifest manifest, FileSystem.FileSystem modFiles)
public ObjectCreator(Manifest manifest, InstalledMods mods)
{
typeCache = new Cache<string, Type>(FindType);
ctorCache = new Cache<Type, ConstructorInfo>(GetCtor);
// Allow mods to load types from the core Game assembly, and any additional assemblies they specify.
// Assemblies can only be loaded from directories to avoid circular dependencies on package loaders.
var assemblyList = new List<Assembly>() { typeof(Game).Assembly };
foreach (var path in manifest.Assemblies)
{
var data = modFiles.Open(path).ReadAllBytes();
var resolvedPath = FileSystem.FileSystem.ResolveAssemblyPath(path, manifest, mods);
if (resolvedPath == null)
throw new FileNotFoundException("Assembly `{0}` not found.".F(path));
// .NET doesn't provide any way of querying the metadata of an assembly without either:
// (a) loading duplicate data into the application domain, breaking the world.
// (b) crashing if the assembly has already been loaded.
// We can't check the internal name of the assembly, so we'll work off the data instead
var hash = CryptoUtil.SHA1Hash(data);
var hash = CryptoUtil.SHA1Hash(File.ReadAllBytes(resolvedPath));
Assembly assembly;
if (!ResolvedAssemblies.TryGetValue(hash, out assembly))
{
assembly = Assembly.Load(data);
assembly = Assembly.LoadFile(resolvedPath);
ResolvedAssemblies.Add(hash, assembly);
}
@@ -63,7 +60,6 @@ namespace OpenRA
AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
assemblies = assemblyList.SelectMany(asm => asm.GetNamespaces().Select(ns => Pair.New(asm, ns))).ToArray();
AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly;
}
Assembly ResolveAssembly(object sender, ResolveEventArgs e)
@@ -72,6 +68,9 @@ namespace OpenRA
if (a.FullName == e.Name)
return a;
if (assemblies == null)
return null;
return assemblies.Select(a => a.First).FirstOrDefault(a => a.FullName == e.Name);
}
@@ -146,6 +145,38 @@ namespace OpenRA
.SelectMany(ma => ma.GetTypes());
}
public TLoader[] GetLoaders<TLoader>(IEnumerable<string> formats, string name)
{
var loaders = new List<TLoader>();
foreach (var format in formats)
{
var loader = FindType(format + "Loader");
if (loader == null || !loader.GetInterfaces().Contains(typeof(TLoader)))
throw new InvalidOperationException("Unable to find a {0} loader for type '{1}'.".F(name, format));
loaders.Add((TLoader)CreateBasic(loader));
}
return loaders.ToArray();
}
~ObjectCreator()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing)
{
if (disposing)
AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly;
}
[AttributeUsage(AttributeTargets.Constructor)]
public sealed class UseCtorAttribute : Attribute { }
}

View File

@@ -16,7 +16,6 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<IsWebBootstrapper>false</IsWebBootstrapper>
<ApplicationIcon>OpenRA.ico</ApplicationIcon>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -42,6 +41,8 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<StartArguments>Game.Mod=ra</StartArguments>
<Commandlineparameters>Game.Mod=ra</Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugSymbols>true</DebugSymbols>
@@ -53,6 +54,24 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Optimize>true</Optimize>
<StartArguments>Game.Mod=ra</StartArguments>
<Commandlineparameters>Game.Mod=ra</Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<StartArguments>Game.Mod=ra</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Dune 2000' ">
<StartAction>Project</StartAction>
<StartArguments>Game.Mod=d2k</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Tiberian Dawn' ">
<StartAction>Project</StartAction>
<StartArguments>Game.Mod=cnc</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Tiberian Sun' ">
<StartAction>Project</StartAction>
<StartArguments>Game.Mod=ts</StartArguments>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -88,11 +107,8 @@
<Compile Include="Activities\CallFunc.cs" />
<Compile Include="Actor.cs" />
<Compile Include="CacheStorage.cs" />
<Compile Include="FileSystem\IdxEntry.cs" />
<Compile Include="FileSystem\IPackage.cs" />
<Compile Include="LogProxy.cs" />
<Compile Include="FileFormats\IdxReader.cs" />
<Compile Include="FileSystem\BagFile.cs" />
<Compile Include="Map\MapGrid.cs" />
<Compile Include="Map\MapPlayers.cs" />
<Compile Include="MPos.cs" />
@@ -124,7 +140,6 @@
<Compile Include="Graphics\Util.cs" />
<Compile Include="Graphics\Viewport.cs" />
<Compile Include="Graphics\WorldRenderer.cs" />
<Compile Include="Group.cs" />
<Compile Include="IUtilityCommand.cs" />
<Compile Include="ModData.cs" />
<Compile Include="Network\Connection.cs" />
@@ -146,9 +161,11 @@
<Compile Include="Player.cs" />
<Compile Include="Primitives\MergedStream.cs" />
<Compile Include="Primitives\PlayerDictionary.cs" />
<Compile Include="Primitives\ReadOnlyAdapterStream.cs" />
<Compile Include="Primitives\SegmentStream.cs" />
<Compile Include="Primitives\SpatiallyPartitioned.cs" />
<Compile Include="Primitives\ConcurrentCache.cs" />
<Compile Include="Primitives\ZipFileHelper.cs" />
<Compile Include="SelectableExts.cs" />
<Compile Include="Selection.cs" />
<Compile Include="Server\Connection.cs" />
@@ -180,11 +197,8 @@
<Compile Include="Traits\DebugPauseState.cs" />
<Compile Include="Network\UPnP.cs" />
<Compile Include="Graphics\Renderable.cs" />
<Compile Include="Graphics\Voxel.cs" />
<Compile Include="Graphics\VoxelRenderer.cs" />
<Compile Include="Graphics\VoxelLoader.cs" />
<Compile Include="Graphics\VoxelProvider.cs" />
<Compile Include="Graphics\VoxelAnimation.cs" />
<Compile Include="Graphics\ModelRenderer.cs" />
<Compile Include="Graphics\ModelAnimation.cs" />
<Compile Include="Traits\Player\FrozenActorLayer.cs" />
<Compile Include="Graphics\Theater.cs" />
<Compile Include="Traits\Player\PlayerColorPalette.cs" />
@@ -221,7 +235,6 @@
<Compile Include="Support\PerfSample.cs" />
<Compile Include="Graphics\SpriteRenderable.cs" />
<Compile Include="Widgets\Widget.cs" />
<Compile Include="Widgets\RootWidget.cs" />
<Compile Include="Widgets\WidgetLoader.cs" />
<Compile Include="Widgets\ChromeMetrics.cs" />
<Compile Include="Widgets\WidgetUtils.cs" />
@@ -237,21 +250,19 @@
<Compile Include="Graphics\RgbaColorRenderer.cs" />
<Compile Include="Traits\Player\IndexedPlayerPalette.cs" />
<Compile Include="Traits\ActivityUtils.cs" />
<Compile Include="FileSystem\ZipFolder.cs" />
<Compile Include="Primitives\float3.cs" />
<Compile Include="InstalledMods.cs" />
<Compile Include="CryptoUtil.cs" />
<Compile Include="Support\ConditionExpression.cs" />
<Compile Include="Support\VariableExpression.cs" />
<Compile Include="ExternalMods.cs" />
<Compile Include="Graphics\Model.cs" />
<Compile Include="UtilityCommands\RegisterModCommand.cs" />
<Compile Include="UtilityCommands\UnregisterModCommand.cs" />
<Compile Include="UtilityCommands\ClearInvalidModRegistrationsCommand.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileSystem\D2kSoundResources.cs" />
<Compile Include="FileSystem\Folder.cs" />
<Compile Include="FileSystem\InstallShieldPackage.cs" />
<Compile Include="FileSystem\MixFile.cs" />
<Compile Include="FileSystem\Pak.cs" />
<Compile Include="FileSystem\ZipFile.cs" />
<Compile Include="FileSystem\BigFile.cs" />
<Compile Include="Map\PlayerReference.cs" />
<Compile Include="Map\TileReference.cs" />
<Compile Include="Map\TileSet.cs" />
@@ -259,15 +270,7 @@
<Compile Include="FieldSaver.cs" />
<Compile Include="Manifest.cs" />
<Compile Include="Graphics\Vertex.cs" />
<Compile Include="FileFormats\Blast.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="FileFormats\CRC32.cs" />
<Compile Include="FileFormats\XccGlobalDatabase.cs" />
<Compile Include="FileFormats\XccLocalDatabase.cs" />
<Compile Include="FileFormats\HvaReader.cs" />
<Compile Include="FileFormats\PngLoader.cs" />
<Compile Include="FileFormats\VxlReader.cs" />
<Compile Include="Primitives\ActionQueue.cs" />
<Compile Include="Primitives\Bits.cs" />
<Compile Include="Primitives\Cache.cs" />
@@ -288,7 +291,6 @@
<Compile Include="Map\MapCache.cs" />
<Compile Include="Map\MapPreview.cs" />
<Compile Include="Graphics\HSLColor.cs" />
<Compile Include="FileSystem\PackageEntry.cs" />
<Compile Include="CPos.cs" />
<Compile Include="CVec.cs" />
<Compile Include="WAngle.cs" />
@@ -333,8 +335,5 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="OpenRA.ico" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

View File

@@ -15,8 +15,8 @@ namespace OpenRA.Orders
{
public class GenericSelectTarget : UnitOrderGenerator
{
public readonly string OrderName;
protected readonly IEnumerable<Actor> Subjects;
protected readonly string OrderName;
protected readonly string Cursor;
protected readonly MouseButton ExpectedButton;

View File

@@ -139,8 +139,15 @@ namespace OpenRA.Orders
if (mi.Modifiers.HasModifier(Modifiers.Alt))
modifiers |= TargetModifiers.ForceMove;
// The Select(x => x) is required to work around an issue on mono 5.0
// where calling OrderBy* on SelectManySingleSelectorIterator can in some
// circumstances (which we were unable to identify) replace entries in the
// enumeration with duplicates of other entries.
// Other action that replace the SelectManySingleSelectorIterator with a
// different enumerator type (e.g. .Where(true) or .ToList()) also work.
var orders = self.TraitsImplementing<IIssueOrder>()
.SelectMany(trait => trait.Orders.Select(x => new { Trait = trait, Order = x }))
.Select(x => x)
.OrderByDescending(x => x.Order.OrderPriority);
for (var i = 0; i < 2; i++)

View File

@@ -22,6 +22,7 @@ namespace OpenRA
public static class Platform
{
public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } }
public static readonly Guid SessionGUID = Guid.NewGuid();
static Lazy<PlatformType> currentPlatform = Exts.Lazy(GetCurrentPlatform);
@@ -63,14 +64,19 @@ namespace OpenRA
}
}
/// <summary>
/// Directory containing user-specific support files (settings, maps, replays, game data, etc).
/// The directory will automatically be created if it does not exist when this is queried.
/// </summary>
public static string SupportDir { get { return supportDir.Value; } }
static Lazy<string> supportDir = Exts.Lazy(GetSupportDir);
static string GetSupportDir()
{
// Use a local directory in the game root if it exists
if (Directory.Exists("Support"))
return "Support" + Path.DirectorySeparatorChar;
// Use a local directory in the game root if it exists (shared with the system support dir)
var localSupportDir = Path.Combine(GameDir, "Support");
if (Directory.Exists(localSupportDir))
return localSupportDir + Path.DirectorySeparatorChar;
var dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
@@ -93,12 +99,51 @@ namespace OpenRA
return dir + Path.DirectorySeparatorChar;
}
public static string GameDir { get { return AppDomain.CurrentDomain.BaseDirectory; } }
/// <summary>
/// Directory containing system-wide support files (mod metadata).
/// This directory is not guaranteed to exist or be writable.
/// Consumers are expected to check the validity of the returned value, and
/// fall back to the user support directory if necessary.
/// </summary>
public static string SystemSupportDir { get { return systemSupportDir.Value; } }
static Lazy<string> systemSupportDir = Exts.Lazy(GetSystemSupportDir);
static string GetSystemSupportDir()
{
// Use a local directory in the game root if it exists (shared with the system support dir)
var localSupportDir = Path.Combine(GameDir, "Support");
if (Directory.Exists(localSupportDir))
return localSupportDir + Path.DirectorySeparatorChar;
switch (CurrentPlatform)
{
case PlatformType.Windows:
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "OpenRA") + Path.DirectorySeparatorChar;
case PlatformType.OSX:
return "/Library/Application Support/OpenRA/";
default:
return "/var/games/openra/";
}
}
public static string GameDir
{
get
{
var dir = AppDomain.CurrentDomain.BaseDirectory;
// Add trailing DirectorySeparator for some buggy AppPool hosts
if (!dir.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
dir += Path.DirectorySeparatorChar;
return dir;
}
}
/// <summary>Replaces special character prefixes with full paths.</summary>
public static string ResolvePath(string path)
{
path = path.TrimEnd(new char[] { ' ', '\t' });
path = path.TrimEnd(' ', '\t');
// Paths starting with ^ are relative to the support dir
if (path.StartsWith("^", StringComparison.Ordinal))

View File

@@ -47,12 +47,13 @@ namespace OpenRA
public readonly bool Playable = true;
public readonly int ClientIndex;
public readonly PlayerReference PlayerReference;
public readonly bool IsBot;
public readonly string BotType;
/// <summary>The faction (including Random, etc) that was selected in the lobby.</summary>
public readonly FactionInfo DisplayFaction;
public WinState WinState = WinState.Undefined;
public bool IsBot;
public int SpawnPoint;
public bool HasObjectives = false;
public bool Spectating;
@@ -94,8 +95,6 @@ namespace OpenRA
public Player(World world, Session.Client client, PlayerReference pr)
{
string botType;
World = world;
InternalName = pr.Name;
PlayerReference = pr;
@@ -105,8 +104,16 @@ namespace OpenRA
{
ClientIndex = client.Index;
Color = client.Color;
PlayerName = client.Name;
botType = client.Bot;
if (client.Bot != null)
{
var botInfo = world.Map.Rules.Actors["player"].TraitInfos<IBotInfo>().First(b => b.Type == client.Bot);
var botsOfSameType = world.LobbyInfo.Clients.Where(c => c.Bot == client.Bot).ToArray();
PlayerName = botsOfSameType.Length == 1 ? botInfo.Name : "{0} {1}".F(botInfo.Name, botsOfSameType.IndexOf(client) + 1);
}
else
PlayerName = client.Name;
BotType = client.Bot;
Faction = ChooseFaction(world, client.Faction, !pr.LockFaction);
DisplayFaction = ChooseDisplayFaction(world, client.Faction);
}
@@ -119,7 +126,7 @@ namespace OpenRA
NonCombatant = pr.NonCombatant;
Playable = pr.Playable;
Spectating = pr.Spectating;
botType = pr.Bot;
BotType = pr.Bot;
Faction = ChooseFaction(world, pr.Faction, false);
DisplayFaction = ChooseDisplayFaction(world, pr.Faction);
}
@@ -130,12 +137,12 @@ namespace OpenRA
fogVisibilities = PlayerActor.TraitsImplementing<IFogVisibilityModifier>().ToArray();
// Enable the bot logic on the host
IsBot = botType != null;
IsBot = BotType != null;
if (IsBot && Game.IsHost)
{
var logic = PlayerActor.TraitsImplementing<IBot>().FirstOrDefault(b => b.Info.Name == botType);
var logic = PlayerActor.TraitsImplementing<IBot>().FirstOrDefault(b => b.Info.Type == BotType);
if (logic == null)
Log.Write("debug", "Invalid bot type: {0}", botType);
Log.Write("debug", "Invalid bot type: {0}", BotType);
else
logic.Activate(this);
}

View File

@@ -0,0 +1,89 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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;
namespace OpenRA.Primitives
{
/// <summary>
/// Provides a read-only buffering layer so data can be streamed from sources where reading arbitrary amounts of
/// data is difficult.
/// </summary>
public abstract class ReadOnlyAdapterStream : Stream
{
readonly Queue<byte> data = new Queue<byte>(1024);
readonly Stream baseStream;
protected ReadOnlyAdapterStream(Stream stream)
{
if (stream == null)
throw new ArgumentNullException("stream");
if (!stream.CanRead)
throw new ArgumentException("stream must be readable.", "stream");
baseStream = stream;
}
public sealed override bool CanSeek { get { return false; } }
public sealed override bool CanRead { get { return true; } }
public sealed override bool CanWrite { get { return false; } }
public sealed override long Length { get { throw new NotSupportedException(); } }
public sealed override long Position
{
get { throw new NotSupportedException(); }
set { throw new NotSupportedException(); }
}
public sealed override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); }
public sealed override void SetLength(long value) { throw new NotSupportedException(); }
public sealed override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(); }
public sealed override void Flush() { throw new NotSupportedException(); }
public sealed override int Read(byte[] buffer, int offset, int count)
{
var copied = 0;
ConsumeData(buffer, offset, count, ref copied);
var finished = false;
while (copied < count && !finished)
{
finished = BufferData(baseStream, data);
ConsumeData(buffer, offset, count, ref copied);
}
return copied;
}
/// <summary>
/// Reads data into a buffer, which will be used to satisfy <see cref="Read(byte[], int, int)"/> calls.
/// </summary>
/// <param name="baseStream">The source stream from which bytes should be read.</param>
/// <param name="data">The queue where bytes should be enqueued. Do not dequeue from this buffer.</param>
/// <returns>Return true if all data has been read; otherwise, false.</returns>
protected abstract bool BufferData(Stream baseStream, Queue<byte> data);
void ConsumeData(byte[] buffer, int offset, int count, ref int copied)
{
while (copied < count && data.Count > 0)
buffer[offset + copied++] = data.Dequeue();
}
protected override void Dispose(bool disposing)
{
if (disposing)
baseStream.Dispose();
base.Dispose(disposing);
}
}
}

View File

@@ -21,6 +21,15 @@ namespace OpenRA.Primitives
public readonly long BaseOffset;
public readonly long BaseCount;
/// <summary>
/// Creates a new <see cref="SegmentStream"/> that wraps a subset of the source stream. This takes ownership of
/// the source stream. The <see cref="SegmentStream"/> is dependent on the source and changes its underlying
/// position.
/// </summary>
/// <param name="stream">The source stream, of which only a segment should be exposed. Ownership is transferred
/// to the <see cref="SegmentStream"/>.</param>
/// <param name="offset">The offset at which the segment starts.</param>
/// <param name="count">The length of the segment.</param>
public SegmentStream(Stream stream, long offset, long count)
{
if (stream == null)
@@ -90,7 +99,7 @@ namespace OpenRA.Primitives
base.Dispose(disposing);
}
public static long GetOverallNestedOffset(Stream stream, out Stream overallBaseStream)
static long GetOverallNestedOffset(Stream stream, out Stream overallBaseStream)
{
var offset = 0L;
overallBaseStream = stream;
@@ -99,5 +108,34 @@ namespace OpenRA.Primitives
offset += segmentStream.BaseOffset + GetOverallNestedOffset(segmentStream.BaseStream, out overallBaseStream);
return offset;
}
/// <summary>
/// Creates a new <see cref="Stream"/> that wraps a subset of the source stream without taking ownership of it,
/// allowing it to be reused by the caller. The <see cref="Stream"/> is independent of the source stream and
/// won't affect its position.
/// </summary>
/// <param name="stream">The source stream, of which only a segment should be exposed. Ownership is retained by
/// the caller.</param>
/// <param name="offset">The offset at which the segment starts.</param>
/// <param name="count">The length of the segment.</param>
public static Stream CreateWithoutOwningStream(Stream stream, long offset, int count)
{
Stream parentStream;
var nestedOffset = offset + GetOverallNestedOffset(stream, out parentStream);
// Special case FileStream - instead of creating an in-memory copy,
// just reference the portion of the on-disk file that we need to save memory.
// We use GetType instead of 'is' here since we can't handle any derived classes of FileStream.
if (parentStream.GetType() == typeof(FileStream))
{
var path = ((FileStream)parentStream).Name;
return new SegmentStream(File.OpenRead(path), nestedOffset, count);
}
// For all other streams, create a copy in memory.
// This uses more memory but is the only way in general to ensure the returned streams won't clash.
stream.Seek(offset, SeekOrigin.Begin);
return new MemoryStream(stream.ReadBytes(count));
}
}
}

View File

@@ -0,0 +1,46 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.IO;
using System.Text;
using ICSharpCode.SharpZipLib.Zip;
namespace OpenRA.Primitives
{
public static class ZipFileHelper
{
/// <summary>
/// Creates a <see cref="ZipFile"/> with UTF8 encoding. Avoid using <see cref="ZipFile(Stream)"/> as you
/// cannot be sure of the encoding that will be used.
/// </summary>
public static ZipFile Create(Stream stream)
{
// SharpZipLib uses this global as the encoding to use for all ZipFiles.
// The initial value is the system code page, which causes several problems.
// 1) On some systems, the code page for a certain encoding might not even be installed.
// 2) The code page is different on every system, resulting in unpredictability.
// 3) The code page might not work for decoding some archives.
// We set the default to UTF8 instead which fixes all these problems.
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
return new ZipFile(stream);
}
/// <summary>
/// Creates a <see cref="ZipFile"/> with UTF8 encoding. Avoid using <see cref="ZipFile(FileStream)"/> as you
/// cannot be sure of the encoding that will be used.
/// </summary>
public static ZipFile Create(FileStream stream)
{
ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage;
return new ZipFile(stream);
}
}
}

View File

@@ -23,7 +23,7 @@ namespace OpenRA
public SpriteRenderer WorldSpriteRenderer { get; private set; }
public SpriteRenderer WorldRgbaSpriteRenderer { get; private set; }
public RgbaColorRenderer WorldRgbaColorRenderer { get; private set; }
public VoxelRenderer WorldVoxelRenderer { get; private set; }
public ModelRenderer WorldModelRenderer { get; private set; }
public RgbaColorRenderer RgbaColorRenderer { get; private set; }
public SpriteRenderer RgbaSpriteRenderer { get; private set; }
public SpriteRenderer SpriteRenderer { get; private set; }
@@ -59,7 +59,7 @@ namespace OpenRA
WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
WorldRgbaColorRenderer = new RgbaColorRenderer(this, Device.CreateShader("color"));
WorldVoxelRenderer = new VoxelRenderer(this, Device.CreateShader("vxl"));
WorldModelRenderer = new ModelRenderer(this, Device.CreateShader("model"));
RgbaColorRenderer = new RgbaColorRenderer(this, Device.CreateShader("color"));
RgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
SpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
@@ -136,7 +136,7 @@ namespace OpenRA
lastZoom = zoom;
WorldRgbaSpriteRenderer.SetViewportParams(Resolution, depthScale, depthOffset, zoom, scroll);
WorldSpriteRenderer.SetViewportParams(Resolution, depthScale, depthOffset, zoom, scroll);
WorldVoxelRenderer.SetViewportParams(Resolution, zoom, scroll);
WorldModelRenderer.SetViewportParams(Resolution, zoom, scroll);
WorldRgbaColorRenderer.SetViewportParams(Resolution, depthScale, depthOffset, zoom, scroll);
}
}
@@ -153,7 +153,7 @@ namespace OpenRA
SpriteRenderer.SetPalette(currentPaletteTexture);
WorldSpriteRenderer.SetPalette(currentPaletteTexture);
WorldRgbaSpriteRenderer.SetPalette(currentPaletteTexture);
WorldVoxelRenderer.SetPalette(currentPaletteTexture);
WorldModelRenderer.SetPalette(currentPaletteTexture);
}
public void EndFrame(IInputHandler inputHandler)
@@ -267,7 +267,7 @@ namespace OpenRA
public void Dispose()
{
Device.Dispose();
WorldVoxelRenderer.Dispose();
WorldModelRenderer.Dispose();
tempBuffer.Dispose();
if (fontSheetBuilder != null)
fontSheetBuilder.Dispose();

View File

@@ -19,10 +19,23 @@ namespace OpenRA
{
public class Selection
{
public int Hash { get; private set; }
public IEnumerable<Actor> Actors { get { return actors; } }
readonly HashSet<Actor> actors = new HashSet<Actor>();
void UpdateHash()
{
// Not a real hash, but things checking this only care about checking when the selection has changed
// For this purpose, having a false positive (forcing a refresh when nothing changed) is much better
// than a false negative (selection state mismatch)
Hash += 1;
}
public void Add(World w, Actor a)
{
actors.Add(a);
UpdateHash();
foreach (var sel in a.TraitsImplementing<INotifySelected>())
sel.Selected(a);
foreach (var ns in w.WorldActor.TraitsImplementing<INotifySelection>())
@@ -58,6 +71,8 @@ namespace OpenRA
}
}
UpdateHash();
foreach (var a in newSelection)
foreach (var sel in a.TraitsImplementing<INotifySelected>())
sel.Selected(a);
@@ -85,12 +100,17 @@ namespace OpenRA
}
}
public IEnumerable<Actor> Actors { get { return actors; } }
public void Clear() { actors.Clear(); }
public void Clear()
{
actors.Clear();
UpdateHash();
}
public void Tick(World world)
{
actors.RemoveWhere(a => !a.IsInWorld || (!a.Owner.IsAlliedWith(world.RenderPlayer) && world.FogObscures(a)));
var removed = actors.RemoveWhere(a => !a.IsInWorld || (!a.Owner.IsAlliedWith(world.RenderPlayer) && world.FogObscures(a)));
if (removed > 0)
UpdateHash();
foreach (var cg in controlGroups.Values)
{

View File

@@ -306,7 +306,7 @@ namespace OpenRA.Server
IpAddress = ((IPEndPoint)newConn.Socket.RemoteEndPoint).Address.ToString(),
Index = newConn.PlayerIndex,
Slot = LobbyInfo.FirstEmptySlot(),
PreferredColor = handshake.Client.Color,
PreferredColor = handshake.Client.PreferredColor,
Color = handshake.Client.Color,
Faction = "Random",
SpawnPoint = 0,
@@ -375,7 +375,7 @@ namespace OpenRA.Server
Log.Write("server", "{0} ({1}) has joined the game.",
client.Name, newConn.Socket.RemoteEndPoint);
if (Dedicated || !LobbyInfo.IsSinglePlayer)
if (LobbyInfo.NonBotClients.Count() > 1)
SendMessage("{0} has joined the game.".F(client.Name));
// Send initial ping
@@ -392,7 +392,7 @@ namespace OpenRA.Server
SendOrderTo(newConn, "Message", motd);
}
if (!LobbyInfo.IsSinglePlayer && Map.DefinesUnsafeCustomRules)
if (Map.DefinesUnsafeCustomRules)
SendOrderTo(newConn, "Message", "This map contains custom rules. Game experience may change.");
if (!LobbyInfo.GlobalSettings.EnableSingleplayer)
@@ -679,7 +679,7 @@ namespace OpenRA.Server
}
// HACK: Turn down the latency if there is only one real player
if (LobbyInfo.IsSinglePlayer)
if (LobbyInfo.NonBotClients.Count() == 1)
LobbyInfo.GlobalSettings.OrderLatency = 1;
SyncLobbyInfo();

View File

@@ -51,8 +51,6 @@ namespace OpenRA
[Desc("Locks the game with a password.")]
public string Password = "";
public string MasterServer = "http://master.openra.net/";
[Desc("Allow users to enable NAT discovery for external IP detection and automatic port forwarding.")]
public bool DiscoverNatDevices = false;
@@ -120,6 +118,9 @@ namespace OpenRA
[Desc("At which frames per second to cap the framerate.")]
public int MaxFramerate = 60;
[Desc("Disable high resolution DPI scaling on Windows operating systems.")]
public bool DisableWindowsDPIScaling = true;
public int BatchSize = 8192;
public int SheetSize = 2048;
@@ -153,13 +154,11 @@ namespace OpenRA
public class GameSettings
{
[Desc("Load a specific mod on startup.")]
public string Mod = null;
public string PreviousMod = "ra";
public string Platform = "Default";
public bool ViewportEdgeScroll = true;
public int ViewportEdgeScrollMargin = 5;
public bool LockMouseWindow = false;
public MouseScrollType MiddleMouseScroll = MouseScrollType.Standard;
public MouseScrollType RightMouseScroll = MouseScrollType.Disabled;
@@ -175,13 +174,11 @@ namespace OpenRA
public bool DrawTargetLine = true;
public bool AllowDownloading = true;
public string MapRepository = "http://resource.openra.net/map/";
public bool AllowZoom = true;
public Modifiers ZoomModifier = Modifiers.Ctrl;
public bool FetchNews = true;
public string NewsUrl = "http://master.openra.net/gamenews";
public MPGameFilters MPGameFilters = MPGameFilters.Waiting | MPGameFilters.Empty | MPGameFilters.Protected | MPGameFilters.Started;
}
@@ -228,7 +225,10 @@ namespace OpenRA
public Hotkey StopKey = new Hotkey(Keycode.S, Modifiers.None);
public Hotkey ScatterKey = new Hotkey(Keycode.X, Modifiers.Ctrl);
public Hotkey DeployKey = new Hotkey(Keycode.F, Modifiers.None);
public Hotkey StanceCycleKey = new Hotkey(Keycode.Z, Modifiers.Ctrl);
public Hotkey StanceHoldFireKey = new Hotkey(Keycode.F, Modifiers.Alt);
public Hotkey StanceReturnFireKey = new Hotkey(Keycode.D, Modifiers.Alt);
public Hotkey StanceDefendKey = new Hotkey(Keycode.S, Modifiers.Alt);
public Hotkey StanceAttackAnythingKey = new Hotkey(Keycode.A, Modifiers.Alt);
public Hotkey GuardKey = new Hotkey(Keycode.D, Modifiers.None);
public Hotkey ObserverCombinedView = new Hotkey(Keycode.MINUS, Modifiers.None);
@@ -330,7 +330,6 @@ namespace OpenRA
public string Hostname = "irc.openra.net";
public int Port = 6667;
public string Channel = "lobby";
public string Nickname = "Newbie";
public string QuitMessage = "Battle control terminated!";
public string TimestampFormat = "HH:mm";
public bool ConnectAutomatically = false;
@@ -338,18 +337,23 @@ namespace OpenRA
public class Settings
{
string settingsFile;
readonly string settingsFile;
public PlayerSettings Player = new PlayerSettings();
public GameSettings Game = new GameSettings();
public SoundSettings Sound = new SoundSettings();
public GraphicSettings Graphics = new GraphicSettings();
public ServerSettings Server = new ServerSettings();
public DebugSettings Debug = new DebugSettings();
public KeySettings Keys = new KeySettings();
public ChatSettings Chat = new ChatSettings();
public readonly PlayerSettings Player = new PlayerSettings();
public readonly GameSettings Game = new GameSettings();
public readonly SoundSettings Sound = new SoundSettings();
public readonly GraphicSettings Graphics = new GraphicSettings();
public readonly ServerSettings Server = new ServerSettings();
public readonly DebugSettings Debug = new DebugSettings();
public readonly KeySettings Keys = new KeySettings();
public readonly ChatSettings Chat = new ChatSettings();
public Dictionary<string, object> Sections;
public readonly Dictionary<string, object> Sections;
// A direct clone of the file loaded from disk.
// Any changed settings will be merged over this on save,
// allowing us to persist any unknown configuration keys
readonly List<MiniYamlNode> yamlCache = new List<MiniYamlNode>();
public Settings(string file, Arguments args)
{
@@ -375,11 +379,13 @@ namespace OpenRA
if (File.Exists(settingsFile))
{
var yaml = MiniYaml.DictFromFile(settingsFile);
foreach (var kv in Sections)
if (yaml.ContainsKey(kv.Key))
LoadSectionYaml(yaml[kv.Key], kv.Value);
yamlCache = MiniYaml.FromFile(settingsFile);
foreach (var yamlSection in yamlCache)
{
object settingsSection;
if (Sections.TryGetValue(yamlSection.Key, out settingsSection))
LoadSectionYaml(yamlSection.Value, settingsSection);
}
}
// Override with commandline args
@@ -397,11 +403,39 @@ namespace OpenRA
public void Save()
{
var root = new List<MiniYamlNode>();
foreach (var kv in Sections)
root.Add(new MiniYamlNode(kv.Key, FieldSaver.SaveDifferences(kv.Value, Activator.CreateInstance(kv.Value.GetType()))));
{
var sectionYaml = yamlCache.FirstOrDefault(x => x.Key == kv.Key);
if (sectionYaml == null)
{
sectionYaml = new MiniYamlNode(kv.Key, new MiniYaml(""));
yamlCache.Add(sectionYaml);
}
root.WriteToFile(settingsFile);
var defaultValues = Activator.CreateInstance(kv.Value.GetType());
var fields = FieldLoader.GetTypeLoadInfo(kv.Value.GetType());
foreach (var fli in fields)
{
var serialized = FieldSaver.FormatValue(kv.Value, fli.Field);
var defaultSerialized = FieldSaver.FormatValue(defaultValues, fli.Field);
// Fields with their default value are not saved in the settings yaml
// Make sure that we erase any previously defined custom values
if (serialized == defaultSerialized)
sectionYaml.Value.Nodes.RemoveAll(n => n.Key == fli.YamlName);
else
{
// Update or add the custom value
var fieldYaml = sectionYaml.Value.Nodes.FirstOrDefault(n => n.Key == fli.YamlName);
if (fieldYaml != null)
fieldYaml.Value.Value = serialized;
else
sectionYaml.Value.Nodes.Add(new MiniYamlNode(fli.YamlName, new MiniYaml(serialized)));
}
}
}
yamlCache.WriteToFile(settingsFile);
}
static string SanitizedName(string dirty)

View File

@@ -37,6 +37,8 @@ namespace OpenRA
public sealed class Sound : IDisposable
{
readonly ISoundEngine soundEngine;
ISoundLoader[] loaders;
IReadOnlyFileSystem fileSystem;
Cache<string, ISoundSource> sounds;
ISoundSource rawSource;
ISound music;
@@ -52,12 +54,12 @@ namespace OpenRA
MuteAudio();
}
ISoundSource LoadSound(ISoundLoader[] loaders, IReadOnlyFileSystem fileSystem, string filename)
T LoadSound<T>(string filename, Func<ISoundFormat, T> loadFormat)
{
if (!fileSystem.Exists(filename))
{
Log.Write("sound", "LoadSound, file does not exist: {0}", filename);
return null;
return default(T);
}
using (var stream = fileSystem.Open(filename))
@@ -68,8 +70,7 @@ namespace OpenRA
stream.Position = 0;
if (loader.TryParseSound(stream, out soundFormat))
{
var source = soundEngine.AddSoundSourceFromMemory(
soundFormat.GetPCMInputStream().ReadAllBytes(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate);
var source = loadFormat(soundFormat);
soundFormat.Dispose();
return source;
}
@@ -81,10 +82,20 @@ namespace OpenRA
public void Initialize(ISoundLoader[] loaders, IReadOnlyFileSystem fileSystem)
{
sounds = new Cache<string, ISoundSource>(s => LoadSound(loaders, fileSystem, s));
StopMusic();
soundEngine.StopAllSounds();
if (sounds != null)
foreach (var soundSource in sounds.Values)
if (soundSource != null)
soundSource.Dispose();
this.loaders = loaders;
this.fileSystem = fileSystem;
Func<ISoundFormat, ISoundSource> loadIntoMemory = soundFormat => soundEngine.AddSoundSourceFromMemory(
soundFormat.GetPCMInputStream().ReadAllBytes(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate);
sounds = new Cache<string, ISoundSource>(filename => LoadSound(filename, loadIntoMemory));
currentSounds = new Dictionary<uint, ISound>();
music = null;
currentMusic = null;
video = null;
}
@@ -163,7 +174,7 @@ namespace OpenRA
public void Tick()
{
// Song finished
if (MusicPlaying && !music.Playing)
if (MusicPlaying && music.Complete)
{
StopMusic();
onMusicComplete();
@@ -195,11 +206,17 @@ namespace OpenRA
StopMusic();
var sound = sounds[m.Filename];
if (sound == null)
return;
Func<ISoundFormat, ISound> stream = soundFormat => soundEngine.Play2DStream(
soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate,
false, true, WPos.Zero, MusicVolume);
music = LoadSound(m.Filename, stream);
if (music == null)
{
onMusicComplete = null;
return;
}
music = soundEngine.Play2D(sound, false, true, WPos.Zero, MusicVolume, false);
currentMusic = m;
MusicPlaying = true;
}
@@ -222,10 +239,13 @@ namespace OpenRA
public void StopMusic()
{
if (music != null)
{
soundEngine.StopSound(music);
music = null;
}
MusicPlaying = false;
currentMusic = null;
MusicPlaying = false;
}
public void PauseMusic()
@@ -388,6 +408,11 @@ namespace OpenRA
public void Dispose()
{
StopAudio();
if (sounds != null)
foreach (var soundSource in sounds.Values)
if (soundSource != null)
soundSource.Dispose();
soundEngine.Dispose();
}
}

View File

@@ -10,6 +10,7 @@
#endregion
using System;
using System.IO;
namespace OpenRA
{
@@ -18,6 +19,7 @@ namespace OpenRA
SoundDevice[] AvailableDevices();
ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate);
ISound Play2D(ISoundSource sound, bool loop, bool relative, WPos pos, float volume, bool attenuateVolume);
ISound Play2DStream(Stream stream, int channels, int sampleBits, int sampleRate, bool loop, bool relative, WPos pos, float volume);
float Volume { get; set; }
void PauseSound(ISound sound, bool paused);
void StopSound(ISound sound);
@@ -39,13 +41,13 @@ namespace OpenRA
}
}
public interface ISoundSource { }
public interface ISoundSource : IDisposable { }
public interface ISound
{
float Volume { get; set; }
float SeekPosition { get; }
bool Playing { get; }
bool Complete { get; }
void SetPosition(WPos pos);
}
}

View File

@@ -12,6 +12,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace OpenRA
@@ -117,7 +118,17 @@ namespace OpenRA
public static byte[] ReadAllBytes(this Stream s)
{
using (s)
return s.ReadBytes((int)(s.Length - s.Position));
{
if (s.CanSeek)
return s.ReadBytes((int)(s.Length - s.Position));
var bytes = new List<byte>();
var buffer = new byte[1024];
int count;
while ((count = s.Read(buffer, 0, buffer.Length)) > 0)
bytes.AddRange(buffer.Take(count));
return bytes.ToArray();
}
}
public static void Write(this Stream s, byte[] data)

View File

@@ -43,7 +43,7 @@ namespace OpenRA
connect = Connect;
if (!string.IsNullOrEmpty(URI))
connect = URI.Replace("openra://", "").TrimEnd('/');
connect = URI.Substring(URI.IndexOf("://", System.StringComparison.Ordinal) + 3).TrimEnd('/');
return connect;
}

View File

@@ -51,10 +51,13 @@ namespace OpenRA
var exceptionName = "exception-" + DateTime.UtcNow.ToString("yyyy-MM-ddTHHmmssZ", CultureInfo.InvariantCulture) + ".log";
Log.AddChannel("exception", exceptionName);
if (Game.EngineVersion != null)
Log.Write("exception", "OpenRA engine version {0}", Game.EngineVersion);
if (Game.ModData != null)
{
var mod = Game.ModData.Manifest.Metadata;
Log.Write("exception", "{0} Mod at Version {1}", mod.Title, mod.Version);
Log.Write("exception", "{0} mod version {1}", mod.Title, mod.Version);
}
if (Game.OrderManager != null && Game.OrderManager.World != null && Game.OrderManager.World.Map != null)

View File

@@ -18,14 +18,12 @@ using Expressions = System.Linq.Expressions;
namespace OpenRA.Support
{
public class ConditionExpression
public abstract class VariableExpression
{
public readonly string Expression;
readonly HashSet<string> variables = new HashSet<string>();
public IEnumerable<string> Variables { get { return variables; } }
readonly Func<IReadOnlyDictionary<string, int>, int> asFunction;
enum CharClass { Whitespace, Operator, Mixed, Id, Digit }
static CharClass CharClassOf(char c)
@@ -92,7 +90,7 @@ namespace OpenRA.Support
enum Associativity { Left, Right }
[Flags]
enum OperandSides
enum Sides
{
// Value type
None = 0,
@@ -161,18 +159,34 @@ namespace OpenRA.Support
{
public readonly string Symbol;
public readonly Precedence Precedence;
public readonly OperandSides OperandSides;
public readonly Sides OperandSides;
public readonly Sides WhitespaceSides;
public readonly Associativity Associativity;
public readonly Grouping Opens;
public readonly Grouping Closes;
public TokenTypeInfo(string symbol, Precedence precedence, OperandSides operandSides = OperandSides.None,
public TokenTypeInfo(string symbol, Precedence precedence, Sides operandSides = Sides.None,
Associativity associativity = Associativity.Left,
Grouping opens = Grouping.None, Grouping closes = Grouping.None)
{
Symbol = symbol;
Precedence = precedence;
OperandSides = operandSides;
WhitespaceSides = Sides.None;
Associativity = associativity;
Opens = opens;
Closes = closes;
}
public TokenTypeInfo(string symbol, Precedence precedence, Sides operandSides,
Sides whitespaceSides,
Associativity associativity = Associativity.Left,
Grouping opens = Grouping.None, Grouping closes = Grouping.None)
{
Symbol = symbol;
Precedence = precedence;
OperandSides = operandSides;
WhitespaceSides = whitespaceSides;
Associativity = associativity;
Opens = opens;
Closes = closes;
@@ -183,10 +197,11 @@ namespace OpenRA.Support
{
Symbol = symbol;
Precedence = precedence;
WhitespaceSides = Sides.None;
OperandSides = opens == Grouping.None ?
(closes == Grouping.None ? OperandSides.None : OperandSides.Left)
(closes == Grouping.None ? Sides.None : Sides.Left)
:
(closes == Grouping.None ? OperandSides.Right : OperandSides.Both);
(closes == Grouping.None ? Sides.Right : Sides.Both);
Associativity = associativity;
Opens = opens;
Closes = closes;
@@ -221,52 +236,52 @@ namespace OpenRA.Support
yield return new TokenTypeInfo(")", Precedence.Parens, Grouping.None, Grouping.Parens);
continue;
case TokenType.Not:
yield return new TokenTypeInfo("!", Precedence.Unary, OperandSides.Right, Associativity.Right);
yield return new TokenTypeInfo("!", Precedence.Unary, Sides.Right, Associativity.Right);
continue;
case TokenType.OnesComplement:
yield return new TokenTypeInfo("~", Precedence.Unary, OperandSides.Right, Associativity.Right);
yield return new TokenTypeInfo("~", Precedence.Unary, Sides.Right, Associativity.Right);
continue;
case TokenType.Negate:
yield return new TokenTypeInfo("-", Precedence.Unary, OperandSides.Right, Associativity.Right);
yield return new TokenTypeInfo("-", Precedence.Unary, Sides.Right, Associativity.Right);
continue;
case TokenType.And:
yield return new TokenTypeInfo("&&", Precedence.And, OperandSides.Both);
yield return new TokenTypeInfo("&&", Precedence.And, Sides.Both, Sides.Both);
continue;
case TokenType.Or:
yield return new TokenTypeInfo("||", Precedence.Or, OperandSides.Both);
yield return new TokenTypeInfo("||", Precedence.Or, Sides.Both, Sides.Both);
continue;
case TokenType.Equals:
yield return new TokenTypeInfo("==", Precedence.Equality, OperandSides.Both);
yield return new TokenTypeInfo("==", Precedence.Equality, Sides.Both, Sides.Both);
continue;
case TokenType.NotEquals:
yield return new TokenTypeInfo("!=", Precedence.Equality, OperandSides.Both);
yield return new TokenTypeInfo("!=", Precedence.Equality, Sides.Both, Sides.Both);
continue;
case TokenType.LessThan:
yield return new TokenTypeInfo("<", Precedence.Relation, OperandSides.Both);
yield return new TokenTypeInfo("<", Precedence.Relation, Sides.Both, Sides.Both);
continue;
case TokenType.LessThanOrEqual:
yield return new TokenTypeInfo("<=", Precedence.Relation, OperandSides.Both);
yield return new TokenTypeInfo("<=", Precedence.Relation, Sides.Both, Sides.Both);
continue;
case TokenType.GreaterThan:
yield return new TokenTypeInfo(">", Precedence.Relation, OperandSides.Both);
yield return new TokenTypeInfo(">", Precedence.Relation, Sides.Both, Sides.Both);
continue;
case TokenType.GreaterThanOrEqual:
yield return new TokenTypeInfo(">=", Precedence.Relation, OperandSides.Both);
yield return new TokenTypeInfo(">=", Precedence.Relation, Sides.Both, Sides.Both);
continue;
case TokenType.Add:
yield return new TokenTypeInfo("+", Precedence.Addition, OperandSides.Both);
yield return new TokenTypeInfo("+", Precedence.Addition, Sides.Both, Sides.Both);
continue;
case TokenType.Subtract:
yield return new TokenTypeInfo("-", Precedence.Addition, OperandSides.Both);
yield return new TokenTypeInfo("-", Precedence.Addition, Sides.Both, Sides.Both);
continue;
case TokenType.Multiply:
yield return new TokenTypeInfo("*", Precedence.Multiplication, OperandSides.Both);
yield return new TokenTypeInfo("*", Precedence.Multiplication, Sides.Both, Sides.Both);
continue;
case TokenType.Divide:
yield return new TokenTypeInfo("/", Precedence.Multiplication, OperandSides.Both);
yield return new TokenTypeInfo("/", Precedence.Multiplication, Sides.Both, Sides.Both);
continue;
case TokenType.Modulo:
yield return new TokenTypeInfo("%", Precedence.Multiplication, OperandSides.Both);
yield return new TokenTypeInfo("%", Precedence.Multiplication, Sides.Both, Sides.Both);
continue;
}
@@ -279,7 +294,7 @@ namespace OpenRA.Support
static bool HasRightOperand(TokenType type)
{
return ((int)TokenTypeInfos[(int)type].OperandSides & (int)OperandSides.Right) != 0;
return ((int)TokenTypeInfos[(int)type].OperandSides & (int)Sides.Right) != 0;
}
static bool IsLeftOperandOrNone(TokenType type)
@@ -287,6 +302,21 @@ namespace OpenRA.Support
return type == TokenType.Invalid || HasRightOperand(type);
}
static bool RequiresWhitespaceAfter(TokenType type)
{
return ((int)TokenTypeInfos[(int)type].WhitespaceSides & (int)Sides.Right) != 0;
}
static bool RequiresWhitespaceBefore(TokenType type)
{
return ((int)TokenTypeInfos[(int)type].WhitespaceSides & (int)Sides.Left) != 0;
}
static string GetTokenSymbol(TokenType type)
{
return TokenTypeInfos[(int)type].Symbol;
}
class Token
{
public readonly TokenType Type;
@@ -295,10 +325,10 @@ namespace OpenRA.Support
public virtual string Symbol { get { return TokenTypeInfos[(int)Type].Symbol; } }
public int Precedence { get { return (int)TokenTypeInfos[(int)Type].Precedence; } }
public OperandSides OperandSides { get { return TokenTypeInfos[(int)Type].OperandSides; } }
public Sides OperandSides { get { return TokenTypeInfos[(int)Type].OperandSides; } }
public Associativity Associativity { get { return TokenTypeInfos[(int)Type].Associativity; } }
public bool LeftOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)OperandSides.Left) != 0; } }
public bool RightOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)OperandSides.Right) != 0; } }
public bool LeftOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Left) != 0; } }
public bool RightOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Right) != 0; } }
public Grouping Opens { get { return TokenTypeInfos[(int)Type].Opens; } }
public Grouping Closes { get { return TokenTypeInfos[(int)Type].Closes; } }
@@ -322,7 +352,7 @@ namespace OpenRA.Support
cc = CharClassOf(expression[i]);
if (cc != CharClass.Digit)
{
if (cc != CharClass.Whitespace && cc != CharClass.Operator)
if (cc != CharClass.Whitespace && cc != CharClass.Operator && cc != CharClass.Mixed)
throw new InvalidDataException("Number {0} and variable merged at index {1}".F(
int.Parse(expression.Substring(start, i - start)), start));
@@ -336,6 +366,15 @@ namespace OpenRA.Support
return false;
}
static TokenType VariableOrKeyword(string expression, int start, ref int i)
{
if (CharClassOf(expression[i - 1]) == CharClass.Mixed)
throw new InvalidDataException("Invalid identifier end character at index {0} for `{1}`".F(
i - 1, expression.Substring(start, i - start)));
return VariableOrKeyword(expression, start, i - start);
}
static TokenType VariableOrKeyword(string expression, int start, int length)
{
var i = start;
@@ -466,10 +505,10 @@ namespace OpenRA.Support
{
cc = CharClassOf(expression[i]);
if (cc == CharClass.Whitespace || cc == CharClass.Operator)
return VariableOrKeyword(expression, start, i - start);
return VariableOrKeyword(expression, start, ref i);
}
return VariableOrKeyword(expression, start, i - start);
return VariableOrKeyword(expression, start, ref i);
}
public static Token GetNext(string expression, ref int i, TokenType lastType = TokenType.Invalid)
@@ -477,16 +516,30 @@ namespace OpenRA.Support
if (i == expression.Length)
return null;
// Ignore whitespace
while (CharClassOf(expression[i]) == CharClass.Whitespace)
// Check and eat whitespace
var whitespaceBefore = false;
if (CharClassOf(expression[i]) == CharClass.Whitespace)
{
if (++i == expression.Length)
return null;
whitespaceBefore = true;
while (CharClassOf(expression[i]) == CharClass.Whitespace)
{
if (++i == expression.Length)
return null;
}
}
else if (lastType == TokenType.Invalid)
whitespaceBefore = true;
else if (RequiresWhitespaceAfter(lastType))
throw new InvalidDataException("Missing whitespace at index {0}, after `{1}` operator."
.F(i, GetTokenSymbol(lastType)));
var start = i;
var type = GetNextType(expression, ref i, lastType);
if (!whitespaceBefore && RequiresWhitespaceBefore(type))
throw new InvalidDataException("Missing whitespace at index {0}, before `{1}` operator."
.F(i, GetTokenSymbol(type)));
switch (type)
{
case TokenType.Number:
@@ -525,15 +578,19 @@ namespace OpenRA.Support
}
}
public ConditionExpression(string expression)
public VariableExpression(string expression)
{
Expression = expression;
}
Expression Build(ExpressionType resultType)
{
var tokens = new List<Token>();
var currentOpeners = new Stack<Token>();
Token lastToken = null;
for (var i = 0;;)
{
var token = Token.GetNext(expression, ref i, lastToken != null ? lastToken.Type : TokenType.Invalid);
var token = Token.GetNext(Expression, ref i, lastToken != null ? lastToken.Type : TokenType.Invalid);
if (token == null)
{
// Sanity check parsed tree
@@ -591,7 +648,20 @@ namespace OpenRA.Support
if (currentOpeners.Count > 0)
throw new InvalidDataException("Unclosed opening parenthesis at index {0}".F(currentOpeners.Peek().Index));
asFunction = new Compiler().Compile(ToPostfix(tokens).ToArray());
return new Compiler().Build(ToPostfix(tokens).ToArray(), resultType);
}
protected Func<IReadOnlyDictionary<string, int>, T> Compile<T>()
{
ExpressionType resultType;
if (typeof(T) == typeof(int))
resultType = ExpressionType.Int;
else if (typeof(T) == typeof(bool))
resultType = ExpressionType.Bool;
else
throw new InvalidCastException("Variable expressions can only be int or bool.");
return Expressions.Expression.Lambda<Func<IReadOnlyDictionary<string, int>, T>>(Build(resultType), SymbolsParam).Compile();
}
static int ParseSymbol(string symbol, IReadOnlyDictionary<string, int> symbols)
@@ -614,7 +684,7 @@ namespace OpenRA.Support
while (!((temp = s.Pop()).Opens != Grouping.None))
yield return temp;
}
else if (t.OperandSides == OperandSides.None)
else if (t.OperandSides == Sides.None)
yield return t;
else
{
@@ -712,7 +782,7 @@ namespace OpenRA.Support
{
readonly AstStack ast = new AstStack();
public Func<IReadOnlyDictionary<string, int>, int> Compile(Token[] postfix)
public Expression Build(Token[] postfix, ExpressionType resultType)
{
foreach (var t in postfix)
{
@@ -877,10 +947,34 @@ namespace OpenRA.Support
}
}
return Expressions.Expression.Lambda<Func<IReadOnlyDictionary<string, int>, int>>(
ast.Pop(ExpressionType.Int), SymbolsParam).Compile();
return ast.Pop(resultType);
}
}
}
public class BooleanExpression : VariableExpression
{
readonly Func<IReadOnlyDictionary<string, int>, bool> asFunction;
public BooleanExpression(string expression) : base(expression)
{
asFunction = Compile<bool>();
}
public bool Evaluate(IReadOnlyDictionary<string, int> symbols)
{
return asFunction(symbols);
}
}
public class IntegerExpression : VariableExpression
{
readonly Func<IReadOnlyDictionary<string, int>, int> asFunction;
public IntegerExpression(string expression) : base(expression)
{
asFunction = Compile<int>();
}
public int Evaluate(IReadOnlyDictionary<string, int> symbols)
{

View File

@@ -10,6 +10,7 @@
#endregion
using System.Collections.Generic;
using System.Linq;
namespace OpenRA.Traits
{
@@ -113,7 +114,7 @@ namespace OpenRA.Traits
void INotifyCreated.Created(Actor self)
{
Enabled = self.World.LobbyInfo.IsSinglePlayer || self.World.LobbyInfo.GlobalSettings
Enabled = self.World.LobbyInfo.NonBotPlayers.Count() == 1 || self.World.LobbyInfo.GlobalSettings
.OptionOrDefault("cheats", info.Enabled);
}

View File

@@ -145,12 +145,11 @@ namespace OpenRA.Traits
if (!actor.Targetables.Any(Exts.IsTraitEnabled))
return new[] { actor.CenterPosition };
var targetablePositions = actor.TraitOrDefault<ITargetablePositions>();
if (targetablePositions != null)
var targetablePositions = actor.TraitsImplementing<ITargetablePositions>().Where(Exts.IsTraitEnabled);
if (targetablePositions.Any())
{
var positions = targetablePositions.TargetablePositions(actor);
if (positions.Any())
return positions;
var target = this;
return targetablePositions.SelectMany(tp => tp.TargetablePositions(target.actor));
}
return new[] { actor.CenterPosition };

View File

@@ -95,6 +95,8 @@ namespace OpenRA.Traits
public interface ITick { void Tick(Actor self); }
public interface ITickRender { void TickRender(WorldRenderer wr, Actor self); }
public interface IRender { IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr); }
public interface IAutoSelectionSizeInfo : ITraitInfoInterface { }
public interface IAutoSelectionSize { int2 SelectionSize(Actor self); }
public interface IIssueOrder
@@ -199,6 +201,11 @@ namespace OpenRA.Traits
public interface IRadarColorModifier { Color RadarColorOverride(Actor self, Color color); }
public interface ITargetableCells
{
IEnumerable<Pair<CPos, SubCell>> TargetableCells();
}
public interface IOccupySpaceInfo : ITraitInfoInterface
{
IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any);
@@ -285,7 +292,7 @@ namespace OpenRA.Traits
public interface IMove
{
Activity MoveTo(CPos cell, int nearEnough);
Activity MoveTo(CPos cell, Actor ignoredActor);
Activity MoveTo(CPos cell, Actor ignoreActor);
Activity MoveWithinRange(Target target, WDist range);
Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange);
Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange);
@@ -330,7 +337,12 @@ namespace OpenRA.Traits
public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); }
public interface ICreatePlayers { void CreatePlayers(World w); }
public interface IBotInfo : ITraitInfoInterface { string Name { get; } }
public interface IBotInfo : ITraitInfoInterface
{
string Type { get; }
string Name { get; }
}
public interface IBot
{
void Activate(Player p);

View File

@@ -0,0 +1,41 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Linq;
namespace OpenRA.UtilityCommands
{
class ClearInvalidModRegistrationsCommand : IUtilityCommand
{
string IUtilityCommand.Name { get { return "--clear-invalid-mod-registrations"; } }
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]);
}
[Desc("(system|user|both)", "Removes invalid metadata entries for the in-game mod switcher.")]
void IUtilityCommand.Run(Utility utility, string[] args)
{
ModRegistration type = 0;
if (args[1] == "system" || args[1] == "both")
type |= ModRegistration.System;
if (args[1] == "user" || args[1] == "both")
type |= ModRegistration.User;
var mods = new ExternalMods();
ExternalMod activeMod = null;
mods.TryGetValue(ExternalMod.MakeKey(utility.ModData.Manifest), out activeMod);
mods.ClearInvalidRegistrations(activeMod, type);
}
}
}

View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Linq;
namespace OpenRA.UtilityCommands
{
class RegisterModCommand : IUtilityCommand
{
string IUtilityCommand.Name { get { return "--register-mod"; } }
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 3 && new string[] { "system", "user", "both" }.Contains(args[2]);
}
[Desc("LAUNCHPATH (system|user|both)", "Generates a mod metadata entry for the in-game mod switcher.")]
void IUtilityCommand.Run(Utility utility, string[] args)
{
ModRegistration type = 0;
if (args[2] == "system" || args[2] == "both")
type |= ModRegistration.System;
if (args[2] == "user" || args[2] == "both")
type |= ModRegistration.User;
new ExternalMods().Register(utility.ModData.Manifest, args[1], type);
}
}
}

View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Linq;
namespace OpenRA.UtilityCommands
{
class UnregisterModCommand : IUtilityCommand
{
string IUtilityCommand.Name { get { return "--unregister-mod"; } }
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]);
}
[Desc("(system|user|both)", "Removes the mod metadata entry for the in-game mod switcher.")]
void IUtilityCommand.Run(Utility utility, string[] args)
{
ModRegistration type = 0;
if (args[1] == "system" || args[1] == "both")
type |= ModRegistration.System;
if (args[1] == "user" || args[1] == "both")
type |= ModRegistration.User;
new ExternalMods().Unregister(utility.ModData.Manifest, type);
}
}
}

View File

@@ -1,55 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.Graphics;
namespace OpenRA.Widgets
{
public class RootWidget : ContainerWidget
{
public RootWidget()
{
IgnoreMouseOver = true;
}
public override bool HandleKeyPress(KeyInput e)
{
if (e.Event == KeyInputEvent.Down)
{
var hk = Hotkey.FromKeyInput(e);
if (hk == Game.Settings.Keys.DevReloadChromeKey)
{
ChromeProvider.Initialize(Game.ModData);
return true;
}
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
{
foreach (var child in Children)
child.Visible ^= true;
return true;
}
if (hk == Game.Settings.Keys.TakeScreenshotKey)
{
if (e.Event == KeyInputEvent.Down)
Game.TakeScreenshot = true;
return true;
}
}
return base.HandleKeyPress(e);
}
}
}

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Widgets
{
public static class Ui
{
public static Widget Root = new RootWidget();
public static Widget Root = new ContainerWidget();
public static long LastTickTime = Game.RunTime;
@@ -108,7 +108,7 @@ namespace OpenRA.Widgets
if (mi.Event == MouseInputEvent.Move)
{
Viewport.LastMousePos = mi.Location;
Viewport.TicksSinceLastMove = 0;
Viewport.LastMoveRunTime = Game.RunTime;
}
if (wasMouseOver != MouseOverWidget)
@@ -128,6 +128,29 @@ namespace OpenRA.Widgets
/// <param name="e">Key input data</param>
public static bool HandleKeyPress(KeyInput e)
{
if (e.Event == KeyInputEvent.Down)
{
var hk = Hotkey.FromKeyInput(e);
if (hk == Game.Settings.Keys.DevReloadChromeKey)
{
ChromeProvider.Initialize(Game.ModData);
return true;
}
if (hk == Game.Settings.Keys.HideUserInterfaceKey)
{
Root.Visible ^= true;
return true;
}
if (hk == Game.Settings.Keys.TakeScreenshotKey)
{
Game.TakeScreenshot = true;
return true;
}
}
if (KeyboardFocusWidget != null)
return KeyboardFocusWidget.HandleKeyPressOuter(e);

View File

@@ -40,6 +40,7 @@ namespace OpenRA
public Session LobbyInfo { get { return OrderManager.LobbyInfo; } }
public readonly MersenneTwister SharedRandom;
public readonly IModelCache ModelCache;
public Player[] Players = new Player[0];
@@ -147,7 +148,7 @@ namespace OpenRA
}
}
internal World(Map map, OrderManager orderManager, WorldType type)
internal World(ModData modData, Map map, OrderManager orderManager, WorldType type)
{
Type = type;
OrderManager = orderManager;
@@ -156,6 +157,8 @@ namespace OpenRA
Timestep = orderManager.LobbyInfo.GlobalSettings.Timestep;
SharedRandom = new MersenneTwister(orderManager.LobbyInfo.GlobalSettings.RandomSeed);
ModelCache = modData.ModelSequenceLoader.CacheModels(map, modData, map.Rules.ModelSequences);
var worldActorType = type == WorldType.Editor ? "EditorWorld" : "World";
WorldActor = CreateActor(worldActorType, new TypeDictionary());
ActorMap = WorldActor.Trait<IActorMap>();
@@ -437,6 +440,8 @@ namespace OpenRA
Game.Sound.StopAudio();
Game.Sound.StopVideo();
ModelCache.Dispose();
// Dispose newer actors first, and the world actor last
foreach (var a in actors.Values.Reverse())
a.Dispose();

View File

@@ -1,155 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Media;
using System.Reflection;
using System.Windows.Forms;
namespace OpenRA
{
class GameMonitor
{
static Process gameProcess;
[STAThread]
static void Main(string[] args)
{
var launcherPath = Assembly.GetExecutingAssembly().Location;
var directory = Path.GetDirectoryName(launcherPath);
var enginePath = Path.Combine(directory, "OpenRA.Game.exe");
Directory.SetCurrentDirectory(directory);
var engineArgs = args
.Append("Engine.LaunchPath=" + launcherPath)
.Select(arg => "\"" + arg + "\"");
var psi = new ProcessStartInfo(enginePath, string.Join(" ", engineArgs));
try
{
gameProcess = Process.Start(psi);
}
catch
{
return;
}
if (gameProcess == null)
return;
gameProcess.EnableRaisingEvents = true;
gameProcess.Exited += GameProcessExited;
Application.Run();
}
static void ShowErrorDialog()
{
var form = new Form
{
Size = new Size(315, 140),
Text = "Fatal Error",
MinimizeBox = false,
MaximizeBox = false,
FormBorderStyle = FormBorderStyle.FixedDialog,
StartPosition = FormStartPosition.CenterScreen,
TopLevel = true,
Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
};
var notice = new Label
{
Location = new Point(10, 10),
AutoSize = true,
Text = "OpenRA has encountered a fatal error and must close.{0}Refer to the crash logs and FAQ for more information.".F(Environment.NewLine),
TextAlign = ContentAlignment.TopCenter
};
var viewLogs = new Button
{
Location = new Point(10, 80),
Size = new Size(75, 23),
Text = "View Logs"
};
var viewFaq = new Button
{
Location = new Point(90, 80),
Size = new Size(75, 23),
Text = "View FAQ"
};
var quit = new Button
{
Location = new Point(225, 80),
Size = new Size(75, 23),
Text = "Quit",
DialogResult = DialogResult.Cancel
};
form.Controls.Add(notice);
form.Controls.Add(viewLogs);
form.Controls.Add(viewFaq);
form.Controls.Add(quit);
viewLogs.Click += ViewLogsClicked;
viewFaq.Click += ViewFaqClicked;
form.FormClosed += FormClosed;
SystemSounds.Exclamation.Play();
form.ShowDialog();
}
static void GameProcessExited(object sender, EventArgs e)
{
if (gameProcess.ExitCode != (int)RunStatus.Success)
ShowErrorDialog();
Exit();
}
static void ViewLogsClicked(object sender, EventArgs e)
{
try
{
Process.Start(Platform.ResolvePath("^", "Logs"));
}
catch
{ }
}
static void ViewFaqClicked(object sender, EventArgs e)
{
try
{
Process.Start("http://wiki.openra.net/FAQ");
}
catch
{ }
}
static void FormClosed(object sender, EventArgs e)
{
Exit();
}
static void Exit()
{
Environment.Exit(0);
}
}
}

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{68295755-7902-4602-AC2C-9A8AC36D5EF7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>OpenRA</RootNamespace>
<AssemblyName>OpenRA</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>..\OpenRA.Game\OpenRA.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
<Name>OpenRA.Game</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="GameMonitor.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -53,11 +53,12 @@ namespace OpenRA.Mods.Cnc.Activities
if (rearmTarget == null)
return new Wait(20);
// Add a CloseEnough range of 512 to the Repair activity in order to ensure that we're at the host actor
return ActivityUtils.SequenceActivities(
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
new Rearm(self),
new Repair(self, rearmTarget),
new Repair(self, rearmTarget, new WDist(512)),
this);
}

View File

@@ -9,7 +9,7 @@
*/
#endregion
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
class Blowfish
{

View File

@@ -12,7 +12,7 @@
using System;
using System.Linq;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
/* TODO: Convert this direct C port into readable code. */

View File

@@ -9,7 +9,7 @@
*/
#endregion
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
/// <summary>
/// Static class that uses a lookup table to calculates CRC32

View File

@@ -14,7 +14,7 @@ using System;
using System.IO;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
public class HvaReader
{

View File

@@ -9,10 +9,9 @@
*/
#endregion
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileSystem
namespace OpenRA.Mods.Cnc.FileFormats
{
public class IdxEntry
{

View File

@@ -11,9 +11,8 @@
using System.Collections.Generic;
using System.IO;
using OpenRA.FileSystem;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
public class IdxReader
{

View File

@@ -13,7 +13,7 @@
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
public enum NormalType { TiberianSun = 2, RedAlert2 = 4 }
public class VxlElement

View File

@@ -13,7 +13,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
public class XccGlobalDatabase : IDisposable
{

View File

@@ -14,7 +14,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace OpenRA.FileFormats
namespace OpenRA.Mods.Cnc.FileFormats
{
public class XccLocalDatabase
{

View File

@@ -0,0 +1,155 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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.Text;
using OpenRA.FileSystem;
using OpenRA.Mods.Cnc.FileFormats;
using OpenRA.Primitives;
using FS = OpenRA.FileSystem.FileSystem;
namespace OpenRA.Mods.Cnc.FileSystem
{
public class AudioBagLoader : IPackageLoader
{
sealed class BagFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Stream s;
readonly Dictionary<string, IdxEntry> index;
public BagFile(Stream s, List<IdxEntry> entries, string filename)
{
Name = filename;
this.s = s;
index = entries.ToDictionaryWithConflictLog(x => x.Filename,
"{0} (bag format)".F(filename),
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length));
}
public Stream GetStream(string filename)
{
IdxEntry entry;
if (!index.TryGetValue(filename, out entry))
return null;
s.Seek(entry.Offset, SeekOrigin.Begin);
var waveHeaderMemoryStream = new MemoryStream();
var channels = (entry.Flags & 1) > 0 ? 2 : 1;
if ((entry.Flags & 2) > 0)
{
// PCM
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("RIFF"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length + 36));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("WAVE"));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fmt "));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(16));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)1));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)channels));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(2 * channels * entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)(2 * channels)));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)16));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("data"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length));
}
if ((entry.Flags & 8) > 0)
{
// IMA ADPCM
var samplesPerChunk = (2 * (entry.ChunkSize - 4)) + 1;
var bytesPerSec = (int)Math.Floor(((double)(2 * entry.ChunkSize) / samplesPerChunk) * ((double)entry.SampleRate / 2));
var chunkSize = entry.ChunkSize > entry.Length ? entry.Length : entry.ChunkSize;
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("RIFF"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length + 52));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("WAVE"));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fmt "));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(20));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)17));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)channels));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.SampleRate));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(bytesPerSec));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)chunkSize));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)4));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)2));
waveHeaderMemoryStream.Write(BitConverter.GetBytes((short)samplesPerChunk));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("fact"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(4));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(4 * entry.Length));
waveHeaderMemoryStream.Write(Encoding.ASCII.GetBytes("data"));
waveHeaderMemoryStream.Write(BitConverter.GetBytes(entry.Length));
}
waveHeaderMemoryStream.Seek(0, SeekOrigin.Begin);
// Construct a merged stream
var mergedStream = new MergedStream(waveHeaderMemoryStream, s);
mergedStream.SetLength(waveHeaderMemoryStream.Length + entry.Length);
return mergedStream;
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public IReadOnlyPackage OpenPackage(string filename, FS context)
{
// Not implemented
return null;
}
public void Dispose()
{
s.Dispose();
}
}
bool IPackageLoader.TryParsePackage(Stream s, string filename, FS context, out IReadOnlyPackage package)
{
if (!filename.EndsWith(".bag", StringComparison.InvariantCultureIgnoreCase))
{
package = null;
return false;
}
// A bag file is always accompanied with an .idx counterpart
// For example: audio.bag requires the audio.idx file
var indexFilename = Path.ChangeExtension(filename, ".idx");
List<IdxEntry> entries = null;
try
{
// Build the index and dispose the stream, it is no longer needed after this
using (var indexStream = context.Open(indexFilename))
entries = new IdxReader(indexStream).Entries;
}
catch
{
package = null;
return false;
}
package = new BagFile(s, entries, filename);
return true;
}
}
}

View File

@@ -0,0 +1,130 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileSystem;
using FS = OpenRA.FileSystem.FileSystem;
namespace OpenRA.Mods.Cnc.FileSystem
{
public class BigLoader : IPackageLoader
{
sealed class BigFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Stream s;
public BigFile(Stream s, string filename)
{
Name = filename;
this.s = s;
try
{
/* var signature = */ s.ReadASCII(4);
// Total archive size.
s.ReadUInt32();
var entryCount = s.ReadUInt32();
if (BitConverter.IsLittleEndian)
entryCount = int2.Swap(entryCount);
// First entry offset? This is apparently bogus for EA's .big files
// and we don't have to try seeking there since the entries typically start next in EA's .big files.
s.ReadUInt32();
for (var i = 0; i < entryCount; i++)
{
var entry = new Entry(s);
index.Add(entry.Path, entry);
}
}
catch
{
Dispose();
throw;
}
}
class Entry
{
readonly Stream s;
readonly uint offset;
readonly uint size;
public readonly string Path;
public Entry(Stream s)
{
this.s = s;
offset = s.ReadUInt32();
size = s.ReadUInt32();
if (BitConverter.IsLittleEndian)
{
offset = int2.Swap(offset);
size = int2.Swap(size);
}
Path = s.ReadASCIIZ();
}
public Stream GetData()
{
s.Position = offset;
return new MemoryStream(s.ReadBytes((int)size));
}
}
public Stream GetStream(string filename)
{
return index[filename].GetData();
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public IReadOnlyPackage OpenPackage(string filename, FS context)
{
// Not implemented
return null;
}
public void Dispose()
{
s.Dispose();
}
}
bool IPackageLoader.TryParsePackage(Stream s, string filename, FS context, out IReadOnlyPackage package)
{
// Take a peek at the file signature
var signature = s.ReadASCII(4);
s.Position -= 4;
if (signature != "BIGF")
{
package = null;
return false;
}
package = new BigFile(s, filename);
return true;
}
}
}

View File

@@ -0,0 +1,252 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Mods.Cnc.FileFormats;
using OpenRA.Primitives;
using FS = OpenRA.FileSystem.FileSystem;
namespace OpenRA.Mods.Cnc.FileSystem
{
public class MixLoader : IPackageLoader
{
public sealed class MixFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, PackageEntry> index;
readonly long dataStart;
readonly Stream s;
public MixFile(Stream s, string filename, HashSet<string> allPossibleFilenames)
{
Name = filename;
this.s = s;
try
{
// Detect format type
var isCncMix = s.ReadUInt16() != 0;
// The C&C mix format doesn't contain any flags or encryption
var isEncrypted = false;
if (!isCncMix)
isEncrypted = (s.ReadUInt16() & 0x2) != 0;
List<PackageEntry> entries;
if (isEncrypted)
{
long unused;
entries = ParseHeader(DecryptHeader(s, 4, out dataStart), 0, out unused);
}
else
entries = ParseHeader(s, isCncMix ? 0 : 4, out dataStart);
index = ParseIndex(entries.ToDictionaryWithConflictLog(x => x.Hash,
"{0} ({1} format, Encrypted: {2}, DataStart: {3})".F(filename, isCncMix ? "C&C" : "RA/TS/RA2", isEncrypted, dataStart),
null, x => "(offs={0}, len={1})".F(x.Offset, x.Length)), allPossibleFilenames);
}
catch (Exception)
{
Dispose();
throw;
}
}
Dictionary<string, PackageEntry> ParseIndex(Dictionary<uint, PackageEntry> entries, HashSet<string> allPossibleFilenames)
{
var classicIndex = new Dictionary<string, PackageEntry>();
var crcIndex = new Dictionary<string, PackageEntry>();
// Try and find a local mix database
var dbNameClassic = PackageEntry.HashFilename("local mix database.dat", PackageHashType.Classic);
var dbNameCRC = PackageEntry.HashFilename("local mix database.dat", PackageHashType.CRC32);
foreach (var kv in entries)
{
if (kv.Key == dbNameClassic || kv.Key == dbNameCRC)
{
using (var content = GetContent(kv.Value))
{
var db = new XccLocalDatabase(content);
foreach (var e in db.Entries)
allPossibleFilenames.Add(e);
}
break;
}
}
foreach (var filename in allPossibleFilenames)
{
var classicHash = PackageEntry.HashFilename(filename, PackageHashType.Classic);
var crcHash = PackageEntry.HashFilename(filename, PackageHashType.CRC32);
PackageEntry e;
if (entries.TryGetValue(classicHash, out e))
classicIndex.Add(filename, e);
if (entries.TryGetValue(crcHash, out e))
crcIndex.Add(filename, e);
}
var bestIndex = crcIndex.Count > classicIndex.Count ? crcIndex : classicIndex;
var unknown = entries.Count - bestIndex.Count;
if (unknown > 0)
Log.Write("debug", "{0}: failed to resolve filenames for {1} unknown hashes".F(Name, unknown));
return bestIndex;
}
static List<PackageEntry> ParseHeader(Stream s, long offset, out long headerEnd)
{
s.Seek(offset, SeekOrigin.Begin);
var numFiles = s.ReadUInt16();
/*uint dataSize = */s.ReadUInt32();
var items = new List<PackageEntry>();
for (var i = 0; i < numFiles; i++)
items.Add(new PackageEntry(s));
headerEnd = offset + 6 + numFiles * PackageEntry.Size;
return items;
}
static MemoryStream DecryptHeader(Stream s, long offset, out long headerEnd)
{
s.Seek(offset, SeekOrigin.Begin);
// Decrypt blowfish key
var keyblock = s.ReadBytes(80);
var blowfishKey = new BlowfishKeyProvider().DecryptKey(keyblock);
var fish = new Blowfish(blowfishKey);
// Decrypt first block to work out the header length
var ms = Decrypt(ReadBlocks(s, offset + 80, 1), fish);
var numFiles = ms.ReadUInt16();
// Decrypt the full header - round bytes up to a full block
var blockCount = (13 + numFiles * PackageEntry.Size) / 8;
headerEnd = offset + 80 + blockCount * 8;
return Decrypt(ReadBlocks(s, offset + 80, blockCount), fish);
}
static MemoryStream Decrypt(uint[] h, Blowfish fish)
{
var decrypted = fish.Decrypt(h);
var ms = new MemoryStream();
var writer = new BinaryWriter(ms);
foreach (var t in decrypted)
writer.Write(t);
writer.Flush();
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
static uint[] ReadBlocks(Stream s, long offset, int count)
{
if (offset < 0)
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
if (count < 0)
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
if (offset + (count * 2) > s.Length)
throw new ArgumentException("Bytes to read {0} and offset {1} greater than stream length {2}.".F(count * 2, offset, s.Length));
s.Seek(offset, SeekOrigin.Begin);
// A block is a single encryption unit (represented as two 32-bit integers)
var ret = new uint[2 * count];
for (var i = 0; i < ret.Length; i++)
ret[i] = s.ReadUInt32();
return ret;
}
public Stream GetContent(PackageEntry entry)
{
return SegmentStream.CreateWithoutOwningStream(s, dataStart + entry.Offset, (int)entry.Length);
}
public Stream GetStream(string filename)
{
PackageEntry e;
if (!index.TryGetValue(filename, out e))
return null;
return GetContent(e);
}
public IReadOnlyDictionary<string, PackageEntry> Index
{
get
{
var absoluteIndex = index.ToDictionary(e => e.Key, e => new PackageEntry(e.Value.Hash, (uint)(e.Value.Offset + dataStart), e.Value.Length));
return new ReadOnlyDictionary<string, PackageEntry>(absoluteIndex);
}
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public IReadOnlyPackage OpenPackage(string filename, FS context)
{
IReadOnlyPackage package;
var childStream = GetStream(filename);
if (childStream == null)
return null;
if (context.TryParsePackage(childStream, filename, out package))
return package;
childStream.Dispose();
return null;
}
public void Dispose()
{
s.Dispose();
}
}
bool IPackageLoader.TryParsePackage(Stream s, string filename, FS context, out IReadOnlyPackage package)
{
if (!filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
{
package = null;
return false;
}
// Load the global mix database
Stream mixDatabase;
var allPossibleFilenames = new HashSet<string>();
if (context.TryOpen("global mix database.dat", out mixDatabase))
using (var db = new XccGlobalDatabase(mixDatabase))
foreach (var e in db.Entries)
allPossibleFilenames.Add(e);
package = new MixFile(s, filename, allPossibleFilenames);
return true;
}
}
}

View File

@@ -13,9 +13,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using OpenRA.FileFormats;
using OpenRA.Mods.Cnc.FileFormats;
namespace OpenRA.FileSystem
namespace OpenRA.Mods.Cnc.FileSystem
{
public enum PackageHashType { Classic, CRC32 }

View File

@@ -0,0 +1,106 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileSystem;
using FS = OpenRA.FileSystem.FileSystem;
namespace OpenRA.Mods.Cnc.FileSystem
{
public class PakFileLoader : IPackageLoader
{
struct Entry
{
public uint Offset;
public uint Length;
public string Filename;
}
sealed class PakFile : IReadOnlyPackage
{
public string Name { get; private set; }
public IEnumerable<string> Contents { get { return index.Keys; } }
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
readonly Stream stream;
public PakFile(Stream stream, string filename)
{
Name = filename;
this.stream = stream;
try
{
var offset = stream.ReadUInt32();
while (offset != 0)
{
var file = stream.ReadASCIIZ();
var next = stream.ReadUInt32();
var length = (next == 0 ? (uint)stream.Length : next) - offset;
// Ignore duplicate files
if (index.ContainsKey(file))
continue;
index.Add(file, new Entry { Offset = offset, Length = length, Filename = file });
offset = next;
}
}
catch
{
Dispose();
throw;
}
}
public Stream GetStream(string filename)
{
Entry entry;
if (!index.TryGetValue(filename, out entry))
return null;
stream.Seek(entry.Offset, SeekOrigin.Begin);
var data = stream.ReadBytes((int)entry.Length);
return new MemoryStream(data);
}
public bool Contains(string filename)
{
return index.ContainsKey(filename);
}
public IReadOnlyPackage OpenPackage(string filename, FS context)
{
// Not implemented
return null;
}
public void Dispose()
{
stream.Dispose();
}
}
bool IPackageLoader.TryParsePackage(Stream s, string filename, FS context, out IReadOnlyPackage package)
{
if (!filename.EndsWith(".pak", StringComparison.InvariantCultureIgnoreCase))
{
package = null;
return false;
}
package = new PakFile(s, filename);
return true;
}
}
}

View File

@@ -11,25 +11,28 @@
using System;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.Cnc.FileFormats;
namespace OpenRA.Graphics
namespace OpenRA.Mods.Cnc.Graphics
{
struct Limb
{
public float Scale;
public float[] Bounds;
public byte[] Size;
public VoxelRenderData RenderData;
public ModelRenderData RenderData;
}
public class Voxel
public class Voxel : IModel
{
Limb[] limbData;
float[] transforms;
readonly Limb[] limbData;
readonly float[] transforms;
readonly uint frames;
readonly uint limbs;
public readonly uint Frames;
public readonly uint Limbs;
uint IModel.Frames { get { return frames; } }
uint IModel.Sections { get { return limbs; } }
public Voxel(VoxelLoader loader, VxlReader vxl, HvaReader hva)
{
@@ -37,8 +40,8 @@ namespace OpenRA.Graphics
throw new InvalidOperationException("Voxel and hva limb counts don't match");
transforms = hva.Transforms;
Frames = hva.FrameCount;
Limbs = hva.LimbCount;
frames = hva.FrameCount;
limbs = hva.LimbCount;
limbData = new Limb[vxl.LimbCount];
for (var i = 0; i < vxl.LimbCount; i++)
@@ -55,14 +58,14 @@ namespace OpenRA.Graphics
public float[] TransformationMatrix(uint limb, uint frame)
{
if (frame >= Frames)
throw new ArgumentOutOfRangeException("frame", "Only {0} frames exist.".F(Frames));
if (limb >= Limbs)
throw new ArgumentOutOfRangeException("limb", "Only {1} limbs exist.".F(Limbs));
if (frame >= frames)
throw new ArgumentOutOfRangeException("frame", "Only {0} frames exist.".F(frames));
if (limb >= limbs)
throw new ArgumentOutOfRangeException("limb", "Only {1} limbs exist.".F(limbs));
var l = limbData[limb];
var t = new float[16];
Array.Copy(transforms, 16 * (Limbs * frame + limb), t, 0, 16);
Array.Copy(transforms, 16 * (limbs * frame + limb), t, 0, 16);
// Fix limb position
t[12] *= l.Scale * (l.Bounds[3] - l.Bounds[0]) / l.Size[0];
@@ -76,7 +79,7 @@ namespace OpenRA.Graphics
return t;
}
public VoxelRenderData RenderData(uint limb)
public ModelRenderData RenderData(uint limb)
{
return limbData[limb].RenderData;
}
@@ -100,7 +103,7 @@ namespace OpenRA.Graphics
var ret = new float[] { float.MaxValue, float.MaxValue, float.MaxValue,
float.MinValue, float.MinValue, float.MinValue };
for (uint j = 0; j < Limbs; j++)
for (uint j = 0; j < limbs; j++)
{
var l = limbData[j];
var b = new float[]

View File

@@ -13,26 +13,13 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Mods.Cnc.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Graphics
namespace OpenRA.Mods.Cnc.Graphics
{
public struct VoxelRenderData
{
public readonly int Start;
public readonly int Count;
public readonly Sheet Sheet;
public VoxelRenderData(int start, int count, Sheet sheet)
{
Start = start;
Count = count;
Sheet = sheet;
}
}
public sealed class VoxelLoader : IDisposable
{
static readonly float[] ChannelSelect = { 0.75f, 0.25f, -0.25f, -0.75f };
@@ -182,7 +169,7 @@ namespace OpenRA.Graphics
(u, v) => new float3(u, v, z));
}
public VoxelRenderData GenerateRenderData(VxlLimb l)
public ModelRenderData GenerateRenderData(VxlLimb l)
{
Vertex[] v;
try
@@ -203,14 +190,14 @@ namespace OpenRA.Graphics
var start = totalVertexCount;
var count = v.Length;
totalVertexCount += count;
return new VoxelRenderData(start, count, sheetBuilder.Current);
return new ModelRenderData(start, count, sheetBuilder.Current);
}
public void RefreshBuffer()
{
if (vertexBuffer != null)
vertexBuffer.Dispose();
vertexBuffer = Game.Renderer.Device.CreateVertexBuffer(totalVertexCount);
vertexBuffer = Game.Renderer.CreateVertexBuffer(totalVertexCount);
vertexBuffer.SetData(vertices.SelectMany(v => v).ToArray(), totalVertexCount);
cachedVertexCount = totalVertexCount;
}

View File

@@ -0,0 +1,119 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.FileSystem;
using OpenRA.Graphics;
namespace OpenRA.Mods.Cnc.Graphics
{
public class VoxelModelSequenceLoader : IModelSequenceLoader
{
public Action<string> OnMissingModelError { get; set; }
public VoxelModelSequenceLoader(ModData modData) { }
public IModelCache CacheModels(IReadOnlyFileSystem fileSystem, ModData modData, IReadOnlyDictionary<string, MiniYamlNode> modelSequences)
{
var cache = new VoxelModelCache(fileSystem);
foreach (var kv in modelSequences)
{
modData.LoadScreen.Display();
try
{
cache.CacheModel(kv.Key, kv.Value.Value);
}
catch (FileNotFoundException ex)
{
Console.WriteLine(ex);
// Eat the FileNotFound exceptions from missing sprites
OnMissingModelError(ex.Message);
}
}
cache.LoadComplete();
return cache;
}
}
public class VoxelModelCache : IModelCache
{
readonly VoxelLoader loader;
readonly Dictionary<string, Dictionary<string, IModel>> models = new Dictionary<string, Dictionary<string, IModel>>();
public VoxelModelCache(IReadOnlyFileSystem fileSystem)
{
loader = new VoxelLoader(fileSystem);
}
public void CacheModel(string model, MiniYaml definition)
{
models.Add(model, definition.ToDictionary(my => LoadVoxel(model, my)));
}
public void LoadComplete()
{
loader.RefreshBuffer();
loader.Finish();
}
IModel LoadVoxel(string unit, MiniYaml info)
{
var vxl = unit;
var hva = unit;
if (info.Value != null)
{
var fields = info.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (fields.Length >= 1)
vxl = hva = fields[0].Trim();
if (fields.Length >= 2)
hva = fields[1].Trim();
}
return loader.Load(vxl, hva);
}
public IModel GetModelSequence(string model, string sequence)
{
try { return models[model][sequence]; }
catch (KeyNotFoundException)
{
if (models.ContainsKey(model))
throw new InvalidOperationException(
"Model `{0}` does not have a sequence `{1}`".F(model, sequence));
else
throw new InvalidOperationException(
"Model `{0}` does not have any sequences defined.".F(model));
}
}
public bool HasModelSequence(string model, string sequence)
{
if (!models.ContainsKey(model))
throw new InvalidOperationException(
"Model `{0}` does not have any sequences defined.".F(model));
return models[model].ContainsKey(sequence);
}
public IVertexBuffer<Vertex> VertexBuffer { get { return loader.VertexBuffer; } }
public void Dispose()
{
loader.Dispose();
}
}
}

View File

@@ -72,11 +72,12 @@
<Compile Include="Traits\Render\WithReloadingSpriteTurret.cs" />
<Compile Include="Traits\Render\WithRoof.cs" />
<Compile Include="Traits\SupportPowers\IonCannonPower.cs" />
<Compile Include="ImportTiberianDawnLegacyMapCommand.cs" />
<Compile Include="UtilityCommands\ImportTiberianDawnLegacyMapCommand.cs" />
<Compile Include="Projectiles\IonCannon.cs" />
<Compile Include="Activities\VoxelHarvesterDockSequence.cs" />
<Compile Include="SpriteLoaders\TmpTSLoader.cs" />
<Compile Include="Traits\Buildings\TiberianSunRefinery.cs" />
<Compile Include="Traits\Render\WithBuildingBib.cs" />
<Compile Include="Traits\Render\WithDockingOverlay.cs" />
<Compile Include="Traits\Render\WithPermanentInjury.cs" />
<Compile Include="Traits\Render\WithVoxelWalkerBody.cs" />
@@ -109,6 +110,7 @@
<Compile Include="Traits\Chronoshiftable.cs" />
<Compile Include="Traits\Cloneable.cs" />
<Compile Include="Traits\Disguise.cs" />
<Compile Include="Traits\EnergyWall.cs" />
<Compile Include="Traits\FrozenUnderFogUpdatedByGps.cs" />
<Compile Include="Traits\HarvesterHuskModifier.cs" />
<Compile Include="Traits\Infiltration\InfiltrateForCash.cs" />
@@ -130,9 +132,28 @@
<Compile Include="Traits\GpsWatcher.cs" />
<Compile Include="Scripting\Properties\ChronosphereProperties.cs" />
<Compile Include="Traits\Render\WithDisguisingInfantryBody.cs" />
<Compile Include="ImportRedAlertLegacyMapCommand.cs" />
<Compile Include="UtilityCommands\ImportRedAlertLegacyMapCommand.cs" />
<Compile Include="Traits\Infiltration\InfiltrateForDecoration.cs" />
<Compile Include="TraitsInterfaces.cs" />
<Compile Include="FileSystem\BagFile.cs" />
<Compile Include="FileSystem\BigFile.cs" />
<Compile Include="FileSystem\MixFile.cs" />
<Compile Include="FileSystem\PackageEntry.cs" />
<Compile Include="FileSystem\Pak.cs" />
<Compile Include="UtilityCommands\ListMixContentsCommand.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="FileFormats\IdxEntry.cs" />
<Compile Include="FileFormats\IdxReader.cs" />
<Compile Include="FileFormats\XccGlobalDatabase.cs" />
<Compile Include="FileFormats\XccLocalDatabase.cs" />
<Compile Include="FileFormats\CRC32.cs" />
<Compile Include="Graphics\VoxelModelSequenceLoader.cs" />
<Compile Include="Graphics\VoxelLoader.cs" />
<Compile Include="Graphics\Voxel.cs" />
<Compile Include="FileFormats\HvaReader.cs" />
<Compile Include="FileFormats\VxlReader.cs" />
<Compile Include="Traits\World\VoxelNormalsPalette.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
@@ -170,17 +191,17 @@
SourceFiles="$(TargetPath)"
DestinationFolder="$(SolutionDir)mods/common/"/>
<!--
We need to copy OpenRA.Mods.Cnc.pdb (not `.dll.pdb`). This is only necessary on Windows.
Mono outputs a `.dll.mdb` so we can just append `.mdb` directly.
csc generates .pdb symbol files (not `.dll.pdb`).
mcs generates .dll.mdb symbol files.
-->
<Copy
SourceFiles="$(TargetDir)$(TargetName).pdb"
DestinationFolder="$(SolutionDir)mods/common/"
Condition="'$(OS)' == 'Windows_NT'"/>
Condition="Exists('$(TargetDir)$(TargetName).pdb')"/>
<Copy
SourceFiles="$(TargetPath).mdb"
DestinationFolder="$(SolutionDir)mods/common/"
Condition="'$(OS)' == 'Unix'"/>
Condition="Exists('$(TargetPath).mdb')"/>
<!-- Uncomment these lines when debugging or adding to this target
<Message Text="DEBUG OS: $(OS)"/>
<Message Text="DEBUG SolutionDir: $(SolutionDir)"/>

View File

@@ -32,46 +32,48 @@ namespace OpenRA.Mods.Cnc.Projectiles
public readonly int Duration = 2;
public readonly int DamageDuration = 1;
public readonly bool TrackTarget = true;
public IProjectile Create(ProjectileArgs args) { return new TeslaZap(this, args); }
}
public class TeslaZap : IProjectile
public class TeslaZap : IProjectile, ISync
{
readonly ProjectileArgs args;
readonly TeslaZapInfo info;
TeslaZapRenderable zap;
int timeUntilRemove; // # of frames
bool doneDamage = false;
bool initialized = false;
int ticksUntilRemove;
int damageDuration;
[Sync] WPos target;
public TeslaZap(TeslaZapInfo info, ProjectileArgs args)
{
this.args = args;
this.info = info;
this.timeUntilRemove = info.Duration;
ticksUntilRemove = info.Duration;
damageDuration = info.DamageDuration > info.Duration ? info.Duration : info.DamageDuration;
target = args.PassiveTarget;
}
public void Tick(World world)
{
if (timeUntilRemove-- <= 0)
if (ticksUntilRemove-- <= 0)
world.AddFrameEndTask(w => w.Remove(this));
if (!doneDamage)
{
var pos = args.GuidedTarget.IsValidFor(args.SourceActor) ? args.GuidedTarget.CenterPosition : args.PassiveTarget;
args.Weapon.Impact(Target.FromPos(pos), args.SourceActor, args.DamageModifiers);
doneDamage = true;
}
// Zap tracks target
if (info.TrackTarget && args.GuidedTarget.IsValidFor(args.SourceActor))
target = args.Weapon.TargetActorCenter ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.PositionClosestTo(args.Source);
if (damageDuration-- > 0)
args.Weapon.Impact(Target.FromPos(target), args.SourceActor, args.DamageModifiers);
}
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (!initialized)
{
var pos = args.GuidedTarget.IsValidFor(args.SourceActor) ? args.GuidedTarget.CenterPosition : args.PassiveTarget;
zap = new TeslaZapRenderable(args.Source, 0, pos - args.Source,
info.Image, info.BrightSequence, info.BrightZaps, info.DimSequence, info.DimZaps, info.Palette);
}
zap = new TeslaZapRenderable(args.Source, 0, target - args.Source,
info.Image, info.BrightSequence, info.BrightZaps, info.DimSequence, info.DimZaps, info.Palette);
yield return zap;
}

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Implements the charge-then-burst attack logic specific to the RA tesla coil.")]
class AttackTeslaInfo : AttackOmniInfo
class AttackTeslaInfo : AttackBaseInfo
{
[Desc("How many charges this actor has to attack with, once charged.")]
public readonly int MaxCharges = 1;
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Traits
public override object Create(ActorInitializer init) { return new AttackTesla(init.Self, this); }
}
class AttackTesla : AttackOmni, ITick, INotifyAttack
class AttackTesla : AttackBase, ITick, INotifyAttack
{
readonly AttackTeslaInfo info;

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Cnc.Traits
protected override bool CanAttack(Actor self, Target target)
{
if (state == PopupState.Transitioning || !building.Value.BuildComplete)
if (state == PopupState.Transitioning || !building.BuildComplete)
return false;
if (!base.CanAttack(self, target))

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