key_action |= key_info[i].action;
if (key_status == KEY_PRESSED)
- {
- if (network_playing)
- stored_player[pnr].potential_action |= key_action;
- else
- stored_player[pnr].action |= key_action;
- }
+ stored_player[pnr].action |= key_action;
else
- {
- if (network_playing)
- stored_player[pnr].potential_action &= ~key_action;
- else
- stored_player[pnr].action &= ~key_action;
- }
+ stored_player[pnr].action &= ~key_action;
}
}
else
continue;
joy_action = Joystick(i);
-
result |= joy_action;
- if (network_playing)
- stored_player[i].potential_action = joy_action;
- else
- stored_player[i].action = joy_action;
+ stored_player[i].action = joy_action;
}
return result;
#define SETUP_TOKEN_FADING 8
#define SETUP_TOKEN_AUTORECORD 9
#define SETUP_TOKEN_QUICK_DOORS 10
-#define SETUP_TOKEN_ALIAS_NAME 11
-
-#define SETUP_TOKEN_USE_JOYSTICK 12
-#define SETUP_TOKEN_JOY_DEVICE_NAME 13
-#define SETUP_TOKEN_JOY_XLEFT 14
-#define SETUP_TOKEN_JOY_XMIDDLE 15
-#define SETUP_TOKEN_JOY_XRIGHT 16
-#define SETUP_TOKEN_JOY_YUPPER 17
-#define SETUP_TOKEN_JOY_YMIDDLE 18
-#define SETUP_TOKEN_JOY_YLOWER 19
-#define SETUP_TOKEN_JOY_SNAP 20
-#define SETUP_TOKEN_JOY_BOMB 21
-#define SETUP_TOKEN_KEY_LEFT 22
-#define SETUP_TOKEN_KEY_RIGHT 23
-#define SETUP_TOKEN_KEY_UP 24
-#define SETUP_TOKEN_KEY_DOWN 25
-#define SETUP_TOKEN_KEY_SNAP 26
-#define SETUP_TOKEN_KEY_BOMB 27
-
-#define NUM_SETUP_TOKENS 28
+#define SETUP_TOKEN_TEAM_MODE 11
+#define SETUP_TOKEN_ALIAS_NAME 12
+
+#define SETUP_TOKEN_USE_JOYSTICK 13
+#define SETUP_TOKEN_JOY_DEVICE_NAME 14
+#define SETUP_TOKEN_JOY_XLEFT 15
+#define SETUP_TOKEN_JOY_XMIDDLE 16
+#define SETUP_TOKEN_JOY_XRIGHT 17
+#define SETUP_TOKEN_JOY_YUPPER 18
+#define SETUP_TOKEN_JOY_YMIDDLE 19
+#define SETUP_TOKEN_JOY_YLOWER 20
+#define SETUP_TOKEN_JOY_SNAP 21
+#define SETUP_TOKEN_JOY_BOMB 22
+#define SETUP_TOKEN_KEY_LEFT 23
+#define SETUP_TOKEN_KEY_RIGHT 24
+#define SETUP_TOKEN_KEY_UP 25
+#define SETUP_TOKEN_KEY_DOWN 26
+#define SETUP_TOKEN_KEY_SNAP 27
+#define SETUP_TOKEN_KEY_BOMB 28
+
+#define NUM_SETUP_TOKENS 29
#define FIRST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_SOUND
#define LAST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_ALIAS_NAME
{ TYPE_SWITCH, &si.fading, "screen_fading" },
{ TYPE_SWITCH, &si.autorecord, "automatic_tape_recording" },
{ TYPE_SWITCH, &si.quick_doors, "quick_doors" },
+ { TYPE_SWITCH, &si.team_mode, "team_mode" },
{ TYPE_STRING, &si.alias_name, "alias_name" },
/* for each player: */
player->active = FALSE;
player->action = 0;
- player->potential_action = 0;
+ player->effective_action = 0;
player->score = 0;
player->gems_still_needed = level.edelsteine;
}
}
+ /* when in single player mode, eliminate all but the first active player */
+ if (!options.network && !setup.team_mode)
+ for(i=0; i<MAX_PLAYERS; i++)
+ if (stored_player[i].active)
+ for(j=i+1; j<MAX_PLAYERS; j++)
+ stored_player[j].active = FALSE;
for(i=0; i<MAX_PLAYERS; i++)
{
}
}
-void PlayerActions(struct PlayerInfo *player, byte player_action)
+static void PlayerActions(struct PlayerInfo *player, byte player_action)
{
static byte stored_player_action[MAX_PLAYERS];
static int num_stored_actions = 0;
int sieb_x = 0, sieb_y = 0;
int i, x,y, element;
byte *recorded_player_action;
+ byte summarized_player_action;
if (game_status != PLAYING)
return;
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
- if (network_playing)
+ for(i=0; i<MAX_PLAYERS; i++)
{
- byte local_potential_action = 0;
-
- for(i=0; i<MAX_PLAYERS; i++)
- local_potential_action |= stored_player[i].potential_action;
+ summarized_player_action |= stored_player[i].action;
- SendToServer_MovePlayer(local_potential_action);
+ if (!network_playing)
+ stored_player[i].effective_action = stored_player[i].action;
}
+ if (network_playing)
+ SendToServer_MovePlayer(summarized_player_action);
+
+ if (!options.network && !setup.team_mode)
+ local_player->effective_action = summarized_player_action;
+
for(i=0; i<MAX_PLAYERS; i++)
{
- int actual_player_action = stored_player[i].action;
+ int actual_player_action = stored_player[i].effective_action;
if (recorded_player_action)
actual_player_action = recorded_player_action[i];
/* should only happen if pre-1.0 tape recordings are played */
/* this is only for backward compatibility */
-#ifdef DEBUG
+#if DEBUG
printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.0 LEVEL TAPES.\n");
#endif
boolean fading;
boolean autorecord;
boolean quick_doors;
+ boolean team_mode;
char login_name[MAX_NAMELEN];
char alias_name[MAX_NAMELEN];
int index_nr, client_nr, element_nr;
- byte action; /* action from server or for local playing */
- byte potential_action; /* must go to network server first */
+ byte action; /* action from local input device */
+ byte effective_action; /* action aknowledged from network server
+ or summarized over all configured input
+ devices when in single player mode */
int joystick_fd; /* file descriptor of player's joystick */
/* copy valid player actions */
for (i=0; i<MAX_PLAYERS; i++)
- stored_player[i].action =
+ stored_player[i].effective_action =
(i < len - 6 && stored_player[i].active ? buf[6 + i] : 0);
network_player_action_received = TRUE;
{ &setup.fading, "Fading:" },
{ &setup.quick_doors, "Quick Doors:" },
{ &setup.autorecord, "Auto-Record:" },
+ { &setup.team_mode, "Team-Mode:" },
{ NULL, "Input Devices" },
{ NULL, "" },
- { NULL, "" },
{ NULL, "Exit" },
{ NULL, "Save and exit" }
};
setup.autorecord = !setup.autorecord;
}
else if (y==13)
+ {
+ if (setup.team_mode)
+ DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
+ else
+ DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
+ setup.team_mode = !setup.team_mode;
+ }
+ else if (y==14)
{
game_status = SETUPINPUT;
DrawSetupInputScreen();
/* for DrawSetupScreen(), HandleSetupScreen() */
#define SETUP_SCREEN_POS_START 2
#define SETUP_SCREEN_POS_END 16
-#define SETUP_SCREEN_POS_EMPTY1 (SETUP_SCREEN_POS_END - 3)
+#define SETUP_SCREEN_POS_EMPTY1 (SETUP_SCREEN_POS_END - 2)
#define SETUP_SCREEN_POS_EMPTY2 (SETUP_SCREEN_POS_END - 2)
#define SETUPINPUT_SCREEN_POS_START 2