@ -353,7 +353,6 @@ void VirusAttack::InitializeLevelData(){
}
}
}
}
# pragma endregion
# pragma endregion
# pragma region Stage 7
# pragma region Stage 7
{
{
//Stage 7 data.
//Stage 7 data.
@ -439,8 +438,6 @@ void VirusAttack::InitializeLevelData(){
}
}
}
}
# pragma endregion
# pragma endregion
# pragma region Stage 8
# pragma region Stage 8
{
{
//Stage 8 data.
//Stage 8 data.
@ -502,17 +499,28 @@ void VirusAttack::InitializeLevelData(){
types . erase ( types . begin ( ) + randomIndex2 ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
}
units . push_back ( { UnitType : : Refresher , vf2d { 52 * 24 , 52 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
for ( int i = 0 ; i < 2 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 53 * 24 , 53 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Refresher , vf2d { 56 * 24 , 56 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 39 * 24 , 3 5* 24 } , false } ) ;
}
}
units . push_back ( { UnitType : : Refresher , vf2d { 43 * 24 , 52 * 24 } , false } ) ;
units . push_back ( { UnitType : : Turret , vf2d { 44 * 24 , 52 * 24 } , false } ) ;
units . push_back ( { UnitType : : MemoryGuard , vf2d { 40 * 24 , 35 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 40 * 24 , 36 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 40 * 24 , 36 * 24 } , false } ) ;
units . push_back ( { UnitType : : Turret , vf2d { 37 * 24 , 57 * 24 } , false } ) ;
units . push_back ( { UnitType : : Turret , vf2d { 42 * 24 , 57 * 24 } , false } ) ;
for ( int i = 0 ; i < 2 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 10 * 24 , 53 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : RAMBank , vf2d { 10 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 10 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : Turret , vf2d { 11 * 24 , 52 * 24 } , false } ) ;
}
}
}
}
# pragma endregion
# pragma endregion
@ -1294,7 +1302,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){
for ( auto & u : units ) {
for ( auto & u : units ) {
u - > Draw ( gametv , IMAGES ) ;
u - > Draw ( gametv , IMAGES ) ;
if ( u - > IsGuarded ( ) ) {
if ( u - > IsGuarded ( ) & & ! u - > InFogOfWar ( ) ) {
gametv . DrawDecal ( u - > GetPos ( ) + vf2d { float ( u - > GetUnitSize ( ) . x / 2 ) , - float ( u - > GetUnitSize ( ) . y / 2 ) } - vf2d { float ( IMAGES [ GUARD_ICON ] - > Sprite ( ) - > width ) , 0.f } * 0.375 , IMAGES [ GUARD_ICON ] - > Decal ( ) , { 0.375 , 0.375 } ) ;
gametv . DrawDecal ( u - > GetPos ( ) + vf2d { float ( u - > GetUnitSize ( ) . x / 2 ) , - float ( u - > GetUnitSize ( ) . y / 2 ) } - vf2d { float ( IMAGES [ GUARD_ICON ] - > Sprite ( ) - > width ) , 0.f } * 0.375 , IMAGES [ GUARD_ICON ] - > Decal ( ) , { 0.375 , 0.375 } ) ;
}
}
}
}
@ -1383,9 +1391,16 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){
# pragma endregion
# pragma endregion
# pragma region COMPLETED
# pragma region COMPLETED
case GameState : : COMPLETED : {
case GameState : : COMPLETED : {
DrawPartialDecal ( { 0 , 0 } , GetScreenSize ( ) , IMAGES [ MATRIX ] - > Decal ( ) , randomBackgroundOffset + gametv . GetWorldOffset ( ) * ( vf2d { 32 , 32 } / vf2d ( GetScreenSize ( ) ) ) * gametv . GetWorldScale ( ) , { 32 , 32 } , Pixel { currentLevel - > levelColor . r , currentLevel - > levelColor . g , currentLevel - > levelColor . b , 164 } / 2 ) ;
DrawPartialDecal ( { 0 , 0 } , GetScreenSize ( ) , IMAGES [ MATRIX ] - > Decal ( ) , randomBackgroundOffset + gametv . GetWorldOffset ( ) * ( vf2d { 32 , 32 } / vf2d ( GetScreenSize ( ) ) ) * gametv . GetWorldScale ( ) , { 32 , 32 } , Pixel { currentLevel - > levelColor . r , currentLevel - > levelColor . g , currentLevel - > levelColor . b , 164 } / 2 ) ;
completedBox . Initialize ( " Thank you for playing Virus Attack! \n \n Completion Time: " + std : : to_string ( gameSeconds ) + " seconds \n \n Huge shoutout to the OLC community, javidx9 for the PGE, and all supporters! " ) ;
completedBox . Initialize ( " Thank you for playing Virus Attack! \n \n Completion Time: " + std : : to_string ( gameSeconds ) + " seconds \n \n Huge shoutout to the OLC community, javidx9 for the PGE, and all supporters! \n \n \n Press [Escape] to return to the main menu. " , { 0 , 0 } , " Congratulations! " , nullptr , { float ( ScreenWidth ( ) - 2 ) , 1.f } ) ;
completedBox . UpdateAndDraw ( { 0 , 0 } , this , player_resources , IMAGES , GetTotalUsedMemory ( ) , currentLevel - > availableMemory ) ;
if ( GetKey ( ESCAPE ) . bPressed ) {
state = GameState : : MAIN_MENU ;
float titleScreenY = - 200 ;
float textOrientationY = 0 ;
float textOrientationX = 0 ;
levelToLoad = LevelName : : STAGE1 ;
}
} break ;
} break ;
# pragma endregion
# pragma endregion
}
}