Skip to content
Browse files

Clean up unused code and parameters in radar drawing code.

  • Loading branch information...
1 parent 20317c2 commit 7a3338ce397620b517e25bb3add60e69536cd974 @perim perim committed Feb 17, 2013
Showing with 24 additions and 41 deletions.
  1. +0 −7 lib/ivis_opengl/pieclip.h
  2. +14 −23 lib/ivis_opengl/piefunc.cpp
  3. +1 −1 lib/ivis_opengl/piefunc.h
  4. +9 −10 src/radar.cpp
View
7 lib/ivis_opengl/pieclip.h
@@ -34,13 +34,6 @@
#include "lib/framework/frame.h"
#include "piedef.h"
-struct CLIP_VERTEX
-{
- Vector3i pos;
- unsigned int u, v;
- PIELIGHT light;
-};
-
/***************************************************************************/
/*
* Global ProtoTypes
View
37 lib/ivis_opengl/piefunc.cpp
@@ -37,52 +37,43 @@
static GFX *skyboxGfx = NULL;
#define VW_VERTICES 5
-void pie_DrawViewingWindow(Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, PIELIGHT colour)
+void pie_DrawViewingWindow(Vector3i *v, PIELIGHT colour)
{
- CLIP_VERTEX pieVrts[VW_VERTICES];
+ Vector3i pieVrts[VW_VERTICES];
SDWORD i;
pie_SetTexturePage(TEXPAGE_NONE);
pie_SetRendMode(REND_ALPHA);
- pieVrts[0].pos.x = v[1].x;
- pieVrts[0].pos.y = v[1].y;
- //cull triangles with off screen points
- pieVrts[0].pos.z = INTERFACE_DEPTH;
+ pieVrts[0] = v[1];
+ pieVrts[0].z = INTERFACE_DEPTH; // cull triangles with off screen points
- pieVrts[0].u = 0;
- pieVrts[0].v = 0;
- pieVrts[0].light = colour;
+ pieVrts[1] = v[0];
+ pieVrts[1].z = INTERFACE_DEPTH;
- pieVrts[1] = pieVrts[0];
- pieVrts[2] = pieVrts[0];
- pieVrts[3] = pieVrts[0];
- pieVrts[4] = pieVrts[0];
-
- pieVrts[1].pos.x = v[0].x;
- pieVrts[1].pos.y = v[0].y;
+ pieVrts[2] = v[2];
+ pieVrts[2].z = INTERFACE_DEPTH;
- pieVrts[2].pos.x = v[2].x;
- pieVrts[2].pos.y = v[2].y;
+ pieVrts[3] = v[3];
+ pieVrts[3].z = INTERFACE_DEPTH;
- pieVrts[3].pos.x = v[3].x;
- pieVrts[3].pos.y = v[3].y;
+ pieVrts[4] = pieVrts[0];
glColor4ub(colour.byte.r, colour.byte.g, colour.byte.b, colour.byte.a >> 1);
glBegin(GL_TRIANGLE_FAN);
for (i = 0; i < VW_VERTICES; i++)
{
- glVertex2f(pieVrts[i].pos.x, pieVrts[i].pos.y);
+ glVertex2f(pieVrts[i].x, pieVrts[i].y);
}
glEnd();
glColor4ub(colour.byte.r, colour.byte.g, colour.byte.b, colour.byte.a);
glBegin(GL_LINE_STRIP);
for (i = 0; i < VW_VERTICES; i++)
{
- glVertex2f(pieVrts[i].pos.x, pieVrts[i].pos.y);
+ glVertex2f(pieVrts[i].x, pieVrts[i].y);
}
- glVertex2f(pieVrts[0].pos.x, pieVrts[0].pos.y);
+ glVertex2f(pieVrts[0].x, pieVrts[0].y);
glEnd();
}
View
2 lib/ivis_opengl/piefunc.h
@@ -35,7 +35,7 @@
extern UBYTE pie_ByteScale(UBYTE a, UBYTE b) WZ_DECL_CONST;
extern void pie_TransColouredTriangle(Vector3f *vrt, PIELIGHT c);
-extern void pie_DrawViewingWindow( Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, PIELIGHT colour);
+extern void pie_DrawViewingWindow(Vector3i *v, PIELIGHT colour);
void pie_DrawSkybox(float scale);
void pie_Skybox_Init();
View
19 src/radar.cpp
@@ -107,7 +107,7 @@ static int frameSkip = 0;
static void DrawRadarTiles(void);
static void DrawRadarObjects(void);
-static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV);
+static void DrawRadarExtras(float pixSizeH, float pixSizeV);
static void DrawNorth(void);
static void radarSize(int ZoomLevel)
@@ -285,7 +285,7 @@ void drawRadar(void)
pie_RenderRadar();
pie_MatBegin();
pie_TRANSLATE(-radarWidth/2 - 1, -radarHeight/2 - 1, 0);
- DrawRadarExtras(0, 0, pixSizeH, pixSizeV);
+ DrawRadarExtras(pixSizeH, pixSizeV);
pie_MatEnd();
drawRadarBlips(-radarWidth/2.0 - 1, -radarHeight/2.0 - 1, pixSizeH, pixSizeV);
pie_MatEnd();
@@ -576,7 +576,7 @@ static SDWORD getLengthAdjust( void )
}
/** Draws a Myth/FF7 style viewing window */
-static void drawViewingWindow(float radarX, float radarY, int x, int y, float pixSizeH, float pixSizeV)
+static void drawViewingWindow(int x, int y, float pixSizeH, float pixSizeV)
{
Vector3i v[4], tv[4], centre;
int shortX, longX, yDrop, yDropVar;
@@ -601,8 +601,8 @@ static void drawViewingWindow(float radarX, float radarY, int x, int y, float pi
v[3].x = -shortX;
v[3].y = yDrop;
- centre.x = radarX + x - scrollMinX*pixSizeH;
- centre.y = radarY + y - scrollMinY*pixSizeV;
+ centre.x = x - scrollMinX * pixSizeH;
+ centre.y = y - scrollMinY * pixSizeV;
RotateVector2D(v,tv,&centre,player.r.y,4);
@@ -627,20 +627,19 @@ static void drawViewingWindow(float radarX, float radarY, int x, int y, float pi
colour.rgba = 0;
colour.byte.a = 0x3f;
break;
-
}
/* Send the four points to the draw routine and the clip box params */
- pie_DrawViewingWindow(tv, radarX, radarY, radarX + radarWidth, radarY + radarHeight, colour);
+ pie_DrawViewingWindow(tv, colour);
}
-static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV)
+static void DrawRadarExtras(float pixSizeH, float pixSizeV)
{
int viewX = player.p.x*pixSizeH / TILE_UNITS;
int viewY = player.p.z*pixSizeV / TILE_UNITS;
- drawViewingWindow(radarX, radarY, viewX, viewY, pixSizeH, pixSizeV);
- RenderWindowFrame(FRAME_RADAR, radarX - 1, radarY - 1, radarWidth + 2, radarHeight + 2);
+ drawViewingWindow(viewX, viewY, pixSizeH, pixSizeV);
+ RenderWindowFrame(FRAME_RADAR, -1, -1, radarWidth + 2, radarHeight + 2);
}
/** Does a screen coordinate lie within the radar area? */

0 comments on commit 7a3338c

Please sign in to comment.
Something went wrong with that request. Please try again.