Fix memory reading error for monsters that used the draw strategy function while dead (m value gets reassigned and lost). Adjust ranger arrow shoot speed slightly. Environmental audio is backwards again?
This commit is contained in:
parent
cbb277cab2
commit
4aaa954d05
@ -1028,7 +1028,7 @@ void AiL::RenderWorld(float fElapsedTime){
|
||||
#pragma endregion
|
||||
|
||||
for(Monster&m:MONSTER_LIST){
|
||||
m.strategyDraw(this);
|
||||
m.strategyDraw(this,m);
|
||||
}
|
||||
|
||||
if(player->GetZ()>0){
|
||||
|
@ -60,7 +60,7 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){
|
||||
m.PerformShootAnimation();
|
||||
m.F(A::CASTING_TIMER)=ConfigFloat("Chargeup Time");
|
||||
m.V(A::LOCKON_POS)=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).vector();
|
||||
m.SetStrategyDrawFunction([&](AiL*game){
|
||||
m.SetStrategyDrawFunction([](AiL*game,Monster&m){
|
||||
if(m.IsAlive()){
|
||||
game->view.DrawRotatedDecal(m.GetPos()+m.V(A::LOCKON_POS),GFX["range_indicator.png"].Decal(),0.f,{12.f,12.f},vf2d{_GetFloat(m,"Smash Attack Diameter",MONSTER_DATA[m.GetName()].GetAIStrategy()),_GetFloat(m,"Smash Attack Diameter",MONSTER_DATA[m.GetName()].GetAIStrategy())}/100.f,{255,255,0,160});
|
||||
}
|
||||
@ -99,7 +99,7 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){
|
||||
}
|
||||
m.spriteRot=0.f;
|
||||
game->SetupWorldShake(0.2f);
|
||||
m.SetStrategyDrawFunction([&](AiL*game){});
|
||||
m.SetStrategyDrawFunction([&](AiL*game,Monster&m){});
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void EnvironmentalAudio::Update(){
|
||||
return; //Do not need to continue processing if the sound is not even going to be heard.
|
||||
}
|
||||
float distRatio=1-distanceFromPlayer/ACTIVATION_RANGE; //0-1 where 1 is full volume.
|
||||
float xDistRatio=(game->GetPlayer()->GetX()-pos.x)/ACTIVATION_RANGE; //0-1 where 1 is full volume.
|
||||
float xDistRatio=(pos.x-game->GetPlayer()->GetX())/ACTIVATION_RANGE; //0-1 where 1 is full volume.
|
||||
|
||||
Audio::Engine().SetVolume(soundInstance,distRatio*SOUND_DATA[audioName].volume);
|
||||
Audio::Engine().SetPan(soundInstance,xDistRatio);
|
||||
|
@ -565,7 +565,7 @@ void Monster::SetZ(float z){
|
||||
this->z=z;
|
||||
}
|
||||
|
||||
void Monster::SetStrategyDrawFunction(std::function<void(AiL*)>func){
|
||||
void Monster::SetStrategyDrawFunction(std::function<void(AiL*,Monster&)>func){
|
||||
strategyDraw=func;
|
||||
}
|
||||
|
||||
|
@ -168,8 +168,8 @@ public:
|
||||
const std::function<void(Monster&,float,std::string)>&GetStrategy()const;
|
||||
void SetSize(float newSize,bool immediate=true);
|
||||
geom2d::circle<float>Hitbox();
|
||||
void SetStrategyDrawFunction(std::function<void(AiL*)>func);
|
||||
std::function<void(AiL*)>strategyDraw=[](AiL*pge){};
|
||||
void SetStrategyDrawFunction(std::function<void(AiL*,Monster&)>func);
|
||||
std::function<void(AiL*,Monster&)>strategyDraw=[](AiL*pge,Monster&m){};
|
||||
const ItemAttributable&GetStats()const;
|
||||
const EventName&GetHurtSound();
|
||||
const EventName&GetDeathSound();
|
||||
|
@ -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,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/2,12*"Ranger.Ability 1.ArrowRadius"_F/100,int(GetAttack()*"Ranger.Ability 1.DamageMult"_F),OnUpperLevel(),true)));
|
||||
SetAnimationBasedOnTargetingDirection(angleToCursor);
|
||||
rapidFireTimer=RAPID_FIRE_SHOOT_DELAY;
|
||||
}else{
|
||||
|
@ -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,"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/2,"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);
|
||||
|
@ -212,10 +212,10 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat
|
||||
}
|
||||
m.SetZ(0);
|
||||
Landed(m.phase);
|
||||
m.SetStrategyDrawFunction([](AiL*game){});
|
||||
m.SetStrategyDrawFunction([](AiL*game,Monster&m){});
|
||||
} else
|
||||
if(m.F(A::JUMP_LANDING_TIMER)<=ConfigFloat("JumpWarningIndicatorTime")){
|
||||
m.SetStrategyDrawFunction([&](AiL*game){
|
||||
m.SetStrategyDrawFunction([](AiL*game,Monster&m){
|
||||
Decal*dec=GFX["range_indicator.png"].Decal();
|
||||
game->view.DrawRotatedDecal(m.GetPos(),dec,0,dec->sprite->Size()/2,vf2d{m.GetSizeMult(),m.GetSizeMult()},RED);
|
||||
});
|
||||
|
@ -86,7 +86,7 @@ void SoundEffect::PlaySFX(const std::string_view eventName,const vf2d&pos){
|
||||
float distanceFromPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),pos).length();
|
||||
if(distanceFromPlayer<soundActivationRange){
|
||||
float distRatio=1-distanceFromPlayer/soundActivationRange; //0-1 where 1 is full volume.
|
||||
float xDistRatio=(game->GetPlayer()->GetX()-pos.x)/soundActivationRange; //0-1 where 1 is full volume.
|
||||
float xDistRatio=(pos.x-game->GetPlayer()->GetX())/soundActivationRange; //0-1 where 1 is full volume.
|
||||
|
||||
float vol=distRatio*sfx.vol;
|
||||
float pan=xDistRatio;
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 5966
|
||||
#define VERSION_BUILD 5969
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -20,7 +20,7 @@ Ranger
|
||||
# Whether or not this ability cancels casts.
|
||||
CancelCast = 0
|
||||
|
||||
ArrowSpd = 250
|
||||
ArrowSpd = 275
|
||||
|
||||
Sound = Ranger Auto Attack
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user