mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 11:52:32 +01:00
- fix overhead map
This commit is contained in:
parent
8159286182
commit
143ed7bf3e
@ -10,7 +10,6 @@
|
|||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "draw.h"
|
|
||||||
#include "pres.h"
|
#include "pres.h"
|
||||||
#include "cop_ai.h"
|
#include "cop_ai.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
@ -26,25 +25,7 @@ OVERMAP overlaidmaps[4] =
|
|||||||
{ 159, 207, 416, 576, 252, 68, 2048 }
|
{ 159, 207, 416, 576, 252, 68, 2048 }
|
||||||
};
|
};
|
||||||
|
|
||||||
SXYPAIR MapSegmentPos[16] =
|
SXYPAIR MapSegmentPos[16];
|
||||||
{
|
|
||||||
{ 0, 0 },
|
|
||||||
{ 8, 0 },
|
|
||||||
{ 16, 0 },
|
|
||||||
{ 24, 0 },
|
|
||||||
{ 0, 32 },
|
|
||||||
{ 8, 32 },
|
|
||||||
{ 16, 32 },
|
|
||||||
{ 24, 32 },
|
|
||||||
{ 0, 64 },
|
|
||||||
{ 8, 64 },
|
|
||||||
{ 16, 64 },
|
|
||||||
{ 24, 64 },
|
|
||||||
{ 0, 96 },
|
|
||||||
{ 8, 96 },
|
|
||||||
{ 16, 96 },
|
|
||||||
{ 24, 96 }
|
|
||||||
};
|
|
||||||
|
|
||||||
XYPAIR NVertex[4] = {
|
XYPAIR NVertex[4] = {
|
||||||
{ -2, 3 },
|
{ -2, 3 },
|
||||||
@ -62,15 +43,10 @@ XYPAIR north[4] = {
|
|||||||
|
|
||||||
static short big_north[] =
|
static short big_north[] =
|
||||||
{
|
{
|
||||||
2048,
|
2048, 2048, 2048, 2048
|
||||||
2048,
|
|
||||||
2048,
|
|
||||||
2048
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VECTOR player_position = { 0, 0, 0, 0 };
|
VECTOR player_position = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
|
||||||
MATRIX map_matrix;
|
MATRIX map_matrix;
|
||||||
|
|
||||||
char* MapBitMaps;
|
char* MapBitMaps;
|
||||||
@ -399,9 +375,10 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size)
|
|||||||
MapRect.x = (MapTPage & 15) << 6;
|
MapRect.x = (MapTPage & 15) << 6;
|
||||||
MapRect.y = (MapTPage & 16) << 4;
|
MapRect.y = (MapTPage & 16) << 4;
|
||||||
|
|
||||||
|
// place map segments inside rectangle
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
MapSegmentPos[i].x = ((i & 3) * 32 + info.coords.u0) / 4;
|
MapSegmentPos[i].x = info.coords.u0 + (i & 3) * 32;
|
||||||
MapSegmentPos[i].y = info.coords.v0 + (i / 4) * 32;
|
MapSegmentPos[i].y = info.coords.v0 + (i / 4) * 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,19 +398,17 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size)
|
|||||||
// [D] [T]
|
// [D] [T]
|
||||||
void LoadMapTile(int tpage, int x, int y)
|
void LoadMapTile(int tpage, int x, int y)
|
||||||
{
|
{
|
||||||
int temp; // $a0
|
int idx, temp, count;
|
||||||
int count; // $a2
|
|
||||||
int idx; // $a3
|
|
||||||
RECT16 MapSegment;
|
RECT16 MapSegment;
|
||||||
|
|
||||||
MapSegment.w = 8;
|
MapSegment.w = 8;
|
||||||
MapSegment.h = 32;
|
MapSegment.h = 32;
|
||||||
|
|
||||||
MapSegment.x = MapRect.x + MapSegmentPos[tpage].x;
|
MapSegment.x = MapRect.x + (MapSegmentPos[tpage].x >> 2);
|
||||||
MapSegment.y = MapRect.y + MapSegmentPos[tpage].y;
|
MapSegment.y = MapRect.y + MapSegmentPos[tpage].y;
|
||||||
|
|
||||||
idx = x + y * tilehnum;
|
idx = x + y * tilehnum;
|
||||||
temp = x << 5;
|
temp = x * 32;
|
||||||
|
|
||||||
if (idx > -1 && idx < overlaidmaps[GameLevel].toptile &&
|
if (idx > -1 && idx < overlaidmaps[GameLevel].toptile &&
|
||||||
temp > -1 && (temp < overlaidmaps[GameLevel].width))
|
temp > -1 && (temp < overlaidmaps[GameLevel].width))
|
||||||
@ -1050,7 +1025,7 @@ void DrawMultiplayerMap(void)
|
|||||||
poly->y2 = yPos + 64;
|
poly->y2 = yPos + 64;
|
||||||
poly->y3 = yPos + 64;
|
poly->y3 = yPos + 64;
|
||||||
|
|
||||||
px = MapSegmentPos[0].x * 4;
|
px = MapSegmentPos[0].x;
|
||||||
py = MapSegmentPos[0].y;
|
py = MapSegmentPos[0].y;
|
||||||
|
|
||||||
poly->u0 = px;
|
poly->u0 = px;
|
||||||
@ -1098,12 +1073,9 @@ void DrawOverheadMap(void)
|
|||||||
VECTOR vec;
|
VECTOR vec;
|
||||||
long flag;
|
long flag;
|
||||||
int i, j;
|
int i, j;
|
||||||
int width;
|
int tw, th;
|
||||||
int height;
|
int x_mod, y_mod;
|
||||||
int x_mod;
|
int MeshWidth, MeshHeight;
|
||||||
int y_mod;
|
|
||||||
int MeshWidth;
|
|
||||||
int MeshHeight;
|
|
||||||
int map_minX, map_maxX;
|
int map_minX, map_maxX;
|
||||||
int map_minY, map_maxY;
|
int map_minY, map_maxY;
|
||||||
|
|
||||||
@ -1359,16 +1331,17 @@ void DrawOverheadMap(void)
|
|||||||
{
|
{
|
||||||
for (j = 0; j < MeshWidth; j++)
|
for (j = 0; j < MeshWidth; j++)
|
||||||
{
|
{
|
||||||
int tile;
|
int tile, px, py;
|
||||||
|
|
||||||
tile = maptile[j][i];
|
tile = maptile[j][i];
|
||||||
width = MapTex[j].w - 1;
|
tw = MapTex[j].w - 1;
|
||||||
height = MapTex[i].h - 1;
|
th = MapTex[i].h - 1;
|
||||||
#ifndef PSX
|
#ifndef PSX
|
||||||
// make map fully detailed when filtering is not available
|
// make map fully detailed when filtering is not available
|
||||||
if (!g_bilinearFiltering)
|
if (!g_bilinearFiltering)
|
||||||
{
|
{
|
||||||
width += 1;
|
tw += 1;
|
||||||
height += 1;
|
th += 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1397,17 +1370,20 @@ void DrawOverheadMap(void)
|
|||||||
spt->x3 = MapMeshO[j+1][i+1].vx;
|
spt->x3 = MapMeshO[j+1][i+1].vx;
|
||||||
spt->y3 = MapMeshO[j+1][i+1].vz;
|
spt->y3 = MapMeshO[j+1][i+1].vz;
|
||||||
|
|
||||||
spt->u0 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4);
|
px = MapSegmentPos[tile].x;
|
||||||
spt->v0 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y);
|
py = MapSegmentPos[tile].y;
|
||||||
|
|
||||||
spt->u1 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4 + width);
|
spt->u0 = MIN(255, MapTex[j].u + px);
|
||||||
spt->v1 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y);
|
spt->v0 = MIN(255, MapTex[i].v + py);
|
||||||
|
|
||||||
spt->u2 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4);
|
spt->u1 = MIN(255, MapTex[j].u + px + tw);
|
||||||
spt->v2 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y + height);
|
spt->v1 = MIN(255, MapTex[i].v + py);
|
||||||
|
|
||||||
spt->u3 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4 + width);
|
spt->u2 = MIN(255, MapTex[j].u + px);
|
||||||
spt->v3 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y + height);
|
spt->v2 = MIN(255, MapTex[i].v + py + th);
|
||||||
|
|
||||||
|
spt->u3 = MIN(255, MapTex[j].u + px + tw);
|
||||||
|
spt->v3 = MIN(255, MapTex[i].v + py + th);
|
||||||
|
|
||||||
addPrim(current->ot + 1, spt);
|
addPrim(current->ot + 1, spt);
|
||||||
|
|
||||||
@ -1499,6 +1475,7 @@ void DrawFullscreenMap(void)
|
|||||||
long flag;
|
long flag;
|
||||||
int width, height;
|
int width, height;
|
||||||
int ntiles, count;
|
int ntiles, count;
|
||||||
|
int tw, th;
|
||||||
|
|
||||||
// toggle rotated map
|
// toggle rotated map
|
||||||
if (Pads[0].dirnew & 0x20)
|
if (Pads[0].dirnew & 0x20)
|
||||||
@ -1513,7 +1490,19 @@ void DrawFullscreenMap(void)
|
|||||||
|
|
||||||
SetFullscreenMapMatrix();
|
SetFullscreenMapMatrix();
|
||||||
|
|
||||||
#ifdef PSX
|
tw = tile_size - 1;
|
||||||
|
th = tile_size - 1;
|
||||||
|
|
||||||
|
#ifndef PSX
|
||||||
|
/* It will look funny when enabled
|
||||||
|
// make map fully detailed when filtering is not available
|
||||||
|
if (!g_bilinearFiltering)
|
||||||
|
{
|
||||||
|
tw += 1;
|
||||||
|
th += 1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#else
|
||||||
polys = (TILE*)current->primptr;
|
polys = (TILE*)current->primptr;
|
||||||
|
|
||||||
setTile(polys);
|
setTile(polys);
|
||||||
@ -1715,21 +1704,21 @@ void DrawFullscreenMap(void)
|
|||||||
back->x3 = meshO[3].vx;
|
back->x3 = meshO[3].vx;
|
||||||
back->y3 = meshO[3].vz;
|
back->y3 = meshO[3].vz;
|
||||||
|
|
||||||
px = MapSegmentPos[ntiles & 15].x * 4;
|
px = MapSegmentPos[ntiles & 15].x;
|
||||||
py = MapSegmentPos[ntiles & 15].y;
|
py = MapSegmentPos[ntiles & 15].y;
|
||||||
|
|
||||||
back->u0 = px;
|
back->u0 = px;
|
||||||
back->v0 = py;
|
back->v0 = py;
|
||||||
|
|
||||||
back->u1 = px + 31;
|
|
||||||
back->v1 = py;
|
|
||||||
|
|
||||||
back->u2 = px;
|
|
||||||
back->v2 = py + 31;
|
|
||||||
|
|
||||||
back->u3 = px + 31;
|
|
||||||
back->v3 = py + 31;
|
|
||||||
|
|
||||||
|
back->u1 = MIN(255, px + tw);
|
||||||
|
back->v1 = MIN(255, py);
|
||||||
|
|
||||||
|
back->u2 = px;
|
||||||
|
back->v2 = MIN(255, py + th);
|
||||||
|
|
||||||
|
back->u3 = MIN(255, px + tw);
|
||||||
|
back->v3 = MIN(255, py + th);
|
||||||
|
|
||||||
back->clut = MapClut;
|
back->clut = MapClut;
|
||||||
back->tpage = MapTPage;
|
back->tpage = MapTPage;
|
||||||
#ifdef PSX
|
#ifdef PSX
|
||||||
@ -1737,15 +1726,6 @@ void DrawFullscreenMap(void)
|
|||||||
DrawSync(0);
|
DrawSync(0);
|
||||||
ntiles++;
|
ntiles++;
|
||||||
#else
|
#else
|
||||||
// make map fully detailed when filtering is not available
|
|
||||||
if (!g_bilinearFiltering)
|
|
||||||
{
|
|
||||||
back->u1 += 1;
|
|
||||||
back->v2 += 1;
|
|
||||||
back->u3 += 1;
|
|
||||||
back->v3 += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
current->primptr += sizeof(POLY_FT4);
|
current->primptr += sizeof(POLY_FT4);
|
||||||
|
|
||||||
if (!prevback)
|
if (!prevback)
|
||||||
|
Loading…
Reference in New Issue
Block a user