Add in exit and exit walls.
This commit is contained in:
parent
0e091a856d
commit
8149d1110e
11
Faceball2030/assets/Exit.mtl
Normal file
11
Faceball2030/assets/Exit.mtl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 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 auvBG.png
|
||||||
|
|
BIN
Faceball2030/assets/Exit.wings
Normal file
BIN
Faceball2030/assets/Exit.wings
Normal file
Binary file not shown.
BIN
Faceball2030/assets/auvBG.png
Normal file
BIN
Faceball2030/assets/auvBG.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
Faceball2030/assets/exitwall.png
Normal file
BIN
Faceball2030/assets/exitwall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
Faceball2030/assets/hud.png
Normal file
BIN
Faceball2030/assets/hud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
BIN
Faceball2030/assets/hud.xcf
Normal file
BIN
Faceball2030/assets/hud.xcf
Normal file
Binary file not shown.
@ -8,7 +8,7 @@
|
|||||||
8202
|
8202
|
||||||
8200
|
8200
|
||||||
8204
|
8204
|
||||||
40969
|
40971
|
||||||
32776
|
32776
|
||||||
0
|
0
|
||||||
8194
|
8194
|
||||||
@ -16,15 +16,15 @@
|
|||||||
8202
|
8202
|
||||||
8198
|
8198
|
||||||
8197
|
8197
|
||||||
|
8351
|
||||||
8193
|
8193
|
||||||
8192
|
|
||||||
8198
|
8198
|
||||||
8617
|
8617
|
||||||
8200
|
8200
|
||||||
8202
|
8202
|
||||||
8202
|
8202
|
||||||
8198
|
8198
|
||||||
8195
|
8203
|
||||||
16662
|
16662
|
||||||
8207
|
8207
|
||||||
8195
|
8195
|
||||||
|
@ -87,16 +87,20 @@ void FaceBall::LoadLevel(int level)
|
|||||||
objects.clear();
|
objects.clear();
|
||||||
bullets.clear();
|
bullets.clear();
|
||||||
enemies.clear();
|
enemies.clear();
|
||||||
|
vi2d exitCoords = { 0,0 };
|
||||||
for (int y = 0; y < MAP_SIZE.y; y++) {
|
for (int y = 0; y < MAP_SIZE.y; y++) {
|
||||||
std::vector<MapSquare>row;
|
std::vector<MapSquare>row;
|
||||||
for (int x = 0; x < MAP_SIZE.x; x++) {
|
for (int x = 0; x < MAP_SIZE.x; x++) {
|
||||||
row.push_back({});
|
row.push_back({});
|
||||||
mapFloor.tris.push_back({ {{(float)x,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y}},{{0,0},{0,1},{1,0}},{WHITE,WHITE,WHITE} });
|
mapFloor.tris.push_back({ {{(float)x,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y}},{{0,0},{0,1},{1,0}},{WHITE,WHITE,WHITE}, floor_tex });
|
||||||
mapFloor.tris.push_back({ {{(float)x + 1,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y + 1}},{{1,0},{0,1},{1,1}},{WHITE,WHITE,WHITE} });
|
mapFloor.tris.push_back({ {{(float)x + 1,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y + 1}},{{1,0},{0,1},{1,1}},{WHITE,WHITE,WHITE}, floor_tex });
|
||||||
EnemyID id = mapData[y][x].enemyId;
|
EnemyID id = mapData[y][x].enemyId;
|
||||||
if (id>=SHOOTME&& id < COIN) {
|
if (id>=SHOOTME&& id < COIN) {
|
||||||
enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir-1)*PI/2,0.2f});
|
enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir-1)*PI/2,0.2f});
|
||||||
}
|
}
|
||||||
|
if (id == EXIT) {
|
||||||
|
exitCoords = { x,y };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
map.push_back(row);
|
map.push_back(row);
|
||||||
}
|
}
|
||||||
@ -117,25 +121,42 @@ void FaceBall::LoadLevel(int level)
|
|||||||
}
|
}
|
||||||
AddWall(wallData, { x,y });
|
AddWall(wallData, { x,y });
|
||||||
if (map[y][x].wallN != NULL) {
|
if (map[y][x].wallN != NULL) {
|
||||||
mapWalls.tris.push_back({ {{(float)x,1,(float)y},{(float)x,0,(float)y},{(float)x + 1,1,(float)y}},{{0,0},{0,1},{1,0}},{WHITE,WHITE,WHITE} });
|
Decal*exitWallTex = wall_tex;
|
||||||
mapWalls.tris.push_back({ {{(float)x,0,(float)y},{(float)x + 1,0,(float)y},{(float)x + 1,1,(float)y}},{{0,1},{1,1},{1,0}},{WHITE,WHITE,WHITE} });
|
if (vi2d{ x,y } == vi2d{exitCoords.x, exitCoords.y + 1}) {
|
||||||
|
exitWallTex = exit_wall_tex;
|
||||||
|
}
|
||||||
|
mapWalls.tris.push_back({ {{(float)x,1,(float)y},{(float)x,0,(float)y},{(float)x + 1,1,(float)y}},{{0,0},{0,1},{1,0}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
|
mapWalls.tris.push_back({ {{(float)x,0,(float)y},{(float)x + 1,0,(float)y},{(float)x + 1,1,(float)y}},{{0,1},{1,1},{1,0}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
}
|
}
|
||||||
if (map[y][x].wallS != NULL) {
|
if (map[y][x].wallS != NULL) {
|
||||||
mapWalls.tris.push_back({ {{(float)x + 1,1,(float)y + 1},{(float)x,0,(float)y + 1},{(float)x,1,(float)y + 1}},{{0,0},{1,1},{1,0}},{WHITE,WHITE,WHITE} });
|
Decal* exitWallTex = wall_tex;
|
||||||
mapWalls.tris.push_back({ {{(float)x + 1,1,(float)y + 1},{(float)x + 1,0,(float)y + 1},{(float)x,0,(float)y + 1}},{{0,0},{0,1},{1,1}},{WHITE,WHITE,WHITE} });
|
if (vi2d{ x,y } == vi2d{ exitCoords.x, exitCoords.y - 1 }) {
|
||||||
|
exitWallTex = exit_wall_tex;
|
||||||
|
}
|
||||||
|
mapWalls.tris.push_back({ {{(float)x + 1,1,(float)y + 1},{(float)x,0,(float)y + 1},{(float)x,1,(float)y + 1}},{{0,0},{1,1},{1,0}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
|
mapWalls.tris.push_back({ {{(float)x + 1,1,(float)y + 1},{(float)x + 1,0,(float)y + 1},{(float)x,0,(float)y + 1}},{{0,0},{0,1},{1,1}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
}
|
}
|
||||||
if (map[y][x].wallW != NULL) {
|
if (map[y][x].wallW != NULL) {
|
||||||
mapWalls.tris.push_back({ {{(float)x,1,(float)y},{(float)x,1,(float)y + 1}, {(float)x,0,(float)y + 1}},{{1,0},{0,0},{0,1}},{WHITE,WHITE,WHITE} });
|
Decal* exitWallTex = wall_tex;
|
||||||
mapWalls.tris.push_back({ {{(float)x,0,(float)y},{(float)x,1,(float)y}, {(float)x,0,(float)y + 1}}, {{1,1},{1,0},{0,1}},{WHITE,WHITE,WHITE} });
|
if (vi2d{ x,y } == vi2d{ exitCoords.x+1, exitCoords.y }) {
|
||||||
|
exitWallTex = exit_wall_tex;
|
||||||
|
}
|
||||||
|
mapWalls.tris.push_back({ {{(float)x,1,(float)y},{(float)x,1,(float)y + 1}, {(float)x,0,(float)y + 1}},{{1,0},{0,0},{0,1}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
|
mapWalls.tris.push_back({ {{(float)x,0,(float)y},{(float)x,1,(float)y}, {(float)x,0,(float)y + 1}}, {{1,1},{1,0},{0,1}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
}
|
}
|
||||||
if (map[y][x].wallE != NULL) {
|
if (map[y][x].wallE != NULL) {
|
||||||
mapWalls.tris.push_back({ {{(float)x + 1,0,(float)y + 1},{(float)x + 1,1,(float)y + 1},{(float)x + 1,1,(float)y}},{{1,1},{1,0},{0,0}},{WHITE,WHITE,WHITE} });
|
Decal* exitWallTex = wall_tex;
|
||||||
mapWalls.tris.push_back({ {{(float)x + 1,0,(float)y + 1} ,{(float)x + 1,1,(float)y},{(float)x + 1,0,(float)y}},{{1,1},{0,0},{0,1}},{WHITE,WHITE,WHITE} });
|
if (vi2d{ x,y } == vi2d{ exitCoords.x - 1, exitCoords.y }) {
|
||||||
|
exitWallTex = exit_wall_tex;
|
||||||
|
}
|
||||||
|
mapWalls.tris.push_back({ {{(float)x + 1,0,(float)y + 1},{(float)x + 1,1,(float)y + 1},{(float)x + 1,1,(float)y}},{{1,1},{1,0},{0,0}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
|
mapWalls.tris.push_back({ {{(float)x + 1,0,(float)y + 1} ,{(float)x + 1,1,(float)y},{(float)x + 1,0,(float)y}},{{1,1},{0,0},{0,1}},{WHITE,WHITE,WHITE}, exitWallTex });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objects.push_back({ mapWalls,{0,0},0,0 });
|
objects.push_back({ mapWalls,{0,0,0},0,0 });
|
||||||
objects.push_back({ mapFloor,{0,0},0,0 });
|
objects.push_back({ mapFloor,{0,0,0},0,0 });
|
||||||
|
objects.push_back({ game->mapExit,{(float)exitCoords.x+0.5f,0,(float)exitCoords.y+0.5f},0,0.4f });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FaceBall::CheckCollision(vec3d movementVector,vf2d pos,float radius){
|
bool FaceBall::CheckCollision(vec3d movementVector,vf2d pos,float radius){
|
||||||
@ -540,6 +561,7 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
|
|||||||
triTransformed.col[0] = tri.col[0];
|
triTransformed.col[0] = tri.col[0];
|
||||||
triTransformed.col[1] = tri.col[1];
|
triTransformed.col[1] = tri.col[1];
|
||||||
triTransformed.col[2] = tri.col[2];
|
triTransformed.col[2] = tri.col[2];
|
||||||
|
triTransformed.tex = tri.tex;
|
||||||
|
|
||||||
vec3d normal, line1, line2;
|
vec3d normal, line1, line2;
|
||||||
line1 = Vector_Sub(triTransformed.p[1], triTransformed.p[0]);
|
line1 = Vector_Sub(triTransformed.p[1], triTransformed.p[0]);
|
||||||
@ -575,6 +597,7 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
|
|||||||
triViewed.col[0] = Pixel(triViewed.col[0].r * colorMult, triViewed.col[0].g * colorMult, triViewed.col[0].b * colorMult);
|
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[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);
|
triViewed.col[2] = Pixel(triViewed.col[2].r * colorMult3, triViewed.col[2].g * colorMult3, triViewed.col[2].b * colorMult3);
|
||||||
|
triViewed.tex = triTransformed.tex;
|
||||||
|
|
||||||
for (Bullet& b : bullets) {
|
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 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));
|
||||||
@ -602,6 +625,7 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
|
|||||||
triProjected.col[0] = clipped[n].col[0];
|
triProjected.col[0] = clipped[n].col[0];
|
||||||
triProjected.col[1] = clipped[n].col[1];
|
triProjected.col[1] = clipped[n].col[1];
|
||||||
triProjected.col[2] = clipped[n].col[2];
|
triProjected.col[2] = clipped[n].col[2];
|
||||||
|
triProjected.tex = clipped[n].tex;
|
||||||
triProjected.uv[0] = clipped[n].uv[0];
|
triProjected.uv[0] = clipped[n].uv[0];
|
||||||
triProjected.uv[1] = clipped[n].uv[1];
|
triProjected.uv[1] = clipped[n].uv[1];
|
||||||
triProjected.uv[2] = clipped[n].uv[2];
|
triProjected.uv[2] = clipped[n].uv[2];
|
||||||
@ -640,7 +664,6 @@ void FaceBall::RenderMesh(mat4x4&matView,std::vector<Triangle>&vecTrianglesToRas
|
|||||||
triProjected.p[1].y *= 0.5f * (float)ScreenHeight();
|
triProjected.p[1].y *= 0.5f * (float)ScreenHeight();
|
||||||
triProjected.p[2].x *= 0.5f * (float)ScreenWidth();
|
triProjected.p[2].x *= 0.5f * (float)ScreenWidth();
|
||||||
triProjected.p[2].y *= 0.5f * (float)ScreenHeight();
|
triProjected.p[2].y *= 0.5f * (float)ScreenHeight();
|
||||||
triProjected.tex = o.mesh.texture;
|
|
||||||
|
|
||||||
vecTrianglesToRaster.push_back(triProjected);
|
vecTrianglesToRaster.push_back(triProjected);
|
||||||
}
|
}
|
||||||
@ -684,8 +707,7 @@ void FaceBall::RenderWorld() {
|
|||||||
|
|
||||||
//std::sort(vecTrianglesToRaster.begin(),vecTrianglesToRaster.end(),[](triangle&t1,triangle&t2){return (t1.p[0].z+t1.p[1].z+t1.p[2].z)/3.0f>(t2.p[0].z+t2.p[1].z+t2.p[2].z)/3.0f;});
|
//std::sort(vecTrianglesToRaster.begin(),vecTrianglesToRaster.end(),[](triangle&t1,triangle&t2){return (t1.p[0].z+t1.p[1].z+t1.p[2].z)/3.0f>(t2.p[0].z+t2.p[1].z+t2.p[2].z)/3.0f;});
|
||||||
ClearBuffer(BLACK, true);
|
ClearBuffer(BLACK, true);
|
||||||
int triRenderCount = 0;
|
triRenderCount = 0;
|
||||||
|
|
||||||
for (auto& triToRaster : vecTrianglesToRaster) {
|
for (auto& triToRaster : vecTrianglesToRaster) {
|
||||||
|
|
||||||
Triangle clipped[2];
|
Triangle clipped[2];
|
||||||
@ -752,9 +774,6 @@ void FaceBall::RenderWorld() {
|
|||||||
triRenderCount++;
|
triRenderCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDecalMode(DecalMode::NORMAL);
|
|
||||||
DrawStringDecal({ 0,0 }, "Triangles: " + std::to_string(triRenderCount), WHITE, { 2,2 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceBall::HandleKeys(float fElapsedTime) {
|
void FaceBall::HandleKeys(float fElapsedTime) {
|
||||||
@ -846,6 +865,9 @@ void FaceBall::HandleKeys(float fElapsedTime) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fYaw -= 2 * fElapsedTime;
|
fYaw -= 2 * fElapsedTime;
|
||||||
|
if (hudOffset < 20) {
|
||||||
|
hudOffset = std::min(20.f, hudOffset + 128 * fElapsedTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetKey(olc::D).bHeld) {
|
if (GetKey(olc::D).bHeld) {
|
||||||
@ -854,6 +876,9 @@ void FaceBall::HandleKeys(float fElapsedTime) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fYaw += 2 * fElapsedTime;
|
fYaw += 2 * fElapsedTime;
|
||||||
|
if (hudOffset > -20) {
|
||||||
|
hudOffset = std::max(-20.f,hudOffset-128 * fElapsedTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetKey(olc::F1).bPressed) {
|
if (GetKey(olc::F1).bPressed) {
|
||||||
@ -902,10 +927,13 @@ bool FaceBall::OnUserCreate()
|
|||||||
bullet_tex = new Decal(new Sprite("assets/enemies/bullet.png"));
|
bullet_tex = new Decal(new Sprite("assets/enemies/bullet.png"));
|
||||||
floor_tex = new Decal(new Sprite("assets/floor.png"));
|
floor_tex = new Decal(new Sprite("assets/floor.png"));
|
||||||
enemy_Sonar_tex = new Decal(new Sprite("assets/enemies/Sonar.png"));
|
enemy_Sonar_tex = new Decal(new Sprite("assets/enemies/Sonar.png"));
|
||||||
|
hud = new Decal(new Sprite("assets/hud.png"));
|
||||||
|
exit_wall_tex = new Decal(new Sprite("assets/exitwall.png"));
|
||||||
|
|
||||||
enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex };
|
enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex };
|
||||||
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
|
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
|
||||||
bullet = { "assets/enemies/bullet.obj",bullet_tex };
|
bullet = { "assets/enemies/bullet.obj",bullet_tex };
|
||||||
|
mapExit = { "assets/Exit.obj",dot };
|
||||||
mapWalls.texture = wall_tex;
|
mapWalls.texture = wall_tex;
|
||||||
mapFloor.texture = floor_tex;
|
mapFloor.texture = floor_tex;
|
||||||
|
|
||||||
@ -937,6 +965,9 @@ bool Bullet::Update(float fElapsedTime) {
|
|||||||
Enemy& enemy = game->enemies[collided_enemy];
|
Enemy& enemy = game->enemies[collided_enemy];
|
||||||
if (!enemy.isDead()) {
|
if (!enemy.isDead()) {
|
||||||
enemy.Hurt();
|
enemy.Hurt();
|
||||||
|
if (enemy.isDead()) {
|
||||||
|
game->SubtractTag();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -951,6 +982,10 @@ bool Bullet::Update(float fElapsedTime) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FaceBall::SubtractTag() {
|
||||||
|
tagsRemaining = std::max(0, tagsRemaining - 1);
|
||||||
|
}
|
||||||
|
|
||||||
void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime) {
|
void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime) {
|
||||||
if (e.isDead()) {
|
if (e.isDead()) {
|
||||||
if (!e.deathAnimationOver()) {
|
if (!e.deathAnimationOver()) {
|
||||||
@ -1023,6 +1058,18 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
|
|||||||
case GAME: {
|
case GAME: {
|
||||||
HandleKeys(fElapsedTime);
|
HandleKeys(fElapsedTime);
|
||||||
RenderWorld();
|
RenderWorld();
|
||||||
|
if (!GetKey(olc::D).bHeld && !GetKey(olc::A).bHeld) {
|
||||||
|
hudOffsetAcc += 20 * fElapsedTime;
|
||||||
|
while (hudOffsetAcc >= 1) {
|
||||||
|
hudOffset /= 2;
|
||||||
|
hudOffsetAcc--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetDecalMode(DecalMode::NORMAL);
|
||||||
|
DrawDecal({ -32+hudOffset,-18 }, hud, {1.05,1.05});
|
||||||
|
DrawStringDecal({ 112+hudOffset,4 }, "Triangles: " + std::to_string(triRenderCount), BLACK, { 2,4 });
|
||||||
|
std::string hudText = "Tags Left: " + std::to_string(tagsRemaining) + " Lives: " + std::to_string(lives);
|
||||||
|
DrawStringPropDecal(vf2d{ hudOffset+(float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2),(float)(ScreenHeight() - 64 - GetTextSizeProp(hudText).y*6) }, hudText, WHITE, {3,6});
|
||||||
}break;
|
}break;
|
||||||
case EDITOR: {
|
case EDITOR: {
|
||||||
editor.Update(fElapsedTime);
|
editor.Update(fElapsedTime);
|
||||||
@ -1047,7 +1094,6 @@ void FaceBall::OnTextEntryComplete(const std::string& sText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
FaceBall demo;
|
FaceBall demo;
|
||||||
|
@ -78,7 +78,7 @@ struct Mesh
|
|||||||
|
|
||||||
Mesh(std::string filename, Decal* tex)
|
Mesh(std::string filename, Decal* tex)
|
||||||
:texture(tex) {
|
:texture(tex) {
|
||||||
LoadFromObjectFile(filename);
|
LoadFromObjectFile(filename,tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -92,7 +92,7 @@ private:
|
|||||||
//std::cout<<" "<<v<<"/"<<uv<<"\n";
|
//std::cout<<" "<<v<<"/"<<uv<<"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadFromObjectFile(std::string sFilename)
|
bool LoadFromObjectFile(std::string sFilename,Decal*tex)
|
||||||
{
|
{
|
||||||
std::ifstream f(sFilename);
|
std::ifstream f(sFilename);
|
||||||
if (!f.is_open())
|
if (!f.is_open())
|
||||||
@ -128,7 +128,7 @@ private:
|
|||||||
Parse(t2, v2, uv2);
|
Parse(t2, v2, uv2);
|
||||||
Parse(t3, v3, uv3);
|
Parse(t3, v3, uv3);
|
||||||
tris.push_back({ verts[v1 - 1],verts[v2 - 1],verts[v3 - 1],
|
tris.push_back({ verts[v1 - 1],verts[v2 - 1],verts[v3 - 1],
|
||||||
uvs[uv1 - 1],uvs[uv2 - 1],uvs[uv3 - 1],{WHITE,WHITE,WHITE} });
|
uvs[uv1 - 1],uvs[uv2 - 1],uvs[uv3 - 1],{WHITE,WHITE,WHITE},tex });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -204,10 +204,10 @@ class FaceBall : public PixelGameEngine
|
|||||||
std::vector<Enemy>enemies;
|
std::vector<Enemy>enemies;
|
||||||
private:
|
private:
|
||||||
Mesh mapWalls,mapFloor,enemy_ShootMe,bullet,green_bullet,undefined,
|
Mesh mapWalls,mapFloor,enemy_ShootMe,bullet,green_bullet,undefined,
|
||||||
enemy_Sonar;
|
enemy_Sonar, mapExit;
|
||||||
|
|
||||||
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;
|
*enemy_Sonar_tex,*hud,*exit_wall_tex;
|
||||||
vi2d MAP_SIZE;
|
vi2d MAP_SIZE;
|
||||||
std::vector<std::vector<MapSquare>>map;
|
std::vector<std::vector<MapSquare>>map;
|
||||||
std::vector<Object>objects;
|
std::vector<Object>objects;
|
||||||
@ -215,6 +215,8 @@ class FaceBall : public PixelGameEngine
|
|||||||
GAMEMODE mode=GAMEMODE::GAME;
|
GAMEMODE mode=GAMEMODE::GAME;
|
||||||
Editor editor;
|
Editor editor;
|
||||||
int level=1;
|
int level=1;
|
||||||
|
int tagsRemaining = 10;
|
||||||
|
int lives = 3;
|
||||||
|
|
||||||
mat4x4 matProj;
|
mat4x4 matProj;
|
||||||
|
|
||||||
@ -231,8 +233,12 @@ class FaceBall : public PixelGameEngine
|
|||||||
float freeRoamCamera_pitch = pitch;
|
float freeRoamCamera_pitch = pitch;
|
||||||
float freeRoamCamera_yaw = fYaw;
|
float freeRoamCamera_yaw = fYaw;
|
||||||
|
|
||||||
float shotSpd = 3.0f;
|
float shotSpd = 4.0f;
|
||||||
float moveSpd = 2.0f;
|
float moveSpd = 2.0f;
|
||||||
|
float hudOffset = 0;
|
||||||
|
float hudOffsetAcc = 0;
|
||||||
|
|
||||||
|
int triRenderCount = 0;
|
||||||
|
|
||||||
vec3d Matrix_MultiplyVector(mat4x4& m, vec3d& i);
|
vec3d Matrix_MultiplyVector(mat4x4& m, vec3d& i);
|
||||||
mat4x4 Matrix_MakeIdentity();
|
mat4x4 Matrix_MakeIdentity();
|
||||||
@ -268,4 +274,5 @@ class FaceBall : public PixelGameEngine
|
|||||||
public:
|
public:
|
||||||
static bool CheckCollision(vec3d movementVector,vf2d pos,float radius);
|
static bool CheckCollision(vec3d movementVector,vf2d pos,float radius);
|
||||||
static int CheckEnemyCollision(vec3d movementVector, vf2d pos, float radius);
|
static int CheckEnemyCollision(vec3d movementVector, vf2d pos, float radius);
|
||||||
|
void SubtractTag();
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user