summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog71
-rw-r--r--src/gui/playerbox.cpp2
-rw-r--r--src/resources/image.h7
-rw-r--r--tools/Reorganize.java128
4 files changed, 122 insertions, 86 deletions
diff --git a/ChangeLog b/ChangeLog
index b5e17fb7..188bab14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-09-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * data/graphics/sprites/hairstyle*.png,
+ data/graphics/sprites/hairstyle*.xml, tools/Reorganize.java: Removed
+ unused frames from the hairsets.
+ * src/resources/image.h: Defined NO_SDL_GLEXT to prevent a
+ redefinition when gl.h also tries to define OpenGL extensions (patch
+ accepted from Rogier Polak).
+
2006-09-23 Bjørn Lindeijer <bjorn@lindeijer.nl>
* data/maps/new_5-1.tmx.gz: Accepted new version by Matt Howe, fixing
@@ -13,63 +22,29 @@
* src/animation.cpp, src/animation.h, src/animatedsprite.cpp,
src/animatedsprite.h: Removed some obsolete code and implemented
- the posibility to define an <end /> token in the <animation>s
+ the posibility to define an <end /> token in the <animation>s
that allows to define an animation that doesn't loop and returns
to the STAND animation when finished.
- * data/graphics/sprites/hairstyle1.xml,
- data/graphics/sprites/hairstyle2.xml,
- data/graphics/sprites/hairstyle3.xml,
- data/graphics/sprites/hairstyle4.xml,
- data/graphics/sprites/hairstyle5.xml,
- data/graphics/sprites/hairstyle6.xml,
- data/graphics/sprites/hairstyle7.xml,
- data/graphics/sprites/item001.xml,
- data/graphics/sprites/item002.xml,
- data/graphics/sprites/item003.xml,
- data/graphics/sprites/item004.xml,
- data/graphics/sprites/item005.xml,
- data/graphics/sprites/item006.xml,
- data/graphics/sprites/item007.xml,
- data/graphics/sprites/item008.xml,
- data/graphics/sprites/item009.xml,
- data/graphics/sprites/item010.xml,
- data/graphics/sprites/monster0.xml,
- data/graphics/sprites/monster1.xml,
- data/graphics/sprites/monster2.xml,
- data/graphics/sprites/monster3.xml,
- data/graphics/sprites/monster4.xml,
- data/graphics/sprites/monster5.xml,
- data/graphics/sprites/monster6.xml,
- data/graphics/sprites/monster7.xml,
- data/graphics/sprites/monster8.xml,
- data/graphics/sprites/monster9.xml,
- data/graphics/sprites/monster10.xml,
- data/graphics/sprites/monster11.xml,
- data/graphics/sprites/monster12.xml,
- data/graphics/sprites/monster13.xml,
- data/graphics/sprites/monster14.xml,
- data/graphics/sprites/monster15.xml,
- data/graphics/sprites/monster16.xml,
- data/graphics/sprites/monster17.xml,
- data/graphics/sprites/monster18.xml,
- data/graphics/sprites/monster19.xml,
- data/graphics/sprites/weapons.xml:
- Used the <end /> token for all attack animations fixing the problem
- with looping monster attack animations.
+ * data/graphics/sprites/hairstyle*.xml,
+ data/graphics/sprites/item0*.xml,
+ data/graphics/sprites/monster*.xml,
+ data/graphics/sprites/weapons.xml: Used the <end /> token for all
+ attack animations fixing the problem with looping monster attack
+ animations.
2006-09-20 Philipp Sehmisch <tmw@crushnet.org>
- * data/graphics/items/generic-whitefur.png,
- data/graphics/items/generic-cavesnakelamp.png,
- data/graphics/items/generic-hardspike.png,
+ * data/graphics/items/generic-whitefur.png,
+ data/graphics/items/generic-cavesnakelamp.png,
+ data/graphics/items/generic-hardspike.png,
data/graphics/items/generic-pinkantennae.png,
- data/graphics/items/Makefile.am, data/items.xml:
- Added drops for new monsters.
+ data/graphics/items/Makefile.am, data/items.xml: Added drops for new
+ monsters.
* src/gui/setup.cpp, src/gui/setup_video.cpp,
src/gui/setup_video.h: Added a slider for controlling the overlay
detail to the video setup dialog based on a patch by VictorSan.
- * data/maps/new_14-1.tmx.gz, data/maps/new_16-1.tmx.gz:
- Added cloud effect and minimap.
+ * data/maps/new_14-1.tmx.gz, data/maps/new_16-1.tmx.gz: Added cloud
+ effect and minimap.
* data/images/Makefile.am: Updated makefile.
2006-09-19 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index f0ed9b71..0a155573 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -97,7 +97,7 @@ void PlayerBox::draw(gcn::Graphics *graphics)
if (mHairColor >= 0 && mHairStyle >= 0 &&
mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES)
{
- int hf = 9 * mHairColor;
+ int hf = 5 * mHairColor;
if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) {
dynamic_cast<Graphics*>(graphics)->drawImage(
hairset[mHairStyle]->get(hf), 35, 7);
diff --git a/src/resources/image.h b/src/resources/image.h
index 1f67fcae..c769ecb6 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -26,6 +26,13 @@
#include <SDL.h>
#ifdef USE_OPENGL
+
+/* The definition of OpenGL extensions by SDL is giving problems with recent
+ * gl.h headers, since they also include these definitions. As we're not using
+ * extensions anyway it's safe to just disable the SDL version.
+ */
+#define NO_SDL_GLEXT
+
#include <SDL_opengl.h>
#endif
diff --git a/tools/Reorganize.java b/tools/Reorganize.java
index 19a17b99..22f42604 100644
--- a/tools/Reorganize.java
+++ b/tools/Reorganize.java
@@ -12,7 +12,7 @@ import java.io.File;
import javax.imageio.ImageIO;
/**
- * Very simple tool to reorganize the monster spritesets.
+ * Tool to reorganize the hair spritesets.
*/
public class Reorganize
{
@@ -20,6 +20,12 @@ public class Reorganize
private static final int SPRITE_HEIGHT = 60;
private static final int FRAMES = 10;
private static final int DIRECTIONS = 4;
+
+ private static final int HAIR_COLORS = 10;
+ private static final int HAIR_FRAMES = 9;
+ private static final int HAIR_SPRITE_WIDTH = 40;
+ private static final int HAIR_SPRITE_HEIGHT = 40;
+
private static final int TRANSPARENT = new Color(255, 0, 255).getRGB();
public static void main(String[] arg)
@@ -38,30 +44,15 @@ public class Reorganize
System.exit(1);
}
- Rectangle cropRect = null;
-
- // Read the existing frames into a vector and determine minimal
- // rectangle that still can contain the contents of any frame.
- Vector<BufferedImage> spriteSet = new Vector<BufferedImage>();
- for (int x = 0; x < DIRECTIONS; x++) {
- for (int y = 0; y < FRAMES; y++) {
- BufferedImage sprite = source.getSubimage(
- x * SPRITE_WIDTH,
- y * SPRITE_HEIGHT,
- SPRITE_WIDTH,
- SPRITE_HEIGHT);
-
- spriteSet.add(sprite);
+ // Read the existing frames into a vector
+ Vector<BufferedImage> spriteSet = gridCut(source,
+ HAIR_SPRITE_WIDTH, HAIR_SPRITE_HEIGHT,
+ HAIR_FRAMES, HAIR_COLORS);
- Rectangle frameCropRect = determineCropRect(sprite);
-
- if (cropRect == null) {
- cropRect = frameCropRect;
- } else {
- cropRect.add(frameCropRect);
- }
- }
- }
+ // Determine minimal rectangle that can still contain the contents of
+ // any frame
+ /*
+ Rectangle cropRect = minimumCropRect(spriteSet);
if (cropRect == null) {
System.out.println(
@@ -76,19 +67,61 @@ public class Reorganize
System.out.println(arg[0] + ": width=\"" +
cropRect.width + "\" height=\"" + cropRect.height + "\"");
+ */
+
+ filterHairstyle(spriteSet);
+
+ BufferedImage target = gridDraw(
+ spriteSet,
+ new Rectangle(0, 0, HAIR_SPRITE_WIDTH, HAIR_SPRITE_HEIGHT),
+ HAIR_FRAMES - 4, HAIR_COLORS);
- // Create a new image (with frame direction flipped)
+ // Save the target image
+ try {
+ ImageIO.write(target, "png", new File(arg[1]));
+ } catch (IOException e) {
+ System.out.println("Error while trying to write " + arg[1] + ".");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static Vector<BufferedImage> gridCut(
+ BufferedImage source,
+ int width, int height, int xFrames, int yFrames)
+ {
+ Vector<BufferedImage> spriteSet = new Vector<BufferedImage>();
+
+ for (int y = 0; y < yFrames; y++) {
+ for (int x = 0; x < xFrames; x++) {
+ BufferedImage sprite = source.getSubimage(
+ x * width,
+ y * height,
+ width,
+ height);
+
+ spriteSet.add(sprite);
+ }
+ }
+
+ return spriteSet;
+ }
+
+ private static BufferedImage gridDraw(Vector<BufferedImage> spriteSet,
+ Rectangle cropRect, int xFrames, int yFrames)
+ {
+ // Create a new image
BufferedImage target = new BufferedImage(
- FRAMES * cropRect.width,
- DIRECTIONS * cropRect.height,
+ xFrames * cropRect.width,
+ yFrames * cropRect.height,
BufferedImage.TYPE_INT_ARGB);
// Draw the frames onto the target image
Graphics g = target.getGraphics();
- for (int y = 0; y < DIRECTIONS; y++) {
- for (int x = 0; x < FRAMES; x++) {
+ for (int y = 0; y < yFrames; y++) {
+ for (int x = 0; x < xFrames; x++) {
g.drawImage(
- spriteSet.get(x + FRAMES * y).getSubimage(
+ spriteSet.get(x + xFrames * y).getSubimage(
cropRect.x,
cropRect.y,
cropRect.width,
@@ -99,14 +132,24 @@ public class Reorganize
}
}
- // Save the target image
- try {
- ImageIO.write(target, "png", new File(arg[1]));
- } catch (IOException e) {
- System.out.println("Error while trying to write " + arg[1] + ".");
- e.printStackTrace();
- System.exit(1);
+ return target;
+ }
+
+ private static Rectangle minimumCropRect(Vector<BufferedImage> spriteSet)
+ {
+ Rectangle cropRect = null;
+
+ for (BufferedImage sprite : spriteSet) {
+ Rectangle frameCropRect = determineCropRect(sprite);
+
+ if (cropRect == null) {
+ cropRect = frameCropRect;
+ } else {
+ cropRect.add(frameCropRect);
+ }
}
+
+ return cropRect;
}
private static Rectangle determineCropRect(BufferedImage image)
@@ -130,4 +173,15 @@ public class Reorganize
return rect;
}
+
+ private static void filterHairstyle(Vector<BufferedImage> spriteSet)
+ {
+ // Remove frame 1, 2, 6 and 7 from each color
+ for (int i = HAIR_COLORS - 1; i >= 0; i--) {
+ spriteSet.remove(i * HAIR_FRAMES + 7);
+ spriteSet.remove(i * HAIR_FRAMES + 6);
+ spriteSet.remove(i * HAIR_FRAMES + 2);
+ spriteSet.remove(i * HAIR_FRAMES + 1);
+ }
+ }
}