diff --git a/StyleCop.Cache b/StyleCop.Cache new file mode 100644 index 000000000..472d28838 --- /dev/null +++ b/StyleCop.Cache @@ -0,0 +1,7 @@ + + 12 + + + + + \ No newline at end of file diff --git a/Subsurface/Camera.cs b/Subsurface/Camera.cs index 662fdb27b..11a260a4d 100644 --- a/Subsurface/Camera.cs +++ b/Subsurface/Camera.cs @@ -5,28 +5,23 @@ using Microsoft.Xna.Framework.Input; namespace Subsurface { public class Camera - { - float zoom; - + { const float DefaultZoom = 1.0f; const float ZoomSmoothness = 8.0f; const float MoveSmoothness = 8.0f; - float offsetAmount; + private float zoom; - Matrix transform; - Matrix shaderTransform; + private float offsetAmount; - Matrix viewMatrix; + private Matrix transform, shaderTransform, viewMatrix; private Vector2 position; - float rotation; + private float rotation; //the area of the world inside the camera view - //used by the sprite drawing functions to determine whether - //a sprite should be drawn - Rectangle worldView; + private Rectangle worldView; - Point resolution; + private Point resolution; private Vector2 targetPos; @@ -35,7 +30,6 @@ namespace Subsurface get { return zoom; } set { - //prevZoom = zoom; zoom = value; if (zoom < 0.1f) zoom = 0.1f; @@ -46,8 +40,8 @@ namespace Subsurface float newHeight = resolution.Y / zoom; worldView = new Rectangle( - (int)(center.X - newWidth/2.0f), - (int)(center.Y - newHeight/2.0f), + (int)(center.X - newWidth / 2.0f), + (int)(center.Y - newHeight / 2.0f), (int)newWidth, (int)newHeight); @@ -110,7 +104,6 @@ namespace Subsurface resolution = new Point(Game1.GraphicsWidth, Game1.GraphicsHeight); viewMatrix = - //Matrix.CreateRotationZ(Rotation) * Matrix.CreateTranslation(new Vector3(Game1.GraphicsWidth / 2.0f, Game1.GraphicsHeight / 2.0f, 0)); } diff --git a/Subsurface/Characters/AI/AIController.cs b/Subsurface/Characters/AI/AIController.cs index f32019c3f..96922c9f3 100644 --- a/Subsurface/Characters/AI/AIController.cs +++ b/Subsurface/Characters/AI/AIController.cs @@ -9,7 +9,7 @@ namespace Subsurface public enum AiState { None, Attack, GoTo, Escape } public enum SteeringState { Wander, Seek, Escape } - public Character character; + public Character Character; protected AiState state; @@ -17,18 +17,18 @@ namespace Subsurface public Vector2 Steering { - get { return character.animController.TargetMovement; } - set { character.animController.TargetMovement = value; } + get { return Character.AnimController.TargetMovement; } + set { Character.AnimController.TargetMovement = value; } } public Vector2 Position { - get { return character.animController.limbs[0].SimPosition; } + get { return Character.AnimController.limbs[0].SimPosition; } } public Vector2 Velocity { - get { return character.animController.limbs[0].LinearVelocity; } + get { return Character.AnimController.limbs[0].LinearVelocity; } } public AiState State @@ -38,7 +38,7 @@ namespace Subsurface public AIController (Character c) { - character = c; + Character = c; steeringManager = new SteeringManager(this); } diff --git a/Subsurface/Characters/AI/AITarget.cs b/Subsurface/Characters/AI/AITarget.cs index 9c10f1851..3a0670f2a 100644 --- a/Subsurface/Characters/AI/AITarget.cs +++ b/Subsurface/Characters/AI/AITarget.cs @@ -5,14 +5,13 @@ namespace Subsurface { class AITarget { - public static List list = new List(); + public static List List = new List(); + public Entity Entity; protected float soundRange; protected float sightRange; - - public Entity entity; - + public float SoundRange { get @@ -30,18 +29,18 @@ namespace Subsurface public Vector2 Position { - get { return entity.SimPosition; } + get { return Entity.SimPosition; } } public AITarget(Entity e) { - entity = e; - list.Add(this); + Entity = e; + List.Add(this); } public void Remove() { - list.Remove(this); + List.Remove(this); } } diff --git a/Subsurface/Characters/AI/EnemyAIController.cs b/Subsurface/Characters/AI/EnemyAIController.cs index 9b3aafbf7..0ff95d7e4 100644 --- a/Subsurface/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Characters/AI/EnemyAIController.cs @@ -11,7 +11,12 @@ namespace Subsurface { class EnemyAIController : AIController - { //the preference to attack a specific type of target (-1.0 - 1.0) + { + private const float UpdateTargetsInterval = 5.0f; + + private const float RaycastInterval = 1.0f; + + //the preference to attack a specific type of target (-1.0 - 1.0) //0.0 = doesn't attack targets of the type //positive values = attacks targets of this type //negative values = escapes targets of this type @@ -20,13 +25,9 @@ namespace Subsurface private float attackWeaker; private float attackStronger; - - private float updateTargetsTimer; - private const float UpdateTargetsInterval = 5.0f; private float raycastTimer; - private const float RaycastInterval = 1.0f; private Vector2 prevPosition; private float distanceAccumulator; @@ -85,7 +86,7 @@ namespace Subsurface { UpdateDistanceAccumulator(); - character.animController.IgnorePlatforms = (-character.animController.TargetMovement.Y > Math.Abs(character.animController.TargetMovement.X)); + Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X)); if (updateTargetsTimer > 0.0) { @@ -94,7 +95,7 @@ namespace Subsurface else { System.Diagnostics.Debug.WriteLine("updatetargets"); - UpdateTargets(character); + UpdateTargets(Character); updateTargetsTimer = UpdateTargetsInterval; if (selectedTarget == null) @@ -136,7 +137,7 @@ namespace Subsurface private void UpdateDistanceAccumulator() { - Limb limb = character.animController.limbs[0]; + Limb limb = Character.AnimController.limbs[0]; distanceAccumulator += (limb.SimPosition - prevPosition).Length(); prevPosition = limb.body.Position; @@ -178,10 +179,10 @@ namespace Subsurface //check if any of the limbs is close enough to attack the target if (attackingLimb == null) { - foreach (Limb limb in character.animController.limbs) + foreach (Limb limb in Character.AnimController.limbs) { - if (limb.attack==null || limb.attack.type == Attack.Type.None) continue; - if (Vector2.Distance(limb.SimPosition, attackPosition) > limb.attack.range) continue; + if (limb.attack==null || limb.attack.Type == AttackType.None) continue; + if (Vector2.Distance(limb.SimPosition, attackPosition) > limb.attack.Range) continue; attackingLimb = limb; break; @@ -200,8 +201,8 @@ namespace Subsurface //System.Diagnostics.Debug.WriteLine("cooldown"); - if (selectedTarget.entity is Hull || - Vector2.Distance(attackPosition, character.animController.limbs[0].SimPosition) < ConvertUnits.ToSimUnits(500.0f)) + if (selectedTarget.Entity is Hull || + Vector2.Distance(attackPosition, Character.AnimController.limbs[0].SimPosition) < ConvertUnits.ToSimUnits(500.0f)) { steeringManager.SteeringSeek(attackPosition, -0.8f); steeringManager.SteeringAvoid(deltaTime, 1.0f); @@ -217,7 +218,7 @@ namespace Subsurface { targetEntity = null; //check if there's a wall between the target and the character - Vector2 rayStart = character.animController.limbs[0].SimPosition; + Vector2 rayStart = Character.AnimController.limbs[0].SimPosition; Vector2 rayEnd = selectedTarget.Position; Body closestBody = Submarine.CheckVisibility(rayStart, rayEnd); @@ -257,12 +258,12 @@ namespace Subsurface { IDamageable damageTarget = null; - switch (limb.attack.type) + switch (limb.attack.Type) { - case Attack.Type.PinchCW: - case Attack.Type.PinchCCW: + case AttackType.PinchCW: + case AttackType.PinchCCW: - float dir = (limb.attack.type == Attack.Type.PinchCW) ? 1.0f : -1.0f; + float dir = (limb.attack.Type == AttackType.PinchCW) ? 1.0f : -1.0f; float dist = Vector2.Distance(limb.SimPosition, attackPosition); if (wallAttackPos != Vector2.Zero && targetEntity != null) @@ -271,21 +272,21 @@ namespace Subsurface } else { - damageTarget = selectedTarget.entity as IDamageable; + damageTarget = selectedTarget.Entity as IDamageable; } attackTimer += deltaTime*0.05f; if (damageTarget == null) { - attackTimer = limb.attack.duration; + attackTimer = limb.attack.Duration; break; } - if (dist < limb.attack.range * 0.5f) + if (dist < limb.attack.Range * 0.5f) { attackTimer += deltaTime; - limb.body.ApplyTorque(limb.Mass * 50.0f * character.animController.Dir * dir); + limb.body.ApplyTorque(limb.Mass * 50.0f * Character.AnimController.Dir * dir); limb.attack.DoDamage(damageTarget, limb.SimPosition, deltaTime, (limb.soundTimer <= 0.0f)); @@ -303,11 +304,11 @@ namespace Subsurface break; default: - attackTimer = limb.attack.duration; + attackTimer = limb.attack.Duration; break; } - if (attackTimer >= limb.attack.duration) + if (attackTimer >= limb.attack.Duration) { attackTimer = 0.0f; if (Vector2.Distance(limb.SimPosition, attackPosition)<5.0) coolDownTimer = attackCoolDown; @@ -320,10 +321,10 @@ namespace Subsurface //sight/hearing range public void UpdateTargets(Character character) { - if (distanceAccumulator<5.0f && Game1.random.Next(1,3)==1) + if (distanceAccumulator<5.0f && Rand.Range(1,3, false)==1) { selectedTarget = null; - character.animController.TargetMovement = -character.animController.TargetMovement; + character.AnimController.TargetMovement = -character.AnimController.TargetMovement; state = AiState.None; return; } @@ -335,35 +336,35 @@ namespace Subsurface UpdateTargetMemories(); - foreach (AITarget target in AITarget.list) + foreach (AITarget target in AITarget.List) { float valueModifier = 0.0f; float dist = 0.0f; - IDamageable targetDamageable = target.entity as IDamageable; + IDamageable targetDamageable = target.Entity as IDamageable; if (targetDamageable!=null && targetDamageable.Health <= 0.0f) continue; - Character targetCharacter = target.entity as Character; + Character targetCharacter = target.Entity as Character; //ignore the aitarget if it is the character itself if (targetCharacter == character) continue; if (targetCharacter!=null) { - if (attackHumans == 0.0f || targetCharacter.speciesName != "human") continue; + if (attackHumans == 0.0f || targetCharacter.SpeciesName != "human") continue; valueModifier = attackHumans; } - else if (target.entity!=null && attackRooms!=0.0f) + else if (target.Entity!=null && attackRooms!=0.0f) { //skip the target if it's the room the character is inside of - if (character.animController.CurrentHull != null && character.animController.CurrentHull == target.entity as Hull) continue; + if (character.AnimController.CurrentHull != null && character.AnimController.CurrentHull == target.Entity as Hull) continue; valueModifier = attackRooms; } dist = Vector2.Distance( - character.animController.limbs[0].SimPosition, + character.AnimController.limbs[0].SimPosition, target.Position); dist = ConvertUnits.ToDisplayUnits(dist); @@ -374,7 +375,7 @@ namespace Subsurface if (Math.Abs(valueModifier) > Math.Abs(targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing)) { - Vector2 rayStart = character.animController.limbs[0].SimPosition; + Vector2 rayStart = character.AnimController.limbs[0].SimPosition; Vector2 rayEnd = target.Position; Body closestBody = Submarine.CheckVisibility(rayStart, rayEnd); @@ -414,7 +415,7 @@ namespace Subsurface selectedTargetMemory = targetMemory; targetValue = valueModifier; - Debug.WriteLine(selectedTarget.entity+": "+targetValue); + Debug.WriteLine(selectedTarget.Entity+": "+targetValue); } } } @@ -448,7 +449,7 @@ namespace Subsurface foreach(KeyValuePair memory in targetMemories) { memory.Value.Priority += 0.5f; - if (memory.Value.Priority == 0.0f || !AITarget.list.Contains(memory.Key)) toBeRemoved.Add(memory.Key); + if (memory.Value.Priority == 0.0f || !AITarget.List.Contains(memory.Key)) toBeRemoved.Add(memory.Key); } foreach (AITarget target in toBeRemoved) diff --git a/Subsurface/Characters/AI/SteeringManager.cs b/Subsurface/Characters/AI/SteeringManager.cs index e65798f6b..23e96941d 100644 --- a/Subsurface/Characters/AI/SteeringManager.cs +++ b/Subsurface/Characters/AI/SteeringManager.cs @@ -32,7 +32,7 @@ namespace Subsurface { this.host = host; - wanderAngle = MathUtils.RandomFloatLocal(0.0f, MathHelper.TwoPi); + wanderAngle = Rand.Range(0.0f, MathHelper.TwoPi); } public void SteeringSeek(Vector2 target, float speed = 1.0f) @@ -90,7 +90,7 @@ namespace Subsurface float angleChange = 1.5f; - wanderAngle += MathUtils.RandomFloatLocal(0.0f, 1.0f) * angleChange - angleChange * 0.5f; + wanderAngle += Rand.Range(0.0f, 1.0f) * angleChange - angleChange * 0.5f; Vector2 newSteering = circleCenter + displacement; float steeringSpeed = (newSteering + host.Steering).Length(); @@ -106,9 +106,9 @@ namespace Subsurface { if (steering == Vector2.Zero || host.Steering == Vector2.Zero) return Vector2.Zero; - float MaxDistance = 2.0f; + float maxDistance = 2.0f; - Vector2 ahead = host.Position + Vector2.Normalize(host.Steering)*MaxDistance; + Vector2 ahead = host.Position + Vector2.Normalize(host.Steering)*maxDistance; if (rayCastTimer <= 0.0f) { diff --git a/Subsurface/Characters/AI/SteeringPath.cs b/Subsurface/Characters/AI/SteeringPath.cs index e07730aa9..9ad1215a5 100644 --- a/Subsurface/Characters/AI/SteeringPath.cs +++ b/Subsurface/Characters/AI/SteeringPath.cs @@ -7,7 +7,7 @@ namespace Subsurface { private Queue nodes; - const float minDistance = 0.1f; + const float MinDistance = 0.1f; Vector2 currentNode; @@ -30,7 +30,7 @@ namespace Subsurface public Vector2 GetNode(Vector2 pos) { if (nodes.Count == 0) return Vector2.Zero; - if (currentNode==Vector2.Zero || Vector2.Distance(pos, currentNode) 0.0f) damageAmount *= deltaTime; - float bleedingAmount = (duration == 0.0f) ? bleedingDamage : bleedingDamage * deltaTime; + if (Duration > 0.0f) damageAmount *= deltaTime; + float bleedingAmount = (Duration == 0.0f) ? BleedingDamage : BleedingDamage * deltaTime; if (damageAmount > 0.0f) { - return target.AddDamage(position, damageType, damageAmount, bleedingAmount, stun, playSound); + return target.AddDamage(position, DamageType, damageAmount, bleedingAmount, Stun, playSound); } else { diff --git a/Subsurface/Characters/Character.cs b/Subsurface/Characters/Character.cs index 04510c06b..d06d5b1c5 100644 --- a/Subsurface/Characters/Character.cs +++ b/Subsurface/Characters/Character.cs @@ -16,11 +16,11 @@ namespace Subsurface { class Character : Entity, IDamageable, IPropertyObject { - public static List characterList = new List(); + public static List CharacterList = new List(); - public static Queue newCharacterQueue = new Queue(); + public static Queue NewCharacterQueue = new Queue(); - public static bool disableControls; + public static bool DisableControls; //the character that the player is currently controlling private static Character controlled; @@ -35,14 +35,14 @@ namespace Subsurface private Inventory inventory; - public double lastNetworkUpdate; + public double LastNetworkUpdate; - public byte largeUpdateTimer; + public byte LargeUpdateTimer; - public readonly Dictionary properties; + public readonly Dictionary Properties; public Dictionary ObjectProperties { - get { return properties; } + get { return Properties; } } protected Key selectKeyHit; @@ -52,7 +52,7 @@ namespace Subsurface private Item selectedConstruction; private Item[] selectedItems; - public AnimController animController; + public AnimController AnimController; private AIController aiController; private Vector2 cursorPosition; @@ -71,9 +71,9 @@ namespace Subsurface bool isHumanoid; //the name of the species (e.q. human) - public readonly string speciesName; + public readonly string SpeciesName; - public CharacterInfo info; + public CharacterInfo Info; protected float soundTimer; protected float soundInterval; @@ -89,7 +89,7 @@ namespace Subsurface { get { - return speciesName; + return SpeciesName; } } @@ -251,12 +251,12 @@ namespace Subsurface public override Vector2 SimPosition { - get { return animController.limbs[0].SimPosition; } + get { return AnimController.limbs[0].SimPosition; } } public Vector2 Position { - get { return ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition); } + get { return ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); } } public Character(string file) : this(file, Vector2.Zero, null) @@ -269,7 +269,7 @@ namespace Subsurface } public Character(CharacterInfo characterInfo, Vector2 position, bool isNetworkPlayer = false) - : this(characterInfo.file, position, characterInfo, isNetworkPlayer) + : this(characterInfo.File, position, characterInfo, isNetworkPlayer) { } @@ -289,33 +289,33 @@ namespace Subsurface //blood = 100.0f; aiTarget = new AITarget(this); - properties = ObjectProperty.GetProperties(this); + Properties = ObjectProperty.GetProperties(this); - info = characterInfo==null ? new CharacterInfo(file) : characterInfo; + Info = characterInfo==null ? new CharacterInfo(file) : characterInfo; XDocument doc = ToolBox.TryLoadXml(file); if (doc == null) return; - speciesName = ToolBox.GetAttributeString(doc.Root, "name", "Unknown"); + SpeciesName = ToolBox.GetAttributeString(doc.Root, "name", "Unknown"); isHumanoid = ToolBox.GetAttributeBool(doc.Root, "humanoid", false); if (isHumanoid) { - animController = new HumanoidAnimController(this, doc.Root.Element("ragdoll")); - animController.targetDir = Direction.Right; + AnimController = new HumanoidAnimController(this, doc.Root.Element("ragdoll")); + AnimController.TargetDir = Direction.Right; inventory = new CharacterInventory(10, this); } else { - animController = new FishAnimController(this, doc.Root.Element("ragdoll")); + AnimController = new FishAnimController(this, doc.Root.Element("ragdoll")); PressureProtection = 100.0f; //FishAnimController fishAnim = (FishAnimController)animController; aiController = new EnemyAIController(this, file); } - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { limb.body.SetTransform(position+limb.SimPosition, 0.0f); //limb.prevPosition = ConvertUnits.ToDisplayUnits(position); @@ -329,44 +329,40 @@ namespace Subsurface soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f); - var xSounds = doc.Root.Elements("sound").ToList(); - if (xSounds.Any()) + var soundElements = doc.Root.Elements("sound").ToList(); + if (soundElements.Any()) { - sounds = new Sound[xSounds.Count()]; - soundStates = new AIController.AiState[xSounds.Count()]; + sounds = new Sound[soundElements.Count()]; + soundStates = new AIController.AiState[soundElements.Count()]; int i = 0; - foreach (XElement xSound in xSounds) + foreach (XElement soundElement in soundElements) { - sounds[i] = Sound.Load(xSound.Attribute("file").Value); - if (xSound.Attribute("state") == null) + sounds[i] = Sound.Load(soundElement.Attribute("file").Value); + if (soundElement.Attribute("state") == null) { soundStates[i] = AIController.AiState.None; } else { soundStates[i] = (AIController.AiState)Enum.Parse( - typeof(AIController.AiState), xSound.Attribute("state").Value, true); + typeof(AIController.AiState), soundElement.Attribute("state").Value, true); } i++; } } - animController.FindHull(); + AnimController.FindHull(); //if (info.ID >= 0) //{ // ID = info.ID; //} - characterList.Add(this); + CharacterList.Add(this); } - - /// - /// Control the characte - /// - public void Control(float deltaTime, Camera cam, bool forcePick=false) + public void Control(float deltaTime, Camera cam, bool forcePick = false) { if (isDead) return; @@ -416,7 +412,7 @@ namespace Subsurface private Item FindClosestItem(Vector2 mouseSimPos) { - Limb torso = animController.GetLimb(LimbType.Torso); + Limb torso = AnimController.GetLimb(LimbType.Torso); Vector2 pos = (torso.body.TargetPosition != Vector2.Zero) ? torso.body.TargetPosition : torso.SimPosition; return Item.FindPickable(pos, selectedConstruction == null ? mouseSimPos : selectedConstruction.SimPosition, null, selectedItems); @@ -433,13 +429,13 @@ namespace Subsurface // return; //} - Limb head = animController.GetLimb(LimbType.Head); + Limb head = AnimController.GetLimb(LimbType.Head); - Lights.LightManager.viewPos = ConvertUnits.ToDisplayUnits(head.SimPosition); + Lights.LightManager.ViewPos = ConvertUnits.ToDisplayUnits(head.SimPosition); Vector2 targetMovement = Vector2.Zero; - if (!disableControls) + if (!DisableControls) { if (PlayerInput.KeyDown(Keys.W)) targetMovement.Y += 1.0f; if (PlayerInput.KeyDown(Keys.S)) targetMovement.Y -= 1.0f; @@ -448,13 +444,13 @@ namespace Subsurface //the vertical component is only used for falling through platforms and climbing ladders when not in water, //so the movement can't be normalized or the character would walk slower when pressing down/up - if (animController.InWater) + if (AnimController.InWater) { float length = targetMovement.Length(); if (length > 0.0f) targetMovement = targetMovement / length; } - if (Keyboard.GetState().IsKeyDown(Keys.LeftShift) && Math.Sign(targetMovement.X) == Math.Sign(animController.Dir)) + if (Keyboard.GetState().IsKeyDown(Keys.LeftShift) && Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir)) targetMovement *= 3.0f; selectKeyHit.SetState(PlayerInput.KeyHit(Keys.E)); @@ -472,53 +468,53 @@ namespace Subsurface secondaryKeyDown.SetState(false); } - animController.TargetMovement = targetMovement; - animController.isStanding = true; + AnimController.TargetMovement = targetMovement; + AnimController.IsStanding = true; if (moveCam) { - cam.TargetPos = ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition); + cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); cam.OffsetAmount = 250.0f; } cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition); Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition); - if (animController.onGround && - !animController.InWater && - animController.anim != AnimController.Animation.UsingConstruction) + if (AnimController.onGround && + !AnimController.InWater && + AnimController.Anim != AnimController.Animation.UsingConstruction) { if (mouseSimPos.X < head.SimPosition.X-1.0f) { - animController.targetDir = Direction.Left; + AnimController.TargetDir = Direction.Left; } else if (mouseSimPos.X > head.SimPosition.X + 1.0f) { - animController.targetDir = Direction.Right; + AnimController.TargetDir = Direction.Right; } } - disableControls = false; + DisableControls = false; } public static void UpdateAnimAll(float deltaTime) { - foreach (Character c in characterList) + foreach (Character c in CharacterList) { if (c.isDead) continue; - c.animController.UpdateAnim(deltaTime); + c.AnimController.UpdateAnim(deltaTime); } } public static void UpdateAll(Camera cam, float deltaTime) { - if (newCharacterQueue.Count>0) + if (NewCharacterQueue.Count>0) { - new Character(newCharacterQueue.Dequeue(), Vector2.Zero); + new Character(NewCharacterQueue.Dequeue(), Vector2.Zero); } - foreach (Character c in characterList) + foreach (Character c in CharacterList) { c.Update(cam, deltaTime); } @@ -531,14 +527,14 @@ namespace Subsurface if (controlled == this) { cam.Zoom = MathHelper.Lerp(cam.Zoom, 1.5f, 0.1f); - cam.TargetPos = ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition); + cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); cam.OffsetAmount = 0.0f; } return; } if (PressureProtection==0.0f && - (animController.CurrentHull == null || animController.CurrentHull.LethalPressure >= 100.0f)) + (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f)) { Implode(); return; @@ -553,18 +549,18 @@ namespace Subsurface if (needsAir) { - if (animController.HeadInWater) + if (AnimController.HeadInWater) { Oxygen -= deltaTime*100.0f / drowningTime; } - else if (animController.CurrentHull != null) + else if (AnimController.CurrentHull != null) { - float hullOxygen = animController.CurrentHull.OxygenPercentage; + float hullOxygen = AnimController.CurrentHull.OxygenPercentage; hullOxygen -= 30.0f; Oxygen += deltaTime * 100.0f * (hullOxygen / 500.0f); - animController.CurrentHull.Oxygen -= Hull.OxygenConsumptionSpeed * deltaTime; + AnimController.CurrentHull.Oxygen -= Hull.OxygenConsumptionSpeed * deltaTime; } PressureProtection -= deltaTime*100.0f; } @@ -593,12 +589,12 @@ namespace Subsurface //distance is approximated based on the mass of the character //(which corresponds to size because all the characters have the same limb density) - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { aiTarget.SightRange += limb.Mass * 1000.0f; } //the faster the character is moving, the easier it is to see it - Limb torso = animController.GetLimb(LimbType.Torso); + Limb torso = AnimController.GetLimb(LimbType.Torso); if (torso !=null) { aiTarget.SightRange += torso.LinearVelocity.Length() * 500.0f; @@ -607,13 +603,13 @@ namespace Subsurface public void Draw(SpriteBatch spriteBatch) { - animController.Draw(spriteBatch); + AnimController.Draw(spriteBatch); if (IsNetworkPlayer) { - Vector2 namePos = new Vector2(Position.X, -Position.Y - 80.0f) - GUI.font.MeasureString(info.name) * 0.5f; - spriteBatch.DrawString(GUI.font, info.name, namePos - new Vector2(1.0f, 1.0f), Color.Black); - spriteBatch.DrawString(GUI.font, info.name, namePos, Color.White); + Vector2 namePos = new Vector2(Position.X, -Position.Y - 80.0f) - GUI.font.MeasureString(Info.Name) * 0.5f; + spriteBatch.DrawString(GUI.font, Info.Name, namePos - new Vector2(1.0f, 1.0f), Color.Black); + spriteBatch.DrawString(GUI.font, Info.Name, namePos, Color.White); } if (this == Character.controlled) return; @@ -622,7 +618,9 @@ namespace Subsurface GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X-2, (int)healthBarPos.Y-2, 100+4, 15+4), Color.Black, false); GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f*(health/maxHealth)), 15), Color.Red, true); - //spriteBatch.DrawString(GUI.font, ID.ToString(), ConvertUnits.ToDisplayUnits(animController.limbs[0].Position), Color.White); + Vector2 pos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); + pos.Y = -pos.Y; + spriteBatch.DrawString(GUI.font, ID.ToString(), pos, Color.White); //GUI.DrawLine(spriteBatch, ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y), // ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y) + // ConvertUnits.ToDisplayUnits(animController.targetMovement.X, animController.targetMovement.Y), Color.Green); @@ -681,7 +679,7 @@ namespace Subsurface if (sounds == null || !sounds.Any()) return; var matchingSoundStates = soundStates.Where(x => x == state).ToList(); - int selectedSound = Game1.localRandom.Next(matchingSoundStates.Count()); + int selectedSound = Rand.Int(matchingSoundStates.Count()); int n = 0; for (int i = 0; i < sounds.Count(); i++) @@ -690,7 +688,7 @@ namespace Subsurface if (n == selectedSound) { sounds[i].Play(1.0f, 2000.0f, - animController.limbs[0].body.FarseerBody); + AnimController.limbs[0].body.FarseerBody); Debug.WriteLine("playing: " + sounds[i]); return; } @@ -700,11 +698,11 @@ namespace Subsurface public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound = false) { - animController.StunTimer = Math.Max(animController.StunTimer, stun); + AnimController.StunTimer = Math.Max(AnimController.StunTimer, stun); Limb closestLimb = null; float closestDistance = 0.0f; - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { float distance = Vector2.Distance(position, limb.SimPosition); if (closestLimb == null || distance < closestDistance) @@ -720,8 +718,8 @@ namespace Subsurface AttackResult attackResult = closestLimb.AddDamage(position, damageType, amount, bleedingAmount, playSound); - health -= attackResult.damage; - bleeding += attackResult.bleeding; + health -= attackResult.Damage; + bleeding += attackResult.Bleeding; return attackResult; @@ -741,12 +739,12 @@ namespace Subsurface private void Implode() { - Limb torso= animController.GetLimb(LimbType.Torso); - if (torso == null) torso = animController.GetLimb(LimbType.Head); + Limb torso= AnimController.GetLimb(LimbType.Torso); + if (torso == null) torso = AnimController.GetLimb(LimbType.Head); Vector2 centerOfMass = Vector2.Zero; float totalMass = 0.0f; - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { centerOfMass += limb.Mass * limb.SimPosition; totalMass += limb.Mass; @@ -756,7 +754,7 @@ namespace Subsurface health = 0.0f; - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { Vector2 diff = centerOfMass - limb.SimPosition; if (diff == Vector2.Zero) continue; @@ -769,16 +767,16 @@ namespace Subsurface for (int i = 0; i < 10; i++) { Particle p = Game1.particleManager.CreateParticle("waterblood", - torso.SimPosition + new Vector2(MathUtils.RandomFloatLocal(-0.5f, 0.5f), MathUtils.RandomFloatLocal(-0.5f, 0.5f)), + torso.SimPosition + new Vector2(Rand.Range(-0.5f, 0.5f), Rand.Range(-0.5f, 0.5f)), Vector2.Zero); if (p!=null) p.Size *= 2.0f; Game1.particleManager.CreateParticle("bubbles", torso.SimPosition, - new Vector2(MathUtils.RandomFloatLocal(-0.5f, 0.5f), MathUtils.RandomFloatLocal(-1.0f,0.5f))); + new Vector2(Rand.Range(-0.5f, 0.5f), Rand.Range(-1.0f,0.5f))); } - foreach (var joint in animController.limbJoints) + foreach (var joint in AnimController.limbJoints) { joint.LimitEnabled = false; } @@ -790,8 +788,8 @@ namespace Subsurface if (isDead) return; isDead = true; - animController.movement = Vector2.Zero; - animController.TargetMovement = Vector2.Zero; + AnimController.movement = Vector2.Zero; + AnimController.TargetMovement = Vector2.Zero; for (int i = 0; i < selectedItems.Length; i++ ) { @@ -802,13 +800,13 @@ namespace Subsurface aiTarget.Remove(); aiTarget = null; - foreach (Limb limb in animController.limbs) + foreach (Limb limb in AnimController.limbs) { if (limb.pullJoint == null) continue; limb.pullJoint.Enabled = false; } - foreach (RevoluteJoint joint in animController.limbJoints) + foreach (RevoluteJoint joint in AnimController.limbJoints) { joint.MotorEnabled = false; joint.MaxMotorTorque = 0.0f; @@ -863,20 +861,25 @@ namespace Subsurface message.Write(NetTime.Now); // Write byte = move direction - message.Write(animController.TargetMovement.X); - message.Write(animController.TargetMovement.Y); + message.Write(AnimController.TargetMovement.X); + message.Write(AnimController.TargetMovement.Y); - message.Write(animController.targetDir==Direction.Right); + message.Write(AnimController.TargetDir==Direction.Right); message.Write(cursorPosition.X); message.Write(cursorPosition.Y); - message.Write(largeUpdateTimer <= 0); + message.Write(AnimController.limbs.Count()); - if (largeUpdateTimer<=0) + + message.Write(LargeUpdateTimer <= 0); + + if (LargeUpdateTimer<=0) { - foreach (Limb limb in animController.limbs) + int i = 0; + foreach (Limb limb in AnimController.limbs) { + message.Write(42.0f+i); message.Write(limb.body.Position.X); message.Write(limb.body.Position.Y); @@ -885,19 +888,20 @@ namespace Subsurface message.Write(limb.body.Rotation); message.Write(limb.body.AngularVelocity); + i++; } - message.Write(animController.StunTimer); + message.Write(AnimController.StunTimer); - largeUpdateTimer = 5; + LargeUpdateTimer = 5; } else { - Limb torso = animController.GetLimb(LimbType.Torso); + Limb torso = AnimController.GetLimb(LimbType.Torso); message.Write(torso.body.Position.X); message.Write(torso.body.Position.Y); - largeUpdateTimer = (byte)Math.Max(0, largeUpdateTimer-1); + LargeUpdateTimer = (byte)Math.Max(0, LargeUpdateTimer-1); } @@ -950,7 +954,7 @@ namespace Subsurface targetMovement.X = message.ReadFloat(); targetMovement.Y = message.ReadFloat(); - animController.isStanding = true; + AnimController.IsStanding = true; bool targetDir = message.ReadBoolean(); @@ -958,67 +962,77 @@ namespace Subsurface cursorPos.X = message.ReadFloat(); cursorPos.Y = message.ReadFloat(); - if (sendingTime > lastNetworkUpdate) - { - cursorPosition = cursorPos; + int num1 = message.ReadInt32(); + System.Diagnostics.Debug.WriteLine(num1); - animController.TargetMovement= targetMovement; - animController.targetDir = (targetDir) ? Direction.Right : Direction.Left; + if (sendingTime <= LastNetworkUpdate) return; + + cursorPosition = cursorPos; + + + AnimController.TargetMovement= targetMovement; + AnimController.TargetDir = (targetDir) ? Direction.Right : Direction.Left; - if (message.ReadBoolean()) + if (message.ReadBoolean()) + { + foreach (Limb limb in AnimController.limbs) { - foreach (Limb limb in animController.limbs) + float num = message.ReadFloat(); + System.Diagnostics.Debug.WriteLine(num); + Vector2 pos = Vector2.Zero; + pos.X = message.ReadFloat(); + pos.Y = message.ReadFloat(); + + Vector2 vel = Vector2.Zero; + vel.X = message.ReadFloat(); + vel.Y = message.ReadFloat(); + + float rotation = message.ReadFloat(); + float angularVel = message.ReadFloat(); + + + + if (vel != Vector2.Zero && vel.Length() > 100.0f) { } + + if (pos != Vector2.Zero && pos.Length() > 100.0f) { } + + if (limb.body != null) { - Vector2 pos = Vector2.Zero; - pos.X = message.ReadFloat(); - pos.Y = message.ReadFloat(); - - Vector2 vel = Vector2.Zero; - vel.X = message.ReadFloat(); - vel.Y = message.ReadFloat(); - - float rotation = message.ReadFloat(); - float angularVel = message.ReadFloat(); - - if (limb.body == null) continue; - - if (vel != Vector2.Zero && vel.Length() > 100.0f) { } - - if (pos != Vector2.Zero && pos.Length() > 100.0f) { } - limb.body.TargetVelocity = vel; limb.body.TargetPosition = pos;// +vel * (float)(deltaTime / 60.0); limb.body.TargetRotation = rotation;// +angularVel * (float)(deltaTime / 60.0); limb.body.TargetAngularVelocity = angularVel; } - animController.StunTimer = message.ReadFloat(); - - largeUpdateTimer = 1; - } - else - { - Vector2 pos = Vector2.Zero; - pos.X = message.ReadFloat(); - pos.Y = message.ReadFloat(); - - Limb torso = animController.GetLimb(LimbType.Torso); - torso.body.TargetPosition = pos; - - largeUpdateTimer = 0; } - if (aiController != null) aiController.ReadNetworkData(message); + AnimController.StunTimer = message.ReadFloat(); - lastNetworkUpdate = sendingTime; + LargeUpdateTimer = 1; } + else + { + Vector2 pos = Vector2.Zero; + pos.X = message.ReadFloat(); + pos.Y = message.ReadFloat(); + + Limb torso = AnimController.GetLimb(LimbType.Torso); + torso.body.TargetPosition = pos; + + LargeUpdateTimer = 0; + } + + if (aiController != null) aiController.ReadNetworkData(message); + + LastNetworkUpdate = sendingTime; + } public override void Remove() { base.Remove(); - characterList.Remove(this); + CharacterList.Remove(this); if (controlled == this) controlled = null; @@ -1027,8 +1041,8 @@ namespace Subsurface if (aiTarget != null) aiTarget.Remove(); - if (animController!=null) - animController.Remove(); + if (AnimController!=null) + AnimController.Remove(); } } diff --git a/Subsurface/Characters/CharacterInfo.cs b/Subsurface/Characters/CharacterInfo.cs index c6c583cce..66efc1ca7 100644 --- a/Subsurface/Characters/CharacterInfo.cs +++ b/Subsurface/Characters/CharacterInfo.cs @@ -7,17 +7,17 @@ namespace Subsurface class CharacterInfo { - public string name; + public string Name; - public readonly string file; + public readonly string File; - public readonly int headSpriteId; + public int HeadSpriteId; //public int ID; - public Gender gender; + public Gender Gender; - public int salary; + public int Salary; //public string GenderString() //{ @@ -26,25 +26,25 @@ namespace Subsurface public CharacterInfo(string file, string name = "", Gender gender = Gender.None) { - this.file = file; + this.File = file; //ID = -1; XDocument doc = ToolBox.TryLoadXml(file); if (doc == null) return; - salary = 500; + Salary = 500; if (ToolBox.GetAttributeBool(doc.Root, "genders", false)) { if (gender == Gender.None) { float femaleRatio = ToolBox.GetAttributeFloat(doc.Root, "femaleratio", 0.5f); - this.gender = (Game1.random.NextDouble() < femaleRatio) ? Gender.Female : Gender.Male; + this.Gender = (Rand.Range(0.0f, 1.0f, false) < femaleRatio) ? Gender.Female : Gender.Male; } else { - this.gender = gender; + this.Gender = gender; } } @@ -53,18 +53,18 @@ namespace Subsurface { headSpriteRange = ToolBox.GetAttributeVector2( doc.Root, - this.gender == Gender.Female ? "femaleheadid" : "maleheadid", + this.Gender == Gender.Female ? "femaleheadid" : "maleheadid", Vector2.Zero); } if (headSpriteRange != Vector2.Zero) { - headSpriteId = Game1.localRandom.Next((int)headSpriteRange.X, (int)headSpriteRange.Y + 1); + HeadSpriteId = Rand.Range((int)headSpriteRange.X, (int)headSpriteRange.Y + 1); } if (!string.IsNullOrEmpty(name)) { - this.name = name; + this.Name = name; return; } @@ -73,32 +73,32 @@ namespace Subsurface string firstNamePath = (ToolBox.GetAttributeString(doc.Root.Element("name"), "firstname", "")); if (firstNamePath != "") { - firstNamePath = firstNamePath.Replace("[GENDER]", (this.gender == Gender.Female) ? "f" : ""); - this.name = ToolBox.GetRandomLine(firstNamePath); + firstNamePath = firstNamePath.Replace("[GENDER]", (this.Gender == Gender.Female) ? "f" : ""); + this.Name = ToolBox.GetRandomLine(firstNamePath); } string lastNamePath = (ToolBox.GetAttributeString(doc.Root.Element("name"), "lastname", "")); if (lastNamePath != "") { - lastNamePath = lastNamePath.Replace("[GENDER]", (this.gender == Gender.Female) ? "f" : ""); - if (this.name != "") this.name += " "; - this.name += ToolBox.GetRandomLine(lastNamePath); + lastNamePath = lastNamePath.Replace("[GENDER]", (this.Gender == Gender.Female) ? "f" : ""); + if (this.Name != "") this.Name += " "; + this.Name += ToolBox.GetRandomLine(lastNamePath); } } } public CharacterInfo(XElement element) { - name = ToolBox.GetAttributeString(element, "name", "unnamed"); + Name = ToolBox.GetAttributeString(element, "name", "unnamed"); string genderStr = ToolBox.GetAttributeString(element, "gender", "male").ToLower(); - gender = (genderStr == "male") ? Gender.Male : Gender.Female; + Gender = (genderStr == "male") ? Gender.Male : Gender.Female; - file = ToolBox.GetAttributeString(element, "file", ""); + File = ToolBox.GetAttributeString(element, "file", ""); - salary = ToolBox.GetAttributeInt(element, "salary", 1000); + Salary = ToolBox.GetAttributeInt(element, "salary", 1000); - headSpriteId = ToolBox.GetAttributeInt(element, "headspriteid", 1); + HeadSpriteId = ToolBox.GetAttributeInt(element, "headspriteid", 1); } public virtual XElement Save(XElement parentElement) @@ -106,11 +106,11 @@ namespace Subsurface XElement componentElement = new XElement("character"); componentElement.Add( - new XAttribute("name", name), - new XAttribute("file", file), - new XAttribute("gender", gender == Gender.Male ? "male" : "female"), - new XAttribute("salary", salary), - new XAttribute("headspriteid", headSpriteId)); + new XAttribute("name", Name), + new XAttribute("file", File), + new XAttribute("gender", Gender == Gender.Male ? "male" : "female"), + new XAttribute("salary", Salary), + new XAttribute("headspriteid", HeadSpriteId)); parentElement.Add(componentElement); return componentElement; diff --git a/Subsurface/Characters/DelayedEffect.cs b/Subsurface/Characters/DelayedEffect.cs index 8813d017f..7010fbdd9 100644 --- a/Subsurface/Characters/DelayedEffect.cs +++ b/Subsurface/Characters/DelayedEffect.cs @@ -6,15 +6,15 @@ namespace Subsurface { class DelayedEffect : StatusEffect { - public static List list = new List(); + public static List List = new List(); - float delay; + private float delay; - float timer; - - Vector2 position; + private float timer; - List targets; + private Vector2 position; + + private List targets; public float Timer { @@ -36,7 +36,7 @@ namespace Subsurface this.targets = targets; - list.Add(this); + List.Add(this); } public void Update(float deltaTime) @@ -46,7 +46,7 @@ namespace Subsurface if (timer > 0.0f) return; base.Apply(1.0f, position, targets); - list.Remove(this); + List.Remove(this); } } diff --git a/Subsurface/Characters/FishAnimController.cs b/Subsurface/Characters/FishAnimController.cs index 1767554df..d01cbc795 100644 --- a/Subsurface/Characters/FishAnimController.cs +++ b/Subsurface/Characters/FishAnimController.cs @@ -62,11 +62,11 @@ namespace Subsurface //targetDir = (movement.X > 0.0f) ? Direction.Right : Direction.Left; if (movement.X > 0.1f && movement.X > Math.Abs(movement.Y)) { - targetDir = Direction.Right; + TargetDir = Direction.Right; } else if (movement.X < -0.1f && movement.X < -Math.Abs(movement.Y)) { - targetDir = Direction.Left; + TargetDir = Direction.Left; } } else @@ -79,17 +79,17 @@ namespace Subsurface if (rotation > 20 && rotation < 160) { - targetDir = Direction.Left; + TargetDir = Direction.Left; } else if (rotation > 200 && rotation < 340) { - targetDir = Direction.Right; + TargetDir = Direction.Right; } } //if (stunTimer > gameTime.TotalGameTime.TotalMilliseconds) return; - if (targetDir != dir) + if (TargetDir != dir) { Flip(); if (flip) Mirror(); @@ -213,7 +213,7 @@ namespace Subsurface //out whether the ragdoll is standing on ground float closestFraction = 1; //Structure closestStructure = null; - Game1.world.RayCast((fixture, point, normal, fraction) => + Game1.World.RayCast((fixture, point, normal, fraction) => { //other limbs and bodies with no collision detection are ignored if (fixture == null || diff --git a/Subsurface/Characters/HumanoidAnimController.cs b/Subsurface/Characters/HumanoidAnimController.cs index 8946a8163..757900651 100644 --- a/Subsurface/Characters/HumanoidAnimController.cs +++ b/Subsurface/Characters/HumanoidAnimController.cs @@ -20,13 +20,13 @@ namespace Subsurface Vector2 rayStart = colliderPos; // at the bottom of the player sprite Vector2 rayEnd = rayStart - new Vector2(0.0f, TorsoPosition); if (stairs != null) rayEnd.Y -= 0.5f; - if (anim != Animation.UsingConstruction) ResetPullJoints(); + if (Anim != Animation.UsingConstruction) ResetPullJoints(); //do a raytrace straight down from the torso to figure //out whether the ragdoll is standing on ground float closestFraction = 1; Structure closestStructure = null; - Game1.world.RayCast((fixture, point, normal, fraction) => + Game1.World.RayCast((fixture, point, normal, fraction) => { switch (fixture.CollisionCategories) { @@ -119,7 +119,7 @@ namespace Subsurface return; } - switch (anim) + switch (Anim) { case Animation.Climbing: UpdateClimbing(); @@ -129,13 +129,13 @@ namespace Subsurface default: if (inWater) UpdateSwimming(); - else if (isStanding) + else if (IsStanding) UpdateStanding(); break; } - if (targetDir != dir) Flip(); + if (TargetDir != dir) Flip(); foreach (Limb limb in limbs) { @@ -376,9 +376,9 @@ namespace Subsurface if (!character.IsNetworkPlayer) { if (rotation > 20 && rotation < 170) - targetDir = Direction.Left; + TargetDir = Direction.Left; else if (rotation > 190 && rotation < 340) - targetDir = Direction.Right; + TargetDir = Direction.Right; } if (TargetMovement == Vector2.Zero) return; @@ -520,7 +520,7 @@ namespace Subsurface { if (character.SelectedConstruction == null) { - anim = Animation.None; + Anim = Animation.None; return; } @@ -597,7 +597,7 @@ namespace Subsurface torso.body.ApplyForce(climbForce * 65.0f * torso.Mass); head.body.SmoothRotate(0.0f); - Rectangle trigger = character.SelectedConstruction.Prefab.triggers.First(); + Rectangle trigger = character.SelectedConstruction.Prefab.Triggers.First(); trigger = character.SelectedConstruction.TransformTrigger(trigger); //stop climbing if: @@ -609,7 +609,7 @@ namespace Subsurface (TargetMovement.Y < 0.0f && ConvertUnits.ToSimUnits(trigger.Height) + handPos.Y < HeadPosition*2.0f) || (TargetMovement.Y > 0.0f && -handPos.Y < ConvertUnits.ToSimUnits(10.0f))) { - anim = Animation.None; + Anim = Animation.None; character.SelectedConstruction = null; IgnorePlatforms = false; } diff --git a/Subsurface/Characters/Limb.cs b/Subsurface/Characters/Limb.cs index a17e19bb7..515ecf5e9 100644 --- a/Subsurface/Characters/Limb.cs +++ b/Subsurface/Characters/Limb.cs @@ -208,7 +208,7 @@ namespace Subsurface pullJoint.Enabled = false; pullJoint.MaxForce = 150.0f * body.Mass; - Game1.world.AddJoint(pullJoint); + Game1.World.AddJoint(pullJoint); } else { @@ -235,10 +235,10 @@ namespace Subsurface case "sprite": string spritePath = subElement.Attribute("texture").Value; - if (character.info!=null) + if (character.Info!=null) { - spritePath = spritePath.Replace("[GENDER]", (character.info.gender == Gender.Female) ? "f" : ""); - spritePath = spritePath.Replace("[HEADID]", character.info.headSpriteId.ToString()); + spritePath = spritePath.Replace("[GENDER]", (character.Info.Gender == Gender.Female) ? "f" : ""); + spritePath = spritePath.Replace("[HEADID]", character.Info.HeadSpriteId.ToString()); } @@ -323,7 +323,7 @@ namespace Subsurface Game1.particleManager.CreateParticle("blood", SimPosition, - particleVel * MathUtils.RandomFloatLocal(1.0f, 3.0f)); + particleVel * Rand.Range(1.0f, 3.0f)); } for (int i = 0; i < bloodAmount / 2; i++) @@ -339,7 +339,7 @@ namespace Subsurface if (LinearVelocity.X>100.0f) { DebugConsole.ThrowError("CHARACTER EXPLODED"); - foreach (Limb limb in character.animController.limbs) + foreach (Limb limb in character.AnimController.limbs) { limb.body.ResetDynamics(); limb.body.SetTransform(body.Position, 0.0f); diff --git a/Subsurface/Characters/Ragdoll.cs b/Subsurface/Characters/Ragdoll.cs index dc18b26f7..50343f0ac 100644 --- a/Subsurface/Characters/Ragdoll.cs +++ b/Subsurface/Characters/Ragdoll.cs @@ -197,7 +197,7 @@ namespace Subsurface joint.MotorEnabled = true; joint.MaxMotorTorque = 0.25f; - Game1.world.AddJoint(joint); + Game1.World.AddJoint(joint); for (int i = 0; i < limbJoints.Length; i++ ) { @@ -223,7 +223,7 @@ namespace Subsurface float startDepth = 0.1f; float increment = 0.0001f; - foreach (Character otherCharacter in Character.characterList) + foreach (Character otherCharacter in Character.CharacterList) { if (otherCharacter==character) continue; startDepth+=increment; @@ -541,7 +541,7 @@ namespace Subsurface float allowedDistance = 0.1f; float dist = Vector2.Distance(limbs[0].body.Position, refLimb.body.TargetPosition); - bool resetAll = (dist > resetDistance && character.largeUpdateTimer == 1); + bool resetAll = (dist > resetDistance && character.LargeUpdateTimer == 1); Vector2 newMovement = (refLimb.body.TargetPosition - refLimb.body.Position); @@ -632,7 +632,7 @@ namespace Subsurface foreach (Limb l in limbs) l.Remove(); foreach (RevoluteJoint joint in limbJoints) { - Game1.world.RemoveJoint(joint); + Game1.World.RemoveJoint(joint); } } diff --git a/Subsurface/Characters/StatusEffect.cs b/Subsurface/Characters/StatusEffect.cs index 2101943e2..e7c504e4c 100644 --- a/Subsurface/Characters/StatusEffect.cs +++ b/Subsurface/Characters/StatusEffect.cs @@ -237,9 +237,9 @@ namespace Subsurface public static void UpdateAll(float deltaTime) { - for (int i = DelayedEffect.list.Count-1; i>= 0; i--) + for (int i = DelayedEffect.List.Count-1; i>= 0; i--) { - DelayedEffect.list[i].Update(deltaTime); + DelayedEffect.List[i].Update(deltaTime); } } diff --git a/Subsurface/Content/HUD/style.xml b/Subsurface/Content/HUD/style.xml deleted file mode 100644 index b7458d130..000000000 --- a/Subsurface/Content/HUD/style.xml +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/Subsurface/Content/HUD/textboxTexture.png b/Subsurface/Content/UI/textboxTexture.png similarity index 100% rename from Subsurface/Content/HUD/textboxTexture.png rename to Subsurface/Content/UI/textboxTexture.png diff --git a/Subsurface/Content/UI/uiBackground.png b/Subsurface/Content/UI/uiBackground.png new file mode 100644 index 000000000..60ca3146d Binary files /dev/null and b/Subsurface/Content/UI/uiBackground.png differ diff --git a/Subsurface/DebugConsole.cs b/Subsurface/DebugConsole.cs index e1b5043e5..9491fa361 100644 --- a/Subsurface/DebugConsole.cs +++ b/Subsurface/DebugConsole.cs @@ -61,7 +61,7 @@ namespace Subsurface if (isOpen) { - Character.disableControls = true; + Character.DisableControls = true; if (PlayerInput.KeyHit(Keys.Up)) { @@ -165,7 +165,7 @@ namespace Subsurface break; case "startserver": if (Game1.Server==null) - Game1.Server = new GameServer(); + Game1.NetworkMember = new GameServer(); break; case "kick": if (Game1.Server == null) break; @@ -175,7 +175,7 @@ namespace Subsurface if (commands.Length == 1) return; if (Game1.Client == null) { - Game1.Client = new GameClient("Name"); + Game1.NetworkMember = new GameClient("Name"); Game1.Client.ConnectToServer(commands[1]); } break; @@ -198,6 +198,7 @@ namespace Subsurface Game1.EditCharacterScreen.Select(); break; case "freecamera": + case "freecam": Character.Controlled = null; Game1.GameScreen.Cam.TargetPos = Vector2.Zero; break; @@ -209,13 +210,13 @@ namespace Subsurface } break; case "generatelevel": - Game1.Level = new Level(100, 500,500, 50); + Game1.Level = new Level("asdf", 500,500, 50); Game1.Level.Generate(100.0f); break; case "fowenabled": case "fow": case "drawfow": - Lights.LightManager.fowEnabled = !Lights.LightManager.fowEnabled; + Lights.LightManager.FowEnabled = !Lights.LightManager.FowEnabled; break; case "lobbyscreen": case "lobby": diff --git a/Subsurface/Events/MonsterEvent.cs b/Subsurface/Events/MonsterEvent.cs index d060fa99a..b6fd61ec6 100644 --- a/Subsurface/Events/MonsterEvent.cs +++ b/Subsurface/Events/MonsterEvent.cs @@ -25,15 +25,15 @@ namespace Subsurface { WayPoint randomWayPoint = WayPoint.GetRandom(WayPoint.SpawnType.Enemy); - int amount = Game1.random.Next(minAmount, maxAmount); + int amount = Rand.Range(minAmount, maxAmount, false); monsters = new Character[amount]; for (int i = 0; i < amount; i++) { Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition; - position.X += MathUtils.RandomFloatLocal(-0.5f,0.5f); - position.Y += MathUtils.RandomFloatLocal(-0.5f,0.5f); + position.X += Rand.Range(-0.5f, 0.5f); + position.Y += Rand.Range(-0.5f, 0.5f); monsters[i] = new Character(characterFile, position); } } diff --git a/Subsurface/Events/ScriptedEvent.cs b/Subsurface/Events/ScriptedEvent.cs index 97db8b975..b02b84e0e 100644 --- a/Subsurface/Events/ScriptedEvent.cs +++ b/Subsurface/Events/ScriptedEvent.cs @@ -125,7 +125,7 @@ namespace Subsurface i++; } - float randomNumber = (float)Game1.random.NextDouble() * probabilitySum; + float randomNumber = Rand.Range(0.0f,probabilitySum); i = 0; foreach (XElement element in doc.Root.Elements()) @@ -169,7 +169,7 @@ namespace Subsurface { isStarted = false; isFinished = false; - startTimer = Game1.random.Next(startTimeMin, startTimeMax); + startTimer = Rand.Range(startTimeMin, startTimeMax, false); } protected virtual void Start() diff --git a/Subsurface/Events/TaskManager.cs b/Subsurface/Events/TaskManager.cs index 2e4c8f524..a6bccadfd 100644 --- a/Subsurface/Events/TaskManager.cs +++ b/Subsurface/Events/TaskManager.cs @@ -35,7 +35,7 @@ namespace Subsurface taskListBox = new GUIListBox(new Rectangle(Game1.GraphicsWidth - 250, 50, 250, 500), Color.Transparent); //taskListBox.ScrollBarEnabled = false; - taskListBox.Padding = GUI.style.smallPadding; + //taskListBox.Padding = GUI.style.smallPadding; } public void AddTask(Task newTask) @@ -83,12 +83,12 @@ namespace Subsurface color = Color.Orange; } - GUIFrame frame = new GUIFrame(new Rectangle(0,0,width,40), Color.Transparent, Alignment.Right, taskListBox); + GUIFrame frame = new GUIFrame(new Rectangle(0,0,width,40), Color.Transparent, Alignment.Right, null, taskListBox); frame.UserData = task; frame.Padding = new Vector4(0.0f, 5.0f, 5.0f, 5.0f); - GUIFrame colorFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), color * 0.5f, Alignment.Right, frame); - GUITextBlock textBlock = new GUITextBlock(new Rectangle(5, 5, 0, 20), task.Name, Color.Transparent, Color.Black, Alignment.Right, colorFrame); + GUIFrame colorFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), color * 0.5f, Alignment.Right, null, frame); + GUITextBlock textBlock = new GUITextBlock(new Rectangle(5, 5, 0, 20), task.Name, Color.Transparent, Color.Black, Alignment.Right, null, colorFrame); //textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f); //colorFrame.AddChild(textBlock); diff --git a/Subsurface/FrameCounter.cs b/Subsurface/FrameCounter.cs index 1674f264c..56440e095 100644 --- a/Subsurface/FrameCounter.cs +++ b/Subsurface/FrameCounter.cs @@ -12,7 +12,7 @@ namespace Subsurface public const int MaximumSamples = 10; - private Queue _sampleBuffer = new Queue(); + private Queue sampleBuffer = new Queue(); public bool Update(double deltaTime) { @@ -23,12 +23,12 @@ namespace Subsurface CurrentFramesPerSecond = (1.0 / deltaTime); - _sampleBuffer.Enqueue(CurrentFramesPerSecond); + sampleBuffer.Enqueue(CurrentFramesPerSecond); - if (_sampleBuffer.Count > MaximumSamples) + if (sampleBuffer.Count > MaximumSamples) { - _sampleBuffer.Dequeue(); - AverageFramesPerSecond = _sampleBuffer.Average(i => i); + sampleBuffer.Dequeue(); + AverageFramesPerSecond = sampleBuffer.Average(i => i); } else { diff --git a/Subsurface/GUI/ComponentStyle.cs b/Subsurface/GUI/ComponentStyle.cs new file mode 100644 index 000000000..6187d7aa9 --- /dev/null +++ b/Subsurface/GUI/ComponentStyle.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Linq; + +namespace Subsurface +{ + class GUIComponentStyle + { + public readonly Vector4 Padding; + + public readonly Color Color; + + public readonly Color textColor; + + public readonly Color HoverColor; + public readonly Color SelectedColor; + + public readonly Color OutlineColor; + + public readonly List Sprites; + + + public GUIComponentStyle(XElement element) + { + Sprites = new List(); + + Padding = ToolBox.GetAttributeVector4(element, "padding", Vector4.Zero); + + Vector4 colorVector = ToolBox.GetAttributeVector4(element, "color", new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + Color = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + colorVector = ToolBox.GetAttributeVector4(element, "textcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + textColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + colorVector = ToolBox.GetAttributeVector4(element, "hovercolor", new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + HoverColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + colorVector = ToolBox.GetAttributeVector4(element, "selectedcolor", new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + SelectedColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + colorVector = ToolBox.GetAttributeVector4(element, "outlinecolor", new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + OutlineColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLower()) + { + case "sprite": + Sprites.Add(new Sprite(subElement)); + break; + } + } + } + } +} diff --git a/Subsurface/GUI/GUI.cs b/Subsurface/GUI/GUI.cs index 5c6ad18fd..86303ad09 100644 --- a/Subsurface/GUI/GUI.cs +++ b/Subsurface/GUI/GUI.cs @@ -92,7 +92,7 @@ namespace Subsurface t.SetData( new Color[] { Color.White });// fill the texture with white - style = new GUIStyle("Content/HUD/style.xml"); + style = new GUIStyle("Content/UI/style.xml"); } public static void DrawLine(SpriteBatch sb, Vector2 start, Vector2 end, Color clr, float depth = 0.0f) diff --git a/Subsurface/GUI/GUIButton.cs b/Subsurface/GUI/GUIButton.cs index 427484084..1688ef06c 100644 --- a/Subsurface/GUI/GUIButton.cs +++ b/Subsurface/GUI/GUIButton.cs @@ -7,6 +7,7 @@ namespace Subsurface class GUIButton : GUIComponent { protected GUITextBlock textBlock; + protected GUIFrame frame; public delegate bool OnClickedHandler(GUIButton button, object obj); public OnClickedHandler OnClicked; @@ -22,33 +23,41 @@ namespace Subsurface set { textBlock.Text = value; } } - public GUIButton(Rectangle rect, string text, GUIStyle style, Alignment alignment, GUIComponent parent = null) - : this(rect, text, style.foreGroundColor, alignment, parent) + public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null) + : this(rect, text, null, Alignment.Left, style, parent) { - hoverColor = style.hoverColor; - selectedColor = style.selectedColor; } - public GUIButton(Rectangle rect, string text, Color color, GUIComponent parent = null) - : this(rect, text, color, (Alignment.Left | Alignment.Top), parent) + public GUIButton(Rectangle rect, string text, Alignment alignment, GUIStyle style, GUIComponent parent = null) + : this(rect, text, null, alignment, style, parent) { } - - public GUIButton(Rectangle rect, string text, Color color, Alignment alignment, GUIComponent parent = null) + + public GUIButton(Rectangle rect, string text, Color? color, GUIStyle style, GUIComponent parent = null) + : this(rect, text, color, (Alignment.Left | Alignment.Top), style, parent) + { + } + + public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, GUIStyle style, GUIComponent parent = null) + :base (style) { this.rect = rect; - this.color = color; + if (color!=null) this.color = (Color)color; this.alignment = alignment; Enabled = true; if (parent != null) parent.AddChild(this); - - textBlock = new GUITextBlock(new Rectangle(0,0,0,0), text, Color.Transparent, Color.Black, (Alignment.CenterX | Alignment.CenterY), this); + frame = new GUIFrame(new Rectangle(0,0,0,0), style, this); + if (style!=null) style.Apply(frame, this); + + textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), text, + Color.Transparent, (this.style==null) ? Color.Black : this.style.textColor, + Alignment.Center, style, this); } - + public override void Draw(SpriteBatch spriteBatch) { if (rect.Contains(PlayerInput.GetMouseState.Position) && Enabled && (MouseOn == this || IsParentOf(MouseOn))) @@ -74,15 +83,17 @@ namespace Subsurface state = ComponentState.None; } - Color currColor = color; - if (state == ComponentState.Hover) currColor = hoverColor; - if (state == ComponentState.Selected) currColor = selectedColor; + frame.State = state; - GUI.DrawRectangle(spriteBatch, rect, currColor * alpha, true); + //Color currColor = color; + //if (state == ComponentState.Hover) currColor = hoverColor; + //if (state == ComponentState.Selected) currColor = selectedColor; - //spriteBatch.DrawString(HUD.font, text, new Vector2(rect.X+rect.Width/2, rect.Y+rect.Height/2), Color.Black, 0.0f, new Vector2(0.5f,0.5f), 1.0f, SpriteEffects.None, 0.0f); + //GUI.DrawRectangle(spriteBatch, rect, currColor * alpha, true); - GUI.DrawRectangle(spriteBatch, rect, Color.Black * alpha, false); + ////spriteBatch.DrawString(HUD.font, text, new Vector2(rect.X+rect.Width/2, rect.Y+rect.Height/2), Color.Black, 0.0f, new Vector2(0.5f,0.5f), 1.0f, SpriteEffects.None, 0.0f); + + //GUI.DrawRectangle(spriteBatch, rect, Color.Black * alpha, false); DrawChildren(spriteBatch); diff --git a/Subsurface/GUI/GUIComponent.cs b/Subsurface/GUI/GUIComponent.cs index 966d97f2b..40063086e 100644 --- a/Subsurface/GUI/GUIComponent.cs +++ b/Subsurface/GUI/GUIComponent.cs @@ -9,15 +9,16 @@ namespace Subsurface { abstract class GUIComponent { - public static GUIComponent MouseOn; + + protected static KeyboardDispatcher keyboardDispatcher; public enum ComponentState { None, Hover, Selected}; protected Alignment alignment; - protected static KeyboardDispatcher keyboardDispatcher; - + protected GUIComponentStyle style; + protected object userData; protected Rectangle rect; @@ -33,7 +34,7 @@ namespace Subsurface protected ComponentState state; - protected float alpha; + //protected float alpha; public GUIComponent Parent { @@ -68,6 +69,12 @@ namespace Subsurface } } + protected List sprites; + //public Alignment SpriteAlignment { get; set; } + //public bool RepeatSpriteX, RepeatSpriteY; + + public Color OutlineColor { get; set; } + public ComponentState State { get { return state; } @@ -110,27 +117,32 @@ namespace Subsurface } - public float Alpha - { - get - { - return alpha; - } - set - { - alpha = MathHelper.Clamp(value, 0.0f, 1.0f); - foreach (GUIComponent child in children) - { - child.Alpha = value; - } - } - } + //public float Alpha + //{ + // get + // { + // return alpha; + // } + // set + // { + // alpha = MathHelper.Clamp(value, 0.0f, 1.0f); + // foreach (GUIComponent child in children) + // { + // child.Alpha = value; + // } + // } + //} - protected GUIComponent() + protected GUIComponent(GUIStyle style) { - alpha = 1.0f; + //alpha = 1.0f; + OutlineColor = Color.Transparent; + + sprites = new List(); children = new List(); + + if (style!=null) style.Apply(this); } public static void Init(GameWindow window) @@ -233,8 +245,21 @@ namespace Subsurface else { rect.Y += parentRect.Y + (int)padding.Y; - } + } + } + + public virtual void ApplyStyle(GUIComponentStyle style) + { + color = style.Color; + hoverColor = style.HoverColor; + selectedColor = style.SelectedColor; + padding = style.Padding; + sprites = style.Sprites; + + OutlineColor = style.OutlineColor; + + this.style = style; } public virtual void DrawChildren(SpriteBatch spriteBatch) diff --git a/Subsurface/GUI/GUIFrame.cs b/Subsurface/GUI/GUIFrame.cs index 06d726c25..a16e9af5d 100644 --- a/Subsurface/GUI/GUIFrame.cs +++ b/Subsurface/GUI/GUIFrame.cs @@ -1,28 +1,29 @@ using Microsoft.Xna.Framework; +using System; namespace Subsurface { class GUIFrame : GUIComponent - { - public GUIFrame(Rectangle rect, Color color, Alignment alignment, GUIStyle style, GUIComponent parent = null) - : this(rect, color, alignment, parent) - { - hoverColor = style.hoverColor; - selectedColor = style.selectedColor; - } - - public GUIFrame(Rectangle rect, Color color, GUIComponent parent = null) - : this(rect,color,(Alignment.Left | Alignment.Top), parent) + { + public GUIFrame(Rectangle rect, GUIStyle style = null, GUIComponent parent = null) + : this(rect, null, (Alignment.Left | Alignment.Top), style, parent) { } - public GUIFrame(Rectangle rect, Color color, Alignment alignment, GUIComponent parent = null) + + public GUIFrame(Rectangle rect, Color color, GUIStyle style = null, GUIComponent parent = null) + : this(rect, color, (Alignment.Left | Alignment.Top), style, parent) + { + } + + public GUIFrame(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null) + : base(style) { this.rect = rect; this.alignment = alignment; - this.color = color; + if (color!=null) this.color = (Color)color; if (parent != null) { @@ -32,17 +33,40 @@ namespace Subsurface { UpdateDimensions(); } - } + //if (style != null) ApplyStyle(style); + } + public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { base.Draw(spriteBatch); - Color newColor = color; - if (state == ComponentState.Selected) newColor = selectedColor; - if (state == ComponentState.Hover) newColor = hoverColor; + Color currColor = color; + if (state == ComponentState.Selected) currColor = selectedColor; + if (state == ComponentState.Hover) currColor = hoverColor; + + GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A/255.0f), true); + + if (sprites != null) + { + foreach (Sprite sprite in sprites) + { + Vector2 startPos = new Vector2(rect.X, rect.Y); + Vector2 size = new Vector2(sprite.SourceRect.Width, sprite.SourceRect.Height); + + if (sprite.size.X == 0.0f) size.X = rect.Width; + if (sprite.size.Y == 0.0f) size.Y = rect.Height; + + sprite.DrawTiled(spriteBatch, startPos, size, currColor * (currColor.A / 255.0f)); + } + } + + if (OutlineColor != Color.Transparent) + { + GUI.DrawRectangle(spriteBatch, rect, OutlineColor * (OutlineColor.A/255.0f), false); + } + - GUI.DrawRectangle(spriteBatch, rect, newColor * alpha, true); DrawChildren(spriteBatch); } diff --git a/Subsurface/GUI/GUIImage.cs b/Subsurface/GUI/GUIImage.cs index f46cc86ff..9e9b5ddeb 100644 --- a/Subsurface/GUI/GUIImage.cs +++ b/Subsurface/GUI/GUIImage.cs @@ -47,6 +47,7 @@ namespace Subsurface } public GUIImage(Rectangle rect, Sprite sprite, Alignment alignment, GUIComponent parent = null) + : base(null) { this.rect = rect; @@ -54,7 +55,7 @@ namespace Subsurface color = Color.White; - alpha = 1.0f; + //alpha = 1.0f; Scale = 1.0f; @@ -75,7 +76,7 @@ namespace Subsurface if (state == ComponentState.Hover) currColor = hoverColor; if (state == ComponentState.Selected) currColor = selectedColor; - spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * alpha, 0.0f, Vector2.Zero, + spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * (currColor.A / 255.0f), 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.0f); DrawChildren(spriteBatch); diff --git a/Subsurface/GUI/GUIListBox.cs b/Subsurface/GUI/GUIListBox.cs index 92e1ff62a..43d0d4b83 100644 --- a/Subsurface/GUI/GUIListBox.cs +++ b/Subsurface/GUI/GUIListBox.cs @@ -16,6 +16,7 @@ namespace Subsurface public CheckSelectedHandler CheckSelected; private GUIScrollBar scrollBar; + private GUIFrame frame; private int totalSize; @@ -73,36 +74,46 @@ namespace Subsurface } } - public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null) - : this(rect, style.foreGroundColor, alignment, parent) + public GUIListBox(Rectangle rect, GUIStyle style, GUIComponent parent = null) + : this(rect, style, Alignment.TopLeft, parent) { } - public GUIListBox(Rectangle rect, Color color, GUIComponent parent = null) - : this(rect, color, (Alignment.Left | Alignment.Top), parent) + public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null) + : this(rect, null, style, parent) + { + } + + public GUIListBox(Rectangle rect, Color? color, GUIStyle style = null, GUIComponent parent = null) + : this(rect, color, (Alignment.Left | Alignment.Top), style, parent) { } - public GUIListBox(Rectangle rect, Color color, Alignment alignment, GUIComponent parent = null) + public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null) + : base(style) { this.rect = rect; this.alignment = alignment; - this.color = color; + if (color!=null) this.color = (Color)color; if (parent != null) parent.AddChild(this); - this.rect.Width -= 20; scrollBar = new GUIScrollBar( - new Rectangle(this.rect.X + this.rect.Width, this.rect.Y, 20, this.rect.Height), color, 1.0f); + new Rectangle(this.rect.X + this.rect.Width, this.rect.Y, 20, this.rect.Height), color, 1.0f, style); + + frame = new GUIFrame(Rectangle.Empty, style, this); + if (style != null) style.Apply(frame, this); UpdateScrollBarSize(); enabled = true; scrollBarEnabled = true; + + scrollBar.BarScroll = 0.0f; } public void Select(object selection) @@ -126,6 +137,9 @@ namespace Subsurface public void Select(int childIndex) { + //children[0] is the GUIFrame, ignore it + childIndex += 1; + if (childIndex >= children.Count || childIndex<0) return; selected = children[childIndex]; @@ -142,6 +156,7 @@ namespace Subsurface totalSize = 0; foreach (GUIComponent child in children) { + if (child == frame) continue; totalSize += (scrollBar.IsHorizontal) ? child.Rect.Width : child.Rect.Height; totalSize += spacing; } @@ -161,8 +176,8 @@ namespace Subsurface float oldScroll = scrollBar.BarScroll; float oldSize = scrollBar.BarSize; UpdateScrollBarSize(); - - if (scrollBar.BarSize<1.0f && (oldSize>=1.0f || oldScroll==1.0f)) + + if (scrollBar.BarSize < 1.0f && oldScroll == 1.0f) { scrollBar.BarScroll = 1.0f; } @@ -199,7 +214,9 @@ namespace Subsurface public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); - GUI.DrawRectangle(spriteBatch, rect, color*alpha, true); + + frame.Draw(spriteBatch); + //GUI.DrawRectangle(spriteBatch, rect, color*alpha, true); int x = rect.X, y = rect.Y; @@ -219,6 +236,7 @@ namespace Subsurface for (int i = 0; i < children.Count; i++ ) { GUIComponent child = children[i]; + if (child == frame) continue; child.Rect = new Rectangle(child.Rect.X, y, child.Rect.Width, child.Rect.Height); y += child.Rect.Height + spacing; @@ -241,7 +259,7 @@ namespace Subsurface if (CheckSelected() != selected.UserData) selected = null; } } - else if (enabled && (MouseOn==this || ( MouseOn!=null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.GetMouseState.Position)) + else if (enabled && (MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.GetMouseState.Position)) { child.State = ComponentState.Hover; if (PlayerInput.LeftButtonClicked()) diff --git a/Subsurface/GUI/GUIMessageBox.cs b/Subsurface/GUI/GUIMessageBox.cs index de5f4dfd8..ec58e4fc4 100644 --- a/Subsurface/GUI/GUIMessageBox.cs +++ b/Subsurface/GUI/GUIMessageBox.cs @@ -23,9 +23,9 @@ namespace Subsurface public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = (Alignment.Left | Alignment.Top)) : base(new Rectangle(Game1.GraphicsWidth / 2 - DefaultWidth / 2, Game1.GraphicsHeight / 2 - DefaultHeight / 2, DefaultWidth, DefaultHeight), - GUI.style.backGroundColor, Alignment.CenterX, GUI.style) + null, Alignment.CenterX, GUI.style, null) { - Padding = GUI.style.smallPadding; + //Padding = GUI.style.smallPadding; if (buttons == null || buttons.Length == 0) { @@ -33,14 +33,14 @@ namespace Subsurface return; } - new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, this, true); - new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, this, true); + new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.style, this, true); + new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true); int x = 0; this.Buttons = new GUIButton[buttons.Length]; for (int i = 0; i < buttons.Length; i++) { - this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], GUI.style, Alignment.Left | Alignment.Bottom, this); + this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.style, this); x += this.Buttons[i].Rect.Width + 20; } diff --git a/Subsurface/GUI/GUIProgressBar.cs b/Subsurface/GUI/GUIProgressBar.cs index 63c29d912..32f43b1fd 100644 --- a/Subsurface/GUI/GUIProgressBar.cs +++ b/Subsurface/GUI/GUIProgressBar.cs @@ -37,6 +37,7 @@ namespace Subsurface } public GUIProgressBar(Rectangle rect, Color color, float barSize, Alignment alignment, GUIComponent parent = null) + : base(null) { this.rect = rect; this.color = color; @@ -49,7 +50,7 @@ namespace Subsurface if (parent != null) parent.AddChild(this); - frame = new GUIFrame(new Rectangle(0,0,0,0), Color.White, this); + frame = new GUIFrame(new Rectangle(0,0,0,0), Color.White, null, this); this.barSize = barSize; UpdateRect(); @@ -70,7 +71,7 @@ namespace Subsurface DrawChildren(spriteBatch); - GUI.DrawRectangle(spriteBatch, rect, color*alpha, true); + GUI.DrawRectangle(spriteBatch, rect, color * (color.A / 255.0f), true); } } diff --git a/Subsurface/GUI/GUIScrollBar.cs b/Subsurface/GUI/GUIScrollBar.cs index 48f426d88..fa7568518 100644 --- a/Subsurface/GUI/GUIScrollBar.cs +++ b/Subsurface/GUI/GUIScrollBar.cs @@ -63,22 +63,23 @@ namespace Subsurface { float oldBarSize = barSize; barSize = Math.Min(Math.Max(value, 0.0f), 1.0f); - if (barSize!=oldBarSize) UpdateRect(); + if (barSize != oldBarSize) UpdateRect(); } } public GUIScrollBar(Rectangle rect, GUIStyle style, float barSize, GUIComponent parent = null) - : this(rect, style.foreGroundColor, barSize, parent) + : this(rect, null, barSize, style, parent) { } - public GUIScrollBar(Rectangle rect, Color color, float barSize, GUIComponent parent = null) - : this(rect, color, barSize, (Alignment.Left | Alignment.Top), parent) + public GUIScrollBar(Rectangle rect, Color? color, float barSize, GUIStyle style = null, GUIComponent parent = null) + : this(rect, color, barSize, Alignment.TopLeft, style, parent) { } - public GUIScrollBar(Rectangle rect, Color color, float barSize, Alignment alignment, GUIComponent parent = null) + public GUIScrollBar(Rectangle rect, Color? color, float barSize, Alignment alignment, GUIStyle style = null, GUIComponent parent = null) + : base(style) { this.rect = rect; //GetDimensions(parent); @@ -89,12 +90,13 @@ namespace Subsurface parent.AddChild(this); isHorizontal = (rect.Width > rect.Height); - frame = new GUIFrame(new Rectangle(0,0,0,0), Color.White, this); + frame = new GUIFrame(new Rectangle(0,0,0,0), Color.White, style, this); //AddChild(frame); //System.Diagnostics.Debug.WriteLine(frame.rect); - bar = new GUIButton(new Rectangle(0, 0, 0, 0), "", color, this); + bar = new GUIButton(new Rectangle(0, 0, 0, 0), "", color, style, this); + bar.OnPressed = SelectBar; //AddChild(bar); diff --git a/Subsurface/GUI/GUIStyle.cs b/Subsurface/GUI/GUIStyle.cs index 0dc23ca2a..8231b5fb8 100644 --- a/Subsurface/GUI/GUIStyle.cs +++ b/Subsurface/GUI/GUIStyle.cs @@ -1,24 +1,19 @@ using System.Xml.Linq; using Microsoft.Xna.Framework; using System; +using System.Collections.Generic; namespace Subsurface { class GUIStyle { - public readonly Vector4 smallPadding; - public readonly Vector4 largePadding; - - public readonly Color backGroundColor; - public readonly Color foreGroundColor; - - public readonly Color textColor; - - public readonly Color hoverColor; - public readonly Color selectedColor; + private Dictionary componentStyles; public GUIStyle(string file) { + + componentStyles = new Dictionary(); + XDocument doc; try { doc = XDocument.Load(file); } catch (Exception e) @@ -27,24 +22,46 @@ namespace Subsurface return; } - smallPadding = ToolBox.GetAttributeVector4(doc.Root, "smallpadding", Vector4.Zero); - largePadding = ToolBox.GetAttributeVector4(doc.Root, "largepadding", Vector4.Zero); + //smallPadding = ToolBox.GetAttributeVector4(doc.Root, "smallpadding", Vector4.Zero); + //largePadding = ToolBox.GetAttributeVector4(doc.Root, "largepadding", Vector4.Zero); - Vector4 colorVector = ToolBox.GetAttributeVector4(doc.Root, "backgroundcolor", new Vector4(0.0f,0.0f,0.0f,1.0f)); - backGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + //Vector4 colorVector = ToolBox.GetAttributeVector4(doc.Root, "backgroundcolor", new Vector4(0.0f,0.0f,0.0f,1.0f)); + //backGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); - colorVector = ToolBox.GetAttributeVector4(doc.Root, "foregroundcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); - foreGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + //colorVector = ToolBox.GetAttributeVector4(doc.Root, "foregroundcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + //foreGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); - colorVector = ToolBox.GetAttributeVector4(doc.Root, "textcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); - textColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + //colorVector = ToolBox.GetAttributeVector4(doc.Root, "textcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + //textColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); - colorVector = ToolBox.GetAttributeVector4(doc.Root, "hovercolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); - hoverColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + //colorVector = ToolBox.GetAttributeVector4(doc.Root, "hovercolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + //hoverColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); - colorVector = ToolBox.GetAttributeVector4(doc.Root, "selectedcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); - selectedColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + //colorVector = ToolBox.GetAttributeVector4(doc.Root, "selectedcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + //selectedColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W); + + foreach (XElement subElement in doc.Root.Elements()) + { + GUIComponentStyle componentStyle = new GUIComponentStyle(subElement); + componentStyles.Add(subElement.Name.ToString().ToLower(), componentStyle); + } } + public void Apply(GUIComponent targetComponent, GUIComponent parent = null) + { + GUIComponentStyle componentStyle = null; + string name = (parent==null) ? targetComponent.GetType().Name.ToLower() : parent.GetType().Name.ToLower(); + componentStyles.TryGetValue(name, out componentStyle); + + if (componentStyle==null) + { + DebugConsole.ThrowError("Couldn't find a GUI style for "+targetComponent.GetType().Name); + return; + } + + targetComponent.ApplyStyle(componentStyle); + } + + } } diff --git a/Subsurface/GUI/GUITextBlock.cs b/Subsurface/GUI/GUITextBlock.cs index b5ad340dc..eee250c3d 100644 --- a/Subsurface/GUI/GUITextBlock.cs +++ b/Subsurface/GUI/GUITextBlock.cs @@ -60,16 +60,24 @@ namespace Subsurface { get { return caretPos; } } - - public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment, Alignment textAlignment, GUIComponent parent = null, bool wrap = false) - : this (rect, text, style.foreGroundColor, style.textColor, alignment, textAlignment, parent, wrap) + + public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null, bool wrap = false) + : this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, wrap) { - hoverColor = style.hoverColor; - selectedColor = style.selectedColor; + //hoverColor = style.hoverColor; + //selectedColor = style.selectedColor; } - public GUITextBlock(Rectangle rect, string text, Color color, Color textColor, Alignment textAlignment = Alignment.Left, GUIComponent parent = null, bool wrap = false) - : this(rect, text,color, textColor, (Alignment.Left | Alignment.Top), textAlignment, parent, wrap) + + public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = (Alignment.Left | Alignment.Top), Alignment textAlignment = (Alignment.Left | Alignment.Top), GUIComponent parent = null, bool wrap = false) + : this (rect, text, null, null, alignment, textAlignment, style, parent, wrap) + { + //hoverColor = style.hoverColor; + //selectedColor = style.selectedColor; + } + + public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false) + : this(rect, text,color, textColor, (Alignment.Left | Alignment.Top), textAlignment, style, parent, wrap) { } @@ -80,13 +88,21 @@ namespace Subsurface SetTextPos(); } + public override void ApplyStyle(GUIComponentStyle style) + { + base.ApplyStyle(style); - public GUITextBlock(Rectangle rect, string text, Color color, Color textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIComponent parent = null, bool wrap = false) + textColor = style.textColor; + } + + + public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false) + :base (style) { this.rect = rect; - this.color = color; - this.textColor = textColor; + if (color!=null) this.color = (Color)color; + if (textColor!=null) this.textColor = (Color)textColor; this.text = text; this.alignment = alignment; @@ -174,7 +190,7 @@ namespace Subsurface if (state == ComponentState.Hover) currColor = hoverColor; if (state == ComponentState.Selected) currColor = selectedColor; - GUI.DrawRectangle(spriteBatch, rect, currColor*alpha, true); + GUI.DrawRectangle(spriteBatch, rect, currColor*(currColor.A/255.0f), true); if (TextGetter != null) text = TextGetter(); @@ -183,7 +199,7 @@ namespace Subsurface spriteBatch.DrawString(GUI.font, text, new Vector2(rect.X, rect.Y) + textPos, - textColor * alpha, + textColor * (textColor.A / 255.0f), 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f); } diff --git a/Subsurface/GUI/GUITextBox.cs b/Subsurface/GUI/GUITextBox.cs index 13530ab53..9967b3c6c 100644 --- a/Subsurface/GUI/GUITextBox.cs +++ b/Subsurface/GUI/GUITextBox.cs @@ -24,6 +24,12 @@ namespace Subsurface public delegate bool OnTextChangedHandler(GUITextBox textBox, string text); public OnTextChangedHandler OnTextChanged; + public bool Enabled + { + get; + set; + } + public override Color Color { get { return color; } @@ -68,11 +74,24 @@ namespace Subsurface } } - public GUITextBox(Rectangle rect, Color color, Color textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIComponent parent = null) + public GUITextBox(Rectangle rect, GUIStyle style = null, GUIComponent parent = null) + : this(rect, null, null, Alignment.Left, Alignment.Left, style, parent) + { + + } + + public GUITextBox(Rectangle rect, Alignment alignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null) + : this(rect, null, null, alignment, Alignment.Left, style, parent) + { + + } + + public GUITextBox(Rectangle rect, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null) + : base(style) { this.rect = rect; - this.color = color; + if (color!=null) this.color = (Color)color; this.alignment = alignment; @@ -81,10 +100,11 @@ namespace Subsurface if (parent != null) parent.AddChild(this); - textBlock = new GUITextBlock(new Rectangle(0,0,0,0), "", color, textColor, textAlignment, this); + textBlock = new GUITextBlock(new Rectangle(0,0,0,0), "", color, textColor, textAlignment, null, this); textBlock.Padding = new Vector4(10.0f, 0.0f, 10.0f, 0.0f); + if (style != null) style.Apply(textBlock, this); - _previousMouse = PlayerInput.GetMouseState; + previousMouse = PlayerInput.GetMouseState; //SetTextPos(); } @@ -99,19 +119,18 @@ namespace Subsurface if (keyboardDispatcher.Subscriber == this) keyboardDispatcher.Subscriber = null; } - MouseState _previousMouse; + MouseState previousMouse; public override void Update(float deltaTime) { + if (!Enabled) return; + caretTimer += deltaTime; caretVisible = ((caretTimer*1000.0f) % 1000) < 500; if (rect.Contains(PlayerInput.GetMouseState.Position)) { state = ComponentState.Hover; - if (PlayerInput.LeftButtonClicked()) - { - Select(); - } + if (PlayerInput.LeftButtonClicked()) Select(); } else { @@ -120,7 +139,7 @@ namespace Subsurface if (keyboardDispatcher.Subscriber == this) { - Character.disableControls = true; + Character.DisableControls = true; if (OnEnter != null && PlayerInput.KeyHit(Keys.Enter)) { string input = Text; @@ -143,7 +162,7 @@ namespace Subsurface GUI.DrawLine(spriteBatch, new Vector2((int)caretPos.X + 2, caretPos.Y + 3), new Vector2((int)caretPos.X + 2, caretPos.Y + rect.Height - 3), - textBlock.TextColor * alpha); + textBlock.TextColor * (textBlock.TextColor.A / 255.0f)); } } diff --git a/Subsurface/GUI/GUITickBox.cs b/Subsurface/GUI/GUITickBox.cs index f43069e65..6e0a9fe8c 100644 --- a/Subsurface/GUI/GUITickBox.cs +++ b/Subsurface/GUI/GUITickBox.cs @@ -15,12 +15,13 @@ namespace Subsurface bool selected; public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent) + : base(null) { if (parent != null) parent.AddChild(this); - box = new GUIFrame(new Rectangle(rect.X, rect.Y, 30, 30), Color.LightGray, this); - text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.Left | Alignment.CenterY, this); + box = new GUIFrame(new Rectangle(rect.X, rect.Y, 30, 30), Color.LightGray, null, this); + text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.Left | Alignment.CenterY, null, this); } public override void Update(float deltaTime) @@ -53,7 +54,7 @@ namespace Subsurface if (selected) { - GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10), Color.Green * alpha, true); + GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10), Color.Green * (color.A / 255.0f), true); } } } diff --git a/Subsurface/Game1.cs b/Subsurface/Game1.cs index 7f1d87d91..b26253a4c 100644 --- a/Subsurface/Game1.cs +++ b/Subsurface/Game1.cs @@ -10,12 +10,9 @@ using Subsurface.Particles; namespace Subsurface { - /// - /// This is the main type for your game - /// class Game1 : Game { - public static GraphicsDeviceManager graphics; + public static GraphicsDeviceManager Graphics; static int graphicsWidth, graphicsHeight; static SpriteBatch spriteBatch; @@ -23,7 +20,7 @@ namespace Subsurface public static FrameCounter frameCounter; - public static readonly Version version = Assembly.GetEntryAssembly().GetName().Version; + public static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version; public static GameScreen GameScreen; public static MainMenuScreen MainMenuScreen; @@ -35,18 +32,17 @@ namespace Subsurface public static Level Level; public static GameSession GameSession; - - public static GameClient Client; - public static GameServer Server; + + public static NetworkMember NetworkMember; public static ParticleManager particleManager; public static TextureLoader textureLoader; - public static World world; + public static World World; - public static Random localRandom; - public static Random random; + //public static Random localRandom; + //public static Random random; //private Stopwatch renderTimer; //public static int renderTimeElapsed; @@ -57,7 +53,6 @@ namespace Subsurface get { return GameScreen.Cam; } } - public static int GraphicsWidth { get { return graphicsWidth; } @@ -67,17 +62,27 @@ namespace Subsurface { get { return graphicsHeight; } } + + public static GameServer Server + { + get { return NetworkMember as GameServer; } + } + + public static GameClient Client + { + get { return NetworkMember as GameClient; } + } public Game1() { - graphics = new GraphicsDeviceManager(this); + Graphics = new GraphicsDeviceManager(this); graphicsWidth = 1280; graphicsHeight = 720; //graphics.IsFullScreen = true; - graphics.PreferredBackBufferWidth = graphicsWidth; - graphics.PreferredBackBufferHeight = graphicsHeight; + Graphics.PreferredBackBufferWidth = graphicsWidth; + Graphics.PreferredBackBufferHeight = graphicsHeight; Content.RootDirectory = "Content"; //graphics.SynchronizeWithVerticalRetrace = false; @@ -92,12 +97,9 @@ namespace Subsurface IsFixedTimeStep = false; //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 55); - world = new World(new Vector2(0, -9.82f)); + World = new World(new Vector2(0, -9.82f)); Settings.VelocityIterations = 2; Settings.PositionIterations = 1; - - random = new Random(); - localRandom = new Random(); } /// @@ -151,7 +153,7 @@ namespace Subsurface AmbientSoundManager.Init("Content/Sounds/Sounds.xml"); Submarine.Preload("Content/SavedMaps"); - GameScreen = new GameScreen(graphics.GraphicsDevice); + GameScreen = new GameScreen(Graphics.GraphicsDevice); MainMenuScreen = new MainMenuScreen(this); LobbyScreen = new LobbyScreen(); NetLobbyScreen = new NetLobbyScreen(); @@ -190,18 +192,11 @@ namespace Subsurface DebugConsole.Update(this, (float)deltaTime); - if (!DebugConsole.IsOpen || Server != null || Client != null) Screen.Selected.Update(deltaTime); + if (!DebugConsole.IsOpen || NetworkMember != null) Screen.Selected.Update(deltaTime); GUI.Update((float)deltaTime); - if (Server != null) - { - Server.Update(); - } - else if (Client != null) - { - Client.Update(); - } + if (NetworkMember != null) NetworkMember.Update(); else { NetworkEvent.events.Clear(); @@ -228,7 +223,7 @@ namespace Subsurface protected override void OnExiting(object sender, EventArgs args) { - if (Client != null) Client.Disconnect(); + if (NetworkMember != null) NetworkMember.Disconnect(); base.OnExiting(sender, args); } diff --git a/Subsurface/GameSession/CrewManager.cs b/Subsurface/GameSession/CrewManager.cs index 7cde3fb91..3e1d0c008 100644 --- a/Subsurface/GameSession/CrewManager.cs +++ b/Subsurface/GameSession/CrewManager.cs @@ -33,7 +33,7 @@ namespace Subsurface guiFrame = new GUIFrame(new Rectangle(0, 50, 150, 450), Color.Transparent); - listBox = new GUIListBox(new Rectangle(0, 0, 150, 0), Color.Transparent, guiFrame); + listBox = new GUIListBox(new Rectangle(0, 0, 150, 0), Color.Transparent, null, guiFrame); listBox.ScrollBarEnabled = false; listBox.OnSelected = SelectCharacter; @@ -72,29 +72,28 @@ namespace Subsurface public void AddCharacter(Character character) { characters.Add(character); - if (!characterInfos.Contains(character.info)) + if (!characterInfos.Contains(character.Info)) { - characterInfos.Add(character.info); + characterInfos.Add(character.Info); } - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, listBox); + GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, listBox); frame.UserData = character; frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); frame.HoverColor = Color.LightGray * 0.5f; frame.SelectedColor = Color.Gold * 0.5f; - string name = character.info.name.Replace(' ', '\n'); + string name = character.Info.Name.Replace(' ', '\n'); GUITextBlock textBlock = new GUITextBlock( new Rectangle(40, 0, 0, 25), name, Color.Transparent, Color.White, - Alignment.Left, - Alignment.Left, - frame); + Alignment.Left, Alignment.Left, + null, frame); textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); - new GUIImage(new Rectangle(-10, -10, 0, 0), character.animController.limbs[0].sprite, Alignment.Left, frame); + new GUIImage(new Rectangle(-10, -10, 0, 0), character.AnimController.limbs[0].sprite, Alignment.Left, frame); } public void Update(float deltaTime) @@ -123,7 +122,7 @@ namespace Subsurface WayPoint randomWayPoint = WayPoint.GetRandom(WayPoint.SpawnType.Human); Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition; - Character character = new Character(ci.file, position, ci); + Character character = new Character(ci.File, position, ci); Character.Controlled = character; AddCharacter(character); } @@ -137,7 +136,7 @@ namespace Subsurface { if (!c.IsDead) continue; - CharacterInfo deadInfo = characterInfos.Find(x => c.info == x); + CharacterInfo deadInfo = characterInfos.Find(x => c.Info == x); if (deadInfo != null) characterInfos.Remove(deadInfo); } diff --git a/Subsurface/GameSession/GameSession.cs b/Subsurface/GameSession/GameSession.cs index 641c14183..3ab85c9e7 100644 --- a/Subsurface/GameSession/GameSession.cs +++ b/Subsurface/GameSession/GameSession.cs @@ -57,20 +57,20 @@ namespace Subsurface guiRoot = new GUIFrame(new Rectangle(0,0,Game1.GraphicsWidth,Game1.GraphicsWidth), Color.Transparent); - map = new Map(Game1.random.Next(), 500); + map = new Map(Rand.Int(), 500); int width = 350, height = 100; - if (Game1.Client!=null || Game1.Server!=null) + if (Game1.NetworkMember!=null) { chatBox = new GUIListBox(new Rectangle( - Game1.GraphicsWidth - (int)GUI.style.smallPadding.X - width, - Game1.GraphicsHeight - (int)GUI.style.smallPadding.W*2 - 25 - height, + Game1.GraphicsWidth - 20 - width, + Game1.GraphicsHeight - 40 - 25 - height, width, height), - Color.White * 0.5f, guiRoot); + Color.White * 0.5f, GUI.style, guiRoot); textBox = new GUITextBox( - new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + (int)GUI.style.smallPadding.W, chatBox.Rect.Width, 25), - Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, guiRoot); + new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25), + Color.White * 0.5f, Color.Black, Alignment.Bottom, Alignment.Left, GUI.style, guiRoot); textBox.OnEnter = EnterChatMessage; } @@ -91,8 +91,8 @@ namespace Subsurface } - public GameSession(Submarine selectedMap, string savePath, string filePath) - : this(selectedMap) + public GameSession(Submarine selectedSub, string savePath, string filePath) + : this(selectedSub) { XDocument doc = ToolBox.TryLoadXml(filePath); if (doc == null) return; @@ -111,27 +111,26 @@ namespace Subsurface this.savePath = savePath; } - public void StartShift(TimeSpan duration, Level level) + public void StartShift(TimeSpan duration, string levelSeed, int scriptedEventCount = 1) { - submarine.Load(); - level.Generate(submarine==null ? 100.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height)); - - this.level = level; - - StartShift(duration, 1); } - public void StartShift(TimeSpan duration, int scriptedEventCount = 1) + public void StartShift(TimeSpan duration, Level level, int scriptedEventCount = 1) { //if (crewManager.characterInfos.Count == 0) return; + + + this.level = level; + if (Submarine.Loaded!=submarine) submarine.Load(); if (gameMode!=null) gameMode.Start(duration); - if (level!=null) + if (level != null) { + level.Generate(submarine == null ? 100.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height)); submarine.SetPosition(level.StartPosition); } @@ -177,13 +176,9 @@ namespace Subsurface { if (string.IsNullOrWhiteSpace(message)) return false; - if (Game1.Server!=null) + else if (Game1.NetworkMember != null) { - Game1.Server.SendChatMessage(message); - } - else if (Game1.Client!=null) - { - Game1.Client.SendChatMessage(Game1.Client.Name + ": " + message); + Game1.NetworkMember.SendChatMessage(Game1.NetworkMember.Name + ": " + message); } textBox.Deselect(); @@ -195,9 +190,9 @@ namespace Subsurface { GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), text, ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, color, - Alignment.Left, null, true); + Alignment.Left, null, null, true); - msg.Padding = new Vector4(GUI.style.smallPadding.X, 0, 0, 0); + msg.Padding = new Vector4(20.0f, 0, 0, 0); chatBox.AddChild(msg); while (chatBox.CountChildren > 20) @@ -244,7 +239,7 @@ namespace Subsurface //crewManager.Draw(spriteBatch); taskManager.Draw(spriteBatch); - gameMode.Draw(spriteBatch); + if (gameMode!=null) gameMode.Draw(spriteBatch); //chatBox.Draw(spriteBatch); //textBox.Draw(spriteBatch); diff --git a/Subsurface/GameSession/SinglePlayerMode.cs b/Subsurface/GameSession/SinglePlayerMode.cs index 924f11b53..0ca0ad861 100644 --- a/Subsurface/GameSession/SinglePlayerMode.cs +++ b/Subsurface/GameSession/SinglePlayerMode.cs @@ -31,7 +31,7 @@ namespace Subsurface crewManager = new CrewManager(); hireManager = new HireManager(); - endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 240, 20, 100, 25), "End shift", Color.White, Alignment.Left | Alignment.Top); + endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 240, 20, 100, 25), "End shift", Alignment.Left | Alignment.Top, GUI.style); endShiftButton.OnClicked = EndShift; hireManager.GenerateCharacters("Content/Characters/Human/human.xml", 10); @@ -61,12 +61,12 @@ namespace Subsurface public bool TryHireCharacter(CharacterInfo characterInfo) { - if (crewManager.Money < characterInfo.salary) return false; + if (crewManager.Money < characterInfo.Salary) return false; hireManager.availableCharacters.Remove(characterInfo); crewManager.characterInfos.Add(characterInfo); - crewManager.Money -= characterInfo.salary; + crewManager.Money -= characterInfo.Salary; return true; } @@ -137,7 +137,7 @@ namespace Subsurface sb.Append("Casualties: \n"); foreach (Character c in casualties) { - sb.Append(" - " + c.info.name + "\n"); + sb.Append(" - " + c.Info.Name + "\n"); } } else @@ -151,9 +151,9 @@ namespace Subsurface } crewManager.EndShift(); - for (int i = Character.characterList.Count-1; i>=0; i--) + for (int i = Character.CharacterList.Count-1; i>=0; i--) { - Character.characterList.RemoveAt(i); + Character.CharacterList.RemoveAt(i); } Game1.GameSession.EndShift(""); diff --git a/Subsurface/GameSession/TraitorMode.cs b/Subsurface/GameSession/TraitorMode.cs index f93b5e054..a5f0dd5c6 100644 --- a/Subsurface/GameSession/TraitorMode.cs +++ b/Subsurface/GameSession/TraitorMode.cs @@ -31,9 +31,9 @@ namespace Subsurface if (DateTime.Now >= endTime) { - string endMessage = traitor.character.info.name + " was a traitor! "; - endMessage += (traitor.character.info.gender == Gender.Male) ? "His" : "Her"; - endMessage += " task was to assassinate " + target.character.info.name + ". The task was unsuccesful."; + string endMessage = traitor.character.Info.Name + " was a traitor! "; + endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her"; + endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was unsuccesful."; End(endMessage); return; } @@ -44,13 +44,13 @@ namespace Subsurface int clientCount = Game1.Server.connectedClients.Count(); if (clientCount < 2) return; - int traitorIndex = Game1.localRandom.Next(clientCount); + int traitorIndex = Rand.Int(clientCount, false); traitor = Game1.Server.connectedClients[traitorIndex]; int targetIndex = 0; - while (targetIndex==traitorIndex) + while (targetIndex == traitorIndex) { - targetIndex = Game1.localRandom.Next(clientCount); + targetIndex = Rand.Int(clientCount, false); } target = Game1.Server.connectedClients[targetIndex]; @@ -61,9 +61,9 @@ namespace Subsurface { if (target.character.IsDead) { - string endMessage = traitor.character.info.name + " was a traitor! "; - endMessage += (traitor.character.info.gender == Gender.Male) ? "his" : "her"; - endMessage += " task was to assassinate " + target.character.info.name + ". The task was succesful."; + string endMessage = traitor.character.Info.Name + " was a traitor! "; + endMessage += (traitor.character.Info.Gender == Gender.Male) ? "his" : "her"; + endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was succesful."; End(endMessage); } } diff --git a/Subsurface/Items/Components/Door.cs b/Subsurface/Items/Components/Door.cs index 2be769c5e..bbd6c59df 100644 --- a/Subsurface/Items/Components/Door.cs +++ b/Subsurface/Items/Components/Door.cs @@ -120,7 +120,7 @@ namespace Subsurface.Items.Components (int)doorSprite.size.Y); - body = new PhysicsBody(BodyFactory.CreateRectangle(Game1.world, + body = new PhysicsBody(BodyFactory.CreateRectangle(Game1.World, ConvertUnits.ToSimUnits(Math.Max(doorRect.Width, 1)), ConvertUnits.ToSimUnits(Math.Max(doorRect.Height, 1)), 1.5f)); @@ -281,10 +281,10 @@ namespace Subsurface.Items.Components Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(item.Rect.Width, item.Rect.Height * (1.0f - openState))); - foreach (Character c in Character.characterList) + foreach (Character c in Character.CharacterList) { - int dir = Math.Sign(c.animController.limbs[0].SimPosition.X - simPos.X); - foreach (Limb l in c.animController.limbs) + int dir = Math.Sign(c.AnimController.limbs[0].SimPosition.X - simPos.X); + foreach (Limb l in c.AnimController.limbs) { if (l.SimPosition.Y < simPos.Y || l.SimPosition.Y > simPos.Y - simSize.Y) continue; if (Math.Abs(l.SimPosition.X - simPos.X) > simSize.X * 2.0f) continue; @@ -300,7 +300,7 @@ namespace Subsurface.Items.Components { base.Remove(); - Game1.world.RemoveBody(body.FarseerBody); + Game1.World.RemoveBody(body.FarseerBody); if (linkedGap!=null) linkedGap.Remove(); @@ -312,11 +312,11 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - if (connection.name=="toggle") + if (connection.Name=="toggle") { isOpen = !isOpen; } - else if (connection.name == "set_state") + else if (connection.Name == "set_state") { isOpen = (signal!="0"); } diff --git a/Subsurface/Items/Components/Holdable/Holdable.cs b/Subsurface/Items/Components/Holdable/Holdable.cs index 47d054880..9e22c2793 100644 --- a/Subsurface/Items/Components/Holdable/Holdable.cs +++ b/Subsurface/Items/Components/Holdable/Holdable.cs @@ -129,7 +129,7 @@ namespace Subsurface.Items.Components if (!item.body.Enabled) { - Limb rightHand = picker.animController.GetLimb(LimbType.RightHand); + Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand); item.SetTransform(rightHand.SimPosition, 0.0f); } @@ -197,9 +197,9 @@ namespace Subsurface.Items.Components ApplyStatusEffects(ActionType.OnActive, deltaTime, picker); - if (item.body.Dir != picker.animController.Dir) Flip(item); + if (item.body.Dir != picker.AnimController.Dir) Flip(item); - AnimController ac = picker.animController; + AnimController ac = picker.AnimController; ac.HoldItem(deltaTime, cam, item, handlePos, holdPos, aimPos, holdAngle); } diff --git a/Subsurface/Items/Components/Holdable/Pickable.cs b/Subsurface/Items/Components/Holdable/Pickable.cs index 2815ecd97..fdb97dd14 100644 --- a/Subsurface/Items/Components/Holdable/Pickable.cs +++ b/Subsurface/Items/Components/Holdable/Pickable.cs @@ -81,7 +81,7 @@ namespace Subsurface.Items.Components if (item.body!= null && !item.body.Enabled) { - Limb rightHand = picker.animController.GetLimb(LimbType.RightHand); + Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand); item.SetTransform(rightHand.SimPosition, 0.0f); item.body.Enabled = true; } diff --git a/Subsurface/Items/Components/Holdable/RangedWeapon.cs b/Subsurface/Items/Components/Holdable/RangedWeapon.cs index dfc0ec150..4e1f2afbc 100644 --- a/Subsurface/Items/Components/Holdable/RangedWeapon.cs +++ b/Subsurface/Items/Components/Holdable/RangedWeapon.cs @@ -58,7 +58,7 @@ namespace Subsurface.Items.Components reload = 1.0f; List limbBodies = new List(); - foreach (Limb l in character.animController.limbs) + foreach (Limb l in character.AnimController.limbs) { limbBodies.Add(l.body.FarseerBody); } diff --git a/Subsurface/Items/Components/Holdable/RepairTool.cs b/Subsurface/Items/Components/Holdable/RepairTool.cs index f781bbf33..dce55bfde 100644 --- a/Subsurface/Items/Components/Holdable/RepairTool.cs +++ b/Subsurface/Items/Components/Holdable/RepairTool.cs @@ -104,7 +104,7 @@ namespace Subsurface.Items.Components (float)Math.Sin(item.body.Rotation)) * range * item.body.Dir; List ignoredBodies = new List(); - foreach (Limb limb in character.animController.limbs) + foreach (Limb limb in character.AnimController.limbs) { ignoredBodies.Add(limb.body.FarseerBody); } diff --git a/Subsurface/Items/Components/Holdable/Throwable.cs b/Subsurface/Items/Components/Holdable/Throwable.cs index 78faa506f..e2e08be40 100644 --- a/Subsurface/Items/Components/Holdable/Throwable.cs +++ b/Subsurface/Items/Components/Holdable/Throwable.cs @@ -64,9 +64,9 @@ namespace Subsurface.Items.Components ApplyStatusEffects(ActionType.OnActive, deltaTime, picker); - if (item.body.Dir != picker.animController.Dir) Flip(item); + if (item.body.Dir != picker.AnimController.Dir) Flip(item); - AnimController ac = picker.animController; + AnimController ac = picker.AnimController; ac.HoldItem(deltaTime, cam, item, handlePos, new Vector2(throwPos, 0.0f), aimPos, holdAngle); diff --git a/Subsurface/Items/Components/ItemComponent.cs b/Subsurface/Items/Components/ItemComponent.cs index 58c5b5dcf..3fe5ef3a7 100644 --- a/Subsurface/Items/Components/ItemComponent.cs +++ b/Subsurface/Items/Components/ItemComponent.cs @@ -15,18 +15,18 @@ namespace Subsurface { class ItemSound { - public readonly Sound sound; - public readonly ActionType type; + public readonly Sound Sound; + public readonly ActionType Type; - public string volumeProperty; + public string VolumeProperty; - public readonly float range; + public readonly float Range; public ItemSound(Sound sound, ActionType type, float range) { - this.sound = sound; - this.type = type; - this.range = range; + this.Sound = sound; + this.Type = type; + this.Range = range; } } @@ -191,7 +191,7 @@ namespace Subsurface guiFrame = new GUIFrame( new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W), new Color(color.X, color.Y, color.Z), alignment); - guiFrame.Alpha = color.W; + //guiFrame.Alpha = color.W; break; case "sound": @@ -218,7 +218,7 @@ namespace Subsurface float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f); ItemSound itemSound = new ItemSound(sound, type, range); - itemSound.volumeProperty = ToolBox.GetAttributeString(subElement, "volume", ""); + itemSound.VolumeProperty = ToolBox.GetAttributeString(subElement, "volume", ""); sounds.Add(itemSound); break; } @@ -233,16 +233,16 @@ namespace Subsurface ItemSound itemSound = null; if (!loop || !Sounds.SoundManager.IsPlaying(loopingSoundIndex)) { - List matchingSounds = sounds.FindAll(x => x.type == type); + List matchingSounds = sounds.FindAll(x => x.Type == type); if (matchingSounds.Count == 0) return; - int index = Game1.localRandom.Next(matchingSounds.Count); + int index = Rand.Int(matchingSounds.Count); itemSound = sounds[index]; - if (itemSound.volumeProperty != "") + if (itemSound.VolumeProperty != "") { ObjectProperty op = null; - if (properties.TryGetValue(itemSound.volumeProperty.ToLower(), out op)) + if (properties.TryGetValue(itemSound.VolumeProperty.ToLower(), out op)) { float newVolume = 0.0f; float.TryParse(op.GetValue().ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out newVolume); @@ -258,12 +258,12 @@ namespace Subsurface if (loop) { //if (loopingSound != null && loopingSound.volumeProperty != "") volume = float.Parse(properties[loopingSound.volumeProperty].GetValue().ToString()); - loopingSoundIndex = loopingSound.sound.Loop(loopingSoundIndex, volume, position, loopingSound.range); + loopingSoundIndex = loopingSound.Sound.Loop(loopingSoundIndex, volume, position, loopingSound.Range); } else { - itemSound.sound.Play(volume, itemSound.range, position); + itemSound.Sound.Play(volume, itemSound.Range, position); } } diff --git a/Subsurface/Items/Components/Ladder.cs b/Subsurface/Items/Components/Ladder.cs index 051fe78db..89f97803e 100644 --- a/Subsurface/Items/Components/Ladder.cs +++ b/Subsurface/Items/Components/Ladder.cs @@ -14,7 +14,7 @@ namespace Subsurface.Items.Components { if (picker == null) return false; - picker.animController.anim = AnimController.Animation.Climbing; + picker.AnimController.Anim = AnimController.Animation.Climbing; //picker.SelectedConstruction = item; return true; diff --git a/Subsurface/Items/Components/Machines/Controller.cs b/Subsurface/Items/Components/Machines/Controller.cs index 1e4f2c072..2c5067435 100644 --- a/Subsurface/Items/Components/Machines/Controller.cs +++ b/Subsurface/Items/Components/Machines/Controller.cs @@ -80,7 +80,7 @@ namespace Subsurface.Items.Components if (character != null) { character.SelectedConstruction = null; - character.animController.anim = AnimController.Animation.None; + character.AnimController.Anim = AnimController.Animation.None; character = null; } isActive = false; @@ -89,33 +89,33 @@ namespace Subsurface.Items.Components ApplyStatusEffects(ActionType.OnActive, deltaTime, character); - if (userPos != 0.0f && character.animController.anim != AnimController.Animation.UsingConstruction) + if (userPos != 0.0f && character.AnimController.Anim != AnimController.Animation.UsingConstruction) { - Limb torso = character.animController.GetLimb(LimbType.Torso); + Limb torso = character.AnimController.GetLimb(LimbType.Torso); float torsoX = ConvertUnits.ToDisplayUnits(torso.SimPosition.X); if (Math.Abs(torsoX - item.Rect.X + userPos) > 10.0f) { - character.animController.anim = AnimController.Animation.None; + character.AnimController.Anim = AnimController.Animation.None; - character.animController.TargetMovement = + character.AnimController.TargetMovement = new Vector2( Math.Min(Math.Max(item.Rect.X + userPos - torsoX, -1.0f), 1.0f), 0.0f); - character.animController.targetDir = (Math.Sign(torsoX - item.Rect.X + userPos) == 1) ? Direction.Right : Direction.Left; + character.AnimController.TargetDir = (Math.Sign(torsoX - item.Rect.X + userPos) == 1) ? Direction.Right : Direction.Left; return; } } if (limbPositions.Count == 0) return; - character.animController.anim = AnimController.Animation.UsingConstruction; - character.animController.ResetPullJoints(); - if (dir != 0) character.animController.targetDir = dir; + character.AnimController.Anim = AnimController.Animation.UsingConstruction; + character.AnimController.ResetPullJoints(); + if (dir != 0) character.AnimController.TargetDir = dir; foreach (LimbPos lb in limbPositions) { - Limb limb = character.animController.GetLimb(lb.limbType); + Limb limb = character.AnimController.GetLimb(lb.limbType); if (limb == null) continue; FixedMouseJoint fmj = limb.pullJoint; @@ -167,7 +167,7 @@ namespace Subsurface.Items.Components { character = null; isActive = false; - if (activator != null) activator.animController.anim = AnimController.Animation.None; + if (activator != null) activator.AnimController.Anim = AnimController.Animation.None; return false; } diff --git a/Subsurface/Items/Components/Machines/Engine.cs b/Subsurface/Items/Components/Machines/Engine.cs index 3c7b1e94c..db7f52063 100644 --- a/Subsurface/Items/Components/Machines/Engine.cs +++ b/Subsurface/Items/Components/Machines/Engine.cs @@ -30,7 +30,7 @@ namespace Subsurface.Items.Components } } - [Editable, HasDefaultValue(50000.0f, true)] + [Editable, HasDefaultValue(500.0f, true)] public float MaxForce { get { return maxForce; } @@ -62,9 +62,17 @@ namespace Subsurface.Items.Components Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f); if (Force != 0.0f) { - Submarine.Loaded.ApplyForce(new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f)); + Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f); + + Submarine.Loaded.ApplyForce(currForce); + + for (int i = 0; i < 5; i++) + { + Game1.particleManager.CreateParticle("bubbles", item.SimPosition, + -currForce/500.0f + new Vector2(Rand.Range(-1.0f, 1.0f), Rand.Range(-0.5f, 0.5f))); + } } - + voltage = 0.0f; } @@ -79,7 +87,7 @@ namespace Subsurface.Items.Components //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true); - spriteBatch.DrawString(GUI.font, "Force: " + (int)targetForce + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White); + spriteBatch.DrawString(GUI.font, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White); if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 30, 40, 40), "+", true)) targetForce += 1.0f; if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 80, 40, 40), "-", true)) targetForce -= 1.0f; @@ -96,12 +104,13 @@ namespace Subsurface.Items.Components { base.ReceiveSignal(signal, connection, sender, power); - if (connection.name == "set_force") + if (connection.Name == "set_force") { float tempForce; if (float.TryParse(signal, NumberStyles.Float, CultureInfo.InvariantCulture, out tempForce)) { - Force = tempForce; + targetForce = tempForce; + targetForce = MathHelper.Clamp(targetForce, -100.0f, 100.0f); } } } diff --git a/Subsurface/Items/Components/Machines/Fabricator.cs b/Subsurface/Items/Components/Machines/Fabricator.cs index 398799724..6e8d84d4c 100644 --- a/Subsurface/Items/Components/Machines/Fabricator.cs +++ b/Subsurface/Items/Components/Machines/Fabricator.cs @@ -90,12 +90,9 @@ namespace Subsurface.Items.Components //frame.SelectedColor = Color.Gold * 0.5f; GUITextBlock textBlock = new GUITextBlock( - new Rectangle(0, 0, 0, 25), - fi.TargetItem.Name, + new Rectangle(0, 0, 0, 25), fi.TargetItem.Name, color, Color.Black, - Alignment.Left, - Alignment.Left, - itemList); + Alignment.Left, Alignment.Left, null, itemList); textBlock.UserData = fi; textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); @@ -114,7 +111,7 @@ namespace Subsurface.Items.Components int width = 200, height = 150; selectedItemFrame = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, itemList.Rect.Bottom+20, width, height), Color.Black*0.8f); - selectedItemFrame.Padding = GUI.style.smallPadding; + //selectedItemFrame.Padding = GUI.style.smallPadding; if (targetItem.TargetItem.sprite != null) { @@ -134,10 +131,10 @@ namespace Subsurface.Items.Components text, Color.Transparent, Color.White, Alignment.CenterX | Alignment.CenterY, - Alignment.Left, + Alignment.Left, null, selectedItemFrame); - GUIButton button = new GUIButton(new Rectangle(0,0,100,20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, selectedItemFrame); + GUIButton button = new GUIButton(new Rectangle(0,0,100,20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, GUI.style, selectedItemFrame); button.OnClicked = StartFabricating; button.UserData = targetItem; diff --git a/Subsurface/Items/Components/Machines/MiniMap.cs b/Subsurface/Items/Components/Machines/MiniMap.cs index cbc32393a..48c25d061 100644 --- a/Subsurface/Items/Components/Machines/MiniMap.cs +++ b/Subsurface/Items/Components/Machines/MiniMap.cs @@ -67,9 +67,9 @@ namespace Subsurface.Items.Components GUI.DrawRectangle(spriteBatch, hullRect, Color.White); } - foreach (Character c in Character.characterList) + foreach (Character c in Character.CharacterList) { - if (c.animController.CurrentHull!=null) continue; + if (c.AnimController.CurrentHull!=null) continue; Rectangle characterRect = new Rectangle( miniMap.X + (int)((c.Position.X - Submarine.Borders.X) * size), diff --git a/Subsurface/Items/Components/Machines/OxygenGenerator.cs b/Subsurface/Items/Components/Machines/OxygenGenerator.cs index 75e6bcc13..0d6f6c187 100644 --- a/Subsurface/Items/Components/Machines/OxygenGenerator.cs +++ b/Subsurface/Items/Components/Machines/OxygenGenerator.cs @@ -36,7 +36,7 @@ namespace Subsurface.Items.Components currPowerConsumption = powerConsumption; - if (item.currentHull == null) return; + if (item.CurrentHull == null) return; if (voltage < minVoltage) { @@ -56,7 +56,7 @@ namespace Subsurface.Items.Components running = true; float deltaOxygen = Math.Min(voltage, 1.0f) * 50000.0f; - item.currentHull.Oxygen += deltaOxygen * deltaTime; + item.CurrentHull.Oxygen += deltaOxygen * deltaTime; UpdateVents(deltaOxygen); diff --git a/Subsurface/Items/Components/Machines/Pump.cs b/Subsurface/Items/Components/Machines/Pump.cs index 26b3db691..5d6db21a5 100644 --- a/Subsurface/Items/Components/Machines/Pump.cs +++ b/Subsurface/Items/Components/Machines/Pump.cs @@ -10,6 +10,8 @@ namespace Subsurface.Items.Components float flowPercentage; float maxFlow; + float? targetLevel; + //bool flowIn; Hull hull1, hull2; @@ -41,7 +43,18 @@ namespace Subsurface.Items.Components float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage; //flowPercentage = maxFlow * powerFactor; - float deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor; + float deltaVolume = 0.0f; + if (targetLevel!=null) + { + float hullPercentage = 0.0f; + if (hull1 != null) hullPercentage = (hull1.Volume / hull1.FullVolume)*100.0f; + deltaVolume = ((float)targetLevel - hullPercentage)/100.0f * maxFlow * powerFactor; + } + else + { + deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor; + } + hull1.Volume += deltaVolume; if (hull2 != null) hull2.Volume -= deltaVolume; @@ -139,15 +152,15 @@ namespace Subsurface.Items.Components isActive = true; - if (connection.name == "toggle") + if (connection.Name == "toggle") { isActive = !isActive; } - else if (connection.name == "set_active") + else if (connection.Name == "set_active") { isActive = (signal != "0"); } - else if (connection.name == "set_speed") + else if (connection.Name == "set_speed") { float tempSpeed; if (float.TryParse(signal, NumberStyles.Float, CultureInfo.InvariantCulture, out tempSpeed)) @@ -155,6 +168,14 @@ namespace Subsurface.Items.Components flowPercentage = MathHelper.Clamp(tempSpeed, -100.0f, 100.0f); } } + else if (connection.Name == "set_targetlevel") + { + float tempTarget; + if (float.TryParse(signal, NumberStyles.Float, CultureInfo.InvariantCulture, out tempTarget)) + { + targetLevel = MathHelper.Clamp(tempTarget, 0.0f, 100.0f); + } + } } diff --git a/Subsurface/Items/Components/Machines/Radar.cs b/Subsurface/Items/Components/Machines/Radar.cs index e38f65e58..59c7af06f 100644 --- a/Subsurface/Items/Components/Machines/Radar.cs +++ b/Subsurface/Items/Components/Machines/Radar.cs @@ -55,7 +55,7 @@ namespace Subsurface.Items.Components float scale = 0.01f; - List edges = Level.Loaded.GetCellEdges(-Level.Loaded.position, 5); + List edges = Level.Loaded.GetCellEdges(-Level.Loaded.Position, 5); Vector2 offset = Vector2.Zero; //Level.Loaded.position; //offset.Y = -offset.Y; diff --git a/Subsurface/Items/Components/Machines/Reactor.cs b/Subsurface/Items/Components/Machines/Reactor.cs index 2a34e610f..7a7a0927e 100644 --- a/Subsurface/Items/Components/Machines/Reactor.cs +++ b/Subsurface/Items/Components/Machines/Reactor.cs @@ -181,10 +181,10 @@ namespace Subsurface.Items.Components //the power generated by the reactor is equal to the temperature currPowerConsumption = -temperature*powerPerTemp; - if (item.currentHull != null) + if (item.CurrentHull != null) { //the sound can be heard from 20 000 display units away when everything running at 100% - item.currentHull.SoundRange += (coolingRate + fissionRate) * 100; + item.CurrentHull.SoundRange += (coolingRate + fissionRate) * 100; } UpdateGraph(deltaTime); diff --git a/Subsurface/Items/Components/Machines/Steering.cs b/Subsurface/Items/Components/Machines/Steering.cs index 95b3d9721..8ce407bd1 100644 --- a/Subsurface/Items/Components/Machines/Steering.cs +++ b/Subsurface/Items/Components/Machines/Steering.cs @@ -68,7 +68,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - if (connection.name == "velocity_in") + if (connection.Name == "velocity_in") { currVelocity = ToolBox.ParseToVector2(signal, false); } diff --git a/Subsurface/Items/Components/Machines/Vent.cs b/Subsurface/Items/Components/Machines/Vent.cs index eb813b5ee..07191494d 100644 --- a/Subsurface/Items/Components/Machines/Vent.cs +++ b/Subsurface/Items/Components/Machines/Vent.cs @@ -23,9 +23,9 @@ namespace Subsurface.Items.Components { base.Update(deltaTime, cam); - if (item.currentHull == null) return; + if (item.CurrentHull == null) return; - item.currentHull.Oxygen += oxygenFlow * deltaTime; + item.CurrentHull.Oxygen += oxygenFlow * deltaTime; OxygenFlow -= deltaTime * 1000.0f; } } diff --git a/Subsurface/Items/Components/Power/PowerTransfer.cs b/Subsurface/Items/Components/Power/PowerTransfer.cs index e8990bc83..92117fe25 100644 --- a/Subsurface/Items/Components/Power/PowerTransfer.cs +++ b/Subsurface/Items/Components/Power/PowerTransfer.cs @@ -141,7 +141,7 @@ namespace Subsurface.Items.Components { base.ReceiveSignal(signal, connection, sender, power); - if (connection.name=="signal") + if (connection.Name=="signal") { connection.SendSignal(signal, item, 0.0f); } diff --git a/Subsurface/Items/Components/Power/Powered.cs b/Subsurface/Items/Components/Power/Powered.cs index 219b683f2..092e5b979 100644 --- a/Subsurface/Items/Components/Power/Powered.cs +++ b/Subsurface/Items/Components/Power/Powered.cs @@ -61,7 +61,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power) { - if (connection.name=="power_in") voltage = power; + if (connection.Name=="power_in") voltage = power; } public override void Update(float deltaTime, Camera cam) diff --git a/Subsurface/Items/Components/Projectile.cs b/Subsurface/Items/Components/Projectile.cs index 6a2f04b70..1f0b3e97e 100644 --- a/Subsurface/Items/Components/Projectile.cs +++ b/Subsurface/Items/Components/Projectile.cs @@ -106,7 +106,7 @@ namespace Subsurface.Items.Components if (stickJoint != null && doesStick) { if (stickTarget!=null) item.body.FarseerBody.RestoreCollisionWith(stickTarget); - Game1.world.RemoveJoint(stickJoint); + Game1.World.RemoveJoint(stickJoint); stickJoint = null; } } @@ -122,7 +122,7 @@ namespace Subsurface.Items.Components item.body.FarseerBody.RestoreCollisionWith(stickTarget); } - Game1.world.RemoveJoint(stickJoint); + Game1.World.RemoveJoint(stickJoint); stickJoint = null; isActive = false; @@ -181,7 +181,7 @@ namespace Subsurface.Items.Components ignoredBodies.Clear(); - if (attackResult.hitArmor) + if (attackResult.HitArmor) { item.body.LinearVelocity *= 0.5f; } @@ -211,7 +211,7 @@ namespace Subsurface.Items.Components item.body.FarseerBody.IgnoreCollisionWith(targetBody); stickTarget = targetBody; - Game1.world.AddJoint(stickJoint); + Game1.World.AddJoint(stickJoint); isActive = true; diff --git a/Subsurface/Items/Components/Rope.cs b/Subsurface/Items/Components/Rope.cs index 4edf38726..e3f1c45bc 100644 --- a/Subsurface/Items/Components/Rope.cs +++ b/Subsurface/Items/Components/Rope.cs @@ -90,7 +90,7 @@ namespace Subsurface.Items.Components Vertices box = PolygonTools.CreateRectangle(sectionLength, 0.05f); PolygonShape shape = new PolygonShape(box, 5); - ListropeList = PathManager.EvenlyDistributeShapesAlongPath(Game1.world, ropePath, shape, BodyType.Dynamic, (int)(length/sectionLength)); + ListropeList = PathManager.EvenlyDistributeShapesAlongPath(Game1.World, ropePath, shape, BodyType.Dynamic, (int)(length/sectionLength)); ropeBodies = new PhysicsBody[ropeList.Count()]; for (int i = 0; i joints = PathManager.AttachBodiesWithRevoluteJoint(Game1.world, ropeList, + List joints = PathManager.AttachBodiesWithRevoluteJoint(Game1.World, ropeList, new Vector2(-sectionLength/2, 0.0f), new Vector2(sectionLength/2, 0.0f), false, false); ropeJoints = new RevoluteJoint[joints.Count+1]; //ropeJoints[0] = JointFactory.CreateRevoluteJoint(Game1.world, item.body, ropeList[0], new Vector2(0f, -0.0f)); for (int i = 0; i < joints.Count; i++) { - var distanceJoint = JointFactory.CreateDistanceJoint(Game1.world, ropeList[i], ropeList[i + 1]); + var distanceJoint = JointFactory.CreateDistanceJoint(Game1.World, ropeList[i], ropeList[i + 1]); distanceJoint.Length = sectionLength; distanceJoint.DampingRatio = 1.0f; @@ -299,8 +299,8 @@ namespace Subsurface.Items.Components ropeBodies[ropeBodies.Length - 1].SetTransform(projectile.body.Position, projectile.body.Rotation); //attach projectile to the last section of the rope - if (ropeJoints[ropeJoints.Length-1] != null) Game1.world.RemoveJoint(ropeJoints[ropeJoints.Length-1]); - ropeJoints[ropeJoints.Length - 1] = JointFactory.CreateRevoluteJoint(Game1.world, + if (ropeJoints[ropeJoints.Length-1] != null) Game1.World.RemoveJoint(ropeJoints[ropeJoints.Length-1]); + ropeJoints[ropeJoints.Length - 1] = JointFactory.CreateRevoluteJoint(Game1.World, projectile.body.FarseerBody, ropeBodies[ropeBodies.Length - 1].FarseerBody, projectileAnchor, new Vector2(sectionLength / 2, 0.0f)); @@ -315,7 +315,7 @@ namespace Subsurface.Items.Components body.SetTransform(TransformedBarrelPos, rotation); //Vector2 axis = new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)); - if (gunJoint != null) Game1.world.RemoveJoint(gunJoint); + if (gunJoint != null) Game1.World.RemoveJoint(gunJoint); gunJoint = new DistanceJoint(item.body.FarseerBody, body, BarrelPos, new Vector2(sectionLength / 2, 0.0f)); @@ -328,7 +328,7 @@ namespace Subsurface.Items.Components //gunJoint.LimitEnabled = true; //gunJoint.ReferenceAngle = 0.0f; - Game1.world.AddJoint(gunJoint); + Game1.World.AddJoint(gunJoint); } } diff --git a/Subsurface/Items/Components/Signal/AndComponent.cs b/Subsurface/Items/Components/Signal/AndComponent.cs index 085a4b896..e19898ce9 100644 --- a/Subsurface/Items/Components/Signal/AndComponent.cs +++ b/Subsurface/Items/Components/Signal/AndComponent.cs @@ -55,7 +55,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - switch (connection.name) + switch (connection.Name) { case "signal_in1": if (signal == "0") return; diff --git a/Subsurface/Items/Components/Signal/Connection.cs b/Subsurface/Items/Components/Signal/Connection.cs index 40685a15d..6b3b00478 100644 --- a/Subsurface/Items/Components/Signal/Connection.cs +++ b/Subsurface/Items/Components/Signal/Connection.cs @@ -16,13 +16,13 @@ namespace Subsurface.Items.Components //how many wires can be linked to a single connector private const int MaxLinked = 5; - public readonly string name; + public readonly string Name; - public Wire[] wires; + public Wire[] Wires; private Item item; - public readonly bool isOutput; + public readonly bool IsOutput; private static Item draggingConnected; @@ -35,8 +35,8 @@ namespace Subsurface.Items.Components List recipients = new List(); for (int i = 0; i-1) { - Inventory.draggingItem = c.wires[linkIndex].Item; + Inventory.draggingItem = c.Wires[linkIndex].Item; } } //outputs are drawn at the right side of the panel, inputs at the left - if (c.isOutput) + if (c.IsOutput) { c.Draw(spriteBatch, panel.Item, rightPos, new Vector2(rightPos.X + 20, rightPos.Y), @@ -235,7 +235,7 @@ namespace Subsurface.Items.Components //and the wire hasn't been connected yet, draw it on the panel if (equippedWire!=null) { - if (panel.connections.Find(c => c.wires.Contains(equippedWire)) == null) + if (panel.connections.Find(c => c.Wires.Contains(equippedWire)) == null) { DrawWire(spriteBatch, equippedWire.Item, equippedWire.Item, new Vector2(x + width / 2, y + height - 100), @@ -274,19 +274,19 @@ namespace Subsurface.Items.Components private void Draw(SpriteBatch spriteBatch, Item item, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, bool wireEquipped) { - spriteBatch.DrawString(GUI.font, name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); + spriteBatch.DrawString(GUI.font, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); GUI.DrawRectangle(spriteBatch, new Rectangle((int)position.X-10, (int)position.Y-10, 20, 20), Color.White); for (int i = 0; i see if the wire can be connected to this connection @@ -301,9 +301,9 @@ namespace Subsurface.Items.Components Wire wireComponent = draggingConnected.GetComponent(); - if (index>-1 && wireComponent!=null && !wires.Contains(wireComponent)) + if (index>-1 && wireComponent!=null && !Wires.Contains(wireComponent)) { - wires[index] = wireComponent; + Wires[index] = wireComponent; wireComponent.Connect(this); } } @@ -313,11 +313,11 @@ namespace Subsurface.Items.Components int index = FindWireIndex(draggingConnected); if (index>-1) { - wires[index].RemoveConnection(this); - wires[index].Item.SetTransform(item.SimPosition, 0.0f); - wires[index].Item.Drop(); - wires[index].Item.body.Enabled = true; - wires[index] = null; + Wires[index].RemoveConnection(this); + Wires[index].Item.SetTransform(item.SimPosition, 0.0f); + Wires[index].Item.Drop(); + Wires[index].Item.body.Enabled = true; + Wires[index] = null; } } } @@ -396,9 +396,9 @@ namespace Subsurface.Items.Components public void Save(XElement parentElement) { - XElement newElement = new XElement(isOutput ? "output" : "input", new XAttribute("name", name)); + XElement newElement = new XElement(IsOutput ? "output" : "input", new XAttribute("name", Name)); - Array.Sort(wires, delegate(Wire wire1, Wire wire2) + Array.Sort(Wires, delegate(Wire wire1, Wire wire2) { if (wire1 == null) return 1; if (wire2 == null) return -1; @@ -407,13 +407,13 @@ namespace Subsurface.Items.Components for (int i = 0; i < MaxLinked; i++ ) { - if (wires[i] == null) continue; + if (Wires[i] == null) continue; //Connection recipient = wires[i].OtherConnection(this); //int connectionIndex = recipient.item.Connections.FindIndex(x => x == recipient); newElement.Add(new XElement("link", - new XAttribute("w", wires[i].Item.ID.ToString()))); + new XAttribute("w", Wires[i].Item.ID.ToString()))); } parentElement.Add(newElement); @@ -432,12 +432,12 @@ namespace Subsurface.Items.Components Item wireItem = MapEntity.FindEntityByID(wireId[i]) as Item; if (wireItem == null) continue; - wires[i] = wireItem.GetComponent(); + Wires[i] = wireItem.GetComponent(); - if (wires[i]!=null) + if (Wires[i]!=null) { - wires[i].Item.body.Enabled = false; - wires[i].Connect(this, false); + Wires[i].Item.body.Enabled = false; + Wires[i].Connect(this, false); } } diff --git a/Subsurface/Items/Components/Signal/ConnectionPanel.cs b/Subsurface/Items/Components/Signal/ConnectionPanel.cs index a331234a5..4b48bea80 100644 --- a/Subsurface/Items/Components/Signal/ConnectionPanel.cs +++ b/Subsurface/Items/Components/Signal/ConnectionPanel.cs @@ -107,10 +107,10 @@ namespace Subsurface.Items.Components { foreach (Connection c in connections) { - int wireCount = c.wires.Length; + int wireCount = c.Wires.Length; for (int i = 0 ; i < wireCount; i++) { - message.Write(c.wires[i]==null ? -1 : c.wires[i].Item.ID); + message.Write(c.Wires[i]==null ? -1 : c.Wires[i].Item.ID); } } } @@ -120,7 +120,7 @@ namespace Subsurface.Items.Components System.Diagnostics.Debug.WriteLine("connectionpanel update"); foreach (Connection c in connections) { - int wireCount = c.wires.Length; + int wireCount = c.Wires.Length; c.ClearConnections(); for (int i = 0; i < wireCount; i++) @@ -134,7 +134,7 @@ namespace Subsurface.Items.Components Wire wireComponent = wireItem.GetComponent(); if (wireComponent == null) continue; - c.wires[i] = wireComponent; + c.Wires[i] = wireComponent; wireComponent.Connect(c, false); } } diff --git a/Subsurface/Items/Components/Signal/LightComponent.cs b/Subsurface/Items/Components/Signal/LightComponent.cs index b95338896..3feb0201b 100644 --- a/Subsurface/Items/Components/Signal/LightComponent.cs +++ b/Subsurface/Items/Components/Signal/LightComponent.cs @@ -40,7 +40,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - switch (connection.name) + switch (connection.Name) { case "toggle": isActive = !isActive; diff --git a/Subsurface/Items/Components/Signal/NotComponent.cs b/Subsurface/Items/Components/Signal/NotComponent.cs index e02b80952..7515f78e9 100644 --- a/Subsurface/Items/Components/Signal/NotComponent.cs +++ b/Subsurface/Items/Components/Signal/NotComponent.cs @@ -11,7 +11,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - if (connection.name != "signal_in") return; + if (connection.Name != "signal_in") return; item.SendSignal(signal=="0" ? "1" : "0", "signal_out"); } diff --git a/Subsurface/Items/Components/Signal/RegExFindComponent.cs b/Subsurface/Items/Components/Signal/RegExFindComponent.cs index 5aa9483e1..c247038c1 100644 --- a/Subsurface/Items/Components/Signal/RegExFindComponent.cs +++ b/Subsurface/Items/Components/Signal/RegExFindComponent.cs @@ -30,7 +30,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) { - switch (connection.name) + switch (connection.Name) { case "signal_in": if (string.IsNullOrWhiteSpace(expression)) return; diff --git a/Subsurface/Items/Components/Signal/Wire.cs b/Subsurface/Items/Components/Signal/Wire.cs index 8c238b175..240d474ae 100644 --- a/Subsurface/Items/Components/Signal/Wire.cs +++ b/Subsurface/Items/Components/Signal/Wire.cs @@ -123,15 +123,15 @@ namespace Subsurface.Items.Components Vector2 position = item.Position; position.X = MathUtils.Round(item.Position.X, nodeDistance); - if (item.currentHull == null) + if (item.CurrentHull == null) { position.Y = MathUtils.Round(item.Position.Y, nodeDistance); } else { - position.Y -= item.currentHull.Rect.Y - item.currentHull.Rect.Height; + position.Y -= item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height; position.Y = Math.Max(MathUtils.Round(position.Y, nodeDistance), heightFromFloor); - position.Y += item.currentHull.Rect.Y - item.currentHull.Rect.Height; + position.Y += item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height; } newNodePos = position; diff --git a/Subsurface/Items/Components/Turret.cs b/Subsurface/Items/Components/Turret.cs index 079b06b9e..fcd4ec371 100644 --- a/Subsurface/Items/Components/Turret.cs +++ b/Subsurface/Items/Components/Turret.cs @@ -137,7 +137,7 @@ namespace Subsurface.Items.Components if (character == Character.Controlled && cam!=null) { - Lights.LightManager.viewPos = centerPos; + Lights.LightManager.ViewPos = centerPos; cam.TargetPos = new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y); } } diff --git a/Subsurface/Items/Components/Wearable.cs b/Subsurface/Items/Components/Wearable.cs index db693fd27..6333d6f92 100644 --- a/Subsurface/Items/Components/Wearable.cs +++ b/Subsurface/Items/Components/Wearable.cs @@ -55,7 +55,7 @@ namespace Subsurface.Items.Components picker = character; for (int i = 0; i < sprite.Length; i++ ) { - Limb equipLimb = character.animController.GetLimb(limbType[i]); + Limb equipLimb = character.AnimController.GetLimb(limbType[i]); if (equipLimb == null) continue; //something is already on the limb -> unequip it @@ -91,7 +91,7 @@ namespace Subsurface.Items.Components if (picker == null) return; for (int i = 0; i < sprite.Length; i++) { - Limb equipLimb = character.animController.GetLimb(limbType[i]); + Limb equipLimb = character.AnimController.GetLimb(limbType[i]); if (equipLimb == null) continue; if (equipLimb.WearingItem != item) continue; diff --git a/Subsurface/Items/Item.cs b/Subsurface/Items/Item.cs index 51966c5b5..f66989118 100644 --- a/Subsurface/Items/Item.cs +++ b/Subsurface/Items/Item.cs @@ -27,7 +27,7 @@ namespace Subsurface private List tags; - public Hull currentHull; + public Hull CurrentHull; //components that determine the functionality of the item public List components; @@ -318,8 +318,8 @@ namespace Subsurface public virtual Hull FindHull() { - currentHull = Hull.FindHull((body == null) ? Position : ConvertUnits.ToDisplayUnits(body.Position), currentHull); - return currentHull; + CurrentHull = Hull.FindHull((body == null) ? Position : ConvertUnits.ToDisplayUnits(body.Position), CurrentHull); + return CurrentHull; } @@ -441,9 +441,9 @@ namespace Subsurface body.SetToTargetPosition(); - if (currentHull != null) + if (CurrentHull != null) { - float surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface); + float surfaceY = ConvertUnits.ToSimUnits(CurrentHull.Surface); if (surfaceY > body.Position.Y) return; //the item has gone through the surface of the water -> apply an impulse which serves as surface tension @@ -451,8 +451,8 @@ namespace Subsurface { Vector2 impulse = -body.LinearVelocity * (body.Mass / body.Density); body.ApplyLinearImpulse(impulse); - int n = (int)((displayPos.X - currentHull.Rect.X) / Hull.WaveWidth); - currentHull.WaveVel[n] = impulse.Y * 10.0f; + int n = (int)((displayPos.X - CurrentHull.Rect.X) / Hull.WaveWidth); + CurrentHull.WaveVel[n] = impulse.Y * 10.0f; } } @@ -509,7 +509,7 @@ namespace Subsurface GUI.DrawRectangle(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), Color.Green); - foreach (Rectangle t in prefab.triggers) + foreach (Rectangle t in prefab.Triggers) { Rectangle transformedTrigger = TransformTrigger(t); GUI.DrawRectangle(spriteBatch, @@ -574,7 +574,7 @@ namespace Subsurface editingHUD.Padding = new Vector4(10, 10, 0, 0); editingHUD.UserData = this; - new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, Color.Transparent, Color.White, Alignment.Left, editingHUD); + new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, GUI.style, editingHUD); y += 20; @@ -582,7 +582,7 @@ namespace Subsurface { if (prefab.IsLinkable) { - new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another construction", Color.Transparent, Color.White, Alignment.Left, editingHUD); + new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another construction", GUI.style, editingHUD); y += 25; } foreach (ItemComponent ic in components) @@ -590,8 +590,8 @@ namespace Subsurface foreach (RelatedItem relatedItem in ic.requiredItems) { - new GUITextBlock(new Rectangle(0, y, 100, 20),ic.Name+ ": "+relatedItem.Type.ToString()+" required", Color.Transparent, Color.White, Alignment.Left, editingHUD); - GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Color.White, Color.Black, Alignment.Right, Alignment.Left, editingHUD); + new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.style, editingHUD); + GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Alignment.Right, GUI.style, editingHUD); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem); PropertyDescriptor property = properties.Find("JoinedNames", false); @@ -609,8 +609,8 @@ namespace Subsurface foreach (var objectProperty in editableProperties) { - new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, editingHUD); - GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), Color.White, Color.Black, Alignment.Left, Alignment.Left, editingHUD); + new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, null, editingHUD); + GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.style, editingHUD); object value = objectProperty.GetValue(); if (value != null) @@ -647,7 +647,7 @@ namespace Subsurface if (panel == null) return; foreach (Connection c in panel.connections) { - if (c.name != connectionName) continue; + if (c.Name != connectionName) continue; c.SendSignal(signal, this, power); } @@ -669,13 +669,13 @@ namespace Subsurface foreach (Item item in itemList) { if (ignoredItems!=null && ignoredItems.Contains(item)) continue; - if (hull != null && item.currentHull != hull) continue; + if (hull != null && item.CurrentHull != hull) continue; if (item.body != null && !item.body.Enabled) continue; Pickable pickableComponent = item.GetComponent(); if (pickableComponent != null && (pickableComponent.Picker != null && !pickableComponent.Picker.IsDead)) continue; - foreach (Rectangle trigger in item.prefab.triggers) + foreach (Rectangle trigger in item.prefab.Triggers) { Rectangle transformedTrigger = item.TransformTrigger(trigger); diff --git a/Subsurface/Items/ItemInventory.cs b/Subsurface/Items/ItemInventory.cs index 5fd589516..d355df0e3 100644 --- a/Subsurface/Items/ItemInventory.cs +++ b/Subsurface/Items/ItemInventory.cs @@ -43,7 +43,7 @@ namespace Subsurface if (wasPut) { - foreach (Character c in Character.characterList) + foreach (Character c in Character.CharacterList) { if (!c.HasSelectedItem(item)) continue; diff --git a/Subsurface/Items/ItemPrefab.cs b/Subsurface/Items/ItemPrefab.cs index 452e6d425..8ed6b2518 100644 --- a/Subsurface/Items/ItemPrefab.cs +++ b/Subsurface/Items/ItemPrefab.cs @@ -23,14 +23,14 @@ namespace Subsurface protected Vector2 size; //how close the character has to be to the item to pick it up - float pickDistance; + private float pickDistance; //public List sounds; //an area next to the construction //the construction can be Activated() by a character inside the area - public List triggers; + public List Triggers; public string ConfigFile { @@ -177,7 +177,7 @@ namespace Subsurface offsetOnSelected = ToolBox.GetAttributeFloat(element, "offsetonselected", 0.0f); - triggers = new List(); + Triggers = new List(); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLower()) @@ -195,7 +195,7 @@ namespace Subsurface trigger.Width = ToolBox.GetAttributeInt(subElement, "width", 0); trigger.Height = ToolBox.GetAttributeInt(subElement, "height", 0); - triggers.Add(trigger); + Triggers.Add(trigger); break; } diff --git a/Subsurface/Map/Entity.cs b/Subsurface/Map/Entity.cs index 6c197ba54..c3f456773 100644 --- a/Subsurface/Map/Entity.cs +++ b/Subsurface/Map/Entity.cs @@ -25,6 +25,7 @@ namespace Subsurface Entity existingEntity; if (dictionary.TryGetValue(value, out existingEntity)) { + System.Diagnostics.Debug.WriteLine(existingEntity+" had the same ID as "+this); dictionary.Remove(value); dictionary.Add(id, existingEntity); existingEntity.id = id; diff --git a/Subsurface/Map/Explosion.cs b/Subsurface/Map/Explosion.cs index 55f2ad76e..64b20cf53 100644 --- a/Subsurface/Map/Explosion.cs +++ b/Subsurface/Map/Explosion.cs @@ -48,8 +48,7 @@ namespace Subsurface for (int i = 0; i() @@ -210,7 +210,7 @@ namespace Subsurface for (int i = 0; i < waveY.Length; i++) { float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i])); - if (maxDelta > MathUtils.RandomFloatLocal(0.2f,10.0f)) + if (maxDelta > Rand.Range(0.2f,10.0f)) { Game1.particleManager.CreateParticle("mist", ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])), diff --git a/Subsurface/Map/Level.cs b/Subsurface/Map/Level.cs index a73ed17ef..fb9e100b2 100644 --- a/Subsurface/Map/Level.cs +++ b/Subsurface/Map/Level.cs @@ -20,7 +20,7 @@ namespace Subsurface static Level loaded; - private int seed; + private string seed; private int siteInterval; @@ -45,7 +45,12 @@ namespace Subsurface get { return startPosition; } } - public Level(int seed, int width, int height, int siteInterval) + public Vector2 Position + { + get { return ConvertUnits.ToDisplayUnits(cells[0].body.Position); } + } + + public Level(string seed, int width, int height, int siteInterval) { this.seed = seed; @@ -54,9 +59,14 @@ namespace Subsurface borders = new Rectangle(0, 0, width, height); } - public static Level CreateRandom() + public static Level CreateRandom(string seed = "") { - return new Level(100, 100000, 40000, 2000); + + if (seed == "") + { + seed = Rand.Range(0, int.MaxValue).ToString(); + } + return new Level((string)seed, 100000, 40000, 2000); } public void Generate(float minWidth) @@ -64,7 +74,7 @@ namespace Subsurface Stopwatch sw = new Stopwatch(); sw.Start(); - Game1.random = new Random(seed); + //Game1.random = new Random(ToolBox.SeedToInt(seed)); if (loaded != null) { @@ -76,7 +86,7 @@ namespace Subsurface Voronoi voronoi = new Voronoi(1.0); List sites = new List(); - Random rand = new Random(seed); + Random rand = new Random(ToolBox.SeedToInt(seed)); float siteVariance = siteInterval * 0.8f; for (int x = siteInterval/2; x < borders.Width; x += siteInterval) @@ -84,8 +94,8 @@ namespace Subsurface for (int y = siteInterval / 2; y < borders.Height; y += siteInterval) { sites.Add(new Vector2( - x + (float)(Game1.random.NextDouble() - 0.5) * siteVariance, - y + (float)(Game1.random.NextDouble() - 0.5) * siteVariance)); + x + (float)(rand.NextDouble() - 0.5) * siteVariance, + y + (float)(rand.NextDouble() - 0.5) * siteVariance)); } } @@ -146,25 +156,28 @@ namespace Subsurface borders.X + (int)minWidth, borders.Y + (int)minWidth, borders.Right - (int)minWidth, borders.Y + borders.Height - (int)minWidth); - List pathCells = GeneratePath( - new Vector2((int)minWidth, Game1.random.Next((int)minWidth, borders.Height - (int)minWidth)), - new Vector2(borders.Width - (int)minWidth, Game1.random.Next((int)minWidth, borders.Height - (int)minWidth)), + List pathCells = GeneratePath(rand, + new Vector2((int)minWidth, rand.Next((int)minWidth, borders.Height - (int)minWidth)), + new Vector2(borders.Width - (int)minWidth, rand.Next((int)minWidth, borders.Height - (int)minWidth)), cells, pathBorders, minWidth); //generate a couple of random paths - for (int i = 0; i < Game1.random.Next() % 3; i++ ) + for (int i = 0; i < rand.Next() % 3; i++ ) { pathBorders = new Rectangle( borders.X + siteInterval * 2, borders.Y - siteInterval * 2, borders.Right - siteInterval * 2, borders.Y + borders.Height - siteInterval * 2); - Vector2 start = pathCells[Game1.random.Next(1,pathCells.Count-2)].Center; - Vector2 end = new Vector2(MathUtils.RandomFloat(pathBorders.X, pathBorders.Right), MathUtils.RandomFloat(pathBorders.Y, pathBorders.Bottom)); + Vector2 start = pathCells[rand.Next(1,pathCells.Count-2)].Center; + float x = pathBorders.X + (float)rand.NextDouble() * (pathBorders.Right - pathBorders.X); + float y = pathBorders.Y + (float)rand.NextDouble() * (pathBorders.Bottom - pathBorders.Y); + Vector2 end = new Vector2(x,y); + pathCells.AddRange ( - GeneratePath( start,end, cells, pathBorders, 0.0f) + GeneratePath(rand, start,end, cells, pathBorders, 0.0f, 0.8f) ); } @@ -221,7 +234,7 @@ namespace Subsurface Debug.WriteLine("Generated a map with "+sites.Count+" sites in "+sw.ElapsedMilliseconds+" ms"); } - private List GeneratePath(Vector2 start, Vector2 end, List cells, Microsoft.Xna.Framework.Rectangle limits, float minWidth, float wanderAmount = 0.3f) + private List GeneratePath(Random rand, Vector2 start, Vector2 end, List cells, Microsoft.Xna.Framework.Rectangle limits, float minWidth, float wanderAmount = 0.3f) { Stopwatch sw2 = new Stopwatch(); @@ -243,7 +256,7 @@ namespace Subsurface int edgeIndex = 0; //steer towards target - if (Game1.random.NextDouble()>wanderAmount) + if (rand.NextDouble()>wanderAmount) { for (int i = 0; i < currentCell.edges.Count; i++) { @@ -264,7 +277,7 @@ namespace Subsurface allowedEdges.Add(edge); } edgeIndex = (allowedEdges.Count==0) ? - 0 : currentCell.edges.IndexOf(allowedEdges[Game1.random.Next() % allowedEdges.Count]); + 0 : currentCell.edges.IndexOf(allowedEdges[rand.Next() % allowedEdges.Count]); } currentCell = currentCell.edges[edgeIndex].AdjacentCell(currentCell); @@ -412,45 +425,6 @@ namespace Subsurface return cells.IndexOf(closestCell); } - private void GenerateBodies(List cells, List emptyCells) - { - foreach (VoronoiCell cell in cells) - { - List points = new List(); - foreach (GraphEdge edge in cell.edges) - { - VoronoiCell adjacentCell = edge.AdjacentCell(cell); - if (!emptyCells.Contains(adjacentCell)) continue; - - if (!points.Contains(edge.point1)) points.Add(edge.point1); - if (!points.Contains(edge.point2)) points.Add(edge.point2); - - - } - - if (points.Count == 0) continue; - - for (int i = 0 ; i cells, List emptyCells) { List verticeList = new List(); @@ -490,8 +464,8 @@ namespace Subsurface int lastIndex = 1; for (int i = 0; i < triangleCount; i++ ) { - List triangleVertices = new List(); - + //simple triangulation + List triangleVertices = new List(); triangleVertices.Add(tempVertices[0]); for (int j = lastIndex; j<=lastIndex+1; j++) { @@ -504,31 +478,43 @@ namespace Subsurface verticeList.Add(new VertexPositionColor(new Vector3(vertex, 0.0f), Color.LightGray*0.8f));//new Color(n,(n*2)%255,(n*3)%255)*0.5f)); } - bool isSame = false; - if (triangleVertices[0].Y == triangleVertices[1].Y && triangleVertices[1].Y == triangleVertices[2].Y) isSame = true; - if (triangleVertices[0].X == triangleVertices[1].X && triangleVertices[1].X == triangleVertices[2].X) isSame = true; + //bool isSame = false; + //if (triangleVertices[0].Y == triangleVertices[1].Y && triangleVertices[1].Y == triangleVertices[2].Y) isSame = true; + //if (triangleVertices[0].X == triangleVertices[1].X && triangleVertices[1].X == triangleVertices[2].X) isSame = true; - if (isSame) continue; + //if (isSame) continue; //CreateBody(cell, triangleVertices); } if (bodyPoints.Count < 2) continue; + + //todo: make sure the first point is the one where the edge should start from bodyPoints.Sort(new CompareCCW(cell.Center)); + if (bodyPoints.Count == tempVertices.Count) + { + + } + for (int i = 0; i < bodyPoints.Count; i++) { + cell.bodyVertices.Add(bodyPoints[i]); bodyPoints[i] = ConvertUnits.ToSimUnits(bodyPoints[i]); } Vertices bodyVertices = new Vertices(bodyPoints); - Body edgeBody = BodyFactory.CreateChainShape( - Game1.world, bodyVertices, cell); + Body edgeBody = BodyFactory.CreateLoopShape(Game1.World, bodyVertices); + + //Body edgeBody = (bodyVertices.Count == tempVertices.Count) ? + // BodyFactory.CreateLoopShape(Game1.world, bodyVertices) : + // BodyFactory.CreateChainShape(Game1.world, bodyVertices); + edgeBody.UserData = cell; - edgeBody.BodyType = BodyType.Static; + edgeBody.BodyType = BodyType.Kinematic; edgeBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel; cell.body = edgeBody; @@ -539,75 +525,118 @@ namespace Subsurface //return bodies; } - //private void CreateBody(VoronoiCell cell, List bodyVertices) - //{ - // for (int i = 0; i < bodyVertices.Count; i++) - // { - // bodyVertices[i] = ConvertUnits.ToSimUnits(bodyVertices[i]); - // } - // //get farseer 'vertices' from vectors - // Vertices _shapevertices = new Vertices(bodyVertices); - // //_shapevertices.Sort(new CompareCCW(cell.Center)); - // //feed vertices array to BodyFactory.CreatePolygon to get a new farseer polygonal body - // Body _newBody = BodyFactory.CreatePolygon(Game1.world, _shapevertices, 15); - // _newBody.BodyType = BodyType.Static; - // _newBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel; - // _newBody.UserData = cell; - - // cell.body = _newBody; - //} - - - public Vector2 position; public void SetPosition(Vector2 pos) { - Vector2 amount = ConvertUnits.ToSimUnits(pos - position); + Vector2 amount = ConvertUnits.ToSimUnits(pos - Position); foreach (VoronoiCell cell in cells) { if (cell.body == null) continue; - //foreach (Body b in cell.bodies) - //{ + cell.body.SleepingAllowed = false; cell.body.SetTransform(cell.body.Position + amount, cell.body.Rotation); - //} } - - position = pos; } + Vector2 prevVelocity; public void Move(Vector2 amount) { - position += amount; + //position += amount; + + Vector2 velocity = amount; + Vector2 simVelocity = ConvertUnits.ToSimUnits(amount / (float)Physics.step); + + //DebugCheckPos(); - amount = ConvertUnits.ToSimUnits(amount); foreach (VoronoiCell cell in cells) { if (cell.body == null) continue; - //foreach (Body b in cell.bodies) - //{ - // b.SetTransform(b.Position+amount, b.Rotation); - //} - cell.body.SetTransform(cell.body.Position + amount, cell.body.Rotation); + cell.body.LinearVelocity = simVelocity; } - foreach (Character character in Character.characterList) + foreach (Character character in Character.CharacterList) { - if (character.animController.CurrentHull==null) + foreach (Limb limb in character.AnimController.limbs) { - foreach (Limb limb in character.animController.limbs) + //limb.body.SetTransform(limb.body.Position + amount * (float)Physics.step, limb.body.Rotation); + if (character.AnimController.CurrentHull == null) { - limb.body.SetTransform(limb.body.Position + amount, limb.body.Rotation); + limb.body.LinearVelocity += simVelocity; } + else + { + if (limb.type == LimbType.LeftFoot || limb.type == LimbType.RightFoot) continue; + limb.body.ApplyForce((simVelocity - prevVelocity) * 10.0f * limb.Mass); + } + } + } + + foreach (Item item in Item.itemList) + { + if (item.CurrentHull != null) continue; + if (item.body == null) + { + item.Move(velocity); + } + else + { + item.body.LinearVelocity += simVelocity; } } - + prevVelocity = simVelocity; } + + public static void AfterWorldStep() + { + if (loaded == null) return; + + loaded.ResetBodyVelocities(); + } + + private void ResetBodyVelocities() + { + foreach (Character character in Character.CharacterList) + { + if (character.AnimController.CurrentHull != null) continue; + + foreach (Limb limb in character.AnimController.limbs) + { + limb.body.LinearVelocity -= prevVelocity; + } + } + + foreach (Item item in Item.itemList) + { + if (item.body == null || item.CurrentHull != null) continue; + item.body.LinearVelocity -= prevVelocity; + } + } + + + + public void DebugCheckPos() + { + + Vector2 avgPos = Vector2.Zero; + foreach (VoronoiCell cell in cells) + { + if (cell.body == null) continue; + + + System.Diagnostics.Debug.WriteLine(cell.body.Position); + avgPos += cell.body.Position; + } + + System.Diagnostics.Debug.WriteLine("avgpos: "+avgPos / cells.Count); + + System.Diagnostics.Debug.WriteLine("pos: " + Position); + } + Vector2 observerPosition; public void SetObserverPosition(Vector2 position) { - observerPosition = position - this.position; + observerPosition = position - this.Position; int gridPosX = (int)Math.Floor(observerPosition.X / gridCellWidth); int gridPosY = (int)Math.Floor(observerPosition.Y / gridCellWidth); int searchOffset = 2; @@ -627,7 +656,7 @@ namespace Subsurface //foreach (Body b in cellGrid[x, y][i].bodies) //{ if (cellGrid[x, y][i].body == null) continue; - cellGrid[x, y][i].body.Enabled = (x >= startX && x <= endX && y >= startY && y <= endY); + cellGrid[x, y][i].body.Enabled = true;// (x >= startX && x <= endX && y >= startY && y <= endY); //} } } @@ -669,26 +698,30 @@ namespace Subsurface // } //} - List edges = GetCellEdges(-observerPosition); + List edges = GetCellEdges(observerPosition, 1, false); - for (int i = 0; i < edges.Count; i++ ) + //for (int i = 0; i < edges.Count; i++) + //{ + // GUI.DrawLine(spriteBatch, edges[i][0], edges[i][1], Color.Green); + //} + + foreach (VoronoiCell cell in cells) { - GUI.DrawLine(spriteBatch, edges[i][0], edges[i][1], Color.Green); + for (int i = 0; i < cell.bodyVertices.Count-1; i++) + { + Vector2 start = cell.bodyVertices[i]; + start.X += Position.X; + start.Y = -start.Y - Position.Y; + start.X += Rand.Range(-10.0f, 10.0f); + + Vector2 end = cell.bodyVertices[i+1]; + end.X += Position.X; + end.Y = -end.Y - Position.Y; + end.X += Rand.Range(-10.0f, 10.0f); + + GUI.DrawLine(spriteBatch, start, end, (cell.body != null && cell.body.Enabled) ? Color.Red : Color.Red); + } } - - //foreach (VoronoiCell cell in cells) - //{ - // for (int i = 0; i < cell.edges.Count; i++) - // { - // Vector2 start = cell.edges[i].point1 + position; - // start.Y = -start.Y; - - // Vector2 end = cell.edges[i].point2 + position; - // end.Y = -end.Y; - - // GUI.DrawLine(spriteBatch, start, end, (cell.body != null && cell.body.Enabled) ? Color.Green : Color.Red); - // } - //} } public List GetCellEdges(Vector2 refPos, int searchDepth = 2, bool onlySolid = true) @@ -715,10 +748,10 @@ namespace Subsurface for (int i = 0; i < cell.edges.Count; i++) { if (onlySolid && !cell.edges[i].isSolid) continue; - Vector2 start = cell.edges[i].point1 + position; + Vector2 start = cell.edges[i].point1 + Position; start.Y = -start.Y; - Vector2 end = cell.edges[i].point2 + position; + Vector2 end = cell.edges[i].point2 + Position; end.Y = -end.Y; edges.Add(new Vector2[] { start, end }); @@ -727,22 +760,7 @@ namespace Subsurface } } } - - //foreach (VoronoiCell cell in cells) - //{ - // for (int i = 0; i < cell.edges.Count; i++) - // { - // Vector2 start = cell.edges[i].point1 + position; - // start.Y = -start.Y; - - // Vector2 end = cell.edges[i].point2 + position; - // end.Y = -end.Y; - - // edges.Add(new Vector2[] {start, end}); - // //GUI.DrawLine(spriteBatch, start, end, (cell.body != null && cell.body.Enabled) ? Color.Green : Color.Red); - // } - //} - + return edges; } @@ -751,7 +769,7 @@ namespace Subsurface if (vertices == null) return; if (vertices.Length <= 0) return; - basicEffect.World = Matrix.CreateTranslation(new Vector3(position, 0.0f))*cam.ShaderTransform + basicEffect.World = Matrix.CreateTranslation(new Vector3(Position, 0.0f))*cam.ShaderTransform * Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f; @@ -763,7 +781,7 @@ namespace Subsurface private void Unload() { - position = Vector2.Zero; + //position = Vector2.Zero; //foreach (VoronoiCell cell in cells) //{ diff --git a/Subsurface/Map/Lights/LightManager.cs b/Subsurface/Map/Lights/LightManager.cs index 2cbd5b909..749ce356e 100644 --- a/Subsurface/Map/Lights/LightManager.cs +++ b/Subsurface/Map/Lights/LightManager.cs @@ -5,16 +5,16 @@ namespace Subsurface.Lights { class LightManager { - public static Vector2 viewPos; + public static Vector2 ViewPos; - public static bool fowEnabled = true; + public static bool FowEnabled = true; public static void DrawFow(GraphicsDevice graphics, Camera cam) { - if (!fowEnabled) return; + if (!FowEnabled) return; foreach (ConvexHull convexHull in ConvexHull.list) { - convexHull.DrawShadows(graphics, cam, viewPos); + convexHull.DrawShadows(graphics, cam, ViewPos); } } } diff --git a/Subsurface/Map/Location.cs b/Subsurface/Map/Location.cs index f71f91d16..35705c869 100644 --- a/Subsurface/Map/Location.cs +++ b/Subsurface/Map/Location.cs @@ -31,7 +31,7 @@ namespace Subsurface public static Location CreateRandom(Vector2 position) { - return new Location("Location " + (Game1.random.Next() % 10000), position); + return new Location("Location " + Rand.Int(10000, false), position); } } } diff --git a/Subsurface/Map/Map.cs b/Subsurface/Map/Map.cs index 91216ace7..b26df7e6f 100644 --- a/Subsurface/Map/Map.cs +++ b/Subsurface/Map/Map.cs @@ -77,7 +77,7 @@ namespace Subsurface // connections.Add(new LocationConnection(locations[i], locations[closestIndex], level)); //} - currentLocation = locations[0]; + currentLocation = locations[locations.Count/2]; } private void GenerateLocations() @@ -87,8 +87,9 @@ namespace Subsurface List sites = new List(); for (int i = 0; i < 50; i++) { - sites.Add(new Vector2((float)Game1.random.NextDouble() * size, (float)Game1.random.NextDouble() * size)); + sites.Add(new Vector2(Rand.Range(0.0f, size), Rand.Range(0.0f, size))); } + List edges = voronoi.MakeVoronoiGraph(sites, size, size); sites.Clear(); @@ -106,7 +107,7 @@ namespace Subsurface Vector2[] points = new Vector2[] { edge.point1, edge.point2 }; - int positionIndex = Game1.random.Next(0, 1); + int positionIndex = Rand.Int(1); Vector2 position = points[positionIndex]; if (newLocations[1 - i] != null && newLocations[1 - i].MapPosition == position) position = points[1 - positionIndex]; @@ -167,6 +168,8 @@ namespace Subsurface if (highlightedLocation!=null) { Vector2 pos = highlightedLocation.MapPosition * scale; + pos.X = (int)pos.X; + pos.Y = (int)pos.Y; spriteBatch.DrawString(GUI.font, highlightedLocation.Name, pos + new Vector2(rect.X - 50, rect.Y), Color.White); GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X + (int)pos.X - 4, rect.Y + (int)pos.Y - 4, 5 + 8, 5 + 8), Color.White, false); } @@ -174,6 +177,8 @@ namespace Subsurface if (selectedLocation != null) { Vector2 pos = selectedLocation.MapPosition * scale; + pos.X = (int)pos.X; + pos.Y = (int)pos.Y; spriteBatch.DrawString(GUI.font, selectedLocation.Name, pos + new Vector2(rect.X - 50, rect.Y), Color.White); GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X + (int)pos.X - 4, rect.Y + (int)pos.Y - 4, 5 + 8, 5 + 8), Color.White, false); } diff --git a/Subsurface/Map/MapEntity.cs b/Subsurface/Map/MapEntity.cs index 69837ac9b..13cf61fa1 100644 --- a/Subsurface/Map/MapEntity.cs +++ b/Subsurface/Map/MapEntity.cs @@ -235,7 +235,7 @@ namespace Subsurface selectionSize.Y = selectionPos.Y - position.Y; List newSelection = new List();// FindSelectedEntities(selectionPos, selectionSize); - if (Math.Abs(selectionSize.X) > Submarine.gridSize.X || Math.Abs(selectionSize.Y) > Submarine.gridSize.Y) + if (Math.Abs(selectionSize.X) > Submarine.GridSize.X || Math.Abs(selectionSize.Y) > Submarine.GridSize.Y) { newSelection = FindSelectedEntities(selectionPos, selectionSize); } diff --git a/Subsurface/Map/MapEntityPrefab.cs b/Subsurface/Map/MapEntityPrefab.cs index 0f596b3b5..7e063aa6d 100644 --- a/Subsurface/Map/MapEntityPrefab.cs +++ b/Subsurface/Map/MapEntityPrefab.cs @@ -73,7 +73,7 @@ namespace Subsurface public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam) { - Vector2 placeSize = Submarine.gridSize; + Vector2 placeSize = Submarine.GridSize; if (placePosition == Vector2.Zero) { @@ -88,8 +88,8 @@ namespace Subsurface if (resizeVertical) placeSize.Y = placePosition.Y - position.Y; Rectangle newRect = Submarine.AbsRect(placePosition, placeSize); - newRect.Width = (int)Math.Max(newRect.Width, Submarine.gridSize.X); - newRect.Height = (int)Math.Max(newRect.Height, Submarine.gridSize.Y); + newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X); + newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y); if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released) { diff --git a/Subsurface/Map/Structure.cs b/Subsurface/Map/Structure.cs index a8e47a75c..0f8fb2e6d 100644 --- a/Subsurface/Map/Structure.cs +++ b/Subsurface/Map/Structure.cs @@ -144,7 +144,7 @@ namespace Subsurface bodies = new List(); //gaps = new List(); - Body newBody = BodyFactory.CreateRectangle(Game1.world, + Body newBody = BodyFactory.CreateRectangle(Game1.World, ConvertUnits.ToSimUnits(rect.Width), ConvertUnits.ToSimUnits(rect.Height), 1.5f); @@ -202,16 +202,16 @@ namespace Subsurface { bodies = new List(); - Body newBody = BodyFactory.CreateRectangle(Game1.world, - ConvertUnits.ToSimUnits(rect.Width * Math.Sqrt(2.0) - Submarine.gridSize.X), + Body newBody = BodyFactory.CreateRectangle(Game1.World, + ConvertUnits.ToSimUnits(rect.Width * Math.Sqrt(2.0) - Submarine.GridSize.X), ConvertUnits.ToSimUnits(10), 1.5f); newBody.BodyType = BodyType.Static; Vector2 stairPos = new Vector2(Position.X, rect.Y - rect.Height + rect.Width / 2.0f); stairPos += new Vector2( - (StairDirection == Direction.Right) ? -Submarine.gridSize.X*1.5f : Submarine.gridSize.X*1.5f, - - Submarine.gridSize.Y*2.0f); + (StairDirection == Direction.Right) ? -Submarine.GridSize.X*1.5f : Submarine.GridSize.X*1.5f, + - Submarine.GridSize.Y*2.0f); newBody.Position = ConvertUnits.ToSimUnits(stairPos); @@ -251,7 +251,7 @@ namespace Subsurface if (bodies != null) { foreach (Body b in bodies) - Game1.world.RemoveBody(b); + Game1.World.RemoveBody(b); } if (convexHull != null) convexHull.Remove(); @@ -299,7 +299,7 @@ namespace Subsurface Limb limb; if ((limb = f2.Body.UserData as Limb) != null) { - if (limb.character.animController.IgnorePlatforms) return false; + if (limb.character.AnimController.IgnorePlatforms) return false; } } @@ -443,7 +443,7 @@ namespace Subsurface { foreach (Body b in bodies) { - Game1.world.RemoveBody(b); + Game1.World.RemoveBody(b); } bodies.Clear(); @@ -497,7 +497,7 @@ namespace Subsurface private Body CreateRectBody(Rectangle rect) { - Body newBody = BodyFactory.CreateRectangle(Game1.world, + Body newBody = BodyFactory.CreateRectangle(Game1.World, ConvertUnits.ToSimUnits(rect.Width), ConvertUnits.ToSimUnits(rect.Height), 1.5f); diff --git a/Subsurface/Map/Submarine.cs b/Subsurface/Map/Submarine.cs index 3c7613e03..4bcc5209b 100644 --- a/Subsurface/Map/Submarine.cs +++ b/Subsurface/Map/Submarine.cs @@ -28,7 +28,7 @@ namespace Subsurface private static Submarine loaded; - public static readonly Vector2 gridSize = new Vector2(16.0f, 16.0f); + public static readonly Vector2 GridSize = new Vector2(16.0f, 16.0f); private static Vector2 lastPickedPosition; private static float lastPickedFraction; @@ -253,8 +253,8 @@ namespace Subsurface public static Vector2 VectorToWorldGrid(Vector2 position) { - position.X = (float)Math.Floor(Convert.ToDouble(position.X / gridSize.X)) * gridSize.X; - position.Y = (float)Math.Ceiling(Convert.ToDouble(position.Y / gridSize.Y)) * gridSize.Y; + position.X = (float)Math.Floor(Convert.ToDouble(position.X / GridSize.X)) * GridSize.X; + position.Y = (float)Math.Ceiling(Convert.ToDouble(position.Y / GridSize.Y)) * GridSize.Y; return position; } @@ -299,7 +299,7 @@ namespace Subsurface { float closestFraction = 1.0f; Body closestBody = null; - Game1.world.RayCast((fixture, point, normal, fraction) => + Game1.World.RayCast((fixture, point, normal, fraction) => { if (fixture == null || fixture.CollisionCategories == Category.None) return -1; if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1; @@ -332,7 +332,7 @@ namespace Subsurface return null; } - Game1.world.RayCast((fixture, point, normal, fraction) => + Game1.World.RayCast((fixture, point, normal, fraction) => { if (fixture == null || fixture.CollisionCategories != Physics.CollisionWall) return -1; @@ -364,7 +364,7 @@ namespace Subsurface Body foundBody = null; AABB aabb = new AABB(point, point); - Game1.world.QueryAABB(p => + Game1.World.QueryAABB(p => { foundBody = p.Body; @@ -408,7 +408,8 @@ namespace Subsurface } //hullBodies[0].body.LinearVelocity = -hullBodies[0].body.Position; - hullBody.SetTransform(Vector2.Zero , 0.0f); + //hullBody.SetTransform(Vector2.Zero , 0.0f); + hullBody.LinearVelocity = -hullBody.Position; if (collidingCell == null) { @@ -419,8 +420,8 @@ namespace Subsurface foreach (GraphEdge ge in collidingCell.edges) { Body body = PickBody( - ConvertUnits.ToSimUnits(ge.point1+ Game1.GameSession.Level.position), - ConvertUnits.ToSimUnits(ge.point2 + Game1.GameSession.Level.position), new List(){collidingCell.body}); + ConvertUnits.ToSimUnits(ge.point1+ Game1.GameSession.Level.Position), + ConvertUnits.ToSimUnits(ge.point2 + Game1.GameSession.Level.Position), new List(){collidingCell.body}); if (body == null || body.UserData == null) continue; Structure structure = body.UserData as Structure; @@ -461,7 +462,7 @@ namespace Subsurface public void SetPosition(Vector2 position) { //hullBodies[0].body.SetTransform(position, 0.0f); - Translate(position); + Level.Loaded.SetPosition(-position); //prevPosition = position; } @@ -712,9 +713,9 @@ namespace Subsurface convexHull.Reverse(); //get farseer 'vertices' from vectors - Vertices _shapevertices = new Vertices(convexHull); + Vertices shapevertices = new Vertices(convexHull); - AABB hullAABB = _shapevertices.GetAABB(); + AABB hullAABB = shapevertices.GetAABB(); borders = new Rectangle( (int)ConvertUnits.ToDisplayUnits(hullAABB.LowerBound.X), @@ -723,9 +724,9 @@ namespace Subsurface (int)ConvertUnits.ToDisplayUnits(hullAABB.Extents.Y * 2.0f)); - var triangulatedVertices = Triangulate.ConvexPartition(_shapevertices, TriangulationAlgorithm.Bayazit); + var triangulatedVertices = Triangulate.ConvexPartition(shapevertices, TriangulationAlgorithm.Bayazit); - hullBody = BodyFactory.CreateCompoundPolygon(Game1.world, triangulatedVertices, 5.0f); + hullBody = BodyFactory.CreateCompoundPolygon(Game1.World, triangulatedVertices, 5.0f); hullBody.BodyType = BodyType.Dynamic; hullBody.CollisionCategories = Physics.CollisionMisc; @@ -787,7 +788,7 @@ namespace Subsurface Ragdoll.list.Clear(); - Game1.world.Clear(); + Game1.World.Clear(); } } diff --git a/Subsurface/Map/VoronoiElements.cs b/Subsurface/Map/VoronoiElements.cs index b56c81d2d..746788917 100644 --- a/Subsurface/Map/VoronoiElements.cs +++ b/Subsurface/Map/VoronoiElements.cs @@ -121,6 +121,8 @@ namespace Voronoi2 public List edges; public Site site; + public List bodyVertices; + public Body body; public Vector2 Center @@ -131,7 +133,7 @@ namespace Voronoi2 public VoronoiCell(Site site) { edges = new List(); - + bodyVertices = new List(); //bodies = new List(); this.site = site; } diff --git a/Subsurface/Map/WayPoint.cs b/Subsurface/Map/WayPoint.cs index 5abea6130..bf137ce0f 100644 --- a/Subsurface/Map/WayPoint.cs +++ b/Subsurface/Map/WayPoint.cs @@ -91,7 +91,7 @@ namespace Subsurface if (!wayPoints.Any()) return null; - return wayPoints[Game1.random.Next(wayPoints.Count())]; + return wayPoints[Rand.Int(wayPoints.Count())]; } public override XElement Save(XDocument doc) @@ -123,7 +123,7 @@ namespace Subsurface Rectangle rect = new Rectangle( int.Parse(element.Attribute("x").Value), int.Parse(element.Attribute("y").Value), - (int)Submarine.gridSize.X, (int)Submarine.gridSize.Y); + (int)Submarine.GridSize.X, (int)Submarine.GridSize.Y); WayPoint w = new WayPoint(rect); diff --git a/Subsurface/MathUtils.cs b/Subsurface/MathUtils.cs index 85d84ab1c..c56ec2445 100644 --- a/Subsurface/MathUtils.cs +++ b/Subsurface/MathUtils.cs @@ -20,31 +20,6 @@ namespace Subsurface return (float)Math.Floor(value / div) * div; } - public static float RandomFloat(int minimum, int maximum) - { - return RandomFloat((float)minimum, (float)maximum); - } - - public static float RandomFloat(float minimum, float maximum) - { - return (float)Game1.random.NextDouble() * (maximum - minimum) + minimum; - } - - public static int RandomInt(int minimum, int maximum) - { - return Game1.random.Next(maximum - minimum) + minimum; - } - - public static float RandomFloatLocal(float minimum, float maximum) - { - return (float)Game1.localRandom.NextDouble() * (maximum - minimum) + minimum; - } - - public static int RandomIntLocal(int minimum, int maximum) - { - return Game1.localRandom.Next(maximum - minimum) + minimum; - } - public static float VectorToAngle(Vector2 vector) { return (float)Math.Atan2(vector.Y, vector.X); diff --git a/Subsurface/Networking/GameClient.cs b/Subsurface/Networking/GameClient.cs index 0e328bb25..836ee94e4 100644 --- a/Subsurface/Networking/GameClient.cs +++ b/Subsurface/Networking/GameClient.cs @@ -14,11 +14,6 @@ namespace Subsurface.Networking private Character myCharacter; private CharacterInfo characterInfo; - string name; - - // Create timer that tells client, when to send update - // System.Timers.Timer update; - public Character Character { get { return myCharacter; } @@ -30,16 +25,6 @@ namespace Subsurface.Networking get { return characterInfo; } } - public string Name - { - get { return name; } - set - { - if (string.IsNullOrEmpty(name)) return; - name = value; - } - } - public GameClient(string newName) { name = newName; @@ -64,7 +49,7 @@ namespace Subsurface.Networking Client.Start(); outmsg.Write((byte)PacketTypes.Login); - outmsg.Write(Game1.version.ToString()); + outmsg.Write(Game1.Version.ToString()); outmsg.Write(name); // Connect client, to ip previously requested from user @@ -163,7 +148,7 @@ namespace Subsurface.Networking } } - public void Update() + public override void Update() { if (updateTimer > DateTime.Now) return; @@ -222,8 +207,10 @@ namespace Subsurface.Networking case (byte)PacketTypes.StartGame: if (gameStarted) continue; + if (this.Character != null) Character.Remove(); + int seed = inc.ReadInt32(); - Game1.random = new Random(seed); + Rand.SetSyncedSeed(seed); string mapName = inc.ReadString(); string mapHash = inc.ReadString(); @@ -241,7 +228,7 @@ namespace Subsurface.Networking //int gameModeIndex = inc.ReadInt32(); Game1.GameSession = new GameSession(Submarine.Loaded); - Game1.GameSession.StartShift(duration, 1); + Game1.GameSession.StartShift(duration, "asdf"); myCharacter = ReadCharacterData(inc); Character.Controlled = myCharacter; @@ -270,14 +257,6 @@ namespace Subsurface.Networking Game1.NetLobbyScreen.AddPlayer(otherClient.name); - //string newPlayerName = inc.ReadString(); - //int newPlayerID = inc.ReadInt32(); - - //CharacterInfo ch = new CharacterInfo("Content/Characters/Human/human.xml", newPlayerName); - //ch.ID = newPlayerID; - - //Character.newCharacterQueue.Enqueue(ch); - AddChatMessage(otherClient.name + " has joined the server", ChatMessageType.Server); break; @@ -289,7 +268,7 @@ namespace Subsurface.Networking break; case (byte)PacketTypes.KickedOut: - string msg= inc.ReadString(); + string msg = inc.ReadString(); DebugConsole.ThrowError(msg); @@ -336,7 +315,7 @@ namespace Subsurface.Networking gameStarted = false; } - public void Disconnect() + public override void Disconnect() { NetOutgoingMessage msg = Client.CreateMessage(); msg.Write((byte)PacketTypes.PlayerLeft); @@ -350,8 +329,9 @@ namespace Subsurface.Networking NetOutgoingMessage msg = Client.CreateMessage(); msg.Write((byte)PacketTypes.CharacterInfo); - msg.Write(characterInfo.name); - msg.Write(characterInfo.gender == Gender.Male); + msg.Write(characterInfo.Name); + msg.Write(characterInfo.Gender == Gender.Male); + msg.Write(characterInfo.HeadSpriteId); Client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); @@ -359,11 +339,11 @@ namespace Subsurface.Networking private Character ReadCharacterData(NetIncomingMessage inc) { - string newName = inc.ReadString(); - int ID = inc.ReadInt32(); - bool isFemale = inc.ReadBoolean(); - int inventoryID = inc.ReadInt32(); - Vector2 position = new Vector2(inc.ReadFloat(), inc.ReadFloat()); + string newName = inc.ReadString(); + int ID = inc.ReadInt32(); + bool isFemale = inc.ReadBoolean(); + int inventoryID = inc.ReadInt32(); + Vector2 position = new Vector2(inc.ReadFloat(), inc.ReadFloat()); CharacterInfo ch = new CharacterInfo("Content/Characters/Human/human.xml", newName, isFemale ? Gender.Female : Gender.Male); Character character = new Character(ch, position); @@ -373,11 +353,11 @@ namespace Subsurface.Networking return character; } - public void SendChatMessage(string message) + public override void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Default) { //AddChatMessage(message); - ChatMessageType type = (gameStarted && myCharacter != null && myCharacter.IsDead) ? ChatMessageType.Dead : ChatMessageType.Default; + type = (gameStarted && myCharacter != null && myCharacter.IsDead) ? ChatMessageType.Dead : ChatMessageType.Default; NetOutgoingMessage msg = Client.CreateMessage(); msg.Write((byte)PacketTypes.Chatmessage); diff --git a/Subsurface/Networking/GameServer.cs b/Subsurface/Networking/GameServer.cs index 27097b277..e0814099c 100644 --- a/Subsurface/Networking/GameServer.cs +++ b/Subsurface/Networking/GameServer.cs @@ -9,22 +9,20 @@ namespace Subsurface.Networking { class GameServer : NetworkMember { - // Server object NetServer Server; - // Configuration object NetPeerConfiguration Config; public List connectedClients = new List(); - //NetIncomingMessage inc; - - const int sparseUpdateInterval = 150; + const int SparseUpdateInterval = 150; int sparseUpdateTimer; Client myClient; public GameServer() { + name = "Server"; + Config = new NetPeerConfiguration("subsurface"); Config.Port = 14242; @@ -54,7 +52,7 @@ namespace Subsurface.Networking } - public void Update() + public override void Update() { // Server.ReadMessage() Returns new messages, that have not yet been read. // If "inc" is null -> ReadMessage returned null -> Its null, so dont do this :) @@ -109,10 +107,10 @@ namespace Subsurface.Networking if (sender == null) break; - if (sender.version != Game1.version.ToString()) + if (sender.version != Game1.Version.ToString()) { DisconnectClient(sender, sender.name+" was unable to connect to the server (nonmatching game version)", - "Subsurface version " + Game1.version + " required to connect to the server (Your version: " + sender.version + ")"); + "Subsurface version " + Game1.Version + " required to connect to the server (Your version: " + sender.version + ")"); } else @@ -208,7 +206,7 @@ namespace Subsurface.Networking private void SparseUpdate() { - foreach (Character c in Character.characterList) + foreach (Character c in Character.CharacterList) { bool isClient = false; foreach (Client client in connectedClients) @@ -220,12 +218,12 @@ namespace Subsurface.Networking if (!isClient) { - c.largeUpdateTimer = 0; + c.LargeUpdateTimer = 0; new NetworkEvent(c.ID, false); } } - sparseUpdateTimer = sparseUpdateInterval; + sparseUpdateTimer = SparseUpdateInterval; } private void SendMessage(NetOutgoingMessage msg, NetDeliveryMethod deliveryMethod, NetConnection excludedConnection) @@ -268,14 +266,14 @@ namespace Subsurface.Networking public bool StartGame(GUIButton button, object obj) { int seed = DateTime.Now.Millisecond; - Game1.random = new Random(seed); + Rand.SetSyncedSeed(seed); Submarine selectedMap = Game1.NetLobbyScreen.SelectedMap as Submarine; //selectedMap.Load(); Game1.GameSession = new GameSession(selectedMap, Game1.NetLobbyScreen.SelectedMode); - Game1.GameSession.StartShift(Game1.NetLobbyScreen.GameDuration, 1); + Game1.GameSession.StartShift(Game1.NetLobbyScreen.GameDuration, "asdf", 1); //EventManager.SelectEvent(Game1.netLobbyScreen.SelectedEvent); foreach (Client client in connectedClients) @@ -446,17 +444,17 @@ namespace Subsurface.Networking - public void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server) + public override void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server) { AddChatMessage(message, type); + if (Server.Connections.Count == 0) return; + NetOutgoingMessage msg = Server.CreateMessage(); msg.Write((byte)PacketTypes.Chatmessage); msg.Write((byte)type); msg.Write(message); - if (Server.Connections.Count == 0) return; - if (type==ChatMessageType.Dead) { List recipients = new List(); @@ -478,13 +476,15 @@ namespace Subsurface.Networking private void ReadCharacterData(NetIncomingMessage message) { - string name = message.ReadString(); - Gender gender = message.ReadBoolean() ? Gender.Male : Gender.Female; + string name = message.ReadString(); + Gender gender = message.ReadBoolean() ? Gender.Male : Gender.Female; + int headSpriteId = message.ReadInt32(); foreach (Client c in connectedClients) { if (c.Connection != message.SenderConnection) continue; c.characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", name, gender); + c.characterInfo.HeadSpriteId = headSpriteId; } } @@ -492,7 +492,7 @@ namespace Subsurface.Networking { message.Write(name); message.Write(character.ID); - message.Write(character.info.gender==Gender.Female); + message.Write(character.Info.Gender == Gender.Female); message.Write(character.Inventory.ID); message.Write(character.SimPosition.X); message.Write(character.SimPosition.Y); diff --git a/Subsurface/Networking/NetworkMember.cs b/Subsurface/Networking/NetworkMember.cs index bc4bad54f..7ddf9609e 100644 --- a/Subsurface/Networking/NetworkMember.cs +++ b/Subsurface/Networking/NetworkMember.cs @@ -30,10 +30,22 @@ namespace Subsurface.Networking { protected static Color[] messageColor = { Color.Black, Color.DarkRed, Color.DarkBlue, Color.DarkGreen }; + protected string name; + protected TimeSpan updateInterval; protected DateTime updateTimer; protected bool gameStarted; + + public string Name + { + get { return name; } + set + { + if (string.IsNullOrEmpty(name)) return; + name = value; + } + } public void AddChatMessage(string message, ChatMessageType messageType) { @@ -42,6 +54,12 @@ namespace Subsurface.Networking GUI.PlayMessageSound(); } + + public virtual void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server) { } + + public virtual void Update() { } + + public virtual void Disconnect() { } } enum ChatMessageType diff --git a/Subsurface/Particles/Particle.cs b/Subsurface/Particles/Particle.cs index 2eca53f32..971b7ec1d 100644 --- a/Subsurface/Particles/Particle.cs +++ b/Subsurface/Particles/Particle.cs @@ -66,19 +66,16 @@ namespace Subsurface.Particles velocity = speed; - this.rotation = rotation + MathUtils.RandomFloatLocal(prefab.startRotationMin, prefab.startRotationMax); + this.rotation = rotation + Rand.Range(prefab.startRotationMin, prefab.startRotationMax); prevRotation = rotation; - float rand = (float)Game1.localRandom.NextDouble(); - angularVelocity = prefab.angularVelocityMin + (prefab.angularVelocityMax - prefab.angularVelocityMin) * rand; + angularVelocity = prefab.angularVelocityMin + (prefab.angularVelocityMax - prefab.angularVelocityMin) * Rand.Range(0.0f, 1.0f); lifeTime = prefab.lifeTime; - rand = (float)Game1.localRandom.NextDouble(); - size = prefab.startSizeMin + (prefab.startSizeMax - prefab.startSizeMin)*rand; + size = prefab.startSizeMin + (prefab.startSizeMax - prefab.startSizeMin) * Rand.Range(0.0f, 1.0f); - rand = (float)Game1.localRandom.NextDouble(); - sizeChange = prefab.sizeChangeMin + (prefab.sizeChangeMax - prefab.sizeChangeMin) * rand; + sizeChange = prefab.sizeChangeMin + (prefab.sizeChangeMax - prefab.sizeChangeMin) * Rand.Range(0.0f, 1.0f); yLimits = Vector2.Zero; diff --git a/Subsurface/Physics/PhysicsBody.cs b/Subsurface/Physics/PhysicsBody.cs index fbbb6b60e..035ac10e6 100644 --- a/Subsurface/Physics/PhysicsBody.cs +++ b/Subsurface/Physics/PhysicsBody.cs @@ -178,17 +178,17 @@ namespace Subsurface if (width != 0.0f && height != 0.0f) { - body = BodyFactory.CreateRectangle(Game1.world, width, height, density); + body = BodyFactory.CreateRectangle(Game1.World, width, height, density); bodyShape = Shape.Rectangle; } else if (radius != 0.0f && height != 0.0f) { - body = BodyFactory.CreateCapsule(Game1.world, height, radius, density); + body = BodyFactory.CreateCapsule(Game1.World, height, radius, density); bodyShape = Shape.Capsule; } else if (radius != 0.0f) { - body = BodyFactory.CreateCircle(Game1.world, radius, density); + body = BodyFactory.CreateCircle(Game1.World, radius, density); bodyShape = Shape.Circle; } else @@ -322,7 +322,7 @@ namespace Subsurface public void Remove() { list.Remove(this); - Game1.world.RemoveBody(body); + Game1.World.RemoveBody(body); } diff --git a/Subsurface/Rand.cs b/Subsurface/Rand.cs new file mode 100644 index 000000000..018dd4473 --- /dev/null +++ b/Subsurface/Rand.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Subsurface +{ + static class Rand + { + private static Random localRandom = new Random(); + private static Random syncedRandom = new Random(); + + public static void SetSyncedSeed(int seed) + { + syncedRandom = new Random(seed); + } + + public static float Range(float minimum, float maximum, bool local = true) + { + if (local) + { + return (float)localRandom.NextDouble() * (maximum - minimum) + minimum; + } + else + { + return (float)syncedRandom.NextDouble() * (maximum - minimum) + minimum; + } + } + + public static int Range(int minimum, int maximum, bool local = true) + { + if (local) + { + return localRandom.Next(maximum - minimum) + minimum; + } + else + { + return syncedRandom.Next(maximum - minimum) + minimum; + } + } + + public static int Int(int max = int.MaxValue, bool local = true) + { + if (local) + { + return localRandom.Next(max); + } + else + { + return syncedRandom.Next(max); + } + } + + public static Vector2 Vector(float length = 1.0f, bool local = true) + { + Vector2 randomVector = new Vector2(Range(-1.0f, 1.0f, local), Range(-1.0f, 1.0f, local)); + + if (randomVector == Vector2.Zero) return Vector2.One * length; + + return Vector2.Normalize(randomVector) * length; + } + + } +} diff --git a/Subsurface/Screens/EditCharacterScreen.cs b/Subsurface/Screens/EditCharacterScreen.cs index 4b115ddd3..7f3d2fdfb 100644 --- a/Subsurface/Screens/EditCharacterScreen.cs +++ b/Subsurface/Screens/EditCharacterScreen.cs @@ -46,28 +46,28 @@ namespace Subsurface GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, Game1.GraphicsHeight), Color.DarkGray * 0.8f); GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Color.White, GUIpanel); + physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, GUI.style, GUIpanel); physicsButton.OnClicked += TogglePhysics; - new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", Color.Transparent, Color.Black, Alignment.Left, GUIpanel); - limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, GUIpanel); + new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", Color.Transparent, Color.Black, Alignment.Left, null, GUIpanel); + limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, GUI.style, GUIpanel); limbList.OnSelected = SelectLimb; - new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", Color.Transparent, Color.Black, Alignment.Left, GUIpanel); - jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, GUIpanel); + new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", Color.Transparent, Color.Black, Alignment.Left, null, GUIpanel); + jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, GUI.style, GUIpanel); - while (Character.characterList.Count > 1) + while (Character.CharacterList.Count > 1) { - Character.characterList.First().Remove(); + Character.CharacterList.First().Remove(); } - if (Character.characterList.Count == 1) + if (Character.CharacterList.Count == 1) { - if (editingCharacter != Character.characterList[0]) UpdateLimbLists(Character.characterList[0]); - editingCharacter = Character.characterList[0]; + if (editingCharacter != Character.CharacterList[0]) UpdateLimbLists(Character.CharacterList[0]); + editingCharacter = Character.CharacterList[0]; - Vector2 camPos = editingCharacter.animController.limbs[0].body.Position; + Vector2 camPos = editingCharacter.AnimController.limbs[0].body.Position; camPos = ConvertUnits.ToDisplayUnits(camPos); camPos.Y = -camPos.Y; cam.TargetPos = camPos; @@ -84,7 +84,7 @@ namespace Subsurface textures = new List(); texturePaths = new List(); - foreach (Limb limb in editingCharacter.animController.limbs) + foreach (Limb limb in editingCharacter.AnimController.limbs) { if (texturePaths.Contains(limb.sprite.FilePath)) continue; textures.Add(limb.sprite.Texture); @@ -113,7 +113,7 @@ namespace Subsurface Ragdoll.UpdateAll((float)Physics.step); - Game1.world.Step((float)Physics.step); + Game1.World.Step((float)Physics.step); Physics.accumulator -= Physics.step; } @@ -173,7 +173,7 @@ namespace Subsurface x = Game1.GraphicsWidth - textures[i].Width; spriteBatch.Draw(textures[i], new Vector2(x, y), Color.White); - foreach (Limb limb in editingCharacter.animController.limbs) + foreach (Limb limb in editingCharacter.AnimController.limbs) { if (limb.sprite.FilePath != texturePaths[i]) continue; Rectangle rect = limb.sprite.SourceRect; @@ -220,21 +220,21 @@ namespace Subsurface private void UpdateLimbLists(Character character) { limbList.ClearChildren(); - foreach (Limb limb in character.animController.limbs) + foreach (Limb limb in character.AnimController.limbs) { GUITextBlock textBlock = new GUITextBlock( new Rectangle(0,0,0,25), limb.type.ToString(), Color.Transparent, Color.Black, - Alignment.Left, + Alignment.Left, null, limbList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = limb; } jointList.ClearChildren(); - foreach (RevoluteJoint joint in character.animController.limbJoints) + foreach (RevoluteJoint joint in character.AnimController.limbJoints) { Limb limb1 = (Limb)(joint.BodyA.UserData); Limb limb2 = (Limb)(joint.BodyB.UserData); @@ -244,7 +244,7 @@ namespace Subsurface limb1.type.ToString() + " - " + limb2.type.ToString(), Color.Transparent, Color.Black, - Alignment.Left, + Alignment.Left, null, jointList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = joint; @@ -253,7 +253,7 @@ namespace Subsurface private void DrawJoints(SpriteBatch spriteBatch, Limb limb, Vector2 limbBodyPos) { - foreach (var joint in editingCharacter.animController.limbJoints) + foreach (var joint in editingCharacter.AnimController.limbJoints) { Vector2 jointPos = Vector2.Zero; @@ -297,7 +297,7 @@ namespace Subsurface editingLimb = (Limb)selection; limbPanel = new GUIFrame(new Rectangle(300, 0, 500, 100), Color.Gray*0.8f); limbPanel.Padding = new Vector4(10.0f,10.0f,10.0f,10.0f); - new GUITextBlock(new Rectangle(0, 0, 200, 25), editingLimb.type.ToString(), Color.Transparent, Color.Black, Alignment.Left, limbPanel); + new GUITextBlock(new Rectangle(0, 0, 200, 25), editingLimb.type.ToString(), Color.Transparent, Color.Black, Alignment.Left, null, limbPanel); //spriteOrigin = new GUITextBlock(new Rectangle(0, 25, 200, 25), "Sprite origin: ", Color.White, Color.Black, Alignment.Left, limbPanel); diff --git a/Subsurface/Screens/EditMapScreen.cs b/Subsurface/Screens/EditMapScreen.cs index 2b66d4d05..a7541619e 100644 --- a/Subsurface/Screens/EditMapScreen.cs +++ b/Subsurface/Screens/EditMapScreen.cs @@ -37,28 +37,28 @@ namespace Subsurface //constructionList.OnSelected = MapEntityPrefab.SelectPrefab; //constructionList.CheckSelected = MapEntityPrefab.GetSelected; - GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", GUI.style, Alignment.Left, GUIpanel); + GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", Alignment.Left, GUI.style, GUIpanel); button.UserData = 0; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", GUI.style, Alignment.Left, GUIpanel); + button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", Alignment.Left, GUI.style, GUIpanel); button.UserData = 1; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", GUI.style, Alignment.Left, GUIpanel); + button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", Alignment.Left, GUI.style, GUIpanel); button.OnClicked = ToggleCharacterMode; GUItabs = new GUIComponent[2]; int width = 400, height = 400; GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), Color.DarkGray*0.8f); GUItabs[0].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUItabs[0]); + GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.style, GUItabs[0]); itemList.OnSelected = SelectPrefab; itemList.CheckSelected = MapEntityPrefab.GetSelected; GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), Color.DarkGray * 0.8f); GUItabs[1].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); - GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUItabs[1]); + GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUI.style, GUItabs[1]); structureList.OnSelected = SelectPrefab; structureList.CheckSelected = MapEntityPrefab.GetSelected; @@ -67,7 +67,7 @@ namespace Subsurface GUIListBox parent = ((ep as ItemPrefab) == null) ? structureList : itemList; Color color = ((parent.CountChildren % 2) == 0) ? Color.White : Color.LightGray; - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, parent); + GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, parent); frame.UserData = ep; frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); frame.Color = color; @@ -78,9 +78,8 @@ namespace Subsurface new Rectangle(40, 0, 0, 25), ep.Name, Color.Transparent, Color.Black, - Alignment.Left, - Alignment.Left, - frame); + Alignment.Left, Alignment.Left, + null, frame); textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); if (ep.sprite != null) @@ -110,7 +109,7 @@ namespace Subsurface { dummyCharacter.Remove(); dummyCharacter = null; - Game1.world.ProcessChanges(); + Game1.World.ProcessChanges(); } } @@ -120,7 +119,7 @@ namespace Subsurface dummyCharacter = new Character("Content/Characters/Human/human.xml", Vector2.Zero); Character.Controlled = dummyCharacter; - Game1.world.ProcessChanges(); + Game1.World.ProcessChanges(); } private bool SelectTab(GUIButton button, object obj) @@ -190,7 +189,7 @@ namespace Subsurface if (dummyCharacter.SelectedConstruction==null) { Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition)); - foreach (Limb limb in dummyCharacter.animController.limbs) + foreach (Limb limb in dummyCharacter.AnimController.limbs) { limb.body.SetTransform(mouseSimPos, 0.0f); } diff --git a/Subsurface/Screens/GameScreen.cs b/Subsurface/Screens/GameScreen.cs index ccb62723a..2dba94c72 100644 --- a/Subsurface/Screens/GameScreen.cs +++ b/Subsurface/Screens/GameScreen.cs @@ -96,7 +96,9 @@ namespace Subsurface if (Game1.GameSession != null && Game1.GameSession.Level != null) Game1.GameSession.Submarine.Update((float)Physics.step); - Game1.world.Step((float)Physics.step); + Game1.World.Step((float)Physics.step); + + Level.AfterWorldStep(); Physics.accumulator -= Physics.step; } @@ -188,7 +190,7 @@ namespace Subsurface Submarine.DrawBack(spriteBatch); - foreach (Character c in Character.characterList) c.Draw(spriteBatch); + foreach (Character c in Character.CharacterList) c.Draw(spriteBatch); spriteBatch.End(); diff --git a/Subsurface/Screens/LobbyScreen.cs b/Subsurface/Screens/LobbyScreen.cs index 42a25bee0..b56601b23 100644 --- a/Subsurface/Screens/LobbyScreen.cs +++ b/Subsurface/Screens/LobbyScreen.cs @@ -33,32 +33,29 @@ namespace Subsurface public LobbyScreen() { Rectangle panelRect = new Rectangle( - (int)GUI.style.largePadding.X, - (int)GUI.style.largePadding.Y, - (int)(Game1.GraphicsWidth * 0.3f) - (int)(GUI.style.largePadding.X * 1.5f), - Game1.GraphicsHeight - (int)(GUI.style.largePadding.Y * 2)); + 40, 40, + (int)(Game1.GraphicsWidth * 0.3f) - 60, + Game1.GraphicsHeight - 80); - leftPanel = new GUIFrame(panelRect, GUI.style.backGroundColor); - leftPanel.Padding = GUI.style.smallPadding; + leftPanel = new GUIFrame(panelRect, GUI.style); + //leftPanel.Padding = GUI.style.smallPadding; new GUITextBlock(new Rectangle(0, 0, 200, 25), - "asdfdasfasdf", Color.Transparent, Color.White, Alignment.Left, leftPanel); + "asdfdasfasdf", Color.Transparent, Color.White, Alignment.Left, GUI.style, leftPanel); GUITextBlock moneyText = new GUITextBlock(new Rectangle(0, 30, 200, 25), - "", Color.Transparent, Color.White, Alignment.Left, leftPanel); + "", Color.Transparent, Color.White, Alignment.Left, GUI.style, leftPanel); moneyText.TextGetter = GetMoney; - - - GUIButton button = new GUIButton(new Rectangle(0, 60, 100, 30), "Map", GUI.style, Alignment.Left, leftPanel); + GUIButton button = new GUIButton(new Rectangle(0, 60, 100, 30), "Map", null, Alignment.Left, GUI.style, leftPanel); button.UserData = PanelTab.Map; button.OnClicked = SelectRightPanel; - button = new GUIButton(new Rectangle(0, 100, 100, 30), "Crew", GUI.style, Alignment.Left, leftPanel); + button = new GUIButton(new Rectangle(0, 100, 100, 30), "Crew", null, Alignment.Left, GUI.style, leftPanel); button.UserData = PanelTab.Crew; button.OnClicked = SelectRightPanel; - button = new GUIButton(new Rectangle(0, 140, 100, 30), "Hire", GUI.style, Alignment.Left, leftPanel); + button = new GUIButton(new Rectangle(0, 140, 100, 30), "Hire", null, Alignment.Left, GUI.style, leftPanel); button.UserData = PanelTab.Hire; button.OnClicked = SelectRightPanel; @@ -66,37 +63,37 @@ namespace Subsurface //--------------------------------------------------------------- panelRect = new Rectangle( - panelRect.X + panelRect.Width + (int)(GUI.style.largePadding.X), - (int)GUI.style.largePadding.Y, - Game1.GraphicsWidth - panelRect.Width - (int)(GUI.style.largePadding.X * 3.0f), - Game1.GraphicsHeight - (int)(GUI.style.largePadding.Y * 2)); + panelRect.X + panelRect.Width + 40, + 40, + Game1.GraphicsWidth - panelRect.Width - 120, + Game1.GraphicsHeight - 80); rightPanel = new GUIFrame[3]; - rightPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, GUI.style.backGroundColor); - rightPanel[(int)PanelTab.Crew].Padding = GUI.style.smallPadding; + rightPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, GUI.style); + //rightPanel[(int)PanelTab.Crew].Padding = GUI.style.smallPadding; - new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, rightPanel[(int)PanelTab.Crew]); + new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.style, rightPanel[(int)PanelTab.Crew]); - characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, rightPanel[(int)PanelTab.Crew]); + characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), GUI.style, rightPanel[(int)PanelTab.Crew]); characterList.OnSelected = SelectCharacter; //--------------------------------------- - rightPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, GUI.style.backGroundColor); - rightPanel[(int)PanelTab.Map].Padding = GUI.style.smallPadding; + rightPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, GUI.style); + //rightPanel[(int)PanelTab.Map].Padding = GUI.style.smallPadding; - startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, - Alignment.BottomRight, rightPanel[(int)PanelTab.Map]); + startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", + Alignment.BottomRight, GUI.style, rightPanel[(int)PanelTab.Map]); startButton.OnClicked = StartShift; startButton.Enabled = false; //--------------------------------------- - rightPanel[(int)PanelTab.Hire] = new GUIFrame(panelRect, GUI.style.backGroundColor); - rightPanel[(int)PanelTab.Hire].Padding = GUI.style.smallPadding; + rightPanel[(int)PanelTab.Hire] = new GUIFrame(panelRect, GUI.style); + //rightPanel[(int)PanelTab.Hire].Padding = GUI.style.smallPadding; - hireList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, Alignment.Left, rightPanel[(int)PanelTab.Hire]); + hireList = new GUIListBox(new Rectangle(0, 30, 300, 0), GUI.style, Alignment.Left, rightPanel[(int)PanelTab.Hire]); hireList.OnSelected = HireCharacter; } @@ -117,7 +114,7 @@ namespace Subsurface if (previewPlatform != null) { - Game1.world.RemoveBody(previewPlatform); + Game1.World.RemoveBody(previewPlatform); previewPlatform = null; } @@ -142,11 +139,11 @@ namespace Subsurface previewCharacter = new Character(characterList.SelectedData as CharacterInfo, pos); - previewCharacter.animController.isStanding = true; + previewCharacter.AnimController.IsStanding = true; if (previewPlatform == null) { - Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f); + Body platform = BodyFactory.CreateRectangle(Game1.World, 3.0f, 1.0f, 5.0f); platform.SetTransform(new Vector2(pos.X, pos.Y - 3.5f), 0.0f); platform.IsStatic = true; } @@ -161,9 +158,9 @@ namespace Subsurface for (int i = 0; i < 500; i++) { - previewCharacter.animController.Update((float)Physics.step); - previewCharacter.animController.UpdateAnim((float)Physics.step); - Game1.world.Step((float)Physics.step); + previewCharacter.AnimController.Update((float)Physics.step); + previewCharacter.AnimController.UpdateAnim((float)Physics.step); + Game1.World.Step((float)Physics.step); } } @@ -173,10 +170,10 @@ namespace Subsurface if (locationPanel != null) rightPanel[(int)PanelTab.Map].RemoveChild(locationPanel); - locationPanel = new GUIFrame(new Rectangle(0, 0, rightPanel[(int)PanelTab.Map].Rect.Width / 2 - 40, 190), Color.Transparent, rightPanel[(int)PanelTab.Map]); + locationPanel = new GUIFrame(new Rectangle(0, 0, rightPanel[(int)PanelTab.Map].Rect.Width / 2 - 40, 190), Color.Transparent, null, rightPanel[(int)PanelTab.Map]); locationPanel.UserData = "selectedlocation"; - new GUITextBlock(new Rectangle(0,0,100,20), location.Name, Color.Transparent, Color.White, Alignment.TopLeft, locationPanel); + new GUITextBlock(new Rectangle(0,0,100,20), location.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel); startButton.Enabled = true; @@ -190,7 +187,7 @@ namespace Subsurface { GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - c.name, GUI.style, + c.Name, GUI.style, Alignment.Left, Alignment.Left, characterList); @@ -202,27 +199,21 @@ namespace Subsurface foreach (CharacterInfo c in gameMode.hireManager.availableCharacters) { GUIFrame frame = new GUIFrame( - new Rectangle(0, 0, 0, 25), - Color.White, - Alignment.Left, - GUI.style, - hireList); + new Rectangle(0, 0, 0, 25), Color.White, Alignment.Left, null, hireList); frame.UserData = c; frame.Padding = new Vector4(10.0f, 0.0f, 10.0f, 0.0f); GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - c.name, + c.Name, Color.Transparent, Color.Black, - Alignment.Left, - frame); + Alignment.Left, null, frame); textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - c.salary.ToString(), + c.Salary.ToString(), Color.Transparent, Color.Black, - Alignment.Right, - frame); + Alignment.Right, null, frame); } } @@ -334,25 +325,12 @@ namespace Subsurface return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.crewManager.Money.ToString()); } - private string GetDay() - { - - return "Day #" + ((Game1.GameSession == null) ? "" : gameMode.Day.ToString()); - } - - private float GetWeekProgress() - { - if (Game1.GameSession == null) return 0.0f; - - return (float)((gameMode.Day - 1) % 7) / 7.0f; - } - private bool SelectCharacter(object selection) { CharacterInfo characterInfo = selection as CharacterInfo; if (characterInfo == null) return false; - if (Character.Controlled != null && characterInfo == Character.Controlled.info) return false; + if (Character.Controlled != null && characterInfo == Character.Controlled.Info) return false; CreatePreviewCharacter(); diff --git a/Subsurface/Screens/MainMenu.cs b/Subsurface/Screens/MainMenu.cs index 5a8361e8f..8d0a2d9b4 100644 --- a/Subsurface/Screens/MainMenu.cs +++ b/Subsurface/Screens/MainMenu.cs @@ -31,38 +31,38 @@ namespace Subsurface Game1.GraphicsHeight/ 2 - 250, 500, 500); - menuTabs[(int)Tabs.Main] = new GUIFrame(panelRect, GUI.style.backGroundColor); - menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding; + menuTabs[(int)Tabs.Main] = new GUIFrame(panelRect, GUI.style); + //menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding; - GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "New Game", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]); + GUIButton button = new GUIButton(new Rectangle(0, 0, 0, 30), "New Game", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]); button.UserData = (int)Tabs.NewGame; button.OnClicked = SelectTab; //button.Enabled = false; - button = new GUIButton(new Rectangle(0, 60, 0, 30), "Load Game", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]); + button = new GUIButton(new Rectangle(0, 60, 0, 30), "Load Game", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]); button.UserData = (int)Tabs.LoadGame; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 120, 0, 30), "Join Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]); + button = new GUIButton(new Rectangle(0, 120, 0, 30), "Join Server", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]); button.UserData = (int)Tabs.JoinServer; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 180, 0, 30), "Host Server", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]); + button = new GUIButton(new Rectangle(0, 180, 0, 30), "Host Server", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]); button.OnClicked = HostServerClicked; //button.Enabled = false; - button = new GUIButton(new Rectangle(0, 240, 0, 30), "Quit", GUI.style, Alignment.CenterX, menuTabs[(int)Tabs.Main]); + button = new GUIButton(new Rectangle(0, 240, 0, 30), "Quit", Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.Main]); button.OnClicked = QuitClicked; //---------------------------------------------------------------------- - menuTabs[(int)Tabs.NewGame] = new GUIFrame(panelRect, GUI.style.backGroundColor); - menuTabs[(int)Tabs.NewGame].Padding = GUI.style.smallPadding; + menuTabs[(int)Tabs.NewGame] = new GUIFrame(panelRect, GUI.style); + //menuTabs[(int)Tabs.NewGame].Padding = GUI.style.smallPadding; - new GUITextBlock(new Rectangle(0, 0, 0, 30), "New Game", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.NewGame]); + new GUITextBlock(new Rectangle(0, 0, 0, 30), "New Game", null, null, Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.NewGame]); - new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, menuTabs[(int)Tabs.NewGame]); - mapList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, menuTabs[(int)Tabs.NewGame]); + new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", null, null, Alignment.Left, GUI.style, menuTabs[(int)Tabs.NewGame]); + mapList = new GUIListBox(new Rectangle(0, 60, 200, 400), GUI.style, menuTabs[(int)Tabs.NewGame]); foreach (Submarine map in Submarine.SavedSubmarines) { @@ -70,30 +70,28 @@ namespace Subsurface new Rectangle(0, 0, 0, 25), map.Name, GUI.style, - Alignment.Left, - Alignment.Left, - mapList); + Alignment.Left, Alignment.Left, mapList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = map; } if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]); - button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.NewGame]); + button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",Alignment.Right | Alignment.Bottom, GUI.style, menuTabs[(int)Tabs.NewGame]); button.OnClicked = StartGame; //---------------------------------------------------------------------- - menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.style.backGroundColor); - menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding; + menuTabs[(int)Tabs.LoadGame] = new GUIFrame(panelRect, GUI.style); + //menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding; - new GUITextBlock(new Rectangle(0, 0, 0, 30), "Load Game", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.LoadGame]); + new GUITextBlock(new Rectangle(0, 0, 0, 30), "Load Game", Color.Transparent, Color.Black, Alignment.CenterX, null, menuTabs[(int)Tabs.LoadGame]); string[] saveFiles = Directory.GetFiles(SaveUtil.SaveFolder, "*.save"); //new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, menuTabs[(int)Tabs.NewGame]); - saveList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, menuTabs[(int)Tabs.LoadGame]); + saveList = new GUIListBox(new Rectangle(0, 60, 200, 400), Color.White, GUI.style, menuTabs[(int)Tabs.LoadGame]); foreach (string saveFile in saveFiles) { @@ -108,23 +106,23 @@ namespace Subsurface textBlock.UserData = saveFile; } - button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", GUI.style, Alignment.Right | Alignment.Bottom, menuTabs[(int)Tabs.LoadGame]); + button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",Alignment.Right | Alignment.Bottom, GUI.style, menuTabs[(int)Tabs.LoadGame]); button.OnClicked = LoadGame; //---------------------------------------------------------------------- - menuTabs[(int)Tabs.JoinServer] = new GUIFrame(panelRect, GUI.style.backGroundColor); - menuTabs[(int)Tabs.JoinServer].Padding = GUI.style.smallPadding; + menuTabs[(int)Tabs.JoinServer] = new GUIFrame(panelRect, GUI.style); + //menuTabs[(int)Tabs.JoinServer].Padding = GUI.style.smallPadding; - new GUITextBlock(new Rectangle(0, 0, 0, 30), "Join Server", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); - - new GUITextBlock(new Rectangle(0, 30, 0, 30), "Name:", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); - nameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); + new GUITextBlock(new Rectangle(0, 0, 0, 30), "Join Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); - new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", Color.Transparent, Color.Black, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); - ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); + new GUITextBlock(new Rectangle(0, 30, 0, 30), "Name:", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); + nameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, null, menuTabs[(int)Tabs.JoinServer]); - GUIButton joinButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Join", Color.White, Alignment.Bottom | Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); + new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.JoinServer]); + ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), Color.White, Color.Black, Alignment.CenterX, Alignment.CenterX, null, menuTabs[(int)Tabs.JoinServer]); + + GUIButton joinButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Join", Alignment.BottomCenter, GUI.style, menuTabs[(int)Tabs.JoinServer]); joinButton.OnClicked = JoinServer; @@ -140,7 +138,7 @@ namespace Subsurface private bool HostServerClicked(GUIButton button, object obj) { - Game1.NetLobbyScreen.isServer = true; + Game1.NetLobbyScreen.IsServer = true; Game1.NetLobbyScreen.Select(); return true; } @@ -211,7 +209,7 @@ namespace Subsurface if (string.IsNullOrEmpty(nameBox.Text)) return false; if (string.IsNullOrEmpty(ipBox.Text)) return false; - Game1.Client = new GameClient(nameBox.Text); + Game1.NetworkMember = new GameClient(nameBox.Text); if (Game1.Client.ConnectToServer(ipBox.Text)) { Game1.NetLobbyScreen.Select(); @@ -219,7 +217,7 @@ namespace Subsurface } else { - Game1.Client = null; + Game1.NetworkMember = null; return false; } } diff --git a/Subsurface/Screens/NetLobbyScreen.cs b/Subsurface/Screens/NetLobbyScreen.cs index 3336027b9..3e5a5e8b5 100644 --- a/Subsurface/Screens/NetLobbyScreen.cs +++ b/Subsurface/Screens/NetLobbyScreen.cs @@ -12,27 +12,27 @@ namespace Subsurface { class NetLobbyScreen : Screen { - GUIFrame menu; - GUIFrame infoFrame; - GUIListBox playerList; + private GUIFrame menu; + private GUIFrame infoFrame; + private GUIListBox playerList; - GUIListBox mapList, modeList, chatBox; - GUITextBox textBox; + private GUIListBox subList, modeList, chatBox; + private GUITextBox textBox; - GUIScrollBar durationBar; + private GUIScrollBar durationBar; - GUIFrame playerFrame; + private GUIFrame playerFrame; - float camAngle; + private float camAngle; - Body previewPlatform; - Hull previewHull; - - public bool isServer; + private Body previewPlatform; + private Hull previewHull; + + public bool IsServer; public Submarine SelectedMap { - get { return mapList.SelectedData as Submarine; } + get { return subList.SelectedData as Submarine; } } @@ -50,6 +50,12 @@ namespace Subsurface } } + public string LevelSeed + { + get; + private set; + } + public string DurationText() { return "Game duration: "+GameDuration+" min"; @@ -58,48 +64,42 @@ namespace Subsurface public NetLobbyScreen() { Rectangle panelRect = new Rectangle( - (int)GUI.style.largePadding.X, - (int)GUI.style.largePadding.Y, - (int)(Game1.GraphicsWidth - GUI.style.largePadding.X * 2.0f), - (int)(Game1.GraphicsHeight - GUI.style.largePadding.Y * 2.0f)); + 40, 40, Game1.GraphicsWidth - 80, Game1.GraphicsHeight - 80); menu = new GUIFrame(panelRect, Color.Transparent); //menu.Padding = GUI.style.smallPadding; //server info panel ------------------------------------------------------------ - infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.6f), (int)(panelRect.Height * 0.6f)), GUI.style.backGroundColor, menu); - infoFrame.Padding = GUI.style.smallPadding; + infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.6f), (int)(panelRect.Height * 0.6f)), GUI.style, menu); + //infoFrame.Padding = GUI.style.smallPadding; //chatbox ---------------------------------------------------------------------- GUIFrame chatFrame = new GUIFrame( - new Rectangle(0, (int)(panelRect.Height * 0.6f + GUI.style.smallPadding.W), + new Rectangle(0, (int)(panelRect.Height * 0.6f + 20), (int)(panelRect.Width * 0.6f), - (int)(panelRect.Height * 0.4f - GUI.style.smallPadding.W)), - GUI.style.backGroundColor, menu); - chatFrame.Padding = GUI.style.smallPadding; + (int)(panelRect.Height * 0.4f - 20)), + GUI.style, menu); - chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, chatFrame); - textBox = new GUITextBox(new Rectangle(0, 0, 0, 25), Color.White, Color.Black, Alignment.Bottom, Alignment.Left, chatFrame); + chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.style, chatFrame); + textBox = new GUITextBox(new Rectangle(0, 0, 0, 25), Alignment.Bottom, GUI.style, chatFrame); textBox.OnEnter = EnterChatMessage; //player info panel ------------------------------------------------------------ playerFrame = new GUIFrame( - new Rectangle((int)(panelRect.Width * 0.6f + GUI.style.smallPadding.Z), 0, - (int)(panelRect.Width * 0.4f - GUI.style.smallPadding.Z), (int)(panelRect.Height * 0.6f)), - GUI.style.backGroundColor, menu); - playerFrame.Padding = GUI.style.smallPadding; + new Rectangle((int)(panelRect.Width * 0.6f + 20), 0, + (int)(panelRect.Width * 0.4f - 20), (int)(panelRect.Height * 0.6f)), + GUI.style, menu); //player list ------------------------------------------------------------------ GUIFrame playerListFrame = new GUIFrame( - new Rectangle((int)(panelRect.Width * 0.6f + GUI.style.smallPadding.Z), (int)(panelRect.Height * 0.6f + GUI.style.smallPadding.W), - (int)(panelRect.Width * 0.4f - GUI.style.smallPadding.Z), (int)(panelRect.Height * 0.4f - GUI.style.smallPadding.W)), - GUI.style.backGroundColor, menu); - playerListFrame.Padding = GUI.style.smallPadding; + new Rectangle((int)(panelRect.Width * 0.6f + 20), (int)(panelRect.Height * 0.6f + 20), + (int)(panelRect.Width * 0.4f - 20), (int)(panelRect.Height * 0.4f - 20)), + GUI.style, menu); - playerList = new GUIListBox(new Rectangle(0,0,0,0), Color.White, playerListFrame); + playerList = new GUIListBox(new Rectangle(0,0,0,0), Color.White, null, playerListFrame); } public override void Deselect() @@ -108,7 +108,7 @@ namespace Subsurface if (previewPlatform!=null) { - Game1.world.RemoveBody(previewPlatform); + Game1.World.RemoveBody(previewPlatform); previewPlatform = null; } @@ -123,41 +123,39 @@ namespace Subsurface { infoFrame.ClearChildren(); - if (isServer && Game1.Server == null) Game1.Server = new GameServer(); + if (IsServer && Game1.Server == null) Game1.NetworkMember = new GameServer(); textBox.Select(); //int oldMapIndex = 0; //if (mapList != null && mapList.SelectedData != null) oldMapIndex = mapList.SelectedIndex; - new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, infoFrame); - mapList = new GUIListBox(new Rectangle(0, 60, 200, 200), Color.White, infoFrame); - mapList.OnSelected = SelectMap; - mapList.Enabled = (Game1.Server!=null); + new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected submarine:", null, null, Alignment.Left, null, infoFrame); + subList = new GUIListBox(new Rectangle(0, 60, 200, 200), Color.White, GUI.style, infoFrame); + subList.OnSelected = SelectMap; + subList.Enabled = (Game1.Server!=null); - if (Submarine.SavedSubmarines.Count>0) + if (Submarine.SavedSubmarines.Count > 0) { - foreach (Submarine map in Submarine.SavedSubmarines) + foreach (Submarine sub in Submarine.SavedSubmarines) { GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - map.Name, - GUI.style, - Alignment.Left, - Alignment.Left, - mapList); + sub.Name, GUI.style, + Alignment.Left, Alignment.Left, + subList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); - textBlock.UserData = map; + textBlock.UserData = sub; } } else { - DebugConsole.ThrowError("No saved maps found!"); + DebugConsole.ThrowError("No saved submarines found!"); return; } - new GUITextBlock(new Rectangle(220, 30, 0, 30), "Selected game mode: ", Color.Transparent, Color.Black, Alignment.Left, infoFrame); - modeList = new GUIListBox(new Rectangle(220, 60, 200, 200), Color.White, infoFrame); + new GUITextBlock(new Rectangle(220, 30, 0, 30), "Selected game mode: ", null, null, Alignment.Left, GUI.style, infoFrame); + modeList = new GUIListBox(new Rectangle(220, 60, 200, 200), GUI.style, infoFrame); modeList.Enabled = (Game1.Server != null); //modeList.OnSelected = new GUIListBox.OnSelectedHandler(SelectEvent); @@ -167,69 +165,75 @@ namespace Subsurface GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - mode.Name, - GUI.style, - Alignment.Left, - Alignment.Left, + mode.Name, GUI.style, + Alignment.Left, Alignment.Left, modeList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = mode; } - GUITextBlock durationText = new GUITextBlock(new Rectangle((int)(modeList.Rect.X + modeList.Rect.Width + GUI.style.smallPadding.X), modeList.Rect.Y, 100, 20), - "Game duration: ", Color.Transparent, Color.Black, Alignment.Left, infoFrame); + GUITextBlock durationText = new GUITextBlock(new Rectangle((int)(modeList.Rect.Right + 20 - 100), 30, 100, 20), + "Game duration: ", GUI.style, Alignment.Left, Alignment.TopLeft, infoFrame); durationText.TextGetter = DurationText; - durationBar = new GUIScrollBar(new Rectangle((int)(modeList.Rect.X + modeList.Rect.Width + GUI.style.smallPadding.X), modeList.Rect.Y + 30, 100, 20), - Color.Gold, 0.1f, Alignment.Left, infoFrame); + durationBar = new GUIScrollBar(new Rectangle((int)(modeList.Rect.Right + 20 - 100), 60, 180, 20), + GUI.style, 0.1f, infoFrame); durationBar.BarSize = 0.1f; durationBar.Enabled = (Game1.Server != null); + + new GUITextBlock(new Rectangle((int)(modeList.Rect.Right + 20 - 80), 100, 100, 20), + "Level Seed: ", GUI.style, Alignment.Left, Alignment.TopLeft, infoFrame); + + GUITextBox seedBox = new GUITextBox(new Rectangle((int)(modeList.Rect.Right + 20 - 80), 130, 180, 20), + Alignment.TopLeft, GUI.style, infoFrame); + seedBox.OnEnter = SelectSeed; + seedBox.Enabled = (Game1.Server != null); - if (isServer && Game1.Server!=null) + if (IsServer && Game1.Server!=null) { - GUIButton startButton = new GUIButton(new Rectangle(0,0,200,30), "Start", Color.White, Alignment.Right | Alignment.Bottom, infoFrame); + GUIButton startButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", GUI.style, infoFrame); startButton.OnClicked = Game1.Server.StartGame; //mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby); modeList.OnSelected = Game1.Server.UpdateNetLobby; durationBar.OnMoved = Game1.Server.UpdateNetLobby; - if (mapList.CountChildren > 0) mapList.Select(0); + if (subList.CountChildren > 0) subList.Select(0); if (GameModePreset.list.Count > 0) modeList.Select(0); } else { int x = playerFrame.Rect.Width / 2; - GUITextBox playerName = new GUITextBox(new Rectangle(x, 0, 0, 20), Color.White, Color.Black, - Alignment.Left | Alignment.Top, Alignment.Left, playerFrame); - playerName.Text = Game1.Client.CharacterInfo.name; + GUITextBox playerName = new GUITextBox(new Rectangle(x, 0, 0, 20), + Alignment.TopLeft, GUI.style, playerFrame); + playerName.Text = Game1.Client.CharacterInfo.Name; playerName.OnEnter += ChangeCharacterName; new GUITextBlock(new Rectangle(x,40,200, 30), "Gender: ", Color.Transparent, Color.Black, - Alignment.Left | Alignment.Top, Alignment.Left, playerFrame); + Alignment.TopLeft, GUI.style, playerFrame); - GUIButton maleButton = new GUIButton(new Rectangle(x+70,50,70,20), "Male", GUI.style, - Alignment.Left | Alignment.Top, playerFrame); + GUIButton maleButton = new GUIButton(new Rectangle(x+70,50,70,20), "Male", + Alignment.TopLeft, GUI.style,playerFrame); maleButton.UserData = Gender.Male; maleButton.OnClicked += SwitchGender; - GUIButton femaleButton = new GUIButton(new Rectangle(x+150, 50, 70, 20), "Female", GUI.style, - Alignment.Left | Alignment.Top, playerFrame); + GUIButton femaleButton = new GUIButton(new Rectangle(x+150, 50, 70, 20), "Female", + Alignment.TopLeft, GUI.style, playerFrame); femaleButton.UserData = Gender.Female; femaleButton.OnClicked += SwitchGender; - new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", Color.Transparent, Color.Black, Alignment.Left, playerFrame); + new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.style, playerFrame); - GUIListBox jobList = new GUIListBox(new Rectangle(0,180,200,0), Color.White, playerFrame); + GUIListBox jobList = new GUIListBox(new Rectangle(0,180,200,0), GUI.style, playerFrame); foreach (Job job in Job.jobList) { - GUITextBlock jobText = new GUITextBlock(new Rectangle(0,0,0,20), job.Name, Color.Transparent, Color.Black, Alignment.Left, jobList); - GUIButton upButton = new GUIButton(new Rectangle(jobText.Rect.Width - 40, 0, 20, 20), "u", Color.White, jobText); + GUITextBlock jobText = new GUITextBlock(new Rectangle(0,0,0,20), job.Name, GUI.style, jobList); + GUIButton upButton = new GUIButton(new Rectangle(jobText.Rect.Width - 40, 0, 20, 20), "u", GUI.style, jobText); upButton.UserData = -1; upButton.OnClicked += ChangeJobPreference; - GUIButton downButton = new GUIButton(new Rectangle(jobText.Rect.Width - 20, 0, 20, 20), "d", Color.White, jobText); + GUIButton downButton = new GUIButton(new Rectangle(jobText.Rect.Width - 20, 0, 20, 20), "d", GUI.style, jobText); downButton.UserData = 1; downButton.OnClicked += ChangeJobPreference; } @@ -340,9 +344,9 @@ namespace Subsurface GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), message, ((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, color, - Alignment.Left, null, true); + Alignment.Left, GUI.style, null, true); - msg.Padding = new Vector4(GUI.style.smallPadding.X, 0, 0, 0); + msg.Padding = new Vector4(20, 0, 0, 0); chatBox.AddChild(msg); } @@ -357,15 +361,8 @@ namespace Subsurface { if (String.IsNullOrEmpty(message)) return false; - if (isServer) - { - Game1.Server.SendChatMessage("Server: " + message); - } - else - { - Game1.Client.SendChatMessage(Game1.Client.Name + ": " + message); - } - + Game1.NetworkMember.SendChatMessage(Game1.NetworkMember.Name + ": " + message); + return true; } @@ -379,11 +376,11 @@ namespace Subsurface Game1.Client.Character = character; - character.animController.isStanding = true; + character.AnimController.IsStanding = true; if (previewPlatform==null) { - Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f); + Body platform = BodyFactory.CreateRectangle(Game1.World, 3.0f, 1.0f, 5.0f); platform.SetTransform(new Vector2(pos.X, pos.Y - 2.5f), 0.0f); platform.IsStatic = true; } @@ -398,9 +395,9 @@ namespace Subsurface for (int i = 0; i < 500; i++) { - character.animController.Update((float)Physics.step); - character.animController.UpdateAnim((float)Physics.step); - Game1.world.Step((float)Physics.step); + character.AnimController.Update((float)Physics.step); + character.AnimController.UpdateAnim((float)Physics.step); + Game1.World.Step((float)Physics.step); } } @@ -409,7 +406,7 @@ namespace Subsurface try { Gender gender = (Gender)obj; - Game1.Client.CharacterInfo.gender = gender; + Game1.Client.CharacterInfo.Gender = gender; Game1.Client.SendCharacterData(); CreatePreviewCharacter(); } @@ -420,11 +417,25 @@ namespace Subsurface return true; } + private bool SelectSeed(GUITextBox textBox, string seed) + { + if (string.IsNullOrWhiteSpace(seed)) + { + textBox.Text = LevelSeed; + } + else + { + LevelSeed = seed; + } + + return true; + } + private bool ChangeCharacterName(GUITextBox textBox, string newName) { if (string.IsNullOrEmpty(newName)) return false; - Game1.Client.CharacterInfo.name = newName; + Game1.Client.CharacterInfo.Name = newName; Game1.Client.Name = newName; Game1.Client.SendCharacterData(); @@ -463,10 +474,37 @@ namespace Subsurface } } + public bool TrySelectMap(string mapName, string md5Hash) + { + Submarine map = Submarine.SavedSubmarines.Find(m => m.Name == mapName); + if (map == null) + { + DebugConsole.ThrowError("The map ''" + mapName + "'' has been selected by the server."); + DebugConsole.ThrowError("Matching map not found in your map folder."); + return false; + } + else + { + if (map.Hash.MD5Hash != md5Hash) + { + DebugConsole.ThrowError("Your version of the map file ''" + map.Name + "'' doesn't match the server's version!"); + DebugConsole.ThrowError("Your file: " + map.Name + "(MD5 hash : " + map.Hash.MD5Hash + ")"); + DebugConsole.ThrowError("Server's file: " + mapName + "(MD5 hash : " + md5Hash + ")"); + return false; + } + else + { + subList.Select(map); + //map.Load(); + return true; + } + } + } + public void WriteData(NetOutgoingMessage msg) { - Submarine selectedMap = mapList.SelectedData as Submarine; + Submarine selectedMap = subList.SelectedData as Submarine; if (selectedMap==null) { @@ -481,35 +519,10 @@ namespace Subsurface msg.Write(modeList.SelectedIndex); msg.Write(durationBar.BarScroll); + msg.Write(LevelSeed); } - public bool TrySelectMap(string mapName, string md5Hash) - { - Submarine map = Submarine.SavedSubmarines.Find(m => m.Name == mapName); - if (map==null) - { - DebugConsole.ThrowError("The map ''" + mapName + "'' has been selected by the server."); - DebugConsole.ThrowError("Matching map not found in your map folder."); - return false; - } - else - { - if (map.Hash.MD5Hash!=md5Hash) - { - DebugConsole.ThrowError("Your version of the map file ''"+map.Name+"'' doesn't match the server's version!"); - DebugConsole.ThrowError("Your file: "+map.Name+"(MD5 hash : "+map.Hash.MD5Hash+")"); - DebugConsole.ThrowError("Server's file: " + mapName + "(MD5 hash : " + md5Hash + ")"); - return false; - } - else - { - mapList.Select(map); - //map.Load(); - return true; - } - } - } public void ReadData(NetIncomingMessage msg) { @@ -523,6 +536,8 @@ namespace Subsurface modeList.Select(msg.ReadInt32()); durationBar.BarScroll = msg.ReadFloat(); + + LevelSeed = msg.ReadString(); } } } diff --git a/Subsurface/Settings.StyleCop b/Subsurface/Settings.StyleCop new file mode 100644 index 000000000..a6d177c6e --- /dev/null +++ b/Subsurface/Settings.StyleCop @@ -0,0 +1,719 @@ + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/Subsurface/Sounds/AmbientSoundManager.cs b/Subsurface/Sounds/AmbientSoundManager.cs index 01053901e..0c0c24181 100644 --- a/Subsurface/Sounds/AmbientSoundManager.cs +++ b/Subsurface/Sounds/AmbientSoundManager.cs @@ -139,7 +139,7 @@ namespace Subsurface float lowpassHFGain = 1.0f; if (Character.Controlled != null) { - AnimController animController = Character.Controlled.animController; + AnimController animController = Character.Controlled.AnimController; if (animController.HeadInWater) { ambienceVolume = 0.5f; @@ -184,7 +184,7 @@ namespace Subsurface if (suitableMusic.Count > 0 && !suitableMusic.Contains(currentMusic)) { - int index = Game1.localRandom.Next(suitableMusic.Count()); + int index = Rand.Int(suitableMusic.Count()); if (currentMusic == null || suitableMusic[index].file != currentMusic.file) { @@ -225,7 +225,7 @@ namespace Subsurface var sounds = damageSounds.Where(x => damage >= x.damageRange.X && damage <= x.damageRange.Y && x.damageType == damageType).ToList(); if (!sounds.Any()) return; - int selectedSound = Game1.localRandom.Next(sounds.Count()); + int selectedSound = Rand.Int(sounds.Count()); int i = 0; foreach (var s in sounds) diff --git a/Subsurface/Sprite.cs b/Subsurface/Sprite.cs index 85c4d754b..676067df0 100644 --- a/Subsurface/Sprite.cs +++ b/Subsurface/Sprite.cs @@ -61,17 +61,17 @@ namespace Subsurface { get { return file; } } - - public Sprite(XElement element, string path ="", string file="") + + public Sprite(XElement element, string path = "", string file = "") { - if (file=="") + if (file == "") { file = ToolBox.GetAttributeString(element, "texture", ""); } - if (file=="") + if (file == "") { - DebugConsole.ThrowError("Sprite "+element+" doesn't have a texture specified!"); + DebugConsole.ThrowError("Sprite " + element + " doesn't have a texture specified!"); return; } @@ -99,7 +99,9 @@ namespace Subsurface origin.X = origin.X * sourceRect.Width; origin.Y = origin.Y * sourceRect.Height; - size = new Vector2(sourceRect.Width, sourceRect.Height); + size = ToolBox.GetAttributeVector2(element, "size", Vector2.One); + size.X *= sourceRect.Width; + size.Y *= sourceRect.Height; Depth = ToolBox.GetAttributeFloat(element, "depth", 0.0f); } diff --git a/Subsurface/StyleCop.Cache b/Subsurface/StyleCop.Cache new file mode 100644 index 000000000..98890f375 --- /dev/null +++ b/Subsurface/StyleCop.Cache @@ -0,0 +1,6492 @@ + + 12 + + DEBUG;TRACE;WINDOWS + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:22:44.086 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:39.620 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:22:44.090 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:22:44.077 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'aiElement' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 69 + False + + + The line contains unnecessary parenthesis. + 89 + 3458 + 3555 + 89 + 56 + 89 + 153 + False + + + The line contains unnecessary parenthesis. + 291 + 10678 + 10702 + 291 + 89 + 291 + 113 + False + + + The line contains unnecessary parenthesis. + 478 + 18243 + 18262 + 478 + 30 + 478 + 49 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.17 14:46:27.045 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:46.812 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:19:26.001 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:22:44.082 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Readonly variables that are not declared private must start with an upper-case letter: stepSize. + 27 + False + + + Readonly variables that are not declared private must start with an upper-case letter: legTorque. + 28 + False + + + Readonly variables that are not declared private must start with an upper-case letter: stepOffset. + 29 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:22:44.094 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:18:22.996 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'aiController' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 56 + False + + + The line contains unnecessary parenthesis. + 974 + 33566 + 33576 + 974 + 40 + 974 + 50 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:02:52.124 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 73 + 2090 + 2160 + 73 + 40 + 73 + 110 + False + + + The line contains unnecessary parenthesis. + 80 + 2470 + 2539 + 80 + 39 + 80 + 108 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:38.763 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:14:50.050 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 150 + 5504 + 5551 + 150 + 30 + 150 + 77 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:07.268 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 105 + 3924 + 3948 + 105 + 31 + 105 + 55 + False + + + The line contains unnecessary parenthesis. + 226 + 8870 + 8903 + 226 + 32 + 226 + 65 + False + + + The line contains unnecessary parenthesis. + 263 + 10577 + 10628 + 263 + 49 + 263 + 100 + False + + + The line contains unnecessary parenthesis. + 358 + 14276 + 14333 + 358 + 34 + 358 + 91 + False + + + The line contains unnecessary parenthesis. + 662 + 27438 + 27476 + 662 + 29 + 662 + 67 + False + + + The line contains unnecessary parenthesis. + 674 + 27851 + 27889 + 674 + 29 + 674 + 67 + False + + + The line contains unnecessary parenthesis. + 685 + 28346 + 28406 + 685 + 33 + 685 + 93 + False + + + The line contains unnecessary parenthesis. + 691 + 28688 + 28747 + 691 + 33 + 691 + 92 + False + + + The line contains unnecessary parenthesis. + 745 + 30705 + 30727 + 745 + 39 + 745 + 61 + False + + + The line contains unnecessary parenthesis. + 746 + 30778 + 30801 + 746 + 40 + 746 + 63 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.062 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: jobList. + 8 + False + + + Public and internal fields must start with an upper-case letter: itemNames. + 14 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:54.813 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: character. + 22 + False + + + Readonly variables that are not declared private must start with an upper-case letter: character. + 22 + False + + + Public and internal fields must start with an upper-case letter: body. + 25 + False + + + Public and internal fields must start with an upper-case letter: sprite. + 34 + False + + + Public and internal fields must start with an upper-case letter: inWater. + 36 + False + + + Public and internal fields must start with an upper-case letter: pullJoint. + 38 + False + + + Public and internal fields must start with an upper-case letter: type. + 40 + False + + + Readonly variables that are not declared private must start with an upper-case letter: type. + 40 + False + + + Public and internal fields must start with an upper-case letter: ignoreCollisions. + 42 + False + + + Readonly variables that are not declared private must start with an upper-case letter: ignoreCollisions. + 42 + False + + + Public and internal fields must start with an upper-case letter: impactTolerance. + 48 + False + + + Readonly variables that are not declared private must start with an upper-case letter: impactTolerance. + 48 + False + + + Public and internal fields must start with an upper-case letter: soundTimer. + 55 + False + + + Public and internal fields must start with an upper-case letter: attack. + 58 + False + + + Readonly variables that are not declared private must start with an upper-case letter: attack. + 58 + False + + + The line contains unnecessary parenthesis. + 116 + 2764 + 2803 + 116 + 26 + 116 + 65 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.538 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: list. + 16 + False + + + Public and internal fields must start with an upper-case letter: limbs. + 22 + False + + + Public and internal fields must start with an upper-case letter: limbJoints. + 24 + False + + + Public and internal fields must start with an upper-case letter: movement. + 38 + False + + + Public and internal fields must start with an upper-case letter: correctionMovement. + 44 + False + + + Public and internal fields must start with an upper-case letter: onGround. + 50 + False + + + The line contains unnecessary parenthesis. + 92 + 2386 + 2425 + 92 + 26 + 92 + 65 + False + + + The line contains unnecessary parenthesis. + 122 + 3115 + 3131 + 122 + 43 + 122 + 59 + False + + + Variable names and private field names must start with a lower-case letter: ID. + 167 + False + + + The line contains unnecessary parenthesis. + 300 + 10308 + 10338 + 300 + 37 + 300 + 67 + False + + + The line contains unnecessary parenthesis. + 517 + 18881 + 18930 + 517 + 47 + 517 + 96 + False + + + The line contains unnecessary parenthesis. + 544 + 19791 + 19847 + 544 + 29 + 544 + 85 + False + + + The line contains unnecessary parenthesis. + 546 + 19887 + 19939 + 546 + 35 + 546 + 87 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:21.597 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: propertyNames. + 20 + False + + + Public and internal fields must start with an upper-case letter: type. + 27 + False + + + Readonly variables that are not declared private must start with an upper-case letter: type. + 27 + False + + + Variable names and private field names must start with a lower-case letter: Flags. + 92 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:54.720 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: text. + 13 + False + + + Public and internal fields must start with an upper-case letter: color. + 14 + False + + + Public and internal fields must start with an upper-case letter: messages. + 25 + False + + + The line contains unnecessary parenthesis. + 256 + 9353 + 9357 + 256 + 38 + 256 + 42 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.17 15:10:02.281 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not contain underscores. + 12 + False + + + Field names must not contain underscores. + 13 + False + + + Field names must not contain underscores. + 14 + False + + + Field names must not contain underscores. + 15 + False + + + Variable names and private field names must start with a lower-case letter: Flags. + 20 + False + + + method names begin with an upper-case letter: getName. + 28 + False + + + The variable name 'lParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 39 + False + + + The variable name 'lParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 41 + False + + + The variable name 'hIMC' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 123 + False + + + Field names must not contain underscores. + 126 + False + + + Field names must not contain underscores. + 127 + False + + + Field names must not contain underscores. + 128 + False + + + Field names must not contain underscores. + 129 + False + + + Field names must not contain underscores. + 130 + False + + + Field names must not contain underscores. + 131 + False + + + Field names must not contain underscores. + 132 + False + + + Field names must not contain underscores. + 133 + False + + + Field names must not contain underscores. + 134 + False + + + The variable name 'hWnd' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 138 + False + + + The variable name 'hWnd' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 141 + False + + + The variable name 'hIMC' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 141 + False + + + The variable name 'lpPrevWndFunc' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 144 + False + + + The variable name 'hWnd' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 144 + False + + + Variable names and private field names must start with a lower-case letter: Msg. + 144 + False + + + The variable name 'wParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 144 + False + + + The variable name 'lParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 144 + False + + + The variable name 'hWnd' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 147 + False + + + The variable name 'nIndex' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 147 + False + + + The variable name 'dwNewLong' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 147 + False + + + The variable name 'hWnd' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 167 + False + + + The variable name 'wParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 167 + False + + + The variable name 'lParam' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 167 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.03 20:02:36.269 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not start with an underscore. + 63 + False + + + Field names must not start with an underscore. + 78 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.03.25 18:58:36.611 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:19:50.954 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 20:15:28.266 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: IsFinishedChecker. + 9 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 20:16:05.151 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:12:45.668 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 23:15:38.883 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 23:17:11.670 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 19:51:49.005 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.24 20:49:28.100 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not start with an underscore. + 15 + False + + + The line contains unnecessary parenthesis. + 24 + 808 + 824 + 24 + 42 + 24 + 58 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 19:13:14.704 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: graphics. + 18 + False + + + Public and internal fields must start with an upper-case letter: frameCounter. + 24 + False + + + Public and internal fields must start with an upper-case letter: version. + 26 + False + + + Readonly variables that are not declared private must start with an upper-case letter: version. + 26 + False + + + Static readonly fields must start with an upper-case letter: version. + 26 + False + + + Public and internal fields must start with an upper-case letter: particleManager. + 41 + False + + + Public and internal fields must start with an upper-case letter: textureLoader. + 43 + False + + + Public and internal fields must start with an upper-case letter: world. + 45 + False + + + Public and internal fields must start with an upper-case letter: localRandom. + 47 + False + + + Public and internal fields must start with an upper-case letter: random. + 48 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:54.804 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: characters. + 12 + False + + + Public and internal fields must start with an upper-case letter: characterInfos. + 13 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:12:45.676 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: list. + 11 + False + + + Public and internal fields must start with an upper-case letter: presetList. + 39 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 19:13:14.698 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: taskManager. + 15 + False + + + Readonly variables that are not declared private must start with an upper-case letter: taskManager. + 15 + False + + + Public and internal fields must start with an upper-case letter: gameMode. + 21 + False + + + Readonly variables that are not declared private must start with an upper-case letter: gameMode. + 21 + False + + + Public and internal fields must start with an upper-case letter: map. + 34 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.081 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: availableCharacters. + 7 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.529 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: crewManager. + 13 + False + + + Readonly variables that are not declared private must start with an upper-case letter: crewManager. + 13 + False + + + Public and internal fields must start with an upper-case letter: hireManager. + 14 + False + + + Readonly variables that are not declared private must start with an upper-case letter: hireManager. + 14 + False + + + The line contains unnecessary parenthesis. + 76 + 2178 + 2208 + 76 + 20 + 76 + 50 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:54.762 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:43:45.572 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: textColor. + 16 + False + + + Readonly variables that are not declared private must start with an upper-case letter: textColor. + 16 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 19:12:30.866 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: style. + 69 + False + + + Public and internal fields must start with an upper-case letter: font. + 72 + False + + + The line contains unnecessary parenthesis. + 251 + 8588 + 8648 + 251 + 27 + 251 + 87 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:49:54.655 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 37 + 1226 + 1257 + 37 + 39 + 37 + 70 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:56:30.039 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: children. + 33 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 00:53:19.330 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 9 + 247 + 278 + 9 + 32 + 9 + 63 + False + + + The line contains unnecessary parenthesis. + 15 + 460 + 491 + 15 + 33 + 15 + 64 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:56:30.026 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 23:37:56.626 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 88 + 2378 + 2409 + 88 + 33 + 88 + 64 + False + + + The line contains unnecessary parenthesis. + 160 + 4498 + 4521 + 160 + 30 + 160 + 53 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 20:01:07.071 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: messageBoxes. + 8 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:56:30.016 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 35 + 942 + 973 + 35 + 40 + 35 + 71 + False + + + The line contains unnecessary parenthesis. + 44 + 1261 + 1286 + 44 + 28 + 44 + 53 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 23:02:10.417 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: draggingBar. + 9 + False + + + The line contains unnecessary parenthesis. + 92 + 2837 + 2862 + 92 + 28 + 92 + 53 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:31:31.306 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:56:30.046 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 80 + 2337 + 2368 + 80 + 49 + 80 + 80 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:54.746 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not start with an underscore. + 122 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:56:30.021 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.09 21:26:00.170 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.28 23:36:21.304 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 203 + 6921 + 6941 + 203 + 42 + 203 + 62 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.18 20:21:05.197 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: inventory. + 13 + False + + + The line contains unnecessary parenthesis. + 119 + 3745 + 3801 + 119 + 20 + 119 + 76 + False + + + The line contains unnecessary parenthesis. + 202 + 7056 + 7071 + 202 + 20 + 202 + 35 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.477 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 79 + 2202 + 2209 + 79 + 29 + 79 + 36 + False + + + The line contains unnecessary parenthesis. + 238 + 7429 + 7436 + 238 + 43 + 238 + 50 + False + + + The line contains unnecessary parenthesis. + 243 + 7560 + 7567 + 243 + 29 + 243 + 36 + False + + + The line contains unnecessary parenthesis. + 256 + 8001 + 8017 + 256 + 27 + 256 + 43 + False + + + The line contains unnecessary parenthesis. + 321 + 10641 + 10653 + 321 + 26 + 321 + 38 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.259 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.251 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.293 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 31 + 944 + 1010 + 31 + 24 + 31 + 90 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.241 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 59 + 1709 + 1775 + 59 + 24 + 59 + 90 + False + + + The line contains unnecessary parenthesis. + 123 + 3976 + 4009 + 123 + 36 + 123 + 69 + False + + + The line contains unnecessary parenthesis. + 135 + 4412 + 4440 + 135 + 36 + 135 + 64 + False + + + The line contains unnecessary parenthesis. + 143 + 4718 + 4746 + 143 + 36 + 143 + 64 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.195 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:12:45.638 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: sound. + 18 + False + + + Readonly variables that are not declared private must start with an upper-case letter: sound. + 18 + False + + + Public and internal fields must start with an upper-case letter: type. + 19 + False + + + Readonly variables that are not declared private must start with an upper-case letter: type. + 19 + False + + + Public and internal fields must start with an upper-case letter: volumeProperty. + 21 + False + + + Public and internal fields must start with an upper-case letter: range. + 23 + False + + + Readonly variables that are not declared private must start with an upper-case letter: range. + 23 + False + + + Public and internal fields must start with an upper-case letter: statusEffects. + 49 + False + + + Public and internal fields must start with an upper-case letter: requiredItems. + 53 + False + + + Public and internal fields must start with an upper-case letter: properties. + 59 + False + + + Readonly variables that are not declared private must start with an upper-case letter: properties. + 59 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.212 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.319 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: limbType. + 12 + False + + + Public and internal fields must start with an upper-case letter: position. + 13 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.30 01:14:39.544 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 19:45:05.218 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 149 + 5930 + 5945 + 149 + 20 + 149 + 35 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.547 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 18:26:33.795 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 19 + 352 + 383 + 19 + 20 + 19 + 51 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.30 01:14:42.021 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 161 + 4936 + 4950 + 161 + 28 + 161 + 42 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.30 17:49:05.968 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 18:26:33.777 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 88 + 2357 + 2376 + 88 + 20 + 88 + 39 + False + + + The line contains unnecessary parenthesis. + 309 + 9955 + 9995 + 309 + 29 + 309 + 69 + False + + + The line contains unnecessary parenthesis. + 334 + 11381 + 11390 + 334 + 62 + 334 + 71 + False + + + The line contains unnecessary parenthesis. + 335 + 11539 + 11575 + 335 + 86 + 335 + 122 + False + + + The line contains unnecessary parenthesis. + 335 + 11540 + 11549 + 335 + 87 + 335 + 96 + False + + + The variable name 'xOffset' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 309 + False + + + The variable name 'yScale' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 359 + False + + + The variable name 'xOffset' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 353 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 20:38:37.986 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 18:26:33.788 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.26 19:54:31.573 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 87 + 2526 + 2555 + 87 + 39 + 87 + 68 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:20:39.643 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 18:25:12.219 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:13:14.143 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: ignoredBodies. + 23 + False + + + The line contains unnecessary parenthesis. + 165 + 5469 + 5494 + 165 + 29 + 165 + 54 + False + + + The line contains unnecessary parenthesis. + 169 + 5676 + 5706 + 169 + 39 + 169 + 69 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:18:41.618 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 274 + 10193 + 10251 + 274 + 29 + 274 + 87 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:19:18.779 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:18:55.564 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: name. + 19 + False + + + Readonly variables that are not declared private must start with an upper-case letter: name. + 19 + False + + + Public and internal fields must start with an upper-case letter: wires. + 21 + False + + + Public and internal fields must start with an upper-case letter: isOutput. + 25 + False + + + Readonly variables that are not declared private must start with an upper-case letter: isOutput. + 25 + False + + + The line contains unnecessary parenthesis. + 67 + 1987 + 2023 + 67 + 24 + 67 + 60 + False + + + The line contains unnecessary parenthesis. + 68 + 2090 + 2099 + 68 + 64 + 68 + 73 + False + + + The line contains unnecessary parenthesis. + 289 + 10021 + 10030 + 289 + 35 + 289 + 44 + False + + + The line contains unnecessary parenthesis. + 341 + 12123 + 12136 + 341 + 27 + 341 + 40 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:57:38.590 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: connections. + 10 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:20:39.686 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 49 + 1699 + 1713 + 49 + 32 + 49 + 46 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:20:39.649 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.24 19:28:13.260 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.116 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.29 17:21:52.259 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 18:26:33.766 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Constants must start with an upper-case letter: nodeDistance. + 13 + False + + + Constants must start with an upper-case letter: heightFromFloor. + 14 + False + + + The line contains unnecessary parenthesis. + 263 + 7984 + 8013 + 263 + 29 + 263 + 58 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:18:44.151 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.286 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.18 20:18:29.506 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: draggingItem. + 13 + False + + + Public and internal fields must start with an upper-case letter: doubleClickedItem. + 14 + False + + + Public and internal fields must start with an upper-case letter: items. + 40 + False + + + The line contains unnecessary parenthesis. + 81 + 2067 + 2084 + 81 + 20 + 81 + 37 + False + + + The line contains unnecessary parenthesis. + 260 + 8853 + 8863 + 260 + 93 + 260 + 103 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 20:08:48.769 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: itemList. + 25 + False + + + Public and internal fields must start with an upper-case letter: components. + 33 + False + + + Public and internal fields must start with an upper-case letter: properties. + 35 + False + + + Readonly variables that are not declared private must start with an upper-case letter: properties. + 35 + False + + + Public and internal fields must start with an upper-case letter: body. + 41 + False + + + Public and internal fields must start with an upper-case letter: inventory. + 46 + False + + + Public and internal fields must start with an upper-case letter: container. + 48 + False + + + property names begin with an upper-case letter: sprite. + 55 + False + + + The line contains unnecessary parenthesis. + 328 + 9733 + 9752 + 328 + 20 + 328 + 39 + False + + + The line contains unnecessary parenthesis. + 347 + 10371 + 10398 + 347 + 31 + 347 + 58 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.505 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 37 + 1029 + 1092 + 37 + 20 + 37 + 83 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.277 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: triggers. + 33 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.18 22:23:07.479 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: statusEffects. + 23 + False + + + Readonly variables that are not declared private must start with an upper-case letter: statusEffects. + 23 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 08:53:08.295 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: dictionary. + 10 + False + + + The variable name 'aiTarget' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 14 + False + + + Variable names and private field names must start with a lower-case letter: IDfound. + 47 + False + + + Variable names and private field names must start with a lower-case letter: ID. + 64 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.467 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.28 00:13:32.575 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: isHorizontal. + 13 + False + + + The line contains unnecessary parenthesis. + 57 + 1344 + 1369 + 57 + 28 + 57 + 53 + False + + + The line contains unnecessary parenthesis. + 93 + 2169 + 2334 + 93 + 20 + 94 + 122 + False + + + The line contains unnecessary parenthesis. + 287 + 10017 + 10030 + 287 + 26 + 287 + 39 + False + + + The line contains unnecessary parenthesis. + 318 + 11811 + 11824 + 318 + 87 + 318 + 100 + False + + + The line contains unnecessary parenthesis. + 337 + 12834 + 12847 + 337 + 87 + 337 + 100 + False + + + The line contains unnecessary parenthesis. + 457 + 18162 + 18175 + 457 + 26 + 457 + 39 + False + + + The line contains unnecessary parenthesis. + 528 + 20654 + 20690 + 528 + 33 + 528 + 69 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:19:50.999 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: hullList. + 15 + False + + + Public and internal fields must start with an upper-case letter: renderer. + 19 + False + + + Public and internal fields must start with an upper-case letter: properties. + 35 + False + + + Readonly variables that are not declared private must start with an upper-case letter: properties. + 35 + False + + + The line contains unnecessary parenthesis. + 99 + 2691 + 2716 + 99 + 26 + 99 + 51 + False + + + The line contains unnecessary parenthesis. + 128 + 3413 + 3445 + 128 + 29 + 128 + 61 + False + + + The line contains unnecessary parenthesis. + 153 + 4115 + 4282 + 153 + 20 + 154 + 124 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.01 23:37:05.668 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.557 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Constants must start with an upper-case letter: gridCellWidth. + 27 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.143 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: list. + 10 + False + + + The line contains unnecessary parenthesis. + 113 + 4014 + 4036 + 113 + 33 + 113 + 55 + False + + + The variable name 'svCount' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 144 + False + + + Variable names and private field names must start with a lower-case letter: L. + 107 + False + + + Variable names and private field names must start with a lower-case letter: N. + 109 + False + + + Variable names and private field names must start with a lower-case letter: L2P. + 157 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.145 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: viewPos. + 8 + False + + + Public and internal fields must start with an upper-case letter: fowEnabled. + 10 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.26 20:27:37.513 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.30 21:39:36.517 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.207 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: mapEntityList. + 15 + False + + + Public and internal fields must start with an upper-case letter: linkedTo. + 30 + False + + + property names begin with an upper-case letter: sprite. + 48 + False + + + The line contains unnecessary parenthesis. + 120 + 3216 + 3255 + 120 + 20 + 120 + 59 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:12:45.629 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: list. + 12 + False + + + Public and internal fields must start with an upper-case letter: sprite. + 18 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 19:18:35.023 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.302 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: rect. + 20 + False + + + Public and internal fields must start with an upper-case letter: damage. + 21 + False + + + Public and internal fields must start with an upper-case letter: gap. + 22 + False + + + Public and internal fields must start with an upper-case letter: isHighLighted. + 24 + False + + + Public and internal fields must start with an upper-case letter: wallList. + 42 + False + + + property names begin with an upper-case letter: sprite. + 56 + False + + + The line contains unnecessary parenthesis. + 140 + 3498 + 3521 + 140 + 28 + 140 + 51 + False + + + The line contains unnecessary parenthesis. + 159 + 4271 + 4289 + 159 + 47 + 159 + 65 + False + + + The line contains unnecessary parenthesis. + 265 + 8282 + 8296 + 265 + 27 + 265 + 41 + False + + + The line contains unnecessary parenthesis. + 275 + 8843 + 8871 + 275 + 35 + 275 + 63 + False + + + The line contains unnecessary parenthesis. + 341 + 11249 + 11297 + 341 + 20 + 341 + 68 + False + + + The line contains unnecessary parenthesis. + 357 + 11676 + 11689 + 357 + 25 + 357 + 38 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.007 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:12:45.619 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: gridSize. + 31 + False + + + Readonly variables that are not declared private must start with an upper-case letter: gridSize. + 31 + False + + + Static readonly fields must start with an upper-case letter: gridSize. + 31 + False + + + Variable names and private field names must start with a lower-case letter: SaveFolder. + 36 + False + + + Variable names and private field names must start with a lower-case letter: Orin. + 193 + False + + + The line contains unnecessary parenthesis. + 280 + 8681 + 8794 + 280 + 20 + 281 + 66 + False + + + Field names must not start with an underscore. + 716 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 20:41:57.558 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: position. + 10 + False + + + Public and internal fields must start with an upper-case letter: vertices. + 47 + False + + + Public and internal fields must start with an upper-case letter: positionInBuffer. + 51 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.057 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 36 + 927 + 938 + 36 + 25 + 36 + 36 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.25 17:09:12.506 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not contain underscores. + 86 + False + + + Variable names and private field names must start with a lower-case letter: PQcount. + 88 + False + + + Variable names and private field names must start with a lower-case letter: PQmin. + 89 + False + + + Variable names and private field names must start with a lower-case letter: PQhashsize. + 90 + False + + + Variable names and private field names must start with a lower-case letter: PQhash. + 91 + False + + + Variable names and private field names must start with a lower-case letter: ELhashsize. + 96 + False + + + Variable names and private field names must start with a lower-case letter: ELhash. + 97 + False + + + Variable names and private field names must start with a lower-case letter: ELleftend. + 98 + False + + + method names begin with an upper-case letter: generateVoronoi. + 126 + False + + + The variable name 'xValuesIn' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 126 + False + + + The variable name 'yValuesIn' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 126 + False + + + method names begin with an upper-case letter: sort. + 160 + False + + + The variable name 'xValues' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 173 + False + + + The variable name 'yValues' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 174 + False + + + The variable name 'xValuesIn' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 160 + False + + + The variable name 'yValuesIn' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 160 + False + + + method names begin with an upper-case letter: qsort. + 183 + False + + + method names begin with an upper-case letter: sortNode. + 200 + False + + + The variable name 'xValues' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 200 + False + + + The variable name 'yValues' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 200 + False + + + method names begin with an upper-case letter: nextone. + 231 + False + + + method names begin with an upper-case letter: bisect. + 243 + False + + + method names begin with an upper-case letter: makevertex. + 282 + False + + + The line contains unnecessary parenthesis. + 362 + 9691 + 9706 + 362 + 11 + 362 + 26 + False + + + The line contains unnecessary parenthesis. + 439 + 11166 + 11220 + 439 + 11 + 439 + 65 + False + + + method names begin with an upper-case letter: leftreg. + 433 + False + + + The line contains unnecessary parenthesis. + 446 + 11352 + 11363 + 446 + 4 + 446 + 15 + False + + + The line contains unnecessary parenthesis. + 456 + 11575 + 11585 + 456 + 4 + 456 + 14 + False + + + The line contains unnecessary parenthesis. + 457 + 11613 + 11624 + 457 + 4 + 457 + 15 + False + + + method names begin with an upper-case letter: pushGraphEdge. + 539 + False + + + method names begin with an upper-case letter: clip_line. + 550 + False + + + method names begin with an upper-case letter: endpoint. + 669 + False + + + The line contains unnecessary parenthesis. + 720 + 17647 + 17658 + 720 + 30 + 720 + 41 + False + + + The line contains unnecessary parenthesis. + 736 + 18035 + 18068 + 736 + 11 + 736 + 44 + False + + + method names begin with an upper-case letter: right_of. + 678 + False + + + The line contains unnecessary parenthesis. + 745 + 18263 + 18274 + 745 + 12 + 745 + 23 + False + + + The line contains unnecessary parenthesis. + 750 + 18410 + 18464 + 750 + 11 + 750 + 65 + False + + + method names begin with an upper-case letter: rightreg. + 739 + False + + + method names begin with an upper-case letter: dist. + 753 + False + + + method names begin with an upper-case letter: intersect. + 763 + False + + + The line contains unnecessary parenthesis. + 849 + 21152 + 21166 + 849 + 23 + 849 + 37 + False + + + method names begin with an upper-case letter: voronoi_bd. + 818 + False + + + The variable name 'xVal' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 977 + False + + + The variable name 'yVal' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 978 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.30 23:44:36.088 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: x. + 63 + False + + + method names begin with an upper-case letter: setPoint. + 69 + False + + + Public and internal fields must start with an upper-case letter: coord. + 79 + False + + + Public and internal fields must start with an upper-case letter: sitenbr. + 80 + False + + + Public and internal fields must start with an upper-case letter: a. + 90 + False + + + Public and internal fields must start with an upper-case letter: ep. + 91 + False + + + Public and internal fields must start with an upper-case letter: reg. + 92 + False + + + Public and internal fields must start with an upper-case letter: edgenbr. + 93 + False + + + Public and internal fields must start with an upper-case letter: deleted. + 107 + False + + + Public and internal fields must start with an upper-case letter: vertex. + 109 + False + + + Public and internal fields must start with an upper-case letter: ystar. + 110 + False + + + Public and internal fields must start with an upper-case letter: edges. + 121 + False + + + Public and internal fields must start with an upper-case letter: site. + 122 + False + + + Public and internal fields must start with an upper-case letter: bodyVertices. + 124 + False + + + Public and internal fields must start with an upper-case letter: body. + 126 + False + + + Public and internal fields must start with an upper-case letter: point1. + 144 + False + + + Public and internal fields must start with an upper-case letter: site1. + 145 + False + + + Public and internal fields must start with an upper-case letter: cell1. + 146 + False + + + Public and internal fields must start with an upper-case letter: isSolid. + 148 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 00:40:04.990 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: A. + 135 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:01:46.125 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: Client. + 12 + False + + + Variable names and private field names must start with a lower-case letter: Config. + 40 + False + + + Variable names and private field names must start with a lower-case letter: CanStart. + 98 + False + + + The line contains unnecessary parenthesis. + 178 + 6204 + 6229 + 178 + 25 + 178 + 50 + False + + + Variable names and private field names must start with a lower-case letter: ID. + 343 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.522 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: Server. + 12 + False + + + Variable names and private field names must start with a lower-case letter: Config. + 13 + False + + + Public and internal fields must start with an upper-case letter: connectedClients. + 15 + False + + + The line contains unnecessary parenthesis. + 64 + 1753 + 1765 + 64 + 17 + 64 + 29 + False + + + The line contains unnecessary parenthesis. + 260 + 9868 + 9893 + 260 + 21 + 260 + 46 + False + + + Public and internal fields must start with an upper-case letter: name. + 504 + False + + + Public and internal fields must start with an upper-case letter: character. + 506 + False + + + Public and internal fields must start with an upper-case letter: characterInfo. + 507 + False + + + Public and internal fields must start with an upper-case letter: version. + 509 + False + + + Public and internal fields must start with an upper-case letter: inGame. + 510 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 20:21:44.926 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: events. + 18 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 19:13:32.146 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:19:51.028 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + property names begin with an upper-case letter: yLimits. + 40 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.047 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: particleCount. + 12 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.17 14:46:27.065 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: name. + 8 + False + + + Readonly variables that are not declared private must start with an upper-case letter: name. + 8 + False + + + Public and internal fields must start with an upper-case letter: sprite. + 10 + False + + + Readonly variables that are not declared private must start with an upper-case letter: sprite. + 10 + False + + + Public and internal fields must start with an upper-case letter: angularVelocityMin. + 12 + False + + + Readonly variables that are not declared private must start with an upper-case letter: angularVelocityMin. + 12 + False + + + Public and internal fields must start with an upper-case letter: startRotationMin. + 14 + False + + + Readonly variables that are not declared private must start with an upper-case letter: startRotationMin. + 14 + False + + + Public and internal fields must start with an upper-case letter: startSizeMin. + 16 + False + + + Readonly variables that are not declared private must start with an upper-case letter: startSizeMin. + 16 + False + + + Public and internal fields must start with an upper-case letter: sizeChangeMin. + 17 + False + + + Readonly variables that are not declared private must start with an upper-case letter: sizeChangeMin. + 17 + False + + + Public and internal fields must start with an upper-case letter: startColor. + 19 + False + + + Readonly variables that are not declared private must start with an upper-case letter: startColor. + 19 + False + + + Public and internal fields must start with an upper-case letter: startAlpha. + 20 + False + + + Readonly variables that are not declared private must start with an upper-case letter: startAlpha. + 20 + False + + + Public and internal fields must start with an upper-case letter: colorChange. + 22 + False + + + Readonly variables that are not declared private must start with an upper-case letter: colorChange. + 22 + False + + + Public and internal fields must start with an upper-case letter: lifeTime. + 24 + False + + + Readonly variables that are not declared private must start with an upper-case letter: lifeTime. + 24 + False + + + Public and internal fields must start with an upper-case letter: deleteOnHit. + 26 + False + + + Readonly variables that are not declared private must start with an upper-case letter: deleteOnHit. + 26 + False + + + Public and internal fields must start with an upper-case letter: velocityChange. + 28 + False + + + Readonly variables that are not declared private must start with an upper-case letter: velocityChange. + 28 + False + + + Public and internal fields must start with an upper-case letter: inWater. + 30 + False + + + Readonly variables that are not declared private must start with an upper-case letter: inWater. + 30 + False + + + Public and internal fields must start with an upper-case letter: rotateToDirection. + 32 + False + + + Readonly variables that are not declared private must start with an upper-case letter: rotateToDirection. + 32 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 16:35:54.927 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: accumulator. + 21 + False + + + Public and internal fields must start with an upper-case letter: step. + 22 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.27 14:19:30.436 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: list. + 21 + False + + + Public and internal fields must start with an upper-case letter: bodyShape. + 37 + False + + + Readonly variables that are not declared private must start with an upper-case letter: bodyShape. + 37 + False + + + Public and internal fields must start with an upper-case letter: height. + 38 + False + + + Readonly variables that are not declared private must start with an upper-case letter: height. + 38 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.12 23:58:02.957 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Constants must start with an upper-case letter: doubleClickDelay. + 64 + False + + + Public and internal fields must start with an upper-case letter: selectKey. + 68 + False + + + The line contains unnecessary parenthesis. + 116 + 2789 + 2903 + 116 + 20 + 117 + 65 + False + + + The line contains unnecessary parenthesis. + 122 + 2999 + 3115 + 122 + 20 + 123 + 66 + False + + + The line contains unnecessary parenthesis. + 133 + 3313 + 3381 + 133 + 20 + 133 + 88 + False + + + The line contains unnecessary parenthesis. + 138 + 3477 + 3509 + 138 + 20 + 138 + 52 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.28 23:55:35.836 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.17 14:46:27.065 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.167 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: defaultValue. + 24 + False + + + Public and internal fields must start with an upper-case letter: isSaveable. + 25 + False + + + The line contains unnecessary parenthesis. + 83 + 2209 + 2233 + 83 + 40 + 83 + 64 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.23 17:50:40.027 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'sDir' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 112 + False + + + The variable name 'sRelativePath' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 112 + False + + + Variable names and private field names must start with a lower-case letter: Readed. + 130 + False + + + The variable name 'iNameLen' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 134 + False + + + The variable name 'sFileName' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 143 + False + + + The variable name 'iFileLen' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 150 + False + + + The variable name 'sFilePath' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 155 + False + + + The variable name 'sFinalDir' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 156 + False + + + The variable name 'sDir' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 126 + False + + + The variable name 'sFiles' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 168 + False + + + The variable name 'iDirLen' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 169 + False + + + The variable name 'sInDir' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 166 + False + + + The variable name 'sOutFile' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 166 + False + + + The variable name 'sFilePath' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 173 + False + + + The variable name 'sRelativePath' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 175 + False + + + The variable name 'sCompressedFile' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 182 + False + + + The variable name 'sDir' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 182 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.514 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: GUIpanel. + 15 + False + + + The line contains unnecessary parenthesis. + 239 + 8610 + 8631 + 239 + 36 + 239 + 57 + False + + + The line contains unnecessary parenthesis. + 240 + 8670 + 8691 + 240 + 36 + 240 + 57 + False + + + The line contains unnecessary parenthesis. + 323 + 11914 + 11929 + 323 + 34 + 323 + 49 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.186 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Variable names and private field names must start with a lower-case letter: GUIpanel. + 12 + False + + + Variable names and private field names must start with a lower-case letter: GUItabs. + 14 + False + + + The line contains unnecessary parenthesis. + 134 + 5391 + 5405 + 134 + 28 + 134 + 42 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:17:30.496 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:16:54.771 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 20:02:30.912 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'ipBox' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 19 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.269 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The line contains unnecessary parenthesis. + 136 + 4680 + 4699 + 136 + 31 + 136 + 50 + False + + + The line contains unnecessary parenthesis. + 159 + 5688 + 5709 + 159 + 32 + 159 + 53 + False + + + The line contains unnecessary parenthesis. + 182 + 6813 + 6834 + 182 + 35 + 182 + 56 + False + + + The line contains unnecessary parenthesis. + 190 + 7280 + 7301 + 190 + 31 + 190 + 52 + False + + + The variable name 'upButton' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 232 + False + + + The line contains unnecessary parenthesis. + 292 + 11473 + 11645 + 292 + 30 + 294 + 79 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.07 19:30:43.178 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 21:15:28.278 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: damageRange. + 23 + False + + + Readonly variables that are not declared private must start with an upper-case letter: damageRange. + 23 + False + + + Public and internal fields must start with an upper-case letter: damageType. + 25 + False + + + Readonly variables that are not declared private must start with an upper-case letter: damageType. + 25 + False + + + Public and internal fields must start with an upper-case letter: sound. + 27 + False + + + Readonly variables that are not declared private must start with an upper-case letter: sound. + 27 + False + + + Public and internal fields must start with an upper-case letter: file. + 39 + False + + + Readonly variables that are not declared private must start with an upper-case letter: file. + 39 + False + + + Public and internal fields must start with an upper-case letter: type. + 40 + False + + + Readonly variables that are not declared private must start with an upper-case letter: type. + 40 + False + + + Public and internal fields must start with an upper-case letter: priorityRange. + 42 + False + + + Readonly variables that are not declared private must start with an upper-case letter: priorityRange. + 42 + False + + + Public and internal fields must start with an upper-case letter: flowSounds. + 54 + False + + + The variable name 'xDamageSounds' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 81 + False + + + The variable name 'xMusic' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 111 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.07 17:09:23.798 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'alBufferId' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 26 + False + + + The variable name 'alBufferId' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 82 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.05.10 17:42:51.174 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: stopMutex. + 62 + False + + + Readonly variables that are not declared private must start with an upper-case letter: stopMutex. + 62 + False + + + Public and internal fields must start with an upper-case letter: prepareMutex. + 63 + False + + + Readonly variables that are not declared private must start with an upper-case letter: prepareMutex. + 63 + False + + + The variable name 'alSourceId' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 65 + False + + + Public and internal fields must start with an upper-case letter: alSourceId. + 65 + False + + + Readonly variables that are not declared private must start with an upper-case letter: alSourceId. + 65 + False + + + The variable name 'alBufferIds' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 66 + False + + + Public and internal fields must start with an upper-case letter: alBufferIds. + 66 + False + + + Readonly variables that are not declared private must start with an upper-case letter: alBufferIds. + 66 + False + + + The variable name 'alFilterId' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 68 + False + + + Public and internal fields must start with an upper-case letter: logX. + 78 + False + + + Static readonly fields must start with an upper-case letter: singletonMutex. + 375 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.08 23:07:49.891 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.06.01 22:02:04.743 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + The variable name 'alSources' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 14 + False + + + The variable name 'alBuffers' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 15 + False + + + Variable names and private field names must start with a lower-case letter: AC. + 26 + False + + + Public and internal fields must start with an upper-case letter: oggStreamer. + 28 + False + + + Public and internal fields must start with an upper-case letter: oggStream. + 29 + False + + + The line contains unnecessary parenthesis. + 241 + 8856 + 8887 + 241 + 20 + 241 + 51 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.01 22:01:00.827 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Public and internal fields must start with an upper-case letter: origin. + 25 + False + + + Public and internal fields must start with an upper-case letter: size. + 29 + False + + + Public and internal fields must start with an upper-case letter: rotation. + 31 + False + + + Public and internal fields must start with an upper-case letter: effects. + 33 + False + + + The variable name 'xTiles' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 205 + False + + + The variable name 'yTiles' begins with a prefix that looks like Hungarian notation. Remove the prefix or add it to the list of allowed prefixes. + 207 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.04.17 14:46:27.075 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + Field names must not start with an underscore. + 111 + False + + + Field names must not start with an underscore. + 112 + False + + + Field names must not start with an underscore. + 113 + False + + + + + + 2014.04.01 10:18:24.000 + 2015.07.02 21:22:42.115 + 2015.07.02 18:56:17.502 + 2014.04.01 10:18:24.000 + 2014.04.01 10:18:24.000 + -1945363787 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + 2014.04.01 10:18:24.000 + 0 + + + + \ No newline at end of file diff --git a/Subsurface/Subsurface.csproj b/Subsurface/Subsurface.csproj index 69cb96cab..f5e950ae0 100644 --- a/Subsurface/Subsurface.csproj +++ b/Subsurface/Subsurface.csproj @@ -63,6 +63,7 @@ + @@ -73,6 +74,7 @@ + @@ -360,14 +362,14 @@ PreserveNewest - + PreserveNewest - + PreserveNewest Designer - + PreserveNewest @@ -548,6 +550,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Subsurface.csproj.user b/Subsurface/Subsurface.csproj.user index 693505ea4..505c3a0bf 100644 --- a/Subsurface/Subsurface.csproj.user +++ b/Subsurface/Subsurface.csproj.user @@ -9,6 +9,6 @@ en-US false - ShowAllFiles + ProjectFiles \ No newline at end of file diff --git a/Subsurface/ToolBox.cs b/Subsurface/ToolBox.cs index a97317a92..54a309dfe 100644 --- a/Subsurface/ToolBox.cs +++ b/Subsurface/ToolBox.cs @@ -247,6 +247,16 @@ namespace Subsurface return floatArray; } + public static int SeedToInt(string seed) + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < seed.Length; i++) + { + sb.Append((int)seed[i]); + } + return int.Parse(sb.ToString()) % int.MaxValue; + } + public static string WrapText(string text, float lineWidth) { if (GUI.font.MeasureString(text).X < lineWidth) return text; @@ -291,7 +301,7 @@ namespace Subsurface return ""; } - int lineNumber = Game1.random.Next(lineCount); + int lineNumber = Rand.Int(lineCount, false); int i = 0; diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 221e16c3d..a0ed447d0 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ diff --git a/Subsurface_content/Subsurface_content/StyleCop.Cache b/Subsurface_content/Subsurface_content/StyleCop.Cache new file mode 100644 index 000000000..9e0c058e4 --- /dev/null +++ b/Subsurface_content/Subsurface_content/StyleCop.Cache @@ -0,0 +1,7 @@ + + 12 + + + + + \ No newline at end of file diff --git a/Subsurface_content/Subsurface_contentContent/StyleCop.Cache b/Subsurface_content/Subsurface_contentContent/StyleCop.Cache new file mode 100644 index 000000000..2330220c8 --- /dev/null +++ b/Subsurface_content/Subsurface_contentContent/StyleCop.Cache @@ -0,0 +1,7 @@ + + 12 + + + + + \ No newline at end of file