+ 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))
+ {
+ DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]);
+
+ if (last_element == EL_DYNAMITE_ACTIVE)
+ DrawDynamite(last_jx, last_jy);
+ else
+ DrawLevelFieldThruMask(last_jx, last_jy);
+ }
+ else if (last_element == EL_DYNAMITE_ACTIVE)
+ DrawDynamite(last_jx, last_jy);
+ else
+ DrawLevelField(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)
+ DrawLevelElement(next_jx, next_jy, EL_SOKOBAN_FIELD_EMPTY);
+ else
+ DrawLevelElement(next_jx, next_jy, EL_EMPTY);
+ }
+ else
+ DrawLevelField(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])
+ DrawLevelElement(jx, jy, Store[jx][jy]);
+ else if (!IS_ACTIVE_BOMB(element))
+ DrawLevelField(jx, jy);
+ else
+ DrawLevelElement(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 = getGraphicAnimationFrame(graphic, -1);
+ }
+
+ if (player->MovDir == MV_LEFT || player->MovDir == MV_RIGHT)
+ last_dir = player->MovDir;
+ }