Temporary map sprite/decal re-rendering.

pull/1/head
sigonasr2 2 years ago
parent d3a918876c
commit 13b3e08d63
  1. BIN
      Faceball2030/assets/enemies/IShoot.png
  2. 18
      Faceball2030/main.cpp
  3. 3
      Faceball2030/main.h
  4. 5
      TODO.txt

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

@ -1694,6 +1694,9 @@ bool FaceBall::OnUserCreate()
mapWalls.texture = wall_tex; mapWalls.texture = wall_tex;
mapFloor.texture = floor_tex; mapFloor.texture = floor_tex;
mapSpr=new Sprite(128,128);
mapDecal=new Decal(mapSpr);
InitializeEnemyData(); InitializeEnemyData();
InitializePowerupColors(); InitializePowerupColors();
@ -1982,6 +1985,16 @@ void FaceBall::RenderHud(float fElapsedTime) {
if (camoDuration > 0) { 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); 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);
} }
vf2d mapCenter = {float(ScreenWidth()-364),float(164)};
mapSpr= new Sprite{128,128};
vf2d mapSprSize = {float(mapSpr->width),float(mapSpr->height)};
SetDrawTarget(mapSpr);
Clear(BLACK);
vf2d center = mapSprSize/2;
FillCircle(center,5,GREEN);
SetDrawTarget(nullptr);
mapDecal=new Decal(mapSpr);
DrawRotatedDecal(mapCenter-mapSprSize,mapDecal,-fYaw,mapSprSize/2);
SetDecalMode(DecalMode::NORMAL); 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({ 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) });
@ -2106,7 +2119,8 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
}break; }break;
} }
}break; }break;
case ISHOOT: { case ISHOOT:
case ISHOOT_MAP: {
e.rot += dat.rotSpd * fElapsedTime; e.rot += dat.rotSpd * fElapsedTime;
if (e.CanShoot()) { if (e.CanShoot()) {
e.ShootBullet(myIndex); e.ShootBullet(myIndex);
@ -2154,6 +2168,8 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
bool FaceBall::OnUserUpdate(float fElapsedTime) bool FaceBall::OnUserUpdate(float fElapsedTime)
{ {
delete mapSpr;
delete mapDecal;
fElapsedTime = std::min(0.01667f, fElapsedTime); fElapsedTime = std::min(0.01667f, fElapsedTime);
gameTimer += fElapsedTime; gameTimer += fElapsedTime;
switch (mode) { switch (mode) {

@ -263,6 +263,9 @@ class FaceBall : public PixelGameEngine
enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2, enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2,
enemy_IShoot; enemy_IShoot;
Sprite*mapSpr;
Decal*mapDecal;
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex, Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex, *enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex,
*life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex, *life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex,

@ -0,0 +1,5 @@
- Minimap
- Skybox
- Levels have distinguishing elements (skybox, walls, floor, fog color)
- Main Menu
- Sounds & Music
Loading…
Cancel
Save