aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--galaxies.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/galaxies.c b/galaxies.c
index 59c8cf6..b2158b7 100644
--- a/galaxies.c
+++ b/galaxies.c
@@ -2383,7 +2383,7 @@ struct game_drawstate {
blitter *blmirror;
bool dragging;
- int dragx, dragy;
+ int dragx, dragy, oppx, oppy;
int *colour_scratch;
@@ -3112,7 +3112,7 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state)
ds->bl = NULL;
ds->blmirror = NULL;
ds->dragging = false;
- ds->dragx = ds->dragy = 0;
+ ds->dragx = ds->dragy = ds->oppx = ds->oppy = 0;
ds->colour_scratch = snewn(ds->w * ds->h, int);
@@ -3274,7 +3274,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
int w = ds->w, h = ds->h;
int x, y;
bool flashing = false;
- int oppx, oppy;
if (flashtime > 0) {
int frame = (int)(flashtime / FLASH_TIME);
@@ -3284,14 +3283,10 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
if (ds->dragging) {
assert(ds->bl);
assert(ds->blmirror);
- calculate_opposite_point(ui, ds, ds->dragx + TILE_SIZE/2,
- ds->dragy + TILE_SIZE/2, &oppx, &oppy);
- oppx -= TILE_SIZE/2;
- oppy -= TILE_SIZE/2;
+ blitter_load(dr, ds->blmirror, ds->oppx, ds->oppy);
+ draw_update(dr, ds->oppx, ds->oppy, TILE_SIZE, TILE_SIZE);
blitter_load(dr, ds->bl, ds->dragx, ds->dragy);
draw_update(dr, ds->dragx, ds->dragy, TILE_SIZE, TILE_SIZE);
- blitter_load(dr, ds->blmirror, oppx, oppy);
- draw_update(dr, oppx, oppy, TILE_SIZE, TILE_SIZE);
ds->dragging = false;
}
if (ds->cur_visible) {
@@ -3449,16 +3444,28 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
}
if (ui->dragging) {
+ int oppx, oppy;
+
ds->dragging = true;
ds->dragx = ui->dx - TILE_SIZE/2;
ds->dragy = ui->dy - TILE_SIZE/2;
calculate_opposite_point(ui, ds, ui->dx, ui->dy, &oppx, &oppy);
+ ds->oppx = oppx - TILE_SIZE/2;
+ ds->oppy = oppy - TILE_SIZE/2;
+
blitter_save(dr, ds->bl, ds->dragx, ds->dragy);
- blitter_save(dr, ds->blmirror, oppx - TILE_SIZE/2, oppy - TILE_SIZE/2);
+ clip(dr, ds->dragx, ds->dragy, TILE_SIZE, TILE_SIZE);
draw_arrow(dr, ds, ui->dx, ui->dy, SCOORD(ui->dotx) - ui->dx,
SCOORD(ui->doty) - ui->dy, COL_ARROW);
+ unclip(dr);
+ draw_update(dr, ds->dragx, ds->dragy, TILE_SIZE, TILE_SIZE);
+
+ blitter_save(dr, ds->blmirror, ds->oppx, ds->oppy);
+ clip(dr, ds->oppx, ds->oppy, TILE_SIZE, TILE_SIZE);
draw_arrow(dr, ds, oppx, oppy, SCOORD(ui->dotx) - oppx,
SCOORD(ui->doty) - oppy, COL_ARROW);
+ unclip(dr);
+ draw_update(dr, ds->oppx, ds->oppy, TILE_SIZE, TILE_SIZE);
}
#ifdef EDITOR
{