Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

WinQuake: SCR_UpdateScreen Walkthrough

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Tue Jul 13, 2010 3:56 am Post subject: WinQuake: SCR_UpdateScreen Walkthrough |

SCR_UpdateScreen - screen.c [r_screen.c] 1. Check to see if viewsize changed 2. Check to see if FOV changed 3. Check to see if lcd_x changed 4. If (any of those changed) SCR_CalcRefdef () ;
/////
4a. Set full screen update
4b. Sbar_Changed () ;
4c. Determine if we draw sbar based on intermission, viewsize
4d. R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
4e. R_ViewChanged (&vrect, sb_lines, vid.aspect) ;
////////
5. D_EnableBackBufferAccess () ; (All this does is VID_LockBuffer () ; )
6. Draw_TileClear if necessary.
7. SCR_SetUpToDrawConsole () ;
8. SCR_EraseCenterString () ;
9. D_DisableBackBufferAccess () ; (All this does is VID_UnlockBuffer () ; )
10. VID_LockBuffer () ;
11. V_RenderView () ;
12. VID_UnlockBuffer () ;
13. D_EnableBackBufferAccess () ; (All this does is VID_LockBuffer () ; )
14. Draw 2D stuff: crosshair, sbar, center string, console, menu, intermission, etc.
15. D_DisableBackBufferAccess () ; (All this does is VID_UnlockBuffer () ; )
16. V_UpdatePalette () ; // Update the palette View blends applied to palette here
16a. V_CalcPowerupCshift () ;
Looking at V_RenderView
V_RenderView is the point where drawing the world is entered.
If the console is forced up, we exit. It is a bit annoying how there are 10 different ways to detect a "disconnect" state and Quake appears to use different methods in different places in the code. Why not just if (cls.state != ca_connected). Oh well ...
Anyhow ...
1. if (cl.intermission) V_CalcIntermissionRefdef () ; // Do camera sway from intermission point
2. if (!cl.paused) V_CalcRefdef () ; // If not paused
/// V_CalcRefdef - modifications to view x,y,z pitch, yaw, roll
2a. Calc pitches, rolls (you know ... strafing stuff and so on ...)
2b. Calc gun angle
2c. Calc bobs
2d. Weapon position with or without the gun position hacking
2e. Gun Kick
2f. Stair steps smoothing
/// End V_CalcRefdef
3. R_PushDlights
4. R_RenderView () ; --> R_RenderView_
/// R_RenderView_
R_SetupFrame () ;
-- R_CheckVariables () ; "if (r_fullbright.value != oldbright) D_FlushCaches () ;"
-- R_AnimateLight () ;
-- if (r_waterwarp) do water warp stuff;
-- R_TransformFrustum () ;
-- R_SetSkyFrame () ;
-- R_SetUpFrustumIndexes () ;
-- D_SetupFrame () ;
R_MarkLeaves () ;
Sys_LowFPPrecision () ; // ASM - floating point precision to low
VID_UnlockBuffer () ;
S_ExtraUpdate () ;
VID_LockBuffer () ;
R_EdgeDrawing () ;
--- R_BeginEdgeFrame () ;
--- R_RenderWorld () ;
--- if (r_drawculledpolys) R_ScanEdges () ;
--- R_DrawBEntitiesOnList () ; // map brush models
--- VID_UnlockBuffer () ;
--- S_ExtraUpdate () ;
--- VID_LockBuffer () ;
VID_UnlockBuffer () ;
S_ExtraUpdate () ;
VID_LockBuffer () ;
R_DrawEntitiesOnList () ;
--- do each entity
--- case mod_sprite: R_DrawSprite () ;
--- case mod_alias: R_AliasDrawModel (&lighting) ;
R_DrawViewModel () ;
R_DrawParticles () ;
if (r_dowarp) D_WarpScreen () ;
V_SetContentsColor (r_viewleaf->contents) ; Calculates the view blends, doesn't apply them here
if (r_timegraph.value) R_TimeGraph () ;
if (r_aliasstats.value) R_PrintAliasStats () ;
if (r_speeds.value) R_PrintTimes () ;
Sys_HighFPPrecision () ; // ASM - floating point precision to high
Now ....
Start WinQuake, goto start map and type "impulse -1". Then type disconnect. You keep the blue quad blend.
Why? The part that calculates the view blend is only done if the world is being rendered. But it is applied even when the world isn't being rendered. Annoying ...
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Tue Jul 13, 2010 9:00 am Post subject: |

Actually, playing around. It appears the problem is that when you disconnect it doesn't clear the player items and thinks you still have the quad or the enviro suit even after disconnect. The solution is replacing "V_CalcPowerupCshift ();" with this block of code at the top of V_UpdatePalette (the #ifndef GLQUAKE one obviously)

Code:
if (cls.state != ca_connected) { cl.cshifts[CSHIFT_CONTENTS] = cshift_empty; cl.cshifts[CSHIFT_POWERUP].percent = 0; }
else
{
V_CalcPowerupCshift ();
}

_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Engine Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group