This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic editing of vanilla textures in the editor.
- Loading branch information
1 parent
f9cb7e0
commit c89f4b7
Showing
8 changed files
with
413 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Drawing; | ||
using System.Drawing.Imaging; | ||
using System.Windows.Forms; | ||
|
||
namespace UnderworldEditor | ||
{ | ||
class ArtUI | ||
{ | ||
|
||
public static void setPixelAtLocation(TextureLoader artfile, int imageNo, PictureBox img, int x, int y, int newpixel) | ||
{ | ||
if (artfile == null) { return; } | ||
if (img.Image == null) { return; } | ||
//(Bitmap)(img.Image).SetPixel(x, y, PaletteLoader.Palettes[0].ColorAtPixel(50, false)); | ||
artfile.ImageCache[imageNo].SetPixel(x, y, PaletteLoader.Palettes[0].ColorAtPixel((byte)newpixel, false)); | ||
switch (main.curgame) | ||
{ | ||
case main.GAME_UW1: | ||
if (imageNo<210) | ||
{ | ||
artfile.texturebufferW[artfile.OffsetT[imageNo] + y * 64 + x] = (char)newpixel; | ||
} | ||
break; | ||
} | ||
img.Image = artfile.ImageCache[imageNo]; | ||
} | ||
|
||
public static void SaveData(char[] artfile) | ||
{ | ||
Util.WriteStreamFile("c:\\games\\uw1\\data\\W64_test.TR", artfile); | ||
} | ||
|
||
}//endclass | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Drawing; | ||
|
||
namespace UnderworldEditor | ||
{ | ||
public class Palette | ||
{ | ||
public byte[] red = new byte[256]; | ||
public byte[] blue = new byte[256]; | ||
public byte[] green = new byte[256]; | ||
|
||
/// <summary> | ||
/// Returns the color for the specified palette index. | ||
/// </summary> | ||
/// <returns>The at pixel.</returns> | ||
/// <param name="pixel">Pixel.</param> | ||
/// <param name="Alpha">If set to <c>true</c> alpha.</param> | ||
public Color ColorAtPixel(byte pixel, bool Alpha) | ||
{ | ||
byte alpha; | ||
if (Alpha == true) | ||
{ | ||
if (pixel != 0) //Alpha | ||
{ | ||
alpha = 255; | ||
} | ||
else | ||
{ | ||
alpha = 0; | ||
} | ||
} | ||
else | ||
{ | ||
alpha = 0; | ||
} | ||
return Color.FromArgb((int)alpha, (int)red[pixel], (int)green[pixel], (int)blue[pixel]); | ||
} | ||
|
||
|
||
}//end class | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.