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
# this path should match build\Makefile.msvc
WDKROOT="C:\WinDDK\7600.16385.1"
DXROOT="C:\Program Files\Microsoft DirectX SDK (February 2010)"
WDKROOT="H:\WinDDK\7600.16385.1"
DXROOT="H:\Microsoft DirectX SDK (February 2010)"
!ifdef DEBUG
# debugging options

View file

@ -3,13 +3,12 @@
ENGINELIB=libengine.a
EDITORLIB=libbuild.a
# SDLCONFIG = /usr/local/bin/sdl-config
SDLCONFIG = /usr/bin/sdl-config
SDLCONFIG = /usr/local/bin/sdl-configinvalid
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
SDLROOT = /usr/local
else
SDLCONFIG = sdl-config
SDLCONFIG = /usr/bin/sdl-config
endif
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;
#define DYNALLOC_ARRAYS
// #define DYNALLOC_ARRAYS
#ifndef DYNALLOC_ARRAYS
static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID];

View file

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

View file

@ -354,6 +354,9 @@
<ClInclude Include="source\demo.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\quotes.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<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))
{
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
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;
}
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;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<1;
}
@ -916,15 +916,15 @@ int32_t A_IncurDamage(int32_t sn)
case SEENINE__STATIC:
case OOZFILTER__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;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<2;
break;
default:
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
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;
break;
}
@ -1282,7 +1282,7 @@ ACTOR_STATIC void G_MoveFallers(void)
s->z -= (16<<8);
T2 = s->ang;
x = s->extra;
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
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);
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (s->owner == -2)
if (g_player[p].ps->on_crane == i)
@ -1692,7 +1692,7 @@ ACTOR_STATIC void G_MoveStandables(void)
x = s->extra;
s->extra = 1;
l = s->ang;
IFHIT { actor[i].t_data[6] = 3;
if ((j = A_IncurDamage(i)) >= 0) { actor[i].t_data[6] = 3;
T3 = 16;
}
s->extra = x;
@ -2061,7 +2061,7 @@ DETONATE:
case TRASH__STATIC:
if (s->xvel == 0) s->xvel = 1;
IFMOVING
if (A_SetSprite(i, CLIPMASK0))
{
A_Fall(i);
if (krand()&1) s->zvel -= 256;
@ -2283,7 +2283,7 @@ CLEAR_THE_BOLT:
case CANWITHSOMETHING3__STATIC:
case CANWITHSOMETHING4__STATIC:
A_Fall(i);
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
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 &&
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)) )
{
k = 1;
@ -3230,14 +3230,14 @@ ACTOR_STATIC void G_MoveTransports(void)
sector[sprite[OW].sectnum].ceilingz;
/*
g_player[p].ps->posvel.x = 4096-(krand()&8192);
g_player[p].ps->posvel.y = 4096-(krand()&8192);
g_player[p].ps->vel.x = 4096-(krand()&8192);
g_player[p].ps->vel.y = 4096-(krand()&8192);
*/
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;
// 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_counter = 0;
g_player[p].ps->posvel.z = 0;
// g_player[p].ps->posvel.z += 1024;
g_player[p].ps->vel.z = 0;
// g_player[p].ps->vel.z += 1024;
}
if (k == 1)
@ -3575,7 +3575,7 @@ ACTOR_STATIC void G_MoveActors(void)
break;
case RAT__STATIC:
A_Fall(i);
IFMOVING
if (A_SetSprite(i, CLIPMASK0))
{
if ((krand()&255) < 3) A_PlaySound(RATTY,i);
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;
}
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (s->extra < 0 && t[0] != -1)
{
@ -4005,7 +4005,7 @@ ACTOR_STATIC void G_MoveActors(void)
s->picnum = GREENSLIME+2;
s->extra = 1;
s->pal = 1;
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (j == FREEZEBLAST) goto BOLT;
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);
@ -4744,7 +4744,7 @@ DETONATEB:
}
else
{
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
for (x=0; x<32; x++)
RANDOMSCRAP;
@ -4761,7 +4761,7 @@ DETONATEB:
t[1]+=8;
if (g_damageCameras)
{
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
t[0] = 1; // static
s->cstat = (int16_t)32768;
@ -6195,17 +6195,16 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
}
else
{
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;
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;
sc->ceilingshade = 0;
}
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
t[3]++;
if (t[3] == 5)
if (++t[3] == 5)
{
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)
break;
default:
activatebysector(s->sectnum,i);
G_ActivateBySector(s->sectnum,i);
t[0] = 0;
break;
}
@ -6821,7 +6820,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{
IFHITSECT
{
P_DoQuote(8,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_UNLOCKED,g_player[myconnectindex].ps);
l = headspritestat[STAT_EFFECTOR];
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)
{
Bstrcpy(ScriptQuotes[122], "CANNOT START DEMO RECORDING WHEN DEAD!");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "CANNOT START DEMO RECORDING WHEN DEAD!");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0;
return;
}
@ -156,8 +156,8 @@ void G_OpenDemoWrite(void)
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("with the `demorec_diffs' cvar.\n\n");
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0;
return;
}
@ -178,8 +178,8 @@ void G_OpenDemoWrite(void)
demorec_synccompress_cvar|(demorec_seeds_cvar<<1));
if (i)
{
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
Bfclose(g_demo_filePtr), g_demo_filePtr=NULL;
ud.recstat = ud.m_recstat = 0;
return;
@ -189,8 +189,8 @@ void G_OpenDemoWrite(void)
demo_synccompress = demorec_synccompress_cvar;
demorec_difftics = demorec_difftics_cvar;
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STARTED");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STARTED");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.reccnt = 0;
ud.recstat = ud.m_recstat = 1; //
@ -269,8 +269,8 @@ void G_CloseDemoWrite(void)
sv_freemem();
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STOPPED");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STOPPED");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
}
#if KRANDDEBUG
krd_print("krandrec.log");

View file

@ -64,7 +64,7 @@ extern "C" {
#define WW2GI (g_gameType & 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_14 116
#define BYTEVERSION_15 117
@ -86,15 +86,10 @@ extern "C" {
#define TICSPERFRAME 4
#define TICRATE 120
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define NO 0
#define YES 1
#define PACKBUF_SIZE 65535
#define PACKBUF_SIZE 2048
#define TILE_SAVESHOT (MAXTILES-1)
#define TILE_LOADSHOT (MAXTILES-3)
@ -118,6 +113,7 @@ extern "C" {
#include "music.h"
#include "player.h"
#include "actors.h"
#include "quotes.h"
#include "global.h"
#include "sector.h"
#include "net.h"

View file

@ -25,7 +25,7 @@ extern "C"
#define ENET_VERSION_MAJOR 1
#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 ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)

View file

@ -9,9 +9,9 @@
#include "enet/time.h"
#include "enet/enet.h"
#ifndef UNREFERENCED_PARAMETER
# define UNREFERENCED_PARAMETER(x) x=x
#endif
#ifndef UNREFERENCED_PARAMETER
# define UNREFERENCED_PARAMETER(x) x=x
#endif
static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] =
{
@ -178,6 +178,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand;
ENetProtocolCommand commandNumber;
int wasSent = 1;
for (currentCommand = enet_list_begin (& 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))
return ENET_PROTOCOL_COMMAND_NONE;
wasSent = 0;
}
if (channelID < peer -> channelCount)
@ -227,7 +230,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (outgoingCommand -> packet != NULL)
{
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
if (wasSent)
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
-- outgoingCommand -> packet -> referenceCount;
@ -256,6 +260,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
size_t channelCount;
ENetPeer * currentPeer;
ENetProtocol verifyCommand;
UNREFERENCED_PARAMETER(header);
channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount);
@ -611,9 +616,10 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet
static int
enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
{
UNREFERENCED_PARAMETER(host);
UNREFERENCED_PARAMETER(peer);
UNREFERENCED_PARAMETER(command);
UNREFERENCED_PARAMETER(host);
UNREFERENCED_PARAMETER(peer);
UNREFERENCED_PARAMETER(command);
return 0;
}
@ -642,7 +648,7 @@ static int
enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
{
UNREFERENCED_PARAMETER(host);
peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval);
peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration);
peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration);
@ -758,7 +764,7 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer *
enet_peer_disconnect (peer, peer -> eventData);
break;
default:
break;
break;
}
return 0;
@ -1266,7 +1272,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even
return 0;
}
static void
static int
enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
{
ENetProtocol * command = & host -> commands [host -> commandCount];
@ -1276,6 +1282,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
ENetChannel *channel;
enet_uint16 reliableWindow;
size_t commandSize;
int windowExceeded = 0, windowWrap = 0, canPing = 1;
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
@ -1285,39 +1292,54 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
if (channel != NULL &&
outgoingCommand -> sendAttempts < 1 &&
! (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 -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
break;
if (channel != NULL)
{
if (! windowWrap &&
outgoingCommand -> sendAttempts < 1 &&
! (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 -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
windowWrap = 1;
if (windowWrap)
{
currentCommand = enet_list_next (currentCommand);
continue;
}
}
if (outgoingCommand -> packet != NULL)
{
if (! windowExceeded)
{
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
windowExceeded = 1;
}
if (windowExceeded)
{
currentCommand = enet_list_next (currentCommand);
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)
peer -> mtu - host -> packetSize < commandSize ||
(outgoingCommand -> packet != NULL &&
(enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
{
host -> continueSending = 1;
break;
}
if (outgoingCommand -> packet != NULL)
{
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
break;
if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))
{
host -> continueSending = 1;
break;
}
}
currentCommand = enet_list_next (currentCommand);
if (channel != NULL && outgoingCommand -> sendAttempts < 1)
@ -1370,6 +1392,8 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
host -> commandCount = command - host -> commands;
host -> bufferCount = buffer - host -> buffers;
return canPing;
}
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)
return 1;
if (! enet_list_empty (& currentPeer -> outgoingReliableCommands))
enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
else
if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
enet_list_empty (& currentPeer -> sentReliableCommands) &&
ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
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
#include <windows.h>
#include <shellapi.h>
#include <WinIoCtl.h>
extern int32_t G_GetVersionFromWebsite(char *buffer);
#define UPDATEINTERVAL 604800 // 1w
#else
static int32_t usecwd = 0;
#include <sys/ioctl.h>
#endif /* _WIN32 */
int32_t g_quitDeadline = 0;
@ -528,7 +530,7 @@ void G_HandleSpecialKeys(void)
// 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))
{
@ -546,7 +548,7 @@ void G_HandleSpecialKeys(void)
{
KB_ClearKeyDown(sc_F12);
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
@ -1695,7 +1697,7 @@ static void G_PrintCoords(int32_t snum)
printext256(250L,y,31,-1,tempbuf,0);
Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz);
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);
Bsprintf(tempbuf,"OG= %d",g_player[snum].ps->on_ground);
printext256(250L,y+27L,31,-1,tempbuf,0);
@ -1727,7 +1729,7 @@ void G_PrintGameQuotes(void)
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)
k += 7;
@ -1778,7 +1780,7 @@ void G_PrintGameQuotes(void)
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;
}
@ -1826,8 +1828,8 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
if (ud.fta_on == 0)
return;
if (p->fta > 0 && q != 115 && q != 116)
if (p->ftq == 115 || p->ftq == 116) return;
if (p->fta > 0 && q != QUOTE_RESERVED && q != QUOTE_RESERVED2)
if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return;
p->fta = 100;
@ -3220,6 +3222,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
int32_t tmpyx=yxaspect, tmpvr=viewingrange;
if (g_networkMode == NET_DEDICATED_SERVER) return;
if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always
{
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')))
{
g_player[myconnectindex].ps->cheat_phase = 0;
// P_DoQuote(46,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_46,g_player[myconnectindex].ps);
return;
}
@ -6709,14 +6713,14 @@ FOUNDCHEAT:
KB_FlushKeyBoardQueue();
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;
case CHEAT_INVENTORY:
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0;
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;
return;
@ -6724,7 +6728,7 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->got_access = 7;
KB_FlushKeyBoardQueue();
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;
case CHEAT_DEBUG:
@ -6743,7 +6747,7 @@ FOUNDCHEAT:
ud.clipping = 1-ud.clipping;
KB_FlushKeyBoardQueue();
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;
case CHEAT_RESERVED2:
@ -6753,7 +6757,7 @@ FOUNDCHEAT:
return;
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;
KB_ClearKeyDown(sc_N);
return;
@ -6779,7 +6783,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].lotag = 0;
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
{
@ -6787,7 +6791,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
actor[g_player[myconnectindex].ps->i].extra = -1;
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;
@ -6816,9 +6820,9 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].hitag = 0;
sprite[g_player[myconnectindex].ps->i].lotag = 0;
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);
P_DoQuote(122,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
G_CheatGetInv();
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; 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;
actor[g_player[myconnectindex].ps->i].extra = -1;
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;
@ -6859,10 +6863,10 @@ FOUNDCHEAT:
P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]);
G_CheatGetInv();
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;
// P_DoQuote(21,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_21,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->inven_icon = 1;
@ -6937,14 +6941,14 @@ FOUNDCHEAT:
g_cameraDistance = 0;
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;
KB_FlushKeyBoardQueue();
return;
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;
KB_FlushKeyBoardQueue();
return;
@ -6965,7 +6969,7 @@ FOUNDCHEAT:
}
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;
KB_FlushKeyBoardQueue();
return;
@ -6979,7 +6983,7 @@ FOUNDCHEAT:
case CHEAT_ITEMS:
G_CheatGetInv();
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;
KB_FlushKeyBoardQueue();
return;
@ -6992,7 +6996,7 @@ FOUNDCHEAT:
show2dsector[i] = 255;
for (i=0; i<(MAXWALLS>>3); i++)
show2dwall[i] = 255;
P_DoQuote(111,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SHOW_MAP_ON, g_player[myconnectindex].ps);
}
else
{
@ -7000,14 +7004,14 @@ FOUNDCHEAT:
show2dsector[i] = 0;
for (i=0; i<(MAXWALLS>>3); i++)
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;
KB_FlushKeyBoardQueue();
return;
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;
KB_FlushKeyBoardQueue();
return;
@ -7019,7 +7023,7 @@ FOUNDCHEAT:
return;
case CHEAT_BETA:
P_DoQuote(105,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_BETA,g_player[myconnectindex].ps);
KB_ClearKeyDown(sc_H);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
@ -7029,19 +7033,22 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399;
g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200;
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();
return;
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;
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();
return;
}
@ -7073,13 +7080,13 @@ FOUNDCHEAT:
{
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;
}
else
{
g_player[myconnectindex].ps->cheat_phase = 1;
// P_DoQuote(25,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_25,g_player[myconnectindex].ps);
cheatbuflen = 0;
}
KB_FlushKeyboardQueue();
@ -7192,14 +7199,14 @@ void G_HandleLocalKeys(void)
{
CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon);
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))
{
CONTROL_ClearButton(gamefunc_Toggle_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))
@ -7212,7 +7219,7 @@ void G_HandleLocalKeys(void)
ud.foly = g_player[screenpeek].ps->opos.y;
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))
@ -7338,7 +7345,7 @@ void G_HandleLocalKeys(void)
{
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);
g_musicIndex = (g_musicIndex+1)%i;
@ -7351,10 +7358,10 @@ void G_HandleLocalKeys(void)
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
{
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
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
P_DoQuote(26,g_player[myconnectindex].ps);
Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps);
}
return;
}
@ -7473,7 +7480,7 @@ void G_HandleLocalKeys(void)
FAKE_F2:
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;
}
ChangeToMenu(350);
@ -7542,7 +7549,7 @@ FAKE_F3:
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;
}
g_screenCapture = 1;
@ -7571,32 +7578,32 @@ FAKE_F3:
g_cameraDistance = 0;
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)
{
KB_ClearKeyDown(sc_F5);
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)
{
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[26],". USE SHIFT-F5 TO CHANGE.");
Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[QUOTE_MUSIC],". USE SHIFT-F5 TO CHANGE.");
}
else ScriptQuotes[26][0] = '\0';
P_DoQuote(26,g_player[myconnectindex].ps);
else ScriptQuotes[QUOTE_MUSIC][0] = '\0';
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
}
if (KB_UnBoundKeyPressed(sc_F8))
{
KB_ClearKeyDown(sc_F8);
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
{
ud.fta_on = 1;
P_DoQuote(24,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_MESSAGES_OFF,g_player[myconnectindex].ps);
ud.fta_on = 0;
}
}
@ -7673,7 +7680,7 @@ FAKE_F3:
{
CONTROL_ClearButton(gamefunc_AutoRun);
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))
@ -7809,7 +7816,7 @@ static int32_t getfilenames(const char *path, char kind[])
}
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)
{
@ -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)
return destname;
@ -7859,7 +7866,7 @@ static int32_t S_DefineSound(int32_t ID,char *name)
{
if (ID >= MAXSOUNDS)
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);
// S_LoadSound(ID);
return 0;
@ -7899,7 +7906,7 @@ static int32_t S_DefineMusic(char *ID,char *name)
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("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn);
// S_PlayMusic(ID,sel);
@ -8190,14 +8197,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
initprintf("\n");
i = 1;
while (i < argc)
do
{
c = (char *)argv[i];
if ((*c == '-')
#ifdef _WIN32
|| (*c == '/')
|| (*c == '/')
#endif
)
)
{
if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help"))
{
@ -8318,7 +8325,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
}
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;
i++;
continue;
@ -8430,9 +8444,9 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if ((*c == '-')
#ifdef _WIN32
|| (*c == '/')
|| (*c == '/')
#endif
)
)
{
c++;
switch (Btolower(*c))
@ -8648,6 +8662,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
}
i++;
}
while (i < argc);
}
}
@ -9305,6 +9320,7 @@ int32_t app_main(int32_t argc,const char **argv)
break;
}
}
if (i == argc && win_checkinstance())
{
if (!wm_ynbox("EDuke32","Another Build game is currently running. "
@ -9747,7 +9763,7 @@ CLEAN_DIRECTORY:
if (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 };
g_netServer = enet_host_create(&address, MAXPLAYERS, CHAN_MAX, 0, 0);
@ -9842,24 +9858,27 @@ CLEAN_DIRECTORY:
OSD_SetVersion(tempbuf, 10,0);
registerosdcommands();
if (CONTROL_Startup(1, &GetTime, TICRATE))
if (g_networkMode != NET_DEDICATED_SERVER)
{
fprintf(stderr, "There was an error initializing the CONTROL system.\n");
uninitengine();
exit(5);
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
fprintf(stderr, "There was an error initializing the CONTROL system.\n");
uninitengine();
exit(5);
}
G_SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
}
G_SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
{
char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,".");
if (!Bstrcmp(setupfilename, SETUPFILENAME))
@ -9869,53 +9888,55 @@ CLEAN_DIRECTORY:
Bfree(ptr);
}
i = clipmapinfo_load("_clipshape0.map");
if (i>0)
if ((i = clipmapinfo_load("_clipshape0.map")) > 0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
OSD_Exec("autoexec.cfg");
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
if (g_networkMode != NET_DEDICATED_SERVER)
{
int32_t i = 0;
int32_t xres[] = {ud.config.ScreenWidth,800,640,320};
int32_t yres[] = {ud.config.ScreenHeight,600,480,240};
int32_t bpp[] = {32,16,8};
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
{
int32_t i = 0;
int32_t xres[] = {ud.config.ScreenWidth,800,640,320};
int32_t yres[] = {ud.config.ScreenHeight,600,480,240};
int32_t bpp[] = {32,16,8};
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed");
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed");
#if defined(POLYMOST) && defined(USE_OPENGL)
{
int32_t j = 0;
while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]);
if (++j == 3)
int32_t j = 0;
while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0)
{
if (++i == 4)
G_GameExit("Unable to set failsafe video mode!");
j = 0;
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]);
if (++j == 3)
{
if (++i == 4)
G_GameExit("Unable to set failsafe video mode!");
j = 0;
}
}
}
}
#else
while (setgamemode(0,xres[i],yres[i],8) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],8);
i++;
}
while (setgamemode(0,xres[i],yres[i],8) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],8);
i++;
}
#endif
ud.config.ScreenWidth = xres[i];
ud.config.ScreenHeight = yres[i];
ud.config.ScreenBPP = bpp[i];
ud.config.ScreenWidth = xres[i];
ud.config.ScreenHeight = yres[i];
ud.config.ScreenBPP = bpp[i];
}
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
S_MusicStartup();
S_SoundStartup();
}
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
S_MusicStartup();
S_SoundStartup();
// loadtmb();
if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2))
@ -9939,8 +9960,11 @@ CLEAN_DIRECTORY:
MAIN_LOOP_RESTART:
G_GetCrosshairColor();
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
if (g_networkMode != NET_DEDICATED_SERVER)
{
G_GetCrosshairColor();
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
}
if (ud.warp_on == 0)
{
@ -9965,14 +9989,18 @@ MAIN_LOOP_RESTART:
Net_WaitForServer();
}
else G_DisplayLogo();
else if (g_networkMode != NET_DEDICATED_SERVER)
G_DisplayLogo();
if (G_PlaybackDemo())
if (g_networkMode != NET_DEDICATED_SERVER)
{
FX_StopAllSounds();
S_ClearSoundLocks();
g_noLogoAnim = 1;
goto MAIN_LOOP_RESTART;
if (G_PlaybackDemo())
{
FX_StopAllSounds();
S_ClearSoundLocks();
g_noLogoAnim = 1;
goto MAIN_LOOP_RESTART;
}
}
}
else if (ud.warp_on == 1)
@ -10015,19 +10043,49 @@ MAIN_LOOP_RESTART:
}
sampletimer();
MUSIC_Update();
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
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();
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)
{
CONTROL_ProcessBinds();
getinput(myconnectindex);
if (g_networkMode != NET_DEDICATED_SERVER)
{
CONTROL_ProcessBinds();
getinput(myconnectindex);
}
avg.fvel += loc.fvel;
avg.svel += loc.svel;
@ -10065,7 +10123,7 @@ MAIN_LOOP_RESTART:
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
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;
}
@ -10094,6 +10152,12 @@ MAIN_LOOP_RESTART:
g_multiMapState = NULL;
}
if (g_networkMode == NET_DEDICATED_SERVER)
{
idle();
goto skipframe;
}
if (framewaiting)
{
framewaiting--;
@ -10128,6 +10192,7 @@ MAIN_LOOP_RESTART:
framewaiting++;
}
skipframe:
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
}
@ -10184,12 +10249,12 @@ int32_t G_DoMoveThings(void)
sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek &&
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)
{
Bsprintf(ScriptQuotes[117],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]);
g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = 117;
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 = QUOTE_RESERVED3;
}
}
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);
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);
*(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
};
if (g_networkMode == NET_DEDICATED_SERVER)
return;
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
wm_setapptitle(tempbuf);
@ -11190,7 +11258,7 @@ void A_SpawnGlass(int32_t i,int32_t n)
for (; n>0; n--)
{
int32_t k = A_InsertSprite(SECT,SX,SY,SZ-((krand()&16)<<8),GLASSPIECES+(n%3),
krand()&15,36,36,krand()&2047,32+(krand()&63),-512-(krand()&2047),i,5);
krand()&15,36,36,krand()&2047,32+(krand()&63),-512-(krand()&2047),i,5);
sprite[k].pal = sprite[i].pal;
}
}

View file

@ -64,6 +64,17 @@ enum LogoFlags_t {
LOGO_TENSCREEN = 0x00000200
};
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL,
BASEPALCOUNT
} basepal_t;
#define deletesprite A_DeleteSprite
void A_DeleteSprite(int32_t s);
@ -227,23 +238,9 @@ extern palette_t DefaultCrosshairColors;
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 *basepaltable[BASEPALCOUNT];
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL
} basepal_t;
extern user_defs ud;
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);
#endif
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
#ifdef RENDERTYPEWIN
void app_crashhandler(void);
#ifdef USE_OPENGL
extern char forcegl;
#endif
#if defined(RENDERTYPEWIN)
void app_crashhandler(void);
#endif
#if KRANDDEBUG

View file

@ -5552,8 +5552,8 @@ repeatcase:
tempbuf[i] = '\0';
if (MapInfo[j *MAXLEVELS+k].name == NULL)
MapInfo[j *MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
if (MapInfo[j*MAXLEVELS+k].name == NULL)
MapInfo[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].name))
MapInfo[j *MAXLEVELS+k].name = Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
@ -5582,6 +5582,7 @@ repeatcase:
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuotes[k])
{
ScriptQuotes[k] = NULL;

View file

@ -83,56 +83,47 @@ void VM_ScriptInfo(void)
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;
insptr = apScriptGameEvent[iEventID];
{
intptr_t *oinsptr=insptr;
vmstate_t vm_backup;
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, &tempvm, sizeof(vmstate_t));
insptr = apScriptGameEvent[iEventID];
VM_Execute(0);
if (vm.g_flags & VM_KILL)
{
// if player was set to squish, first stop that...
if (vm.g_p >= 0)
{
if (g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1;
}
if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1;
deletesprite(vm.g_i);
}
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
insptr=oinsptr;
insptr = oinsptr;
}
}
static int32_t VM_CheckSquished(void)
static inline int32_t VM_CheckSquished(void)
{
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;
squishme = (sc->floorz - sc->ceilingz < (12<<8)); // && (sc->lotag&32768) == 0;
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);
P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps);
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->return_to_center = 9;
p->look_ang = n>>1;
p->rotscrnang = n>>1;
p->look_ang = p->rotscrnang = n>>1;
}
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 mxvect = sintable[(s->ang+512)&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
{
if (OW == i/* || SECT != s->sectnum*/)
if (OW == i)
continue;
bx = SX-mx;
@ -176,16 +166,14 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
bxvect = sintable[(SA+512)&2047];
byvect = sintable[SA&2047];
if (mxvect *bx + myvect *by >= 0)
if (bxvect*bx + byvect*by < 0)
if ((mxvect * bx) + (myvect * by) >= 0 && (bxvect * bx) + (byvect * by) < 0)
{
if (klabs((bxvect * by) - (byvect * bx)) < 65536<<6)
{
d = bxvect*by - byvect*bx;
if (klabs(d) < 65536*64)
{
s->ang -= 512+(krand()&1024);
return 1;
}
s->ang -= 512+(krand()&1024);
return 1;
}
}
}
return 0;
}
@ -508,8 +496,8 @@ GAMEEXEC_STATIC void VM_Move(void)
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 newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->posvel.y/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->vel.y/768);
goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2;
@ -613,13 +601,13 @@ GAMEEXEC_STATIC void VM_Move(void)
if (vm.g_x < 512)
{
g_player[vm.g_p].ps->posvel.x = 0;
g_player[vm.g_p].ps->posvel.y = 0;
g_player[vm.g_p].ps->vel.x = 0;
g_player[vm.g_p].ps->vel.y = 0;
}
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->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.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->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)
@ -1437,7 +1425,7 @@ skip_check:
{
case CON_ACTIVATEBYSECTOR:
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;
case CON_OPERATESECTORS:
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))
j = 1;
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;
else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348)
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 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;
deletesprite(vm.g_i);
return;
}
@ -5195,7 +5184,7 @@ void G_RestoreMapState(mapstate_t *save)
Net_ResetPrediction();
clearfifo();
G_ClearFIFO();
G_ResetTimers();
}
}

View file

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

View file

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

View file

@ -44,9 +44,7 @@ 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 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 IFWITHIN(B,E) if ((PN)>=(B) && (PN)<=(E))
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#define rnd(X) ((krand()>>8)>=(255-(X)))

View file

@ -5150,8 +5150,8 @@ VOLUME_ALL_40x:
else if (g_netServer)
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE));
Bsprintf(ScriptQuotes[116],"VOTE FAILED");
P_DoQuote(116,g_player[myconnectindex].ps);
Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"VOTE FAILED");
P_DoQuote(QUOTE_RESERVED2,g_player[myconnectindex].ps);
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"
#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
{
CHAN_MOVE, // unreliable movement packets
@ -69,13 +155,21 @@ enum DukePacket_t
PACKET_MAP_VOTE_CANCEL,
};
enum NetDisconnect_t
enum netdisconnect_t
{
DISC_BAD_PASSWORD = 1,
DISC_KICKED,
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_netServer;
extern ENetPeer *g_netClientPeer;
@ -83,12 +177,12 @@ extern char g_netPassword[32];
extern int32_t g_netDisconnect;
extern int32_t g_netPlayersWaiting;
extern int32_t g_netPort;
extern int32_t g_netServerMode;
extern int32_t g_networkMode;
extern int32_t g_netSync;
extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES];
extern int32_t lastwallupdate[MAXWALLS];
extern int8_t g_netStatnums[8];
extern int16_t g_netStatnums[10];
extern mapstate_t *g_multiMapState;
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;
char ipaddr[32];
if (parm->numparms != 0)
if (parm && parm->numparms != 0)
return OSDCMD_SHOWHELP;
if (!g_netServer)
@ -1174,6 +1174,8 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
initprintf("Connected clients:\n");
for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer)
@ -1222,6 +1224,7 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
}
initprintf("Player %s not found!\n", parm->parms[0]);
osdcmd_listplayers(NULL);
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]);
osdcmd_listplayers(NULL);
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 mouseyaxismode = -1;
int32_t jump_timer = 0;
int32_t g_emuJumpTics = 0;
void getinput(int32_t snum)
{
@ -2996,7 +2996,7 @@ void getinput(int32_t snum)
if (g_myAimStat > g_oldAimStat)
{
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;
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)
jump_timer--;
if (g_emuJumpTics > 0)
g_emuJumpTics--;
loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH;
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
@ -3404,7 +3404,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
{
p->scuba_on = 1;
p->inven_icon = 6;
P_DoQuote(76,p);
P_DoQuote(QUOTE_SCUBA_ON,p);
}
else
{
@ -3665,8 +3665,8 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
p->pals.g = 0;
p->pals.b = 0;
p->posvel.x = -(sintable[(p->ang+512)&2047]<<8);
p->posvel.y = -(sintable[(p->ang)&2047]<<8);
p->vel.x = -(sintable[(p->ang+512)&2047]<<8);
p->vel.y = -(sintable[(p->ang)&2047]<<8);
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
{
@ -3848,13 +3848,13 @@ void P_FragPlayer(int32_t snum)
if (snum == screenpeek)
{
Bsprintf(ScriptQuotes[115],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]);
P_DoQuote(115,p);
Bsprintf(ScriptQuotes[QUOTE_RESERVED],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]);
P_DoQuote(QUOTE_RESERVED,p);
}
else
{
Bsprintf(ScriptQuotes[116],"KILLED %s",&g_player[snum].user_name[0]);
P_DoQuote(116,g_player[p->frag_ps].ps);
Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"KILLED %s",&g_player[snum].user_name[0]);
P_DoQuote(QUOTE_RESERVED2,g_player[p->frag_ps].ps);
}
if (ud.obituaries)
@ -3941,13 +3941,13 @@ void P_ProcessWeapon(int32_t snum)
{
p->holster_weapon = 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)
{
p->holster_weapon = 0;
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->weapon_pos = 10;
P_DoQuote(74,p);
P_DoQuote(QUOTE_WEAPON_RAISED,p);
}
}
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))
{
p->pos.z = p->opos.z;
p->posvel.z = 0;
p->vel.z = 0;
(*kb) = 1;
if (aplWeaponInitialSound[p->curr_weapon][snum] > 0)
{
@ -4290,7 +4290,7 @@ void P_ProcessWeapon(int32_t snum)
&& *kb < (aplWeaponFireDelay[p->curr_weapon][snum]+1))
{
p->pos.z = p->opos.z;
p->posvel.z = 0;
p->vel.z = 0;
}
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
j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y);
p->posvel.x -= sintable[(j+512)&2047]<<4;
p->posvel.y -= sintable[j&2047]<<4;
p->vel.x -= sintable[(j+512)&2047]<<4;
p->vel.y -= sintable[j&2047]<<4;
}
}
@ -4597,7 +4597,7 @@ void P_ProcessInput(int32_t snum)
if (p->customexitsound >= 0)
{
S_PlaySound(p->customexitsound);
P_DoQuote(102,p);
P_DoQuote(QUOTE_WEREGONNAFRYYOURASS,p);
}
}
else if (p->timebeforeexit == 1)
@ -4689,7 +4689,7 @@ void P_ProcessInput(int32_t snum)
p->pos.y = SY;
p->pos.z = SZ;
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->rotscrnang = 0;
@ -4802,9 +4802,9 @@ void P_ProcessInput(int32_t snum)
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
// jump
if (p->posvel.z > 0) p->posvel.z = 0;
p->posvel.z -= 348;
if (p->posvel.z < -(256*6)) p->posvel.z = -(256*6);
if (p->vel.z > 0) p->vel.z = 0;
p->vel.z -= 348;
if (p->vel.z < -(256*6)) p->vel.z = -(256*6);
}
}
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)
{
// crouch
if (p->posvel.z < 0) p->posvel.z = 0;
p->posvel.z += 348;
if (p->posvel.z > (256*6)) p->posvel.z = (256*6);
if (p->vel.z < 0) p->vel.z = 0;
p->vel.z += 348;
if (p->vel.z > (256*6)) p->vel.z = (256*6);
}
}
else
{
// normal view
if (p->posvel.z < 0)
if (p->vel.z < 0)
{
p->posvel.z += 256;
if (p->posvel.z > 0)
p->posvel.z = 0;
p->vel.z += 256;
if (p->vel.z > 0)
p->vel.z = 0;
}
if (p->posvel.z > 0)
if (p->vel.z > 0)
{
p->posvel.z -= 256;
if (p->posvel.z < 0)
p->posvel.z = 0;
p->vel.z -= 256;
if (p->vel.z < 0)
p->vel.z = 0;
}
}
if (p->posvel.z > 2048)
p->posvel.z >>= 1;
if (p->vel.z > 2048)
p->vel.z >>= 1;
p->pos.z += p->posvel.z;
p->pos.z += p->vel.z;
if (p->pos.z > (fz-(15<<8)))
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)
{
p->pos.z = cz;
p->posvel.z = 0;
p->vel.z = 0;
}
if (p->scuba_on && (krand()&255) < 8)
@ -5004,16 +5004,16 @@ void P_ProcessInput(int32_t snum)
else
{
p->on_ground = 0;
p->posvel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
if (p->posvel.z >= (4096+2048)) p->posvel.z = (4096+2048);
if (p->posvel.z > 2400 && p->falling_counter < 255)
p->vel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
if (p->vel.z >= (4096+2048)) p->vel.z = (4096+2048);
if (p->vel.z > 2400 && p->falling_counter < 255)
{
p->falling_counter++;
if (p->falling_counter >= 38 && p->scream_voice <= FX_Ok)
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 (p->falling_counter > 62)
@ -5040,7 +5040,7 @@ void P_ProcessInput(int32_t snum)
p->pals.b = 0;
p->pals.f = 32;
}
else if (p->posvel.z > 2048)
else if (p->vel.z > 2048)
A_PlaySound(DUKE_LAND,p->i);
}
}
@ -5057,8 +5057,8 @@ void P_ProcessInput(int32_t snum)
p->scream_voice = -1;
}
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->posvel.z > (6144>>1))
p->hard_landing = p->posvel.z>>10;
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->vel.z > (6144>>1))
p->hard_landing = p->vel.z>>10;
p->on_ground = 1;
@ -5069,8 +5069,8 @@ void P_ProcessInput(int32_t snum)
k = ((fz-(i<<8))-p->pos.z)>>1;
if (klabs(k) < 256) k = 0;
p->pos.z += k;
p->posvel.z -= 768;
if (p->posvel.z < 0) p->posvel.z = 0;
p->vel.z -= 768;
if (p->vel.z < 0) p->vel.z = 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))
{
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)
{
p->jumping_counter = 0;
p->posvel.z = -512;
p->vel.z = -512;
}
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->on_ground = 0;
}
@ -5140,18 +5140,18 @@ void P_ProcessInput(int32_t snum)
else
{
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)))
{
p->jumping_counter = 0;
if (p->posvel.z < 0)
p->posvel.x = p->posvel.y = 0;
p->posvel.z = 128;
if (p->vel.z < 0)
p->vel.x = p->vel.y = 0;
p->vel.z = 128;
p->pos.z = cz+(4<<8);
}
}
@ -5161,8 +5161,8 @@ void P_ProcessInput(int32_t snum)
*kb > 1 && *kb < *aplWeaponFireDelay[p->curr_weapon]))
{
doubvel = 0;
p->posvel.x = 0;
p->posvel.y = 0;
p->vel.x = 0;
p->vel.y = 0;
}
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))
{
P_DoQuote(75, p);
P_DoQuote(QUOTE_BOOTS_ON, p);
p->inv_amount[GET_BOOTS] -= 2;
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)
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;
@ -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)
doubvel <<= 1;
p->posvel.x += ((g_player[snum].sync->fvel*doubvel)<<6);
p->posvel.y += ((g_player[snum].sync->svel*doubvel)<<6);
p->vel.x += ((g_player[snum].sync->fvel*doubvel)<<6);
p->vel.y += ((g_player[snum].sync->svel*doubvel)<<6);
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)))
j = 0x2000;
p->posvel.x = mulscale16(p->posvel.x,p->runspeed-j);
p->posvel.y = mulscale16(p->posvel.y,p->runspeed-j);
p->vel.x = mulscale16(p->vel.x,p->runspeed-j);
p->vel.y = mulscale16(p->vel.y,p->runspeed-j);
if (klabs(p->posvel.x) < 2048 && klabs(p->posvel.y) < 2048)
p->posvel.x = p->posvel.y = 0;
if (klabs(p->vel.x) < 2048 && klabs(p->vel.y) < 2048)
p->vel.x = p->vel.y = 0;
if (shrunk)
{
p->posvel.x = mulscale16(p->posvel.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.x = mulscale16(p->vel.x,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)
{
p->pos.x += p->posvel.x>>14;
p->pos.y += p->posvel.y>>14;
p->pos.x += p->vel.x>>14;
p->pos.y += p->vel.y>>14;
updatesector(p->pos.x,p->pos.y,&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);
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) ||
isanearoperator(sector[s->sectnum].lotag)))
activatebysector(s->sectnum,p->i);
G_ActivateBySector(s->sectnum,p->i);
if (j)
{
P_QuickKill(p);
@ -5377,7 +5377,7 @@ HORIZONLY:
}
}
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;
@ -5809,7 +5809,7 @@ void computergetinput(int32_t snum, input_t *syn)
if (fightdist < 128) fightdist = 128;
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
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;
fightdist = max(fightdist,(klabs(z2-z1)>>4));
@ -6048,13 +6048,13 @@ void computergetinput(int32_t snum, input_t *syn)
int16_t dasect = p->cursectnum;
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)
{
Bmemcpy(&vect,p,sizeof(vec3_t));
vect.z += (24<<8);
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)

View file

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

View file

@ -544,7 +544,7 @@ void G_CacheMapData(void)
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);
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->fta = 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->runspeed = g_playerFriction;
g_player[snum].ps->falling_counter = 0;
@ -782,9 +782,9 @@ void P_ResetStatus(int32_t snum)
p->newowner =-1;
p->jumping_counter = 0;
p->hard_landing = 0;
p->posvel.x = 0;
p->posvel.y = 0;
p->posvel.z = 0;
p->vel.x = 0;
p->vel.y = 0;
p->vel.z = 0;
fricxv = 0;
fricyv = 0;
p->somethingonplayer =-1;
@ -1560,31 +1560,26 @@ void G_ResetTimers(void)
g_moveThingsCount = 0;
}
void clearfifo(void)
void G_ClearFIFO(void)
{
int32_t i = 0;
extern int32_t jump_timer;
int32_t i = MAXPLAYERS-1;
g_emuJumpTics = 0;
jump_timer = 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(&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)
Bmemset(g_player[i].sync,0,sizeof(input_t));
g_player[i].vote = 0;
g_player[i].gotvote = 0;
Bmemset(g_player[i].sync, 0, sizeof(input_t));
g_player[i].vote = g_player[i].gotvote = 0;
}
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
}
extern int32_t voting, vote_map, vote_episode;
int32_t G_FindLevelForFilename(const char *fn)
int32_t G_FindLevelByFile(const char *fn)
{
int32_t volume, level;
@ -1637,8 +1632,10 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
if (filename != NULL)
Bstrcpy(outbuf, filename);
p = Bstrrchr(outbuf,'.');
if (!p) Bstrcat(outbuf,".mhk");
if (!p)
Bstrcat(outbuf,".mhk");
else
{
p[1]='m';
@ -1646,7 +1643,9 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
p[3]='k';
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)
@ -1671,18 +1670,21 @@ int32_t G_EnterLevel(int32_t g)
if ((g&MODE_DEMO) == 0 && ud.recstat == 2)
ud.recstat = 0;
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0);
if (g_networkMode != NET_DEDICATED_SERVER)
{
FX_StopAllSounds();
S_ClearSoundLocks();
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)
{
int32_t volume, level;
Bcorrectfilename(boardfilename,0);
volume = level = G_FindLevelForFilename(boardfilename);
volume = level = G_FindLevelByFile(boardfilename);
if (level != MAXLEVELS*MAXVOLUMES)
{
@ -1811,7 +1813,6 @@ int32_t G_EnterLevel(int32_t g)
}
else
{
i = strlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
copybufbyte(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i);
levname[i] = 255;
@ -1871,7 +1872,7 @@ int32_t G_EnterLevel(int32_t g)
G_OpenDemoWrite();
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)
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;
clearfifo();
G_ClearFIFO();
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 palette_t CrosshairColors;
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_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);
@ -45,7 +45,7 @@ void P_ResetInventory(int32_t snum);
void P_ResetPlayer(int32_t snum);
void P_ResetStatus(int32_t snum);
void P_ResetWeapons(int32_t snum);
void clearfifo(void);
void xyzmirror(int32_t i,int32_t wn);
void G_ClearFIFO(void);
void G_SetupCamTile(int32_t i,int32_t wn);
#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 (bv != BYTEVERSION)
{
P_DoQuote(114,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil);
return 1;
}*/
@ -154,7 +154,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&bv,sizeof(bv),1,fil) != 1) return -1;
if (bv != BYTEVERSION)
{
P_DoQuote(114,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
@ -167,7 +167,7 @@ int32_t G_LoadPlayer(int32_t spot)
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
P_DoQuote(124,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_PLAYERS,g_player[myconnectindex].ps);
return 1;
}
else ud.multimode = nump;
@ -590,7 +590,7 @@ int32_t G_LoadPlayer(int32_t spot)
ready2send = 1;
clearfifo();
G_ClearFIFO();
Net_WaitForServer();
G_ResetTimers();
@ -895,8 +895,8 @@ int32_t G_SavePlayer(int32_t spot)
if ((!g_netServer && ud.multimode < 2))
{
strcpy(ScriptQuotes[122],"GAME SAVED");
P_DoQuote(122,g_player[myconnectindex].ps);
strcpy(ScriptQuotes[QUOTE_RESERVED4],"GAME SAVED");
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
}
ready2send = 1;

View file

@ -307,7 +307,7 @@ void G_DoSectorAnimations(void)
if (sprite[g_player[p].ps->i].owner >= 0)
{
g_player[p].ps->pos.z += v;
g_player[p].ps->posvel.z = 0;
g_player[p].ps->vel.z = 0;
if (p == myconnectindex)
{
my.z += v;
@ -381,7 +381,7 @@ void G_AnimateCamSprite(void)
if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
else walock[TILE_VIEWSCR] = 255;
xyzmirror(OW,/*PN*/TILE_VIEWSCR);
G_SetupCamTile(OW,/*PN*/TILE_VIEWSCR);
}
}
else T1++;
@ -1046,8 +1046,8 @@ void G_OperateActivators(int32_t low,int32_t snum)
if (snum >= 0 && snum < ud.multimode)
{
if (sector[SECT].lotag&16384)
P_DoQuote(4,g_player[snum].ps);
else P_DoQuote(8,g_player[snum].ps);
P_DoQuote(QUOTE_LOCKED,g_player[snum].ps);
else P_DoQuote(QUOTE_UNLOCKED,g_player[snum].ps);
}
}
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))
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)
{
if (g_player[snum].ps->got_access&2)
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)
{
if (g_player[snum].ps->got_access&4)
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)
@ -1565,11 +1565,11 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
case 25:
actor[x].t_data[4] = !actor[x].t_data[4];
if (actor[x].t_data[4])
P_DoQuote(15,g_player[snum].ps);
else P_DoQuote(2,g_player[snum].ps);
P_DoQuote(QUOTE_DEACTIVATED,g_player[snum].ps);
else P_DoQuote(QUOTE_ACTIVATED,g_player[snum].ps);
break;
case 21:
P_DoQuote(2,g_player[screenpeek].ps);
P_DoQuote(QUOTE_ACTIVATED,g_player[screenpeek].ps);
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 didit = 0;
@ -2521,7 +2521,7 @@ void G_HandleSharedKeys(int32_t snum)
{
p->quick_kick = 14;
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->inven_icon = 5;
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]--;
A_PlaySound(DUKE_TAKEPILLS,p->i);
P_DoQuote(12,p);
P_DoQuote(QUOTE_USED_STEROIDS,p);
}
if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2;
@ -2710,7 +2710,8 @@ CHECKINV1:
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);
}
}
@ -2919,11 +2920,11 @@ CHECKINV1:
T4 = T5 = 0;
SP = snum;
sprite[i].extra = 0;
P_DoQuote(47,p);
P_DoQuote(QUOTE_HOLODUKE_ON,p);
A_PlaySound(TELEPORTER,p->holoduke_on);
}
}
else P_DoQuote(49,p);
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,p);
}
}
else
@ -2934,7 +2935,7 @@ CHECKINV1:
{
A_PlaySound(TELEPORTER,p->holoduke_on);
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;
VM_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
@ -2986,19 +2987,19 @@ CHECKINV1:
A_PlaySound(DUKE_JETPACK_ON,p->i);
P_DoQuote(52,p);
P_DoQuote(QUOTE_JETPACK_ON,p);
}
else
{
p->hard_landing = 0;
p->posvel.z = 0;
p->vel.z = 0;
A_PlaySound(DUKE_JETPACK_OFF,p->i);
S_StopEnvSound(DUKE_JETPACK_IDLE,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;
*hitsp = hitinfo.hitsprite;
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
return((1<<30));
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;
@ -3064,7 +3066,7 @@ void P_CheckSectors(int32_t snum)
case 32767:
sector[p->cursectnum].lotag = 0;
P_DoQuote(9,p);
P_DoQuote(QUOTE_FOUND_SECRET,p);
p->secret_rooms++;
return;
case -1:
@ -3144,7 +3146,7 @@ void P_CheckSectors(int32_t snum)
p->toggle_key_flag = 1;
hitscanwall = -1;
i = hitawall(p,&hitscanwall);
i = P_FindWall(p,&hitscanwall);
if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
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;
case NUKEBUTTON__STATIC:
hitawall(p,&j);
P_FindWall(p,&j);
if (j >= 0 && wall[j].overpicnum == 0)
if (actor[neartagsprite].t_data[0] == 0)
{

View file

@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gamevars.h"
#define MAXCYCLERS 1024
#define MAXANIMATES 256
#define MAXANIMWALLS 512
#define MAXCYCLERS 1024
#define MAXANIMATES 256
#define MAXANIMWALLS 512
typedef struct {
int16_t wallnum, tag;
@ -85,7 +85,7 @@ typedef struct {
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_CheckHitSprite(int32_t i,int16_t *hitsp);
void A_DamageObject(int32_t i,int32_t sn);