|
|
|
@ -128,7 +128,7 @@ void FaceBall::InitializeEnemyData() { |
|
|
|
|
enemyData[START] = { "SPAWN POSITION",undefined,{128,64,0} }; |
|
|
|
|
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,PI / 8,2,1,0.2f,true }; |
|
|
|
|
enemyData[SHOOTME2] = { "SHOOTME2",enemy_IShoot,YELLOW,1,1,PI / 6,2,1,0.3f,true }; |
|
|
|
|
enemyData[SHOOTME_ARMOR] = { "SHOOTME_ARMOR",enemy_ShootMe,YELLOW,6,1,PI / 6,2,1,0.3f,true,PowerupType::ARMOR,true }; |
|
|
|
|
enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,PI / 6,2,1,0.3f,true,PowerupType::ARMOR,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} }; |
|
|
|
@ -141,23 +141,23 @@ void FaceBall::InitializeEnemyData() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FaceBall::InitializePowerupColors() { |
|
|
|
|
powerupColorData[PowerupType::ARMOR] = DARK_GREEN; |
|
|
|
|
powerupColorData[PowerupType::SPEED] = DARK_BLUE; |
|
|
|
|
powerupColorData[PowerupType::SHOTS] = DARK_RED; |
|
|
|
|
powerupColorData[PowerupType::STOP] = RED; |
|
|
|
|
powerupColorData[PowerupType::SHIELD] = CYAN; |
|
|
|
|
powerupColorData[PowerupType::CAMO] = MAGENTA; |
|
|
|
|
powerupColorData[PowerupType::MAP] = GREEN; |
|
|
|
|
powerupColorData[PowerupType::COIN] = BLUE; |
|
|
|
|
powerupData[PowerupType::ARMOR] = { "Armor UP",DARK_GREEN }; |
|
|
|
|
powerupData[PowerupType::SPEED] = { "Speed UP", DARK_BLUE}; |
|
|
|
|
powerupData[PowerupType::SHOTS] = { "Shots UP", DARK_RED}; |
|
|
|
|
powerupData[PowerupType::STOP] = { "< STOP >", RED}; |
|
|
|
|
powerupData[PowerupType::SHIELD] = { "< Invincibility Shield >", CYAN}; |
|
|
|
|
powerupData[PowerupType::CAMO] = { "< Camouflage >", MAGENTA}; |
|
|
|
|
powerupData[PowerupType::MAP] = { "< Minimap >", GREEN}; |
|
|
|
|
powerupData[PowerupType::COIN] = { "Coin", BLUE }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Powerup::Powerup(Mesh mesh, vec3d pos, float rot, PowerupType type)
|
|
|
|
|
: type(type), col(game->powerupColorData[type]), Object{ mesh,pos,rot,0.375f } {} |
|
|
|
|
: type(type), col(game->powerupData[type].col), Object{ mesh,pos,rot,0.375f } {} |
|
|
|
|
|
|
|
|
|
bool Powerup::Update(float fElapsedTime) { |
|
|
|
|
aliveTime += fElapsedTime; |
|
|
|
|
colorCycle = std::sinf(10 * aliveTime); |
|
|
|
|
col = game->powerupColorData[type] * colorCycle; |
|
|
|
|
col = game->powerupData[type].col * colorCycle; |
|
|
|
|
opened = false; //Open state is false until a player causes it to open.
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -165,9 +165,9 @@ bool Powerup::Update(float fElapsedTime) { |
|
|
|
|
void FaceBall::SpawnPowerup(PowerupType type, vec3d pos) { |
|
|
|
|
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]; |
|
|
|
|
t.col[0] = powerupData[type].col; |
|
|
|
|
t.col[1] = powerupData[type].col; |
|
|
|
|
t.col[2] = powerupData[type].col; |
|
|
|
|
} |
|
|
|
|
powerups.push_back({ mesh,pos,0,type }); |
|
|
|
|
} |
|
|
|
@ -1206,7 +1206,7 @@ void FaceBall::RenderWorld() { |
|
|
|
|
{t.uv[1].u,t.uv[1].v}, |
|
|
|
|
{t.uv[2].u,t.uv[2].v}, |
|
|
|
|
}, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { t.col[0],t.col[1],t.col[2]}); |
|
|
|
|
SetDecalMode(DecalMode::WIREFRAME); |
|
|
|
|
/*SetDecalMode(DecalMode::WIREFRAME);
|
|
|
|
|
DrawPolygonDecal(nullptr,{ |
|
|
|
|
{t.p[0].x, t.p[0].y}, |
|
|
|
|
{t.p[1].x, t.p[1].y}, |
|
|
|
@ -1215,7 +1215,7 @@ void FaceBall::RenderWorld() { |
|
|
|
|
{0,0}, |
|
|
|
|
{0,0}, |
|
|
|
|
{0,0}, |
|
|
|
|
}, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { WHITE,WHITE,WHITE}); |
|
|
|
|
}, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { WHITE,WHITE,WHITE});*/ |
|
|
|
|
SetDecalStructure(DecalStructure::FAN); |
|
|
|
|
triRenderCount++; |
|
|
|
|
} |
|
|
|
@ -1784,7 +1784,15 @@ void FaceBall::RenderHud(float fElapsedTime) { |
|
|
|
|
if (hp > 0) { |
|
|
|
|
DrawStringDecal(vf2d{ 112 + hudOffset+32,4+18 }+hudAdjustment, "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)+32,(float)(ScreenHeight() - 64 - GetTextSizeProp(hudText).y * 6)+18 } + hudAdjustment, hudText, WHITE, { 3,6 }); |
|
|
|
|
DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2)+32,(float)(ScreenHeight() - 2 - GetTextSizeProp(hudText).y * 5)+18 } + hudAdjustment, hudText, WHITE, { 3,5 }); |
|
|
|
|
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 }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
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 }); |
|
|
|
|
DrawDecal({ float(ScreenWidth() / 2 - crosshair->sprite->width / 2),float(ScreenHeight() / 2 - crosshair->sprite->height / 2) }, crosshair, { 1,1 }, {255,255,255,128}); |
|
|
|
|
} |
|
|
|
|
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) }); |
|
|
|
@ -2048,6 +2056,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) |
|
|
|
|
gameTimer += fElapsedTime; |
|
|
|
|
switch (mode) { |
|
|
|
|
case GAME: { |
|
|
|
|
hudDisplayText = ""; |
|
|
|
|
for (std::vector<Bullet>::iterator it = bullets.begin(); it != bullets.end();) { |
|
|
|
|
Bullet& b = *it; |
|
|
|
|
if (!b.Update(fElapsedTime)) { |
|
|
|
@ -2078,6 +2087,7 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) |
|
|
|
|
vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius() - 0.00001f, moveSpd * fElapsedTime)); |
|
|
|
|
if (CheckPowerupCollision({ vForward.x,0,vForward.z }, { player.GetPos().x,player.GetPos().z }, player.GetRadius() * 1.25) != -1) { |
|
|
|
|
powerups[lastPowerupCollidedWith].opened = true; |
|
|
|
|
hudDisplayText = powerupData[powerups[lastPowerupCollidedWith].type].name; |
|
|
|
|
if (GetKey(F).bPressed) { |
|
|
|
|
powerups.erase(powerups.begin() + lastPowerupCollidedWith); |
|
|
|
|
lastPowerupCollidedWith = -1; |
|
|
|
|