

Shadow era draw engines update#
In BuildĪ player has to be tracked after each position update via updatesector(int newX, int newY, int* lastKnownSectorID). No BSP means it is not possible to take a point p(x,y) and navigate tree nodes until we reach a leaf sector. Nowaday SDL alleviates this burden with a simple video mode flag SDL_DOUBLEBUF but the method name remain as an artefact of the past. Michael Abrash's Black Book of Graphic Programming: Bones and sinew. You can read a lot about that in the Chapters 23 of Swapping buffer was about setting the CRT to use the "next page" by changing the base address. Back in the 90's, the joy of VGA/VESA programming meantĭoing double buffering manually: Two portions of the video RAM were reserved and alternatively used.Įach portion was called a "page" One portion was used by the VGA CRT Module while the other was updated by the engine. Trivia : Why is the swapping buffer method called nextpage(). Trivia : If you study the code, here is the fully unrolled loop that I used as a map. While ((spritesortcnt > 0) & (maskwallcnt > 0))
Shadow era draw engines windows#
Render partially transparent walls such as grid, windows and visible sprites (players, items). Stop rendition and run the game module so it can update ONLY the visible sprites. DRAW a bunch of wall identified by bunchID (closest) Find closest bunch via a (o) n*n method for(i=1 i>numbunches i++) This is a (O)n*n operation since the algorith seach for the closest bunch each time. At this point, numbunches is set and bunches have been generated. Determine which sprites are visible and store a reference in tsprite, spritesortcnt++

Visit all connected sectors and populate a BUNCH array. Visit sectors and portal: Build a list of "bunch". Reset umost and dmost array (occlusion tracker arrays). Clear "gotsector" variable, the "visited sectors" bit array.Ĭlearbufbyte(&gotsector,( long)((numsectors+7)>3),0L) Also populate a list of visible sprites (but DO NOT RENDER THEM).

Render solid walls, ceilings and floors.

Updatesector( int x, int y, int* lastKnownSectorID) Each time an entity is moved, its current sector has to be updated.
