From 88a46f726da49d5ae03e736b1388a4b854221685 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 19 Oct 2002 20:52:29 +0200 Subject: [PATCH] rnd-20021019-1-src --- src/conf_chr.c | 16 +++---- src/conftime.h | 2 +- src/editor.c | 100 ++++++++++++++++++++--------------------- src/game.c | 10 ++--- src/init.c | 2 +- src/libgame/text.c | 30 ++++++++----- src/main.h | 6 +-- src/tools.c | 110 ++++++++++++++++++++++++++++++++++++++++++++- src/tools.h | 6 +++ 9 files changed, 201 insertions(+), 81 deletions(-) diff --git a/src/conf_chr.c b/src/conf_chr.c index 127a270f..3f2923d0 100644 --- a/src/conf_chr.c +++ b/src/conf_chr.c @@ -339,23 +339,23 @@ { "char_underscore.frames", "1" }, { "char_empty", "RocksFontEM.pcx" }, - { "char_empty.xpos", "16" }, - { "char_empty.ypos", "0" }, + { "char_empty.xpos", "0" }, + { "char_empty.ypos", "4" }, { "char_empty.frames", "1" }, { "char_degree", "RocksFontEM.pcx" }, - { "char_degree.xpos", "16" }, - { "char_degree.ypos", "1" }, + { "char_degree.xpos", "1" }, + { "char_degree.ypos", "4" }, { "char_degree.frames", "1" }, { "char_tm", "RocksFontEM.pcx" }, - { "char_tm.xpos", "16" }, - { "char_tm.ypos", "2" }, + { "char_tm.xpos", "2" }, + { "char_tm.ypos", "4" }, { "char_tm.frames", "1" }, { "char_cursor", "RocksFontEM.pcx" }, - { "char_cursor.xpos", "16" }, - { "char_cursor.ypos", "3" }, + { "char_cursor.xpos", "3" }, + { "char_cursor.ypos", "4" }, { "char_cursor.frames", "1" }, diff --git a/src/conftime.h b/src/conftime.h index 12893605..da174758 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-10-06 04:07]" +#define COMPILE_DATE_STRING "[2002-10-19 20:38]" diff --git a/src/editor.c b/src/editor.c index ec814f42..db1a37e8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1298,13 +1298,13 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll) { x = (dx == 1 ? 0 : ed_fieldx - 1); for(y=0; y start_sx) { Feld[lx - 1][ly] = delete_buffer[sx - start_sx - 1]; - DrawMiniElement(sx - 1, sy, Feld[lx - 1][ly]); + DrawNewMiniElement(sx - 1, sy, Feld[lx - 1][ly]); DrawLevelText(sx - 1, sy, 0, TEXT_SETCURSOR); } break; @@ -3213,7 +3213,7 @@ static int DrawLevelText(int sx, int sy, char letter, int mode) case TEXT_END: CopyLevelToUndoBuffer(UNDO_IMMEDIATE); - DrawMiniElement(sx, sy, Feld[lx][ly]); + DrawNewMiniElement(sx, sy, Feld[lx][ly]); typing = FALSE; break; @@ -3234,7 +3234,7 @@ static void SetTextCursor(int unused_sx, int unused_sy, int sx, int sy, int ly = sy + level_ypos; if (element == -1) - DrawMiniElement(sx, sy, Feld[lx][ly]); + DrawNewMiniElement(sx, sy, Feld[lx][ly]); else DrawAreaBorder(sx, sy, sx, sy); } @@ -3279,7 +3279,7 @@ static void CopyLevelToUndoBuffer(int mode) last_border_element = BorderElement; SetBorderElement(); if (BorderElement != last_border_element) - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); #if 0 #ifdef DEBUG @@ -3320,7 +3320,7 @@ static void RandomPlacement(int new_element) for (y=0; y= 0 && x - level_xpos < ed_fieldx && y - level_ypos >= 0 && y - level_ypos < ed_fieldy) - DrawMiniElement(x - level_xpos, y - level_ypos, + DrawNewMiniElement(x - level_xpos, y - level_ypos, EL_EMPTY); } } @@ -3466,19 +3466,19 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) } Feld[lx][ly] = new_element; - DrawMiniElement(sx, sy, new_element); + DrawNewMiniElement(sx, sy, new_element); } } else { - DrawMiniGraphicExt(drawto, + DrawNewMiniGraphicExt(drawto, gi->x + sx * MINI_TILEX, gi->y + sy * MINI_TILEY, - el2gfx(new_element)); - DrawMiniGraphicExt(window, + el2img(new_element)); + DrawNewMiniGraphicExt(window, gi->x + sx * MINI_TILEX, gi->y + sy * MINI_TILEY, - el2gfx(new_element)); + el2img(new_element)); if (id == GADGET_ID_AMOEBA_CONTENT) level.amoeba_content = new_element; @@ -3575,7 +3575,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) if (button_press_event && Feld[lx][ly] != new_element) { FloodFill(lx, ly, new_element); - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); CopyLevelToUndoBuffer(UNDO_IMMEDIATE); } break; @@ -3698,7 +3698,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (button == 1) ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_RIGHT); else - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL], GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END); @@ -3717,7 +3717,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (button == 1) ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_LEFT); else - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL], GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END); @@ -3736,7 +3736,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (button == 1) ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_DOWN); else - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL], GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END); @@ -3755,7 +3755,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (button == 1) ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_UP); else - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL], GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END); @@ -3764,12 +3764,12 @@ static void HandleControlButtons(struct GadgetInfo *gi) case GADGET_ID_SCROLL_HORIZONTAL: level_xpos = gi->event.item_position - 1; - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); break; case GADGET_ID_SCROLL_VERTICAL: level_ypos = gi->event.item_position - 1; - DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); + DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); break; case GADGET_ID_SCROLL_LIST_UP: @@ -3800,7 +3800,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) int element = editor_element[element_shift + i]; UnmapGadget(gi); - getMiniGraphicSource(el2gfx(element), &gd->bitmap, &gd->x, &gd->y); + getNewMiniGraphicSource(el2img(element), &gd->bitmap, &gd->x, &gd->y); ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END); MapGadget(gi); } @@ -3869,7 +3869,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) for(x=0; xkey[key_nr] = TRUE; RaiseScoreElement(element); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; @@ -6324,9 +6324,9 @@ int DigField(struct PlayerInfo *player, RemoveField(x, y); player->key[key_nr] = TRUE; RaiseScoreElement(element); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, + DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, GFX_SCHLUESSEL1 + key_nr); PlaySoundLevel(x, y, SND_KEY_COLLECTING); break; diff --git a/src/init.c b/src/init.c index 32b2cb8e..55cfd3a2 100644 --- a/src/init.c +++ b/src/init.c @@ -109,9 +109,9 @@ void OpenAll(void) InitLevelInfo(); InitLevelArtworkInfo(); - InitGadgets(); /* needs to know number of level series */ InitImages(); /* needs to know current level directory */ InitSound(); /* needs to know current level directory */ + InitGadgets(); /* needs images + number of level series */ InitGfxBackground(); InitToons(); diff --git a/src/libgame/text.c b/src/libgame/text.c index a31c80f2..9c2529bc 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -108,7 +108,7 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text, int font_size, int font_type) { Bitmap *font_bitmap; - int font_width, font_height, font_start; + int font_width, font_height, font_starty; boolean print_inverse = FALSE; if (font_size != FS_SMALL && font_size != FS_BIG && font_size != FS_MEDIUM) @@ -126,15 +126,15 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, font.bitmap_small); if (font_type == FC_SPECIAL2) - font_start = (font_size == FS_BIG ? 0 : FONT1_YSIZE) * FONT_LINES_PER_FONT; + font_starty = (font_size == FS_BIG ? 0 : FONT1_YSIZE) * 5; else - font_start = (font_type * (font_size == FS_BIG ? FONT1_YSIZE : - font_size == FS_MEDIUM ? FONT6_YSIZE : - FONT2_YSIZE) * - FONT_LINES_PER_FONT); + font_starty = (font_type * (font_size == FS_BIG ? FONT1_YSIZE : + font_size == FS_MEDIUM ? FONT6_YSIZE : + FONT2_YSIZE) * + FONT_LINES_PER_FONT); if (font_type == FC_SPECIAL3) - font_start -= FONT2_YSIZE * FONT_LINES_PER_FONT; + font_starty -= FONT2_YSIZE * FONT_LINES_PER_FONT; while (*text) { @@ -162,20 +162,28 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, if ((c >= 32 && c <= 95) || c == '°' || c == '´') { int src_x = ((c - 32) % FONT_CHARS_PER_LINE) * font_width; - int src_y = ((c - 32) / FONT_CHARS_PER_LINE) * font_height + font_start; + int src_y = ((c - 32) / FONT_CHARS_PER_LINE) * font_height + font_starty; int dest_x = x, dest_y = y; if (c == '°' || c == '´') /* map '°' and 'TM' signs */ { - src_x = FONT_CHARS_PER_LINE * font_width; - src_y = (c == '°' ? 1 : 2) * font_height + font_start; + if (font_type == FC_SPECIAL2) + { + src_x = (c == '°' ? 1 : 2) * font_width; + src_y = 4 * font_height; + } + else + { + src_x = FONT_CHARS_PER_LINE * font_width; + src_y = (c == '°' ? 1 : 2) * font_height + font_starty; + } } if (print_inverse) { BlitBitmap(font_bitmap, bitmap, FONT_CHARS_PER_LINE * font_width, - 3 * font_height + font_start, + 3 * font_height + font_starty, font_width, font_height, x, y); SetClipOrigin(font_bitmap, font_bitmap->stored_clip_gc, diff --git a/src/main.h b/src/main.h index 7b82f5e3..458c7e18 100644 --- a/src/main.h +++ b/src/main.h @@ -255,9 +255,9 @@ #define MICRO_GFX_PER_LINE 16 #define MINI_FONT_STARTX 0 -#define MINI_FONT_STARTY 128 -#define MICRO_FONT_STARTX 408 -#define MICRO_FONT_STARTY 128 +#define MINI_FONT_STARTY 160 +#define MICRO_FONT_STARTX 384 +#define MICRO_FONT_STARTY 160 #define HEROES_PER_LINE 16 diff --git a/src/tools.c b/src/tools.c index c8f9e5d2..eba90f70 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1008,8 +1008,16 @@ void DrawNewGraphicThruMaskExt(DrawBuffer *d, int dest_x, int dest_y, void DrawMiniGraphic(int x, int y, int graphic) { - DrawMiniGraphicExt(drawto, SX + x*MINI_TILEX, SY + y*MINI_TILEY, graphic); - MarkTileDirty(x/2, y/2); + DrawMiniGraphicExt(drawto, + SX + x * MINI_TILEX, SY + y * MINI_TILEY, graphic); + MarkTileDirty(x / 2, y / 2); +} + +void DrawNewMiniGraphic(int x, int y, int graphic) +{ + DrawNewMiniGraphicExt(drawto, + SX + x * MINI_TILEX, SY + y * MINI_TILEY, graphic); + MarkTileDirty(x / 2, y / 2); } void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) @@ -1057,6 +1065,19 @@ void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) } } +void getNewMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) +{ + Bitmap *src_bitmap = new_graphic_info[graphic].bitmap; + int mini_startx = 0; + int mini_starty = src_bitmap->height * 2 / 3; + int src_x = mini_startx + new_graphic_info[graphic].src_x / 2; + int src_y = mini_starty + new_graphic_info[graphic].src_y / 2; + + *bitmap = src_bitmap; + *x = src_x; + *y = src_y; +} + void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic) { Bitmap *bitmap; @@ -1066,6 +1087,24 @@ void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic) BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y); } +void DrawNewMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic) +{ +#if 1 + Bitmap *src_bitmap; + int src_x, src_y; + + getNewMiniGraphicSource(graphic, &src_bitmap, &src_x, &src_y); +#else + Bitmap *src_bitmap = new_graphic_info[graphic].bitmap; + int mini_startx = src_bitmap->width * 2 / 3; + int mini_starty = src_bitmap->height * 2 / 3; + int src_x = mini_startx + new_graphic_info[graphic].src_x / 2; + int src_y = mini_starty + new_graphic_info[graphic].src_y / 2; +#endif + + BlitBitmap(src_bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y); +} + void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic, int cut_mode, int mask_mode) { @@ -2025,6 +2064,22 @@ void DrawMiniElement(int x, int y, int element) DrawMiniGraphic(x, y, graphic); } +void DrawNewMiniElement(int x, int y, int element) +{ + int graphic; + +#if 0 + if (!element) + { + DrawNewMiniGraphic(x, y, -1); + return; + } +#endif + + graphic = el2img(element); + DrawNewMiniGraphic(x, y, graphic); +} + void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) { int x = sx + scroll_x, y = sy + scroll_y; @@ -2059,6 +2114,40 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) } } +void DrawNewMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) +{ + int x = sx + scroll_x, y = sy + scroll_y; + + if (x < -1 || x > lev_fieldx || y < -1 || y > lev_fieldy) + DrawNewMiniElement(sx, sy, EL_EMPTY); + else if (x > -1 && x < lev_fieldx && y > -1 && y < lev_fieldy) + DrawNewMiniElement(sx, sy, Feld[x][y]); + else + { + int steel_type, steel_position; + int border[6][2] = + { + { IMG_STEELWALL_TOPLEFT, IMG_INVISIBLE_STEELWALL_TOPLEFT }, + { IMG_STEELWALL_TOPRIGHT, IMG_INVISIBLE_STEELWALL_TOPRIGHT }, + { IMG_STEELWALL_BOTTOMLEFT, IMG_INVISIBLE_STEELWALL_BOTTOMLEFT }, + { IMG_STEELWALL_BOTTOMRIGHT, IMG_INVISIBLE_STEELWALL_BOTTOMRIGHT }, + { IMG_STEELWALL_VERTICAL, IMG_INVISIBLE_STEELWALL_VERTICAL }, + { IMG_STEELWALL_HORIZONTAL, IMG_INVISIBLE_STEELWALL_HORIZONTAL } + }; + + steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); + steel_position = (x == -1 && y == -1 ? 0 : + x == lev_fieldx && y == -1 ? 1 : + x == -1 && y == lev_fieldy ? 2 : + x == lev_fieldx && y == lev_fieldy ? 3 : + x == -1 || x == lev_fieldx ? 4 : + y == -1 || y == lev_fieldy ? 5 : -1); + + if (steel_position != -1) + DrawNewMiniGraphic(sx, sy, border[steel_position][steel_type]); + } +} + void DrawMicroElement(int xpos, int ypos, int element) { int graphic; @@ -2131,6 +2220,17 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) redraw_mask |= REDRAW_FIELD; } +void DrawNewMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) +{ + int x,y; + + for(x=0; x graphic %d -- probably crashing now...", + element, graphic_NEW); +#endif + return graphic_NEW; #else diff --git a/src/tools.h b/src/tools.h index 33f43c8c..96b27e41 100644 --- a/src/tools.h +++ b/src/tools.h @@ -85,8 +85,11 @@ void DrawNewGraphicThruMask(int, int, int, int); void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int); void DrawNewGraphicThruMaskExt(DrawBuffer *, int, int, int, int); void DrawMiniGraphic(int, int, int); +void DrawNewMiniGraphic(int, int, int); void getMiniGraphicSource(int, Bitmap **, int *, int *); +void getNewMiniGraphicSource(int, Bitmap **, int *, int *); void DrawMiniGraphicExt(DrawBuffer *, int, int, int); +void DrawNewMiniGraphicExt(DrawBuffer *, int, int, int); void DrawGraphicShifted(int, int, int, int, int, int, int); void DrawNewGraphicShifted(int, int, int, int, int, int, int, int); void DrawGraphicShiftedThruMask(int, int, int, int, int, int); @@ -115,10 +118,13 @@ void DrawNewScreenField(int, int); void DrawLevelField(int, int); void DrawNewLevelField(int, int); void DrawMiniElement(int, int, int); +void DrawNewMiniElement(int, int, int); void DrawMiniElementOrWall(int, int, int, int); +void DrawNewMiniElementOrWall(int, int, int, int); void DrawMicroElement(int, int, int); void DrawLevel(void); void DrawMiniLevel(int, int, int, int); +void DrawNewMiniLevel(int, int, int, int); void DrawMicroLevel(int, int, boolean); boolean Request(char *, unsigned int); unsigned int OpenDoor(unsigned int); -- 2.34.1