Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up unused code and parameters in radar drawing code.

  • Loading branch information...
commit 7a3338ce397620b517e25bb3add60e69536cd974 1 parent 20317c2
Per Inge Mathisen perim authored
7 lib/ivis_opengl/pieclip.h
@@ -34,13 +34,6 @@
34 34 #include "lib/framework/frame.h"
35 35 #include "piedef.h"
36 36
37   -struct CLIP_VERTEX
38   -{
39   - Vector3i pos;
40   - unsigned int u, v;
41   - PIELIGHT light;
42   -};
43   -
44 37 /***************************************************************************/
45 38 /*
46 39 * Global ProtoTypes
37 lib/ivis_opengl/piefunc.cpp
@@ -37,42 +37,33 @@
37 37 static GFX *skyboxGfx = NULL;
38 38
39 39 #define VW_VERTICES 5
40   -void pie_DrawViewingWindow(Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, PIELIGHT colour)
  40 +void pie_DrawViewingWindow(Vector3i *v, PIELIGHT colour)
41 41 {
42   - CLIP_VERTEX pieVrts[VW_VERTICES];
  42 + Vector3i pieVrts[VW_VERTICES];
43 43 SDWORD i;
44 44
45 45 pie_SetTexturePage(TEXPAGE_NONE);
46 46 pie_SetRendMode(REND_ALPHA);
47 47
48   - pieVrts[0].pos.x = v[1].x;
49   - pieVrts[0].pos.y = v[1].y;
50   - //cull triangles with off screen points
51   - pieVrts[0].pos.z = INTERFACE_DEPTH;
  48 + pieVrts[0] = v[1];
  49 + pieVrts[0].z = INTERFACE_DEPTH; // cull triangles with off screen points
52 50
53   - pieVrts[0].u = 0;
54   - pieVrts[0].v = 0;
55   - pieVrts[0].light = colour;
  51 + pieVrts[1] = v[0];
  52 + pieVrts[1].z = INTERFACE_DEPTH;
56 53
57   - pieVrts[1] = pieVrts[0];
58   - pieVrts[2] = pieVrts[0];
59   - pieVrts[3] = pieVrts[0];
60   - pieVrts[4] = pieVrts[0];
61   -
62   - pieVrts[1].pos.x = v[0].x;
63   - pieVrts[1].pos.y = v[0].y;
  54 + pieVrts[2] = v[2];
  55 + pieVrts[2].z = INTERFACE_DEPTH;
64 56
65   - pieVrts[2].pos.x = v[2].x;
66   - pieVrts[2].pos.y = v[2].y;
  57 + pieVrts[3] = v[3];
  58 + pieVrts[3].z = INTERFACE_DEPTH;
67 59
68   - pieVrts[3].pos.x = v[3].x;
69   - pieVrts[3].pos.y = v[3].y;
  60 + pieVrts[4] = pieVrts[0];
70 61
71 62 glColor4ub(colour.byte.r, colour.byte.g, colour.byte.b, colour.byte.a >> 1);
72 63 glBegin(GL_TRIANGLE_FAN);
73 64 for (i = 0; i < VW_VERTICES; i++)
74 65 {
75   - glVertex2f(pieVrts[i].pos.x, pieVrts[i].pos.y);
  66 + glVertex2f(pieVrts[i].x, pieVrts[i].y);
76 67 }
77 68 glEnd();
78 69
@@ -80,9 +71,9 @@ void pie_DrawViewingWindow(Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD
80 71 glBegin(GL_LINE_STRIP);
81 72 for (i = 0; i < VW_VERTICES; i++)
82 73 {
83   - glVertex2f(pieVrts[i].pos.x, pieVrts[i].pos.y);
  74 + glVertex2f(pieVrts[i].x, pieVrts[i].y);
84 75 }
85   - glVertex2f(pieVrts[0].pos.x, pieVrts[0].pos.y);
  76 + glVertex2f(pieVrts[0].x, pieVrts[0].y);
86 77 glEnd();
87 78 }
88 79
2  lib/ivis_opengl/piefunc.h
@@ -35,7 +35,7 @@
35 35
36 36 extern UBYTE pie_ByteScale(UBYTE a, UBYTE b) WZ_DECL_CONST;
37 37 extern void pie_TransColouredTriangle(Vector3f *vrt, PIELIGHT c);
38   -extern void pie_DrawViewingWindow( Vector3i *v, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, PIELIGHT colour);
  38 +extern void pie_DrawViewingWindow(Vector3i *v, PIELIGHT colour);
39 39
40 40 void pie_DrawSkybox(float scale);
41 41 void pie_Skybox_Init();
19 src/radar.cpp
@@ -107,7 +107,7 @@ static int frameSkip = 0;
107 107
108 108 static void DrawRadarTiles(void);
109 109 static void DrawRadarObjects(void);
110   -static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV);
  110 +static void DrawRadarExtras(float pixSizeH, float pixSizeV);
111 111 static void DrawNorth(void);
112 112
113 113 static void radarSize(int ZoomLevel)
@@ -285,7 +285,7 @@ void drawRadar(void)
285 285 pie_RenderRadar();
286 286 pie_MatBegin();
287 287 pie_TRANSLATE(-radarWidth/2 - 1, -radarHeight/2 - 1, 0);
288   - DrawRadarExtras(0, 0, pixSizeH, pixSizeV);
  288 + DrawRadarExtras(pixSizeH, pixSizeV);
289 289 pie_MatEnd();
290 290 drawRadarBlips(-radarWidth/2.0 - 1, -radarHeight/2.0 - 1, pixSizeH, pixSizeV);
291 291 pie_MatEnd();
@@ -576,7 +576,7 @@ static SDWORD getLengthAdjust( void )
576 576 }
577 577
578 578 /** Draws a Myth/FF7 style viewing window */
579   -static void drawViewingWindow(float radarX, float radarY, int x, int y, float pixSizeH, float pixSizeV)
  579 +static void drawViewingWindow(int x, int y, float pixSizeH, float pixSizeV)
580 580 {
581 581 Vector3i v[4], tv[4], centre;
582 582 int shortX, longX, yDrop, yDropVar;
@@ -601,8 +601,8 @@ static void drawViewingWindow(float radarX, float radarY, int x, int y, float pi
601 601 v[3].x = -shortX;
602 602 v[3].y = yDrop;
603 603
604   - centre.x = radarX + x - scrollMinX*pixSizeH;
605   - centre.y = radarY + y - scrollMinY*pixSizeV;
  604 + centre.x = x - scrollMinX * pixSizeH;
  605 + centre.y = y - scrollMinY * pixSizeV;
606 606
607 607 RotateVector2D(v,tv,&centre,player.r.y,4);
608 608
@@ -627,20 +627,19 @@ static void drawViewingWindow(float radarX, float radarY, int x, int y, float pi
627 627 colour.rgba = 0;
628 628 colour.byte.a = 0x3f;
629 629 break;
630   -
631 630 }
632 631
633 632 /* Send the four points to the draw routine and the clip box params */
634   - pie_DrawViewingWindow(tv, radarX, radarY, radarX + radarWidth, radarY + radarHeight, colour);
  633 + pie_DrawViewingWindow(tv, colour);
635 634 }
636 635
637   -static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV)
  636 +static void DrawRadarExtras(float pixSizeH, float pixSizeV)
638 637 {
639 638 int viewX = player.p.x*pixSizeH / TILE_UNITS;
640 639 int viewY = player.p.z*pixSizeV / TILE_UNITS;
641 640
642   - drawViewingWindow(radarX, radarY, viewX, viewY, pixSizeH, pixSizeV);
643   - RenderWindowFrame(FRAME_RADAR, radarX - 1, radarY - 1, radarWidth + 2, radarHeight + 2);
  641 + drawViewingWindow(viewX, viewY, pixSizeH, pixSizeV);
  642 + RenderWindowFrame(FRAME_RADAR, -1, -1, radarWidth + 2, radarHeight + 2);
644 643 }
645 644
646 645 /** 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.