- 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 = GFX_SP_MURPHY;
-
- if (player->Pushing)
- {
- if (player->MovDir == MV_LEFT)
- graphic = GFX_MURPHY_PUSH_LEFT;
- else if (player->MovDir == MV_RIGHT)
- graphic = GFX_MURPHY_PUSH_RIGHT;
- else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_LEFT)
- graphic = GFX_MURPHY_PUSH_LEFT;
- else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_RIGHT)
- graphic = GFX_MURPHY_PUSH_RIGHT;
- }
- else if (player->snapped)
- {
- if (player->MovDir == MV_LEFT)
- graphic = GFX_MURPHY_SNAP_LEFT;
- else if (player->MovDir == MV_RIGHT)
- graphic = GFX_MURPHY_SNAP_RIGHT;
- else if (player->MovDir == MV_UP)
- graphic = GFX_MURPHY_SNAP_UP;
- else if (player->MovDir == MV_DOWN)
- graphic = GFX_MURPHY_SNAP_DOWN;
- }
- else if (action_moving)
- {
- if (player->MovDir == MV_LEFT)
- graphic = GFX_MURPHY_GO_LEFT;
- else if (player->MovDir == MV_RIGHT)
- graphic = GFX_MURPHY_GO_RIGHT;
- else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_LEFT)
- graphic = GFX_MURPHY_GO_LEFT;
- else if (player->MovDir & (MV_UP | MV_DOWN) && last_dir == MV_RIGHT)
- graphic = GFX_MURPHY_GO_RIGHT;
- else
- graphic = GFX_MURPHY_GO_LEFT;
-
- graphic += getGraphicAnimationPhase(3, 2, ANIM_PINGPONG);
- }
-
- if (player->MovDir == MV_LEFT || player->MovDir == MV_RIGHT)
- last_dir = player->MovDir;
- }
- else
- {
- if (player->MovDir == MV_LEFT)
- graphic =
- (player->Pushing ? GFX_SPIELER1_PUSH_LEFT : GFX_SPIELER1_LEFT);
- else if (player->MovDir == MV_RIGHT)
- graphic =
- (player->Pushing ? GFX_SPIELER1_PUSH_RIGHT : GFX_SPIELER1_RIGHT);
- else if (player->MovDir == MV_UP)
- graphic = GFX_SPIELER1_UP;
- else /* MV_DOWN || MV_NO_MOVING */
- graphic = GFX_SPIELER1_DOWN;
-
- graphic += player->index_nr * 3 * HEROES_PER_LINE;
- graphic += 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;
-
- DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic, NO_CUTTING);
-
- if (SHIELD_ON(player))
- {
- int graphic = (player->shield_deadly_time_left ? GFX2_SHIELD_ACTIVE :
- GFX2_SHIELD_PASSIVE);
-
- DrawGraphicAnimationShiftedThruMask(sx, sy, sxx, syy, graphic,
- 3, 8, ANIM_PINGPONG);
- }
-
- 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)
- DrawGraphicShiftedThruMask(px, py, sxx, syy, GFX_SOKOBAN_OBJEKT,
- NO_CUTTING);
- else
- {
- int element = Feld[next_jx][next_jy];
- int graphic = el2gfx(element);
-
- if ((element == EL_ROCK ||
- element == EL_SP_ZONK ||
- element == EL_BD_ROCK) && sxx)
- {
- int phase = (player->GfxPos / (TILEX / 4));
-
- if (player->MovDir == MV_LEFT)
- graphic += phase;
- else
- graphic += (phase + 4) % 4;
- }
-
- DrawGraphicShifted(px, py, sxx, syy, graphic, NO_CUTTING, NO_MASKING);
- }
- }
-
- /* draw things in front of player (active dynamite or dynabombs) */
-
- if (IS_ACTIVE_BOMB(element))
- {
- graphic = el2gfx(element);
-
- if (element == EL_DYNAMITE_ACTIVE)
- {
- if ((phase = (96 - MovDelay[jx][jy]) / 12) > 6)
- phase = 6;
- }
- else
- {
- if ((phase = ((96 - MovDelay[jx][jy]) / 6) % 8) > 3)
- phase = 7 - phase;
- }
-
- if (game.emulation == EMU_SUPAPLEX)
- DrawGraphic(sx, sy, GFX_SP_DISK_RED);
- else
- DrawGraphicThruMask(sx, sy, graphic + phase);
- }
-
- if (player_is_moving && last_element == EL_EXPLOSION)
- {
- int phase = Frame[last_jx][last_jy];
- int delay = 2;
-
- if (phase > 2)
- DrawGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy),
- GFX_EXPLOSION + ((phase - 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))
- DrawLevelField(last_jx, last_jy);
- /* ... and the field the player is entering */
- if (IS_OVER_PLAYER(element))
- DrawLevelField(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);
-}
-
-#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 */
-