Semiworking mp

This commit is contained in:
nukeykt 2019-07-04 04:04:38 +09:00 committed by Christoph Oelckers
parent 3ce70b7c3a
commit 20420dc702
8 changed files with 21 additions and 19 deletions

View file

@ -60,7 +60,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define NUMPAGES 1 #define NUMPAGES 1
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3 #define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
#define MOVEFIFOSIZ 2 #define MOVEFIFOSIZ 256
// KEEPINSYNC lunatic/con_lang.lua // KEEPINSYNC lunatic/con_lang.lua
#define MAXVOLUMES 7 #define MAXVOLUMES 7

View file

@ -2628,8 +2628,8 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
} }
*/ */
if (g_netClient) // [75] The server should not overwrite its own randomseed //if (g_netClient) // [75] The server should not overwrite its own randomseed
randomseed = ticrandomseed; // randomseed = ticrandomseed;
if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS)) if (EDUKE32_PREDICT_FALSE((unsigned)vm.pSprite->sectnum >= MAXSECTORS))
{ {

View file

@ -3666,8 +3666,8 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
if (g_netServer) if (g_netServer)
{ {
Net_FillNewGame(&pendingnewgame, 1); Net_FillNewGame(&pendingnewgame, 1);
Net_StartNewGame();
Net_SendNewGame(1, NULL); Net_SendNewGame(1, NULL);
Net_StartNewGame();
} }
else if (voting == -1) else if (voting == -1)
{ {

View file

@ -108,7 +108,7 @@ void Net_SyncPlayer(ENetEvent *event)
Net_SendPlayerIndex(i, event->peer); Net_SendPlayerIndex(i, event->peer);
Net_SendClientInfo(); Net_SendClientInfo();
Net_SendUserMapName(); Net_SendUserMapName();
Net_SendNewGame(0, event->peer); // Net_SendNewGame(0, event->peer);
} }
//void Net_SpawnPlayer(int32_t player) //void Net_SpawnPlayer(int32_t player)
@ -149,6 +149,7 @@ void Net_WaitForEverybody(void)
{ {
if (numplayers < 2) return; if (numplayers < 2) return;
packbuf[0] = PACKET_TYPE_PLAYER_READY;
g_player[myconnectindex].playerreadyflag++; g_player[myconnectindex].playerreadyflag++;
// if we're a peer or slave, not a master // if we're a peer or slave, not a master
@ -2561,7 +2562,7 @@ void Net_SendPacket(int dest, uint8_t *pbuf, int32_t packbufleng)
uint8_t* buffer = packet->data; uint8_t* buffer = packet->data;
*buffer++ = myconnectindex; *buffer++ = myconnectindex;
Bmemcpy(buffer, pbuf, packbufleng); Bmemcpy(buffer, pbuf, packbufleng);
enet_peer_send(g_netPlayerPeer[dest], CHAN_GAME, packet); enet_peer_send(g_netClientPeer, CHAN_GAME, packet);
} }
else else
{ {
@ -2570,7 +2571,7 @@ void Net_SendPacket(int dest, uint8_t *pbuf, int32_t packbufleng)
*buffer++ = dest; *buffer++ = dest;
*buffer++ = myconnectindex; *buffer++ = myconnectindex;
Bmemcpy(buffer, pbuf, packbufleng); Bmemcpy(buffer, pbuf, packbufleng);
enet_peer_send(g_netPlayerPeer[dest], CHAN_REROUTE, packet); enet_peer_send(g_netClientPeer, CHAN_REROUTE, packet);
} }
enet_host_service(g_netClient, NULL, 0); enet_host_service(g_netClient, NULL, 0);
} }

View file

@ -1121,8 +1121,8 @@ growspark_rr:
shootAng = pSprite->ang + (krand2() & 31) - 16; shootAng = pSprite->ang + (krand2() & 31) - 16;
} }
if (numplayers > 1 && g_netClient) //if (numplayers > 1 && g_netClient)
return -1; // return -1;
if (RRRA && projecTile == RRTILE1790) if (RRRA && projecTile == RRTILE1790)
{ {
@ -4478,8 +4478,8 @@ void P_FragPlayer(int playerNum)
DukePlayer_t *const pPlayer = g_player[playerNum].ps; DukePlayer_t *const pPlayer = g_player[playerNum].ps;
spritetype *const pSprite = &sprite[pPlayer->i]; spritetype *const pSprite = &sprite[pPlayer->i];
if (g_netClient) // [75] The server should not overwrite its own randomseed //if (g_netClient) // [75] The server should not overwrite its own randomseed
randomseed = ticrandomseed; // randomseed = ticrandomseed;
if (pSprite->pal != 1) if (pSprite->pal != 1)
{ {
@ -4880,7 +4880,7 @@ static void P_ProcessWeapon(int playerNum)
if (pPlayer->ammo_amount[RPG_WEAPON]) if (pPlayer->ammo_amount[RPG_WEAPON])
pPlayer->ammo_amount[RPG_WEAPON]--; pPlayer->ammo_amount[RPG_WEAPON]--;
if (numplayers < 2 || g_netServer) //if (numplayers < 2 || g_netServer)
{ {
int pipeBombZvel; int pipeBombZvel;
int pipeBombFwdVel; int pipeBombFwdVel;
@ -5443,7 +5443,7 @@ static void P_ProcessWeapon(int playerNum)
{ {
pPlayer->ammo_amount[pPlayer->curr_weapon]--; pPlayer->ammo_amount[pPlayer->curr_weapon]--;
if (numplayers < 2 || g_netServer) //if (numplayers < 2 || g_netServer)
{ {
int pipeBombZvel; int pipeBombZvel;
int pipeBombFwdVel; int pipeBombFwdVel;
@ -6091,7 +6091,7 @@ static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ,
if (ud.recstat == 1 && (!g_netServer && ud.multimode < 2)) if (ud.recstat == 1 && (!g_netServer && ud.multimode < 2))
G_CloseDemoWrite(); G_CloseDemoWrite();
if ((numplayers < 2 || g_netServer) && pPlayer->dead_flag == 0) if (/*(numplayers < 2 || g_netServer) && */pPlayer->dead_flag == 0)
P_FragPlayer(playerNum); P_FragPlayer(playerNum);
if (sectorLotag == ST_2_UNDERWATER) if (sectorLotag == ST_2_UNDERWATER)

View file

@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "inv.h" #include "inv.h"
#include "namesdyn.h" #include "namesdyn.h"
#include "fix16.h" #include "fix16.h"
#include "net.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -33,7 +34,7 @@ extern "C" {
extern int32_t g_mostConcurrentPlayers; extern int32_t g_mostConcurrentPlayers;
#define MOVEFIFOSIZ 2 #define MOVEFIFOSIZ 256
#define NAM_GRENADE_LIFETIME 120 #define NAM_GRENADE_LIFETIME 120
#define NAM_GRENADE_LIFETIME_VAR 30 #define NAM_GRENADE_LIFETIME_VAR 30
@ -219,7 +220,7 @@ typedef struct {
char vote, gotvote, playerreadyflag, playerquitflag, connected; char vote, gotvote, playerreadyflag, playerquitflag, connected;
char user_name[32]; char user_name[32];
char syncval[MAXPLAYERS][MOVEFIFOSIZ]; char syncval[SYNCFIFOSIZ][MAXSYNCBYTES];
} playerdata_t; } playerdata_t;
#pragma pack(pop) #pragma pack(pop)

View file

@ -2096,7 +2096,7 @@ static void resetpspritevars(char gameMode)
s->xoffset = 0; s->xoffset = 0;
s->clipdist = 64; s->clipdist = 64;
// if (j < g_mostConcurrentPlayers) if (j < g_mostConcurrentPlayers)
{ {
if ((gameMode&MODE_EOL) != MODE_EOL || g_player[j].ps->last_extra == 0) if ((gameMode&MODE_EOL) != MODE_EOL || g_player[j].ps->last_extra == 0)
{ {

View file

@ -2380,8 +2380,8 @@ void Sect_DamageCeiling(int const sectNum)
// hard coded props... :( // hard coded props... :(
void A_DamageObject(int spriteNum, int const dmgSrc) void A_DamageObject(int spriteNum, int const dmgSrc)
{ {
if (g_netClient) //if (g_netClient)
return; // return;
spriteNum &= (MAXSPRITES-1); spriteNum &= (MAXSPRITES-1);