@ -85,6 +85,7 @@ All rights reserved.
INCLUDE_EMITTER_LIST
INCLUDE_ITEM_CATEGORIES
INCLUDE_BACKDROP_DATA
INCLUDE_FOREDROP_DATA
INCLUDE_MONSTER_DATA
INCLUDE_PACK_KEY
@ -1037,8 +1038,26 @@ void AiL::RenderWorld(float fElapsedTime){
}
# pragma region Basic Tile Layer Rendering
const MapTag & currentMap = GetCurrentMapData ( ) ;
vf2d backgroundToMapRatio ;
vf2d backgroundExcessAmount ;
vf2d backgroundSize ;
vf2d foregroundExcessAmount ;
vf2d foregroundSize ;
vf2d foregroundToMapRatio ;
const vf2d mapPixelSize = currentMap . MapSize * currentMap . TileSize ;
if ( GetCurrentMap ( ) . backdrop . length ( ) > 0 ) {
DrawPartialDecal ( { 0 , 0 } , WINDOW_SIZE , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , " Backdrop Config.Speed Ratio " _F * - camera . GetPosition ( ) + view . GetWorldOffset ( ) , WINDOW_SIZE ) ;
backgroundSize = BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Sprite ( ) - > Size ( ) ;
backgroundExcessAmount = backgroundSize - vf2d ( WINDOW_SIZE ) ; //Extends outside the boundaries of the screen. Essentially the background size minus the size of the screen and take half to get the amount that extends in any one direction.
backgroundToMapRatio = 1 - ( backgroundExcessAmount / mapPixelSize ) ; //Expected range is from -half map size to +half map size.
DrawPartialDecal ( { } , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , backgroundToMapRatio * - camera . GetPosition ( ) + view . GetWorldOffset ( ) + WINDOW_SIZE / 2 , WINDOW_SIZE ) ;
if ( FOREDROP_DATA . count ( GetCurrentMap ( ) . backdrop ) ) {
foregroundSize = FOREDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Sprite ( ) - > Size ( ) ;
foregroundExcessAmount = foregroundSize - vf2d ( WINDOW_SIZE ) ; //Extends outside the boundaries of the screen. Essentially the background size minus the size of the screen and take half to get the amount that extends in any one direction.
foregroundToMapRatio = 1 - ( foregroundExcessAmount / mapPixelSize ) ;
DrawPartialDecal ( { } , FOREDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , foregroundToMapRatio * - camera . GetPosition ( ) + view . GetWorldOffset ( ) + WINDOW_SIZE / 2 , WINDOW_SIZE ) ;
}
} else {
FillRectDecal ( { 0 , 0 } , GetScreenSize ( ) , { 100 , 180 , 100 } ) ;
}
@ -1144,7 +1163,8 @@ void AiL::RenderWorld(float fElapsedTime){
# pragma region Render Backdrop
if ( GetCurrentMap ( ) . backdrop . length ( ) > 0 ) {
vf2d tileWorldPos = vi2d { x , y } * GetCurrentMapData ( ) . tilewidth ;
view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , " Backdrop Config.Speed Ratio " _F * - camera . GetPosition ( ) + tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , backgroundToMapRatio * - camera . GetPosition ( ) + tileWorldPos + WINDOW_SIZE / 2 , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
if ( FOREDROP_DATA . count ( GetCurrentMap ( ) . backdrop ) ) view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , FOREDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , foregroundToMapRatio * - camera . GetPosition ( ) + tileWorldPos + WINDOW_SIZE / 2 , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
} else {
view . FillRectDecal ( vi2d { x , y } * GetCurrentMapData ( ) . tilewidth , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , { 100 , 180 , 100 } ) ;
}
@ -1174,7 +1194,8 @@ void AiL::RenderWorld(float fElapsedTime){
} else {
if ( GetCurrentMap ( ) . backdrop . length ( ) > 0 ) {
vf2d tileWorldPos = vi2d { x , y } * GetCurrentMapData ( ) . tilewidth ;
view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , " Backdrop Config.Speed Ratio " _F * - camera . GetPosition ( ) + tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , BACKDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , backgroundToMapRatio * - camera . GetPosition ( ) + tileWorldPos + WINDOW_SIZE / 2 , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
if ( FOREDROP_DATA . count ( GetCurrentMap ( ) . backdrop ) ) view . DrawPartialDecal ( tileWorldPos , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , FOREDROP_DATA [ GetCurrentMap ( ) . backdrop ] . Decal ( ) , foregroundToMapRatio * - camera . GetPosition ( ) + tileWorldPos + WINDOW_SIZE / 2 , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } ) ;
} else {
view . FillRectDecal ( vi2d { x , y } * GetCurrentMapData ( ) . tilewidth , { float ( GetCurrentMapData ( ) . tilewidth ) , float ( GetCurrentMapData ( ) . tilewidth ) } , { 100 , 180 , 100 } ) ;
}
@ -3008,6 +3029,7 @@ bool AiL::OnUserDestroy(){
delete value ;
}
BACKDROP_DATA . clear ( ) ;
FOREDROP_DATA . clear ( ) ;
return true ;
} else {
return false ; //Something is preventing us from quitting. We wait patiently...
@ -3047,6 +3069,10 @@ void AiL::InitializeLevels(){
Renderable & backdrop = BACKDROP_DATA [ key ] ;
LoadResource ( backdrop , " backdrop_directory " _S + DATA [ " Backdrops " ] [ key ] . GetString ( ) , false , false ) ;
}
for ( auto & [ key , size ] : DATA [ " Foredrops " ] ) {
Renderable & backdrop = FOREDROP_DATA [ key ] ;
LoadResource ( backdrop , " backdrop_directory " _S + DATA [ " Foredrops " ] [ key ] . GetString ( ) , false , false ) ;
}
Test : : RunMapTests ( ) ;
}