Added infinite and nan checks for positions.
This commit is contained in:
parent
dfa014b0a9
commit
7cf44b2462
@ -61,7 +61,7 @@ safemap<std::string,std::function<void(Monster&,float,std::string)>>STRATEGY_DAT
|
||||
std::map<std::string,Renderable*>MonsterData::imgs;
|
||||
|
||||
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob):
|
||||
pos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetDisplayName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(DOWN){
|
||||
pos(pos),spawnPos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetDisplayName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(DOWN){
|
||||
bool firstAnimation=true;
|
||||
for(std::string&anim:data.GetAnimations()){
|
||||
animation.AddState(anim,ANIMATION_DATA[anim]);
|
||||
@ -376,6 +376,15 @@ void Monster::Moved(){
|
||||
monsterWalkSoundTimer-=1.f;
|
||||
SoundEffect::PlaySFX(GetWalkSound(),GetPos());
|
||||
}
|
||||
|
||||
if(!std::isfinite(pos.x)){
|
||||
ERR(std::format("WARNING! Player X position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.x));
|
||||
pos.x=spawnPos.x;
|
||||
}
|
||||
if(!std::isfinite(pos.y)){
|
||||
ERR(std::format("WARNING! Player Y position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.y));
|
||||
pos.y=spawnPos.y;
|
||||
}
|
||||
}
|
||||
std::string Monster::GetDeathAnimationName(){
|
||||
return MONSTER_DATA[name].GetDeathAnimation();
|
||||
|
@ -189,6 +189,7 @@ private:
|
||||
float friction=400;
|
||||
vf2d target={0,0};
|
||||
float targetAcquireTimer=0;
|
||||
vf2d spawnPos;
|
||||
int hp;
|
||||
ItemAttributable stats;
|
||||
float size;
|
||||
|
@ -619,7 +619,7 @@ void Player::Update(float fElapsedTime){
|
||||
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>(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/2,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true)));
|
||||
BULLET_LIST.push_back(std::make_unique<Arrow>(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/1.5f,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true)));
|
||||
SetAnimationBasedOnTargetingDirection(angleToCursor);
|
||||
rapidFireTimer=RAPID_FIRE_SHOOT_DELAY;
|
||||
}else{
|
||||
@ -788,6 +788,15 @@ void Player::Moved(){
|
||||
}
|
||||
}
|
||||
EnvironmentalAudio::UpdateEnvironmentalAudio();
|
||||
|
||||
if(!std::isfinite(pos.x)){
|
||||
ERR(std::format("WARNING! Player X position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.x));
|
||||
ForceSetPos({float(game->GetCurrentMapData().playerSpawnLocation.x),pos.y});
|
||||
}
|
||||
if(!std::isfinite(pos.y)){
|
||||
ERR(std::format("WARNING! Player Y position is {}...Trying to recover. THIS SHOULD NOT BE HAPPENING!",pos.y));
|
||||
ForceSetPos({pos.x,float(game->GetCurrentMapData().playerSpawnLocation.y)});
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Spin(float duration,float spinSpd){
|
||||
|
@ -71,7 +71,7 @@ bool Ranger::AutoAttack(){
|
||||
vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
|
||||
float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x);
|
||||
attack_cooldown_timer=ARROW_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||
BULLET_LIST.push_back(std::make_unique<Arrow>(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/2,"Ranger.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true)));
|
||||
BULLET_LIST.push_back(std::make_unique<Arrow>(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/1.5f,"Ranger.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true)));
|
||||
SetState(State::SHOOT_ARROW);
|
||||
SetAnimationBasedOnTargetingDirection(angleToCursor);
|
||||
SoundEffect::PlaySFX("Ranger.Auto Attack.Sound"_S,SoundEffect::CENTERED);
|
||||
|
@ -13,7 +13,6 @@ Settings Menu
|
||||
|
||||
- Fix Stage Completed screen, item displays can hit the scrollbar.
|
||||
- Monster spawn list is not populated in Emscripten?
|
||||
- Random pitch up down +/-10%.
|
||||
|
||||
January 31st
|
||||
============
|
||||
@ -32,6 +31,8 @@ Story proofreading/correcting/storyboarding
|
||||
- Lock up unimplemented classes.
|
||||
- Don't enable all stage plates normally.
|
||||
|
||||
ERR messages become just output messages in release build and won't crash the game.
|
||||
|
||||
- Hide mouse cursor during controller play. Reveal it again during mouse play.
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 6033
|
||||
#define VERSION_BUILD 6037
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user