|
|
|
@ -439,30 +439,31 @@ void FaceBall::RegenerateMinimap(){ |
|
|
|
|
vf2d mapSprSize = {float(mapSpr->width),float(mapSpr->height)}; |
|
|
|
|
SetDrawTarget(mapSpr); |
|
|
|
|
Clear(BLACK); |
|
|
|
|
const int MAP_VISIBILITY=6; |
|
|
|
|
for (int x=0;x<MAP_SIZE.x;x++){ |
|
|
|
|
for (int y=0;y<MAP_SIZE.y;y++){ |
|
|
|
|
float dist = std::sqrtf(std::pow(player.GetPos().x-x,2)+std::pow(player.GetPos().z-y,2)); |
|
|
|
|
if (dist<6){ |
|
|
|
|
if (dist<MAP_VISIBILITY){ |
|
|
|
|
try{ |
|
|
|
|
MapSquare&square=map.at(y).at(x); |
|
|
|
|
vf2d squareLoc = vf2d{x*minimapGridSize.x,y*minimapGridSize.y}; |
|
|
|
|
if (square.wallN){ |
|
|
|
|
DrawLine(squareLoc,squareLoc+vf2d{1.f,0.f}*minimapGridSize,WHITE); |
|
|
|
|
DrawLine(squareLoc,squareLoc+vf2d{1.f,0.f}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)}); |
|
|
|
|
} |
|
|
|
|
if (square.wallS){ |
|
|
|
|
DrawLine(squareLoc+vf2d{0,1.f}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,WHITE); |
|
|
|
|
DrawLine(squareLoc+vf2d{0,1.f}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)}); |
|
|
|
|
} |
|
|
|
|
if (square.wallE){ |
|
|
|
|
DrawLine(squareLoc+vf2d{1,0}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,WHITE); |
|
|
|
|
DrawLine(squareLoc+vf2d{1,0}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)}); |
|
|
|
|
} |
|
|
|
|
if (square.wallW){ |
|
|
|
|
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,WHITE); |
|
|
|
|
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)}); |
|
|
|
|
} |
|
|
|
|
if (hasMapUpgrade){ |
|
|
|
|
for (Enemy&e:enemies){ |
|
|
|
|
if (!e.isDead()){ |
|
|
|
|
if (vi2d{int(e.pos.x),int(e.pos.z)}==vi2d{x,y}){ |
|
|
|
|
FillCircle(vi2d{int(squareLoc.x+0.5*minimapGridSize.x),int(squareLoc.y+0.5*minimapGridSize.y)},3,enemyData[e.GetID()].col); |
|
|
|
|
FillCircle(vi2d{int(squareLoc.x+0.5*minimapGridSize.x),int(squareLoc.y+0.5*minimapGridSize.y)},3,enemyData[e.GetID()].col*(1-(float(dist)/MAP_VISIBILITY))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|