puzzles: resync with upstream; add Loopy and Palisade, mouse mode

This brings a various small changes to the drawing and input code,
as well as a brand new "mouse mode", where input goes to a virtual
mouse cursor. Only Loopy has this mouse mode enabled by default,
while other games have it hidden away under the debug menu. Some
changes by me to Palisade were required to make it playable; those
are included here as well. Right now, sgt-net is pushing the c200v2's
upper limit on size and may have to be dropped in a future commit.

Change-Id: I495d2a2125462c2985aec1ffbc54bbe3fe5133bd
This commit is contained in:
Franklin Wei 2017-11-21 19:28:16 -05:00
parent f4c4221306
commit e8e85c5762
10 changed files with 500 additions and 108 deletions

View file

@ -865,14 +865,16 @@ static char *game_text_format(const game_state *state)
struct game_ui {
int x, y;
unsigned int show: 1;
unsigned int show: 1;
unsigned int fake_ctrl: 1;
unsigned int fake_shift: 1;
};
static game_ui *new_ui(const game_state *state)
{
game_ui *ui = snew(game_ui);
ui->x = ui->y = 0;
ui->show = FALSE;
ui->show = ui->fake_ctrl = ui->fake_shift = FALSE;
return ui;
}
@ -916,7 +918,10 @@ static char *interpret_move(const game_state *state, game_ui *ui,
const game_drawstate *ds, int x, int y, int button)
{
int w = state->shared->params.w, h = state->shared->params.h;
int control = button & MOD_CTRL, shift = button & MOD_SHFT;
int control = (button & MOD_CTRL) | ui->fake_ctrl, shift = (button & MOD_SHFT) | ui->fake_shift;
/* reset */
ui->fake_ctrl = ui->fake_shift = FALSE;
button &= ~MOD_MASK;
@ -999,6 +1004,16 @@ static char *interpret_move(const game_state *state, game_ui *ui,
return UI_UPDATE;
}
}
else if(IS_CURSOR_SELECT(button)) {
/* CURSOR_SELECT or CURSOR_SELECT2 tells us to toggle whether
* the button press should be interpreted as having CTRL or
* shift pressed along with it, respectively. */
ui->show = TRUE;
if(button == CURSOR_SELECT2)
ui->fake_shift = !ui->fake_shift;
else
ui->fake_ctrl = !ui->fake_ctrl;
}
return NULL;
}