Skip to content

Commit 93ac10f

Browse files
committed
rename Dir and MoveDir on client
1 parent e12103e commit 93ac10f

File tree

8 files changed

+79
-85
lines changed

8 files changed

+79
-85
lines changed

Intersect.Client.Core/Entities/Critter.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public Critter(MapInstance map, byte x, byte y, MapCritterAttribute att) : base(
3636
//Determine Direction
3737
if (mAttribute.Direction == 0)
3838
{
39-
Dir = Randomization.NextDirection();
39+
DirectionFacing = Randomization.NextDirection();
4040
}
4141
else
4242
{
43-
Dir = (Direction)(mAttribute.Direction - 1);
43+
DirectionFacing = (Direction)(mAttribute.Direction - 1);
4444
}
4545

4646
//Block Players?
@@ -59,7 +59,7 @@ public override bool Update()
5959
MoveRandomly();
6060
break;
6161
case 1: //Turn?
62-
Dir = Randomization.NextDirection();
62+
DirectionFacing = Randomization.NextDirection();
6363
break;
6464

6565
}
@@ -75,7 +75,7 @@ public override bool Update()
7575

7676
private void MoveRandomly()
7777
{
78-
MoveDir = Randomization.NextDirection();
78+
DirectionMoving = Randomization.NextDirection();
7979
var tmpX = (sbyte)X;
8080
var tmpY = (sbyte)Y;
8181
IEntity? blockedBy = null;
@@ -88,7 +88,7 @@ private void MoveRandomly()
8888
var deltaX = 0;
8989
var deltaY = 0;
9090

91-
switch (MoveDir)
91+
switch (DirectionMoving)
9292
{
9393
case Direction.Up:
9494
deltaX = 0;
@@ -153,7 +153,7 @@ private void MoveRandomly()
153153
tmpX += (sbyte)deltaX;
154154
tmpY += (sbyte)deltaY;
155155
IsMoving = true;
156-
Dir = MoveDir;
156+
DirectionFacing = DirectionMoving;
157157

158158
if (deltaX == 0)
159159
{
@@ -181,9 +181,9 @@ private void MoveRandomly()
181181
Y = (byte)tmpY;
182182
MoveTimer = Timing.Global.MillisecondsUtc + (long)GetMovementTime();
183183
}
184-
else if (MoveDir != Dir)
184+
else if (DirectionMoving != DirectionFacing)
185185
{
186-
Dir = MoveDir;
186+
DirectionFacing = DirectionMoving;
187187
}
188188
}
189189

Intersect.Client.Core/Entities/Dash.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void Start(Entity entity)
9393
mEndYCoord = targetMap.Y + mEndY * Options.Instance.Map.TileHeight - (currentMap.Y + entity.Y * Options.Instance.Map.TileHeight);
9494
if (mChangeDirection > Direction.None)
9595
{
96-
entity.Dir = mChangeDirection;
96+
entity.DirectionFacing = mChangeDirection;
9797
}
9898
}
9999

Intersect.Client.Core/Entities/Entity.cs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public Guid[] Equipment
135135
//Chat
136136
private readonly List<ChatBubble> mChatBubbles = [];
137137

138-
private Direction mDir;
138+
private Direction _directionFacing;
139139

140140
protected bool mDisposed;
141141

@@ -145,7 +145,7 @@ public Guid[] Equipment
145145

146146
public Color Color { get; set; } = new Color(255, 255, 255, 255);
147147

148-
public virtual Direction MoveDir { get; set; } = Direction.None;
148+
public virtual Direction DirectionMoving { get; set; } = Direction.None;
149149

150150
public long MoveTimer { get; set; }
151151

@@ -328,13 +328,13 @@ public Entity(Guid id, EntityPacket? packet, EntityType entityType)
328328

329329
public Vector2 Center => Origin - CenterOffset;
330330

331-
public Direction Dir
331+
public Direction DirectionFacing
332332
{
333-
get => mDir;
334-
set => mDir = (Direction)((int)(value + Options.Instance.Map.MovementDirections) % Options.Instance.Map.MovementDirections);
333+
get => _directionFacing;
334+
set => _directionFacing = (Direction)((int)(value + Options.Instance.Map.MovementDirections) % Options.Instance.Map.MovementDirections);
335335
}
336336

337-
private Direction mLastDirection = Direction.Down;
337+
private Direction _lastDirection = Direction.Down;
338338

339339
public virtual string TransformedSprite
340340
{
@@ -404,7 +404,7 @@ public virtual void Load(EntityPacket? packet)
404404
Face = packet.Face;
405405
Level = packet.Level;
406406
Position = packet.Position;
407-
Dir = (Direction)packet.Dir;
407+
DirectionFacing = (Direction)packet.Dir;
408408
Passable = packet.Passable;
409409
HideName = packet.HideName;
410410
IsHidden = packet.HideEntity;
@@ -604,7 +604,7 @@ public virtual void Dispose()
604604
public virtual float GetMovementTime()
605605
{
606606
var time = 1000f / (float)(1 + Math.Log(Stat[(int)Enums.Stat.Speed]));
607-
if (Dir > Direction.Right)
607+
if (DirectionFacing > Direction.Right)
608608
{
609609
time *= MathHelper.UnitDiagonalLength;
610610
}
@@ -704,9 +704,9 @@ public virtual bool Update()
704704
{
705705
var displacementTime = ecTime * TileHeight / GetMovementTime();
706706

707-
PickLastDirection(Dir);
707+
PickLastDirection(DirectionFacing);
708708

709-
switch (Dir)
709+
switch (DirectionFacing)
710710
{
711711
case Direction.Up:
712712
OffsetY -= displacementTime;
@@ -904,7 +904,7 @@ public virtual bool Update()
904904
animation.Show();
905905
}
906906

907-
var animationDirection = animation.AutoRotate ? Dir : default;
907+
var animationDirection = animation.AutoRotate ? DirectionFacing : default;
908908
animation.SetPosition(
909909
(int)Math.Ceiling(Center.X),
910910
(int)Math.Ceiling(Center.Y),
@@ -1235,7 +1235,7 @@ public virtual void Draw()
12351235
return;
12361236
}
12371237

1238-
var spriteRow = PickSpriteRow(Dir);
1238+
var spriteRow = PickSpriteRow(DirectionFacing);
12391239

12401240
var frameWidth = texture.Width / SpriteFrames;
12411241
var frameHeight = texture.Height / Options.Instance.Sprites.Directions;
@@ -1261,9 +1261,9 @@ public virtual void Draw()
12611261
WorldPos = destRectangle;
12621262

12631263
//Order the layers of paperdolls and sprites
1264-
for (var z = 0; z < Options.Instance.Equipment.Paperdoll.Directions[(int)mLastDirection].Count; z++)
1264+
for (var z = 0; z < Options.Instance.Equipment.Paperdoll.Directions[(int)_lastDirection].Count; z++)
12651265
{
1266-
var paperdoll = Options.Instance.Equipment.Paperdoll.Directions[(int)mLastDirection][z];
1266+
var paperdoll = Options.Instance.Equipment.Paperdoll.Directions[(int)_lastDirection][z];
12671267
var equipSlot = Options.Instance.Equipment.Slots.IndexOf(paperdoll);
12681268

12691269
//Check for player
@@ -1343,23 +1343,23 @@ private int PickSpriteRow(Direction direction)
13431343
switch (direction)
13441344
{
13451345
case Direction.Left:
1346-
case Direction.DownLeft when mLastDirection == Direction.Left:
1347-
case Direction.UpLeft when mLastDirection == Direction.Left:
1346+
case Direction.DownLeft when _lastDirection == Direction.Left:
1347+
case Direction.UpLeft when _lastDirection == Direction.Left:
13481348
return 1;
13491349

13501350
case Direction.Right:
1351-
case Direction.DownRight when mLastDirection == Direction.Right:
1352-
case Direction.UpRight when mLastDirection == Direction.Right:
1351+
case Direction.DownRight when _lastDirection == Direction.Right:
1352+
case Direction.UpRight when _lastDirection == Direction.Right:
13531353
return 2;
13541354

13551355
case Direction.Up:
1356-
case Direction.UpLeft when mLastDirection != Direction.Left:
1357-
case Direction.UpRight when mLastDirection != Direction.Right:
1356+
case Direction.UpLeft when _lastDirection != Direction.Left:
1357+
case Direction.UpRight when _lastDirection != Direction.Right:
13581358
return 3;
13591359

13601360
case Direction.Down:
1361-
case Direction.DownLeft when mLastDirection != Direction.Left:
1362-
case Direction.DownRight when mLastDirection != Direction.Right:
1361+
case Direction.DownLeft when _lastDirection != Direction.Left:
1362+
case Direction.DownRight when _lastDirection != Direction.Right:
13631363
default:
13641364
return 0;
13651365
}
@@ -1370,28 +1370,28 @@ public void PickLastDirection(Direction direction)
13701370
switch (direction)
13711371
{
13721372
case Direction.Left:
1373-
case Direction.DownLeft when mLastDirection == Direction.Left:
1374-
case Direction.UpLeft when mLastDirection == Direction.Left:
1375-
mLastDirection = Direction.Left;
1373+
case Direction.DownLeft when _lastDirection == Direction.Left:
1374+
case Direction.UpLeft when _lastDirection == Direction.Left:
1375+
_lastDirection = Direction.Left;
13761376
break;
13771377

13781378
case Direction.Right:
1379-
case Direction.DownRight when mLastDirection == Direction.Right:
1380-
case Direction.UpRight when mLastDirection == Direction.Right:
1381-
mLastDirection = Direction.Right;
1379+
case Direction.DownRight when _lastDirection == Direction.Right:
1380+
case Direction.UpRight when _lastDirection == Direction.Right:
1381+
_lastDirection = Direction.Right;
13821382
break;
13831383

13841384
case Direction.Up:
1385-
case Direction.UpLeft when mLastDirection != Direction.Left:
1386-
case Direction.UpRight when mLastDirection != Direction.Right:
1387-
mLastDirection = Direction.Up;
1385+
case Direction.UpLeft when _lastDirection != Direction.Left:
1386+
case Direction.UpRight when _lastDirection != Direction.Right:
1387+
_lastDirection = Direction.Up;
13881388
break;
13891389

13901390
case Direction.Down:
1391-
case Direction.DownLeft when mLastDirection != Direction.Left:
1392-
case Direction.DownRight when mLastDirection != Direction.Right:
1391+
case Direction.DownLeft when _lastDirection != Direction.Left:
1392+
case Direction.DownRight when _lastDirection != Direction.Right:
13931393
default:
1394-
mLastDirection = Direction.Down;
1394+
_lastDirection = Direction.Down;
13951395
break;
13961396
}
13971397
}
@@ -1483,7 +1483,7 @@ public virtual void DrawEquipment(string filename, Color renderColor)
14831483
}
14841484

14851485
// Calculate: direction, frame width and frame height.
1486-
var spriteRow = PickSpriteRow(Dir);
1486+
var spriteRow = PickSpriteRow(DirectionFacing);
14871487
var frameWidth = paperdollTex.Width / spriteFrames;
14881488
var frameHeight = paperdollTex.Height / Options.Instance.Sprites.Directions;
14891489

@@ -2317,15 +2317,15 @@ public Direction DirectionToTarget(Entity en)
23172317
{
23182318
if (en == null)
23192319
{
2320-
return Dir;
2320+
return DirectionFacing;
23212321
}
23222322

23232323
var originMapController = MapInstance;
23242324
var targetMapController = en.MapInstance;
23252325

23262326
if (originMapController == null || targetMapController == null)
23272327
{
2328-
return Dir;
2328+
return DirectionFacing;
23292329
}
23302330

23312331
var originY = Y + originMapController.GridY * MapHeight;

0 commit comments

Comments
 (0)