Include rendering of exit box on minimap

pull/1/head
sigonasr2 2 years ago
parent b850b8f548
commit 849282bb41
  1. 19
      Faceball2030/main.cpp
  2. 2
      Faceball2030/main.h

@ -447,17 +447,18 @@ void FaceBall::RegenerateMinimap(){
try{
MapSquare&square=map.at(y).at(x);
vf2d squareLoc = vf2d{x*minimapGridSize.x,y*minimapGridSize.y};
uint8_t transparency=uint8_t((1-(float(dist)/MAP_VISIBILITY))*255);
if (square.wallN){
DrawLine(squareLoc,squareLoc+vf2d{1.f,0.f}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)});
DrawLine(squareLoc,squareLoc+vf2d{1.f,0.f}*minimapGridSize,Pixel{255,255,255,transparency});
}
if (square.wallS){
DrawLine(squareLoc+vf2d{0,1.f}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)});
DrawLine(squareLoc+vf2d{0,1.f}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,Pixel{255,255,255,transparency});
}
if (square.wallE){
DrawLine(squareLoc+vf2d{1,0}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)});
DrawLine(squareLoc+vf2d{1,0}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,Pixel{255,255,255,transparency});
}
if (square.wallW){
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,{255,255,255,uint8_t((1-(float(dist)/MAP_VISIBILITY))*255)});
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,Pixel{255,255,255,transparency});
}
if (hasMapUpgrade){
for (Enemy&e:enemies){
@ -474,6 +475,16 @@ void FaceBall::RegenerateMinimap(){
}
}
}
float dist = std::sqrtf(std::pow(player.GetPos().x-exitCoords.x,2)+std::pow(player.GetPos().z-exitCoords.y,2));
if (tagsRemaining>0){
vf2d squareLoc = vf2d{exitCoords.x*minimapGridSize.x,exitCoords.y*minimapGridSize.y};
uint8_t transparency=uint8_t((1-(float(dist)/MAP_VISIBILITY))*255);
DrawLine(squareLoc,squareLoc+vf2d{1.f,0.f}*minimapGridSize,Pixel{DARK_RED.r,DARK_RED.g,DARK_RED.b,transparency});
DrawLine(squareLoc+vf2d{0,1.f}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,Pixel{DARK_RED.r,DARK_RED.g,DARK_RED.b,transparency});
DrawLine(squareLoc+vf2d{1,0}*minimapGridSize,squareLoc+vf2d{1,1}*minimapGridSize,Pixel{DARK_RED.r,DARK_RED.g,DARK_RED.b,transparency});
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,Pixel{DARK_RED.r,DARK_RED.g,DARK_RED.b,transparency});
}
FillCircle(vi2d{int(exitCoords.x*minimapGridSize.x+0.5*minimapGridSize.x),int(exitCoords.y*minimapGridSize.x+0.5*minimapGridSize.y)},3,MAGENTA*(1-(float(dist)/MAP_VISIBILITY)));
SetDrawTarget(nullptr);
mapDecal->Update();
}

@ -339,7 +339,7 @@ class FaceBall : public PixelGameEngine
vf2d{1162,575},
vf2d{1163,525}
};
public:
Player player = { {3.7,0.3,0.7}, {{0.5,0.5},0.2} };
vi2d playerRoundedCoords = {int(player.GetPos().x),int(player.GetPos().z)};
const int baseHP = 3;

Loading…
Cancel
Save