return true;
}
- if ( key_pressed )
+ if ( nPrimary == K_MOUSE1 && HUD_MinigameMenu_activeitem &&
+ HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )
{
- if ( nPrimary == K_MOUSE1 && HUD_MinigameMenu_activeitem &&
- HUD_mouse_over(HUD_PANEL(MINIGAMEMENU)) )
- {
- HUD_MinigameMenu_Click(HUD_MinigameMenu_activeitem);
+ if (!key_pressed)
return true;
- }
- if ( nPrimary == K_UPARROW || nPrimary == K_KP_UPARROW )
- {
- if ( HUD_MinigameMenu_activeitem && HUD_MinigameMenu_activeitem.list_prev )
- HUD_MinigameMenu_activeitem = HUD_MinigameMenu_activeitem.list_prev;
- else
- HUD_MinigameMenu_activeitem = HUD_MinigameMenu_last_entry;
+ HUD_MinigameMenu_Click(HUD_MinigameMenu_activeitem);
+ return true;
+ }
+ if ( nPrimary == K_UPARROW || nPrimary == K_KP_UPARROW )
+ {
+ if (!key_pressed)
return true;
- }
- else if ( nPrimary == K_DOWNARROW || nPrimary == K_KP_DOWNARROW )
- {
- if ( HUD_MinigameMenu_activeitem && HUD_MinigameMenu_activeitem.list_next )
- HUD_MinigameMenu_activeitem = HUD_MinigameMenu_activeitem.list_next;
- else
- HUD_MinigameMenu_activeitem = HUD_MinigameMenu_entries;
+ if ( HUD_MinigameMenu_activeitem && HUD_MinigameMenu_activeitem.list_prev )
+ HUD_MinigameMenu_activeitem = HUD_MinigameMenu_activeitem.list_prev;
+ else
+ HUD_MinigameMenu_activeitem = HUD_MinigameMenu_last_entry;
+ return true;
+ }
+ else if ( nPrimary == K_DOWNARROW || nPrimary == K_KP_DOWNARROW )
+ {
+ if (!key_pressed)
return true;
- }
- else if ( nPrimary == K_HOME || nPrimary == K_KP_HOME )
- {
+ if ( HUD_MinigameMenu_activeitem && HUD_MinigameMenu_activeitem.list_next )
+ HUD_MinigameMenu_activeitem = HUD_MinigameMenu_activeitem.list_next;
+ else
HUD_MinigameMenu_activeitem = HUD_MinigameMenu_entries;
+ return true;
+ }
+ else if ( nPrimary == K_HOME || nPrimary == K_KP_HOME )
+ {
+ if (!key_pressed)
return true;
- }
- else if ( nPrimary == K_END || nPrimary == K_KP_END )
- {
- HUD_MinigameMenu_activeitem = HUD_MinigameMenu_entries;
+ HUD_MinigameMenu_activeitem = HUD_MinigameMenu_entries;
+ return true;
+ }
+ else if ( nPrimary == K_END || nPrimary == K_KP_END )
+ {
+ if (!key_pressed)
return true;
- }
- else if ( nPrimary == K_KP_ENTER || nPrimary == K_ENTER || nPrimary == K_SPACE )
- {
- HUD_MinigameMenu_Click(HUD_MinigameMenu_activeitem);
+ HUD_MinigameMenu_activeitem = HUD_MinigameMenu_entries;
+ return true;
+ }
+ else if ( nPrimary == K_KP_ENTER || nPrimary == K_ENTER || nPrimary == K_SPACE )
+ {
+ if (!key_pressed)
return true;
- }
- else if ( nPrimary == K_ESCAPE )
- {
- HUD_MinigameMenu_Close(NULL, NULL, NULL);
+ HUD_MinigameMenu_Click(HUD_MinigameMenu_activeitem);
+ return true;
+ }
+ else if ( nPrimary == K_ESCAPE )
+ {
+ if (!key_pressed)
return true;
- }
+ HUD_MinigameMenu_Close(NULL, NULL, NULL);
+ return true;
}
return false;
bd_curr_pos = s;
}
-bool bd_normal_move(entity minigame, int themove)
-{
- switch ( themove )
- {
- case K_RIGHTARROW:
- case K_KP_RIGHTARROW:
- bd_make_move(minigame, "r");
- return true;
- case K_LEFTARROW:
- case K_KP_LEFTARROW:
- bd_make_move(minigame, "l");
- return true;
- case K_UPARROW:
- case K_KP_UPARROW:
- bd_make_move(minigame, "u");
- return true;
- case K_DOWNARROW:
- case K_KP_DOWNARROW:
- bd_make_move(minigame, "d");
- return true;
- }
-
- return false;
-}
-
bool bd_change_dozer_angle(entity minigame)
{
entity dozer = bd_find_piece(minigame, bd_curr_pos, false);
return true;
}
-bool bd_editor_move(entity minigame, int themove)
-{
- switch ( themove )
- {
- case K_RIGHTARROW:
- case K_KP_RIGHTARROW:
- if ( ! bd_curr_pos )
- bd_set_curr_pos("a3");
- else
- bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,1,0,BD_NUM_CNT,BD_LET_CNT));
- return true;
- case K_LEFTARROW:
- case K_KP_LEFTARROW:
- if ( ! bd_curr_pos )
- bd_set_curr_pos("c3");
- else
- bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,-1,0,BD_NUM_CNT,BD_LET_CNT));
- return true;
- case K_UPARROW:
- case K_KP_UPARROW:
- if ( ! bd_curr_pos )
- bd_set_curr_pos("a1");
- else
- bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,0,1,BD_NUM_CNT,BD_LET_CNT));
- return true;
- case K_DOWNARROW:
- case K_KP_DOWNARROW:
- if ( ! bd_curr_pos )
- bd_set_curr_pos("a3");
- else
- bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,0,-1,BD_NUM_CNT,BD_LET_CNT));
- return true;
- case K_ENTER:
- case K_KP_ENTER:
- bd_editor_make_move(minigame, "");
- return true;
- case K_SPACE:
- if(bd_change_dozer_angle(minigame))
- return true;
- bd_curr_tile += 1;
- if(bd_curr_tile > BD_TILE_LAST)
- bd_curr_tile = 1;
- return true;
- }
-
- return false;
-}
-
// Required function, handle client events
int bd_client_event(entity minigame, string event, ...)
{
return false;
}
case "key_pressed":
+ case "key_released":
{
if(minigame.minigame_flags & BD_TURN_MOVE)
{
- if(bd_normal_move(minigame, ...(0,int)))
- return true;
+ switch ( ...(0,int) )
+ {
+ case K_RIGHTARROW:
+ case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
+ bd_make_move(minigame, "r");
+ return true;
+ case K_LEFTARROW:
+ case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
+ bd_make_move(minigame, "l");
+ return true;
+ case K_UPARROW:
+ case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
+ bd_make_move(minigame, "u");
+ return true;
+ case K_DOWNARROW:
+ case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
+ bd_make_move(minigame, "d");
+ return true;
+ }
}
if(minigame.minigame_flags & BD_TURN_EDIT)
{
- if(bd_editor_move(minigame, ...(0,int)))
- return true;
+ switch ( ...(0,int) )
+ {
+ case K_RIGHTARROW:
+ case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
+ if ( ! bd_curr_pos )
+ bd_set_curr_pos("a3");
+ else
+ bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,1,0,BD_NUM_CNT,BD_LET_CNT));
+ return true;
+ case K_LEFTARROW:
+ case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
+ if ( ! bd_curr_pos )
+ bd_set_curr_pos("c3");
+ else
+ bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,-1,0,BD_NUM_CNT,BD_LET_CNT));
+ return true;
+ case K_UPARROW:
+ case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
+ if ( ! bd_curr_pos )
+ bd_set_curr_pos("a1");
+ else
+ bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,0,1,BD_NUM_CNT,BD_LET_CNT));
+ return true;
+ case K_DOWNARROW:
+ case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
+ if ( ! bd_curr_pos )
+ bd_set_curr_pos("a3");
+ else
+ bd_set_curr_pos(minigame_relative_tile(bd_curr_pos,0,-1,BD_NUM_CNT,BD_LET_CNT));
+ return true;
+ case K_ENTER:
+ case K_KP_ENTER:
+ if (event == "key_released")
+ return true;
+ bd_editor_make_move(minigame, "");
+ return true;
+ case K_SPACE:
+ if (event == "key_released")
+ return true;
+ if(bd_change_dozer_angle(minigame))
+ return true;
+ bd_curr_tile += 1;
+ if(bd_curr_tile > BD_TILE_LAST)
+ bd_curr_tile = 1;
+ return true;
+ }
}
return false;
return false;
}
case "key_pressed":
+ case "key_released":
{
if((minigame.minigame_flags & C4_TURN_TEAM) == minigame_self.team)
{
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
if ( ! c4_curr_pos )
c4_set_curr_pos(c4_get_lowest_tile(minigame, "a3"));
else
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
if ( ! c4_curr_pos )
c4_set_curr_pos(c4_get_lowest_tile(minigame, "c3"));
else
return true;
/*case K_UPARROW:
case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
if ( ! c4_curr_pos )
c4_set_curr_pos("a1");
else
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
if ( ! c4_curr_pos )
c4_set_curr_pos("a3");
else
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
+ if (event == "key_released")
+ return true;
c4_make_move(minigame);
return true;
}
nmm_kill_tiles(minigame);
strfree(minigame.message);
}
- else if ( event == "key_pressed" && (minigame.minigame_flags&NMM_TURN_TEAM) == minigame_self.team )
+ else if ( (event == "key_pressed" || event == "key_released") && (minigame.minigame_flags&NMM_TURN_TEAM) == minigame_self.team )
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
if ( ! nmm_currtile )
nmm_currtile = nmm_find_tile(active_minigame,"a7");
else
return 1;
case K_LEFTARROW:
case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
if ( ! nmm_currtile )
nmm_currtile = nmm_find_tile(active_minigame,"g7");
else
return 1;
case K_UPARROW:
case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
if ( ! nmm_currtile )
nmm_currtile = nmm_find_tile(active_minigame,"a1");
else
return 1;
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
if ( ! nmm_currtile )
nmm_currtile = nmm_find_tile(active_minigame,"a7");
else
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
+ if (event == "key_released")
+ return true;
nmm_make_move(minigame);
return 1;
}
return false;
}
case "key_pressed":
- switch ( ...(0,int) )
- {
- case K_UPARROW:
- case K_KP_UPARROW:
- case K_LEFTARROW:
- case K_KP_LEFTARROW:
- //minigame_cmd("+moved");
- pong_keys_pressed |= PONG_KEY_DECREASE;
- return true;
- case K_DOWNARROW:
- case K_KP_DOWNARROW:
- case K_RIGHTARROW:
- case K_KP_RIGHTARROW:
- //minigame_cmd("+movei");
- pong_keys_pressed |= PONG_KEY_INCREASE;
- return true;
- }
- return false;
case "key_released":
switch ( ...(0,int) )
{
case K_KP_UPARROW:
case K_LEFTARROW:
case K_KP_LEFTARROW:
- //minigame_cmd("-moved");
- pong_keys_pressed &= ~PONG_KEY_DECREASE;
+ if (event == "key_pressed")
+ {
+ //minigame_cmd("+moved");
+ pong_keys_pressed |= PONG_KEY_DECREASE;
+ }
+ else
+ {
+ //minigame_cmd("-moved");
+ pong_keys_pressed &= ~PONG_KEY_DECREASE;
+ }
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- //minigame_cmd("-movei");
- pong_keys_pressed &= ~PONG_KEY_INCREASE;
+ if (event == "key_pressed")
+ {
+ //minigame_cmd("+movei");
+ pong_keys_pressed |= PONG_KEY_INCREASE;
+ }
+ else
+ {
+ //minigame_cmd("-movei");
+ pong_keys_pressed &= ~PONG_KEY_INCREASE;
+ }
return true;
}
return false;
return false;
}
case "key_pressed":
+ case "key_released":
{
if((minigame.minigame_flags & PP_TURN_TEAM) == minigame_self.team)
{
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a3");
else
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("c3");
else
return true;
case K_UPARROW:
case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a1");
else
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a3");
else
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
+ if (event == "key_released")
+ return true;
pp_make_move(minigame);
return true;
}
return false;
}
case "key_pressed":
+ case "key_released":
{
//if((minigame.minigame_flags & PS_TURN_TEAM) == minigame_self.team)
{
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a3");
else
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("c3");
else
return true;
case K_UPARROW:
case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a1");
else
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a3");
else
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
+ if (event == "key_released")
+ return true;
ps_make_move(minigame);
return true;
}
return false;
}
case "key_pressed":
+ case "key_released":
{
if((minigame.minigame_flags & TTT_TURN_TEAM) == minigame_self.team)
{
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
+ if (event == "key_released")
+ return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a3");
else
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
+ if (event == "key_released")
+ return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("c3");
else
return true;
case K_UPARROW:
case K_KP_UPARROW:
+ if (event == "key_released")
+ return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a1");
else
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
+ if (event == "key_released")
+ return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a3");
else
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
+ if (event == "key_released")
+ return true;
ttt_make_move(minigame);
return true;
}