Added patch by Karate Chris:

- The net arbitrator can add or remove players to an access list so they 
    can or cannot control game settings:
 * net_addcontroller <player number> - Adds a player to the control list. Only net arbitrators have access to this command.
 * net_removecontroller <player number> - Removes a player from the control list. Only net arbitrators have access to this command.
 * net_listcontrollers - Lists the players who are able to control the game settings.
- Fixed: The 'Printf'' occurrences in the 'addplayerclass' console command were all missing a '\n' at the end.
- Enhanced the 'playerinfo' console command so more information about each setting is shown.


SVN r750 (trunk)
This commit is contained in:
Christoph Oelckers 2008-02-16 15:02:52 +00:00
parent e99b239ae6
commit 39bff11693
9 changed files with 1791 additions and 1621 deletions

View file

@ -1,4 +1,13 @@
February 16, 2008 (Changes by Graf Zahl)
- Added patch by Karate Chris:
- The net arbitrator can add or remove players to an access list so they
can or cannot control game settings:
* net_addcontroller <player number> - Adds a player to the control list. Only net arbitrators have access to this command.
* net_removecontroller <player number> - Removes a player from the control list. Only net arbitrators have access to this command.
* net_listcontrollers - Lists the players who are able to control the game settings.
- Fixed: The 'Printf'' occurrences in the 'addplayerclass' console command were all missing a '\n' at the end.
- Enhanced the 'playerinfo' console command so more information about each setting is shown.
- Added customizable pickup flash.
- Added option to show shorter messages for save game and screenshot confirmation.
Also added this to the 'Messages' menu.

View file

@ -31,9 +31,9 @@ CCMD (addbot)
return;
}
if (consoleplayer != Net_Arbitrator)
if (!players[consoleplayer].settings_controller)
{
Printf ("Only player %d can add bots\n", Net_Arbitrator + 1);
Printf ("Only setting controllers can add bots\n");
return;
}
@ -78,17 +78,17 @@ extern bool CheckCheatmode ();
CCMD (freeze)
{
if (CheckCheatmode ())
return;
if (CheckCheatmode ())
return;
if (netgame && consoleplayer != Net_Arbitrator)
{
Printf ("Only player %d can use freeze mode\n", Net_Arbitrator + 1);
return;
}
if (netgame && !players[consoleplayer].settings_controller)
{
Printf ("Only setting controllers can use freeze mode\n");
return;
}
Net_WriteByte (DEM_GENERICCHEAT);
Net_WriteByte (CHT_FREEZE);
Net_WriteByte (DEM_GENERICCHEAT);
Net_WriteByte (CHT_FREEZE);
}
CCMD (listbots)

View file

@ -315,9 +315,9 @@ CCMD (changemap)
return;
}
if (who->player - players != Net_Arbitrator && multiplayer)
if (!players[who->player - players].settings_controller && netgame)
{
Printf ("Only player %d can change the map.\n", Net_Arbitrator+1);
Printf ("Only setting controllers can change the map.\n");
return;
}
@ -589,7 +589,7 @@ CCMD (fov)
}
else
{
Printf ("The arbitrator has disabled FOV changes.\n");
Printf ("A setting controller has disabled FOV changes.\n");
return;
}
}

File diff suppressed because it is too large Load diff

View file

@ -649,6 +649,7 @@ void PlayerIsGone (int netnode, int netconsole)
if (playeringame[i] && !players[i].isbot)
{
Net_Arbitrator = i;
players[i].settings_controller = true;
Printf ("%s is the new arbitrator\n", players[i].userinfo.netname);
break;
}
@ -1580,6 +1581,8 @@ void D_CheckNetGame (void)
I_InitNetwork ();
if (doomcom.id != DOOMCOM_ID)
I_FatalError ("Doomcom buffer invalid!");
players[0].settings_controller = true;
consoleplayer = doomcom.consoleplayer;
@ -2313,6 +2316,26 @@ void Net_DoCommand (int type, BYTE **stream, int player)
playerswiping &= ~(1 << player);
break;
case DEM_ADDCONTROLLER:
{
BYTE playernum = ReadByte (stream);
players[playernum].settings_controller = true;
if (consoleplayer == playernum || consoleplayer == Net_Arbitrator)
Printf ("%s has been added to the controller list.\n", players[playernum].userinfo.netname);
}
break;
case DEM_DELCONTROLLER:
{
BYTE playernum = ReadByte (stream);
players[playernum].settings_controller = false;
if (consoleplayer == playernum || consoleplayer == Net_Arbitrator)
Printf ("%s has been removed from the controller list.\n", players[playernum].userinfo.netname);
}
break;
default:
I_Error ("Unknown net command: %d", type);
break;
@ -2362,6 +2385,8 @@ void Net_SkipCommand (int type, BYTE **stream)
case DEM_DROPPLAYER:
case DEM_FOV:
case DEM_MYFOV:
case DEM_ADDCONTROLLER:
case DEM_DELCONTROLLER:
skip = 1;
break;
@ -2417,3 +2442,132 @@ CCMD (pings)
Printf ("% 4d %s\n", currrecvtime[i] - lastrecvtime[i],
players[i].userinfo.netname);
}
//==========================================================================
//
// Network_Controller
//
// Implement players who have the ability to change settings in a network
// game.
//
//==========================================================================
static void Network_Controller (int playernum, bool add)
{
if (consoleplayer != Net_Arbitrator)
{
Printf ("This command is only accessible to the net arbitrator.\n");
return;
}
if (players[playernum].settings_controller && add)
{
Printf ("%s is already on the setting controller list.\n", players[playernum].userinfo.netname);
return;
}
if (!players[playernum].settings_controller && !add)
{
Printf ("%s is not on the setting controller list.\n", players[playernum].userinfo.netname);
return;
}
if (!playeringame[playernum])
{
Printf ("Player (%d) not found!\n");
return;
}
if (players[playernum].isbot)
{
Printf ("Bots cannot be added to the controller list.\n");
return;
}
if (playernum == Net_Arbitrator)
{
Printf ("The net arbitrator cannot have their status changed on this list.\n");
return;
}
if (add)
Net_WriteByte (DEM_ADDCONTROLLER);
else
Net_WriteByte (DEM_DELCONTROLLER);
Net_WriteByte (playernum);
}
//==========================================================================
//
// CCMD net_addcontroller
//
//==========================================================================
CCMD (net_addcontroller)
{
if (!netgame)
{
Printf ("This command can only be used when playing a net game.\n");
return;
}
if (argv.argc () < 2)
{
Printf ("Usage: net_addcontroller <player>\n");
return;
}
Network_Controller (atoi (argv[1]), true);
}
//==========================================================================
//
// CCMD net_removecontroller
//
//==========================================================================
CCMD (net_removecontroller)
{
if (!netgame)
{
Printf ("This command can only be used when playing a net game.\n");
return;
}
if (argv.argc () < 2)
{
Printf ("Usage: net_removecontroller <player>\n");
return;
}
Network_Controller (atoi (argv[1]), false);
}
//==========================================================================
//
// CCMD net_listcontrollers
//
//==========================================================================
CCMD (net_listcontrollers)
{
if (!netgame)
{
Printf ("This command can only be used when playing a net game.\n");
return;
}
Printf ("The following players can change the game settings:\n");
for (int i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
if (players[i].settings_controller)
{
Printf ("- %s\n", players[i].userinfo.netname);
}
}
}

View file

@ -823,15 +823,18 @@ CCMD (playerinfo)
else
{
int i = atoi (argv[1]);
Printf ("Name: %s\n", players[i].userinfo.netname);
Printf ("Team: %d\n", players[i].userinfo.team);
Printf ("Aimdist: %d\n", players[i].userinfo.aimdist);
Printf ("Color: %06x\n", players[i].userinfo.color);
Printf ("Skin: %d\n", players[i].userinfo.skin);
Printf ("Gender: %d\n", players[i].userinfo.gender);
Printf ("NeverSwitch: %d\n", players[i].userinfo.neverswitch);
Printf ("MoveBob: %g\n", players[i].userinfo.MoveBob/65536.f);
Printf ("StillBob: %g\n", players[i].userinfo.StillBob/65536.f);
Printf ("PlayerClass: %d\n", players[i].userinfo.PlayerClass);
userinfo_t *ui = &players[i].userinfo;
Printf ("Name: %s\n", ui->netname);
Printf ("Team: %s (%d)\n", ui->team == TEAM_None ? "None" : teams[ui->team].name, ui->team);
Printf ("Aimdist: %d\n", ui->aimdist);
Printf ("Color: %06x\n", ui->color);
Printf ("Skin: %s (%d)\n", skins[ui->skin].name, ui->skin);
Printf ("Gender: %s (%d)\n", GenderNames[ui->gender], ui->gender);
Printf ("NeverSwitch: %d\n", ui->neverswitch);
Printf ("MoveBob: %g\n", ui->MoveBob/65536.f);
Printf ("StillBob: %g\n", ui->StillBob/65536.f);
Printf ("PlayerClass: %s (%d)\n",
ui->PlayerClass == -1 ? "Random" : PlayerClasses[ui->PlayerClass].Type->Meta.GetMetaString (APMETA_DisplayName),
ui->PlayerClass);
}
}

View file

@ -280,6 +280,8 @@ public:
// pointed to by this. Allows bot to roam to it if
// necessary.
bool settings_controller; // Player can control game settings.
//Skills
struct botskill_t skill;

View file

@ -147,6 +147,8 @@ enum EDemoCommand
DEM_WIPEON, // 45 Player started a screen wipe
DEM_WIPEOFF, // 46 Player finished a screen wipe
DEM_TAKECHEAT, // 47 String: item to take, Word: quantity
DEM_ADDCONTROLLER, // 48 Player to add to the controller list.
DEM_DELCONTROLLER, // 49 Player to remove from the controller list.
};
// The following are implemented by cht_DoCheat in m_cheat.cpp

View file

@ -143,15 +143,15 @@ CCMD (addplayerclass)
if (!ti)
{
Printf ("Unknown player class '%s'", argv[1]);
Printf ("Unknown player class '%s'\n", argv[1]);
}
else if (!ti->IsDescendantOf (RUNTIME_CLASS (APlayerPawn)))
{
Printf ("Invalid player class '%s'", argv[1]);
Printf ("Invalid player class '%s'\n", argv[1]);
}
else if (ti->Meta.GetMetaString (APMETA_DisplayName) == NULL)
{
Printf ("Missing displayname for player class '%s'", argv[1]);
Printf ("Missing displayname for player class '%s'\n", argv[1]);
}
else
{
@ -169,7 +169,7 @@ CCMD (addplayerclass)
}
else
{
Printf ("Unknown flag '%s' for player class '%s'", argv[arg], argv[1]);
Printf ("Unknown flag '%s' for player class '%s'\n", argv[arg], argv[1]);
}
arg++;