Skip to content

Commit

Permalink
Cleaned up everythiing and Bumped to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
doomjoshuaboy committed Oct 29, 2020
1 parent 95381a8 commit 24b0513
Show file tree
Hide file tree
Showing 25 changed files with 712 additions and 1,047 deletions.
4 changes: 4 additions & 0 deletions .hg_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
repo: cc9165005bbc6161c0adbdf418e79445e1b09598
node: 10af1739daa34a45cb0817adfdef4106b20c0634
branch: default
tag: ZA_3.0.1
Binary file added rcon_utility/resource.aps
Binary file not shown.
6 changes: 3 additions & 3 deletions sqlite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required( VERSION 2.4 )

# [BB/EP] Download SQLite archive and extract the sources if necessary.
set( ZAN_SQLITE_VERSION 3300100 ) # SQL version 3.30.1
set( ZAN_SQLITE_YEAR 2019 )
set( ZAN_SQLITE_SHA1 "8383f29d53fa1d4383e4c8eb3e087f2ed940a9e0" )
set( ZAN_SQLITE_VERSION 3180000 ) # SQL version 3.18.0
set( ZAN_SQLITE_YEAR 2017 )
set( ZAN_SQLITE_SHA1 "74559194e1dd9b9d577cac001c0e9d370856671b" )
set( ZAN_SQLITE_DOWNLOAD_NAME "sqlite-autoconf-${ZAN_SQLITE_VERSION}" )
set( ZAN_SQLITE_TEMP_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz" )
set( ZAN_SQLITE_HASHED_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/sqlite-${ZAN_SQLITE_SHA1}.tar.gz" )
Expand Down
2 changes: 1 addition & 1 deletion src/cl_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void CLIENTCOMMANDS_ClientMove( void )
NETWORK_WriteByte( &CLIENT_GetLocalBuffer( )->ByteStream, CLC_CLIENTMOVE );
NETWORK_WriteLong( &CLIENT_GetLocalBuffer( )->ByteStream, gametic );
// [CK] Send the server the latest known server-gametic
NETWORK_WriteLong(&CLIENT_GetLocalBuffer()->ByteStream, CLIENT_GetLatestServerGametic() + CLIENT_GetServerGameticOffset());
NETWORK_WriteLong( &CLIENT_GetLocalBuffer( )->ByteStream, CLIENT_GetLatestServerGametic( ) );

// Decide what additional information needs to be sent.
ulBits = 0;
Expand Down
26 changes: 3 additions & 23 deletions src/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ EXTERN_CVAR( Float, turbo )
EXTERN_CVAR( Float, sv_gravity )
EXTERN_CVAR( Float, sv_aircontrol )
EXTERN_CVAR( Bool, cl_hideaccount )
EXTERN_CVAR(Int, cl_ticsperupdate )
EXTERN_CVAR( String, name )

//*****************************************************************************
Expand Down Expand Up @@ -364,11 +363,8 @@ static LONG g_lMissingPacketTicks;
// Debugging variables.
static LONG g_lLastCmd;

// [CK] The most up-to-date server gametic.
static int g_lLatestServerGametic = 0;

// Offset from the server gametic caused by cl_ticsperupdate.
static int g_ServerGameticOffset;
// [CK] The most up-to-date server gametic
static int g_lLatestServerGametic = 0;

// [TP] Client's understanding of the account names of players.
static FString g_PlayerAccountNames[MAXPLAYERS];
Expand Down Expand Up @@ -548,10 +544,6 @@ void CLIENT_Tick( void )
//
void CLIENT_EndTick( void )
{
// Take in account cl_ticsperupdate the next time we send a movement command.
if ( g_ServerGameticOffset < cl_ticsperupdate - 1)
g_ServerGameticOffset++;

// [TP] Do we want to change our weapon or use an item or something like that?
if ( SendItemUse )
{
Expand Down Expand Up @@ -746,17 +738,7 @@ int CLIENT_GetLatestServerGametic( void )
void CLIENT_SetLatestServerGametic( int latestServerGametic )
{
if ( latestServerGametic >= 0 )
{
g_lLatestServerGametic = latestServerGametic;
g_ServerGameticOffset = 0;
}
}

//*****************************************************************************
//
int CLIENT_GetServerGameticOffset(void)
{
return g_ServerGameticOffset;
}

//*****************************************************************************
Expand Down Expand Up @@ -832,9 +814,7 @@ void CLIENT_AttemptConnection( void )
g_lHighestReceivedSequence = -1;

g_lMissingPacketTicks = 0;
\
// [CK] Reset this here since we plan on connecting to a new server
CLIENT_SetLatestServerGametic( 0 );
g_lLatestServerGametic = 0; // [CK] Reset this here since we plan on connecting to a new server

// Send connection signal to the server.
NETWORK_WriteByte( &g_LocalBuffer.ByteStream, CLCC_ATTEMPTCONNECTION );
Expand Down
1 change: 0 additions & 1 deletion src/cl_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ bool CLIENT_GetAllowSendingOfUserInfo( void );
void CLIENT_SetAllowSendingOfUserInfo( bool bAllow );
int CLIENT_GetLatestServerGametic( void );
void CLIENT_SetLatestServerGametic( int latestServerGametic );
int CLIENT_GetServerGameticOffset( void );
bool CLIENT_GetFullUpdateIncomplete ( void );
unsigned int CLIENT_GetEndFullUpdateTic( void );
const FString &CLIENT_GetPlayerAccountName( int player );
Expand Down
4 changes: 4 additions & 0 deletions src/g_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
#include "domination.h"
#include "win32/g15/g15.h"
#include "gl/dynlights/gl_dynlight.h"
#include "unlagged.h"
#include "p_3dmidtex.h"
#include "a_lightning.h"
#include "po_man.h"
Expand Down Expand Up @@ -1720,6 +1721,9 @@ void G_Ticker ()

}

// [BB] Tick the unlagged module.
UNLAGGED_Tick( );

// [BB] Don't call P_Ticker on the server if there are no players.
// This significantly reduces CPU usage on maps with many monsters
// (of course only as long as there are no connected clients).
Expand Down
3 changes: 1 addition & 2 deletions src/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3993,9 +3993,8 @@ void AActor::Tick ()
{
// In server mode, only allow the ticking of a player if he's a client currently
// having his movement commands executed.
// Only tick the body if we processed a movement command this tic.
if (( NETWORK_GetState( ) == NETSTATE_SERVER ) &&
(SERVER_GetClient(player - players)->lLastMoveTickProcess != gametic) &&
( SERVER_GetCurrentClient( ) != ( player - players )) &&
( player->bIsBot == false ))
{
return;
Expand Down
6 changes: 2 additions & 4 deletions src/p_pspr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ static FRandom pr_gunshot ("GunShot");
//
//---------------------------------------------------------------------------

// [EP] Added player parameter.
void P_NewPspriteTick(player_t * player)
void P_NewPspriteTick()
{
// This function should be called after the beginning of a tick, before any possible
// prprite-event, or near the end, after any possible psprite event.
// Because data is reset for every tick (which it must be) this has no impact on savegames.
for (int i = 0; i<MAXPLAYERS; i++)
{
// [EP] if player is not NULL, only this player's psprite settings are changed.
if (playeringame[i] && (player == NULL || player - players == i))
if (playeringame[i])
{
pspdef_t *pspdef = players[i].psprites;
for (int j = 0;j < NUMPSPRITES; j++)
Expand Down
2 changes: 1 addition & 1 deletion src/p_pspr.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class player_t;
class AActor;
struct FState;

void P_NewPspriteTick(player_t * player = NULL); // [EP] Add player parameter.
void P_NewPspriteTick();
void P_SetPsprite (player_t *player, int position, FState *state, bool nofunction=false);
void P_CalcSwing (player_t *player);
void P_BringUpWeapon (player_t *player);
Expand Down
2 changes: 1 addition & 1 deletion src/p_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ void P_SpawnSpecials (void)
if ((sector->special & 0xff) >= Scroll_North_Slow &&
(sector->special & 0xff) <= Scroll_SouthWest_Fast)
{ // Hexen scroll special
signed static const char hexenScrollies[24][2] =
static const SBYTE hexenScrollies[24][2] =
{
{ 0, 1 }, { 0, 2 }, { 0, 4 },
{ -1, 0 }, { -2, 0 }, { -4, 0 },
Expand Down
30 changes: 1 addition & 29 deletions src/p_tick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,34 +311,6 @@ void P_Ticker (void)
}
}

// [Leo] The player ticking process for the server is now "linear" because we must call P_PlayerThink for
// everyone before ticking (and therefore moving) the mobjs so that clients can get a chance to hit someone.
// [BB] Process up to two movement commands for each client.
if (NETWORK_GetState() == NETSTATE_SERVER)
{
for (int i = 0; i < 2; i++)
{
for (ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++)
{
if (SERVER_IsValidClient(ulIdx) == false)
continue;

while (SERVER_GetClient(ulIdx)->MoveCMDs.Size() != 0)
{
// Process only one movement command.
const bool bMovement = SERVER_GetClient(ulIdx)->MoveCMDs[0]->isMoveCmd();
SERVER_GetClient(ulIdx)->MoveCMDs[0]->process(ulIdx);

delete SERVER_GetClient(ulIdx)->MoveCMDs[0];
SERVER_GetClient(ulIdx)->MoveCMDs.Delete(0);

if (bMovement == true)
break;
}
}
}
}

for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
{
// Increment individual player time.
Expand All @@ -363,7 +335,7 @@ void P_Ticker (void)
}
}

// Clients "think" every time we process a movement command.
// Client's "think" every time we get a cmd.
// [BB] The server has to think for lagging clients, otherwise they aren't affected by things like sector damage.
if (( NETWORK_GetState( ) == NETSTATE_SERVER ) && ( players[ulIdx].bIsBot == false ) && ( players[ulIdx].bLagging == false ) )
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/sdl/i_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int main (int argc, char **argv)

// [SB] I moved this below the ZA_PrintVersion call so it
// doesn't get printed to stdout with --version's output.
printf(GAMENAME" %s - %s - SDL version\nCompiled on %s\n for Raspberry PI",
printf(GAMENAME" %s - %s - SDL version\nCompiled on %s for Raspberry-Pi\n",
GetVersionString(), GetGitTime(), __DATE__);

#ifdef SERVER_ONLY
Expand Down
57 changes: 31 additions & 26 deletions src/sv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
#include "p_enemy.h"
#include "network/packetarchive.h"
#include "p_lnspec.h"
#include "unlagged.h"

//*****************************************************************************
// MISC CRAP THAT SHOULDN'T BE HERE BUT HAS TO BE BECAUSE OF SLOPPY CODING
Expand All @@ -138,7 +137,6 @@ void SERVERCONSOLE_ReListPlayers( void );

EXTERN_CVAR( Bool, sv_cheats );
EXTERN_CVAR( Bool, sv_showwarnings );
EXTERN_CVAR( Bool, sv_unlagged_debugactors)

//*****************************************************************************
// PROTOTYPES
Expand Down Expand Up @@ -594,20 +592,30 @@ void SERVER_Tick( void )
// Recieve packets.
SERVER_GetPackets( );

// We have to record player positions before their mobj moves.
// [BB] Tick the unlagged module.
UNLAGGED_Tick();
// [BB] Process up to two movement commands for each client.
for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
{
if ( SERVER_IsValidClient( ulIdx ) == false )
continue;

G_Ticker ();
int numMoveCMDs = 0;
for ( unsigned int i = 0; i < g_aClients[ulIdx].MoveCMDs.Size(); ++i )
{
g_aClients[ulIdx].MoveCMDs[0]->process ( ulIdx );

// However we need to spawn the unlagged debug actors here i.e. after having processed their
// movement commands which updated their last server gametic.
// [BB] Spawn debug actors if the server runner wants them.
if ( sv_unlagged_debugactors )
UNLAGGED_SpawnDebugActors( );
// [BB] Only limit the amount of movement commands.
if ( g_aClients[ulIdx].MoveCMDs[0]->isMoveCmd() )
++numMoveCMDs;

gametic++;
maketic++;
delete g_aClients[ulIdx].MoveCMDs[0];
g_aClients[ulIdx].MoveCMDs.Delete(0);

if ( numMoveCMDs == 2 )
break;
}
}

G_Ticker ();

// Update the scoreboard if we have a new second to display.
if ( timelimit && (( level.time % TICRATE ) == 0 ) && ( level.time != iOldTime ))
Expand Down Expand Up @@ -689,6 +697,8 @@ void SERVER_Tick( void )
SERVERCOMMANDS_MapAuthenticate ( level.mapname, ulIdx, SVCF_ONLYTHISCLIENT );
}

gametic++;
maketic++;

// Do some statistic stuff every second.
if (( gametic % TICRATE ) == 0 )
Expand Down Expand Up @@ -1993,7 +2003,6 @@ void SERVER_SetupNewConnection( BYTESTREAM_s *pByteStream, bool bNewPlayer )
g_aClients[lClient].ulLastSuicideTime = 0;
g_aClients[lClient].lLastPacketLossTick = 0;
g_aClients[lClient].lLastMoveTick = 0;
g_aClients[lClient].lLastMoveTickProcess = 0;
g_aClients[lClient].lOverMovementLevel = 0;
g_aClients[lClient].bRunEnterScripts = false;
g_aClients[lClient].bSuspicious = false;
Expand Down Expand Up @@ -5287,15 +5296,6 @@ bool ClientMoveCommand::process( const ULONG ulClient ) const
{
if ( pPlayer->mo )
{
// We already processed a movement command this tic
if (g_aClients[ulClient].lLastMoveTickProcess == gametic)
{
// [Leo] We have no choice left but to tick the body now.
pPlayer->mo->Tick();

// [EP] Make sure that the server sets the proper player psprite settings before running the psprite-events from this client command.
P_NewPspriteTick(pPlayer);
}

// [BB] Ignore the angle and pitch sent by the client if the client isn't authenticated yet.
// In this case the client still sends these values based on the previous map.
Expand All @@ -5319,9 +5319,14 @@ bool ClientMoveCommand::process( const ULONG ulClient ) const
pPlayer->mo->pitch = ( ANGLE_1 * 90 );

P_PlayerThink( pPlayer );

// P_PlayerThink was called this tic, this is used to tick the body afterwards.
g_aClients[ulClient].lLastMoveTickProcess = gametic;

// [BB] The server blocks AActor::Tick() for non-bot player actors unless the player
// is the "current client". So we have to work around this.
const LONG savedCurrentClient = g_lCurrentClient;
g_lCurrentClient = ulClient;
if ( pPlayer->mo )
pPlayer->mo->Tick( );
g_lCurrentClient = savedCurrentClient;

// [BB] We possibly process more than one move of this client per tic,
// so we have to update oldbuttons (otherwise a door that just started to
Expand Down
3 changes: 0 additions & 3 deletions src/sv_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ struct CLIENT_s
// Last tick we received a movement command.
LONG lLastMoveTick;

// Last tick we processed a movement command.
LONG lLastMoveTickProcess;

// We keep track of how many extra movement commands we get from the client. If it
// exceeds a certain level over time, we kick him.
LONG lOverMovementLevel;
Expand Down
2 changes: 1 addition & 1 deletion src/sv_master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void SERVER_MASTER_Construct( void )
if ( uname(&u_name) < 0 )
g_VersionWithOS.Format ( "%s (RPIv%d)", GetVersionStringRev(), RPI_VERSION ); //error, no data
else
g_VersionWithOS.Format ( "%s (RPIv%d) on %s %s", GetVersionStringRev(), RPI_VERSION, u_name.sysname, u_name.release ); // "Linux 2.6.32.5-amd64" or "FreeBSD 9.0-RELEASE" etc
g_VersionWithOS.Format ( "%s on %s %s", GetVersionStringRev(), RPI_VERSION, u_name.sysname, u_name.release ); // "Linux 2.6.32.5-amd64" or "FreeBSD 9.0-RELEASE" etc
#endif

// [TP] Which wads will we broadcast as optional to launchers?
Expand Down
Binary file added src/timidity/instrum.obj
Binary file not shown.
22 changes: 14 additions & 8 deletions src/unlagged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,25 @@ CVAR( Bool, sv_unlagged_debugactors, false, 0 )
bool reconciledGame = false;
int reconciliationBlockers = 0;

void UNLAGGED_Tick(void)
void UNLAGGED_Tick( void )
{
// [BB] Only the server has to do anything here.
if (NETWORK_GetState() != NETSTATE_SERVER)
if ( NETWORK_GetState() != NETSTATE_SERVER )
return;

// [Spleen] Record sectors soon before they are reconciled/restored
UNLAGGED_RecordSectors();
UNLAGGED_RecordSectors( );

// [Spleen] Record players
for (ULONG ulIdx = 0; ulIdx < MAXPLAYERS; ++ulIdx)
for ( ULONG ulIdx = 0; ulIdx < MAXPLAYERS; ++ulIdx )
{
if (PLAYER_IsValidPlayerWithMo(ulIdx))
UNLAGGED_RecordPlayer(&players[ulIdx]);
if ( PLAYER_IsValidPlayerWithMo( ulIdx ) )
UNLAGGED_RecordPlayer( &players[ulIdx] );
}

// [BB] Spawn debug actors if the server runner wants them.
if ( sv_unlagged_debugactors )
UNLAGGED_SpawnDebugActors( );
}

//Figure out which tic to use for reconciliation
Expand All @@ -103,11 +107,13 @@ int UNLAGGED_Gametic( player_t *player )
if ( pClient == NULL )
return gametic;


// The logic here with + 1 is that you will be behind the server by one
// gametic, since the loop is: 1) poll input 2) update world 3) render,
// which makes your client old by one gametic.
// [CK] If the client wants ping unlagged, use that.
int unlaggedGametic = ( players[playerNum].userinfo.GetClientFlags() & CLIENTFLAGS_PING_UNLAGGED ) ?
gametic - ( player->ulPing * TICRATE / 1000 ) :
pClient->lLastServerGametic;
pClient->lLastServerGametic + 1;

// Do not let the client send us invalid gametics ahead of the server's
// gametic. This should be guarded against, but just in case...
Expand Down
Loading

0 comments on commit 24b0513

Please sign in to comment.