@ -215,307 +215,315 @@ void VirusAttack::InitializeLevelData(){
}
}
# pragma endregion
# pragma region Stage 5
{
//Stage 5 data.
LevelName stage = STAGE5 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 48 , 48 } ;
levelData [ stage ] . levelColor = DARK_GREY ;
levelData [ stage ] . bgm = Sound : : BOSS1 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 640 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
# pragma region Stage 5
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
//Stage 5 data.
LevelName stage = STAGE5 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 48 , 48 } ;
levelData [ stage ] . levelColor = DARK_GREY ;
levelData [ stage ] . bgm = Sound : : BOSS1 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 640 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
collectionPoints . push_back ( CPData { { 8 * 24 , 1 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 10 * 24 , 1 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 32 * 24 , 12 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 20 * 24 , 32 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 9 * 24 , 1 * 24 } , 0 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 7 * 24 } , - PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 16 * 24 , 16 * 24 } , 0 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 36 * 24 , 1 * 24 } , - PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 3 * 24 } , - PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 6 * 24 } , - PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 11 * 24 } , - PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 22 * 24 } , - PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { 6 * 24 , 16 * 24 } , - PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 32 * 24 } , - PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 4 ) * 24 } , PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 7 ) * 24 } , PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 12 ) * 24 } , PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 23 ) * 24 } , PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 6 ) * 24 , ( 48 - 17 ) * 24 } , PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 33 ) * 24 } , PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 8 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 10 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 32 ) * 24 , ( 48 - 13 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 20 ) * 24 , ( 48 - 33 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 9 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 8 ) * 24 } , PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 16 ) * 24 , ( 48 - 17 ) * 24 } , PI , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 36 ) * 24 , ( 48 - 2 ) * 24 } , PI / 2 , MemoryType : : PROCEDURE } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
collectionPoints . push_back ( CPData { { 8 * 24 , 1 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 10 * 24 , 1 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 32 * 24 , 12 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 20 * 24 , 32 * 24 } , 0 , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { 9 * 24 , 1 * 24 } , 0 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 7 * 24 } , - PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 16 * 24 , 16 * 24 } , 0 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 36 * 24 , 1 * 24 } , - PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 3 * 24 } , - PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 6 * 24 } , - PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 11 * 24 } , - PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 22 * 24 } , - PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { 6 * 24 , 16 * 24 } , - PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { 1 * 24 , 32 * 24 } , - PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 4 ) * 24 } , PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 7 ) * 24 } , PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 12 ) * 24 } , PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 23 ) * 24 } , PI / 2 , MemoryType : : RANGE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 6 ) * 24 , ( 48 - 17 ) * 24 } , PI / 2 , MemoryType : : ATKSPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 33 ) * 24 } , PI / 2 , MemoryType : : MOVESPD } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 8 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 10 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 32 ) * 24 , ( 48 - 13 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 20 ) * 24 , ( 48 - 33 ) * 24 } , PI , MemoryType : : HEALTH } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 9 ) * 24 , ( 48 - 2 ) * 24 } , PI , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 1 ) * 24 , ( 48 - 8 ) * 24 } , PI / 2 , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 16 ) * 24 , ( 48 - 17 ) * 24 } , PI , MemoryType : : PROCEDURE } ) ;
collectionPoints . push_back ( CPData { { ( 48 - 36 ) * 24 , ( 48 - 2 ) * 24 } , PI / 2 , MemoryType : : PROCEDURE } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 42 * 24 , 42 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 45 * 24 , 41 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 42 * 24 , 42 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 42 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 45 * 24 , 41 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
}
}
# pragma endregion
# pragma region Stage 6
{
//Stage 6 data.
LevelName stage = STAGE6 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 48 , 48 } ;
levelData [ stage ] . levelColor = DARK_GREY ;
levelData [ stage ] . bgm = Sound : : BOSS1 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 640 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
# pragma endregion
# pragma region Stage 6
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
//Stage 6 data.
LevelName stage = STAGE6 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 48 , 48 } ;
levelData [ stage ] . levelColor = DARK_GREY ;
levelData [ stage ] . bgm = Sound : : BOSS1 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 640 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
}
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 44 * 24 , 44 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Refresher , vf2d { 2 * 24 , 42 * 24 } , false } ) ;
units . push_back ( { UnitType : : MemoryGuard , vf2d { 7 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 5 * 24 , 41 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 44 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Refresher , vf2d { 2 * 24 , 42 * 24 } , false } ) ;
units . push_back ( { UnitType : : MemoryGuard , vf2d { 7 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 2 * 24 , 44 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 5 * 24 , 41 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 44 * 24 } , false } ) ;
}
}
# pragma endregion
# pragma region Stage 7
{
//Stage 7 data.
LevelName stage = STAGE7 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 64 , 64 } ;
levelData [ stage ] . levelColor = DARK_RED ;
levelData [ stage ] . bgm = Sound : : BOSS2 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 960 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
# pragma endregion
# pragma region Stage 7
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
//Stage 7 data.
LevelName stage = STAGE7 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 64 , 64 } ;
levelData [ stage ] . levelColor = DARK_RED ;
levelData [ stage ] . bgm = Sound : : BOSS2 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 960 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 }
, { 14 , 16 } , { 27 , 29 } , { 14 , 12 } , { 7 , 36 } , { 16 , 30 } , { 22 , 19 } , { 39 , 40 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD ,
MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 }
, { 14 , 16 } , { 27 , 29 } , { 14 , 12 } , { 7 , 36 } , { 16 , 30 } , { 22 , 19 } , { 39 , 40 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD ,
MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
}
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 52 * 24 , 52 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 55 * 24 , 51 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 52 * 24 , 52 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : LeftShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : Corrupter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 52 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 55 * 24 , 51 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 53 * 24 , 22 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 24 * 24 } , false } ) ;
for ( int i = 0 ; i < 2 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 25 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : RightShifter , vf2d { 53 * 24 , 24 * 24 } , false } ) ;
units . push_back ( { UnitType : : BitRestorer , vf2d { 54 * 24 , 25 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 54 * 24 , 26 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : Turret , vf2d { 53 * 24 , 22 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 54 * 24 , 24 * 24 } , false } ) ;
for ( int i = 0 ; i < 2 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 25 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : RightShifter , vf2d { 53 * 24 , 24 * 24 } , false } ) ;
units . push_back ( { UnitType : : BitRestorer , vf2d { 54 * 24 , 25 * 24 } , false } ) ;
units . push_back ( { UnitType : : RightShifter , vf2d { 54 * 24 , 26 * 24 } , false } ) ;
}
# pragma endregion
# pragma region Stage 8
{
//Stage 8 data.
LevelName stage = STAGE8 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 64 , 64 } ;
levelData [ stage ] . levelColor = DARK_RED ;
levelData [ stage ] . bgm = Sound : : BOSS2 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 1280 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
}
# pragma endregion
# pragma region Stage 8
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
//Stage 8 data.
LevelName stage = STAGE8 ;
levelData [ stage ] . name = stage ;
levelData [ stage ] . cameraStart = { 96 , 96 } ;
levelData [ stage ] . worldZoom = { 1 , 1 } ;
levelData [ stage ] . size = { 64 , 64 } ;
levelData [ stage ] . levelColor = DARK_RED ;
levelData [ stage ] . bgm = Sound : : BOSS2 ;
levelData [ stage ] . scenarioIndex = int ( stage ) ;
levelData [ stage ] . availableMemory = 1280 ;
levelData [ stage ] . player_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
levelData [ stage ] . enemy_starting_resources = { 5 , 5 , 5 , 5 , 5 } ;
{
std : : vector < UnitData > & units = levelData [ stage ] . unitPlacement ;
std : : vector < CPData > & collectionPoints = levelData [ stage ] . cpPlacement ;
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
units . push_back ( { UnitType : : RAMBank , vf2d { 4 * 24 , 4 * 24 } , true } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 4 * 24 , 6 * 24 } , true } ) ;
}
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 }
, { 14 , 16 } , { 27 , 29 } , { 14 , 12 } , { 7 , 36 } , { 16 , 30 } , { 22 , 19 } , { 39 , 40 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD ,
MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
std : : vector < vf2d > positions = {
{ { 8 , 1 } , { 10 , 1 } , { 32 , 12 } , { 20 , 32 } , { 9 , 1 } , { 1 , 7 } , { 16 , 16 }
, { 36 , 1 } , { 1 , 3 } , { 1 , 6 } , { 1 , 11 } , { 1 , 22 } , { 6 , 16 } , { 1 , 32 }
, { 14 , 16 } , { 27 , 29 } , { 14 , 12 } , { 7 , 36 } , { 16 , 30 } , { 22 , 19 } , { 39 , 40 } }
} ;
std : : vector < MemoryType > types = {
{ MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : PROCEDURE , MemoryType : : RANGE ,
MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , MemoryType : : ATKSPD , MemoryType : : MOVESPD ,
MemoryType : : HEALTH , MemoryType : : HEALTH , MemoryType : : PROCEDURE ,
MemoryType : : PROCEDURE , MemoryType : : ATKSPD , MemoryType : : MOVESPD , MemoryType : : RANGE , }
} ;
if ( positions . size ( ) ! = types . size ( ) ) {
throw ;
}
while ( positions . size ( ) > 0 ) {
int randomIndex = rand ( ) % positions . size ( ) ;
int randomIndex2 = rand ( ) % types . size ( ) ;
float finalDir = 0 ;
if ( positions [ randomIndex ] . x < levelData [ stage ] . size . x / 2 ) {
if ( positions [ randomIndex ] . y < positions [ randomIndex ] . x ) {
finalDir = 0 ;
} else {
finalDir = - PI / 2 ;
}
} else {
if ( positions [ randomIndex ] . y > positions [ randomIndex ] . x ) {
finalDir = PI ;
} else {
finalDir = PI / 2 ;
}
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
types . erase ( types . begin ( ) + randomIndex2 ) ;
}
collectionPoints . push_back ( CPData { positions [ randomIndex ] * 24 , finalDir , types [ randomIndex2 ] } ) ;
collectionPoints . push_back ( CPData { ( levelData [ stage ] . size - positions [ randomIndex ] - vf2d { 1 , 1 } ) * 24 , float ( finalDir + PI ) , types [ randomIndex2 ] } ) ;
positions . erase ( positions . begin ( ) + randomIndex ) ;
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 + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 54 * 24 , 54 * 24 } , false } ) ;
for ( int i = 0 ; i < 5 ; i + + ) {
units . push_back ( { UnitType : : MemoryAllocator , vf2d { 39 * 24 , 35 * 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 : : 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 : : Turret , vf2d { 11 * 24 , 52 * 24 } , false } ) ;
}
units . push_back ( { UnitType : : RAMBank , vf2d { 40 * 24 , 36 * 24 } , false } ) ;
units . push_back ( { UnitType : : RAMBank , vf2d { 10 * 24 , 54 * 24 } , false } ) ;
}
}
# pragma endregion
# pragma endregion
}
bool VirusAttack : : OnUserCreate ( ) {
@ -1294,7 +1302,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){
for ( auto & u : units ) {
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 } ) ;
}
}
@ -1383,9 +1391,16 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){
# pragma endregion
# pragma region 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 ) ;
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 ;
# pragma endregion
}