int x = event->x, y = event->y;
int width = event->width, height = event->height;
- if (setup.direct_draw_on && game_status==PLAYING)
+ if (setup.direct_draw && game_status==PLAYING)
{
int xx,yy;
int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY;
SetDrawtoField(DRAW_DIRECT);
}
- if (setup.soft_scrolling_on && game_status == PLAYING)
+ if (setup.soft_scrolling && game_status == PLAYING)
{
int fx = FX, fy = FY;
void HandleKey(KeySym key, int key_status)
{
int joy = 0;
+ static struct SetupKeyboardInfo custom_key;
+ static struct
+ {
+ KeySym *keysym_custom;
+ KeySym keysym_default;
+ byte action;
+ } key_info[] =
+ {
+ { &custom_key.left, DEFAULT_KEY_LEFT, JOY_LEFT },
+ { &custom_key.right, DEFAULT_KEY_RIGHT, JOY_RIGHT },
+ { &custom_key.up, DEFAULT_KEY_UP, JOY_UP },
+ { &custom_key.down, DEFAULT_KEY_DOWN, JOY_DOWN },
+ { &custom_key.snap, DEFAULT_KEY_SNAP, JOY_BUTTON_1 },
+ { &custom_key.bomb, DEFAULT_KEY_BOMB, JOY_BUTTON_2 }
+ };
+
+ if (game_status == PLAYING)
+ {
+ int pnr;
+
+ for (pnr=0; pnr<MAX_PLAYERS; pnr++)
+ {
+ int i;
+ byte key_action = 0;
+
+ if (setup.input[pnr].use_joystick)
+ continue;
+
+ custom_key = setup.input[pnr].key;
+
+ for (i=0; i<6; i++)
+ if (key == *key_info[i].keysym_custom)
+ key_action |= key_info[i].action;
+
+ if (key_status == KEY_PRESSED)
+ {
+ if (network_playing)
+ local_player->potential_action |= key_action;
+ else
+ stored_player[pnr].action |= key_action;
+ }
+ else
+ {
+ if (network_playing)
+ local_player->potential_action &= ~key_action;
+ else
+ stored_player[pnr].action &= ~key_action;
+ }
+ }
+ }
+ else
+ {
+ int i;
+
+ for (i=0; i<6; i++)
+ if (key == key_info[i].keysym_default)
+ joy |= key_info[i].action;
+ }
+
+
+#if 0
+
/* Map cursor keys to joystick directions */
break;
}
+
+#endif
+
+
if (joy)
{
if (key_status == KEY_PRESSED)
GAME_FRAME_DELAY * 100 / GameFrameDelay, GameFrameDelay);
break;
+
+#if 0
case XK_a:
if (ScrollStepSize == TILEX/8)
ScrollStepSize = TILEX/4;
ScrollStepSize = TILEX/8;
printf("ScrollStepSize == %d\n", ScrollStepSize);
break;
+#endif
case XK_f:
ScrollStepSize = TILEX/8;
local_player->dynamite = 1000;
break;
+
+
+#if 0
+
case XK_x:
{
}
*/
- printf("direct_draw_on == %d\n", setup.direct_draw_on);
+ printf("direct_draw == %d\n", setup.direct_draw);
break;
}
break;
+#endif
#endif
default:
}
}
+static int HandleJoystickForAllPlayers()
+{
+ int i;
+ int result = 0;
+
+ for (i=0; i<MAX_PLAYERS; i++)
+ {
+ byte joy_action = 0;
+
+ if (!setup.input[i].use_joystick)
+ continue;
+
+ joy_action = Joystick(i);
+
+ result |= joy_action;
+
+ if (network_playing)
+ local_player->potential_action |= joy_action;
+ else
+ stored_player[i].action |= joy_action;
+ }
+
+ return result;
+}
+
void HandleJoystick()
{
- int joystick = Joystick();
+ int joystick = HandleJoystickForAllPlayers();
int keyboard = key_joystick_mapping;
int joy = (joystick | keyboard);
int left = joy & JOY_LEFT;
int up = joy & JOY_UP;
int down = joy & JOY_DOWN;
int button = joy & JOY_BUTTON;
- int newbutton = (JoystickButton() == JOY_BUTTON_NEW_PRESSED);
+ int newbutton = (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED);
int dx = (left ? -1 : right ? 1 : 0);
int dy = (up ? -1 : down ? 1 : 0);
return;
}
- if (tape.pausing || AllPlayersGone)
- joy = 0;
-
- HandleGameActions((byte)joy);
+ HandleGameActions();
break;
default: