|
|
@ -163,7 +163,12 @@ bool Powerup::Update(float fElapsedTime) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FaceBall::SpawnPowerup(PowerupType type, vec3d pos) { |
|
|
|
void FaceBall::SpawnPowerup(PowerupType type, vec3d pos) { |
|
|
|
Mesh& mesh = (type <= PowerupType::SHOTS) ? powerup : powerup2; |
|
|
|
Mesh mesh = (type <= PowerupType::SHOTS) ? powerup : powerup2; |
|
|
|
|
|
|
|
for (Triangle& t : mesh.tris) { |
|
|
|
|
|
|
|
t.col[0] = powerupColorData[type]; |
|
|
|
|
|
|
|
t.col[1] = powerupColorData[type]; |
|
|
|
|
|
|
|
t.col[2] = powerupColorData[type]; |
|
|
|
|
|
|
|
} |
|
|
|
powerups.push_back({ mesh,pos,0,type }); |
|
|
|
powerups.push_back({ mesh,pos,0,type }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -198,9 +203,12 @@ void FaceBall::LoadLevel(int level) |
|
|
|
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,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}, 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}, floor_tex }); |
|
|
|
EnemyID id = mapData[y][x].enemyId; |
|
|
|
EnemyID id = mapData[y][x].enemyId; |
|
|
|
if (id>=SHOOTME&& id < COIN) { |
|
|
|
if (id>=SHOOTME&& id < POWERUP_ARMOR) { |
|
|
|
enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir-1)*PI/2,enemyData[id].radius}); |
|
|
|
enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir-1)*PI/2,enemyData[id].radius}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (id >= POWERUP_ARMOR) { |
|
|
|
|
|
|
|
SpawnPowerup(PowerupType((int)id-55), vec3d{ x + 0.5f,0,y + 0.5f }); |
|
|
|
|
|
|
|
} |
|
|
|
if (id == EXIT) { |
|
|
|
if (id == EXIT) { |
|
|
|
exitCoords = { x,y }; |
|
|
|
exitCoords = { x,y }; |
|
|
|
} |
|
|
|
} |
|
|
@ -846,9 +854,9 @@ void FaceBall::RenderPowerupMesh(mat4x4& matView, std::vector<Triangle>& vecTria |
|
|
|
triTransformed.uv[0] = tri.uv[0]; |
|
|
|
triTransformed.uv[0] = tri.uv[0]; |
|
|
|
triTransformed.uv[1] = tri.uv[1]; |
|
|
|
triTransformed.uv[1] = tri.uv[1]; |
|
|
|
triTransformed.uv[2] = tri.uv[2]; |
|
|
|
triTransformed.uv[2] = tri.uv[2]; |
|
|
|
triTransformed.col[0] = tri.col[0]; |
|
|
|
triTransformed.col[0] = tri.col[0] * p.colorCycle; |
|
|
|
triTransformed.col[1] = tri.col[1]; |
|
|
|
triTransformed.col[1] = tri.col[1] * p.colorCycle; |
|
|
|
triTransformed.col[2] = tri.col[2]; |
|
|
|
triTransformed.col[2] = tri.col[2] * p.colorCycle; |
|
|
|
triTransformed.tex = tri.tex; |
|
|
|
triTransformed.tex = tri.tex; |
|
|
|
|
|
|
|
|
|
|
|
vec3d normal, line1, line2; |
|
|
|
vec3d normal, line1, line2; |
|
|
@ -1135,14 +1143,14 @@ void FaceBall::RenderWorld() { |
|
|
|
RenderMesh(matView, vecTrianglesToRaster, enemy); |
|
|
|
RenderMesh(matView, vecTrianglesToRaster, enemy); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto& powerup : powerups) { |
|
|
|
|
|
|
|
RenderPowerupMesh(matView, vecTrianglesToRaster, powerup); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (auto& bullet : bullets) { |
|
|
|
for (auto& bullet : bullets) { |
|
|
|
RenderBulletMesh(matView, vecTrianglesToRasterTranslucent, bullet); |
|
|
|
RenderBulletMesh(matView, vecTrianglesToRasterTranslucent, bullet); |
|
|
|
} |
|
|
|
} |
|
|
|
RenderMesh(matView, vecTrianglesToRaster, walls); |
|
|
|
RenderMesh(matView, vecTrianglesToRaster, walls); |
|
|
|
RenderMesh(matView, vecTrianglesToRasterTranslucent, walls, true); |
|
|
|
RenderMesh(matView, vecTrianglesToRasterTranslucent, walls, true); |
|
|
|
|
|
|
|
for (auto& powerup : powerups) { |
|
|
|
|
|
|
|
RenderPowerupMesh(matView, vecTrianglesToRasterTranslucent, powerup); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//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); |
|
|
@ -1531,6 +1539,7 @@ bool FaceBall::OnUserCreate() |
|
|
|
mapFloor.texture = floor_tex; |
|
|
|
mapFloor.texture = floor_tex; |
|
|
|
|
|
|
|
|
|
|
|
InitializeEnemyData(); |
|
|
|
InitializeEnemyData(); |
|
|
|
|
|
|
|
InitializePowerupColors(); |
|
|
|
|
|
|
|
|
|
|
|
LoadLevel(1); |
|
|
|
LoadLevel(1); |
|
|
|
|
|
|
|
|
|
|
|