WIP multiplayer changes, still completely broken.

git-svn-id: https://svn.eduke32.com/eduke32@2664 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-05-17 23:54:43 +00:00
parent 5941bf013c
commit 1c1da97378
13 changed files with 679 additions and 1730 deletions

View file

@ -36,7 +36,7 @@ else
endif
OURCFLAGS=$(BASECFLAGS) \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -I$(SRC)/xdelta3
OURCXXFLAGS=$(BASECXXFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS)
@ -122,6 +122,7 @@ GAMEOBJS=$(OBJ)/game.$o \
$(OBJ)/osdcmds.$o \
$(OBJ)/grpscan.$o \
$(OBJ)/sounds.$o \
$(OBJ)/xdelta3/xdelta3.$o \
$(JMACTOBJ)
EDITOROBJS=$(OBJ)/astub.$o \
@ -458,7 +459,7 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
# PHONIES
clean:
-rm -f $(OBJ)/* eduke32$(EXESUFFIX) eduke32$(EXESUFFIX).memmap mapster32$(EXESUFFIX) mapster32$(EXESUFFIX).memmap core* duke3d_w32$(EXESUFFIX) && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean
-rm -rf $(OBJ)/* eduke32$(EXESUFFIX) eduke32$(EXESUFFIX).memmap mapster32$(EXESUFFIX) mapster32$(EXESUFFIX).memmap core* duke3d_w32$(EXESUFFIX) && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean
ifeq ($(PLATFORM),DARWIN)
-rm -rf EDuke32.app Mapster32.app
endif

View file

@ -52,9 +52,8 @@ $(OBJ)/config.$o: $(SRC)/config.c $(duke3d_h) $(SRC)/jmact/scriplib.h $(INC)/_fu
$(OBJ)/winbits.$o: $(SRC)/winbits.c
$(OBJ)/osdfuncs.$o: $(SRC)/names.h $(EINC)/build.h $(EINC)/osd.h
$(OBJ)/osdcmds.$o: $(SRC)/osdcmds.c $(INC)/osdcmds.h $(EINC)/osd.h $(duke3d_h)
$(OBJ)/xdelta3/xdelta3.$o: $(SRC)/xdelta3/xdelta3.c $(SRC)/xdelta3/xdelta3.h
$(OBJ)/animvpx.$o: $(SRC)/animvpx.c $(SRC)/animvpx.h $(duke3d_h) $(EINC)/glbuild.h
$(OBJ)/lunatic/lunatic.$o: $(SRC)/lunatic/lunatic.c $(SRC)/lunatic/lunatic.h $(EINC)/cache1d.h $(EINC)/osd.h
# editor objects
@ -113,20 +112,6 @@ $(OBJ)/mouse.$o: $(SRC)/jmact/mouse.c $(SRC)/jmact/mouse.h $(EINC)/baselayer.h
$(OBJ)/mathutil.$o: $(SRC)/jmact/mathutil.c $(EINC)/compat.h $(EINC)/pragmas.h
$(OBJ)/scriplib.$o: $(SRC)/jmact/scriplib.c $(SRC)/jmact/scriplib.h $(SRC)/jmact/_scrplib.h $(EINC)/compat.h
# jAudioLib objects
$(OBJ)/mv_mix.$o: $(SRC)/jaudiolib/mv_mix.nasm
$(OBJ)/mv_mix16.$o: $(SRC)/jaudiolib/mv_mix16.nasm
$(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm
$(OBJ)/mv_mix-c.$o: $(SRC)/jaudiolib/mv_mix-c.c
$(OBJ)/mvreverb-c.$o: $(SRC)/jaudiolib/mvreverb-c.c
$(OBJ)/pitch.$o: $(SRC)/jaudiolib/pitch.c $(SRC)/jaudiolib/pitch.h
$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h
$(OBJ)/fx_man.$o: $(SRC)/jaudiolib/fx_man.c $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/ll_man.h $(JAUDIOLIBDIR)/include/fx_man.h
$(OBJ)/dsoundout.$o: $(SRC)/jaudiolib/dsoundout.c $(SRC)/jaudiolib/dsoundout.h
$(OBJ)/openal.$o: $(SRC)/jaudiolib/openal.c $(SRC)/jaudiolib/openal.h
$(OBJ)/dsl.$o: $(SRC)/jaudiolib/dsl.c $(SRC)/jaudiolib/dsl.h $(EINC)/compat.h
$(OBJ)/midi.$o: $(SRC)/midi.c $(SRC)/_midi.h $(SRC)/midi.h $(JAUDIOLIBDIR)/include/music.h
$(OBJ)/mpu401.$o: $(SRC)/mpu401.c $(SRC)/mpu401.h $(JAUDIOLIBDIR)/include/music.h
$(OBJ)/music.$o: $(SRC)/music.c $(SRC)/midi.h $(SRC)/mpu401.h $(JAUDIOLIBDIR)/include/music.h

View file

@ -40,7 +40,7 @@ AS=ml
LINK=link /nologo /opt:ref
MT=mt
CFLAGS= /MT /J /nologo $(flags_cl) \
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\xdelta3 /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \
/W2 $(ENGINEOPTS) \
/I$(DXROOT)\include /DRENDERTYPEWIN=1
@ -97,6 +97,7 @@ GAMEOBJS=$(OBJ)\game.$o \
$(JMACTOBJ) \
$(AUDIOLIBOBJ) \
$(OBJ)\sounds.$o \
$(OBJ)\xdelta3.$o \
!ifdef DEBUG
$(OBJ)\mdump.$o
!endif
@ -124,6 +125,9 @@ EDITOROBJS=$(OBJ)\astub.$o \
{$(SRC)\jmact}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\xdelta3}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\util}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<

View file

@ -249,7 +249,8 @@ SKIPWALLCHECK:
actor[j].extra = hp1 + (krand()%(hp2-hp1));
}
if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 && sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4)
if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 &&
sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4)
{
if (sj->xvel < 0) sj->xvel = 0;
sj->xvel += (s->extra<<2);

View file

@ -87,7 +87,7 @@ extern "C" {
#define TICSPERFRAME 4
#define TICRATE 120
#define PACKBUF_SIZE 2048
#define PACKBUF_SIZE 16384
#define TILE_SAVESHOT (MAXTILES-1)
#define TILE_LOADSHOT (MAXTILES-3)

View file

@ -10698,19 +10698,6 @@ MAIN_LOOP_RESTART:
case 2: goto MAIN_LOOP_RESTART;
}
}
else if (g_netClient && g_multiMapState)
{
for (i=g_gameVarCount-1; i>=0; i--)
{
if (aGameVars[i].dwFlags & GAMEVAR_USER_MASK)
g_multiMapState->vars[i] = NULL;
}
G_RestoreMapState(g_multiMapState);
g_player[myconnectindex].ps->gm = MODE_GAME;
Bfree(g_multiMapState);
g_multiMapState = NULL;
}
if (g_networkMode == NET_DEDICATED_SERVER)
{

View file

@ -68,7 +68,7 @@ typedef struct {
typedef struct {
char *szLabel;
int32_t *plValues; // array of values
intptr_t *plValues; // array of values
intptr_t size;
intptr_t bReset;
} gamearray_t;

View file

@ -160,7 +160,7 @@ int32_t CONTROL_FlagActive( int32_t which );
void CONTROL_ClearAssignments( void );
void CONTROL_GetInput( ControlInfo *info );
void CONTROL_ClearButton( int32_t whichbutton );
float CONTROL_MouseSensitivity;
extern float CONTROL_MouseSensitivity;
int32_t CONTROL_Startup
(
controltype which,

File diff suppressed because it is too large Load diff

View file

@ -25,91 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "enet/enet.h"
#define NET_SECTOR_WALLPTR 0x00000001
#define NET_SECTOR_WALLNUM 0x00000002
#define NET_SECTOR_CEILINGZ 0x00000004
#define NET_SECTOR_FLOORZ 0x00000008
#define NET_SECTOR_CEILINGSTAT 0x00000010
#define NET_SECTOR_FLOORSTAT 0x00000020
#define NET_SECTOR_CEILINGPIC 0x00000040
#define NET_SECTOR_CEILINGSLOPE 0x00000080
#define NET_SECTOR_CEILINGSHADE 0x00000100
#define NET_SECTOR_CEILINGPAL 0x00000200
#define NET_SECTOR_CEILINGXPAN 0x00000400
#define NET_SECTOR_CEILINGYPAN 0x00000800
#define NET_SECTOR_FLOORPIC 0x00001000
#define NET_SECTOR_FLOORSLOPE 0x00002000
#define NET_SECTOR_FLOORSHADE 0x00004000
#define NET_SECTOR_FLOORPAL 0x00008000
#define NET_SECTOR_FLOORXPAN 0x00010000
#define NET_SECTOR_FLOORYPAN 0x00020000
#define NET_SECTOR_VISIBILITY 0x00040000
#define NET_SECTOR_LOTAG 0x00080000
#define NET_SECTOR_HITAG 0x00100000
#define NET_SECTOR_EXTRA 0x00200000
#define NET_WALL_X 0x00000001
#define NET_WALL_Y 0x00000002
#define NET_WALL_POINT2 0x00000004
#define NET_WALL_NEXTWALL 0x00000008
#define NET_WALL_NEXTSECTOR 0x00000010
#define NET_WALL_CSTAT 0x00000020
#define NET_WALL_PICNUM 0x00000040
#define NET_WALL_OVERPICNUM 0x00000080
#define NET_WALL_SHADE 0x00000100
#define NET_WALL_PAL 0x00000200
#define NET_WALL_XREPEAT 0x00000400
#define NET_WALL_YREPEAT 0x00000800
#define NET_WALL_XPANNING 0x00001000
#define NET_WALL_YPANNING 0x00002000
#define NET_WALL_LOTAG 0x00004000
#define NET_WALL_HITAG 0x00008000
#define NET_WALL_EXTRA 0x00010000
#define NET_SPRITE_X 0x00000001
#define NET_SPRITE_Y 0x00000002
#define NET_SPRITE_Z 0x00000004
#define NET_SPRITE_SHADE 0x00000008
#define NET_SPRITE_PAL 0x00000010
#define NET_SPRITE_CLIPDIST 0x00000020
#define NET_SPRITE_XREPEAT 0x00000040
#define NET_SPRITE_YREPEAT 0x00000080
#define NET_SPRITE_XOFFSET 0x00000100
#define NET_SPRITE_YOFFSET 0x00000200
#define NET_SPRITE_SECTNUM 0x00000400
#define NET_SPRITE_STATNUM 0x00000800
#define NET_SPRITE_ANG 0x00001000
#define NET_SPRITE_OWNER 0x00002000
#define NET_SPRITE_XVEL 0x00004000
#define NET_SPRITE_YVEL 0x00008000
#define NET_SPRITE_ZVEL 0x00010000
#define NET_SPRITE_LOTAG 0x00020000
#define NET_SPRITE_HITAG 0x00040000
#define NET_SPRITE_EXTRA 0x00080000
#define NET_SPRITE_CSTAT 0x00100000
#define NET_SPRITE_PICNUM 0x00200000
#define NET_ACTOR_T1 0x00000001
#define NET_ACTOR_T2 0x00000002
#define NET_ACTOR_T3 0x00000004
#define NET_ACTOR_T4 0x00000008
#define NET_ACTOR_T5 0x00000010
#define NET_ACTOR_T6 0x00000020
#define NET_ACTOR_T7 0x00000040
#define NET_ACTOR_T8 0x00000080
#define NET_ACTOR_T9 0x00000100
#define NET_ACTOR_T10 0x00000200
#define NET_ACTOR_PICNUM 0x00000400
#define NET_ACTOR_ANG 0x00000800
#define NET_ACTOR_EXTRA 0x00001000
#define NET_ACTOR_OWNER 0x00002000
#define NET_ACTOR_MOVFLAG 0x00004000
#define NET_ACTOR_TEMPANG 0x00008000
#define NET_ACTOR_TIMETOSLEEP 0x00010000
#define NET_ACTOR_FLAGS 0x00020000
#define NET_ACTOR_PTR1 0x00040000
#define NET_ACTOR_PTR2 0x00080000
#define NET_ACTOR_PTR3 0x00100000
#define NET_REVISIONS 64
enum netchan_t
{
@ -171,6 +87,49 @@ enum netmode_t
NET_DEDICATED_SERVER
};
#pragma pack(push,1)
typedef struct {
int32_t revision;
int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
int32_t animateptr[MAXANIMATES];
// int32_t lockclock;
int32_t msx[2048], msy[2048];
int32_t randomseed, g_globalRandom;
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
int16_t animatesect[MAXANIMATES];
int16_t cyclers[MAXCYCLERS][6];
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
int16_t g_numAnimWalls;
int16_t g_numCyclers;
int16_t headspritesect[MAXSECTORS+1];
int16_t headspritestat[MAXSTATUS+1];
int16_t nextspritesect[MAXSPRITES];
int16_t nextspritestat[MAXSPRITES];
int16_t numsectors;
int16_t numwalls;
int16_t prevspritesect[MAXSPRITES];
int16_t prevspritestat[MAXSPRITES];
uint8_t g_earthquakeTime;
uint8_t g_numPlayerSprites;
uint8_t scriptptrs[MAXSPRITES];
netactor_t actor[MAXSPRITES];
playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
animwalltype animwall[MAXANIMWALLS];
sectortype sector[MAXSECTORS];
spriteext_t spriteext[MAXSPRITES];
spritetype sprite[MAXSPRITES];
walltype wall[MAXWALLS];
uint32_t crc;
} netmapstate_t;
extern netmapstate_t *g_multiMapState[MAXPLAYERS];
extern netmapstate_t *g_multiMapRevisions[NET_REVISIONS];
#pragma pack(pop)
extern int32_t g_netMapRevision;
extern ENetHost *g_netClient;
extern ENetHost *g_netServer;
extern ENetPeer *g_netClientPeer;
@ -184,7 +143,7 @@ extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES];
extern int32_t lastwallupdate[MAXWALLS];
extern int16_t g_netStatnums[10];
extern mapstate_t *g_multiMapState;
int32_t Net_PackSprite(int32_t i,uint8_t *pbuf);
int32_t Net_UnpackSprite(int32_t i,uint8_t *pbuf);
@ -197,6 +156,7 @@ void Net_NewGame(int32_t volume,int32_t level);
void Net_ParseClientPacket(ENetEvent *event);
void Net_ParseServerPacket(ENetEvent *event);
void Net_ResetPrediction(void);
void Net_RestoreMapState(netmapstate_t *save);
void Net_SendClientInfo(void);
void Net_SendUserMapName(void);
void Net_StreamLevel(void);

View file

@ -3165,6 +3165,8 @@ static int32_t P_DoCounters(DukePlayer_t *p)
// j = g_player[snum].sync->avel;
// p->weapon_ang = -(j/5);
if (snum < 0) return 1;
if (p->invdisptime > 0)
p->invdisptime--;
@ -3521,16 +3523,16 @@ void P_CheckWeapon(DukePlayer_t *p)
else p->weapon_pos = -1;
}
void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
void P_CheckTouchDamage(DukePlayer_t *p, int32_t obj)
{
if ((j = VM_OnEvent(EVENT_CHECKTOUCHDAMAGE, p->i, sprite[p->i].yvel, -1, j)) == -1)
if ((obj = VM_OnEvent(EVENT_CHECKTOUCHDAMAGE, p->i, sprite[p->i].yvel, -1, obj)) == -1)
return;
if ((j&49152) == 49152)
if ((obj&49152) == 49152)
{
j &= (MAXSPRITES-1);
obj &= (MAXSPRITES-1);
if (sprite[j].picnum == CACTUS)
if (sprite[obj].picnum == CACTUS)
{
if (p->hurt_delay < 8)
{
@ -3544,13 +3546,13 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
return;
}
if ((j&49152) != 32768) return;
j &= (MAXWALLS-1);
if ((obj&49152) != 32768) return;
obj &= (MAXWALLS-1);
if (p->hurt_delay > 0) p->hurt_delay--;
else if (wall[j].cstat&85)
else if (wall[obj].cstat&85)
{
int32_t switchpicnum = wall[j].overpicnum;
int32_t switchpicnum = wall[obj].overpicnum;
if ((switchpicnum>W_FORCEFIELD)&&(switchpicnum<=W_FORCEFIELD+2))
switchpicnum=W_FORCEFIELD;
@ -3574,7 +3576,7 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
davect.x = p->pos.x+(sintable[(p->ang+512)&2047]>>9);
davect.y = p->pos.y+(sintable[p->ang&2047]>>9);
davect.z = p->pos.z;
A_DamageWall(p->i,j,&davect,-1);
A_DamageWall(p->i,obj,&davect,-1);
}
break;
@ -3587,7 +3589,7 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
davect.x = p->pos.x+(sintable[(p->ang+512)&2047]>>9);
davect.y = p->pos.y+(sintable[p->ang&2047]>>9);
davect.z = p->pos.z;
A_DamageWall(p->i,j,&davect,-1);
A_DamageWall(p->i,obj,&davect,-1);
}
break;
@ -3595,14 +3597,14 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
}
}
int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t tex)
{
spritetype *s = &sprite[p->i];
if ((unsigned)(j = VM_OnEvent(EVENT_CHECKFLOORDAMAGE, p->i, sprite[p->i].yvel, -1, j)) >= MAXTILES)
if ((unsigned)(tex = VM_OnEvent(EVENT_CHECKFLOORDAMAGE, p->i, sprite[p->i].yvel, -1, tex)) >= MAXTILES)
return 0;
switch (DYNAMICTILEMAP(j))
switch (DYNAMICTILEMAP(tex))
{
case HURTRAIL__STATIC:
if (rnd(32))

View file

@ -215,6 +215,7 @@ typedef struct {
char vote, gotvote, pingcnt, playerquitflag;
char user_name[32];
uint32_t revision;
} playerdata_t;
#pragma pack(pop)

View file

@ -44,7 +44,6 @@ typedef struct {
int32_t lockclock;
int32_t msx[2048], msy[2048];
int32_t randomseed, g_globalRandom;
intptr_t *vars[MAXGAMEVARS];
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
int16_t animatesect[MAXANIMATES];
@ -78,6 +77,8 @@ typedef struct {
spriteext_t spriteext[MAXSPRITES];
spritetype sprite[MAXSPRITES];
walltype wall[MAXWALLS];
intptr_t *vars[MAXGAMEVARS];
#ifdef YAX_ENABLE
int32_t numyaxbunches;
int16_t yax_bunchnum[MAXSECTORS][2];