X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=eeebba4e517446d3eddc9e60a20f5a0bcb8e1807;hb=7cd6d9ecca4ccd4927eddc994b616569ef23b231;hp=9a8c477c08332e8e0eb00048b679003ca94c90cd;hpb=1290799ac0be42dc5db602dd113c5185df0a7e03;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 9a8c477c..eeebba4e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -95,7 +95,7 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) for(xx=BX1; xx<=BX2; xx++) for(yy=BY1; yy<=BY2; yy++) if (xx >= x1 && xx <= x2 && yy >= y1 && yy <= y2) - DrawScreenField(xx, yy); + DrawNewScreenField(xx, yy); DrawAllPlayers(); if (setup.direct_draw) @@ -434,6 +434,7 @@ void DrawPlayerField(int x, int y) DrawPlayer(PLAYERINFO(x, y)); } +#if 0 void DrawPlayer(struct PlayerInfo *player) { int jx = player->jx, jy = player->jy; @@ -594,7 +595,7 @@ void DrawPlayer(struct PlayerInfo *player) if (SHIELD_ON(player)) { - int graphic = (player->shield_active_time_left ? GFX2_SHIELD_ACTIVE : + int graphic = (player->shield_deadly_time_left ? GFX2_SHIELD_ACTIVE : GFX2_SHIELD_PASSIVE); DrawGraphicAnimationShiftedThruMask(sx, sy, sxx, syy, graphic, @@ -686,11 +687,284 @@ void DrawPlayer(struct PlayerInfo *player) MarkTileDirty(sx,sy); } +#else + +void DrawPlayer(struct PlayerInfo *player) +{ + int jx = player->jx, jy = player->jy; + int last_jx = player->last_jx, last_jy = player->last_jy; + int next_jx = jx + (jx - last_jx), next_jy = jy + (jy - last_jy); + int sx = SCREENX(jx), sy = SCREENY(jy); + int sxx = 0, syy = 0; + int element = Feld[jx][jy], last_element = Feld[last_jx][last_jy]; + int graphic; + int frame = 0; + boolean player_is_moving = (last_jx != jx || last_jy != jy ? TRUE : FALSE); + + if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy))) + return; + +#if DEBUG + if (!IN_LEV_FIELD(jx,jy)) + { + printf("DrawPlayerField(): x = %d, y = %d\n",jx,jy); + printf("DrawPlayerField(): sx = %d, sy = %d\n",sx,sy); + printf("DrawPlayerField(): This should never happen!\n"); + return; + } +#endif + + if (element == EL_EXPLOSION) + return; + + /* draw things in the field the player is leaving, if needed */ + + if (player_is_moving) + { + if (Store[last_jx][last_jy] && IS_DRAWABLE(last_element)) + { + DrawNewLevelElement(last_jx, last_jy, Store[last_jx][last_jy]); + + if (last_element == EL_DYNAMITE_ACTIVE) + DrawDynamite(last_jx, last_jy); + else + DrawNewLevelFieldThruMask(last_jx, last_jy); + } + else if (last_element == EL_DYNAMITE_ACTIVE) + DrawDynamite(last_jx, last_jy); + else + DrawNewLevelField(last_jx, last_jy); + + if (player->Pushing && IN_SCR_FIELD(SCREENX(next_jx), SCREENY(next_jy))) + { + if (player->GfxPos) + { + if (Feld[next_jx][next_jy] == EL_SOKOBAN_FIELD_FULL) + DrawNewLevelElement(next_jx, next_jy, EL_SOKOBAN_FIELD_EMPTY); + else + DrawNewLevelElement(next_jx, next_jy, EL_EMPTY); + } + else + DrawNewLevelField(next_jx, next_jy); + } + } + + if (!IN_SCR_FIELD(sx, sy)) + return; + + if (setup.direct_draw) + SetDrawtoField(DRAW_BUFFERED); + + /* draw things behind the player, if needed */ + + if (Store[jx][jy]) + DrawNewLevelElement(jx, jy, Store[jx][jy]); + else if (!IS_ACTIVE_BOMB(element)) + DrawNewLevelField(jx, jy); + else + DrawNewLevelElement(jx, jy, EL_EMPTY); + + /* draw player himself */ + + if (game.emulation == EMU_SUPAPLEX) + { + static int last_dir = MV_LEFT; + int action = (player->programmed_action ? player->programmed_action : + player->action); + boolean action_moving = + (player_is_moving || + ((action & (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)) && + !(action & ~(MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)))); + + graphic = IMG_SP_MURPHY; + + if (player->Pushing) + { + if (player->MovDir == MV_LEFT) + graphic = IMG_SP_MURPHY_LEFT_PUSHING; + else if (player->MovDir == MV_RIGHT) + graphic = IMG_SP_MURPHY_RIGHT_PUSHING; + else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_LEFT) + graphic = IMG_SP_MURPHY_LEFT_PUSHING; + else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_RIGHT) + graphic = IMG_SP_MURPHY_RIGHT_PUSHING; + } + else if (player->snapped) + { + if (player->MovDir == MV_LEFT) + graphic = IMG_SP_MURPHY_LEFT_SNAPPING; + else if (player->MovDir == MV_RIGHT) + graphic = IMG_SP_MURPHY_RIGHT_SNAPPING; + else if (player->MovDir == MV_UP) + graphic = IMG_SP_MURPHY_UP_SNAPPING; + else if (player->MovDir == MV_DOWN) + graphic = IMG_SP_MURPHY_DOWN_SNAPPING; + } + else if (action_moving) + { + if (player->MovDir == MV_LEFT) + graphic = IMG_SP_MURPHY_LEFT_MOVING; + else if (player->MovDir == MV_RIGHT) + graphic = IMG_SP_MURPHY_RIGHT_MOVING; + else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_LEFT) + graphic = IMG_SP_MURPHY_LEFT_MOVING; + else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_RIGHT) + graphic = IMG_SP_MURPHY_RIGHT_MOVING; + else + graphic = IMG_SP_MURPHY_LEFT_MOVING; + + frame = getNewGraphicAnimationFrame(graphic, -1); + } + + if (player->MovDir == MV_LEFT || player->MovDir == MV_RIGHT) + last_dir = player->MovDir; + } + else + { + if (player->MovDir == MV_LEFT) + graphic = (player->Pushing ? IMG_PLAYER1_LEFT_PUSHING : + IMG_PLAYER1_LEFT_MOVING); + else if (player->MovDir == MV_RIGHT) + graphic = (player->Pushing ? IMG_PLAYER1_RIGHT_PUSHING : + IMG_PLAYER1_RIGHT_MOVING); + else if (player->MovDir == MV_UP) + graphic = (player->Pushing ? IMG_PLAYER1_UP_PUSHING : + IMG_PLAYER1_UP_MOVING); + else /* MV_DOWN || MV_NO_MOVING */ + graphic = (player->Pushing ? IMG_PLAYER1_DOWN_PUSHING : + IMG_PLAYER1_DOWN_MOVING); + + graphic = PLAYER_NR_GFX(graphic, player->index_nr); + + frame = player->Frame; + } + + if (player->GfxPos) + { + if (player->MovDir == MV_LEFT || player->MovDir == MV_RIGHT) + sxx = player->GfxPos; + else + syy = player->GfxPos; + } + + if (!setup.soft_scrolling && ScreenMovPos) + sxx = syy = 0; + + DrawNewGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, frame, NO_CUTTING); + + if (SHIELD_ON(player)) + { + int graphic = (player->shield_deadly_time_left ? IMG_SHIELD_DEADLY_ACTIVE : + IMG_SHIELD_NORMAL_ACTIVE); + int frame = getNewGraphicAnimationFrame(graphic, -1); + + DrawNewGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, frame, NO_CUTTING); + } + + if (player->Pushing && player->GfxPos) + { + int px = SCREENX(next_jx), py = SCREENY(next_jy); + + if (element == EL_SOKOBAN_FIELD_EMPTY || + Feld[next_jx][next_jy] == EL_SOKOBAN_FIELD_FULL) + DrawNewGraphicShiftedThruMask(px, py, sxx, syy, GFX_SOKOBAN_OBJEKT, 0, + NO_CUTTING); + else + { + int element = Feld[next_jx][next_jy]; + int graphic = el2img(element); + int frame = 0; + + if ((element == EL_ROCK || + element == EL_SP_ZONK || + element == EL_BD_ROCK) && sxx) + { + graphic = el_dir_act2img(element, player->MovDir, GFX_ACTION_PUSHING); + frame = getNewGraphicAnimationFrame(graphic, player->GfxPos); + + /* !!! FIX !!! */ + if (player->MovDir == MV_LEFT) + frame = 3 - frame; + +#if 0 + frame = (player->GfxPos / (TILEX / 4)); + + if (player->MovDir == MV_RIGHT) + frame = (frame + 4) % 4; +#endif + } + + DrawNewGraphicShifted(px, py, sxx, syy, graphic, frame, + NO_CUTTING, NO_MASKING); + } + } + + /* draw things in front of player (active dynamite or dynabombs) */ + + if (IS_ACTIVE_BOMB(element)) + { + graphic = el2img(element); + +#if 0 + if (element == EL_DYNAMITE_ACTIVE) + { + if ((frame = (96 - MovDelay[jx][jy]) / 12) > 6) + frame = 6; + } + else + { + if ((frame = ((96 - MovDelay[jx][jy]) / 6) % 8) > 3) + frame = 7 - frame; + } +#else + frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[jx][jy]); +#endif + + if (game.emulation == EMU_SUPAPLEX) + DrawNewGraphic(sx, sy, GFX_SP_DISK_RED, 0); + else + DrawNewGraphicThruMask(sx, sy, graphic, frame); + } + + if (player_is_moving && last_element == EL_EXPLOSION) + { + int frame = Frame[last_jx][last_jy]; + int delay = 2; + + if (frame > 2) + DrawNewGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy), + GFX_EXPLOSION, ((frame - 1) / delay - 1)); + } + + /* draw elements that stay over the player */ + /* handle the field the player is leaving ... */ + if (player_is_moving && IS_OVER_PLAYER(last_element)) + DrawNewLevelField(last_jx, last_jy); + /* ... and the field the player is entering */ + if (IS_OVER_PLAYER(element)) + DrawNewLevelField(jx, jy); + + if (setup.direct_draw) + { + int dest_x = SX + SCREENX(MIN(jx, last_jx)) * TILEX; + int dest_y = SY + SCREENY(MIN(jy, last_jy)) * TILEY; + int x_size = TILEX * (1 + ABS(jx - last_jx)); + int y_size = TILEY * (1 + ABS(jy - last_jy)); + + BlitBitmap(drawto_field, window, + dest_x, dest_y, x_size, y_size, dest_x, dest_y); + SetDrawtoField(DRAW_DIRECT); + } + + MarkTileDirty(sx,sy); +} +#endif + static int getGraphicAnimationPhase(int frames, int delay, int mode) { int phase; - if (mode == ANIM_PINGPONG) + if (mode & ANIM_PINGPONG) { int max_anim_frames = 2 * frames - 2; @@ -700,24 +974,35 @@ static int getGraphicAnimationPhase(int frames, int delay, int mode) else phase = (FrameCounter % (delay * frames)) / delay; - if (mode == ANIM_REVERSE) + if (mode & ANIM_REVERSE) phase = -phase; return phase; } -static int getNewGraphicAnimationFrame(int graphic, int sync_frame) +int getNewGraphicAnimationFrame(int graphic, int sync_frame) { int num_frames = new_graphic_info[graphic].anim_frames; int delay = new_graphic_info[graphic].anim_delay; int mode = new_graphic_info[graphic].anim_mode; - int frame; + int frame = 0; /* animation synchronized with global frame counter, not move position */ if (new_graphic_info[graphic].anim_global_sync || sync_frame < 0) sync_frame = FrameCounter; - if (mode & ANIM_PINGPONG) /* use border frames once */ + if (mode & ANIM_LOOP) /* normal, looping animation */ + { + frame = (sync_frame % (delay * num_frames)) / delay; + } + else if (mode & ANIM_LINEAR) /* normal, non-looping animation */ + { + frame = sync_frame / delay; + + if (frame > num_frames - 1) + frame = num_frames - 1; + } + else if (mode & ANIM_PINGPONG) /* use border frames once */ { int max_anim_frames = 2 * num_frames - 2; @@ -731,8 +1016,6 @@ static int getNewGraphicAnimationFrame(int graphic, int sync_frame) frame = (sync_frame % (delay * max_anim_frames)) / delay; frame = (frame < num_frames ? frame : max_anim_frames - frame - 1); } - else /* mode == ANIM_NORMAL || mode == ANIM_REVERSE */ - frame = (sync_frame % (delay * num_frames)) / delay; if (mode & ANIM_REVERSE) /* use reverse animation direction */ frame = num_frames - frame - 1; @@ -740,6 +1023,7 @@ static int getNewGraphicAnimationFrame(int graphic, int sync_frame) return frame; } +#if 0 void DrawGraphicAnimationExt(int x, int y, int graphic, int frames, int delay, int mode, int mask_mode) { @@ -753,12 +1037,17 @@ void DrawGraphicAnimationExt(int x, int y, int graphic, DrawGraphic(SCREENX(x), SCREENY(y), graphic + phase); } } +#endif void DrawNewGraphicAnimationExt(int x, int y, int graphic, int mask_mode) { +#if 0 int delay = new_graphic_info[graphic].anim_delay; if (!(FrameCounter % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#else + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) +#endif { int frame = getNewGraphicAnimationFrame(graphic, -1); @@ -769,22 +1058,26 @@ void DrawNewGraphicAnimationExt(int x, int y, int graphic, int mask_mode) } } +#if 0 void DrawGraphicAnimation(int x, int y, int graphic, int frames, int delay, int mode) { DrawGraphicAnimationExt(x, y, graphic, frames, delay, mode, NO_MASKING); } +#endif void DrawNewGraphicAnimation(int x, int y, int graphic) { DrawNewGraphicAnimationExt(x, y, graphic, NO_MASKING); } +#if 0 void DrawGraphicAnimationThruMask(int x, int y, int graphic, int frames, int delay, int mode) { DrawGraphicAnimationExt(x, y, graphic, frames, delay, mode, USE_MASKING); } +#endif static void DrawGraphicAnimationShiftedThruMask(int sx, int sy, int sxx, int syy, @@ -797,6 +1090,7 @@ static void DrawGraphicAnimationShiftedThruMask(int sx, int sy, DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic + phase, NO_CUTTING); } +#if 1 void getGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { if (graphic >= 0 && graphic_info[graphic].bitmap != NULL) @@ -855,7 +1149,9 @@ void getGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) *y = 0; } } +#endif +#if 0 void DrawGraphic(int x, int y, int graphic) { #if DEBUG @@ -870,6 +1166,7 @@ void DrawGraphic(int x, int y, int graphic) DrawGraphicExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic); MarkTileDirty(x, y); } +#endif void DrawNewGraphic(int x, int y, int graphic, int frame) { @@ -887,7 +1184,7 @@ void DrawNewGraphic(int x, int y, int graphic, int frame) MarkTileDirty(x, y); } -void DrawGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic) +void DrawOldGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic) { Bitmap *src_bitmap; int src_x, src_y; @@ -902,11 +1199,11 @@ void DrawNewGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic, Bitmap *src_bitmap = new_graphic_info[graphic].bitmap; int src_x = new_graphic_info[graphic].src_x; int src_y = new_graphic_info[graphic].src_y; + int offset_x = new_graphic_info[graphic].offset_x; + int offset_y = new_graphic_info[graphic].offset_y; - if (new_graphic_info[graphic].anim_vertical) - src_y += frame * TILEY; - else - src_x += frame * TILEX; + src_x += frame * offset_x; + src_y += frame * offset_y; BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y); } @@ -983,22 +1280,33 @@ void DrawNewGraphicThruMaskExt(DrawBuffer *d, int dest_x, int dest_y, GC drawing_gc = src_bitmap->stored_clip_gc; int src_x = new_graphic_info[graphic].src_x; int src_y = new_graphic_info[graphic].src_y; + int offset_x = new_graphic_info[graphic].offset_x; + int offset_y = new_graphic_info[graphic].offset_y; - if (new_graphic_info[graphic].anim_vertical) - src_y += frame * TILEY; - else - src_x += frame * TILEX; + src_x += frame * offset_x; + src_y += frame * offset_y; SetClipOrigin(src_bitmap, drawing_gc, dest_x - src_x, dest_y - src_y); BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dest_x, dest_y); } +#if 0 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); +} +#endif + +void DrawNewMiniGraphic(int x, int y, int graphic) +{ + DrawNewMiniGraphicExt(drawto, + SX + x * MINI_TILEX, SY + y * MINI_TILEY, graphic); + MarkTileDirty(x / 2, y / 2); } +#if 1 void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { if (graphic >= GFX_START_ROCKSELEMENTS && graphic <= GFX_END_ROCKSELEMENTS) @@ -1044,6 +1352,21 @@ 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; +} +#endif + +#if 0 void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic) { Bitmap *bitmap; @@ -1052,7 +1375,27 @@ void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic) getMiniGraphicSource(graphic, &bitmap, &src_x, &src_y); BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y); } +#endif + +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); +} +#if 0 void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic, int cut_mode, int mask_mode) { @@ -1179,6 +1522,7 @@ void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic, MarkTileDirty(x,y); } +#endif void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame, int cut_mode, int mask_mode) @@ -1187,6 +1531,8 @@ void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame, GC drawing_gc; int src_x; int src_y; + int offset_x; + int offset_y; int width = TILEX, height = TILEY; int cx = 0, cy = 0; @@ -1263,14 +1609,15 @@ void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame, } src_bitmap = new_graphic_info[graphic].bitmap; - drawing_gc = src_bitmap->stored_clip_gc; src_x = new_graphic_info[graphic].src_x; src_y = new_graphic_info[graphic].src_y; + offset_x = new_graphic_info[graphic].offset_x; + offset_y = new_graphic_info[graphic].offset_y; - if (new_graphic_info[graphic].anim_vertical) - src_y += frame * TILEY; - else - src_x += frame * TILEX; + drawing_gc = src_bitmap->stored_clip_gc; + + src_x += frame * offset_x; + src_y += frame * offset_y; src_x += cx; src_y += cy; @@ -1288,19 +1635,25 @@ void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame, #endif if (mask_mode == USE_MASKING) + { SetClipOrigin(src_bitmap, drawing_gc, dest_x - src_x, dest_y - src_y); - - BlitBitmap(src_bitmap, drawto_field, src_x, src_y, width, height, - dest_x, dest_y); + BlitBitmapMasked(src_bitmap, drawto_field, src_x, src_y, width, height, + dest_x, dest_y); + } + else + BlitBitmap(src_bitmap, drawto_field, src_x, src_y, width, height, + dest_x, dest_y); MarkTileDirty(x,y); } +#if 0 void DrawGraphicShiftedThruMask(int x,int y, int dx,int dy, int graphic, int cut_mode) { DrawGraphicShifted(x,y, dx,dy, graphic, cut_mode, USE_MASKING); } +#endif void DrawNewGraphicShiftedThruMask(int x,int y, int dx,int dy, int graphic, int frame, int cut_mode) @@ -1308,6 +1661,7 @@ void DrawNewGraphicShiftedThruMask(int x,int y, int dx,int dy, int graphic, DrawNewGraphicShifted(x,y, dx,dy, graphic, frame, cut_mode, USE_MASKING); } +#if 0 void DrawScreenElementExt(int x, int y, int dx, int dy, int element, int cut_mode, int mask_mode) { @@ -1344,7 +1698,7 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, } else if (element == EL_SP_ELECTRON) { - graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); + graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_LOOP); } else if (element == EL_MOLE || element == EL_PENGUIN || element == EL_PIG || element == EL_DRAGON) @@ -1370,11 +1724,11 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, } else if (element == EL_SATELLITE) { - graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); + graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_LOOP); } else if (element == EL_ACID) { - graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL); + graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_LOOP); } else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) { @@ -1438,6 +1792,7 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, else if (rechts_massiv) graphic = GFX_MAUER_L; } +#if 0 else if ((element == EL_INVISIBLE_STEELWALL || element == EL_INVISIBLE_WALL || element == EL_INVISIBLE_SAND) && game.light_time_left) @@ -1446,6 +1801,7 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, element == EL_INVISIBLE_WALL ? GFX_UNSICHTBAR_ON : GFX_SAND_INVISIBLE_ON); } +#endif if (dx || dy) DrawGraphicShifted(x, y, dx, dy, graphic, cut_mode, mask_mode); @@ -1454,102 +1810,68 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, else DrawGraphic(x, y, graphic); } +#endif + +inline static int getFramePosition(int x, int y) +{ + int element = Feld[x][y]; + int frame_pos = -1; + + if (element == EL_QUICKSAND_FULL || + element == EL_MAGIC_WALL_FULL || + element == EL_BD_MAGIC_WALL_FULL) + frame_pos = -1; + else if (IS_MOVING(x, y) || CAN_MOVE(element) || CAN_FALL(element)) + frame_pos = ABS(MovPos[x][y]) / (TILEX / 8); + + return frame_pos; +} + +inline static int getGfxAction(int x, int y) +{ + int gfx_action = GFX_ACTION_DEFAULT; + + if (GfxAction[x][y] != GFX_ACTION_DEFAULT) + gfx_action = GfxAction[x][y]; + else if (IS_MOVING(x, y)) + gfx_action = GFX_ACTION_MOVING; + + return gfx_action; +} void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, - int cut_mode, int mask_mode) + int cut_mode, int mask_mode) { int ux = LEVELX(x), uy = LEVELY(y); int move_dir = MovDir[ux][uy]; - int move_pos = ABS(MovPos[ux][uy]) / (TILEX / 8); - int graphic = el_dir2img(element, move_dir); + int move_pos = getFramePosition(ux, uy); + int gfx_action = getGfxAction(ux, uy); + int graphic = el_dir_act2img(element, move_dir, gfx_action); int frame = getNewGraphicAnimationFrame(graphic, move_pos); - int phase8 = move_pos; - int phase4 = phase8 / 2; - int phase2 = phase8 / 4; - - int dir = move_dir; /* !!! THROW AWAY LATER !!! */ - if (0) - { - ; - } -#if 0 - else if (element == EL_PACMAN || element == EL_BUG || - element == EL_SPACESHIP) - { - graphic += 1 * !phase2; - - if (dir == MV_UP) - graphic += 1 * 2; - else if (dir == MV_LEFT) - graphic += 2 * 2; - else if (dir == MV_DOWN) - graphic += 3 * 2; - } - else if (element == EL_SP_SNIKSNAK) + if (element == EL_WALL_GROWING) { - if (dir == MV_LEFT) - graphic = GFX_SP_SNIKSNAK_LEFT; - else if (dir == MV_RIGHT) - graphic = GFX_SP_SNIKSNAK_RIGHT; - else if (dir == MV_UP) - graphic = GFX_SP_SNIKSNAK_UP; - else - graphic = GFX_SP_SNIKSNAK_DOWN; + boolean left_stopped = FALSE, right_stopped = FALSE; - graphic += (phase8 < 4 ? phase8 : 7 - phase8); - } - else if (element == EL_SP_ELECTRON) - { - graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); - } -#endif - else if (element == EL_MOLE || element == EL_PENGUIN || - element == EL_PIG || element == EL_DRAGON) - { - if (dir == MV_LEFT) - graphic = (element == EL_MOLE ? GFX_MOLE_LEFT : - element == EL_PENGUIN ? GFX_PINGUIN_LEFT : - element == EL_PIG ? GFX_SCHWEIN_LEFT : GFX_DRACHE_LEFT); - else if (dir == MV_RIGHT) - graphic = (element == EL_MOLE ? GFX_MOLE_RIGHT : - element == EL_PENGUIN ? GFX_PINGUIN_RIGHT : - element == EL_PIG ? GFX_SCHWEIN_RIGHT : GFX_DRACHE_RIGHT); - else if (dir == MV_UP) - graphic = (element == EL_MOLE ? GFX_MOLE_UP : - element == EL_PENGUIN ? GFX_PINGUIN_UP : - element == EL_PIG ? GFX_SCHWEIN_UP : GFX_DRACHE_UP); - else - graphic = (element == EL_MOLE ? GFX_MOLE_DOWN : - element == EL_PENGUIN ? GFX_PINGUIN_DOWN : - element == EL_PIG ? GFX_SCHWEIN_DOWN : GFX_DRACHE_DOWN); + if (!IN_LEV_FIELD(ux - 1, uy) || IS_MAUER(Feld[ux - 1][uy])) + left_stopped = TRUE; + if (!IN_LEV_FIELD(ux + 1, uy) || IS_MAUER(Feld[ux + 1][uy])) + right_stopped = TRUE; - graphic += phase4; - } - else if (element == EL_SATELLITE) - { -#if 1 - graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL); -#else - graphic = GFX_SONDE_START + getNewGraphicAnimationFrame(graphic, move_pos); -#endif - } - else if (element == EL_ACID) - { -#if 1 - graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL); -#else - graphic = GFX_GEBLUBBER + getNewGraphicAnimationFrame(graphic, move_pos); -#endif - } - else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) - { - graphic += !phase2; - } - else if (element == EL_BALLOON) - { - graphic += phase4; + if (left_stopped && right_stopped) + graphic = IMG_WALL; + else if (left_stopped) + { + graphic = IMG_WALL_GROWING_ACTIVE_RIGHT; + frame = new_graphic_info[graphic].anim_frames - 1; + } + else if (right_stopped) + { + graphic = IMG_WALL_GROWING_ACTIVE_LEFT; + frame = new_graphic_info[graphic].anim_frames - 1; + } } +#if 0 else if ((element == EL_ROCK || element == EL_SP_ZONK || element == EL_BD_ROCK || @@ -1563,9 +1885,9 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, element == EL_SP_ZONK || element == EL_BD_ROCK) { - if (dir == MV_LEFT) + if (move_dir == MV_LEFT) graphic += (4 - phase4) % 4; - else if (dir == MV_RIGHT) + else if (move_dir == MV_RIGHT) graphic += phase4; else graphic += phase2 * 2; @@ -1574,47 +1896,16 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, graphic += phase2; } } - else if (element == EL_MAGIC_WALL_ACTIVE || - element == EL_MAGIC_WALL_EMPTYING || - element == EL_BD_MAGIC_WALL_ACTIVE || - element == EL_BD_MAGIC_WALL_EMPTYING || - element == EL_MAGIC_WALL_FULL || - element == EL_BD_MAGIC_WALL_FULL) - { -#if 1 - graphic += 3 + getGraphicAnimationPhase(4, 4, ANIM_REVERSE); -#else - graphic += 3 + getNewGraphicAnimationFrame(graphic, move_pos); #endif - } else if (IS_AMOEBOID(element) || element == EL_AMOEBA_DRIPPING) { - graphic = (element == EL_AMOEBA_DEAD ? GFX_AMOEBE_TOT : GFX_AMOEBE_LEBT); - graphic += (x + 2 * y + 4) % 4; - } - else if (element == EL_WALL_GROWING) - { - boolean links_massiv = FALSE, rechts_massiv = FALSE; + graphic = (element == EL_BD_AMOEBA ? IMG_BD_AMOEBA_PART1 : + element == EL_AMOEBA_WET ? IMG_AMOEBA_WET_PART1 : + element == EL_AMOEBA_DRY ? IMG_AMOEBA_DRY_PART1 : + element == EL_AMOEBA_FULL ? IMG_AMOEBA_FULL_PART1 : + IMG_AMOEBA_DEAD_PART1); - if (!IN_LEV_FIELD(ux-1, uy) || IS_MAUER(Feld[ux-1][uy])) - links_massiv = TRUE; - if (!IN_LEV_FIELD(ux+1, uy) || IS_MAUER(Feld[ux+1][uy])) - rechts_massiv = TRUE; - - if (links_massiv && rechts_massiv) - graphic = GFX_MAUERWERK; - else if (links_massiv) - graphic = GFX_MAUER_R; - else if (rechts_massiv) - graphic = GFX_MAUER_L; - } - else if ((element == EL_INVISIBLE_STEELWALL || - element == EL_INVISIBLE_WALL || - element == EL_INVISIBLE_SAND) && game.light_time_left) - { - graphic = (element == EL_INVISIBLE_STEELWALL ? GFX_INVISIBLE_STEEL_ON : - element == EL_INVISIBLE_WALL ? GFX_UNSICHTBAR_ON : - GFX_SAND_INVISIBLE_ON); + graphic += (x + 2 * y + 4) % 4; } if (dx || dy) @@ -1625,6 +1916,7 @@ void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element, DrawNewGraphic(x, y, graphic, frame); } +#if 0 void DrawLevelElementExt(int x, int y, int dx, int dy, int element, int cut_mode, int mask_mode) { @@ -1632,6 +1924,7 @@ void DrawLevelElementExt(int x, int y, int dx, int dy, int element, DrawScreenElementExt(SCREENX(x), SCREENY(y), dx, dy, element, cut_mode, mask_mode); } +#endif void DrawNewLevelElementExt(int x, int y, int dx, int dy, int element, int cut_mode, int mask_mode) @@ -1641,11 +1934,13 @@ void DrawNewLevelElementExt(int x, int y, int dx, int dy, int element, cut_mode, mask_mode); } +#if 0 void DrawScreenElementShifted(int x, int y, int dx, int dy, int element, int cut_mode) { DrawScreenElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING); } +#endif void DrawNewScreenElementShifted(int x, int y, int dx, int dy, int element, int cut_mode) @@ -1653,11 +1948,13 @@ void DrawNewScreenElementShifted(int x, int y, int dx, int dy, int element, DrawNewScreenElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING); } +#if 0 void DrawLevelElementShifted(int x, int y, int dx, int dy, int element, int cut_mode) { DrawLevelElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING); } +#endif void DrawNewLevelElementShifted(int x, int y, int dx, int dy, int element, int cut_mode) @@ -1665,6 +1962,7 @@ void DrawNewLevelElementShifted(int x, int y, int dx, int dy, int element, DrawNewLevelElementExt(x, y, dx, dy, element, cut_mode, NO_MASKING); } +#if 0 void DrawScreenElementThruMask(int x, int y, int element) { DrawScreenElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING); @@ -1674,27 +1972,33 @@ void DrawNewScreenElementThruMask(int x, int y, int element) { DrawNewScreenElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING); } +#endif +#if 0 void DrawLevelElementThruMask(int x, int y, int element) { DrawLevelElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING); } +#endif void DrawNewLevelElementThruMask(int x, int y, int element) { DrawNewLevelElementExt(x, y, 0, 0, element, NO_CUTTING, USE_MASKING); } +#if 0 void DrawLevelFieldThruMask(int x, int y) { DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING); } +#endif void DrawNewLevelFieldThruMask(int x, int y) { DrawNewLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING); } +#if 0 void ErdreichAnbroeckeln(int x, int y) { Bitmap *src_bitmap; @@ -1811,24 +2115,151 @@ void ErdreichAnbroeckeln(int x, int y) } } } +#endif + +void DrawCrumbledSand(int x, int y) +{ + Bitmap *src_bitmap; + int src_x, src_y; + int i, width, height, cx,cy; + int ux = LEVELX(x), uy = LEVELY(y); + int element, graphic; + int snip = 4; + static int xy[4][2] = + { + { 0, -1 }, + { -1, 0 }, + { +1, 0 }, + { 0, +1 } + }; + + if (!IN_LEV_FIELD(ux, uy)) + return; + + element = Feld[ux][uy]; + + if (element == EL_SAND || + element == EL_LANDMINE || + element == EL_TRAP || + element == EL_TRAP_ACTIVE) + { + if (!IN_SCR_FIELD(x, y)) + return; + + graphic = IMG_SAND_CRUMBLED; + + src_bitmap = new_graphic_info[graphic].bitmap; + src_x = new_graphic_info[graphic].src_x; + src_y = new_graphic_info[graphic].src_y; + + for(i=0; i<4; i++) + { + int uxx, uyy; + + uxx = ux + xy[i][0]; + uyy = uy + xy[i][1]; + if (!IN_LEV_FIELD(uxx, uyy)) + element = EL_STEELWALL; + else + element = Feld[uxx][uyy]; + + if (element == EL_SAND || + element == EL_LANDMINE || + element == EL_TRAP || + element == EL_TRAP_ACTIVE) + continue; + + if (i == 1 || i == 2) + { + width = snip; + height = TILEY; + cx = (i == 2 ? TILEX - snip : 0); + cy = 0; + } + else + { + width = TILEX; + height = snip; + cx = 0; + cy = (i == 3 ? TILEY - snip : 0); + } + + BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy, + width, height, FX + x * TILEX + cx, FY + y * TILEY + cy); + } + + MarkTileDirty(x, y); + } + else + { + graphic = IMG_SAND_CRUMBLED; + + src_bitmap = new_graphic_info[graphic].bitmap; + src_x = new_graphic_info[graphic].src_x; + src_y = new_graphic_info[graphic].src_y; + + for(i=0; i<4; i++) + { + int xx, yy, uxx, uyy; + + xx = x + xy[i][0]; + yy = y + xy[i][1]; + uxx = ux + xy[i][0]; + uyy = uy + xy[i][1]; + + if (!IN_LEV_FIELD(uxx, uyy) || + (Feld[uxx][uyy] != EL_SAND && + Feld[uxx][uyy] != EL_LANDMINE && + Feld[uxx][uyy] != EL_TRAP && + Feld[uxx][uyy] != EL_TRAP_ACTIVE) || + !IN_SCR_FIELD(xx, yy)) + continue; + + if (i == 1 || i == 2) + { + width = snip; + height = TILEY; + cx = (i == 1 ? TILEX - snip : 0); + cy = 0; + } + else + { + width = TILEX; + height = snip; + cx = 0; + cy = (i==0 ? TILEY-snip : 0); + } + + BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy, + width, height, FX + xx * TILEX + cx, FY + yy * TILEY + cy); + + MarkTileDirty(xx, yy); + } + } +} +#if 0 void DrawScreenElement(int x, int y, int element) { DrawScreenElementExt(x, y, 0, 0, element, NO_CUTTING, NO_MASKING); ErdreichAnbroeckeln(x, y); } +#endif void DrawNewScreenElement(int x, int y, int element) { DrawNewScreenElementExt(x, y, 0, 0, element, NO_CUTTING, NO_MASKING); - ErdreichAnbroeckeln(x, y); + DrawCrumbledSand(x, y); } + +#if 0 void DrawLevelElement(int x, int y, int element) { if (IN_LEV_FIELD(x, y) && IN_SCR_FIELD(SCREENX(x), SCREENY(y))) DrawScreenElement(SCREENX(x), SCREENY(y), element); } +#endif void DrawNewLevelElement(int x, int y, int element) { @@ -1836,6 +2267,7 @@ void DrawNewLevelElement(int x, int y, int element) DrawNewScreenElement(SCREENX(x), SCREENY(y), element); } +#if 0 void DrawScreenField(int x, int y) { int ux = LEVELX(x), uy = LEVELY(y); @@ -1925,6 +2357,7 @@ void DrawScreenField(int x, int y) else DrawScreenElement(x, y, EL_EMPTY); } +#endif void DrawNewScreenField(int x, int y) { @@ -2016,6 +2449,7 @@ void DrawNewScreenField(int x, int y) DrawNewScreenElement(x, y, EL_EMPTY); } +#if 0 void DrawLevelField(int x, int y) { if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) @@ -2037,6 +2471,7 @@ void DrawLevelField(int x, int y) DrawScreenField(SCREENX(oldx), SCREENY(oldy)); } } +#endif void DrawNewLevelField(int x, int y) { @@ -2060,6 +2495,7 @@ void DrawNewLevelField(int x, int y) } } +#if 0 void DrawMiniElement(int x, int y, int element) { int graphic; @@ -2073,7 +2509,25 @@ void DrawMiniElement(int x, int y, int element) graphic = el2gfx(element); DrawMiniGraphic(x, y, graphic); } +#endif + +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); +} +#if 0 void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) { int x = sx + scroll_x, y = sy + scroll_y; @@ -2107,7 +2561,43 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) DrawMiniGraphic(sx, sy, border[steel_position][steel_type]); } } +#endif + +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]); + } +} +#if 0 void DrawMicroElement(int xpos, int ypos, int element) { int graphic; @@ -2155,6 +2645,36 @@ void DrawMicroElement(int xpos, int ypos, int element) MICRO_GFX_STARTY + (graphic / MICRO_GFX_PER_LINE) * MICRO_TILEY, MICRO_TILEX, MICRO_TILEY, xpos, ypos); } +#endif + +void getNewMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) +{ + Bitmap *src_bitmap = new_graphic_info[graphic].bitmap; + int mini_startx = src_bitmap->width * 3 / 4; + int mini_starty = src_bitmap->height * 2 / 3; + int src_x = mini_startx + new_graphic_info[graphic].src_x / 8; + int src_y = mini_starty + new_graphic_info[graphic].src_y / 8; + + *bitmap = src_bitmap; + *x = src_x; + *y = src_y; +} + +void DrawNewMicroElement(int xpos, int ypos, int element) +{ + Bitmap *src_bitmap; + int src_x, src_y; + int graphic; + + if (element == EL_EMPTY) + return; + + graphic = el2img(element); + + getNewMicroGraphicSource(graphic, &src_bitmap, &src_x, &src_y); + BlitBitmap(src_bitmap, drawto, src_x, src_y, MICRO_TILEX, MICRO_TILEY, + xpos, ypos); +} void DrawLevel() { @@ -2164,11 +2684,12 @@ void DrawLevel() for(x=BX1; x<=BX2; x++) for(y=BY1; y<=BY2; y++) - DrawScreenField(x, y); + DrawNewScreenField(x, y); redraw_mask |= REDRAW_FIELD; } +#if 0 void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) { int x,y; @@ -2179,7 +2700,20 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) redraw_mask |= REDRAW_FIELD; } +#endif + +void DrawNewMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) +{ + int x,y; + + for(x=0; x= 0 && lx < lev_fieldx && ly >= 0 && ly < lev_fieldy) + DrawNewMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY, + Ur[lx][ly]); + else if (lx >= -1 && lx < lev_fieldx+1 && ly >= -1 && ly < lev_fieldy+1) + DrawNewMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY, + BorderElement); + } + } + + redraw_mask |= REDRAW_MICROLEVEL; +} #define MICROLABEL_EMPTY 0 #define MICROLABEL_LEVEL_NAME 1 @@ -2261,7 +2828,7 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) label_state = 1; label_counter = 0; - DrawMicroLevelExt(xpos, ypos, from_x, from_y); + DrawNewMicroLevelExt(xpos, ypos, from_x, from_y); DrawMicroLevelLabelExt(label_state); /* initialize delay counters */ @@ -2309,7 +2876,7 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) break; } - DrawMicroLevelExt(xpos, ypos, from_x, from_y); + DrawNewMicroLevelExt(xpos, ypos, from_x, from_y); } /* redraw micro level label, if needed */ @@ -3026,7 +3593,6 @@ int el2gfx_OLD(int element) case EL_EXIT_OPENING: return GFX_AUSGANG_ACT; case EL_EXIT_OPEN: return GFX_AUSGANG_AUF; case EL_SP_EXIT_OPEN: return GFX_SP_EXIT; - case EL_PLAYER: return GFX_SPIELFIGUR; case EL_PLAYER1: return GFX_SPIELER1; case EL_PLAYER2: return GFX_SPIELER2; case EL_PLAYER3: return GFX_SPIELER3; @@ -3104,6 +3670,7 @@ int el2gfx_OLD(int element) case EL_PACMAN_LEFT: return GFX_PACMAN_LEFT; case EL_PACMAN_DOWN: return GFX_PACMAN_DOWN; case EL_INVISIBLE_WALL: return GFX_UNSICHTBAR; + case EL_INVISIBLE_WALL_ACTIVE: return GFX_UNSICHTBAR_ON; case EL_WALL_EMERALD: return GFX_ERZ_EDEL; case EL_WALL_DIAMOND: return GFX_ERZ_DIAM; case EL_LAMP: return GFX_BIRNE_AUS; @@ -3128,10 +3695,10 @@ int el2gfx_OLD(int element) case EL_BD_MAGIC_WALL_EMPTYING: return GFX_MAGIC_WALL_BD_EMPTY; case EL_BD_MAGIC_WALL_FULL: return GFX_MAGIC_WALL_BD_FULL; case EL_BD_MAGIC_WALL_DEAD: return GFX_MAGIC_WALL_BD_DEAD; - case EL_DYNABOMB_ACTIVE_1: return GFX_DYNABOMB; - case EL_DYNABOMB_ACTIVE_2: return GFX_DYNABOMB; - case EL_DYNABOMB_ACTIVE_3: return GFX_DYNABOMB; - case EL_DYNABOMB_ACTIVE_4: return GFX_DYNABOMB; + case EL_DYNABOMB_PLAYER1_ACTIVE: return GFX_DYNABOMB; + case EL_DYNABOMB_PLAYER2_ACTIVE: return GFX_DYNABOMB; + case EL_DYNABOMB_PLAYER3_ACTIVE: return GFX_DYNABOMB; + case EL_DYNABOMB_PLAYER4_ACTIVE: return GFX_DYNABOMB; case EL_DYNABOMB_NR: return GFX_DYNABOMB_NR; case EL_DYNABOMB_SZ: return GFX_DYNABOMB_SZ; case EL_DYNABOMB_XL: return GFX_DYNABOMB_XL; @@ -3153,6 +3720,7 @@ int el2gfx_OLD(int element) case EL_SP_ZONK: return GFX_SP_ZONK; /* ^^^^^^^^^^ non-standard position in supaplex graphic set! */ case EL_INVISIBLE_STEELWALL: return GFX_INVISIBLE_STEEL; + case EL_INVISIBLE_STEELWALL_ACTIVE: return GFX_INVISIBLE_STEEL_ON; case EL_BLACK_ORB: return GFX_BLACK_ORB; case EL_EM_GATE1: return GFX_EM_GATE_1; case EL_EM_GATE2: return GFX_EM_GATE_2; @@ -3242,6 +3810,7 @@ int el2gfx_OLD(int element) case EL_MOLE_DOWN: return GFX_MOLE_DOWN; case EL_STEELWALL_SLANTED: return GFX_STEEL_SLANTED; case EL_INVISIBLE_SAND: return GFX_SAND_INVISIBLE; + case EL_INVISIBLE_SAND_ACTIVE: return GFX_SAND_INVISIBLE_ON; case EL_DX_UNKNOWN_15: return GFX_DX_UNKNOWN_15; case EL_DX_UNKNOWN_42: return GFX_DX_UNKNOWN_42; case EL_TIMEGATE_OPEN: return GFX_TIMEGATE_OPEN; @@ -3308,6 +3877,12 @@ int el2gfx_OLD(int element) int el2gfx(int element) { +#if 1 + int graphic_OLD = el2gfx_OLD(element); + + return graphic_OLD; +#else + int graphic_NEW = element_info[element].graphic[GFX_ACTION_DEFAULT]; #if DEBUG @@ -3326,10 +3901,23 @@ int el2gfx(int element) #endif return graphic_NEW; +#endif } int el2img(int element) { +#if 1 + int graphic_NEW = element_info[element].graphic[GFX_ACTION_DEFAULT]; + +#if DEBUG + if (graphic_NEW < 0) + Error(ERR_WARN, "element %d -> graphic %d -- probably crashing now...", + element, graphic_NEW); +#endif + + return graphic_NEW; +#else + switch(element) { case EL_BD_BUTTERFLY: return IMG_BD_BUTTERFLY; @@ -3340,17 +3928,19 @@ int el2img(int element) break; } - return IMG_EMPTY_SPACE; + return IMG_EMPTY; +#endif } int el_dir2img(int element, int direction) { - if (element_info[element].has_direction_graphic[GFX_ACTION_DEFAULT]) - { - int i = LOG_MV_DIR(direction); + return el_dir_act2img(element, direction, GFX_ACTION_DEFAULT); +} - return element_info[element].direction_graphic[GFX_ACTION_DEFAULT][i]; - } - else - return el2img(element); +int el_dir_act2img(int element, int direction, int action) +{ + action = graphics_action_mapping[action]; + direction = MV_DIR_BIT(direction); + + return element_info[element].direction_graphic[action][direction]; }