Merge pull request 'Combine Linux Compatibility with main branch' (#1) from master into linux_template

Reviewed-on: #1
linux_template
sigonasr2 2 years ago
commit 2dd5c990f8
  1. 3
      Faceball2030/Editor.cpp
  2. 1
      Faceball2030/Editor.h
  3. BIN
      Faceball2030/assets/enemies/IShoot.png
  4. 11
      Faceball2030/assets/enemies/IShoot2.mtl
  5. 1016
      Faceball2030/assets/enemies/IShoot2.obj
  6. BIN
      Faceball2030/assets/enemies/IShoot2.png
  7. BIN
      Faceball2030/assets/enemies/IShoot2.wings
  8. BIN
      Faceball2030/assets/enemies/IShoot2.xcf
  9. BIN
      Faceball2030/assets/enemies/sphere1_auv.png
  10. 2
      Faceball2030/assets/map/map1.map
  11. 78
      Faceball2030/assets/map/map3.map
  12. 20
      Faceball2030/assets/worldSkyBox.mtl
  13. 207
      Faceball2030/assets/worldSkyBox.obj
  14. BIN
      Faceball2030/assets/worldSkyBox.png
  15. 292
      Faceball2030/main.cpp
  16. 20
      Faceball2030/main.h
  17. 5
      TODO.txt

@ -295,7 +295,8 @@ void Editor::OnTextEntryComplete(const std::string& sText) {
MAP_SIZE = { (int)map[0].size(),(int)map.size() };
}
else {
reEnableTextEntry = true;
game->TextEntryEnable(false);
promptState = PromptState::NONE;
}
}break;
case PromptState::ENTER_WIDTH: {

@ -28,6 +28,7 @@ enum EnemyID {
ISHOOT2,
SHOOTME_ARMOR,
ISHOOT_MAP,
ISHOOT2_SPEED,
SONAR,
POWERUP_ARMOR = 56,
POWERUP_SPEED = 57,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

@ -0,0 +1,11 @@
# Exported from Wings 3D 2.2.9
newmtl sphere1_auv
Ns 19.999999999999996
d 1.0
illum 2
Kd 1.0 1.0 1.0
Ka 0.0 0.0 0.0
Ks 0.19 0.19 0.19
Ke 0.0 0.0 0.0
map_Kd sphere1_auv.png

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -32,7 +32,7 @@
8351
8197
8595
8198
7958
273
8196
8195

@ -1,27 +1,51 @@
5
5
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
7
7
17193
8202
24586
424
8202
25370
16924
1221
8201
8204
8597
8201
8204
17221
8197
8195
8198
837
24579
8198
837
8721
8202
8202
8192
8202
8202
25444
8197
11
8204
24581
9
8204
8197
8197
8351
8199
25381
8195
8198
8197
9027
24986
8202
8194
8746
24586
278

@ -0,0 +1,20 @@
# Exported from Wings 3D 2.2.9
newmtl Cylinder1_auv
Ns 19.999999999999996
d 1.0
illum 2
Kd 1.0 1.0 1.0
Ka 0.0 0.0 0.0
Ks 0.19 0.19 0.19
Ke 0.0 0.0 0.0
map_Kd Cylinder1_auv.png
newmtl default
Ns 19.999999999999996
d 1.0
illum 2
Kd 0.7898538076923077 0.8133333333333334 0.6940444444444445
Ka 0.0 0.0 0.0
Ks 0.1689853807692308 0.17133333333333334 0.15940444444444446
Ke 0.0 0.0 0.0

@ -0,0 +1,207 @@
# Exported from Wings 3D 2.2.9
mtllib worldSkyBox.mtl
o Cylinder1
#64 vertices, 64 faces
v 1.00000000 20.00000000 0.0000000e+0
v 0.98078528 20.00000000 0.19509032
v 0.92387953 20.00000000 0.38268343
v 0.83146961 20.00000000 0.55557023
v 0.70710678 20.00000000 0.70710678
v 0.55557023 20.00000000 0.83146961
v 0.38268343 20.00000000 0.92387953
v 0.19509032 20.00000000 0.98078528
v 6.1232340e-17 20.00000000 1.00000000
v -0.19509032 20.00000000 0.98078528
v -0.38268343 20.00000000 0.92387953
v -0.55557023 20.00000000 0.83146961
v -0.70710678 20.00000000 0.70710678
v -0.83146961 20.00000000 0.55557023
v -0.92387953 20.00000000 0.38268343
v -0.98078528 20.00000000 0.19509032
v -1.00000000 20.00000000 1.2246468e-16
v -0.98078528 20.00000000 -0.19509032
v -0.92387953 20.00000000 -0.38268343
v -0.83146961 20.00000000 -0.55557023
v -0.70710678 20.00000000 -0.70710678
v -0.55557023 20.00000000 -0.83146961
v -0.38268343 20.00000000 -0.92387953
v -0.19509032 20.00000000 -0.98078528
v -1.8369702e-16 20.00000000 -1.00000000
v 0.19509032 20.00000000 -0.98078528
v 0.38268343 20.00000000 -0.92387953
v 0.55557023 20.00000000 -0.83146961
v 0.70710678 20.00000000 -0.70710678
v 0.83146961 20.00000000 -0.55557023
v 0.92387953 20.00000000 -0.38268343
v 0.98078528 20.00000000 -0.19509032
v 1.00000000 0.0000000e+0 0.0000000e+0
v 0.98078528 0.0000000e+0 0.19509032
v 0.92387953 0.0000000e+0 0.38268343
v 0.83146961 0.0000000e+0 0.55557023
v 0.70710678 0.0000000e+0 0.70710678
v 0.55557023 0.0000000e+0 0.83146961
v 0.38268343 0.0000000e+0 0.92387953
v 0.19509032 0.0000000e+0 0.98078528
v 6.1232340e-17 0.0000000e+0 1.00000000
v -0.19509032 0.0000000e+0 0.98078528
v -0.38268343 0.0000000e+0 0.92387953
v -0.55557023 0.0000000e+0 0.83146961
v -0.70710678 0.0000000e+0 0.70710678
v -0.83146961 0.0000000e+0 0.55557023
v -0.92387953 0.0000000e+0 0.38268343
v -0.98078528 0.0000000e+0 0.19509032
v -1.00000000 0.0000000e+0 1.2246468e-16
v -0.98078528 0.0000000e+0 -0.19509032
v -0.92387953 0.0000000e+0 -0.38268343
v -0.83146961 0.0000000e+0 -0.55557023
v -0.70710678 0.0000000e+0 -0.70710678
v -0.55557023 0.0000000e+0 -0.83146961
v -0.38268343 0.0000000e+0 -0.92387953
v -0.19509032 0.0000000e+0 -0.98078528
v -1.8369702e-16 0.0000000e+0 -1.00000000
v 0.19509032 0.0000000e+0 -0.98078528
v 0.38268343 0.0000000e+0 -0.92387953
v 0.55557023 0.0000000e+0 -0.83146961
v 0.70710678 0.0000000e+0 -0.70710678
v 0.83146961 0.0000000e+0 -0.55557023
v 0.92387953 0.0000000e+0 -0.38268343
v 0.98078528 0.0000000e+0 -0.19509032
vt 0.0000000e+0 1.00000000
vt 2.2648550e-14 1.1657342e-15
vt 9.8017140e-3 1.00000000
vt 9.8017140e-3 7.2164497e-16
vt 1.9603428e-2 1.00000000
vt 1.9603428e-2 4.4408921e-16
vt 2.9405142e-2 1.00000000
vt 2.9405142e-2 2.2204460e-16
vt 3.9206856e-2 1.00000000
vt 3.9206856e-2 0.0000000e+0
vt 4.9008570e-2 1.00000000
vt 4.9008570e-2 0.0000000e+0
vt 5.8810284e-2 1.00000000
vt 5.8810284e-2 0.0000000e+0
vt 6.8611998e-2 1.00000000
vt 6.8611998e-2 2.2204460e-16
vt 7.8413712e-2 1.00000000
vt 7.8413712e-2 1.00000000
vt 7.8413712e-2 3.8857806e-16
vt 7.8413712e-2 2.6645353e-15
vt 8.8215426e-2 1.00000000
vt 8.8215426e-2 2.0539126e-15
vt 9.8017140e-2 1.00000000
vt 9.8017140e-2 1.5543122e-15
vt 0.10781885 1.00000000
vt 0.10781885 9.9920072e-16
vt 0.11762057 1.00000000
vt 0.11762057 5.5511151e-16
vt 0.12742228 1.00000000
vt 0.12742228 3.8857806e-16
vt 0.13722400 1.00000000
vt 0.13722400 2.2204460e-16
vt 0.14702571 1.00000000
vt 0.14702571 0.0000000e+0
vt 0.15682742 1.00000000
vt 0.15682742 0.0000000e+0
vt 0.15682742 1.00000000
vt 0.15682742 1.6653345e-16
vt 0.16662914 1.00000000
vt 0.16662914 0.0000000e+0
vt 0.17643085 1.00000000
vt 0.17643085 0.0000000e+0
vt 0.18623257 1.00000000
vt 0.18623257 0.0000000e+0
vt 0.19603428 1.00000000
vt 0.19603428 0.0000000e+0
vt 0.20583599 1.00000000
vt 0.20583599 2.7755576e-16
vt 0.21563771 1.00000000
vt 0.21563771 5.5511151e-16
vt 0.22543942 1.00000000
vt 0.22543942 8.8817842e-16
vt 0.23524114 1.00000000
vt 0.23524114 1.4432899e-15
vt 0.23524114 3.8857806e-16
vt 0.23524114 1.00000000
vt 0.24504285 2.2204460e-16
vt 0.24504285 1.00000000
vt 0.25484456 0.0000000e+0
vt 0.25484456 1.00000000
vt 0.26464628 0.0000000e+0
vt 0.26464628 1.00000000
vt 0.27444799 0.0000000e+0
vt 0.27444799 1.00000000
vt 0.28424971 2.2204460e-16
vt 0.28424971 1.00000000
vt 0.29405142 3.8857806e-16
vt 0.29405142 1.00000000
vt 0.30385314 7.2164497e-16
vt 0.30385314 1.00000000
vt 0.31365485 3.8857806e-16
vt 0.31365485 1.00000000
g Cylinder1_Cylinder1_auv
usemtl Cylinder1_auv
s 1
f 1/64/ 33/63/ 32/66/
f 2/62/ 33/63/ 1/64/
f 2/62/ 35/59/ 34/61/
f 3/60/ 35/59/ 2/62/
f 4/58/ 35/59/ 3/60/
f 4/58/ 37/55/ 36/57/
f 5/56/ 37/55/ 4/58/
f 6/33/ 37/36/ 5/35/
f 6/33/ 39/32/ 38/34/
f 7/31/ 39/32/ 6/33/
f 8/29/ 39/32/ 7/31/
f 8/29/ 41/28/ 40/30/
f 9/27/ 41/28/ 8/29/
f 10/25/ 41/28/ 9/27/
f 10/25/ 43/24/ 42/26/
f 11/23/ 43/24/ 10/25/
f 12/21/ 43/24/ 11/23/
f 12/21/ 45/20/ 44/22/
f 13/18/ 45/20/ 12/21/
f 14/51/ 45/54/ 13/53/
f 14/51/ 47/50/ 46/52/
f 15/49/ 47/50/ 14/51/
f 16/47/ 47/50/ 15/49/
f 16/47/ 49/46/ 48/48/
f 17/45/ 49/46/ 16/47/
f 18/43/ 49/46/ 17/45/
f 18/43/ 51/42/ 50/44/
f 19/41/ 51/42/ 18/43/
f 20/39/ 51/42/ 19/41/
f 20/39/ 53/38/ 52/40/
f 21/37/ 53/38/ 20/39/
f 22/15/ 53/19/ 21/17/
f 22/15/ 55/14/ 54/16/
f 23/13/ 55/14/ 22/15/
f 24/11/ 55/14/ 23/13/
f 24/11/ 57/10/ 56/12/
f 25/9/ 57/10/ 24/11/
f 26/7/ 57/10/ 25/9/
f 26/7/ 59/6/ 58/8/
f 27/5/ 59/6/ 26/7/
f 28/3/ 59/6/ 27/5/
f 28/3/ 61/2/ 60/4/
f 29/1/ 61/2/ 28/3/
f 30/70/ 61/71/ 29/72/
f 30/70/ 63/67/ 62/69/
f 31/68/ 63/67/ 30/70/
f 32/66/ 33/63/ 64/65/
f 32/66/ 63/67/ 31/68/
f 34/61/ 33/63/ 2/62/
f 36/57/ 35/59/ 4/58/
f 38/34/ 37/36/ 6/33/
f 40/30/ 39/32/ 8/29/
f 42/26/ 41/28/ 10/25/
f 44/22/ 43/24/ 12/21/
f 46/52/ 45/54/ 14/51/
f 48/48/ 47/50/ 16/47/
f 50/44/ 49/46/ 18/43/
f 52/40/ 51/42/ 20/39/
f 54/16/ 53/19/ 22/15/
f 56/12/ 55/14/ 24/11/
f 58/8/ 57/10/ 26/7/
f 60/4/ 59/6/ 28/3/
f 62/69/ 61/71/ 30/70/
f 64/65/ 63/67/ 32/66/

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

@ -66,7 +66,7 @@ bool Enemy::CanShoot() {
void Enemy::ShootBullet(int myIndex) {
fireDelay = game->enemyData[GetID()].fireDelay;
game->bullets.push_back({ game->bullet, {pos.x,pos.y+0.15f,pos.z},rot,0.2f,{std::cosf(rot) * game->shotSpd,std::sinf(rot) * game->shotSpd }, YELLOW,false,GetID(),myIndex,blinking});
game->bullets.push_back({ game->bullet, {pos.x,pos.y+0.15f,pos.z},rot,0.2f,1,true,{std::cosf(rot) * game->shotSpd,std::sinf(rot) * game->shotSpd }, YELLOW,false,GetID(),myIndex,blinking});
}
void Enemy::ReloadBullet(float fElapsedTime) {
@ -94,6 +94,7 @@ bool Enemy::isExplosive() {
void Enemy::setExploded(bool exploded) {
this->exploded = exploded;
game->RegenerateMinimap();
}
Enemy Enemy::freshCopy(bool randomizeLoc){
@ -216,6 +217,11 @@ bool Enemy::Update(float fElapsedTime) {
}
}
}
else
if (fElapsedTime > 3/120.f) {
mesh.tris.clear();
return false;
}
}
return true;
}
@ -237,6 +243,9 @@ void Enemy::OnDeathEvent() {
if (game->enemyData[id].powerupDrop != PowerupType::NONE) {
game->SpawnPowerup(game->enemyData[id].powerupDrop, pos);
}
if (game->PlayerHasMapUpgrade()){
game->RegenerateMinimap();
}
}
vf2d FaceBall::GetPlayerPos() {
@ -254,8 +263,10 @@ void FaceBall::InitializeEnemyData() {
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,0.5,2,1,0.2f,true };
enemyData[SHOOTME2] = { "SHOOTME2",enemy_ShootMe2,YELLOW,1,1,PI / 6,2,1,0.35f,true };
enemyData[ISHOOT] = { "ISHOOT",enemy_IShoot,YELLOW,1,1,0.5,2,3,0.4f,true };
enemyData[ISHOOT2] = { "ISHOOT2",enemy_IShoot2,YELLOW,1,1,PI / 6,2,1,0.35f,true };
enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,0.5,2,1,0.3f,true,PowerupType::ARMOR,true };
enemyData[ISHOOT_MAP] = { "ISHOOT",enemy_IShoot,YELLOW,7,1,0.5,2,2,0.3f,true,PowerupType::MAP,true };
enemyData[ISHOOT2_SPEED] = { "ISHOOT2",enemy_IShoot2,YELLOW,6,1,PI / 6,2,1,0.35f,true,PowerupType::SPEED,true };
enemyData[SONAR] = { "Sonar",enemy_Sonar,RED,5,1,PI / 8,2,1 };
enemyData[COIN] = { "Coin",undefined,BLUE };
enemyData[POWERUP_ARMOR] = { "Armor",undefined,{96,0,96} };
@ -424,8 +435,65 @@ void FaceBall::LoadLevel(int level)
walls = { mapWalls };
MapWallsObjectIndex = objects.size()-1;
objects.push_back({ mapFloor,{0,0,0},0,0 });
objects.push_back({ worldSkyBox,{MAP_SIZE.x/2.f,0,MAP_SIZE.y/2.f},0,0,std::max(float(MAP_SIZE.x),float(MAP_SIZE.y))*2,false });
//objects.push_back({ game->mapExit,{(float)exitCoords.x+0.5f,0,(float)exitCoords.y+0.5f},0,0.4f });
exit = { game->mapExit,{(float)exitCoords.x + 0.5f,0.02f,(float)exitCoords.y + 0.5f},0,0.4f };
RegenerateMinimap();
}
void FaceBall::RegenerateMinimap(){
vf2d mapCenter = {float(ScreenWidth()-364),float(164)};
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<MAP_VISIBILITY){
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,Pixel{255,255,255,transparency});
}
if (square.wallS){
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,Pixel{255,255,255,transparency});
}
if (square.wallW){
DrawLine(squareLoc,squareLoc+vf2d{0,1}*minimapGridSize,Pixel{255,255,255,transparency});
}
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*(1-(float(dist)/MAP_VISIBILITY)));
}
}
}
}
} catch (std::out_of_range const& exc) {
std::cout << exc.what() << '\n';
}
}
}
}
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();
}
bool FaceBall::CheckCollision(vec3d movementVector,vf2d pos,float radius){
@ -850,23 +918,32 @@ void FaceBall::RenderBulletMesh(mat4x4& matView, std::vector<Triangle>& vecTrian
void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRaster, Object&o,bool translucent) {
for (auto& tri : o.mesh.tris) {
if (translucent&&tri.tex != exit_wall_tex && tri.tex != bullet_tex ||!translucent&&(tri.tex==exit_wall_tex || tri.tex == bullet_tex)) { continue; }
Triangle triProjected, triTransformed, triViewed;
Triangle triScaled,triProjected, triTransformed, triViewed;
mat4x4 localMat = Matrix_MakeIdentity();
mat4x4 rotMat = Matrix_MakeRotationY(o.rot);
localMat = Matrix_MultiplyMatrix(localMat, rotMat);
mat4x4 matTrans = Matrix_MakeTranslation(o.pos.x, o.pos.y, o.pos.z);
localMat = Matrix_MultiplyMatrix(localMat, matTrans);
triTransformed.p[0] = Matrix_MultiplyVector(localMat, tri.p[0]);
triTransformed.p[1] = Matrix_MultiplyVector(localMat, tri.p[1]);
triTransformed.p[2] = Matrix_MultiplyVector(localMat, tri.p[2]);
triTransformed.uv[0] = tri.uv[0];
triTransformed.uv[1] = tri.uv[1];
triTransformed.uv[2] = tri.uv[2];
triTransformed.col[0] = tri.col[0];
triTransformed.col[1] = tri.col[1];
triTransformed.col[2] = tri.col[2];
triTransformed.tex = tri.tex;
for (int i = 0; i < 3; i++) {
triScaled.p[i].x = tri.p[i].x*o.scale;
triScaled.p[i].y = tri.p[i].y * o.scale;
triScaled.p[i].z = tri.p[i].z * o.scale;
triScaled.uv[i] = tri.uv[i];
triScaled.col[i] = tri.col[i];
}
triScaled.tex = tri.tex;
triTransformed.p[0] = Matrix_MultiplyVector(localMat, triScaled.p[0]);
triTransformed.p[1] = Matrix_MultiplyVector(localMat, triScaled.p[1]);
triTransformed.p[2] = Matrix_MultiplyVector(localMat, triScaled.p[2]);
triTransformed.uv[0] = triScaled.uv[0];
triTransformed.uv[1] = triScaled.uv[1];
triTransformed.uv[2] = triScaled.uv[2];
triTransformed.col[0] = triScaled.col[0];
triTransformed.col[1] = triScaled.col[1];
triTransformed.col[2] = triScaled.col[2];
triTransformed.tex = triScaled.tex;
vec3d normal, line1, line2;
line1 = Vector_Sub(triTransformed.p[1], triTransformed.p[0]);
@ -877,7 +954,7 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
vec3d vCameraRay = Vector_Sub(triTransformed.p[0], freeRoam ? freeRoamCamera : player.GetPos());
if (Vector_DotProduct(normal, vCameraRay) < 0) {
if (Vector_DotProduct(normal, vCameraRay) < 0||!o.affectedByLighting) {
vec3d light_dir = Vector_Mul(vLookDir, -1);
light_dir = Vector_Normalise(light_dir);
@ -889,9 +966,11 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
triViewed.uv[0] = triTransformed.uv[0];
triViewed.uv[1] = triTransformed.uv[1];
triViewed.uv[2] = triTransformed.uv[2];
triViewed.col[0] = Pixel(triTransformed.col[0].r * dp * dp, triTransformed.col[0].g * dp * dp, triTransformed.col[0].b * dp * dp);
triViewed.col[1] = Pixel(triTransformed.col[1].r * dp * dp, triTransformed.col[1].g * dp * dp, triTransformed.col[1].b * dp * dp);
triViewed.col[2] = Pixel(triTransformed.col[2].r * dp * dp, triTransformed.col[2].g * dp * dp, triTransformed.col[2].b * dp * dp);
if (o.affectedByLighting) {
triViewed.col[0] = Pixel(triTransformed.col[0].r * dp * dp, triTransformed.col[0].g * dp * dp, triTransformed.col[0].b * dp * dp);
triViewed.col[1] = Pixel(triTransformed.col[1].r * dp * dp, triTransformed.col[1].g * dp * dp, triTransformed.col[1].b * dp * dp);
triViewed.col[2] = Pixel(triTransformed.col[2].r * dp * dp, triTransformed.col[2].g * dp * dp, triTransformed.col[2].b * dp * dp);
}
Pixel originalCol[3] = { triViewed.col[0],triViewed.col[1],triViewed.col[2] };
float dist = std::sqrtf(std::powf((freeRoam ? freeRoamCamera : player.GetPos()).x - triTransformed.p[0].x, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).y - triTransformed.p[0].y, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).z - triTransformed.p[0].z, 2));
float dist2 = std::sqrtf(std::powf((freeRoam ? freeRoamCamera : player.GetPos()).x - triTransformed.p[1].x, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).y - triTransformed.p[1].y, 2) + std::powf((freeRoam ? freeRoamCamera : player.GetPos()).z - triTransformed.p[1].z, 2));
@ -899,22 +978,31 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
float colorMult = dist > 5 * PI / 3 ? 0 : std::sinf(0.3 * dist + PI / 2);
float colorMult2 = dist2 > 5 * PI / 3 ? 0 : std::sinf(0.3 * dist2 + PI / 2);
float colorMult3 = dist3 > 5 * PI / 3 ? 0 : std::sinf(0.3 * dist3 + PI / 2);
triViewed.col[0] = Pixel(triViewed.col[0].r * colorMult, triViewed.col[0].g * colorMult, triViewed.col[0].b * colorMult);
triViewed.col[1] = Pixel(triViewed.col[1].r * colorMult2, triViewed.col[1].g * colorMult2, triViewed.col[1].b * colorMult2);
triViewed.col[2] = Pixel(triViewed.col[2].r * colorMult3, triViewed.col[2].g * colorMult3, triViewed.col[2].b * colorMult3);
if (o.affectedByLighting) {
triViewed.col[0] = Pixel(triViewed.col[0].r * colorMult, triViewed.col[0].g * colorMult, triViewed.col[0].b * colorMult);
triViewed.col[1] = Pixel(triViewed.col[1].r * colorMult2, triViewed.col[1].g * colorMult2, triViewed.col[1].b * colorMult2);
triViewed.col[2] = Pixel(triViewed.col[2].r * colorMult3, triViewed.col[2].g * colorMult3, triViewed.col[2].b * colorMult3);
}
if (!o.affectedByLighting) {
triViewed.col[0] = originalCol[0];
triViewed.col[1] = originalCol[1];
triViewed.col[2] = originalCol[2];
}
triViewed.tex = triTransformed.tex;
for (Bullet& b : bullets) {
float dist = std::sqrtf(std::powf(b.pos.x - triTransformed.p[0].x, 2) + std::powf(b.pos.y - triTransformed.p[0].y, 2) + std::powf(b.pos.z - triTransformed.p[0].z, 2));
float dist2 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[1].x, 2) + std::powf(b.pos.y - triTransformed.p[1].y, 2) + std::powf(b.pos.z - triTransformed.p[1].z, 2));
float dist3 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[2].x, 2) + std::powf(b.pos.y - triTransformed.p[2].y, 2) + std::powf(b.pos.z - triTransformed.p[2].z, 2));
float colorMult = (dist < 2 ? std::sinf(0.75 * dist + PI / 2) * 4 :1);
float colorMult2 = (dist2 < 2 ? std::sinf(0.75 * dist2 + PI / 2) * 4 : 1);
float colorMult3 = (dist3 < 2 ? std::sinf(0.75 * dist3 + PI / 2) * 4 : 1);
Pixel lightCol = b.col / 2 + Pixel{ 128, 128, 128 };
if (dist < 2) {triViewed.col[0] = Pixel(std::min(255, std::max((int)originalCol[0].r, (int)(originalCol[0].r * colorMult / float(255.f/lightCol.r)))), std::min(255, std::max((int)originalCol[0].g, (int)(originalCol[0].g * colorMult / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[0].b, (int)(originalCol[0].b * colorMult / float(255.f / lightCol.b)))));}
if (dist2 < 2) {triViewed.col[1] = Pixel(std::min(255, std::max((int)originalCol[1].r, (int)(originalCol[1].r * colorMult2 / float(255.f / lightCol.r)))), std::min(255, std::max((int)originalCol[1].g, (int)(originalCol[1].g * colorMult2 / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[1].b, (int)(originalCol[1].b * colorMult2 / float(255.f / lightCol.b)))));}
if (dist3 < 2) {triViewed.col[2] = Pixel(std::min(255, std::max((int)originalCol[2].r, (int)(originalCol[2].r * colorMult3 / float(255.f / lightCol.r)))), std::min(255, std::max((int)originalCol[2].g, (int)(originalCol[2].g * colorMult3 / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[2].b, (int)(originalCol[2].b * colorMult3 / float(255.f / lightCol.b)))));}
if (o.affectedByLighting) {
for (Bullet& b : bullets) {
float dist = std::sqrtf(std::powf(b.pos.x - triTransformed.p[0].x, 2) + std::powf(b.pos.y - triTransformed.p[0].y, 2) + std::powf(b.pos.z - triTransformed.p[0].z, 2));
float dist2 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[1].x, 2) + std::powf(b.pos.y - triTransformed.p[1].y, 2) + std::powf(b.pos.z - triTransformed.p[1].z, 2));
float dist3 = std::sqrtf(std::powf(b.pos.x - triTransformed.p[2].x, 2) + std::powf(b.pos.y - triTransformed.p[2].y, 2) + std::powf(b.pos.z - triTransformed.p[2].z, 2));
float colorMult = (dist < 2 ? std::sinf(0.75 * dist + PI / 2) * 4 : 1);
float colorMult2 = (dist2 < 2 ? std::sinf(0.75 * dist2 + PI / 2) * 4 : 1);
float colorMult3 = (dist3 < 2 ? std::sinf(0.75 * dist3 + PI / 2) * 4 : 1);
Pixel lightCol = b.col / 2 + Pixel{ 128, 128, 128 };
if (dist < 2) { triViewed.col[0] = Pixel(std::min(255, std::max((int)originalCol[0].r, (int)(originalCol[0].r * colorMult / float(255.f / lightCol.r)))), std::min(255, std::max((int)originalCol[0].g, (int)(originalCol[0].g * colorMult / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[0].b, (int)(originalCol[0].b * colorMult / float(255.f / lightCol.b))))); }
if (dist2 < 2) { triViewed.col[1] = Pixel(std::min(255, std::max((int)originalCol[1].r, (int)(originalCol[1].r * colorMult2 / float(255.f / lightCol.r)))), std::min(255, std::max((int)originalCol[1].g, (int)(originalCol[1].g * colorMult2 / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[1].b, (int)(originalCol[1].b * colorMult2 / float(255.f / lightCol.b))))); }
if (dist3 < 2) { triViewed.col[2] = Pixel(std::min(255, std::max((int)originalCol[2].r, (int)(originalCol[2].r * colorMult3 / float(255.f / lightCol.r)))), std::min(255, std::max((int)originalCol[2].g, (int)(originalCol[2].g * colorMult3 / float(255.f / lightCol.g)))), std::min(255, std::max((int)originalCol[2].b, (int)(originalCol[2].b * colorMult3 / float(255.f / lightCol.b))))); }
}
}
//triViewed.col = triTransformed.col;
@ -1443,6 +1531,16 @@ void FaceBall::RenderWorld() {
}
}
int FaceBall::PlayerActiveShotCount(int playerNumb){
int count=0;
for (Bullet&b:bullets){
if (b.playerIndex==playerNumb){
count++;
}
}
return count;
}
void FaceBall::HandleKeys(float fElapsedTime) {
vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius()-0.00001f,moveSpd*fElapsedTime));
if (freeRoam) {
@ -1456,8 +1554,10 @@ void FaceBall::HandleKeys(float fElapsedTime) {
else {
pitch = 0;
if (GetMouse(0).bPressed) {
if (bullets.size() < shotLimit) {
bullets.push_back({ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true });
if (PlayerActiveShotCount(0) < shotLimit) {
Bullet newBullet={ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,1,true,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true };
newBullet.playerIndex=0;
bullets.push_back(newBullet);
}
}
}
@ -1638,6 +1738,10 @@ void FaceBall::HandleKeys(float fElapsedTime) {
if (GetKey(olc::F1).bPressed) {
freeRoam = !freeRoam;
}
if (vi2d{int(player.GetPos().x),int(player.GetPos().z)}!=playerRoundedCoords){
playerRoundedCoords = vi2d{int(player.GetPos().x),int(player.GetPos().z)};
RegenerateMinimap();
}
}
void FaceBall::AddWall(int dir, vi2d gridSquare) {
@ -1685,6 +1789,7 @@ bool FaceBall::OnUserCreate()
exit_wall_tex = new Decal(new Sprite("assets/exitwall.png"));
enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png"));
enemy_IShoot_tex = new Decal(new Sprite("assets/enemies/IShoot.png"));
enemy_IShoot2_tex = new Decal(new Sprite("assets/enemies/IShoot2.png"));
life4 = new Decal(new Sprite("assets/life4.png"));
life3 = new Decal(new Sprite("assets/life3.png"));
life2 = new Decal(new Sprite("assets/life2.png"));
@ -1694,22 +1799,28 @@ bool FaceBall::OnUserCreate()
powerup_tex = new Decal(new Sprite("assets/powerup.png"));
powerup2_tex = new Decal(new Sprite("assets/powerup2.png"));
powerups_tex = new Decal(new Sprite("assets/powerups.png"));
worldSkyBox_tex = new Decal(new Sprite("assets/worldSkyBox.png"));
enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex };
enemy_ShootMe2 = { "assets/enemies/ShootMe2.obj", enemy_ShootMe2_tex };
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex};
enemy_IShoot2 = { "assets/enemies/IShoot2.obj", enemy_IShoot2_tex};
bullet = { "assets/enemies/bullet.obj",bullet_tex };
powerup = { "assets/Powerup.obj",powerup_tex};
powerup2 = { "assets/Powerup2.obj",powerup2_tex };
mapExit = { "assets/Exit.obj",dot };
worldSkyBox = { "assets/worldSkyBox.obj",worldSkyBox_tex };
mapWalls.texture = wall_tex;
mapFloor.texture = floor_tex;
mapSpr=new Sprite(minimapGridSize.x*20,minimapGridSize.y*20);
mapDecal=new Decal(mapSpr);
InitializeEnemyData();
InitializePowerupColors();
LoadLevel(1);
LoadLevel(level);
return true;
}
@ -1812,20 +1923,23 @@ bool Bullet::Update(float fElapsedTime) {
}
void FaceBall::HurtPlayer(EnemyID id,int damage,bool blinking) {
if (shieldDuration >= 0) {
damage = 0;
}
hp = std::max(0, hp - damage);
if (hp <= 0) {
respawnTimer = 3.0f;
}
lastHitBy = id;
lastHitByBlinking = blinking;
if (shieldDuration < 0) {
screenCol = enemyData[lastHitBy].col;
}
else {
screenCol = WHITE;
if (respawnTimer<=0.0f){
if (shieldDuration >= 0) {
damage = 0;
}
hp = std::max(0, hp - damage);
if (hp <= 0) {
RegenerateMinimap();
respawnTimer = 3.0f;
}
lastHitBy = id;
lastHitByBlinking = blinking;
if (shieldDuration < 0) {
screenCol = enemyData[lastHitBy].col;
}
else {
screenCol = WHITE;
}
}
}
@ -1948,6 +2062,7 @@ void FaceBall::RenderHud(float fElapsedTime) {
hudShakeAmt = std::sinf(40 * hudShakeTime);
hudAdjustment.x += hudShakeAmt * 2;
hudAdjustment.y += hudShakeAmt * 4;
hudOffset += hudShakeAmt * 2;
}
vf2d hudLoc = { hudAdjustment.x + (hp>0?hudOffset:0),hudAdjustment.y};
if (hp > 0) {
@ -1969,7 +2084,12 @@ void FaceBall::RenderHud(float fElapsedTime) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
if (x != 0 && y != 0) {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(hudDisplayText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(hudDisplayText).y * 4) + 18 } + vf2d{ float(x),float(y) }, hudDisplayText, DARK_BLUE, { 4,4 });
if (lookingAtText != "") {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(lookingAtText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(lookingAtText).y * 4) + 18 } + vf2d{ float(x),float(y) }, lookingAtText, DARK_BLUE, { 4,4 });
}
else {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(hudDisplayText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(hudDisplayText).y * 4) + 18 } + vf2d{ float(x),float(y) }, hudDisplayText, DARK_BLUE, { 4,4 });
}
}
}
}
@ -1981,7 +2101,12 @@ void FaceBall::RenderHud(float fElapsedTime) {
}
}
DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(std::to_string(score)).x * 4 / 2) + 32,(float)(36 - GetTextSizeProp(std::to_string(score)).y * 4) + 18 } + hudAdjustment, std::to_string(score), { 192,96,96 }, { 4,4 });
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 });
if (lookingAtText != "") {
DrawStringDecal(vf2d{ hudOffset + float(ScreenWidth() / 2 - GetTextSize(lookingAtText).x / 2 * 4) + 32,float(ScreenHeight() - 128 - GetTextSize(lookingAtText).y * 4) + 18 }, lookingAtText, { 192,192,255 }, { 4,4 });
}
else {
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 });
}
DrawStringDecal({float(ScreenWidth()-128),24},std::to_string(wave2Enemies.size()));
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});
@ -1994,6 +2119,10 @@ void FaceBall::RenderHud(float fElapsedTime) {
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);
}
vf2d mapCenter = {float(ScreenWidth()-364),float(164)};
SetDrawTarget(nullptr);
DrawDecal(vf2d{mapCenter.x+hudOffset/2,mapCenter.y}-vf2d{2.5f,2.5f},dot,{5,5},GREEN);
DrawRotatedDecal({mapCenter.x+hudOffset/2,mapCenter.y},mapDecal,-fYaw-PI/2,vf2d{int(player.GetPos().x)+0.5f,int(player.GetPos().z)+0.5f}*minimapGridSize,{1,1});
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) });
@ -2118,14 +2247,15 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
}break;
}
}break;
case ISHOOT:
case ISHOOT:
case ISHOOT_MAP: {
e.rot += dat.rotSpd * fElapsedTime;
if (e.CanShoot()) {
e.ShootBullet(myIndex);
}
}break;
case ISHOOT2: {
case ISHOOT2:
case ISHOOT2_SPEED:{
switch (e.GetPhase()) {
case Phase::DEFAULT: {
vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime };
@ -2162,12 +2292,22 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
}
}break;
}
if (e.roundedCoords!=vi2d{int(e.pos.x),int(e.pos.z)}){
e.roundedCoords=vi2d{int(e.pos.x),int(e.pos.z)};
if (hasMapUpgrade){
RegenerateMinimap();
}
}
}
}
bool FaceBall::PlayerHasMapUpgrade(){
return hasMapUpgrade;
}
bool FaceBall::OnUserUpdate(float fElapsedTime)
{
fElapsedTime = std::min(0.01667f, fElapsedTime);
fElapsedTime = std::min(2/60.f, fElapsedTime);
gameTimer += fElapsedTime;
switch (mode) {
case GAME: {
@ -2191,6 +2331,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave2Enemies.erase(wave2Enemies.begin()+i);
RegenerateMinimap();
goto spawningDone;
}
}
@ -2202,6 +2343,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave3Enemies.erase(wave3Enemies.begin()+i);
RegenerateMinimap();
goto spawningDone;
}
}
@ -2217,6 +2359,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
!CheckPlayerCollision({0,0,0},{e.pos.x,e.pos.z},e.radius*6)){
enemies.push_back(e);
wave2Enemies.erase(wave2Enemies.begin()+i);
RegenerateMinimap();
break;
}
}
@ -2231,14 +2374,21 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
it++;
}
}
for (int i = 0; i < enemies.size(); i++) {
Enemy& e = enemies[i];
e.Update(fElapsedTime);
if (e.isLastHitTimerActive()) {
e.reduceLastHitTimer(fElapsedTime);
int counter = 0;
for (std::vector<Enemy>::iterator it = enemies.begin(); it != enemies.end();) {
Enemy& e = *it;
if (!e.Update(fElapsedTime)) {
it = enemies.erase(it);
}
if (stopDuration < 0) {
RunEnemyAI(e, fElapsedTime, i);
else {
if (e.isLastHitTimerActive()) {
e.reduceLastHitTimer(fElapsedTime);
}
if (stopDuration < 0) {
RunEnemyAI(e, fElapsedTime, counter);
}
it++;
counter++;
}
}
for (std::vector<Powerup>::iterator it = powerups.begin(); it != powerups.end();) {
@ -2283,6 +2433,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
}break;
case PowerupType::MAP: {
hasMapUpgrade = true;
RegenerateMinimap();
}break;
case PowerupType::COIN: {
AddScore(1000);
@ -2294,6 +2445,25 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
}
}
if (hp > 0) {
vf2d checkPos = {player.GetPos().x, player.GetPos().z};
lookingAtText = "";
while (true) {
if (checkPos.x<0 || checkPos.y<0 || checkPos.x>MAP_SIZE.x || checkPos.y>MAP_SIZE.y) break;
vf2d checkVec = { std::cosf(fYaw) * 0.1f,std::sinf(fYaw) * 0.1f };
if (CheckCollision({ checkVec.x,0,checkVec.y }, checkPos, 0.05f)) break;
checkPos.x += checkVec.x;
checkPos.y += checkVec.y;
for (Enemy&e : enemies) {
if (!e.isDead()) {
float dist = std::sqrtf(std::powf(checkPos.x - e.pos.x, 2) + std::powf(checkPos.y - e.pos.z, 2));
if (dist <= e.radius*2) {
lookingAtText = enemyData[e.GetID()].name;
goto afterPositionCheck;
}
}
}
}
afterPositionCheck:
HandleKeys(fElapsedTime);
RenderWorld();
}
@ -2408,7 +2578,7 @@ int FaceBall::EnemiesAlive(){
int main()
{
FaceBall demo;
if (demo.Construct(1280, 720, 2, 2))
if (demo.Construct(1280, 720, 2, 2, false, true))
demo.Start();
return 0;
}

@ -144,6 +144,8 @@ struct Object {
vec3d pos = { 0,0 };
float rot = 0;
float radius = 0.2f;
float scale = 1.f;
bool affectedByLighting = true;
};
struct Bullet : Object{
@ -153,6 +155,7 @@ struct Bullet : Object{
EnemyID shooterID;
int shooterIndex = -1;
bool shooterBlinking = false;
int playerIndex = -1;
bool Update(float fElapsedTime);
};
@ -214,6 +217,7 @@ struct Enemy : public Object {
bool flippedTriangles = false;
bool finishedAnimation = false;
float blinkingAmt = 1; //>0.5 the enemy is visible.
vi2d roundedCoords = vi2d{int(pos.x),int(pos.z)};
Enemy(EnemyID id, vec3d pos, float rot, float radius);
EnemyID GetID();
//Can set the damage to 0 to cause just a visual hit.
@ -261,12 +265,17 @@ class FaceBall : public PixelGameEngine
private:
Mesh mapWalls,mapFloor,enemy_ShootMe,undefined,
enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2,
enemy_IShoot;
enemy_IShoot,enemy_IShoot2,worldSkyBox;
Sprite*mapSpr;
Decal*mapDecal;
vf2d minimapGridSize={16,16};
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex,
*life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex,
*powerups_tex;
*powerups_tex,*enemy_IShoot2_tex, *worldSkyBox_tex;
vi2d exitCoords = { 0,0 };
std::vector<vf2d>knownGoodPositions;
std::vector<std::vector<MapSquare>>map;
@ -281,6 +290,7 @@ class FaceBall : public PixelGameEngine
double gameTimer = 0;
int lastPowerupCollidedWith = -1;
std::string hudDisplayText = "";
std::string lookingAtText = "";
float stopDuration = 0,shieldDuration=0,camoDuration=0;
bool hasMapUpgrade = false;
std::array<Pixel,14>colorCycle={
@ -333,8 +343,9 @@ 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;
int hp = baseHP;
int maxHP=hp;
@ -413,6 +424,7 @@ class FaceBall : public PixelGameEngine
int CheckPowerupCollision(vec3d movementVector, vf2d pos, float radius);
void ResetScore();
int EnemiesAlive();
int PlayerActiveShotCount(int playerNumb);
public:
vi2d MAP_SIZE;
float restingTriangleYDepth = 0.f;
@ -431,4 +443,6 @@ class FaceBall : public PixelGameEngine
vf2d GetPlayerPos();
void AddScore(int score);
vf2d GetRandomizedSpawnPosition();
bool PlayerHasMapUpgrade();
void RegenerateMinimap();
};

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