Commit: c95f0f8be3a967dca7ef65f557fbc5db1419dc72
Author: Giel van Schijndel <giel@...>
Date: Tue Oct 5 20:14:55 2010 +0200
Replace [xy]pshift with the single constant it ever contains
The variables [xy]pshift only ever contain the constant value `10`, so
instead of bothering to keep the variables around use the
STRETCHED_Z_SHIFT constant. This constant serves the same purpose as
[xy]pshift (only for the Z coordinate) and is defined to `10` as well.
Signed-off-by: Giel van Schijndel <giel@...>
lib/ivis_common/ivisdef.h | 2 --
lib/ivis_common/rendmode.h | 2 +-
lib/ivis_opengl/piematrix.c | 10 ++++------
lib/ivis_opengl/piemode.c | 2 --
lib/ivis_opengl/rendmode.c | 4 +---
src/intdisplay.c | 8 ++++----
6 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/lib/ivis_common/ivisdef.h b/lib/ivis_common/ivisdef.h
index 19c57f7..bd47ae6 100644
--- a/lib/ivis_common/ivisdef.h
+++ b/lib/ivis_common/ivisdef.h
@@ -43,8 +43,6 @@ typedef struct _iSurface {
int32_t flags;
int xcentre;
int ycentre;
- int xpshift;
- int ypshift;
iClip clip;
UBYTE *buffer;
diff --git a/lib/ivis_common/rendmode.h b/lib/ivis_common/rendmode.h
index 3c7149b..e6d7123 100644
--- a/lib/ivis_common/rendmode.h
+++ b/lib/ivis_common/rendmode.h
@@ -55,6 +55,6 @@ extern iSurface *psRendSurface;
extern void iV_RenderAssign(iSurface *s);
extern void iV_SurfaceDestroy(iSurface *s);
-extern iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, int xp, int yp, uint8_t *buffer);
+extern iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, uint8_t *buffer);
#endif
diff --git a/lib/ivis_opengl/piematrix.c b/lib/ivis_opengl/piematrix.c
index 3b5f0fb..3876d05 100644
--- a/lib/ivis_opengl/piematrix.c
+++ b/lib/ivis_opengl/piematrix.c
@@ -250,19 +250,17 @@ int32_t pie_RotateProject(const Vector3i *v3d, Vector2i *v2d)
v3d->x * psMatrix->c + v3d->y * psMatrix->f + v3d->z * psMatrix->i + psMatrix->l
};
- int zz = v.z >> STRETCHED_Z_SHIFT;
- int zfx = v.z >> psRendSurface->xpshift;
- int zfy = v.z >> psRendSurface->ypshift;
+ const int zz = v.z >> STRETCHED_Z_SHIFT;
- if (zfx <= 0 || zfy <= 0 || zz < MIN_STRETCHED_Z)
+ if (zz < MIN_STRETCHED_Z)
{
v2d->x = LONG_WAY; //just along way off screen
v2d->y = LONG_WAY;
}
else
{
- v2d->x = psRendSurface->xcentre + (v.x / zfx);
- v2d->y = psRendSurface->ycentre - (v.y / zfy);
+ v2d->x = psRendSurface->xcentre + (v.x / zz);
+ v2d->y = psRendSurface->ycentre - (v.y / zz);
}
return zz;
diff --git a/lib/ivis_opengl/piemode.c b/lib/ivis_opengl/piemode.c
index 6849391..66568f3 100644
--- a/lib/ivis_opengl/piemode.c
+++ b/lib/ivis_opengl/piemode.c
@@ -81,8 +81,6 @@ BOOL pie_Initialise(void)
rendSurface.clip.top = 0;
rendSurface.clip.right = pie_GetVideoBufferWidth();
rendSurface.clip.bottom = pie_GetVideoBufferHeight();
- rendSurface.xpshift = 10;
- rendSurface.ypshift = 10;
pie_SetDefaultStates();
iV_RenderAssign(&rendSurface);
diff --git a/lib/ivis_opengl/rendmode.c b/lib/ivis_opengl/rendmode.c
index 856fa04..aece911 100644
--- a/lib/ivis_opengl/rendmode.c
+++ b/lib/ivis_opengl/rendmode.c
@@ -35,7 +35,7 @@ iSurface *psRendSurface;
//*
//******
-iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, int xp, int yp, UBYTE *buffer)
+iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, UBYTE *buffer)
{
iSurface *s = malloc(sizeof(iSurface));
@@ -50,8 +50,6 @@ iSurface *iV_SurfaceCreate(uint32_t flags, int width, int height, int xp, int yp
s->flags = flags;
s->xcentre = width>>1;
s->ycentre = height>>1;
- s->xpshift = xp;
- s->ypshift = yp;
s->width = width;
s->height = height;
s->size = width * height;
diff --git a/src/intdisplay.c b/src/intdisplay.c
index 27bfe4d..e3ed8f6 100644
--- a/src/intdisplay.c
+++ b/src/intdisplay.c
@@ -1858,7 +1858,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_OBJECTSURFACES; i++) {
ObjectSurfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( ObjectSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Object surface" );
- ObjectSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,ObjectSurfaces[i].Buffer);
+ ObjectSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,ObjectSurfaces[i].Buffer);
ASSERT( ObjectSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Object surface" );
}
@@ -1870,7 +1870,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_SYSTEM0SURFACES; i++) {
System0Surfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( System0Surfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate System0 surface" );
- System0Surfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,System0Surfaces[i].Buffer);
+ System0Surfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,System0Surfaces[i].Buffer);
ASSERT( System0Surfaces[i].Surface!=NULL,"intInitialise : Failed to create System0 surface" );
}
@@ -1882,7 +1882,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_TOPICSURFACES; i++) {
TopicSurfaces[i].Buffer = (UBYTE*)malloc(WidthTopic*HeightTopic);
ASSERT( TopicSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Topic surface" );
- TopicSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,WidthTopic,HeightTopic,10,10,TopicSurfaces[i].Buffer);
+ TopicSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,WidthTopic,HeightTopic,TopicSurfaces[i].Buffer);
ASSERT( TopicSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Topic surface" );
}
@@ -1894,7 +1894,7 @@ void InitialiseButtonData(void)
for(i=0; i<NUM_STATSURFACES; i++) {
StatSurfaces[i].Buffer = (UBYTE*)malloc(Width*Height);
ASSERT( StatSurfaces[i].Buffer!=NULL,"intInitialise : Failed to allocate Stats surface" );
- StatSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,StatSurfaces[i].Buffer);
+ StatSurfaces[i].Surface = iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,StatSurfaces[i].Buffer);
ASSERT( StatSurfaces[i].Surface!=NULL,"intInitialise : Failed to create Stat surface" );
}
-------------------------
|