void DoViewUpdate() { mws_render_wipe(M->state); mws_render_draw(M->state); /* XXX: Hack. I don't want to deal with setting updateView in * the mws_* methods, thus just always update view, even * if it is unnecessary. */ updateView = TRUE; if (updateView) { /* paint the screen */ /* XXX: I don't think this is necessary anymore as the * mws_render_* functions take care of it. ShowPosition(MY_X_LOC, MY_Y_LOC, MY_DIR); */ if (M->peeking()) ShowView(M->xPeek(), M->yPeek(), M->dirPeek()); else ShowView(MY_X_LOC, MY_Y_LOC, MY_DIR); updateView = FALSE; } }
void DoViewUpdate() { if (updateView) { /* paint the screen */ ShowPosition(MY_X_LOC, MY_Y_LOC, MY_DIR); if (M->peeking()) ShowView(M->xPeek(), M->yPeek(), M->dirPeek()); else ShowView(MY_X_LOC, MY_Y_LOC, MY_DIR); updateView = FALSE; } }
void peekRight() { M->xPeekIs(MY_X_LOC); M->yPeekIs(MY_Y_LOC); M->dirPeekIs(MY_DIR); switch(MY_DIR) { case NORTH: if (!M->maze_[MY_X_LOC+1][MY_Y_LOC]) { M->xPeekIs(MY_X_LOC + 1); M->dirPeekIs(EAST); } break; case SOUTH: if (!M->maze_[MY_X_LOC-1][MY_Y_LOC]) { M->xPeekIs(MY_X_LOC - 1); M->dirPeekIs(WEST); } break; case EAST: if (!M->maze_[MY_X_LOC][MY_Y_LOC+1]) { M->yPeekIs(MY_Y_LOC + 1); M->dirPeekIs(SOUTH); } break; case WEST: if (!M->maze_[MY_X_LOC][MY_Y_LOC-1]) { M->yPeekIs(MY_Y_LOC - 1); M->dirPeekIs(NORTH); } break; default: MWError("bad direction in PeekRight"); } /* if any change, display the new view without moving! */ if ((M->xPeek() != MY_X_LOC) || (M->yPeek() != MY_Y_LOC)) { M->peekingIs(TRUE); updateView = TRUE; } }