From d66cc50af6d781d179f46ae67d74bf26bf5914e5 Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 2 Jun 2015 02:16:55 +0200 Subject: Re-implemented clif->colormes to accept arbitrary colors - Due to the backward-incompatible change, clif->colormes was renamed to clif->messagecolor_self (for similarity with clif->messagecolor). The 'color' argument is now a 0xRRGGBB color rather than a color_table index. - enum clif_colors is no longer needed, but 0xRRGGBB-based constants are now provided to replace the old COLOR_* values. Signed-off-by: Haru --- src/map/clif.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/map/clif.h') diff --git a/src/map/clif.h b/src/map/clif.h index df45b9ec0..f4402bdf7 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -49,6 +49,12 @@ struct channel_data; #define clif_disp_onlyself(sd,mes,len) clif->disp_message( &(sd)->bl, (mes), (len), SELF ) #define MAX_ROULETTE_LEVEL 7 /** client-defined value **/ #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/ +#define RGB2BGR(c) ((c & 0x0000FF) << 16 | (c & 0x00FF00) | (c & 0xFF0000) >> 16) + +#define COLOR_RED 0xff0000U +#define COLOR_GREEN 0x00ff00U +#define COLOR_WHITE 0xffffffU +#define COLOR_DEFAULT COLOR_GREEN /** * Enumerations @@ -385,16 +391,6 @@ enum cashshop_error { ERROR_TYPE_NOT_ALL = 8, ///< Some items could not be purchased. (ERROR_TYPE_NOT_ALL) }; -/** - * Color Table - **/ -enum clif_colors { - COLOR_RED, - COLOR_DEFAULT, - COLOR_WHITE, - COLOR_MAX -}; - enum CASH_SHOP_TABS { CASHSHOP_TAB_NEW = 0, CASHSHOP_TAB_POPULAR = 1, @@ -552,7 +548,6 @@ struct cdelayed_damage { * Vars **/ struct s_packet_db packet_db[MAX_PACKET_DB + 1]; -unsigned int color_table[COLOR_MAX]; /** * Clif.c Interface @@ -830,7 +825,8 @@ struct clif_interface { void (*disp_message) (struct block_list* src, const char* mes, size_t len, enum send_target target); void (*broadcast) (struct block_list* bl, const char* mes, size_t len, int type, enum send_target target); void (*broadcast2) (struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); - void (*messagecolor) (struct block_list* bl, unsigned int color, const char* msg); + void (*messagecolor_self) (int fd, uint32 color, const char *msg); + void (*messagecolor) (struct block_list* bl, uint32 color, const char* msg); void (*disp_overhead) (struct block_list *bl, const char* mes); void (*msgtable) (struct map_session_data* sd, unsigned short msg_id); void (*msgtable_num) (struct map_session_data *sd, unsigned short msg_id, int value); @@ -839,7 +835,6 @@ struct clif_interface { void (*messageln) (const int fd, const char* mes); /* message+s(printf) */ void (*messages) (const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); - int (*colormes) (int fd, enum clif_colors color, const char* msg); bool (*process_message) (struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_); void (*wisexin) (struct map_session_data *sd,int type,int flag); void (*wisall) (struct map_session_data *sd,int type,int flag); -- cgit v1.2.3-60-g2f50