mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +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)
|
||||
{
|
||||
ErrorCorrectionQuit();
|
||||
|
||||
// uninitmultiplayers();
|
||||
|
||||
if (CleanExit)
|
||||
{
|
||||
//SybexScreen();
|
||||
|
@ -414,7 +410,6 @@ bool InitGame()
|
|||
|
||||
numplayers = 1; myconnectindex = 0;
|
||||
connecthead = 0; connectpoint2[0] = -1;
|
||||
initsynccrc();
|
||||
|
||||
// code to duplicate packets
|
||||
if (numplayers > 4 && MovesPerPacket == 1)
|
||||
|
@ -435,7 +430,7 @@ bool InitGame()
|
|||
TileFiles.LoadArtSet("tiles%03d.art");
|
||||
InitFonts();
|
||||
|
||||
Connect();
|
||||
//Connect();
|
||||
SortBreakInfo();
|
||||
parallaxtype = 1;
|
||||
SW_InitMultiPsky();
|
||||
|
@ -908,26 +903,6 @@ void MenuLevel(void)
|
|||
if (totalclock >= 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)
|
||||
|
@ -1088,7 +1063,7 @@ void MoveLoop(void)
|
|||
{
|
||||
int pnum;
|
||||
|
||||
getpackets();
|
||||
//getpackets();
|
||||
|
||||
if (PredictionOn && CommEnabled)
|
||||
{
|
||||
|
@ -1166,16 +1141,8 @@ void InitRunLevel(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// ensure we are through the initialization code before sending the game
|
||||
// version. Otherwise, it is possible to send this too early and have it
|
||||
// blown away on the other side.
|
||||
waitforeverybody();
|
||||
#endif
|
||||
|
||||
SendVersion(GameVersion);
|
||||
|
||||
waitforeverybody();
|
||||
//SendVersion(GameVersion);
|
||||
//waitforeverybody();
|
||||
|
||||
Mus_Stop();
|
||||
|
||||
|
@ -1206,7 +1173,7 @@ void InitRunLevel(void)
|
|||
|
||||
waitforeverybody();
|
||||
|
||||
CheckVersion(GameVersion);
|
||||
//CheckVersion(GameVersion);
|
||||
|
||||
// IMPORTANT - MUST be right before game loop AFTER waitforeverybody
|
||||
InitTimingVars();
|
||||
|
@ -1522,23 +1489,11 @@ FunctionKeys(PLAYERp pp)
|
|||
|
||||
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);
|
||||
|
||||
rts_delay = 0;
|
||||
|
||||
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;
|
||||
|
@ -1546,27 +1501,9 @@ FunctionKeys(PLAYERp pp)
|
|||
|
||||
if (inputState.ShiftPressed())
|
||||
{
|
||||
if (fn_key && CommEnabled)
|
||||
if (fn_key)
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
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;
|
||||
|
|
|
@ -2284,7 +2284,6 @@ void DrawMenuLevelScreen(void); // game.c
|
|||
void DebugWriteString(char *string); // game.c
|
||||
void ManualPlayerInsert(PLAYERp pp); // game.c
|
||||
|
||||
void initsynccrc(void); // sync.c
|
||||
void getsyncstat(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
|
||||
|
||||
#define PACKET_TYPE_MASTER_TO_SLAVE 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 SYNC_TEST 0
|
||||
#define MAXSYNCBYTES 16
|
||||
|
||||
#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
|
||||
{
|
||||
|
@ -78,31 +48,6 @@ typedef struct
|
|||
SWBOOL Nuke;
|
||||
} 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)
|
||||
|
||||
extern uint8_t syncstat[MAXSYNCBYTES];
|
||||
|
@ -112,17 +57,11 @@ extern PLAYERp ppp;
|
|||
extern short predictangpos[MOVEFIFOSIZ];
|
||||
extern int predictmovefifoplc;
|
||||
extern SWBOOL Prediction;
|
||||
extern short NumSyncBytes;
|
||||
|
||||
void InitPrediction(PLAYERp pp);
|
||||
void DoPrediction(PLAYERp ppp);
|
||||
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
|
||||
{
|
||||
|
@ -172,20 +111,11 @@ extern AUTO_NET Auto;
|
|||
extern SWBOOL AutoNet;
|
||||
|
||||
void UpdateInputs(void);
|
||||
void getpackets(void);
|
||||
void SendMulitNameChange(char *new_name);
|
||||
void InitNetVars(void);
|
||||
void InitTimingVars(void);
|
||||
void PauseAction(void);
|
||||
void ResumeAction(void);
|
||||
void ErrorCorrectionQuit(void);
|
||||
void Connect(void);
|
||||
void waitforeverybody(void);
|
||||
SWBOOL MenuCommPlayerQuit(short quit_player);
|
||||
void SendVersion(int version);
|
||||
void InitNetPlayerOptions(void);
|
||||
void CheckVersion(int GameVersion);
|
||||
void SW_SendMessage(short pnum,const char *text);
|
||||
inline void SW_SendMessage(short, const char*) {}
|
||||
void ResumeGame(void);
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -672,7 +672,7 @@ extern SWBOOL InMenuLevel;
|
|||
Mus_Stop();
|
||||
else
|
||||
{
|
||||
PauseAction();
|
||||
//PauseAction();
|
||||
TerminateLevel();
|
||||
}
|
||||
StopFX();
|
||||
|
|
|
@ -31,37 +31,20 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "names2.h"
|
||||
#include "network.h"
|
||||
#include "menus.h"
|
||||
#include "m_crc32.h"
|
||||
|
||||
BEGIN_SW_NS
|
||||
|
||||
SWBOOL SyncPrintMode = TRUE;
|
||||
short NumSyncBytes = 1;
|
||||
char sync_first[MAXSYNCBYTES][60];
|
||||
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
|
||||
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
|
||||
PlayerSync(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue