46
46
#include "intdisplay.h"
47
47
#include "texture.h"
49
#define HIT_NOTIFICATION (GAME_TICKS_PER_SEC*2)
51
#define RADAR_DRAW_VIEW_BOX // If defined then draw a box to show the viewing area.
52
#define RADAR_TRIANGLE_SIZE 8
53
#define RADAR_TRIANGLE_HEIGHT RADAR_TRIANGLE_SIZE
54
#define RADAR_TRIANGLE_WIDTH (RADAR_TRIANGLE_SIZE/2)
56
#define RADAR_FRAME_SKIP 10
58
static PIELIGHT colRadarAlly, colRadarMe, colRadarEnemy;
60
BOOL bEnemyAllyRadarColor = false; //enemy/ally radar color
62
//current mini-map mode
63
RADAR_DRAW_MODE radarDrawMode = RADAR_MODE_DEFAULT;
49
#define HIT_NOTIFICATION (GAME_TICKS_PER_SEC * 2)
50
#define RADAR_FRAME_SKIP 10
52
BOOL bEnemyAllyRadarColor = false; /**< Enemy/ally radar color. */
53
RADAR_DRAW_MODE radarDrawMode = RADAR_MODE_DEFAULT; /**< Current mini-map mode. */
54
BOOL rotateRadar; ///< Rotate the radar?
56
static PIELIGHT colRadarAlly, colRadarMe, colRadarEnemy;
65
57
static PIELIGHT tileColours[MAX_TILES];
66
58
static UDWORD *radarBuffer = NULL;
90
82
{{254,37,37,200}} // Player 7
93
static SDWORD RadarScrollX;
94
static SDWORD RadarScrollY;
95
static SDWORD RadarWidth;
96
static SDWORD RadarHeight;
97
static SDWORD RadVisWidth;
98
static SDWORD RadVisHeight;
99
static SDWORD RadarOffsetX;
100
static SDWORD RadarOffsetY;
101
static UWORD RadarZoom;
102
static SDWORD RadarMapOriginX;
103
static SDWORD RadarMapOriginY;
104
static SDWORD RadarMapWidth;
105
static SDWORD RadarMapHeight;
107
static void CalcRadarPixelSize(UWORD *SizeH,UWORD *SizeV);
108
static void CalcRadarScroll(UWORD boxSizeH,UWORD boxSizeV);
109
static void ClearRadar(UDWORD *screen);
110
static void DrawRadarTiles(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD boxSizeV);
111
static void DrawRadarObjects(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD boxSizeV);
112
static void DrawRadarExtras(UWORD boxSizeH, UWORD boxSizeV);
85
static SDWORD radarWidth, radarHeight, radarCenterX, radarCenterY, radarTexWidth, radarTexHeight;
86
static float RadarZoom;
87
static UDWORD radarBufferSize = 0;
89
static void DrawRadarTiles(void);
90
static void DrawRadarObjects(void);
91
static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV);
93
static void radarSize(float zoom)
95
radarWidth = radarTexWidth * zoom;
96
radarHeight = radarTexHeight * zoom;
97
radarCenterX = pie_GetVideoBufferWidth() - BASE_GAP * 4 - MAX(radarHeight, radarWidth)/2;
98
radarCenterY = pie_GetVideoBufferHeight() - BASE_GAP * 4 - MAX(radarWidth, radarHeight)/2;
99
debug(LOG_WZ, "radar=(%u,%u) tex=(%u,%u) size=(%u,%u)", radarCenterX, radarCenterY, radarTexWidth, radarTexHeight, radarWidth, radarHeight);
115
102
void radarInitVars(void)
119
RadarWidth = RADWIDTH;
120
RadarHeight = RADHEIGHT;
107
debug(LOG_WZ, "Resetting radar zoom to %f", RadarZoom);
108
radarSize(RadarZoom);
126
111
//called for when a new mission is started
127
void resetRadarRedraw(void)
112
void resetRadarRedraw()
114
// make sure Radar buffer is correct
132
118
BOOL InitRadar(void)
134
radarBuffer = malloc(RADWIDTH * RADHEIGHT * sizeof(UDWORD));
135
if (radarBuffer == NULL)
137
debug(LOG_ERROR, "Out of memory!");
141
memset(radarBuffer, 0, RADWIDTH * RADHEIGHT * sizeof(UDWORD));
143
120
// Ally/enemy/me colors
144
121
colRadarAlly = WZCOL_YELLOW;
145
122
colRadarEnemy = WZCOL_RED;
165
void SetRadarZoom(UWORD ZoomLevel)
164
void SetRadarZoom(float ZoomLevel)
167
ASSERT( ZoomLevel <= MAX_RADARZOOM,"SetRadarZoom: Max radar zoom exceeded" );
169
if (ZoomLevel != RadarZoom)
166
if (ZoomLevel <= MAX_RADARZOOM && ZoomLevel >= MIN_RADARZOOM)
168
debug(LOG_WZ, "Setting radar zoom to %f from %f", ZoomLevel, RadarZoom);
171
169
RadarZoom = ZoomLevel;
170
radarSize(ZoomLevel);
175
UDWORD GetRadarZoom(void)
174
float GetRadarZoom(void)
177
176
return RadarZoom;
181
// Given a position within the radar, return a world coordinate.
183
void CalcRadarPosition(UDWORD mX,UDWORD mY,UDWORD *PosX,UDWORD *PosY)
185
UWORD boxSizeH,boxSizeV;
187
SDWORD Xoffset,Yoffset;
189
CalcRadarPixelSize(&boxSizeH,&boxSizeV);
190
CalcRadarScroll(boxSizeH,boxSizeV);
192
// Calculate where on the radar we clicked
193
Xoffset=mX-RADTLX-RadarOffsetX;
194
// we need to check for negative values (previously this meant that sPosX/Y were becoming huge)
195
if (Xoffset<0) Xoffset=0;
197
Yoffset=mY-RADTLY-RadarOffsetY;
198
if (Yoffset<0) Yoffset=0;
200
sPosX = ((Xoffset)/boxSizeH)+RadarScrollX+RadarMapOriginX;
201
sPosY = ((Yoffset)/boxSizeV)+RadarScrollY+RadarMapOriginY;
179
/** Calculate the radar pixel sizes. Returns pixels per tile. */
180
static void CalcRadarPixelSize(float *SizeH, float *SizeV)
182
*SizeH = (float)radarHeight / (float)radarTexHeight;
183
*SizeV = (float)radarWidth / (float)radarTexWidth;
186
/** Given a position within the radar, return a world coordinate. */
187
void CalcRadarPosition(int mX, int mY, int *PosX, int *PosY)
190
float pixSizeH, pixSizeV;
193
pos.x = mX - radarCenterX;
194
pos.y = mY - radarCenterY;
197
pos = Vector2f_Rotate2f(pos, -player.r.y/DEG(1));
199
pos.x += radarWidth/2.0;
200
pos.y += radarHeight/2.0;
202
if (pos.x<0 || pos.y<0 || pos.x>=radarWidth || pos.y>=radarHeight)
204
ASSERT(false, "clicked outside radar minimap (%d, %d) -> (%.1f,%.1f)", mX, mY, pos.x, pos.y);
209
CalcRadarPixelSize(&pixSizeH, &pixSizeV);
210
sPosX = pos.x / pixSizeH; // adjust for pixel size
211
sPosY = pos.y / pixSizeV;
212
sPosX += scrollMinX; // adjust for scroll limits
215
#if REALLY_DEBUG_RADAR
216
debug(LOG_ERROR, "m=(%d,%d) radar=(%d,%d) pos(%d,%d), scroll=(%u-%u,%u-%u) sPos=(%d,%d), pixSize=(%f,%f)",
217
mX, mY, radarX, radarY, posX, posY, scrollMinX, scrollMaxX, scrollMinY, scrollMaxY, sPosX, sPosY, pixSizeH, pixSizeV);
220
// old safety code -- still necessary?
203
221
if (sPosX < scrollMinX)
205
223
sPosX = scrollMinX;
217
235
sPosY = scrollMaxY;
224
// Calculate the radar pixel sizes.
226
static void CalcRadarPixelSize(UWORD *SizeH,UWORD *SizeV)
228
UWORD Size = (UWORD)(1<<RadarZoom);
235
// Calculate the radar scroll positions from the current player position.
237
static void CalcRadarScroll(UWORD boxSizeH,UWORD boxSizeV)
243
RadarMapOriginX = scrollMinX;
244
RadarMapOriginY = scrollMinY;
245
RadarMapWidth = scrollMaxX- scrollMinX;
246
RadarMapHeight = scrollMaxY - scrollMinY;
248
RadVisWidth = RadarWidth;
249
RadVisHeight = RadarHeight;
251
if(RadarMapWidth < RadVisWidth/boxSizeH) {
252
RadVisWidth = RadarMapWidth*boxSizeH;
253
RadarOffsetX = (RadarWidth-RadVisWidth)/2;
258
if(RadarMapHeight < RadVisHeight/boxSizeV) {
259
RadVisHeight = RadarMapHeight*boxSizeV;
260
RadarOffsetY = (RadarHeight-RadVisHeight)/2;
265
BorderX = (RadVisWidth - visibleTiles.x*boxSizeH) / 2;
266
BorderY = (RadVisHeight - visibleTiles.y*boxSizeV) / 2;
272
} else if(BorderX < 0) {
278
} else if(BorderY < 0) {
282
viewX = ((player.p.x/TILE_UNITS)-RadarScrollX-RadarMapOriginX);
283
viewY = ((player.p.z/TILE_UNITS)-RadarScrollY-RadarMapOriginY);
285
if(viewX < BorderX) {
286
RadarScrollX += viewX-BorderX;
289
viewX += visibleTiles.x;
290
if(viewX > (RadVisWidth/boxSizeH)-BorderX) {
291
RadarScrollX += viewX-(RadVisWidth/boxSizeH)+BorderX;
294
if(viewY < BorderY) {
295
RadarScrollY += viewY-BorderY;
298
viewY += visibleTiles.y;
299
if(viewY > (RadVisHeight/boxSizeV)-BorderY) {
300
RadarScrollY += viewY-(RadVisHeight/boxSizeV)+BorderY;
303
if(RadarScrollX < 0) {
305
} else if(RadarScrollX > RadarMapWidth-(RadVisWidth/boxSizeH)) {
306
RadarScrollX = RadarMapWidth-(RadVisWidth/boxSizeH);
309
if(RadarScrollY < 0) {
311
} else if(RadarScrollY > RadarMapHeight-(RadVisHeight/boxSizeV)) {
312
RadarScrollY = RadarMapHeight-(RadVisHeight/boxSizeV);
317
242
void drawRadar(void)
319
UWORD boxSizeH,boxSizeV;
244
float pixSizeH, pixSizeV;
320
245
static int frameSkip = 0;
322
247
ASSERT(radarBuffer, "No radar buffer allocated");
328
CalcRadarPixelSize(&boxSizeH,&boxSizeV);
329
CalcRadarScroll(boxSizeH,boxSizeV);
253
CalcRadarPixelSize(&pixSizeH, &pixSizeV);
333
if (RadVisWidth != RadarWidth || RadVisHeight != RadarHeight)
335
ClearRadar(radarBuffer);
337
DrawRadarTiles(radarBuffer, RADWIDTH, boxSizeH, boxSizeV);
338
DrawRadarObjects(radarBuffer, RADWIDTH, boxSizeH, boxSizeV);
339
pie_DownLoadRadar(radarBuffer, RADWIDTH, RADHEIGHT);
340
frameSkip=RADAR_FRAME_SKIP;
259
pie_DownLoadRadar(radarBuffer, radarTexWidth, radarTexHeight);
260
frameSkip = RADAR_FRAME_SKIP;
344
pie_ClipBegin(RADTLX, RADTLY, RADTLX + RADWIDTH, RADTLY + RADHEIGHT);
345
iV_TransBoxFill( RADTLX,RADTLY, RADTLX + RADWIDTH, RADTLY + RADHEIGHT);
346
pie_RenderRadar(RADTLX, RADTLY, RADWIDTH, RADHEIGHT);
347
DrawRadarExtras(boxSizeH,boxSizeV);
348
drawRadarBlips(boxSizeH, boxSizeV, RadarOffsetX, RadarOffsetY);
353
// Clear the radar buffer.
355
static void ClearRadar(UDWORD *screen)
358
UDWORD *pScr = screen;
360
for (i = 0; i < RadarWidth; i++)
362
for (j = 0; j < RadarHeight; j++)
263
pie_SetTranslucencyMode(TRANS_ALPHA);
265
pie_TRANSLATE(radarCenterX, radarCenterY, 0);
364
*pScr++ = WZCOL_RADAR_BACKGROUND.rgba;
269
iV_MatrixRotateZ(player.r.y);
271
// draw the box at the dimensions of the map
272
iV_TransBoxFill(-radarWidth/2.0,
276
pie_RenderRadar(-radarWidth/2.0,
281
pie_TRANSLATE(-radarWidth/2 - 1, -radarHeight/2 - 1, 0);
282
DrawRadarExtras(0, 0, pixSizeH, pixSizeV);
284
drawRadarBlips(-radarWidth/2.0, -radarHeight/2.0, pixSizeH, pixSizeV);
369
288
static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile)
422
// Draw the map tiles on the radar.
424
static void DrawRadarTiles(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD boxSizeV)
336
/** Draw the map tiles on the radar. */
337
static void DrawRadarTiles(void)
427
UWORD SizeH = boxSizeH;
428
UWORD SizeV = boxSizeV;
429
SDWORD VisWidth = RadVisWidth;
430
SDWORD VisHeight = RadVisHeight;
431
SDWORD i, j, EndY = VisHeight;
432
SDWORD OffsetX = RadarOffsetX;
433
SDWORD OffsetY = RadarOffsetY;
434
UDWORD *Scr = screen + OffsetX + OffsetY * Modulus;
436
ASSERT( (SizeV!=0) && (SizeV!=0) ,"Zero pixel size" );
438
/* Get pointer to very first tile */
439
psTile = psMapTiles + RadarScrollX + RadarScrollY*mapWidth;
440
psTile += RadarMapOriginX + RadarMapOriginY*mapWidth;
444
for (i=0; i<EndY; i+=SizeH)
446
MAPTILE *WTile = psTile;
449
for (j=0; j<VisWidth; j+=SizeV)
451
if (!getRevealStatus() || TEST_TILE_VISIBLE(selectedPlayer, WTile) || godMode)
453
*WScr = appliedRadarColour(radarDrawMode, WTile).rgba;
455
*WScr = WZCOL_RADAR_BACKGROUND.rgba;
457
/* Next pixel, next tile */
467
for (i=0; i<EndY; i+=SizeV)
469
MAPTILE *WTile = psTile;
471
for (j=0; j<VisWidth; j+=SizeH)
473
/* Only draw if discovered or in GOD mode */
474
if (!getRevealStatus() || TEST_TILE_VISIBLE(selectedPlayer, WTile) || godMode)
476
PIELIGHT col = tileColours[TileNumber_tile(WTile->texture)];
478
UDWORD *Ptr = Scr + j + i * Modulus;
480
col.byte.r = sqrtf(col.byte.r * WTile->illumination);
481
col.byte.b = sqrtf(col.byte.b * WTile->illumination);
482
col.byte.g = sqrtf(col.byte.g * WTile->illumination);
485
for(c=0; c<SizeV; c++)
489
for(d=0; d<SizeH; d++)
491
*WPtr = appliedRadarColour(radarDrawMode, WTile).rgba;
500
UDWORD *Ptr = Scr + j + i * Modulus;
502
for(c=0; c<SizeV; c++)
506
for(d=0; d<SizeH; d++)
508
*WPtr = WZCOL_RADAR_BACKGROUND.rgba;
341
for (x = scrollMinX; x < scrollMaxX; x++)
343
for (y = scrollMinY; y < scrollMaxY; y++)
345
MAPTILE *psTile = mapTile(x, y);
346
size_t pos = radarTexWidth * (y - scrollMinY) + (x - scrollMinX);
348
ASSERT(pos * sizeof(*radarBuffer) < radarBufferSize, "Buffer overrun");
349
if (!getRevealStatus() || TEST_TILE_VISIBLE(selectedPlayer, psTile))
351
radarBuffer[pos] = appliedRadarColour(radarDrawMode, psTile).rgba;
353
radarBuffer[pos] = WZCOL_RADAR_BACKGROUND.rgba;
522
// Draw the droids and structure positions on the radar.
524
static void DrawRadarObjects(UDWORD *screen,UDWORD Modulus,UWORD boxSizeH,UWORD boxSizeV)
359
/** Draw the droids and structure positions on the radar. */
360
static void DrawRadarObjects(void)
531
PROXIMITY_DISPLAY *psProxDisp;
532
VIEW_PROXIMITY *psViewProx;
536
SDWORD SSizeH,SSizeV;
541
PIELIGHT playerCol, col;
542
364
PIELIGHT flashCol;
546
VisWidth = RadVisWidth;
547
VisHeight = RadVisHeight;
548
OffsetX = RadarOffsetX;
549
OffsetY = RadarOffsetY;
551
367
/* Show droids on map - go through all players */
552
368
for(clan = 0; clan < MAX_PLAYERS; clan++)
554
372
//see if have to draw enemy/ally color
555
373
if (bEnemyAllyRadarColor)
572
390
flashCol = flashColours[getPlayerColour(clan)];
574
392
/* Go through all droids */
575
for(psDroid = apsDroidLists[clan]; psDroid != NULL;
576
psDroid = psDroid->psNext)
393
for(psDroid = apsDroidLists[clan]; psDroid != NULL; psDroid = psDroid->psNext)
395
if (psDroid->pos.x < world_coord(scrollMinX) || psDroid->pos.y < world_coord(scrollMinY)
396
|| psDroid->pos.x >= world_coord(scrollMaxX) || psDroid->pos.y >= world_coord(scrollMaxY))
578
400
if (psDroid->visible[selectedPlayer]
580
401
|| (bMultiPlayer && game.alliance == ALLIANCES_TEAMS
581
402
&& aiCheckAlliances(selectedPlayer,psDroid->player)))
583
x=(psDroid->pos.x/TILE_UNITS)-RadarScrollX;
584
y=(psDroid->pos.y/TILE_UNITS)-RadarScrollY;
585
x -= RadarMapOriginX;
586
y -= RadarMapOriginY;
592
if((x < VisWidth) && (y < VisHeight) && (x >= 0) && (y >= 0)) {
593
Ptr = screen + x + y*Modulus + OffsetX + OffsetY*Modulus;
595
if((clan == selectedPlayer) && (gameTime-psDroid->timeLastHit < HIT_NOTIFICATION))
604
for(c=0; c<SizeV; c++)
607
for(d=0; d<SizeH; d++)
404
int x = psDroid->pos.x / TILE_UNITS;
405
int y = psDroid->pos.y / TILE_UNITS;
406
size_t pos = (x - scrollMinX) + (y - scrollMinY) * radarTexWidth;
408
ASSERT(pos * sizeof(*radarBuffer) < radarBufferSize, "Buffer overrun");
409
if (clan == selectedPlayer && gameTime-psDroid->timeLastHit < HIT_NOTIFICATION)
411
radarBuffer[pos] = flashCol.rgba;
415
radarBuffer[pos] = playerCol.rgba;
620
421
/* Do the same for structures */
621
for(clan = 0; clan < MAX_PLAYERS; clan++)
623
//see if have to draw enemy/ally color
624
if (bEnemyAllyRadarColor)
626
if (clan == selectedPlayer)
628
playerCol = colRadarMe;
632
playerCol = (aiCheckAlliances(selectedPlayer,clan) ? colRadarAlly: colRadarEnemy);
637
//original 8-color mode
638
playerCol = clanColours[getPlayerColour(clan)];
641
flashCol = flashColours[getPlayerColour(clan)];
643
/* Go through all structures */
644
for(psStruct = apsStructLists[clan]; psStruct != NULL;
645
psStruct = psStruct->psNext)
422
for (x = scrollMinX; x < scrollMaxX; x++)
424
for (y = scrollMinY; y < scrollMaxY; y++)
426
MAPTILE *psTile = mapTile(x, y);
427
STRUCTURE *psStruct = (STRUCTURE *)psTile->psObject;
428
size_t pos = (x - scrollMinX) + (y - scrollMinY) * radarTexWidth;
430
ASSERT(pos * sizeof(*radarBuffer) < radarBufferSize, "Buffer overrun");
431
if (!TileHasStructure(psTile))
435
clan = psStruct->player;
437
//see if have to draw enemy/ally color
438
if (bEnemyAllyRadarColor)
440
if (clan == selectedPlayer)
442
playerCol = colRadarMe;
446
playerCol = (aiCheckAlliances(selectedPlayer, clan) ? colRadarAlly: colRadarEnemy);
451
//original 8-color mode
452
playerCol = clanColours[getPlayerColour(clan)];
454
flashCol = flashColours[getPlayerColour(clan)];
647
456
if (psStruct->visible[selectedPlayer]
649
457
|| (bMultiPlayer && game.alliance == ALLIANCES_TEAMS
650
&& aiCheckAlliances(selectedPlayer,psStruct->player)))
458
&& aiCheckAlliances(selectedPlayer, psStruct->player)))
652
x=(psStruct->pos.x/TILE_UNITS)-RadarScrollX;
653
y=(psStruct->pos.y/TILE_UNITS)-RadarScrollY;
654
x -= RadarMapOriginX;
655
y -= RadarMapOriginY;
659
// Get structures tile size.
660
bw = (UWORD)psStruct->pStructureType->baseWidth;
661
bh = (UWORD)psStruct->pStructureType->baseBreadth;
663
// Need to offset for the structures top left corner.
666
x = x&(~(boxSizeH-1));
667
y = y&(~(boxSizeV-1));
669
SSizeH = (SWORD)boxSizeH*bh;
670
SSizeV = (SWORD)boxSizeV*bw;
672
// Clip the structure box.
683
if(x+SSizeH > VisWidth) {
684
SSizeH -= (x+SSizeH) - VisWidth;
687
if(y+SSizeV > VisHeight) {
688
SSizeV -= (y+SSizeV) - VisHeight;
692
if((SSizeV > 0) && (SSizeH > 0)) {
693
Ptr = screen + x + y*Modulus + OffsetX + OffsetY*Modulus;
694
if((clan == selectedPlayer) && (gameTime - psStruct->timeLastHit < HIT_NOTIFICATION))
703
for(c=0; c<SSizeV; c++)
706
for(d=0; d<SSizeH; d++)
460
if (clan == selectedPlayer && gameTime - psStruct->timeLastHit < HIT_NOTIFICATION)
462
radarBuffer[pos] = flashCol.rgba;
466
radarBuffer[pos] = playerCol.rgba;
718
//now set up coords for Proximity Messages - but only for selectedPlayer
719
for(psProxDisp = apsProxDisp[selectedPlayer]; psProxDisp != NULL;
720
psProxDisp = psProxDisp->psNext)
722
if (psProxDisp->type == POS_PROXDATA)
724
psViewProx = (VIEW_PROXIMITY *)((VIEWDATA *)psProxDisp->psMessage->
726
x = (psViewProx->x/TILE_UNITS)-RadarScrollX;
727
y = (psViewProx->y/TILE_UNITS)-RadarScrollY;
729
else if (psProxDisp->type == POS_PROXOBJ)
731
x = (((BASE_OBJECT *)psProxDisp->psMessage->pViewData)->pos.x /
732
TILE_UNITS) - RadarScrollX;
733
y = (((BASE_OBJECT *)psProxDisp->psMessage->pViewData)->pos.y /
734
TILE_UNITS) - RadarScrollY;
736
x -= RadarMapOriginX;
737
y -= RadarMapOriginY;
741
psProxDisp->radarX = 0;
742
psProxDisp->radarY = 0;
743
if((x < VisWidth) && (y < VisHeight) && (x >= 0) && (y >= 0))
746
psProxDisp->radarX = x + OffsetX;
747
psProxDisp->radarY = y + OffsetY;
753
// Rotate an array of 2d vectors about a given angle, also translates them after rotating.
473
/** Rotate an array of 2d vectors about a given angle, also translates them after rotating. */
755
474
static void RotateVector2D(Vector3i *Vector, Vector3i *TVector, Vector3i *Pos, int Angle, int Count)
757
476
int Cos = COS(Angle);
863
579
/* Send the four points to the draw routine and the clip box params */
864
pie_DrawViewingWindow(tv,RADTLX,RADTLY,RADTLX+RADWIDTH,RADTLY+RADHEIGHT,colour);
580
pie_DrawViewingWindow(tv, radarX, radarY, radarX + radarWidth, radarY + radarHeight, colour);
867
static void DrawRadarExtras(UWORD boxSizeH, UWORD boxSizeV)
583
static void DrawRadarExtras(float radarX, float radarY, float pixSizeH, float pixSizeV)
869
SDWORD viewX = ((player.p.x / TILE_UNITS) - RadarScrollX - RadarMapOriginX) * boxSizeH + RadarOffsetX;
870
SDWORD viewY = ((player.p.z / TILE_UNITS) - RadarScrollY - RadarMapOriginY) * boxSizeV + RadarOffsetY;
872
viewX = viewX&(~(boxSizeH-1));
873
viewY = viewY&(~(boxSizeV-1));
875
drawViewingWindow(viewX, viewY, boxSizeH, boxSizeV);
876
RenderWindowFrame(FRAME_RADAR, RADTLX - 1, RADTLY - 1, RADWIDTH + 2, RADHEIGHT + 2);
585
int viewX = (player.p.x / TILE_UNITS) * pixSizeH;
586
int viewY = (player.p.z / TILE_UNITS) * pixSizeV;
588
drawViewingWindow(radarX, radarY, viewX, viewY, pixSizeH, pixSizeV);
589
RenderWindowFrame(FRAME_RADAR, radarX - 1, radarY - 1, radarWidth + 2, radarHeight + 2);
879
// Does a screen coordinate lie within the radar area?
592
/** Does a screen coordinate lie within the radar area? */
881
593
BOOL CoordInRadar(int x,int y)
883
if (x >= RADTLX - 1 && x < RADTLX + RADWIDTH + 1 && y >= RADTLY - 1 && y < RADTLY + RADHEIGHT + 1)
596
pos.x = x - radarCenterX;
597
pos.y = y - radarCenterY;
600
pos = Vector2f_Rotate2f(pos, -player.r.y/DEG(1));
602
pos.x += radarWidth/2;
603
pos.y += radarHeight/2;
605
if (pos.x<0 || pos.y<0 || pos.x>=radarWidth || pos.y>=radarHeight)
891
612
void radarColour(UDWORD tileNumber, uint8_t r, uint8_t g, uint8_t b)