|
|
@ -65,14 +65,19 @@ void VirusAttack::InitializeImages(){ |
|
|
|
|
|
|
|
|
|
|
|
void VirusAttack::InitializeLevelData(){ |
|
|
|
void VirusAttack::InitializeLevelData(){ |
|
|
|
#pragma region Stage 1 |
|
|
|
#pragma region Stage 1 |
|
|
|
|
|
|
|
{ |
|
|
|
//Stage 1 data.
|
|
|
|
//Stage 1 data.
|
|
|
|
levelData[STAGE1].size={64,64}; |
|
|
|
LevelName stage=STAGE1; |
|
|
|
levelData[STAGE1].bgm=Sound::BOSS2; |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[STAGE1].player_starting_resources={50,50,50,50,50}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
levelData[STAGE1].enemy_starting_resources={0,0,0,0,0}; |
|
|
|
levelData[stage].levelColor=DARK_RED; |
|
|
|
|
|
|
|
levelData[stage].size={64,64}; |
|
|
|
|
|
|
|
levelData[stage].bgm=Sound::BOSS2; |
|
|
|
|
|
|
|
levelData[stage].player_starting_resources={50,50,50,50,50}; |
|
|
|
|
|
|
|
levelData[stage].enemy_starting_resources={0,0,0,0,0}; |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<UnitData>&units=levelData[STAGE1].unitPlacement; |
|
|
|
std::vector<UnitData>&units=levelData[stage].unitPlacement; |
|
|
|
std::vector<CPData>&collectionPoints=levelData[STAGE1].cpPlacement; |
|
|
|
std::vector<CPData>&collectionPoints=levelData[stage].cpPlacement; |
|
|
|
|
|
|
|
|
|
|
|
units.push_back({UnitType::LeftShifter,vf2d{128,128},true}); |
|
|
|
units.push_back({UnitType::LeftShifter,vf2d{128,128},true}); |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{129,129},true}); |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{129,129},true}); |
|
|
@ -96,21 +101,28 @@ void VirusAttack::InitializeLevelData(){ |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{360,300},false}); |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{360,300},false}); |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{361,300},false}); |
|
|
|
units.push_back({UnitType::RightShifter,vf2d{361,300},false}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#pragma endregion |
|
|
|
#pragma endregion |
|
|
|
#pragma region Stage 2 |
|
|
|
#pragma region Stage 2 |
|
|
|
|
|
|
|
{ |
|
|
|
//Stage 2 data.
|
|
|
|
//Stage 2 data.
|
|
|
|
levelData[STAGE2].size={16,16}; |
|
|
|
LevelName stage=STAGE2; |
|
|
|
levelData[STAGE2].bgm=Sound::COSMOS; |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[STAGE2].player_starting_resources={10,10,10,10,10}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
levelData[STAGE2].enemy_starting_resources={0,0,0,0,0}; |
|
|
|
levelData[stage].size={16,16}; |
|
|
|
|
|
|
|
levelData[stage].levelColor=DARK_GREEN; |
|
|
|
|
|
|
|
levelData[stage].bgm=Sound::COSMOS; |
|
|
|
|
|
|
|
levelData[stage].player_starting_resources={10,10,10,10,10}; |
|
|
|
|
|
|
|
levelData[stage].enemy_starting_resources={0,0,0,0,0}; |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<UnitData>&units=levelData[STAGE2].unitPlacement; |
|
|
|
std::vector<UnitData>&units=levelData[stage].unitPlacement; |
|
|
|
std::vector<CPData>&collectionPoints=levelData[STAGE2].cpPlacement; |
|
|
|
std::vector<CPData>&collectionPoints=levelData[stage].cpPlacement; |
|
|
|
|
|
|
|
|
|
|
|
units.push_back({UnitType::RAMBank,vf2d{134,134},true}); |
|
|
|
units.push_back({UnitType::RAMBank,vf2d{134,134},true}); |
|
|
|
|
|
|
|
|
|
|
|
units.push_back({UnitType::RAMBank,vf2d{1200,1200},false}); |
|
|
|
units.push_back({UnitType::RAMBank,vf2d{1200,1200},false}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#pragma endregion |
|
|
|
#pragma endregion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -203,6 +215,8 @@ void VirusAttack::LoadLevel(LevelName level){ |
|
|
|
for(auto&cp:selectedLevel.cpPlacement){ |
|
|
|
for(auto&cp:selectedLevel.cpPlacement){ |
|
|
|
collectionPoints.push_back(std::make_unique<CollectionPoint>(this,cp.pos,cp.rot,*IMAGES[MEMORY_COLLECTION_POINT],cp.type));
|
|
|
|
collectionPoints.push_back(std::make_unique<CollectionPoint>(this,cp.pos,cp.rot,*IMAGES[MEMORY_COLLECTION_POINT],cp.type));
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randomBackgroundOffset={util::random(128),util::random(128)}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void VirusAttack::InitializeGUIs(){ |
|
|
|
void VirusAttack::InitializeGUIs(){ |
|
|
@ -471,11 +485,35 @@ void VirusAttack::DrawMinimap(){ |
|
|
|
SetDrawTarget(IMAGES[MINIMAP_OUTLINE]->Sprite()); |
|
|
|
SetDrawTarget(IMAGES[MINIMAP_OUTLINE]->Sprite()); |
|
|
|
Clear(BLANK); |
|
|
|
Clear(BLANK); |
|
|
|
DrawRect((game.GetWorldOffset()/worldPixelSize*64),viewingTilesPct*64/game.GetWorldScale()); |
|
|
|
DrawRect((game.GetWorldOffset()/worldPixelSize*64),viewingTilesPct*64/game.GetWorldScale()); |
|
|
|
|
|
|
|
for(auto&cp:collectionPoints){ |
|
|
|
|
|
|
|
Pixel col; |
|
|
|
|
|
|
|
switch(cp->type){ |
|
|
|
|
|
|
|
case HEALTH:{ |
|
|
|
|
|
|
|
col=CONSTANT::HEALTH_COLOR; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case ATKSPD:{ |
|
|
|
|
|
|
|
col=CONSTANT::ATKSPD_COLOR; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case MOVESPD:{ |
|
|
|
|
|
|
|
col=CONSTANT::MOVESPD_COLOR; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case RANGE:{ |
|
|
|
|
|
|
|
col=CONSTANT::RANGE_COLOR; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case PROCEDURE:{ |
|
|
|
|
|
|
|
col=CONSTANT::PROCEDURE_COLOR; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
FillCircle(cp->pos/worldPixelSize*64-vf2d{1,0},1,col); |
|
|
|
|
|
|
|
DrawCircle(cp->pos/worldPixelSize*64-vf2d{1,0},1,BLACK); |
|
|
|
|
|
|
|
} |
|
|
|
for(auto&u:units){ |
|
|
|
for(auto&u:units){ |
|
|
|
vf2d squareSize=u->GetUnitSize()/vf2d(WORLD_SIZE); |
|
|
|
vf2d squareSize=u->GetUnitSize()/vf2d(WORLD_SIZE); |
|
|
|
squareSize.x=std::round(std::max(1.f,squareSize.x)); |
|
|
|
squareSize.x=std::round(std::max(1.f,squareSize.x)); |
|
|
|
squareSize.y=std::round(std::max(1.f,squareSize.y)); |
|
|
|
squareSize.y=std::round(std::max(1.f,squareSize.y)); |
|
|
|
FillRect(u->GetGhostPos()/worldPixelSize*64-squareSize,squareSize*2,u->IsFriendly()?GREEN:RED); |
|
|
|
float colorMult=1; |
|
|
|
|
|
|
|
if(u->IsAttached()){colorMult=0.5;} |
|
|
|
|
|
|
|
FillRect(u->GetGhostPos()/worldPixelSize*64-squareSize,squareSize*2,(u->IsFriendly()?GREEN:RED)*colorMult); |
|
|
|
} |
|
|
|
} |
|
|
|
IMAGES[MINIMAP_OUTLINE]->Decal()->Update(); |
|
|
|
IMAGES[MINIMAP_OUTLINE]->Decal()->Update(); |
|
|
|
SetDrawTarget(nullptr); |
|
|
|
SetDrawTarget(nullptr); |
|
|
@ -647,7 +685,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
u->AttemptAttack(u,closestUnit,units,debuffIcons,IMAGES); |
|
|
|
u->AttemptAttack(u,closestUnit,units,debuffIcons,IMAGES); |
|
|
|
u->_Update(this,SOUNDS,player_resources,enemy_resources,queuedUnits,resourceGainTimer); |
|
|
|
u->_Update(this,SOUNDS,player_resources,enemy_resources,queuedUnits,resourceGainTimer,resourceGainIcons,IMAGES); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::erase_if(units,[&](std::shared_ptr<Unit>u){ |
|
|
|
std::erase_if(units,[&](std::shared_ptr<Unit>u){ |
|
|
@ -666,7 +704,8 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
|
|
|
|
|
|
|
|
queuedUnits.clear(); |
|
|
|
queuedUnits.clear(); |
|
|
|
|
|
|
|
|
|
|
|
game.DrawPartialDecal({0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,IMAGES[TILE]->Decal(),{0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,DARK_GREEN); |
|
|
|
DrawPartialDecal({0,0},GetScreenSize(),IMAGES[MATRIX]->Decal(),randomBackgroundOffset,{32,32},Pixel{currentLevel->levelColor.r,currentLevel->levelColor.g,currentLevel->levelColor.b,164}/2); |
|
|
|
|
|
|
|
game.DrawPartialDecal({0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,IMAGES[TILE]->Decal(),{0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,currentLevel->levelColor); |
|
|
|
|
|
|
|
|
|
|
|
for(auto&u:units){ |
|
|
|
for(auto&u:units){ |
|
|
|
u->DrawRangeIndicator(this,game,IMAGES); |
|
|
|
u->DrawRangeIndicator(this,game,IMAGES); |
|
|
@ -699,7 +738,13 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
icon.Draw(game); |
|
|
|
icon.Draw(game); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(ResourceGainIcon&icon:resourceGainIcons){ |
|
|
|
|
|
|
|
icon.Update(fElapsedTime); |
|
|
|
|
|
|
|
icon.Draw(game); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::erase_if(debuffIcons,[](DebuffIcon&icon){return icon.lifetime<=0;}); |
|
|
|
std::erase_if(debuffIcons,[](DebuffIcon&icon){return icon.lifetime<=0;}); |
|
|
|
|
|
|
|
std::erase_if(resourceGainIcons,[](ResourceGainIcon&icon){return icon.lifetime<=0;}); |
|
|
|
|
|
|
|
|
|
|
|
for(auto&u:units){ |
|
|
|
for(auto&u:units){ |
|
|
|
u->_DrawHud(game,IMAGES); |
|
|
|
u->_DrawHud(game,IMAGES); |
|
|
@ -765,7 +810,7 @@ void VirusAttack::RenderFogOfWar(){ |
|
|
|
for(int y=game.GetTopLeftTile().y/96-1;y<=game.GetBottomRightTile().y/96+1;y++){ |
|
|
|
for(int y=game.GetTopLeftTile().y/96-1;y<=game.GetBottomRightTile().y/96+1;y++){ |
|
|
|
for(int x=game.GetTopLeftTile().x/96-1;x<=game.GetBottomRightTile().x/96+1;x++){ |
|
|
|
for(int x=game.GetTopLeftTile().x/96-1;x<=game.GetBottomRightTile().x/96+1;x++){ |
|
|
|
if(TileManager::visibleTiles.count(vi2d{x,y})==0){ |
|
|
|
if(TileManager::visibleTiles.count(vi2d{x,y})==0){ |
|
|
|
if(x>=0&&y>=0&&x<=WORLD_SIZE.x*CONSTANT::TILE_SIZE.x&&y<=WORLD_SIZE.y*CONSTANT::TILE_SIZE.y){ |
|
|
|
if(x>=0&&y>=0&&x<WORLD_SIZE.x/4&&y<WORLD_SIZE.y/4){ |
|
|
|
game.FillRectDecal(vf2d{float(x),float(y)}*96,{96,96},{0,0,0,128}); |
|
|
|
game.FillRectDecal(vf2d{float(x),float(y)}*96,{96,96},{0,0,0,128}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|