@ -123,6 +123,7 @@ bool Crawler::OnUserCreate(){
bool Crawler : : OnUserUpdate ( float fElapsedTime ) {
fElapsedTime = std : : clamp ( fElapsedTime , 0.f , 1 / 30.f ) ; //HACK fix. We can't have a negative time. Although using a more precise system clock should make this never occur. Also make sure if the game is too slow we advance by only 1/30th of a second.
levelTime + = fElapsedTime ;
bossDisplayTimer = std : : max ( 0.f , bossDisplayTimer - fElapsedTime ) ;
HandleUserInput ( fElapsedTime ) ;
UpdateEffects ( fElapsedTime ) ;
player - > Update ( fElapsedTime ) ;
@ -1024,6 +1025,21 @@ void Crawler::RenderHud(){
std : : string displayText = player - > notificationDisplay . first ;
DrawShadowStringPropDecal ( vf2d { float ( ScreenWidth ( ) / 2 ) , float ( ScreenHeight ( ) / 4 ) - 24 } - GetTextSizeProp ( displayText ) / 2 , displayText , BLUE , VERY_DARK_BLUE ) ;
}
if ( bossDisplayTimer > 0 ) {
std : : string displayText = " - " + bossName + " - " ;
uint8_t alpha = 0 ;
if ( bossDisplayTimer > 4 ) {
alpha = uint8_t ( ( 5 - bossDisplayTimer ) * 255 ) ;
} else
if ( bossDisplayTimer > 1 ) {
alpha = 255 ;
} else {
alpha = uint8_t ( ( bossDisplayTimer ) * 255 ) ;
}
vf2d textScale = { 3 , 5 } ;
DrawShadowStringPropDecal ( vf2d { float ( ScreenWidth ( ) / 2 ) , float ( ScreenHeight ( ) / 2 ) } - vf2d { GetTextSizeProp ( displayText ) } * textScale / 2 , displayText , { 252 , 186 , 3 , alpha } , { 128 , 0 , 0 , alpha } , textScale , 2 ) ;
}
std : : string versionStr ( " v " + std : : to_string ( VERSION_MAJOR ) + " . " + std : : to_string ( VERSION_MINOR ) + " . " + std : : to_string ( VERSION_PATCH ) + " . " + std : : to_string ( VERSION_BUILD ) ) ;
DrawShadowStringDecal ( vf2d { GetScreenSize ( ) } - vf2d { GetTextSize ( versionStr ) } * 0.4 , versionStr , WHITE , BLACK , { 0.4 , 0.4 } , 0.4 ) ;
if ( " debug_player_info " _I ) {
@ -1158,7 +1174,7 @@ void Crawler::LoadLevel(MapName map){
int monsterTypeID = monster . GetInteger ( " value " ) - 1 ;
monster_list . push_back ( { monsterTypeID , { monster . GetInteger ( " x " ) - spawnData . ObjectData . GetFloat ( " x " ) , monster . GetInteger ( " y " ) - spawnData . ObjectData . GetFloat ( " y " ) } } ) ;
}
SPAWNER_LIST . push_back ( MonsterSpawner { { spawnData . ObjectData . GetFloat ( " x " ) , spawnData . ObjectData . GetFloat ( " y " ) } , spawnerRadius * 2 , monster_list , spawnData . upperLevel } ) ;
SPAWNER_LIST . push_back ( MonsterSpawner { { spawnData . ObjectData . GetFloat ( " x " ) , spawnData . ObjectData . GetFloat ( " y " ) } , spawnerRadius * 2 , monster_list , spawnData . upperLevel , spawnData . bossNameDisplay } ) ;
}
# pragma endregion
@ -1588,4 +1604,9 @@ void Crawler::InitializeDefaultKeybinds(){
KEY_UP . AddKeybind ( { KEY , W } ) ;
KEY_DOWN . AddKeybind ( { KEY , DOWN } ) ;
KEY_DOWN . AddKeybind ( { KEY , S } ) ;
}
void Crawler : : SetBossNameDisplay ( std : : string name , float time ) {
bossName = name ;
bossDisplayTimer = time ;
}