summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_scanner.c103
1 files changed, 52 insertions, 51 deletions
diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c
index e8ba439c..75b7eefa 100644
--- a/src/cgame/cg_scanner.c
+++ b/src/cgame/cg_scanner.c
@@ -24,13 +24,49 @@
#include "cg_local.h"
+#define RANGE 1000.0f
+
+/*#define XPOS 140.0f
+#define YPOS 320.0f
+#define WIDTH 360.0f
+#define HEIGHT 80.0f*/
+#define XPOS 0.0f
+#define YPOS 0.0f
+#define WIDTH 640.0f
+#define HEIGHT 480.0f
+
+#define STALKWIDTH 2.0f
+#define BLIPX 16.0f
+#define BLIPY 8.0f
+
+static void CG_DrawBlips( vec3_t origin, vec4_t colour )
+{
+ vec3_t drawOrigin;
+ vec3_t up = { 0, 0, 1 };
+
+ RotatePointAroundVector( drawOrigin, up, origin, -cg.refdefViewAngles[ 1 ] - 90 );
+ drawOrigin[ 0 ] /= ( 2 * RANGE / WIDTH );
+ drawOrigin[ 1 ] /= ( 2 * RANGE / HEIGHT );
+ drawOrigin[ 2 ] /= ( 2 * RANGE / WIDTH );
+
+ trap_R_SetColor( colour );
+ CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ],
+ YPOS + ( HEIGHT / 2 ) + drawOrigin[ 1 ],
+ STALKWIDTH, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
+ CG_DrawPic( XPOS + ( WIDTH / 2 ) - ( BLIPX / 2 ) - drawOrigin[ 0 ],
+ YPOS + ( HEIGHT / 2 ) - ( BLIPY / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ],
+ BLIPX, BLIPY, cgs.media.scannerBlipShader );
+ trap_R_SetColor( NULL );
+}
+
+/*
+Global Scanner draw
+*/
void CG_Scanner( )
{
int i;
vec3_t origin;
vec3_t relOrigin;
- vec3_t drawOrigin;
- vec3_t up = { 0, 0, 1 };
vec4_t hIabove = { 0, 1, 0, 1 };
vec4_t hIbelow = { 0, 0.5, 0, 1 };
vec4_t aIabove = { 1, 0, 0, 1 };
@@ -38,80 +74,45 @@ void CG_Scanner( )
VectorCopy( cg.refdef.vieworg, origin );
+ //draw human items below scanner plane
for( i = 0; i < cgIP.numHumanItems; i++ )
{
VectorClear( relOrigin );
VectorSubtract( cgIP.humanItemPositions[ i ], origin, relOrigin );
- if( VectorLength( relOrigin ) < 1000 && ( relOrigin[ 2 ] < 0 ) )
- {
- RotatePointAroundVector( drawOrigin, up, relOrigin, -cg.refdefViewAngles[ 1 ]-90 );
- drawOrigin[ 0 ] /= ( 1000 / 180 );
- drawOrigin[ 1 ] /= ( 1000 / 40 );
- drawOrigin[ 2 ] /= ( 1000 / 180 );
-
- trap_R_SetColor( hIbelow );
- CG_DrawPic( 319 - drawOrigin[ 0 ], 360 + drawOrigin[ 1 ], 2, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
- CG_DrawPic( 312 - drawOrigin[ 0 ], 356 + drawOrigin[ 1 ] - drawOrigin[ 2 ], 16, 8, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
- }
+ if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) )
+ CG_DrawBlips( relOrigin, hIbelow );
}
+ //draw alien items below scanner plane
for( i = 0; i < cgIP.numDroidItems; i++ )
{
VectorClear( relOrigin );
VectorSubtract( cgIP.droidItemPositions[ i ], origin, relOrigin );
- if( VectorLength( relOrigin ) < 1000 && ( relOrigin[ 2 ] < 0 ) )
- {
- RotatePointAroundVector( drawOrigin, up, relOrigin, -cg.refdefViewAngles[ 1 ]-90 );
- drawOrigin[ 0 ] /= ( 1000 / 180 );
- drawOrigin[ 1 ] /= ( 1000 / 40 );
- drawOrigin[ 2 ] /= ( 1000 / 180 );
-
- trap_R_SetColor( aIbelow );
- CG_DrawPic( 319 - drawOrigin[ 0 ], 360 + drawOrigin[ 1 ], 2, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
- CG_DrawPic( 312 - drawOrigin[ 0 ], 356 + drawOrigin[ 1 ] - drawOrigin[ 2 ], 16, 8, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
- }
+ if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) )
+ CG_DrawBlips( relOrigin, aIbelow );
}
- CG_DrawPic( 140, 320, 360, 80, cgs.media.scannerShader );
+ /*CG_DrawPic( XPOS, YPOS, WIDTH, HEIGHT, cgs.media.scannerShader );*/
+ //draw human items above scanner plane
for( i = 0; i < cgIP.numHumanItems; i++ )
{
VectorClear( relOrigin );
VectorSubtract( cgIP.humanItemPositions[ i ], origin, relOrigin );
- if( VectorLength( relOrigin ) < 1000 && ( relOrigin[ 2 ] > 0 ) )
- {
- RotatePointAroundVector( drawOrigin, up, relOrigin, -cg.refdefViewAngles[ 1 ]-90 );
- drawOrigin[ 0 ] /= ( 1000 / 180 );
- drawOrigin[ 1 ] /= ( 1000 / 40 );
- drawOrigin[ 2 ] /= ( 1000 / 180 );
-
- trap_R_SetColor( hIabove );
- CG_DrawPic( 319 - drawOrigin[ 0 ], 360 + drawOrigin[ 1 ], 2, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
- CG_DrawPic( 312 - drawOrigin[ 0 ], 356 + drawOrigin[ 1 ] - drawOrigin[ 2 ], 16, 8, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
- }
+ if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) )
+ CG_DrawBlips( relOrigin, hIabove );
}
+
+ //draw alien items above scanner plane
for( i = 0; i < cgIP.numDroidItems; i++ )
{
VectorClear( relOrigin );
VectorSubtract( cgIP.droidItemPositions[ i ], origin, relOrigin );
- if( VectorLength( relOrigin ) < 1000 && ( relOrigin[ 2 ] > 0 ) )
- {
- RotatePointAroundVector( drawOrigin, up, relOrigin, -cg.refdefViewAngles[ 1 ]-90 );
- drawOrigin[ 0 ] /= ( 1000 / 180 );
- drawOrigin[ 1 ] /= ( 1000 / 40 );
- drawOrigin[ 2 ] /= ( 1000 / 180 );
-
- trap_R_SetColor( aIabove );
- CG_DrawPic( 319 - drawOrigin[ 0 ], 360 + drawOrigin[ 1 ], 2, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
- CG_DrawPic( 312 - drawOrigin[ 0 ], 356 + drawOrigin[ 1 ] - drawOrigin[ 2 ], 16, 8, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
- }
+ if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) )
+ CG_DrawBlips( relOrigin, aIabove );
}
}