X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=3bdf371f09e197e831f5e95ad620ddb7c7f3e937;hb=1fcb3ddbb8404effdcfa5ebbd53d3ff5009260f6;hp=a17057c8fb5204f19b3693538591ade91b4a860a;hpb=c46bcfd8dd92fbf3ce134eed1e64078147d33b50;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a17057c8..3bdf371f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -63,6 +63,12 @@ void DumpTile(int x, int y) int sx = SCREENX(x); int sy = SCREENY(y); + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) + { + x--; + y--; + } + printf_line("-", 79); printf("Field Info: SCREEN(%d, %d), LEVEL(%d, %d)\n", sx, sy, x, y); printf_line("-", 79); @@ -127,7 +133,11 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) if (game_status == GAME_MODE_PLAYING && level.game_engine_type == GAME_ENGINE_TYPE_EM) { +#if 1 + RedrawPlayfield_EM(force_redraw); +#else BlitScreenToBitmap_EM(backbuffer); +#endif } else if (game_status == GAME_MODE_PLAYING && !game.envelope_active) { @@ -899,10 +909,6 @@ void DrawLevelFieldThruMask(int x, int y) DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING); } -#define TILE_GFX_ELEMENT(x, y) \ - (GfxElement[x][y] != EL_UNDEFINED && Feld[x][y] != EL_EXPLOSION ? \ - GfxElement[x][y] : Feld[x][y]) - static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) { Bitmap *src_bitmap; @@ -1037,10 +1043,17 @@ void DrawLevelFieldCrumbledSand(int x, int y) return; #if 1 + /* if (Feld[x][y] == EL_ELEMENT_SNAPPING && GFX_CRUMBLED(GfxElement[x][y])) + */ + + if (Feld[x][y] == EL_ELEMENT_SNAPPING && + GfxElement[x][y] != EL_UNDEFINED && + GFX_CRUMBLED(GfxElement[x][y])) { DrawLevelFieldCrumbledSandDigging(x, y, GfxDir[x][y], GfxFrame[x][y]); + return; } #endif @@ -1818,6 +1831,7 @@ void DrawPlayer(struct PlayerInfo *player) int next_jx = jx + dx; int next_jy = jy + dy; boolean player_is_moving = (player->MovPos ? TRUE : FALSE); + boolean player_is_opaque = FALSE; int sx = SCREENX(jx), sy = SCREENY(jy); int sxx = 0, syy = 0; int element = Feld[jx][jy], last_element = Feld[last_jx][last_jy]; @@ -1827,6 +1841,13 @@ void DrawPlayer(struct PlayerInfo *player) int last_player_frame = player->Frame; int frame = 0; +#if 1 + /* GfxElement[][] is set to the element the player is digging or collecting; + remove also for off-screen player if the player is not moving anymore */ + if (IN_LEV_FIELD(jx, jy) && !player_is_moving) + GfxElement[jx][jy] = EL_UNDEFINED; +#endif + if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy))) return; @@ -1851,6 +1872,11 @@ void DrawPlayer(struct PlayerInfo *player) player->is_dropping ? ACTION_DROPPING : player->is_waiting ? player->action_waiting : ACTION_DEFAULT); +#if 1 + if (player->is_waiting) + move_dir = player->dir_waiting; +#endif + InitPlayerGfxAnimation(player, action, move_dir); /* ----------------------------------------------------------------------- */ @@ -1899,16 +1925,17 @@ void DrawPlayer(struct PlayerInfo *player) { if (player_is_moving && GfxElement[jx][jy] != EL_UNDEFINED) { - if (GFX_CRUMBLED(GfxElement[jx][jy])) + int old_element = GfxElement[jx][jy]; + int old_graphic = el_act_dir2img(old_element, action, move_dir); + int frame = getGraphicAnimationFrame(old_graphic, player->StepFrame); + + if (GFX_CRUMBLED(old_element)) DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame); else - { - int old_element = GfxElement[jx][jy]; - int old_graphic = el_act_dir2img(old_element, action, move_dir); - int frame = getGraphicAnimationFrame(old_graphic, player->StepFrame); - DrawGraphic(sx, sy, old_graphic, frame); - } + + if (graphic_info[old_graphic].anim_mode & ANIM_OPAQUE_PLAYER) + player_is_opaque = TRUE; } else { @@ -1946,7 +1973,10 @@ void DrawPlayer(struct PlayerInfo *player) if (!setup.soft_scrolling && ScreenMovPos) sxx = syy = 0; - DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, frame, NO_CUTTING); + if (player_is_opaque) + DrawGraphicShifted(sx, sy, sxx, syy, graphic, frame,NO_CUTTING,NO_MASKING); + else + DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, frame, NO_CUTTING); if (SHIELD_ON(player)) { @@ -2009,7 +2039,9 @@ void DrawPlayer(struct PlayerInfo *player) if (player_is_moving && last_element == EL_EXPLOSION) { - int graphic = el_act2img(GfxElement[last_jx][last_jy], ACTION_EXPLODING); + int element = (GfxElement[last_jx][last_jy] != EL_UNDEFINED ? + GfxElement[last_jx][last_jy] : EL_EMPTY); + int graphic = el_act2img(element, ACTION_EXPLODING); int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); int phase = ExplodePhase[last_jx][last_jy] - 1; int frame = getGraphicAnimationFrame(graphic, phase - delay); @@ -3458,19 +3490,19 @@ em_object_mapping_list[] = }, { Xeater_n, TRUE, FALSE, - EL_YAMYAM, -1, -1 + EL_YAMYAM_UP, -1, -1 }, { - Xeater_e, FALSE, FALSE, - EL_YAMYAM, -1, -1 + Xeater_e, TRUE, FALSE, + EL_YAMYAM_RIGHT, -1, -1 }, { - Xeater_w, FALSE, FALSE, - EL_YAMYAM, -1, -1 + Xeater_w, TRUE, FALSE, + EL_YAMYAM_LEFT, -1, -1 }, { - Xeater_s, FALSE, FALSE, - EL_YAMYAM, -1, -1 + Xeater_s, TRUE, FALSE, + EL_YAMYAM_DOWN, -1, -1 }, { Yeater_n, FALSE, FALSE, @@ -4580,10 +4612,6 @@ em_object_mapping_list[] = Xalpha_copyr, TRUE, FALSE, EL_CHAR('©'), -1, -1 }, - { - Xalpha_copyr, TRUE, FALSE, - EL_CHAR('©'), -1, -1 - }, { Xboom_bug, FALSE, FALSE, @@ -5103,6 +5131,53 @@ int font2baseimg(int font_nr) return font_info[font_nr].special_graphic[GFX_SPECIAL_ARG_DEFAULT]; } +#if 0 +void setCenteredPlayerNr_EM(int centered_player_nr) +{ + game.centered_player_nr = game.centered_player_nr_next = centered_player_nr; +} + +int getCenteredPlayerNr_EM() +{ +#if 0 + if (game.centered_player_nr_next >= 0 && + !native_em_level.ply[game.centered_player_nr_next]->alive) + game.centered_player_nr_next = game.centered_player_nr; +#endif + + if (game.centered_player_nr != game.centered_player_nr_next) + game.centered_player_nr = game.centered_player_nr_next; + + return game.centered_player_nr; +} + +void setSetCenteredPlayer_EM(boolean set_centered_player) +{ + game.set_centered_player = set_centered_player; +} + +boolean getSetCenteredPlayer_EM() +{ + return game.set_centered_player; +} +#endif + +int getNumActivePlayers_EM() +{ + int num_players = 0; + int i; + + if (!tape.playing) + return -1; + + for (i = 0; i < MAX_PLAYERS; i++) + if (tape.player_participates[i]) + num_players++; + + return num_players; +} + +#if 1 int getGameFrameDelay_EM(int native_em_game_frame_delay) { int game_frame_delay_value; @@ -5117,6 +5192,7 @@ int getGameFrameDelay_EM(int native_em_game_frame_delay) return game_frame_delay_value; } +#endif unsigned int InitRND(long seed) {