Add a screen-space offset to barrel positions, and fix HTNK firing offsets. Fixes #803, 929.

This commit is contained in:
Paul Chote
2011-06-25 15:25:22 +12:00
parent b64c5e001e
commit fc37733c3c
10 changed files with 33 additions and 30 deletions

View File

@@ -219,7 +219,8 @@ namespace OpenRA.Mods.RA
var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing; var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing;
return GetTurretPosition(self, facing, turret) + Util.RotateVectorByFacing(barrel.Position, turretFacing, .7f); return GetTurretPosition(self, facing, turret) + barrel.ScreenSpaceOffset
+ Util.RotateVectorByFacing(barrel.TurretSpaceOffset, turretFacing, .7f);
} }
public static bool IsInRange( float2 attackOrigin, float range, Actor target ) public static bool IsInRange( float2 attackOrigin, float range, Actor target )

View File

@@ -18,7 +18,8 @@ namespace OpenRA.Mods.RA
{ {
public class Barrel public class Barrel
{ {
public int2 Position; // position in turret space public int2 TurretSpaceOffset; // position in turret space
public int2 ScreenSpaceOffset; // screen-space hack to make things line up good.
public int Facing; // deviation from turret facing public int Facing; // deviation from turret facing
} }
@@ -51,16 +52,17 @@ namespace OpenRA.Mods.RA
Turret = turret; Turret = turret;
var barrels = new List<Barrel>(); var barrels = new List<Barrel>();
for (var i = 0; i < localOffset.Length / 3; i++) for (var i = 0; i < localOffset.Length / 5; i++)
barrels.Add(new Barrel barrels.Add(new Barrel
{ {
Position = new int2(localOffset[3 * i], localOffset[3 * i + 1]), TurretSpaceOffset = new int2(localOffset[5 * i], localOffset[5 * i + 1]),
Facing = localOffset[3 * i + 2] ScreenSpaceOffset = new int2(localOffset[5 * i + 2], localOffset[5 * i + 3]),
Facing = localOffset[5 * i + 4]
}); });
// if no barrels specified, the default is "turret position; turret facing". // if no barrels specified, the default is "turret position; turret facing".
if (barrels.Count == 0) if (barrels.Count == 0)
barrels.Add(new Barrel { Position = int2.Zero, Facing = 0 }); barrels.Add(new Barrel { TurretSpaceOffset = int2.Zero, ScreenSpaceOffset = int2.Zero, Facing = 0 });
Barrels = barrels.ToArray(); Barrels = barrels.ToArray();
} }

View File

@@ -61,7 +61,7 @@ HELI:
AttackHeli: AttackHeli:
PrimaryWeapon: HeliGun PrimaryWeapon: HeliGun
PrimaryOffset: 0,-3,0,2 PrimaryOffset: 0,-3,0,2
PrimaryLocalOffset: -5,0,0,5,0,0 PrimaryLocalOffset: -5,0,0,0,0, 5,0,0,0,0
FacingTolerance: 20 FacingTolerance: 20
LimitedAmmo: LimitedAmmo:
Ammo: 10 Ammo: 10
@@ -102,7 +102,7 @@ ORCA:
AttackHeli: AttackHeli:
PrimaryWeapon: OrcaMissiles PrimaryWeapon: OrcaMissiles
PrimaryOffset: 0,-10,0,5 PrimaryOffset: 0,-10,0,5
PrimaryLocalOffset: -4,0,0,4,0,0 PrimaryLocalOffset: -4,0,0,0,0, 4,0,0,0,0
FacingTolerance: 20 FacingTolerance: 20
LimitedAmmo: LimitedAmmo:
Ammo: 10 Ammo: 10

View File

@@ -21,7 +21,7 @@ BOAT:
AttackTurreted: AttackTurreted:
PrimaryWeapon: BoatMissile PrimaryWeapon: BoatMissile
PrimaryOffset: 0,-15,0,-4 PrimaryOffset: 0,-15,0,-4
PrimaryLocalOffset: -3,-5,0,3,-5,0,0,-5,0 PrimaryLocalOffset: -3,-5,0,0,0, 3,-5,0,0,0, 0,-5,0,0,0
RenderGunboat: RenderGunboat:
AutoTarget: AutoTarget:
AllowMovement: false AllowMovement: false

View File

@@ -692,7 +692,7 @@ GTWR:
AttackTurreted: AttackTurreted:
PrimaryWeapon: HighV PrimaryWeapon: HighV
PrimaryOffset: 0,0,0,-6 PrimaryOffset: 0,0,0,-6
PrimaryLocalOffset:0,-6,0 PrimaryLocalOffset: 0,-6,0,0,0
AutoTarget: AutoTarget:
DetectCloaked: DetectCloaked:
Range: 3 Range: 3
@@ -730,7 +730,7 @@ ATWR:
AttackTurreted: AttackTurreted:
PrimaryWeapon: Tomahawk PrimaryWeapon: Tomahawk
PrimaryOffset: 0,0,5,2 PrimaryOffset: 0,0,5,2
PrimaryLocalOffset:7,-7,-25,-7,-7,25 PrimaryLocalOffset: 7,-7,0,0,-25, -7,-7,0,0,25
Turreted: Turreted:
ROT:255 ROT:255
AutoTarget: AutoTarget:

View File

@@ -159,7 +159,7 @@ FTNK:
AttackFrontal: AttackFrontal:
PrimaryWeapon: BigFlamer PrimaryWeapon: BigFlamer
PrimaryOffset: 0,-5,3,2 PrimaryOffset: 0,-5,3,2
PrimaryLocalOffset:2,0,0,-2,0,0 PrimaryLocalOffset: 2,0,0,0,0, -2,0,0,0,0
RenderUnit: RenderUnit:
AutoTarget: AutoTarget:
WithMuzzleFlash: WithMuzzleFlash:
@@ -225,7 +225,7 @@ BIKE:
AttackFrontal: AttackFrontal:
PrimaryWeapon: Rockets.Bike PrimaryWeapon: Rockets.Bike
PrimaryOffset: 0,0,0,-2 PrimaryOffset: 0,0,0,-2
PrimaryLocalOffset: -4,0,25,4,0,-25 PrimaryLocalOffset: -4,0,0,0,25, 4,0,0,0,-25
RenderUnit: RenderUnit:
AutoTarget: AutoTarget:
LeavesHusk: LeavesHusk:
@@ -357,8 +357,8 @@ HTNK:
AttackTurreted: AttackTurreted:
PrimaryWeapon: 120mmDual PrimaryWeapon: 120mmDual
SecondaryWeapon: MissilePack SecondaryWeapon: MissilePack
PrimaryLocalOffset: -5,0,0,5,0,0 PrimaryLocalOffset: -5,-5,0,-10,0, 5,-5,0,-10,0
SecondaryLocalOffset: -9,2,25,9,2,-25 SecondaryLocalOffset: -9,2,0,0,25, 9,2,0,0,-25
Recoil: 4 Recoil: 4
RenderUnitTurreted: RenderUnitTurreted:
AutoTarget: AutoTarget:
@@ -396,7 +396,7 @@ MSAM:
AttackFrontal: AttackFrontal:
PrimaryWeapon: 227mm PrimaryWeapon: 227mm
PrimaryOffset: 0,6,0,-3 PrimaryOffset: 0,6,0,-3
PrimaryLocalOffset: 3,-5,0, -3,-5,0 PrimaryLocalOffset: 3,-5,0,0,0, -3,-5,0,0,0
Recoil: 0 Recoil: 0
RenderUnitTurretedAim: RenderUnitTurretedAim:
AutoTarget: AutoTarget:
@@ -429,8 +429,8 @@ MLRS:
PrimaryWeapon: HonestJohn PrimaryWeapon: HonestJohn
SecondaryWeapon: HonestJohn SecondaryWeapon: HonestJohn
PrimaryOffset: 0,3,0,-3 PrimaryOffset: 0,3,0,-3
PrimaryLocalOffset: -4,0,0 PrimaryLocalOffset: -4,0,0,0,0
SecondaryLocalOffset: 4,0,0 SecondaryLocalOffset: 4,0,0,0,0
Recoil: 0 Recoil: 0
AlignIdleTurrets: true AlignIdleTurrets: true
RenderUnitTurretedAim: RenderUnitTurretedAim:
@@ -466,7 +466,7 @@ STNK:
AttackFrontal: AttackFrontal:
PrimaryWeapon: 227mm.stnk PrimaryWeapon: 227mm.stnk
PrimaryOffset: 0,-5,0,-3 PrimaryOffset: 0,-5,0,-3
PrimaryLocalOffset:1,0,0,-1,0,0 PrimaryLocalOffset: 1,0,0,0,0, -1,0,0,0,0
RenderUnit: RenderUnit:
AutoTarget: AutoTarget:
TargetableUnit: TargetableUnit:

View File

@@ -99,8 +99,8 @@ MIG:
AttackPlane: AttackPlane:
PrimaryWeapon: Maverick PrimaryWeapon: Maverick
SecondaryWeapon: Maverick SecondaryWeapon: Maverick
PrimaryLocalOffset: -15,0,-10,-12,0,6 PrimaryLocalOffset: -15,0,0,0,-10, -12,0,0,0,6
SecondaryLocalOffset: 15,0,10,12,0,6 SecondaryLocalOffset: 15,0,0,0,10, 12,0,0,0,6
FacingTolerance: 20 FacingTolerance: 20
Plane: Plane:
InitialFacing: 192 InitialFacing: 192

View File

@@ -32,7 +32,7 @@ SS:
UncloakSound: subshow1.aud UncloakSound: subshow1.aud
AttackFrontal: AttackFrontal:
PrimaryWeapon: TorpTube PrimaryWeapon: TorpTube
PrimaryLocalOffset: -4,0,0,4,0,0 PrimaryLocalOffset: -4,0,0,0,0, 4,0,0,0,0
FireDelay: 2 FireDelay: 2
Selectable: Selectable:
Bounds: 38,38 Bounds: 38,38
@@ -115,7 +115,7 @@ DD:
PrimaryWeapon: Stinger PrimaryWeapon: Stinger
SecondaryWeapon: DepthCharge SecondaryWeapon: DepthCharge
PrimaryOffset: 0,-8,0,-3 PrimaryOffset: 0,-8,0,-3
PrimaryLocalOffset: -4,0,-20,4,0,20 PrimaryLocalOffset: -4,0,0,0,-20, 4,0,0,0,20
Selectable: Selectable:
Bounds: 38,38 Bounds: 38,38
RenderUnitTurreted: RenderUnitTurreted:
@@ -156,8 +156,8 @@ CA:
SecondaryWeapon: 8Inch SecondaryWeapon: 8Inch
PrimaryOffset: 0,17,0,-2 PrimaryOffset: 0,17,0,-2
SecondaryOffset: 0,-17,0,-2 SecondaryOffset: 0,-17,0,-2
PrimaryLocalOffset: -4,-5,0,4,-5,0 PrimaryLocalOffset: -4,-5,0,0,0, 4,-5,0,0,0
SecondaryLocalOffset: -4,-5,0,4,-5,0 SecondaryLocalOffset: -4,-5,0,0,0, 4,-5,0,0,0
Recoil: 4 Recoil: 4
Selectable: Selectable:
Bounds: 44,44 Bounds: 44,44

View File

@@ -381,7 +381,7 @@ PBOX:
Range: 6 Range: 6
AttackTurreted: AttackTurreted:
PrimaryWeapon: Vulcan PrimaryWeapon: Vulcan
PrimaryLocalOffset: 0,-11,0 PrimaryLocalOffset: 0,-11,0,0,0
AutoTarget: AutoTarget:
IronCurtainable: IronCurtainable:
RenderRangeCircle: RenderRangeCircle:
@@ -414,7 +414,7 @@ HBOX:
Range: 6 Range: 6
AttackTurreted: AttackTurreted:
PrimaryWeapon: Vulcan PrimaryWeapon: Vulcan
PrimaryLocalOffset: 0,-11,0 PrimaryLocalOffset: 0,-11,0,0,0
AutoTarget: AutoTarget:
IronCurtainable: IronCurtainable:
RenderRangeCircle: RenderRangeCircle:
@@ -484,7 +484,7 @@ FTUR:
AttackTurreted: AttackTurreted:
PrimaryWeapon: FireballLauncher PrimaryWeapon: FireballLauncher
PrimaryOffset: 0,0,0,-2 PrimaryOffset: 0,0,0,-2
PrimaryLocalOffset: 0,-12,0 PrimaryLocalOffset: 0,-12,0,0,0
AutoTarget: AutoTarget:
IronCurtainable: IronCurtainable:
RenderRangeCircle: RenderRangeCircle:

View File

@@ -153,8 +153,8 @@ V2RL:
AttackTurreted: AttackTurreted:
PrimaryWeapon: 120mm PrimaryWeapon: 120mm
SecondaryWeapon: MammothTusk SecondaryWeapon: MammothTusk
PrimaryLocalOffset: -4,-5,0,4,-5,0 PrimaryLocalOffset: -4,-5,0,0,0, 4,-5,0,0,0
SecondaryLocalOffset: -7,2,25,7,2,-25 SecondaryLocalOffset: -7,2,0,0,25, 7,2,0,0,-25
Recoil: 4 Recoil: 4
RenderUnitTurreted: RenderUnitTurreted:
AutoTarget: AutoTarget: