Multiplayer improvements

git-svn-id: https://svn.eduke32.com/eduke32@1802 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2011-02-25 21:50:19 +00:00
parent 48d15c23c6
commit 043bb208b3
29 changed files with 2027 additions and 592 deletions

View file

@ -20,8 +20,8 @@ EDITORLIB=build.lib
# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll # the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll
# this path should match build\Makefile.msvc # this path should match build\Makefile.msvc
WDKROOT="C:\WinDDK\7600.16385.1" WDKROOT="H:\WinDDK\7600.16385.1"
DXROOT="C:\Program Files\Microsoft DirectX SDK (February 2010)" DXROOT="H:\Microsoft DirectX SDK (February 2010)"
!ifdef DEBUG !ifdef DEBUG
# debugging options # debugging options

View file

@ -3,13 +3,12 @@
ENGINELIB=libengine.a ENGINELIB=libengine.a
EDITORLIB=libbuild.a EDITORLIB=libbuild.a
# SDLCONFIG = /usr/local/bin/sdl-config SDLCONFIG = /usr/local/bin/sdl-configinvalid
SDLCONFIG = /usr/bin/sdl-config
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
SDLROOT = /usr/local SDLROOT = /usr/local
else else
SDLCONFIG = sdl-config SDLCONFIG = /usr/bin/sdl-config
endif endif
SDL_FRAMEWORK = 0 SDL_FRAMEWORK = 0

View file

@ -6152,7 +6152,7 @@ static void sighandler(int32_t sig, const siginfo_t *info, void *ctx)
// //
static int32_t preinitcalled = 0; static int32_t preinitcalled = 0;
#define DYNALLOC_ARRAYS // #define DYNALLOC_ARRAYS
#ifndef DYNALLOC_ARRAYS #ifndef DYNALLOC_ARRAYS
static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID];

View file

@ -120,6 +120,7 @@
<ClInclude Include="source\net.h" /> <ClInclude Include="source\net.h" />
<ClInclude Include="source\player.h" /> <ClInclude Include="source\player.h" />
<ClInclude Include="source\premap.h" /> <ClInclude Include="source\premap.h" />
<ClInclude Include="source\quotes.h" />
<ClInclude Include="source\savegame.h" /> <ClInclude Include="source\savegame.h" />
<ClInclude Include="source\sector.h" /> <ClInclude Include="source\sector.h" />
<ClInclude Include="source\_functio.h" /> <ClInclude Include="source\_functio.h" />

View file

@ -354,6 +354,9 @@
<ClInclude Include="source\demo.h"> <ClInclude Include="source\demo.h">
<Filter>eduke32\headers</Filter> <Filter>eduke32\headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="source\quotes.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="build\src\a-c.c"> <ClCompile Include="build\src\a-c.c">

View file

@ -894,16 +894,16 @@ int32_t A_IncurDamage(int32_t sn)
if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE) && (SpriteProjectile[sn].workslike & PROJECTILE_RPG)) if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE) && (SpriteProjectile[sn].workslike & PROJECTILE_RPG))
{ {
g_player[p].ps->posvel.x += g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2; actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2;
g_player[p].ps->posvel.y += g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<2; actor[sn].extra*(sintable[actor[sn].ang&2047])<<2;
} }
else if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE)) else if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE))
{ {
g_player[p].ps->posvel.x += g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1; actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1;
g_player[p].ps->posvel.y += g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<1; actor[sn].extra*(sintable[actor[sn].ang&2047])<<1;
} }
@ -916,15 +916,15 @@ int32_t A_IncurDamage(int32_t sn)
case SEENINE__STATIC: case SEENINE__STATIC:
case OOZFILTER__STATIC: case OOZFILTER__STATIC:
case EXPLODINGBARREL__STATIC: case EXPLODINGBARREL__STATIC:
g_player[p].ps->posvel.x += g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2; actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2;
g_player[p].ps->posvel.y += g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<2; actor[sn].extra*(sintable[actor[sn].ang&2047])<<2;
break; break;
default: default:
g_player[p].ps->posvel.x += g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1; actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1;
g_player[p].ps->posvel.y += g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<1; actor[sn].extra*(sintable[actor[sn].ang&2047])<<1;
break; break;
} }
@ -1282,7 +1282,7 @@ ACTOR_STATIC void G_MoveFallers(void)
s->z -= (16<<8); s->z -= (16<<8);
T2 = s->ang; T2 = s->ang;
x = s->extra; x = s->extra;
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{ {
@ -1540,7 +1540,7 @@ ACTOR_STATIC void G_MoveStandables(void)
{ {
p = A_FindPlayer(s,&x); p = A_FindPlayer(s,&x);
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
if (s->owner == -2) if (s->owner == -2)
if (g_player[p].ps->on_crane == i) if (g_player[p].ps->on_crane == i)
@ -1692,7 +1692,7 @@ ACTOR_STATIC void G_MoveStandables(void)
x = s->extra; x = s->extra;
s->extra = 1; s->extra = 1;
l = s->ang; l = s->ang;
IFHIT { actor[i].t_data[6] = 3; if ((j = A_IncurDamage(i)) >= 0) { actor[i].t_data[6] = 3;
T3 = 16; T3 = 16;
} }
s->extra = x; s->extra = x;
@ -2061,7 +2061,7 @@ DETONATE:
case TRASH__STATIC: case TRASH__STATIC:
if (s->xvel == 0) s->xvel = 1; if (s->xvel == 0) s->xvel = 1;
IFMOVING if (A_SetSprite(i, CLIPMASK0))
{ {
A_Fall(i); A_Fall(i);
if (krand()&1) s->zvel -= 256; if (krand()&1) s->zvel -= 256;
@ -2283,7 +2283,7 @@ CLEAR_THE_BOLT:
case CANWITHSOMETHING3__STATIC: case CANWITHSOMETHING3__STATIC:
case CANWITHSOMETHING4__STATIC: case CANWITHSOMETHING4__STATIC:
A_Fall(i); A_Fall(i);
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
A_PlaySound(VENT_BUST,i); A_PlaySound(VENT_BUST,i);
@ -3215,7 +3215,7 @@ ACTOR_STATIC void G_MoveTransports(void)
if (onfloorz && sectlotag == 1 && g_player[p].ps->on_ground && if (onfloorz && sectlotag == 1 && g_player[p].ps->on_ground &&
g_player[p].ps->pos.z >= sector[sect].floorz && g_player[p].ps->pos.z >= sector[sect].floorz &&
(TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->posvel.z > 2048)) (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->vel.z > 2048))
// if( onfloorz && sectlotag == 1 && g_player[p].ps->pos.z > (sector[sect].floorz-(6<<8)) ) // if( onfloorz && sectlotag == 1 && g_player[p].ps->pos.z > (sector[sect].floorz-(6<<8)) )
{ {
k = 1; k = 1;
@ -3230,14 +3230,14 @@ ACTOR_STATIC void G_MoveTransports(void)
sector[sprite[OW].sectnum].ceilingz; sector[sprite[OW].sectnum].ceilingz;
/* /*
g_player[p].ps->posvel.x = 4096-(krand()&8192); g_player[p].ps->vel.x = 4096-(krand()&8192);
g_player[p].ps->posvel.y = 4096-(krand()&8192); g_player[p].ps->vel.y = 4096-(krand()&8192);
*/ */
if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH)) if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))
g_player[p].ps->posvel.z += 512; g_player[p].ps->vel.z += 512;
} }
if (onfloorz && sectlotag == 2 && g_player[p].ps->pos.z <= sector[sect].ceilingz /*&& g_player[p].ps->posvel.z == 0*/) if (onfloorz && sectlotag == 2 && g_player[p].ps->pos.z <= sector[sect].ceilingz /*&& g_player[p].ps->vel.z == 0*/)
{ {
k = 1; k = 1;
// if( sprite[j].extra <= 0) break; // if( sprite[j].extra <= 0) break;
@ -3253,8 +3253,8 @@ ACTOR_STATIC void G_MoveTransports(void)
g_player[p].ps->jumping_toggle = 1; g_player[p].ps->jumping_toggle = 1;
g_player[p].ps->jumping_counter = 0; g_player[p].ps->jumping_counter = 0;
g_player[p].ps->posvel.z = 0; g_player[p].ps->vel.z = 0;
// g_player[p].ps->posvel.z += 1024; // g_player[p].ps->vel.z += 1024;
} }
if (k == 1) if (k == 1)
@ -3575,7 +3575,7 @@ ACTOR_STATIC void G_MoveActors(void)
break; break;
case RAT__STATIC: case RAT__STATIC:
A_Fall(i); A_Fall(i);
IFMOVING if (A_SetSprite(i, CLIPMASK0))
{ {
if ((krand()&255) < 3) A_PlaySound(RATTY,i); if ((krand()&255) < 3) A_PlaySound(RATTY,i);
s->ang += (krand()&31)-15+(sintable[(t[0]<<8)&2047]>>11); s->ang += (krand()&31)-15+(sintable[(t[0]<<8)&2047]>>11);
@ -3767,7 +3767,7 @@ ACTOR_STATIC void G_MoveActors(void)
} }
else if (g_noEnemies == 2) s->cstat = 257; else if (g_noEnemies == 2) s->cstat = 257;
} }
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
if (s->extra < 0 && t[0] != -1) if (s->extra < 0 && t[0] != -1)
{ {
@ -4005,7 +4005,7 @@ ACTOR_STATIC void G_MoveActors(void)
s->picnum = GREENSLIME+2; s->picnum = GREENSLIME+2;
s->extra = 1; s->extra = 1;
s->pal = 1; s->pal = 1;
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
if (j == FREEZEBLAST) goto BOLT; if (j == FREEZEBLAST) goto BOLT;
for (j=16; j >= 0 ; j--) for (j=16; j >= 0 ; j--)
@ -4138,7 +4138,7 @@ ACTOR_STATIC void G_MoveActors(void)
} }
} }
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
A_PlaySound(SLIM_DYING,i); A_PlaySound(SLIM_DYING,i);
@ -4744,7 +4744,7 @@ DETONATEB:
} }
else else
{ {
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
for (x=0; x<32; x++) for (x=0; x<32; x++)
RANDOMSCRAP; RANDOMSCRAP;
@ -4761,7 +4761,7 @@ DETONATEB:
t[1]+=8; t[1]+=8;
if (g_damageCameras) if (g_damageCameras)
{ {
IFHIT if ((j = A_IncurDamage(i)) >= 0)
{ {
t[0] = 1; // static t[0] = 1; // static
s->cstat = (int16_t)32768; s->cstat = (int16_t)32768;
@ -6195,17 +6195,16 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
} }
else else
{ {
t[2] += t[2] += G_GetAngleDelta(t[2]+512,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2;
G_GetAngleDelta(t[2]+512,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2;
sc->ceilingshade = 0; sc->ceilingshade = 0;
} }
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{ {
t[3]++; if (++t[3] == 5)
if (t[3] == 5)
{ {
s->zvel += 1024; s->zvel += 1024;
P_DoQuote(7,g_player[myconnectindex].ps); P_DoQuote(QUOTE_WASTED, g_player[myconnectindex].ps);
} }
} }
@ -6312,7 +6311,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (GetAnimationGoal(&sector[s->sectnum].ceilingz) >= 0) if (GetAnimationGoal(&sector[s->sectnum].ceilingz) >= 0)
break; break;
default: default:
activatebysector(s->sectnum,i); G_ActivateBySector(s->sectnum,i);
t[0] = 0; t[0] = 0;
break; break;
} }
@ -6821,7 +6820,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
IFHITSECT IFHITSECT
{ {
P_DoQuote(8,g_player[myconnectindex].ps); P_DoQuote(QUOTE_UNLOCKED,g_player[myconnectindex].ps);
l = headspritestat[STAT_EFFECTOR]; l = headspritestat[STAT_EFFECTOR];
while (l >= 0) while (l >= 0)

View file

@ -138,8 +138,8 @@ void G_OpenDemoWrite(void)
if ((g_player[myconnectindex].ps->gm&MODE_GAME) && g_player[myconnectindex].ps->dead_flag) if ((g_player[myconnectindex].ps->gm&MODE_GAME) && g_player[myconnectindex].ps->dead_flag)
{ {
Bstrcpy(ScriptQuotes[122], "CANNOT START DEMO RECORDING WHEN DEAD!"); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "CANNOT START DEMO RECORDING WHEN DEAD!");
P_DoQuote(122, g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0; ud.recstat = ud.m_recstat = 0;
return; return;
} }
@ -156,8 +156,8 @@ void G_OpenDemoWrite(void)
OSD_Printf("contain a RESIZEARRAY command, you can force recording with the\n"); OSD_Printf("contain a RESIZEARRAY command, you can force recording with the\n");
OSD_Printf("`demorec_force' cvar. Alternatively, you can disable diff recording\n"); OSD_Printf("`demorec_force' cvar. Alternatively, you can disable diff recording\n");
OSD_Printf("with the `demorec_diffs' cvar.\n\n"); OSD_Printf("with the `demorec_diffs' cvar.\n\n");
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS."); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0; ud.recstat = ud.m_recstat = 0;
return; return;
} }
@ -178,8 +178,8 @@ void G_OpenDemoWrite(void)
demorec_synccompress_cvar|(demorec_seeds_cvar<<1)); demorec_synccompress_cvar|(demorec_seeds_cvar<<1));
if (i) if (i)
{ {
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS."); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
Bfclose(g_demo_filePtr), g_demo_filePtr=NULL; Bfclose(g_demo_filePtr), g_demo_filePtr=NULL;
ud.recstat = ud.m_recstat = 0; ud.recstat = ud.m_recstat = 0;
return; return;
@ -189,8 +189,8 @@ void G_OpenDemoWrite(void)
demo_synccompress = demorec_synccompress_cvar; demo_synccompress = demorec_synccompress_cvar;
demorec_difftics = demorec_difftics_cvar; demorec_difftics = demorec_difftics_cvar;
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STARTED"); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STARTED");
P_DoQuote(122, g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.reccnt = 0; ud.reccnt = 0;
ud.recstat = ud.m_recstat = 1; // ud.recstat = ud.m_recstat = 1; //
@ -269,8 +269,8 @@ void G_CloseDemoWrite(void)
sv_freemem(); sv_freemem();
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STOPPED"); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STOPPED");
P_DoQuote(122, g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
} }
#if KRANDDEBUG #if KRANDDEBUG
krd_print("krandrec.log"); krd_print("krandrec.log");

View file

@ -64,7 +64,7 @@ extern "C" {
#define WW2GI (g_gameType & 2) #define WW2GI (g_gameType & 2)
// increase by 3, because atomic GRP adds 1, and Shareware adds 2 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION_JF 195 #define BYTEVERSION_JF 198
#define BYTEVERSION_13 27 #define BYTEVERSION_13 27
#define BYTEVERSION_14 116 #define BYTEVERSION_14 116
#define BYTEVERSION_15 117 #define BYTEVERSION_15 117
@ -86,15 +86,10 @@ extern "C" {
#define TICSPERFRAME 4 #define TICSPERFRAME 4
#define TICRATE 120 #define TICRATE 120
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define NO 0 #define NO 0
#define YES 1 #define YES 1
#define PACKBUF_SIZE 65535 #define PACKBUF_SIZE 2048
#define TILE_SAVESHOT (MAXTILES-1) #define TILE_SAVESHOT (MAXTILES-1)
#define TILE_LOADSHOT (MAXTILES-3) #define TILE_LOADSHOT (MAXTILES-3)
@ -118,6 +113,7 @@ extern "C" {
#include "music.h" #include "music.h"
#include "player.h" #include "player.h"
#include "actors.h" #include "actors.h"
#include "quotes.h"
#include "global.h" #include "global.h"
#include "sector.h" #include "sector.h"
#include "net.h" #include "net.h"

View file

@ -25,7 +25,7 @@ extern "C"
#define ENET_VERSION_MAJOR 1 #define ENET_VERSION_MAJOR 1
#define ENET_VERSION_MINOR 3 #define ENET_VERSION_MINOR 3
#define ENET_VERSION_PATCH 0 #define ENET_VERSION_PATCH 1
#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)

View file

@ -178,6 +178,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
ENetOutgoingCommand * outgoingCommand; ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand; ENetListIterator currentCommand;
ENetProtocolCommand commandNumber; ENetProtocolCommand commandNumber;
int wasSent = 1;
for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
currentCommand != enet_list_end (& peer -> sentReliableCommands); currentCommand != enet_list_end (& peer -> sentReliableCommands);
@ -207,6 +208,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands)) if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands))
return ENET_PROTOCOL_COMMAND_NONE; return ENET_PROTOCOL_COMMAND_NONE;
wasSent = 0;
} }
if (channelID < peer -> channelCount) if (channelID < peer -> channelCount)
@ -227,6 +230,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (outgoingCommand -> packet != NULL) if (outgoingCommand -> packet != NULL)
{ {
if (wasSent)
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
-- outgoingCommand -> packet -> referenceCount; -- outgoingCommand -> packet -> referenceCount;
@ -256,6 +260,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
size_t channelCount; size_t channelCount;
ENetPeer * currentPeer; ENetPeer * currentPeer;
ENetProtocol verifyCommand; ENetProtocol verifyCommand;
UNREFERENCED_PARAMETER(header); UNREFERENCED_PARAMETER(header);
channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount); channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount);
@ -614,6 +619,7 @@ enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol
UNREFERENCED_PARAMETER(host); UNREFERENCED_PARAMETER(host);
UNREFERENCED_PARAMETER(peer); UNREFERENCED_PARAMETER(peer);
UNREFERENCED_PARAMETER(command); UNREFERENCED_PARAMETER(command);
return 0; return 0;
} }
@ -1266,7 +1272,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even
return 0; return 0;
} }
static void static int
enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
{ {
ENetProtocol * command = & host -> commands [host -> commandCount]; ENetProtocol * command = & host -> commands [host -> commandCount];
@ -1276,6 +1282,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
ENetChannel *channel; ENetChannel *channel;
enet_uint16 reliableWindow; enet_uint16 reliableWindow;
size_t commandSize; size_t commandSize;
int windowExceeded = 0, windowWrap = 0, canPing = 1;
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
@ -1285,38 +1292,53 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
if (channel != NULL && if (channel != NULL)
{
if (! windowWrap &&
outgoingCommand -> sendAttempts < 1 && outgoingCommand -> sendAttempts < 1 &&
! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
(channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
break; windowWrap = 1;
if (windowWrap)
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
peer -> mtu - host -> packetSize < commandSize)
{ {
host -> continueSending = 1; currentCommand = enet_list_next (currentCommand);
break; continue;
}
} }
if (outgoingCommand -> packet != NULL) if (outgoingCommand -> packet != NULL)
{
if (! windowExceeded)
{ {
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE; enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu)) if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
break; windowExceeded = 1;
}
if (windowExceeded)
{
currentCommand = enet_list_next (currentCommand);
if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)) continue;
}
}
canPing = 0;
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
peer -> mtu - host -> packetSize < commandSize ||
(outgoingCommand -> packet != NULL &&
(enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
{ {
host -> continueSending = 1; host -> continueSending = 1;
break; break;
} }
}
currentCommand = enet_list_next (currentCommand); currentCommand = enet_list_next (currentCommand);
@ -1370,6 +1392,8 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
host -> commandCount = command - host -> commands; host -> commandCount = command - host -> commands;
host -> bufferCount = buffer - host -> buffers; host -> bufferCount = buffer - host -> buffers;
return canPing;
} }
static int static int
@ -1407,10 +1431,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
enet_protocol_check_timeouts (host, currentPeer, event) == 1) enet_protocol_check_timeouts (host, currentPeer, event) == 1)
return 1; return 1;
if (! enet_list_empty (& currentPeer -> outgoingReliableCommands)) if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
enet_protocol_send_reliable_outgoing_commands (host, currentPeer); enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
else enet_list_empty (& currentPeer -> sentReliableCommands) &&
if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL && ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing)) currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
{ {

View file

@ -67,10 +67,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <WinIoCtl.h>
extern int32_t G_GetVersionFromWebsite(char *buffer); extern int32_t G_GetVersionFromWebsite(char *buffer);
#define UPDATEINTERVAL 604800 // 1w #define UPDATEINTERVAL 604800 // 1w
#else #else
static int32_t usecwd = 0; static int32_t usecwd = 0;
#include <sys/ioctl.h>
#endif /* _WIN32 */ #endif /* _WIN32 */
int32_t g_quitDeadline = 0; int32_t g_quitDeadline = 0;
@ -528,7 +530,7 @@ void G_HandleSpecialKeys(void)
// CONTROL_ProcessBinds(); // CONTROL_ProcessBinds();
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{ {
if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
{ {
@ -546,7 +548,7 @@ void G_HandleSpecialKeys(void)
{ {
KB_ClearKeyDown(sc_F12); KB_ClearKeyDown(sc_F12);
screencapture("duke0000.tga",0); screencapture("duke0000.tga",0);
P_DoQuote(103,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SCREEN_SAVED,g_player[myconnectindex].ps);
} }
// only dispatch commands here when not in a game // only dispatch commands here when not in a game
@ -1695,7 +1697,7 @@ static void G_PrintCoords(int32_t snum)
printext256(250L,y,31,-1,tempbuf,0); printext256(250L,y,31,-1,tempbuf,0);
Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz); Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz);
printext256(250L,y+9L,31,-1,tempbuf,0); printext256(250L,y+9L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"ZV= %d",g_player[snum].ps->posvel.z); Bsprintf(tempbuf,"ZV= %d",g_player[snum].ps->vel.z);
printext256(250L,y+18L,31,-1,tempbuf,0); printext256(250L,y+18L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"OG= %d",g_player[snum].ps->on_ground); Bsprintf(tempbuf,"OG= %d",g_player[snum].ps->on_ground);
printext256(250L,y+27L,31,-1,tempbuf,0); printext256(250L,y+27L,31,-1,tempbuf,0);
@ -1727,7 +1729,7 @@ void G_PrintGameQuotes(void)
else if (j > 12) k += 24; else if (j > 12) k += 24;
} }
if (g_player[screenpeek].ps->fta > 1 && (g_player[screenpeek].ps->ftq < 115 || g_player[screenpeek].ps->ftq > 117)) if (g_player[screenpeek].ps->fta > 1 && (g_player[screenpeek].ps->ftq < QUOTE_RESERVED || g_player[screenpeek].ps->ftq > QUOTE_RESERVED3))
{ {
if (g_player[screenpeek].ps->fta > 6) if (g_player[screenpeek].ps->fta > 6)
k += 7; k += 7;
@ -1778,7 +1780,7 @@ void G_PrintGameQuotes(void)
k = 0; k = 0;
if (g_player[screenpeek].ps->ftq == 115 || g_player[screenpeek].ps->ftq == 116 || g_player[screenpeek].ps->ftq == 117) if (g_player[screenpeek].ps->ftq >= QUOTE_RESERVED && g_player[screenpeek].ps->ftq <= QUOTE_RESERVED3)
{ {
k = 140;//quotebot-8-4; k = 140;//quotebot-8-4;
} }
@ -1826,8 +1828,8 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
if (ud.fta_on == 0) if (ud.fta_on == 0)
return; return;
if (p->fta > 0 && q != 115 && q != 116) if (p->fta > 0 && q != QUOTE_RESERVED && q != QUOTE_RESERVED2)
if (p->ftq == 115 || p->ftq == 116) return; if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return;
p->fta = 100; p->fta = 100;
@ -3220,6 +3222,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
int32_t tmpyx=yxaspect, tmpvr=viewingrange; int32_t tmpyx=yxaspect, tmpvr=viewingrange;
if (g_networkMode == NET_DEDICATED_SERVER) return;
if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always
{ {
if (getrendermode() >= 3 || ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) if (getrendermode() >= 3 || ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100))
@ -6661,7 +6665,7 @@ GAME_STATIC void G_DoCheats(void)
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))) if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
{ {
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
// P_DoQuote(46,g_player[myconnectindex].ps); // P_DoQuote(QUOTE_46,g_player[myconnectindex].ps);
return; return;
} }
@ -6709,14 +6713,14 @@ FOUNDCHEAT:
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(119,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_ALL_WEAPONS, g_player[myconnectindex].ps);
return; return;
case CHEAT_INVENTORY: case CHEAT_INVENTORY:
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
G_CheatGetInv(); G_CheatGetInv();
P_DoQuote(120,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_ALL_INV, g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
return; return;
@ -6724,7 +6728,7 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->got_access = 7; g_player[myconnectindex].ps->got_access = 7;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(121,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_ALL_KEYS, g_player[myconnectindex].ps);
return; return;
case CHEAT_DEBUG: case CHEAT_DEBUG:
@ -6743,7 +6747,7 @@ FOUNDCHEAT:
ud.clipping = 1-ud.clipping; ud.clipping = 1-ud.clipping;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(112+ud.clipping,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_NOCLIP-ud.clipping, g_player[myconnectindex].ps);
return; return;
case CHEAT_RESERVED2: case CHEAT_RESERVED2:
@ -6753,7 +6757,7 @@ FOUNDCHEAT:
return; return;
case CHEAT_ALLEN: case CHEAT_ALLEN:
P_DoQuote(79,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_ALLEN,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_N);
return; return;
@ -6779,7 +6783,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].lotag = 0; sprite[g_player[myconnectindex].ps->i].lotag = 0;
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup; sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup;
P_DoQuote(17,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_GODMODE_ON,g_player[myconnectindex].ps);
} }
else else
{ {
@ -6787,7 +6791,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
actor[g_player[myconnectindex].ps->i].extra = -1; actor[g_player[myconnectindex].ps->i].extra = -1;
g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health;
P_DoQuote(18,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_GODMODE_OFF,g_player[myconnectindex].ps);
} }
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
@ -6816,9 +6820,9 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].hitag = 0; sprite[g_player[myconnectindex].ps->i].hitag = 0;
sprite[g_player[myconnectindex].ps->i].lotag = 0; sprite[g_player[myconnectindex].ps->i].lotag = 0;
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup; sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup;
Bstrcpy(ScriptQuotes[122],"COME GET SOME!"); Bstrcpy(ScriptQuotes[QUOTE_RESERVED4],"COME GET SOME!");
S_PlaySound(DUKE_GETWEAPON2); S_PlaySound(DUKE_GETWEAPON2);
P_DoQuote(122,g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
G_CheatGetInv(); G_CheatGetInv();
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
g_player[myconnectindex].ps->gotweapon |= (1<<weapon); g_player[myconnectindex].ps->gotweapon |= (1<<weapon);
@ -6834,7 +6838,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
actor[g_player[myconnectindex].ps->i].extra = -1; actor[g_player[myconnectindex].ps->i].extra = -1;
g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health;
P_DoQuote(18,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_GODMODE_OFF, g_player[myconnectindex].ps);
} }
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
@ -6859,10 +6863,10 @@ FOUNDCHEAT:
P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]);
G_CheatGetInv(); G_CheatGetInv();
g_player[myconnectindex].ps->got_access = 7; g_player[myconnectindex].ps->got_access = 7;
P_DoQuote(5,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_EVERYTHING, g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
// P_DoQuote(21,g_player[myconnectindex].ps); // P_DoQuote(QUOTE_21,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->inven_icon = 1; g_player[myconnectindex].ps->inven_icon = 1;
@ -6937,14 +6941,14 @@ FOUNDCHEAT:
g_cameraDistance = 0; g_cameraDistance = 0;
g_cameraClock = totalclock; g_cameraClock = totalclock;
} }
P_DoQuote(22,g_player[myconnectindex].ps); // P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
case CHEAT_TIME: case CHEAT_TIME:
P_DoQuote(21,g_player[myconnectindex].ps); // P_DoQuote(QUOTE_21,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
@ -6965,7 +6969,7 @@ FOUNDCHEAT:
} }
G_OperateForceFields(g_player[myconnectindex].ps->i,-1); G_OperateForceFields(g_player[myconnectindex].ps->i,-1);
P_DoQuote(100,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_UNLOCK,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
@ -6979,7 +6983,7 @@ FOUNDCHEAT:
case CHEAT_ITEMS: case CHEAT_ITEMS:
G_CheatGetInv(); G_CheatGetInv();
g_player[myconnectindex].ps->got_access = 7; g_player[myconnectindex].ps->got_access = 7;
P_DoQuote(5,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_EVERYTHING,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
@ -6992,7 +6996,7 @@ FOUNDCHEAT:
show2dsector[i] = 255; show2dsector[i] = 255;
for (i=0; i<(MAXWALLS>>3); i++) for (i=0; i<(MAXWALLS>>3); i++)
show2dwall[i] = 255; show2dwall[i] = 255;
P_DoQuote(111,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SHOW_MAP_ON, g_player[myconnectindex].ps);
} }
else else
{ {
@ -7000,14 +7004,14 @@ FOUNDCHEAT:
show2dsector[i] = 0; show2dsector[i] = 0;
for (i=0; i<(MAXWALLS>>3); i++) for (i=0; i<(MAXWALLS>>3); i++)
show2dwall[i] = 0; show2dwall[i] = 0;
P_DoQuote(1,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SHOW_MAP_OFF, g_player[myconnectindex].ps);
} }
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
case CHEAT_TODD: case CHEAT_TODD:
P_DoQuote(99,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_TODD,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
@ -7019,7 +7023,7 @@ FOUNDCHEAT:
return; return;
case CHEAT_BETA: case CHEAT_BETA:
P_DoQuote(105,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_BETA,g_player[myconnectindex].ps);
KB_ClearKeyDown(sc_H); KB_ClearKeyDown(sc_H);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
@ -7029,19 +7033,22 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399; g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399;
g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200; g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200;
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(37,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEAT_STEROIDS,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
case CHEAT_MONSTERS: case CHEAT_MONSTERS:
{ {
char *s[] = { "ON", "OFF", "ON" }; char *s[] = { "ON", "OFF" };
if (++g_noEnemies == 3)
g_noEnemies = 0;
g_noEnemies++;
if (g_noEnemies == 3) g_noEnemies = 0;
g_player[screenpeek].ps->cheat_phase = 0; g_player[screenpeek].ps->cheat_phase = 0;
Bsprintf(ScriptQuotes[122],"MONSTERS: %s",s[(uint8_t)g_noEnemies]);
P_DoQuote(122,g_player[myconnectindex].ps); Bsprintf(ScriptQuotes[QUOTE_RESERVED4], "MONSTERS: %s", s[g_noEnemies%1]);
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();
return; return;
} }
@ -7073,13 +7080,13 @@ FOUNDCHEAT:
{ {
if (ud.player_skill == 4) if (ud.player_skill == 4)
{ {
P_DoQuote(22,g_player[myconnectindex].ps); P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
} }
else else
{ {
g_player[myconnectindex].ps->cheat_phase = 1; g_player[myconnectindex].ps->cheat_phase = 1;
// P_DoQuote(25,g_player[myconnectindex].ps); // P_DoQuote(QUOTE_25,g_player[myconnectindex].ps);
cheatbuflen = 0; cheatbuflen = 0;
} }
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
@ -7192,14 +7199,14 @@ void G_HandleLocalKeys(void)
{ {
CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon); CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon);
ud.config.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons; ud.config.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons;
P_DoQuote(82-ud.showweapons,g_player[screenpeek].ps); P_DoQuote(QUOTE_WEAPON_MODE_OFF-ud.showweapons,g_player[screenpeek].ps);
} }
if (BUTTON(gamefunc_Toggle_Crosshair)) if (BUTTON(gamefunc_Toggle_Crosshair))
{ {
CONTROL_ClearButton(gamefunc_Toggle_Crosshair); CONTROL_ClearButton(gamefunc_Toggle_Crosshair);
ud.crosshair = !ud.crosshair; ud.crosshair = !ud.crosshair;
P_DoQuote(21-ud.crosshair,g_player[screenpeek].ps); P_DoQuote(QUOTE_CROSSHAIR_OFF-ud.crosshair,g_player[screenpeek].ps);
} }
if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode)) if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode))
@ -7212,7 +7219,7 @@ void G_HandleLocalKeys(void)
ud.foly = g_player[screenpeek].ps->opos.y; ud.foly = g_player[screenpeek].ps->opos.y;
ud.fola = g_player[screenpeek].ps->oang; ud.fola = g_player[screenpeek].ps->oang;
} }
P_DoQuote(83+ud.scrollmode,g_player[myconnectindex].ps); P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps);
} }
if (KB_UnBoundKeyPressed(sc_ScrollLock)) if (KB_UnBoundKeyPressed(sc_ScrollLock))
@ -7338,7 +7345,7 @@ void G_HandleLocalKeys(void)
{ {
if (SHIFTS_IS_PRESSED) if (SHIFTS_IS_PRESSED)
{ {
if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == 26) if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == QUOTE_MUSIC)
{ {
i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6);
g_musicIndex = (g_musicIndex+1)%i; g_musicIndex = (g_musicIndex+1)%i;
@ -7351,10 +7358,10 @@ void G_HandleLocalKeys(void)
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
{ {
if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex)) if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex))
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
else else
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
P_DoQuote(26,g_player[myconnectindex].ps); P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps);
} }
return; return;
} }
@ -7473,7 +7480,7 @@ void G_HandleLocalKeys(void)
FAKE_F2: FAKE_F2:
if (sprite[g_player[myconnectindex].ps->i].extra <= 0) if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{ {
P_DoQuote(118,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps);
return; return;
} }
ChangeToMenu(350); ChangeToMenu(350);
@ -7542,7 +7549,7 @@ FAKE_F3:
if (sprite[g_player[myconnectindex].ps->i].extra <= 0) if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{ {
P_DoQuote(118,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps);
return; return;
} }
g_screenCapture = 1; g_screenCapture = 1;
@ -7571,32 +7578,32 @@ FAKE_F3:
g_cameraDistance = 0; g_cameraDistance = 0;
g_cameraClock = totalclock; g_cameraClock = totalclock;
} }
P_DoQuote(109+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps); P_DoQuote(QUOTE_VIEW_MODE_OFF+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps);
} }
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0) if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
{ {
KB_ClearKeyDown(sc_F5); KB_ClearKeyDown(sc_F5);
if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL) if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL)
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
{ {
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[26],". USE SHIFT-F5 TO CHANGE."); Bstrcat(ScriptQuotes[QUOTE_MUSIC],". USE SHIFT-F5 TO CHANGE.");
} }
else ScriptQuotes[26][0] = '\0'; else ScriptQuotes[QUOTE_MUSIC][0] = '\0';
P_DoQuote(26,g_player[myconnectindex].ps); P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
} }
if (KB_UnBoundKeyPressed(sc_F8)) if (KB_UnBoundKeyPressed(sc_F8))
{ {
KB_ClearKeyDown(sc_F8); KB_ClearKeyDown(sc_F8);
ud.fta_on = !ud.fta_on; ud.fta_on = !ud.fta_on;
if (ud.fta_on) P_DoQuote(23,g_player[myconnectindex].ps); if (ud.fta_on) P_DoQuote(QUOTE_MESSAGES_ON,g_player[myconnectindex].ps);
else else
{ {
ud.fta_on = 1; ud.fta_on = 1;
P_DoQuote(24,g_player[myconnectindex].ps); P_DoQuote(QUOTE_MESSAGES_OFF,g_player[myconnectindex].ps);
ud.fta_on = 0; ud.fta_on = 0;
} }
} }
@ -7673,7 +7680,7 @@ FAKE_F3:
{ {
CONTROL_ClearButton(gamefunc_AutoRun); CONTROL_ClearButton(gamefunc_AutoRun);
ud.auto_run = 1-ud.auto_run; ud.auto_run = 1-ud.auto_run;
P_DoQuote(85+ud.auto_run,g_player[myconnectindex].ps); P_DoQuote(QUOTE_RUN_MODE_OFF+ud.auto_run,g_player[myconnectindex].ps);
} }
if (BUTTON(gamefunc_Map)) if (BUTTON(gamefunc_Map))
@ -7809,7 +7816,7 @@ static int32_t getfilenames(const char *path, char kind[])
} }
static char *autoloadmasks[] = { "*.grp", "*.zip", "*.pk3" }; static char *autoloadmasks[] = { "*.grp", "*.zip", "*.pk3" };
#define NUMAUTOLOADMASKS 3 #define NUMAUTOLOADMASKS (int32_t)(sizeof(autoloadmasks)/sizeof(autoloadmasks[0]))
static void G_DoAutoload(const char *fn) static void G_DoAutoload(const char *fn)
{ {
@ -7829,7 +7836,7 @@ static void G_DoAutoload(const char *fn)
} }
} }
static char *makename(char *destname, char *OGGname, const char *origname) static char *S_OggifyFilename(char *destname, char *OGGname, const char *origname)
{ {
if (!origname) if (!origname)
return destname; return destname;
@ -7859,7 +7866,7 @@ static int32_t S_DefineSound(int32_t ID,char *name)
{ {
if (ID >= MAXSOUNDS) if (ID >= MAXSOUNDS)
return 1; return 1;
g_sounds[ID].filename1 =makename(g_sounds[ID].filename1,name,g_sounds[ID].filename); g_sounds[ID].filename1 =S_OggifyFilename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename); // initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
// S_LoadSound(ID); // S_LoadSound(ID);
return 0; return 0;
@ -7899,7 +7906,7 @@ static int32_t S_DefineMusic(char *ID,char *name)
ID = MapInfo[sel].musicfn; ID = MapInfo[sel].musicfn;
} }
MapInfo[sel].alt_musicfn = makename(MapInfo[sel].alt_musicfn,name,ID); MapInfo[sel].alt_musicfn = S_OggifyFilename(MapInfo[sel].alt_musicfn,name,ID);
// initprintf("%-15s | ",ID); // initprintf("%-15s | ",ID);
// initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn); // initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn);
// S_PlayMusic(ID,sel); // S_PlayMusic(ID,sel);
@ -8190,7 +8197,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
initprintf("\n"); initprintf("\n");
i = 1; i = 1;
while (i < argc) do
{ {
c = (char *)argv[i]; c = (char *)argv[i];
if ((*c == '-') if ((*c == '-')
@ -8318,7 +8325,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
if (!Bstrcasecmp(c+1,"server")) if (!Bstrcasecmp(c+1,"server"))
{ {
g_netServerMode = 1; g_networkMode = NET_SERVER;
g_noSetup = g_noLogo = TRUE;
i++;
continue;
}
if (!Bstrcasecmp(c+1,"dedicated"))
{
g_networkMode = NET_DEDICATED_SERVER;
g_noSetup = g_noLogo = TRUE; g_noSetup = g_noLogo = TRUE;
i++; i++;
continue; continue;
@ -8648,6 +8662,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
i++; i++;
} }
while (i < argc);
} }
} }
@ -9305,6 +9320,7 @@ int32_t app_main(int32_t argc,const char **argv)
break; break;
} }
} }
if (i == argc && win_checkinstance()) if (i == argc && win_checkinstance())
{ {
if (!wm_ynbox("EDuke32","Another Build game is currently running. " if (!wm_ynbox("EDuke32","Another Build game is currently running. "
@ -9747,7 +9763,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);
if (g_netServerMode) if (g_networkMode == NET_SERVER || g_networkMode == NET_DEDICATED_SERVER)
{ {
ENetAddress address = { ENET_HOST_ANY, g_netPort }; ENetAddress address = { ENET_HOST_ANY, g_netPort };
g_netServer = enet_host_create(&address, MAXPLAYERS, CHAN_MAX, 0, 0); g_netServer = enet_host_create(&address, MAXPLAYERS, CHAN_MAX, 0, 0);
@ -9842,6 +9858,8 @@ CLEAN_DIRECTORY:
OSD_SetVersion(tempbuf, 10,0); OSD_SetVersion(tempbuf, 10,0);
registerosdcommands(); registerosdcommands();
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (CONTROL_Startup(1, &GetTime, TICRATE)) if (CONTROL_Startup(1, &GetTime, TICRATE))
{ {
fprintf(stderr, "There was an error initializing the CONTROL system.\n"); fprintf(stderr, "There was an error initializing the CONTROL system.\n");
@ -9859,6 +9877,7 @@ CLEAN_DIRECTORY:
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0; i<joynumaxes; i++) for (i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]); setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
}
{ {
char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,"."); char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,".");
@ -9869,12 +9888,13 @@ CLEAN_DIRECTORY:
Bfree(ptr); Bfree(ptr);
} }
i = clipmapinfo_load("_clipshape0.map"); if ((i = clipmapinfo_load("_clipshape0.map")) > 0)
if (i>0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", i); initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
OSD_Exec("autoexec.cfg"); OSD_Exec("autoexec.cfg");
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0) if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
{ {
int32_t i = 0; int32_t i = 0;
@ -9916,6 +9936,7 @@ CLEAN_DIRECTORY:
S_MusicStartup(); S_MusicStartup();
S_SoundStartup(); S_SoundStartup();
}
// loadtmb(); // loadtmb();
if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2)) if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2))
@ -9939,8 +9960,11 @@ CLEAN_DIRECTORY:
MAIN_LOOP_RESTART: MAIN_LOOP_RESTART:
if (g_networkMode != NET_DEDICATED_SERVER)
{
G_GetCrosshairColor(); G_GetCrosshairColor();
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
}
if (ud.warp_on == 0) if (ud.warp_on == 0)
{ {
@ -9965,8 +9989,11 @@ MAIN_LOOP_RESTART:
Net_WaitForServer(); Net_WaitForServer();
} }
else G_DisplayLogo(); else if (g_networkMode != NET_DEDICATED_SERVER)
G_DisplayLogo();
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (G_PlaybackDemo()) if (G_PlaybackDemo())
{ {
FX_StopAllSounds(); FX_StopAllSounds();
@ -9975,6 +10002,7 @@ MAIN_LOOP_RESTART:
goto MAIN_LOOP_RESTART; goto MAIN_LOOP_RESTART;
} }
} }
}
else if (ud.warp_on == 1) else if (ud.warp_on == 1)
{ {
G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill);
@ -10015,19 +10043,49 @@ MAIN_LOOP_RESTART:
} }
sampletimer(); sampletimer();
MUSIC_Update();
Net_GetPackets(); Net_GetPackets();
G_HandleLocalKeys();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO); bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
// stdin -> OSD input for dedicated server
if (g_networkMode == NET_DEDICATED_SERVER)
{
int32_t nb, flag = 1;
char ch;
static uint32_t bufpos = 0;
static char buf[128];
ioctl(0, FIONBIO, &flag);
if ((nb = read(0, &ch, 1)) > 0 && bufpos < sizeof(buf))
{
if (ch != '\n')
buf[bufpos++] = ch;
if (ch == '\n' || bufpos >= sizeof(buf))
{
buf[bufpos] = 0;
OSD_Dispatch(buf);
bufpos = 0;
}
}
}
else
{
MUSIC_Update();
G_HandleLocalKeys();
}
OSD_DispatchQueued(); OSD_DispatchQueued();
if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME) if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
{
if (g_networkMode != NET_DEDICATED_SERVER)
{ {
CONTROL_ProcessBinds(); CONTROL_ProcessBinds();
getinput(myconnectindex); getinput(myconnectindex);
}
avg.fvel += loc.fvel; avg.fvel += loc.fvel;
avg.svel += loc.svel; avg.svel += loc.svel;
@ -10065,7 +10123,7 @@ MAIN_LOOP_RESTART:
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop()) (g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
j++; j++;
} }
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME); while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME);
if (j) continue; if (j) continue;
} }
@ -10094,6 +10152,12 @@ MAIN_LOOP_RESTART:
g_multiMapState = NULL; g_multiMapState = NULL;
} }
if (g_networkMode == NET_DEDICATED_SERVER)
{
idle();
goto skipframe;
}
if (framewaiting) if (framewaiting)
{ {
framewaiting--; framewaiting--;
@ -10128,6 +10192,7 @@ MAIN_LOOP_RESTART:
framewaiting++; framewaiting++;
} }
skipframe:
if (g_player[myconnectindex].ps->gm&MODE_DEMO) if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART; goto MAIN_LOOP_RESTART;
} }
@ -10184,12 +10249,12 @@ int32_t G_DoMoveThings(void)
sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek && sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek &&
g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0) g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0)
{ {
if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == 117) if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == QUOTE_RESERVED3)
{ {
if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hitinfo.hitsprite]) < 9216) if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hitinfo.hitsprite]) < 9216)
{ {
Bsprintf(ScriptQuotes[117],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]); Bsprintf(ScriptQuotes[QUOTE_RESERVED3],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]);
g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = 117; g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = QUOTE_RESERVED3;
} }
} }
else if (g_player[screenpeek].ps->fta > 2) g_player[screenpeek].ps->fta -= 3; else if (g_player[screenpeek].ps->fta > 2) g_player[screenpeek].ps->fta -= 3;
@ -10301,7 +10366,7 @@ int32_t G_DoMoveThings(void)
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2); Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2);
j += sizeof(vec3_t) * 2; j += sizeof(vec3_t) * 2;
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->posvel.x, sizeof(vec3_t)); Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->vel.x, sizeof(vec3_t));
j += sizeof(vec3_t); j += sizeof(vec3_t);
*(int16_t *)&packbuf[j] = g_player[myconnectindex].ps->ang; *(int16_t *)&packbuf[j] = g_player[myconnectindex].ps->ang;
@ -10403,6 +10468,9 @@ void G_BonusScreen(int32_t bonusonly)
350, 380,VICTORY1+8,86,59 350, 380,VICTORY1+8,86,59
}; };
if (g_networkMode == NET_DEDICATED_SERVER)
return;
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
wm_setapptitle(tempbuf); wm_setapptitle(tempbuf);

View file

@ -64,6 +64,17 @@ enum LogoFlags_t {
LOGO_TENSCREEN = 0x00000200 LOGO_TENSCREEN = 0x00000200
}; };
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL,
BASEPALCOUNT
} basepal_t;
#define deletesprite A_DeleteSprite #define deletesprite A_DeleteSprite
void A_DeleteSprite(int32_t s); void A_DeleteSprite(int32_t s);
@ -227,23 +238,9 @@ extern palette_t DefaultCrosshairColors;
extern uint32_t g_frameDelay; extern uint32_t g_frameDelay;
// Watch out for MAXBASEPALS in the engine before increasing this
#define BASEPALCOUNT 7
extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768],*anim_pal; extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768],*anim_pal;
extern uint8_t *basepaltable[BASEPALCOUNT]; extern uint8_t *basepaltable[BASEPALCOUNT];
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL
} basepal_t;
extern user_defs ud; extern user_defs ud;
int32_t A_CheckInventorySprite(spritetype *s); int32_t A_CheckInventorySprite(spritetype *s);
@ -313,12 +310,11 @@ static inline int32_t G_GetTeamPalette(int32_t team)
int32_t G_GetVersionFromWebsite(char *buffer); int32_t G_GetVersionFromWebsite(char *buffer);
#endif #endif
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) #ifdef RENDERTYPEWIN
void app_crashhandler(void);
#ifdef USE_OPENGL
extern char forcegl; extern char forcegl;
#endif #endif
#if defined(RENDERTYPEWIN)
void app_crashhandler(void);
#endif #endif
#if KRANDDEBUG #if KRANDDEBUG

View file

@ -5582,6 +5582,7 @@ repeatcase:
if (ScriptQuotes[k] == NULL) if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuotes[k]) if (!ScriptQuotes[k])
{ {
ScriptQuotes[k] = NULL; ScriptQuotes[k] = NULL;

View file

@ -83,31 +83,28 @@ void VM_ScriptInfo(void)
void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist) void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist)
{ {
if (iEventID < 0 || iEventID >= MAXGAMEEVENTS || apScriptGameEvent[iEventID] == 0) if (!apScriptGameEvent[iEventID])
return; return;
insptr = apScriptGameEvent[iEventID];
{ {
intptr_t *oinsptr=insptr; intptr_t *oinsptr=insptr;
vmstate_t vm_backup; vmstate_t vm_backup;
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0], vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
&sprite[iActor], 0 &sprite[iActor], 0 };
};
Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t)); Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t));
Bmemcpy(&vm, &tempvm, sizeof(vmstate_t)); Bmemcpy(&vm, &tempvm, sizeof(vmstate_t));
insptr = apScriptGameEvent[iEventID];
VM_Execute(0); VM_Execute(0);
if (vm.g_flags & VM_KILL) if (vm.g_flags & VM_KILL)
{ {
// if player was set to squish, first stop that... // if player was set to squish, first stop that...
if (vm.g_p >= 0) if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
{
if (g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1; g_player[vm.g_p].ps->actorsqu = -1;
}
deletesprite(vm.g_i); deletesprite(vm.g_i);
} }
@ -116,23 +113,17 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
} }
} }
static int32_t VM_CheckSquished(void) static inline int32_t VM_CheckSquished(void)
{ {
sectortype *sc = &sector[vm.g_sp->sectnum]; sectortype *sc = &sector[vm.g_sp->sectnum];
int32_t squishme = 0;
if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23) if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23 ||
(vm.g_sp->pal == 1 ?
!(sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0) :
!(sc->floorz - sc->ceilingz < (12<<8))))
return 0; return 0;
squishme = (sc->floorz - sc->ceilingz < (12<<8)); // && (sc->lotag&32768) == 0; P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps);
if (vm.g_sp->pal == 1)
squishme = (sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0);
if (!squishme)
return 0;
P_DoQuote(10, g_player[vm.g_p].ps);
if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0; if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0;
@ -152,13 +143,12 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *p)
p->horiz += 64; p->horiz += 64;
p->return_to_center = 9; p->return_to_center = 9;
p->look_ang = n>>1; p->look_ang = p->rotscrnang = n>>1;
p->rotscrnang = n>>1;
} }
GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s) GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
{ {
int32_t bx,by,bxvect,byvect,d,i; int32_t bx,by,bxvect,byvect,i;
int32_t mx = s->x, my = s->y; int32_t mx = s->x, my = s->y;
int32_t mxvect = sintable[(s->ang+512)&2047]; int32_t mxvect = sintable[(s->ang+512)&2047];
int32_t myvect = sintable[s->ang&2047]; int32_t myvect = sintable[s->ang&2047];
@ -168,7 +158,7 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
{ {
if (OW == i/* || SECT != s->sectnum*/) if (OW == i)
continue; continue;
bx = SX-mx; bx = SX-mx;
@ -176,11 +166,9 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
bxvect = sintable[(SA+512)&2047]; bxvect = sintable[(SA+512)&2047];
byvect = sintable[SA&2047]; byvect = sintable[SA&2047];
if (mxvect *bx + myvect *by >= 0) if ((mxvect * bx) + (myvect * by) >= 0 && (bxvect * bx) + (byvect * by) < 0)
if (bxvect*bx + byvect*by < 0)
{ {
d = bxvect*by - byvect*bx; if (klabs((bxvect * by) - (byvect * bx)) < 65536<<6)
if (klabs(d) < 65536*64)
{ {
s->ang -= 512+(krand()&1024); s->ang -= 512+(krand()&1024);
return 1; return 1;
@ -508,8 +496,8 @@ GAMEEXEC_STATIC void VM_Move(void)
if (a&face_player_smart && !deadflag) if (a&face_player_smart && !deadflag)
{ {
int32_t newx = g_player[vm.g_p].ps->pos.x+(g_player[vm.g_p].ps->posvel.x/768); int32_t newx = g_player[vm.g_p].ps->pos.x+(g_player[vm.g_p].ps->vel.x/768);
int32_t newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->posvel.y/768); int32_t newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->vel.y/768);
goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y); goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2; angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2;
@ -613,13 +601,13 @@ GAMEEXEC_STATIC void VM_Move(void)
if (vm.g_x < 512) if (vm.g_x < 512)
{ {
g_player[vm.g_p].ps->posvel.x = 0; g_player[vm.g_p].ps->vel.x = 0;
g_player[vm.g_p].ps->posvel.y = 0; g_player[vm.g_p].ps->vel.y = 0;
} }
else else
{ {
g_player[vm.g_p].ps->posvel.x = mulscale(g_player[vm.g_p].ps->posvel.x,g_player[vm.g_p].ps->runspeed-0x2000,16); g_player[vm.g_p].ps->vel.x = mulscale(g_player[vm.g_p].ps->vel.x,g_player[vm.g_p].ps->runspeed-0x2000,16);
g_player[vm.g_p].ps->posvel.y = mulscale(g_player[vm.g_p].ps->posvel.y,g_player[vm.g_p].ps->runspeed-0x2000,16); g_player[vm.g_p].ps->vel.y = mulscale(g_player[vm.g_p].ps->vel.y,g_player[vm.g_p].ps->runspeed-0x2000,16);
} }
} }
else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER) else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER)
@ -1437,7 +1425,7 @@ skip_check:
{ {
case CON_ACTIVATEBYSECTOR: case CON_ACTIVATEBYSECTOR:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
activatebysector(var1, var2); G_ActivateBySector(var1, var2);
break; break;
case CON_OPERATESECTORS: case CON_OPERATESECTORS:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
@ -3048,7 +3036,7 @@ nullquote:
if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH)) if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH))
j = 1; j = 1;
else if ((l&16) && g_player[vm.g_p].ps->jumping_counter == 0 && !g_player[vm.g_p].ps->on_ground && else if ((l&16) && g_player[vm.g_p].ps->jumping_counter == 0 && !g_player[vm.g_p].ps->on_ground &&
g_player[vm.g_p].ps->posvel.z > 2048) g_player[vm.g_p].ps->vel.z > 2048)
j = 1; j = 1;
else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348) else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348)
j = 1; j = 1;
@ -4853,8 +4841,9 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
if (vm.g_flags & VM_KILL) if (vm.g_flags & VM_KILL)
{ {
// if player was set to squish, first stop that... // if player was set to squish, first stop that...
if (g_player[vm.g_p].ps->actorsqu == vm.g_i) if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1; g_player[vm.g_p].ps->actorsqu = -1;
deletesprite(vm.g_i); deletesprite(vm.g_i);
return; return;
} }
@ -5195,7 +5184,7 @@ void G_RestoreMapState(mapstate_t *save)
Net_ResetPrediction(); Net_ResetPrediction();
clearfifo(); G_ClearFIFO();
G_ResetTimers(); G_ResetTimers();
} }
} }

View file

@ -1256,11 +1256,11 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa
case PLAYER_OPYOFF: case PLAYER_OPYOFF:
Gv_SetVar(lVar2, g_player[iPlayer].ps->opyoff, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->opyoff, vm.g_i, vm.g_p); return;
case PLAYER_POSXV: case PLAYER_POSXV:
Gv_SetVar(lVar2, g_player[iPlayer].ps->posvel.x, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.x, vm.g_i, vm.g_p); return;
case PLAYER_POSYV: case PLAYER_POSYV:
Gv_SetVar(lVar2, g_player[iPlayer].ps->posvel.y, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.y, vm.g_i, vm.g_p); return;
case PLAYER_POSZV: case PLAYER_POSZV:
Gv_SetVar(lVar2, g_player[iPlayer].ps->posvel.z, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->vel.z, vm.g_i, vm.g_p); return;
case PLAYER_LAST_PISSED_TIME: case PLAYER_LAST_PISSED_TIME:
Gv_SetVar(lVar2, g_player[iPlayer].ps->last_pissed_time, vm.g_i, vm.g_p); return; Gv_SetVar(lVar2, g_player[iPlayer].ps->last_pissed_time, vm.g_i, vm.g_p); return;
case PLAYER_TRUEFZ: case PLAYER_TRUEFZ:
@ -1589,11 +1589,11 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa
case PLAYER_OPYOFF: case PLAYER_OPYOFF:
g_player[iPlayer].ps->opyoff=lVar1; return; g_player[iPlayer].ps->opyoff=lVar1; return;
case PLAYER_POSXV: case PLAYER_POSXV:
g_player[iPlayer].ps->posvel.x=lVar1; return; g_player[iPlayer].ps->vel.x=lVar1; return;
case PLAYER_POSYV: case PLAYER_POSYV:
g_player[iPlayer].ps->posvel.y=lVar1; return; g_player[iPlayer].ps->vel.y=lVar1; return;
case PLAYER_POSZV: case PLAYER_POSZV:
g_player[iPlayer].ps->posvel.z=lVar1; return; g_player[iPlayer].ps->vel.z=lVar1; return;
case PLAYER_LAST_PISSED_TIME: case PLAYER_LAST_PISSED_TIME:
g_player[iPlayer].ps->last_pissed_time=lVar1; return; g_player[iPlayer].ps->last_pissed_time=lVar1; return;
case PLAYER_TRUEFZ: case PLAYER_TRUEFZ:
@ -3513,11 +3513,11 @@ static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, in
case PLAYER_OPYOFF: case PLAYER_OPYOFF:
return g_player[iPlayer].ps->opyoff; return g_player[iPlayer].ps->opyoff;
case PLAYER_POSXV: case PLAYER_POSXV:
return g_player[iPlayer].ps->posvel.x; return g_player[iPlayer].ps->vel.x;
case PLAYER_POSYV: case PLAYER_POSYV:
return g_player[iPlayer].ps->posvel.y; return g_player[iPlayer].ps->vel.y;
case PLAYER_POSZV: case PLAYER_POSZV:
return g_player[iPlayer].ps->posvel.z; return g_player[iPlayer].ps->vel.z;
case PLAYER_LAST_PISSED_TIME: case PLAYER_LAST_PISSED_TIME:
return g_player[iPlayer].ps->last_pissed_time; return g_player[iPlayer].ps->last_pissed_time;
case PLAYER_TRUEFZ: case PLAYER_TRUEFZ:

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "duke3d.h" #include "duke3d.h"
const char *s_buildDate = "20100727"; const char *s_buildDate = "20110109";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int32_t g_musicSize; int32_t g_musicSize;

View file

@ -45,8 +45,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TEST_SYNC_KEY(bits, sync_num) TEST(bits, BIT(sync_num)) #define TEST_SYNC_KEY(bits, sync_num) TEST(bits, BIT(sync_num))
#define IFWITHIN(B,E) if ((PN)>=(B) && (PN)<=(E)) #define IFWITHIN(B,E) if ((PN)>=(B) && (PN)<=(E))
#define IFMOVING if(A_SetSprite(i,CLIPMASK0))
#define IFHIT j=A_IncurDamage(i);if(j >= 0)
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE) #define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#define rnd(X) ((krand()>>8)>=(255-(X))) #define rnd(X) ((krand()>>8)>=(255-(X)))

View file

@ -5150,8 +5150,8 @@ VOLUME_ALL_40x:
else if (g_netServer) else if (g_netServer)
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE)); enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE));
Bsprintf(ScriptQuotes[116],"VOTE FAILED"); Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"VOTE FAILED");
P_DoQuote(116,g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED2,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,92 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "enet/enet.h" #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
enum netchan_t enum netchan_t
{ {
CHAN_MOVE, // unreliable movement packets CHAN_MOVE, // unreliable movement packets
@ -69,13 +155,21 @@ enum DukePacket_t
PACKET_MAP_VOTE_CANCEL, PACKET_MAP_VOTE_CANCEL,
}; };
enum NetDisconnect_t enum netdisconnect_t
{ {
DISC_BAD_PASSWORD = 1, DISC_BAD_PASSWORD = 1,
DISC_KICKED, DISC_KICKED,
DISC_BANNED DISC_BANNED
}; };
enum netmode_t
{
NET_CLIENT = 0,
NET_SERVER,
NET_DEDICATED_CLIENT, // client on dedicated server
NET_DEDICATED_SERVER
};
extern ENetHost *g_netClient; extern ENetHost *g_netClient;
extern ENetHost *g_netServer; extern ENetHost *g_netServer;
extern ENetPeer *g_netClientPeer; extern ENetPeer *g_netClientPeer;
@ -83,12 +177,12 @@ extern char g_netPassword[32];
extern int32_t g_netDisconnect; extern int32_t g_netDisconnect;
extern int32_t g_netPlayersWaiting; extern int32_t g_netPlayersWaiting;
extern int32_t g_netPort; extern int32_t g_netPort;
extern int32_t g_netServerMode; extern int32_t g_networkMode;
extern int32_t g_netSync; extern int32_t g_netSync;
extern int32_t lastsectupdate[MAXSECTORS]; extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES]; extern int32_t lastupdate[MAXSPRITES];
extern int32_t lastwallupdate[MAXWALLS]; extern int32_t lastwallupdate[MAXWALLS];
extern int8_t g_netStatnums[8]; extern int16_t g_netStatnums[10];
extern mapstate_t *g_multiMapState; extern mapstate_t *g_multiMapState;
int32_t Net_PackSprite(int32_t i,uint8_t *pbuf); int32_t Net_PackSprite(int32_t i,uint8_t *pbuf);

View file

@ -1165,7 +1165,7 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
ENetPeer *currentPeer; ENetPeer *currentPeer;
char ipaddr[32]; char ipaddr[32];
if (parm->numparms != 0) if (parm && parm->numparms != 0)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
if (!g_netServer) if (!g_netServer)
@ -1174,6 +1174,8 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
initprintf("Connected clients:\n");
for (currentPeer = g_netServer -> peers; for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount]; currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer) ++ currentPeer)
@ -1222,6 +1224,7 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
} }
initprintf("Player %s not found!\n", parm->parms[0]); initprintf("Player %s not found!\n", parm->parms[0]);
osdcmd_listplayers(NULL);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1264,6 +1267,7 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
} }
initprintf("Player %s not found!\n", parm->parms[0]); initprintf("Player %s not found!\n", parm->parms[0]);
osdcmd_listplayers(NULL);
return OSDCMD_OK; return OSDCMD_OK;
} }

View file

@ -2958,7 +2958,7 @@ void P_DisplayWeapon(int32_t snum)
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0; int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1; int32_t mouseyaxismode = -1;
int32_t jump_timer = 0; int32_t g_emuJumpTics = 0;
void getinput(int32_t snum) void getinput(int32_t snum)
{ {
@ -2996,7 +2996,7 @@ void getinput(int32_t snum)
if (g_myAimStat > g_oldAimStat) if (g_myAimStat > g_oldAimStat)
{ {
g_myAimMode ^= 1; g_myAimMode ^= 1;
P_DoQuote(44+g_myAimMode,p); P_DoQuote(QUOTE_MOUSE_AIMING_OFF+g_myAimMode,p);
} }
} }
@ -3166,12 +3166,12 @@ void getinput(int32_t snum)
j = 12; j = 12;
if (BUTTON(gamefunc_Jump) && p->on_ground) if (BUTTON(gamefunc_Jump) && p->on_ground)
jump_timer = 4; g_emuJumpTics = 4;
loc.bits = (jump_timer > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP; loc.bits = (g_emuJumpTics > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP;
if (jump_timer > 0) if (g_emuJumpTics > 0)
jump_timer--; g_emuJumpTics--;
loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH; loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH;
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE; loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
@ -3404,7 +3404,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
{ {
p->scuba_on = 1; p->scuba_on = 1;
p->inven_icon = 6; p->inven_icon = 6;
P_DoQuote(76,p); P_DoQuote(QUOTE_SCUBA_ON,p);
} }
else else
{ {
@ -3665,8 +3665,8 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
p->pals.g = 0; p->pals.g = 0;
p->pals.b = 0; p->pals.b = 0;
p->posvel.x = -(sintable[(p->ang+512)&2047]<<8); p->vel.x = -(sintable[(p->ang+512)&2047]<<8);
p->posvel.y = -(sintable[(p->ang)&2047]<<8); p->vel.y = -(sintable[(p->ang)&2047]<<8);
A_PlaySound(DUKE_LONGTERM_PAIN,p->i); A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
{ {
@ -3848,13 +3848,13 @@ void P_FragPlayer(int32_t snum)
if (snum == screenpeek) if (snum == screenpeek)
{ {
Bsprintf(ScriptQuotes[115],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]); Bsprintf(ScriptQuotes[QUOTE_RESERVED],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]);
P_DoQuote(115,p); P_DoQuote(QUOTE_RESERVED,p);
} }
else else
{ {
Bsprintf(ScriptQuotes[116],"KILLED %s",&g_player[snum].user_name[0]); Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"KILLED %s",&g_player[snum].user_name[0]);
P_DoQuote(116,g_player[p->frag_ps].ps); P_DoQuote(QUOTE_RESERVED2,g_player[p->frag_ps].ps);
} }
if (ud.obituaries) if (ud.obituaries)
@ -3941,13 +3941,13 @@ void P_ProcessWeapon(int32_t snum)
{ {
p->holster_weapon = 1; p->holster_weapon = 1;
p->weapon_pos = -1; p->weapon_pos = -1;
P_DoQuote(73,p); P_DoQuote(QUOTE_WEAPON_LOWERED,p);
} }
else if (p->holster_weapon == 1 && p->weapon_pos == -9) else if (p->holster_weapon == 1 && p->weapon_pos == -9)
{ {
p->holster_weapon = 0; p->holster_weapon = 0;
p->weapon_pos = 10; p->weapon_pos = 10;
P_DoQuote(74,p); P_DoQuote(QUOTE_WEAPON_RAISED,p);
} }
} }
@ -4027,7 +4027,7 @@ void P_ProcessWeapon(int32_t snum)
{ {
p->holster_weapon = 0; p->holster_weapon = 0;
p->weapon_pos = 10; p->weapon_pos = 10;
P_DoQuote(74,p); P_DoQuote(QUOTE_WEAPON_RAISED,p);
} }
} }
else else
@ -4110,7 +4110,7 @@ void P_ProcessWeapon(int32_t snum)
(hitinfo.pos.y-p->pos.y)*(hitinfo.pos.y-p->pos.y)) < (290*290)) (hitinfo.pos.y-p->pos.y)*(hitinfo.pos.y-p->pos.y)) < (290*290))
{ {
p->pos.z = p->opos.z; p->pos.z = p->opos.z;
p->posvel.z = 0; p->vel.z = 0;
(*kb) = 1; (*kb) = 1;
if (aplWeaponInitialSound[p->curr_weapon][snum] > 0) if (aplWeaponInitialSound[p->curr_weapon][snum] > 0)
{ {
@ -4290,7 +4290,7 @@ void P_ProcessWeapon(int32_t snum)
&& *kb < (aplWeaponFireDelay[p->curr_weapon][snum]+1)) && *kb < (aplWeaponFireDelay[p->curr_weapon][snum]+1))
{ {
p->pos.z = p->opos.z; p->pos.z = p->opos.z;
p->posvel.z = 0; p->vel.z = 0;
} }
if (*kb == aplWeaponSound2Time[p->curr_weapon][snum]) if (*kb == aplWeaponSound2Time[p->curr_weapon][snum])
@ -4567,8 +4567,8 @@ void P_ProcessInput(int32_t snum)
{ {
// I think this is what makes the player slide off enemies... might be a good sprite flag to add later // I think this is what makes the player slide off enemies... might be a good sprite flag to add later
j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y); j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y);
p->posvel.x -= sintable[(j+512)&2047]<<4; p->vel.x -= sintable[(j+512)&2047]<<4;
p->posvel.y -= sintable[j&2047]<<4; p->vel.y -= sintable[j&2047]<<4;
} }
} }
@ -4597,7 +4597,7 @@ void P_ProcessInput(int32_t snum)
if (p->customexitsound >= 0) if (p->customexitsound >= 0)
{ {
S_PlaySound(p->customexitsound); S_PlaySound(p->customexitsound);
P_DoQuote(102,p); P_DoQuote(QUOTE_WEREGONNAFRYYOURASS,p);
} }
} }
else if (p->timebeforeexit == 1) else if (p->timebeforeexit == 1)
@ -4689,7 +4689,7 @@ void P_ProcessInput(int32_t snum)
p->pos.y = SY; p->pos.y = SY;
p->pos.z = SZ; p->pos.z = SZ;
p->ang = SA; p->ang = SA;
p->posvel.x = p->posvel.y = s->xvel = 0; p->vel.x = p->vel.y = s->xvel = 0;
p->look_ang = 0; p->look_ang = 0;
p->rotscrnang = 0; p->rotscrnang = 0;
@ -4802,9 +4802,9 @@ void P_ProcessInput(int32_t snum)
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
// jump // jump
if (p->posvel.z > 0) p->posvel.z = 0; if (p->vel.z > 0) p->vel.z = 0;
p->posvel.z -= 348; p->vel.z -= 348;
if (p->posvel.z < -(256*6)) p->posvel.z = -(256*6); if (p->vel.z < -(256*6)) p->vel.z = -(256*6);
} }
} }
else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH)) else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
@ -4814,32 +4814,32 @@ void P_ProcessInput(int32_t snum)
if (aGameVars[g_iReturnVarID].val.lValue == 0) if (aGameVars[g_iReturnVarID].val.lValue == 0)
{ {
// crouch // crouch
if (p->posvel.z < 0) p->posvel.z = 0; if (p->vel.z < 0) p->vel.z = 0;
p->posvel.z += 348; p->vel.z += 348;
if (p->posvel.z > (256*6)) p->posvel.z = (256*6); if (p->vel.z > (256*6)) p->vel.z = (256*6);
} }
} }
else else
{ {
// normal view // normal view
if (p->posvel.z < 0) if (p->vel.z < 0)
{ {
p->posvel.z += 256; p->vel.z += 256;
if (p->posvel.z > 0) if (p->vel.z > 0)
p->posvel.z = 0; p->vel.z = 0;
} }
if (p->posvel.z > 0) if (p->vel.z > 0)
{ {
p->posvel.z -= 256; p->vel.z -= 256;
if (p->posvel.z < 0) if (p->vel.z < 0)
p->posvel.z = 0; p->vel.z = 0;
} }
} }
if (p->posvel.z > 2048) if (p->vel.z > 2048)
p->posvel.z >>= 1; p->vel.z >>= 1;
p->pos.z += p->posvel.z; p->pos.z += p->vel.z;
if (p->pos.z > (fz-(15<<8))) if (p->pos.z > (fz-(15<<8)))
p->pos.z += ((fz-(15<<8))-p->pos.z)>>1; p->pos.z += ((fz-(15<<8))-p->pos.z)>>1;
@ -4847,7 +4847,7 @@ void P_ProcessInput(int32_t snum)
if (p->pos.z < cz) if (p->pos.z < cz)
{ {
p->pos.z = cz; p->pos.z = cz;
p->posvel.z = 0; p->vel.z = 0;
} }
if (p->scuba_on && (krand()&255) < 8) if (p->scuba_on && (krand()&255) < 8)
@ -5004,16 +5004,16 @@ void P_ProcessInput(int32_t snum)
else else
{ {
p->on_ground = 0; p->on_ground = 0;
p->posvel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6); p->vel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
if (p->posvel.z >= (4096+2048)) p->posvel.z = (4096+2048); if (p->vel.z >= (4096+2048)) p->vel.z = (4096+2048);
if (p->posvel.z > 2400 && p->falling_counter < 255) if (p->vel.z > 2400 && p->falling_counter < 255)
{ {
p->falling_counter++; p->falling_counter++;
if (p->falling_counter >= 38 && p->scream_voice <= FX_Ok) if (p->falling_counter >= 38 && p->scream_voice <= FX_Ok)
p->scream_voice = A_PlaySound(DUKE_SCREAM,p->i); p->scream_voice = A_PlaySound(DUKE_SCREAM,p->i);
} }
if ((p->pos.z+p->posvel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground if ((p->pos.z+p->vel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground
if (sector[p->cursectnum].lotag != 1) if (sector[p->cursectnum].lotag != 1)
{ {
if (p->falling_counter > 62) if (p->falling_counter > 62)
@ -5040,7 +5040,7 @@ void P_ProcessInput(int32_t snum)
p->pals.b = 0; p->pals.b = 0;
p->pals.f = 32; p->pals.f = 32;
} }
else if (p->posvel.z > 2048) else if (p->vel.z > 2048)
A_PlaySound(DUKE_LAND,p->i); A_PlaySound(DUKE_LAND,p->i);
} }
} }
@ -5057,8 +5057,8 @@ void P_ProcessInput(int32_t snum)
p->scream_voice = -1; p->scream_voice = -1;
} }
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->posvel.z > (6144>>1)) if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->vel.z > (6144>>1))
p->hard_landing = p->posvel.z>>10; p->hard_landing = p->vel.z>>10;
p->on_ground = 1; p->on_ground = 1;
@ -5069,8 +5069,8 @@ void P_ProcessInput(int32_t snum)
k = ((fz-(i<<8))-p->pos.z)>>1; k = ((fz-(i<<8))-p->pos.z)>>1;
if (klabs(k) < 256) k = 0; if (klabs(k) < 256) k = 0;
p->pos.z += k; p->pos.z += k;
p->posvel.z -= 768; p->vel.z -= 768;
if (p->posvel.z < 0) p->posvel.z = 0; if (p->vel.z < 0) p->vel.z = 0;
} }
else if (p->jumping_counter == 0) else if (p->jumping_counter == 0)
{ {
@ -5078,7 +5078,7 @@ void P_ProcessInput(int32_t snum)
if (p->on_warping_sector == 0 && p->pos.z > fz-(16<<8)) if (p->on_warping_sector == 0 && p->pos.z > fz-(16<<8))
{ {
p->pos.z = fz-(16<<8); p->pos.z = fz-(16<<8);
p->posvel.z >>= 1; p->vel.z >>= 1;
} }
} }
@ -5128,11 +5128,11 @@ void P_ProcessInput(int32_t snum)
if (psectlotag == 1 && p->jumping_counter > 768) if (psectlotag == 1 && p->jumping_counter > 768)
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
p->posvel.z = -512; p->vel.z = -512;
} }
else else
{ {
p->posvel.z -= (sintable[(2048-128+p->jumping_counter)&2047])/12; p->vel.z -= (sintable[(2048-128+p->jumping_counter)&2047])/12;
p->jumping_counter += 180; p->jumping_counter += 180;
p->on_ground = 0; p->on_ground = 0;
} }
@ -5140,18 +5140,18 @@ void P_ProcessInput(int32_t snum)
else else
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
p->posvel.z = 0; p->vel.z = 0;
} }
} }
p->pos.z += p->posvel.z; p->pos.z += p->vel.z;
if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8))) if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8)))
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
if (p->posvel.z < 0) if (p->vel.z < 0)
p->posvel.x = p->posvel.y = 0; p->vel.x = p->vel.y = 0;
p->posvel.z = 128; p->vel.z = 128;
p->pos.z = cz+(4<<8); p->pos.z = cz+(4<<8);
} }
} }
@ -5161,8 +5161,8 @@ void P_ProcessInput(int32_t snum)
*kb > 1 && *kb < *aplWeaponFireDelay[p->curr_weapon])) *kb > 1 && *kb < *aplWeaponFireDelay[p->curr_weapon]))
{ {
doubvel = 0; doubvel = 0;
p->posvel.x = 0; p->vel.x = 0;
p->posvel.y = 0; p->vel.y = 0;
} }
else if (g_player[snum].sync->avel) //p->ang += syncangvel * constant else if (g_player[snum].sync->avel) //p->ang += syncangvel * constant
{ {
@ -5203,7 +5203,7 @@ void P_ProcessInput(int32_t snum)
if (p->on_ground && truefdist <= PHEIGHT+(16<<8) && P_CheckFloorDamage(p, j)) if (p->on_ground && truefdist <= PHEIGHT+(16<<8) && P_CheckFloorDamage(p, j))
{ {
P_DoQuote(75, p); P_DoQuote(QUOTE_BOOTS_ON, p);
p->inv_amount[GET_BOOTS] -= 2; p->inv_amount[GET_BOOTS] -= 2;
if (p->inv_amount[GET_BOOTS] <= 0) if (p->inv_amount[GET_BOOTS] <= 0)
{ {
@ -5231,7 +5231,7 @@ void P_ProcessInput(int32_t snum)
if (g_player[snum].sync->extbits&(1<<5) || g_player[snum].sync->avel > 0) if (g_player[snum].sync->extbits&(1<<5) || g_player[snum].sync->avel > 0)
VM_OnEvent(EVENT_TURNRIGHT,p->i,snum, -1); VM_OnEvent(EVENT_TURNRIGHT,p->i,snum, -1);
if (p->posvel.x || p->posvel.y || g_player[snum].sync->fvel || g_player[snum].sync->svel) if (p->vel.x || p->vel.y || g_player[snum].sync->fvel || g_player[snum].sync->svel)
{ {
p->crack_time = 777; p->crack_time = 777;
@ -5275,8 +5275,8 @@ void P_ProcessInput(int32_t snum)
if (p->jetpack_on == 0 && p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400) if (p->jetpack_on == 0 && p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
doubvel <<= 1; doubvel <<= 1;
p->posvel.x += ((g_player[snum].sync->fvel*doubvel)<<6); p->vel.x += ((g_player[snum].sync->fvel*doubvel)<<6);
p->posvel.y += ((g_player[snum].sync->svel*doubvel)<<6); p->vel.y += ((g_player[snum].sync->svel*doubvel)<<6);
j = 0; j = 0;
@ -5285,16 +5285,16 @@ void P_ProcessInput(int32_t snum)
else if (p->on_ground && (TEST_SYNC_KEY(sb_snum, SK_CROUCH) || (*kb > 10 && aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON))) else if (p->on_ground && (TEST_SYNC_KEY(sb_snum, SK_CROUCH) || (*kb > 10 && aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON)))
j = 0x2000; j = 0x2000;
p->posvel.x = mulscale16(p->posvel.x,p->runspeed-j); p->vel.x = mulscale16(p->vel.x,p->runspeed-j);
p->posvel.y = mulscale16(p->posvel.y,p->runspeed-j); p->vel.y = mulscale16(p->vel.y,p->runspeed-j);
if (klabs(p->posvel.x) < 2048 && klabs(p->posvel.y) < 2048) if (klabs(p->vel.x) < 2048 && klabs(p->vel.y) < 2048)
p->posvel.x = p->posvel.y = 0; p->vel.x = p->vel.y = 0;
if (shrunk) if (shrunk)
{ {
p->posvel.x = mulscale16(p->posvel.x,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2)); p->vel.x = mulscale16(p->vel.x,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
p->posvel.y = mulscale16(p->posvel.y,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2)); p->vel.y = mulscale16(p->vel.y,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
} }
} }
@ -5307,12 +5307,12 @@ HORIZONLY:
if (ud.clipping) if (ud.clipping)
{ {
p->pos.x += p->posvel.x>>14; p->pos.x += p->vel.x>>14;
p->pos.y += p->posvel.y>>14; p->pos.y += p->vel.y>>14;
updatesector(p->pos.x,p->pos.y,&p->cursectnum); updatesector(p->pos.x,p->pos.y,&p->cursectnum);
changespritesect(p->i,p->cursectnum); changespritesect(p->i,p->cursectnum);
} }
else if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->posvel.x,p->posvel.y,164L,(4L<<8),i,CLIPMASK0))) else if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->vel.x,p->vel.y,164L,(4L<<8),i,CLIPMASK0)))
P_CheckTouchDamage(p, j); P_CheckTouchDamage(p, j);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
@ -5369,7 +5369,7 @@ HORIZONLY:
{ {
if (!(sector[s->sectnum].lotag&0x8000) && (isanunderoperator(sector[s->sectnum].lotag) || if (!(sector[s->sectnum].lotag&0x8000) && (isanunderoperator(sector[s->sectnum].lotag) ||
isanearoperator(sector[s->sectnum].lotag))) isanearoperator(sector[s->sectnum].lotag)))
activatebysector(s->sectnum,p->i); G_ActivateBySector(s->sectnum,p->i);
if (j) if (j)
{ {
P_QuickKill(p); P_QuickKill(p);
@ -5377,7 +5377,7 @@ HORIZONLY:
} }
} }
else if (klabs(fz-cz) < (32<<8) && isanunderoperator(sector[p->cursectnum].lotag)) else if (klabs(fz-cz) < (32<<8) && isanunderoperator(sector[p->cursectnum].lotag))
activatebysector(p->cursectnum,p->i); G_ActivateBySector(p->cursectnum,p->i);
} }
i = 0; i = 0;
@ -5809,7 +5809,7 @@ void computergetinput(int32_t snum, input_t *syn)
if (fightdist < 128) fightdist = 128; if (fightdist < 128) fightdist = 128;
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
if (dist == 0) dist = 1; if (dist == 0) dist = 1;
daang = getangle(x2+(g_player[goalplayer[snum]].ps->posvel.x>>14)-x1,y2+(g_player[goalplayer[snum]].ps->posvel.y>>14)-y1); daang = getangle(x2+(g_player[goalplayer[snum]].ps->vel.x>>14)-x1,y2+(g_player[goalplayer[snum]].ps->vel.y>>14)-y1);
zang = 100-((z2-z1)*8)/dist; zang = 100-((z2-z1)*8)/dist;
fightdist = max(fightdist,(klabs(z2-z1)>>4)); fightdist = max(fightdist,(klabs(z2-z1)>>4));
@ -6048,13 +6048,13 @@ void computergetinput(int32_t snum, input_t *syn)
int16_t dasect = p->cursectnum; int16_t dasect = p->cursectnum;
Bmemcpy(&vect,p,sizeof(vec3_t)); Bmemcpy(&vect,p,sizeof(vec3_t));
i = clipmove(&vect,&dasect,p->posvel.x,p->posvel.y,164L,4L<<8,4L<<8,CLIPMASK0); i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
if (!i) if (!i)
{ {
Bmemcpy(&vect,p,sizeof(vec3_t)); Bmemcpy(&vect,p,sizeof(vec3_t));
vect.z += (24<<8); vect.z += (24<<8);
dasect = p->cursectnum; dasect = p->cursectnum;
i = clipmove(&vect,&dasect,p->posvel.x,p->posvel.y,164L,4L<<8,4L<<8,CLIPMASK0); i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
} }
} }
if (i) if (i)

View file

@ -33,6 +33,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AUTO_AIM_ANGLE 48 #define AUTO_AIM_ANGLE 48
#define PHEIGHT (38<<8) #define PHEIGHT (38<<8)
#define TRIPBOMB_TRIPWIRE 0x00000001
#define TRIPBOMB_TIMER 0x00000002
#define PIPEBOMB_REMOTE 0x00000001
#define PIPEBOMB_TIMER 0x00000002
enum dukeinv_t { enum dukeinv_t {
GET_STEROIDS, GET_STEROIDS,
GET_SHIELD, GET_SHIELD,
@ -116,12 +122,6 @@ enum playeraction_t {
pfacing = 0x00010000 pfacing = 0x00010000
}; };
#define TRIPBOMB_TRIPWIRE 0x00000001
#define TRIPBOMB_TIMER 0x00000002
#define PIPEBOMB_REMOTE 0x00000001
#define PIPEBOMB_TIMER 0x00000002
#pragma pack(push,1) #pragma pack(push,1)
typedef struct { typedef struct {
int32_t ox,oy,oz; int32_t ox,oy,oz;
@ -137,7 +137,7 @@ typedef struct {
} DukeStatus_t; } DukeStatus_t;
typedef struct { typedef struct {
vec3_t pos, opos, posvel; vec3_t pos, opos, vel, npos;
int32_t bobposx, bobposy; int32_t bobposx, bobposy;
int32_t truefz, truecz, player_par; int32_t truefz, truecz, player_par;
int32_t randomflamex, exitx, exity; int32_t randomflamex, exitx, exity;
@ -261,7 +261,7 @@ extern int32_t g_numObituaries;
extern int32_t g_numSelfObituaries; extern int32_t g_numSelfObituaries;
extern int32_t g_weapon_offset; extern int32_t g_weapon_offset;
extern int32_t g_weapon_xoffset; extern int32_t g_weapon_xoffset;
extern int32_t jump_timer; extern int32_t g_emuJumpTics;
extern int32_t lastvisinc; extern int32_t lastvisinc;
extern int32_t mouseyaxismode; extern int32_t mouseyaxismode;
extern int32_t ticrandomseed; extern int32_t ticrandomseed;

View file

@ -544,7 +544,7 @@ void G_CacheMapData(void)
OSD_Printf("Cache time: %dms\n", endtime-starttime); OSD_Printf("Cache time: %dms\n", endtime-starttime);
} }
void xyzmirror(int32_t i,int32_t wn) void G_SetupCamTile(int32_t i,int32_t wn)
{ {
//if (waloff[wn] == 0) loadtile(wn); //if (waloff[wn] == 0) loadtile(wn);
setviewtotile(wn,tilesizy[wn],tilesizx[wn]); setviewtotile(wn,tilesizy[wn],tilesizx[wn]);
@ -678,7 +678,7 @@ void P_ResetPlayer(int32_t snum)
g_player[snum].ps->weapreccnt = 0; g_player[snum].ps->weapreccnt = 0;
g_player[snum].ps->fta = 0; g_player[snum].ps->fta = 0;
g_player[snum].ps->ftq = 0; g_player[snum].ps->ftq = 0;
g_player[snum].ps->posvel.x = g_player[snum].ps->posvel.y = 0; g_player[snum].ps->vel.x = g_player[snum].ps->vel.y = 0;
g_player[snum].ps->rotscrnang = 0; g_player[snum].ps->rotscrnang = 0;
g_player[snum].ps->runspeed = g_playerFriction; g_player[snum].ps->runspeed = g_playerFriction;
g_player[snum].ps->falling_counter = 0; g_player[snum].ps->falling_counter = 0;
@ -782,9 +782,9 @@ void P_ResetStatus(int32_t snum)
p->newowner =-1; p->newowner =-1;
p->jumping_counter = 0; p->jumping_counter = 0;
p->hard_landing = 0; p->hard_landing = 0;
p->posvel.x = 0; p->vel.x = 0;
p->posvel.y = 0; p->vel.y = 0;
p->posvel.z = 0; p->vel.z = 0;
fricxv = 0; fricxv = 0;
fricyv = 0; fricyv = 0;
p->somethingonplayer =-1; p->somethingonplayer =-1;
@ -1560,31 +1560,26 @@ void G_ResetTimers(void)
g_moveThingsCount = 0; g_moveThingsCount = 0;
} }
void clearfifo(void) void G_ClearFIFO(void)
{ {
int32_t i = 0; int32_t i = MAXPLAYERS-1;
extern int32_t jump_timer;
jump_timer = 0; g_emuJumpTics = 0;
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;
Bmemset(&avg, 0, sizeof(input_t));
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);
for (; i<MAXPLAYERS; i++) for (; i >= 0; i--)
{ {
// 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));
g_player[i].vote = 0; g_player[i].vote = g_player[i].gotvote = 0;
g_player[i].gotvote = 0;
} }
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
} }
extern int32_t voting, vote_map, vote_episode; int32_t G_FindLevelByFile(const char *fn)
int32_t G_FindLevelForFilename(const char *fn)
{ {
int32_t volume, level; int32_t volume, level;
@ -1637,8 +1632,10 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
if (filename != NULL) if (filename != NULL)
Bstrcpy(outbuf, filename); Bstrcpy(outbuf, filename);
p = Bstrrchr(outbuf,'.'); p = Bstrrchr(outbuf,'.');
if (!p) Bstrcat(outbuf,".mhk"); if (!p)
Bstrcat(outbuf,".mhk");
else else
{ {
p[1]='m'; p[1]='m';
@ -1646,7 +1643,9 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
p[3]='k'; p[3]='k';
p[4]=0; p[4]=0;
} }
if (!loadmaphack(outbuf)) initprintf("Loaded map hack file '%s'\n",outbuf);
if (!loadmaphack(outbuf))
initprintf("Loaded map hack file '%s'\n",outbuf);
} }
int32_t G_EnterLevel(int32_t g) int32_t G_EnterLevel(int32_t g)
@ -1671,18 +1670,21 @@ int32_t G_EnterLevel(int32_t g)
if ((g&MODE_DEMO) == 0 && ud.recstat == 2) if ((g&MODE_DEMO) == 0 && ud.recstat == 2)
ud.recstat = 0; ud.recstat = 0;
if (g_networkMode != NET_DEDICATED_SERVER)
{
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0); FX_SetReverb(0);
setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP);
}
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0) if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{ {
int32_t volume, level; int32_t volume, level;
Bcorrectfilename(boardfilename,0); Bcorrectfilename(boardfilename,0);
volume = level = G_FindLevelForFilename(boardfilename); volume = level = G_FindLevelByFile(boardfilename);
if (level != MAXLEVELS*MAXVOLUMES) if (level != MAXLEVELS*MAXVOLUMES)
{ {
@ -1811,7 +1813,6 @@ int32_t G_EnterLevel(int32_t g)
} }
else else
{ {
i = strlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename); i = strlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
copybufbyte(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i); copybufbyte(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i);
levname[i] = 255; levname[i] = 255;
@ -1871,7 +1872,7 @@ int32_t G_EnterLevel(int32_t g)
G_OpenDemoWrite(); G_OpenDemoWrite();
if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2) if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2)
P_DoQuote(40,g_player[myconnectindex].ps); P_DoQuote(QUOTE_F1HELP,g_player[myconnectindex].ps);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
switch (DynamicTileMap[sector[sprite[g_player[i].ps->i].sectnum].floorpicnum]) switch (DynamicTileMap[sector[sprite[g_player[i].ps->i].sectnum].floorpicnum])
@ -1904,7 +1905,7 @@ int32_t G_EnterLevel(int32_t g)
ud.last_level = ud.level_number+1; ud.last_level = ud.level_number+1;
clearfifo(); G_ClearFIFO();
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i]; for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];

View file

@ -32,7 +32,7 @@ extern int32_t g_numRealPalettes;
extern int32_t voting,vote_map,vote_episode; extern int32_t voting,vote_map,vote_episode;
extern palette_t CrosshairColors; extern palette_t CrosshairColors;
int32_t G_EnterLevel(int32_t g); int32_t G_EnterLevel(int32_t g);
int32_t G_FindLevelForFilename(const char *fn); int32_t G_FindLevelByFile(const char *fn);
void G_CacheMapData(void); void G_CacheMapData(void);
void G_FadeLoad(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step); void G_FadeLoad(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
void G_FreeMapState(int32_t mapnum); void G_FreeMapState(int32_t mapnum);
@ -45,7 +45,7 @@ void P_ResetInventory(int32_t snum);
void P_ResetPlayer(int32_t snum); void P_ResetPlayer(int32_t snum);
void P_ResetStatus(int32_t snum); void P_ResetStatus(int32_t snum);
void P_ResetWeapons(int32_t snum); void P_ResetWeapons(int32_t snum);
void clearfifo(void); void G_ClearFIFO(void);
void xyzmirror(int32_t i,int32_t wn); void G_SetupCamTile(int32_t i,int32_t wn);
#endif #endif

View file

@ -0,0 +1,96 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2011 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
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.
*/
//-------------------------------------------------------------------------
#ifndef __quotes_h__
#define __quotes_h__
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define QUOTE_SHOW_MAP_OFF 1
#define QUOTE_ACTIVATED 2
#define QUOTE_MEDKIT 3
#define QUOTE_LOCKED 4
#define QUOTE_CHEAT_EVERYTHING 5
#define QUOTE_BOOTS 6
#define QUOTE_WASTED 7
#define QUOTE_UNLOCKED 8
#define QUOTE_FOUND_SECRET 9
#define QUOTE_SQUISHED 10
#define QUOTE_USED_STEROIDS 12
#define QUOTE_DEACTIVATED 15
#define QUOTE_CHEAT_GODMODE_ON 17
#define QUOTE_CHEAT_GODMODE_OFF 18
#define QUOTE_CROSSHAIR_OFF 21
#define QUOTE_CHEATS_DISABLED 22
#define QUOTE_MESSAGES_ON 23
#define QUOTE_MESSAGES_OFF 24
#define QUOTE_MUSIC 26
#define QUOTE_CHEAT_STEROIDS 37
#define QUOTE_F1HELP 40
#define QUOTE_MOUSE_AIMING_OFF 44
#define QUOTE_HOLODUKE_ON 47
#define QUOTE_HOLODUKE_OFF 48
#define QUOTE_HOLODUKE_NOT_FOUND 49
#define QUOTE_JETPACK_NOT_FOUND 50
#define QUOTE_JETPACK_ON 52
#define QUOTE_JETPACK_OFF 53
#define QUOTE_NEED_BLUE_KEY 70
#define QUOTE_NEED_RED_KEY 71
#define QUOTE_NEED_YELLOW_KEY 72
#define QUOTE_WEAPON_LOWERED 73
#define QUOTE_WEAPON_RAISED 74
#define QUOTE_BOOTS_ON 75
#define QUOTE_SCUBA_ON 76
#define QUOTE_CHEAT_ALLEN 79
#define QUOTE_MIGHTY_FOOT 80
#define QUOTE_WEAPON_MODE_OFF 82
#define QUOTE_MAP_FOLLOW_OFF 83
#define QUOTE_RUN_MODE_OFF 85
#define QUOTE_JETPACK 88
#define QUOTE_SCUBA 89
#define QUOTE_STEROIDS 90
#define QUOTE_HOLODUKE 91
#define QUOTE_CHEAT_TODD 99
#define QUOTE_CHEAT_UNLOCK 100
#define QUOTE_NVG 101
#define QUOTE_WEREGONNAFRYYOURASS 102
#define QUOTE_SCREEN_SAVED 103
#define QUOTE_CHEAT_BETA 105
#define QUOTE_NVG_OFF 107
#define QUOTE_VIEW_MODE_OFF 109
#define QUOTE_SHOW_MAP_ON 111
#define QUOTE_CHEAT_NOCLIP 113
#define QUOTE_SAVE_BAD_VERSION 114
#define QUOTE_RESERVED 115
#define QUOTE_RESERVED2 116
#define QUOTE_RESERVED3 117
#define QUOTE_SAVE_DEAD 118
#define QUOTE_CHEAT_ALL_WEAPONS 119
#define QUOTE_CHEAT_ALL_INV 120
#define QUOTE_CHEAT_ALL_KEYS 121
#define QUOTE_RESERVED4 122
#define QUOTE_SAVE_BAD_PLAYERS 124
#endif

View file

@ -99,7 +99,7 @@ int32_t G_LoadSaveHeader(char spot,struct savehead *saveh)
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
/* if (bv != BYTEVERSION) /* if (bv != BYTEVERSION)
{ {
P_DoQuote(114,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
return 1; return 1;
}*/ }*/
@ -154,7 +154,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&bv,sizeof(bv),1,fil) != 1) return -1; if (kdfread(&bv,sizeof(bv),1,fil) != 1) return -1;
if (bv != BYTEVERSION) if (bv != BYTEVERSION)
{ {
P_DoQuote(114,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
@ -167,7 +167,7 @@ int32_t G_LoadPlayer(int32_t spot)
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
P_DoQuote(124,g_player[myconnectindex].ps); P_DoQuote(QUOTE_SAVE_BAD_PLAYERS,g_player[myconnectindex].ps);
return 1; return 1;
} }
else ud.multimode = nump; else ud.multimode = nump;
@ -590,7 +590,7 @@ int32_t G_LoadPlayer(int32_t spot)
ready2send = 1; ready2send = 1;
clearfifo(); G_ClearFIFO();
Net_WaitForServer(); Net_WaitForServer();
G_ResetTimers(); G_ResetTimers();
@ -895,8 +895,8 @@ int32_t G_SavePlayer(int32_t spot)
if ((!g_netServer && ud.multimode < 2)) if ((!g_netServer && ud.multimode < 2))
{ {
strcpy(ScriptQuotes[122],"GAME SAVED"); strcpy(ScriptQuotes[QUOTE_RESERVED4],"GAME SAVED");
P_DoQuote(122,g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
} }
ready2send = 1; ready2send = 1;

View file

@ -307,7 +307,7 @@ void G_DoSectorAnimations(void)
if (sprite[g_player[p].ps->i].owner >= 0) if (sprite[g_player[p].ps->i].owner >= 0)
{ {
g_player[p].ps->pos.z += v; g_player[p].ps->pos.z += v;
g_player[p].ps->posvel.z = 0; g_player[p].ps->vel.z = 0;
if (p == myconnectindex) if (p == myconnectindex)
{ {
my.z += v; my.z += v;
@ -381,7 +381,7 @@ void G_AnimateCamSprite(void)
if (waloff[TILE_VIEWSCR] == 0) if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
else walock[TILE_VIEWSCR] = 255; else walock[TILE_VIEWSCR] = 255;
xyzmirror(OW,/*PN*/TILE_VIEWSCR); G_SetupCamTile(OW,/*PN*/TILE_VIEWSCR);
} }
} }
else T1++; else T1++;
@ -1046,8 +1046,8 @@ void G_OperateActivators(int32_t low,int32_t snum)
if (snum >= 0 && snum < ud.multimode) if (snum >= 0 && snum < ud.multimode)
{ {
if (sector[SECT].lotag&16384) if (sector[SECT].lotag&16384)
P_DoQuote(4,g_player[snum].ps); P_DoQuote(QUOTE_LOCKED,g_player[snum].ps);
else P_DoQuote(8,g_player[snum].ps); else P_DoQuote(QUOTE_UNLOCKED,g_player[snum].ps);
} }
} }
else else
@ -1222,21 +1222,21 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
{ {
if ((g_player[snum].ps->got_access&1)) if ((g_player[snum].ps->got_access&1))
g_player[snum].ps->access_incs = 1; g_player[snum].ps->access_incs = 1;
else P_DoQuote(70,g_player[snum].ps); else P_DoQuote(QUOTE_NEED_BLUE_KEY,g_player[snum].ps);
} }
else if (switchpal == 21) else if (switchpal == 21)
{ {
if (g_player[snum].ps->got_access&2) if (g_player[snum].ps->got_access&2)
g_player[snum].ps->access_incs = 1; g_player[snum].ps->access_incs = 1;
else P_DoQuote(71,g_player[snum].ps); else P_DoQuote(QUOTE_NEED_RED_KEY,g_player[snum].ps);
} }
else if (switchpal == 23) else if (switchpal == 23)
{ {
if (g_player[snum].ps->got_access&4) if (g_player[snum].ps->got_access&4)
g_player[snum].ps->access_incs = 1; g_player[snum].ps->access_incs = 1;
else P_DoQuote(72,g_player[snum].ps); else P_DoQuote(QUOTE_NEED_YELLOW_KEY,g_player[snum].ps);
} }
if (g_player[snum].ps->access_incs == 1) if (g_player[snum].ps->access_incs == 1)
@ -1565,11 +1565,11 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
case 25: case 25:
actor[x].t_data[4] = !actor[x].t_data[4]; actor[x].t_data[4] = !actor[x].t_data[4];
if (actor[x].t_data[4]) if (actor[x].t_data[4])
P_DoQuote(15,g_player[snum].ps); P_DoQuote(QUOTE_DEACTIVATED,g_player[snum].ps);
else P_DoQuote(2,g_player[snum].ps); else P_DoQuote(QUOTE_ACTIVATED,g_player[snum].ps);
break; break;
case 21: case 21:
P_DoQuote(2,g_player[screenpeek].ps); P_DoQuote(QUOTE_ACTIVATED,g_player[screenpeek].ps);
break; break;
} }
} }
@ -1603,7 +1603,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
} }
void activatebysector(int32_t sect,int32_t j) void G_ActivateBySector(int32_t sect,int32_t j)
{ {
int32_t i = headspritesect[sect]; int32_t i = headspritesect[sect];
int32_t didit = 0; int32_t didit = 0;
@ -2521,7 +2521,7 @@ void G_HandleSharedKeys(int32_t snum)
{ {
p->quick_kick = 14; p->quick_kick = 14;
if (p->fta == 0 || p->ftq == 80) if (p->fta == 0 || p->ftq == 80)
P_DoQuote(80,p); P_DoQuote(QUOTE_MIGHTY_FOOT,p);
} }
} }
@ -2597,7 +2597,7 @@ void G_HandleSharedKeys(int32_t snum)
P_UpdateScreenPal(p); P_UpdateScreenPal(p);
p->inven_icon = 5; p->inven_icon = 5;
A_PlaySound(NITEVISION_ONOFF,p->i); A_PlaySound(NITEVISION_ONOFF,p->i);
P_DoQuote(106+(!p->heat_on),p); P_DoQuote(QUOTE_NVG_OFF-p->heat_on,p);
} }
} }
@ -2611,7 +2611,7 @@ void G_HandleSharedKeys(int32_t snum)
{ {
p->inv_amount[GET_STEROIDS]--; p->inv_amount[GET_STEROIDS]--;
A_PlaySound(DUKE_TAKEPILLS,p->i); A_PlaySound(DUKE_TAKEPILLS,p->i);
P_DoQuote(12,p); P_DoQuote(QUOTE_USED_STEROIDS,p);
} }
if (p->inv_amount[GET_STEROIDS] > 0) if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2; p->inven_icon = 2;
@ -2710,7 +2710,8 @@ CHECKINV1:
if (dainv || p->inv_amount[GET_FIRSTAID]) if (dainv || p->inv_amount[GET_FIRSTAID])
{ {
static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 }; static const int32_t i[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE,
QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 };
P_DoQuote(i[dainv-1], p); P_DoQuote(i[dainv-1], p);
} }
} }
@ -2919,11 +2920,11 @@ CHECKINV1:
T4 = T5 = 0; T4 = T5 = 0;
SP = snum; SP = snum;
sprite[i].extra = 0; sprite[i].extra = 0;
P_DoQuote(47,p); P_DoQuote(QUOTE_HOLODUKE_ON,p);
A_PlaySound(TELEPORTER,p->holoduke_on); A_PlaySound(TELEPORTER,p->holoduke_on);
} }
} }
else P_DoQuote(49,p); else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,p);
} }
} }
else else
@ -2934,7 +2935,7 @@ CHECKINV1:
{ {
A_PlaySound(TELEPORTER,p->holoduke_on); A_PlaySound(TELEPORTER,p->holoduke_on);
p->holoduke_on = -1; p->holoduke_on = -1;
P_DoQuote(48,p); P_DoQuote(QUOTE_HOLODUKE_OFF,p);
} }
} }
} }
@ -2966,7 +2967,7 @@ CHECKINV1:
} }
} }
if (TEST_SYNC_KEY(sb_snum, SK_JETPACK) && p->newowner == -1) if (p->newowner == -1 && TEST_SYNC_KEY(sb_snum, SK_JETPACK))
{ {
aGameVars[g_iReturnVarID].val.lValue = 0; aGameVars[g_iReturnVarID].val.lValue = 0;
VM_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1); VM_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
@ -2986,19 +2987,19 @@ CHECKINV1:
A_PlaySound(DUKE_JETPACK_ON,p->i); A_PlaySound(DUKE_JETPACK_ON,p->i);
P_DoQuote(52,p); P_DoQuote(QUOTE_JETPACK_ON,p);
} }
else else
{ {
p->hard_landing = 0; p->hard_landing = 0;
p->posvel.z = 0; p->vel.z = 0;
A_PlaySound(DUKE_JETPACK_OFF,p->i); A_PlaySound(DUKE_JETPACK_OFF,p->i);
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i); S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
S_StopEnvSound(DUKE_JETPACK_ON,p->i); S_StopEnvSound(DUKE_JETPACK_ON,p->i);
P_DoQuote(53,p); P_DoQuote(QUOTE_JETPACK_OFF,p);
} }
} }
else P_DoQuote(50,p); else P_DoQuote(QUOTE_JETPACK_NOT_FOUND,p);
} }
} }
@ -3031,13 +3032,14 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
SZ += zoff; SZ += zoff;
*hitsp = hitinfo.hitsprite; *hitsp = hitinfo.hitsprite;
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i])) if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
return((1<<30)); return((1<<30));
return (FindDistance2D(hitinfo.pos.x-SX,hitinfo.pos.y-SY)); return (FindDistance2D(hitinfo.pos.x-SX,hitinfo.pos.y-SY));
} }
static int32_t hitawall(DukePlayer_t *p,int16_t *hitw) static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw)
{ {
hitdata_t hitinfo; hitdata_t hitinfo;
@ -3064,7 +3066,7 @@ void P_CheckSectors(int32_t snum)
case 32767: case 32767:
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
P_DoQuote(9,p); P_DoQuote(QUOTE_FOUND_SECRET,p);
p->secret_rooms++; p->secret_rooms++;
return; return;
case -1: case -1:
@ -3144,7 +3146,7 @@ void P_CheckSectors(int32_t snum)
p->toggle_key_flag = 1; p->toggle_key_flag = 1;
hitscanwall = -1; hitscanwall = -1;
i = hitawall(p,&hitscanwall); i = P_FindWall(p,&hitscanwall);
if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek) if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek)
@ -3247,7 +3249,7 @@ void P_CheckSectors(int32_t snum)
return; return;
case NUKEBUTTON__STATIC: case NUKEBUTTON__STATIC:
hitawall(p,&j); P_FindWall(p,&j);
if (j >= 0 && wall[j].overpicnum == 0) if (j >= 0 && wall[j].overpicnum == 0)
if (actor[neartagsprite].t_data[0] == 0) if (actor[neartagsprite].t_data[0] == 0)
{ {

View file

@ -85,7 +85,7 @@ typedef struct {
extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
void activatebysector(int32_t sect,int32_t j); void G_ActivateBySector(int32_t sect,int32_t j);
int32_t A_CallSound(int32_t sn,int32_t whatsprite); int32_t A_CallSound(int32_t sn,int32_t whatsprite);
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp); int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
void A_DamageObject(int32_t i,int32_t sn); void A_DamageObject(int32_t i,int32_t sn);