From f4b305df0ae775ef48daee86020904abb79ebef8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 23 Feb 2003 18:51:14 +0100 Subject: [PATCH] rnd-20030223-2-src --- src/conftime.h | 2 +- src/init.c | 32 ++++++++++++++++---------------- src/libgame/system.c | 1 - src/libgame/system.h | 9 +++------ src/libgame/text.c | 4 ++-- src/libgame/text.h | 13 +------------ src/libgame/toons.c | 4 ++-- src/main.h | 14 ++++++++++++-- src/tools.c | 2 +- 9 files changed, 38 insertions(+), 43 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index b4341798..349eb876 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-02-23 18:14]" +#define COMPILE_DATE_STRING "[2003-02-23 18:48]" diff --git a/src/init.c b/src/init.c index 73f9274f..3d1ef64f 100644 --- a/src/init.c +++ b/src/init.c @@ -31,7 +31,7 @@ #define CONFIG_TOKEN_FONT_INITIAL "font.initial" -struct FontInfo font_info_initial[NUM_INITIAL_FONTS]; +struct FontBitmapInfo font_initial[NUM_INITIAL_FONTS]; static void InitGlobal(); static void InitSetup(); @@ -486,13 +486,13 @@ void InitGfx() strncmp(image_config[i].token, font_token, len_font_token) == 0) { if (strcmp(&image_config[i].token[len_font_token], ".x") == 0) - font_info_initial[j].src_x = atoi(image_config[i].value); + font_initial[j].src_x = atoi(image_config[i].value); else if (strcmp(&image_config[i].token[len_font_token], ".y") == 0) - font_info_initial[j].src_y = atoi(image_config[i].value); + font_initial[j].src_y = atoi(image_config[i].value); else if (strcmp(&image_config[i].token[len_font_token], ".width") == 0) - font_info_initial[j].width = atoi(image_config[i].value); + font_initial[j].width = atoi(image_config[i].value); else if (strcmp(&image_config[i].token[len_font_token],".height") == 0) - font_info_initial[j].height = atoi(image_config[i].value); + font_initial[j].height = atoi(image_config[i].value); } } } @@ -514,7 +514,7 @@ void InitGfx() bitmap_font_initial = LoadCustomImage(filename_font_initial); for (j=0; j < NUM_INITIAL_FONTS; j++) - font_info_initial[j].bitmap = bitmap_font_initial; + font_initial[j].bitmap = bitmap_font_initial; InitFontGraphicInfo(); @@ -730,7 +730,7 @@ void InitElementSmallImages() void InitFontGraphicInfo() { - static struct FontInfo font_info[NUM_IMG_FONTS]; + static struct FontBitmapInfo font_bitmap_info[NUM_IMG_FONTS]; int num_fonts = NUM_IMG_FONTS; int i; @@ -740,21 +740,21 @@ void InitFontGraphicInfo() for (i=0; i < num_fonts; i++) { if (i < NUM_INITIAL_FONTS) - font_info[i] = font_info_initial[i]; + font_bitmap_info[i] = font_initial[i]; else { /* copy font relevant information from graphics information */ - font_info[i].bitmap = graphic_info[FIRST_IMG_FONT + i].bitmap; - font_info[i].src_x = graphic_info[FIRST_IMG_FONT + i].src_x; - font_info[i].src_y = graphic_info[FIRST_IMG_FONT + i].src_y; - font_info[i].width = graphic_info[FIRST_IMG_FONT + i].width; - font_info[i].height = graphic_info[FIRST_IMG_FONT + i].height; - font_info[i].draw_x = graphic_info[FIRST_IMG_FONT + i].draw_x; - font_info[i].draw_y = graphic_info[FIRST_IMG_FONT + i].draw_y; + font_bitmap_info[i].bitmap = graphic_info[FIRST_IMG_FONT + i].bitmap; + font_bitmap_info[i].src_x = graphic_info[FIRST_IMG_FONT + i].src_x; + font_bitmap_info[i].src_y = graphic_info[FIRST_IMG_FONT + i].src_y; + font_bitmap_info[i].width = graphic_info[FIRST_IMG_FONT + i].width; + font_bitmap_info[i].height = graphic_info[FIRST_IMG_FONT + i].height; + font_bitmap_info[i].draw_x = graphic_info[FIRST_IMG_FONT + i].draw_x; + font_bitmap_info[i].draw_y = graphic_info[FIRST_IMG_FONT + i].draw_y; } } - InitFontInfo(font_info, num_fonts); + InitFontInfo(font_bitmap_info, num_fonts); } void InitElementGraphicInfo() diff --git a/src/libgame/system.c b/src/libgame/system.c index 201d0131..0131c133 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -36,7 +36,6 @@ struct OptionInfo options; struct VideoSystemInfo video; struct AudioSystemInfo audio; struct GfxInfo gfx; -struct AnimInfo anim; struct ArtworkInfo artwork; struct JoystickInfo joystick; struct SetupInfo setup; diff --git a/src/libgame/system.h b/src/libgame/system.h index 72dbb28d..bce82b93 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -290,7 +290,7 @@ struct AudioSystemInfo int first_sound_channel; }; -struct FontInfo +struct FontBitmapInfo { Bitmap *bitmap; int src_x, src_y; /* start position of animation frames */ @@ -325,12 +325,9 @@ struct GfxInfo boolean menu_main_hide_static_text; int num_fonts; - struct FontInfo *font; -}; + struct FontBitmapInfo *font; -struct AnimInfo -{ - int random_frame; + int anim_random_frame; }; struct JoystickInfo diff --git a/src/libgame/text.c b/src/libgame/text.c index bc2a366d..2e4262d0 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -107,7 +107,7 @@ static void InitFontClipmasks() } #endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */ -void InitFontInfo(struct FontInfo *font_info, int num_fonts) +void InitFontInfo(struct FontBitmapInfo *font_info, int num_fonts) { gfx.num_fonts = num_fonts; gfx.font = font_info; @@ -189,7 +189,7 @@ void DrawText(int x, int y, char *text, int font) void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, int font_nr, int mask_mode) { - struct FontInfo *font = &gfx.font[font_nr]; + struct FontBitmapInfo *font = &gfx.font[font_nr]; boolean print_inverse = FALSE; if (font->bitmap == NULL) diff --git a/src/libgame/text.h b/src/libgame/text.h index 505409a3..18dd2ba4 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -62,8 +62,7 @@ /* font structure definitions */ -#if 1 -void InitFontInfo(struct FontInfo *, int); +void InitFontInfo(struct FontBitmapInfo *, int); int getFontWidth(int); int getFontHeight(int); void DrawInitText(char *, int, int); @@ -71,15 +70,5 @@ void DrawTextF(int, int, int, char *, ...); void DrawTextFCentered(int, int, char *, ...); void DrawText(int, int, char *, int); void DrawTextExt(DrawBuffer *, int, int, char *, int, int); -#else -void InitFontInfo(Bitmap *, Bitmap *, Bitmap *, Bitmap *, Bitmap *); -int getFontWidth(int, int); -int getFontHeight(int, int); -void DrawInitText(char *, int, int); -void DrawTextF(int, int, int, char *, ...); -void DrawTextFCentered(int, int, char *, ...); -void DrawText(int, int, char *, int, int); -void DrawTextExt(DrawBuffer *, int, int, char *, int, int, int); -#endif #endif /* TEXT_H */ diff --git a/src/libgame/toons.c b/src/libgame/toons.c index 613d2017..01229f01 100644 --- a/src/libgame/toons.c +++ b/src/libgame/toons.c @@ -64,10 +64,10 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_frame, { /* note: expect different frames for the same delay cycle! */ - if (anim.random_frame < 0) + if (gfx.anim_random_frame < 0) frame = SimpleRND(num_frames); else - frame = anim.random_frame % num_frames; + frame = gfx.anim_random_frame % num_frames; } if (mode & ANIM_REVERSE) /* use reverse animation direction */ diff --git a/src/main.h b/src/main.h index a82e054f..281fc47e 100644 --- a/src/main.h +++ b/src/main.h @@ -1056,11 +1056,11 @@ struct ElementInfo int graphic[NUM_ACTIONS]; /* default graphics for several actions */ - /* special graphics for left/right/up/down */ int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS]; + /* special graphics for left/right/up/down */ - /* special graphics for certain screens */ int special_graphic[NUM_SPECIAL_GFX_ARGS]; + /* special graphics for certain screens */ int editor_graphic; /* graphic displayed in level editor */ int preview_graphic; /* graphic displayed in level preview */ @@ -1068,6 +1068,16 @@ struct ElementInfo int sound[NUM_ACTIONS]; /* default sounds for several actions */ }; +#if 0 +struct FontInfo +{ + int graphic; /* default graphic for this font */ + + int special_graphic[NUM_SPECIAL_GFX_ARGS]; + /* special graphics for certain screens */ +}; +#endif + struct GraphicInfo { Bitmap *bitmap; diff --git a/src/tools.c b/src/tools.c index fd263d1e..7330f9f9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -437,7 +437,7 @@ void SetBorderElement() void SetRandomAnimationValue(int x, int y) { - anim.random_frame = GfxRandom[x][y]; + gfx.anim_random_frame = GfxRandom[x][y]; } inline int getGraphicAnimationFrame(int graphic, int sync_frame) -- 2.34.1