Skip to content

Commit

Permalink
Fixed ticcmd handling, removed non-smooth camera
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 6, 2004
1 parent f328e36 commit 0f82ebd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 40 deletions.
1 change: 0 additions & 1 deletion doomsday/Include/r_main.h
Expand Up @@ -31,7 +31,6 @@ extern ddplayer_t *viewplayer;
extern angle_t clipangle;
extern fixed_t finetangent[FINEANGLES / 2];

extern int rend_camera_smooth;
extern float frameTimePos; // 0...1: fractional part for sharp game tics
extern boolean resyncFrameTimePos;
extern int loadInStartupMode;
Expand Down
8 changes: 7 additions & 1 deletion doomsday/Src/dd_loop.c
Expand Up @@ -257,7 +257,7 @@ void DD_Ticker(timespan_t time)
else
Sv_Ticker( /* time */ );

// This is needed by rend_camera_smooth. It needs to know
// This is needed by camera smoothing. It needs to know
// when the world tic has occured so the next sharp
// position can be processed.

Expand Down Expand Up @@ -375,4 +375,10 @@ void DD_RunTics(void)
// Various global variables are used for counting time.
DD_AdvanceTime(ticLength);
}

// Clients send commands periodically, not on every frame.
if(!isClient)
{
Net_SendCommands();
}
}
29 changes: 7 additions & 22 deletions doomsday/Src/net_main.c
Expand Up @@ -372,10 +372,7 @@ void Net_SendCommands(void)
// Therefore they need to send a combination of all the cmds built
// during the wait period.

if(isClient)
cmd = clients[consoleplayer].aggregateCmd;
else
cmd = clients[consoleplayer].lastCmd;
cmd = clients[consoleplayer].aggregateCmd;

// The game will pack the commands into a buffer. The returned
// pointer points to a buffer that contains its size and the
Expand All @@ -388,12 +385,9 @@ void Net_SendCommands(void)
// Send the packet to the server, i.e. player zero.
Net_SendBuffer(0, isClient ? 0 : SPF_REBOUND);

if(isClient)
{
// Clients will begin composing a new aggregate now that this
// one has been sent.
memset(cmd, 0, TICCMD_SIZE);
}
// Clients will begin composing a new aggregate now that this
// one has been sent.
memset(cmd, 0, TICCMD_SIZE);
}

/*
Expand Down Expand Up @@ -523,18 +517,9 @@ void Net_BuildLocalCommands(timespan_t time)
gx.BuildTicCmd(cmd, time);
}

if(!isClient)
{
// Clients don't send commands too often (will be called from
// Cl_Ticker).
Net_SendCommands();
}
else
{
// Be sure to merge each built command into the aggregate that
// will be sent periodically to the server.
gx.MergeTicCmd(clients[consoleplayer].aggregateCmd, cmd);
}
// Be sure to merge each built command into the aggregate that
// will be sent periodically to the server.
gx.MergeTicCmd(clients[consoleplayer].aggregateCmd, cmd);
}

//===========================================================================
Expand Down
28 changes: 12 additions & 16 deletions doomsday/Src/r_main.c
Expand Up @@ -53,7 +53,6 @@ int viewangleoffset = 0;
int validcount = 1; // increment every time a check is made
int framecount; // just for profiling purposes
int rend_info_tris = 0;
int rend_camera_smooth = true; // smoothed by default
fixed_t viewx, viewy, viewz;
float viewfrontvec[3], viewupvec[3], viewsidevec[3];
fixed_t viewxOffset = 0, viewyOffset = 0, viewzOffset = 0;
Expand All @@ -77,6 +76,8 @@ int loadInStartupMode = true;

// PRIVATE DATA DEFINITIONS ------------------------------------------------

static int rend_camera_smooth = true; // smoothed by default

// These are used when camera smoothing is disabled.
static angle_t frozenAngle = 0;
static float frozenPitch = 0;
Expand Down Expand Up @@ -104,8 +105,8 @@ void R_Register(void)
C_VAR_BYTE("rend-info-frametime", &showFrameTimePos, 0, 0, 1,
"1=Print frame time offsets.");

C_VAR_INT("rend-camera-smooth", &rend_camera_smooth, 0, 0, 1,
"1=Filter camera movement between game tics.");
C_VAR_INT("rend-camera-smooth", &rend_camera_smooth, CVF_HIDE, 0, 1,
"1=Filter camera movement between game tics (OBSOLETE).");

C_VAR_INT("bsp-build", &bspBuild, 0, 0, 1,
"1=Build GL nodes when loading a map.");
Expand Down Expand Up @@ -225,7 +226,7 @@ void R_Shutdown(void)
//===========================================================================
void R_ResetViewer(void)
{
resetNextViewer = true;
resetNextViewer = 1;
}

//===========================================================================
Expand Down Expand Up @@ -307,6 +308,9 @@ void R_NewSharpWorld(void)

if(!viewplayer) return;

if(resetNextViewer)
resetNextViewer = 2;

R_GetSharpView(&sharpView, viewplayer);

// Update the camera angles that will be used when the camera is
Expand Down Expand Up @@ -369,21 +373,13 @@ void R_SetupFrame(ddplayer_t *player)
viewplayer = player;
R_GetSharpView(&sharpView, viewplayer);

// Camera smoothing is only enabled if the frame rate is above 35.
if(!rend_camera_smooth || resetNextViewer)
if(resetNextViewer)
{
// Synchronize view angles to game updates.
if(resetNextViewer)
{
frozenAngle = sharpView.angle;
frozenPitch = sharpView.pitch;
}

resetNextViewer = false;
// Keep reseting until a new sharp world has arrived.
if(resetNextViewer > 1)
resetNextViewer = 0;

// Just view from the sharp position.
sharpView.angle = frozenAngle;
sharpView.pitch = frozenPitch;
R_SetViewPos(&sharpView);

memcpy(&lastSharpView[0], &sharpView, sizeof(sharpView));
Expand Down

0 comments on commit 0f82ebd

Please sign in to comment.