diff --git a/Crawler/Ability.h b/Crawler/Ability.h index c8c43917..78091d49 100644 --- a/Crawler/Ability.h +++ b/Crawler/Ability.h @@ -62,6 +62,7 @@ struct Ability{ bool canCancelCast=false; InputGroup*input; std::string icon; + bool waitForRelease=false; //Ability action function, returns true if the ability can be casted, otherwise returns false. // Argument 1: Player* - player pointer // Argument 2: vf2d - The returned precast target position (if the ability needs to be aimed, otherwise {}) diff --git a/Crawler/Animation.cpp b/Crawler/Animation.cpp index 9a71f925..124c15e7 100644 --- a/Crawler/Animation.cpp +++ b/Crawler/Animation.cpp @@ -58,25 +58,25 @@ void sig::Animation::InitializeAnimations(){ }; auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,std::string className){ - Animate2D::FrameSequence pl_walk_s{0.2}; + Animate2D::FrameSequence pl_walk_s{0.2f}; pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}}); pl_walk_s.AddFrame({&sheet,{vi2d{1,0}*24,{24,24}}}); pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}}); pl_walk_s.AddFrame({&sheet,{vi2d{2,0}*24,{24,24}}}); ANIMATION_DATA[className+"_WALK_S"]=pl_walk_s; - Animate2D::FrameSequence pl_walk_e{0.2}; + Animate2D::FrameSequence pl_walk_e{0.2f}; pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}}); pl_walk_e.AddFrame({&sheet,{vi2d{1,3}*24,{24,24}}}); pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}}); pl_walk_e.AddFrame({&sheet,{vi2d{2,3}*24,{24,24}}}); ANIMATION_DATA[className+"_WALK_E"]=pl_walk_e; - Animate2D::FrameSequence pl_walk_w{0.2}; + Animate2D::FrameSequence pl_walk_w{0.2f}; pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}}); pl_walk_w.AddFrame({&sheet,{vi2d{1,2}*24,{24,24}}}); pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}}); pl_walk_w.AddFrame({&sheet,{vi2d{2,2}*24,{24,24}}}); ANIMATION_DATA[className+"_WALK_W"]=pl_walk_w; - Animate2D::FrameSequence pl_walk_n{0.2}; + Animate2D::FrameSequence pl_walk_n{0.2f}; pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}}); pl_walk_n.AddFrame({&sheet,{vi2d{1,1}*24,{24,24}}}); pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}}); @@ -98,8 +98,8 @@ void sig::Animation::InitializeAnimations(){ //Warrior animations. SetupClassWalkIdleAnimations(GFX["nico-warrior.png"],"WARRIOR"); - Animate2D::FrameSequence pl_warrior_swing_s(0.05),pl_warrior_swing_n(0.05),pl_warrior_swing_e(0.05),pl_warrior_swing_w(0.05); - Animate2D::FrameSequence pl_warrior_sonic_swing_s(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_n(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_e(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_w(0.1,Animate2D::Style::OneShot); + Animate2D::FrameSequence pl_warrior_swing_s(0.05f),pl_warrior_swing_n(0.05f),pl_warrior_swing_e(0.05f),pl_warrior_swing_w(0.05f); + Animate2D::FrameSequence pl_warrior_sonic_swing_s(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_n(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_e(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_w(0.1f,Animate2D::Style::OneShot); for (int i=0;i<4;i++){ pl_warrior_swing_s.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,0}*24,{24,24}}}); pl_warrior_sonic_swing_s.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,4}*24,{24,24}}}); @@ -153,7 +153,7 @@ void sig::Animation::InitializeAnimations(){ Animate2D::FrameSequence pl_wizard_idle_attack_n; pl_wizard_idle_attack_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,1}*24,{24,24}}}); ANIMATION_DATA["WIZARD_IDLE_ATTACK_N"]=pl_wizard_idle_attack_n; - Animate2D::FrameSequence pl_wizard_attack_s(0.2); + Animate2D::FrameSequence pl_wizard_attack_s(0.2f); for(int i=0;i<3;i++){ pl_wizard_attack_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,0}*24,{24,24}}}); if(i==1){ @@ -161,7 +161,7 @@ void sig::Animation::InitializeAnimations(){ } } ANIMATION_DATA["WIZARD_ATTACK_S"]=pl_wizard_attack_s; - Animate2D::FrameSequence pl_wizard_attack_e(0.2); + Animate2D::FrameSequence pl_wizard_attack_e(0.2f); for(int i=0;i<3;i++){ pl_wizard_attack_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,3}*24,{24,24}}}); if(i==1){ @@ -169,7 +169,7 @@ void sig::Animation::InitializeAnimations(){ } } ANIMATION_DATA["WIZARD_ATTACK_E"]=pl_wizard_attack_e; - Animate2D::FrameSequence pl_wizard_attack_w(0.2); + Animate2D::FrameSequence pl_wizard_attack_w(0.2f); for(int i=0;i<3;i++){ pl_wizard_attack_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,2}*24,{24,24}}}); if(i==1){ @@ -177,7 +177,7 @@ void sig::Animation::InitializeAnimations(){ } } ANIMATION_DATA["WIZARD_ATTACK_W"]=pl_wizard_attack_w; - Animate2D::FrameSequence pl_wizard_attack_n(0.2); + Animate2D::FrameSequence pl_wizard_attack_n(0.2f); for(int i=0;i<3;i++){ pl_wizard_attack_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,1}*24,{24,24}}}); if(i==1){ @@ -185,41 +185,41 @@ void sig::Animation::InitializeAnimations(){ } } ANIMATION_DATA["WIZARD_ATTACK_N"]=pl_wizard_attack_n; - Animate2D::FrameSequence pl_wizard_cast_s(0.1); + Animate2D::FrameSequence pl_wizard_cast_s(0.1f); for(int i=0;i<2;i++){ pl_wizard_cast_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,0}*24,{24,24}}}); } ANIMATION_DATA["WIZARD_CAST_S"]=pl_wizard_cast_s; - Animate2D::FrameSequence pl_wizard_cast_e(0.1); + Animate2D::FrameSequence pl_wizard_cast_e(0.1f); for(int i=0;i<2;i++){ pl_wizard_cast_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,3}*24,{24,24}}}); } ANIMATION_DATA["WIZARD_CAST_E"]=pl_wizard_cast_e; - Animate2D::FrameSequence pl_wizard_cast_n(0.1); + Animate2D::FrameSequence pl_wizard_cast_n(0.1f); for(int i=0;i<2;i++){ pl_wizard_cast_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,1}*24,{24,24}}}); } ANIMATION_DATA["WIZARD_CAST_N"]=pl_wizard_cast_n; - Animate2D::FrameSequence pl_wizard_cast_w(0.1); + Animate2D::FrameSequence pl_wizard_cast_w(0.1f); for(int i=0;i<2;i++){ pl_wizard_cast_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,2}*24,{24,24}}}); } ANIMATION_DATA["WIZARD_CAST_W"]=pl_wizard_cast_w; - CreateHorizontalAnimationSequence("ground-slam-attack-back.png",5,{64,64},{0.02,Animate2D::Style::OneShot}); - CreateHorizontalAnimationSequence("ground-slam-attack-front.png",5,{64,64},{0.02,Animate2D::Style::OneShot}); - CreateHorizontalAnimationSequence("battlecry_effect.png",5,{84,84},{0.02,Animate2D::Style::OneShot}); - CreateHorizontalAnimationSequence("sonicslash.png",4,{60,60},{0.04,Animate2D::Style::OneShot}); + CreateHorizontalAnimationSequence("ground-slam-attack-back.png",5,{64,64},{0.02f,Animate2D::Style::OneShot}); + CreateHorizontalAnimationSequence("ground-slam-attack-front.png",5,{64,64},{0.02f,Animate2D::Style::OneShot}); + CreateHorizontalAnimationSequence("battlecry_effect.png",5,{84,84},{0.02f,Animate2D::Style::OneShot}); + CreateHorizontalAnimationSequence("sonicslash.png",4,{60,60},{0.04f,Animate2D::Style::OneShot}); CreateStillAnimation("energy_bolt.png",{24,24}); CreateHorizontalAnimationSequence("energy_particle.png",3,{3,3}); - CreateHorizontalAnimationSequence("splash_effect.png",5,{24,24},{0.05}); + CreateHorizontalAnimationSequence("splash_effect.png",5,{24,24},{0.05f}); CreateStillAnimation("circle.png",{3,3}); - CreateHorizontalAnimationSequence("lightning_bolt.png",5,{24,24},{0.03,Animate2D::Style::PingPong}); + CreateHorizontalAnimationSequence("lightning_bolt.png",5,{24,24},{0.03f,Animate2D::Style::PingPong}); CreateStillAnimation("lightning_bolt_part1.png",{5,5}); CreateStillAnimation("lightning_bolt_part2.png",{5,5}); @@ -230,7 +230,7 @@ void sig::Animation::InitializeAnimations(){ CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24}); - CreateHorizontalAnimationSequence("monsters/Slime King - Cast.png",10,{24,24},{0.04}); + CreateHorizontalAnimationSequence("monsters/Slime King - Cast.png",10,{24,24},{0.04f}); CreateStillAnimation("meteor.png",{192,192}); diff --git a/Crawler/Bullet.h b/Crawler/Bullet.h index 96b87719..56577013 100644 --- a/Crawler/Bullet.h +++ b/Crawler/Bullet.h @@ -45,7 +45,7 @@ struct Bullet{ float radius; int damage; Pixel col; - float lifetime=INFINITE; + float lifetime=float(INFINITE); bool hitsMultiple=false; bool rotates=false; bool animated=false; diff --git a/Crawler/CharacterAbilityPreviewComponent.h b/Crawler/CharacterAbilityPreviewComponent.h index 68432c33..73bdae39 100644 --- a/Crawler/CharacterAbilityPreviewComponent.h +++ b/Crawler/CharacterAbilityPreviewComponent.h @@ -60,13 +60,13 @@ protected: vi2d descriptionPos=iconPos+vi2d{int(rect.size.y)-2,1}; - game->DrawShadowStringProp(descriptionPos,util::WrapText(game,ability->description,rect.size.x-(descriptionPos.x-rect.pos.x),true,{1,1})); + game->DrawShadowStringProp(descriptionPos,util::WrapText(game,ability->description,int(rect.size.x-(descriptionPos.x-rect.pos.x)),true,{1,1})); } virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{ ICONPOS vi2d textPos=iconPos+vi2d{12,12}; - float textWidth=game->GetTextSizeProp(ability->input->GetDisplayName()).x*0.5+4; + float textWidth=game->GetTextSizeProp(ability->input->GetDisplayName()).x*0.5f+4; float boxWidth=rect.size.y-4; //No, the y is not a typo. It's a square, we use the y to determine the x. diff --git a/Crawler/CharacterRotatingDisplay.h b/Crawler/CharacterRotatingDisplay.h index 83648380..1fa15236 100644 --- a/Crawler/CharacterRotatingDisplay.h +++ b/Crawler/CharacterRotatingDisplay.h @@ -41,7 +41,7 @@ INCLUDE_game class CharacterRotatingDisplay:public MenuComponent{ protected: Decal*icon; - float timer; + float timer=0; float rotatingFactor=7; float perspectiveFactor=6; public: diff --git a/Crawler/ChargedArrow.cpp b/Crawler/ChargedArrow.cpp index 1d469fe3..a4a75ca6 100644 --- a/Crawler/ChargedArrow.cpp +++ b/Crawler/ChargedArrow.cpp @@ -50,7 +50,7 @@ void ChargedArrow::Update(float fElapsedTime){ float dist=lineToCurrentPos.length(); if(dist>=1){ vf2d midpoint(lineToCurrentPos.rpoint(0.5)); - game->AddEffect(std::make_unique(midpoint,0.1,"laser.png",upperLevel,vf2d{1,dist},0.3,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true)); + game->AddEffect(std::make_unique(midpoint,0.1f,"laser.png",upperLevel,vf2d{1,dist},0.3f,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true)); lastLaserPos=pos; } } diff --git a/Crawler/ClassInfo.h b/Crawler/ClassInfo.h index e65433d1..e9ab7a1c 100644 --- a/Crawler/ClassInfo.h +++ b/Crawler/ClassInfo.h @@ -55,7 +55,7 @@ public: static inline Class StringToClass(std::string className){ const std::vector&classList=DATA["class_list"].GetValues(); auto it=std::find(classList.begin(),classList.end(),className); - int element=std::distance(classList.begin(),it); + int element=int(std::distance(classList.begin(),it)); return Class(1<GetPos()); } if(lastWorldShakeAdjust==0){ - lastWorldShakeAdjust=0.02; + lastWorldShakeAdjust=0.02f; worldShakeVel.x*=-1; worldShakeVel.y*=-1; } @@ -478,7 +478,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ b->animation.UpdateState(b->internal_animState,fElapsedTime); if(!b->deactivated){ float totalDistance=(b->vel*fElapsedTime).mag(); - int iterations=std::max(1.f,(b->vel*fElapsedTime).mag()); + int iterations=int(std::max(1.f,(b->vel*fElapsedTime).mag())); int totalIterations=iterations; vf2d finalBulletPos=b->pos+b->vel*fElapsedTime; const auto CollisionCheck=[&](){ @@ -533,9 +533,8 @@ void Crawler::UpdateBullets(float fElapsedTime){ continue; } nextBullet: - int a; + while(false); } - outsideBulletLoop: std::erase_if(BULLET_LIST,[](std::unique_ptr&b){return b->dead;}); } void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){ @@ -641,8 +640,8 @@ void Crawler::PopulateRenderLists(){ void Crawler::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d tileSheetPos){ if(tileSheet.tileset->animationData.count(tileSheetIndex)){ - int animationDuration_ms=tileSheet.tileset->animationData[tileSheetIndex].size()*"animation_tile_precision"_I; - int animatedIndex=tileSheet.tileset->animationData[tileSheetIndex][int(fmod(levelTime*1000,animationDuration_ms)/"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 tileSheetWidth=tileSheet.tileset->tileset->Sprite()->width/tileSheet.tileset->tilewidth; int tileSheetX=animatedIndex%tileSheetWidth; int tileSheetY=animatedIndex/tileSheetWidth; @@ -654,8 +653,8 @@ void Crawler::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2 void Crawler::RenderTile(TileRenderData&tileSheet,Pixel col){ if(tileSheet.tileSheet.tileset->animationData.count(tileSheet.tileID%1000000)){ - int animationDuration_ms=tileSheet.tileSheet.tileset->animationData[tileSheet.tileID%1000000].size()*"animation_tile_precision"_I; - int animatedIndex=tileSheet.tileSheet.tileset->animationData[tileSheet.tileID%1000000][int(fmod(levelTime*1000,animationDuration_ms)/"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 tileSheetWidth=tileSheet.tileSheet.tileset->tileset->Sprite()->width/tileSheet.tileSheet.tileset->tilewidth; int tileSheetX=animatedIndex%tileSheetWidth; int tileSheetY=animatedIndex/tileSheetWidth; @@ -681,8 +680,8 @@ void Crawler::RenderWorld(float fElapsedTime){ count++; } if(player->teleportAnimationTimer>0){ - playerScale.x=120*abs(pow(player->teleportAnimationTimer-0.175,3)); - pos=player->teleportStartPosition.lerp(player->teleportTarget,(0.35-player->teleportAnimationTimer)/0.35); + playerScale.x=120*float(abs(pow(player->teleportAnimationTimer-0.175f,3))); + pos=player->teleportStartPosition.lerp(player->teleportTarget,(0.35f-player->teleportAnimationTimer)/0.35f); } view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,player->GetBuffs(BuffType::ATTACK_UP).size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration))),uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration)))}:WHITE); SetDecalMode(DecalMode::NORMAL); @@ -724,9 +723,9 @@ void Crawler::RenderWorld(float fElapsedTime){ float reflectionHeight=(float(player->GetFrame().GetSourceRect().size.y)-8)*player->GetSizeMult(); float reflectionBottom=player->GetPos().y+reflectionHeight; float cutOff=reflectionBottom-GetCurrentMap().height*GetCurrentMap().tileheight; - float multiplierX=0.9; + float multiplierX=0.9f; multiplierX*=(1-abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F); - multiplierX*=(1-abs(cos(1.5*reflectionStepTime))*"water_reflection_scale_factor"_F); + multiplierX*=(1-abs(cos(1.5f*reflectionStepTime))*"water_reflection_scale_factor"_F); float reflectionRatioX=abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F; RenderPlayer(player->GetPos()+vf2d{reflectionRatioX*player->GetFrame().GetSourceRect().size.x,float(player->GetFrame().GetSourceRect().size.y)-8}*player->GetSizeMult(),{multiplierX,-1}); for(Monster&m:MONSTER_LIST){ @@ -735,7 +734,7 @@ void Crawler::RenderWorld(float fElapsedTime){ SetDecalMode(DecalMode::NORMAL); } if(GetCurrentMap().optimized){ - view.FillRectDecal(-WINDOW_SIZE,vf2d{float(GetCurrentMap().width),float(GetCurrentMap().height)}*GetCurrentMap().tilewidth+WINDOW_SIZE*2,{100,180,100}); + view.FillRectDecal(-WINDOW_SIZE,vf2d{float(GetCurrentMap().width),float(GetCurrentMap().height)}*float(GetCurrentMap().tilewidth)+vf2d{WINDOW_SIZE}*2,{100,180,100}); view.DrawDecal({0,0},MAP_DATA[GetCurrentLevel()].optimizedTile->Decal()); }else{ for (int x = view.GetTopLeftTile().x/GetCurrentMap().tilewidth-1; x <= view.GetBottomRightTile().x/GetCurrentMap().tilewidth; x++){ @@ -864,7 +863,7 @@ void Crawler::RenderWorld(float fElapsedTime){ float precastRange=GetPlayer()->castPrepAbility->precastInfo.range; vf2d scale=vf2d{precastSize,precastSize}*2/3.f; vf2d centerPoint=GetWorldMousePos()-vf2d{GFX["circle.png"].Sprite()->width*scale.x/2,GFX["circle.png"].Sprite()->height*scale.y/2}; - float distance=sqrt(pow(player->GetX()-GetWorldMousePos().x,2)+pow(player->GetY()-GetWorldMousePos().y,2)); + float distance=float(sqrt(pow(player->GetX()-GetWorldMousePos().x,2)+pow(player->GetY()-GetWorldMousePos().y,2))); if(distance>precastRange){//Clamp the distance. vf2d pointToCursor = {GetWorldMousePos().x-player->GetX(),GetWorldMousePos().y-player->GetY()}; pointToCursor=pointToCursor.norm()*precastRange; @@ -1152,7 +1151,7 @@ void Crawler::RenderWorld(float fElapsedTime){ if(DEBUG_PATHFINDING){ std::vectorpathing=game->pathfinder.Solve_AStar(player.get()->GetPos(),GetWorldMousePos(),8,player.get()->OnUpperLevel()); for(vf2d&square:pathing){ - view.FillRectDecal(square*game->GetCurrentMap().tilewidth,{float(game->GetCurrentMap().tilewidth),float(game->GetCurrentMap().tilewidth)},DARK_GREEN); + view.FillRectDecal(square*float(game->GetCurrentMap().tilewidth),{float(game->GetCurrentMap().tilewidth),float(game->GetCurrentMap().tilewidth)},DARK_GREEN); } } } @@ -1222,7 +1221,7 @@ void Crawler::RenderCooldowns(){ if(a.name!="???"){ if(a.cooldown>0.1){ vf2d iconScale={1,1}; - if(loadoutSlot!=-1)iconScale={0.7,0.7}; + if(loadoutSlot!=-1)iconScale={0.7f,0.7f}; DrawRotatedDecal(pos+vf2d{12,12},GFX[a.icon].Decal(),0,{12,12},iconScale,{255,255,255,64}); if(circle){ DrawPie(pos+vf2d{12,12},12,360-(a.cooldown/a.COOLDOWN_TIME)*360,PixelLerp(a.barColor1,a.barColor2,(a.cooldown/a.COOLDOWN_TIME))); @@ -1234,7 +1233,7 @@ void Crawler::RenderCooldowns(){ DrawShadowStringPropDecal(pos+vf2d{12,12}-vf2d{float(GetTextSizeProp(cooldownTimeDisplay.str()).x*0.5),float(GetTextSizeProp(cooldownTimeDisplay.str()).y*1)}/2,cooldownTimeDisplay.str(),WHITE,BLACK,{0.5,1}); }else{ vf2d iconScale={1,1}; - if(loadoutSlot!=-1)iconScale={0.7,0.7}; + if(loadoutSlot!=-1)iconScale={0.7f,0.7f}; DrawRotatedDecal(pos+vf2d{12,12},GFX[a.icon].Decal(),0,{12,12},iconScale,WHITE); } @@ -1261,8 +1260,8 @@ void Crawler::RenderCooldowns(){ uint32_t itemAmt=GetLoadoutItem(loadoutSlot).Amt(); if(itemAmt>0){ std::string amtString="x"+std::to_string(itemAmt); - vf2d qtySize=vf2d{GetTextSize(amtString)}*vf2d{0.5,0.75}; - DrawShadowStringDecal(pos+vf2d{20,20}-qtySize/2,amtString,WHITE,BLACK,{0.5,0.75}); + vf2d qtySize=vf2d{GetTextSize(amtString)}*vf2d{0.5f,0.75f}; + DrawShadowStringDecal(pos+vf2d{20,20}-qtySize/2,amtString,WHITE,BLACK,{0.5f,0.75f}); }else{ DrawDecal(pos,GFX["square_skill_overlay_icon_empty.png"].Decal(),{1,1},DARK_RED); shortNameCol=RED; @@ -1272,15 +1271,15 @@ void Crawler::RenderCooldowns(){ } if(a.manaCost>0){ - vf2d manaCostSize=vf2d{GetTextSize(std::to_string(a.manaCost))}*vf2d{0.5,0.75}; - DrawShadowStringDecal(pos+vf2d{20,4}-manaCostSize/2,std::to_string(a.manaCost),{192,192,255},manaCostShadowCol,{0.5,0.75}); + vf2d manaCostSize=vf2d{GetTextSize(std::to_string(a.manaCost))}*vf2d{0.5f,0.75f}; + DrawShadowStringDecal(pos+vf2d{20,4}-manaCostSize/2,std::to_string(a.manaCost),{192,192,255},manaCostShadowCol,{0.5f,0.75f}); } - vf2d keyDisplaySize=vf2d{GetTextSize(a.input->GetDisplayName())}*vf2d{0.5,0.5}; - DrawShadowStringDecal(pos+vf2d{12,-2}-keyDisplaySize/2,a.input->GetDisplayName(),keyDisplayCol,BLACK,{0.5,0.5},1); + vf2d keyDisplaySize=vf2d{GetTextSize(a.input->GetDisplayName())}*vf2d{0.5f,0.5f}; + DrawShadowStringDecal(pos+vf2d{12,-2}-keyDisplaySize/2,a.input->GetDisplayName(),keyDisplayCol,BLACK,{0.5f,0.5f},1); - vf2d shortNameSize=vf2d{GetTextSize(a.shortName)}*vf2d{0.5,0.75}; - DrawShadowStringDecal(pos+vf2d{13,24}-shortNameSize/2,a.shortName,shortNameCol,{255,255,255,64},{0.5,0.75}); + vf2d shortNameSize=vf2d{GetTextSize(a.shortName)}*vf2d{0.5f,0.75f}; + DrawShadowStringDecal(pos+vf2d{13,24}-shortNameSize/2,a.shortName,shortNameCol,{255,255,255,64},{0.5f,0.75f}); } }; @@ -1413,7 +1412,7 @@ void Crawler::LoadLevel(MapName map){ Inventory::Clear("Stage Loot"); #pragma region Monster Spawn Data Setup - for(auto key:MAP_DATA[map].SpawnerData){ + for(auto&key:MAP_DATA[map].SpawnerData){ SpawnerTag&spawnData=MAP_DATA[map].SpawnerData[key.first]; std::vector>monster_list; @@ -1578,8 +1577,8 @@ TilesheetData Crawler::GetTileSheet(MapName map,int tileID){ } else { for (int i=1;icollisionRect=GetTileCollision(map,pos,upperLevel); - vi2d collisionRectSnapPos=vi2d{pos/game->GetCurrentMap().tilewidth}*game->GetCurrentMap().tilewidth; + vi2d collisionRectSnapPos=vi2d{pos/float(game->GetCurrentMap().tilewidth)}*game->GetCurrentMap().tilewidth; collisionRect.pos+=collisionRectSnapPos; return geom2d::overlaps(collisionRect,pos); } @@ -1679,8 +1678,8 @@ void Crawler::ChangePlayerClass(Class cl){ } player->hp=player->maxhp=DATA.GetProperty(player->GetClassName()+".BaseHealth").GetInt(); player->atk=DATA.GetProperty(player->GetClassName()+".BaseAtk").GetInt(); - player->hpGrowthRate=DATA.GetProperty(player->GetClassName()+".HealthGrowthRate").GetReal(); - player->atkGrowthRate=DATA.GetProperty(player->GetClassName()+".AtkGrowthRate").GetReal(); + player->hpGrowthRate=float(DATA.GetProperty(player->GetClassName()+".HealthGrowthRate").GetReal()); + player->atkGrowthRate=float(DATA.GetProperty(player->GetClassName()+".AtkGrowthRate").GetReal()); sig::Animation::SetupPlayerAnimations(); GetPlayer()->UpdateIdleAnimation(DOWN); GetPlayer()->SetItem1UseFunc(itemAbility1); @@ -1721,7 +1720,7 @@ datafileintdata Crawler::GetIntList(std::string key){ } float Crawler::GetFloat(std::string key){ - return DATA.GetProperty(key).GetReal(); + return float(DATA.GetProperty(key).GetReal()); } datafilefloatdata Crawler::GetFloatList(std::string key){ @@ -1812,12 +1811,12 @@ int operator ""_I(const char*key,std::size_t len){ float operator ""_F(const char*key,std::size_t len){ Crawler::OutputDebugInfo(key,len); - return 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){ Crawler::OutputDebugInfo(key,len); - return util::random(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)); } double operator ""_D(const char*key,std::size_t len){ @@ -1926,7 +1925,8 @@ bool Crawler::InBossEncounter(){ void Crawler::StartBossEncounter(){ if(!encounterStarted){ encounterStarted=true; - totalDamageDealt=encounterDuration=0; + totalDamageDealt=0; + encounterDuration=0.f; } } @@ -1991,7 +1991,7 @@ void Crawler::InitializeGraphics(){ circleCooldownPoints.push_back({0,0}); squareCircleCooldownPoints.push_back({0,0}); for(int i=0;i<=360;i+=4){ - float angle=util::degToRad(i)-PI/2; + float angle=util::degToRad(float(i))-PI/2; circleCooldownPoints.push_back(vf2d{cos(angle),sin(angle)}); vf2d point=vf2d{cos(angle),sin(angle)}*sqrt(2.1f); point.x=std::clamp(point.x,-1.f,1.f); @@ -2091,7 +2091,7 @@ void Crawler::ValidateGameStatus(){ void Crawler::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)); - DrawShadowStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4,versionStr,WHITE,BLACK,{0.4,0.4},0.4); + DrawShadowStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4f,versionStr,WHITE,BLACK,{0.4f,0.4f},0.4f); } int Crawler::GetCurrentChapter(){ diff --git a/Crawler/Crawler.h b/Crawler/Crawler.h index d54720d3..92cd107e 100644 --- a/Crawler/Crawler.h +++ b/Crawler/Crawler.h @@ -74,7 +74,7 @@ private: float worldShakeTime=0; float lastWorldShakeAdjust=0; vf2d worldShakeVel={}; - const float WORLD_SHAKE_ADJUST_MAX_TIME=0.4; + const float WORLD_SHAKE_ADJUST_MAX_TIME=0.4f; MapName currentLevel=MapName::CAMPAIGN_1_1; std::vectorforegroundTileGroups; std::vectorupperForegroundTileGroups; diff --git a/Crawler/DamageNumber.cpp b/Crawler/DamageNumber.cpp index e7825cad..8b356321 100644 --- a/Crawler/DamageNumber.cpp +++ b/Crawler/DamageNumber.cpp @@ -33,7 +33,7 @@ SUCH DAMAGE. #pragma endregion #include "DamageNumber.h" -const float DamageNumber::MOVE_UP_TIME=0.4; +const float DamageNumber::MOVE_UP_TIME=0.4f; DamageNumber::DamageNumber() :damage(0){ diff --git a/Crawler/FireBolt.cpp b/Crawler/FireBolt.cpp index 7428be4f..9f57f158 100644 --- a/Crawler/FireBolt.cpp +++ b/Crawler/FireBolt.cpp @@ -68,7 +68,7 @@ bool FireBolt::MonsterHit(Monster& monster) game->AddEffect(std::make_unique(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)})); } game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F); - game->HurtEnemies(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,"Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack(),OnUpperLevel(),0); + game->HurtEnemies(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,int("Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack()),OnUpperLevel(),0); game->AddEffect(std::make_unique(monster.GetPos(),0,"splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel)); return false; } diff --git a/Crawler/InventoryScrollableWindowComponent.h b/Crawler/InventoryScrollableWindowComponent.h index 2edea183..a69a7a6d 100644 --- a/Crawler/InventoryScrollableWindowComponent.h +++ b/Crawler/InventoryScrollableWindowComponent.h @@ -71,8 +71,8 @@ public: protected: virtual inline void RemoveButton(MenuComponent*button){ if(button->selectable){ - std::vector&buttonList=Menu::menus[button->parentMenu]->buttons.at(button->GetPos().y); - std::vector&keyboardButtonList=Menu::menus[button->parentMenu]->keyboardButtons.at(button->GetPos().y); + std::vector&buttonList=Menu::menus[button->parentMenu]->buttons.at(int(button->GetPos().y)); + std::vector&keyboardButtonList=Menu::menus[button->parentMenu]->keyboardButtons.at(int(button->GetPos().y)); size_t removedCount=0; removedCount+=std::erase(buttonList,button); removedCount+=std::erase(keyboardButtonList,button); @@ -80,12 +80,12 @@ protected: std::cout<<"WARNING! Attempted to remove buttons from button listing, but not found!"; } if(buttonList.size()==0){ - if(!Menu::menus[button->parentMenu]->buttons.erase(button->GetPos().y)){ + if(!Menu::menus[button->parentMenu]->buttons.erase(int(button->GetPos().y))){ ERR("WARNING! Attempted to erase key "<GetPos().y<<" from button map, but the list still exists!") } } if(keyboardButtonList.size()==0){ - if(!Menu::menus[button->parentMenu]->keyboardButtons.erase(button->GetPos().y)){ + if(!Menu::menus[button->parentMenu]->keyboardButtons.erase(int(button->GetPos().y))){ ERR("WARNING! Attempted to erase key "<GetPos().y<<" from button map, but the list still exists!") } } @@ -100,8 +100,8 @@ protected: if(!button->valid){ for(int j=i;jparentMenu]->components.at(components[j]->name)=components[j+1]; - components[j]=components[j+1]; + Menu::menus[components[j]->parentMenu]->components.at(components[j]->name)=components[size_t(j+1)]; + components[j]=components[size_t(j+1)]; } MenuComponent*lastButton=Menu::menus[components[components.size()-1]->parentMenu]->components.at(components[components.size()-1]->name); //Now we have to fix up the keyboard button list. @@ -120,8 +120,8 @@ protected: //We only want to refresh the inventory slots if the component count no longer matches what's actually in our inventory. if(components.size()HasProperty(prop)) return (*customProps)[prop].GetReal(); - else return (*scriptProps)[prop].GetReal(); + if(customProps->HasProperty(prop)) return float((*customProps)[prop].GetReal()); + else return float((*scriptProps)[prop].GetReal()); }; std::string ItemProps::GetStringProp(std::string prop){ if(customProps->HasProperty(prop)) return (*customProps)[prop].GetString(); @@ -142,9 +142,9 @@ std::string ItemProps::GetStringProp(std::string prop){ void ItemInfo::InitializeScripts(){ ITEM_SCRIPTS["Restore"]=[](Crawler*game,ItemProps props){ game->GetPlayer()->Heal(props.GetIntProp("HP Restore")); - game->GetPlayer()->Heal(game->GetPlayer()->GetMaxHealth()*props.GetIntProp("HP % Restore")/100.f); + game->GetPlayer()->Heal(int(game->GetPlayer()->GetMaxHealth()*props.GetIntProp("HP % Restore")/100.f)); game->GetPlayer()->RestoreMana(props.GetIntProp("MP Restore")); - game->GetPlayer()->RestoreMana(game->GetPlayer()->GetMaxMana()*props.GetIntProp("MP % Restore")/100.f); + game->GetPlayer()->RestoreMana(int(game->GetPlayer()->GetMaxMana()*props.GetIntProp("MP % Restore")/100.f)); return true; }; @@ -337,7 +337,7 @@ void Inventory::Clear(ITCategory itemCategory){ if(itemCategory=="Monster Loot"||itemCategory=="Stage Loot"){//These do not affect the actual inventory, we just clear the lists. itemQuantity=item.Amt(); } - RemoveItem(item.Name(),itemCategory,itemQuantity); + RemoveItem(item.Name(),itemCategory,uint32_t(itemQuantity)); } } @@ -346,7 +346,7 @@ bool Item::operator==(const Item&rhs)const{ } ItemOverlay::ItemOverlay(ItemInfo item) -:it(item),width("ItemDrop.Item Drop Scale"_F*24+4+game->GetTextSizeProp(item.Name()).x*0.5){ +:it(item),width("ItemDrop.Item Drop Scale"_F*24+4+game->GetTextSizeProp(item.Name()).x*0.5f){ xOffset=-width; } @@ -364,11 +364,11 @@ void ItemOverlay::Draw(){ for(ItemOverlay&item:items){ vf2d pos={item.xOffset,96.f+counter*10}; Pixel darkCol=Menu::GetCurrentTheme().GetButtonCol(); - Pixel lightCol=Menu::GetCurrentTheme().GetButtonCol()*1.2; + Pixel lightCol=Menu::GetCurrentTheme().GetButtonCol()*1.2f; game->GradientFillRectDecal(pos,{item.width,8},darkCol,darkCol,darkCol,lightCol); game->DrawRectDecal(pos,{item.width,8},Menu::GetCurrentTheme().GetHighlightCol()); game->DrawDecal(pos,item.it.Decal(),{itemScale,itemScale}); - game->DrawShadowStringPropDecal(pos+vf2d{itemScale*24+2,2},item.it.Name(),WHITE,BLACK,{0.5,0.7}); + game->DrawShadowStringPropDecal(pos+vf2d{itemScale*24+2,2},item.it.Name(),WHITE,BLACK,{0.5f,0.7f}); counter++; } } diff --git a/Crawler/ItemDrop.cpp b/Crawler/ItemDrop.cpp index 8c4c1559..1b3b78e2 100644 --- a/Crawler/ItemDrop.cpp +++ b/Crawler/ItemDrop.cpp @@ -71,7 +71,7 @@ void ItemDrop::Draw(){ float yOffset=0; if(GetZ()==0){ - yOffset=sin((game->levelTime+randomSpinOffset)*3)*0.5; + yOffset=sin((game->levelTime+randomSpinOffset)*3)*0.5f; } game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},GFX["skill_overlay_icon_overlay.png"].Decal(),0,GFX["skill_overlay_icon_overlay.png"].Decal()->sprite->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},YELLOW); game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},item->Decal(),0,item->Decal()->sprite->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},{255,255,255,128}); diff --git a/Crawler/Key.cpp b/Crawler/Key.cpp index 1e0fed0b..8c7b575b 100644 --- a/Crawler/Key.cpp +++ b/Crawler/Key.cpp @@ -52,6 +52,8 @@ bool Input::Pressed(){ throw; //TODO: Throw for now, this control scheme is unsupported! }break; } + ERR("Invalid Control Scheme detected! We shouldn't be here!! Type is "<lineToTarget=geom2d::line(monster.GetPos(),m.GetPos()); float dist=lineToTarget.length(); if(dist<="Wizard.Ability 2.LightningChainRadius"_F/100*24){ - if(m.Hurt(game->GetPlayer()->GetAttack()*"Wizard.Ability 2.LightningChainDamageMult"_F,OnUpperLevel(),0)){ + if(m.Hurt(int(game->GetPlayer()->GetAttack()*"Wizard.Ability 2.LightningChainDamageMult"_F),OnUpperLevel(),0)){ EMITTER_LIST.push_back(std::make_unique(LightningBoltEmitter(monster.GetPos(),m.GetPos(),"Wizard.Ability 2.LightningChainFrequency"_F,"Wizard.Ability 2.LightningChainLifetime"_F,upperLevel))); game->AddEffect(std::make_unique(m.GetPos(),"Wizard.Ability 2.LightningChainSplashLifetime"_F,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.LightningChainSplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.LightningChainSplashRotationRange"_FRange)); targetsHit++; diff --git a/Crawler/LightningBoltEmitter.cpp b/Crawler/LightningBoltEmitter.cpp index 153da89f..cf37518f 100644 --- a/Crawler/LightningBoltEmitter.cpp +++ b/Crawler/LightningBoltEmitter.cpp @@ -55,7 +55,7 @@ void LightningBoltEmitter::DrawLightningBolt(){ float targetDist=lineToTarget.length()*util::random(0.5); targetAngle+=util::random((PI/2))-PI/4; geom2d::linelightningLine=geom2d::line(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist}); - game->AddEffect(std::make_unique(lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true)); + game->AddEffect(std::make_unique(lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},0.2f,vf2d{},WHITE,targetAngle,0,true)); int iterations=1; currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist}; while(iterations(currentPos,endPos).length()>1){ @@ -64,7 +64,7 @@ void LightningBoltEmitter::DrawLightningBolt(){ float targetDist=lineToTarget.length()*util::random(0.5); targetAngle+=util::random((PI/2))-PI/4; geom2d::linelightningLine=geom2d::line(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist}); - game->AddEffect(std::make_unique(lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true)); + game->AddEffect(std::make_unique(lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},0.2f,vf2d{},WHITE,targetAngle,0,true)); currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist}; iterations++; } diff --git a/Crawler/Map.cpp b/Crawler/Map.cpp index 1b6ce96b..7574d4d4 100644 --- a/Crawler/Map.cpp +++ b/Crawler/Map.cpp @@ -38,7 +38,7 @@ SUCH DAMAGE. INCLUDE_game INCLUDE_LEVEL_NAMES -float TileGroup::FADE_TIME=0.3; +float TileGroup::FADE_TIME=0.3f; uint8_t TileGroup::FADE_AMT=160; Map&MapHelper::MapFromString(std::string mapName){ diff --git a/Crawler/Map.h b/Crawler/Map.h index 173c1bbc..3290740d 100644 --- a/Crawler/Map.h +++ b/Crawler/Map.h @@ -56,7 +56,7 @@ struct TileCollisionData{ struct TilesetData{ Renderable*tileset=nullptr; - int tilewidth,tileheight; + int tilewidth=0,tileheight=0; std::mapforegroundTiles; std::mapupperForegroundTiles; std::mapcollision; diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp index c997b2ab..1f8893d2 100644 --- a/Crawler/Menu.cpp +++ b/Crawler/Menu.cpp @@ -70,12 +70,12 @@ typedef Attribute A; Menu::Menu(vf2d pos,vf2d size) :pos(pos==CENTERED?WINDOW_SIZE/2-size/2:vi2d{pos}),size(size){ - r.Create(size.x,size.y); + r.Create(uint32_t(size.x),uint32_t(size.y)); overlay.Create(WINDOW_SIZE.x,WINDOW_SIZE.y); } Menu::~Menu(){ - for(auto key:components){ + for(auto&key:components){ delete key.second; } } @@ -128,17 +128,17 @@ Menu*Menu::CreateMenu(MenuType type,vf2d pos,vf2d size){ void Menu::AddComponent(std::string key,MenuComponent*button){ if(button->selectable){ buttons.Unlock(); - if(buttons.count(button->rect.pos.y)){ - buttons.at(button->rect.pos.y).push_back(button); + if(buttons.count(int(button->rect.pos.y))){ + buttons.at(int(button->rect.pos.y)).push_back(button); }else{ - buttons[button->rect.pos.y].push_back(button); + buttons[int(button->rect.pos.y)].push_back(button); } if(button->selectableViaKeyboard){ keyboardButtons.Unlock(); - if(keyboardButtons.count(button->rect.pos.y)){ - keyboardButtons.at(button->rect.pos.y).push_back(button); + if(keyboardButtons.count(int(button->rect.pos.y))){ + keyboardButtons.at(int(button->rect.pos.y)).push_back(button); }else{ - keyboardButtons[button->rect.pos.y].push_back(button); + keyboardButtons[int(button->rect.pos.y)].push_back(button); } } @@ -147,11 +147,11 @@ void Menu::AddComponent(std::string key,MenuComponent*button){ keyboardButtons.SetInitialized(); //We make an assumption that menu components are supposed to be in left-to-right order. Sometimes we may add things out-of-order, so this fixes the problem by sorting the items afterwards. - std::sort(buttons[button->rect.pos.y].begin(),buttons[button->rect.pos.y].end(),[](MenuComponent*c1,MenuComponent*c2){ + std::sort(buttons[int(button->rect.pos.y)].begin(),buttons[int(button->rect.pos.y)].end(),[](MenuComponent*c1,MenuComponent*c2){ return c1->GetPos().xGetPos().x; }); - if(keyboardButtons.count(button->rect.pos.y)){ //Keyboard buttons may not necessarily contain this key...Let's be sure. - std::sort(keyboardButtons[button->rect.pos.y].begin(),keyboardButtons[button->rect.pos.y].end(),[](MenuComponent*c1,MenuComponent*c2){ + if(keyboardButtons.count(int(button->rect.pos.y))){ //Keyboard buttons may not necessarily contain this key...Let's be sure. + std::sort(keyboardButtons[int(button->rect.pos.y)].begin(),keyboardButtons[int(button->rect.pos.y)].end(),[](MenuComponent*c1,MenuComponent*c2){ return c1->GetPos().xGetPos().x; }); } @@ -395,7 +395,7 @@ void Menu::KeyboardButtonNavigation(Crawler*game,vf2d menuPos){ if(selection==vi2d{-1,-1})return; selection.x--; SetMouseNavigation(false); - if(selection.x<0)selection.x+=keyboardButtons[selection.y].size(); + if(selection.x<0)selection.x+=int32_t(keyboardButtons[selection.y].size()); } if(game->GetKey(DOWN).bPressed||game->GetKey(UP).bPressed){ if(game->GetKey(DOWN).bPressed){ @@ -411,7 +411,7 @@ void Menu::KeyboardButtonNavigation(Crawler*game,vf2d menuPos){ }else{ for(auto&key:keyboardButtons){ if(found){ //Once we discover the previous element, the next element becomes our next selection. - int previousButtonX=keyboardButtons[selection.y][selection.x]->rect.pos.x; + int previousButtonX=int(keyboardButtons[selection.y][selection.x]->rect.pos.x); selection.y=key.first; int index=0; for(auto&button:key.second){ //Try to match a button in the same column as this button first. @@ -456,7 +456,7 @@ void Menu::KeyboardButtonNavigation(Crawler*game,vf2d menuPos){ prevInd=key.first; } if(prevInd!=-1){ - int previousButtonX=keyboardButtons[selection.y][selection.x]->rect.pos.x; + int previousButtonX=int(keyboardButtons[selection.y][selection.x]->rect.pos.x); selection.y=prevInd; int index=0; for(auto&button:keyboardButtons[prevInd]){ //Try to match a button in the same column as this button first. @@ -687,9 +687,9 @@ bool Menu::IsMenuOpen(){ } void Menu::CleanupAllMenus(){ - for(auto key:Menu::menus){ + for(auto&key:Menu::menus){ Menu*menu=key.second; - for(auto componentKey:menu->components){ + for(auto&componentKey:menu->components){ MenuComponent*component=componentKey.second; component->Cleanup(); delete component; diff --git a/Crawler/Menu.h b/Crawler/Menu.h index 0948379a..b706fdf0 100644 --- a/Crawler/Menu.h +++ b/Crawler/Menu.h @@ -60,7 +60,7 @@ enum MenuType{ class Menu:public IAttributable{ friend class Crawler; - friend class Player; + friend struct Player; friend class ItemInfo; float buttonHoldTime=0; diff --git a/Crawler/MenuLabel.h b/Crawler/MenuLabel.h index 7385745b..c8d47fbf 100644 --- a/Crawler/MenuLabel.h +++ b/Crawler/MenuLabel.h @@ -61,7 +61,7 @@ protected: } virtual void inline Draw(Crawler*game,vf2d parentPos)override{ MenuComponent::Draw(game,parentPos); - std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{float(scale),float(scale)}); + std::string wrappedText=util::WrapText(game,label,int(rect.size.x),true,{float(scale),float(scale)}); vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered. if(!centered){ drawPos=vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here. diff --git a/Crawler/Meteor.cpp b/Crawler/Meteor.cpp index 4f544a0b..6cad081a 100644 --- a/Crawler/Meteor.cpp +++ b/Crawler/Meteor.cpp @@ -58,7 +58,7 @@ bool Meteor::Update(float fElapsedTime){ vf2d effectPos=vf2d{cos(randomAngle),sin(randomAngle)}*randomRange+meteorOffset; game->AddEffect(std::make_unique(effectPos,0,"circle.png",OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{255,uint8_t(randomColorTintG),uint8_t(randomColorTintB),uint8_t("Wizard.Ability 3.MeteorImpactParticleAlphaRange"_FRange)},0,0,true),effectPos.yHurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,game->GetPlayer()->GetAttack()*"Wizard.Ability 3.MeteorDamageMult"_F,OnUpperLevel(),0); + game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,int(game->GetPlayer()->GetAttack()*"Wizard.Ability 3.MeteorDamageMult"_F),OnUpperLevel(),0); game->AddEffect(std::make_unique(pos,"Wizard.Ability 3.FireRingLifetime"_F,"fire_ring1.png",OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100*2,"Wizard.Ability 3.MeteorRadius"_F/100*2},"Wizard.Ability 3.FireRingFadeoutTime"_F),true); } return Effect::Update(fElapsedTime); diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index b73c9d97..81fc8a53 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -58,7 +58,7 @@ safemapSTRATEGY_ID_DATA; std::mapMonsterData::imgs; Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): - pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),id(data.GetID()),upperLevel(upperLevel),isBoss(bossMob){ + pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),id(data.GetID()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(DOWN){ bool firstAnimation=true; for(std::string&anim:data.GetAnimations()){ animation.AddState(anim,ANIMATION_DATA[anim]); @@ -76,7 +76,7 @@ int Monster::GetHealth(){ return hp; } int Monster::GetAttack(){ - float mod_atk=atk; + float mod_atk=float(atk); for(Buff&b:GetBuffs(ATTACK_UP)){ mod_atk+=atk*b.intensity; } @@ -109,17 +109,17 @@ void Monster::PerformIdleAnimation(){ } bool Monster::SetX(float x){ vf2d newPos={x,pos.y}; - vi2d tilePos=vi2d(newPos/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().tilewidth; + vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth; geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel); if(collisionRect.pos==vi2d{0,0}&&collisionRect.size==vi2d{1,1}){ - pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } else { geom2d::rectcollision={collisionRect.pos,collisionRect.size}; collision.pos+=tilePos; if(!geom2d::overlaps(geom2d::circle(newPos,12*GetSizeMult()),collision)){ - pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } @@ -128,17 +128,17 @@ bool Monster::SetX(float x){ } bool Monster::SetY(float y){ vf2d newPos={pos.x,y}; - vi2d tilePos=vi2d(newPos/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().tilewidth; + vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth; geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel); if(collisionRect.pos==vi2d{0,0}&&collisionRect.size==vi2d{1,1}){ - pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } else { geom2d::rectcollision={collisionRect.pos,collisionRect.size}; collision.pos+=tilePos; if(!geom2d::overlaps(geom2d::circle(newPos,game->GetCurrentMap().tilewidth/2*GetSizeMult()),collision)){ - pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } @@ -171,7 +171,7 @@ bool Monster::Update(float fElapsedTime){ m.Collision(*this); geom2d::line line(pos,m.GetPos()); float dist = line.length(); - m.SetPos(line.rpoint(dist*1.1)); + m.SetPos(line.rpoint(dist*1.1f)); if(m.IsAlive()){ vel=line.vector().norm()*-128; } @@ -180,7 +180,7 @@ bool Monster::Update(float fElapsedTime){ if(!game->GetPlayer()->HasIframes()&&abs(game->GetPlayer()->GetZ()-GetZ())<=1&&game->GetPlayer()->OnUpperLevel()==OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(game->GetPlayer()->GetPos(),12*game->GetPlayer()->GetSizeMult()/2))){ geom2d::line line(pos,game->GetPlayer()->GetPos()); float dist = line.length(); - SetPos(line.rpoint(-0.1)); + SetPos(line.rpoint(-0.1f)); vel=line.vector().norm()*-128; } } @@ -244,7 +244,7 @@ void Monster::Collision(Monster&m){ Collision(); } void Monster::Collision(){ - if(strategy==0&&GetState()==State::MOVE_TOWARDS&&util::random(Monster::STRATEGY::_GetInt(*this,"BumpStopChance",strategy))<1){//The run towards strategy causes state to return to normal upon a collision. + if(strategy==0&&GetState()==State::MOVE_TOWARDS&&util::random(float(Monster::STRATEGY::_GetInt(*this,"BumpStopChance",strategy)))<1){//The run towards strategy causes state to return to normal upon a collision. SetState(State::NORMAL); } } @@ -257,7 +257,7 @@ bool Monster::SetPos(vf2d pos){ if(resultY&&!resultX){ resultX=SetX(pos.x); } - return resultX|resultY; + return resultX||resultY; } void Monster::Moved(){ std::map>&zoneData=game->GetZoneData(game->GetCurrentLevel()); @@ -281,19 +281,19 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){ game->StartBossEncounter(); } game->GetPlayer()->ResetLastCombatTime(); - float mod_dmg=damage; + float mod_dmg=float(damage); for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ mod_dmg-=damage*b.intensity; } hp=std::max(0,hp-int(mod_dmg)); if(lastHitTimer>0){ damageNumberPtr.get()->damage+=int(mod_dmg); - damageNumberPtr.get()->pauseTime=0.4; + damageNumberPtr.get()->pauseTime=0.4f; } else { damageNumberPtr=std::make_shared(pos,int(mod_dmg)); DAMAGENUMBER_LIST.push_back(damageNumberPtr); } - lastHitTimer=0.05; + lastHitTimer=0.05f; if(!IsAlive()){ OnDeath(); }else{ @@ -365,7 +365,7 @@ void Monster::StartPathfinding(float pathingTime){ void Monster::PathAroundBehavior(float fElapsedTime){ if(path.size()>0){ //Move towards the new path. - geom2d::line moveTowardsLine=geom2d::line(pos,path[pathIndex]*game->GetCurrentMap().tilewidth); + geom2d::line moveTowardsLine=geom2d::line(pos,path[pathIndex]*float(game->GetCurrentMap().tilewidth)); if(moveTowardsLine.length()>2){ SetPos(pos+moveTowardsLine.vector().norm()*100*fElapsedTime*GetMoveSpdMult()); if(moveTowardsLine.vector().x>0){ @@ -374,7 +374,7 @@ void Monster::PathAroundBehavior(float fElapsedTime){ facingDirection=LEFT; } }else{ - if(pathIndex+1>=path.size()){ + if(size_t(pathIndex+1)>=path.size()){ //We have reached the end of the path! targetAcquireTimer=0; }else{ @@ -450,7 +450,7 @@ void Monster::OnDeath(){ for(MonsterDropData data:MONSTER_DATA.at(id).GetDropData()){ if(util::random(100)<=data.dropChance){ //This isn't necessarily fair odds for each quantity dropped. - int dropQuantity=data.minQty+std::round(util::random(data.maxQty-data.minQty)); + int dropQuantity=int(data.minQty+std::round(util::random(float(data.maxQty-data.minQty)))); for(int i=0;ianimation; diff --git a/Crawler/MonsterData.cpp b/Crawler/MonsterData.cpp index 8ce11679..601028fb 100644 --- a/Crawler/MonsterData.cpp +++ b/Crawler/MonsterData.cpp @@ -141,8 +141,8 @@ void MonsterData::InitializeMonsterData(){ DATA["Monsters"][std::to_string(id)]["Attack"].GetInt(), animations, drops, - DATA["Monsters"][std::to_string(id)]["MoveSpd"].GetReal()/100, - DATA["Monsters"][std::to_string(id)]["Size"].GetReal()/100, + float(DATA["Monsters"][std::to_string(id)]["MoveSpd"].GetReal())/100, + float(DATA["Monsters"][std::to_string(id)]["Size"].GetReal())/100, STRATEGY_DATA[DATA["Monsters"][std::to_string(id)]["Strategy"].GetString()], DATA["Monsters"][std::to_string(id)]["CollisionDmg"].GetInt() ); diff --git a/Crawler/Pathfinding.cpp b/Crawler/Pathfinding.cpp index d6633649..7e6d5107 100644 --- a/Crawler/Pathfinding.cpp +++ b/Crawler/Pathfinding.cpp @@ -82,7 +82,7 @@ void Pathfinding::Initialize(){ } std::vector Pathfinding::Solve_AStar(vf2d startPos,vf2d endPos,float maxRange,bool upperLevel){ - float dist=sqrt(pow(endPos.x-startPos.x,2)+pow(endPos.y-startPos.y,2)); + float dist=float(sqrt(pow(endPos.x-startPos.x,2)+pow(endPos.y-startPos.y,2))); if(dist>maxRange*game->GetCurrentMap().tilewidth)return {}; nodeStart=&nodes[int(startPos.y/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().width+int(startPos.x/game->GetCurrentMap().tilewidth)]; @@ -108,7 +108,7 @@ std::vector Pathfinding::Solve_AStar(vf2d startPos,vf2d endPos,float maxRa auto distance = [](sNode* a, sNode* b) // For convenience { - return sqrtf((a->x - b->x)*(a->x - b->x) + (a->y - b->y)*(a->y - b->y)); + return sqrtf(float((a->x - b->x)*(a->x - b->x) + (a->y - b->y)*(a->y - b->y))); }; auto heuristic = [distance](sNode* a, sNode* b) diff --git a/Crawler/Pathfinding.h b/Crawler/Pathfinding.h index 8491c77f..c46b68fe 100644 --- a/Crawler/Pathfinding.h +++ b/Crawler/Pathfinding.h @@ -40,10 +40,10 @@ struct Pathfinding{ bool bObstacle = false; // Is the node an obstruction? bool bObstacleUpper = false; // Is the node an obstruction on the upper level? bool bVisited = false; // Have we searched this node before? - float fGlobalGoal; // Distance to goal so far - float fLocalGoal; // Distance to goal if we took the alternative route - int x; // Nodes position in 2D space - int y; + float fGlobalGoal=0; // Distance to goal so far + float fLocalGoal=0; // Distance to goal if we took the alternative route + int x=0; // Nodes position in 2D space + int y=0; std::vector vecNeighbours; // Connections to neighbours sNode* parent=nullptr; // Node connecting to this node that offers shortest parent }; diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index b81457ae..4e2e27c2 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -81,13 +81,13 @@ void Player::Initialize(){ bool Player::SetX(float x){ vf2d newPos={x,pos.y}; - vi2d tilePos=vi2d(newPos/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().tilewidth; + vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth; geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel); #pragma region lambdas auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;}; #pragma endregion if(NoTileCollisionExistsHere()){ - pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } else { @@ -97,7 +97,7 @@ bool Player::SetX(float x){ #pragma endregion collision.pos+=tilePos; if(NoPlayerCollisionWithTile()){ - pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.x=std::clamp(x,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().width*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } @@ -107,13 +107,13 @@ bool Player::SetX(float x){ bool Player::SetY(float y){ vf2d newPos={pos.x,y}; - vi2d tilePos=vi2d(newPos/game->GetCurrentMap().tilewidth)*game->GetCurrentMap().tilewidth; + vi2d tilePos=vi2d(newPos/float(game->GetCurrentMap().tilewidth))*game->GetCurrentMap().tilewidth; geom2d::rectcollisionRect=game->GetTileCollision(game->GetCurrentLevel(),newPos,upperLevel); #pragma region lambdas auto NoTileCollisionExistsHere=[&](){return collisionRect.pos==game->NO_COLLISION.pos&&collisionRect.size==game->NO_COLLISION.size;}; #pragma endregion if(NoTileCollisionExistsHere()){ - pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } else { @@ -123,7 +123,7 @@ bool Player::SetY(float y){ #pragma endregion collision.pos+=tilePos; if(NoPlayerCollisionWithTile()){ - pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2*GetSizeMult())); + pos.y=std::clamp(y,game->GetCurrentMap().tilewidth/2.f*GetSizeMult(),float(game->GetCurrentMap().height*game->GetCurrentMap().tilewidth-game->GetCurrentMap().tilewidth/2.f*GetSizeMult())); Moved(); return true; } @@ -141,7 +141,7 @@ bool Player::SetPos(vf2d pos){ if(resultY&&!resultX){ resultX=SetX(pos.x); } - return resultX|resultY; + return resultX||resultY; } vf2d&Player::GetPos(){ @@ -177,7 +177,7 @@ int Player::GetMaxMana() { } int Player::GetAttack(){ - float mod_atk=atk; + float mod_atk=float(atk); for(Buff&b:GetBuffs(BuffType::ATTACK_UP)){ mod_atk+=atk*b.intensity; } @@ -247,7 +247,7 @@ void Player::Update(float fElapsedTime){ } } while(manaTickTimer<=0){ - manaTickTimer+=0.2; + manaTickTimer+=0.2f; RestoreMana(1,true); } for(std::vector::iterator it=buffList.begin();it!=buffList.end();++it){ @@ -265,14 +265,14 @@ void Player::Update(float fElapsedTime){ switch(facingDirection){ case UP:{ if(lastAnimationFlip==0){ - lastAnimationFlip=0.03; + lastAnimationFlip=0.03f; facingDirection=DOWN; animation.ChangeState(internal_animState,"WARRIOR_WALK_S"); } }break; case DOWN:{ if(lastAnimationFlip==0){ - lastAnimationFlip=0.03; + lastAnimationFlip=0.03f; facingDirection=UP; animation.ChangeState(internal_animState,"WARRIOR_WALK_N"); } @@ -291,7 +291,7 @@ void Player::Update(float fElapsedTime){ spin_angle=0; z=0; float numb=4; - game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,GetAttack()*"Warrior.Ability 2.DamageMult"_F,OnUpperLevel(),0); + game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,int(GetAttack()*"Warrior.Ability 2.DamageMult"_F),OnUpperLevel(),0); game->AddEffect(std::make_unique(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-front.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-back.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F)); } if(lastAnimationFlip>0){ @@ -379,7 +379,7 @@ void Player::Update(float fElapsedTime){ if(dist<=0.001){ m.SetPos(m.GetPos()+vf2d{util::random(2)-1,util::random(2)-1}); }else{ - m.SetPos(line.rpoint(dist*1.1)); + m.SetPos(line.rpoint(dist*1.1f)); } if(m.IsAlive()){ vel=line.vector().norm()*-128; @@ -430,9 +430,10 @@ void Player::Update(float fElapsedTime){ } } else if(ability.cooldown==0&&GetMana()0){ remainingRapidFireShots--; geom2d::line pointTowardsCursor(GetPos(),game->GetWorldMousePos()); - vf2d extendedLine=pointTowardsCursor.upoint(1.1); + vf2d extendedLine=pointTowardsCursor.upoint(1.1f); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; - BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F-PI/8*"Ranger.Ability 1.ArrowSpd"_F)}+movementVelocity,12*"Ranger.Ability 1.ArrowRadius"_F/100,GetAttack()*"Ranger.Ability 1.DamageMult"_F,OnUpperLevel(),true))); + BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F-PI/8*"Ranger.Ability 1.ArrowSpd"_F)}+movementVelocity,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true))); SetAnimationBasedOnTargetingDirection(angleToCursor); rapidFireTimer=RAPID_FIRE_SHOOT_DELAY; }else{ @@ -574,7 +575,7 @@ bool Player::CanAct(){ } bool Player::CanAct(Ability&ability){ - return (ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK&&GameState::STATE==GameState::states[States::GAME_RUN]; + return !ability.waitForRelease&&(ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK&&GameState::STATE==GameState::states[States::GAME_RUN]; } bool Player::HasIframes(){ @@ -583,8 +584,8 @@ bool Player::HasIframes(){ bool Player::Hurt(int damage,bool onUpperLevel,float z){ if(hp<=0||HasIframes()||OnUpperLevel()!=onUpperLevel||abs(GetZ()-z)>1) return false; - if(GetState()==State::BLOCK)damage*=1-"Warrior.Right Click Ability.DamageReduction"_F; - float mod_dmg=damage; + if(GetState()==State::BLOCK)damage*=int(1-"Warrior.Right Click Ability.DamageReduction"_F); + float mod_dmg=float(damage); lastCombatTime=0; for(Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ mod_dmg-=damage*b.intensity; @@ -592,12 +593,12 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ hp=std::max(0,hp-int(mod_dmg)); if(lastHitTimer>0){ damageNumberPtr.get()->damage+=int(mod_dmg); - damageNumberPtr.get()->pauseTime=0.4; + damageNumberPtr.get()->pauseTime=0.4f; } else { damageNumberPtr=std::make_shared(pos,int(mod_dmg),true); DAMAGENUMBER_LIST.push_back(damageNumberPtr); } - lastHitTimer=0.05; + lastHitTimer=0.05f; return true; } @@ -634,6 +635,7 @@ Key Player::GetFacingDirection(){ void Player::Moved(){ if(state==State::CASTING){ state=State::NORMAL; + castPrepAbility->waitForRelease=true; castInfo={"",0}; DAMAGENUMBER_LIST.push_back(std::make_shared(GetPos(),0,true,INTERRUPT)); } @@ -718,7 +720,7 @@ void Player::RemoveAllBuffs(){ void Player::CastSpell(Ability&ability){ vf2d castPosition=game->GetWorldMousePos(); - float distance=sqrt(pow(GetX()-game->GetWorldMousePos().x,2)+pow(GetY()-game->GetWorldMousePos().y,2)); + float distance=float(sqrt(pow(GetX()-game->GetWorldMousePos().x,2)+pow(GetY()-game->GetWorldMousePos().y,2))); if(distance>ability.precastInfo.range){//Clamp the distance. vf2d pointToCursor = {game->GetWorldMousePos().x-GetX(),game->GetWorldMousePos().y-GetY()}; pointToCursor=pointToCursor.norm()*ability.precastInfo.range; diff --git a/Crawler/Player.h b/Crawler/Player.h index 903c37f0..b48a805f 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -79,7 +79,7 @@ private: float spin_angle=0; float lastAnimationFlip=0; float manaTickTimer=0; - std::pair notEnoughManaDisplay={"",0}; + std::pair notEnoughManaDisplay={"",0.f}; float teleportAttemptWaitTime=0; //If a teleport fails, we wait awhile before trying again, it's expensive. State::State state=State::NORMAL; Animate2D::Animationanimation; @@ -110,7 +110,7 @@ protected: float teleportAnimationTimer=0; vf2d teleportTarget={}; vf2d teleportStartPosition={}; - std::pair notificationDisplay={"",0}; + std::pair notificationDisplay={"",0.f}; bool upperLevel=false; vf2d vel={0,0}; float attack_range="Warrior.Auto Attack.Range"_F/100.f; @@ -124,7 +124,7 @@ protected: const float RETREAT_DISTANCE=24*"Ranger.Right Click Ability.RetreatDistance"_F/100; float RETREAT_TIME="Ranger.Right Click Ability.RetreatTime"_F; //How long the Retreat ability takes. const int RETREAT_GHOST_FRAMES=8; - const float RETREAT_GHOST_FRAME_DELAY=0.025; + const float RETREAT_GHOST_FRAME_DELAY=0.025f; float ghostFrameTimer=0; float ghostRemoveTimer=0; float blockTimer=0; diff --git a/Crawler/PopupMenuLabel.h b/Crawler/PopupMenuLabel.h index 73dd9f04..9e70dd8b 100644 --- a/Crawler/PopupMenuLabel.h +++ b/Crawler/PopupMenuLabel.h @@ -44,7 +44,7 @@ private: float scale; public: inline PopupMenuLabel(MenuType parent,geom2d::rectrect,std::string label,float scale=1,ComponentAttr attributes=ComponentAttr::NONE) - :MenuLabel(parent,rect,label,scale,attributes),scale(scale){ + :MenuLabel(parent,rect,label,int(scale),attributes),scale(scale){ } protected: virtual void inline Update(Crawler*game)override{ @@ -54,7 +54,7 @@ protected: virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{ if(label.length()>0){ MenuLabel::DrawDecal(game,parentPos,focused); - std::string wrappedText=util::WrapText(game,label,rect.size.x-1,true,{scale,scale}); + std::string wrappedText=util::WrapText(game,label,int(rect.size.x-1),true,{scale,scale}); vf2d drawPos=Menu::menus.at(parentMenu)->pos+parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered. if(!centered){ drawPos=Menu::menus.at(parentMenu)->pos+vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here. diff --git a/Crawler/PulsatingFire.cpp b/Crawler/PulsatingFire.cpp index 8fa8f247..ed97579a 100644 --- a/Crawler/PulsatingFire.cpp +++ b/Crawler/PulsatingFire.cpp @@ -52,7 +52,7 @@ bool PulsatingFire::Update(float fElapsedTime){ lastParticleTimer-=fElapsedTime; lastDamageTimer-=fElapsedTime; if(lastParticleTimer<=0){ - int particleCount="Wizard.Ability 3.FireRingParticleSpawnAmtRange"_FRange; + int particleCount=int("Wizard.Ability 3.FireRingParticleSpawnAmtRange"_FRange); for(int i=0;iHurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,game->GetPlayer()->GetAttack()*"Wizard.Ability 3.FireRingDamageMult"_F,OnUpperLevel(),0); + lastDamageTimer="Wizard.Ability 3.FireRingDamageFreq"_F-0.01f; + game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,int(game->GetPlayer()->GetAttack()*"Wizard.Ability 3.FireRingDamageMult"_F),OnUpperLevel(),0); } return Effect::Update(fElapsedTime); } diff --git a/Crawler/RUN_STRATEGY.cpp b/Crawler/RUN_STRATEGY.cpp index 62e20d80..f6e75649 100644 --- a/Crawler/RUN_STRATEGY.cpp +++ b/Crawler/RUN_STRATEGY.cpp @@ -46,9 +46,9 @@ int Monster::STRATEGY::_GetInt(Monster&m,std::string param,int strategyNumber,in } float Monster::STRATEGY::_GetFloat(Monster&m,std::string param,int strategyNumber,int index){ if(DATA["Monsters"][std::to_string(m.id)].HasProperty(param)){ - return DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetReal(index); + return float(DATA["Monsters"][std::to_string(m.id)].GetProperty(param).GetReal(index)); } else { - return DATA["MonsterStrategy"][std::to_string(strategyNumber)].GetProperty(param).GetReal(index); + return float(DATA["MonsterStrategy"][std::to_string(strategyNumber)].GetProperty(param).GetReal(index)); } } std::string Monster::STRATEGY::_GetString(Monster&m,std::string param,int strategyNumber,int index){ diff --git a/Crawler/Ranger.cpp b/Crawler/Ranger.cpp index 147ce771..4574566d 100644 --- a/Crawler/Ranger.cpp +++ b/Crawler/Ranger.cpp @@ -64,10 +64,10 @@ void Ranger::OnUpdate(float fElapsedTime){ bool Ranger::AutoAttack(){ geom2d::line pointTowardsCursor(GetPos(),game->GetWorldMousePos()); - vf2d extendedLine=pointTowardsCursor.upoint(1.1); + vf2d extendedLine=pointTowardsCursor.upoint(1.1f); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; - BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity,"Ranger.Auto Attack.Radius"_F/100*12,GetAttack()*"Ranger.Auto Attack.DamageMult"_F,OnUpperLevel(),true))); + BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity,"Ranger.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true))); SetState(State::SHOOT_ARROW); SetAnimationBasedOnTargetingDirection(angleToCursor); return true; @@ -78,7 +78,7 @@ void Ranger::InitializeClassAbilities(){ Ranger::rightClickAbility.action= [](Player*p,vf2d pos={}){ geom2d::line mouseDir{game->GetWorldMousePos(),p->GetPos()}; - float velocity=(0.5*-p->friction*p->RETREAT_TIME*p->RETREAT_TIME-p->RETREAT_DISTANCE)/-p->RETREAT_TIME; //Derived from kinetic motion formula. + float velocity=(0.5f*-p->friction*p->RETREAT_TIME*p->RETREAT_TIME-p->RETREAT_DISTANCE)/-p->RETREAT_TIME; //Derived from kinetic motion formula. p->SetVelocity(mouseDir.vector().norm()*velocity); p->retreatTimer=p->RETREAT_TIME; p->iframe_time=p->RETREAT_TIME; @@ -128,8 +128,8 @@ void Ranger::InitializeClassAbilities(){ const float increment=halfAngle/"Ranger.Ability 3.ArrowCount"_I; const float newAngle=shootingAngle+leftAngle/2+i*increment; geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist); - vf2d extendedLine=pointTowardsCursor.upoint(1.1); - BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,p->GetAttack()*"Ranger.Ability 3.DamageMult"_F,p->OnUpperLevel(),true))); + vf2d extendedLine=pointTowardsCursor.upoint(1.1f); + BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true))); } p->SetAnimationBasedOnTargetingDirection(shootingAngle); return true; diff --git a/Crawler/RunAway.cpp b/Crawler/RunAway.cpp index 6ed416f8..9c0ec8de 100644 --- a/Crawler/RunAway.cpp +++ b/Crawler/RunAway.cpp @@ -46,7 +46,7 @@ void Monster::STRATEGY::RUN_AWAY(Monster&m,float fElapsedTime,int strategyNumber if(m.targetAcquireTimer==0&&m.queueShotTimer==0){ m.targetAcquireTimer=1; if(line.length()<24.f*ConfigInt("Range")/100.f){ - m.target=line.upoint(-1.2); + m.target=line.upoint(-1.2f); if(m.canMove){ m.SetState(State::MOVE_AWAY); } else { @@ -54,7 +54,7 @@ void Monster::STRATEGY::RUN_AWAY(Monster&m,float fElapsedTime,int strategyNumber } } else if(line.length()>24.f*ConfigInt("CloseInRange")/100.0f){ - m.target=line.upoint(1.2); + m.target=line.upoint(1.2f); m.SetState(State::MOVE_TOWARDS); } else { m.SetState(State::NORMAL); diff --git a/Crawler/RunTowards.cpp b/Crawler/RunTowards.cpp index 59a5dd94..f9bed201 100644 --- a/Crawler/RunTowards.cpp +++ b/Crawler/RunTowards.cpp @@ -49,7 +49,7 @@ void Monster::STRATEGY::RUN_TOWARDS(Monster&m,float fElapsedTime,int strategyNum //Trim to max distance desired. m.target=desiredTargetLine.rpoint(ConfigInt("MaxDistance")/100.f*24); } else { - m.target=desiredTargetLine.upoint(1.2); + m.target=desiredTargetLine.upoint(1.2f); } m.SetState(State::MOVE_TOWARDS); m.hasHitPlayer=false; diff --git a/Crawler/ScrollableWindowComponent.h b/Crawler/ScrollableWindowComponent.h index d87aace7..034bdf0f 100644 --- a/Crawler/ScrollableWindowComponent.h +++ b/Crawler/ScrollableWindowComponent.h @@ -59,7 +59,7 @@ public: :MenuComponent(parent,rect,"",[](MenuFuncData data){return true;},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD){ background=attributes&ComponentAttr::BACKGROUND; border=attributes&ComponentAttr::OUTLINE; - r.Create(rect.size.x,rect.size.y); + r.Create(uint32_t(rect.size.x),uint32_t(rect.size.y)); } protected: virtual inline void AfterCreate()override{ diff --git a/Crawler/ShootAfar.cpp b/Crawler/ShootAfar.cpp index d30a9c98..b38e87a5 100644 --- a/Crawler/ShootAfar.cpp +++ b/Crawler/ShootAfar.cpp @@ -47,7 +47,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb if(m.queueShotTimer<0){ m.queueShotTimer=0; { - BULLET_LIST.push_back(std::make_unique(Bullet(m.pos + vf2d{ 0,-4 }, geom2d::line(m.pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24 * ConfigInt("BulletSpeed")/100.f, 12.f*ConfigInt("BulletSize")/100.f, m.GetAttack(),m.upperLevel,false, { uint8_t(ConfigIntArr("BulletColor",0)),uint8_t(ConfigIntArr("BulletColor",1)),uint8_t(ConfigIntArr("BulletColor",2)),uint8_t(ConfigIntArr("BulletColor",3) )},{ConfigInt("BulletSize")/100.f*8,ConfigInt("BulletSize")/100.f*8}))); + BULLET_LIST.push_back(std::make_unique(Bullet(m.pos + vf2d{ 0,-4 }, geom2d::line(m.pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24.f * float(ConfigInt("BulletSpeed"))/100.f, 12.f*ConfigInt("BulletSize")/100.f, m.GetAttack(),m.upperLevel,false, { uint8_t(ConfigIntArr("BulletColor",0)),uint8_t(ConfigIntArr("BulletColor",1)),uint8_t(ConfigIntArr("BulletColor",2)),uint8_t(ConfigIntArr("BulletColor",3) )},{ConfigInt("BulletSize")/100.f*8,ConfigInt("BulletSize")/100.f*8}))); } } } @@ -55,7 +55,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb if(m.targetAcquireTimer==0&&m.queueShotTimer==0){ m.targetAcquireTimer=1; if(line.length()<24.f*ConfigInt("Range")/100.f){ - m.target=line.upoint(-1.2); + m.target=line.upoint(-1.2f); if(m.canMove){ m.SetState(State::MOVE_AWAY); } else { @@ -63,7 +63,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb } } else if(line.length()>24.f*ConfigInt("CloseInRange")/100.0f){ - m.target=line.upoint(1.2); + m.target=line.upoint(1.2f); m.SetState(State::MOVE_TOWARDS); } else { m.SetState(State::NORMAL); @@ -78,7 +78,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb vf2d newPos=m.pos+moveTowardsLine.vector().norm()*100*fElapsedTime*m.GetMoveSpdMult(); bool movedX=m.SetX(newPos.x); bool movedY=m.SetY(newPos.y); - pathfindingDecision=movedX|movedY; + pathfindingDecision=movedX||movedY; m.canMove=movedX&&movedY; } if(!pathfindingDecision){ @@ -99,7 +99,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb vf2d newPos=m.pos+moveTowardsLine.vector().norm()*100*fElapsedTime*m.GetMoveSpdMult(); bool movedX=m.SetX(newPos.x); bool movedY=m.SetY(newPos.y); - pathfindingDecision=movedX|movedY; + pathfindingDecision=movedX||movedY; m.canMove=movedX&&movedY; } if(!pathfindingDecision){ @@ -121,7 +121,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,int strategyNumb default:{ if(m.attackCooldownTimer==0){ m.attackCooldownTimer=ConfigFloat("ShootingSpeed"); - m.queueShotTimer=std::min(m.attackCooldownTimer-0.001,0.7); + m.queueShotTimer=std::min(m.attackCooldownTimer-0.001f,0.7f); m.PerformShootAnimation(); } } diff --git a/Crawler/SlimeKing.cpp b/Crawler/SlimeKing.cpp index ee4d5f29..1a251b72 100644 --- a/Crawler/SlimeKing.cpp +++ b/Crawler/SlimeKing.cpp @@ -134,7 +134,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.I(A::JUMP_COUNT)++; float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); - StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); + StartJumpTowardsPlayer(jumpTime,0.2f,jumpSpd); }break; default:{ m.PerformIdleAnimation(); @@ -179,13 +179,13 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.SetY(std::min(jumpTargetPos.y,m.GetPos().y+m.F(A::JUMP_MOVE_SPD)*game->GetElapsedTime())); } if(m.F(A::JUMP_LANDING_TIMER)>=m.F(A::JUMP_ORIGINAL_LANDING_TIMER)/2){ - m.SetZ(util::lerp(0,ConfigInt("JumpHeight"),1-jumpLandingTimerRatio)); + m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),1-jumpLandingTimerRatio)); }else{ - m.SetZ(util::lerp(0,ConfigInt("JumpHeight"),jumpLandingTimerRatio*2)); + m.SetZ(util::lerp(0,float(ConfigInt("JumpHeight")),jumpLandingTimerRatio*2)); } if(m.F(A::JUMP_LANDING_TIMER)==0){ m.state=State::RECOVERY; - game->SetupWorldShake(0.6); + game->SetupWorldShake(0.6f); geom2d::linelineToPlayer(m.GetPos(),game->GetPlayer()->GetPos()); float dist=lineToPlayer.length(); for(int i=0;i<200;i++){ @@ -198,7 +198,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe float randomDir=util::random(2*PI); lineToPlayer={m.GetPos(),m.GetPos()+vf2d{cos(randomDir),sin(randomDir)}*1}; } - game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*ConfigInt("JumpKnockbackFactor")); + game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*float(ConfigInt("JumpKnockbackFactor"))); if(m.phase!=2){ //In phase 2, the player can get slammed multiple times. No iframes for messing up. game->GetPlayer()->SetIframes(1); } @@ -223,14 +223,14 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe m.I(A::JUMP_COUNT)++; float jumpTime=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",0); float jumpSpd=ConfigFloatArr("Phase2.Jump["+std::to_string(m.I(A::JUMP_COUNT))+"]",1); - StartJumpTowardsPlayer(jumpTime,0.2,jumpSpd); + StartJumpTowardsPlayer(jumpTime,0.2f,jumpSpd); } return; } switch(m.phase){ case 0:{ - m.size=ConfigInt("Phase1.Size")/100; + m.size=ConfigInt("Phase1.Size")/100.f; m.diesNormally=false; m.F(A::IFRAME_TIME_UPON_HIT)=0; m.iframe_timer=ConfigFloat("Phase5.IframeTimePerHit"); @@ -277,7 +277,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe return; } if(m.F(A::SHOOT_TIMER)==0){ - m.F(A::SHOOT_TIMER)=ConfigInt("Phase2.ShootRate"); + m.F(A::SHOOT_TIMER)=float(ConfigInt("Phase2.ShootRate")); m.I(A::PATTERN_REPEAT_COUNT)++; int bulletCount=ConfigInt("Phase2.ShootProjectileCount"); for(int i=0;i ForegroundTileData; std::map UpperForegroundTileData; std::map CollisionData; diff --git a/Crawler/TestSubMenu.cpp b/Crawler/TestSubMenu.cpp index a6272177..dc04b371 100644 --- a/Crawler/TestSubMenu.cpp +++ b/Crawler/TestSubMenu.cpp @@ -64,7 +64,7 @@ void Menu::InitializeTestSubMenu(){ bool found=false; data.menu.I(A::INDEXED_THEME)--; if(data.menu.I(A::INDEXED_THEME)<0){ - data.menu.I(A::INDEXED_THEME)=themes.size()-1; + data.menu.I(A::INDEXED_THEME)=int(themes.size()-1); } int index=0; for(auto&theme:Menu::themes){ diff --git a/Crawler/Turret.cpp b/Crawler/Turret.cpp index 7cb2aa3f..a6dc4ede 100644 --- a/Crawler/Turret.cpp +++ b/Crawler/Turret.cpp @@ -56,7 +56,7 @@ void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,int strategyNumber){ m.queueShotTimer-=fElapsedTime; if(m.queueShotTimer<0){ m.queueShotTimer=0; - BULLET_LIST.push_back(std::make_unique(Bullet(m.pos + vf2d{ 0,-4 }, geom2d::line(m.pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24 * ConfigInt("BulletSpeed")/100.f, 12.f*ConfigInt("BulletSize")/100.f, m.GetAttack(),m.upperLevel,false, { uint8_t(ConfigIntArr("BulletColor",0)),uint8_t(ConfigIntArr("BulletColor",1)),uint8_t(ConfigIntArr("BulletColor",2)),uint8_t(ConfigIntArr("BulletColor",3) )},{ConfigInt("BulletSize")/100.f*8,ConfigInt("BulletSize")/100.f*8}))); + BULLET_LIST.push_back(std::make_unique(Bullet(m.pos + vf2d{ 0,-4 }, geom2d::line(m.pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24.f * float(ConfigInt("BulletSpeed"))/100.f, 12.f*ConfigInt("BulletSize")/100.f, m.GetAttack(),m.upperLevel,false, { uint8_t(ConfigIntArr("BulletColor",0)),uint8_t(ConfigIntArr("BulletColor",1)),uint8_t(ConfigIntArr("BulletColor",2)),uint8_t(ConfigIntArr("BulletColor",3) )},{ConfigInt("BulletSize")/100.f*8,ConfigInt("BulletSize")/100.f*8}))); } } @@ -64,7 +64,7 @@ void Monster::STRATEGY::TURRET(Monster&m,float fElapsedTime,int strategyNumber){ if(distHurt(GetAttack()*"Warrior.Auto Attack.DamageMult"_F,OnUpperLevel(),GetZ())){ + if(closest!=nullptr&&closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ())){ attack_cooldown_timer=ATTACK_COOLDOWN; swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; SetState(State::SWING_SWORD); diff --git a/Crawler/Wizard.cpp b/Crawler/Wizard.cpp index 9b278198..da73830a 100644 --- a/Crawler/Wizard.cpp +++ b/Crawler/Wizard.cpp @@ -100,7 +100,7 @@ void Wizard::OnUpdate(float fElapsedTime){ bool Wizard::AutoAttack(){ attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); - BULLET_LIST.push_back(std::make_unique(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,GetAttack()*"Wizard.Auto Attack.DamageMult"_F,upperLevel,true,WHITE))); + BULLET_LIST.push_back(std::make_unique(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Wizard.Auto Attack.DamageMult"_F),upperLevel,true,WHITE))); return true; } void Wizard::InitializeClassAbilities(){ @@ -112,11 +112,11 @@ void Wizard::InitializeClassAbilities(){ float dist=std::clamp(geom2d::line{p->GetPos(),game->GetWorldMousePos()}.length(),0.f,"Wizard.Right Click Ability.TeleportRange"_F/100*24); if(dist<"Wizard.Right Click Ability.TilesMin"_I*12)return false; vf2d teleportPoint=p->GetPos()+pointTowardsMouse*dist; - while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ + while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint,float("Wizard.Right Click Ability.TilesMax"_I))){ dist-=4; teleportPoint=p->GetPos()+pointTowardsMouse*dist; } - if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ + if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint,float("Wizard.Right Click Ability.TilesMax"_I))){ p->SetState(State::TELEPORT); p->teleportAnimationTimer="Wizard.Right Click Ability.AnimationTime"_F; p->teleportTarget=teleportPoint; @@ -136,7 +136,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability1.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F,p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); + BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F),p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); return true; }; #pragma endregion @@ -144,7 +144,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability2.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 2.DamageMult"_F,p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); + BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 2.DamageMult"_F),p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); return true; }; #pragma endregion diff --git a/Crawler/assets/Campaigns/1_1_v2.tmx b/Crawler/assets/Campaigns/1_1_v2.tmx index 1d4bb518..36d0771f 100644 --- a/Crawler/assets/Campaigns/1_1_v2.tmx +++ b/Crawler/assets/Campaigns/1_1_v2.tmx @@ -1135,7 +1135,7 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1170,7 +1170,7 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -1262,7 +1262,7 @@ - + diff --git a/Crawler/olcPixelGameEngine.h b/Crawler/olcPixelGameEngine.h index 9c422ba9..77f9b47d 100644 --- a/Crawler/olcPixelGameEngine.h +++ b/Crawler/olcPixelGameEngine.h @@ -569,11 +569,11 @@ namespace olc class Sprite; // Pixel Game Engine Advanced Configuration - constexpr uint8_t nMouseButtons = 5; - constexpr uint8_t nDefaultAlpha = 0xFF; - constexpr uint32_t nDefaultPixel = (nDefaultAlpha << 24); - constexpr uint8_t nTabSizeInSpaces = 4; - constexpr size_t OLC_MAX_VERTS = 128; + constexpr inline uint8_t nMouseButtons = 5; + constexpr inline uint8_t nDefaultAlpha = 0xFF; + constexpr inline uint32_t nDefaultPixel = (nDefaultAlpha << 24); + constexpr inline uint8_t nTabSizeInSpaces = 4; + constexpr inline size_t OLC_MAX_VERTS = 128; enum rcode { FAIL = 0, OK = 1, NO_FILE = -1 }; // O------------------------------------------------------------------------------O @@ -3344,7 +3344,7 @@ namespace olc for(float y=-shadowSizeFactor;y<=shadowSizeFactor+0.1;y+=shadowSizeFactor/2){ for(float x=-shadowSizeFactor;x<=shadowSizeFactor+0.1;x+=shadowSizeFactor/2){ if(x!=0||y!=0){ - DrawString(pos.x+x,pos.y+y, sText, shadowCol,int(scale.x)); + DrawString(int32_t(pos.x+x),int32_t(pos.y+y), sText, shadowCol,int(scale.x)); } } } @@ -3355,7 +3355,7 @@ namespace olc for(float y=-shadowSizeFactor;y<=shadowSizeFactor+0.1;y+=shadowSizeFactor/2){ for(float x=-shadowSizeFactor;x<=shadowSizeFactor+0.1;x+=shadowSizeFactor/2){ if(x!=0||y!=0){ - DrawStringProp(pos.x+x,pos.y+y, sText, shadowCol,int(scale.x)); + DrawStringProp(int32_t(pos.x+x),int32_t(pos.y+y), sText, shadowCol,int(scale.x)); } } } @@ -6858,4 +6858,4 @@ namespace olc using namespace olc; -#define PI 3.14159 \ No newline at end of file +#define PI 3.14159f \ No newline at end of file diff --git a/Crawler/olcUTIL_DataFile.h b/Crawler/olcUTIL_DataFile.h index 64535720..bd314505 100644 --- a/Crawler/olcUTIL_DataFile.h +++ b/Crawler/olcUTIL_DataFile.h @@ -501,7 +501,7 @@ namespace olc::utils public: inline datafilefloatdata(datafile&dat,std::string key) :data(dat),key(key){}; - float operator[](int index){return data.get().GetProperty(key).GetReal(index);}; + float operator[](int index){return float(data.get().GetProperty(key).GetReal(index));}; }; class datafiledoubledata { diff --git a/Crawler/safemap.h b/Crawler/safemap.h index 25f0bf6c..b56c3c34 100644 --- a/Crawler/safemap.h +++ b/Crawler/safemap.h @@ -107,7 +107,7 @@ public: } if(!initialized){ size_t originalSize=map.size(); - map[key]=items.size(); + map[key]=int(items.size()); if(originalSize==map.size()){ ERR("WARNING! A previously set value has been overwritten! Key: "<