@ -36,7 +36,7 @@ All rights reserved.
*/
*/
# pragma endregion
# pragma endregion
# include "olcPGEX_TransformedView.h"
# include "olcPGEX_TransformedView.h"
# include "Crawler .h"
# include "AdventuresInLestoria .h"
# include "olcUTIL_Camera2D.h"
# include "olcUTIL_Camera2D.h"
# include "DamageNumber.h"
# include "DamageNumber.h"
# include "Bullet.h"
# include "Bullet.h"
@ -86,21 +86,21 @@ std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
safemap < std : : string , Renderable > GFX ;
safemap < std : : string , Renderable > GFX ;
safemap < std : : string , MapName > LEVEL_NAMES ;
safemap < std : : string , MapName > LEVEL_NAMES ;
utils : : datafile DATA ;
utils : : datafile DATA ;
Crawler * game ;
AiL * game ;
InputGroup Crawler : : KEY_LEFT ;
InputGroup AiL : : KEY_LEFT ;
InputGroup Crawler : : KEY_RIGHT ;
InputGroup AiL : : KEY_RIGHT ;
InputGroup Crawler : : KEY_UP ;
InputGroup AiL : : KEY_UP ;
InputGroup Crawler : : KEY_DOWN ;
InputGroup AiL : : KEY_DOWN ;
InputGroup Crawler : : KEY_ATTACK ;
InputGroup AiL : : KEY_ATTACK ;
InputGroup Crawler : : KEY_CONFIRM ;
InputGroup AiL : : KEY_CONFIRM ;
InputGroup Crawler : : KEY_MENU ;
InputGroup AiL : : KEY_MENU ;
# ifndef __EMSCRIPTEN__
# ifndef __EMSCRIPTEN__
: : discord : : Core * Discord { } ;
: : discord : : Core * Discord { } ;
# endif
# endif
float Crawler : : SIZE_CHANGE_SPEED = 1 ;
float AiL : : SIZE_CHANGE_SPEED = 1 ;
Crawler : : Crawler ( )
AiL : : AiL ( )
{
{
utils : : datafile : : Read ( DATA , " assets/config/configuration.txt " ) ;
utils : : datafile : : Read ( DATA , " assets/config/configuration.txt " ) ;
@ -155,7 +155,7 @@ Crawler::Crawler()
gameStarted = time ( NULL ) ;
gameStarted = time ( NULL ) ;
}
}
bool Crawler : : OnUserCreate ( ) {
bool AiL : : OnUserCreate ( ) {
Font : : init ( ) ;
Font : : init ( ) ;
InitializeDefaultKeybinds ( ) ;
InitializeDefaultKeybinds ( ) ;
@ -242,7 +242,7 @@ bool Crawler::OnUserCreate(){
return true ;
return true ;
}
}
bool Crawler : : OnUserUpdate ( float fElapsedTime ) {
bool AiL : : OnUserUpdate ( float fElapsedTime ) {
levelTime + = fElapsedTime ;
levelTime + = fElapsedTime ;
if ( ! GamePaused ( ) ) {
if ( ! GamePaused ( ) ) {
GameState : : STATE - > OnUserUpdate ( this ) ;
GameState : : STATE - > OnUserUpdate ( this ) ;
@ -265,32 +265,32 @@ bool Crawler::OnUserUpdate(float fElapsedTime){
return ! gameEnd ;
return ! gameEnd ;
}
}
bool Crawler : : LeftHeld ( ) {
bool AiL : : LeftHeld ( ) {
return KEY_LEFT . Held ( ) ;
return KEY_LEFT . Held ( ) ;
}
}
bool Crawler : : RightHeld ( ) {
bool AiL : : RightHeld ( ) {
return KEY_RIGHT . Held ( ) ;
return KEY_RIGHT . Held ( ) ;
}
}
bool Crawler : : UpHeld ( ) {
bool AiL : : UpHeld ( ) {
return KEY_UP . Held ( ) ;
return KEY_UP . Held ( ) ;
}
}
bool Crawler : : DownHeld ( ) {
bool AiL : : DownHeld ( ) {
return KEY_DOWN . Held ( ) ;
return KEY_DOWN . Held ( ) ;
}
}
bool Crawler : : LeftReleased ( ) {
bool AiL : : LeftReleased ( ) {
return KEY_LEFT . Released ( ) ;
return KEY_LEFT . Released ( ) ;
}
}
bool Crawler : : RightReleased ( ) {
bool AiL : : RightReleased ( ) {
return KEY_RIGHT . Released ( ) ;
return KEY_RIGHT . Released ( ) ;
}
}
bool Crawler : : UpReleased ( ) {
bool AiL : : UpReleased ( ) {
return KEY_UP . Released ( ) ;
return KEY_UP . Released ( ) ;
}
}
bool Crawler : : DownReleased ( ) {
bool AiL : : DownReleased ( ) {
return KEY_DOWN . Released ( ) ;
return KEY_DOWN . Released ( ) ;
}
}
void Crawler : : HandleUserInput ( float fElapsedTime ) {
void AiL : : HandleUserInput ( float fElapsedTime ) {
if ( ! Menu : : stack . empty ( ) ) return ; //A window being opened means there's no user input allowed.
if ( ! Menu : : stack . empty ( ) ) return ; //A window being opened means there's no user input allowed.
bool setIdleAnimation = true ;
bool setIdleAnimation = true ;
@ -492,7 +492,7 @@ void Crawler::HandleUserInput(float fElapsedTime){
}
}
}
}
void Crawler : : UpdateCamera ( float fElapsedTime ) {
void AiL : : UpdateCamera ( float fElapsedTime ) {
lastWorldShakeAdjust = std : : max ( 0.f , lastWorldShakeAdjust - fElapsedTime ) ;
lastWorldShakeAdjust = std : : max ( 0.f , lastWorldShakeAdjust - fElapsedTime ) ;
if ( worldShakeTime > 0 ) {
if ( worldShakeTime > 0 ) {
worldShakeTime - = fElapsedTime ;
worldShakeTime - = fElapsedTime ;
@ -510,7 +510,7 @@ void Crawler::UpdateCamera(float fElapsedTime){
view . SetWorldOffset ( camera . GetViewPosition ( ) ) ;
view . SetWorldOffset ( camera . GetViewPosition ( ) ) ;
}
}
void Crawler : : UpdateEffects ( float fElapsedTime ) {
void AiL : : UpdateEffects ( float fElapsedTime ) {
for ( auto it = EMITTER_LIST . begin ( ) ; it ! = EMITTER_LIST . end ( ) ; + + it ) {
for ( auto it = EMITTER_LIST . begin ( ) ; it ! = EMITTER_LIST . end ( ) ; + + it ) {
auto ptr = ( * it ) . get ( ) ;
auto ptr = ( * it ) . get ( ) ;
ptr - > Update ( fElapsedTime ) ;
ptr - > Update ( fElapsedTime ) ;
@ -538,7 +538,7 @@ void Crawler::UpdateEffects(float fElapsedTime){
foregroundEffectsToBeInserted . clear ( ) ;
foregroundEffectsToBeInserted . clear ( ) ;
backgroundEffectsToBeInserted . clear ( ) ;
backgroundEffectsToBeInserted . clear ( ) ;
}
}
void Crawler : : UpdateBullets ( float fElapsedTime ) {
void AiL : : UpdateBullets ( float fElapsedTime ) {
for ( auto it = BULLET_LIST . begin ( ) ; it ! = BULLET_LIST . end ( ) ; + + it ) {
for ( auto it = BULLET_LIST . begin ( ) ; it ! = BULLET_LIST . end ( ) ; + + it ) {
Bullet * b = ( * it ) . get ( ) ;
Bullet * b = ( * it ) . get ( ) ;
b - > UpdateFadeTime ( fElapsedTime ) ;
b - > UpdateFadeTime ( fElapsedTime ) ;
@ -605,7 +605,7 @@ void Crawler::UpdateBullets(float fElapsedTime){
}
}
std : : erase_if ( BULLET_LIST , [ ] ( std : : unique_ptr < Bullet > & b ) { return b - > dead ; } ) ;
std : : erase_if ( BULLET_LIST , [ ] ( std : : unique_ptr < Bullet > & b ) { return b - > dead ; } ) ;
}
}
void Crawler : : HurtEnemies ( vf2d pos , float radius , int damage , bool upperLevel , float z ) {
void AiL : : HurtEnemies ( vf2d pos , float radius , int damage , bool upperLevel , float z ) {
for ( Monster & m : MONSTER_LIST ) {
for ( Monster & m : MONSTER_LIST ) {
if ( geom2d : : overlaps ( geom2d : : circle ( pos , radius ) , geom2d : : circle ( m . GetPos ( ) , 12 * m . GetSizeMult ( ) ) ) ) {
if ( geom2d : : overlaps ( geom2d : : circle ( pos , radius ) , geom2d : : circle ( m . GetPos ( ) , 12 * m . GetSizeMult ( ) ) ) ) {
m . Hurt ( damage , upperLevel , z ) ;
m . Hurt ( damage , upperLevel , z ) ;
@ -613,7 +613,7 @@ void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float
}
}
}
}
void Crawler : : PopulateRenderLists ( ) {
void AiL : : PopulateRenderLists ( ) {
monstersBeforeLower . clear ( ) ;
monstersBeforeLower . clear ( ) ;
monstersAfterLower . clear ( ) ;
monstersAfterLower . clear ( ) ;
monstersBeforeUpper . clear ( ) ;
monstersBeforeUpper . clear ( ) ;
@ -706,7 +706,7 @@ void Crawler::PopulateRenderLists(){
std : : sort ( monstersAfterLower . begin ( ) , monstersAfterLower . end ( ) , [ ] ( Monster * m1 , Monster * m2 ) { return m1 - > GetPos ( ) . y < m2 - > GetPos ( ) . y ; } ) ;
std : : sort ( monstersAfterLower . begin ( ) , monstersAfterLower . end ( ) , [ ] ( Monster * m1 , Monster * m2 ) { return m1 - > GetPos ( ) . y < m2 - > GetPos ( ) . y ; } ) ;
}
}
void Crawler : : RenderTile ( vi2d pos , TilesheetData tileSheet , int tileSheetIndex , vi2d tileSheetPos ) {
void AiL : : RenderTile ( vi2d pos , TilesheetData tileSheet , int tileSheetIndex , vi2d tileSheetPos ) {
if ( tileSheet . tileset - > animationData . count ( tileSheetIndex ) ) {
if ( tileSheet . tileset - > animationData . count ( tileSheetIndex ) ) {
int animationDuration_ms = int ( tileSheet . tileset - > animationData [ tileSheetIndex ] . size ( ) * " animation_tile_precision " _I ) ;
int animationDuration_ms = int ( tileSheet . tileset - > animationData [ tileSheetIndex ] . size ( ) * " animation_tile_precision " _I ) ;
int animatedIndex = tileSheet . tileset - > animationData [ tileSheetIndex ] [ size_t ( fmod ( levelTime * 1000.f , animationDuration_ms ) / " animation_tile_precision " _I ) ] ;
int animatedIndex = tileSheet . tileset - > animationData [ tileSheetIndex ] [ size_t ( fmod ( levelTime * 1000.f , animationDuration_ms ) / " animation_tile_precision " _I ) ] ;
@ -719,7 +719,7 @@ void Crawler::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2
}
}
}
}
void Crawler : : RenderTile ( TileRenderData & tileSheet , Pixel col ) {
void AiL : : RenderTile ( TileRenderData & tileSheet , Pixel col ) {
if ( tileSheet . tileSheet . tileset - > animationData . count ( tileSheet . tileID % 1000000 ) ) {
if ( tileSheet . tileSheet . tileset - > animationData . count ( tileSheet . tileID % 1000000 ) ) {
int animationDuration_ms = int ( tileSheet . tileSheet . tileset - > animationData [ tileSheet . tileID % 1000000 ] . size ( ) * " animation_tile_precision " _I ) ;
int animationDuration_ms = int ( tileSheet . tileSheet . tileset - > animationData [ tileSheet . tileID % 1000000 ] . size ( ) * " animation_tile_precision " _I ) ;
int animatedIndex = tileSheet . tileSheet . tileset - > animationData [ tileSheet . tileID % 1000000 ] [ size_t ( fmod ( levelTime * 1000.f , animationDuration_ms ) / " animation_tile_precision " _I ) ] ;
int animatedIndex = tileSheet . tileSheet . tileset - > animationData [ tileSheet . tileID % 1000000 ] [ size_t ( fmod ( levelTime * 1000.f , animationDuration_ms ) / " animation_tile_precision " _I ) ] ;
@ -732,7 +732,7 @@ void Crawler::RenderTile(TileRenderData&tileSheet,Pixel col){
}
}
}
}
void Crawler : : RenderWorld ( float fElapsedTime ) {
void AiL : : RenderWorld ( float fElapsedTime ) {
LayerTag * bridgeLayer = nullptr ;
LayerTag * bridgeLayer = nullptr ;
bool bridgeLayerFade = false ;
bool bridgeLayerFade = false ;
@ -1235,11 +1235,11 @@ void Crawler::RenderWorld(float fElapsedTime){
}
}
}
}
Player * Crawler : : GetPlayer ( ) {
Player * AiL : : GetPlayer ( ) {
return player . get ( ) ;
return player . get ( ) ;
}
}
void Crawler : : RenderHud ( ) {
void AiL : : RenderHud ( ) {
ItemOverlay : : Draw ( ) ;
ItemOverlay : : Draw ( ) ;
RenderCooldowns ( ) ;
RenderCooldowns ( ) ;
@ -1291,7 +1291,7 @@ void Crawler::RenderHud(){
DrawShadowStringDecal ( { 0 , 12 } , " Button Hold Time: " + std : : to_string ( Menu : : menus [ INVENTORY_CONSUMABLES ] - > buttonHoldTime ) ) ;
DrawShadowStringDecal ( { 0 , 12 } , " Button Hold Time: " + std : : to_string ( Menu : : menus [ INVENTORY_CONSUMABLES ] - > buttonHoldTime ) ) ;
} }
} }
void Crawler : : RenderCooldowns ( ) {
void AiL : : RenderCooldowns ( ) {
std : : vector < Ability > cooldowns {
std : : vector < Ability > cooldowns {
player - > GetAbility1 ( ) ,
player - > GetAbility1 ( ) ,
player - > GetAbility2 ( ) ,
player - > GetAbility2 ( ) ,
@ -1396,12 +1396,12 @@ void Crawler::RenderCooldowns(){
}
}
}
}
void Crawler : : AddEffect ( std : : unique_ptr < Effect > foreground , std : : unique_ptr < Effect > background ) {
void AiL : : AddEffect ( std : : unique_ptr < Effect > foreground , std : : unique_ptr < Effect > background ) {
AddEffect ( std : : move ( background ) , true ) ;
AddEffect ( std : : move ( background ) , true ) ;
AddEffect ( std : : move ( foreground ) ) ;
AddEffect ( std : : move ( foreground ) ) ;
}
}
void Crawler : : AddEffect ( std : : unique_ptr < Effect > foreground , bool back ) {
void AiL : : AddEffect ( std : : unique_ptr < Effect > foreground , bool back ) {
if ( back ) {
if ( back ) {
backgroundEffectsToBeInserted . push_back ( std : : move ( foreground ) ) ;
backgroundEffectsToBeInserted . push_back ( std : : move ( foreground ) ) ;
} else {
} else {
@ -1409,11 +1409,11 @@ void Crawler::AddEffect(std::unique_ptr<Effect> foreground,bool back){
}
}
}
}
vf2d Crawler : : GetWorldMousePos ( ) {
vf2d AiL : : GetWorldMousePos ( ) {
return GetMousePos ( ) + view . GetWorldOffset ( ) ;
return GetMousePos ( ) + view . GetWorldOffset ( ) ;
}
}
void Crawler : : SetupWorldShake ( float duration ) {
void AiL : : SetupWorldShake ( float duration ) {
worldShakeVel = { 13 , - 13 } ;
worldShakeVel = { 13 , - 13 } ;
worldShakeTime = duration ;
worldShakeTime = duration ;
worldShake = vf2d { player - > GetPos ( ) } ;
worldShake = vf2d { player - > GetPos ( ) } ;
@ -1421,7 +1421,7 @@ void Crawler::SetupWorldShake(float duration){
}
}
void Crawler : : InitializeLevel ( std : : string mapFile , MapName map ) {
void AiL : : InitializeLevel ( std : : string mapFile , MapName map ) {
TMXParser level ( mapFile ) ;
TMXParser level ( mapFile ) ;
size_t slashMarker = mapFile . find_last_of ( ' / ' ) ;
size_t slashMarker = mapFile . find_last_of ( ' / ' ) ;
@ -1535,7 +1535,7 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
}
}
}
}
void Crawler : : LoadLevel ( MapName map ) {
void AiL : : LoadLevel ( MapName map ) {
SPAWNER_LIST . clear ( ) ;
SPAWNER_LIST . clear ( ) ;
foregroundTileGroups . clear ( ) ;
foregroundTileGroups . clear ( ) ;
upperForegroundTileGroups . clear ( ) ;
upperForegroundTileGroups . clear ( ) ;
@ -1772,15 +1772,15 @@ void Crawler::LoadLevel(MapName map){
pathfinder . Initialize ( ) ;
pathfinder . Initialize ( ) ;
}
}
bool Crawler : : IsUpperForegroundTile ( int tileID ) {
bool AiL : : IsUpperForegroundTile ( int tileID ) {
return tileID > = 1000000 ;
return tileID > = 1000000 ;
}
}
bool Crawler : : IsForegroundTile ( TilesheetData sheet , int tileID ) {
bool AiL : : IsForegroundTile ( TilesheetData sheet , int tileID ) {
return sheet . tileset - > foregroundTiles . find ( tileID ) ! = sheet . tileset - > foregroundTiles . end ( ) ;
return sheet . tileset - > foregroundTiles . find ( tileID ) ! = sheet . tileset - > foregroundTiles . end ( ) ;
}
}
TilesheetData Crawler : : GetTileSheet ( MapName map , int tileID ) {
TilesheetData AiL : : GetTileSheet ( MapName map , int tileID ) {
std : : vector < XMLTag > & tileData = MAP_DATA [ map ] . TilesetData ;
std : : vector < XMLTag > & tileData = MAP_DATA [ map ] . TilesetData ;
if ( tileData . size ( ) = = 1 ) {
if ( tileData . size ( ) = = 1 ) {
size_t slashMarkerSourceDir = tileData [ 0 ] . data [ " source " ] . find_last_of ( ' / ' ) ;
size_t slashMarkerSourceDir = tileData [ 0 ] . data [ " source " ] . find_last_of ( ' / ' ) ;
@ -1800,18 +1800,18 @@ TilesheetData Crawler::GetTileSheet(MapName map,int tileID){
}
}
}
}
bool Crawler : : HasTileCollision ( MapName map , vf2d pos , bool upperLevel ) {
bool AiL : : HasTileCollision ( MapName map , vf2d pos , bool upperLevel ) {
geom2d : : rect < int > collisionRect = GetTileCollision ( map , pos , upperLevel ) ;
geom2d : : rect < int > collisionRect = GetTileCollision ( map , pos , upperLevel ) ;
vi2d collisionRectSnapPos = vi2d { pos / float ( game - > GetCurrentMap ( ) . tilewidth ) } * game - > GetCurrentMap ( ) . tilewidth ;
vi2d collisionRectSnapPos = vi2d { pos / float ( game - > GetCurrentMap ( ) . tilewidth ) } * game - > GetCurrentMap ( ) . tilewidth ;
collisionRect . pos + = collisionRectSnapPos ;
collisionRect . pos + = collisionRectSnapPos ;
return geom2d : : overlaps ( collisionRect , pos ) ;
return geom2d : : overlaps ( collisionRect , pos ) ;
}
}
bool Crawler : : IsBridgeLayer ( LayerTag & layer ) {
bool AiL : : IsBridgeLayer ( LayerTag & layer ) {
return layer . tag . data . find ( " class " ) ! = layer . tag . data . end ( ) & & layer . tag . data [ " class " ] = = " Bridge " ;
return layer . tag . data . find ( " class " ) ! = layer . tag . data . end ( ) & & layer . tag . data [ " class " ] = = " Bridge " ;
}
}
geom2d : : rect < int > Crawler : : GetTileCollision ( MapName map , vf2d pos , bool upperLevel ) {
geom2d : : rect < int > AiL : : GetTileCollision ( MapName map , vf2d pos , bool upperLevel ) {
if ( pos . x < 0 | | pos . y < 0 | | pos . x > = GetCurrentMap ( ) . width * game - > GetCurrentMap ( ) . tilewidth | | pos . y > = GetCurrentMap ( ) . height * game - > GetCurrentMap ( ) . tilewidth ) return NO_COLLISION ;
if ( pos . x < 0 | | pos . y < 0 | | pos . x > = GetCurrentMap ( ) . width * game - > GetCurrentMap ( ) . tilewidth | | pos . y > = GetCurrentMap ( ) . height * game - > GetCurrentMap ( ) . tilewidth ) return NO_COLLISION ;
# pragma region Lower Bridge Collision Check
# pragma region Lower Bridge Collision Check
if ( ! upperLevel ) { //We are looking for lower bridge collisions.
if ( ! upperLevel ) { //We are looking for lower bridge collisions.
@ -1855,15 +1855,15 @@ geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel)
return foundRect ;
return foundRect ;
}
}
MapName Crawler : : GetCurrentLevel ( ) {
MapName AiL : : GetCurrentLevel ( ) {
return currentLevel ;
return currentLevel ;
}
}
std : : map < std : : string , std : : vector < ZoneData > > & Crawler : : GetZoneData ( MapName map ) {
std : : map < std : : string , std : : vector < ZoneData > > & AiL : : GetZoneData ( MapName map ) {
return MAP_DATA [ map ] . ZoneData ;
return MAP_DATA [ map ] . ZoneData ;
}
}
void Crawler : : ChangePlayerClass ( Class cl ) {
void AiL : : ChangePlayerClass ( Class cl ) {
Ability itemAbility1 = player - > useItem1 ;
Ability itemAbility1 = player - > useItem1 ;
Ability itemAbility2 = player - > useItem2 ;
Ability itemAbility2 = player - > useItem2 ;
Ability itemAbility3 = player - > useItem3 ;
Ability itemAbility3 = player - > useItem3 ;
@ -1916,7 +1916,7 @@ void Crawler::ChangePlayerClass(Class cl){
Player : : moneyListeners = moneyListeners ;
Player : : moneyListeners = moneyListeners ;
}
}
void Crawler : : InitializeClasses ( ) {
void AiL : : InitializeClasses ( ) {
Warrior : : Initialize ( ) ;
Warrior : : Initialize ( ) ;
Thief : : Initialize ( ) ;
Thief : : Initialize ( ) ;
Ranger : : Initialize ( ) ;
Ranger : : Initialize ( ) ;
@ -1931,42 +1931,42 @@ void Crawler::InitializeClasses(){
Witch : : InitializeClassAbilities ( ) ;
Witch : : InitializeClassAbilities ( ) ;
}
}
std : : string Crawler : : GetString ( std : : string key ) {
std : : string AiL : : GetString ( std : : string key ) {
return DATA . GetProperty ( key ) . GetString ( ) ;
return DATA . GetProperty ( key ) . GetString ( ) ;
}
}
datafilestringdata Crawler : : GetStringList ( std : : string key ) {
datafilestringdata AiL : : GetStringList ( std : : string key ) {
return { DATA , key } ;
return { DATA , key } ;
}
}
int Crawler : : GetInt ( std : : string key ) {
int AiL : : GetInt ( std : : string key ) {
return DATA . GetProperty ( key ) . GetInt ( ) ;
return DATA . GetProperty ( key ) . GetInt ( ) ;
}
}
datafileintdata Crawler : : GetIntList ( std : : string key ) {
datafileintdata AiL : : GetIntList ( std : : string key ) {
return { DATA , key } ;
return { DATA , key } ;
}
}
float Crawler : : GetFloat ( std : : string key ) {
float AiL : : GetFloat ( std : : string key ) {
return float ( DATA . GetProperty ( key ) . GetReal ( ) ) ;
return float ( DATA . GetProperty ( key ) . GetReal ( ) ) ;
}
}
datafilefloatdata Crawler : : GetFloatList ( std : : string key ) {
datafilefloatdata AiL : : GetFloatList ( std : : string key ) {
return { DATA , key } ;
return { DATA , key } ;
}
}
double Crawler : : GetDouble ( std : : string key ) {
double AiL : : GetDouble ( std : : string key ) {
return DATA . GetProperty ( key ) . GetReal ( ) ;
return DATA . GetProperty ( key ) . GetReal ( ) ;
}
}
datafiledoubledata Crawler : : GetDoubleList ( std : : string key ) {
datafiledoubledata AiL : : GetDoubleList ( std : : string key ) {
return { DATA , key } ;
return { DATA , key } ;
}
}
int main ( )
int main ( )
{
{
{
{
Crawler demo ;
AiL demo ;
if ( demo . Construct ( WINDOW_SIZE . x , WINDOW_SIZE . y , 4 , 4 ) )
if ( demo . Construct ( WINDOW_SIZE . x , WINDOW_SIZE . y , 4 , 4 ) )
demo . Start ( ) ;
demo . Start ( ) ;
}
}
@ -1986,7 +1986,7 @@ int main()
while ( file . good ( ) ) {
while ( file . good ( ) ) {
std : : string line ;
std : : string line ;
std : : getline ( file , line ) ;
std : : getline ( file , line ) ;
if ( line . find ( " Crawler \\ " ) ! = std : : string : : npos ) {
if ( line . find ( " AiL \\ " ) ! = std : : string : : npos ) {
if ( ! leaked ) {
if ( ! leaked ) {
leaked = true ;
leaked = true ;
std : : cout < < std : : endl < < std : : endl < < std : : endl < < " Memory leak detected! " < < std : : endl ;
std : : cout < < std : : endl < < std : : endl < < std : : endl < < " Memory leak detected! " < < std : : endl ;
@ -2003,47 +2003,47 @@ int main()
}
}
datafilestringdata operator " " _s ( const char * key , std : : size_t len ) {
datafilestringdata operator " " _s ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return { DATA , std : : string ( key , len ) } ;
return { DATA , std : : string ( key , len ) } ;
}
}
datafileintdata operator " " _i ( const char * key , std : : size_t len ) {
datafileintdata operator " " _i ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return { DATA , std : : string ( key , len ) } ;
return { DATA , std : : string ( key , len ) } ;
}
}
datafilefloatdata operator " " _f ( const char * key , std : : size_t len ) {
datafilefloatdata operator " " _f ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return { DATA , std : : string ( key , len ) } ;
return { DATA , std : : string ( key , len ) } ;
}
}
datafiledoubledata operator " " _d ( const char * key , std : : size_t len ) {
datafiledoubledata operator " " _d ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return { DATA , std : : string ( key , len ) } ;
return { DATA , std : : string ( key , len ) } ;
}
}
Pixel operator " " _Pixel ( const char * key , std : : size_t len ) {
Pixel operator " " _Pixel ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return { uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 0 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 1 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 2 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 3 ) ) } ;
return { uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 0 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 1 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 2 ) ) , uint8_t ( DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( 3 ) ) } ;
}
}
std : : string operator " " _S ( const char * key , std : : size_t len ) {
std : : string operator " " _S ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetString ( ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetString ( ) ;
}
}
int operator " " _I ( const char * key , std : : size_t len ) {
int operator " " _I ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetInt ( ) ;
}
}
float operator " " _F ( const char * key , std : : size_t len ) {
float operator " " _F ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return float ( DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( ) ) ;
return float ( DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( ) ) ;
}
}
float operator " " _FRange ( const char * key , std : : size_t len ) {
float operator " " _FRange ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return float ( util : : random ( float ( DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 1 ) - DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 0 ) ) ) + DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 0 ) ) ;
return float ( util : : random ( float ( DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 1 ) - DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 0 ) ) ) + DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( 0 ) ) ;
}
}
float operator " " _Pct ( long double pct ) {
float operator " " _Pct ( long double pct ) {
@ -2051,16 +2051,16 @@ float operator ""_Pct(long double pct){
}
}
double operator " " _D ( const char * key , std : : size_t len ) {
double operator " " _D ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetReal ( ) ;
}
}
datafile operator " " _A ( const char * key , std : : size_t len ) {
datafile operator " " _A ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) ;
}
}
void Crawler : : OutputDebugInfo ( const char * key , std : : size_t len ) {
void AiL : : OutputDebugInfo ( const char * key , std : : size_t len ) {
if ( utils : : datafile : : DEBUG_ACCESS_OPTIONS ) {
if ( utils : : datafile : : DEBUG_ACCESS_OPTIONS ) {
std : : string k = std : : string ( key ) ;
std : : string k = std : : string ( key ) ;
if ( ! k . starts_with ( " debug_ " ) ) {
if ( ! k . starts_with ( " debug_ " ) ) {
@ -2069,11 +2069,11 @@ void Crawler::OutputDebugInfo(const char*key,std::size_t len){
}
}
}
}
bool Crawler : : IsReflectiveTile ( TilesheetData tileSheet , int tileID ) {
bool AiL : : IsReflectiveTile ( TilesheetData tileSheet , int tileID ) {
return tileSheet . tileset - > reflectiveData . find ( tileID ) ! = tileSheet . tileset - > reflectiveData . end ( ) ;
return tileSheet . tileset - > reflectiveData . find ( tileID ) ! = tileSheet . tileset - > reflectiveData . end ( ) ;
}
}
bool Crawler : : OnUserDestroy ( ) {
bool AiL : : OnUserDestroy ( ) {
if ( GameState : : STATE ! = GameState : : states [ States : : MAIN_MENU ] ) { //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game.
if ( GameState : : STATE ! = GameState : : states [ States : : MAIN_MENU ] ) { //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game.
SaveFile : : SaveGame ( ) ;
SaveFile : : SaveGame ( ) ;
}
}
@ -2097,7 +2097,7 @@ bool Crawler::OnUserDestroy(){
return true ;
return true ;
}
}
void Crawler : : InitializeLevels ( ) {
void AiL : : InitializeLevels ( ) {
# define INITLEVEL(map) \
# define INITLEVEL(map) \
LEVEL_NAMES [ # map ] = map ; \
LEVEL_NAMES [ # map ] = map ; \
InitializeLevel ( " map_path " _S + " Levels. " # map # # _S , map ) ;
InitializeLevel ( " map_path " _S + " Levels. " # map # # _S , map ) ;
@ -2115,22 +2115,22 @@ void Crawler::InitializeLevels(){
LEVEL_NAMES . SetInitialized ( ) ;
LEVEL_NAMES . SetInitialized ( ) ;
}
}
void Crawler : : SpawnMonster ( vf2d pos , MonsterData & data , bool upperLevel , bool isBossSpawn ) {
void AiL : : SpawnMonster ( vf2d pos , MonsterData & data , bool upperLevel , bool isBossSpawn ) {
monstersToBeSpawned . push_back ( Monster ( pos , data , upperLevel , isBossSpawn ) ) ;
monstersToBeSpawned . push_back ( Monster ( pos , data , upperLevel , isBossSpawn ) ) ;
if ( isBossSpawn ) {
if ( isBossSpawn ) {
totalBossEncounterMobs + + ;
totalBossEncounterMobs + + ;
}
}
}
}
void Crawler : : DrawPie ( vf2d center , float radius , float degreesCut , Pixel col ) {
void AiL : : DrawPie ( vf2d center , float radius , float degreesCut , Pixel col ) {
DrawPolygonDecal ( nullptr , circleCooldownPoints , circleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
DrawPolygonDecal ( nullptr , circleCooldownPoints , circleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
}
}
void Crawler : : DrawSquarePie ( vf2d center , float radius , float degreesCut , Pixel col ) {
void AiL : : DrawSquarePie ( vf2d center , float radius , float degreesCut , Pixel col ) {
DrawPolygonDecal ( nullptr , squareCircleCooldownPoints , squareCircleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
DrawPolygonDecal ( nullptr , squareCircleCooldownPoints , squareCircleCooldownPoints , std : : max ( 1 , int ( degreesCut / 4 ) ) , center , radius , col ) ;
}
}
void Crawler : : InitializeDefaultKeybinds ( ) {
void AiL : : InitializeDefaultKeybinds ( ) {
Player : : KEY_ABILITY1 . AddKeybind ( { KEY , Q } ) ;
Player : : KEY_ABILITY1 . AddKeybind ( { KEY , Q } ) ;
Player : : KEY_ABILITY2 . AddKeybind ( { KEY , E } ) ;
Player : : KEY_ABILITY2 . AddKeybind ( { KEY , E } ) ;
Player : : KEY_ABILITY3 . AddKeybind ( { KEY , R } ) ;
Player : : KEY_ABILITY3 . AddKeybind ( { KEY , R } ) ;
@ -2153,16 +2153,16 @@ void Crawler::InitializeDefaultKeybinds(){
KEY_MENU . AddKeybind ( { KEY , ESCAPE } ) ;
KEY_MENU . AddKeybind ( { KEY , ESCAPE } ) ;
}
}
void Crawler : : SetBossNameDisplay ( std : : string name , float time ) {
void AiL : : SetBossNameDisplay ( std : : string name , float time ) {
bossName = name ;
bossName = name ;
bossDisplayTimer = time ;
bossDisplayTimer = time ;
}
}
bool Crawler : : InBossEncounter ( ) {
bool AiL : : InBossEncounter ( ) {
return bossName ! = " " ;
return bossName ! = " " ;
}
}
void Crawler : : StartBossEncounter ( ) {
void AiL : : StartBossEncounter ( ) {
if ( ! encounterStarted ) {
if ( ! encounterStarted ) {
encounterStarted = true ;
encounterStarted = true ;
totalDamageDealt = 0 ;
totalDamageDealt = 0 ;
@ -2170,7 +2170,7 @@ void Crawler::StartBossEncounter(){
}
}
}
}
void Crawler : : DisplayBossEncounterInfo ( ) {
void AiL : : DisplayBossEncounterInfo ( ) {
if ( bossDisplayTimer > 0 ) {
if ( bossDisplayTimer > 0 ) {
std : : string displayText = " - " + bossName + " - " ;
std : : string displayText = " - " + bossName + " - " ;
@ -2202,18 +2202,18 @@ void Crawler::DisplayBossEncounterInfo(){
}
}
void Crawler : : BossDamageDealt ( int damage ) {
void AiL : : BossDamageDealt ( int damage ) {
totalDamageDealt + = damage ;
totalDamageDealt + = damage ;
}
}
void Crawler : : ReduceBossEncounterMobCount ( ) {
void AiL : : ReduceBossEncounterMobCount ( ) {
totalBossEncounterMobs - - ;
totalBossEncounterMobs - - ;
if ( totalBossEncounterMobs < 0 ) {
if ( totalBossEncounterMobs < 0 ) {
ERR ( " WARNING! Boss Encounter mob count is less than zero, THIS SHOULD NOT BE HAPPENING! " ) ;
ERR ( " WARNING! Boss Encounter mob count is less than zero, THIS SHOULD NOT BE HAPPENING! " ) ;
}
}
}
}
void Crawler : : RenderMenu ( ) {
void AiL : : RenderMenu ( ) {
if ( ! GamePaused ( ) & & Menu : : stack . size ( ) > 0 ) {
if ( ! GamePaused ( ) & & Menu : : stack . size ( ) > 0 ) {
Menu : : stack . back ( ) - > Update ( this ) ;
Menu : : stack . back ( ) - > Update ( this ) ;
}
}
@ -2225,7 +2225,7 @@ void Crawler::RenderMenu(){
}
}
}
}
void Crawler : : InitializeGraphics ( ) {
void AiL : : InitializeGraphics ( ) {
circleCooldownPoints . push_back ( { 0 , 0 } ) ;
circleCooldownPoints . push_back ( { 0 , 0 } ) ;
squareCircleCooldownPoints . push_back ( { 0 , 0 } ) ;
squareCircleCooldownPoints . push_back ( { 0 , 0 } ) ;
for ( int i = 0 ; i < = 360 ; i + = 4 ) {
for ( int i = 0 ; i < = 360 ; i + = 4 ) {
@ -2313,11 +2313,11 @@ void Crawler::InitializeGraphics(){
std : : cout < < GFX . size ( ) < < " images have been loaded. " < < std : : endl ;
std : : cout < < GFX . size ( ) < < " images have been loaded. " < < std : : endl ;
}
}
MapTag Crawler : : GetCurrentMap ( ) {
MapTag AiL : : GetCurrentMap ( ) {
return MAP_DATA [ GetCurrentLevel ( ) ] . MapData ;
return MAP_DATA [ GetCurrentLevel ( ) ] . MapData ;
}
}
void Crawler : : ValidateGameStatus ( ) {
void AiL : : ValidateGameStatus ( ) {
if ( IToggleable : : uninitializedToggleGroupItems . size ( ) > 0 ) {
if ( IToggleable : : uninitializedToggleGroupItems . size ( ) > 0 ) {
for ( IToggleable * item : IToggleable : : uninitializedToggleGroupItems ) {
for ( IToggleable * item : IToggleable : : uninitializedToggleGroupItems ) {
std : : cout < < " \t Uninitialized Toggle Item Ptr: 0x " < < std : : hex < < item < < std : : endl ;
std : : cout < < " \t Uninitialized Toggle Item Ptr: 0x " < < std : : hex < < item < < std : : endl ;
@ -2335,28 +2335,28 @@ void Crawler::ValidateGameStatus(){
}
}
}
}
void Crawler : : RenderVersionInfo ( ) {
void AiL : : RenderVersionInfo ( ) {
std : : string versionStr ( " v " + std : : to_string ( VERSION_MAJOR ) + " . " + std : : to_string ( VERSION_MINOR ) + " . " + std : : to_string ( VERSION_PATCH ) + " . " + std : : to_string ( VERSION_BUILD ) ) ;
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.4f , versionStr , WHITE , BLACK , { 0.4f , 0.4f } , std : : numeric_limits < float > : : max ( ) , 0.4f ) ;
DrawShadowStringDecal ( vf2d { GetScreenSize ( ) } - vf2d { GetTextSize ( versionStr ) } * 0.4f , versionStr , WHITE , BLACK , { 0.4f , 0.4f } , std : : numeric_limits < float > : : max ( ) , 0.4f ) ;
}
}
int Crawler : : GetCurrentChapter ( ) {
int AiL : : GetCurrentChapter ( ) {
return chapter ;
return chapter ;
}
}
void Crawler : : SetChapter ( int chapter ) {
void AiL : : SetChapter ( int chapter ) {
this - > chapter = chapter ;
this - > chapter = chapter ;
for ( MenuComponent * component : Menu : : chapterListeners ) {
for ( MenuComponent * component : Menu : : chapterListeners ) {
component - > OnChapterUpdate ( chapter ) ;
component - > OnChapterUpdate ( chapter ) ;
}
}
}
}
const std : : weak_ptr < Item > Crawler : : GetLoadoutItem ( int slot ) {
const std : : weak_ptr < Item > AiL : : GetLoadoutItem ( int slot ) {
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
return loadout [ slot ] ;
return loadout [ slot ] ;
}
}
void Crawler : : SetLoadoutItem ( int slot , std : : string itemName ) {
void AiL : : SetLoadoutItem ( int slot , std : : string itemName ) {
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( Inventory : : GetItemCount ( itemName ) > 0 ) {
if ( Inventory : : GetItemCount ( itemName ) > 0 ) {
loadout [ slot ] = Inventory : : CopyItem ( itemName ) [ 0 ] ;
loadout [ slot ] = Inventory : : CopyItem ( itemName ) [ 0 ] ;
@ -2405,7 +2405,7 @@ void Crawler::SetLoadoutItem(int slot,std::string itemName){
}
}
}
}
bool Crawler : : UseLoadoutItem ( int slot ) {
bool AiL : : UseLoadoutItem ( int slot ) {
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( GetLoadoutItem ( slot ) . lock ( ) - > Amt ( ) > 0 ) {
if ( GetLoadoutItem ( slot ) . lock ( ) - > Amt ( ) > 0 ) {
Inventory : : UseItem ( GetLoadoutItem ( slot ) . lock ( ) - > ActualName ( ) ) ;
Inventory : : UseItem ( GetLoadoutItem ( slot ) . lock ( ) - > ActualName ( ) ) ;
@ -2415,7 +2415,7 @@ bool Crawler::UseLoadoutItem(int slot){
return false ;
return false ;
}
}
void Crawler : : ClearLoadoutItem ( int slot ) {
void AiL : : ClearLoadoutItem ( int slot ) {
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
if ( slot < 0 | | slot > loadout . size ( ) - 1 ) ERR ( " Invalid inventory slot " + std : : to_string ( slot ) + " , please choose a slot in range (0- " + std : : to_string ( loadout . size ( ) - 1 ) + " ). " ) ;
loadout [ slot ] . reset ( ) ;
loadout [ slot ] . reset ( ) ;
InputGroup * inputGroup = nullptr ;
InputGroup * inputGroup = nullptr ;
@ -2458,7 +2458,7 @@ void Crawler::ClearLoadoutItem(int slot){
}
}
}
}
void Crawler : : RenderFadeout ( ) {
void AiL : : RenderFadeout ( ) {
uint8_t alpha = 0 ;
uint8_t alpha = 0 ;
if ( fadeOutDuration > 0 ) {
if ( fadeOutDuration > 0 ) {
fadeOutDuration = std : : max ( 0.f , fadeOutDuration - GetElapsedTime ( ) ) ;
fadeOutDuration = std : : max ( 0.f , fadeOutDuration - GetElapsedTime ( ) ) ;
@ -2474,16 +2474,16 @@ void Crawler::RenderFadeout(){
FillRectDecal ( { 0 , 0 } , GetScreenSize ( ) , { 0 , 0 , 0 , alpha } ) ;
FillRectDecal ( { 0 , 0 } , GetScreenSize ( ) , { 0 , 0 , 0 , alpha } ) ;
}
}
bool Crawler : : GamePaused ( ) {
bool AiL : : GamePaused ( ) {
return fadeOutDuration > 0 ;
return fadeOutDuration > 0 ;
}
}
void Crawler : : EndGame ( ) {
void AiL : : EndGame ( ) {
gameEnd = true ;
gameEnd = true ;
}
}
# ifndef __EMSCRIPTEN__
# ifndef __EMSCRIPTEN__
: : discord : : Result Crawler : : SetupDiscord ( ) {
: : discord : : Result AiL : : SetupDiscord ( ) {
auto result = : : discord : : Core : : Create ( 1186719371750555780 , DiscordCreateFlags_NoRequireDiscord , & Discord ) ;
auto result = : : discord : : Core : : Create ( 1186719371750555780 , DiscordCreateFlags_NoRequireDiscord , & Discord ) ;
if ( result = = : : discord : : Result : : Ok ) {
if ( result = = : : discord : : Result : : Ok ) {
Discord - > SetLogHook (
Discord - > SetLogHook (
@ -2499,7 +2499,7 @@ void Crawler::EndGame(){
}
}
# endif
# endif
void Crawler : : UpdateDiscordStatus ( std : : string levelName , std : : string className ) {
void AiL : : UpdateDiscordStatus ( std : : string levelName , std : : string className ) {
# ifndef __EMSCRIPTEN__
# ifndef __EMSCRIPTEN__
if ( Discord ) {
if ( Discord ) {
: : discord : : Activity newActivity { } ;
: : discord : : Activity newActivity { } ;
@ -2509,7 +2509,7 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
timestamps . SetStart ( gameStarted ) ;
timestamps . SetStart ( gameStarted ) ;
newActivity . SetType ( discord : : ActivityType : : Playing ) ;
newActivity . SetType ( discord : : ActivityType : : Playing ) ;
discord : : ActivityAssets & assets = newActivity . GetAssets ( ) ;
discord : : ActivityAssets & assets = newActivity . GetAssets ( ) ;
assets . SetLargeImage ( " heart _512" ) ;
assets . SetLargeImage ( " ail _512" ) ;
assets . SetLargeText ( game - > sAppName . c_str ( ) ) ;
assets . SetLargeText ( game - > sAppName . c_str ( ) ) ;
assets . SetSmallText ( std : : format ( " Level {} {} " , player - > Level ( ) , className ) . c_str ( ) ) ;
assets . SetSmallText ( std : : format ( " Level {} {} " , player - > Level ( ) , className ) . c_str ( ) ) ;
@ -2532,7 +2532,7 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
# endif
# endif
}
}
void Crawler : : InitializePlayerLevelCap ( ) {
void AiL : : InitializePlayerLevelCap ( ) {
while ( DATA [ " PlayerXP " ] . HasProperty ( std : : format ( " LEVEL[{}] " , player - > levelCap + 1 ) ) ) {
while ( DATA [ " PlayerXP " ] . HasProperty ( std : : format ( " LEVEL[{}] " , player - > levelCap + 1 ) ) ) {
player - > levelCap + + ;
player - > levelCap + + ;
}
}
@ -2540,7 +2540,7 @@ void Crawler::InitializePlayerLevelCap(){
std : : cout < < " Level cap detected as " < < int ( player - > levelCap ) < < std : : endl ;
std : : cout < < " Level cap detected as " < < int ( player - > levelCap ) < < std : : endl ;
}
}
void Crawler : : ResetGame ( ) {
void AiL : : ResetGame ( ) {
GameState : : ChangeState ( States : : MAIN_MENU , 0.5f ) ;
GameState : : ChangeState ( States : : MAIN_MENU , 0.5f ) ;
for ( int i = int ( EquipSlot : : HELMET ) ; i < = int ( EquipSlot : : RING2 ) ; i < < = 1 ) {
for ( int i = int ( EquipSlot : : HELMET ) ; i < = int ( EquipSlot : : RING2 ) ; i < < = 1 ) {
Inventory : : UnequipItem ( EquipSlot ( i ) ) ;
Inventory : : UnequipItem ( EquipSlot ( i ) ) ;
@ -2564,11 +2564,11 @@ void Crawler::ResetGame(){
SaveFile : : SetSaveFileName ( " " ) ;
SaveFile : : SetSaveFileName ( " " ) ;
}
}
void Crawler : : OnRequestCompleted ( const std : : string_view receivedData ) const {
void AiL : : OnRequestCompleted ( const std : : string_view receivedData ) const {
responseCallback ( receivedData ) ;
responseCallback ( receivedData ) ;
}
}
std : : string operator " " _FS ( const char * key , std : : size_t len ) {
std : : string operator " " _FS ( const char * key , std : : size_t len ) {
Crawler : : OutputDebugInfo ( key , len ) ;
AiL : : OutputDebugInfo ( key , len ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetFullString ( ) ;
return DATA . GetProperty ( std : : string ( key , len ) ) . GetFullString ( ) ;
}
}