summaryrefslogtreecommitdiff
path: root/commonTypes.h
diff options
context:
space:
mode:
authorPetr Mrázek2012-02-27 20:04:19 +0100
committerPetr Mrázek2012-02-27 20:04:19 +0100
commit44107ca9d4f9c33ce9564acb48ca954b5f473524 (patch)
tree1ece6d17f7f703dab7735537a3e7a21cbae17596 /commonTypes.h
parentca35c82579d1e3e0ce227ccdaeb71c2a6dbf1cb9 (diff)
downloadstonesense-44107ca9d4f9c33ce9564acb48ca954b5f473524.tar.gz
stonesense-44107ca9d4f9c33ce9564acb48ca954b5f473524.tar.bz2
stonesense-44107ca9d4f9c33ce9564acb48ca954b5f473524.tar.xz
DF colors tweak.
Diffstat (limited to 'commonTypes.h')
-rw-r--r--commonTypes.h114
1 files changed, 62 insertions, 52 deletions
diff --git a/commonTypes.h b/commonTypes.h
index 52bd51d..398a3cc 100644
--- a/commonTypes.h
+++ b/commonTypes.h
@@ -1,6 +1,7 @@
#pragma once
#include "common.h"
+#include "SpriteColors.h"
enum ShadeBy
{
@@ -55,58 +56,6 @@ struct t_SpriteWithOffset
uint8_t snowMax;
} ;
-typedef struct dfColors
-{
- uint8_t black_r;
- uint8_t black_g;
- uint8_t black_b;
- uint8_t blue_r;
- uint8_t blue_g;
- uint8_t blue_b;
- uint8_t green_r;
- uint8_t green_g;
- uint8_t green_b;
- uint8_t cyan_r;
- uint8_t cyan_g;
- uint8_t cyan_b;
- uint8_t red_r;
- uint8_t red_g;
- uint8_t red_b;
- uint8_t magenta_r;
- uint8_t magenta_g;
- uint8_t magenta_b;
- uint8_t brown_r;
- uint8_t brown_g;
- uint8_t brown_b;
- uint8_t lgray_r;
- uint8_t lgray_g;
- uint8_t lgray_b;
- uint8_t dgray_r;
- uint8_t dgray_g;
- uint8_t dgray_b;
- uint8_t lblue_r;
- uint8_t lblue_g;
- uint8_t lblue_b;
- uint8_t lgreen_r;
- uint8_t lgreen_g;
- uint8_t lgreen_b;
- uint8_t lcyan_r;
- uint8_t lcyan_g;
- uint8_t lcyan_b;
- uint8_t lred_r;
- uint8_t lred_g;
- uint8_t lred_b;
- uint8_t lmagenta_r;
- uint8_t lmagenta_g;
- uint8_t lmagenta_b;
- uint8_t yellow_r;
- uint8_t yellow_g;
- uint8_t yellow_b;
- uint8_t white_r;
- uint8_t white_g;
- uint8_t white_b;
-} dfColors;
-
typedef struct Crd2D {
int32_t x,y;
}Crd2D;
@@ -114,6 +63,67 @@ typedef struct Crd3D {
int32_t x,y,z;
}Crd3D;
+class dfColors
+{
+public:
+ dfColors()
+ {
+ memset(colors, 0, sizeof(colors));
+ update();
+ }
+ struct color
+ {
+ uint8_t red;
+ uint8_t green;
+ uint8_t blue;
+ ALLEGRO_COLOR al;
+ void update()
+ {
+ al = al_map_rgb(red,green,blue);
+ }
+ }colors[16];
+ enum color_name
+ {
+ black,
+ blue,
+ green,
+ cyan,
+ red,
+ magenta,
+ brown,
+ lgray,
+ dgray,
+ lblue,
+ lgreen,
+ lcyan,
+ lred,
+ lmagenta,
+ yellow,
+ white
+ };
+ void update()
+ {
+ for (int i = 0; i < 16; i++)
+ {
+ colors[i].update();
+ }
+ }
+ color & operator [] (color_name col)
+ {
+ return colors[col];
+ }
+ ALLEGRO_COLOR getDfColor(int color)
+ {
+ if(color < 0 || color >= 16)
+ return al_map_rgb(255,255,255);
+ return colors[ (color_name) color].al;
+ }
+ ALLEGRO_COLOR getDfColor(int color, int bright)
+ {
+ return getDfColor(color+(bright*8));
+ }
+};
+
typedef struct
{