Fix RCS1061

This commit is contained in:
RoosterDragon
2023-03-18 12:16:52 +00:00
committed by Gustas
parent 5d91b678bb
commit 4dd787be13
32 changed files with 167 additions and 210 deletions

View File

@@ -378,11 +378,8 @@ namespace OpenRA.Mods.Cnc.FileFormats
if (tmp > 0)
{
MulBignumWord(esi, globOne, tmp, 2 * len);
if ((*edi & 0x8000) == 0)
{
if (SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len) != 0)
(*edi)--;
}
if ((*edi & 0x8000) == 0 && SubBigNum((uint*)esi, (uint*)esi, g1, 0, (int)len) != 0)
(*edi)--;
}
}

View File

@@ -235,10 +235,9 @@ namespace OpenRA.Mods.Cnc.FileSystem
}
// Load the global mix database
if (globalFilenames == null)
if (context.TryOpen("global mix database.dat", out var mixDatabase))
using (var db = new XccGlobalDatabase(mixDatabase))
globalFilenames = db.Entries.ToHashSet().ToArray();
if (globalFilenames == null && context.TryOpen("global mix database.dat", out var mixDatabase))
using (var db = new XccGlobalDatabase(mixDatabase))
globalFilenames = db.Entries.ToHashSet().ToArray();
package = new MixFile(s, filename, globalFilenames ?? Array.Empty<string>());
return true;

View File

@@ -60,14 +60,11 @@ namespace OpenRA.Mods.Cnc.Graphics
var tilesetNode = node.Value.NodeWithKeyOrDefault(tileset);
if (tilesetNode != null)
{
if (frames == null)
if (frames == null && LoadField<string>("Length", null, data) != "*")
{
if (LoadField<string>("Length", null, data) != "*")
{
var subStart = LoadField("Start", 0, data);
var subLength = LoadField("Length", 1, data);
frames = Exts.MakeArray(subLength, i => subStart + i);
}
var subStart = LoadField("Start", 0, data);
var subLength = LoadField("Length", 1, data);
frames = Exts.MakeArray(subLength, i => subStart + i);
}
return new[] { new ReservationInfo(tilesetNode.Value.Value, frames, frames, tilesetNode.Location) };

View File

@@ -203,13 +203,10 @@ namespace OpenRA.Mods.Cnc.Traits
mad.initiated = true;
}
if (++ticks % mad.info.ThumpInterval == 0)
if (++ticks % mad.info.ThumpInterval == 0 && mad.info.ThumpDamageWeapon != null)
{
if (mad.info.ThumpDamageWeapon != null)
{
// Use .FromPos since this weapon needs to affect more than just the MadTank actor
mad.info.ThumpDamageWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self);
}
// Use .FromPos since this weapon needs to affect more than just the MadTank actor
mad.info.ThumpDamageWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self);
}
if (ticks == mad.info.ChargeDelay)

View File

@@ -441,14 +441,12 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Only import the top-left cell of multi-celled overlays
// Returning true here means this is a part of a bigger overlay that has already been handled.
var aboveType = overlayPack[overlayIndex[cell - new CVec(1, 0)]];
if (shape.Width > 1 && aboveType != 0xFF)
if (OverlayToActor.TryGetValue(aboveType, out var a) && a == actorType)
return true;
if (shape.Width > 1 && aboveType != 0xFF && OverlayToActor.TryGetValue(aboveType, out var a) && a == actorType)
return true;
var leftType = overlayPack[overlayIndex[cell - new CVec(0, 1)]];
if (shape.Height > 1 && leftType != 0xFF)
if (OverlayToActor.TryGetValue(leftType, out var a) && a == actorType)
return true;
if (shape.Height > 1 && leftType != 0xFF && OverlayToActor.TryGetValue(leftType, out var l) && l == actorType)
return true;
}
actorReference = new ActorReference(actorType)

View File

@@ -282,14 +282,12 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
// Only import the top-left cell of multi-celled overlays
// Returning true here means this is a part of a bigger overlay that has already been handled.
var aboveType = overlayPack[overlayIndex[cell - new CVec(1, 0)]];
if (shape.Width > 1 && aboveType != 0xFF)
if (OverlayToActor.TryGetValue(aboveType, out var a) && a == actorType)
return true;
if (shape.Width > 1 && aboveType != 0xFF && OverlayToActor.TryGetValue(aboveType, out var a) && a == actorType)
return true;
var leftType = overlayPack[overlayIndex[cell - new CVec(0, 1)]];
if (shape.Height > 1 && leftType != 0xFF)
if (OverlayToActor.TryGetValue(leftType, out var a) && a == actorType)
return true;
if (shape.Height > 1 && leftType != 0xFF && OverlayToActor.TryGetValue(leftType, out var l) && l == actorType)
return true;
}
// Fix position of vein hole actors.