git-svn-id: https://svn.eduke32.com/eduke32@1126 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-11-11 14:48:59 +00:00
parent 5be3b76e85
commit 7aa2930514
14 changed files with 101 additions and 128 deletions

View file

@ -285,6 +285,12 @@ endif
include Makefile.deps
ifneq (0,$(ENET_NETWORKING))
duke3d_h+=$(EINC)/enet_mmulti.h
else
duke3d_h+=$(EINC)/mmulti.h
endif
.PHONY: enginelib editorlib
enginelib editorlib:
-mkdir -p $(EOBJ)

View file

@ -1,11 +1,4 @@
duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.h $(SRC)/jmact/types.h $(SRC)/jmact/file_lib.h $(SRC)/jmact/util_lib.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/control.h $(INC)/gamedefs.h $(INC)/function.h $(INC)/config.h $(INC)/sounds.h $(INC)/rts.h $(INC)/_rts.h $(INC)/soundefs.h $(SRC)/jaudiolib/fx_man.h $(SRC)/jaudiolib/music.h $(INC)/namesdyn.h $(INC)/funct.h $(INC)/duke3d.h
ifneq (0,$(ENET_NETWORKING))
duke3d_h+=$(EINC)/enet_mmulti.h
else
duke3d_h+=$(EINC)/mmulti.h
endif
gamedef_h=$(SRC)/gamedef.h
$(OBJ)/game.$o: $(SRC)/game.c $(SRC)/jmact/scriplib.h $(duke3d_h) $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h

View file

@ -22,6 +22,7 @@ EDITORLIB=build.lib
DXROOT=c:\sdks\dx6
MSSDKROOT="C:\Program Files\Microsoft Visual Studio 8\VC
PLATFORMSDK="C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK
ENETROOT=$(SRC)\enet
# /D these to enable certain features of the port's compile process
# NOASM When defined, uses C instead of assembly code
@ -44,7 +45,7 @@ CC=cl
AS=ml
RC=rc
LINK=link /opt:nowin98 /opt:ref /nologo
CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include"
CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include /I$(ENETROOT)\include"
ASFLAGS=/nologo /coff /c
EXESUFFIX=.exe
@ -66,7 +67,7 @@ ENGINEOBJS= \
$(OBJ)\lzf_d.$o \
$(OBJ)\lzwnew.$o \
$(OBJ)\md4.$o \
$(OBJ)\mmulti.$o \
$(OBJ)\mmulti_unstable.$o \
$(OBJ)\osd.$o \
$(OBJ)\pragmas.$o \
$(OBJ)\scriptfile.$o \

View file

@ -14,7 +14,7 @@ endif
SDL_FRAMEWORK = 0
# Overridden for OSes that don't have the cutdown stdc++ that is supc++
STDCPPLIB=-lstdc++
STDCPPLIB=-lsupc++
BUILDCFLAGS=
@ -84,7 +84,7 @@ ifeq ($(PLATFORM),WINDOWS)
BUILDCFLAGS+= -DHAVE_INTTYPES
EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
STDCPPLIB=-lstdc++
# STDCPPLIB=-lstdc++
endif
ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL

View file

@ -13,7 +13,7 @@ extern int natfree; //Addfaz NatFree
int initmultiplayersparms(int argc, char **argv);
int initmultiplayerscycle(void);
void initmultiplayers(int argc, char **argv, char damultioption, char dacomrateoption, char dapriority);
void initmultiplayers(int argc, char **argv);
void setpackettimeout(int datimeoutcount, int daresendagaincount);
void uninitmultiplayers(void);
void sendlogon(void);

View file

@ -3,17 +3,19 @@
void callcommit(void);
void initcrc(void);
long getcrc(char *buffer, short bufleng);
void initmultiplayers(int argc, char **argv, char damultioption, char dacomrateoption, char dapriority);
void sendpacket(long other, char *bufptr, long messleng);
void setpackettimeout(long datimeoutcount, long daresendagaincount);
int getcrc(char *buffer, int bufleng);
void initmultiplayers(int argc, char **argv);
void sendpacket(int other, char *bufptr, int messleng);
void setpackettimeout(int datimeoutcount, int daresendagaincount);
void uninitmultiplayers(void);
void sendlogon(void);
void sendlogoff(void);
int getoutputcirclesize(void);
void setsocket(short newsocket);
short getpacket(short *other, char *bufptr);
void setsocket(int newsocket);
int getpacket(int *other, char *bufptr);
void flushpackets(void);
void genericmultifunction(long other, char *bufptr, long messleng, long command);
void genericmultifunction(int other, char *bufptr, int messleng, int command);
extern int natfree;
#endif

View file

@ -13,7 +13,7 @@
#include <time.h>
#include "mmulti_unstable.h"
#include "enet/enet.h"
#include <enet/enet.h>
#include "compat.h"
#include "baselayer.h"
@ -43,7 +43,7 @@
#define updatecrc16(crc,dat) crc = (((crc<<8)&65535)^crctable[((((unsigned short)crc)>>8)&65535)^dat])
static long incnt[MAXPLAYERS], outcntplc[MAXPLAYERS], outcntend[MAXPLAYERS];
static int incnt[MAXPLAYERS], outcntplc[MAXPLAYERS], outcntend[MAXPLAYERS];
static char errorgotnum[MAXPLAYERS];
static char errorfixnum[MAXPLAYERS];
static char errorresendnum[MAXPLAYERS];
@ -51,24 +51,24 @@ static char errorresendnum[MAXPLAYERS];
static char lasterrorgotnum[MAXPLAYERS];
#endif
long crctable[256];
int crctable[256];
int tmpmax[8]; //addfaz variable addition (you could probs think of something better)
int itmp = 0; //addfaz router fix STUN
static char lastpacket[576], inlastpacket = 0;
static short lastpacketfrom, lastpacketleng;
static int lastpacketfrom, lastpacketleng;
extern long totalclock; /* MUST EXTERN 1 ANNOYING VARIABLE FROM GAME */
static long timeoutcount = 60, resendagaincount = 4, lastsendtime[MAXPLAYERS];
extern int totalclock; /* MUST EXTERN 1 ANNOYING VARIABLE FROM GAME */
static int timeoutcount = 60, resendagaincount = 4, lastsendtime[MAXPLAYERS];
int natfree; //NatFree mode flag
static short bakpacketptr[MAXPLAYERS][256], bakpacketlen[MAXPLAYERS][256];
static char bakpacketbuf[BAKSIZ];
static long bakpacketplc = 0;
static int bakpacketplc = 0;
short myconnectindex, numplayers;
short connecthead, connectpoint2[MAXPLAYERS];
int myconnectindex, numplayers;
int connecthead, connectpoint2[MAXPLAYERS];
char syncstate = 0;
#define MAXPACKETSIZE 2048
@ -83,7 +83,7 @@ typedef struct
short gametype; /* gametype: 1-serial,2-modem,3-net */
short filler;
char buffer[MAXPACKETSIZE];
long longcalladdress;
intptr_t longcalladdress;
} gcomtype;
static gcomtype *gcom;
@ -134,12 +134,12 @@ enum ECommitCMDs
gcomtype *init_network_transport(char **ARGV, int argpos);
void deinit_network_transport(gcomtype *gcom);
//void callcommit(void);
void dosendpackets(long other);
void dosendpackets(int other);
void initcrc(void)
{
long i, j, k, a;
int i, j, k, a;
for(j=0;j<256;j++) /* Calculate CRC table */
{
@ -157,23 +157,20 @@ void initcrc(void)
}
long getcrc(char *buffer, short bufleng)
int getcrc(char *buffer, int bufleng)
{
long i, j;
int i, j;
j = 0;
for(i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
return(j&65535);
}
void initmultiplayers(int argc, char **argv, char damultioption, char dacomrateoption, char dapriority)
void initmultiplayers(int argc, char **argv)
{
long i;
int i;
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(damultioption);
UNREFERENCED_PARAMETER(dacomrateoption);
UNREFERENCED_PARAMETER(dapriority);
initcrc();
for(i=0;i<MAXPLAYERS;i++)
@ -226,9 +223,9 @@ void initmultiplayers(int argc, char **argv, char damultioption, char dacomrateo
}
void dosendpackets(long other)
void dosendpackets(int other)
{
long i, j, k, messleng;
int i, j, k, messleng;
unsigned short dacrc;
if (outcntplc[other] == outcntend[other]) return;
@ -303,10 +300,10 @@ void dosendpackets(long other)
}
void sendpacket(long other, char *bufptr, long messleng)
void sendpacket(int other, char *bufptr, int messleng)
{
long i = 0;
long j = 0;
int i = 0;
int j = 0;
if (numplayers < 2) return;
@ -335,14 +332,14 @@ void sendpacket(long other, char *bufptr, long messleng)
}
void setpackettimeout(long datimeoutcount, long daresendagaincount)
void setpackettimeout(int datimeoutcount, int daresendagaincount)
{
UNREFERENCED_PARAMETER(datimeoutcount);
UNREFERENCED_PARAMETER(daresendagaincount);
// Don't do this it keeps '/f4' from working
// Though /f4 feels weird on my mouse.... slugish is the word...
/*
long i;
int i;
timeoutcount = datimeoutcount;
resendagaincount = daresendagaincount;
@ -363,7 +360,7 @@ void sendlogon(void)
void sendlogoff(void)
{
long i;
int i;
char tempbuf[2];
tempbuf[0] = 255;
@ -378,15 +375,15 @@ int getoutputcirclesize(void)
return(0);
}
void setsocket(short newsocket)
void setsocket(int newsocket)
{
UNREFERENCED_PARAMETER(newsocket);
}
short getpacket (short *other, char *bufptr)
int getpacket (int *other, char *bufptr)
{
long i, messleng;
int i, messleng;
unsigned short dacrc;
if (numplayers < 2) return(0);
@ -480,7 +477,7 @@ short getpacket (short *other, char *bufptr)
#if (PRINTERRORS)
initprintf("\n%ld-%ld .û ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
#endif
messleng = ((long)gcom->buffer[3]) + (((long)gcom->buffer[4])<<8);
messleng = ((int)gcom->buffer[3]) + (((int)gcom->buffer[4])<<8);
lastpacketleng = gcom->numbytes-7-messleng;
memcpy(bufptr,&gcom->buffer[messleng+5],lastpacketleng);
incnt[*other]++;
@ -514,7 +511,7 @@ short getpacket (short *other, char *bufptr)
initprintf("\n%ld-%ld ûû ",gcom->buffer[0],(gcom->buffer[0]+1)&255);
#endif
messleng = ((long)gcom->buffer[3]) + (((long)gcom->buffer[4])<<8);
messleng = ((int)gcom->buffer[3]) + (((int)gcom->buffer[4])<<8);
lastpacketleng = gcom->numbytes-7-messleng;
inlastpacket = 1; lastpacketfrom = *other;
@ -528,7 +525,7 @@ short getpacket (short *other, char *bufptr)
void flushpackets()
{
#if 0
long i;
int i;
if (numplayers < 2) return;
@ -551,7 +548,7 @@ void flushpackets()
#endif
}
void genericmultifunction(long other, char *bufptr, long messleng, long command)
void genericmultifunction(int other, char *bufptr, int messleng, int command)
{
if (numplayers < 2) return;
@ -563,53 +560,7 @@ void genericmultifunction(long other, char *bufptr, long messleng, long command)
}
#if STUB_NETWORKING
gcomtype *init_network_transport(char **ARGV, int argpos)
{
initprintf("No networking support built in.\n");
return NULL;
} /* init_network_transport */
void deinit_network_transport(gcomtype *gcom)
{
}
void callcommit(void)
{
}
#elif (defined PLATFORM_DOS)
gcomtype *init_network_transport(char **ARGV, int argpos)
{
/*
* How to talk to COMMIT is passed as a pointer to a block of memory
* that COMMIT.EXE configures...
*/
return((gcomtype *)atol(ARGV[argpos])); /* UGH! --ryan. */
} /* init_network_transport */
static union REGS regs;
#pragma aux longcall =\
"call eax",\
parm [eax]
void callcommit(void)
{
if (gcom->intnum&0xff00)
longcall(gcom->longcalladdress);
else
int386(gcom->intnum,&regs,&regs);
}
void deinit_network_transport(gcomtype *gcom)
{
/* no-op, apparently. */
}
#elif UDP_NETWORKING
#if UDP_NETWORKING
#if PLATFORM_WIN32
# include <winsock.h>
@ -773,8 +724,12 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize)
int i;
/* FIXME: Will this ever receive a partial packet? */
int rc = recvfrom(udpsocket, pkt, pktsize, 0,
(struct sockaddr *) &addr, (unsigned int *)&fromlen);
int rc = recvfrom(udpsocket, pkt, pktsize, 0, (struct sockaddr *) &addr,
#ifdef _WIN32
(int *)&fromlen);
#else
(unsigned int *)&fromlen);
#endif
if (rc == -1)
err = neterrno();
@ -889,8 +844,8 @@ static int get_udp_packet(int *ip, short *_port, void *pkt, size_t pktsize)
static char *read_whole_file(const char *cfgfile)
{
char *buf;
long len, rc;
long handle;
int len, rc;
int handle;
if (cfgfile == NULL)
return(NULL);
@ -949,14 +904,14 @@ static char *get_token(char **ptr)
static int set_socket_blockmode(int onOrOff)
{
unsigned long flags;
unsigned int flags;
int rc = 0;
/* set socket to be (non-)blocking. */
#if PLATFORM_WIN32
flags = (onOrOff) ? 0 : 1;
rc = (ioctlsocket(udpsocket, FIONBIO, &flags) == 0);
rc = (ioctlsocket(udpsocket, FIONBIO, (void *) &flags) == 0);
#else
flags = fcntl(udpsocket, F_GETFL, 0);
if ((signed)flags != -1)
@ -1085,7 +1040,7 @@ static int connect_to_everyone(gcomtype *gcom, int myip, int bcast)
short port;
int first_send = 1;
unsigned short heard_from[MAX_PLAYERS];
unsigned long resendat;
unsigned int resendat;
int max;
int remaining;
@ -1124,6 +1079,9 @@ static int connect_to_everyone(gcomtype *gcom, int myip, int bcast)
while ((remaining) && (!ctrlc_pressed))
{
handleevents();
if (quitevent) ctrlc_pressed = 1;
if (resendat <= getticks())
{
if (bcast)

View file

@ -104,6 +104,10 @@
RelativePath=".\build\include\editor.h"
>
</File>
<File
RelativePath=".\build\include\enet_mmulti.h"
>
</File>
<File
RelativePath=".\build\include\glbuild.h"
>
@ -136,6 +140,10 @@
RelativePath=".\build\include\mmulti.h"
>
</File>
<File
RelativePath=".\build\include\mmulti_unstable.h"
>
</File>
<File
RelativePath=".\build\include\mmultimsgs.h"
>
@ -232,6 +240,10 @@
RelativePath=".\build\src\dynamicgtk.c"
>
</File>
<File
RelativePath=".\build\src\enet_mmulti.cpp"
>
</File>
<File
RelativePath=".\build\src\engine.c"
>
@ -284,6 +296,10 @@
RelativePath=".\build\src\mmulti_null.c"
>
</File>
<File
RelativePath=".\build\src\mmulti_unstable.c"
>
</File>
<File
RelativePath=".\build\src\osd.c"
>

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h>
#endif
#define BUILDDATE " 20081107"
#define BUILDDATE " 20081111"
#define VERSION " 1.2.0devel"
static int floor_over_floor;

View file

@ -583,14 +583,8 @@ extern input_t loc;
extern input_t recsync[RECSYNCBUFSIZ];
extern int avgfvel, avgsvel, avgavel, avghorz, avgbits, avgextbits;
#ifdef ENET_NETWORKING
// HACK: should be changed in the enet network backend
extern short numplayers, myconnectindex;
extern short connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers)
#else
extern int numplayers, myconnectindex;
extern int connecthead, connectpoint2[MAXPLAYERS]; //Player linked list variables (indeces, not connection numbers)
#endif
extern int screenpeek;
extern int current_menu;

View file

@ -651,12 +651,7 @@ int lastpackettime = 0;
void getpackets(void)
{
int i, j, k, l;
#ifdef ENET_NETWORKING
// HACK, type should be changed in the enet network backend
short other;
#else
int other;
#endif
int packbufleng;
input_t *osyn, *nsyn;
@ -8896,9 +8891,7 @@ static void comlinehelp(void)
"-r\t\tRecord demo\n"
"-rmnet FILE\tUse FILE for network play configuration (see documentation)\n"
"-keepaddr\n"
#ifndef ENET_NETWORKING
"-stun\n"
#endif
"-w\t\tShow coordinates"
"-noautoload\tDo not use the autoload directory\n"
"-nologo\t\tSkip the logo anim\n"
@ -9610,13 +9603,13 @@ static void checkcommandline(int argc, const char **argv)
i++;
continue;
}
#ifndef ENET_NETWORKING
if (!Bstrcasecmp(c+1,"stun"))
{
natfree = 1; //Addfaz NatFree
i++;
continue;
}
#ifndef ENET_NETWORKING
if (!Bstrcasecmp(c+1,"rmnet"))
{
if (argc > i+1)
@ -9630,7 +9623,11 @@ static void checkcommandline(int argc, const char **argv)
continue;
}
#endif
if (!Bstrcasecmp(c+1,"net"))
if (!Bstrcasecmp(c+1,"net")
#ifdef ENET_NETWORKING
|| !Bstrcasecmp(c+1,"rmnet")
#endif
)
{
g_NoSetup = TRUE;
firstnet = i;
@ -10544,7 +10541,14 @@ static void Startup(void)
#ifdef ENET_NETWORKING
// TODO: split this up in the same fine-grained manner as eduke32 network backend, to
// allow for event handling
initmultiplayers(netparamcount,netparam, 0,0,0);
initmultiplayers(netparamcount,netparam);
if (quitevent)
{
Shutdown();
return;
}
#else
if (initmultiplayersparms(netparamcount,netparam))
{
@ -10978,7 +10982,6 @@ void app_main(int argc,const char **argv)
#endif
#ifdef _WIN32
#ifndef ENET_NETWORKING
if (ud.config.CheckForUpdates == -1)
{
i=wm_ynbox("Automatic Release Notification",
@ -11029,7 +11032,6 @@ void app_main(int argc,const char **argv)
else initprintf("update: failed to check for updates\n");
}
}
#endif
#endif
if (preinitengine())
{

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "duke3d.h"
char *s_builddate = "20081107";
char *s_builddate = "20081111";
char *MusicPtr = NULL;
int Musicsize;

View file

@ -348,7 +348,7 @@ int AL_Init()
void AL_Stop();
void AL_Shutdown()
{
if (openal_disabled)return;
if (openal_disabled || !device) return;
initprintf("Uninitializing OpenAL...\n");
AL_Stop();

View file

@ -403,6 +403,7 @@ static int osdcmd_rate(const osdfuncparm_t *parm)
}
else OSD_Printf("rate: value out of range\n");
#endif
UNREFERENCED_PARAMETER(parm);
return OSDCMD_OK;
}