|
|
|
@ -1757,7 +1757,6 @@ void FaceBall::RenderHud(float fElapsedTime) { |
|
|
|
|
hudOffsetAcc--; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SetDecalMode(DecalMode::NORMAL); |
|
|
|
|
if (hp <= 0) { |
|
|
|
|
FillRectDecal({ 0,0 }, { float(ScreenWidth()),float(ScreenHeight()) }); |
|
|
|
|
std::string topText = enemyData[lastHitBy].name + " SAYS"; |
|
|
|
@ -1775,10 +1774,14 @@ void FaceBall::RenderHud(float fElapsedTime) { |
|
|
|
|
hudAdjustment.y += hudShakeAmt * 4; |
|
|
|
|
} |
|
|
|
|
vf2d hudLoc = { hudAdjustment.x + (hp>0?hudOffset:0),hudAdjustment.y}; |
|
|
|
|
if (hp > 0) { |
|
|
|
|
SetDecalMode(DecalMode::ADDITIVE); |
|
|
|
|
} |
|
|
|
|
DrawWarpedDecal(hudmeter, { meter_ARMOR[0] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2,meter_ARMOR[1] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2,meter_ARMOR[2].lerp(meter_ARMOR[1],1 - float(armorUpgrades)/maxArmorUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2, meter_ARMOR[3].lerp(meter_ARMOR[0],1- float(armorUpgrades)/maxArmorUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2}); |
|
|
|
|
DrawWarpedDecal(hudmeter, { meter_SPEED[0] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)}/2, meter_SPEED[1] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2,meter_SPEED[2].lerp(meter_SPEED[1],1 - float(speedUpgrades) / maxSpeedUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)}/2, meter_SPEED[3].lerp(meter_SPEED[0],1-float(speedUpgrades) / maxSpeedUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2 }); |
|
|
|
|
DrawWarpedDecal(hudmeter, { meter_SHOTS[0] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2,meter_SHOTS[1] + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2,meter_SHOTS[2].lerp(meter_SHOTS[1],1 - float(shotsUpgrades) / maxShotsUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2, meter_SHOTS[3].lerp(meter_SHOTS[0],1-float(shotsUpgrades) / maxShotsUpgrades) + hudLoc + vf2d{float(hudmeter->sprite->width),float(hudmeter->sprite->height)} / 2}); |
|
|
|
|
DrawDecal(hudLoc, hud, { 1.05,1.05 }); |
|
|
|
|
SetDecalMode(DecalMode::NORMAL); |
|
|
|
|
DrawDecal(hudLoc + vf2d{ 704+32,56+18 }, life4, { 1,1 }, float(hp) / maxHP > 0.75f ? WHITE : VERY_DARK_GREEN); |
|
|
|
|
DrawDecal(hudLoc + vf2d{ 704 - 64+32,56+18 }, life3, { 1,1 }, float(hp) / maxHP > 0.34f && float(hp) / maxHP <= 0.75f ? WHITE : VERY_DARK_GREEN); |
|
|
|
|
DrawDecal(hudLoc + vf2d{ 704 - 128+32,56+18 }, life2, { 1,1 }, hp > 0 && float(hp) / maxHP <= 0.34f ? WHITE : VERY_DARK_GREEN); |
|
|
|
@ -1795,7 +1798,18 @@ void FaceBall::RenderHud(float fElapsedTime) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(hudDisplayText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(hudDisplayText).y * 4) + 18 }, hudDisplayText, { 192,192,255 }, { 4,4 }); |
|
|
|
|
SetDecalMode(DecalMode::ADDITIVE); |
|
|
|
|
DrawDecal({ float(ScreenWidth() / 2 - crosshair->sprite->width / 2),float(ScreenHeight() / 2 - crosshair->sprite->height / 2) }, crosshair, { 1,1 }, {255,255,255,128}); |
|
|
|
|
if (stopDuration > 0) { |
|
|
|
|
DrawPartialDecal({ hudOffset + float(ScreenWidth() / 10 - 16), float(ScreenHeight() / 4 - 16 * 4) }, vf2d{ 32,32 }*4, powerups_tex, { 3 * 32,0 }, { 32,32 },stopDuration>7?WHITE:stopDuration>2?std::abs(std::sin(10*stopDuration))>0.65?WHITE:BLACK: std::abs(std::sin(30 * stopDuration)) > 0.75 ? WHITE : BLACK); |
|
|
|
|
} |
|
|
|
|
if (shieldDuration > 0) { |
|
|
|
|
DrawPartialDecal({ hudOffset + float(ScreenWidth() / 10 - 16), float(ScreenHeight() / 4 + ScreenHeight() / 4 * 1 - 16 * 4) }, vf2d{ 32,32 }*4, powerups_tex, { 4 * 32,0 }, { 32,32 }, shieldDuration > 7 ? WHITE : shieldDuration > 2 ? std::abs(std::sin(10 * shieldDuration)) > 0.65 ? WHITE : BLACK : std::abs(std::sin(30 * shieldDuration)) > 0.75 ? WHITE : BLACK); |
|
|
|
|
} |
|
|
|
|
if (camoDuration > 0) { |
|
|
|
|
DrawPartialDecal({ hudOffset + float(ScreenWidth() / 10 - 16), float(ScreenHeight() / 4 + ScreenHeight() / 4 * 2 - 16 * 4) }, vf2d{ 32,32 }*4, powerups_tex, { 5 * 32,0 }, { 32,32 },camoDuration>7?WHITE:camoDuration>2?std::abs(std::sin(10*camoDuration))>0.65?WHITE:BLACK: std::abs(std::sin(30 * camoDuration)) > 0.75 ? WHITE : BLACK); |
|
|
|
|
} |
|
|
|
|
SetDecalMode(DecalMode::NORMAL); |
|
|
|
|
} |
|
|
|
|
GradientFillRectDecal({ 0,0 }, vf2d{ (float)ScreenWidth()/2,(float)ScreenHeight()/2 }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime > 0.2f ? 64 : 0) }, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0) }); |
|
|
|
|
GradientFillRectDecal({ float(ScreenWidth()/2),0}, vf2d{(float)ScreenWidth() / 2,(float)ScreenHeight() / 2}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, { (uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime > 0.2f ? 64 : 0) }, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}, {(uint8_t)screenCol.r,(uint8_t)screenCol.g,(uint8_t)screenCol.b,(uint8_t)(hudShakeTime>0.2f?120:hudShakeTime>0?64:0)}); |
|
|
|
@ -2060,6 +2074,15 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) |
|
|
|
|
switch (mode) { |
|
|
|
|
case GAME: { |
|
|
|
|
hudDisplayText = ""; |
|
|
|
|
if (stopDuration > 0) { |
|
|
|
|
stopDuration -= fElapsedTime; |
|
|
|
|
} |
|
|
|
|
if (shieldDuration > 0) { |
|
|
|
|
shieldDuration -= fElapsedTime; |
|
|
|
|
} |
|
|
|
|
if (camoDuration > 0) { |
|
|
|
|
camoDuration -= fElapsedTime; |
|
|
|
|
} |
|
|
|
|
for (std::vector<Bullet>::iterator it = bullets.begin(); it != bullets.end();) { |
|
|
|
|
Bullet& b = *it; |
|
|
|
|
if (!b.Update(fElapsedTime)) { |
|
|
|
@ -2092,6 +2115,33 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) |
|
|
|
|
powerups[lastPowerupCollidedWith].opened = true; |
|
|
|
|
hudDisplayText = powerupData[powerups[lastPowerupCollidedWith].type].name; |
|
|
|
|
if (GetKey(F).bPressed) { |
|
|
|
|
Powerup& power = powerups[lastPowerupCollidedWith]; |
|
|
|
|
switch (power.type) { |
|
|
|
|
case PowerupType::ARMOR: { |
|
|
|
|
armorUpgrades++; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::SPEED: { |
|
|
|
|
speedUpgrades++; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::SHOTS: { |
|
|
|
|
shotsUpgrades++; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::STOP: { |
|
|
|
|
stopDuration = 20; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::SHIELD: { |
|
|
|
|
shieldDuration = 20; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::CAMO: { |
|
|
|
|
camoDuration = 20; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::MAP: { |
|
|
|
|
hasMapUpgrade = true; |
|
|
|
|
}break; |
|
|
|
|
case PowerupType::COIN: { |
|
|
|
|
score += 1000; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
powerups.erase(powerups.begin() + lastPowerupCollidedWith); |
|
|
|
|
lastPowerupCollidedWith = -1; |
|
|
|
|
} |
|
|
|
@ -2105,6 +2155,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) |
|
|
|
|
respawnTimer -= fElapsedTime; |
|
|
|
|
if (respawnTimer <= 0.0f) { |
|
|
|
|
lives--; |
|
|
|
|
hasMapUpgrade = false; |
|
|
|
|
if (lives > 0) { |
|
|
|
|
hp = maxHP; |
|
|
|
|
player.UpdatePos(spawnLoc); |
|
|
|
|