Skip to content

Commit

Permalink
MAX_PLAYERS raised to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukitty committed Oct 7, 2024
1 parent 2310d0d commit 39b9d72
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 11 deletions.
113 changes: 104 additions & 9 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -18606,9 +18606,20 @@ void load_levelorder()
if(i % 2 == 1)
xoff = P2_STATS_DIST;

switch(i / 2)
{
// p1, p2 on top
case 0:
break;
// p3, p4 on bottom
if(i / 2 == 1)
case 1:
yoff = 200;
break;
// others make new rows
default:
yoff = ((i / 2) - 1) * 40;
break;
}

// default fonts
plifeX[i][2] = -1;
Expand Down Expand Up @@ -18773,6 +18784,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2LIFE:
case CMD_LEVELORDER_P3LIFE:
case CMD_LEVELORDER_P4LIFE:
case CMD_LEVELORDER_P5LIFE:
case CMD_LEVELORDER_P6LIFE:
case CMD_LEVELORDER_P7LIFE:
case CMD_LEVELORDER_P8LIFE:
i = cmd - CMD_LEVELORDER_P1LIFE;
assert(i >= 0 && i < MAX_PLAYERS);

Expand All @@ -18792,6 +18807,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2MP:
case CMD_LEVELORDER_P3MP:
case CMD_LEVELORDER_P4MP:
case CMD_LEVELORDER_P5MP:
case CMD_LEVELORDER_P6MP:
case CMD_LEVELORDER_P7MP:
case CMD_LEVELORDER_P8MP:
i = cmd - CMD_LEVELORDER_P1MP;
assert(i >= 0 && i < MAX_PLAYERS);

Expand All @@ -18809,6 +18828,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2LIFEX:
case CMD_LEVELORDER_P3LIFEX:
case CMD_LEVELORDER_P4LIFEX:
case CMD_LEVELORDER_P5LIFEX:
case CMD_LEVELORDER_P6LIFEX:
case CMD_LEVELORDER_P7LIFEX:
case CMD_LEVELORDER_P8LIFEX:
j = cmd - CMD_LEVELORDER_P1LIFEX;
assert(j >= 0 && j < MAX_PLAYERS);

Expand All @@ -18823,6 +18846,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2LIFEN:
case CMD_LEVELORDER_P3LIFEN:
case CMD_LEVELORDER_P4LIFEN:
case CMD_LEVELORDER_P5LIFEN:
case CMD_LEVELORDER_P6LIFEN:
case CMD_LEVELORDER_P7LIFEN:
case CMD_LEVELORDER_P8LIFEN:
j = cmd - CMD_LEVELORDER_P1LIFEN;
assert(j >= 0 && j < MAX_PLAYERS);

Expand All @@ -18837,6 +18864,10 @@ void load_levelorder()
case CMD_LEVELORDER_E2LIFE:
case CMD_LEVELORDER_E3LIFE:
case CMD_LEVELORDER_E4LIFE:
case CMD_LEVELORDER_E5LIFE:
case CMD_LEVELORDER_E6LIFE:
case CMD_LEVELORDER_E7LIFE:
case CMD_LEVELORDER_E8LIFE:
i = cmd - CMD_LEVELORDER_E1LIFE;
assert(i >= 0 && i < MAX_PLAYERS);

Expand All @@ -18856,6 +18887,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2ICON:
case CMD_LEVELORDER_P3ICON:
case CMD_LEVELORDER_P4ICON:
case CMD_LEVELORDER_P5ICON:
case CMD_LEVELORDER_P6ICON:
case CMD_LEVELORDER_P7ICON:
case CMD_LEVELORDER_P8ICON:
i = cmd - CMD_LEVELORDER_P1ICON;
assert(i >= 0 && i < MAX_PLAYERS);

Expand All @@ -18875,6 +18910,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2ICONW:
case CMD_LEVELORDER_P3ICONW:
case CMD_LEVELORDER_P4ICONW:
case CMD_LEVELORDER_P5ICONW:
case CMD_LEVELORDER_P6ICONW:
case CMD_LEVELORDER_P7ICONW:
case CMD_LEVELORDER_P8ICONW:
i = cmd - CMD_LEVELORDER_P1ICONW;
assert(i >= 0 && i < MAX_PLAYERS);

Expand All @@ -18894,6 +18933,10 @@ void load_levelorder()
case CMD_LEVELORDER_MP2ICON:
case CMD_LEVELORDER_MP3ICON:
case CMD_LEVELORDER_MP4ICON:
case CMD_LEVELORDER_MP5ICON:
case CMD_LEVELORDER_MP6ICON:
case CMD_LEVELORDER_MP7ICON:
case CMD_LEVELORDER_MP8ICON:
i = cmd - CMD_LEVELORDER_MP1ICON;
assert(i >= 0 && i < MAX_PLAYERS);
if((arg = GET_ARG(1))[0])
Expand All @@ -18909,6 +18952,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2NAMEJ:
case CMD_LEVELORDER_P3NAMEJ:
case CMD_LEVELORDER_P4NAMEJ:
case CMD_LEVELORDER_P5NAMEJ:
case CMD_LEVELORDER_P6NAMEJ:
case CMD_LEVELORDER_P7NAMEJ:
case CMD_LEVELORDER_P8NAMEJ:
j = cmd - CMD_LEVELORDER_P1NAMEJ;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < 7; i++)
Expand All @@ -18922,6 +18969,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2SCORE:
case CMD_LEVELORDER_P3SCORE:
case CMD_LEVELORDER_P4SCORE:
case CMD_LEVELORDER_P5SCORE:
case CMD_LEVELORDER_P6SCORE:
case CMD_LEVELORDER_P7SCORE:
case CMD_LEVELORDER_P8SCORE:
j = cmd - CMD_LEVELORDER_P1SCORE;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < 7; i++)
Expand All @@ -18935,6 +18986,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2SHOOT:
case CMD_LEVELORDER_P3SHOOT:
case CMD_LEVELORDER_P4SHOOT:
case CMD_LEVELORDER_P5SHOOT:
case CMD_LEVELORDER_P6SHOOT:
case CMD_LEVELORDER_P7SHOOT:
case CMD_LEVELORDER_P8SHOOT:
j = cmd - CMD_LEVELORDER_P1SHOOT;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < 3; i++)
Expand All @@ -18947,6 +19002,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2RUSH:
case CMD_LEVELORDER_P3RUSH:
case CMD_LEVELORDER_P4RUSH:
case CMD_LEVELORDER_P5RUSH:
case CMD_LEVELORDER_P6RUSH:
case CMD_LEVELORDER_P7RUSH:
case CMD_LEVELORDER_P8RUSH:
j = cmd - CMD_LEVELORDER_P1RUSH;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < 8; i++)
Expand All @@ -18959,6 +19018,10 @@ void load_levelorder()
case CMD_LEVELORDER_E2ICON:
case CMD_LEVELORDER_E3ICON:
case CMD_LEVELORDER_E4ICON:
case CMD_LEVELORDER_E5ICON:
case CMD_LEVELORDER_E6ICON:
case CMD_LEVELORDER_E7ICON:
case CMD_LEVELORDER_E8ICON:
i = cmd - CMD_LEVELORDER_E1ICON;
assert(i >= 0 && i < MAX_PLAYERS);
if(i >= 2)
Expand All @@ -18976,6 +19039,10 @@ void load_levelorder()
case CMD_LEVELORDER_E2NAME:
case CMD_LEVELORDER_E3NAME:
case CMD_LEVELORDER_E4NAME:
case CMD_LEVELORDER_E5NAME:
case CMD_LEVELORDER_E6NAME:
case CMD_LEVELORDER_E7NAME:
case CMD_LEVELORDER_E8NAME:
j = cmd - CMD_LEVELORDER_E1NAME;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < 3; i++)
Expand All @@ -18989,6 +19056,10 @@ void load_levelorder()
case CMD_LEVELORDER_P2SMENU:
case CMD_LEVELORDER_P3SMENU:
case CMD_LEVELORDER_P4SMENU:
case CMD_LEVELORDER_P5SMENU:
case CMD_LEVELORDER_P6SMENU:
case CMD_LEVELORDER_P7SMENU:
case CMD_LEVELORDER_P8SMENU:
j = cmd - CMD_LEVELORDER_P1SMENU;
assert(j >= 0 && j < MAX_PLAYERS);
for(i = 0; i < MAX_PLAYERS; i++)
Expand Down Expand Up @@ -20262,6 +20333,10 @@ void load_level(char *filename)
case CMD_LEVEL_SPAWN2:
case CMD_LEVEL_SPAWN3:
case CMD_LEVEL_SPAWN4:
case CMD_LEVEL_SPAWN5:
case CMD_LEVEL_SPAWN6:
case CMD_LEVEL_SPAWN7:
case CMD_LEVEL_SPAWN8:
i = cmd - CMD_LEVEL_SPAWN1;
assert(i >= 0 && i < MAX_PLAYERS);

Expand Down Expand Up @@ -20565,6 +20640,10 @@ void load_level(char *filename)
case CMD_LEVEL_2PSPAWN:
case CMD_LEVEL_3PSPAWN:
case CMD_LEVEL_4PSPAWN:
case CMD_LEVEL_5PSPAWN:
case CMD_LEVEL_6PSPAWN:
case CMD_LEVEL_7PSPAWN:
case CMD_LEVEL_8PSPAWN:
// Entity only for 2p+ game
i = cmd - CMD_LEVEL_SPAWN;
assert(i >= 0 && i < MAX_PLAYERS);
Expand Down Expand Up @@ -20618,6 +20697,10 @@ void load_level(char *filename)
case CMD_LEVEL_2PHEALTH:
case CMD_LEVEL_3PHEALTH:
case CMD_LEVEL_4PHEALTH:
case CMD_LEVEL_5PHEALTH:
case CMD_LEVEL_6PHEALTH:
case CMD_LEVEL_7PHEALTH:
case CMD_LEVEL_8PHEALTH:
// Health the spawned entity will have if 2+ people are playing
i = cmd - CMD_LEVEL_HEALTH;
assert(i >= 0 && i < MAX_PLAYERS);
Expand Down Expand Up @@ -20673,6 +20756,10 @@ void load_level(char *filename)
case CMD_LEVEL_2PITEM:
case CMD_LEVEL_3PITEM:
case CMD_LEVEL_4PITEM:
case CMD_LEVEL_5PITEM:
case CMD_LEVEL_6PITEM:
case CMD_LEVEL_7PITEM:
case CMD_LEVEL_8PITEM:
i = cmd - CMD_LEVEL_ITEM;
assert(i >= 0 && i < MAX_PLAYERS);
next.item_properties.player_count = i;
Expand Down Expand Up @@ -48698,9 +48785,9 @@ void menu_options_input()
int selector = 1; // 0
int x_pos = -6;
#if ANDROID
int OPTIONS_NUM = 6;
int OPTIONS_NUM = 10;
#else
int OPTIONS_NUM = 5;
int OPTIONS_NUM = 9;
#endif

screen_status |= IN_SCREEN_CONTROL_OPTIONS_MENU;
Expand Down Expand Up @@ -48742,18 +48829,22 @@ void menu_options_input()
_menutext((selector == 2), x_pos, 0, Tr("Setup Player 2..."));
_menutext((selector == 3), x_pos, 1, Tr("Setup Player 3..."));
_menutext((selector == 4), x_pos, 2, Tr("Setup Player 4..."));
_menutext((selector == 5), x_pos, 3, Tr("Setup Player 5..."));
_menutext((selector == 6), x_pos, 4, Tr("Setup Player 6..."));
_menutext((selector == 7), x_pos, 5, Tr("Setup Player 7..."));
_menutext((selector == 8), x_pos, 6, Tr("Setup Player 8..."));
#if ANDROID
if(savedata.is_touchpad_vibration_enabled)
{
_menutextm((selector == 5), 4, 0, Tr("Touchpad Vibration Enabled"));
_menutextm((selector == 5), 7, 0, Tr("Touchpad Vibration Enabled"));
}
else
else
{
_menutextm((selector == 5), 4, 0, Tr("Touchpad Vibration Disabled"));
_menutextm((selector == 5), 7, 0, Tr("Touchpad Vibration Disabled"));
}
_menutextm((selector == 6), 6, 0, Tr("Back"));
_menutextm((selector == 6), 9, 0, Tr("Back"));
#else
_menutextm((selector == 5), 5, 0, Tr("Back"));
_menutextm((selector == 9), 8, 0, Tr("Back"));
#endif

update((level != NULL), 0);
Expand Down Expand Up @@ -48803,10 +48894,14 @@ void menu_options_input()
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
keyboard_setup(selector - 1);
break;
#if ANDROID
case 5:
case 9:
savedata.is_touchpad_vibration_enabled ^= 1;
break;
#endif
Expand Down
24 changes: 24 additions & 0 deletions engine/sdl/joysticks.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const char *JoystickKeyName[JOY_NAME_SIZE] = {
JOYSTICK_NAMES("P2")
JOYSTICK_NAMES("P3")
JOYSTICK_NAMES("P4")
JOYSTICK_NAMES("P5")
JOYSTICK_NAMES("P6")
JOYSTICK_NAMES("P7")
JOYSTICK_NAMES("P8")
"undefined"
};

Expand Down Expand Up @@ -152,6 +156,10 @@ const char *GameparkKeyName[JOY_NAME_SIZE] = {
GAMEPARK_NAMES("P2")
GAMEPARK_NAMES("P3")
GAMEPARK_NAMES("P4")
GAMEPARK_NAMES("P5")
GAMEPARK_NAMES("P6")
GAMEPARK_NAMES("P7")
GAMEPARK_NAMES("P8")
"undefined"
};

Expand Down Expand Up @@ -295,6 +303,10 @@ const char* JoystickButtonNames[JOY_NAME_SIZE] = {
BUTTON_NAMES("P2")
BUTTON_NAMES("P3")
BUTTON_NAMES("P4")
BUTTON_NAMES("P5")
BUTTON_NAMES("P6")
BUTTON_NAMES("P7")
BUTTON_NAMES("P8")
};

const char* JoystickAxisNames[JOY_NAME_SIZE] = {
Expand Down Expand Up @@ -339,6 +351,10 @@ const char* JoystickAxisNames[JOY_NAME_SIZE] = {
AXIS_NAMES("P2")
AXIS_NAMES("P3")
AXIS_NAMES("P4")
AXIS_NAMES("P5")
AXIS_NAMES("P6")
AXIS_NAMES("P7")
AXIS_NAMES("P8")
};

const char* JoystickHatNames[JOY_NAME_SIZE] = {
Expand Down Expand Up @@ -369,6 +385,10 @@ const char* JoystickHatNames[JOY_NAME_SIZE] = {
HAT_NAMES("P2")
HAT_NAMES("P3")
HAT_NAMES("P4")
HAT_NAMES("P5")
HAT_NAMES("P6")
HAT_NAMES("P7")
HAT_NAMES("P8")
};

const char* JoystickUnknownNames[JOY_NAME_SIZE] = {
Expand Down Expand Up @@ -442,6 +462,10 @@ const char* JoystickUnknownNames[JOY_NAME_SIZE] = {
UNKNOWN_NAMES("P2")
UNKNOWN_NAMES("P3")
UNKNOWN_NAMES("P4")
UNKNOWN_NAMES("P5")
UNKNOWN_NAMES("P6")
UNKNOWN_NAMES("P7")
UNKNOWN_NAMES("P8")
};

// Numbering order: buttons, then axes, then hats
Expand Down
2 changes: 1 addition & 1 deletion engine/sdl/joysticks.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define JOY_AXIS_Y 1
#define JOY_MAX_INPUTS 64
#define JOY_LIST_FIRST 600
#define JOY_LIST_TOTAL 4
#define JOY_LIST_TOTAL 8
#define JOY_LIST_LAST JOY_LIST_FIRST + JOY_MAX_INPUTS * JOY_LIST_TOTAL
#define JOY_NAME_SIZE 1 + 1 + JOY_MAX_INPUTS * JOY_LIST_TOTAL

Expand Down
2 changes: 1 addition & 1 deletion engine/source/gamelib/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef GAMELIB_TYPES_H
#define GAMELIB_TYPES_H

#define MAX_PLAYERS 4
#define MAX_PLAYERS 8

#ifndef TRANSPARENT_IDX
#define TRANSPARENT_IDX 0x00
Expand Down
Loading

0 comments on commit 39b9d72

Please sign in to comment.