simplify stamp controls code
This commit is contained in:
parent
4c2962ca82
commit
fb9350a299
1 changed files with 11 additions and 36 deletions
|
|
@ -2368,87 +2368,62 @@ static void mainloop(void)
|
||||||
!disable_stamp_controls)
|
!disable_stamp_controls)
|
||||||
{
|
{
|
||||||
/* Stamp controls! */
|
/* Stamp controls! */
|
||||||
|
int stamp_sound = -1;
|
||||||
if (event.button.y >= (48 * ((max / 2) + TOOLOFFSET / 2)) + 40 &&
|
if (event.button.y >= (48 * ((max / 2) + TOOLOFFSET / 2)) + 40 &&
|
||||||
event.button.y < (48 * ((max / 2) + TOOLOFFSET / 2)) + 40 + 48)
|
event.button.y < (48 * ((max / 2) + TOOLOFFSET / 2)) + 40 + 48)
|
||||||
{
|
{
|
||||||
/* One of the top buttons: */
|
/* One of the top buttons: */
|
||||||
|
|
||||||
if (event.button.x >= WINDOW_WIDTH - 96 &&
|
if (event.button.x >= WINDOW_WIDTH - 96 &&
|
||||||
event.button.x <= WINDOW_WIDTH - 48)
|
event.button.x <= WINDOW_WIDTH - 48)
|
||||||
{
|
{
|
||||||
/* Top left button: Mirror: */
|
/* Top left button: Mirror: */
|
||||||
|
|
||||||
if (inf_stamps[cur_stamp]->mirrorable)
|
if (inf_stamps[cur_stamp]->mirrorable)
|
||||||
{
|
{
|
||||||
state_stamps[cur_stamp]->mirrored =
|
state_stamps[cur_stamp]->mirrored =
|
||||||
!state_stamps[cur_stamp]->mirrored;
|
!state_stamps[cur_stamp]->mirrored;
|
||||||
|
stamp_sound = SND_MIRROR;
|
||||||
playsound(0, SND_MIRROR, 0);
|
|
||||||
draw_stamps();
|
|
||||||
|
|
||||||
SDL_UpdateRect(screen,
|
|
||||||
WINDOW_WIDTH - 96, 0,
|
|
||||||
96, (48 * 7) + 40 + HEIGHTOFFSET);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Top right button: Flip: */
|
/* Top right button: Flip: */
|
||||||
|
|
||||||
if (inf_stamps[cur_stamp]->flipable)
|
if (inf_stamps[cur_stamp]->flipable)
|
||||||
{
|
{
|
||||||
state_stamps[cur_stamp]->flipped =
|
state_stamps[cur_stamp]->flipped =
|
||||||
!state_stamps[cur_stamp]->flipped;
|
!state_stamps[cur_stamp]->flipped;
|
||||||
|
stamp_sound = SND_FLIP;
|
||||||
playsound(0, SND_FLIP, 0);
|
|
||||||
draw_stamps();
|
|
||||||
|
|
||||||
SDL_UpdateRect(screen,
|
|
||||||
WINDOW_WIDTH - 96, 0,
|
|
||||||
96, (48 * 7) + 40 + HEIGHTOFFSET);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* One of the bottom buttons: */
|
/* One of the bottom buttons: */
|
||||||
|
|
||||||
if (event.button.x >= WINDOW_WIDTH - 96 &&
|
if (event.button.x >= WINDOW_WIDTH - 96 &&
|
||||||
event.button.x <= WINDOW_WIDTH - 48)
|
event.button.x <= WINDOW_WIDTH - 48)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Bottom left button: Shrink: */
|
/* Bottom left button: Shrink: */
|
||||||
|
|
||||||
if (state_stamps[cur_stamp]->size > MIN_STAMP_SIZE)
|
if (state_stamps[cur_stamp]->size > MIN_STAMP_SIZE)
|
||||||
{
|
{
|
||||||
state_stamps[cur_stamp]->size--;
|
state_stamps[cur_stamp]->size--;
|
||||||
|
stamp_sound = SND_SHRINK;
|
||||||
playsound(0, SND_SHRINK, 0);
|
|
||||||
draw_stamps();
|
|
||||||
|
|
||||||
SDL_UpdateRect(screen,
|
|
||||||
WINDOW_WIDTH - 96, 0,
|
|
||||||
96, (48 * 7) + 40 + HEIGHTOFFSET);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Bottom right button: Grow: */
|
/* Bottom right button: Grow: */
|
||||||
|
|
||||||
if (state_stamps[cur_stamp]->size < MAX_STAMP_SIZE)
|
if (state_stamps[cur_stamp]->size < MAX_STAMP_SIZE)
|
||||||
{
|
{
|
||||||
state_stamps[cur_stamp]->size++;
|
state_stamps[cur_stamp]->size++;
|
||||||
|
stamp_sound = SND_GROW;
|
||||||
playsound(0, SND_GROW, 0);
|
|
||||||
draw_stamps();
|
|
||||||
|
|
||||||
SDL_UpdateRect(screen,
|
|
||||||
WINDOW_WIDTH - 96, 0,
|
|
||||||
96, (48 * 7) + 40 + HEIGHTOFFSET);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (stamp_sound != -1)
|
||||||
|
{
|
||||||
|
playsound(0, stamp_sound, 0);
|
||||||
|
draw_stamps();
|
||||||
|
SDL_UpdateRect(screen, WINDOW_WIDTH - 96, 0, 96, (48 * 7) + 40 + HEIGHTOFFSET);
|
||||||
|
}
|
||||||
update_stamp_xor();
|
update_stamp_xor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue