diff options
| -rw-r--r-- | sword2/driver/render.cpp | 123 | ||||
| -rw-r--r-- | sword2/driver/render.h | 37 | 
2 files changed, 37 insertions, 123 deletions
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index 4874d92aa3..9933914adf 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -108,11 +108,6 @@  //  //============================================================================= - - - -//#include "ddraw.h" -  #include "stdafx.h"  #include "driver96.h"  #include "d_draw.h" @@ -122,46 +117,29 @@  #include "menu.h"  #include "../sword2.h" - -  #define MILLISECSPERCYCLE 83 - - -#if PROFILING == 1 -int32 profileCopyScreenBuffer = 0; -int32 profileRenderLayers = 0; -int32 profileSpriteRender = 0; -int32 profileDecompression = 0; -#endif - - - -  // Scroll variables.  scrollx and scrolly hold the current scroll position,  -//	and scrollxTarget and scrollyTarget are the target position for the end -//	of the game cycle. - -//int16		scrollx; -//int16		scrolly; -extern int16		scrollx; -extern int16		scrolly; -int16			parallaxScrollx; -int16			parallaxScrolly; -int16	locationWide; -int16	locationDeep; - -static	int16	scrollxTarget; -static	int16	scrollyTarget; -static	int16	scrollxOld; -static	int16	scrollyOld; -static	uint16	layer = 0; - - +// and scrollxTarget and scrollyTarget are the target position for the end +// of the game cycle. + +extern int16 scrollx; +extern int16 scrolly; +int16 parallaxScrollx; +int16 parallaxScrolly; +int16 locationWide; +int16 locationDeep; + +static int16 scrollxTarget; +static int16 scrollyTarget; +static int16 scrollxOld; +static int16 scrollyOld; +static uint16 layer = 0;  #define RENDERAVERAGETOTAL 4 +  int32 renderCountIndex = 0; -int32 renderTimeLog[RENDERAVERAGETOTAL] = {60, 60, 60, 60}; +int32 renderTimeLog[RENDERAVERAGETOTAL] = { 60, 60, 60, 60 };  int32 initialTime;  int32 startTime;  int32 totalTime; @@ -169,9 +147,6 @@ int32 renderAverageTime = 60;  int32 framesPerGameCycle;  int32 renderTooSlow; - - -  #define BLOCKWIDTH 64  #define BLOCKHEIGHT 64  #define BLOCKWBITS 6 @@ -512,14 +487,7 @@ int32 RestoreBackgroundLayer(_parallax *p, int16 l)  	return RD_OK;  } - - - - - -int32 PlotPoint(uint16 x, uint16 y, uint8 colour) - -{ +int32 PlotPoint(uint16 x, uint16 y, uint8 colour) {  	warning("stub PlotPoint( %d, %d, %d )", x, y, colour);  /*  	int16 newx, newy; @@ -557,11 +525,8 @@ int32 PlotPoint(uint16 x, uint16 y, uint8 colour)  } -  // Uses Bressnham's incremental algorithm! -int32 DrawLine(int16 x0, int16 y0, int16 x1, int16 y1, uint8 colour) - -{ +int32 DrawLine(int16 x0, int16 y0, int16 x1, int16 y1, uint8 colour) {  	warning("stub DrawLine( %d, %d, %d, %d, %d )", x0, y0, x1, y1, colour);  /*  	int dx, dy; @@ -792,21 +757,14 @@ int32 DrawLine(int16 x0, int16 y0, int16 x1, int16 y1, uint8 colour)  		IDirectDrawSurface2_Unlock(lpBackBuffer, ddsd.lpSurface);  	}  */ -	return(RD_OK); - +	return RD_OK;  } - - -int32 SetLocationMetrics(uint16 w, uint16 h) - -{ - +int32 SetLocationMetrics(uint16 w, uint16 h) {  	locationWide = w;  	locationDeep = h; -	return(RD_OK); - +	return RD_OK;  }  int32 RenderParallax(_parallax *p, int16 l) { @@ -851,42 +809,6 @@ int32 RenderParallax(_parallax *p, int16 l) {  	return RD_OK;  } - -/* -#define LOGSIZE 10 -int32 previousTimeLog[LOGSIZE]; -int32 renderCycleStartLog[LOGSIZE]; -int32 lastRenderTimeLog[LOGSIZE]; -int32 renderCycleEndLog[LOGSIZE]; -int32 timeLeftLog[LOGSIZE]; -int32 scrollxOldLog[LOGSIZE]; -int32 scrollxLog[LOGSIZE]; -int32 scrollxTargetLog[LOGSIZE]; - - -void LogMe(int32 in) -{ -	static int32 i; - -	if (in == 0) -		i = 0; - -	previousTimeLog[i] = previousTime; -	aveRenderCycleLog[i] = aveRenderCycle; -	renderCycleStartLog[i] = renderCycleStart; -	lastRenderTimeLog[i] = lastRenderTime; -	renderCycleEndLog[i] = renderCycleEnd; -	timeLeftLog[i] = timeLeft; -	scrollxOldLog[i] = scrollxOld; -	scrollxLog[i] = scrollx; -	scrollxTargetLog[i] = scrollxTarget; -	 -	if (++i == LOGSIZE) -		i = 0; - -} -*/ -  // Uncomment this when benchmarking the drawing routines.  #define LIMIT_FRAME_RATE @@ -981,6 +903,7 @@ int32 EndRenderCycle(bool *end) {  int32 SetScrollTarget(int16 sx, int16 sy) {  	scrollxTarget = sx;  	scrollyTarget = sy; +  	return RD_OK;  } diff --git a/sword2/driver/render.h b/sword2/driver/render.h index 98d6b4fafe..5a0112159d 100644 --- a/sword2/driver/render.h +++ b/sword2/driver/render.h @@ -30,36 +30,28 @@  //  //============================================================================= -  #ifndef RENDER_H  #define RENDER_H  #include "menu.h" -#define RENDERWIDE 640 -#define ALIGNRENDERDEEP 480 -#define RENDERDEEP (ALIGNRENDERDEEP - (MENUDEEP * 2)) - - -#define PROFILING 0 - +#define RENDERWIDE		640 +#define ALIGNRENDERDEEP		480 +#define RENDERDEEP		(ALIGNRENDERDEEP - (MENUDEEP * 2)) -typedef struct -{ -	uint16	packets; -	uint16	offset; +typedef struct { +	uint16 packets; +	uint16 offset;  } _parallaxLine; - - -extern int16					scrollx;			// current x offset into background of display -extern int16					scrolly;			// current y offset into background of display -extern int16					parallaxScrollx;	// current x offset to link a sprite to the parallax layer -extern int16					parallaxScrolly;	// current y offset to link a sprite to the parallax layer -extern int16					locationWide; -extern int16					locationDeep; - -// extern uint8 myScreenBuffer[RENDERWIDE * RENDERDEEP]; +extern int16 scrollx;		// current x offset into background of display +extern int16 scrolly;		// current y offset into background of display +extern int16 parallaxScrollx;	// current x offset to link a sprite to the +				// parallax layer +extern int16 parallaxScrolly;	// current y offset to link a sprite to the +				// parallax layer +extern int16 locationWide; +extern int16 locationDeep;  void SquashImage(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight, byte *backbuf);  void StretchImage(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight, byte *backbuf); @@ -67,4 +59,3 @@ void StretchImage(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight,  void UploadRect(ScummVM::Rect *r);  #endif -  | 
