mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-10 23:40:35 +00:00
- removed SW's network code.
This commit is contained in:
parent
7bb6b6a1ee
commit
f9b953eeae
6 changed files with 17 additions and 1282 deletions
|
@ -312,10 +312,6 @@ Distance(int x1, int y1, int x2, int y2)
|
||||||
|
|
||||||
void TerminateGame(void)
|
void TerminateGame(void)
|
||||||
{
|
{
|
||||||
ErrorCorrectionQuit();
|
|
||||||
|
|
||||||
// uninitmultiplayers();
|
|
||||||
|
|
||||||
if (CleanExit)
|
if (CleanExit)
|
||||||
{
|
{
|
||||||
//SybexScreen();
|
//SybexScreen();
|
||||||
|
@ -414,7 +410,6 @@ bool InitGame()
|
||||||
|
|
||||||
numplayers = 1; myconnectindex = 0;
|
numplayers = 1; myconnectindex = 0;
|
||||||
connecthead = 0; connectpoint2[0] = -1;
|
connecthead = 0; connectpoint2[0] = -1;
|
||||||
initsynccrc();
|
|
||||||
|
|
||||||
// code to duplicate packets
|
// code to duplicate packets
|
||||||
if (numplayers > 4 && MovesPerPacket == 1)
|
if (numplayers > 4 && MovesPerPacket == 1)
|
||||||
|
@ -435,7 +430,7 @@ bool InitGame()
|
||||||
TileFiles.LoadArtSet("tiles%03d.art");
|
TileFiles.LoadArtSet("tiles%03d.art");
|
||||||
InitFonts();
|
InitFonts();
|
||||||
|
|
||||||
Connect();
|
//Connect();
|
||||||
SortBreakInfo();
|
SortBreakInfo();
|
||||||
parallaxtype = 1;
|
parallaxtype = 1;
|
||||||
SW_InitMultiPsky();
|
SW_InitMultiPsky();
|
||||||
|
@ -908,26 +903,6 @@ void MenuLevel(void)
|
||||||
if (totalclock >= ototalclock + synctics)
|
if (totalclock >= ototalclock + synctics)
|
||||||
{
|
{
|
||||||
ototalclock += synctics;
|
ototalclock += synctics;
|
||||||
if (CommEnabled)
|
|
||||||
getpackets();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CommEnabled)
|
|
||||||
{
|
|
||||||
if (MultiPlayQuitFlag)
|
|
||||||
{
|
|
||||||
uint8_t pbuf[1];
|
|
||||||
QuitFlag = TRUE;
|
|
||||||
pbuf[0] = PACKET_TYPE_MENU_LEVEL_QUIT;
|
|
||||||
netbroadcastpacket(pbuf, 1); // TENSW
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerQuitMenuLevel >= 0)
|
|
||||||
{
|
|
||||||
MenuCommPlayerQuit(PlayerQuitMenuLevel);
|
|
||||||
PlayerQuitMenuLevel = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExitLevel)
|
if (ExitLevel)
|
||||||
|
@ -1088,7 +1063,7 @@ void MoveLoop(void)
|
||||||
{
|
{
|
||||||
int pnum;
|
int pnum;
|
||||||
|
|
||||||
getpackets();
|
//getpackets();
|
||||||
|
|
||||||
if (PredictionOn && CommEnabled)
|
if (PredictionOn && CommEnabled)
|
||||||
{
|
{
|
||||||
|
@ -1166,16 +1141,8 @@ void InitRunLevel(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
//SendVersion(GameVersion);
|
||||||
// ensure we are through the initialization code before sending the game
|
//waitforeverybody();
|
||||||
// version. Otherwise, it is possible to send this too early and have it
|
|
||||||
// blown away on the other side.
|
|
||||||
waitforeverybody();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SendVersion(GameVersion);
|
|
||||||
|
|
||||||
waitforeverybody();
|
|
||||||
|
|
||||||
Mus_Stop();
|
Mus_Stop();
|
||||||
|
|
||||||
|
@ -1206,7 +1173,7 @@ void InitRunLevel(void)
|
||||||
|
|
||||||
waitforeverybody();
|
waitforeverybody();
|
||||||
|
|
||||||
CheckVersion(GameVersion);
|
//CheckVersion(GameVersion);
|
||||||
|
|
||||||
// IMPORTANT - MUST be right before game loop AFTER waitforeverybody
|
// IMPORTANT - MUST be right before game loop AFTER waitforeverybody
|
||||||
InitTimingVars();
|
InitTimingVars();
|
||||||
|
@ -1522,23 +1489,11 @@ FunctionKeys(PLAYERp pp)
|
||||||
|
|
||||||
if (inputState.AltPressed())
|
if (inputState.AltPressed())
|
||||||
{
|
{
|
||||||
if (rts_delay > 16 && fn_key && CommEnabled && !adult_lockout && !Global_PLock)
|
if (rts_delay > 16 && fn_key && !adult_lockout && !Global_PLock)
|
||||||
{
|
{
|
||||||
inputState.ClearKeyStatus(sc_F1 + fn_key - 1);
|
inputState.ClearKeyStatus(sc_F1 + fn_key - 1);
|
||||||
|
|
||||||
rts_delay = 0;
|
rts_delay = 0;
|
||||||
|
|
||||||
PlaySoundRTS(fn_key);
|
PlaySoundRTS(fn_key);
|
||||||
|
|
||||||
if (CommEnabled)
|
|
||||||
{
|
|
||||||
PACKET_RTS p;
|
|
||||||
|
|
||||||
p.PacketType = PACKET_TYPE_RTS;
|
|
||||||
p.RTSnum = fn_key;
|
|
||||||
|
|
||||||
netbroadcastpacket((uint8_t*)(&p), sizeof(p)); // TENSW
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1546,27 +1501,9 @@ FunctionKeys(PLAYERp pp)
|
||||||
|
|
||||||
if (inputState.ShiftPressed())
|
if (inputState.ShiftPressed())
|
||||||
{
|
{
|
||||||
if (fn_key && CommEnabled)
|
if (fn_key)
|
||||||
{
|
{
|
||||||
inputState.ClearKeyStatus(sc_Escape);
|
|
||||||
inputState.ClearKeyStatus(sc_F1 + fn_key - 1);
|
inputState.ClearKeyStatus(sc_F1 + fn_key - 1);
|
||||||
|
|
||||||
if (CommEnabled)
|
|
||||||
{
|
|
||||||
short pnum;
|
|
||||||
|
|
||||||
sprintf(ds,"SENT: %s",**CombatMacros[fn_key-1]);
|
|
||||||
Printf(PRINT_NOTIFY | PRINT_TEAMCHAT, "%s\n", ds);
|
|
||||||
|
|
||||||
TRAVERSE_CONNECT(pnum)
|
|
||||||
{
|
|
||||||
if (pnum != myconnectindex)
|
|
||||||
{
|
|
||||||
sprintf(ds,"%s: %s",pp->PlayerName, **CombatMacros[fn_key - 1]);
|
|
||||||
SW_SendMessage(pnum, ds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2284,7 +2284,6 @@ void DrawMenuLevelScreen(void); // game.c
|
||||||
void DebugWriteString(char *string); // game.c
|
void DebugWriteString(char *string); // game.c
|
||||||
void ManualPlayerInsert(PLAYERp pp); // game.c
|
void ManualPlayerInsert(PLAYERp pp); // game.c
|
||||||
|
|
||||||
void initsynccrc(void); // sync.c
|
|
||||||
void getsyncstat(void); // sync.c
|
void getsyncstat(void); // sync.c
|
||||||
void SyncStatMessage(void); // sync.c
|
void SyncStatMessage(void); // sync.c
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,40 +26,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
#define PACKET_TYPE_MASTER_TO_SLAVE 0
|
#define SYNC_TEST 0
|
||||||
#define PACKET_TYPE_SLAVE_TO_MASTER 1
|
|
||||||
//#define PACKET_TYPE_PLAYER_NAME 3
|
|
||||||
#define PACKET_TYPE_MESSAGE 4
|
|
||||||
//#define PACKET_TYPE_GAME_INFO 8
|
|
||||||
#define PACKET_TYPE_BROADCAST 17
|
|
||||||
#define SERVER_GENERATED_BROADCAST 18
|
|
||||||
#define PACKET_TYPE_PROXY 19
|
|
||||||
|
|
||||||
#define PACKET_TYPE_NEW_GAME 30
|
|
||||||
//#define PACKET_TYPE_NEW_LEVEL 31
|
|
||||||
#define PACKET_TYPE_PLAYER_OPTIONS 32
|
|
||||||
#define PACKET_TYPE_RTS 33
|
|
||||||
#define PACKET_TYPE_DUMMY 34
|
|
||||||
#define PACKET_TYPE_MENU_LEVEL_QUIT 35
|
|
||||||
#define PACKET_TYPE_NAME_CHANGE 36
|
|
||||||
#define PACKET_TYPE_VERSION 38
|
|
||||||
|
|
||||||
#define PACKET_TYPE_NULL_PACKET 127
|
|
||||||
#define PACKET_TYPE_PLAYER_READY 250
|
|
||||||
#define PACKET_TYPE_DONT_USE 255 // old logoff
|
|
||||||
|
|
||||||
#define BIT_CODEC TRUE
|
|
||||||
#define SYNC_TEST TRUE
|
|
||||||
#define MAXSYNCBYTES 16
|
#define MAXSYNCBYTES 16
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
// Slave->Master: PlayerIndex = who to send the packet to (-1 = all)
|
|
||||||
// Master->Slave: PlayerIndex = who sent the packet originally
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t PacketType; // first byte is always packet type
|
|
||||||
uint8_t PlayerIndex;
|
|
||||||
} PACKET_PROXY,*PACKET_PROXYp;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -78,31 +48,6 @@ typedef struct
|
||||||
SWBOOL Nuke;
|
SWBOOL Nuke;
|
||||||
} PACKET_NEW_GAME,*PACKET_NEW_GAMEp;
|
} PACKET_NEW_GAME,*PACKET_NEW_GAMEp;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t PacketType; // first byte is always packet type
|
|
||||||
SWBOOL AutoRun;
|
|
||||||
uint8_t Color;
|
|
||||||
char PlayerName[32];
|
|
||||||
} PACKET_OPTIONS,*PACKET_OPTIONSp;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t PacketType; // first byte is always packet type
|
|
||||||
char PlayerName[32];
|
|
||||||
} PACKET_NAME_CHANGE,*PACKET_NAME_CHANGEp;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t PacketType; // first byte is always packet type
|
|
||||||
uint8_t RTSnum;
|
|
||||||
} PACKET_RTS,*PACKET_RTSp;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint8_t PacketType; // first byte is always packet type
|
|
||||||
int Version;
|
|
||||||
} PACKET_VERSION,*PACKET_VERSIONp;
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
extern uint8_t syncstat[MAXSYNCBYTES];
|
extern uint8_t syncstat[MAXSYNCBYTES];
|
||||||
|
@ -112,17 +57,11 @@ extern PLAYERp ppp;
|
||||||
extern short predictangpos[MOVEFIFOSIZ];
|
extern short predictangpos[MOVEFIFOSIZ];
|
||||||
extern int predictmovefifoplc;
|
extern int predictmovefifoplc;
|
||||||
extern SWBOOL Prediction;
|
extern SWBOOL Prediction;
|
||||||
extern short NumSyncBytes;
|
|
||||||
|
|
||||||
void InitPrediction(PLAYERp pp);
|
void InitPrediction(PLAYERp pp);
|
||||||
void DoPrediction(PLAYERp ppp);
|
void DoPrediction(PLAYERp ppp);
|
||||||
void CorrectPrediction(int actualfifoplc);
|
void CorrectPrediction(int actualfifoplc);
|
||||||
|
|
||||||
//TENSW: safe packet senders
|
|
||||||
void netsendpacket(int ind, uint8_t* buf, int len);
|
|
||||||
void netbroadcastpacket(uint8_t* buf, int len);
|
|
||||||
int netgetpacket(int *ind, uint8_t* buf);
|
|
||||||
|
|
||||||
|
|
||||||
enum MultiGameTypes
|
enum MultiGameTypes
|
||||||
{
|
{
|
||||||
|
@ -172,20 +111,11 @@ extern AUTO_NET Auto;
|
||||||
extern SWBOOL AutoNet;
|
extern SWBOOL AutoNet;
|
||||||
|
|
||||||
void UpdateInputs(void);
|
void UpdateInputs(void);
|
||||||
void getpackets(void);
|
|
||||||
void SendMulitNameChange(char *new_name);
|
|
||||||
void InitNetVars(void);
|
void InitNetVars(void);
|
||||||
void InitTimingVars(void);
|
void InitTimingVars(void);
|
||||||
void PauseAction(void);
|
|
||||||
void ResumeAction(void);
|
|
||||||
void ErrorCorrectionQuit(void);
|
|
||||||
void Connect(void);
|
|
||||||
void waitforeverybody(void);
|
void waitforeverybody(void);
|
||||||
SWBOOL MenuCommPlayerQuit(short quit_player);
|
|
||||||
void SendVersion(int version);
|
|
||||||
void InitNetPlayerOptions(void);
|
void InitNetPlayerOptions(void);
|
||||||
void CheckVersion(int GameVersion);
|
inline void SW_SendMessage(short, const char*) {}
|
||||||
void SW_SendMessage(short pnum,const char *text);
|
|
||||||
void ResumeGame(void);
|
void ResumeGame(void);
|
||||||
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
|
@ -672,7 +672,7 @@ extern SWBOOL InMenuLevel;
|
||||||
Mus_Stop();
|
Mus_Stop();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PauseAction();
|
//PauseAction();
|
||||||
TerminateLevel();
|
TerminateLevel();
|
||||||
}
|
}
|
||||||
StopFX();
|
StopFX();
|
||||||
|
|
|
@ -31,37 +31,20 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
#include "names2.h"
|
#include "names2.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
|
#include "m_crc32.h"
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
SWBOOL SyncPrintMode = TRUE;
|
|
||||||
short NumSyncBytes = 1;
|
|
||||||
char sync_first[MAXSYNCBYTES][60];
|
char sync_first[MAXSYNCBYTES][60];
|
||||||
int sync_found = FALSE;
|
int sync_found = FALSE;
|
||||||
|
|
||||||
static int crctable[256];
|
|
||||||
#define updatecrc(dcrc,xz) (dcrc = (crctable[((dcrc)>>8)^((xz)&255)]^((dcrc)<<8)))
|
|
||||||
|
|
||||||
void initsynccrc(void)
|
|
||||||
{
|
|
||||||
int i, j, k, a;
|
|
||||||
|
|
||||||
for (j=0; j<256; j++) //Calculate CRC table
|
|
||||||
{
|
|
||||||
k = (j<<8); a = 0;
|
|
||||||
for (i=7; i>=0; i--)
|
|
||||||
{
|
|
||||||
if (((k^a)&0x8000) > 0)
|
|
||||||
a = ((a<<1)&65535) ^ 0x1021; //0x1021 = genpoly
|
|
||||||
else
|
|
||||||
a = ((a<<1)&65535);
|
|
||||||
k = ((k<<1)&65535);
|
|
||||||
}
|
|
||||||
crctable[j] = (a&65535);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SYNC_TEST
|
#if SYNC_TEST
|
||||||
|
SWBOOL SyncPrintMode = TRUE;
|
||||||
|
short NumSyncBytes = 1;
|
||||||
|
|
||||||
|
inline void updatecrc(uint16_t& dcrc, uint8_t xz) { dcrc = (uint16_t)CRC1(dcrc, uint8_t(xz), GetCRCTable()); }
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
PlayerSync(void)
|
PlayerSync(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue