Merged branch combat-mission into combat-mission
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
linkable="true"
|
linkable="true"
|
||||||
pickdistance ="150">
|
pickdistance ="150">
|
||||||
|
|
||||||
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64"/>
|
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64" canflipx="false"/>
|
||||||
|
|
||||||
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
|
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
|
||||||
<Containable name="chem"/>
|
<Containable name="chem"/>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
linkable="true"
|
linkable="true"
|
||||||
pickdistance ="150">
|
pickdistance ="150">
|
||||||
|
|
||||||
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64"/>
|
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64" canflipx="false"/>
|
||||||
|
|
||||||
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
|
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
|
||||||
<Containable name="chem"/>
|
<Containable name="chem"/>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
pickdistance="150"
|
pickdistance="150"
|
||||||
description="Serves as a hub for power distribution and relaying signals between devices.">
|
description="Serves as a hub for power distribution and relaying signals between devices.">
|
||||||
|
|
||||||
<Sprite texture ="junctionbox.png" depth="0.8"/>
|
<Sprite texture="junctionbox.png" depth="0.8" canflipx="false"/>
|
||||||
|
|
||||||
<fixrequirement name="Electrical repairs">
|
<fixrequirement name="Electrical repairs">
|
||||||
<skill name="Electrical Engineering" level="40"/>
|
<skill name="Electrical Engineering" level="40"/>
|
||||||
|
|||||||
@@ -29,39 +29,39 @@
|
|||||||
</smallverticalback2>
|
</smallverticalback2>
|
||||||
|
|
||||||
<engineeringLabel width="153" height="16">
|
<engineeringLabel width="153" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,426,153,16" depth ="0.99"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,426,153,16" depth="0.99" canflipx="false"/>
|
||||||
</engineeringLabel>
|
</engineeringLabel>
|
||||||
|
|
||||||
<commandLabel width="128" height="16">
|
<commandLabel width="128" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,443,128,16" depth ="0.99"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,443,128,16" depth="0.99" canflipx="false"/>
|
||||||
</commandLabel>
|
</commandLabel>
|
||||||
|
|
||||||
<airlockLabel width = "99" height ="16">
|
<airlockLabel width = "99" height ="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,460,199,16" depth ="0.99"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,460,199,16" depth="0.99" canflipx="false"/>
|
||||||
</airlockLabel>
|
</airlockLabel>
|
||||||
|
|
||||||
<cabinsLabel width="83" height="16">
|
<cabinsLabel width="83" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,477,83,16" depth ="0.99"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,477,83,16" depth="0.99" canflipx="false"/>
|
||||||
</cabinsLabel>
|
</cabinsLabel>
|
||||||
|
|
||||||
<medicalLabel width="110" height="16">
|
<medicalLabel width="110" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,494,110,16" depth="0.99"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,494,110,16" depth="0.99" canflipx="false"/>
|
||||||
</medicalLabel>
|
</medicalLabel>
|
||||||
|
|
||||||
<arrowUp width="16" height="16">
|
<arrowUp width="16" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="129,460,16,16" depth ="0.99" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="129,460,16,16" depth ="0.99"/>
|
||||||
</arrowUp>
|
</arrowUp>
|
||||||
|
|
||||||
<arrowDown width="16" height="16">
|
<arrowDown width="16" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="146,460,16,16" depth ="0.99" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="146,460,16,16" depth ="0.99"/>
|
||||||
</arrowDown>
|
</arrowDown>
|
||||||
|
|
||||||
<arrowLeft width="16" height="16">
|
<arrowLeft width="16" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="129,477,16,16" depth ="0.99" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="129,477,16,16" depth ="0.99"/>
|
||||||
</arrowLeft>
|
</arrowLeft>
|
||||||
|
|
||||||
<arrowRight width="16" height="16">
|
<arrowRight width="16" height="16">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="146,477,16,16" depth ="0.99" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="146,477,16,16" depth ="0.99"/>
|
||||||
</arrowRight>
|
</arrowRight>
|
||||||
|
|
||||||
<leftwall description="A vertical wall with collision detection"
|
<leftwall description="A vertical wall with collision detection"
|
||||||
@@ -170,19 +170,19 @@
|
|||||||
</PipesBackground>
|
</PipesBackground>
|
||||||
|
|
||||||
<SlopeForward width="16" height="16" resizehorizontal="true" resizevertical="true">
|
<SlopeForward width="16" height="16" resizehorizontal="true" resizevertical="true">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,0,224,64" depth = "0.95" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,0,224,64" depth = "0.95" />
|
||||||
</SlopeForward>
|
</SlopeForward>
|
||||||
|
|
||||||
<SlopeBack width="16" height="16" resizehorizontal="true" resizevertical="true">
|
<SlopeBack width="16" height="16" resizehorizontal="true" resizevertical="true">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="0,64,224,64" depth = "0.95" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="0,64,224,64" depth = "0.95" />
|
||||||
</SlopeBack>
|
</SlopeBack>
|
||||||
|
|
||||||
<stairsright width="256" height="320" stairdirection="Right">
|
<stairsright width="256" height="320" stairdirection="Right">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="256,193,256,319" depth = "0.1" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="256,193,256,319" depth = "0.1" />
|
||||||
</stairsright>
|
</stairsright>
|
||||||
|
|
||||||
<stairsleft width="256" height="320" stairdirection="Left">
|
<stairsleft width="256" height="320" stairdirection="Left">
|
||||||
<sprite texture="Content/Map/structures2.png" sourcerect="256,193,256,319" fliphorizontal="true" depth = "0.1" canflipx="true"/>
|
<sprite texture="Content/Map/structures2.png" sourcerect="256,193,256,319" fliphorizontal="true" depth = "0.1" />
|
||||||
</stairsleft>
|
</stairsleft>
|
||||||
|
|
||||||
<bunk width="173" height="129">
|
<bunk width="173" height="129">
|
||||||
|
|||||||
@@ -288,8 +288,7 @@ namespace Barotrauma
|
|||||||
spriteFolder = Path.GetDirectoryName(filePath);
|
spriteFolder = Path.GetDirectoryName(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ToolBox.GetAttributeBool(subElement, "canflipx", false))
|
canSpriteFlipX = ToolBox.GetAttributeBool(subElement, "canflipx", true);
|
||||||
canSpriteFlipX = true;
|
|
||||||
|
|
||||||
sprite = new Sprite(subElement, spriteFolder);
|
sprite = new Sprite(subElement, spriteFolder);
|
||||||
size = sprite.size;
|
size = sprite.size;
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public SpriteEffects SpriteEffects = SpriteEffects.None;
|
public SpriteEffects SpriteEffects = SpriteEffects.None;
|
||||||
|
|
||||||
|
private bool flippedX;
|
||||||
|
|
||||||
public override Sprite Sprite
|
public override Sprite Sprite
|
||||||
{
|
{
|
||||||
get { return prefab.sprite; }
|
get { return prefab.sprite; }
|
||||||
@@ -260,6 +262,14 @@ namespace Barotrauma
|
|||||||
int xsections = 1, ysections = 1;
|
int xsections = 1, ysections = 1;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
if (!HasBody)
|
||||||
|
{
|
||||||
|
sections = new WallSection[1];
|
||||||
|
sections[0] = new WallSection(rect);
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (isHorizontal)
|
if (isHorizontal)
|
||||||
{
|
{
|
||||||
xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize);
|
xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize);
|
||||||
@@ -275,15 +285,33 @@ namespace Barotrauma
|
|||||||
height = (int)wallSectionSize;
|
height = (int)wallSectionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int x = 0; x < xsections; x++)
|
for (int x = 0; x < xsections; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < ysections; y++)
|
for (int y = 0; y < ysections; y++)
|
||||||
{
|
{
|
||||||
Rectangle sectionRect = new Rectangle(rect.X + x * width, rect.Y - y * height, width, height);
|
if (flippedX)
|
||||||
sectionRect.Width -= (int)Math.Max((sectionRect.X + sectionRect.Width) - (rect.X + rect.Width), 0.0f);
|
{
|
||||||
sectionRect.Height -= (int)Math.Max((rect.Y - rect.Height) - (sectionRect.Y - sectionRect.Height), 0.0f);
|
Rectangle sectionRect = new Rectangle(rect.Right - (x + 1) * width, rect.Y - y * height, width, height);
|
||||||
|
|
||||||
sections[x + y] = new WallSection(sectionRect);
|
int over = Math.Max(rect.X - sectionRect.X, 0);
|
||||||
|
|
||||||
|
sectionRect.X += over;
|
||||||
|
sectionRect.Width -= over;
|
||||||
|
|
||||||
|
sectionRect.Height -= (int)Math.Max((rect.Y - rect.Height) - (sectionRect.Y - sectionRect.Height), 0.0f);
|
||||||
|
|
||||||
|
sections[xsections - 1 - x + y] = new WallSection(sectionRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rectangle sectionRect = new Rectangle(rect.X + x * width, rect.Y - y * height, width, height);
|
||||||
|
sectionRect.Width -= (int)Math.Max(sectionRect.Right - rect.Right, 0.0f);
|
||||||
|
sectionRect.Height -= (int)Math.Max((rect.Y - rect.Height) - (sectionRect.Y - sectionRect.Height), 0.0f);
|
||||||
|
|
||||||
|
sections[x + y] = new WallSection(sectionRect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,9 +465,9 @@ namespace Barotrauma
|
|||||||
if (prefab.BackgroundSprite != null)
|
if (prefab.BackgroundSprite != null)
|
||||||
{
|
{
|
||||||
prefab.BackgroundSprite.DrawTiled(
|
prefab.BackgroundSprite.DrawTiled(
|
||||||
spriteBatch,
|
spriteBatch,
|
||||||
new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)),
|
new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)),
|
||||||
new Vector2(rect.Width, rect.Height),
|
new Vector2(rect.Width, rect.Height),
|
||||||
Vector2.Zero, color, Point.Zero);
|
Vector2.Zero, color, Point.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,16 +477,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (back == prefab.sprite.Depth > 0.5f || editing)
|
if (back == prefab.sprite.Depth > 0.5f || editing)
|
||||||
{
|
{
|
||||||
foreach (WallSection s in sections)
|
for (int i = 0; i < sections.Length; i++)
|
||||||
{
|
{
|
||||||
if (damageEffect != null)
|
if (damageEffect != null)
|
||||||
{
|
{
|
||||||
float newCutoff = Math.Min((s.damage / prefab.MaxHealth), 0.65f);
|
float newCutoff = Math.Min((sections[i].damage / prefab.MaxHealth), 0.65f);
|
||||||
|
|
||||||
if (Math.Abs(newCutoff - prevCutoff) > 0.01f)
|
if (Math.Abs(newCutoff - prevCutoff) > 0.01f)
|
||||||
{
|
{
|
||||||
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
||||||
damageEffect.Parameters["cCutoff"].SetValue(newCutoff*1.2f);
|
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
||||||
|
|
||||||
damageEffect.CurrentTechnique.Passes[0].Apply();
|
damageEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
@@ -466,8 +494,21 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Point offset = new Point(Math.Abs(rect.Location.X - s.rect.Location.X), Math.Abs(rect.Location.Y - s.rect.Location.Y));
|
Point textureOffset = new Point(
|
||||||
prefab.sprite.DrawTiled(spriteBatch, new Vector2(s.rect.X + drawOffset.X, -(s.rect.Y + drawOffset.Y)), new Vector2(s.rect.Width, s.rect.Height), Vector2.Zero, color, offset);
|
Math.Abs(rect.Location.X - sections[i].rect.Location.X),
|
||||||
|
Math.Abs(rect.Location.Y - sections[i].rect.Location.Y));
|
||||||
|
|
||||||
|
if (flippedX && isHorizontal)
|
||||||
|
{
|
||||||
|
textureOffset.X = rect.Width - textureOffset.X - sections[i].rect.Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
prefab.sprite.DrawTiled(
|
||||||
|
spriteBatch,
|
||||||
|
new Vector2(sections[i].rect.X + drawOffset.X, -(sections[i].rect.Y + drawOffset.Y)),
|
||||||
|
new Vector2(sections[i].rect.Width, sections[i].rect.Height),
|
||||||
|
Vector2.Zero, color,
|
||||||
|
textureOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,6 +618,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public int FindSectionIndex(Vector2 displayPos)
|
public int FindSectionIndex(Vector2 displayPos)
|
||||||
{
|
{
|
||||||
|
if (!sections.Any()) return -1;
|
||||||
|
|
||||||
|
//if the sub has been flipped horizontally, the first section may be smaller than wallSectionSize
|
||||||
|
//and we need to adjust the position accordingly
|
||||||
|
if (sections[0].rect.Width < wallSectionSize)
|
||||||
|
{
|
||||||
|
displayPos.X += wallSectionSize - sections[0].rect.Width;
|
||||||
|
}
|
||||||
|
|
||||||
int index = (isHorizontal) ?
|
int index = (isHorizontal) ?
|
||||||
(int)Math.Floor((displayPos.X - rect.X) / wallSectionSize) :
|
(int)Math.Floor((displayPos.X - rect.X) / wallSectionSize) :
|
||||||
(int)Math.Floor((rect.Y - displayPos.Y) / wallSectionSize);
|
(int)Math.Floor((rect.Y - displayPos.Y) / wallSectionSize);
|
||||||
@@ -757,6 +807,8 @@ namespace Barotrauma
|
|||||||
public override void FlipX()
|
public override void FlipX()
|
||||||
{
|
{
|
||||||
base.FlipX();
|
base.FlipX();
|
||||||
|
|
||||||
|
flippedX = !flippedX;
|
||||||
|
|
||||||
if (prefab.CanSpriteFlipX)
|
if (prefab.CanSpriteFlipX)
|
||||||
{
|
{
|
||||||
@@ -771,7 +823,7 @@ namespace Barotrauma
|
|||||||
CreateStairBodies();
|
CreateStairBodies();
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: flip sprites & wall sections
|
CreateSections();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override XElement Save(XElement parentElement)
|
public override XElement Save(XElement parentElement)
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ namespace Barotrauma
|
|||||||
sp.sprite.effects = SpriteEffects.FlipHorizontally;
|
sp.sprite.effects = SpriteEffects.FlipHorizontally;
|
||||||
if (ToolBox.GetAttributeBool(subElement, "flipvertical", false))
|
if (ToolBox.GetAttributeBool(subElement, "flipvertical", false))
|
||||||
sp.sprite.effects = SpriteEffects.FlipVertically;
|
sp.sprite.effects = SpriteEffects.FlipVertically;
|
||||||
if (ToolBox.GetAttributeBool(subElement, "canflipx", false))
|
|
||||||
sp.canSpriteFlipX = true;
|
sp.canSpriteFlipX = ToolBox.GetAttributeBool(subElement, "canflipx", true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "backgroundsprite":
|
case "backgroundsprite":
|
||||||
|
|||||||
+55
-30
@@ -222,56 +222,81 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
DrawTiled(spriteBatch, pos, targetSize, Vector2.Zero, color);
|
DrawTiled(spriteBatch, pos, targetSize, Vector2.Zero, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color, Point offset)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color, Point offset)
|
||||||
{
|
{
|
||||||
//how many times the texture needs to be drawn on the x-axis
|
//how many times the texture needs to be drawn on the x-axis
|
||||||
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width);
|
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width);
|
||||||
//how many times the texture needs to be drawn on the y-axis
|
//how many times the texture needs to be drawn on the y-axis
|
||||||
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height);
|
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height);
|
||||||
|
|
||||||
|
Rectangle texPerspective = sourceRect;
|
||||||
|
|
||||||
|
texPerspective.Location += offset;
|
||||||
|
while (texPerspective.Location.X >= sourceRect.X + sourceRect.Width)
|
||||||
|
texPerspective.X = sourceRect.X + (texPerspective.Location.X - (sourceRect.X + sourceRect.Width));
|
||||||
|
while (texPerspective.Location.Y >= sourceRect.Y + sourceRect.Height)
|
||||||
|
texPerspective.Y = sourceRect.Y + (texPerspective.Location.Y - (sourceRect.Y + sourceRect.Height));
|
||||||
|
|
||||||
Rectangle TexPerspective = sourceRect;
|
texPerspective.Width = (int)Math.Min(targetSize.X, sourceRect.Width);
|
||||||
|
texPerspective.Height = (int)Math.Min(targetSize.Y, sourceRect.Height);
|
||||||
TexPerspective.Location += offset;
|
|
||||||
while (TexPerspective.Location.X >= sourceRect.X + sourceRect.Width)
|
|
||||||
TexPerspective.X = sourceRect.X + (TexPerspective.Location.X - (sourceRect.X + sourceRect.Width));
|
|
||||||
while (TexPerspective.Location.Y >= sourceRect.Y + sourceRect.Height)
|
|
||||||
TexPerspective.Y = sourceRect.Y + (TexPerspective.Location.Y - (sourceRect.Y + sourceRect.Height));
|
|
||||||
TexPerspective.Width = (int)Math.Min(targetSize.X, sourceRect.Width);
|
|
||||||
TexPerspective.Height = (int)Math.Min(targetSize.Y, sourceRect.Height);
|
|
||||||
for (int y = 0; y < yTiles; y++)
|
for (int y = 0; y < yTiles; y++)
|
||||||
{
|
{
|
||||||
TexPerspective.Width = (int)Math.Min(targetSize.X, sourceRect.Width);
|
texPerspective.Width = (int)Math.Min(targetSize.X, sourceRect.Width);
|
||||||
TexPerspective.Height = (int)Math.Min(targetSize.Y, sourceRect.Height);
|
texPerspective.Height = (int)Math.Min(targetSize.Y, sourceRect.Height);
|
||||||
float top = pos.Y + TexPerspective.Height * y;
|
float top = pos.Y + texPerspective.Height * y;
|
||||||
for (int x = 0; x < xTiles; x++)
|
for (int x = 0; x < xTiles; x++)
|
||||||
{
|
{
|
||||||
float left = pos.X + TexPerspective.Width * x;
|
float left = pos.X + texPerspective.Width * x;
|
||||||
TexPerspective.Width = Math.Min((int)(targetSize.X - TexPerspective.Width * x), TexPerspective.Width);
|
texPerspective.Width = Math.Min((int)(targetSize.X - texPerspective.Width * x), texPerspective.Width);
|
||||||
TexPerspective.Height = Math.Min((int)(targetSize.Y - TexPerspective.Height * y), TexPerspective.Height);
|
texPerspective.Height = Math.Min((int)(targetSize.Y - texPerspective.Height * y), texPerspective.Height);
|
||||||
var movementX = TexPerspective.Width;
|
|
||||||
var movementY = TexPerspective.Height;
|
var movementX = texPerspective.Width;
|
||||||
if (TexPerspective.X+TexPerspective.Width > sourceRect.X + sourceRect.Width)
|
var movementY = texPerspective.Height;
|
||||||
|
if (texPerspective.Right > sourceRect.Right)
|
||||||
{
|
{
|
||||||
float diff = (TexPerspective.X + TexPerspective.Width) - (sourceRect.X + sourceRect.Width);
|
if (effects.HasFlag(SpriteEffects.FlipHorizontally))
|
||||||
TexPerspective.Width -= (int)diff;
|
{
|
||||||
spriteBatch.Draw(texture, new Vector2(left+ TexPerspective.Width, top), new Rectangle(sourceRect.X, TexPerspective.Y,(int)diff, TexPerspective.Height), color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
int diff = (texPerspective.X + texPerspective.Width) - (sourceRect.Right);
|
||||||
|
|
||||||
|
spriteBatch.Draw(texture,
|
||||||
|
new Vector2(left, top),
|
||||||
|
new Rectangle(sourceRect.X, texPerspective.Y, diff, texPerspective.Height),
|
||||||
|
color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
|
|
||||||
|
texPerspective.Width -= diff;
|
||||||
|
left += diff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float diff = (texPerspective.X + texPerspective.Width) - (sourceRect.X + sourceRect.Width);
|
||||||
|
texPerspective.Width -= (int)diff;
|
||||||
|
spriteBatch.Draw(texture,
|
||||||
|
new Vector2(left + texPerspective.Width, top),
|
||||||
|
new Rectangle(sourceRect.X, texPerspective.Y, (int)diff, texPerspective.Height),
|
||||||
|
color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (TexPerspective.Y + TexPerspective.Height > sourceRect.Y + sourceRect.Height)
|
else if (texPerspective.Bottom > sourceRect.Bottom)
|
||||||
{
|
{
|
||||||
float diff = (TexPerspective.Y + TexPerspective.Height) - (sourceRect.Y + sourceRect.Height);
|
int diff = (texPerspective.Bottom) - (sourceRect.Bottom);
|
||||||
TexPerspective.Height -= (int)diff;
|
texPerspective.Height -= diff;
|
||||||
spriteBatch.Draw(texture, new Vector2(left, top+ TexPerspective.Height), new Rectangle(TexPerspective.X, sourceRect.Y, TexPerspective.Width, (int)diff), color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
spriteBatch.Draw(texture,
|
||||||
|
new Vector2(left, top + texPerspective.Height),
|
||||||
|
new Rectangle(texPerspective.X, sourceRect.Y, texPerspective.Width, diff),
|
||||||
|
color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.Draw(texture, new Vector2(left,top),TexPerspective, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
spriteBatch.Draw(texture, new Vector2(left, top), texPerspective, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
if (TexPerspective.X+ movementX >= sourceRect.X + sourceRect.Width)
|
|
||||||
TexPerspective.X = sourceRect.X;
|
if (texPerspective.X + movementX >= sourceRect.Right)
|
||||||
if (TexPerspective.Y + movementY >= sourceRect.Y + sourceRect.Height)
|
texPerspective.X = sourceRect.X;
|
||||||
TexPerspective.Y = sourceRect.Y;
|
if (texPerspective.Y + movementY >= sourceRect.Y + sourceRect.Height)
|
||||||
|
texPerspective.Y = sourceRect.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
||||||
{
|
{
|
||||||
//pos.X = (int)pos.X;
|
//pos.X = (int)pos.X;
|
||||||
|
|||||||
Reference in New Issue
Block a user