Fixed multiplayer fog of war, initial support for more game types
This commit is contained in:
parent
2cb196ef18
commit
ec960e2637
5 changed files with 96 additions and 8 deletions
src
|
@ -56,6 +56,7 @@
|
|||
#include "settings.h"
|
||||
#include "campaign.h"
|
||||
#include "trigger.h"
|
||||
#include "commands.h"
|
||||
|
||||
#include "ccl.h"
|
||||
|
||||
|
@ -151,6 +152,20 @@ local void LoadMap(const char* filename,WorldMap* map)
|
|||
-- Game creation
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
local void GameTypeFreeForAll(void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i=0; i<15; i++) {
|
||||
for (j=0; j<15; j++) {
|
||||
if (i != j) {
|
||||
SendCommandDiplomacy(i,DiplomacyEnemy,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** CreateGame.
|
||||
**
|
||||
|
@ -229,6 +244,35 @@ global void CreateGame(char* filename, WorldMap* map)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: implement more game types
|
||||
if (GameSettings.GameType != SettingsGameTypeMapDefault) {
|
||||
switch (GameSettings.GameType) {
|
||||
case SettingsGameTypeMelee:
|
||||
break;
|
||||
case SettingsGameTypeFreeForAll:
|
||||
GameTypeFreeForAll();
|
||||
break;
|
||||
case SettingsGameTypeOneOnOne:
|
||||
break;
|
||||
case SettingsGameTypeCaptureTheFlag:
|
||||
break;
|
||||
case SettingsGameTypeGreed:
|
||||
break;
|
||||
case SettingsGameTypeSlaughter:
|
||||
break;
|
||||
case SettingsGameTypeSuddenDeath:
|
||||
break;
|
||||
case SettingsGameTypeTeamMelee:
|
||||
break;
|
||||
case SettingsGameTypeTeamCaptureTheFlag:
|
||||
break;
|
||||
case SettingsGameTypeTopVsBottom:
|
||||
break;
|
||||
case SettingsGameTypeLeftVsRight:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Graphic part
|
||||
//
|
||||
|
@ -395,6 +439,7 @@ global void InitSettings(void)
|
|||
GameSettings.NumUnits = SettingsNumUnitsMapDefault;
|
||||
GameSettings.Opponents = SettingsPresetMapDefault;
|
||||
GameSettings.Terrain = SettingsPresetMapDefault;
|
||||
GameSettings.GameType = SettingsPresetMapDefault;
|
||||
}
|
||||
|
||||
//@}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
/// Network protocol minor version (maximal 99)
|
||||
#define NetworkProtocolMinorVersion 4
|
||||
/// Network protocol patch level (maximal 99)
|
||||
#define NetworkProtocolPatchLevel 4
|
||||
#define NetworkProtocolPatchLevel 5
|
||||
/// Network protocol version (1,2,3) -> 10203
|
||||
#define NetworkProtocolVersion \
|
||||
(NetworkProtocolMajorVersion*10000+NetworkProtocolMinorVersion*100 \
|
||||
|
@ -87,6 +87,7 @@ typedef struct _setup_state_ {
|
|||
unsigned char UnsOpt; /// Unit # option
|
||||
unsigned char FwsOpt; /// Fog of war option
|
||||
unsigned char TssOpt; /// Tileset select option
|
||||
unsigned char GaTOpt; /// Game type option
|
||||
unsigned char CompOpt[PlayerMax]; /// Free slot option selection
|
||||
unsigned char Ready[PlayerMax]; /// Client ready state
|
||||
unsigned char Race[PlayerMax]; /// Client race selection
|
||||
|
|
|
@ -67,6 +67,7 @@ struct _settings_ {
|
|||
unsigned NumUnits; /// Preset # of units
|
||||
unsigned Opponents; /// Preset # of ai-opponents
|
||||
unsigned Terrain; /// Terrain type (summer,winter,...)
|
||||
unsigned GameType; /// Game type (melee, free for all,...)
|
||||
};
|
||||
|
||||
#define SettingsPresetMapDefault (~0ul) /// Special: Use pud/cm supplied
|
||||
|
@ -85,6 +86,25 @@ struct _settings_ {
|
|||
#define SettingsNumUnitsMapDefault SettingsPresetMapDefault
|
||||
#define SettingsNumUnits1 0
|
||||
|
||||
/*
|
||||
** GameType settings
|
||||
*/
|
||||
enum {
|
||||
SettingsGameTypeMapDefault=SettingsPresetMapDefault,
|
||||
SettingsGameTypeMelee=0,
|
||||
SettingsGameTypeFreeForAll,
|
||||
SettingsGameTypeOneOnOne,
|
||||
SettingsGameTypeCaptureTheFlag,
|
||||
SettingsGameTypeGreed,
|
||||
SettingsGameTypeSlaughter,
|
||||
SettingsGameTypeSuddenDeath,
|
||||
SettingsGameTypeTeamMelee,
|
||||
SettingsGameTypeTeamCaptureTheFlag,
|
||||
SettingsGameTypeTopVsBottom,
|
||||
SettingsGameTypeLeftVsRight,
|
||||
} GameTypes;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define MAX_BRIEFING_VOICES 2 /// How many intro voices supported
|
||||
|
|
|
@ -2172,9 +2172,9 @@ global void SaveMenus(FILE* file)
|
|||
/// Offsets into NetMultiSetupMenuItems
|
||||
#define SERVER_PLAYER_STATE 5
|
||||
/// Offsets into NetMultiSetupMenuItems
|
||||
#define SERVER_PLAYER_READY 30
|
||||
#define SERVER_PLAYER_READY 32
|
||||
/// Offsets into NetMultiSetupMenuItems
|
||||
#define SERVER_PLAYER_LAG 44
|
||||
#define SERVER_PLAYER_LAG 46
|
||||
|
||||
/// Offsets into NetMultiClientMenuItems
|
||||
#define CLIENT_PLAYER_STATE 5
|
||||
|
@ -2188,7 +2188,9 @@ global void SaveMenus(FILE* file)
|
|||
#define CLIENT_FOG_OF_WAR 27
|
||||
/// Offsets into NetMultiClientMenuItems
|
||||
#define CLIENT_TILESET 29
|
||||
/// Offsets into NetMultiClientMenuItems
|
||||
#define CLIENT_GAMETYPE 31
|
||||
/// Offsets into NetMultiClientMenuItems
|
||||
#define CLIENT_PLAYER_READY 30
|
||||
#define CLIENT_PLAYER_READY 32
|
||||
|
||||
//@}
|
||||
|
|
|
@ -3543,8 +3543,8 @@ local void GameGATAction(Menuitem *mi, int i)
|
|||
{
|
||||
if (!mi || mi->d.pulldown.curopt == i) {
|
||||
// FIXME: not supported
|
||||
// GameSettings.GameType = i-1;
|
||||
// ServerSetupState.GaTOpt = i;
|
||||
GameSettings.GameType = i ? SettingsGameTypeMelee + i-1 : SettingsGameTypeMapDefault;
|
||||
ServerSetupState.GaTOpt = i;
|
||||
if (mi) {
|
||||
NetworkServerResyncClients();
|
||||
}
|
||||
|
@ -3564,7 +3564,24 @@ local void CustomGameOPSAction(Menuitem *mi __attribute__((unused)), int i)
|
|||
local void MultiGameFWSAction(Menuitem *mi, int i)
|
||||
{
|
||||
if (!mi || mi->d.pulldown.curopt == i) {
|
||||
FlagRevealMap = i;
|
||||
switch (i) {
|
||||
case 0:
|
||||
TheMap.NoFogOfWar = 0;
|
||||
FlagRevealMap = 0;
|
||||
break;
|
||||
case 1:
|
||||
TheMap.NoFogOfWar = 1;
|
||||
FlagRevealMap = 0;
|
||||
break;
|
||||
case 2:
|
||||
TheMap.NoFogOfWar = 0;
|
||||
FlagRevealMap = 1;
|
||||
break;
|
||||
case 3:
|
||||
TheMap.NoFogOfWar = 1;
|
||||
FlagRevealMap = 1;
|
||||
break;
|
||||
}
|
||||
ServerSetupState.FwsOpt = i;
|
||||
if (mi) {
|
||||
NetworkServerResyncClients();
|
||||
|
@ -3933,7 +3950,6 @@ local void MultiGameSetupInit(Menuitem *mi)
|
|||
*CurrentMapPath='\0';
|
||||
}
|
||||
|
||||
FlagRevealMap = 0;
|
||||
GameSetupInit(mi);
|
||||
NetworkInitServerConnect();
|
||||
menu->items[SERVER_PLAYER_STATE] = NetMultiButtonStorage[1];
|
||||
|
@ -4195,6 +4211,10 @@ global void NetClientUpdateState(void)
|
|||
menu->items[CLIENT_TILESET].d.pulldown.curopt =
|
||||
ServerSetupState.TssOpt;
|
||||
|
||||
GameGATAction(NULL, ServerSetupState.GaTOpt);
|
||||
menu->items[CLIENT_GAMETYPE].d.pulldown.curopt =
|
||||
ServerSetupState.GaTOpt;
|
||||
|
||||
MultiClientUpdate(0);
|
||||
DebugLevel1Fn("MultiClientMenuRedraw\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue