From: Holger Schemel Date: Sun, 6 Apr 2003 22:35:02 +0000 (+0200) Subject: rnd-20030407-1-src X-Git-Tag: 3.0.0^2~108 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6c244f56b4911dc83930193a43497388b91696af;p=rocksndiamonds.git rnd-20030407-1-src --- diff --git a/src/conf_fnt.c b/src/conf_fnt.c index 2b839be3..09dbe007 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -171,6 +171,10 @@ font_to_graphic[] = FONT_TAPE_RECORDER, -1, IMG_FONT_TAPE_RECORDER }, + { + FONT_GAME_INFO, -1, + IMG_FONT_GAME_INFO + }, { -1, -1, -1 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 06367d29..d918b8c5 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -3291,6 +3291,11 @@ struct ConfigInfo image_config[] = { "font.tape_recorder.width", "11" }, { "font.tape_recorder.height", "14" }, + { "font.game_info", "RocksFontEM.pcx" }, + { "font.game_info.xpos", "0" }, + { "font.game_info.ypos", "0" }, + { "font.game_info.delay", "10" }, + { "global.border", "RocksScreen.pcx" }, { "global.door", "RocksDoor.pcx" }, @@ -3307,32 +3312,6 @@ struct ConfigInfo image_config[] = { "background.SETUP", UNDEFINED_FILENAME }, { "background.DOOR", UNDEFINED_FILENAME }, - { "info.font_em_1", "RocksFontEM.pcx" }, - { "info.font_em_1.xpos", "0" }, - { "info.font_em_1.ypos", "0" }, - { "info.font_em_1.frames", "16" }, - { "info.font_em_1.delay", "10" }, - { "info.font_em_2", "RocksFontEM.pcx" }, - { "info.font_em_2.xpos", "0" }, - { "info.font_em_2.ypos", "1" }, - { "info.font_em_2.frames", "16" }, - { "info.font_em_2.delay", "10" }, - { "info.font_em_3", "RocksFontEM.pcx" }, - { "info.font_em_3.xpos", "0" }, - { "info.font_em_3.ypos", "2" }, - { "info.font_em_3.frames", "16" }, - { "info.font_em_3.delay", "10" }, - { "info.font_em_4", "RocksFontEM.pcx" }, - { "info.font_em_4.xpos", "0" }, - { "info.font_em_4.ypos", "3" }, - { "info.font_em_4.frames", "16" }, - { "info.font_em_4.delay", "10" }, - { "info.font_em_5", "RocksFontEM.pcx" }, - { "info.font_em_5.xpos", "0" }, - { "info.font_em_5.ypos", "4" }, - { "info.font_em_5.frames", "4" }, - { "info.font_em_5.delay", "10" }, - /* the following directives are not associated with an image, but make sense to be defined in "graphicsinfo.conf", too */ diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 1679146c..9413a02d 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -870,23 +870,19 @@ #define IMG_FONT_VALUE_OLD 849 #define IMG_FONT_LEVEL_NUMBER 850 #define IMG_FONT_TAPE_RECORDER 851 -#define IMG_GLOBAL_BORDER 852 -#define IMG_GLOBAL_DOOR 853 -#define IMG_EDITOR_ELEMENT_BORDER 854 -#define IMG_BACKGROUND 855 -#define IMG_BACKGROUND_MAIN 856 -#define IMG_BACKGROUND_LEVELS 857 -#define IMG_BACKGROUND_SCORES 858 -#define IMG_BACKGROUND_EDITOR 859 -#define IMG_BACKGROUND_INFO 860 -#define IMG_BACKGROUND_SETUP 861 -#define IMG_BACKGROUND_DOOR 862 -#define IMG_INFO_FONT_EM_1 863 -#define IMG_INFO_FONT_EM_2 864 -#define IMG_INFO_FONT_EM_3 865 -#define IMG_INFO_FONT_EM_4 866 -#define IMG_INFO_FONT_EM_5 867 +#define IMG_FONT_GAME_INFO 852 +#define IMG_GLOBAL_BORDER 853 +#define IMG_GLOBAL_DOOR 854 +#define IMG_EDITOR_ELEMENT_BORDER 855 +#define IMG_BACKGROUND 856 +#define IMG_BACKGROUND_MAIN 857 +#define IMG_BACKGROUND_LEVELS 858 +#define IMG_BACKGROUND_SCORES 859 +#define IMG_BACKGROUND_EDITOR 860 +#define IMG_BACKGROUND_INFO 861 +#define IMG_BACKGROUND_SETUP 862 +#define IMG_BACKGROUND_DOOR 863 -#define NUM_IMAGE_FILES 868 +#define NUM_IMAGE_FILES 864 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index d03062df..de44c3ea 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-04-06 22:55]" +#define COMPILE_DATE_STRING "[2003-04-07 00:31]" diff --git a/src/init.c b/src/init.c index 05ccd337..40ecc4d7 100644 --- a/src/init.c +++ b/src/init.c @@ -383,7 +383,7 @@ void InitFontGraphicInfo() int font_bitmap_id = font_info[i].special_bitmap_id[j]; int graphic = font_info[i].special_graphic[j]; - /* set 'graphic_info' for font entries, if uninitialized */ + /* set 'graphic_info' for font entries, if uninitialized (guessed) */ if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT) { graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT; diff --git a/src/main.h b/src/main.h index a3ce361a..34e646e5 100644 --- a/src/main.h +++ b/src/main.h @@ -442,21 +442,6 @@ #define EL_CHAR(c) (EL_CHAR_ASCII0 + MAP_FONT_ASCII(c)) -#if 0 -#define EL_CHAR(x) ((x) == 'Ä' ? EL_CHAR_AE : \ - (x) == 'Ö' ? EL_CHAR_OE : \ - (x) == 'Ü' ? EL_CHAR_UE : \ - (x) == 'ä' ? EL_CHAR_AE : \ - (x) == 'ö' ? EL_CHAR_OE : \ - (x) == 'ü' ? EL_CHAR_UE : \ - (x) == '©' ? EL_CHAR_COPYRIGHT : \ - (x) == '_' ? EL_CHAR_UNDERSCORE : \ - (x) == '°' ? EL_CHAR_DEGREE : \ - (x) == '´' ? EL_CHAR_TM : \ - (x) == '|' ? EL_CHAR_CURSOR : \ - EL_CHAR_A + (x) - 'A') -#endif - #define EL_EXPANDABLE_WALL_HORIZONTAL 200 #define EL_EXPANDABLE_WALL_VERTICAL 201 #define EL_EXPANDABLE_WALL_ANY 202 @@ -833,10 +818,11 @@ #define FONT_VALUE_1 16 #define FONT_VALUE_2 17 #define FONT_VALUE_OLD 18 -#define FONT_TAPE_RECORDER 19 -#define FONT_LEVEL_NUMBER 20 +#define FONT_LEVEL_NUMBER 19 +#define FONT_TAPE_RECORDER 20 +#define FONT_GAME_INFO 21 -#define NUM_FONTS 21 +#define NUM_FONTS 22 #define NUM_INITIAL_FONTS 4 /* values for game_status */ diff --git a/src/screens.c b/src/screens.c index 6e8c548c..0737cd79 100644 --- a/src/screens.c +++ b/src/screens.c @@ -639,11 +639,7 @@ static int helpscreen_action[] = IMG_WALL_CRUMBLED, -1, HA_NEXT, - IMG_INFO_FONT_EM_1, 160, - IMG_INFO_FONT_EM_2, 160, - IMG_INFO_FONT_EM_3, 160, - IMG_INFO_FONT_EM_4, 160, - IMG_INFO_FONT_EM_5, 40, HA_NEXT, + IMG_FONT_GAME_INFO, -1, HA_NEXT, IMG_EMERALD, -1, HA_NEXT, diff --git a/src/tools.c b/src/tools.c index 8bd0a153..b29cb819 100644 --- a/src/tools.c +++ b/src/tools.c @@ -773,15 +773,25 @@ void DrawPlayer(struct PlayerInfo *player) void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y) { - Bitmap *src_bitmap = graphic_info[graphic].bitmap; - int offset_x = graphic_info[graphic].offset_x; - int offset_y = graphic_info[graphic].offset_y; - int src_x = graphic_info[graphic].src_x + frame * offset_x; - int src_y = graphic_info[graphic].src_y + frame * offset_y; + struct GraphicInfo *g = &graphic_info[graphic]; - *bitmap = src_bitmap; - *x = src_x; - *y = src_y; + *bitmap = g->bitmap; + + if (g->offset_y == 0) /* frames are ordered horizontally */ + { + *x = g->src_x + (frame % g->anim_frames_per_line) * g->offset_x; + *y = g->src_y + (frame / g->anim_frames_per_line) * g->height; + } + else if (g->offset_x == 0) /* frames are ordered vertically */ + { + *x = g->src_x + (frame / g->anim_frames_per_line) * g->width; + *y = g->src_y + (frame % g->anim_frames_per_line) * g->offset_y; + } + else /* frames are ordered diagonally */ + { + *x = g->src_x + frame * g->offset_x; + *y = g->src_y + frame * g->offset_y; + } } void DrawGraphic(int x, int y, int graphic, int frame) @@ -883,32 +893,13 @@ void DrawMiniGraphic(int x, int y, int graphic) void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { - Bitmap *src_bitmap = graphic_info[graphic].bitmap; + struct GraphicInfo *g = &graphic_info[graphic]; int mini_startx = 0; - int mini_starty = src_bitmap->height * 2 / 3; - int src_x = mini_startx + graphic_info[graphic].src_x / 2; - int src_y = mini_starty + graphic_info[graphic].src_y / 2; - -#if 0 - /* !!! not needed anymore, because of automatically created mini graphics */ - if (src_x + MINI_TILEX > src_bitmap->width || - src_y + MINI_TILEY > src_bitmap->height) - { - /* graphic of desired size seems not to be contained in this image; - dirty workaround: get it from the middle of the normal sized image */ - - printf("::: using dirty workaround for %d (%d, %d)\n", - graphic, src_bitmap->width, src_bitmap->height); + int mini_starty = g->bitmap->height * 2 / 3; - getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y); - src_x += (TILEX / 2 - MINI_TILEX / 2); - src_y += (TILEY / 2 - MINI_TILEY / 2); - } -#endif - - *bitmap = src_bitmap; - *x = src_x; - *y = src_y; + *bitmap = g->bitmap; + *x = mini_startx + g->src_x / 2; + *y = mini_starty + g->src_y / 2; } void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic)