/* values for DrawGadget() */
#define DG_UNPRESSED 0
#define DG_PRESSED 1
+
#define DG_BUFFERED 0
#define DG_DIRECT 1
gi->active = (boolean)va_arg(ap, int);
break;
+ case GDI_DIRECT_DRAW:
+ /* take care here: "boolean" is typedef'ed as "unsigned char",
+ which gets promoted to "int" */
+ gi->direct_draw = (boolean)va_arg(ap, int);
+ break;
+
case GDI_CHECKED:
/* take care here: "boolean" is typedef'ed as "unsigned char",
which gets promoted to "int" */
void RedrawGadget(struct GadgetInfo *gi)
{
if (gi->mapped)
- DrawGadget(gi, gi->state, DG_DIRECT);
+ DrawGadget(gi, gi->state, gi->direct_draw);
}
struct GadgetInfo *CreateGadget(int first_tag, ...)
new_gadget->callback_info = default_callback_info;
new_gadget->callback_action = default_callback_action;
new_gadget->active = TRUE;
+ new_gadget->direct_draw = TRUE;
+
new_gadget->next = NULL;
va_start(ap, first_tag);
gi->text.cursor_position = strlen(gi->text.value);
if (gi->text.cursor_position != old_cursor_position)
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else
{
/* if mouse button pressed outside text input gadget, deactivate it */
CheckRangeOfNumericInputGadget(gi);
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->event.type = GD_EVENT_TEXT_LEAVING;
gi->selectbox.current_index = gi->selectbox.num_values - 1;
if (gi->selectbox.current_index != old_index)
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else
{
/* if mouse button pressed outside selectbox gadget, deactivate it */
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->event.type = GD_EVENT_TEXT_LEAVING;
gi->selectbox.current_index = gi->selectbox.num_values - 1;
if (gi->selectbox.current_index != old_index)
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
rgi != gi)
{
rgi->checked = FALSE;
- DrawGadget(rgi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(rgi, DG_UNPRESSED, rgi->direct_draw);
}
rgi = rgi->next;
}
}
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
gi->state = GD_BUTTON_PRESSED;
gi->event.type = GD_EVENT_PRESSED;
if (gi->type & GD_TYPE_BUTTON)
{
if (gadget_moving_inside && gi->state == GD_BUTTON_UNPRESSED)
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
else if (gadget_moving_off_borders && gi->state == GD_BUTTON_PRESSED)
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
}
else if (gi->type & GD_TYPE_SELECTBOX)
{
gi->selectbox.current_index = gi->selectbox.num_values - 1;
if (gi->selectbox.current_index != old_index)
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (gi->type & GD_TYPE_SCROLLBAR)
{
changed_position = TRUE;
}
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
gi->state = (gadget_moving_inside || gi->type & GD_TYPE_SCROLLBAR ?
if (deactivate_gadget &&
!(gi->type & GD_TYPE_TEXTINPUT)) /* text input stays open */
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->state = GD_BUTTON_UNPRESSED;
gi->event.type = GD_EVENT_RELEASED;
if (gadget_released_off_borders)
{
if (gi->type & GD_TYPE_SCROLLBAR)
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->event.type = GD_EVENT_RELEASED;
else if (gi->type & GD_TYPE_SELECTBOX)
gi->selectbox.index = gi->selectbox.current_index;
- DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->event.type = GD_EVENT_TEXT_RETURN;
gi->text.value[cursor_pos] = letter;
gi->text.cursor_position++;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (key == KSYM_Left && cursor_pos > 0)
{
gi->text.cursor_position--;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (key == KSYM_Right && cursor_pos < text_length)
{
gi->text.cursor_position++;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (key == KSYM_BackSpace && cursor_pos > 0)
{
strcpy(text, gi->text.value);
strcpy(&gi->text.value[cursor_pos - 1], &text[cursor_pos]);
gi->text.cursor_position--;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (key == KSYM_Delete && cursor_pos < text_length)
{
strcpy(text, gi->text.value);
strcpy(&gi->text.value[cursor_pos], &text[cursor_pos + 1]);
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
else if (gi->type & GD_TYPE_SELECTBOX) /* only valid for selectbox */
if (key == KSYM_Up && index > 0)
{
gi->selectbox.current_index--;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
else if (key == KSYM_Down && index < num_values - 1)
{
gi->selectbox.current_index++;
- DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
}
}
}
- BackToFront();
-
out:
if (game_status == GAME_MODE_MAIN)
DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE);
DoAnimation();
}
+
+ BackToFront();
}
#else
PlaySound_Menu_Continue(SND_BACKGROUND_INFO);
#endif
-
- DoAnimation();
}
+ DoAnimation();
BackToFront();
}
}
}
- BackToFront();
-
+#if 0
if (game_status == GAME_MODE_LEVELS || game_status == GAME_MODE_SETUP)
DoAnimation();
+
+ BackToFront();
+#endif
}
void DrawChooseLevel()
void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
{
HandleChooseTree(mx, my, dx, dy, button, &leveldir_current);
+
+ DoAnimation();
+ BackToFront();
}
void DrawHallOfFame(int highlight_position)
DrawText(mSX + dx2, sy, highscore[entry].Name, font_nr2);
DrawText(mSX + dx3, sy, int2str(highscore[entry].Score, 5), font_nr4);
}
+
+ redraw_mask |= REDRAW_FIELD;
}
void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
first_entry = 0;
drawHallOfFameList(first_entry, highlight_position);
-
- return;
}
}
else if (dy > 0)
first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN);
drawHallOfFameList(first_entry, highlight_position);
-
- return;
}
}
-
- if (button_released)
+ else if (button_released)
{
FadeSound(SND_BACKGROUND_SCORES);
game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
- BackToFront();
-
- if (game_status == GAME_MODE_SCORES)
- {
- DoAnimation();
#if 1
+ if (game_status == GAME_MODE_SCORES)
PlaySound_Menu_Continue(SND_BACKGROUND_SCORES);
#endif
- }
+
+ DoAnimation();
+ BackToFront();
}
}
}
- BackToFront();
DoAnimation();
+ BackToFront();
/* don't eat all CPU time */
Delay(10);
}
}
+#if 0
BackToFront();
if (game_status == GAME_MODE_SETUP)
DoAnimation();
+#endif
}
void DrawSetupScreen_Input()
static unsigned long delay = 0;
if (!DelayReached(&delay, GADGET_FRAME_DELAY))
+#if 1
+ return;
+#else
goto out;
+#endif
player_nr = (player_nr + (x == 10 ? -1 : +1) + MAX_PLAYERS) % MAX_PLAYERS;
}
}
+#if 0
BackToFront();
out:
if (game_status == GAME_MODE_SETUP)
DoAnimation();
+#endif
}
void CustomizeKeyboard(int player_nr)
}
}
- BackToFront();
DoAnimation();
+ BackToFront();
/* don't eat all CPU time */
Delay(10);
}
- BackToFront();
DoAnimation();
+ BackToFront();
/* don't eat all CPU time */
Delay(10);
HandleChooseTree(mx, my, dx, dy, button, &artwork.mus_current);
else
HandleSetupScreen_Generic(mx, my, dx, dy, button);
+
+ DoAnimation();
+ BackToFront();
}
void HandleGameActions()
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,
+ GDI_DIRECT_DRAW, FALSE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleScreenGadgets,
GDI_END);
GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,
GDI_BORDER_SIZE, SC_BORDER_SIZE, SC_BORDER_SIZE,
+ GDI_DIRECT_DRAW, FALSE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleScreenGadgets,
GDI_END);