|
|
|
@ -555,7 +555,7 @@ void VirusAttack::HandlePanAndZoom(float fElapsedTime){ |
|
|
|
|
float speedScale=std::min(1.f,gametv.GetWorldScale().x); |
|
|
|
|
bool canMouseScroll=!memoryAllocatorBox.IsVisible()&&!unitCreationBox.IsVisible()&& |
|
|
|
|
(GetMouseY()<=ScreenHeight()-64||GetMouseX()<=ScreenWidth()-64 |
|
|
|
|
||GetMouseScreenX()>=GetWindowPos().x+GetWindowSize().x||GetMouseScreenY()>=GetWindowPos().y+GetWindowSize().y); |
|
|
|
|
||GetMouseScreenX()>=GetWindowPos().x+GetWindowSize().x||GetMouseScreenY()>=GetWindowPos().y+GetWindowSize().y)&&!restartBox.IsVisible(); |
|
|
|
|
if(GetKey(A).bHeld||canMouseScroll&&GetMouseScreenX()<=GetWindowPos().x+CONSTANT::SCROLL_BOUNDARY){ |
|
|
|
|
vf2d amt=vf2d{-300*fElapsedTime,0}/speedScale; |
|
|
|
|
gametv.MoveWorldOffset(amt); |
|
|
|
@ -884,6 +884,10 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
|
testBox.UpdateAndDraw(GetMousePos()-testBox.GetSize()/2,this,player_resources,IMAGES,GetTotalUsedMemory(),currentLevel->availableMemory); |
|
|
|
|
memoryAllocatorBox.UpdateAndDraw(GetMousePos()+vi2d{8,-28},this,player_resources,IMAGES,GetTotalUsedMemory(),currentLevel->availableMemory); |
|
|
|
|
platformCreationBox.UpdateAndDraw(GetMousePos()+vi2d{8,-28},this,player_resources,IMAGES,GetTotalUsedMemory(),currentLevel->availableMemory); |
|
|
|
|
restartBox.UpdateAndDraw(GetMousePos()+vf2d{0,10},this,player_resources,IMAGES,GetTotalUsedMemory(),currentLevel->availableMemory); |
|
|
|
|
if(restartButtonHoldTime>0){ |
|
|
|
|
FillRectDecal(restartButton->vPos+vf2d{3,(1-(restartButtonHoldTime/2.5f))*restartButton->vSize.y},{restartButton->vSize.x,((restartButtonHoldTime/2.5f))*restartButton->vSize.y},{255,255,255,128}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::sort(units.begin(),units.end(),[&](auto&u1,auto&u2){ |
|
|
|
|
float dist1=geom2d::line<float>(u1->GetGhostPos(),GetWorldMousePos()).length(); |
|
|
|
@ -1160,7 +1164,6 @@ void VirusAttack::CalculateUsedMemory(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool VirusAttack::OnUserDestroy(){ |
|
|
|
|
std::for_each(scenarios.begin(),scenarios.end(),[](auto&scenario){delete scenario;}); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1188,6 +1191,11 @@ void VirusAttack::HandleRestartButton(float fElapsedTime){ |
|
|
|
|
if(restartButton->bPressed){ |
|
|
|
|
restartButtonHeldDown=true; |
|
|
|
|
} |
|
|
|
|
if(restartButton->bReleased){ |
|
|
|
|
restartBox.SetVisible(false); |
|
|
|
|
restartButtonHeldDown=false; |
|
|
|
|
restartButtonHoldTime=0; |
|
|
|
|
} |
|
|
|
|
if(restartButtonHeldDown){ |
|
|
|
|
restartButtonHoldTime+=fElapsedTime; |
|
|
|
|
if(restartButtonHoldTime>=CONSTANT::RESTART_BUTTON_HOLD_TIME){ |
|
|
|
|