|
|
@ -13,8 +13,7 @@ |
|
|
|
#include "olcUTIL_Geometry2D.h" |
|
|
|
#include "olcUTIL_Geometry2D.h" |
|
|
|
#include "TileManager.h" |
|
|
|
#include "TileManager.h" |
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
#include "Scenario.h" |
|
|
|
#include "VirusAttack.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VirusAttack::VirusAttack() |
|
|
|
VirusAttack::VirusAttack() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -72,6 +71,7 @@ void VirusAttack::InitializeLevelData(){ |
|
|
|
LevelName stage=STAGE1; |
|
|
|
LevelName stage=STAGE1; |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
|
|
|
|
levelData[stage].scenario=scenarios[0]; |
|
|
|
levelData[stage].levelColor=DARK_RED; |
|
|
|
levelData[stage].levelColor=DARK_RED; |
|
|
|
levelData[stage].size={64,64}; |
|
|
|
levelData[stage].size={64,64}; |
|
|
|
levelData[stage].bgm=Sound::BOSS2; |
|
|
|
levelData[stage].bgm=Sound::BOSS2; |
|
|
@ -112,6 +112,7 @@ void VirusAttack::InitializeLevelData(){ |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[stage].cameraStart={96,96}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
levelData[stage].worldZoom={1,1}; |
|
|
|
levelData[stage].size={16,16}; |
|
|
|
levelData[stage].size={16,16}; |
|
|
|
|
|
|
|
levelData[stage].scenario=scenarios[1]; |
|
|
|
levelData[stage].levelColor=DARK_GREEN; |
|
|
|
levelData[stage].levelColor=DARK_GREEN; |
|
|
|
levelData[stage].bgm=Sound::COSMOS; |
|
|
|
levelData[stage].bgm=Sound::COSMOS; |
|
|
|
levelData[stage].player_starting_resources={10,10,10,10,10}; |
|
|
|
levelData[stage].player_starting_resources={10,10,10,10,10}; |
|
|
@ -155,6 +156,7 @@ bool VirusAttack::OnUserCreate(){ |
|
|
|
InitializeSounds(); |
|
|
|
InitializeSounds(); |
|
|
|
|
|
|
|
|
|
|
|
InitializeGUIs(); |
|
|
|
InitializeGUIs(); |
|
|
|
|
|
|
|
InitializeScenarios(); |
|
|
|
InitializeLevelData(); |
|
|
|
InitializeLevelData(); |
|
|
|
|
|
|
|
|
|
|
|
LoadLevel(STAGE1); |
|
|
|
LoadLevel(STAGE1); |
|
|
@ -243,6 +245,11 @@ void VirusAttack::InitializeGUIs(){ |
|
|
|
memoryGuardButton=new QuickGUI::ImageButton(platformCreationList,*IMAGES[MEMORY_GUARD],{0.25,0.25},{float(ScreenWidth()-48),48.f+32*3},{20,20}); |
|
|
|
memoryGuardButton=new QuickGUI::ImageButton(platformCreationList,*IMAGES[MEMORY_GUARD],{0.25,0.25},{float(ScreenWidth()-48),48.f+32*3},{20,20}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VirusAttack::InitializeScenarios(){ |
|
|
|
|
|
|
|
scenarios.emplace_back(new Stage1(this)); |
|
|
|
|
|
|
|
scenarios.emplace_back(new Stage1(this)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void VirusAttack::InitializeSounds(){ |
|
|
|
void VirusAttack::InitializeSounds(){ |
|
|
|
int soundIndex=0; |
|
|
|
int soundIndex=0; |
|
|
|
auto LoadSound=[&](Sound sound,std::string soundFilename){ |
|
|
|
auto LoadSound=[&](Sound sound,std::string soundFilename){ |
|
|
@ -654,6 +661,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
HandleRightClickMove(); |
|
|
|
HandleRightClickMove(); |
|
|
|
HandlePanAndZoom(fElapsedTime); |
|
|
|
HandlePanAndZoom(fElapsedTime); |
|
|
|
HandleMinimapClick(); |
|
|
|
HandleMinimapClick(); |
|
|
|
|
|
|
|
currentLevel->scenario->_Update(); |
|
|
|
AL.vecPos=game.ScreenToWorld(GetScreenSize()/2); |
|
|
|
AL.vecPos=game.ScreenToWorld(GetScreenSize()/2); |
|
|
|
AL.fSoundFXVolume=std::min(1.f,game.GetWorldScale().x); |
|
|
|
AL.fSoundFXVolume=std::min(1.f,game.GetWorldScale().x); |
|
|
|
AL.OnUserUpdate(fElapsedTime); |
|
|
|
AL.OnUserUpdate(fElapsedTime); |
|
|
@ -765,6 +773,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
DrawResourceBar(fElapsedTime); |
|
|
|
DrawResourceBar(fElapsedTime); |
|
|
|
DrawDecal({float(ScreenWidth()-74-IMAGES[GUIDE]->Sprite()->width*0.75),float(ScreenHeight()+6-IMAGES[GUIDE]->Sprite()->height*0.75)},IMAGES[GUIDE]->Decal(),{0.75,0.75}); |
|
|
|
DrawDecal({float(ScreenWidth()-74-IMAGES[GUIDE]->Sprite()->width*0.75),float(ScreenHeight()+6-IMAGES[GUIDE]->Sprite()->height*0.75)},IMAGES[GUIDE]->Decal(),{0.75,0.75}); |
|
|
|
DrawMinimap(); |
|
|
|
DrawMinimap(); |
|
|
|
|
|
|
|
currentLevel->scenario->_Draw(); |
|
|
|
|
|
|
|
|
|
|
|
unitCreationBox.UpdateAndDraw(GetMousePos()+vi2d{8,-28},this,player_resources,IMAGES); |
|
|
|
unitCreationBox.UpdateAndDraw(GetMousePos()+vi2d{8,-28},this,player_resources,IMAGES); |
|
|
|
testBox.UpdateAndDraw(GetMousePos()-testBox.GetSize()/2,this,player_resources,IMAGES); |
|
|
|
testBox.UpdateAndDraw(GetMousePos()-testBox.GetSize()/2,this,player_resources,IMAGES); |
|
|
@ -1030,6 +1039,11 @@ void VirusAttack::CalculateUsedMemory(){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool VirusAttack::OnUserDestroy(){ |
|
|
|
|
|
|
|
std::for_each(scenarios.begin(),scenarios.end(),[](auto&scenario){delete scenario;}); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
int main() |
|
|
|
{ |
|
|
|
{ |
|
|
|
VirusAttack app; |
|
|
|
VirusAttack app; |
|
|
|