From 79ee4446132fd0081c8d78c51c72d8620b5e1e2b Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 20 Jan 2017 21:04:11 +0100 Subject: [PATCH] fixed bug with broken undo/redo buttons when using 'tape.show_game_buttons' --- src/tape.c | 31 +++++++++++++++++++++++++++++-- src/tape.h | 2 ++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/tape.c b/src/tape.c index 5a879d12..5e8746df 100644 --- a/src/tape.c +++ b/src/tape.c @@ -401,8 +401,7 @@ void DrawCompleteVideoDisplay() gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy); /* draw tape buttons (forced) */ - UnmapTapeButtons(); - MapTapeButtons(); + RedrawOrRemapTapeButtons(); DrawVideoDisplay(VIDEO_ALL_OFF, 0); @@ -1290,6 +1289,34 @@ void UnmapTapeButtons() UnmapGameButtons(); } +void RedrawTapeButtons() +{ + int i; + + for (i = 0; i < NUM_TAPE_BUTTONS; i++) + RedrawGadget(tape_gadget[i]); + + if (tape.show_game_buttons) + RedrawGameButtons(); + + // RedrawGadget() may have set REDRAW_ALL if buttons are defined off-area + redraw_mask &= ~REDRAW_ALL; +} + +void RedrawOrRemapTapeButtons() +{ + if (tape_gadget[TAPE_CTRL_ID_PLAY]->mapped) + { + // tape buttons already mapped + RedrawTapeButtons(); + } + else + { + UnmapTapeButtons(); + MapTapeButtons(); + } +} + static void HandleTapeButtonsExt(int id) { if (game_status != GAME_MODE_MAIN && game_status != GAME_MODE_PLAYING) diff --git a/src/tape.h b/src/tape.h index cf6f4dfd..bc80f440 100644 --- a/src/tape.h +++ b/src/tape.h @@ -232,6 +232,8 @@ void MapTapeEjectButton(); void MapTapeWarpButton(); void MapTapeButtons(); void UnmapTapeButtons(); +void RedrawTapeButtons(); +void RedrawOrRemapTapeButtons(); void HandleTapeButtonKeys(Key); -- 2.34.1