case "key_pressed":
case "key_released":
{
- if(minigame.minigame_flags & BD_TURN_MOVE)
+ bool event_blocked = ((event == "key_released")
+ || !(minigame.minigame_flags & BD_TURN_MOVE));
+ if (!(minigame.minigame_flags & BD_TURN_WIN) && !(minigame.minigame_flags & BD_TURN_LOSS))
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
bd_make_move(minigame, "r");
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
bd_make_move(minigame, "l");
return true;
case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
bd_make_move(minigame, "u");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
bd_make_move(minigame, "d");
return true;
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! bd_curr_pos )
bd_set_curr_pos("a3");
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! bd_curr_pos )
bd_set_curr_pos("c3");
return true;
case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! bd_curr_pos )
bd_set_curr_pos("a1");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! bd_curr_pos )
bd_set_curr_pos("a3");
return true;
case K_ENTER:
case K_KP_ENTER:
- if (event == "key_released")
+ if (event_blocked)
return true;
bd_editor_make_move(minigame, "");
return true;
case K_SPACE:
- if (event == "key_released")
+ if (event_blocked)
return true;
if(bd_change_dozer_angle(minigame))
return true;
case "key_pressed":
case "key_released":
{
- if((minigame.minigame_flags & C4_TURN_TEAM) == minigame_self.team)
+ bool event_blocked = ((event == "key_released")
+ || ((minigame.minigame_flags & C4_TURN_TEAM) != minigame_self.team));
+ if (!(minigame.minigame_flags & C4_TURN_WIN) && !(minigame.minigame_flags & C4_TURN_DRAW))
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! c4_curr_pos )
c4_set_curr_pos(c4_get_lowest_tile(minigame, "a3"));
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! c4_curr_pos )
c4_set_curr_pos(c4_get_lowest_tile(minigame, "c3"));
return true;
/*case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! c4_curr_pos )
c4_set_curr_pos("a1");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! c4_curr_pos )
c4_set_curr_pos("a3");
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
- if (event == "key_released")
+ if (event_blocked)
return true;
c4_make_move(minigame);
return true;
nmm_kill_tiles(minigame);
strfree(minigame.message);
}
- else if ( (event == "key_pressed" || event == "key_released") && (minigame.minigame_flags&NMM_TURN_TEAM) == minigame_self.team )
+ else if ( (event == "key_pressed" || event == "key_released") )
{
- switch ( ...(0,int) )
+ bool event_blocked = ((event == "key_released")
+ || ((minigame.minigame_flags & NMM_TURN_TEAM) != minigame_self.team));
+ if (!(minigame.minigame_flags & NMM_TURN_WIN))
{
- 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
- {
- string tileid = nmm_currtile.netname;
- nmm_currtile = NULL;
- while ( !nmm_currtile )
+ switch ( ...(0,int) )
+ {
+ case K_RIGHTARROW:
+ case K_KP_RIGHTARROW:
+ if (event_blocked)
+ return true;
+ if ( ! nmm_currtile )
+ nmm_currtile = nmm_find_tile(active_minigame,"a7");
+ else
{
- tileid = minigame_relative_tile(tileid,1,0,7,7);
- nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ string tileid = nmm_currtile.netname;
+ nmm_currtile = NULL;
+ while ( !nmm_currtile )
+ {
+ tileid = minigame_relative_tile(tileid,1,0,7,7);
+ nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ }
}
- }
- 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
- {
- string tileid = nmm_currtile.netname;
- nmm_currtile = NULL;
- while ( !nmm_currtile )
+ return 1;
+ case K_LEFTARROW:
+ case K_KP_LEFTARROW:
+ if (event_blocked)
+ return true;
+ if ( ! nmm_currtile )
+ nmm_currtile = nmm_find_tile(active_minigame,"g7");
+ else
{
- tileid = minigame_relative_tile(tileid,-1,0,7,7);
- nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ string tileid = nmm_currtile.netname;
+ nmm_currtile = NULL;
+ while ( !nmm_currtile )
+ {
+ tileid = minigame_relative_tile(tileid,-1,0,7,7);
+ nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ }
}
- }
- 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
- {
- string tileid = nmm_currtile.netname;
- nmm_currtile = NULL;
- while ( !nmm_currtile )
+ return 1;
+ case K_UPARROW:
+ case K_KP_UPARROW:
+ if (event_blocked)
+ return true;
+ if ( ! nmm_currtile )
+ nmm_currtile = nmm_find_tile(active_minigame,"a1");
+ else
{
- tileid = minigame_relative_tile(tileid,0,1,7,7);
- nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ string tileid = nmm_currtile.netname;
+ nmm_currtile = NULL;
+ while ( !nmm_currtile )
+ {
+ tileid = minigame_relative_tile(tileid,0,1,7,7);
+ nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ }
}
- }
- 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
- {
- string tileid = nmm_currtile.netname;
- nmm_currtile = NULL;
- while ( !nmm_currtile )
+ return 1;
+ case K_DOWNARROW:
+ case K_KP_DOWNARROW:
+ if (event_blocked)
+ return true;
+ if ( ! nmm_currtile )
+ nmm_currtile = nmm_find_tile(active_minigame,"a7");
+ else
{
- tileid = minigame_relative_tile(tileid,0,-1,7,7);
- nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ string tileid = nmm_currtile.netname;
+ nmm_currtile = NULL;
+ while ( !nmm_currtile )
+ {
+ tileid = minigame_relative_tile(tileid,0,-1,7,7);
+ nmm_currtile = nmm_find_tile(active_minigame,tileid);
+ }
}
- }
- return 1;
- case K_ENTER:
- case K_KP_ENTER:
- case K_SPACE:
- if (event == "key_released")
- return true;
- nmm_make_move(minigame);
- return 1;
+ return 1;
+ case K_ENTER:
+ case K_KP_ENTER:
+ case K_SPACE:
+ if (event_blocked)
+ return true;
+ nmm_make_move(minigame);
+ return 1;
+ }
}
return 0;
}
}
case "key_pressed":
case "key_released":
- switch ( ...(0,int) )
- {
- case K_UPARROW:
- case K_KP_UPARROW:
- case K_LEFTARROW:
- case K_KP_LEFTARROW:
- 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:
- 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;
- }
+ if ((minigame.minigame_flags & PONG_STATUS_PLAY))
+ switch ( ...(0,int) )
+ {
+ case K_UPARROW:
+ case K_KP_UPARROW:
+ case K_LEFTARROW:
+ case K_KP_LEFTARROW:
+ 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:
+ 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;
case "network_receive":
{
case "key_pressed":
case "key_released":
{
- if((minigame.minigame_flags & PP_TURN_TEAM) == minigame_self.team)
+ bool event_blocked = ((event == "key_released")
+ || ((minigame.minigame_flags & PP_TURN_TEAM) != minigame_self.team));
+ if (!(minigame.minigame_flags & PP_TURN_WIN) && !(minigame.minigame_flags & PP_TURN_DRAW))
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a3");
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("c3");
return true;
case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a1");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! pp_curr_pos )
pp_set_curr_pos("a3");
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
- if (event == "key_released")
+ if (event_blocked)
return true;
pp_make_move(minigame);
return true;
case "key_pressed":
case "key_released":
{
- //if((minigame.minigame_flags & PS_TURN_TEAM) == minigame_self.team)
+ bool event_blocked = (event == "key_released");
+ if (!(minigame.minigame_flags & PS_TURN_WIN) && !(minigame.minigame_flags & PS_TURN_DRAW))
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a3");
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("c3");
return true;
case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a1");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ps_curr_pos )
ps_set_curr_pos("a3");
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
- if (event == "key_released")
+ if (event_blocked)
return true;
ps_make_move(minigame);
return true;
case "key_pressed":
case "key_released":
{
- if((minigame.minigame_flags & TTT_TURN_TEAM) == minigame_self.team)
+ bool event_blocked = ((event == "key_released")
+ || ((minigame.minigame_flags & TTT_TURN_TEAM) != minigame_self.team));
+ if (!(minigame.minigame_flags & TTT_TURN_WIN) && !(minigame.minigame_flags & TTT_TURN_DRAW))
{
switch ( ...(0,int) )
{
case K_RIGHTARROW:
case K_KP_RIGHTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a3");
return true;
case K_LEFTARROW:
case K_KP_LEFTARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("c3");
return true;
case K_UPARROW:
case K_KP_UPARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a1");
return true;
case K_DOWNARROW:
case K_KP_DOWNARROW:
- if (event == "key_released")
+ if (event_blocked)
return true;
if ( ! ttt_curr_pos )
ttt_set_curr_pos("a3");
case K_ENTER:
case K_KP_ENTER:
case K_SPACE:
- if (event == "key_released")
+ if (event_blocked)
return true;
ttt_make_move(minigame);
return true;