Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

large and huge world vector packet fix #733

Merged
merged 6 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Content/Bosses/GlassMiniboss/NPCs.Glassweaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ public override void AI()

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(moveTarget);
writer.WriteVector2(moveTarget);
writer.Write(attackVariant);
writer.Write(NPC.direction);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
moveTarget = reader.ReadPackedVector2();
moveTarget = reader.ReadVector2();
attackVariant = reader.ReadBoolean();
NPC.direction = reader.ReadInt32();
}
Expand Down
12 changes: 6 additions & 6 deletions Content/Bosses/VitricBoss/NPCs.VitricBoss.cs
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,9 @@ public override void SendExtraAI(System.IO.BinaryWriter writer)
writer.Write(altAttack);
writer.Write(lockedRotation);

writer.WritePackedVector2(startPos);
writer.WritePackedVector2(endPos);
writer.WritePackedVector2(homePos);
writer.WriteVector2(startPos);
writer.WriteVector2(endPos);
writer.WriteVector2(homePos);

writer.Write(NPC.dontTakeDamage);
writer.Write(NPC.defense);
Expand All @@ -846,9 +846,9 @@ public override void ReceiveExtraAI(System.IO.BinaryReader reader)
altAttack = reader.ReadBoolean();
lockedRotation = reader.ReadSingle();

startPos = reader.ReadPackedVector2();
endPos = reader.ReadPackedVector2();
homePos = reader.ReadPackedVector2();
startPos = reader.ReadVector2();
endPos = reader.ReadVector2();
homePos = reader.ReadVector2();

NPC.dontTakeDamage = reader.ReadBoolean();
NPC.defense = reader.ReadInt32();
Expand Down
8 changes: 4 additions & 4 deletions Content/Bosses/VitricBoss/NPCs.VitricBossCrystal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public bool findParent()

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(StartPos);
writer.WritePackedVector2(TargetPos);
writer.WriteVector2(StartPos);
writer.WriteVector2(TargetPos);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
StartPos = reader.ReadPackedVector2();
TargetPos = reader.ReadPackedVector2();
StartPos = reader.ReadVector2();
TargetPos = reader.ReadVector2();
}

public override void AI()
Expand Down
8 changes: 4 additions & 4 deletions Content/Bosses/VitricBoss/Projectiles.LavaDart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ public override void PostDraw(Color lightColor)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(midPoint);
writer.WritePackedVector2(endPoint);
writer.WriteVector2(midPoint);
writer.WriteVector2(endPoint);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
midPoint = reader.ReadPackedVector2();
endPoint = reader.ReadPackedVector2();
midPoint = reader.ReadVector2();
endPoint = reader.ReadVector2();

if (startPoint == Vector2.Zero)
setStartAndDist();
Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Breacher/Weapons.FlareBreacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(stuck);
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(enemyID);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
stuck = reader.ReadBoolean();
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
enemyID = reader.ReadInt32();
}

Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Dungeon/Weapons.Cloudstrike.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,15 +674,15 @@ private void UpdateRotation()

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(mousePos);
writer.WriteVector2(mousePos);
writer.Write(oldRotation);
writer.Write(followPlayer);
writer.Write(Projectile.timeLeft);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
mousePos = reader.ReadPackedVector2();
mousePos = reader.ReadVector2();
oldRotation = reader.ReadSingle();
followPlayer = reader.ReadBoolean();
Projectile.timeLeft = reader.ReadInt32();
Expand Down
8 changes: 4 additions & 4 deletions Content/Items/Gravedigger/Weapons.GravediggerItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ private void CreateBlood(NPC target, int hitDirection, float knockback)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(directionTwo);
writer.WritePackedVector2(direction);
writer.WriteVector2(directionTwo);
writer.WriteVector2(direction);
writer.Write(Projectile.frame);
writer.Write(Projectile.frameCounter);
writer.Write(SlashWindow);
Expand All @@ -414,8 +414,8 @@ public override void SendExtraAI(BinaryWriter writer)

public override void ReceiveExtraAI(BinaryReader reader)
{
directionTwo = reader.ReadPackedVector2();
direction = reader.ReadPackedVector2();
directionTwo = reader.ReadVector2();
direction = reader.ReadVector2();
Projectile.frame = reader.ReadInt32();
Projectile.frameCounter = reader.ReadInt32();
SlashWindow = reader.ReadInt32();
Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Haunted/Accessories.TaintedGreataxe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(stickyAI);
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(enemyWhoAmI);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
stickyAI = reader.ReadBoolean();
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
enemyWhoAmI = reader.ReadInt32();
}

Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Haunted/Weapons.HauntedDaggerStaff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ internal NPC FindTarget()
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(embedded);
writer.WritePackedVector2(enemyOffset);
writer.WriteVector2(enemyOffset);

if (embeddedTarget != null)
writer.Write(embeddedTarget.whoAmI);
Expand All @@ -552,7 +552,7 @@ public override void SendExtraAI(BinaryWriter writer)
public override void ReceiveExtraAI(BinaryReader reader)
{
embedded = reader.ReadBoolean();
enemyOffset = reader.ReadPackedVector2();
enemyOffset = reader.ReadVector2();
int embeddedTargetId = reader.ReadInt32();

if (embeddedTargetId >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,13 @@ public override bool PreDraw(ref Color lightColor)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(enemyID);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
enemyID = reader.ReadInt32();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Vitric/Ammo.VitricBullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ public override void Kill(int timeLeft)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(enemyID);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
enemyID = reader.ReadInt32();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Vitric/Weapons.Coalescence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(targetPoint);
writer.WriteVector2(targetPoint);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
targetPoint = reader.ReadPackedVector2();
targetPoint = reader.ReadVector2();
}

public void DrawAdditive(SpriteBatch spriteBatch)
Expand Down
4 changes: 2 additions & 2 deletions Content/Items/Vitric/Weapons.MagmiteVacpack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,14 @@ public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(stuck);
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(enemyID);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
stuck = reader.ReadBoolean();
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
enemyID = reader.ReadInt32();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content/NPCs/Moonstone/AngryCrescent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public override void SendExtraAI(BinaryWriter writer)
// Sort of sloppy making the assumption that only 1 packet is ever sent for state 1 and that its near enough to the transition
if (AIState == 1)
{
writer.WritePackedVector2(offset);
writer.WriteVector2(offset);
writer.Write(pointOnChain);
writer.Write(animating);
writer.Write(initializeAnimation);
Expand All @@ -405,7 +405,7 @@ public override void ReceiveExtraAI(BinaryReader reader)
// Sort of sloppy making the assumption that only 1 packet is ever sent for state 1 and that its near enough to the transition
if (AIState == 1)
{
offset = reader.ReadPackedVector2();
offset = reader.ReadVector2();
pointOnChain = reader.ReadInt32();
animating = reader.ReadBoolean();
initializeAnimation = reader.ReadBoolean();
Expand Down
4 changes: 2 additions & 2 deletions Content/NPCs/Vitric/CrystalPopper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(NPC.noGravity);
writer.Write(NPC.target);
writer.WritePackedVector2(NPC.velocity);
writer.WriteVector2(NPC.velocity);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
NPC.noGravity = reader.ReadBoolean();
NPC.target = reader.ReadInt32();
NPC.velocity = reader.ReadPackedVector2();
NPC.velocity = reader.ReadVector2();
}

public override void SetDefaults()
Expand Down
8 changes: 4 additions & 4 deletions Content/NPCs/Vitric/Gauntlet/FlyingGruntConstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ public override void SafeSendExtraAI(BinaryWriter writer)
//frames are being used like cursed timers, maybe TODO: rework this
writer.Write(xFrame);
writer.Write(yFrame);
writer.WritePackedVector2(movementTarget);
writer.WritePackedVector2(oldPosition);
writer.WriteVector2(movementTarget);
writer.WriteVector2(oldPosition);

brownianMotionRandSeed = Main.rand.Next(int.MaxValue);
brownianRand = new(brownianMotionRandSeed);
Expand All @@ -547,8 +547,8 @@ public override void SafeReceiveExtraAI(BinaryReader reader)
{
xFrame = reader.ReadInt32();
yFrame = reader.ReadInt32();
movementTarget = reader.ReadPackedVector2();
oldPosition = reader.ReadPackedVector2();
movementTarget = reader.ReadVector2();
oldPosition = reader.ReadVector2();
brownianMotionRandSeed = reader.ReadInt32();

brownianRand = new(brownianMotionRandSeed);
Expand Down
8 changes: 4 additions & 4 deletions Content/NPCs/Vitric/Gauntlet/FlyingPelterConstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,14 @@ public override void DrawHealingGlow(SpriteBatch spriteBatch)

public override void SafeSendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(posToBe);
writer.WritePackedVector2(oldPos);
writer.WriteVector2(posToBe);
writer.WriteVector2(oldPos);
}

public override void SafeReceiveExtraAI(BinaryReader reader)
{
posToBe = reader.ReadPackedVector2();
oldPos = reader.ReadPackedVector2();
posToBe = reader.ReadVector2();
oldPos = reader.ReadVector2();
}
}

Expand Down
8 changes: 4 additions & 4 deletions Content/NPCs/Vitric/Gauntlet/GauntletSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public override void SpawnNPC()

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(startPos); //this may need to get changed into a safeSendExtraAI if the base class needs to send extra ai
writer.WritePackedVector2(targetPos);
writer.WriteVector2(startPos); //this may need to get changed into a safeSendExtraAI if the base class needs to send extra ai
writer.WriteVector2(targetPos);
writer.Write(rand); //these could be put into ai[] fields but the base class should hold dominion over those
writer.Write(moveTimer);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
startPos = reader.ReadPackedVector2();
targetPos = reader.ReadPackedVector2();
startPos = reader.ReadVector2();
targetPos = reader.ReadVector2();
rand = reader.ReadSingle();
moveTimer = reader.ReadInt32();
}
Expand Down
4 changes: 2 additions & 2 deletions Content/NPCs/Vitric/MagmitePassive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestia

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(NPC.velocity);
writer.WriteVector2(NPC.velocity);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
NPC.velocity = reader.ReadPackedVector2();
NPC.velocity = reader.ReadVector2();
}

public override bool PreAI()
Expand Down
8 changes: 4 additions & 4 deletions Content/Tiles/Underground/EvasionShrineBullets/Dart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ public void DrawPrimitives()

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(midPoint);
writer.WritePackedVector2(endPoint);
writer.WriteVector2(midPoint);
writer.WriteVector2(endPoint);
writer.Write(duration);
}

public override void ReceiveExtraAI(BinaryReader reader)
{
midPoint = reader.ReadPackedVector2();
endPoint = reader.ReadPackedVector2();
midPoint = reader.ReadVector2();
endPoint = reader.ReadVector2();
duration = reader.ReadInt32();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content/Tiles/Underground/EvasionShrineBullets/Spear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public override bool PreDraw(ref Color lightColor)

public override void SendExtraAI(BinaryWriter writer)
{
writer.WritePackedVector2(endPoint);
writer.WriteVector2(endPoint);
writer.Write(timeToRise);
writer.Write(timeToRetract);
writer.Write(teleTime);
Expand All @@ -167,7 +167,7 @@ public override void SendExtraAI(BinaryWriter writer)

public override void ReceiveExtraAI(BinaryReader reader)
{
endPoint = reader.ReadPackedVector2();
endPoint = reader.ReadVector2();
timeToRise = reader.ReadInt32();
timeToRetract = reader.ReadInt32();
teleTime = reader.ReadInt32();
Expand Down
Loading
Loading