summaryrefslogtreecommitdiff
path: root/NW4RTools/Texture.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-23 17:43:33 +0200
committerTreeki <treeki@gmail.com>2012-09-23 17:43:33 +0200
commitc9bfbf84244c8aa4e26ece994ef6b93386c708e3 (patch)
treed267d5732bed21c666750263d2ca62dcdfa9e44f /NW4RTools/Texture.cs
parent31380b4bb93d1fb65faff8f71753de80fb0a8c9d (diff)
downloadnw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.tar.gz
nw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.zip
tons of junk I'll clean up eventually
Diffstat (limited to '')
-rw-r--r--NW4RTools/Texture.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/NW4RTools/Texture.cs b/NW4RTools/Texture.cs
index f2cf231..249af79 100644
--- a/NW4RTools/Texture.cs
+++ b/NW4RTools/Texture.cs
@@ -437,8 +437,10 @@ namespace NW4RTools {
byte val = data.ReadByte();
for (int inX = 0; inX < 4; inX++) {
- uint *pPixel = (uint*)pRow + x + (iBlockX * 4) + inX;
- *pPixel = clrArray[(val >> 6) & 3];
+ if ((y + (iBlockY * 4) + inY) < height && (x + (iBlockX * 4) + inX) < width) {
+ uint *pPixel = (uint*)pRow + x + (iBlockX * 4) + inX;
+ *pPixel = clrArray[(val >> 6) & 3];
+ }
val <<= 2;
}
}