From 07e401fb2335d2372a93f37317f144449f7e872b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 16 Jul 2012 18:18:22 +0300 Subject: Add new dye type A. Same as type S for colors + alpha channel. Example: equipment/feet/boots.png|A:#3c3c3cff,40332d40,4d4d4dff,5e4a3d40 here colors in format RRGGBBAA. --- src/resources/dye.h | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'src/resources/dye.h') diff --git a/src/resources/dye.h b/src/resources/dye.h index 7fe4869ef..7e5ba6c99 100644 --- a/src/resources/dye.h +++ b/src/resources/dye.h @@ -28,7 +28,9 @@ #include -const int dyePalateSize = 8; +const int dyePalateSize = 9; +const int sPaleteIndex = 7; +const int aPaleteIndex = 8; /** * Class for performing a linear interpolation between colors. @@ -42,13 +44,7 @@ class DyePalette * The string is either a file name or a sequence of hexadecimal RGB * values separated by ',' and starting with '#'. */ - DyePalette(const std::string &pallete); - -/* - void addFirstColor(const int color[3]); - - void addLastColor(const int color[3]); -*/ + DyePalette(const std::string &pallete, int8_t blockSize); /** * Gets a pixel color depending on its intensity. First color is @@ -61,15 +57,31 @@ class DyePalette */ void getColor(double intensity, int color[3]) const; - void replaceColor(uint8_t *color) const; + /** + * replace colors for SDL for S dye. + */ + void replaceSColor(uint8_t *color) const; + + /** + * replace colors for SDL for S dye. + */ + void replaceAColor(uint8_t *color) const; + + /** + * replace colors for OpenGL for S dye. + */ + void replaceSOGLColor(uint8_t *color) const; - void replaceOGLColor(uint8_t *color) const; + /** + * replace colors for OpenGL for A dye. + */ + void replaceAOGLColor(uint8_t *color) const; int hexDecode(char c); private: struct Color - { unsigned char value[3]; }; + { unsigned char value[4]; }; std::vector mColors; }; @@ -106,16 +118,21 @@ class Dye const std::string &palettes); /** - * Check if dye is special dye (S) + * Return special dye palete (S) + */ + DyePalette *getSPalete() const + { return mDyePalettes[sPaleteIndex]; } + + /** + * Return special dye palete (A) */ - bool isSpecialDye() const - { return mDyePalettes[dyePalateSize - 1]; } + DyePalette *getAPalete() const + { return mDyePalettes[aPaleteIndex]; } /** - * Return special dye palete (S) + * Return dye type for S - 1, for A - 2, 0 for other */ - DyePalette *getSPalete() const - { return mDyePalettes[dyePalateSize - 1]; } + int getType() const; private: -- cgit v1.2.3-70-g09d2