diff --git a/assets/clouds.png b/assets/clouds.png index 948eaf2..5061b7d 100644 Binary files a/assets/clouds.png and b/assets/clouds.png differ diff --git a/assets/fuelbar.png b/assets/fuelbar.png new file mode 100644 index 0000000..d959911 Binary files /dev/null and b/assets/fuelbar.png differ diff --git a/assets/fuelbar_meter.png b/assets/fuelbar_meter.png new file mode 100644 index 0000000..e0829d2 Binary files /dev/null and b/assets/fuelbar_meter.png differ diff --git a/assets/fuelmeter.png b/assets/fuelmeter.png new file mode 100644 index 0000000..8b11796 Binary files /dev/null and b/assets/fuelmeter.png differ diff --git a/src/Hamster.cpp b/src/Hamster.cpp index 118ed76..50819a8 100644 --- a/src/Hamster.cpp +++ b/src/Hamster.cpp @@ -147,8 +147,8 @@ void Hamster::UpdateHamsters(const float fElapsedTime){ h.lastSafeLocation=closestTile.value().first*16+8; } #pragma endregion - h.SetPos(h.lastSafeLocation.value()); } + h.SetPos(h.lastSafeLocation.value()); h.state=NORMAL; h.RemoveAllPowerups(); } @@ -216,7 +216,10 @@ void Hamster::DrawHamsters(TransformedView&tv){ } void Hamster::DrawOverlay(){ - if(GetPlayer().hamsterJet.has_value())GetPlayer().hamsterJet.value().DrawOverlay(); + if(GetPlayer().hamsterJet.has_value()){ + GetPlayer().hamsterJet.value().DrawOverlay(); + HamsterGame::Game().DrawDecal(vf2d{96.f,0.f}+HamsterGame::SCREEN_FRAME.size,HamsterGame::GetGFX("fuelmeter.png").Decal()); + } } const Animate2D::Frame&Hamster::GetCurrentAnimation()const{ diff --git a/src/HamsterGame.cpp b/src/HamsterGame.cpp index f2c4f48..092af73 100644 --- a/src/HamsterGame.cpp +++ b/src/HamsterGame.cpp @@ -50,6 +50,8 @@ void HamsterGame::LoadGraphics(){ _LoadImage("aimingTarget.png"); _LoadImage("fallometer.png"); _LoadImage("fallometer_outline.png"); + _LoadImage("fuelmeter.png"); + _LoadImage("fuelbar.png"); UpdateMatrixTexture(); } @@ -368,21 +370,40 @@ void HamsterGame::Apply3DTransform(std::vector&decals){ else if(decal.points==3){ GFX3D::triangle tri{{{decal.pos[0].x,decal.pos[0].y,decal.z[0],1.f},{decal.pos[1].x,decal.pos[1].y,decal.z[1],1.f},{decal.pos[2].x,decal.pos[2].y,decal.z[2],1.f}},{{decal.uv[0].x,decal.uv[0].y,0.f},{decal.uv[1].x,decal.uv[1].y,0.f},{decal.uv[2].x,decal.uv[2].y,0.f}},{decal.tint[0],decal.tint[1],decal.tint[2]}}; - renderer.Render({tri},decal.decal); + renderer.Render({tri},decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); + if(decal.z[0]>0.1f||decal.z[1]>0.1f||decal.z[2]>0.1f){ + tri.col[0]=tri.col[1]=tri.col[2]={0,0,0,uint8_t(util::lerp(0,160,(1/std::pow(decal.z[0]/10.f+1,4))))}; + tri.p[0].z=tri.p[1].z=tri.p[2].z=0.1f; + renderer.Render({tri},decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); + } }else if(decal.points==4){ GFX3D::triangle tri{{{decal.pos[0].x,decal.pos[0].y,decal.z[0],1.f},{decal.pos[1].x,decal.pos[1].y,decal.z[1],1.f},{decal.pos[2].x,decal.pos[2].y,decal.z[2],1.f}},{{decal.uv[0].x,decal.uv[0].y,0.f},{decal.uv[1].x,decal.uv[1].y,0.f},{decal.uv[2].x,decal.uv[2].y,0.f}},{decal.tint[0],decal.tint[1],decal.tint[2]}}; GFX3D::triangle tri2{{{decal.pos[0].x,decal.pos[0].y,decal.z[0],1.f},{decal.pos[2].x,decal.pos[2].y,decal.z[2],1.f},{decal.pos[3].x,decal.pos[3].y,decal.z[3],1.f}},{{decal.uv[0].x,decal.uv[0].y,0.f},{decal.uv[2].x,decal.uv[2].y,0.f},{decal.uv[3].x,decal.uv[3].y,0.f}},{decal.tint[0],decal.tint[2],decal.tint[3]}}; renderer.Render({tri,tri2},decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); + if(decal.decal!=GetGFX("dot.png").Decal()&&(decal.z[0]>0.1f||decal.z[1]>0.1f||decal.z[2]>0.1f||decal.z[3]>0.1f)){ + tri.col[0]=tri.col[1]=tri.col[2]=tri2.col[0]=tri2.col[1]=tri2.col[2]={0,0,0,uint8_t(util::lerp(0,160,(1/std::pow(decal.z[0]/10.f+1,4))))}; + tri.p[0].z=tri.p[1].z=tri.p[2].z=tri2.p[0].z=tri2.p[1].z=tri2.p[2].z=0.1f; + renderer.Render({tri,tri2},decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); + } }else{ std::vectortris; + std::vectorshadowTris; tris.reserve(decal.points/3); if(decal.structure!=DecalStructure::LIST)throw std::runtime_error{std::format("WARNING! Using triangle structure type {} is unsupported! Please only use DecalStructure::LIST!!",int(decal.structure))}; if(decal.points%3!=0)throw std::runtime_error{std::format("WARNING! Number of decal structure points is not a multiple of 3! Points provided: {}. THIS SHOULD NOT BE HAPPENING!",decal.points)}; for(int i{0};i0||decal.z[i+1]>0||decal.z[i+2]>0){ + tri.col[0]=tri.col[1]=tri.col[2]={0,0,0,uint8_t(util::lerp(0,160,(1/std::pow(decal.z[0]/10.f+1,4))))}; + tri.p[0].z=tri.p[1].z=tri.p[2].z=0.1f; + shadowTris.emplace_back(tri); + } + } + renderer.Render(tris,decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); + if(shadowTris.size()>0){ + renderer.Render(shadowTris,decal.decal,GFX3D::RENDER_TEXTURED|GFX3D::RENDER_DEPTH); } - renderer.Render(tris,decal.decal); } }