mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 00:21:38 +00:00
mostly multiplayer fixes among other things
git-svn-id: https://svn.eduke32.com/eduke32@1672 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2335302486
commit
1102b74a35
28 changed files with 315 additions and 548 deletions
|
@ -98,8 +98,7 @@ else
|
||||||
EOBJ=eobj
|
EOBJ=eobj
|
||||||
endif
|
endif
|
||||||
|
|
||||||
JMACTOBJ=$(OBJ)/util_lib.$o \
|
JMACTOBJ=$(OBJ)/file_lib.$o \
|
||||||
$(OBJ)/file_lib.$o \
|
|
||||||
$(OBJ)/control.$o \
|
$(OBJ)/control.$o \
|
||||||
$(OBJ)/keyboard.$o \
|
$(OBJ)/keyboard.$o \
|
||||||
$(OBJ)/mouse.$o \
|
$(OBJ)/mouse.$o \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.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 $(JAUDIOLIBDIR)/include/fx_man.h $(JAUDIOLIBDIR)/include/music.h $(INC)/namesdyn.h $(INC)/funct.h $(INC)/duke3d.h
|
duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.h $(SRC)/jmact/file_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 $(JAUDIOLIBDIR)/include/fx_man.h $(JAUDIOLIBDIR)/include/music.h $(INC)/namesdyn.h $(INC)/funct.h $(INC)/duke3d.h
|
||||||
gamedef_h=$(SRC)/gamedef.h
|
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
|
$(OBJ)/game.$o: $(SRC)/game.c $(SRC)/jmact/scriplib.h $(duke3d_h) $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h
|
||||||
|
@ -36,14 +36,13 @@ $(OBJ)/startgtk.game.$o: $(SRC)/startgtk.game.c $(duke3d_h) $(EINC)/dynamicgtk.h
|
||||||
|
|
||||||
|
|
||||||
# jMACT objects
|
# jMACT objects
|
||||||
$(OBJ)/animlib.$o: $(SRC)/jmact/animlib.c $(SRC)/jmact/util_lib.h $(SRC)/jmact/animlib.h $(EINC)/compat.h
|
$(OBJ)/animlib.$o: $(SRC)/jmact/animlib.c $(SRC)/jmact/animlib.h $(EINC)/compat.h
|
||||||
$(OBJ)/util_lib.$o: $(SRC)/jmact/util_lib.c $(SRC)/jmact/util_lib.h $(EINC)/compat.h
|
|
||||||
$(OBJ)/file_lib.$o: $(SRC)/jmact/file_lib.c $(SRC)/jmact/file_lib.h
|
$(OBJ)/file_lib.$o: $(SRC)/jmact/file_lib.c $(SRC)/jmact/file_lib.h
|
||||||
$(OBJ)/control.$o: $(SRC)/jmact/control.c $(SRC)/jmact/control.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/mouse.h $(EINC)/baselayer.h
|
$(OBJ)/control.$o: $(SRC)/jmact/control.c $(SRC)/jmact/control.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/mouse.h $(EINC)/baselayer.h
|
||||||
$(OBJ)/keyboard.$o: $(SRC)/jmact/keyboard.c $(SRC)/jmact/keyboard.h $(EINC)/compat.h $(EINC)/baselayer.h
|
$(OBJ)/keyboard.$o: $(SRC)/jmact/keyboard.c $(SRC)/jmact/keyboard.h $(EINC)/compat.h $(EINC)/baselayer.h
|
||||||
$(OBJ)/mouse.$o: $(SRC)/jmact/mouse.c $(SRC)/jmact/mouse.h $(EINC)/baselayer.h
|
$(OBJ)/mouse.$o: $(SRC)/jmact/mouse.c $(SRC)/jmact/mouse.h $(EINC)/baselayer.h
|
||||||
$(OBJ)/mathutil.$o: $(SRC)/jmact/mathutil.c
|
$(OBJ)/mathutil.$o: $(SRC)/jmact/mathutil.c
|
||||||
$(OBJ)/scriplib.$o: $(SRC)/jmact/scriplib.c $(SRC)/jmact/scriplib.h $(SRC)/jmact/util_lib.h $(SRC)/jmact/_scrplib.h $(EINC)/compat.h
|
$(OBJ)/scriplib.$o: $(SRC)/jmact/scriplib.c $(SRC)/jmact/scriplib.h $(SRC)/jmact/_scrplib.h $(EINC)/compat.h
|
||||||
|
|
||||||
# jAudioLib objects
|
# jAudioLib objects
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,7 @@ LIBS=$(LIBS) msvcrtd.lib
|
||||||
LIBS=$(LIBS) msvcrt.lib msvcrt_winxp.obj
|
LIBS=$(LIBS) msvcrt.lib msvcrt_winxp.obj
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
JMACTOBJ=$(OBJ)\util_lib.$o \
|
JMACTOBJ=$(OBJ)\file_lib.$o \
|
||||||
$(OBJ)\file_lib.$o \
|
|
||||||
$(OBJ)\control.$o \
|
$(OBJ)\control.$o \
|
||||||
$(OBJ)\keyboard.$o \
|
$(OBJ)\keyboard.$o \
|
||||||
$(OBJ)\mouse.$o \
|
$(OBJ)\mouse.$o \
|
||||||
|
|
|
@ -352,9 +352,9 @@ int32_t writesetup(const char *fn)
|
||||||
"\n"
|
"\n"
|
||||||
#endif
|
#endif
|
||||||
"; 3D mode brightness setting\n"
|
"; 3D mode brightness setting\n"
|
||||||
"vid_gamma = %f\n"
|
"vid_gamma = %g\n"
|
||||||
"vid_brightness = %f\n"
|
"vid_brightness = %g\n"
|
||||||
"vid_contrast = %f\n"
|
"vid_contrast = %g\n"
|
||||||
"\n"
|
"\n"
|
||||||
"; Game executable used for map testing\n"
|
"; Game executable used for map testing\n"
|
||||||
"gameexecutable = %s\n"
|
"gameexecutable = %s\n"
|
||||||
|
|
|
@ -152,7 +152,6 @@
|
||||||
<ClInclude Include="source\jmact\mathutil.h" />
|
<ClInclude Include="source\jmact\mathutil.h" />
|
||||||
<ClInclude Include="source\jmact\mouse.h" />
|
<ClInclude Include="source\jmact\mouse.h" />
|
||||||
<ClInclude Include="source\jmact\scriplib.h" />
|
<ClInclude Include="source\jmact\scriplib.h" />
|
||||||
<ClInclude Include="source\jmact\util_lib.h" />
|
|
||||||
<ClInclude Include="source\enet\include\enet\callbacks.h" />
|
<ClInclude Include="source\enet\include\enet\callbacks.h" />
|
||||||
<ClInclude Include="source\enet\include\enet\enet.h" />
|
<ClInclude Include="source\enet\include\enet\enet.h" />
|
||||||
<ClInclude Include="source\enet\include\enet\list.h" />
|
<ClInclude Include="source\enet\include\enet\list.h" />
|
||||||
|
@ -248,7 +247,6 @@
|
||||||
<ClCompile Include="source\jmact\mathutil.c" />
|
<ClCompile Include="source\jmact\mathutil.c" />
|
||||||
<ClCompile Include="source\jmact\mouse.c" />
|
<ClCompile Include="source\jmact\mouse.c" />
|
||||||
<ClCompile Include="source\jmact\scriplib.c" />
|
<ClCompile Include="source\jmact\scriplib.c" />
|
||||||
<ClCompile Include="source\jmact\util_lib.c" />
|
|
||||||
<ClCompile Include="source\enet\src\callbacks.c" />
|
<ClCompile Include="source\enet\src\callbacks.c" />
|
||||||
<ClCompile Include="source\enet\src\host.c" />
|
<ClCompile Include="source\enet\src\host.c" />
|
||||||
<ClCompile Include="source\enet\src\list.c" />
|
<ClCompile Include="source\enet\src\list.c" />
|
||||||
|
|
|
@ -279,9 +279,6 @@
|
||||||
<ClInclude Include="source\jmact\scriplib.h">
|
<ClInclude Include="source\jmact\scriplib.h">
|
||||||
<Filter>jmact\headers</Filter>
|
<Filter>jmact\headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\jmact\util_lib.h">
|
|
||||||
<Filter>jmact\headers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="source\enet\include\enet\callbacks.h">
|
<ClInclude Include="source\enet\include\enet\callbacks.h">
|
||||||
<Filter>enet\headers</Filter>
|
<Filter>enet\headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -569,9 +566,6 @@
|
||||||
<ClCompile Include="source\jmact\scriplib.c">
|
<ClCompile Include="source\jmact\scriplib.c">
|
||||||
<Filter>jmact\source</Filter>
|
<Filter>jmact\source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\jmact\util_lib.c">
|
|
||||||
<Filter>jmact\source</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\enet\src\callbacks.c">
|
<ClCompile Include="source\enet\src\callbacks.c">
|
||||||
<Filter>enet\source</Filter>
|
<Filter>enet\source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -9321,29 +9321,6 @@ static void Keys2d3d(void)
|
||||||
|
|
||||||
if (getmessageleng > 0)
|
if (getmessageleng > 0)
|
||||||
{
|
{
|
||||||
// charsperline = 64;
|
|
||||||
//if (dimensionmode[snum] == 2) charsperline = 80;
|
|
||||||
/* if (qsetmode == 200)
|
|
||||||
{
|
|
||||||
for (i=0;i<=getmessageleng;i+=charsperline)
|
|
||||||
{
|
|
||||||
for (j=0;j<charsperline;j++)
|
|
||||||
tempbuf[j] = getmessage[i+j];
|
|
||||||
if (getmessageleng < i+charsperline)
|
|
||||||
tempbuf[(getmessageleng-i)] = 0;
|
|
||||||
else
|
|
||||||
tempbuf[charsperline] = 0;
|
|
||||||
begindrawing();
|
|
||||||
if (tempbuf[charsperline] != 0)
|
|
||||||
{
|
|
||||||
printext256((MESSAGEX*(xdimgame/320.))+2,(MESSAGEY*(ydimgame/200.))+2,0,-1,tempbuf,xdimgame>640?0:1);
|
|
||||||
printext256(MESSAGEX*(xdimgame/320.),MESSAGEY*(ydimgame/200.),
|
|
||||||
(totalclock > (lastmessagetime + 120*5))?whitecol:256-5,-1,tempbuf,xdimgame>640?0:1);
|
|
||||||
}
|
|
||||||
enddrawing();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else */
|
|
||||||
if (qsetmode != 200)
|
if (qsetmode != 200)
|
||||||
printmessage16(getmessage);
|
printmessage16(getmessage);
|
||||||
if (totalclock > getmessagetimeoff)
|
if (totalclock > getmessagetimeoff)
|
||||||
|
@ -9463,16 +9440,7 @@ void ExtCheckKeys(void)
|
||||||
|
|
||||||
void faketimerhandler(void)
|
void faketimerhandler(void)
|
||||||
{
|
{
|
||||||
int32_t i, dist, angdiff;
|
|
||||||
int32_t hiz, hihit, loz, lohit, oposx, oposy;
|
|
||||||
int16_t hitwall, daang;
|
|
||||||
|
|
||||||
// counter++;
|
|
||||||
// if (counter>=5) counter=0;
|
|
||||||
|
|
||||||
sampletimer();
|
sampletimer();
|
||||||
// if (totalclock < ototalclock+TICSPERFRAME || qsetmode != 200)
|
|
||||||
// return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBOSS1Palette(void)
|
void SetBOSS1Palette(void)
|
||||||
|
|
|
@ -110,7 +110,6 @@ extern int32_t g_scriptVersion, g_Shareware, g_gameType;
|
||||||
#include "file_lib.h"
|
#include "file_lib.h"
|
||||||
#include "gamedefs.h"
|
#include "gamedefs.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "mathutil.h"
|
#include "mathutil.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
#include "fx_man.h"
|
#include "fx_man.h"
|
||||||
|
@ -594,7 +593,7 @@ extern int32_t animatevel[MAXANIMATES];
|
||||||
extern int16_t neartagsector, neartagwall, neartagsprite;
|
extern int16_t neartagsector, neartagwall, neartagsprite;
|
||||||
extern int32_t neartaghitdist;
|
extern int32_t neartaghitdist;
|
||||||
extern int16_t animatesect[MAXANIMATES];
|
extern int16_t animatesect[MAXANIMATES];
|
||||||
extern int32_t movefifoplc, vel,svel,angvel,horiz;
|
extern int32_t vel,svel,angvel,horiz;
|
||||||
|
|
||||||
extern int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
extern int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
||||||
|
|
||||||
|
@ -650,10 +649,6 @@ extern vec3_t my, omy, myvel;
|
||||||
extern int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff, g_skillSoundID;
|
extern int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff, g_skillSoundID;
|
||||||
extern int16_t myang, omyang, mycursectnum, myjumpingcounter;
|
extern int16_t myang, omyang, mycursectnum, myjumpingcounter;
|
||||||
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||||
extern int32_t predictfifoplc;
|
|
||||||
extern int32_t myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
|
|
||||||
extern int32_t myhorizbak[MOVEFIFOSIZ];
|
|
||||||
extern int16_t myangbak[MOVEFIFOSIZ];
|
|
||||||
|
|
||||||
extern int16_t BlimpSpawnSprites[15];
|
extern int16_t BlimpSpawnSprites[15];
|
||||||
|
|
||||||
|
@ -674,36 +669,22 @@ extern int32_t g_cameraDistance, g_cameraClock, g_playerFriction,g_showShareware
|
||||||
extern int32_t g_gameQuit;
|
extern int32_t g_gameQuit;
|
||||||
|
|
||||||
extern int32_t playerswhenstarted;
|
extern int32_t playerswhenstarted;
|
||||||
|
extern int8_t multiwho, multipos, multiwhat, multiflag;
|
||||||
|
|
||||||
extern char pus,pub;
|
extern char pus,pub;
|
||||||
extern int32_t g_damageCameras,g_freezerSelfDamage,g_tripbombLaserMode;
|
extern int32_t g_damageCameras,g_freezerSelfDamage,g_tripbombLaserMode;
|
||||||
|
|
||||||
// TENSW: on really bad network connections, the sync FIFO queue can overflow if it is the
|
|
||||||
// same size as the move fifo.
|
|
||||||
#define MAXSYNCBYTES 16
|
|
||||||
#define SYNCFIFOSIZ 1024
|
|
||||||
|
|
||||||
extern char syncstat[MAXSYNCBYTES];
|
|
||||||
extern int8_t multiwho, multipos, multiwhat, multiflag;
|
|
||||||
extern int32_t syncvaltail, syncvaltottail;
|
|
||||||
extern int32_t g_numFreezeBounces,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius;
|
extern int32_t g_numFreezeBounces,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius;
|
||||||
extern int32_t g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
|
extern int32_t g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
|
||||||
extern int32_t everyothertime;
|
extern int32_t everyothertime;
|
||||||
extern int32_t mymaxlag, otherminlag, bufferjitter;
|
|
||||||
|
|
||||||
extern int32_t g_numInterpolations, startofdynamicinterpolations;
|
extern int32_t g_numInterpolations, startofdynamicinterpolations;
|
||||||
extern int32_t g_interpolationLock;
|
extern int32_t g_interpolationLock;
|
||||||
extern int32_t oldipos[MAXINTERPOLATIONS];
|
extern int32_t oldipos[MAXINTERPOLATIONS];
|
||||||
extern int32_t bakipos[MAXINTERPOLATIONS];
|
extern int32_t bakipos[MAXINTERPOLATIONS];
|
||||||
extern int32_t *curipos[MAXINTERPOLATIONS];
|
extern int32_t *curipos[MAXINTERPOLATIONS];
|
||||||
|
|
||||||
extern int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
extern int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
||||||
extern int32_t cloudtotalclock,totalmemory;
|
extern int32_t cloudtotalclock;
|
||||||
|
|
||||||
extern int32_t stereomode, stereowidth, stereopixelwidth;
|
|
||||||
|
|
||||||
extern int32_t g_myAimMode, g_myAimStat, g_oldAimStat;
|
extern int32_t g_myAimMode, g_myAimStat, g_oldAimStat;
|
||||||
|
|
||||||
extern uint32_t g_moveThingsCount;
|
extern uint32_t g_moveThingsCount;
|
||||||
|
|
||||||
#define IFISGLMODE if (getrendermode() >= 3)
|
#define IFISGLMODE if (getrendermode() >= 3)
|
||||||
|
@ -1060,14 +1041,13 @@ typedef struct {
|
||||||
DukePlayer_t *ps;
|
DukePlayer_t *ps;
|
||||||
input_t *sync;
|
input_t *sync;
|
||||||
|
|
||||||
int32_t movefifoend, syncvalhead;
|
int32_t netsynctime;
|
||||||
int16_t ping, filler;
|
int16_t ping, filler;
|
||||||
int32_t pcolor, pteam;
|
int32_t pcolor, pteam;
|
||||||
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
|
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
|
||||||
|
|
||||||
char vote, gotvote, playerreadyflag, playerquitflag;
|
char vote, gotvote, playerreadyflag, playerquitflag;
|
||||||
char user_name[32];
|
char user_name[32];
|
||||||
char syncval[SYNCFIFOSIZ][MAXSYNCBYTES];
|
|
||||||
} playerdata_t;
|
} playerdata_t;
|
||||||
|
|
||||||
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
||||||
|
|
|
@ -41,7 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "gamedef.h"
|
#include "gamedef.h"
|
||||||
#include "kplib.h"
|
#include "kplib.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "hightile.h"
|
#include "hightile.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
|
||||||
|
@ -59,6 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#include "winlayer.h"
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
@ -83,7 +83,9 @@ int32_t g_netDisconnect = 0;
|
||||||
int8_t g_netStatnums[] = { STAT_PROJECTILE, STAT_STANDABLE, STAT_ACTIVATOR, STAT_TRANSPORT,
|
int8_t g_netStatnums[] = { STAT_PROJECTILE, STAT_STANDABLE, STAT_ACTIVATOR, STAT_TRANSPORT,
|
||||||
STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR, STAT_MISC };
|
STAT_EFFECTOR, STAT_ACTOR, STAT_ZOMBIEACTOR, STAT_MISC };
|
||||||
char g_netPassword[32];
|
char g_netPassword[32];
|
||||||
|
int32_t g_netSync = 0;
|
||||||
int32_t g_quitDeadline = 0;
|
int32_t g_quitDeadline = 0;
|
||||||
|
int32_t g_netPlayersWaiting = 0;
|
||||||
|
|
||||||
int32_t g_scriptSanityChecks = 1;
|
int32_t g_scriptSanityChecks = 1;
|
||||||
|
|
||||||
|
@ -822,7 +824,7 @@ void Net_NewGame(int32_t volume, int32_t level)
|
||||||
static mapstate_t *g_multiMapState = NULL;
|
static mapstate_t *g_multiMapState = NULL;
|
||||||
static int32_t spritecrc[MAXSPRITES], lastupdate[MAXSPRITES], sectcrc[MAXSECTORS], lastsectupdate[MAXSECTORS];
|
static int32_t spritecrc[MAXSPRITES], lastupdate[MAXSPRITES], sectcrc[MAXSECTORS], lastsectupdate[MAXSECTORS];
|
||||||
static int32_t wallcrc[MAXWALLS], lastwallupdate[MAXWALLS];
|
static int32_t wallcrc[MAXWALLS], lastwallupdate[MAXWALLS];
|
||||||
static int32_t peractorvals[MAXGAMEVARS][MAXSPRITES], perplayervals[MAXGAMEVARS][MAXPLAYERS];
|
static int32_t peractorvals[MAXSPRITES][MAXGAMEVARS], perplayervals[MAXPLAYERS][MAXGAMEVARS];
|
||||||
|
|
||||||
// sends a simple crc32 of the current password, verified by the server before the connection can continue
|
// sends a simple crc32 of the current password, verified by the server before the connection can continue
|
||||||
static void Net_SendChallenge(void)
|
static void Net_SendChallenge(void)
|
||||||
|
@ -891,24 +893,23 @@ void Net_SyncPlayer(ENetEvent * event)
|
||||||
{
|
{
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
|
|
||||||
|
g_netPlayersWaiting++;
|
||||||
|
|
||||||
S_PlaySound(DUKE_GETWEAPON2);
|
S_PlaySound(DUKE_GETWEAPON2);
|
||||||
|
|
||||||
TRAVERSE_CONNECT(i)
|
TRAVERSE_CONNECT(i)
|
||||||
if (!g_player[i].playerquitflag)
|
if (g_player[i].playerquitflag == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// open a new slot if necessary
|
// open a new slot if necessary
|
||||||
event->peer->data = (void *)((intptr_t) (i = (i == -1 ? playerswhenstarted++ : i)));
|
event->peer->data = (void *)((intptr_t) (i = (i == -1 ? playerswhenstarted++ : i)));
|
||||||
|
|
||||||
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
|
g_player[i].netsynctime = totalclock;
|
||||||
g_player[i].movefifoend = 1;
|
g_player[i].playerquitflag = 1;
|
||||||
|
|
||||||
for (j=0; j<playerswhenstarted-1; j++) connectpoint2[j] = j+1;
|
for (j=0; j<playerswhenstarted-1; j++) connectpoint2[j] = j+1;
|
||||||
connectpoint2[playerswhenstarted-1] = -1;
|
connectpoint2[playerswhenstarted-1] = -1;
|
||||||
|
|
||||||
numplayers++;
|
|
||||||
ud.multimode++;
|
|
||||||
|
|
||||||
TRAVERSE_CONNECT(j)
|
TRAVERSE_CONNECT(j)
|
||||||
{
|
{
|
||||||
if (!g_player[j].ps) g_player[j].ps = (DukePlayer_t *) Bcalloc(1, sizeof(DukePlayer_t));
|
if (!g_player[j].ps) g_player[j].ps = (DukePlayer_t *) Bcalloc(1, sizeof(DukePlayer_t));
|
||||||
|
@ -916,9 +917,9 @@ void Net_SyncPlayer(ENetEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
packbuf[0] = PACKET_NUM_PLAYERS;
|
packbuf[0] = PACKET_NUM_PLAYERS;
|
||||||
packbuf[1] = numplayers;
|
packbuf[1] = ++numplayers;
|
||||||
packbuf[2] = playerswhenstarted;
|
packbuf[2] = playerswhenstarted;
|
||||||
packbuf[3] = ud.multimode;
|
packbuf[3] = ++ud.multimode;
|
||||||
packbuf[4] = i;
|
packbuf[4] = i;
|
||||||
packbuf[5] = myconnectindex;
|
packbuf[5] = myconnectindex;
|
||||||
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 6, ENET_PACKET_FLAG_RELIABLE));
|
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 6, ENET_PACKET_FLAG_RELIABLE));
|
||||||
|
@ -936,23 +937,11 @@ void Net_SyncPlayer(ENetEvent * event)
|
||||||
if (g_multiMapState == NULL) g_multiMapState = Bcalloc(1, sizeof(mapstate_t));
|
if (g_multiMapState == NULL) g_multiMapState = Bcalloc(1, sizeof(mapstate_t));
|
||||||
if (g_multiMapState)
|
if (g_multiMapState)
|
||||||
{
|
{
|
||||||
char * buf = Bmalloc(sizeof(mapstate_t)<<1);
|
char * buf = (char *)Bmalloc(sizeof(mapstate_t)<<1);
|
||||||
|
|
||||||
j = g_player[i].ps->i;
|
sprite[g_player[i].ps->i].cstat = 32768;
|
||||||
Bmemcpy(g_player[i].ps, g_player[0].ps, sizeof(DukePlayer_t));
|
|
||||||
|
|
||||||
g_player[i].ps->i = j;
|
|
||||||
changespritestat(j, STAT_PLAYER);
|
|
||||||
|
|
||||||
P_ResetStatus(i);
|
|
||||||
P_ResetWeapons(i);
|
|
||||||
P_ResetInventory(i);
|
|
||||||
|
|
||||||
g_player[i].ps->last_extra = g_player[i].ps->max_player_health;
|
|
||||||
sprite[g_player[i].ps->i].extra = g_player[i].ps->max_player_health;
|
|
||||||
sprite[g_player[i].ps->i].cstat = 1+256;
|
|
||||||
g_player[i].ps->runspeed = g_playerFriction;
|
g_player[i].ps->runspeed = g_playerFriction;
|
||||||
g_player[i].ps->frag_ps = i;
|
g_player[i].ps->last_extra = sprite[g_player[i].ps->i].extra = g_player[i].ps->max_player_health;
|
||||||
|
|
||||||
G_SaveMapState(g_multiMapState);
|
G_SaveMapState(g_multiMapState);
|
||||||
j = qlz_compress((char *)g_multiMapState, buf, sizeof(mapstate_t), state_compress);
|
j = qlz_compress((char *)g_multiMapState, buf, sizeof(mapstate_t), state_compress);
|
||||||
|
@ -964,9 +953,11 @@ void Net_SyncPlayer(ENetEvent * event)
|
||||||
enet_packet_create((char *)(buf)+qlz_size_compressed(buf)-j, SYNCPACKETSIZE, ENET_PACKET_FLAG_RELIABLE));
|
enet_packet_create((char *)(buf)+qlz_size_compressed(buf)-j, SYNCPACKETSIZE, ENET_PACKET_FLAG_RELIABLE));
|
||||||
j -= SYNCPACKETSIZE;
|
j -= SYNCPACKETSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...except for this one. A non-SYNCPACKETSIZE packet on CHAN_SYNC doubles as the signal that the transfer is done.
|
// ...except for this one. A non-SYNCPACKETSIZE packet on CHAN_SYNC doubles as the signal that the transfer is done.
|
||||||
enet_peer_send(event->peer, CHAN_SYNC,
|
enet_peer_send(event->peer, CHAN_SYNC,
|
||||||
enet_packet_create((char *)(buf)+qlz_size_compressed(buf)-j, j, ENET_PACKET_FLAG_RELIABLE));
|
enet_packet_create((char *)(buf)+qlz_size_compressed(buf)-j, j, ENET_PACKET_FLAG_RELIABLE));
|
||||||
|
|
||||||
Bfree(buf);
|
Bfree(buf);
|
||||||
Bfree(g_multiMapState);
|
Bfree(g_multiMapState);
|
||||||
g_multiMapState = NULL;
|
g_multiMapState = NULL;
|
||||||
|
@ -988,12 +979,12 @@ void Net_ParseServerPacket(ENetEvent * event)
|
||||||
switch (packbuf[0])
|
switch (packbuf[0])
|
||||||
{
|
{
|
||||||
case PACKET_MASTER_TO_SLAVE: //[0] (receive master sync buffer)
|
case PACKET_MASTER_TO_SLAVE: //[0] (receive master sync buffer)
|
||||||
if (!(g_player[myconnectindex].ps->gm & MODE_GAME)) return;
|
if (!(g_player[myconnectindex].ps->gm & MODE_GAME) || g_netSync) return;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
packbufleng = qlz_size_decompressed((char *)&packbuf[1]);
|
packbufleng = qlz_size_decompressed((char *)&packbuf[1]);
|
||||||
packbuf = Bcalloc(1, packbufleng+1);
|
packbuf = (uint8_t *)Bcalloc(1, packbufleng+1);
|
||||||
packbufleng = qlz_decompress((char *)&event->packet->data[1], (char *)(packbuf), state_decompress);
|
packbufleng = qlz_decompress((char *)&event->packet->data[1], (char *)(packbuf), state_decompress);
|
||||||
|
|
||||||
ticrandomseed = *(int32_t *)&packbuf[j];
|
ticrandomseed = *(int32_t *)&packbuf[j];
|
||||||
|
@ -1005,6 +996,8 @@ void Net_ParseServerPacket(ENetEvent * event)
|
||||||
g_player[i].ps->dead_flag = *(int16_t *)&packbuf[j];
|
g_player[i].ps->dead_flag = *(int16_t *)&packbuf[j];
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
|
||||||
|
g_player[i].playerquitflag = packbuf[j++];
|
||||||
|
|
||||||
if (i == myconnectindex && !g_player[i].ps->dead_flag)
|
if (i == myconnectindex && !g_player[i].ps->dead_flag)
|
||||||
{
|
{
|
||||||
j += offsetof(input_t, filler) +
|
j += offsetof(input_t, filler) +
|
||||||
|
@ -1018,16 +1011,19 @@ void Net_ParseServerPacket(ENetEvent * event)
|
||||||
Bmemcpy(&nsyn[i], &packbuf[j], offsetof(input_t, filler));
|
Bmemcpy(&nsyn[i], &packbuf[j], offsetof(input_t, filler));
|
||||||
j += offsetof(input_t, filler);
|
j += offsetof(input_t, filler);
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(nsyn[i].bits,SK_GAMEQUIT)) g_player[i].playerquitflag = 0;
|
// if (TEST_SYNC_KEY(nsyn[i].bits,SK_GAMEQUIT)) g_player[i].playerquitflag = 0;
|
||||||
g_player[i].movefifoend++;
|
|
||||||
//if (g_player[i].playerquitflag == 0) continue;
|
if (g_player[i].playerquitflag == 0) continue;
|
||||||
|
|
||||||
// Bmemcpy(&g_player[i].ps->opos.x, &g_player[i].ps->pos.x, sizeof(vec3_t));
|
// Bmemcpy(&g_player[i].ps->opos.x, &g_player[i].ps->pos.x, sizeof(vec3_t));
|
||||||
|
|
||||||
Bmemcpy(&g_player[i].ps->pos.x, &packbuf[j], sizeof(vec3_t) * 2);
|
Bmemcpy(&g_player[i].ps->pos.x, &packbuf[j], sizeof(vec3_t) * 2);
|
||||||
|
if (g_player[i].ps->cursectnum >= 0 && g_player[i].ps->cursectnum < numsectors)
|
||||||
|
{
|
||||||
updatesectorz(g_player[i].ps->pos.x, g_player[i].ps->pos.y, g_player[i].ps->pos.z,
|
updatesectorz(g_player[i].ps->pos.x, g_player[i].ps->pos.y, g_player[i].ps->pos.z,
|
||||||
&g_player[i].ps->cursectnum);
|
&g_player[i].ps->cursectnum);
|
||||||
changespritesect(g_player[i].ps->i, g_player[i].ps->cursectnum);
|
changespritesect(g_player[i].ps->i, g_player[i].ps->cursectnum);
|
||||||
|
}
|
||||||
Bmemcpy(&sprite[g_player[i].ps->i], &packbuf[j], sizeof(vec3_t));
|
Bmemcpy(&sprite[g_player[i].ps->i], &packbuf[j], sizeof(vec3_t));
|
||||||
sprite[g_player[i].ps->i].z += PHEIGHT;
|
sprite[g_player[i].ps->i].z += PHEIGHT;
|
||||||
j += sizeof(vec3_t) * 2;
|
j += sizeof(vec3_t) * 2;
|
||||||
|
@ -1103,7 +1099,6 @@ process:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int16_t var_id = *(int16_t *)&packbuf[j];
|
int16_t var_id = *(int16_t *)&packbuf[j];
|
||||||
|
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
|
||||||
if (var_id == MAXGAMEVARS) break;
|
if (var_id == MAXGAMEVARS) break;
|
||||||
|
@ -1118,7 +1113,6 @@ process:
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int16_t var_id = *(int16_t *)&packbuf[j];
|
int16_t var_id = *(int16_t *)&packbuf[j];
|
||||||
|
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
|
||||||
if (var_id == MAXGAMEVARS) break;
|
if (var_id == MAXGAMEVARS) break;
|
||||||
|
@ -1278,7 +1272,6 @@ process:
|
||||||
ud.coop = ud.m_coop;
|
ud.coop = ud.m_coop;
|
||||||
|
|
||||||
if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
|
if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PACKET_VERSION:
|
case PACKET_VERSION:
|
||||||
|
@ -1300,7 +1293,7 @@ process:
|
||||||
ud.multimode = packbuf[3];
|
ud.multimode = packbuf[3];
|
||||||
if (packbuf[4]) // ID of new player
|
if (packbuf[4]) // ID of new player
|
||||||
{
|
{
|
||||||
clearbufbyte(&g_player[packbuf[4]].playerquitflag,1,0x01010101);
|
g_player[packbuf[4]].playerquitflag = 1;
|
||||||
|
|
||||||
if (!g_player[packbuf[4]].ps) g_player[packbuf[4]].ps = (DukePlayer_t *) Bcalloc(1,sizeof(DukePlayer_t));
|
if (!g_player[packbuf[4]].ps) g_player[packbuf[4]].ps = (DukePlayer_t *) Bcalloc(1,sizeof(DukePlayer_t));
|
||||||
if (!g_player[packbuf[4]].sync) g_player[packbuf[4]].sync = (input_t *) Bcalloc(1,sizeof(input_t));
|
if (!g_player[packbuf[4]].sync) g_player[packbuf[4]].sync = (input_t *) Bcalloc(1,sizeof(input_t));
|
||||||
|
@ -1319,19 +1312,20 @@ process:
|
||||||
// receive client player index from server
|
// receive client player index from server
|
||||||
case PACKET_PLAYER_INDEX:
|
case PACKET_PLAYER_INDEX:
|
||||||
myconnectindex = packbuf[1];
|
myconnectindex = packbuf[1];
|
||||||
clearbufbyte(&g_player[myconnectindex].playerquitflag,1,0x01010101);
|
g_player[myconnectindex].playerquitflag = 1;
|
||||||
Net_SendClientInfo();
|
Net_SendClientInfo();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PACKET_PLAYER_DISCONNECTED:
|
case PACKET_PLAYER_DISCONNECTED:
|
||||||
numplayers--;
|
if ((g_player[myconnectindex].ps->gm & MODE_GAME) && !g_netSync)
|
||||||
ud.multimode--;
|
|
||||||
|
|
||||||
P_RemovePlayer(packbuf[1]);
|
P_RemovePlayer(packbuf[1]);
|
||||||
|
numplayers = packbuf[2];
|
||||||
|
ud.multimode = packbuf[3];
|
||||||
|
playerswhenstarted = packbuf[4];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PACKET_PLAYER_SPAWN:
|
case PACKET_PLAYER_SPAWN:
|
||||||
|
if (!(g_player[myconnectindex].ps->gm & MODE_GAME) || g_netSync) break;
|
||||||
P_ResetPlayer(packbuf[1]);
|
P_ResetPlayer(packbuf[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1340,8 +1334,10 @@ process:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PACKET_FRAG:
|
case PACKET_FRAG:
|
||||||
|
if (!(g_player[myconnectindex].ps->gm & MODE_GAME) || g_netSync) break;
|
||||||
g_player[packbuf[1]].ps->frag_ps = packbuf[2];
|
g_player[packbuf[1]].ps->frag_ps = packbuf[2];
|
||||||
actor[g_player[packbuf[1]].ps->i].picnum = packbuf[3];
|
actor[g_player[packbuf[1]].ps->i].picnum = packbuf[3];
|
||||||
|
ticrandomseed = *(int32_t *)&packbuf[4];
|
||||||
P_FragPlayer(packbuf[1]);
|
P_FragPlayer(packbuf[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1360,6 +1356,8 @@ process:
|
||||||
j = i;
|
j = i;
|
||||||
for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i];
|
for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i];
|
||||||
|
|
||||||
|
g_player[other].playerquitflag = 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1452,34 +1450,6 @@ process:
|
||||||
G_LoadPlayer(multipos);
|
G_LoadPlayer(multipos);
|
||||||
multiflag = 0;
|
multiflag = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PACKET_REQUEST_GAMESTATE:
|
|
||||||
if (g_netServer && g_player[0].ps->gm & MODE_GAME)
|
|
||||||
{
|
|
||||||
packbuf[0] = PACKET_NEW_GAME;
|
|
||||||
packbuf[1] = ud.level_number;
|
|
||||||
packbuf[2] = ud.volume_number;
|
|
||||||
packbuf[3] = ud.player_skill+1;
|
|
||||||
packbuf[4] = ud.monsters_off;
|
|
||||||
packbuf[5] = ud.respawn_monsters;
|
|
||||||
packbuf[6] = ud.respawn_items;
|
|
||||||
packbuf[7] = ud.respawn_inventory;
|
|
||||||
packbuf[8] = ud.coop;
|
|
||||||
packbuf[9] = ud.marker;
|
|
||||||
packbuf[10] = ud.ffire;
|
|
||||||
packbuf[11] = ud.noexits;
|
|
||||||
packbuf[12] = myconnectindex;
|
|
||||||
|
|
||||||
enet_peer_send(event->peer, CHAN_GAMESTATE, enet_packet_create(packbuf, 13, ENET_PACKET_FLAG_RELIABLE));
|
|
||||||
|
|
||||||
// a player connecting is a good time to mark everything as needing to be updated
|
|
||||||
Bmemset(spritecrc, 0, sizeof(spritecrc));
|
|
||||||
Bmemset(sectcrc, 0, sizeof(sectcrc));
|
|
||||||
Bmemset(wallcrc, 0, sizeof(wallcrc));
|
|
||||||
Bmemset(peractorvals, 0, sizeof(peractorvals));
|
|
||||||
Bmemset(perplayervals, 0, sizeof(perplayervals));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1509,8 +1479,6 @@ void Net_ParseClientPacket(ENetEvent * event)
|
||||||
|
|
||||||
j += offsetof(input_t, filler);
|
j += offsetof(input_t, filler);
|
||||||
|
|
||||||
g_player[other].movefifoend++;
|
|
||||||
|
|
||||||
// anyone the server thinks is dead can go fuck themselves
|
// anyone the server thinks is dead can go fuck themselves
|
||||||
if (g_player[other].ps->dead_flag)
|
if (g_player[other].ps->dead_flag)
|
||||||
{
|
{
|
||||||
|
@ -1744,11 +1712,47 @@ void Net_ParseClientPacket(ENetEvent * event)
|
||||||
|
|
||||||
enet_peer_send(event->peer, CHAN_GAMESTATE, enet_packet_create(packbuf, 13, ENET_PACKET_FLAG_RELIABLE));
|
enet_peer_send(event->peer, CHAN_GAMESTATE, enet_packet_create(packbuf, 13, ENET_PACKET_FLAG_RELIABLE));
|
||||||
|
|
||||||
// a player connecting is a good time to mark everything as needing to be updated
|
j = g_player[other].ps->i;
|
||||||
Bmemset(spritecrc, 0, sizeof(spritecrc));
|
Bmemcpy(g_player[other].ps, g_player[0].ps, sizeof(DukePlayer_t));
|
||||||
Bmemset(sectcrc, 0, sizeof(sectcrc));
|
|
||||||
Bmemset(wallcrc, 0, sizeof(wallcrc));
|
g_player[other].ps->i = j;
|
||||||
Bmemset(peractorvals, 0, sizeof(peractorvals));
|
changespritestat(j, STAT_PLAYER);
|
||||||
|
|
||||||
|
P_ResetStatus(other);
|
||||||
|
P_ResetWeapons(other);
|
||||||
|
P_ResetInventory(other);
|
||||||
|
|
||||||
|
g_player[other].ps->last_extra = sprite[g_player[other].ps->i].extra = g_player[other].ps->max_player_health;
|
||||||
|
sprite[g_player[other].ps->i].cstat = 1+256;
|
||||||
|
actor[g_player[other].ps->i].t_data[2] = actor[g_player[other].ps->i].t_data[3] = actor[g_player[other].ps->i].t_data[4] = 0;
|
||||||
|
|
||||||
|
g_netPlayersWaiting--;
|
||||||
|
|
||||||
|
// a player connecting is a good time to mark things as needing to be updated
|
||||||
|
// we invalidate everything that has changed since we started sending the snapshot of the map to the new player
|
||||||
|
|
||||||
|
{
|
||||||
|
int32_t zz, i, nexti;
|
||||||
|
|
||||||
|
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++)
|
||||||
|
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
|
||||||
|
{
|
||||||
|
if (lastupdate[i] >= g_player[other].netsynctime)
|
||||||
|
{
|
||||||
|
spritecrc[i] = 0xdeadbeef;
|
||||||
|
Bmemset(peractorvals[i], 0, sizeof(int32_t) * g_gameVarCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=numwalls-1; i>=0; i--)
|
||||||
|
if (lastwallupdate[i] >= g_player[other].netsynctime)
|
||||||
|
wallcrc[i] = 0xdeadbeef;
|
||||||
|
|
||||||
|
for (i=numsectors-1; i>=0; i--)
|
||||||
|
if (lastsectupdate[i] >= g_player[other].netsynctime)
|
||||||
|
sectcrc[i] = 0xdeadbeef;
|
||||||
|
|
||||||
Bmemset(perplayervals, 0, sizeof(perplayervals));
|
Bmemset(perplayervals, 0, sizeof(perplayervals));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1798,6 +1802,7 @@ void Net_GetPackets(void)
|
||||||
}
|
}
|
||||||
Net_SendVersion(event.peer);
|
Net_SendVersion(event.peer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
/*
|
/*
|
||||||
initprintf ("A packet of length %u containing %s was received from player %d on channel %u.\n",
|
initprintf ("A packet of length %u containing %s was received from player %d on channel %u.\n",
|
||||||
|
@ -1812,14 +1817,15 @@ void Net_GetPackets(void)
|
||||||
if ((event.channelID == CHAN_GAMESTATE && event.packet->data[0] > PACKET_BROADCAST) || event.channelID == CHAN_CHAT)
|
if ((event.channelID == CHAN_GAMESTATE && event.packet->data[0] > PACKET_BROADCAST) || event.channelID == CHAN_CHAT)
|
||||||
{
|
{
|
||||||
event.peer->state = ENET_PEER_STATE_DISCONNECTED;
|
event.peer->state = ENET_PEER_STATE_DISCONNECTED;
|
||||||
enet_host_broadcast(g_netServer, event.channelID, event.packet);
|
enet_host_broadcast(g_netServer, event.channelID,
|
||||||
|
enet_packet_create(event.packet->data, event.packet->dataLength, event.packet->flags));
|
||||||
event.peer->state = ENET_PEER_STATE_CONNECTED;
|
event.peer->state = ENET_PEER_STATE_CONNECTED;
|
||||||
}
|
}
|
||||||
else enet_packet_destroy(event.packet);
|
|
||||||
|
|
||||||
|
enet_packet_destroy(event.packet);
|
||||||
g_player[(intptr_t)event.peer->data].ping = (event.peer->lastRoundTripTime + event.peer->roundTripTime)/2;
|
g_player[(intptr_t)event.peer->data].ping = (event.peer->lastRoundTripTime + event.peer->roundTripTime)/2;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
numplayers--;
|
numplayers--;
|
||||||
ud.multimode--;
|
ud.multimode--;
|
||||||
|
@ -1828,12 +1834,17 @@ void Net_GetPackets(void)
|
||||||
|
|
||||||
packbuf[0] = PACKET_PLAYER_DISCONNECTED;
|
packbuf[0] = PACKET_PLAYER_DISCONNECTED;
|
||||||
packbuf[1] = (intptr_t)event.peer->data;
|
packbuf[1] = (intptr_t)event.peer->data;
|
||||||
packbuf[2] = myconnectindex;
|
packbuf[2] = numplayers;
|
||||||
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 3, ENET_PACKET_FLAG_RELIABLE));
|
packbuf[3] = ud.multimode;
|
||||||
|
packbuf[4] = playerswhenstarted;
|
||||||
|
packbuf[5] = myconnectindex;
|
||||||
|
|
||||||
|
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 6, ENET_PACKET_FLAG_RELIABLE));
|
||||||
|
|
||||||
initprintf("%s disconnected.\n", g_player[(intptr_t)event.peer->data].user_name);
|
initprintf("%s disconnected.\n", g_player[(intptr_t)event.peer->data].user_name);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1867,13 +1878,12 @@ void Net_GetPackets(void)
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
datasiz = 0;
|
datasiz = 0;
|
||||||
|
g_netSync = 1;
|
||||||
if (g_multiMapState == NULL)
|
|
||||||
g_multiMapState = (mapstate_t *)Bcalloc(1, sizeof(mapstate_t));
|
|
||||||
|
|
||||||
buf = Bcalloc(1, sizeof(mapstate_t)<<1);
|
buf = Bcalloc(1, sizeof(mapstate_t)<<1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_multiMapState = (mapstate_t *)Brealloc(g_multiMapState, sizeof(mapstate_t));
|
||||||
|
|
||||||
if (buf && event.packet->dataLength == SYNCPACKETSIZE)
|
if (buf && event.packet->dataLength == SYNCPACKETSIZE)
|
||||||
{
|
{
|
||||||
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
|
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
|
||||||
|
@ -1884,9 +1894,12 @@ void Net_GetPackets(void)
|
||||||
{
|
{
|
||||||
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
|
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
|
||||||
datasiz = 0;
|
datasiz = 0;
|
||||||
|
g_netSync = 0;
|
||||||
if (qlz_size_decompressed((const char *)buf) == sizeof(mapstate_t))
|
if (qlz_size_decompressed((const char *)buf) == sizeof(mapstate_t))
|
||||||
{
|
{
|
||||||
qlz_decompress((const char *)buf, g_multiMapState, state_decompress);
|
qlz_decompress((const char *)buf, g_multiMapState, state_decompress);
|
||||||
|
Bfree(buf);
|
||||||
|
buf = NULL;
|
||||||
|
|
||||||
packbuf[0] = PACKET_REQUEST_GAMESTATE;
|
packbuf[0] = PACKET_REQUEST_GAMESTATE;
|
||||||
packbuf[1] = myconnectindex;
|
packbuf[1] = myconnectindex;
|
||||||
|
@ -1895,21 +1908,22 @@ void Net_GetPackets(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initprintf("Invalid map state from server!\n");
|
initprintf("Invalid map state from server!\n");
|
||||||
|
Bfree(buf);
|
||||||
|
buf = NULL;
|
||||||
g_netDisconnect = 1;
|
g_netDisconnect = 1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initprintf("Error allocating buffer for map state!\n");
|
initprintf("Error allocating buffer for map state!\n");
|
||||||
g_netDisconnect = 1;
|
g_netDisconnect = 1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else Net_ParseServerPacket(&event);
|
else Net_ParseServerPacket(&event);
|
||||||
|
|
||||||
enet_packet_destroy(event.packet);
|
enet_packet_destroy(event.packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
g_netDisconnect = 1;
|
g_netDisconnect = 1;
|
||||||
numplayers = playerswhenstarted = ud.multimode = 1;
|
numplayers = playerswhenstarted = ud.multimode = 1;
|
||||||
|
@ -1946,6 +1960,7 @@ void Net_UpdateClients(void)
|
||||||
|
|
||||||
if (!g_netServer || numplayers < 2)
|
if (!g_netServer || numplayers < 2)
|
||||||
{
|
{
|
||||||
|
ticrandomseed = randomseed;
|
||||||
if (g_netServer)
|
if (g_netServer)
|
||||||
Bmemcpy(&osyn[0], &nsyn[0], sizeof(input_t));
|
Bmemcpy(&osyn[0], &nsyn[0], sizeof(input_t));
|
||||||
return;
|
return;
|
||||||
|
@ -1965,9 +1980,12 @@ void Net_UpdateClients(void)
|
||||||
*(int16_t *)&packbuf[j] = g_player[i].ps->dead_flag;
|
*(int16_t *)&packbuf[j] = g_player[i].ps->dead_flag;
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
|
||||||
|
packbuf[j++] = g_player[i].playerquitflag;
|
||||||
|
|
||||||
Bmemcpy(&packbuf[j], &nsyn[i], offsetof(input_t, filler));
|
Bmemcpy(&packbuf[j], &nsyn[i], offsetof(input_t, filler));
|
||||||
j += offsetof(input_t, filler);
|
j += offsetof(input_t, filler);
|
||||||
//if (g_player[i].playerquitflag == 0) continue;
|
|
||||||
|
if (g_player[i].playerquitflag == 0) continue;
|
||||||
|
|
||||||
Bmemcpy(&packbuf[j], &g_player[i].ps->pos.x, sizeof(vec3_t) * 2);
|
Bmemcpy(&packbuf[j], &g_player[i].ps->pos.x, sizeof(vec3_t) * 2);
|
||||||
j += sizeof(vec3_t) * 2;
|
j += sizeof(vec3_t) * 2;
|
||||||
|
@ -2053,9 +2071,9 @@ void Net_UpdateClients(void)
|
||||||
{
|
{
|
||||||
if ((aGameVars[ii].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NOMULTI)) == GAMEVAR_PERACTOR && aGameVars[ii].val.plValues)
|
if ((aGameVars[ii].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NOMULTI)) == GAMEVAR_PERACTOR && aGameVars[ii].val.plValues)
|
||||||
{
|
{
|
||||||
if (peractorvals[ii][i] != aGameVars[ii].val.plValues[i])
|
if (peractorvals[i][ii] != aGameVars[ii].val.plValues[i])
|
||||||
{
|
{
|
||||||
peractorvals[ii][i] = aGameVars[ii].val.plValues[i];
|
peractorvals[i][ii] = aGameVars[ii].val.plValues[i];
|
||||||
|
|
||||||
*(int16_t *)&packbuf[j] = ii;
|
*(int16_t *)&packbuf[j] = ii;
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
@ -2077,9 +2095,9 @@ void Net_UpdateClients(void)
|
||||||
{
|
{
|
||||||
if ((aGameVars[ii].dwFlags & (GAMEVAR_PERPLAYER|GAMEVAR_NOMULTI)) == GAMEVAR_PERPLAYER && aGameVars[ii].val.plValues)
|
if ((aGameVars[ii].dwFlags & (GAMEVAR_PERPLAYER|GAMEVAR_NOMULTI)) == GAMEVAR_PERPLAYER && aGameVars[ii].val.plValues)
|
||||||
{
|
{
|
||||||
if (perplayervals[ii][i] != aGameVars[ii].val.plValues[i])
|
if (perplayervals[i][ii] != aGameVars[ii].val.plValues[i])
|
||||||
{
|
{
|
||||||
perplayervals[ii][i] = aGameVars[ii].val.plValues[i];
|
perplayervals[i][ii] = aGameVars[ii].val.plValues[i];
|
||||||
|
|
||||||
*(int16_t *)&packbuf[j] = ii;
|
*(int16_t *)&packbuf[j] = ii;
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
@ -2155,9 +2173,9 @@ void Net_UpdateClients(void)
|
||||||
{
|
{
|
||||||
if ((aGameVars[ii].dwFlags & GAMEVAR_PERACTOR) && aGameVars[ii].val.plValues)
|
if ((aGameVars[ii].dwFlags & GAMEVAR_PERACTOR) && aGameVars[ii].val.plValues)
|
||||||
{
|
{
|
||||||
if (peractorvals[ii][i] != aGameVars[ii].val.plValues[i])
|
if (peractorvals[i][ii] != aGameVars[ii].val.plValues[i])
|
||||||
{
|
{
|
||||||
peractorvals[ii][i] = aGameVars[ii].val.plValues[i];
|
peractorvals[i][ii] = aGameVars[ii].val.plValues[i];
|
||||||
|
|
||||||
*(int16_t *)&packbuf[j] = ii;
|
*(int16_t *)&packbuf[j] = ii;
|
||||||
j += sizeof(int16_t);
|
j += sizeof(int16_t);
|
||||||
|
@ -2240,12 +2258,14 @@ void Net_UpdateClients(void)
|
||||||
packbuf[j++] = myconnectindex;
|
packbuf[j++] = myconnectindex;
|
||||||
|
|
||||||
enet_host_broadcast(g_netServer, CHAN_MOVE, enet_packet_create(packbuf, j, 0));
|
enet_host_broadcast(g_netServer, CHAN_MOVE, enet_packet_create(packbuf, j, 0));
|
||||||
|
|
||||||
movefifosendplc++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void faketimerhandler(void)
|
void faketimerhandler(void)
|
||||||
{
|
{
|
||||||
|
if (g_netServer)
|
||||||
|
enet_host_service(g_netServer, NULL, 0);
|
||||||
|
else if (g_netClient)
|
||||||
|
enet_host_service(g_netClient, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int32_t cacnum;
|
extern int32_t cacnum;
|
||||||
|
@ -2288,9 +2308,10 @@ int32_t A_CheckInventorySprite(spritetype *s)
|
||||||
case HOLODUKE__STATIC:
|
case HOLODUKE__STATIC:
|
||||||
case AIRTANK__STATIC:
|
case AIRTANK__STATIC:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void G_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation)
|
void G_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation)
|
||||||
{
|
{
|
||||||
|
@ -4326,7 +4347,8 @@ static void G_ShowScores(void)
|
||||||
|
|
||||||
for (i=playerswhenstarted-1; i>=0; i--)
|
for (i=playerswhenstarted-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
if (!g_player[i].playerquitflag) continue;
|
if (!g_player[i].playerquitflag)
|
||||||
|
continue;
|
||||||
|
|
||||||
minitext(70,SCORESHEETOFFSET+90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+128);
|
minitext(70,SCORESHEETOFFSET+90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+128);
|
||||||
|
|
||||||
|
@ -11105,7 +11127,11 @@ void app_main(int32_t argc,const char **argv)
|
||||||
int32_t i = 0, j;
|
int32_t i = 0, j;
|
||||||
char cwd[BMAX_PATH];
|
char cwd[BMAX_PATH];
|
||||||
// extern char datetimestring[];
|
// extern char datetimestring[];
|
||||||
|
#ifdef NEDMALLOC
|
||||||
ENetCallbacks callbacks = { Bmalloc, Bfree, NULL };
|
ENetCallbacks callbacks = { Bmalloc, Bfree, NULL };
|
||||||
|
#else
|
||||||
|
ENetCallbacks callbacks = { NULL, NULL, NULL };
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RENDERTYPEWIN
|
#ifdef RENDERTYPEWIN
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
|
@ -11156,9 +11182,6 @@ void app_main(int32_t argc,const char **argv)
|
||||||
wm_setapptitle(tempbuf);
|
wm_setapptitle(tempbuf);
|
||||||
|
|
||||||
initprintf(HEAD2 " %s\n", s_buildDate);
|
initprintf(HEAD2 " %s\n", s_buildDate);
|
||||||
// initprintf("Compiled %s\n",datetimestring);
|
|
||||||
// initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n");
|
|
||||||
// initprintf("Copyright (c) 2008 EDuke32 team and contributors\n");
|
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
addsearchpath("/usr/share/games/jfduke3d");
|
addsearchpath("/usr/share/games/jfduke3d");
|
||||||
|
@ -11570,10 +11593,7 @@ CLEAN_DIRECTORY:
|
||||||
if (g_scriptDebug)
|
if (g_scriptDebug)
|
||||||
initprintf("CON debugging activated (level %d).\n",g_scriptDebug);
|
initprintf("CON debugging activated (level %d).\n",g_scriptDebug);
|
||||||
|
|
||||||
RegisterShutdownFunction(G_Shutdown);
|
|
||||||
|
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
|
|
||||||
connectpoint2[0] = -1;
|
connectpoint2[0] = -1;
|
||||||
|
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
@ -11584,7 +11604,7 @@ CLEAN_DIRECTORY:
|
||||||
{
|
{
|
||||||
if (!g_player[i].ps) g_player[i].ps = (DukePlayer_t *) Bcalloc(1,sizeof(DukePlayer_t));
|
if (!g_player[i].ps) g_player[i].ps = (DukePlayer_t *) Bcalloc(1,sizeof(DukePlayer_t));
|
||||||
if (!g_player[i].sync) g_player[i].sync = (input_t *) Bcalloc(1,sizeof(input_t));
|
if (!g_player[i].sync) g_player[i].sync = (input_t *) Bcalloc(1,sizeof(input_t));
|
||||||
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
|
g_player[i].playerquitflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_player[myconnectindex].ps->palette = (uint8_t *) &palette[0];
|
g_player[myconnectindex].ps->palette = (uint8_t *) &palette[0];
|
||||||
|
@ -11862,20 +11882,23 @@ MAIN_LOOP_RESTART:
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sampletimer();
|
sampletimer();
|
||||||
|
|
||||||
if ((totalclock < ototalclock+TICSPERFRAME) || (ready2send == 0)) break;
|
if (ready2send == 0) break;
|
||||||
ototalclock += TICSPERFRAME;
|
ototalclock += TICSPERFRAME;
|
||||||
g_player[myconnectindex].movefifoend++;
|
|
||||||
}
|
|
||||||
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
||||||
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
|
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
|
||||||
continue;
|
j++;
|
||||||
|
}
|
||||||
|
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME);
|
||||||
|
|
||||||
|
if (j) continue;
|
||||||
|
}
|
||||||
|
|
||||||
G_DoCheats();
|
G_DoCheats();
|
||||||
|
|
||||||
|
@ -12389,7 +12412,6 @@ nextdemo:
|
||||||
TRAVERSE_CONNECT(j)
|
TRAVERSE_CONNECT(j)
|
||||||
{
|
{
|
||||||
copybufbyte(&recsync[bigi], &inputfifo[0][j], sizeof(input_t));
|
copybufbyte(&recsync[bigi], &inputfifo[0][j], sizeof(input_t));
|
||||||
g_player[j].movefifoend++;
|
|
||||||
bigi++;
|
bigi++;
|
||||||
ud.reccnt--;
|
ud.reccnt--;
|
||||||
}
|
}
|
||||||
|
@ -12584,7 +12606,6 @@ GAME_STATIC GAME_INLINE int32_t G_MoveLoop()
|
||||||
{
|
{
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
|
||||||
while (g_player[myconnectindex].movefifoend-movefifoplc > 0)
|
|
||||||
if (G_DoMoveThings()) return 1;
|
if (G_DoMoveThings()) return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -12660,8 +12681,6 @@ GAME_STATIC int32_t G_DoMoveThings(void)
|
||||||
TRAVERSE_CONNECT(i)
|
TRAVERSE_CONNECT(i)
|
||||||
copybufbyte(&inputfifo[(g_netServer && myconnectindex == i) ? 1 : 0][i],g_player[i].sync,sizeof(input_t));
|
copybufbyte(&inputfifo[(g_netServer && myconnectindex == i) ? 1 : 0][i],g_player[i].sync,sizeof(input_t));
|
||||||
|
|
||||||
movefifoplc++;
|
|
||||||
|
|
||||||
G_UpdateInterpolations();
|
G_UpdateInterpolations();
|
||||||
|
|
||||||
j = -1;
|
j = -1;
|
||||||
|
@ -12765,7 +12784,6 @@ GAME_STATIC int32_t G_DoMoveThings(void)
|
||||||
|
|
||||||
enet_peer_send(g_netClientPeer, CHAN_MOVE, enet_packet_create(packbuf, j, 0));
|
enet_peer_send(g_netClientPeer, CHAN_MOVE, enet_packet_create(packbuf, j, 0));
|
||||||
|
|
||||||
movefifosendplc++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -506,7 +506,7 @@ GAMEEXEC_STATIC void VM_Move(void)
|
||||||
|
|
||||||
moveptr = (intptr_t *)vm.g_t[1];
|
moveptr = (intptr_t *)vm.g_t[1];
|
||||||
|
|
||||||
if (a&geth) vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)>>1;
|
if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1;
|
||||||
if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
|
if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
|
||||||
|
|
||||||
if (a&dodgebullet && !deadflag)
|
if (a&dodgebullet && !deadflag)
|
||||||
|
@ -2021,11 +2021,12 @@ nullquote:
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
int32_t j = Gv_GetVarX(*insptr++);
|
int32_t j = Gv_GetVarX(*insptr++);
|
||||||
|
|
||||||
if (g_timerTicsPerSecond == j)
|
if (g_timerTicsPerSecond == j)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uninittimer();
|
uninittimer();
|
||||||
inittimer(j);
|
inittimer((g_timerTicsPerSecond = j));
|
||||||
g_timerTicsPerSecond = j;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
|
|
||||||
const char *s_buildDate = "20100704";
|
const char *s_buildDate = "20100714";
|
||||||
char *MusicPtr = NULL;
|
char *MusicPtr = NULL;
|
||||||
int32_t g_musicSize;
|
int32_t g_musicSize;
|
||||||
|
|
||||||
|
@ -92,8 +92,6 @@ PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
|
||||||
user_defs ud;
|
user_defs ud;
|
||||||
|
|
||||||
char pus, pub;
|
char pus, pub;
|
||||||
char syncstat[MAXSYNCBYTES];
|
|
||||||
int32_t syncvaltail, syncvaltottail;
|
|
||||||
|
|
||||||
input_t loc;
|
input_t loc;
|
||||||
input_t recsync[RECSYNCBUFSIZ];
|
input_t recsync[RECSYNCBUFSIZ];
|
||||||
|
@ -155,9 +153,7 @@ int16_t myang, omyang, mycursectnum, myjumpingcounter;
|
||||||
char myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
|
char myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
|
||||||
int8_t multiwho, multipos, multiwhat, multiflag;
|
int8_t multiwho, multipos, multiwhat, multiflag;
|
||||||
|
|
||||||
int32_t predictfifoplc,movefifoplc;
|
int32_t g_playerFriction = 0xcc00, g_showShareware;
|
||||||
int32_t myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
|
|
||||||
int32_t myhorizbak[MOVEFIFOSIZ],g_playerFriction = 0xcc00, g_showShareware;
|
|
||||||
|
|
||||||
int16_t myangbak[MOVEFIFOSIZ];
|
int16_t myangbak[MOVEFIFOSIZ];
|
||||||
char szPlayerName[32];
|
char szPlayerName[32];
|
||||||
|
@ -167,9 +163,8 @@ int32_t g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBl
|
||||||
g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
|
g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
|
||||||
DukeStatus_t sbar;
|
DukeStatus_t sbar;
|
||||||
|
|
||||||
int32_t mymaxlag, otherminlag, bufferjitter = 1;
|
|
||||||
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
||||||
int32_t cloudtotalclock = 0,totalmemory = 0;
|
int32_t cloudtotalclock = 0;
|
||||||
int32_t g_numInterpolations = 0, startofdynamicinterpolations = 0;
|
int32_t g_numInterpolations = 0, startofdynamicinterpolations = 0;
|
||||||
int32_t g_interpolationLock = 0;
|
int32_t g_interpolationLock = 0;
|
||||||
int32_t oldipos[MAXINTERPOLATIONS];
|
int32_t oldipos[MAXINTERPOLATIONS];
|
||||||
|
|
|
@ -26,8 +26,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
#include "util_lib.h"
|
|
||||||
#include "animlib.h"
|
#include "animlib.h"
|
||||||
|
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "_control.h"
|
#include "_control.h"
|
||||||
#include "util_lib.h"
|
|
||||||
|
|
||||||
#include "baselayer.h"
|
#include "baselayer.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
|
@ -40,8 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
#include "file_lib.h"
|
#include "file_lib.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "cache1d.h"
|
#include "cache1d.h"
|
||||||
|
#include "baselayer.h"
|
||||||
|
|
||||||
#ifndef O_BINARY
|
#ifndef O_BINARY
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
|
@ -61,7 +61,11 @@ int32_t SafeOpen(const char *filename, int32_t mode, int32_t sharemode)
|
||||||
int32_t h;
|
int32_t h;
|
||||||
|
|
||||||
h = openfrompath(filename, mode, sharemode);
|
h = openfrompath(filename, mode, sharemode);
|
||||||
if (h < 0) Error("Error opening %s: %s", filename, strerror(errno));
|
if (h < 0)
|
||||||
|
{
|
||||||
|
initprintf("Error opening %s: %s", filename, strerror(errno));
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
if (h < MaxFiles)
|
if (h < MaxFiles)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +86,7 @@ int32_t SafeOpenRead(const char *filename, int32_t filetype)
|
||||||
case filetype_text:
|
case filetype_text:
|
||||||
return SafeOpen(filename, O_RDONLY|O_TEXT, S_IREAD);
|
return SafeOpen(filename, O_RDONLY|O_TEXT, S_IREAD);
|
||||||
default:
|
default:
|
||||||
Error("SafeOpenRead: Illegal filetype specified");
|
initprintf("SafeOpenRead: Illegal filetype specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,9 +97,10 @@ void SafeClose(int32_t handle)
|
||||||
if (close(handle) < 0)
|
if (close(handle) < 0)
|
||||||
{
|
{
|
||||||
if (handle < MaxFiles)
|
if (handle < MaxFiles)
|
||||||
Error("Unable to close file %s", FileNames[handle]);
|
initprintf("Unable to close file %s", FileNames[handle]);
|
||||||
else
|
else
|
||||||
Error("Unable to close file");
|
initprintf("Unable to close file");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle < MaxFiles && FileNames[handle])
|
if (handle < MaxFiles && FileNames[handle])
|
||||||
|
@ -126,11 +131,12 @@ void SafeRead(int32_t handle, void *buffer, int32_t count)
|
||||||
{
|
{
|
||||||
close(handle);
|
close(handle);
|
||||||
if (handle < MaxFiles)
|
if (handle < MaxFiles)
|
||||||
Error("File read failure %s reading %d bytes from file %s.",
|
initprintf("File read failure %s reading %d bytes from file %s.",
|
||||||
strerror(errno), count, FileNames[handle]);
|
strerror(errno), count, FileNames[handle]);
|
||||||
else
|
else
|
||||||
Error("File read failure %s reading %d bytes.",
|
initprintf("File read failure %s reading %d bytes.",
|
||||||
strerror(errno), count);
|
strerror(errno), count);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
int32_t FindDistance2D(int32_t x, int32_t y)
|
int32_t FindDistance2D(int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
x= klabs(x);
|
if ((x=klabs(x)) < (y=klabs(y))) swaplong(&x,&y);
|
||||||
y= klabs(y);
|
|
||||||
|
|
||||||
if (x<y) swaplong(&x,&y);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t t = y + (y>>1);
|
int32_t t = y + (y>>1);
|
||||||
|
@ -52,12 +49,8 @@ int32_t FindDistance2D(int32_t x, int32_t y)
|
||||||
|
|
||||||
int32_t FindDistance3D(int32_t x, int32_t y, int32_t z)
|
int32_t FindDistance3D(int32_t x, int32_t y, int32_t z)
|
||||||
{
|
{
|
||||||
x= klabs(x);
|
if ((x=klabs(x)) < (y=klabs(y))) swaplong(&x,&y);
|
||||||
y= klabs(y);
|
if (x < (z=klabs(z))) swaplong(&x,&z);
|
||||||
z= klabs(z);
|
|
||||||
|
|
||||||
if (x<y) swaplong(&x,&y);
|
|
||||||
if (x<z) swaplong(&x,&z);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t t = y + z;
|
int32_t t = y + z;
|
||||||
|
|
|
@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
#include "scriplib.h"
|
#include "scriplib.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "file_lib.h"
|
#include "file_lib.h"
|
||||||
#include "_scrplib.h"
|
#include "_scrplib.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
/*
|
|
||||||
* util_lib.c
|
|
||||||
* Utility functions to emulate MACT
|
|
||||||
*
|
|
||||||
* by Jonathon Fowler
|
|
||||||
*
|
|
||||||
* Since we weren't given the source for MACT386.LIB so I've had to do some
|
|
||||||
* creative interpolation here.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
|
|
||||||
|
|
||||||
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
||||||
|
|
||||||
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "compat.h"
|
|
||||||
|
|
||||||
#include "util_lib.h"
|
|
||||||
#include "baselayer.h"
|
|
||||||
|
|
||||||
//#define MOTOROLA
|
|
||||||
|
|
||||||
|
|
||||||
static void (*ShutDown)(void) = NULL; // this is defined by whoever links us
|
|
||||||
|
|
||||||
|
|
||||||
void RegisterShutdownFunction(void (* sh)(void))
|
|
||||||
{
|
|
||||||
ShutDown = sh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef RENDERTYPEWIN
|
|
||||||
void Error(char *error, ...)
|
|
||||||
{
|
|
||||||
va_list va;
|
|
||||||
|
|
||||||
if (ShutDown) ShutDown();
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
va_start(va, error);
|
|
||||||
vprintf(error, va);
|
|
||||||
va_end(va);
|
|
||||||
printf("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
exit((error != NULL));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char CheckParm(char *check)
|
|
||||||
{
|
|
||||||
int32_t c;
|
|
||||||
|
|
||||||
for (c=1; c<_buildargc; c++)
|
|
||||||
{
|
|
||||||
if (_buildargv[c][0] == '/' || _buildargv[c][0] == '-')
|
|
||||||
if (!Bstrcasecmp(&_buildargv[c][1], check)) return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ParseHex(char *hex)
|
|
||||||
{
|
|
||||||
return strtol(hex, NULL, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ParseNum(char *str)
|
|
||||||
{
|
|
||||||
return strtol(str, NULL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t MotoShort(int16_t l)
|
|
||||||
{
|
|
||||||
#if B_LITTLE_ENDIAN != 0
|
|
||||||
return l;
|
|
||||||
#else
|
|
||||||
return ((l & 0x00ff) << 8) | ((l & 0xff00) >> 8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t IntelShort(int16_t l)
|
|
||||||
{
|
|
||||||
#if B_BIG_ENDIAN != 0
|
|
||||||
return ((l & 0x00ff) << 8) | ((l & 0xff00) >> 8);
|
|
||||||
#else
|
|
||||||
return l;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t MotoLong(int32_t l)
|
|
||||||
{
|
|
||||||
#if B_LITTLE_ENDIAN != 0
|
|
||||||
return l;
|
|
||||||
#else
|
|
||||||
int32_t t = ((l & 0x00ff00ffl) << 8) | ((l & 0xff00ff00l) >> 8);
|
|
||||||
return ((t & 0x0000ffffl) << 16) | ((t & 0xffff0000l) >> 16);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t IntelLong(int32_t l)
|
|
||||||
{
|
|
||||||
#if B_BIG_ENDIAN != 0
|
|
||||||
int32_t t = ((l & 0x00ff00ffl) << 8) | ((l & 0xff00ff00l) >> 8);
|
|
||||||
return ((t & 0x0000ffffl) << 16) | ((t & 0xffff0000l) >> 16);
|
|
||||||
#else
|
|
||||||
return l;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
||||||
|
|
||||||
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
||||||
|
|
||||||
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Original Source: 1996 - Todd Replogle
|
|
||||||
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
||||||
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//***************************************************************************
|
|
||||||
//
|
|
||||||
// UTIL_LIB.C - various utils
|
|
||||||
//
|
|
||||||
//***************************************************************************
|
|
||||||
|
|
||||||
#ifndef _util_lib_public
|
|
||||||
#define _util_lib_public
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if RENDERTYPEWIN
|
|
||||||
#include "winlayer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void RegisterShutdownFunction( void (* sh) (void) );
|
|
||||||
void Error (char *error, ...);
|
|
||||||
|
|
||||||
char CheckParm (char *check);
|
|
||||||
|
|
||||||
int32_t ParseHex (char *hex);
|
|
||||||
int32_t ParseNum (char *str);
|
|
||||||
int16_t MotoShort (int16_t l);
|
|
||||||
int16_t IntelShort (int16_t l);
|
|
||||||
int32_t MotoLong (int32_t l);
|
|
||||||
int32_t IntelLong (int32_t l);
|
|
||||||
|
|
||||||
void HeapSort(char * base, int32_t nel, int32_t width, int32_t (*compare)(), void (*switcher)());
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -48,8 +48,6 @@ extern int16_t searchbottomwall;
|
||||||
#define COLOR_RED 248
|
#define COLOR_RED 248
|
||||||
#define COLOR_WHITE 31
|
#define COLOR_WHITE 31
|
||||||
|
|
||||||
static int32_t ototalclock = 0;
|
|
||||||
|
|
||||||
#define NUMOPTIONS 9
|
#define NUMOPTIONS 9
|
||||||
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
||||||
|
|
||||||
|
@ -94,7 +92,6 @@ static int32_t ppointhighlight;
|
||||||
//static int32_t counter=0;
|
//static int32_t counter=0;
|
||||||
static uint8_t nosprites=0,purpleon=0,skill=4;
|
static uint8_t nosprites=0,purpleon=0,skill=4;
|
||||||
static uint8_t framerateon=1,shadepreview=0;
|
static uint8_t framerateon=1,shadepreview=0;
|
||||||
static int32_t xvel, yvel, timoff;
|
|
||||||
|
|
||||||
int32_t autosave=180;
|
int32_t autosave=180;
|
||||||
static int32_t autosavetimer;
|
static int32_t autosavetimer;
|
||||||
|
|
|
@ -537,6 +537,7 @@ void G_CheckPlayerColor(int32_t *color, int32_t prev_color)
|
||||||
|
|
||||||
void M_DisplayMenus(void)
|
void M_DisplayMenus(void)
|
||||||
{
|
{
|
||||||
|
extern int32_t g_netSync;
|
||||||
CACHE1D_FIND_REC *dir;
|
CACHE1D_FIND_REC *dir;
|
||||||
int32_t c,x,i;
|
int32_t c,x,i;
|
||||||
int32_t l,m;
|
int32_t l,m;
|
||||||
|
@ -544,6 +545,22 @@ void M_DisplayMenus(void)
|
||||||
|
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
|
||||||
|
if (g_netSync)
|
||||||
|
{
|
||||||
|
P_SetGamePalette(g_player[myconnectindex].ps, titlepal, 11);
|
||||||
|
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
|
||||||
|
|
||||||
|
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1);
|
||||||
|
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1);
|
||||||
|
if (PLUTOPAK) // JBF 20030804
|
||||||
|
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
|
||||||
|
|
||||||
|
gametext(160,190,"Transferring gamestate",14,2);
|
||||||
|
nextpage();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if (buttonstat != 0 && !onbar)
|
if (buttonstat != 0 && !onbar)
|
||||||
{
|
{
|
||||||
|
@ -3678,6 +3695,7 @@ cheat_for_port_credits:
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t sense = (int32_t)(CONTROL_MouseSensitivity * 4.0f);
|
int32_t sense = (int32_t)(CONTROL_MouseSensitivity * 4.0f);
|
||||||
|
sense = clamp(sense, 0, 63);
|
||||||
barsm(248,126,&sense,2,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7));
|
barsm(248,126,&sense,2,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7));
|
||||||
CONTROL_MouseSensitivity = sense / 4.0f;
|
CONTROL_MouseSensitivity = sense / 4.0f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,6 @@ int32_t g_kb;
|
||||||
int32_t g_looking_angSR1;
|
int32_t g_looking_angSR1;
|
||||||
int32_t g_weapon_xoffset;
|
int32_t g_weapon_xoffset;
|
||||||
|
|
||||||
int32_t turnheldtime; //MED
|
|
||||||
int32_t lastcontroltime; //MED
|
|
||||||
|
|
||||||
extern int32_t g_levelTextTime, ticrandomseed;
|
extern int32_t g_levelTextTime, ticrandomseed;
|
||||||
|
|
||||||
int32_t g_numObituaries = 0;
|
int32_t g_numObituaries = 0;
|
||||||
|
@ -308,7 +305,7 @@ static int32_t A_FindTargetSprite(spritetype *s,int32_t aang,int32_t atwith)
|
||||||
|
|
||||||
int32_t A_Shoot(int32_t i,int32_t atwith)
|
int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
{
|
{
|
||||||
int16_t l, sa, p, j, k=-1, wh, scount;
|
int16_t l, sa, p, j, k=-1;
|
||||||
int32_t vel, zvel = 0, x, oldzvel, dal;
|
int32_t vel, zvel = 0, x, oldzvel, dal;
|
||||||
hitdata_t hitinfo;
|
hitdata_t hitinfo;
|
||||||
vec3_t srcvect;
|
vec3_t srcvect;
|
||||||
|
@ -392,9 +389,8 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
|
|
||||||
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD)
|
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD)
|
||||||
{
|
{
|
||||||
if (p >= 0)
|
|
||||||
sa += 64 - (krand()&127);
|
sa += 64 - (krand()&127);
|
||||||
else sa += 1024 + 64 - (krand()&127);
|
if (p < 0) sa += 1024;
|
||||||
zvel = 1024-(krand()&2047);
|
zvel = 1024-(krand()&2047);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,13 +422,15 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
ProjectileData[atwith].range = 1024;
|
ProjectileData[atwith].range = 1024;
|
||||||
|
|
||||||
if (FindDistance2D(srcvect.x-hitinfo.pos.x,srcvect.y-hitinfo.pos.y) < ProjectileData[atwith].range)
|
if (FindDistance2D(srcvect.x-hitinfo.pos.x,srcvect.y-hitinfo.pos.y) < ProjectileData[atwith].range)
|
||||||
if (FindDistance2D(wall[hitinfo.hitwall].x-wall[wall[hitinfo.hitwall].point2].x,wall[hitinfo.hitwall].y-wall[wall[hitinfo.hitwall].point2].y) > (mulscale(ProjectileData[atwith].xrepeat+8,tilesizx[ProjectileData[atwith].decal],3)))
|
if (FindDistance2D(wall[hitinfo.hitwall].x-wall[wall[hitinfo.hitwall].point2].x,wall[hitinfo.hitwall].y-wall[wall[hitinfo.hitwall].point2].y) >
|
||||||
|
(mulscale(ProjectileData[atwith].xrepeat+8,tilesizx[ProjectileData[atwith].decal],3)))
|
||||||
if (hitinfo.hitwall >= 0 && wall[hitinfo.hitwall].overpicnum != BIGFORCE)
|
if (hitinfo.hitwall >= 0 && wall[hitinfo.hitwall].overpicnum != BIGFORCE)
|
||||||
if ((wall[hitinfo.hitwall].nextsector >= 0 && hitinfo.hitsect >= 0 &&
|
if ((wall[hitinfo.hitwall].nextsector >= 0 && hitinfo.hitsect >= 0 &&
|
||||||
sector[wall[hitinfo.hitwall].nextsector].lotag == 0 &&
|
sector[wall[hitinfo.hitwall].nextsector].lotag == 0 &&
|
||||||
sector[hitinfo.hitsect].lotag == 0 &&
|
sector[hitinfo.hitsect].lotag == 0 &&
|
||||||
sector[wall[hitinfo.hitwall].nextsector].lotag == 0 &&
|
sector[wall[hitinfo.hitwall].nextsector].lotag == 0 &&
|
||||||
(sector[hitinfo.hitsect].floorz-sector[wall[hitinfo.hitwall].nextsector].floorz) > (mulscale(ProjectileData[atwith].yrepeat,tilesizy[ProjectileData[atwith].decal],3)<<8)) ||
|
(sector[hitinfo.hitsect].floorz-sector[wall[hitinfo.hitwall].nextsector].floorz) >
|
||||||
|
(mulscale(ProjectileData[atwith].yrepeat,tilesizy[ProjectileData[atwith].decal],3)<<8)) ||
|
||||||
(wall[hitinfo.hitwall].nextsector == -1 && sector[hitinfo.hitsect].lotag == 0))
|
(wall[hitinfo.hitwall].nextsector == -1 && sector[hitinfo.hitsect].lotag == 0))
|
||||||
if ((wall[hitinfo.hitwall].cstat&16) == 0)
|
if ((wall[hitinfo.hitwall].cstat&16) == 0)
|
||||||
{
|
{
|
||||||
|
@ -471,7 +469,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
*/
|
*/
|
||||||
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
|
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
|
||||||
{
|
{
|
||||||
wh = (krand()&ProjectileData[atwith].xrepeat);
|
int32_t wh = (krand()&ProjectileData[atwith].xrepeat);
|
||||||
if (wh < ProjectileData[atwith].yrepeat)
|
if (wh < ProjectileData[atwith].yrepeat)
|
||||||
wh = ProjectileData[atwith].yrepeat;
|
wh = ProjectileData[atwith].yrepeat;
|
||||||
sprite[k].xrepeat = wh;
|
sprite[k].xrepeat = wh;
|
||||||
|
@ -486,7 +484,8 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
// sprite[k].cstat = 16+(krand()&12);
|
// sprite[k].cstat = 16+(krand()&12);
|
||||||
sprite[k].cstat = 16;
|
sprite[k].cstat = 16;
|
||||||
|
|
||||||
wh = (krand()&1);
|
{
|
||||||
|
int32_t wh = (krand()&1);
|
||||||
if (wh == 1)
|
if (wh == 1)
|
||||||
sprite[k].cstat |= 4;
|
sprite[k].cstat |= 4;
|
||||||
|
|
||||||
|
@ -496,6 +495,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
|
|
||||||
wh = sprite[k].sectnum;
|
wh = sprite[k].sectnum;
|
||||||
sprite[k].shade = sector[wh].floorshade;
|
sprite[k].shade = sector[wh].floorshade;
|
||||||
|
}
|
||||||
sprite[k].x -= mulscale13(1,sintable[(sprite[k].ang+2560)&2047]);
|
sprite[k].x -= mulscale13(1,sintable[(sprite[k].ang+2560)&2047]);
|
||||||
sprite[k].y -= mulscale13(1,sintable[(sprite[k].ang+2048)&2047]);
|
sprite[k].y -= mulscale13(1,sintable[(sprite[k].ang+2048)&2047]);
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
}
|
}
|
||||||
if (ProjectileData[atwith].spawns >= 0)
|
if (ProjectileData[atwith].spawns >= 0)
|
||||||
{
|
{
|
||||||
wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
||||||
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
||||||
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
||||||
actor[wh].t_data[6] = hitinfo.hitwall;
|
actor[wh].t_data[6] = hitinfo.hitwall;
|
||||||
|
@ -749,7 +749,9 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
if (hitinfo.hitsprite >= 0)
|
if (hitinfo.hitsprite >= 0)
|
||||||
{
|
{
|
||||||
A_DamageObject(hitinfo.hitsprite,k);
|
A_DamageObject(hitinfo.hitsprite,k);
|
||||||
if (sprite[hitinfo.hitsprite].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) && g_player[sprite[hitinfo.hitsprite].yvel].ps->team != g_player[sprite[i].yvel].ps->team)))
|
if (sprite[hitinfo.hitsprite].picnum == APLAYER &&
|
||||||
|
(ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) &&
|
||||||
|
g_player[sprite[hitinfo.hitsprite].yvel].ps->team != g_player[sprite[i].yvel].ps->team)))
|
||||||
{
|
{
|
||||||
l = A_Spawn(k,JIBS6);
|
l = A_Spawn(k,JIBS6);
|
||||||
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
||||||
|
@ -762,7 +764,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
{
|
{
|
||||||
if (ProjectileData[atwith].spawns >= 0)
|
if (ProjectileData[atwith].spawns >= 0)
|
||||||
{
|
{
|
||||||
wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
||||||
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
||||||
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
||||||
actor[wh].t_data[6] = hitinfo.hitwall;
|
actor[wh].t_data[6] = hitinfo.hitwall;
|
||||||
|
@ -788,7 +790,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
{
|
{
|
||||||
if (ProjectileData[atwith].spawns >= 0)
|
if (ProjectileData[atwith].spawns >= 0)
|
||||||
{
|
{
|
||||||
wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
||||||
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
||||||
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
||||||
actor[wh].t_data[6] = hitinfo.hitwall;
|
actor[wh].t_data[6] = hitinfo.hitwall;
|
||||||
|
@ -851,7 +853,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
wall[hitinfo.hitwall].y-wall[wall[hitinfo.hitwall].point2].y)+512;
|
wall[hitinfo.hitwall].y-wall[wall[hitinfo.hitwall].point2].y)+512;
|
||||||
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
|
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
|
||||||
{
|
{
|
||||||
wh = (krand()&ProjectileData[atwith].xrepeat);
|
int32_t wh = (krand()&ProjectileData[atwith].xrepeat);
|
||||||
if (wh < ProjectileData[atwith].yrepeat)
|
if (wh < ProjectileData[atwith].yrepeat)
|
||||||
wh = ProjectileData[atwith].yrepeat;
|
wh = ProjectileData[atwith].yrepeat;
|
||||||
sprite[l].xrepeat = wh;
|
sprite[l].xrepeat = wh;
|
||||||
|
@ -899,7 +901,7 @@ DOSKIPBULLETHOLE:
|
||||||
{
|
{
|
||||||
if (ProjectileData[atwith].spawns >= 0)
|
if (ProjectileData[atwith].spawns >= 0)
|
||||||
{
|
{
|
||||||
wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
|
||||||
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
|
||||||
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
|
||||||
actor[wh].t_data[6] = hitinfo.hitwall;
|
actor[wh].t_data[6] = hitinfo.hitwall;
|
||||||
|
@ -927,7 +929,6 @@ DOSKIPBULLETHOLE:
|
||||||
|
|
||||||
if (s->extra >= 0) s->shade = ProjectileData[atwith].shade;
|
if (s->extra >= 0) s->shade = ProjectileData[atwith].shade;
|
||||||
|
|
||||||
scount = 1;
|
|
||||||
vel = ProjectileData[atwith].vel;
|
vel = ProjectileData[atwith].vel;
|
||||||
|
|
||||||
j = -1;
|
j = -1;
|
||||||
|
@ -1046,10 +1047,8 @@ DOSKIPBULLETHOLE:
|
||||||
case BLOODSPLAT2__STATIC:
|
case BLOODSPLAT2__STATIC:
|
||||||
case BLOODSPLAT3__STATIC:
|
case BLOODSPLAT3__STATIC:
|
||||||
case BLOODSPLAT4__STATIC:
|
case BLOODSPLAT4__STATIC:
|
||||||
|
|
||||||
if (p >= 0)
|
|
||||||
sa += 64 - (krand()&127);
|
sa += 64 - (krand()&127);
|
||||||
else sa += 1024 + 64 - (krand()&127);
|
if (p < 0) sa += 1024;
|
||||||
zvel = 1024-(krand()&2047);
|
zvel = 1024-(krand()&2047);
|
||||||
case KNEE__STATIC:
|
case KNEE__STATIC:
|
||||||
if (atwith == KNEE)
|
if (atwith == KNEE)
|
||||||
|
@ -1173,7 +1172,6 @@ DOSKIPBULLETHOLE:
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOTSPARK1__STATIC:
|
case SHOTSPARK1__STATIC:
|
||||||
|
@ -1468,7 +1466,6 @@ SKIPBULLETHOLE:
|
||||||
|
|
||||||
if (s->extra >= 0) s->shade = -96;
|
if (s->extra >= 0) s->shade = -96;
|
||||||
|
|
||||||
scount = 1;
|
|
||||||
if (atwith == SPIT) vel = 292;
|
if (atwith == SPIT) vel = 292;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1522,36 +1519,24 @@ SKIPBULLETHOLE:
|
||||||
|
|
||||||
if (atwith == SPIT)
|
if (atwith == SPIT)
|
||||||
{
|
{
|
||||||
sizx = 18;
|
sizx = sizy = 18;
|
||||||
sizy = 18,srcvect.z -= (10<<8);
|
srcvect.z -= (10<<8);
|
||||||
}
|
}
|
||||||
|
else if (p >= 0)
|
||||||
|
sizx = sizy = 7;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (atwith == FIRELASER)
|
if (atwith == FIRELASER)
|
||||||
{
|
{
|
||||||
if (p >= 0)
|
if (p >= 0)
|
||||||
{
|
sizx = sizy = 34;
|
||||||
|
else
|
||||||
sizx = 34;
|
sizx = sizy = 18;
|
||||||
sizy = 34;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
sizx = sizy = 18;
|
||||||
sizx = 18;
|
|
||||||
sizy = 18;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sizx = 18;
|
|
||||||
sizy = 18;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p >= 0) sizx = 7,sizy = 7;
|
|
||||||
|
|
||||||
while (scount > 0)
|
|
||||||
{
|
|
||||||
j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,
|
j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,
|
||||||
atwith,-127,sizx,sizy,sa,vel,zvel,i,4);
|
atwith,-127,sizx,sizy,sa,vel,zvel,i,4);
|
||||||
sprite[j].extra += (krand()&7);
|
sprite[j].extra += (krand()&7);
|
||||||
|
@ -1575,9 +1560,6 @@ SKIPBULLETHOLE:
|
||||||
sa = s->ang+32-(krand()&63);
|
sa = s->ang+32-(krand()&63);
|
||||||
zvel = oldzvel+512-(krand()&1023);
|
zvel = oldzvel+512-(krand()&1023);
|
||||||
|
|
||||||
scount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return j;
|
return j;
|
||||||
|
|
||||||
case FREEZEBLAST__STATIC:
|
case FREEZEBLAST__STATIC:
|
||||||
|
@ -1586,7 +1568,6 @@ SKIPBULLETHOLE:
|
||||||
|
|
||||||
if (s->extra >= 0) s->shade = -96;
|
if (s->extra >= 0) s->shade = -96;
|
||||||
|
|
||||||
scount = 1;
|
|
||||||
vel = 644;
|
vel = 644;
|
||||||
|
|
||||||
j = -1;
|
j = -1;
|
||||||
|
@ -2982,8 +2963,10 @@ void getinput(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t j, daang;
|
int32_t j, daang;
|
||||||
static ControlInfo info[2];
|
static ControlInfo info[2];
|
||||||
int32_t tics;
|
static int32_t turnheldtime; //MED
|
||||||
int32_t running;
|
static int32_t lastcontroltime; //MED
|
||||||
|
|
||||||
|
int32_t tics, running;
|
||||||
int32_t turnamount;
|
int32_t turnamount;
|
||||||
int32_t keymove;
|
int32_t keymove;
|
||||||
int32_t momx = 0,momy = 0;
|
int32_t momx = 0,momy = 0;
|
||||||
|
@ -3105,6 +3088,7 @@ void getinput(int32_t snum)
|
||||||
info[1].dz = info[0].dz % (1<<6);
|
info[1].dz = info[0].dz % (1<<6);
|
||||||
vel = -info[0].dz>>6;
|
vel = -info[0].dz>>6;
|
||||||
|
|
||||||
|
// OSD_Printf("running: %d\n", running);
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
turnamount = NORMALTURN<<1;
|
turnamount = NORMALTURN<<1;
|
||||||
|
@ -3820,6 +3804,7 @@ void P_FragPlayer(int32_t snum)
|
||||||
DukePlayer_t *p = g_player[snum].ps;
|
DukePlayer_t *p = g_player[snum].ps;
|
||||||
spritetype *s = &sprite[p->i];
|
spritetype *s = &sprite[p->i];
|
||||||
|
|
||||||
|
if (g_netServer || g_netClient)
|
||||||
randomseed = ticrandomseed;
|
randomseed = ticrandomseed;
|
||||||
|
|
||||||
if (s->pal != 1)
|
if (s->pal != 1)
|
||||||
|
@ -3841,9 +3826,10 @@ void P_FragPlayer(int32_t snum)
|
||||||
packbuf[1] = snum;
|
packbuf[1] = snum;
|
||||||
packbuf[2] = p->frag_ps;
|
packbuf[2] = p->frag_ps;
|
||||||
packbuf[3] = actor[p->i].picnum;
|
packbuf[3] = actor[p->i].picnum;
|
||||||
packbuf[4] = myconnectindex;
|
*(int32_t *)&packbuf[4] = ticrandomseed;
|
||||||
|
packbuf[8] = myconnectindex;
|
||||||
|
|
||||||
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 5, ENET_PACKET_FLAG_RELIABLE));
|
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 9, ENET_PACKET_FLAG_RELIABLE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1597,16 +1597,8 @@ void clearfifo(void)
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
extern int32_t jump_timer;
|
extern int32_t jump_timer;
|
||||||
|
|
||||||
syncvaltail = 0L;
|
|
||||||
syncvaltottail = 0L;
|
|
||||||
memset(&syncstat, 0, sizeof(syncstat));
|
|
||||||
bufferjitter = 1;
|
|
||||||
mymaxlag = otherminlag = 0;
|
|
||||||
jump_timer = 0;
|
jump_timer = 0;
|
||||||
|
|
||||||
movefifoplc = movefifosendplc = predictfifoplc = 0;
|
|
||||||
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;
|
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;
|
||||||
otherminlag = mymaxlag = 0;
|
|
||||||
|
|
||||||
clearbufbyte(&loc,sizeof(input_t),0L);
|
clearbufbyte(&loc,sizeof(input_t),0L);
|
||||||
clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L);
|
clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L);
|
||||||
|
@ -1616,8 +1608,6 @@ void clearfifo(void)
|
||||||
// Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
|
// Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
|
||||||
if (g_player[i].sync != NULL)
|
if (g_player[i].sync != NULL)
|
||||||
Bmemset(g_player[i].sync,0,sizeof(input_t));
|
Bmemset(g_player[i].sync,0,sizeof(input_t));
|
||||||
Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend));
|
|
||||||
Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead));
|
|
||||||
g_player[i].vote = 0;
|
g_player[i].vote = 0;
|
||||||
g_player[i].gotvote = 0;
|
g_player[i].gotvote = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,16 @@ static int32_t RTS_Started = FALSE;
|
||||||
|
|
||||||
char lumplockbyte[11];
|
char lumplockbyte[11];
|
||||||
|
|
||||||
|
int32_t IntelLong(int32_t l)
|
||||||
|
{
|
||||||
|
#if B_BIG_ENDIAN != 0
|
||||||
|
int32_t t = ((l & 0x00ff00ffl) << 8) | ((l & 0xff00ff00l) >> 8);
|
||||||
|
return ((t & 0x0000ffffl) << 16) | ((t & 0xffff0000l) >> 16);
|
||||||
|
#else
|
||||||
|
return l;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============================================================================
|
============================================================================
|
||||||
|
|
||||||
|
@ -186,7 +196,12 @@ int32_t RTS_SoundLength(int32_t lump)
|
||||||
{
|
{
|
||||||
lump++;
|
lump++;
|
||||||
if (lump >= numlumps)
|
if (lump >= numlumps)
|
||||||
Error("RTS_SoundLength: %i >= numlumps",lump);
|
{
|
||||||
|
initprintf("RTS_SoundLength: %i >= numlumps",lump);
|
||||||
|
RTS_Started = FALSE;
|
||||||
|
numlumps = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return lumpinfo[lump].size;
|
return lumpinfo[lump].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +217,13 @@ const char * RTS_GetSoundName(int32_t i)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
if (i>=numlumps)
|
if (i>=numlumps)
|
||||||
Error("RTS_GetSoundName: %i >= numlumps",i);
|
{
|
||||||
|
initprintf("RTS_GetSoundName: %i >= numlumps",i);
|
||||||
|
RTS_Started = FALSE;
|
||||||
|
numlumps = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return &(lumpinfo[i].name[0]);
|
return &(lumpinfo[i].name[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,9 +241,21 @@ void RTS_ReadLump(int32_t lump, void *dest)
|
||||||
lumpinfo_t *l;
|
lumpinfo_t *l;
|
||||||
|
|
||||||
if (lump >= numlumps)
|
if (lump >= numlumps)
|
||||||
Error("RTS_ReadLump: %i >= numlumps",lump);
|
{
|
||||||
|
initprintf("RTS_ReadLump: %i >= numlumps",lump);
|
||||||
|
RTS_Started = FALSE;
|
||||||
|
numlumps = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (lump < 0)
|
if (lump < 0)
|
||||||
Error("RTS_ReadLump: %i < 0",lump);
|
{
|
||||||
|
initprintf("RTS_ReadLump: %i < 0",lump);
|
||||||
|
RTS_Started = FALSE;
|
||||||
|
numlumps = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
l = lumpinfo+lump;
|
l = lumpinfo+lump;
|
||||||
klseek(l->handle, l->position, SEEK_SET);
|
klseek(l->handle, l->position, SEEK_SET);
|
||||||
kread(l->handle,dest,l->size);
|
kread(l->handle,dest,l->size);
|
||||||
|
@ -239,7 +272,13 @@ void *RTS_GetSound(int32_t lump)
|
||||||
{
|
{
|
||||||
lump++;
|
lump++;
|
||||||
if ((uint32_t)lump >= (uint32_t)numlumps)
|
if ((uint32_t)lump >= (uint32_t)numlumps)
|
||||||
Error("RTS_GetSound: %i >= %i\n",lump,numlumps);
|
{
|
||||||
|
initprintf("RTS_GetSound: %i >= %i\n",lump,numlumps);
|
||||||
|
RTS_Started = FALSE;
|
||||||
|
numlumps = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (lumpcache[lump] == NULL)
|
if (lumpcache[lump] == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "music.h"
|
#include "music.h"
|
||||||
|
|
||||||
#if !defined _WIN32 // fork/exec based external midi player
|
#if !defined _WIN32 // fork/exec based external midi player
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
|
@ -308,7 +308,6 @@ void G_DoSectorAnimations(void)
|
||||||
{
|
{
|
||||||
my.z += v;
|
my.z += v;
|
||||||
myvel.z = 0;
|
myvel.z = 0;
|
||||||
myzbak[0] = g_player[p].ps->pos.z;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +330,7 @@ int32_t GetAnimationGoal(int32_t *animptr)
|
||||||
|
|
||||||
for (; i>=0; i--)
|
for (; i>=0; i--)
|
||||||
if (animptr == (int32_t *)animateptr[i])
|
if (animptr == (int32_t *)animateptr[i])
|
||||||
{
|
return j;
|
||||||
j = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(j);
|
return(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "fx_man.h"
|
#include "fx_man.h"
|
||||||
#include "music.h"
|
#include "music.h"
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "winlayer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOUDESTVOLUME 150
|
#define LOUDESTVOLUME 150
|
||||||
|
|
||||||
int32_t backflag,g_numEnvSoundsPlaying,g_maxSoundPos = 0;
|
int32_t backflag,g_numEnvSoundsPlaying,g_maxSoundPos = 0;
|
||||||
|
@ -43,7 +46,7 @@ static int32_t MusicVoice = -1;
|
||||||
static int32_t MusicPaused = 0;
|
static int32_t MusicPaused = 0;
|
||||||
|
|
||||||
static mutex_t s_mutex;
|
static mutex_t s_mutex;
|
||||||
static uint32_t dq[128], dnum = 0;
|
static volatile uint32_t dq[128], dnum = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===================
|
===================
|
||||||
|
@ -145,7 +148,7 @@ void S_MusicShutdown(void)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
|
|
||||||
if (MUSIC_Shutdown() != MUSIC_Ok)
|
if (MUSIC_Shutdown() != MUSIC_Ok)
|
||||||
Error(MUSIC_ErrorString(MUSIC_ErrorCode));
|
initprintf(MUSIC_ErrorString(MUSIC_ErrorCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PauseMusic(int32_t onf)
|
void S_PauseMusic(int32_t onf)
|
||||||
|
@ -251,8 +254,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
||||||
|
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
|
|
||||||
MusicLen = kfilelength(fp);
|
MusicPtr = (char *) Bmalloc((MusicLen = kfilelength(fp)));
|
||||||
MusicPtr = (char *) Bmalloc(MusicLen);
|
|
||||||
|
|
||||||
if ((g_musicSize = kread(fp, (char *)MusicPtr, MusicLen)) != MusicLen)
|
if ((g_musicSize = kread(fp, (char *)MusicPtr, MusicLen)) != MusicLen)
|
||||||
{
|
{
|
||||||
|
@ -313,7 +315,7 @@ void S_Cleanup(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bmemcpy(ldq, dq, sizeof(int32_t) * (ldnum = dnum));
|
Bmemcpy(ldq, (void *)dq, sizeof(int32_t) * (ldnum = dnum));
|
||||||
dnum = 0;
|
dnum = 0;
|
||||||
|
|
||||||
mutex_unlock(&s_mutex);
|
mutex_unlock(&s_mutex);
|
||||||
|
|
|
@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "fx_man.h"
|
#include "fx_man.h"
|
||||||
//#include "music.h"
|
//#include "music.h"
|
||||||
//#include "duke3d.h"
|
//#include "duke3d.h"
|
||||||
#include "util_lib.h"
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
||||||
#include "cache1d.h"
|
#include "cache1d.h"
|
||||||
|
@ -39,6 +38,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "mathutil.h"
|
#include "mathutil.h"
|
||||||
#include "build.h" // vec3_t
|
#include "build.h" // vec3_t
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "winlayer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sounds_mapster32.h"
|
#include "sounds_mapster32.h"
|
||||||
|
|
||||||
#define LOUDESTVOLUME 150
|
#define LOUDESTVOLUME 150
|
||||||
|
|
|
@ -34,27 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "winlayer.h"
|
#include "winlayer.h"
|
||||||
|
|
||||||
// this replaces the Error() function in jmact/util_lib.c
|
|
||||||
extern void G_Shutdown(void); // game.c
|
|
||||||
void Error(char *error, ...)
|
|
||||||
{
|
|
||||||
char buf[1000];
|
|
||||||
va_list va;
|
|
||||||
|
|
||||||
G_Shutdown();
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
va_start(va, error);
|
|
||||||
vsprintf(buf, error, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
MessageBox((HWND)win_gethwnd(),buf,"Fatal Error",MB_OK|MB_ICONERROR|MB_TASKMODAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit((error != NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t G_GetVersionFromWebsite(char *buffer)
|
int32_t G_GetVersionFromWebsite(char *buffer)
|
||||||
{
|
{
|
||||||
int32_t wsainitialized = 0;
|
int32_t wsainitialized = 0;
|
||||||
|
|
Loading…
Reference in a new issue