- fix overhead map

This commit is contained in:
Ilya Shurumov 2021-05-30 13:54:33 +06:00 committed by InspirationByte
parent 8159286182
commit 143ed7bf3e

View File

@ -10,7 +10,6 @@
#include "debris.h"
#include "map.h"
#include "convert.h"
#include "draw.h"
#include "pres.h"
#include "cop_ai.h"
#include "camera.h"
@ -26,25 +25,7 @@ OVERMAP overlaidmaps[4] =
{ 159, 207, 416, 576, 252, 68, 2048 }
};
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 }
};
SXYPAIR MapSegmentPos[16];
XYPAIR NVertex[4] = {
{ -2, 3 },
@ -62,15 +43,10 @@ XYPAIR north[4] = {
static short big_north[] =
{
2048,
2048,
2048,
2048
2048, 2048, 2048, 2048
};
VECTOR player_position = { 0, 0, 0, 0 };
MATRIX map_matrix;
char* MapBitMaps;
@ -399,9 +375,10 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size)
MapRect.x = (MapTPage & 15) << 6;
MapRect.y = (MapTPage & 16) << 4;
// place map segments inside rectangle
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;
}
@ -421,19 +398,17 @@ void ProcessOverlayLump(char *lump_ptr, int lump_size)
// [D] [T]
void LoadMapTile(int tpage, int x, int y)
{
int temp; // $a0
int count; // $a2
int idx; // $a3
int idx, temp, count;
RECT16 MapSegment;
MapSegment.w = 8;
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;
idx = x + y * tilehnum;
temp = x << 5;
temp = x * 32;
if (idx > -1 && idx < overlaidmaps[GameLevel].toptile &&
temp > -1 && (temp < overlaidmaps[GameLevel].width))
@ -1050,7 +1025,7 @@ void DrawMultiplayerMap(void)
poly->y2 = yPos + 64;
poly->y3 = yPos + 64;
px = MapSegmentPos[0].x * 4;
px = MapSegmentPos[0].x;
py = MapSegmentPos[0].y;
poly->u0 = px;
@ -1098,12 +1073,9 @@ void DrawOverheadMap(void)
VECTOR vec;
long flag;
int i, j;
int width;
int height;
int x_mod;
int y_mod;
int MeshWidth;
int MeshHeight;
int tw, th;
int x_mod, y_mod;
int MeshWidth, MeshHeight;
int map_minX, map_maxX;
int map_minY, map_maxY;
@ -1359,16 +1331,17 @@ void DrawOverheadMap(void)
{
for (j = 0; j < MeshWidth; j++)
{
int tile;
int tile, px, py;
tile = maptile[j][i];
width = MapTex[j].w - 1;
height = MapTex[i].h - 1;
tw = MapTex[j].w - 1;
th = MapTex[i].h - 1;
#ifndef PSX
// make map fully detailed when filtering is not available
if (!g_bilinearFiltering)
{
width += 1;
height += 1;
tw += 1;
th += 1;
}
#endif
@ -1397,17 +1370,20 @@ void DrawOverheadMap(void)
spt->x3 = MapMeshO[j+1][i+1].vx;
spt->y3 = MapMeshO[j+1][i+1].vz;
spt->u0 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4);
spt->v0 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y);
px = MapSegmentPos[tile].x;
py = MapSegmentPos[tile].y;
spt->u1 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4 + width);
spt->v1 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y);
spt->u0 = MIN(255, MapTex[j].u + px);
spt->v0 = MIN(255, MapTex[i].v + py);
spt->u2 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4);
spt->v2 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y + height);
spt->u1 = MIN(255, MapTex[j].u + px + tw);
spt->v1 = MIN(255, MapTex[i].v + py);
spt->u3 = MIN(255, MapTex[j].u + MapSegmentPos[tile].x * 4 + width);
spt->v3 = MIN(255, MapTex[i].v + MapSegmentPos[tile].y + height);
spt->u2 = MIN(255, MapTex[j].u + px);
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);
@ -1499,6 +1475,7 @@ void DrawFullscreenMap(void)
long flag;
int width, height;
int ntiles, count;
int tw, th;
// toggle rotated map
if (Pads[0].dirnew & 0x20)
@ -1513,7 +1490,19 @@ void DrawFullscreenMap(void)
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;
setTile(polys);
@ -1715,20 +1704,20 @@ void DrawFullscreenMap(void)
back->x3 = meshO[3].vx;
back->y3 = meshO[3].vz;
px = MapSegmentPos[ntiles & 15].x * 4;
px = MapSegmentPos[ntiles & 15].x;
py = MapSegmentPos[ntiles & 15].y;
back->u0 = px;
back->v0 = py;
back->u1 = px + 31;
back->v1 = py;
back->u1 = MIN(255, px + tw);
back->v1 = MIN(255, py);
back->u2 = px;
back->v2 = py + 31;
back->v2 = MIN(255, py + th);
back->u3 = px + 31;
back->v3 = py + 31;
back->u3 = MIN(255, px + tw);
back->v3 = MIN(255, py + th);
back->clut = MapClut;
back->tpage = MapTPage;
@ -1737,15 +1726,6 @@ void DrawFullscreenMap(void)
DrawSync(0);
ntiles++;
#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);
if (!prevback)