Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions docker-scripts/dockerfiles/rtcwpro-compile-18
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ RUN dpkg --add-architecture i386 && \
apt-get install -y wget libc6:i386 zip \
unzip git gdb-multiarch gcc cmake perl curl gcc-multilib g++-multilib \
autoconf libtool nasm mingw-w64 mingw-w64-tools g++ \
libgl-dev libsdl2-dev:i386 clang-tools-10 lld-10
libgl-dev libsdl2-dev:i386 lsb-release software-properties-common gnupg

RUN ln -s /usr/bin/clang-10 /usr/bin/clang && \
ln -s /usr/bin/clang-cl-10 /usr/bin/clang-cl && \
ln -s /usr/bin/llvm-lib-10 /usr/bin/llvm-lib && \
ln -s /usr/bin/lld-link-10 /usr/bin/lld-link && \
ln -s /usr/bin/llvm-rc-10 /usr/bin/llvm-rc
RUN wget -qO- https://apt.llvm.org/llvm.sh | bash -s -- 15

RUN apt-get update && \
apt-get install -y clang-tools-15 lld-15

RUN ln -s /usr/bin/clang-15 /usr/bin/clang && \
ln -s /usr/bin/clang-cl-15 /usr/bin/clang-cl && \
ln -s /usr/bin/llvm-lib-15 /usr/bin/llvm-lib && \
ln -s /usr/bin/lld-link-15 /usr/bin/lld-link && \
ln -s /usr/bin/llvm-rc-15 /usr/bin/llvm-rc

RUN mkdir /output
RUN chown compile:compile /output
Expand Down
3 changes: 2 additions & 1 deletion fetch-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ cd $DEPS_ROOT

LIBUNWIND_DIR=`pwd`/libunwind
if [ ! -d "$LIBUNWIND_DIR" ]; then
VER=$(curl --silent -qI https://github.com/libunwind/libunwind/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}');
#VER=$(curl --silent -qI https://github.com/libunwind/libunwind/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}');
VER="v1.8.1"
wget https://api.github.com/repos/libunwind/libunwind/tarball/$VER
tar xvfz $VER
rm $VER
Expand Down
75 changes: 71 additions & 4 deletions src/cgame/cg_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,11 @@ CG_CalcEntityLerpPositions
===============
*/
static void CG_CalcEntityLerpPositions( centity_t *cent ) {
//unlagged - projectile nudge
// this will be set to how far forward projectiles will be extrapolated
int timeshift = 0;
//unlagged - projectile nudge

if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
CG_InterpolateEntityPosition( cent );
return;
Expand All @@ -1939,6 +1944,7 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) {
}
// -NERVE - SMF

//unlagged - timenudge extrapolation
// interpolating failed (probably no nextSnap), so extrapolate
// this can also happen if the teleport bit is flipped, but that
// won't be noticeable
Expand All @@ -1948,10 +1954,49 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) {
cent->currentState.pos.trTime = cg.snap->serverTime;
cent->currentState.pos.trDuration = 1000 / trap_Cvar_VariableIntegerValue("sv_fps");
}
//unlagged - timenudge extrapolation

//unlagged - projectile nudge
// if it's a missile but not a grappling hook
if ( cent->currentState.eType == ET_MISSILE /*&& cent->currentState.weapon != WP_GRAPPLING_HOOK*/ ) {
// if it's one of ours
if ( cent->currentState.otherEntityNum == cg.clientNum ) {
// extrapolate one server frame's worth - this will correct for tiny
// visual inconsistencies introduced by backward-reconciling all players
// one server frame before running projectiles
timeshift = 1000 / sv_fps.integer;
}
// if it's not, and it's not a grenade launcher
else if ( cent->currentState.weapon != WP_GRENADE_LAUNCHER ) {
// extrapolate based on cg_projectileNudge
//timeshift = cg_projectileNudge.integer + 1000 / sv_fps.integer; // removed cg_projectileNudge
timeshift = 1000 / sv_fps.integer;
}
}

// just use the current frame and evaluate as best we can
BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
// BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
// BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
BG_EvaluateTrajectory( &cent->currentState.pos, cg.time + timeshift, cent->lerpOrigin );
BG_EvaluateTrajectory( &cent->currentState.apos, cg.time + timeshift, cent->lerpAngles );

// if there's a time shift
if ( timeshift != 0 ) {
trace_t tr;
vec3_t lastOrigin;

BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, lastOrigin );

CG_Trace( &tr, lastOrigin, vec3_origin, vec3_origin, cent->lerpOrigin, cent->currentState.number, MASK_SHOT );

// don't let the projectile go through the floor
if ( tr.fraction < 1.0f ) {
cent->lerpOrigin[0] = lastOrigin[0] + tr.fraction * ( cent->lerpOrigin[0] - lastOrigin[0] );
cent->lerpOrigin[1] = lastOrigin[1] + tr.fraction * ( cent->lerpOrigin[1] - lastOrigin[1] );
cent->lerpOrigin[2] = lastOrigin[2] + tr.fraction * ( cent->lerpOrigin[2] - lastOrigin[2] );
}
}
//unlagged - projectile nudge

// adjust for riding a mover if it wasn't rolled into the predicted
// player state
Expand Down Expand Up @@ -2188,6 +2233,7 @@ void CG_AddPacketEntities( void ) {
centity_t *cent;
playerState_t *ps;
//int clcount;
//int a, b, c = 0; //DEBUG for early transitioning

// set cg.frameInterpolation
if ( cg.nextSnap ) {
Expand Down Expand Up @@ -2230,13 +2276,31 @@ void CG_AddPacketEntities( void ) {
// lerp the non-predicted value for lightning gun origins
CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] );

// add each entity sent over by the server
//unlagged - early transitioning
if ( cg.nextSnap ) {
// pre-add some entities sent over by the server
// we have data for them and they don't need to interpolate
// NON TAG-CONNECTED ENTITIES
for ( num = 0 ; num < cg.nextSnap->numEntities ; num++ ) {
cent = &cg_entities[ cg.nextSnap->entities[ num ].number ];
if ( !( cent->currentState.eFlags & EF_TAGCONNECT ) && ( cent->nextState.eType == ET_MISSILE || cent->nextState.eType == ET_GENERAL ) ) {
// transition it immediately and add it
CG_TransitionEntity( cent );
cent->interpolate = qtrue;
CG_AddCEntity( cent );
//a++; //DEBUG for early transitioning
}
}
//CG_Printf("\n(nextSnap) NON-TAGGED: %i ADDED\n", a); //DEBUG for early transitioning
}

// add each entity sent over by the server
// NON TAG-CONNECTED ENTITIES
for ( num = 0 ; num < cg.snap->numEntities ; num++ ) {
cent = &cg_entities[ cg.snap->entities[ num ].number ];
if ( !( cent->currentState.eFlags & EF_TAGCONNECT ) ) {
if ( !( cent->currentState.eFlags & EF_TAGCONNECT ) && ( !cg.nextSnap || cent->nextState.eType != ET_MISSILE && cent->nextState.eType != ET_GENERAL ) ) {
CG_AddCEntity( cent );
//b++; //DEBUG for early transitioning
}
}

Expand All @@ -2245,8 +2309,11 @@ void CG_AddPacketEntities( void ) {
cent = &cg_entities[ cg.snap->entities[ num ].number ];
if ( cent->currentState.eFlags & EF_TAGCONNECT ) {
CG_AddEntityToTag( cent );
//c++; //DEBUG for early transitioning
}
}
//CG_Printf("(snap) NON-TAGGED: %i / TAGGED: %i ADDED\n", b, c); //DEBUG for early transitioning
//unlagged - early transitioning

// Ridah, add the flamethrower sounds
CG_UpdateFlamethrowerSounds();
Expand Down
32 changes: 28 additions & 4 deletions src/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2272,14 +2272,38 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {

case EV_BULLET_HIT_WALL:
DEBUGNAME( "EV_BULLET_HIT_WALL" );
ByteToDir( es->eventParm, dir );
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD, qfalse, es->otherEntityNum2, 0 );
// CG_MachineGunEjectBrass(cent); // JPW NERVE
//unlagged - attack prediction #2
// if the client is us, unlagged is on server-side, and we've got it client-side
if ( CG_PredictedWeapon(cg.predictedPlayerState.weapon) && es->clientNum == cg.predictedPlayerState.clientNum &&
cgs.delagHitscan && (cg_delag.integer & 1 || cg_delag.integer & 2) ) {
// do nothing, because it was already predicted
//Com_Printf("Ignoring bullet event\n");
}
else {
// do the bullet, because it wasn't predicted
ByteToDir( es->eventParm, dir );
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD, qfalse, es->otherEntityNum2, 0 );
// CG_MachineGunEjectBrass(cent); // JPW NERVE
//Com_Printf("Non-predicted bullet\n");
}
//unlagged - attack prediction #2
break;

case EV_BULLET_HIT_FLESH:
DEBUGNAME( "EV_BULLET_HIT_FLESH" );
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm, qfalse, es->otherEntityNum2, 0 );
//unlagged - attack prediction #2
// if the client is us, unlagged is on server-side, and we've got it client-side
if ( CG_PredictedWeapon(cg.predictedPlayerState.weapon) && es->clientNum == cg.predictedPlayerState.clientNum &&
cgs.delagHitscan && (cg_delag.integer & 1 || cg_delag.integer & 2) ) {
// do nothing, because it was already predicted
//Com_Printf("Ignoring bullet event\n");
}
else {
// do the bullet, because it wasn't predicted
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm, qfalse, es->otherEntityNum2, 0 );
//Com_Printf("Non-predicted bullet\n");
}
//unlagged - attack prediction #2
break;

case EV_WOLFKICK_HIT_WALL:
Expand Down
35 changes: 35 additions & 0 deletions src/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,10 @@ typedef struct {

#define MAX_PREDICTED_EVENTS 16

//unlagged - optimized prediction
#define NUM_SAVED_STATES (CMD_BACKUP + 2)
//unlagged - optimized prediction

#define MAX_SPAWN_VARS 64
#define MAX_SPAWN_VARS_CHARS 2048
// OSPx - Draw HUDnames
Expand Down Expand Up @@ -1260,6 +1264,13 @@ typedef struct {
// RtcwPro shoutcast overlay
int lastKeyCatcher;
qbool ndpDemoEnabled;

//unlagged - optimized prediction
int lastPredictedCommand;
int lastServerTime;
playerState_t savedPmoveStates[NUM_SAVED_STATES];
int stateHead, stateTail;
//unlagged - optimized prediction
} cg_t;


Expand Down Expand Up @@ -1960,6 +1971,11 @@ typedef struct {
qboolean fKeyPressed[256]; // Key status to get around console issues
int timescaleUpdate; // Timescale display for demo playback
demoTimeline_t demoTimeline;

//unlagged - client options
// this will be set to the server's g_delagHitscan
int delagHitscan;
//unlagged - client options
} cgs_t;

//==============================================================================
Expand Down Expand Up @@ -2071,7 +2087,10 @@ extern vmCvar_t cg_noVoiceText; // NERVE - SMF
extern vmCvar_t cg_enableBreath;
extern vmCvar_t cg_autoactivate;
extern vmCvar_t cg_emptyswitch;
//unlagged - smooth clients #2
// this is done server-side now
//extern vmCvar_t cg_smoothClients;
//unlagged - smooth clients #2
extern vmCvar_t pmove_fixed;
extern vmCvar_t pmove_msec;

Expand Down Expand Up @@ -2278,6 +2297,18 @@ extern vmCvar_t cg_teamObituaryColorEnemyTK; // enemy team TK color

extern vmCvar_t cg_drawCI;

//unlagged - client options
extern vmCvar_t cg_delag;
extern vmCvar_t sv_fps;
extern vmCvar_t cg_optimizePrediction;
//unlagged - client options


//unlagged - cg_unlagged.c
void CG_PredictWeaponEffects( centity_t *cent );
qboolean CG_PredictedWeapon( int weapon );
//unlagged - cg_unlagged.c

//
// cg_main.c
//
Expand Down Expand Up @@ -2715,6 +2746,10 @@ void CG_RumbleEfx( float pitch, float yaw );
void CG_ProcessSnapshots( void );
void CG_NDP_ProcessSnapshots( void );

//unlagged - early transitioning
void CG_TransitionEntity( centity_t *cent );
//unlagged - early transitioning

//
// cg_spawn.c
//
Expand Down
24 changes: 22 additions & 2 deletions src/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ vmCvar_t cg_enableBreath;
vmCvar_t cg_autoactivate;
vmCvar_t cg_blinktime; //----(SA) added

//vmCvar_t cg_smoothClients;
//unlagged - smooth clients #2
// this is done server-side now
//vmCvar_t cg_smoothClients;
//unlagged - smooth clients #2
vmCvar_t pmove_fixed;
vmCvar_t pmove_msec;

Expand Down Expand Up @@ -470,6 +473,12 @@ vmCvar_t cg_customCrosshairYGap;

vmCvar_t cg_drawCI;

//unlagged - client options
vmCvar_t cg_delag;
vmCvar_t sv_fps;
vmCvar_t cg_optimizePrediction;
//unlagged - client options

typedef struct {
vmCvar_t *vmCvar;
char *cvarName;
Expand Down Expand Up @@ -589,7 +598,10 @@ cvarTable_t cvarTable[] = {
{ &cg_timescaleFadeEnd, "cg_timescaleFadeEnd", "1", 0},
{ &cg_timescaleFadeSpeed, "cg_timescaleFadeSpeed", "0", 0},
{ &cg_timescale, "timescale", "1", 0},
//unlagged - smooth clients #2
// this is done server-side now
// { &cg_smoothClients, "cg_smoothClients", "0", CVAR_USERINFO | CVAR_ARCHIVE},
//unlagged - smooth clients #2
{ &cg_cameraMode, "com_cameraMode", "0", CVAR_CHEAT},

{ &pmove_fixed, "pmove_fixed", "0", 0},
Expand Down Expand Up @@ -837,7 +849,14 @@ cvarTable_t cvarTable[] = {
{ &cg_customCrosshairXGap, "cg_customCrosshairXGap", "0", CVAR_ARCHIVE },
{ &cg_customCrosshairYGap, "cg_customCrosshairYGap", "0", CVAR_ARCHIVE },

{ &cg_drawCI, "cg_drawCI", "1", CVAR_ARCHIVE }
{ &cg_drawCI, "cg_drawCI", "1", CVAR_ARCHIVE },

//unlagged - client options
{ &cg_delag, "cg_delag", "1", CVAR_ARCHIVE | CVAR_USERINFO },
// this will be automagically copied from the server
{ &sv_fps, "sv_fps", "20", 0 },
{ &cg_optimizePrediction, "cg_optimizePrediction", "1", CVAR_ARCHIVE },
//unlagged - client options

};
int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
Expand Down Expand Up @@ -910,6 +929,7 @@ void CG_UpdateCvars( void ) {
qboolean fSetFlags = qfalse; // OSPx - Auto Actions

for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) {

trap_Cvar_Update( cv->vmCvar );

// RTCWPro - update the modification count and perform actions on special cvars
Expand Down
Loading